stencil.js 5.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318
  1. /*!
  2. Stencil Compiler v2.18.1 | MIT Licensed | https://stenciljs.com
  3. */
  4. (function(exports) {
  5. 'use strict';
  6. if (typeof globalThis === 'undefined') {
  7. if (typeof self !== 'undefined') {
  8. self.globalThis = self;
  9. } else if (typeof window !== 'undefined') {
  10. window.globalThis = window;
  11. } else if (typeof global !== 'undefined') {
  12. global.globalThis = global;
  13. }
  14. }
  15. const Buffer = globalThis.Buffer || {};
  16. const process = globalThis.process || {};
  17. if (!process.argv) {
  18. process.argv = [''];
  19. }
  20. let __cwd = '/';
  21. if (!process.cwd) {
  22. process.cwd = () => __cwd;
  23. }
  24. if (!process.chdir) {
  25. process.chdir = (v) => __cwd = v;
  26. }
  27. if (!process.nextTick) {
  28. const resolved = Promise.resolve();
  29. process.nextTick = (cb) => resolved.then(cb);
  30. }
  31. if (!process.platform) {
  32. process.platform = 'stencil';
  33. }
  34. if (!process.version) {
  35. process.version = 'v12.0.0';
  36. }
  37. process.browser = !!globalThis.location;
  38. const IS_NODE_ENV = typeof global !== 'undefined' &&
  39. typeof require === 'function' &&
  40. !!global.process &&
  41. typeof __filename === 'string' &&
  42. (!global.origin || typeof global.origin !== 'string');
  43. const OS_PLATFORM = IS_NODE_ENV ? process.platform : '';
  44. const IS_WINDOWS_ENV = OS_PLATFORM === 'win32';
  45. const IS_CASE_SENSITIVE_FILE_NAMES = !IS_WINDOWS_ENV;
  46. const IS_BROWSER_ENV = typeof location !== 'undefined' && typeof navigator !== 'undefined' && typeof XMLHttpRequest !== 'undefined';
  47. const IS_WEB_WORKER_ENV = IS_BROWSER_ENV && typeof self !== 'undefined' && typeof self.importScripts === 'function';
  48. const HAS_WEB_WORKER = IS_BROWSER_ENV && typeof Worker === 'function';
  49. const IS_FETCH_ENV = typeof fetch === 'function';
  50. const requireFunc = IS_NODE_ENV ? require : () => { };
  51. const getCurrentDirectory = IS_NODE_ENV ? process.cwd : () => '/';
  52. process.browser=!IS_NODE_ENV;const t={};var r,n$4=undefined&&undefined.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},i$1=undefined&&undefined.__assign||function(){return (i$1=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=undefined&&undefined.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},o=undefined&&undefined.__generator||function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o);}catch(e){a=[6,e],n=0;}finally{r=i=0;}if(5&a[0])throw a[1];return {value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},s=undefined&&undefined.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);}return r},c=undefined&&undefined.__extends||(r=function(e,t){return (r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e;}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n);});!function(e){function t(){var e={};return e.prev=e,{head:e,tail:e,size:0}}function r(e,t){return e===t||e!=e&&t!=t}function n(e){var t=e.prev;if(!t||t===e)throw new Error("Illegal state");return t}function i(e){for(;e;){var t=!e.prev;if(e=e.next,!t)return e}}function a(e,t){for(var i=e.tail;i!==e.head;i=n(i))if(r(i.key,t))return i}function o(e,t,r){var n=a(e,t);if(!n){var i=function(e,t){return {key:e,value:t,next:void 0,prev:void 0}}(t,r);return i.prev=e.tail,e.tail.next=i,e.tail=i,e.size++,i}n.value=r;}function s(e,t){for(var i=e.tail;i!==e.head;i=n(i)){if(void 0===i.prev)throw new Error("Illegal state");if(r(i.key,t)){if(i.next)i.next.prev=i.prev;else {if(e.tail!==i)throw new Error("Illegal state");e.tail=i.prev;}return i.prev.next=i.next,i.next=i.prev,i.prev=void 0,e.size--,i}}}function c(e){for(var t=e.tail;t!==e.head;){var r=n(t);t.next=e.head,t.prev=void 0,t=r;}e.head.next=void 0,e.tail=e.head,e.size=0;}function l(e,t){for(var r=e.head;r;)(r=i(r))&&t(r.value,r.key);}function u(e,t){if(e)for(var r=e.next();!r.done;r=e.next())t(r.value);}function _(e,t){return {current:e.head,selector:t}}function d(e){return e.current=i(e.current),e.current?{value:e.selector(e.current.key,e.current.value),done:!1}:{value:void 0,done:!0}}var p;(p=e.ShimCollections||(e.ShimCollections={})).createMapShim=function(e){var r=function(){function e(e,t){this._data=_(e,t);}return e.prototype.next=function(){return d(this._data)},e}();return function(){function n(r){var n=this;this._mapData=t(),u(e(r),(function(e){var t=e[0],r=e[1];return n.set(t,r)}));}return Object.defineProperty(n.prototype,"size",{get:function(){return this._mapData.size},enumerable:!1,configurable:!0}),n.prototype.get=function(e){var t;return null===(t=a(this._mapData,e))||void 0===t?void 0:t.value},n.prototype.set=function(e,t){return o(this._mapData,e,t),this},n.prototype.has=function(e){return !!a(this._mapData,e)},n.prototype.delete=function(e){return !!s(this._mapData,e)},n.prototype.clear=function(){c(this._mapData);},n.prototype.keys=function(){return new r(this._mapData,(function(e,t){return e}))},n.prototype.values=function(){return new r(this._mapData,(function(e,t){return t}))},n.prototype.entries=function(){return new r(this._mapData,(function(e,t){return [e,t]}))},n.prototype.forEach=function(e){l(this._mapData,e);},n}()},p.createSetShim=function(e){var r=function(){function e(e,t){this._data=_(e,t);}return e.prototype.next=function(){return d(this._data)},e}();return function(){function n(r){var n=this;this._mapData=t(),u(e(r),(function(e){return n.add(e)}));}return Object.defineProperty(n.prototype,"size",{get:function(){return this._mapData.size},enumerable:!1,configurable:!0}),n.prototype.add=function(e){return o(this._mapData,e,e),this},n.prototype.has=function(e){return !!a(this._mapData,e)},n.prototype.delete=function(e){return !!s(this._mapData,e)},n.prototype.clear=function(){c(this._mapData);},n.prototype.keys=function(){return new r(this._mapData,(function(e,t){return e}))},n.prototype.values=function(){return new r(this._mapData,(function(e,t){return t}))},n.prototype.entries=function(){return new r(this._mapData,(function(e,t){return [e,t]}))},n.prototype.forEach=function(e){l(this._mapData,e);},n}()};}(t),function(e){var t,r;function n(r,n,i){var a,o=null!==(a=t[n]())&&void 0!==a?a:null===e.ShimCollections||void 0===e.ShimCollections?void 0:e.ShimCollections[i](e.getIterator);if(o)return o;throw new Error("TypeScript requires an environment that provides a compatible native ".concat(r," implementation."))}e.versionMajorMinor="4.7",e.version="4.7.4",(r=e.Comparison||(e.Comparison={}))[r.LessThan=-1]="LessThan",r[r.EqualTo=0]="EqualTo",r[r.GreaterThan=1]="GreaterThan",function(e){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;e.tryGetNativeMap=function(){var e=null==t?void 0:t.Map;return void 0!==e&&"entries"in e.prototype&&1===new e([[0,0]]).size?e:void 0},e.tryGetNativeSet=function(){var e=null==t?void 0:t.Set;return void 0!==e&&"entries"in e.prototype&&1===new e([0]).size?e:void 0};}(t||(t={})),e.Map=n("Map","tryGetNativeMap","createMapShim"),e.Set=n("Set","tryGetNativeSet","createSetShim");}(t),function(e){function t(e,t,r){if(void 0===r&&(r=I),e)for(var n=0,i=e;n<i.length;n++)if(r(i[n],t))return !0;return !1}function r(e,t){if(e){if(!t)return e.length>0;for(var r=0,n=e;r<n.length;r++)if(t(n[r]))return !0}return !1}function i(e,t){return r(t)?r(e)?n$4(n$4([],e,!0),t,!0):t:e}function a(e,t){return t}function o(e){return e.map(a)}function s(e,t){return void 0===t?e:void 0===e?[t]:(e.push(t),e)}function c(e,t){return t<0?e.length+t:t}function l(e,t,r,n){if(void 0===t||0===t.length)return e;if(void 0===e)return t.slice(r,n);r=void 0===r?0:c(t,r),n=void 0===n?t.length:c(t,n);for(var i=r;i<n&&i<t.length;i++)void 0!==t[i]&&e.push(t[i]);return e}function u(e,r,n){return !t(e,r,n)&&(e.push(r),!0)}function _(e,t,r){t.sort((function(t,n){return r(e[t],e[n])||M(t,n)}));}function d(e,t){return 0===e.length?e:e.slice().sort(t)}function p(e){var t=0;return {next:function(){return t===e.length?{value:void 0,done:!0}:(t++,{value:e[t-1],done:!1})}}}function f(e,t,r,n,i){return g(e,r(t),r,n,i)}function g(e,t,n,i,a){if(!r(e))return -1;for(var o=a||0,s=e.length-1;o<=s;){var c=o+(s-o>>1);switch(i(n(e[c],c),t)){case-1:o=c+1;break;case 0:return c;case 1:s=c-1;}}return ~o}function m(e,t,r,n,i){if(e&&e.length>0){var a=e.length;if(a>0){var o=void 0===n||n<0?0:n,s=void 0===i||o+i>a-1?a-1:o+i,c=void 0;for(arguments.length<=2?(c=e[o],o++):c=r;o<=s;)c=t(c,e[o],o),o++;return c}}return r}e.getIterator=function(t){if(t){if(k(t))return p(t);if(t instanceof e.Map)return t.entries();if(t instanceof e.Set)return t.values();throw new Error("Iteration not supported.")}},e.emptyArray=[],e.emptyMap=new e.Map,e.emptySet=new e.Set,e.length=function(e){return e?e.length:0},e.forEach=function(e,t){if(e)for(var r=0;r<e.length;r++){var n=t(e[r],r);if(n)return n}},e.forEachRight=function(e,t){if(e)for(var r=e.length-1;r>=0;r--){var n=t(e[r],r);if(n)return n}},e.firstDefined=function(e,t){if(void 0!==e)for(var r=0;r<e.length;r++){var n=t(e[r],r);if(void 0!==n)return n}},e.firstDefinedIterator=function(e,t){for(;;){var r=e.next();if(r.done)return;var n=t(r.value);if(void 0!==n)return n}},e.reduceLeftIterator=function(e,t,r){var n=r;if(e)for(var i=e.next(),a=0;!i.done;i=e.next(),a++)n=t(n,i.value,a);return n},e.zipWith=function(t,r,n){var i=[];e.Debug.assertEqual(t.length,r.length);for(var a=0;a<t.length;a++)i.push(n(t[a],r[a],a));return i},e.zipToIterator=function(t,r){e.Debug.assertEqual(t.length,r.length);var n=0;return {next:function(){return n===t.length?{value:void 0,done:!0}:(n++,{value:[t[n-1],r[n-1]],done:!1})}}},e.zipToMap=function(t,r){e.Debug.assert(t.length===r.length);for(var n=new e.Map,i=0;i<t.length;++i)n.set(t[i],r[i]);return n},e.intersperse=function(e,t){if(e.length<=1)return e;for(var r=[],n=0,i=e.length;n<i;n++)n&&r.push(t),r.push(e[n]);return r},e.every=function(e,t){if(e)for(var r=0;r<e.length;r++)if(!t(e[r],r))return !1;return !0},e.find=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(t(n,r))return n}},e.findLast=function(e,t){for(var r=e.length-1;r>=0;r--){var n=e[r];if(t(n,r))return n}},e.findIndex=function(e,t,r){for(var n=r||0;n<e.length;n++)if(t(e[n],n))return n;return -1},e.findLastIndex=function(e,t,r){for(var n=void 0===r?e.length-1:r;n>=0;n--)if(t(e[n],n))return n;return -1},e.findMap=function(t,r){for(var n=0;n<t.length;n++){var i=r(t[n],n);if(i)return i}return e.Debug.fail()},e.contains=t,e.arraysEqual=function(e,t,r){return void 0===r&&(r=I),e.length===t.length&&e.every((function(e,n){return r(e,t[n])}))},e.indexOfAnyCharCode=function(e,r,n){for(var i=n||0;i<e.length;i++)if(t(r,e.charCodeAt(i)))return i;return -1},e.countWhere=function(e,t){var r=0;if(e)for(var n=0;n<e.length;n++)t(e[n],n)&&r++;return r},e.filter=function(e,t){if(e){for(var r=e.length,n=0;n<r&&t(e[n]);)n++;if(n<r){var i=e.slice(0,n);for(n++;n<r;){var a=e[n];t(a)&&i.push(a),n++;}return i}}return e},e.filterMutate=function(e,t){for(var r=0,n=0;n<e.length;n++)t(e[n],n,e)&&(e[r]=e[n],r++);e.length=r;},e.clear=function(e){e.length=0;},e.map=function(e,t){var r;if(e){r=[];for(var n=0;n<e.length;n++)r.push(t(e[n],n));}return r},e.mapIterator=function(e,t){return {next:function(){var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}},e.sameMap=function(e,t){if(e)for(var r=0;r<e.length;r++){var n=e[r],i=t(n,r);if(n!==i){var a=e.slice(0,r);for(a.push(i),r++;r<e.length;r++)a.push(t(e[r],r));return a}}return e},e.flatten=function(e){for(var t=[],r=0,n=e;r<n.length;r++){var i=n[r];i&&(k(i)?l(t,i):t.push(i));}return t},e.flatMap=function(t,r){var n;if(t)for(var i=0;i<t.length;i++){var a=r(t[i],i);a&&(n=k(a)?l(n,a):s(n,a));}return n||e.emptyArray},e.flatMapToMutable=function(e,t){var r=[];if(e)for(var n=0;n<e.length;n++){var i=t(e[n],n);i&&(k(i)?l(r,i):r.push(i));}return r},e.flatMapIterator=function(t,r){var n=t.next();if(n.done)return e.emptyIterator;var i=a(n.value);return {next:function(){for(;;){var e=i.next();if(!e.done)return e;var r=t.next();if(r.done)return r;i=a(r.value);}}};function a(t){var n=r(t);return void 0===n?e.emptyIterator:k(n)?p(n):n}},e.sameFlatMap=function(e,t){var r;if(e)for(var n=0;n<e.length;n++){var i=e[n],a=t(i,n);(r||i!==a||k(a))&&(r||(r=e.slice(0,n)),k(a)?l(r,a):r.push(a));}return r||e},e.mapAllOrFail=function(e,t){for(var r=[],n=0;n<e.length;n++){var i=t(e[n],n);if(void 0===i)return;r.push(i);}return r},e.mapDefined=function(e,t){var r=[];if(e)for(var n=0;n<e.length;n++){var i=t(e[n],n);void 0!==i&&r.push(i);}return r},e.mapDefinedIterator=function(e,t){return {next:function(){for(;;){var r=e.next();if(r.done)return r;var n=t(r.value);if(void 0!==n)return {value:n,done:!1}}}}},e.mapDefinedEntries=function(t,r){if(t){var n=new e.Map;return t.forEach((function(e,t){var i=r(t,e);if(void 0!==i){var a=i[0],o=i[1];void 0!==a&&void 0!==o&&n.set(a,o);}})),n}},e.mapDefinedValues=function(t,r){if(t){var n=new e.Set;return t.forEach((function(e){var t=r(e);void 0!==t&&n.add(t);})),n}},e.getOrUpdate=function(e,t,r){if(e.has(t))return e.get(t);var n=r();return e.set(t,n),n},e.tryAddToSet=function(e,t){return !e.has(t)&&(e.add(t),!0)},e.emptyIterator={next:function(){return {value:void 0,done:!0}}},e.singleIterator=function(e){var t=!1;return {next:function(){var r=t;return t=!0,r?{value:void 0,done:!0}:{value:e,done:!1}}}},e.spanMap=function(e,t,r){var n;if(e){n=[];for(var i=e.length,a=void 0,o=void 0,s=0,c=0;s<i;){for(;c<i;){if(o=t(e[c],c),0===c)a=o;else if(o!==a)break;c++;}if(s<c){var l=r(e.slice(s,c),a,s,c);l&&n.push(l),s=c;}a=o,c++;}}return n},e.mapEntries=function(t,r){if(t){var n=new e.Map;return t.forEach((function(e,t){var i=r(t,e),a=i[0],o=i[1];n.set(a,o);})),n}},e.some=r,e.getRangesWhere=function(e,t,r){for(var n,i=0;i<e.length;i++)t(e[i])?n=void 0===n?i:n:void 0!==n&&(r(n,i),n=void 0);void 0!==n&&r(n,e.length);},e.concatenate=i,e.indicesOf=o,e.deduplicate=function(e,t,r){return 0===e.length?[]:1===e.length?e.slice():r?function(e,t,r){var n=o(e);_(e,n,r);for(var i=e[n[0]],a=[n[0]],s=1;s<n.length;s++){var c=n[s],l=e[c];t(i,l)||(a.push(c),i=l);}return a.sort(),a.map((function(t){return e[t]}))}(e,t,r):function(e,t){for(var r=[],n=0,i=e;n<i.length;n++)u(r,i[n],t);return r}(e,t)},e.createSortedArray=function(){return []},e.insertSorted=function(e,t,r,n){if(0!==e.length){var i=f(e,t,N,r);i<0?e.splice(~i,0,t):n&&e.splice(i,0,t);}else e.push(t);},e.sortAndDeduplicate=function(t,r,n){return function(t,r){if(0===t.length)return e.emptyArray;for(var n=t[0],i=[n],a=1;a<t.length;a++){var o=t[a];switch(r(o,n)){case!0:case 0:continue;case-1:return e.Debug.fail("Array is unsorted.")}i.push(n=o);}return i}(d(t,r),n||r||R)},e.arrayIsSorted=function(e,t){if(e.length<2)return !0;for(var r=e[0],n=0,i=e.slice(1);n<i.length;n++){var a=i[n];if(1===t(r,a))return !1;r=a;}return !0},e.arrayIsEqualTo=function(e,t,r){if(void 0===r&&(r=I),!e||!t)return e===t;if(e.length!==t.length)return !1;for(var n=0;n<e.length;n++)if(!r(e[n],t[n],n))return !1;return !0},e.compact=function(e){var t;if(e)for(var r=0;r<e.length;r++){var n=e[r];!t&&n||(t||(t=e.slice(0,r)),n&&t.push(n));}return t||e},e.relativeComplement=function(t,r,n){if(!r||!t||0===r.length||0===t.length)return r;var i=[];e:for(var a=0,o=0;o<r.length;o++){o>0&&e.Debug.assertGreaterThanOrEqual(n(r[o],r[o-1]),0);t:for(var s=a;a<t.length;a++)switch(a>s&&e.Debug.assertGreaterThanOrEqual(n(t[a],t[a-1]),0),n(r[o],t[a])){case-1:i.push(r[o]);continue e;case 0:continue e;case 1:continue t}}return i},e.sum=function(e,t){for(var r=0,n=0,i=e;n<i.length;n++)r+=i[n][t];return r},e.append=s,e.combine=function(e,t){return void 0===e?t:void 0===t?e:k(e)?k(t)?i(e,t):s(e,t):k(t)?s(t,e):[e,t]},e.addRange=l,e.pushIfUnique=u,e.appendIfUnique=function(e,t,r){return e?(u(e,t,r),e):[t]},e.sort=d,e.arrayIterator=p,e.arrayReverseIterator=function(e){var t=e.length;return {next:function(){return 0===t?{value:void 0,done:!0}:(t--,{value:e[t],done:!1})}}},e.stableSort=function(e,t){var r=o(e);return _(e,r,t),r.map((function(t){return e[t]}))},e.rangeEquals=function(e,t,r,n){for(;r<n;){if(e[r]!==t[r])return !1;r++;}return !0},e.elementAt=function(e,t){if(e&&(t=c(e,t))<e.length)return e[t]},e.firstOrUndefined=function(e){return 0===e.length?void 0:e[0]},e.first=function(t){return e.Debug.assert(0!==t.length),t[0]},e.lastOrUndefined=function(e){return 0===e.length?void 0:e[e.length-1]},e.last=function(t){return e.Debug.assert(0!==t.length),t[t.length-1]},e.singleOrUndefined=function(e){return e&&1===e.length?e[0]:void 0},e.singleOrMany=function(e){return e&&1===e.length?e[0]:e},e.replaceElement=function(e,t,r){var n=e.slice(0);return n[t]=r,n},e.binarySearch=f,e.binarySearchKey=g,e.reduceLeft=m;var y=Object.prototype.hasOwnProperty;function v(e,t){return y.call(e,t)}function h(e){var t=[];for(var r in e)y.call(e,r)&&t.push(r);return t}e.hasProperty=v,e.getProperty=function(e,t){return y.call(e,t)?e[t]:void 0},e.getOwnKeys=h,e.getAllKeys=function(e){var t=[];do{for(var r=0,n=Object.getOwnPropertyNames(e);r<n.length;r++)u(t,n[r]);}while(e=Object.getPrototypeOf(e));return t},e.getOwnValues=function(e){var t=[];for(var r in e)y.call(e,r)&&t.push(e[r]);return t};var b=Object.entries||function(e){for(var t=h(e),r=Array(t.length),n=0;n<t.length;n++)r[n]=[t[n],e[t[n]]];return r};function x(e,t){for(var r=[],n=e.next();!n.done;n=e.next())r.push(t?t(n.value):n.value);return r}function D(e,t,r){void 0===r&&(r=N);for(var n=S(),i=0,a=e;i<a.length;i++){var o=a[i];n.add(t(o),r(o));}return n}function S(){var t=new e.Map;return t.add=T,t.remove=C,t}function T(e,t){var r=this.get(e);return r?r.push(t):this.set(e,r=[t]),r}function C(e,t){var r=this.get(e);r&&(q(r,t),r.length||this.delete(e));}function k(e){return Array.isArray?Array.isArray(e):e instanceof Array}function E(e){}function N(e){return e}function F(e){return e.toLowerCase()}e.getEntries=function(e){return e?b(e):[]},e.arrayOf=function(e,t){for(var r=new Array(e),n=0;n<e;n++)r[n]=t(n);return r},e.arrayFrom=x,e.assign=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0,i=t;n<i.length;n++){var a=i[n];if(void 0!==a)for(var o in a)v(a,o)&&(e[o]=a[o]);}return e},e.equalOwnProperties=function(e,t,r){if(void 0===r&&(r=I),e===t)return !0;if(!e||!t)return !1;for(var n in e)if(y.call(e,n)){if(!y.call(t,n))return !1;if(!r(e[n],t[n]))return !1}for(var n in t)if(y.call(t,n)&&!y.call(e,n))return !1;return !0},e.arrayToMap=function(t,r,n){void 0===n&&(n=N);for(var i=new e.Map,a=0,o=t;a<o.length;a++){var s=o[a],c=r(s);void 0!==c&&i.set(c,n(s));}return i},e.arrayToNumericMap=function(e,t,r){void 0===r&&(r=N);for(var n=[],i=0,a=e;i<a.length;i++){var o=a[i];n[t(o)]=r(o);}return n},e.arrayToMultiMap=D,e.group=function(e,t,r){return void 0===r&&(r=N),x(D(e,t).values(),r)},e.clone=function(e){var t={};for(var r in e)y.call(e,r)&&(t[r]=e[r]);return t},e.extend=function(e,t){var r={};for(var n in t)y.call(t,n)&&(r[n]=t[n]);for(var n in e)y.call(e,n)&&(r[n]=e[n]);return r},e.copyProperties=function(e,t){for(var r in t)y.call(t,r)&&(e[r]=t[r]);},e.maybeBind=function(e,t){return t?t.bind(e):void 0},e.createMultiMap=S,e.createUnderscoreEscapedMultiMap=function(){return S()},e.createSet=function(r,n){var i=new e.Map,a=0;function o(){var e,t=i.values();return {next:function(){for(;;)if(e){if(!(r=e.next()).done)return {value:r.value};e=void 0;}else {var r;if((r=t.next()).done)return {value:void 0,done:!0};if(!k(r.value))return {value:r.value};e=p(r.value);}}}}return {has:function(e){var t=r(e);if(!i.has(t))return !1;var a=i.get(t);if(!k(a))return n(a,e);for(var o=0,s=a;o<s.length;o++){var c=s[o];if(n(c,e))return !0}return !1},add:function(e){var o=r(e);if(i.has(o)){var s=i.get(o);if(k(s))t(s,e,n)||(s.push(e),a++);else {var c=s;n(c,e)||(i.set(o,[c,e]),a++);}}else i.set(o,e),a++;return this},delete:function(e){var t=r(e);if(!i.has(t))return !1;var o=i.get(t);if(k(o)){for(var s=0;s<o.length;s++)if(n(o[s],e))return 1===o.length?i.delete(t):2===o.length?i.set(t,o[1-s]):V(o,s),a--,!0}else if(n(o,e))return i.delete(t),a--,!0;return !1},clear:function(){i.clear(),a=0;},get size(){return a},forEach:function(e){for(var t=0,r=x(i.values());t<r.length;t++){var n=r[t];if(k(n))for(var a=0,o=n;a<o.length;a++){var s;e(s=o[a],s);}else e(s=n,s);}},keys:function(){return o()},values:function(){return o()},entries:function(){var e=o();return {next:function(){var t=e.next();return t.done?t:{value:[t.value,t.value]}}}}}},e.isArray=k,e.toArray=function(e){return k(e)?e:[e]},e.isString=function(e){return "string"==typeof e},e.isNumber=function(e){return "number"==typeof e},e.tryCast=function(e,t){return void 0!==e&&t(e)?e:void 0},e.cast=function(t,r){return void 0!==t&&r(t)?t:e.Debug.fail("Invalid cast. The supplied value ".concat(t," did not pass the test '").concat(e.Debug.getFunctionName(r),"'."))},e.noop=E,e.returnFalse=function(){return !1},e.returnTrue=function(){return !0},e.returnUndefined=function(){},e.identity=N,e.toLowerCase=F;var A,P=/[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;function w(e){return P.test(e)?e.replace(P,F):e}function I(e,t){return e===t}function O(e,t){return e===t?0:void 0===e?-1:void 0===t?1:e<t?-1:1}function M(e,t){return O(e,t)}function L(e,t){return e===t?0:void 0===e?-1:void 0===t?1:(e=e.toUpperCase())<(t=t.toUpperCase())?-1:e>t?1:0}function R(e,t){return O(e,t)}e.toFileNameLowerCase=w,e.notImplemented=function(){throw new Error("Not implemented")},e.memoize=function(e){var t;return function(){return e&&(t=e(),e=void 0),t}},e.memoizeOne=function(t){var r=new e.Map;return function(e){var n="".concat(typeof e,":").concat(e),i=r.get(n);return void 0!==i||r.has(n)||(i=t(e),r.set(n,i)),i}},e.compose=function(e,t,r,n,i){if(i){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];return function(e){return m(a,(function(e,t){return t(e)}),e)}}return n?function(i){return n(r(t(e(i))))}:r?function(n){return r(t(e(n)))}:t?function(r){return t(e(r))}:e?function(t){return e(t)}:function(e){return e}},(A=e.AssertionLevel||(e.AssertionLevel={}))[A.None=0]="None",A[A.Normal=1]="Normal",A[A.Aggressive=2]="Aggressive",A[A.VeryAggressive=3]="VeryAggressive",e.equateValues=I,e.equateStringsCaseInsensitive=function(e,t){return e===t||void 0!==e&&void 0!==t&&e.toUpperCase()===t.toUpperCase()},e.equateStringsCaseSensitive=function(e,t){return I(e,t)},e.compareValues=M,e.compareTextSpans=function(e,t){return M(null==e?void 0:e.start,null==t?void 0:t.start)||M(null==e?void 0:e.length,null==t?void 0:t.length)},e.min=function(e,t,r){return -1===r(e,t)?e:t},e.compareStringsCaseInsensitive=L,e.compareStringsCaseSensitive=R,e.getStringComparer=function(e){return e?L:R};var B,j,J=function(){var e,t,r="object"==typeof Intl&&"function"==typeof Intl.Collator?i:"function"==typeof String.prototype.localeCompare&&"function"==typeof String.prototype.toLocaleUpperCase&&"a".localeCompare("B")<0?a:o;return function(n){return void 0===n?e||(e=r(n)):"en-US"===n?t||(t=r(n)):r(n)};function n(e,t,r){if(e===t)return 0;if(void 0===e)return -1;if(void 0===t)return 1;var n=r(e,t);return n<0?-1:n>0?1:0}function i(e){var t=new Intl.Collator(e,{usage:"sort",sensitivity:"variant"}).compare;return function(e,r){return n(e,r,t)}}function a(e){return void 0!==e?o():function(e,r){return n(e,r,t)};function t(e,t){return e.localeCompare(t)}}function o(){return function(t,r){return n(t,r,e)};function e(e,r){return t(e.toUpperCase(),r.toUpperCase())||t(e,r)}function t(e,t){return e<t?-1:e>t?1:0}}}();function z(e,t,r){for(var n=new Array(t.length+1),i=new Array(t.length+1),a=r+.01,o=0;o<=t.length;o++)n[o]=o;for(o=1;o<=e.length;o++){var s=e.charCodeAt(o-1),c=Math.ceil(o>r?o-r:1),l=Math.floor(t.length>r+o?r+o:t.length);i[0]=o;for(var u=o,_=1;_<c;_++)i[_]=a;for(_=c;_<=l;_++){var d=e[o-1].toLowerCase()===t[_-1].toLowerCase()?n[_-1]+.1:n[_-1]+2,p=s===t.charCodeAt(_-1)?n[_-1]:Math.min(n[_]+1,i[_-1]+1,d);i[_]=p,u=Math.min(u,p);}for(_=l+1;_<=t.length;_++)i[_]=a;if(u>r)return;var f=n;n=i,i=f;}var g=n[t.length];return g>r?void 0:g}function K(e,t){var r=e.length-t.length;return r>=0&&e.indexOf(t,r)===r}function U(e,t){for(var r=t;r<e.length-1;r++)e[r]=e[r+1];e.pop();}function V(e,t){e[t]=e[e.length-1],e.pop();}function q(e,t){return function(e,r){for(var n=0;n<e.length;n++)if(e[n]===t)return V(e,n),!0;return !1}(e)}function W(e,t){return 0===e.lastIndexOf(t,0)}function H(e,t){var r=e.prefix,n=e.suffix;return t.length>=r.length+n.length&&W(t,r)&&K(t,n)}function G(e,t,r,n){for(var i=0,a=e[n];i<a.length;i++){var o=a[i],s=void 0;r?(s=r.slice()).push(o):s=[o],n===e.length-1?t.push(s):G(e,t,s,n+1);}}e.getUILocale=function(){return j},e.setUILocale=function(e){j!==e&&(j=e,B=void 0);},e.compareStringsCaseSensitiveUI=function(e,t){return (B||(B=J(j)))(e,t)},e.compareProperties=function(e,t,r,n){return e===t?0:void 0===e?-1:void 0===t?1:n(e[r],t[r])},e.compareBooleans=function(e,t){return M(e?1:0,t?1:0)},e.getSpellingSuggestion=function(t,r,n){for(var i,a=Math.min(2,Math.floor(.34*t.length)),o=Math.floor(.4*t.length)+1,s=0,c=r;s<c.length;s++){var l=c[s],u=n(l);if(void 0!==u&&Math.abs(u.length-t.length)<=a){if(u===t)continue;if(u.length<3&&u.toLowerCase()!==t.toLowerCase())continue;var _=z(t,u,o-.1);if(void 0===_)continue;e.Debug.assert(_<o),o=_,i=l;}}return i},e.endsWith=K,e.removeSuffix=function(e,t){return K(e,t)?e.slice(0,e.length-t.length):e},e.tryRemoveSuffix=function(e,t){return K(e,t)?e.slice(0,e.length-t.length):void 0},e.stringContains=function(e,t){return -1!==e.indexOf(t)},e.removeMinAndVersionNumbers=function(e){for(var t=e.length,r=t-1;r>0;r--){var n=e.charCodeAt(r);if(n>=48&&n<=57)do{--r,n=e.charCodeAt(r);}while(r>0&&n>=48&&n<=57);else {if(!(r>4)||110!==n&&78!==n)break;if(--r,105!==(n=e.charCodeAt(r))&&73!==n)break;if(--r,109!==(n=e.charCodeAt(r))&&77!==n)break;--r,n=e.charCodeAt(r);}if(45!==n&&46!==n)break;t=r;}return t===e.length?e:e.slice(0,t)},e.orderedRemoveItem=function(e,t){for(var r=0;r<e.length;r++)if(e[r]===t)return U(e,r),!0;return !1},e.orderedRemoveItemAt=U,e.unorderedRemoveItemAt=V,e.unorderedRemoveItem=q,e.createGetCanonicalFileName=function(e){return e?N:w},e.patternText=function(e){var t=e.prefix,r=e.suffix;return "".concat(t,"*").concat(r)},e.matchedText=function(t,r){return e.Debug.assert(H(t,r)),r.substring(t.prefix.length,r.length-t.suffix.length)},e.findBestPatternMatch=function(e,t,r){for(var n,i=-1,a=0,o=e;a<o.length;a++){var s=o[a],c=t(s);H(c,r)&&c.prefix.length>i&&(i=c.prefix.length,n=s);}return n},e.startsWith=W,e.removePrefix=function(e,t){return W(e,t)?e.substr(t.length):e},e.tryRemovePrefix=function(e,t,r){return void 0===r&&(r=N),W(r(e),r(t))?e.substring(t.length):void 0},e.and=function(e,t){return function(r){return e(r)&&t(r)}},e.or=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var i=0,a=e;i<a.length;i++){var o=a[i];if(t=o.apply(void 0,r))return t}return t}},e.not=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return !e.apply(void 0,t)}},e.assertType=function(e){},e.singleElementArray=function(e){return void 0===e?void 0:[e]},e.enumerateInsertsAndDeletes=function(e,t,r,n,i,a){a=a||E;for(var o=0,s=0,c=e.length,l=t.length,u=!1;o<c&&s<l;){var _=e[o],d=t[s],p=r(_,d);-1===p?(n(_),o++,u=!0):1===p?(i(d),s++,u=!0):(a(d,_),o++,s++);}for(;o<c;)n(e[o++]),u=!0;for(;s<l;)i(t[s++]),u=!0;return u},e.fill=function(e,t){for(var r=Array(e),n=0;n<e;n++)r[n]=t(n);return r},e.cartesianProduct=function(e){var t=[];return G(e,t,void 0,0),t},e.padLeft=function(e,t,r){return void 0===r&&(r=" "),t<=e.length?e:r.repeat(t-e.length)+e},e.padRight=function(e,t,r){return void 0===r&&(r=" "),t<=e.length?e:e+r.repeat(t-e.length)},e.takeWhile=function(e,t){for(var r=e.length,n=0;n<r&&t(e[n]);)n++;return e.slice(0,n)},e.trimString=String.prototype.trim?function(e){return e.trim()}:function(t){return e.trimStringEnd(e.trimStringStart(t))},e.trimStringEnd=String.prototype.trimEnd?function(e){return e.trimEnd()}:function(t){for(var r=t.length-1;r>=0&&e.isWhiteSpaceLike(t.charCodeAt(r));)r--;return t.slice(0,r+1)},e.trimStringStart=String.prototype.trimStart?function(e){return e.trimStart()}:function(e){return e.replace(/^\s+/g,"")};}(t),function(e){var t;!function(e){e[e.Off=0]="Off",e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Info=3]="Info",e[e.Verbose=4]="Verbose";}(t=e.LogLevel||(e.LogLevel={})),function(r){var n,i,a=0;function o(){return null!=n?n:n=new e.Version(e.version)}function s(e){return r.currentLogLevel<=e}function c(e,t){r.loggingHost&&s(e)&&r.loggingHost.log(e,t);}function l(e){c(t.Info,e);}r.currentLogLevel=t.Warning,r.isDebugging=!1,r.getTypeScriptVersion=o,r.shouldLog=s,r.log=l,(i=l=r.log||(r.log={})).error=function(e){c(t.Error,e);},i.warn=function(e){c(t.Warning,e);},i.log=function(e){c(t.Info,e);},i.trace=function(e){c(t.Verbose,e);};var u={};function _(e){return a>=e}function d(t,n){return !!_(t)||(u[n]={level:t,assertion:r[n]},r[n]=e.noop,!1)}function p(e,t){var r=new Error(e?"Debug Failure. ".concat(e):"Debug Failure.");throw Error.captureStackTrace&&Error.captureStackTrace(r,t||p),r}function f(e,t,r,n){e||(t=t?"False expression: ".concat(t):"False expression.",r&&(t+="\r\nVerbose Debug Information: "+("string"==typeof r?r:r())),p(t,n||f));}function g(e,t,r){null==e&&p(t,r||g);}function m(e,t,r){for(var n=0,i=e;n<i.length;n++)g(i[n],t,r||m);}function y(e){if("function"!=typeof e)return "";if(e.hasOwnProperty("name"))return e.name;var t=Function.prototype.toString.call(e),r=/^function\s+([\w\$]+)\s*\(/.exec(t);return r?r[1]:""}function v(t,r,n){void 0===t&&(t=0);var i=function(t){var r=[];for(var n in t){var i=t[n];"number"==typeof i&&r.push([i,n]);}return e.stableSort(r,(function(t,r){return e.compareValues(t[0],r[0])}))}(r);if(0===t)return i.length>0&&0===i[0][0]?i[0][1]:"0";if(n){for(var a="",o=t,s=0,c=i;s<c.length;s++){var l=c[s],u=l[0],_=l[1];if(u>t)break;0!==u&&u&t&&(a="".concat(a).concat(a?"|":"").concat(_),o&=~u);}if(0===o)return a}else for(var d=0,p=i;d<p.length;d++){var f=p[d];if(u=f[0],_=f[1],u===t)return _}return t.toString()}function h(t){return v(t,e.SyntaxKind,!1)}function b(t){return v(t,e.NodeFlags,!0)}function x(t){return v(t,e.ModifierFlags,!0)}function D(t){return v(t,e.TransformFlags,!0)}function S(t){return v(t,e.EmitFlags,!0)}function T(t){return v(t,e.SymbolFlags,!0)}function C(t){return v(t,e.TypeFlags,!0)}function k(t){return v(t,e.SignatureFlags,!0)}function E(t){return v(t,e.ObjectFlags,!0)}function N(t){return v(t,e.FlowFlags,!0)}r.getAssertionLevel=function(){return a},r.setAssertionLevel=function(t){var n=a;if(a=t,t>n)for(var i=0,o=e.getOwnKeys(u);i<o.length;i++){var s=o[i],c=u[s];void 0!==c&&r[s]!==c.assertion&&t>=c.level&&(r[s]=c,u[s]=void 0);}},r.shouldAssert=_,r.fail=p,r.failBadSyntaxKind=function e(t,r,n){return p("".concat(r||"Unexpected node.","\r\nNode ").concat(h(t.kind)," was unexpected."),n||e)},r.assert=f,r.assertEqual=function e(t,r,n,i,a){if(t!==r){var o=n?i?"".concat(n," ").concat(i):n:"";p("Expected ".concat(t," === ").concat(r,". ").concat(o),a||e);}},r.assertLessThan=function e(t,r,n,i){t>=r&&p("Expected ".concat(t," < ").concat(r,". ").concat(n||""),i||e);},r.assertLessThanOrEqual=function e(t,r,n){t>r&&p("Expected ".concat(t," <= ").concat(r),n||e);},r.assertGreaterThanOrEqual=function e(t,r,n){t<r&&p("Expected ".concat(t," >= ").concat(r),n||e);},r.assertIsDefined=g,r.checkDefined=function e(t,r,n){return g(t,r,n||e),t},r.assertEachIsDefined=m,r.checkEachDefined=function e(t,r,n){return m(t,r,n||e),t},r.assertNever=function t(r,n,i){void 0===n&&(n="Illegal value:");var a="object"==typeof r&&e.hasProperty(r,"kind")&&e.hasProperty(r,"pos")?"SyntaxKind: "+h(r.kind):JSON.stringify(r);return p("".concat(n," ").concat(a),i||t)},r.assertEachNode=function t(r,n,i,a){d(1,"assertEachNode")&&f(void 0===n||e.every(r,n),i||"Unexpected node.",(function(){return "Node array did not pass test '".concat(y(n),"'.")}),a||t);},r.assertNode=function e(t,r,n,i){d(1,"assertNode")&&f(void 0!==t&&(void 0===r||r(t)),n||"Unexpected node.",(function(){return "Node ".concat(h(null==t?void 0:t.kind)," did not pass test '").concat(y(r),"'.")}),i||e);},r.assertNotNode=function e(t,r,n,i){d(1,"assertNotNode")&&f(void 0===t||void 0===r||!r(t),n||"Unexpected node.",(function(){return "Node ".concat(h(t.kind)," should not have passed test '").concat(y(r),"'.")}),i||e);},r.assertOptionalNode=function e(t,r,n,i){d(1,"assertOptionalNode")&&f(void 0===r||void 0===t||r(t),n||"Unexpected node.",(function(){return "Node ".concat(h(null==t?void 0:t.kind)," did not pass test '").concat(y(r),"'.")}),i||e);},r.assertOptionalToken=function e(t,r,n,i){d(1,"assertOptionalToken")&&f(void 0===r||void 0===t||t.kind===r,n||"Unexpected node.",(function(){return "Node ".concat(h(null==t?void 0:t.kind)," was not a '").concat(h(r),"' token.")}),i||e);},r.assertMissingNode=function e(t,r,n){d(1,"assertMissingNode")&&f(void 0===t,r||"Unexpected node.",(function(){return "Node ".concat(h(t.kind)," was unexpected'.")}),n||e);},r.type=function(e){},r.getFunctionName=y,r.formatSymbol=function(t){return "{ name: ".concat(e.unescapeLeadingUnderscores(t.escapedName),"; flags: ").concat(T(t.flags),"; declarations: ").concat(e.map(t.declarations,(function(e){return h(e.kind)}))," }")},r.formatEnum=v,r.formatSyntaxKind=h,r.formatSnippetKind=function(t){return v(t,e.SnippetKind,!1)},r.formatNodeFlags=b,r.formatModifierFlags=x,r.formatTransformFlags=D,r.formatEmitFlags=S,r.formatSymbolFlags=T,r.formatTypeFlags=C,r.formatSignatureFlags=k,r.formatObjectFlags=E,r.formatFlowFlags=N;var F,A,P,w=!1;function I(e){return function(){if(L(),!F)throw new Error("Debugging helpers could not be loaded.");return F}().formatControlFlowGraph(e)}function O(t){"__debugFlowFlags"in t||Object.defineProperties(t,{__tsDebuggerDisplay:{value:function(){var e=2&this.flags?"FlowStart":4&this.flags?"FlowBranchLabel":8&this.flags?"FlowLoopLabel":16&this.flags?"FlowAssignment":32&this.flags?"FlowTrueCondition":64&this.flags?"FlowFalseCondition":128&this.flags?"FlowSwitchClause":256&this.flags?"FlowArrayMutation":512&this.flags?"FlowCall":1024&this.flags?"FlowReduceLabel":1&this.flags?"FlowUnreachable":"UnknownFlow",t=-2048&this.flags;return "".concat(e).concat(t?" (".concat(N(t),")"):"")}},__debugFlowFlags:{get:function(){return v(this.flags,e.FlowFlags,!0)}},__debugToString:{value:function(){return I(this)}}});}function M(e){"__tsDebuggerDisplay"in e||Object.defineProperties(e,{__tsDebuggerDisplay:{value:function(e){return e=String(e).replace(/(?:,[\s\w\d_]+:[^,]+)+\]$/,"]"),"NodeArray ".concat(e)}}});}function L(){if(!w){var t,r;Object.defineProperties(e.objectAllocator.getSymbolConstructor().prototype,{__tsDebuggerDisplay:{value:function(){var t=33554432&this.flags?"TransientSymbol":"Symbol",r=-33554433&this.flags;return "".concat(t," '").concat(e.symbolName(this),"'").concat(r?" (".concat(T(r),")"):"")}},__debugFlags:{get:function(){return T(this.flags)}}}),Object.defineProperties(e.objectAllocator.getTypeConstructor().prototype,{__tsDebuggerDisplay:{value:function(){var t=98304&this.flags?"NullableType":384&this.flags?"LiteralType ".concat(JSON.stringify(this.value)):2048&this.flags?"LiteralType ".concat(this.value.negative?"-":"").concat(this.value.base10Value,"n"):8192&this.flags?"UniqueESSymbolType":32&this.flags?"EnumType":67359327&this.flags?"IntrinsicType ".concat(this.intrinsicName):1048576&this.flags?"UnionType":2097152&this.flags?"IntersectionType":4194304&this.flags?"IndexType":8388608&this.flags?"IndexedAccessType":16777216&this.flags?"ConditionalType":33554432&this.flags?"SubstitutionType":262144&this.flags?"TypeParameter":524288&this.flags?3&this.objectFlags?"InterfaceType":4&this.objectFlags?"TypeReference":8&this.objectFlags?"TupleType":16&this.objectFlags?"AnonymousType":32&this.objectFlags?"MappedType":1024&this.objectFlags?"ReverseMappedType":256&this.objectFlags?"EvolvingArrayType":"ObjectType":"Type",r=524288&this.flags?-1344&this.objectFlags:0;return "".concat(t).concat(this.symbol?" '".concat(e.symbolName(this.symbol),"'"):"").concat(r?" (".concat(E(r),")"):"")}},__debugFlags:{get:function(){return C(this.flags)}},__debugObjectFlags:{get:function(){return 524288&this.flags?E(this.objectFlags):""}},__debugTypeToString:{value:function(){var e=(void 0===t&&"function"==typeof WeakMap&&(t=new WeakMap),t),r=null==e?void 0:e.get(this);return void 0===r&&(r=this.checker.typeToString(this),null==e||e.set(this,r)),r}}}),Object.defineProperties(e.objectAllocator.getSignatureConstructor().prototype,{__debugFlags:{get:function(){return k(this.flags)}},__debugSignatureToString:{value:function(){var e;return null===(e=this.checker)||void 0===e?void 0:e.signatureToString(this)}}});for(var n=0,i=[e.objectAllocator.getNodeConstructor(),e.objectAllocator.getIdentifierConstructor(),e.objectAllocator.getTokenConstructor(),e.objectAllocator.getSourceFileConstructor()];n<i.length;n++){var a=i[n];a.prototype.hasOwnProperty("__debugKind")||Object.defineProperties(a.prototype,{__tsDebuggerDisplay:{value:function(){var t=e.isGeneratedIdentifier(this)?"GeneratedIdentifier":e.isIdentifier(this)?"Identifier '".concat(e.idText(this),"'"):e.isPrivateIdentifier(this)?"PrivateIdentifier '".concat(e.idText(this),"'"):e.isStringLiteral(this)?"StringLiteral ".concat(JSON.stringify(this.text.length<10?this.text:this.text.slice(10)+"...")):e.isNumericLiteral(this)?"NumericLiteral ".concat(this.text):e.isBigIntLiteral(this)?"BigIntLiteral ".concat(this.text,"n"):e.isTypeParameterDeclaration(this)?"TypeParameterDeclaration":e.isParameter(this)?"ParameterDeclaration":e.isConstructorDeclaration(this)?"ConstructorDeclaration":e.isGetAccessorDeclaration(this)?"GetAccessorDeclaration":e.isSetAccessorDeclaration(this)?"SetAccessorDeclaration":e.isCallSignatureDeclaration(this)?"CallSignatureDeclaration":e.isConstructSignatureDeclaration(this)?"ConstructSignatureDeclaration":e.isIndexSignatureDeclaration(this)?"IndexSignatureDeclaration":e.isTypePredicateNode(this)?"TypePredicateNode":e.isTypeReferenceNode(this)?"TypeReferenceNode":e.isFunctionTypeNode(this)?"FunctionTypeNode":e.isConstructorTypeNode(this)?"ConstructorTypeNode":e.isTypeQueryNode(this)?"TypeQueryNode":e.isTypeLiteralNode(this)?"TypeLiteralNode":e.isArrayTypeNode(this)?"ArrayTypeNode":e.isTupleTypeNode(this)?"TupleTypeNode":e.isOptionalTypeNode(this)?"OptionalTypeNode":e.isRestTypeNode(this)?"RestTypeNode":e.isUnionTypeNode(this)?"UnionTypeNode":e.isIntersectionTypeNode(this)?"IntersectionTypeNode":e.isConditionalTypeNode(this)?"ConditionalTypeNode":e.isInferTypeNode(this)?"InferTypeNode":e.isParenthesizedTypeNode(this)?"ParenthesizedTypeNode":e.isThisTypeNode(this)?"ThisTypeNode":e.isTypeOperatorNode(this)?"TypeOperatorNode":e.isIndexedAccessTypeNode(this)?"IndexedAccessTypeNode":e.isMappedTypeNode(this)?"MappedTypeNode":e.isLiteralTypeNode(this)?"LiteralTypeNode":e.isNamedTupleMember(this)?"NamedTupleMember":e.isImportTypeNode(this)?"ImportTypeNode":h(this.kind);return "".concat(t).concat(this.flags?" (".concat(b(this.flags),")"):"")}},__debugKind:{get:function(){return h(this.kind)}},__debugNodeFlags:{get:function(){return b(this.flags)}},__debugModifierFlags:{get:function(){return x(e.getEffectiveModifierFlagsNoCache(this))}},__debugTransformFlags:{get:function(){return D(this.transformFlags)}},__debugIsParseTreeNode:{get:function(){return e.isParseTreeNode(this)}},__debugEmitFlags:{get:function(){return S(e.getEmitFlags(this))}},__debugGetText:{value:function(t){if(e.nodeIsSynthesized(this))return "";var n=(void 0===r&&"function"==typeof WeakMap&&(r=new WeakMap),r),i=null==n?void 0:n.get(this);if(void 0===i){var a=e.getParseTreeNode(this),o=a&&e.getSourceFileOfNode(a);i=o?e.getSourceTextOfNodeFromSourceFile(o,a,t):"",null==n||n.set(this,i);}return i}}});}try{if(e.sys&&e.sys.require){var o=e.getDirectoryPath(e.resolvePath(e.sys.getExecutingFilePath())),s=e.sys.require(o,"./compiler-debug");s.error||(s.module.init(e),F=s.module);}}catch(e){}w=!0;}}function R(t,r,n,i,a){var o=r?"DeprecationError: ":"DeprecationWarning: ";return o+="'".concat(t,"' "),o+=i?"has been deprecated since v".concat(i):"is deprecated",(o+=r?" and can no longer be used.":n?" and will no longer be usable after v".concat(n,"."):".")+(a?" ".concat(e.formatStringFromArgs(a,[t],0)):"")}r.printControlFlowGraph=function(e){return console.log(I(e))},r.formatControlFlowGraph=I,r.attachFlowNodeDebugInfo=function(e){w&&("function"==typeof Object.setPrototypeOf?(A||O(A=Object.create(Object.prototype)),Object.setPrototypeOf(e,A)):O(e));},r.attachNodeArrayDebugInfo=function(e){w&&("function"==typeof Object.setPrototypeOf?(P||M(P=Object.create(Array.prototype)),Object.setPrototypeOf(e,P)):M(e));},r.enableDebugInfo=L,r.deprecate=function(t,r){return function(e,t){return function(){return e(),t.apply(this,arguments)}}(function(t,r){var n,i;void 0===r&&(r={});var a="string"==typeof r.typeScriptVersion?new e.Version(r.typeScriptVersion):null!==(n=r.typeScriptVersion)&&void 0!==n?n:o(),s="string"==typeof r.errorAfter?new e.Version(r.errorAfter):r.errorAfter,c="string"==typeof r.warnAfter?new e.Version(r.warnAfter):r.warnAfter,u="string"==typeof r.since?new e.Version(r.since):null!==(i=r.since)&&void 0!==i?i:c,_=r.error||s&&a.compareTo(s)<=0,d=!c||a.compareTo(c)>=0;return _?function(e,t,r,n){var i=R(e,!0,t,r,n);return function(){throw new TypeError(i)}}(t,s,u,r.message):d?function(e,t,r,n){var i=!1;return function(){i||(l.warn(R(e,!1,t,r,n)),i=!0);}}(t,s,u,r.message):e.noop}(y(t),r),t)};}(e.Debug||(e.Debug={}));}(t),function(e){var t=/^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i,r=/^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i,n=/^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i,i=/^(0|[1-9]\d*)$/,a=function(){function t(t,i,a,s,c){if(void 0===i&&(i=0),void 0===a&&(a=0),void 0===s&&(s=""),void 0===c&&(c=""),"string"==typeof t){var l=e.Debug.checkDefined(o(t),"Invalid version");t=l.major,i=l.minor,a=l.patch,s=l.prerelease,c=l.build;}e.Debug.assert(t>=0,"Invalid argument: major"),e.Debug.assert(i>=0,"Invalid argument: minor"),e.Debug.assert(a>=0,"Invalid argument: patch"),e.Debug.assert(!s||r.test(s),"Invalid argument: prerelease"),e.Debug.assert(!c||n.test(c),"Invalid argument: build"),this.major=t,this.minor=i,this.patch=a,this.prerelease=s?s.split("."):e.emptyArray,this.build=c?c.split("."):e.emptyArray;}return t.tryParse=function(e){var r=o(e);if(r)return new t(r.major,r.minor,r.patch,r.prerelease,r.build)},t.prototype.compareTo=function(t){return this===t?0:void 0===t?1:e.compareValues(this.major,t.major)||e.compareValues(this.minor,t.minor)||e.compareValues(this.patch,t.patch)||function(t,r){if(t===r)return 0;if(0===t.length)return 0===r.length?0:1;if(0===r.length)return -1;for(var n=Math.min(t.length,r.length),a=0;a<n;a++){var o=t[a],s=r[a];if(o!==s){var c=i.test(o),l=i.test(s);if(c||l){if(c!==l)return c?-1:1;if(u=e.compareValues(+o,+s))return u}else {var u;if(u=e.compareStringsCaseSensitive(o,s))return u}}}return e.compareValues(t.length,r.length)}(this.prerelease,t.prerelease)},t.prototype.increment=function(r){switch(r){case"major":return new t(this.major+1,0,0);case"minor":return new t(this.major,this.minor+1,0);case"patch":return new t(this.major,this.minor,this.patch+1);default:return e.Debug.assertNever(r)}},t.prototype.toString=function(){var t="".concat(this.major,".").concat(this.minor,".").concat(this.patch);return e.some(this.prerelease)&&(t+="-".concat(this.prerelease.join("."))),e.some(this.build)&&(t+="+".concat(this.build.join("."))),t},t.zero=new t(0,0,0),t}();function o(e){var i=t.exec(e);if(i){var a=i[1],o=i[2],s=void 0===o?"0":o,c=i[3],l=void 0===c?"0":c,u=i[4],_=void 0===u?"":u,d=i[5],p=void 0===d?"":d;if((!_||r.test(_))&&(!p||n.test(p)))return {major:parseInt(a,10),minor:parseInt(s,10),patch:parseInt(l,10),prerelease:_,build:p}}}e.Version=a;var s=function(){function t(t){this._alternatives=t?e.Debug.checkDefined(p(t),"Invalid range spec."):e.emptyArray;}return t.tryParse=function(e){var r=p(e);if(r){var n=new t("");return n._alternatives=r,n}},t.prototype.test=function(e){return "string"==typeof e&&(e=new a(e)),function(e,t){if(0===t.length)return !0;for(var r=0,n=t;r<n.length;r++)if(h(e,n[r]))return !0;return !1}(e,this._alternatives)},t.prototype.toString=function(){return t=this._alternatives,e.map(t,x).join(" || ")||"*";var t;},t}();e.VersionRange=s;var c=/\|\|/g,l=/\s+/g,u=/^([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i,_=/^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i,d=/^(~|\^|<|<=|>|>=|=)?\s*([a-z0-9-+.*]+)$/i;function p(t){for(var r=[],n=0,i=e.trimString(t).split(c);n<i.length;n++){var a=i[n];if(a){var o=[];a=e.trimString(a);var s=_.exec(a);if(s){if(!g(s[1],s[2],o))return}else for(var u=0,p=a.split(l);u<p.length;u++){var f=p[u],y=d.exec(e.trimString(f));if(!y||!m(y[1],y[2],o))return}r.push(o);}}return r}function f(e){var t=u.exec(e);if(t){var r=t[1],n=t[2],i=void 0===n?"*":n,o=t[3],s=void 0===o?"*":o,c=t[4],l=t[5];return {version:new a(y(r)?0:parseInt(r,10),y(r)||y(i)?0:parseInt(i,10),y(r)||y(i)||y(s)?0:parseInt(s,10),c,l),major:r,minor:i,patch:s}}}function g(e,t,r){var n=f(e);if(!n)return !1;var i=f(t);return !!i&&(y(n.major)||r.push(v(">=",n.version)),y(i.major)||r.push(y(i.minor)?v("<",i.version.increment("major")):y(i.patch)?v("<",i.version.increment("minor")):v("<=",i.version)),!0)}function m(e,t,r){var n=f(t);if(!n)return !1;var i=n.version,o=n.major,s=n.minor,c=n.patch;if(y(o))"<"!==e&&">"!==e||r.push(v("<",a.zero));else switch(e){case"~":r.push(v(">=",i)),r.push(v("<",i.increment(y(s)?"major":"minor")));break;case"^":r.push(v(">=",i)),r.push(v("<",i.increment(i.major>0||y(s)?"major":i.minor>0||y(c)?"minor":"patch")));break;case"<":case">=":r.push(v(e,i));break;case"<=":case">":r.push(y(s)?v("<="===e?"<":">=",i.increment("major")):y(c)?v("<="===e?"<":">=",i.increment("minor")):v(e,i));break;case"=":case void 0:y(s)||y(c)?(r.push(v(">=",i)),r.push(v("<",i.increment(y(s)?"major":"minor")))):r.push(v("=",i));break;default:return !1}return !0}function y(e){return "*"===e||"x"===e||"X"===e}function v(e,t){return {operator:e,operand:t}}function h(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];if(!b(e,i.operator,i.operand))return !1}return !0}function b(t,r,n){var i=t.compareTo(n);switch(r){case"<":return i<0;case"<=":return i<=0;case">":return i>0;case">=":return i>=0;case"=":return 0===i;default:return e.Debug.assertNever(r)}}function x(t){return e.map(t,D).join(" ")}function D(e){return "".concat(e.operator).concat(e.operand)}}(t),function(e){function t(e,t){return "object"==typeof e&&"number"==typeof e.timeOrigin&&"function"==typeof e.mark&&"function"==typeof e.measure&&"function"==typeof e.now&&"function"==typeof t}var r=function(){if("object"==typeof performance&&"function"==typeof PerformanceObserver&&t(performance,PerformanceObserver))return {shouldWriteNativeEvents:!0,performance,PerformanceObserver}}()||function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser&&"object"==typeof module&&"function"==typeof require)try{var r,n=require("perf_hooks"),i=n.performance,a=n.PerformanceObserver;if(t(i,a)){r=i;var o=new e.Version(process.versions.node);return new e.VersionRange("<12.16.3 || 13 <13.13").test(o)&&(r={get timeOrigin(){return i.timeOrigin},now:function(){return i.now()},mark:function(e){return i.mark(e)},measure:function(e,t,r){void 0===t&&(t="nodeStart"),void 0===r&&(r="__performance.measure-fix__",i.mark(r)),i.measure(e,t,r),"__performance.measure-fix__"===r&&i.clearMarks("__performance.measure-fix__");}}),{shouldWriteNativeEvents:!1,performance:r,PerformanceObserver:a}}}catch(e){}}(),n=null==r?void 0:r.performance;e.tryGetNativePerformanceHooks=function(){return r},e.timestamp=n?function(){return n.now()}:Date.now?Date.now:function(){return +new Date};}(t),function(e){!function(t){var r,n;function i(t,r,n){var i=0;return {enter:function(){1==++i&&u(r);},exit:function(){0==--i?(u(n),_(t,r,n)):i<0&&e.Debug.fail("enter/exit count does not match.");}}}t.createTimerIf=function(e,r,n,a){return e?i(r,n,a):t.nullTimer},t.createTimer=i,t.nullTimer={enter:e.noop,exit:e.noop};var a=!1,o=e.timestamp(),s=new e.Map,c=new e.Map,l=new e.Map;function u(t){var r;if(a){var i=null!==(r=c.get(t))&&void 0!==r?r:0;c.set(t,i+1),s.set(t,e.timestamp()),null==n||n.mark(t);}}function _(t,r,i){var c,u;if(a){var _=null!==(c=void 0!==i?s.get(i):void 0)&&void 0!==c?c:e.timestamp(),d=null!==(u=void 0!==r?s.get(r):void 0)&&void 0!==u?u:o,p=l.get(t)||0;l.set(t,p+(_-d)),null==n||n.measure(t,r,i);}}t.mark=u,t.measure=_,t.getCount=function(e){return c.get(e)||0},t.getDuration=function(e){return l.get(e)||0},t.forEachMeasure=function(e){l.forEach((function(t,r){return e(r,t)}));},t.isEnabled=function(){return a},t.enable=function(t){var i;return void 0===t&&(t=e.sys),a||(a=!0,r||(r=e.tryGetNativePerformanceHooks()),r&&(o=r.performance.timeOrigin,(r.shouldWriteNativeEvents||(null===(i=null==t?void 0:t.cpuProfilingEnabled)||void 0===i?void 0:i.call(t))||(null==t?void 0:t.debugMode))&&(n=r.performance))),!0},t.disable=function(){a&&(s.clear(),c.clear(),l.clear(),n=void 0,a=!1);};}(e.performance||(e.performance={}));}(t),function(e){var t,r,n={logEvent:e.noop,logErrEvent:e.noop,logPerfEvent:e.noop,logInfoEvent:e.noop,logStartCommand:e.noop,logStopCommand:e.noop,logStartUpdateProgram:e.noop,logStopUpdateProgram:e.noop,logStartUpdateGraph:e.noop,logStopUpdateGraph:e.noop,logStartResolveModule:e.noop,logStopResolveModule:e.noop,logStartParseSourceFile:e.noop,logStopParseSourceFile:e.noop,logStartReadFile:e.noop,logStopReadFile:e.noop,logStartBindFile:e.noop,logStopBindFile:e.noop,logStartScheduledOperation:e.noop,logStopScheduledOperation:e.noop};try{var i=null!==(t=process.env.TS_ETW_MODULE_PATH)&&void 0!==t?t:"./node_modules/@microsoft/typescript-etw";r=require(i);}catch(e){r=void 0;}e.perfLogger=r&&r.logEvent?r:n;}(t),function(e){var t;!function(t){var r,n,a,o,s=0,c=0,l=[],u=[];t.startTracing=function(o,_,d){if(e.Debug.assert(!e.tracing,"Tracing already started"),void 0===r)try{r=require("fs");}catch(e){throw new Error("tracing requires having fs\n(original error: ".concat(e.message||e,")"))}n=o,l.length=0,void 0===a&&(a=e.combinePaths(_,"legend.json")),r.existsSync(_)||r.mkdirSync(_,{recursive:!0});var p="build"===n?".".concat(process.pid,"-").concat(++s):"server"===n?".".concat(process.pid):"",f=e.combinePaths(_,"trace".concat(p,".json")),g=e.combinePaths(_,"types".concat(p,".json"));u.push({configFilePath:d,tracePath:f,typesPath:g}),c=r.openSync(f,"w"),e.tracing=t;var m={cat:"__metadata",ph:"M",ts:1e3*e.timestamp(),pid:1,tid:1};r.writeSync(c,"[\n"+[i$1({name:"process_name",args:{name:"tsc"}},m),i$1({name:"thread_name",args:{name:"Main"}},m),i$1(i$1({name:"TracingStartedInBrowser"},m),{cat:"disabled-by-default-devtools.timeline"})].map((function(e){return JSON.stringify(e)})).join(",\n"));},t.stopTracing=function(){e.Debug.assert(e.tracing,"Tracing is not in progress"),e.Debug.assert(!!l.length==("server"!==n)),r.writeSync(c,"\n]\n"),r.closeSync(c),e.tracing=void 0,l.length?function(t){var n,a,o,s,c,l,_,d,p,g,m,y,v,h,b,x,D,S,T,C,k,E;e.performance.mark("beginDumpTypes");var N=u[u.length-1].typesPath,F=r.openSync(N,"w"),A=new e.Map;r.writeSync(F,"[");for(var P=t.length,w=0;w<P;w++){var I=t[w],O=I.objectFlags,M=null!==(n=I.aliasSymbol)&&void 0!==n?n:I.symbol,L=void 0;if(16&O|2944&I.flags)try{L=null===(a=I.checker)||void 0===a?void 0:a.typeToString(I);}catch(e){L=void 0;}var R={};if(8388608&I.flags){var B=I;R={indexedAccessObjectType:null===(o=B.objectType)||void 0===o?void 0:o.id,indexedAccessIndexType:null===(s=B.indexType)||void 0===s?void 0:s.id};}var j={};if(4&O){var J=I;j={instantiatedType:null===(c=J.target)||void 0===c?void 0:c.id,typeArguments:null===(l=J.resolvedTypeArguments)||void 0===l?void 0:l.map((function(e){return e.id})),referenceLocation:f(J.node)};}var z={};if(16777216&I.flags){var K=I;z={conditionalCheckType:null===(_=K.checkType)||void 0===_?void 0:_.id,conditionalExtendsType:null===(d=K.extendsType)||void 0===d?void 0:d.id,conditionalTrueType:null!==(g=null===(p=K.resolvedTrueType)||void 0===p?void 0:p.id)&&void 0!==g?g:-1,conditionalFalseType:null!==(y=null===(m=K.resolvedFalseType)||void 0===m?void 0:m.id)&&void 0!==y?y:-1};}var U={};if(33554432&I.flags){var V=I;U={substitutionBaseType:null===(v=V.baseType)||void 0===v?void 0:v.id,substituteType:null===(h=V.substitute)||void 0===h?void 0:h.id};}var q={};if(1024&O){var W=I;q={reverseMappedSourceType:null===(b=W.source)||void 0===b?void 0:b.id,reverseMappedMappedType:null===(x=W.mappedType)||void 0===x?void 0:x.id,reverseMappedConstraintType:null===(D=W.constraintType)||void 0===D?void 0:D.id};}var H={};if(256&O){var G=I;H={evolvingArrayElementType:G.elementType.id,evolvingArrayFinalType:null===(S=G.finalArrayType)||void 0===S?void 0:S.id};}var Q=void 0,X=I.checker.getRecursionIdentity(I);X&&((Q=A.get(X))||(Q=A.size,A.set(X,Q)));var Y=i$1(i$1(i$1(i$1(i$1(i$1(i$1({id:I.id,intrinsicName:I.intrinsicName,symbolName:(null==M?void 0:M.escapedName)&&e.unescapeLeadingUnderscores(M.escapedName),recursionId:Q,isTuple:!!(8&O)||void 0,unionTypes:1048576&I.flags?null===(T=I.types)||void 0===T?void 0:T.map((function(e){return e.id})):void 0,intersectionTypes:2097152&I.flags?I.types.map((function(e){return e.id})):void 0,aliasTypeArguments:null===(C=I.aliasTypeArguments)||void 0===C?void 0:C.map((function(e){return e.id})),keyofType:4194304&I.flags?null===(k=I.type)||void 0===k?void 0:k.id:void 0},R),j),z),U),q),H),{destructuringPattern:f(I.pattern),firstDeclaration:f(null===(E=null==M?void 0:M.declarations)||void 0===E?void 0:E[0]),flags:e.Debug.formatTypeFlags(I.flags).split("|"),display:L});r.writeSync(F,JSON.stringify(Y)),w<P-1&&r.writeSync(F,",\n");}r.writeSync(F,"]\n"),r.closeSync(F),e.performance.mark("endDumpTypes"),e.performance.measure("Dump types","beginDumpTypes","endDumpTypes");}(l):u[u.length-1].typesPath=void 0;},t.recordType=function(e){"server"!==n&&l.push(e);},(o=t.Phase||(t.Phase={})).Parse="parse",o.Program="program",o.Bind="bind",o.Check="check",o.CheckTypes="checkTypes",o.Emit="emit",o.Session="session",t.instant=function(e,t,r){p("I",e,t,r,'"s":"g"');};var _=[];function d(e,t){var r=_[e],n=r.phase,i=r.name,a=r.args,o=r.time;r.separateBeginAndEnd?p("E",n,i,a,void 0,t):1e4-o%1e4<=t-o&&p("X",n,i,a,'"dur":'.concat(t-o),o);}function p(t,i,a,o,s,l){void 0===l&&(l=1e3*e.timestamp()),"server"===n&&"checkTypes"===i||(e.performance.mark("beginTracing"),r.writeSync(c,',\n{"pid":1,"tid":1,"ph":"'.concat(t,'","cat":"').concat(i,'","ts":').concat(l,',"name":"').concat(a,'"')),s&&r.writeSync(c,",".concat(s)),o&&r.writeSync(c,',"args":'.concat(JSON.stringify(o))),r.writeSync(c,"}"),e.performance.mark("endTracing"),e.performance.measure("Tracing","beginTracing","endTracing"));}function f(t){var r=e.getSourceFileOfNode(t);return r?{path:r.path,start:n(e.getLineAndCharacterOfPosition(r,t.pos)),end:n(e.getLineAndCharacterOfPosition(r,t.end))}:void 0;function n(e){return {line:e.line+1,character:e.character+1}}}t.push=function(t,r,n,i){void 0===i&&(i=!1),i&&p("B",t,r,n),_.push({phase:t,name:r,args:n,time:1e3*e.timestamp(),separateBeginAndEnd:i});},t.pop=function(){e.Debug.assert(_.length>0),d(_.length-1,1e3*e.timestamp()),_.length--;},t.popAll=function(){for(var t=1e3*e.timestamp(),r=_.length-1;r>=0;r--)d(r,t);_.length=0;},t.dumpLegend=function(){a&&r.writeFileSync(a,JSON.stringify(u));};}(t||(t={})),e.startTracing=t.startTracing,e.dumpTracingLegend=t.dumpLegend;}(t),function(e){var t,r,n,i,a,o,s,c,l;(l=e.SyntaxKind||(e.SyntaxKind={}))[l.Unknown=0]="Unknown",l[l.EndOfFileToken=1]="EndOfFileToken",l[l.SingleLineCommentTrivia=2]="SingleLineCommentTrivia",l[l.MultiLineCommentTrivia=3]="MultiLineCommentTrivia",l[l.NewLineTrivia=4]="NewLineTrivia",l[l.WhitespaceTrivia=5]="WhitespaceTrivia",l[l.ShebangTrivia=6]="ShebangTrivia",l[l.ConflictMarkerTrivia=7]="ConflictMarkerTrivia",l[l.NumericLiteral=8]="NumericLiteral",l[l.BigIntLiteral=9]="BigIntLiteral",l[l.StringLiteral=10]="StringLiteral",l[l.JsxText=11]="JsxText",l[l.JsxTextAllWhiteSpaces=12]="JsxTextAllWhiteSpaces",l[l.RegularExpressionLiteral=13]="RegularExpressionLiteral",l[l.NoSubstitutionTemplateLiteral=14]="NoSubstitutionTemplateLiteral",l[l.TemplateHead=15]="TemplateHead",l[l.TemplateMiddle=16]="TemplateMiddle",l[l.TemplateTail=17]="TemplateTail",l[l.OpenBraceToken=18]="OpenBraceToken",l[l.CloseBraceToken=19]="CloseBraceToken",l[l.OpenParenToken=20]="OpenParenToken",l[l.CloseParenToken=21]="CloseParenToken",l[l.OpenBracketToken=22]="OpenBracketToken",l[l.CloseBracketToken=23]="CloseBracketToken",l[l.DotToken=24]="DotToken",l[l.DotDotDotToken=25]="DotDotDotToken",l[l.SemicolonToken=26]="SemicolonToken",l[l.CommaToken=27]="CommaToken",l[l.QuestionDotToken=28]="QuestionDotToken",l[l.LessThanToken=29]="LessThanToken",l[l.LessThanSlashToken=30]="LessThanSlashToken",l[l.GreaterThanToken=31]="GreaterThanToken",l[l.LessThanEqualsToken=32]="LessThanEqualsToken",l[l.GreaterThanEqualsToken=33]="GreaterThanEqualsToken",l[l.EqualsEqualsToken=34]="EqualsEqualsToken",l[l.ExclamationEqualsToken=35]="ExclamationEqualsToken",l[l.EqualsEqualsEqualsToken=36]="EqualsEqualsEqualsToken",l[l.ExclamationEqualsEqualsToken=37]="ExclamationEqualsEqualsToken",l[l.EqualsGreaterThanToken=38]="EqualsGreaterThanToken",l[l.PlusToken=39]="PlusToken",l[l.MinusToken=40]="MinusToken",l[l.AsteriskToken=41]="AsteriskToken",l[l.AsteriskAsteriskToken=42]="AsteriskAsteriskToken",l[l.SlashToken=43]="SlashToken",l[l.PercentToken=44]="PercentToken",l[l.PlusPlusToken=45]="PlusPlusToken",l[l.MinusMinusToken=46]="MinusMinusToken",l[l.LessThanLessThanToken=47]="LessThanLessThanToken",l[l.GreaterThanGreaterThanToken=48]="GreaterThanGreaterThanToken",l[l.GreaterThanGreaterThanGreaterThanToken=49]="GreaterThanGreaterThanGreaterThanToken",l[l.AmpersandToken=50]="AmpersandToken",l[l.BarToken=51]="BarToken",l[l.CaretToken=52]="CaretToken",l[l.ExclamationToken=53]="ExclamationToken",l[l.TildeToken=54]="TildeToken",l[l.AmpersandAmpersandToken=55]="AmpersandAmpersandToken",l[l.BarBarToken=56]="BarBarToken",l[l.QuestionToken=57]="QuestionToken",l[l.ColonToken=58]="ColonToken",l[l.AtToken=59]="AtToken",l[l.QuestionQuestionToken=60]="QuestionQuestionToken",l[l.BacktickToken=61]="BacktickToken",l[l.HashToken=62]="HashToken",l[l.EqualsToken=63]="EqualsToken",l[l.PlusEqualsToken=64]="PlusEqualsToken",l[l.MinusEqualsToken=65]="MinusEqualsToken",l[l.AsteriskEqualsToken=66]="AsteriskEqualsToken",l[l.AsteriskAsteriskEqualsToken=67]="AsteriskAsteriskEqualsToken",l[l.SlashEqualsToken=68]="SlashEqualsToken",l[l.PercentEqualsToken=69]="PercentEqualsToken",l[l.LessThanLessThanEqualsToken=70]="LessThanLessThanEqualsToken",l[l.GreaterThanGreaterThanEqualsToken=71]="GreaterThanGreaterThanEqualsToken",l[l.GreaterThanGreaterThanGreaterThanEqualsToken=72]="GreaterThanGreaterThanGreaterThanEqualsToken",l[l.AmpersandEqualsToken=73]="AmpersandEqualsToken",l[l.BarEqualsToken=74]="BarEqualsToken",l[l.BarBarEqualsToken=75]="BarBarEqualsToken",l[l.AmpersandAmpersandEqualsToken=76]="AmpersandAmpersandEqualsToken",l[l.QuestionQuestionEqualsToken=77]="QuestionQuestionEqualsToken",l[l.CaretEqualsToken=78]="CaretEqualsToken",l[l.Identifier=79]="Identifier",l[l.PrivateIdentifier=80]="PrivateIdentifier",l[l.BreakKeyword=81]="BreakKeyword",l[l.CaseKeyword=82]="CaseKeyword",l[l.CatchKeyword=83]="CatchKeyword",l[l.ClassKeyword=84]="ClassKeyword",l[l.ConstKeyword=85]="ConstKeyword",l[l.ContinueKeyword=86]="ContinueKeyword",l[l.DebuggerKeyword=87]="DebuggerKeyword",l[l.DefaultKeyword=88]="DefaultKeyword",l[l.DeleteKeyword=89]="DeleteKeyword",l[l.DoKeyword=90]="DoKeyword",l[l.ElseKeyword=91]="ElseKeyword",l[l.EnumKeyword=92]="EnumKeyword",l[l.ExportKeyword=93]="ExportKeyword",l[l.ExtendsKeyword=94]="ExtendsKeyword",l[l.FalseKeyword=95]="FalseKeyword",l[l.FinallyKeyword=96]="FinallyKeyword",l[l.ForKeyword=97]="ForKeyword",l[l.FunctionKeyword=98]="FunctionKeyword",l[l.IfKeyword=99]="IfKeyword",l[l.ImportKeyword=100]="ImportKeyword",l[l.InKeyword=101]="InKeyword",l[l.InstanceOfKeyword=102]="InstanceOfKeyword",l[l.NewKeyword=103]="NewKeyword",l[l.NullKeyword=104]="NullKeyword",l[l.ReturnKeyword=105]="ReturnKeyword",l[l.SuperKeyword=106]="SuperKeyword",l[l.SwitchKeyword=107]="SwitchKeyword",l[l.ThisKeyword=108]="ThisKeyword",l[l.ThrowKeyword=109]="ThrowKeyword",l[l.TrueKeyword=110]="TrueKeyword",l[l.TryKeyword=111]="TryKeyword",l[l.TypeOfKeyword=112]="TypeOfKeyword",l[l.VarKeyword=113]="VarKeyword",l[l.VoidKeyword=114]="VoidKeyword",l[l.WhileKeyword=115]="WhileKeyword",l[l.WithKeyword=116]="WithKeyword",l[l.ImplementsKeyword=117]="ImplementsKeyword",l[l.InterfaceKeyword=118]="InterfaceKeyword",l[l.LetKeyword=119]="LetKeyword",l[l.PackageKeyword=120]="PackageKeyword",l[l.PrivateKeyword=121]="PrivateKeyword",l[l.ProtectedKeyword=122]="ProtectedKeyword",l[l.PublicKeyword=123]="PublicKeyword",l[l.StaticKeyword=124]="StaticKeyword",l[l.YieldKeyword=125]="YieldKeyword",l[l.AbstractKeyword=126]="AbstractKeyword",l[l.AsKeyword=127]="AsKeyword",l[l.AssertsKeyword=128]="AssertsKeyword",l[l.AssertKeyword=129]="AssertKeyword",l[l.AnyKeyword=130]="AnyKeyword",l[l.AsyncKeyword=131]="AsyncKeyword",l[l.AwaitKeyword=132]="AwaitKeyword",l[l.BooleanKeyword=133]="BooleanKeyword",l[l.ConstructorKeyword=134]="ConstructorKeyword",l[l.DeclareKeyword=135]="DeclareKeyword",l[l.GetKeyword=136]="GetKeyword",l[l.InferKeyword=137]="InferKeyword",l[l.IntrinsicKeyword=138]="IntrinsicKeyword",l[l.IsKeyword=139]="IsKeyword",l[l.KeyOfKeyword=140]="KeyOfKeyword",l[l.ModuleKeyword=141]="ModuleKeyword",l[l.NamespaceKeyword=142]="NamespaceKeyword",l[l.NeverKeyword=143]="NeverKeyword",l[l.OutKeyword=144]="OutKeyword",l[l.ReadonlyKeyword=145]="ReadonlyKeyword",l[l.RequireKeyword=146]="RequireKeyword",l[l.NumberKeyword=147]="NumberKeyword",l[l.ObjectKeyword=148]="ObjectKeyword",l[l.SetKeyword=149]="SetKeyword",l[l.StringKeyword=150]="StringKeyword",l[l.SymbolKeyword=151]="SymbolKeyword",l[l.TypeKeyword=152]="TypeKeyword",l[l.UndefinedKeyword=153]="UndefinedKeyword",l[l.UniqueKeyword=154]="UniqueKeyword",l[l.UnknownKeyword=155]="UnknownKeyword",l[l.FromKeyword=156]="FromKeyword",l[l.GlobalKeyword=157]="GlobalKeyword",l[l.BigIntKeyword=158]="BigIntKeyword",l[l.OverrideKeyword=159]="OverrideKeyword",l[l.OfKeyword=160]="OfKeyword",l[l.QualifiedName=161]="QualifiedName",l[l.ComputedPropertyName=162]="ComputedPropertyName",l[l.TypeParameter=163]="TypeParameter",l[l.Parameter=164]="Parameter",l[l.Decorator=165]="Decorator",l[l.PropertySignature=166]="PropertySignature",l[l.PropertyDeclaration=167]="PropertyDeclaration",l[l.MethodSignature=168]="MethodSignature",l[l.MethodDeclaration=169]="MethodDeclaration",l[l.ClassStaticBlockDeclaration=170]="ClassStaticBlockDeclaration",l[l.Constructor=171]="Constructor",l[l.GetAccessor=172]="GetAccessor",l[l.SetAccessor=173]="SetAccessor",l[l.CallSignature=174]="CallSignature",l[l.ConstructSignature=175]="ConstructSignature",l[l.IndexSignature=176]="IndexSignature",l[l.TypePredicate=177]="TypePredicate",l[l.TypeReference=178]="TypeReference",l[l.FunctionType=179]="FunctionType",l[l.ConstructorType=180]="ConstructorType",l[l.TypeQuery=181]="TypeQuery",l[l.TypeLiteral=182]="TypeLiteral",l[l.ArrayType=183]="ArrayType",l[l.TupleType=184]="TupleType",l[l.OptionalType=185]="OptionalType",l[l.RestType=186]="RestType",l[l.UnionType=187]="UnionType",l[l.IntersectionType=188]="IntersectionType",l[l.ConditionalType=189]="ConditionalType",l[l.InferType=190]="InferType",l[l.ParenthesizedType=191]="ParenthesizedType",l[l.ThisType=192]="ThisType",l[l.TypeOperator=193]="TypeOperator",l[l.IndexedAccessType=194]="IndexedAccessType",l[l.MappedType=195]="MappedType",l[l.LiteralType=196]="LiteralType",l[l.NamedTupleMember=197]="NamedTupleMember",l[l.TemplateLiteralType=198]="TemplateLiteralType",l[l.TemplateLiteralTypeSpan=199]="TemplateLiteralTypeSpan",l[l.ImportType=200]="ImportType",l[l.ObjectBindingPattern=201]="ObjectBindingPattern",l[l.ArrayBindingPattern=202]="ArrayBindingPattern",l[l.BindingElement=203]="BindingElement",l[l.ArrayLiteralExpression=204]="ArrayLiteralExpression",l[l.ObjectLiteralExpression=205]="ObjectLiteralExpression",l[l.PropertyAccessExpression=206]="PropertyAccessExpression",l[l.ElementAccessExpression=207]="ElementAccessExpression",l[l.CallExpression=208]="CallExpression",l[l.NewExpression=209]="NewExpression",l[l.TaggedTemplateExpression=210]="TaggedTemplateExpression",l[l.TypeAssertionExpression=211]="TypeAssertionExpression",l[l.ParenthesizedExpression=212]="ParenthesizedExpression",l[l.FunctionExpression=213]="FunctionExpression",l[l.ArrowFunction=214]="ArrowFunction",l[l.DeleteExpression=215]="DeleteExpression",l[l.TypeOfExpression=216]="TypeOfExpression",l[l.VoidExpression=217]="VoidExpression",l[l.AwaitExpression=218]="AwaitExpression",l[l.PrefixUnaryExpression=219]="PrefixUnaryExpression",l[l.PostfixUnaryExpression=220]="PostfixUnaryExpression",l[l.BinaryExpression=221]="BinaryExpression",l[l.ConditionalExpression=222]="ConditionalExpression",l[l.TemplateExpression=223]="TemplateExpression",l[l.YieldExpression=224]="YieldExpression",l[l.SpreadElement=225]="SpreadElement",l[l.ClassExpression=226]="ClassExpression",l[l.OmittedExpression=227]="OmittedExpression",l[l.ExpressionWithTypeArguments=228]="ExpressionWithTypeArguments",l[l.AsExpression=229]="AsExpression",l[l.NonNullExpression=230]="NonNullExpression",l[l.MetaProperty=231]="MetaProperty",l[l.SyntheticExpression=232]="SyntheticExpression",l[l.TemplateSpan=233]="TemplateSpan",l[l.SemicolonClassElement=234]="SemicolonClassElement",l[l.Block=235]="Block",l[l.EmptyStatement=236]="EmptyStatement",l[l.VariableStatement=237]="VariableStatement",l[l.ExpressionStatement=238]="ExpressionStatement",l[l.IfStatement=239]="IfStatement",l[l.DoStatement=240]="DoStatement",l[l.WhileStatement=241]="WhileStatement",l[l.ForStatement=242]="ForStatement",l[l.ForInStatement=243]="ForInStatement",l[l.ForOfStatement=244]="ForOfStatement",l[l.ContinueStatement=245]="ContinueStatement",l[l.BreakStatement=246]="BreakStatement",l[l.ReturnStatement=247]="ReturnStatement",l[l.WithStatement=248]="WithStatement",l[l.SwitchStatement=249]="SwitchStatement",l[l.LabeledStatement=250]="LabeledStatement",l[l.ThrowStatement=251]="ThrowStatement",l[l.TryStatement=252]="TryStatement",l[l.DebuggerStatement=253]="DebuggerStatement",l[l.VariableDeclaration=254]="VariableDeclaration",l[l.VariableDeclarationList=255]="VariableDeclarationList",l[l.FunctionDeclaration=256]="FunctionDeclaration",l[l.ClassDeclaration=257]="ClassDeclaration",l[l.InterfaceDeclaration=258]="InterfaceDeclaration",l[l.TypeAliasDeclaration=259]="TypeAliasDeclaration",l[l.EnumDeclaration=260]="EnumDeclaration",l[l.ModuleDeclaration=261]="ModuleDeclaration",l[l.ModuleBlock=262]="ModuleBlock",l[l.CaseBlock=263]="CaseBlock",l[l.NamespaceExportDeclaration=264]="NamespaceExportDeclaration",l[l.ImportEqualsDeclaration=265]="ImportEqualsDeclaration",l[l.ImportDeclaration=266]="ImportDeclaration",l[l.ImportClause=267]="ImportClause",l[l.NamespaceImport=268]="NamespaceImport",l[l.NamedImports=269]="NamedImports",l[l.ImportSpecifier=270]="ImportSpecifier",l[l.ExportAssignment=271]="ExportAssignment",l[l.ExportDeclaration=272]="ExportDeclaration",l[l.NamedExports=273]="NamedExports",l[l.NamespaceExport=274]="NamespaceExport",l[l.ExportSpecifier=275]="ExportSpecifier",l[l.MissingDeclaration=276]="MissingDeclaration",l[l.ExternalModuleReference=277]="ExternalModuleReference",l[l.JsxElement=278]="JsxElement",l[l.JsxSelfClosingElement=279]="JsxSelfClosingElement",l[l.JsxOpeningElement=280]="JsxOpeningElement",l[l.JsxClosingElement=281]="JsxClosingElement",l[l.JsxFragment=282]="JsxFragment",l[l.JsxOpeningFragment=283]="JsxOpeningFragment",l[l.JsxClosingFragment=284]="JsxClosingFragment",l[l.JsxAttribute=285]="JsxAttribute",l[l.JsxAttributes=286]="JsxAttributes",l[l.JsxSpreadAttribute=287]="JsxSpreadAttribute",l[l.JsxExpression=288]="JsxExpression",l[l.CaseClause=289]="CaseClause",l[l.DefaultClause=290]="DefaultClause",l[l.HeritageClause=291]="HeritageClause",l[l.CatchClause=292]="CatchClause",l[l.AssertClause=293]="AssertClause",l[l.AssertEntry=294]="AssertEntry",l[l.ImportTypeAssertionContainer=295]="ImportTypeAssertionContainer",l[l.PropertyAssignment=296]="PropertyAssignment",l[l.ShorthandPropertyAssignment=297]="ShorthandPropertyAssignment",l[l.SpreadAssignment=298]="SpreadAssignment",l[l.EnumMember=299]="EnumMember",l[l.UnparsedPrologue=300]="UnparsedPrologue",l[l.UnparsedPrepend=301]="UnparsedPrepend",l[l.UnparsedText=302]="UnparsedText",l[l.UnparsedInternalText=303]="UnparsedInternalText",l[l.UnparsedSyntheticReference=304]="UnparsedSyntheticReference",l[l.SourceFile=305]="SourceFile",l[l.Bundle=306]="Bundle",l[l.UnparsedSource=307]="UnparsedSource",l[l.InputFiles=308]="InputFiles",l[l.JSDocTypeExpression=309]="JSDocTypeExpression",l[l.JSDocNameReference=310]="JSDocNameReference",l[l.JSDocMemberName=311]="JSDocMemberName",l[l.JSDocAllType=312]="JSDocAllType",l[l.JSDocUnknownType=313]="JSDocUnknownType",l[l.JSDocNullableType=314]="JSDocNullableType",l[l.JSDocNonNullableType=315]="JSDocNonNullableType",l[l.JSDocOptionalType=316]="JSDocOptionalType",l[l.JSDocFunctionType=317]="JSDocFunctionType",l[l.JSDocVariadicType=318]="JSDocVariadicType",l[l.JSDocNamepathType=319]="JSDocNamepathType",l[l.JSDocComment=320]="JSDocComment",l[l.JSDocText=321]="JSDocText",l[l.JSDocTypeLiteral=322]="JSDocTypeLiteral",l[l.JSDocSignature=323]="JSDocSignature",l[l.JSDocLink=324]="JSDocLink",l[l.JSDocLinkCode=325]="JSDocLinkCode",l[l.JSDocLinkPlain=326]="JSDocLinkPlain",l[l.JSDocTag=327]="JSDocTag",l[l.JSDocAugmentsTag=328]="JSDocAugmentsTag",l[l.JSDocImplementsTag=329]="JSDocImplementsTag",l[l.JSDocAuthorTag=330]="JSDocAuthorTag",l[l.JSDocDeprecatedTag=331]="JSDocDeprecatedTag",l[l.JSDocClassTag=332]="JSDocClassTag",l[l.JSDocPublicTag=333]="JSDocPublicTag",l[l.JSDocPrivateTag=334]="JSDocPrivateTag",l[l.JSDocProtectedTag=335]="JSDocProtectedTag",l[l.JSDocReadonlyTag=336]="JSDocReadonlyTag",l[l.JSDocOverrideTag=337]="JSDocOverrideTag",l[l.JSDocCallbackTag=338]="JSDocCallbackTag",l[l.JSDocEnumTag=339]="JSDocEnumTag",l[l.JSDocParameterTag=340]="JSDocParameterTag",l[l.JSDocReturnTag=341]="JSDocReturnTag",l[l.JSDocThisTag=342]="JSDocThisTag",l[l.JSDocTypeTag=343]="JSDocTypeTag",l[l.JSDocTemplateTag=344]="JSDocTemplateTag",l[l.JSDocTypedefTag=345]="JSDocTypedefTag",l[l.JSDocSeeTag=346]="JSDocSeeTag",l[l.JSDocPropertyTag=347]="JSDocPropertyTag",l[l.SyntaxList=348]="SyntaxList",l[l.NotEmittedStatement=349]="NotEmittedStatement",l[l.PartiallyEmittedExpression=350]="PartiallyEmittedExpression",l[l.CommaListExpression=351]="CommaListExpression",l[l.MergeDeclarationMarker=352]="MergeDeclarationMarker",l[l.EndOfDeclarationMarker=353]="EndOfDeclarationMarker",l[l.SyntheticReferenceExpression=354]="SyntheticReferenceExpression",l[l.Count=355]="Count",l[l.FirstAssignment=63]="FirstAssignment",l[l.LastAssignment=78]="LastAssignment",l[l.FirstCompoundAssignment=64]="FirstCompoundAssignment",l[l.LastCompoundAssignment=78]="LastCompoundAssignment",l[l.FirstReservedWord=81]="FirstReservedWord",l[l.LastReservedWord=116]="LastReservedWord",l[l.FirstKeyword=81]="FirstKeyword",l[l.LastKeyword=160]="LastKeyword",l[l.FirstFutureReservedWord=117]="FirstFutureReservedWord",l[l.LastFutureReservedWord=125]="LastFutureReservedWord",l[l.FirstTypeNode=177]="FirstTypeNode",l[l.LastTypeNode=200]="LastTypeNode",l[l.FirstPunctuation=18]="FirstPunctuation",l[l.LastPunctuation=78]="LastPunctuation",l[l.FirstToken=0]="FirstToken",l[l.LastToken=160]="LastToken",l[l.FirstTriviaToken=2]="FirstTriviaToken",l[l.LastTriviaToken=7]="LastTriviaToken",l[l.FirstLiteralToken=8]="FirstLiteralToken",l[l.LastLiteralToken=14]="LastLiteralToken",l[l.FirstTemplateToken=14]="FirstTemplateToken",l[l.LastTemplateToken=17]="LastTemplateToken",l[l.FirstBinaryOperator=29]="FirstBinaryOperator",l[l.LastBinaryOperator=78]="LastBinaryOperator",l[l.FirstStatement=237]="FirstStatement",l[l.LastStatement=253]="LastStatement",l[l.FirstNode=161]="FirstNode",l[l.FirstJSDocNode=309]="FirstJSDocNode",l[l.LastJSDocNode=347]="LastJSDocNode",l[l.FirstJSDocTagNode=327]="FirstJSDocTagNode",l[l.LastJSDocTagNode=347]="LastJSDocTagNode",l[l.FirstContextualKeyword=126]="FirstContextualKeyword",l[l.LastContextualKeyword=160]="LastContextualKeyword",l[l.JSDoc=320]="JSDoc",(c=e.NodeFlags||(e.NodeFlags={}))[c.None=0]="None",c[c.Let=1]="Let",c[c.Const=2]="Const",c[c.NestedNamespace=4]="NestedNamespace",c[c.Synthesized=8]="Synthesized",c[c.Namespace=16]="Namespace",c[c.OptionalChain=32]="OptionalChain",c[c.ExportContext=64]="ExportContext",c[c.ContainsThis=128]="ContainsThis",c[c.HasImplicitReturn=256]="HasImplicitReturn",c[c.HasExplicitReturn=512]="HasExplicitReturn",c[c.GlobalAugmentation=1024]="GlobalAugmentation",c[c.HasAsyncFunctions=2048]="HasAsyncFunctions",c[c.DisallowInContext=4096]="DisallowInContext",c[c.YieldContext=8192]="YieldContext",c[c.DecoratorContext=16384]="DecoratorContext",c[c.AwaitContext=32768]="AwaitContext",c[c.DisallowConditionalTypesContext=65536]="DisallowConditionalTypesContext",c[c.ThisNodeHasError=131072]="ThisNodeHasError",c[c.JavaScriptFile=262144]="JavaScriptFile",c[c.ThisNodeOrAnySubNodesHasError=524288]="ThisNodeOrAnySubNodesHasError",c[c.HasAggregatedChildData=1048576]="HasAggregatedChildData",c[c.PossiblyContainsDynamicImport=2097152]="PossiblyContainsDynamicImport",c[c.PossiblyContainsImportMeta=4194304]="PossiblyContainsImportMeta",c[c.JSDoc=8388608]="JSDoc",c[c.Ambient=16777216]="Ambient",c[c.InWithStatement=33554432]="InWithStatement",c[c.JsonFile=67108864]="JsonFile",c[c.TypeCached=134217728]="TypeCached",c[c.Deprecated=268435456]="Deprecated",c[c.BlockScoped=3]="BlockScoped",c[c.ReachabilityCheckFlags=768]="ReachabilityCheckFlags",c[c.ReachabilityAndEmitFlags=2816]="ReachabilityAndEmitFlags",c[c.ContextFlags=50720768]="ContextFlags",c[c.TypeExcludesFlags=40960]="TypeExcludesFlags",c[c.PermanentlySetIncrementalFlags=6291456]="PermanentlySetIncrementalFlags",(s=e.ModifierFlags||(e.ModifierFlags={}))[s.None=0]="None",s[s.Export=1]="Export",s[s.Ambient=2]="Ambient",s[s.Public=4]="Public",s[s.Private=8]="Private",s[s.Protected=16]="Protected",s[s.Static=32]="Static",s[s.Readonly=64]="Readonly",s[s.Abstract=128]="Abstract",s[s.Async=256]="Async",s[s.Default=512]="Default",s[s.Const=2048]="Const",s[s.HasComputedJSDocModifiers=4096]="HasComputedJSDocModifiers",s[s.Deprecated=8192]="Deprecated",s[s.Override=16384]="Override",s[s.In=32768]="In",s[s.Out=65536]="Out",s[s.HasComputedFlags=536870912]="HasComputedFlags",s[s.AccessibilityModifier=28]="AccessibilityModifier",s[s.ParameterPropertyModifier=16476]="ParameterPropertyModifier",s[s.NonPublicAccessibilityModifier=24]="NonPublicAccessibilityModifier",s[s.TypeScriptModifier=116958]="TypeScriptModifier",s[s.ExportDefault=513]="ExportDefault",s[s.All=125951]="All",(o=e.JsxFlags||(e.JsxFlags={}))[o.None=0]="None",o[o.IntrinsicNamedElement=1]="IntrinsicNamedElement",o[o.IntrinsicIndexedElement=2]="IntrinsicIndexedElement",o[o.IntrinsicElement=3]="IntrinsicElement",(a=e.RelationComparisonResult||(e.RelationComparisonResult={}))[a.Succeeded=1]="Succeeded",a[a.Failed=2]="Failed",a[a.Reported=4]="Reported",a[a.ReportsUnmeasurable=8]="ReportsUnmeasurable",a[a.ReportsUnreliable=16]="ReportsUnreliable",a[a.ReportsMask=24]="ReportsMask",(i=e.GeneratedIdentifierFlags||(e.GeneratedIdentifierFlags={}))[i.None=0]="None",i[i.Auto=1]="Auto",i[i.Loop=2]="Loop",i[i.Unique=3]="Unique",i[i.Node=4]="Node",i[i.KindMask=7]="KindMask",i[i.ReservedInNestedScopes=8]="ReservedInNestedScopes",i[i.Optimistic=16]="Optimistic",i[i.FileLevel=32]="FileLevel",i[i.AllowNameSubstitution=64]="AllowNameSubstitution",(n=e.TokenFlags||(e.TokenFlags={}))[n.None=0]="None",n[n.PrecedingLineBreak=1]="PrecedingLineBreak",n[n.PrecedingJSDocComment=2]="PrecedingJSDocComment",n[n.Unterminated=4]="Unterminated",n[n.ExtendedUnicodeEscape=8]="ExtendedUnicodeEscape",n[n.Scientific=16]="Scientific",n[n.Octal=32]="Octal",n[n.HexSpecifier=64]="HexSpecifier",n[n.BinarySpecifier=128]="BinarySpecifier",n[n.OctalSpecifier=256]="OctalSpecifier",n[n.ContainsSeparator=512]="ContainsSeparator",n[n.UnicodeEscape=1024]="UnicodeEscape",n[n.ContainsInvalidEscape=2048]="ContainsInvalidEscape",n[n.BinaryOrOctalSpecifier=384]="BinaryOrOctalSpecifier",n[n.NumericLiteralFlags=1008]="NumericLiteralFlags",n[n.TemplateLiteralLikeFlags=2048]="TemplateLiteralLikeFlags",(r=e.FlowFlags||(e.FlowFlags={}))[r.Unreachable=1]="Unreachable",r[r.Start=2]="Start",r[r.BranchLabel=4]="BranchLabel",r[r.LoopLabel=8]="LoopLabel",r[r.Assignment=16]="Assignment",r[r.TrueCondition=32]="TrueCondition",r[r.FalseCondition=64]="FalseCondition",r[r.SwitchClause=128]="SwitchClause",r[r.ArrayMutation=256]="ArrayMutation",r[r.Call=512]="Call",r[r.ReduceLabel=1024]="ReduceLabel",r[r.Referenced=2048]="Referenced",r[r.Shared=4096]="Shared",r[r.Label=12]="Label",r[r.Condition=96]="Condition",(t=e.CommentDirectiveType||(e.CommentDirectiveType={}))[t.ExpectError=0]="ExpectError",t[t.Ignore=1]="Ignore";var u,_,d,p,f,g,m,y,v,h,b,x,D,S,T,C,k,E,N,F,A,P,w,I,O,M,L,R,B,j,J,z,K,U,V,q,W,H,G,Q,X,Y,Z,$,ee,te,re,ne,ie,ae,oe,se,ce,le,ue,_e,de,pe,fe;e.OperationCanceledException=function(){},(fe=e.FileIncludeKind||(e.FileIncludeKind={}))[fe.RootFile=0]="RootFile",fe[fe.SourceFromProjectReference=1]="SourceFromProjectReference",fe[fe.OutputFromProjectReference=2]="OutputFromProjectReference",fe[fe.Import=3]="Import",fe[fe.ReferenceFile=4]="ReferenceFile",fe[fe.TypeReferenceDirective=5]="TypeReferenceDirective",fe[fe.LibFile=6]="LibFile",fe[fe.LibReferenceDirective=7]="LibReferenceDirective",fe[fe.AutomaticTypeDirectiveFile=8]="AutomaticTypeDirectiveFile",(pe=e.FilePreprocessingDiagnosticsKind||(e.FilePreprocessingDiagnosticsKind={}))[pe.FilePreprocessingReferencedDiagnostic=0]="FilePreprocessingReferencedDiagnostic",pe[pe.FilePreprocessingFileExplainingDiagnostic=1]="FilePreprocessingFileExplainingDiagnostic",(de=e.StructureIsReused||(e.StructureIsReused={}))[de.Not=0]="Not",de[de.SafeModules=1]="SafeModules",de[de.Completely=2]="Completely",(_e=e.ExitStatus||(e.ExitStatus={}))[_e.Success=0]="Success",_e[_e.DiagnosticsPresent_OutputsSkipped=1]="DiagnosticsPresent_OutputsSkipped",_e[_e.DiagnosticsPresent_OutputsGenerated=2]="DiagnosticsPresent_OutputsGenerated",_e[_e.InvalidProject_OutputsSkipped=3]="InvalidProject_OutputsSkipped",_e[_e.ProjectReferenceCycle_OutputsSkipped=4]="ProjectReferenceCycle_OutputsSkipped",_e[_e.ProjectReferenceCycle_OutputsSkupped=4]="ProjectReferenceCycle_OutputsSkupped",(ue=e.MemberOverrideStatus||(e.MemberOverrideStatus={}))[ue.Ok=0]="Ok",ue[ue.NeedsOverride=1]="NeedsOverride",ue[ue.HasInvalidOverride=2]="HasInvalidOverride",(le=e.UnionReduction||(e.UnionReduction={}))[le.None=0]="None",le[le.Literal=1]="Literal",le[le.Subtype=2]="Subtype",(ce=e.ContextFlags||(e.ContextFlags={}))[ce.None=0]="None",ce[ce.Signature=1]="Signature",ce[ce.NoConstraints=2]="NoConstraints",ce[ce.Completions=4]="Completions",ce[ce.SkipBindingPatterns=8]="SkipBindingPatterns",(se=e.NodeBuilderFlags||(e.NodeBuilderFlags={}))[se.None=0]="None",se[se.NoTruncation=1]="NoTruncation",se[se.WriteArrayAsGenericType=2]="WriteArrayAsGenericType",se[se.GenerateNamesForShadowedTypeParams=4]="GenerateNamesForShadowedTypeParams",se[se.UseStructuralFallback=8]="UseStructuralFallback",se[se.ForbidIndexedAccessSymbolReferences=16]="ForbidIndexedAccessSymbolReferences",se[se.WriteTypeArgumentsOfSignature=32]="WriteTypeArgumentsOfSignature",se[se.UseFullyQualifiedType=64]="UseFullyQualifiedType",se[se.UseOnlyExternalAliasing=128]="UseOnlyExternalAliasing",se[se.SuppressAnyReturnType=256]="SuppressAnyReturnType",se[se.WriteTypeParametersInQualifiedName=512]="WriteTypeParametersInQualifiedName",se[se.MultilineObjectLiterals=1024]="MultilineObjectLiterals",se[se.WriteClassExpressionAsTypeLiteral=2048]="WriteClassExpressionAsTypeLiteral",se[se.UseTypeOfFunction=4096]="UseTypeOfFunction",se[se.OmitParameterModifiers=8192]="OmitParameterModifiers",se[se.UseAliasDefinedOutsideCurrentScope=16384]="UseAliasDefinedOutsideCurrentScope",se[se.UseSingleQuotesForStringLiteralType=268435456]="UseSingleQuotesForStringLiteralType",se[se.NoTypeReduction=536870912]="NoTypeReduction",se[se.AllowThisInObjectLiteral=32768]="AllowThisInObjectLiteral",se[se.AllowQualifiedNameInPlaceOfIdentifier=65536]="AllowQualifiedNameInPlaceOfIdentifier",se[se.AllowQualifedNameInPlaceOfIdentifier=65536]="AllowQualifedNameInPlaceOfIdentifier",se[se.AllowAnonymousIdentifier=131072]="AllowAnonymousIdentifier",se[se.AllowEmptyUnionOrIntersection=262144]="AllowEmptyUnionOrIntersection",se[se.AllowEmptyTuple=524288]="AllowEmptyTuple",se[se.AllowUniqueESSymbolType=1048576]="AllowUniqueESSymbolType",se[se.AllowEmptyIndexInfoType=2097152]="AllowEmptyIndexInfoType",se[se.AllowNodeModulesRelativePaths=67108864]="AllowNodeModulesRelativePaths",se[se.DoNotIncludeSymbolChain=134217728]="DoNotIncludeSymbolChain",se[se.IgnoreErrors=70221824]="IgnoreErrors",se[se.InObjectTypeLiteral=4194304]="InObjectTypeLiteral",se[se.InTypeAlias=8388608]="InTypeAlias",se[se.InInitialEntityName=16777216]="InInitialEntityName",(oe=e.TypeFormatFlags||(e.TypeFormatFlags={}))[oe.None=0]="None",oe[oe.NoTruncation=1]="NoTruncation",oe[oe.WriteArrayAsGenericType=2]="WriteArrayAsGenericType",oe[oe.UseStructuralFallback=8]="UseStructuralFallback",oe[oe.WriteTypeArgumentsOfSignature=32]="WriteTypeArgumentsOfSignature",oe[oe.UseFullyQualifiedType=64]="UseFullyQualifiedType",oe[oe.SuppressAnyReturnType=256]="SuppressAnyReturnType",oe[oe.MultilineObjectLiterals=1024]="MultilineObjectLiterals",oe[oe.WriteClassExpressionAsTypeLiteral=2048]="WriteClassExpressionAsTypeLiteral",oe[oe.UseTypeOfFunction=4096]="UseTypeOfFunction",oe[oe.OmitParameterModifiers=8192]="OmitParameterModifiers",oe[oe.UseAliasDefinedOutsideCurrentScope=16384]="UseAliasDefinedOutsideCurrentScope",oe[oe.UseSingleQuotesForStringLiteralType=268435456]="UseSingleQuotesForStringLiteralType",oe[oe.NoTypeReduction=536870912]="NoTypeReduction",oe[oe.AllowUniqueESSymbolType=1048576]="AllowUniqueESSymbolType",oe[oe.AddUndefined=131072]="AddUndefined",oe[oe.WriteArrowStyleSignature=262144]="WriteArrowStyleSignature",oe[oe.InArrayType=524288]="InArrayType",oe[oe.InElementType=2097152]="InElementType",oe[oe.InFirstTypeArgument=4194304]="InFirstTypeArgument",oe[oe.InTypeAlias=8388608]="InTypeAlias",oe[oe.WriteOwnNameForAnyLike=0]="WriteOwnNameForAnyLike",oe[oe.NodeBuilderFlagsMask=814775659]="NodeBuilderFlagsMask",(ae=e.SymbolFormatFlags||(e.SymbolFormatFlags={}))[ae.None=0]="None",ae[ae.WriteTypeParametersOrArguments=1]="WriteTypeParametersOrArguments",ae[ae.UseOnlyExternalAliasing=2]="UseOnlyExternalAliasing",ae[ae.AllowAnyNodeKind=4]="AllowAnyNodeKind",ae[ae.UseAliasDefinedOutsideCurrentScope=8]="UseAliasDefinedOutsideCurrentScope",ae[ae.DoNotIncludeSymbolChain=16]="DoNotIncludeSymbolChain",(ie=e.SymbolAccessibility||(e.SymbolAccessibility={}))[ie.Accessible=0]="Accessible",ie[ie.NotAccessible=1]="NotAccessible",ie[ie.CannotBeNamed=2]="CannotBeNamed",(ne=e.SyntheticSymbolKind||(e.SyntheticSymbolKind={}))[ne.UnionOrIntersection=0]="UnionOrIntersection",ne[ne.Spread=1]="Spread",(re=e.TypePredicateKind||(e.TypePredicateKind={}))[re.This=0]="This",re[re.Identifier=1]="Identifier",re[re.AssertsThis=2]="AssertsThis",re[re.AssertsIdentifier=3]="AssertsIdentifier",(te=e.TypeReferenceSerializationKind||(e.TypeReferenceSerializationKind={}))[te.Unknown=0]="Unknown",te[te.TypeWithConstructSignatureAndValue=1]="TypeWithConstructSignatureAndValue",te[te.VoidNullableOrNeverType=2]="VoidNullableOrNeverType",te[te.NumberLikeType=3]="NumberLikeType",te[te.BigIntLikeType=4]="BigIntLikeType",te[te.StringLikeType=5]="StringLikeType",te[te.BooleanType=6]="BooleanType",te[te.ArrayLikeType=7]="ArrayLikeType",te[te.ESSymbolType=8]="ESSymbolType",te[te.Promise=9]="Promise",te[te.TypeWithCallSignature=10]="TypeWithCallSignature",te[te.ObjectType=11]="ObjectType",(ee=e.SymbolFlags||(e.SymbolFlags={}))[ee.None=0]="None",ee[ee.FunctionScopedVariable=1]="FunctionScopedVariable",ee[ee.BlockScopedVariable=2]="BlockScopedVariable",ee[ee.Property=4]="Property",ee[ee.EnumMember=8]="EnumMember",ee[ee.Function=16]="Function",ee[ee.Class=32]="Class",ee[ee.Interface=64]="Interface",ee[ee.ConstEnum=128]="ConstEnum",ee[ee.RegularEnum=256]="RegularEnum",ee[ee.ValueModule=512]="ValueModule",ee[ee.NamespaceModule=1024]="NamespaceModule",ee[ee.TypeLiteral=2048]="TypeLiteral",ee[ee.ObjectLiteral=4096]="ObjectLiteral",ee[ee.Method=8192]="Method",ee[ee.Constructor=16384]="Constructor",ee[ee.GetAccessor=32768]="GetAccessor",ee[ee.SetAccessor=65536]="SetAccessor",ee[ee.Signature=131072]="Signature",ee[ee.TypeParameter=262144]="TypeParameter",ee[ee.TypeAlias=524288]="TypeAlias",ee[ee.ExportValue=1048576]="ExportValue",ee[ee.Alias=2097152]="Alias",ee[ee.Prototype=4194304]="Prototype",ee[ee.ExportStar=8388608]="ExportStar",ee[ee.Optional=16777216]="Optional",ee[ee.Transient=33554432]="Transient",ee[ee.Assignment=67108864]="Assignment",ee[ee.ModuleExports=134217728]="ModuleExports",ee[ee.All=67108863]="All",ee[ee.Enum=384]="Enum",ee[ee.Variable=3]="Variable",ee[ee.Value=111551]="Value",ee[ee.Type=788968]="Type",ee[ee.Namespace=1920]="Namespace",ee[ee.Module=1536]="Module",ee[ee.Accessor=98304]="Accessor",ee[ee.FunctionScopedVariableExcludes=111550]="FunctionScopedVariableExcludes",ee[ee.BlockScopedVariableExcludes=111551]="BlockScopedVariableExcludes",ee[ee.ParameterExcludes=111551]="ParameterExcludes",ee[ee.PropertyExcludes=0]="PropertyExcludes",ee[ee.EnumMemberExcludes=900095]="EnumMemberExcludes",ee[ee.FunctionExcludes=110991]="FunctionExcludes",ee[ee.ClassExcludes=899503]="ClassExcludes",ee[ee.InterfaceExcludes=788872]="InterfaceExcludes",ee[ee.RegularEnumExcludes=899327]="RegularEnumExcludes",ee[ee.ConstEnumExcludes=899967]="ConstEnumExcludes",ee[ee.ValueModuleExcludes=110735]="ValueModuleExcludes",ee[ee.NamespaceModuleExcludes=0]="NamespaceModuleExcludes",ee[ee.MethodExcludes=103359]="MethodExcludes",ee[ee.GetAccessorExcludes=46015]="GetAccessorExcludes",ee[ee.SetAccessorExcludes=78783]="SetAccessorExcludes",ee[ee.TypeParameterExcludes=526824]="TypeParameterExcludes",ee[ee.TypeAliasExcludes=788968]="TypeAliasExcludes",ee[ee.AliasExcludes=2097152]="AliasExcludes",ee[ee.ModuleMember=2623475]="ModuleMember",ee[ee.ExportHasLocal=944]="ExportHasLocal",ee[ee.BlockScoped=418]="BlockScoped",ee[ee.PropertyOrAccessor=98308]="PropertyOrAccessor",ee[ee.ClassMember=106500]="ClassMember",ee[ee.ExportSupportsDefaultModifier=112]="ExportSupportsDefaultModifier",ee[ee.ExportDoesNotSupportDefaultModifier=-113]="ExportDoesNotSupportDefaultModifier",ee[ee.Classifiable=2885600]="Classifiable",ee[ee.LateBindingContainer=6256]="LateBindingContainer",($=e.EnumKind||(e.EnumKind={}))[$.Numeric=0]="Numeric",$[$.Literal=1]="Literal",(Z=e.CheckFlags||(e.CheckFlags={}))[Z.Instantiated=1]="Instantiated",Z[Z.SyntheticProperty=2]="SyntheticProperty",Z[Z.SyntheticMethod=4]="SyntheticMethod",Z[Z.Readonly=8]="Readonly",Z[Z.ReadPartial=16]="ReadPartial",Z[Z.WritePartial=32]="WritePartial",Z[Z.HasNonUniformType=64]="HasNonUniformType",Z[Z.HasLiteralType=128]="HasLiteralType",Z[Z.ContainsPublic=256]="ContainsPublic",Z[Z.ContainsProtected=512]="ContainsProtected",Z[Z.ContainsPrivate=1024]="ContainsPrivate",Z[Z.ContainsStatic=2048]="ContainsStatic",Z[Z.Late=4096]="Late",Z[Z.ReverseMapped=8192]="ReverseMapped",Z[Z.OptionalParameter=16384]="OptionalParameter",Z[Z.RestParameter=32768]="RestParameter",Z[Z.DeferredType=65536]="DeferredType",Z[Z.HasNeverType=131072]="HasNeverType",Z[Z.Mapped=262144]="Mapped",Z[Z.StripOptional=524288]="StripOptional",Z[Z.Unresolved=1048576]="Unresolved",Z[Z.Synthetic=6]="Synthetic",Z[Z.Discriminant=192]="Discriminant",Z[Z.Partial=48]="Partial",(Y=e.InternalSymbolName||(e.InternalSymbolName={})).Call="__call",Y.Constructor="__constructor",Y.New="__new",Y.Index="__index",Y.ExportStar="__export",Y.Global="__global",Y.Missing="__missing",Y.Type="__type",Y.Object="__object",Y.JSXAttributes="__jsxAttributes",Y.Class="__class",Y.Function="__function",Y.Computed="__computed",Y.Resolving="__resolving__",Y.ExportEquals="export=",Y.Default="default",Y.This="this",(X=e.NodeCheckFlags||(e.NodeCheckFlags={}))[X.TypeChecked=1]="TypeChecked",X[X.LexicalThis=2]="LexicalThis",X[X.CaptureThis=4]="CaptureThis",X[X.CaptureNewTarget=8]="CaptureNewTarget",X[X.SuperInstance=256]="SuperInstance",X[X.SuperStatic=512]="SuperStatic",X[X.ContextChecked=1024]="ContextChecked",X[X.AsyncMethodWithSuper=2048]="AsyncMethodWithSuper",X[X.AsyncMethodWithSuperBinding=4096]="AsyncMethodWithSuperBinding",X[X.CaptureArguments=8192]="CaptureArguments",X[X.EnumValuesComputed=16384]="EnumValuesComputed",X[X.LexicalModuleMergesWithClass=32768]="LexicalModuleMergesWithClass",X[X.LoopWithCapturedBlockScopedBinding=65536]="LoopWithCapturedBlockScopedBinding",X[X.ContainsCapturedBlockScopeBinding=131072]="ContainsCapturedBlockScopeBinding",X[X.CapturedBlockScopedBinding=262144]="CapturedBlockScopedBinding",X[X.BlockScopedBindingInLoop=524288]="BlockScopedBindingInLoop",X[X.ClassWithBodyScopedClassBinding=1048576]="ClassWithBodyScopedClassBinding",X[X.BodyScopedClassBinding=2097152]="BodyScopedClassBinding",X[X.NeedsLoopOutParameter=4194304]="NeedsLoopOutParameter",X[X.AssignmentsMarked=8388608]="AssignmentsMarked",X[X.ClassWithConstructorReference=16777216]="ClassWithConstructorReference",X[X.ConstructorReferenceInClass=33554432]="ConstructorReferenceInClass",X[X.ContainsClassWithPrivateIdentifiers=67108864]="ContainsClassWithPrivateIdentifiers",X[X.ContainsSuperPropertyInStaticInitializer=134217728]="ContainsSuperPropertyInStaticInitializer",X[X.InCheckIdentifier=268435456]="InCheckIdentifier",(Q=e.TypeFlags||(e.TypeFlags={}))[Q.Any=1]="Any",Q[Q.Unknown=2]="Unknown",Q[Q.String=4]="String",Q[Q.Number=8]="Number",Q[Q.Boolean=16]="Boolean",Q[Q.Enum=32]="Enum",Q[Q.BigInt=64]="BigInt",Q[Q.StringLiteral=128]="StringLiteral",Q[Q.NumberLiteral=256]="NumberLiteral",Q[Q.BooleanLiteral=512]="BooleanLiteral",Q[Q.EnumLiteral=1024]="EnumLiteral",Q[Q.BigIntLiteral=2048]="BigIntLiteral",Q[Q.ESSymbol=4096]="ESSymbol",Q[Q.UniqueESSymbol=8192]="UniqueESSymbol",Q[Q.Void=16384]="Void",Q[Q.Undefined=32768]="Undefined",Q[Q.Null=65536]="Null",Q[Q.Never=131072]="Never",Q[Q.TypeParameter=262144]="TypeParameter",Q[Q.Object=524288]="Object",Q[Q.Union=1048576]="Union",Q[Q.Intersection=2097152]="Intersection",Q[Q.Index=4194304]="Index",Q[Q.IndexedAccess=8388608]="IndexedAccess",Q[Q.Conditional=16777216]="Conditional",Q[Q.Substitution=33554432]="Substitution",Q[Q.NonPrimitive=67108864]="NonPrimitive",Q[Q.TemplateLiteral=134217728]="TemplateLiteral",Q[Q.StringMapping=268435456]="StringMapping",Q[Q.AnyOrUnknown=3]="AnyOrUnknown",Q[Q.Nullable=98304]="Nullable",Q[Q.Literal=2944]="Literal",Q[Q.Unit=109440]="Unit",Q[Q.StringOrNumberLiteral=384]="StringOrNumberLiteral",Q[Q.StringOrNumberLiteralOrUnique=8576]="StringOrNumberLiteralOrUnique",Q[Q.DefinitelyFalsy=117632]="DefinitelyFalsy",Q[Q.PossiblyFalsy=117724]="PossiblyFalsy",Q[Q.Intrinsic=67359327]="Intrinsic",Q[Q.Primitive=131068]="Primitive",Q[Q.StringLike=402653316]="StringLike",Q[Q.NumberLike=296]="NumberLike",Q[Q.BigIntLike=2112]="BigIntLike",Q[Q.BooleanLike=528]="BooleanLike",Q[Q.EnumLike=1056]="EnumLike",Q[Q.ESSymbolLike=12288]="ESSymbolLike",Q[Q.VoidLike=49152]="VoidLike",Q[Q.DefinitelyNonNullable=470302716]="DefinitelyNonNullable",Q[Q.DisjointDomains=469892092]="DisjointDomains",Q[Q.UnionOrIntersection=3145728]="UnionOrIntersection",Q[Q.StructuredType=3670016]="StructuredType",Q[Q.TypeVariable=8650752]="TypeVariable",Q[Q.InstantiableNonPrimitive=58982400]="InstantiableNonPrimitive",Q[Q.InstantiablePrimitive=406847488]="InstantiablePrimitive",Q[Q.Instantiable=465829888]="Instantiable",Q[Q.StructuredOrInstantiable=469499904]="StructuredOrInstantiable",Q[Q.ObjectFlagsType=3899393]="ObjectFlagsType",Q[Q.Simplifiable=25165824]="Simplifiable",Q[Q.Singleton=67358815]="Singleton",Q[Q.Narrowable=536624127]="Narrowable",Q[Q.IncludesMask=205258751]="IncludesMask",Q[Q.IncludesMissingType=262144]="IncludesMissingType",Q[Q.IncludesNonWideningType=4194304]="IncludesNonWideningType",Q[Q.IncludesWildcard=8388608]="IncludesWildcard",Q[Q.IncludesEmptyObject=16777216]="IncludesEmptyObject",Q[Q.IncludesInstantiable=33554432]="IncludesInstantiable",Q[Q.NotPrimitiveUnion=36323363]="NotPrimitiveUnion",(G=e.ObjectFlags||(e.ObjectFlags={}))[G.Class=1]="Class",G[G.Interface=2]="Interface",G[G.Reference=4]="Reference",G[G.Tuple=8]="Tuple",G[G.Anonymous=16]="Anonymous",G[G.Mapped=32]="Mapped",G[G.Instantiated=64]="Instantiated",G[G.ObjectLiteral=128]="ObjectLiteral",G[G.EvolvingArray=256]="EvolvingArray",G[G.ObjectLiteralPatternWithComputedProperties=512]="ObjectLiteralPatternWithComputedProperties",G[G.ReverseMapped=1024]="ReverseMapped",G[G.JsxAttributes=2048]="JsxAttributes",G[G.JSLiteral=4096]="JSLiteral",G[G.FreshLiteral=8192]="FreshLiteral",G[G.ArrayLiteral=16384]="ArrayLiteral",G[G.PrimitiveUnion=32768]="PrimitiveUnion",G[G.ContainsWideningType=65536]="ContainsWideningType",G[G.ContainsObjectOrArrayLiteral=131072]="ContainsObjectOrArrayLiteral",G[G.NonInferrableType=262144]="NonInferrableType",G[G.CouldContainTypeVariablesComputed=524288]="CouldContainTypeVariablesComputed",G[G.CouldContainTypeVariables=1048576]="CouldContainTypeVariables",G[G.ClassOrInterface=3]="ClassOrInterface",G[G.RequiresWidening=196608]="RequiresWidening",G[G.PropagatingFlags=458752]="PropagatingFlags",G[G.ObjectTypeKindMask=1343]="ObjectTypeKindMask",G[G.ContainsSpread=2097152]="ContainsSpread",G[G.ObjectRestType=4194304]="ObjectRestType",G[G.InstantiationExpressionType=8388608]="InstantiationExpressionType",G[G.IsClassInstanceClone=16777216]="IsClassInstanceClone",G[G.IdenticalBaseTypeCalculated=33554432]="IdenticalBaseTypeCalculated",G[G.IdenticalBaseTypeExists=67108864]="IdenticalBaseTypeExists",G[G.IsGenericTypeComputed=2097152]="IsGenericTypeComputed",G[G.IsGenericObjectType=4194304]="IsGenericObjectType",G[G.IsGenericIndexType=8388608]="IsGenericIndexType",G[G.IsGenericType=12582912]="IsGenericType",G[G.ContainsIntersections=16777216]="ContainsIntersections",G[G.IsNeverIntersectionComputed=16777216]="IsNeverIntersectionComputed",G[G.IsNeverIntersection=33554432]="IsNeverIntersection",(H=e.VarianceFlags||(e.VarianceFlags={}))[H.Invariant=0]="Invariant",H[H.Covariant=1]="Covariant",H[H.Contravariant=2]="Contravariant",H[H.Bivariant=3]="Bivariant",H[H.Independent=4]="Independent",H[H.VarianceMask=7]="VarianceMask",H[H.Unmeasurable=8]="Unmeasurable",H[H.Unreliable=16]="Unreliable",H[H.AllowsStructuralFallback=24]="AllowsStructuralFallback",(W=e.ElementFlags||(e.ElementFlags={}))[W.Required=1]="Required",W[W.Optional=2]="Optional",W[W.Rest=4]="Rest",W[W.Variadic=8]="Variadic",W[W.Fixed=3]="Fixed",W[W.Variable=12]="Variable",W[W.NonRequired=14]="NonRequired",W[W.NonRest=11]="NonRest",(q=e.AccessFlags||(e.AccessFlags={}))[q.None=0]="None",q[q.IncludeUndefined=1]="IncludeUndefined",q[q.NoIndexSignatures=2]="NoIndexSignatures",q[q.Writing=4]="Writing",q[q.CacheSymbol=8]="CacheSymbol",q[q.NoTupleBoundsCheck=16]="NoTupleBoundsCheck",q[q.ExpressionPosition=32]="ExpressionPosition",q[q.ReportDeprecated=64]="ReportDeprecated",q[q.SuppressNoImplicitAnyError=128]="SuppressNoImplicitAnyError",q[q.Contextual=256]="Contextual",q[q.Persistent=1]="Persistent",(V=e.JsxReferenceKind||(e.JsxReferenceKind={}))[V.Component=0]="Component",V[V.Function=1]="Function",V[V.Mixed=2]="Mixed",(U=e.SignatureKind||(e.SignatureKind={}))[U.Call=0]="Call",U[U.Construct=1]="Construct",(K=e.SignatureFlags||(e.SignatureFlags={}))[K.None=0]="None",K[K.HasRestParameter=1]="HasRestParameter",K[K.HasLiteralTypes=2]="HasLiteralTypes",K[K.Abstract=4]="Abstract",K[K.IsInnerCallChain=8]="IsInnerCallChain",K[K.IsOuterCallChain=16]="IsOuterCallChain",K[K.IsUntypedSignatureInJSFile=32]="IsUntypedSignatureInJSFile",K[K.PropagatingFlags=39]="PropagatingFlags",K[K.CallChainFlags=24]="CallChainFlags",(z=e.IndexKind||(e.IndexKind={}))[z.String=0]="String",z[z.Number=1]="Number",(J=e.TypeMapKind||(e.TypeMapKind={}))[J.Simple=0]="Simple",J[J.Array=1]="Array",J[J.Function=2]="Function",J[J.Composite=3]="Composite",J[J.Merged=4]="Merged",(j=e.InferencePriority||(e.InferencePriority={}))[j.NakedTypeVariable=1]="NakedTypeVariable",j[j.SpeculativeTuple=2]="SpeculativeTuple",j[j.SubstituteSource=4]="SubstituteSource",j[j.HomomorphicMappedType=8]="HomomorphicMappedType",j[j.PartialHomomorphicMappedType=16]="PartialHomomorphicMappedType",j[j.MappedTypeConstraint=32]="MappedTypeConstraint",j[j.ContravariantConditional=64]="ContravariantConditional",j[j.ReturnType=128]="ReturnType",j[j.LiteralKeyof=256]="LiteralKeyof",j[j.NoConstraints=512]="NoConstraints",j[j.AlwaysStrict=1024]="AlwaysStrict",j[j.MaxValue=2048]="MaxValue",j[j.PriorityImpliesCombination=416]="PriorityImpliesCombination",j[j.Circularity=-1]="Circularity",(B=e.InferenceFlags||(e.InferenceFlags={}))[B.None=0]="None",B[B.NoDefault=1]="NoDefault",B[B.AnyDefault=2]="AnyDefault",B[B.SkippedGenericFunction=4]="SkippedGenericFunction",(R=e.Ternary||(e.Ternary={}))[R.False=0]="False",R[R.Unknown=1]="Unknown",R[R.Maybe=3]="Maybe",R[R.True=-1]="True",(L=e.AssignmentDeclarationKind||(e.AssignmentDeclarationKind={}))[L.None=0]="None",L[L.ExportsProperty=1]="ExportsProperty",L[L.ModuleExports=2]="ModuleExports",L[L.PrototypeProperty=3]="PrototypeProperty",L[L.ThisProperty=4]="ThisProperty",L[L.Property=5]="Property",L[L.Prototype=6]="Prototype",L[L.ObjectDefinePropertyValue=7]="ObjectDefinePropertyValue",L[L.ObjectDefinePropertyExports=8]="ObjectDefinePropertyExports",L[L.ObjectDefinePrototypeProperty=9]="ObjectDefinePrototypeProperty",function(e){e[e.Warning=0]="Warning",e[e.Error=1]="Error",e[e.Suggestion=2]="Suggestion",e[e.Message=3]="Message";}(u=e.DiagnosticCategory||(e.DiagnosticCategory={})),e.diagnosticCategoryName=function(e,t){void 0===t&&(t=!0);var r=u[e.category];return t?r.toLowerCase():r},(M=e.ModuleResolutionKind||(e.ModuleResolutionKind={}))[M.Classic=1]="Classic",M[M.NodeJs=2]="NodeJs",M[M.Node16=3]="Node16",M[M.NodeNext=99]="NodeNext",(O=e.ModuleDetectionKind||(e.ModuleDetectionKind={}))[O.Legacy=1]="Legacy",O[O.Auto=2]="Auto",O[O.Force=3]="Force",(I=e.WatchFileKind||(e.WatchFileKind={}))[I.FixedPollingInterval=0]="FixedPollingInterval",I[I.PriorityPollingInterval=1]="PriorityPollingInterval",I[I.DynamicPriorityPolling=2]="DynamicPriorityPolling",I[I.FixedChunkSizePolling=3]="FixedChunkSizePolling",I[I.UseFsEvents=4]="UseFsEvents",I[I.UseFsEventsOnParentDirectory=5]="UseFsEventsOnParentDirectory",(w=e.WatchDirectoryKind||(e.WatchDirectoryKind={}))[w.UseFsEvents=0]="UseFsEvents",w[w.FixedPollingInterval=1]="FixedPollingInterval",w[w.DynamicPriorityPolling=2]="DynamicPriorityPolling",w[w.FixedChunkSizePolling=3]="FixedChunkSizePolling",(P=e.PollingWatchKind||(e.PollingWatchKind={}))[P.FixedInterval=0]="FixedInterval",P[P.PriorityInterval=1]="PriorityInterval",P[P.DynamicPriority=2]="DynamicPriority",P[P.FixedChunkSize=3]="FixedChunkSize",(A=e.ModuleKind||(e.ModuleKind={}))[A.None=0]="None",A[A.CommonJS=1]="CommonJS",A[A.AMD=2]="AMD",A[A.UMD=3]="UMD",A[A.System=4]="System",A[A.ES2015=5]="ES2015",A[A.ES2020=6]="ES2020",A[A.ES2022=7]="ES2022",A[A.ESNext=99]="ESNext",A[A.Node16=100]="Node16",A[A.NodeNext=199]="NodeNext",(F=e.JsxEmit||(e.JsxEmit={}))[F.None=0]="None",F[F.Preserve=1]="Preserve",F[F.React=2]="React",F[F.ReactNative=3]="ReactNative",F[F.ReactJSX=4]="ReactJSX",F[F.ReactJSXDev=5]="ReactJSXDev",(N=e.ImportsNotUsedAsValues||(e.ImportsNotUsedAsValues={}))[N.Remove=0]="Remove",N[N.Preserve=1]="Preserve",N[N.Error=2]="Error",(E=e.NewLineKind||(e.NewLineKind={}))[E.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",E[E.LineFeed=1]="LineFeed",(k=e.ScriptKind||(e.ScriptKind={}))[k.Unknown=0]="Unknown",k[k.JS=1]="JS",k[k.JSX=2]="JSX",k[k.TS=3]="TS",k[k.TSX=4]="TSX",k[k.External=5]="External",k[k.JSON=6]="JSON",k[k.Deferred=7]="Deferred",(C=e.ScriptTarget||(e.ScriptTarget={}))[C.ES3=0]="ES3",C[C.ES5=1]="ES5",C[C.ES2015=2]="ES2015",C[C.ES2016=3]="ES2016",C[C.ES2017=4]="ES2017",C[C.ES2018=5]="ES2018",C[C.ES2019=6]="ES2019",C[C.ES2020=7]="ES2020",C[C.ES2021=8]="ES2021",C[C.ES2022=9]="ES2022",C[C.ESNext=99]="ESNext",C[C.JSON=100]="JSON",C[C.Latest=99]="Latest",(T=e.LanguageVariant||(e.LanguageVariant={}))[T.Standard=0]="Standard",T[T.JSX=1]="JSX",(S=e.WatchDirectoryFlags||(e.WatchDirectoryFlags={}))[S.None=0]="None",S[S.Recursive=1]="Recursive",(D=e.CharacterCodes||(e.CharacterCodes={}))[D.nullCharacter=0]="nullCharacter",D[D.maxAsciiCharacter=127]="maxAsciiCharacter",D[D.lineFeed=10]="lineFeed",D[D.carriageReturn=13]="carriageReturn",D[D.lineSeparator=8232]="lineSeparator",D[D.paragraphSeparator=8233]="paragraphSeparator",D[D.nextLine=133]="nextLine",D[D.space=32]="space",D[D.nonBreakingSpace=160]="nonBreakingSpace",D[D.enQuad=8192]="enQuad",D[D.emQuad=8193]="emQuad",D[D.enSpace=8194]="enSpace",D[D.emSpace=8195]="emSpace",D[D.threePerEmSpace=8196]="threePerEmSpace",D[D.fourPerEmSpace=8197]="fourPerEmSpace",D[D.sixPerEmSpace=8198]="sixPerEmSpace",D[D.figureSpace=8199]="figureSpace",D[D.punctuationSpace=8200]="punctuationSpace",D[D.thinSpace=8201]="thinSpace",D[D.hairSpace=8202]="hairSpace",D[D.zeroWidthSpace=8203]="zeroWidthSpace",D[D.narrowNoBreakSpace=8239]="narrowNoBreakSpace",D[D.ideographicSpace=12288]="ideographicSpace",D[D.mathematicalSpace=8287]="mathematicalSpace",D[D.ogham=5760]="ogham",D[D._=95]="_",D[D.$=36]="$",D[D._0=48]="_0",D[D._1=49]="_1",D[D._2=50]="_2",D[D._3=51]="_3",D[D._4=52]="_4",D[D._5=53]="_5",D[D._6=54]="_6",D[D._7=55]="_7",D[D._8=56]="_8",D[D._9=57]="_9",D[D.a=97]="a",D[D.b=98]="b",D[D.c=99]="c",D[D.d=100]="d",D[D.e=101]="e",D[D.f=102]="f",D[D.g=103]="g",D[D.h=104]="h",D[D.i=105]="i",D[D.j=106]="j",D[D.k=107]="k",D[D.l=108]="l",D[D.m=109]="m",D[D.n=110]="n",D[D.o=111]="o",D[D.p=112]="p",D[D.q=113]="q",D[D.r=114]="r",D[D.s=115]="s",D[D.t=116]="t",D[D.u=117]="u",D[D.v=118]="v",D[D.w=119]="w",D[D.x=120]="x",D[D.y=121]="y",D[D.z=122]="z",D[D.A=65]="A",D[D.B=66]="B",D[D.C=67]="C",D[D.D=68]="D",D[D.E=69]="E",D[D.F=70]="F",D[D.G=71]="G",D[D.H=72]="H",D[D.I=73]="I",D[D.J=74]="J",D[D.K=75]="K",D[D.L=76]="L",D[D.M=77]="M",D[D.N=78]="N",D[D.O=79]="O",D[D.P=80]="P",D[D.Q=81]="Q",D[D.R=82]="R",D[D.S=83]="S",D[D.T=84]="T",D[D.U=85]="U",D[D.V=86]="V",D[D.W=87]="W",D[D.X=88]="X",D[D.Y=89]="Y",D[D.Z=90]="Z",D[D.ampersand=38]="ampersand",D[D.asterisk=42]="asterisk",D[D.at=64]="at",D[D.backslash=92]="backslash",D[D.backtick=96]="backtick",D[D.bar=124]="bar",D[D.caret=94]="caret",D[D.closeBrace=125]="closeBrace",D[D.closeBracket=93]="closeBracket",D[D.closeParen=41]="closeParen",D[D.colon=58]="colon",D[D.comma=44]="comma",D[D.dot=46]="dot",D[D.doubleQuote=34]="doubleQuote",D[D.equals=61]="equals",D[D.exclamation=33]="exclamation",D[D.greaterThan=62]="greaterThan",D[D.hash=35]="hash",D[D.lessThan=60]="lessThan",D[D.minus=45]="minus",D[D.openBrace=123]="openBrace",D[D.openBracket=91]="openBracket",D[D.openParen=40]="openParen",D[D.percent=37]="percent",D[D.plus=43]="plus",D[D.question=63]="question",D[D.semicolon=59]="semicolon",D[D.singleQuote=39]="singleQuote",D[D.slash=47]="slash",D[D.tilde=126]="tilde",D[D.backspace=8]="backspace",D[D.formFeed=12]="formFeed",D[D.byteOrderMark=65279]="byteOrderMark",D[D.tab=9]="tab",D[D.verticalTab=11]="verticalTab",(x=e.Extension||(e.Extension={})).Ts=".ts",x.Tsx=".tsx",x.Dts=".d.ts",x.Js=".js",x.Jsx=".jsx",x.Json=".json",x.TsBuildInfo=".tsbuildinfo",x.Mjs=".mjs",x.Mts=".mts",x.Dmts=".d.mts",x.Cjs=".cjs",x.Cts=".cts",x.Dcts=".d.cts",(b=e.TransformFlags||(e.TransformFlags={}))[b.None=0]="None",b[b.ContainsTypeScript=1]="ContainsTypeScript",b[b.ContainsJsx=2]="ContainsJsx",b[b.ContainsESNext=4]="ContainsESNext",b[b.ContainsES2022=8]="ContainsES2022",b[b.ContainsES2021=16]="ContainsES2021",b[b.ContainsES2020=32]="ContainsES2020",b[b.ContainsES2019=64]="ContainsES2019",b[b.ContainsES2018=128]="ContainsES2018",b[b.ContainsES2017=256]="ContainsES2017",b[b.ContainsES2016=512]="ContainsES2016",b[b.ContainsES2015=1024]="ContainsES2015",b[b.ContainsGenerator=2048]="ContainsGenerator",b[b.ContainsDestructuringAssignment=4096]="ContainsDestructuringAssignment",b[b.ContainsTypeScriptClassSyntax=4096]="ContainsTypeScriptClassSyntax",b[b.ContainsLexicalThis=8192]="ContainsLexicalThis",b[b.ContainsRestOrSpread=16384]="ContainsRestOrSpread",b[b.ContainsObjectRestOrSpread=32768]="ContainsObjectRestOrSpread",b[b.ContainsComputedPropertyName=65536]="ContainsComputedPropertyName",b[b.ContainsBlockScopedBinding=131072]="ContainsBlockScopedBinding",b[b.ContainsBindingPattern=262144]="ContainsBindingPattern",b[b.ContainsYield=524288]="ContainsYield",b[b.ContainsAwait=1048576]="ContainsAwait",b[b.ContainsHoistedDeclarationOrCompletion=2097152]="ContainsHoistedDeclarationOrCompletion",b[b.ContainsDynamicImport=4194304]="ContainsDynamicImport",b[b.ContainsClassFields=8388608]="ContainsClassFields",b[b.ContainsPossibleTopLevelAwait=16777216]="ContainsPossibleTopLevelAwait",b[b.ContainsLexicalSuper=33554432]="ContainsLexicalSuper",b[b.ContainsUpdateExpressionForIdentifier=67108864]="ContainsUpdateExpressionForIdentifier",b[b.HasComputedFlags=536870912]="HasComputedFlags",b[b.AssertTypeScript=1]="AssertTypeScript",b[b.AssertJsx=2]="AssertJsx",b[b.AssertESNext=4]="AssertESNext",b[b.AssertES2022=8]="AssertES2022",b[b.AssertES2021=16]="AssertES2021",b[b.AssertES2020=32]="AssertES2020",b[b.AssertES2019=64]="AssertES2019",b[b.AssertES2018=128]="AssertES2018",b[b.AssertES2017=256]="AssertES2017",b[b.AssertES2016=512]="AssertES2016",b[b.AssertES2015=1024]="AssertES2015",b[b.AssertGenerator=2048]="AssertGenerator",b[b.AssertDestructuringAssignment=4096]="AssertDestructuringAssignment",b[b.OuterExpressionExcludes=536870912]="OuterExpressionExcludes",b[b.PropertyAccessExcludes=536870912]="PropertyAccessExcludes",b[b.NodeExcludes=536870912]="NodeExcludes",b[b.ArrowFunctionExcludes=557748224]="ArrowFunctionExcludes",b[b.FunctionExcludes=591310848]="FunctionExcludes",b[b.ConstructorExcludes=591306752]="ConstructorExcludes",b[b.MethodOrAccessorExcludes=574529536]="MethodOrAccessorExcludes",b[b.PropertyExcludes=570433536]="PropertyExcludes",b[b.ClassExcludes=536940544]="ClassExcludes",b[b.ModuleExcludes=589443072]="ModuleExcludes",b[b.TypeExcludes=-2]="TypeExcludes",b[b.ObjectLiteralExcludes=536973312]="ObjectLiteralExcludes",b[b.ArrayLiteralOrCallOrNewExcludes=536887296]="ArrayLiteralOrCallOrNewExcludes",b[b.VariableDeclarationListExcludes=537165824]="VariableDeclarationListExcludes",b[b.ParameterExcludes=536870912]="ParameterExcludes",b[b.CatchClauseExcludes=536903680]="CatchClauseExcludes",b[b.BindingPatternExcludes=536887296]="BindingPatternExcludes",b[b.ContainsLexicalThisOrSuper=33562624]="ContainsLexicalThisOrSuper",b[b.PropertyNamePropagatingFlags=33562624]="PropertyNamePropagatingFlags",(h=e.SnippetKind||(e.SnippetKind={}))[h.TabStop=0]="TabStop",h[h.Placeholder=1]="Placeholder",h[h.Choice=2]="Choice",h[h.Variable=3]="Variable",(v=e.EmitFlags||(e.EmitFlags={}))[v.None=0]="None",v[v.SingleLine=1]="SingleLine",v[v.AdviseOnEmitNode=2]="AdviseOnEmitNode",v[v.NoSubstitution=4]="NoSubstitution",v[v.CapturesThis=8]="CapturesThis",v[v.NoLeadingSourceMap=16]="NoLeadingSourceMap",v[v.NoTrailingSourceMap=32]="NoTrailingSourceMap",v[v.NoSourceMap=48]="NoSourceMap",v[v.NoNestedSourceMaps=64]="NoNestedSourceMaps",v[v.NoTokenLeadingSourceMaps=128]="NoTokenLeadingSourceMaps",v[v.NoTokenTrailingSourceMaps=256]="NoTokenTrailingSourceMaps",v[v.NoTokenSourceMaps=384]="NoTokenSourceMaps",v[v.NoLeadingComments=512]="NoLeadingComments",v[v.NoTrailingComments=1024]="NoTrailingComments",v[v.NoComments=1536]="NoComments",v[v.NoNestedComments=2048]="NoNestedComments",v[v.HelperName=4096]="HelperName",v[v.ExportName=8192]="ExportName",v[v.LocalName=16384]="LocalName",v[v.InternalName=32768]="InternalName",v[v.Indented=65536]="Indented",v[v.NoIndentation=131072]="NoIndentation",v[v.AsyncFunctionBody=262144]="AsyncFunctionBody",v[v.ReuseTempVariableScope=524288]="ReuseTempVariableScope",v[v.CustomPrologue=1048576]="CustomPrologue",v[v.NoHoisting=2097152]="NoHoisting",v[v.HasEndOfDeclarationMarker=4194304]="HasEndOfDeclarationMarker",v[v.Iterator=8388608]="Iterator",v[v.NoAsciiEscaping=16777216]="NoAsciiEscaping",v[v.TypeScriptClassWrapper=33554432]="TypeScriptClassWrapper",v[v.NeverApplyImportHelper=67108864]="NeverApplyImportHelper",v[v.IgnoreSourceNewlines=134217728]="IgnoreSourceNewlines",v[v.Immutable=268435456]="Immutable",v[v.IndirectCall=536870912]="IndirectCall",(y=e.ExternalEmitHelpers||(e.ExternalEmitHelpers={}))[y.Extends=1]="Extends",y[y.Assign=2]="Assign",y[y.Rest=4]="Rest",y[y.Decorate=8]="Decorate",y[y.Metadata=16]="Metadata",y[y.Param=32]="Param",y[y.Awaiter=64]="Awaiter",y[y.Generator=128]="Generator",y[y.Values=256]="Values",y[y.Read=512]="Read",y[y.SpreadArray=1024]="SpreadArray",y[y.Await=2048]="Await",y[y.AsyncGenerator=4096]="AsyncGenerator",y[y.AsyncDelegator=8192]="AsyncDelegator",y[y.AsyncValues=16384]="AsyncValues",y[y.ExportStar=32768]="ExportStar",y[y.ImportStar=65536]="ImportStar",y[y.ImportDefault=131072]="ImportDefault",y[y.MakeTemplateObject=262144]="MakeTemplateObject",y[y.ClassPrivateFieldGet=524288]="ClassPrivateFieldGet",y[y.ClassPrivateFieldSet=1048576]="ClassPrivateFieldSet",y[y.ClassPrivateFieldIn=2097152]="ClassPrivateFieldIn",y[y.CreateBinding=4194304]="CreateBinding",y[y.FirstEmitHelper=1]="FirstEmitHelper",y[y.LastEmitHelper=4194304]="LastEmitHelper",y[y.ForOfIncludes=256]="ForOfIncludes",y[y.ForAwaitOfIncludes=16384]="ForAwaitOfIncludes",y[y.AsyncGeneratorIncludes=6144]="AsyncGeneratorIncludes",y[y.AsyncDelegatorIncludes=26624]="AsyncDelegatorIncludes",y[y.SpreadIncludes=1536]="SpreadIncludes",(m=e.EmitHint||(e.EmitHint={}))[m.SourceFile=0]="SourceFile",m[m.Expression=1]="Expression",m[m.IdentifierName=2]="IdentifierName",m[m.MappedTypeParameter=3]="MappedTypeParameter",m[m.Unspecified=4]="Unspecified",m[m.EmbeddedStatement=5]="EmbeddedStatement",m[m.JsxAttributeValue=6]="JsxAttributeValue",(g=e.OuterExpressionKinds||(e.OuterExpressionKinds={}))[g.Parentheses=1]="Parentheses",g[g.TypeAssertions=2]="TypeAssertions",g[g.NonNullAssertions=4]="NonNullAssertions",g[g.PartiallyEmittedExpressions=8]="PartiallyEmittedExpressions",g[g.Assertions=6]="Assertions",g[g.All=15]="All",g[g.ExcludeJSDocTypeAssertion=16]="ExcludeJSDocTypeAssertion",(f=e.LexicalEnvironmentFlags||(e.LexicalEnvironmentFlags={}))[f.None=0]="None",f[f.InParameters=1]="InParameters",f[f.VariablesHoistedInParameters=2]="VariablesHoistedInParameters",(p=e.BundleFileSectionKind||(e.BundleFileSectionKind={})).Prologue="prologue",p.EmitHelpers="emitHelpers",p.NoDefaultLib="no-default-lib",p.Reference="reference",p.Type="type",p.TypeResolutionModeRequire="type-require",p.TypeResolutionModeImport="type-import",p.Lib="lib",p.Prepend="prepend",p.Text="text",p.Internal="internal",(d=e.ListFormat||(e.ListFormat={}))[d.None=0]="None",d[d.SingleLine=0]="SingleLine",d[d.MultiLine=1]="MultiLine",d[d.PreserveLines=2]="PreserveLines",d[d.LinesMask=3]="LinesMask",d[d.NotDelimited=0]="NotDelimited",d[d.BarDelimited=4]="BarDelimited",d[d.AmpersandDelimited=8]="AmpersandDelimited",d[d.CommaDelimited=16]="CommaDelimited",d[d.AsteriskDelimited=32]="AsteriskDelimited",d[d.DelimitersMask=60]="DelimitersMask",d[d.AllowTrailingComma=64]="AllowTrailingComma",d[d.Indented=128]="Indented",d[d.SpaceBetweenBraces=256]="SpaceBetweenBraces",d[d.SpaceBetweenSiblings=512]="SpaceBetweenSiblings",d[d.Braces=1024]="Braces",d[d.Parenthesis=2048]="Parenthesis",d[d.AngleBrackets=4096]="AngleBrackets",d[d.SquareBrackets=8192]="SquareBrackets",d[d.BracketsMask=15360]="BracketsMask",d[d.OptionalIfUndefined=16384]="OptionalIfUndefined",d[d.OptionalIfEmpty=32768]="OptionalIfEmpty",d[d.Optional=49152]="Optional",d[d.PreferNewLine=65536]="PreferNewLine",d[d.NoTrailingNewLine=131072]="NoTrailingNewLine",d[d.NoInterveningComments=262144]="NoInterveningComments",d[d.NoSpaceIfEmpty=524288]="NoSpaceIfEmpty",d[d.SingleElement=1048576]="SingleElement",d[d.SpaceAfterList=2097152]="SpaceAfterList",d[d.Modifiers=262656]="Modifiers",d[d.HeritageClauses=512]="HeritageClauses",d[d.SingleLineTypeLiteralMembers=768]="SingleLineTypeLiteralMembers",d[d.MultiLineTypeLiteralMembers=32897]="MultiLineTypeLiteralMembers",d[d.SingleLineTupleTypeElements=528]="SingleLineTupleTypeElements",d[d.MultiLineTupleTypeElements=657]="MultiLineTupleTypeElements",d[d.UnionTypeConstituents=516]="UnionTypeConstituents",d[d.IntersectionTypeConstituents=520]="IntersectionTypeConstituents",d[d.ObjectBindingPatternElements=525136]="ObjectBindingPatternElements",d[d.ArrayBindingPatternElements=524880]="ArrayBindingPatternElements",d[d.ObjectLiteralExpressionProperties=526226]="ObjectLiteralExpressionProperties",d[d.ImportClauseEntries=526226]="ImportClauseEntries",d[d.ArrayLiteralExpressionElements=8914]="ArrayLiteralExpressionElements",d[d.CommaListElements=528]="CommaListElements",d[d.CallExpressionArguments=2576]="CallExpressionArguments",d[d.NewExpressionArguments=18960]="NewExpressionArguments",d[d.TemplateExpressionSpans=262144]="TemplateExpressionSpans",d[d.SingleLineBlockStatements=768]="SingleLineBlockStatements",d[d.MultiLineBlockStatements=129]="MultiLineBlockStatements",d[d.VariableDeclarationList=528]="VariableDeclarationList",d[d.SingleLineFunctionBodyStatements=768]="SingleLineFunctionBodyStatements",d[d.MultiLineFunctionBodyStatements=1]="MultiLineFunctionBodyStatements",d[d.ClassHeritageClauses=0]="ClassHeritageClauses",d[d.ClassMembers=129]="ClassMembers",d[d.InterfaceMembers=129]="InterfaceMembers",d[d.EnumMembers=145]="EnumMembers",d[d.CaseBlockClauses=129]="CaseBlockClauses",d[d.NamedImportsOrExportsElements=525136]="NamedImportsOrExportsElements",d[d.JsxElementOrFragmentChildren=262144]="JsxElementOrFragmentChildren",d[d.JsxElementAttributes=262656]="JsxElementAttributes",d[d.CaseOrDefaultClauseStatements=163969]="CaseOrDefaultClauseStatements",d[d.HeritageClauseTypes=528]="HeritageClauseTypes",d[d.SourceFileStatements=131073]="SourceFileStatements",d[d.Decorators=2146305]="Decorators",d[d.TypeArguments=53776]="TypeArguments",d[d.TypeParameters=53776]="TypeParameters",d[d.Parameters=2576]="Parameters",d[d.IndexSignatureParameters=8848]="IndexSignatureParameters",d[d.JSDocComment=33]="JSDocComment",(_=e.PragmaKindFlags||(e.PragmaKindFlags={}))[_.None=0]="None",_[_.TripleSlashXML=1]="TripleSlashXML",_[_.SingleLine=2]="SingleLine",_[_.MultiLine=4]="MultiLine",_[_.All=7]="All",_[_.Default=7]="Default",e.commentPragmas={reference:{args:[{name:"types",optional:!0,captureSpan:!0},{name:"lib",optional:!0,captureSpan:!0},{name:"path",optional:!0,captureSpan:!0},{name:"no-default-lib",optional:!0},{name:"resolution-mode",optional:!0}],kind:1},"amd-dependency":{args:[{name:"path"},{name:"name",optional:!0}],kind:1},"amd-module":{args:[{name:"name"}],kind:1},"ts-check":{kind:2},"ts-nocheck":{kind:2},jsx:{args:[{name:"factory"}],kind:4},jsxfrag:{args:[{name:"factory"}],kind:4},jsximportsource:{args:[{name:"factory"}],kind:4},jsxruntime:{args:[{name:"factory"}],kind:4}};}(t),function(e){function t(e){for(var t=5381,r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r);return t.toString()}var r,n;function a(t,r){return t.getModifiedTime(r)||e.missingFileModifiedTime}function o(e){var t;return (t={})[n.Low]=e.Low,t[n.Medium]=e.Medium,t[n.High]=e.High,t}e.generateDjb2Hash=t,e.setStackTraceLimit=function(){Error.stackTraceLimit<100&&(Error.stackTraceLimit=100);},function(e){e[e.Created=0]="Created",e[e.Changed=1]="Changed",e[e.Deleted=2]="Deleted";}(r=e.FileWatcherEventKind||(e.FileWatcherEventKind={})),function(e){e[e.High=2e3]="High",e[e.Medium=500]="Medium",e[e.Low=250]="Low";}(n=e.PollingInterval||(e.PollingInterval={})),e.missingFileModifiedTime=new Date(0),e.getModifiedTime=a;var s={Low:32,Medium:64,High:256},c=o(s);function l(t){if(t.getEnvironmentVariable){var r=function(e,t){var r=a("TSC_WATCH_POLLINGINTERVAL");return !!r&&(n("Low"),n("Medium"),n("High"),!0);function n(e){t[e]=r[e]||t[e];}}(0,n);c=l("TSC_WATCH_POLLINGCHUNKSIZE",s)||c,e.unchangedPollThresholds=l("TSC_WATCH_UNCHANGEDPOLLTHRESHOLDS",s)||e.unchangedPollThresholds;}function a(e){var r;return n("Low"),n("Medium"),n("High"),r;function n(n){var i=function(e,r){return t.getEnvironmentVariable("".concat(e,"_").concat(r.toUpperCase()))}(e,n);i&&((r||(r={}))[n]=Number(i));}}function l(e,t){var n=a(e);return (r||n)&&o(n?i$1(i$1({},t),n):t)}}function u(e,t,r,n,i){for(var o=r,s=t.length;n&&s;++r===t.length&&(o<r&&(t.length=o),r=0,o=0),s--){var c=t[r];if(c)if(c.isClosed)t[r]=void 0;else {n--;var l=f(c,a(e,c.fileName));c.isClosed?t[r]=void 0:(null==i||i(c,r,l),t[r]&&(o<r&&(t[o]=c,t[r]=void 0),o++));}}return r}function _(t){var r=[],i=[],o=_(n.Low),s=_(n.Medium),l=_(n.High);return function(n,i,o){var s={fileName:n,callback:i,unchangedPolls:0,mtime:a(t,n)};return r.push(s),m(s,o),{close:function(){s.isClosed=!0,e.unorderedRemoveItem(r,s);}}};function _(e){var t=[];return t.pollingInterval=e,t.pollIndex=0,t.pollScheduled=!1,t}function d(t){t.pollIndex=f(t,t.pollingInterval,t.pollIndex,c[t.pollingInterval]),t.length?v(t.pollingInterval):(e.Debug.assert(0===t.pollIndex),t.pollScheduled=!1);}function p(e){f(i,n.Low,0,i.length),d(e),!e.pollScheduled&&i.length&&v(n.Low);}function f(r,a,o,s){return u(t,r,o,s,(function(t,o,s){var c;s?(t.unchangedPolls=0,r!==i&&(r[o]=void 0,c=t,i.push(c),y(n.Low))):t.unchangedPolls!==e.unchangedPollThresholds[a]?t.unchangedPolls++:r===i?(t.unchangedPolls=1,r[o]=void 0,m(t,n.Low)):a!==n.High&&(t.unchangedPolls++,r[o]=void 0,m(t,a===n.Low?n.Medium:n.High));}))}function g(e){switch(e){case n.Low:return o;case n.Medium:return s;case n.High:return l}}function m(e,t){g(t).push(e),y(t);}function y(e){g(e).pollScheduled||v(e);}function v(e){g(e).pollScheduled=t.setTimeout(e===n.Low?p:d,e,g(e));}}function d(t){var r,i=[],o=0;return function(r,n){var o={fileName:r,callback:n,mtime:a(t,r)};return i.push(o),l(),{close:function(){o.isClosed=!0,e.unorderedRemoveItem(i,o);}}};function s(){r=void 0,o=u(t,i,o,c[n.Low]),l();}function l(){i.length&&!r&&(r=t.setTimeout(s,n.High));}}function p(t,r){var n=new e.Map,i=e.createMultiMap(),a=e.createGetCanonicalFileName(r);return function(r,o,s,c){var l=a(r),u=n.get(l);return u?u.refCount++:n.set(l,{watcher:t(r,(function(t,r){return e.forEach(i.get(l),(function(e){return e(t,r)}))}),s,c),refCount:1}),i.add(l,o),{close:function(){var t=e.Debug.checkDefined(n.get(l));i.remove(l,o),t.refCount--,t.refCount||(n.delete(l),e.closeFileWatcherOf(t));}}}}function f(e,t){var r=e.mtime.getTime(),n=t.getTime();return r!==n&&(e.mtime=t,e.callback(e.fileName,g(r,n)),!0)}function g(e,t){return 0===e?r.Created:0===t?r.Deleted:r.Changed}e.unchangedPollThresholds=o(s),e.setCustomPollingValues=l,e.createDynamicPriorityPollingWatchFile=_,e.createSingleFileWatcherPerName=p,e.onWatchedFileStat=f,e.getFileWatcherEventKind=g,e.ignoredPaths=["/node_modules/.","/.git","/.#"];var m,y,v=e.noop;function h(e){return v(e)}function b(t){var r,n=t.watchDirectory,i=t.useCaseSensitiveFileNames,a=t.getCurrentDirectory,o=t.getAccessibleSortedChildDirectories,s=t.directoryExists,c=t.realpath,l=t.setTimeout,u=t.clearTimeout,_=new e.Map,d=e.createMultiMap(),p=new e.Map,f=e.getStringComparer(!i),g=e.createGetCanonicalFileName(i);return function(e,t,r,i){return r?m(e,i,t):n(e,t,r,i)};function m(t,i,a){var o=g(t),c=_.get(o);c?c.refCount++:(c={watcher:n(t,(function(e){S(e,i)||((null==i?void 0:i.synchronousWatchDirectory)?(y(o,e),x(t,o,i)):function(e,t,n,i){var a=_.get(t);a&&s(e)?function(e,t,n,i){var a=p.get(t);a?a.fileNames.push(n):p.set(t,{dirName:e,options:i,fileNames:[n]}),r&&(u(r),r=void 0),r=l(v,1e3);}(e,t,n,i):(y(t,n),b(a));}(t,o,e,i));}),!1,i),refCount:1,childWatches:e.emptyArray},_.set(o,c),x(t,o,i));var f=a&&{dirName:t,callback:a};return f&&d.add(o,f),{dirName:t,close:function(){var t=e.Debug.checkDefined(_.get(o));f&&d.remove(o,f),t.refCount--,t.refCount||(_.delete(o),e.closeFileWatcherOf(t),t.childWatches.forEach(e.closeFileWatcher));}}}function y(t,r,n){var i,a;e.isString(r)?i=r:a=r,d.forEach((function(r,o){var s;if((!a||!0!==a.get(o))&&(o===t||e.startsWith(t,o)&&t[o.length]===e.directorySeparator))if(a)if(n){var c=a.get(o);c?(s=c).push.apply(s,n):a.set(o,n.slice());}else a.set(o,!0);else r.forEach((function(e){return (0, e.callback)(i)}));}));}function v(){r=void 0,h("sysLog:: onTimerToUpdateChildWatches:: ".concat(p.size));for(var t=e.timestamp(),n=new e.Map;!r&&p.size;){var i=p.entries().next();e.Debug.assert(!i.done);var a=i.value,o=a[0],s=a[1],c=s.dirName,l=s.options,u=s.fileNames;p.delete(o);var _=x(c,o,l);y(o,n,_?void 0:u);}h("sysLog:: invokingWatchers:: Elapsed:: ".concat(e.timestamp()-t,"ms:: ").concat(p.size)),d.forEach((function(t,r){var i=n.get(r);i&&t.forEach((function(t){var r=t.callback,n=t.dirName;e.isArray(i)?i.forEach(r):r(n);}));}));var f=e.timestamp()-t;h("sysLog:: Elapsed:: ".concat(f,"ms:: onTimerToUpdateChildWatches:: ").concat(p.size," ").concat(r));}function b(t){if(t){var r=t.childWatches;t.childWatches=e.emptyArray;for(var n=0,i=r;n<i.length;n++){var a=i[n];a.close(),b(_.get(g(a.dirName)));}}}function x(t,r,n){var i,a=_.get(r);if(!a)return !1;var l=e.enumerateInsertsAndDeletes(s(t)?e.mapDefined(o(t),(function(r){var i=e.getNormalizedAbsolutePath(r,t);return S(i,n)||0!==f(i,e.normalizePath(c(i)))?void 0:i})):e.emptyArray,a.childWatches,(function(e,t){return f(e,t.dirName)}),(function(e){u(m(e,n));}),e.closeFileWatcher,u);return a.childWatches=i||e.emptyArray,l;function u(e){(i||(i=[])).push(e);}}function S(t,r){return e.some(e.ignoredPaths,(function(r){return function(t,r){return !!e.stringContains(t,r)||!i&&e.stringContains(g(t),r)}(t,r)}))||D(t,r,i,a)}}function x(e){return function(t,n){return e(n===r.Changed?"change":"rename","")}}function D(t,r,n,i){return ((null==r?void 0:r.excludeDirectories)||(null==r?void 0:r.excludeFiles))&&(e.matchesExclude(t,null==r?void 0:r.excludeFiles,n,i())||e.matchesExclude(t,null==r?void 0:r.excludeDirectories,n,i()))}function S(t,r,n,i,a){return function(o,s){if("rename"===o){var c=s?e.normalizePath(e.combinePaths(t,s)):t;s&&D(c,n,i,a)||r(c);}}}function T(t){var i,a,o,s,c=t.pollingWatchFile,l=t.getModifiedTime,u=t.setTimeout,p=t.clearTimeout,f=t.fsWatch,g=t.fileExists,m=t.useCaseSensitiveFileNames,y=t.getCurrentDirectory,v=t.fsSupportsRecursiveFsWatch,h=t.directoryExists,x=t.getAccessibleSortedChildDirectories,D=t.realpath,T=t.tscWatchFile,C=t.useNonPollingWatchers,k=t.tscWatchDirectory,E=t.defaultWatchFileKind;return {watchFile:function(t,i,a,s){s=function(t,r){if(t&&void 0!==t.watchFile)return t;switch(T){case"PriorityPollingInterval":return {watchFile:e.WatchFileKind.PriorityPollingInterval};case"DynamicPriorityPolling":return {watchFile:e.WatchFileKind.DynamicPriorityPolling};case"UseFsEvents":return A(e.WatchFileKind.UseFsEvents,e.PollingWatchKind.PriorityInterval,t);case"UseFsEventsWithFallbackDynamicPolling":return A(e.WatchFileKind.UseFsEvents,e.PollingWatchKind.DynamicPriority,t);case"UseFsEventsOnParentDirectory":r=!0;default:return r?A(e.WatchFileKind.UseFsEventsOnParentDirectory,e.PollingWatchKind.PriorityInterval,t):{watchFile:(null==E?void 0:E())||e.WatchFileKind.FixedPollingInterval}}}(s,C);var l=e.Debug.checkDefined(s.watchFile);switch(l){case e.WatchFileKind.FixedPollingInterval:return c(t,i,n.Low,void 0);case e.WatchFileKind.PriorityPollingInterval:return c(t,i,a,void 0);case e.WatchFileKind.DynamicPriorityPolling:return N()(t,i,a,void 0);case e.WatchFileKind.FixedChunkSizePolling:return F()(t,i,void 0,void 0);case e.WatchFileKind.UseFsEvents:return f(t,0,function(e,t,n){return function(i){t(e,"rename"===i?n(e)?r.Created:r.Deleted:r.Changed);}}(t,i,g),!1,a,e.getFallbackOptions(s));case e.WatchFileKind.UseFsEventsOnParentDirectory:return o||(o=function(t,i){var a=e.createMultiMap(),o=new e.Map,s=e.createGetCanonicalFileName(i);return function(i,c,l,u){var _=s(i);a.add(_,c);var d=e.getDirectoryPath(_)||".",p=o.get(d)||function(i,c,l){var u=t(i,1,(function(t,n){if(e.isString(n)){var o=e.getNormalizedAbsolutePath(n,i),c=o&&a.get(s(o));if(c)for(var l=0,u=c;l<u.length;l++)(0, u[l])(o,r.Changed);}}),!1,n.Medium,l);return u.referenceCount=0,o.set(c,u),u}(e.getDirectoryPath(i)||".",d,u);return p.referenceCount++,{close:function(){1===p.referenceCount?(p.close(),o.delete(d)):p.referenceCount--,a.remove(_,c);}}}}(f,m)),o(t,i,a,e.getFallbackOptions(s));default:e.Debug.assertNever(l);}},watchDirectory:function(t,r,i,a){return v?f(t,1,S(t,r,a,m,y),i,n.Medium,e.getFallbackOptions(a)):(s||(s=b({useCaseSensitiveFileNames:m,getCurrentDirectory:y,directoryExists:h,getAccessibleSortedChildDirectories:x,watchDirectory:P,realpath:D,setTimeout:u,clearTimeout:p})),s(t,r,i,a))}};function N(){return i||(i=_({getModifiedTime:l,setTimeout:u}))}function F(){return a||(a=d({getModifiedTime:l,setTimeout:u}))}function A(e,t,r){var n=null==r?void 0:r.fallbackPolling;return {watchFile:e,fallbackPolling:void 0===n?t:n}}function P(t,r,i,a){e.Debug.assert(!i);var o=function(t){if(t&&void 0!==t.watchDirectory)return t;switch(k){case"RecursiveDirectoryUsingFsWatchFile":return {watchDirectory:e.WatchDirectoryKind.FixedPollingInterval};case"RecursiveDirectoryUsingDynamicPriorityPolling":return {watchDirectory:e.WatchDirectoryKind.DynamicPriorityPolling};default:var r=null==t?void 0:t.fallbackPolling;return {watchDirectory:e.WatchDirectoryKind.UseFsEvents,fallbackPolling:void 0!==r?r:void 0}}}(a),s=e.Debug.checkDefined(o.watchDirectory);switch(s){case e.WatchDirectoryKind.FixedPollingInterval:return c(t,(function(){return r(t)}),n.Medium,void 0);case e.WatchDirectoryKind.DynamicPriorityPolling:return N()(t,(function(){return r(t)}),n.Medium,void 0);case e.WatchDirectoryKind.FixedChunkSizePolling:return F()(t,(function(){return r(t)}),void 0,void 0);case e.WatchDirectoryKind.UseFsEvents:return f(t,1,S(t,r,a,m,y),i,n.Medium,e.getFallbackOptions(o));default:e.Debug.assertNever(s);}}}function C(t){var r=t.writeFile;t.writeFile=function(n,i,a){return e.writeFileEnsuringDirectories(n,i,!!a,(function(e,n,i){return r.call(t,e,n,i)}),(function(e){return t.createDirectory(e)}),(function(e){return t.directoryExists(e)}))};}function k(){if("undefined"!=typeof process){var e=process.version;if(e){var t=e.indexOf(".");if(-1!==t)return parseInt(e.substring(1,t))}}}e.sysLog=h,e.setSysLog=function(e){v=e;},e.createDirectoryWatcherSupportingRecursive=b,(y=e.FileSystemEntryKind||(e.FileSystemEntryKind={}))[y.File=0]="File",y[y.Directory=1]="Directory",e.createFileWatcherCallback=x,e.createSystemWatchFunctions=T,e.patchWriteFileEnsuringDirectory=C,e.getNodeMajorVersion=k,e.sys=("undefined"!=typeof process&&process.nextTick&&!process.browser&&"undefined"!=typeof require&&(m=function(){var n,i,s=require("fs"),c=require("path"),l=require("os");try{i=require("crypto");}catch(e){i=void 0;}var u,d=!1,f=require("buffer").Buffer,g=k()>=4,y="linux"===process.platform||"darwin"===process.platform,v=l.platform(),b="win32"!==v&&"win64"!==v&&!M((u=__filename,u.replace(/\w/g,(function(e){var t=e.toUpperCase();return e===t?e.toLowerCase():t})))),D=null!==(n=s.realpathSync.native)&&void 0!==n?n:s.realpathSync,S=g&&("win32"===process.platform||"darwin"===process.platform),C=e.memoize((function(){return process.cwd()})),E=T({pollingWatchFile:p((function(e,t,n){var i;return s.watchFile(e,{persistent:!0,interval:n},a),{close:function(){return s.unwatchFile(e,a)}};function a(n,a){var o=0==+a.mtime||i===r.Deleted;if(0==+n.mtime){if(o)return;i=r.Deleted;}else if(o)i=r.Created;else {if(+n.mtime==+a.mtime)return;i=r.Changed;}t(e,i);}}),b),getModifiedTime:B,setTimeout,clearTimeout,fsWatch:function(t,n,i,a,o,c){var l,u,_;y&&(u=t.substr(t.lastIndexOf(e.directorySeparator)),_=u.slice(e.directorySeparator.length));var p=O(t,n)?g():b();return {close:function(){p.close(),p=void 0;}};function f(e){h("sysLog:: ".concat(t,":: Changing watcher to ").concat(e===g?"Present":"Missing","FileSystemEntryWatcher")),i("rename",""),p&&(p.close(),p=e());}function g(){if(void 0===l&&(l=S?{persistent:!0,recursive:!!a}:{persistent:!0}),d)return h("sysLog:: ".concat(t,":: Defaulting to fsWatchFile")),v();try{var e=s.watch(t,l,y?m:i);return e.on("error",(function(){return f(b)})),e}catch(e){return d||(d="ENOSPC"===e.code),h("sysLog:: ".concat(t,":: Changing to fsWatchFile")),v()}}function m(e,r){return "rename"!==e||r&&r!==_&&(-1===r.lastIndexOf(u)||r.lastIndexOf(u)!==r.length-u.length)||O(t,n)?i(e,r):f(b)}function v(){return N(t,x(i),o,c)}function b(){return N(t,(function(e,i){i===r.Created&&O(t,n)&&f(g);}),o,c)}},useCaseSensitiveFileNames:b,getCurrentDirectory:C,fileExists:M,fsSupportsRecursiveFsWatch:S,directoryExists:L,getAccessibleSortedChildDirectories:function(e){return I(e).directories},realpath:R,tscWatchFile:process.env.TSC_WATCHFILE,useNonPollingWatchers:process.env.TSC_NONPOLLING_WATCHER,tscWatchDirectory:process.env.TSC_WATCHDIRECTORY,defaultWatchFileKind:function(){var e,t;return null===(t=(e=m).defaultWatchFileKind)||void 0===t?void 0:t.call(e)}}),N=E.watchFile,F=E.watchDirectory,A={args:process.argv.slice(2),newLine:l.EOL,useCaseSensitiveFileNames:b,write:function(e){process.stdout.write(e);},getWidthOfTerminal:function(){return process.stdout.columns},writeOutputIsTTY:function(){return process.stdout.isTTY},readFile:function(t,r){e.perfLogger.logStartReadFile(t);var n=function(e,t){var r;try{r=s.readFileSync(e);}catch(e){return}var n=r.length;if(n>=2&&254===r[0]&&255===r[1]){n&=-2;for(var i=0;i<n;i+=2){var a=r[i];r[i]=r[i+1],r[i+1]=a;}return r.toString("utf16le",2)}return n>=2&&255===r[0]&&254===r[1]?r.toString("utf16le",2):n>=3&&239===r[0]&&187===r[1]&&191===r[2]?r.toString("utf8",3):r.toString("utf8")}(t);return e.perfLogger.logStopReadFile(),n},writeFile:function(t,r,n){var i;e.perfLogger.logEvent("WriteFile: "+t),n&&(r="\ufeff"+r);try{i=s.openSync(t,"w"),s.writeSync(i,r,void 0,"utf8");}finally{void 0!==i&&s.closeSync(i);}},watchFile:N,watchDirectory:F,resolvePath:function(e){return c.resolve(e)},fileExists:M,directoryExists:L,createDirectory:function(e){if(!A.directoryExists(e))try{s.mkdirSync(e);}catch(e){if("EEXIST"!==e.code)throw e}},getExecutingFilePath:function(){return __filename},getCurrentDirectory:C,getDirectories:function(e){return I(e).directories.slice()},getEnvironmentVariable:function(e){return process.env[e]||""},readDirectory:function(t,r,n,i,a){return e.matchFiles(t,r,n,i,b,process.cwd(),a,I,R)},getModifiedTime:B,setModifiedTime:function(e,t){try{s.utimesSync(e,t,t);}catch(e){return}},deleteFile:function(e){try{return s.unlinkSync(e)}catch(e){return}},createHash:i?j:t,createSHA256Hash:i?j:void 0,getMemoryUsage:function(){return global.gc&&global.gc(),process.memoryUsage().heapUsed},getFileSize:function(e){try{var t=P(e);if(null==t?void 0:t.isFile())return t.size}catch(e){}return 0},exit:function(t){!function(t){t();}((function(){return process.exit(t)}));},cpuProfilingEnabled:function(){return e.contains(process.execArgv,"--cpu-prof")||e.contains(process.execArgv,"--prof")},realpath:R,debugMode:!!process.env.NODE_INSPECTOR_IPC||!!process.env.VSCODE_INSPECTOR_OPTIONS||e.some(process.execArgv,(function(e){return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(e)})),tryEnableSourceMapsForHost:function(){try{require("source-map-support").install();}catch(e){}},setTimeout,clearTimeout,clearScreen:function(){process.stdout.write("c");},setBlocking:function(){process.stdout&&process.stdout._handle&&process.stdout._handle.setBlocking&&process.stdout._handle.setBlocking(!0);},bufferFrom:w,base64decode:function(e){return w(e,"base64").toString("utf8")},base64encode:function(e){return w(e).toString("base64")},require:function(t,r){try{var n=e.resolveJSModule(r,t,A);return {module:require(n),modulePath:n,error:void 0}}catch(e){return {module:void 0,modulePath:void 0,error:e}}}};return A;function P(e){return s.statSync(e,{throwIfNoEntry:!1})}function w(e,t){return f.from&&f.from!==Int8Array.from?f.from(e,t):new f(e,t)}function I(t){e.perfLogger.logEvent("ReadDir: "+(t||"."));try{for(var r=s.readdirSync(t||".",{withFileTypes:!0}),n=[],i=[],a=0,o=r;a<o.length;a++){var c=o[a],l="string"==typeof c?c:c.name;if("."!==l&&".."!==l){var u=void 0;if("string"==typeof c||c.isSymbolicLink()){var _=e.combinePaths(t,l);try{if(!(u=P(_)))continue}catch(e){continue}}else u=c;u.isFile()?n.push(l):u.isDirectory()&&i.push(l);}}return n.sort(),i.sort(),{files:n,directories:i}}catch(t){return e.emptyFileSystemEntries}}function O(e,t){var r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{var n=P(e);if(!n)return !1;switch(t){case 0:return n.isFile();case 1:return n.isDirectory();default:return !1}}catch(e){return !1}finally{Error.stackTraceLimit=r;}}function M(e){return O(e,0)}function L(e){return O(e,1)}function R(e){try{return D(e)}catch(t){return e}}function B(e){var t;try{return null===(t=P(e))||void 0===t?void 0:t.mtime}catch(e){return}}function j(e){var t=i.createHash("sha256");return t.update(e),t.digest("hex")}}()),m&&C(m),m),e.setSys=function(t){e.sys=t;},e.sys&&e.sys.getEnvironmentVariable&&(l(e.sys),e.Debug.setAssertionLevel(/^development$/i.test(e.sys.getEnvironmentVariable("NODE_ENV"))?1:0)),e.sys&&e.sys.debugMode&&(e.Debug.isDebugging=!0);}(t),function(e){e.directorySeparator="/",e.altDirectorySeparator="\\";var t=/\\/g;function r(e){return 47===e||92===e}function i(e){return u(e)>0}function a(e){return 0!==u(e)}function o(e){return /^\.\.?($|[\\/])/.test(e)}function s(t,r){return t.length>r.length&&e.endsWith(t,r)}function c(e){return e.length>0&&r(e.charCodeAt(e.length-1))}function l(e){return e>=97&&e<=122||e>=65&&e<=90}function u(t){if(!t)return 0;var r=t.charCodeAt(0);if(47===r||92===r){if(t.charCodeAt(1)!==r)return 1;var n=t.indexOf(47===r?e.directorySeparator:e.altDirectorySeparator,2);return n<0?t.length:n+1}if(l(r)&&58===t.charCodeAt(1)){var i=t.charCodeAt(2);if(47===i||92===i)return 3;if(2===t.length)return 2}var a=t.indexOf("://");if(-1!==a){var o=a+"://".length,s=t.indexOf(e.directorySeparator,o);if(-1!==s){var c=t.slice(0,a),u=t.slice(o,s);if("file"===c&&(""===u||"localhost"===u)&&l(t.charCodeAt(s+1))){var _=function(e,t){var r=e.charCodeAt(t);if(58===r)return t+1;if(37===r&&51===e.charCodeAt(t+1)){var n=e.charCodeAt(t+2);if(97===n||65===n)return t+3}return -1}(t,s+2);if(-1!==_){if(47===t.charCodeAt(_))return ~(_+1);if(_===t.length)return ~_}}return ~(s+1)}return ~t.length}return 0}function _(e){var t=u(e);return t<0?~t:t}function d(t){var r=_(t=v(t));return r===t.length?t:(t=C(t)).slice(0,Math.max(r,t.lastIndexOf(e.directorySeparator)))}function p(t,r,n){if(_(t=v(t))===t.length)return "";var i=(t=C(t)).slice(Math.max(_(t),t.lastIndexOf(e.directorySeparator)+1)),a=void 0!==r&&void 0!==n?g(i,r,n):void 0;return a?i.slice(0,i.length-a.length):i}function f(t,r,n){if(e.startsWith(r,".")||(r="."+r),t.length>=r.length&&46===t.charCodeAt(t.length-r.length)){var i=t.slice(t.length-r.length);if(n(i,r))return i}}function g(t,r,n){if(r)return function(e,t,r){if("string"==typeof t)return f(e,t,r)||"";for(var n=0,i=t;n<i.length;n++){var a=f(e,i[n],r);if(a)return a}return ""}(C(t),r,n?e.equateStringsCaseInsensitive:e.equateStringsCaseSensitive);var i=p(t),a=i.lastIndexOf(".");return a>=0?i.substring(a):""}function m(t,r){return void 0===r&&(r=""),function(t,r){var i=t.substring(0,r),a=t.substring(r).split(e.directorySeparator);return a.length&&!e.lastOrUndefined(a)&&a.pop(),n$4([i],a,!0)}(t=b(r,t),_(t))}function y(t){return 0===t.length?"":(t[0]&&k(t[0]))+t.slice(1).join(e.directorySeparator)}function v(r){var n=r.indexOf("\\");return -1===n?r:(t.lastIndex=n,r.replace(t,e.directorySeparator))}function h(t){if(!e.some(t))return [];for(var r=[t[0]],n=1;n<t.length;n++){var i=t[n];if(i&&"."!==i){if(".."===i)if(r.length>1){if(".."!==r[r.length-1]){r.pop();continue}}else if(r[0])continue;r.push(i);}}return r}function b(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];e&&(e=v(e));for(var n=0,i=t;n<i.length;n++){var a=i[n];a&&(a=v(a),e=e&&0===_(a)?k(e)+a:a);}return e}function x(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return T(e.some(r)?b.apply(void 0,n$4([t],r,!1)):v(t))}function D(e,t){return h(m(e,t))}function S(e,t){return y(D(e,t))}function T(e){if(e=v(e),!N.test(e))return e;var t=e.replace(/\/\.\//g,"/").replace(/^\.\//,"");if(t!==e&&(e=t,!N.test(e)))return e;var r=y(h(m(e)));return r&&c(e)?k(r):r}function C(e){return c(e)?e.substr(0,e.length-1):e}function k(t){return c(t)?t:t+e.directorySeparator}function E(e){return a(e)||o(e)?e:"./"+e}e.isAnyDirectorySeparator=r,e.isUrl=function(e){return u(e)<0},e.isRootedDiskPath=i,e.isDiskPathRoot=function(e){var t=u(e);return t>0&&t===e.length},e.pathIsAbsolute=a,e.pathIsRelative=o,e.pathIsBareSpecifier=function(e){return !a(e)&&!o(e)},e.hasExtension=function(t){return e.stringContains(p(t),".")},e.fileExtensionIs=s,e.fileExtensionIsOneOf=function(e,t){for(var r=0,n=t;r<n.length;r++)if(s(e,n[r]))return !0;return !1},e.hasTrailingDirectorySeparator=c,e.getRootLength=_,e.getDirectoryPath=d,e.getBaseFileName=p,e.getAnyExtensionFromPath=g,e.getPathComponents=m,e.getPathFromPathComponents=y,e.normalizeSlashes=v,e.reducePathComponents=h,e.combinePaths=b,e.resolvePath=x,e.getNormalizedPathComponents=D,e.getNormalizedAbsolutePath=S,e.normalizePath=T,e.getNormalizedAbsolutePathWithoutRoot=function(t,r){return 0===(n=D(t,r)).length?"":n.slice(1).join(e.directorySeparator);var n;},e.toPath=function(e,t,r){return r(i(e)?T(e):S(e,t))},e.removeTrailingDirectorySeparator=C,e.ensureTrailingDirectorySeparator=k,e.ensurePathIsNonModuleName=E,e.changeAnyExtension=function(t,r,n,i){var a=void 0!==n&&void 0!==i?g(t,n,i):g(t);return a?t.slice(0,t.length-a.length)+(e.startsWith(r,".")?r:"."+r):t};var N=/(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;function F(t,r,n){if(t===r)return 0;if(void 0===t)return -1;if(void 0===r)return 1;var i=t.substring(0,_(t)),a=r.substring(0,_(r)),o=e.compareStringsCaseInsensitive(i,a);if(0!==o)return o;var s=t.substring(i.length),c=r.substring(a.length);if(!N.test(s)&&!N.test(c))return n(s,c);for(var l=h(m(t)),u=h(m(r)),d=Math.min(l.length,u.length),p=1;p<d;p++){var f=n(l[p],u[p]);if(0!==f)return f}return e.compareValues(l.length,u.length)}function A(t,r,i,a){var o,s=h(m(t)),c=h(m(r));for(o=0;o<s.length&&o<c.length;o++){var l=a(s[o]),u=a(c[o]);if(!(0===o?e.equateStringsCaseInsensitive:i)(l,u))break}if(0===o)return c;for(var _=c.slice(o),d=[];o<s.length;o++)d.push("..");return n$4(n$4([""],d,!0),_,!0)}function P(t,r,n){e.Debug.assert(_(t)>0==_(r)>0,"Paths must either both be absolute or both be relative");var i="function"==typeof n?n:e.identity;return y(A(t,r,"boolean"==typeof n&&n?e.equateStringsCaseInsensitive:e.equateStringsCaseSensitive,i))}function w(t,r,n,a,o){var s=A(x(n,t),x(n,r),e.equateStringsCaseSensitive,a),c=s[0];if(o&&i(c)){var l=c.charAt(0)===e.directorySeparator?"file://":"file:///";s[0]=l+c;}return y(s)}e.comparePathsCaseSensitive=function(t,r){return F(t,r,e.compareStringsCaseSensitive)},e.comparePathsCaseInsensitive=function(t,r){return F(t,r,e.compareStringsCaseInsensitive)},e.comparePaths=function(t,r,n,i){return "string"==typeof n?(t=b(n,t),r=b(n,r)):"boolean"==typeof n&&(i=n),F(t,r,e.getStringComparer(i))},e.containsPath=function(t,r,n,i){if("string"==typeof n?(t=b(n,t),r=b(n,r)):"boolean"==typeof n&&(i=n),void 0===t||void 0===r)return !1;if(t===r)return !0;var a=h(m(t)),o=h(m(r));if(o.length<a.length)return !1;for(var s=i?e.equateStringsCaseInsensitive:e.equateStringsCaseSensitive,c=0;c<a.length;c++)if(!(0===c?e.equateStringsCaseInsensitive:s)(a[c],o[c]))return !1;return !0},e.startsWithDirectory=function(t,r,n){var i=n(t),a=n(r);return e.startsWith(i,a+"/")||e.startsWith(i,a+"\\")},e.getPathComponentsRelativeTo=A,e.getRelativePathFromDirectory=P,e.convertToRelativePath=function(e,t,r){return i(e)?w(t,e,t,r,!1):e},e.getRelativePathFromFile=function(e,t,r){return E(P(d(e),t,r))},e.getRelativePathToDirectoryOrUrl=w,e.forEachAncestorDirectory=function(e,t){for(;;){var r=t(e);if(void 0!==r)return r;var n=d(e);if(n===e)return;e=n;}},e.isNodeModulesDirectory=function(t){return e.endsWith(t,"/node_modules")};}(t),function(e){function t(e,t,r,n,i,a,o){return {code:e,category:t,key:r,message:n,reportsUnnecessary:i,elidedInCompatabilityPyramid:a,reportsDeprecated:o}}e.Diagnostics={Unterminated_string_literal:t(1002,e.DiagnosticCategory.Error,"Unterminated_string_literal_1002","Unterminated string literal."),Identifier_expected:t(1003,e.DiagnosticCategory.Error,"Identifier_expected_1003","Identifier expected."),_0_expected:t(1005,e.DiagnosticCategory.Error,"_0_expected_1005","'{0}' expected."),A_file_cannot_have_a_reference_to_itself:t(1006,e.DiagnosticCategory.Error,"A_file_cannot_have_a_reference_to_itself_1006","A file cannot have a reference to itself."),The_parser_expected_to_find_a_1_to_match_the_0_token_here:t(1007,e.DiagnosticCategory.Error,"The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007","The parser expected to find a '{1}' to match the '{0}' token here."),Trailing_comma_not_allowed:t(1009,e.DiagnosticCategory.Error,"Trailing_comma_not_allowed_1009","Trailing comma not allowed."),Asterisk_Slash_expected:t(1010,e.DiagnosticCategory.Error,"Asterisk_Slash_expected_1010","'*/' expected."),An_element_access_expression_should_take_an_argument:t(1011,e.DiagnosticCategory.Error,"An_element_access_expression_should_take_an_argument_1011","An element access expression should take an argument."),Unexpected_token:t(1012,e.DiagnosticCategory.Error,"Unexpected_token_1012","Unexpected token."),A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma:t(1013,e.DiagnosticCategory.Error,"A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013","A rest parameter or binding pattern may not have a trailing comma."),A_rest_parameter_must_be_last_in_a_parameter_list:t(1014,e.DiagnosticCategory.Error,"A_rest_parameter_must_be_last_in_a_parameter_list_1014","A rest parameter must be last in a parameter list."),Parameter_cannot_have_question_mark_and_initializer:t(1015,e.DiagnosticCategory.Error,"Parameter_cannot_have_question_mark_and_initializer_1015","Parameter cannot have question mark and initializer."),A_required_parameter_cannot_follow_an_optional_parameter:t(1016,e.DiagnosticCategory.Error,"A_required_parameter_cannot_follow_an_optional_parameter_1016","A required parameter cannot follow an optional parameter."),An_index_signature_cannot_have_a_rest_parameter:t(1017,e.DiagnosticCategory.Error,"An_index_signature_cannot_have_a_rest_parameter_1017","An index signature cannot have a rest parameter."),An_index_signature_parameter_cannot_have_an_accessibility_modifier:t(1018,e.DiagnosticCategory.Error,"An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018","An index signature parameter cannot have an accessibility modifier."),An_index_signature_parameter_cannot_have_a_question_mark:t(1019,e.DiagnosticCategory.Error,"An_index_signature_parameter_cannot_have_a_question_mark_1019","An index signature parameter cannot have a question mark."),An_index_signature_parameter_cannot_have_an_initializer:t(1020,e.DiagnosticCategory.Error,"An_index_signature_parameter_cannot_have_an_initializer_1020","An index signature parameter cannot have an initializer."),An_index_signature_must_have_a_type_annotation:t(1021,e.DiagnosticCategory.Error,"An_index_signature_must_have_a_type_annotation_1021","An index signature must have a type annotation."),An_index_signature_parameter_must_have_a_type_annotation:t(1022,e.DiagnosticCategory.Error,"An_index_signature_parameter_must_have_a_type_annotation_1022","An index signature parameter must have a type annotation."),readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature:t(1024,e.DiagnosticCategory.Error,"readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024","'readonly' modifier can only appear on a property declaration or index signature."),An_index_signature_cannot_have_a_trailing_comma:t(1025,e.DiagnosticCategory.Error,"An_index_signature_cannot_have_a_trailing_comma_1025","An index signature cannot have a trailing comma."),Accessibility_modifier_already_seen:t(1028,e.DiagnosticCategory.Error,"Accessibility_modifier_already_seen_1028","Accessibility modifier already seen."),_0_modifier_must_precede_1_modifier:t(1029,e.DiagnosticCategory.Error,"_0_modifier_must_precede_1_modifier_1029","'{0}' modifier must precede '{1}' modifier."),_0_modifier_already_seen:t(1030,e.DiagnosticCategory.Error,"_0_modifier_already_seen_1030","'{0}' modifier already seen."),_0_modifier_cannot_appear_on_class_elements_of_this_kind:t(1031,e.DiagnosticCategory.Error,"_0_modifier_cannot_appear_on_class_elements_of_this_kind_1031","'{0}' modifier cannot appear on class elements of this kind."),super_must_be_followed_by_an_argument_list_or_member_access:t(1034,e.DiagnosticCategory.Error,"super_must_be_followed_by_an_argument_list_or_member_access_1034","'super' must be followed by an argument list or member access."),Only_ambient_modules_can_use_quoted_names:t(1035,e.DiagnosticCategory.Error,"Only_ambient_modules_can_use_quoted_names_1035","Only ambient modules can use quoted names."),Statements_are_not_allowed_in_ambient_contexts:t(1036,e.DiagnosticCategory.Error,"Statements_are_not_allowed_in_ambient_contexts_1036","Statements are not allowed in ambient contexts."),A_declare_modifier_cannot_be_used_in_an_already_ambient_context:t(1038,e.DiagnosticCategory.Error,"A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038","A 'declare' modifier cannot be used in an already ambient context."),Initializers_are_not_allowed_in_ambient_contexts:t(1039,e.DiagnosticCategory.Error,"Initializers_are_not_allowed_in_ambient_contexts_1039","Initializers are not allowed in ambient contexts."),_0_modifier_cannot_be_used_in_an_ambient_context:t(1040,e.DiagnosticCategory.Error,"_0_modifier_cannot_be_used_in_an_ambient_context_1040","'{0}' modifier cannot be used in an ambient context."),_0_modifier_cannot_be_used_here:t(1042,e.DiagnosticCategory.Error,"_0_modifier_cannot_be_used_here_1042","'{0}' modifier cannot be used here."),_0_modifier_cannot_appear_on_a_module_or_namespace_element:t(1044,e.DiagnosticCategory.Error,"_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044","'{0}' modifier cannot appear on a module or namespace element."),Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier:t(1046,e.DiagnosticCategory.Error,"Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046","Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),A_rest_parameter_cannot_be_optional:t(1047,e.DiagnosticCategory.Error,"A_rest_parameter_cannot_be_optional_1047","A rest parameter cannot be optional."),A_rest_parameter_cannot_have_an_initializer:t(1048,e.DiagnosticCategory.Error,"A_rest_parameter_cannot_have_an_initializer_1048","A rest parameter cannot have an initializer."),A_set_accessor_must_have_exactly_one_parameter:t(1049,e.DiagnosticCategory.Error,"A_set_accessor_must_have_exactly_one_parameter_1049","A 'set' accessor must have exactly one parameter."),A_set_accessor_cannot_have_an_optional_parameter:t(1051,e.DiagnosticCategory.Error,"A_set_accessor_cannot_have_an_optional_parameter_1051","A 'set' accessor cannot have an optional parameter."),A_set_accessor_parameter_cannot_have_an_initializer:t(1052,e.DiagnosticCategory.Error,"A_set_accessor_parameter_cannot_have_an_initializer_1052","A 'set' accessor parameter cannot have an initializer."),A_set_accessor_cannot_have_rest_parameter:t(1053,e.DiagnosticCategory.Error,"A_set_accessor_cannot_have_rest_parameter_1053","A 'set' accessor cannot have rest parameter."),A_get_accessor_cannot_have_parameters:t(1054,e.DiagnosticCategory.Error,"A_get_accessor_cannot_have_parameters_1054","A 'get' accessor cannot have parameters."),Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value:t(1055,e.DiagnosticCategory.Error,"Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055","Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value."),Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher:t(1056,e.DiagnosticCategory.Error,"Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056","Accessors are only available when targeting ECMAScript 5 and higher."),The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:t(1058,e.DiagnosticCategory.Error,"The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058","The return type of an async function must either be a valid promise or must not contain a callable 'then' member."),A_promise_must_have_a_then_method:t(1059,e.DiagnosticCategory.Error,"A_promise_must_have_a_then_method_1059","A promise must have a 'then' method."),The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback:t(1060,e.DiagnosticCategory.Error,"The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060","The first parameter of the 'then' method of a promise must be a callback."),Enum_member_must_have_initializer:t(1061,e.DiagnosticCategory.Error,"Enum_member_must_have_initializer_1061","Enum member must have initializer."),Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method:t(1062,e.DiagnosticCategory.Error,"Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062","Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."),An_export_assignment_cannot_be_used_in_a_namespace:t(1063,e.DiagnosticCategory.Error,"An_export_assignment_cannot_be_used_in_a_namespace_1063","An export assignment cannot be used in a namespace."),The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0:t(1064,e.DiagnosticCategory.Error,"The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064","The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?"),In_ambient_enum_declarations_member_initializer_must_be_constant_expression:t(1066,e.DiagnosticCategory.Error,"In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066","In ambient enum declarations member initializer must be constant expression."),Unexpected_token_A_constructor_method_accessor_or_property_was_expected:t(1068,e.DiagnosticCategory.Error,"Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068","Unexpected token. A constructor, method, accessor, or property was expected."),Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces:t(1069,e.DiagnosticCategory.Error,"Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069","Unexpected token. A type parameter name was expected without curly braces."),_0_modifier_cannot_appear_on_a_type_member:t(1070,e.DiagnosticCategory.Error,"_0_modifier_cannot_appear_on_a_type_member_1070","'{0}' modifier cannot appear on a type member."),_0_modifier_cannot_appear_on_an_index_signature:t(1071,e.DiagnosticCategory.Error,"_0_modifier_cannot_appear_on_an_index_signature_1071","'{0}' modifier cannot appear on an index signature."),A_0_modifier_cannot_be_used_with_an_import_declaration:t(1079,e.DiagnosticCategory.Error,"A_0_modifier_cannot_be_used_with_an_import_declaration_1079","A '{0}' modifier cannot be used with an import declaration."),Invalid_reference_directive_syntax:t(1084,e.DiagnosticCategory.Error,"Invalid_reference_directive_syntax_1084","Invalid 'reference' directive syntax."),Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0:t(1085,e.DiagnosticCategory.Error,"Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085","Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),_0_modifier_cannot_appear_on_a_constructor_declaration:t(1089,e.DiagnosticCategory.Error,"_0_modifier_cannot_appear_on_a_constructor_declaration_1089","'{0}' modifier cannot appear on a constructor declaration."),_0_modifier_cannot_appear_on_a_parameter:t(1090,e.DiagnosticCategory.Error,"_0_modifier_cannot_appear_on_a_parameter_1090","'{0}' modifier cannot appear on a parameter."),Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement:t(1091,e.DiagnosticCategory.Error,"Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091","Only a single variable declaration is allowed in a 'for...in' statement."),Type_parameters_cannot_appear_on_a_constructor_declaration:t(1092,e.DiagnosticCategory.Error,"Type_parameters_cannot_appear_on_a_constructor_declaration_1092","Type parameters cannot appear on a constructor declaration."),Type_annotation_cannot_appear_on_a_constructor_declaration:t(1093,e.DiagnosticCategory.Error,"Type_annotation_cannot_appear_on_a_constructor_declaration_1093","Type annotation cannot appear on a constructor declaration."),An_accessor_cannot_have_type_parameters:t(1094,e.DiagnosticCategory.Error,"An_accessor_cannot_have_type_parameters_1094","An accessor cannot have type parameters."),A_set_accessor_cannot_have_a_return_type_annotation:t(1095,e.DiagnosticCategory.Error,"A_set_accessor_cannot_have_a_return_type_annotation_1095","A 'set' accessor cannot have a return type annotation."),An_index_signature_must_have_exactly_one_parameter:t(1096,e.DiagnosticCategory.Error,"An_index_signature_must_have_exactly_one_parameter_1096","An index signature must have exactly one parameter."),_0_list_cannot_be_empty:t(1097,e.DiagnosticCategory.Error,"_0_list_cannot_be_empty_1097","'{0}' list cannot be empty."),Type_parameter_list_cannot_be_empty:t(1098,e.DiagnosticCategory.Error,"Type_parameter_list_cannot_be_empty_1098","Type parameter list cannot be empty."),Type_argument_list_cannot_be_empty:t(1099,e.DiagnosticCategory.Error,"Type_argument_list_cannot_be_empty_1099","Type argument list cannot be empty."),Invalid_use_of_0_in_strict_mode:t(1100,e.DiagnosticCategory.Error,"Invalid_use_of_0_in_strict_mode_1100","Invalid use of '{0}' in strict mode."),with_statements_are_not_allowed_in_strict_mode:t(1101,e.DiagnosticCategory.Error,"with_statements_are_not_allowed_in_strict_mode_1101","'with' statements are not allowed in strict mode."),delete_cannot_be_called_on_an_identifier_in_strict_mode:t(1102,e.DiagnosticCategory.Error,"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102","'delete' cannot be called on an identifier in strict mode."),for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules:t(1103,e.DiagnosticCategory.Error,"for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1103","'for await' loops are only allowed within async functions and at the top levels of modules."),A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement:t(1104,e.DiagnosticCategory.Error,"A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104","A 'continue' statement can only be used within an enclosing iteration statement."),A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement:t(1105,e.DiagnosticCategory.Error,"A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105","A 'break' statement can only be used within an enclosing iteration or switch statement."),The_left_hand_side_of_a_for_of_statement_may_not_be_async:t(1106,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_of_statement_may_not_be_async_1106","The left-hand side of a 'for...of' statement may not be 'async'."),Jump_target_cannot_cross_function_boundary:t(1107,e.DiagnosticCategory.Error,"Jump_target_cannot_cross_function_boundary_1107","Jump target cannot cross function boundary."),A_return_statement_can_only_be_used_within_a_function_body:t(1108,e.DiagnosticCategory.Error,"A_return_statement_can_only_be_used_within_a_function_body_1108","A 'return' statement can only be used within a function body."),Expression_expected:t(1109,e.DiagnosticCategory.Error,"Expression_expected_1109","Expression expected."),Type_expected:t(1110,e.DiagnosticCategory.Error,"Type_expected_1110","Type expected."),A_default_clause_cannot_appear_more_than_once_in_a_switch_statement:t(1113,e.DiagnosticCategory.Error,"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113","A 'default' clause cannot appear more than once in a 'switch' statement."),Duplicate_label_0:t(1114,e.DiagnosticCategory.Error,"Duplicate_label_0_1114","Duplicate label '{0}'."),A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement:t(1115,e.DiagnosticCategory.Error,"A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115","A 'continue' statement can only jump to a label of an enclosing iteration statement."),A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement:t(1116,e.DiagnosticCategory.Error,"A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116","A 'break' statement can only jump to a label of an enclosing statement."),An_object_literal_cannot_have_multiple_properties_with_the_same_name:t(1117,e.DiagnosticCategory.Error,"An_object_literal_cannot_have_multiple_properties_with_the_same_name_1117","An object literal cannot have multiple properties with the same name."),An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name:t(1118,e.DiagnosticCategory.Error,"An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118","An object literal cannot have multiple get/set accessors with the same name."),An_object_literal_cannot_have_property_and_accessor_with_the_same_name:t(1119,e.DiagnosticCategory.Error,"An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119","An object literal cannot have property and accessor with the same name."),An_export_assignment_cannot_have_modifiers:t(1120,e.DiagnosticCategory.Error,"An_export_assignment_cannot_have_modifiers_1120","An export assignment cannot have modifiers."),Octal_literals_are_not_allowed_in_strict_mode:t(1121,e.DiagnosticCategory.Error,"Octal_literals_are_not_allowed_in_strict_mode_1121","Octal literals are not allowed in strict mode."),Variable_declaration_list_cannot_be_empty:t(1123,e.DiagnosticCategory.Error,"Variable_declaration_list_cannot_be_empty_1123","Variable declaration list cannot be empty."),Digit_expected:t(1124,e.DiagnosticCategory.Error,"Digit_expected_1124","Digit expected."),Hexadecimal_digit_expected:t(1125,e.DiagnosticCategory.Error,"Hexadecimal_digit_expected_1125","Hexadecimal digit expected."),Unexpected_end_of_text:t(1126,e.DiagnosticCategory.Error,"Unexpected_end_of_text_1126","Unexpected end of text."),Invalid_character:t(1127,e.DiagnosticCategory.Error,"Invalid_character_1127","Invalid character."),Declaration_or_statement_expected:t(1128,e.DiagnosticCategory.Error,"Declaration_or_statement_expected_1128","Declaration or statement expected."),Statement_expected:t(1129,e.DiagnosticCategory.Error,"Statement_expected_1129","Statement expected."),case_or_default_expected:t(1130,e.DiagnosticCategory.Error,"case_or_default_expected_1130","'case' or 'default' expected."),Property_or_signature_expected:t(1131,e.DiagnosticCategory.Error,"Property_or_signature_expected_1131","Property or signature expected."),Enum_member_expected:t(1132,e.DiagnosticCategory.Error,"Enum_member_expected_1132","Enum member expected."),Variable_declaration_expected:t(1134,e.DiagnosticCategory.Error,"Variable_declaration_expected_1134","Variable declaration expected."),Argument_expression_expected:t(1135,e.DiagnosticCategory.Error,"Argument_expression_expected_1135","Argument expression expected."),Property_assignment_expected:t(1136,e.DiagnosticCategory.Error,"Property_assignment_expected_1136","Property assignment expected."),Expression_or_comma_expected:t(1137,e.DiagnosticCategory.Error,"Expression_or_comma_expected_1137","Expression or comma expected."),Parameter_declaration_expected:t(1138,e.DiagnosticCategory.Error,"Parameter_declaration_expected_1138","Parameter declaration expected."),Type_parameter_declaration_expected:t(1139,e.DiagnosticCategory.Error,"Type_parameter_declaration_expected_1139","Type parameter declaration expected."),Type_argument_expected:t(1140,e.DiagnosticCategory.Error,"Type_argument_expected_1140","Type argument expected."),String_literal_expected:t(1141,e.DiagnosticCategory.Error,"String_literal_expected_1141","String literal expected."),Line_break_not_permitted_here:t(1142,e.DiagnosticCategory.Error,"Line_break_not_permitted_here_1142","Line break not permitted here."),or_expected:t(1144,e.DiagnosticCategory.Error,"or_expected_1144","'{' or ';' expected."),Declaration_expected:t(1146,e.DiagnosticCategory.Error,"Declaration_expected_1146","Declaration expected."),Import_declarations_in_a_namespace_cannot_reference_a_module:t(1147,e.DiagnosticCategory.Error,"Import_declarations_in_a_namespace_cannot_reference_a_module_1147","Import declarations in a namespace cannot reference a module."),Cannot_use_imports_exports_or_module_augmentations_when_module_is_none:t(1148,e.DiagnosticCategory.Error,"Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148","Cannot use imports, exports, or module augmentations when '--module' is 'none'."),File_name_0_differs_from_already_included_file_name_1_only_in_casing:t(1149,e.DiagnosticCategory.Error,"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149","File name '{0}' differs from already included file name '{1}' only in casing."),const_declarations_must_be_initialized:t(1155,e.DiagnosticCategory.Error,"const_declarations_must_be_initialized_1155","'const' declarations must be initialized."),const_declarations_can_only_be_declared_inside_a_block:t(1156,e.DiagnosticCategory.Error,"const_declarations_can_only_be_declared_inside_a_block_1156","'const' declarations can only be declared inside a block."),let_declarations_can_only_be_declared_inside_a_block:t(1157,e.DiagnosticCategory.Error,"let_declarations_can_only_be_declared_inside_a_block_1157","'let' declarations can only be declared inside a block."),Unterminated_template_literal:t(1160,e.DiagnosticCategory.Error,"Unterminated_template_literal_1160","Unterminated template literal."),Unterminated_regular_expression_literal:t(1161,e.DiagnosticCategory.Error,"Unterminated_regular_expression_literal_1161","Unterminated regular expression literal."),An_object_member_cannot_be_declared_optional:t(1162,e.DiagnosticCategory.Error,"An_object_member_cannot_be_declared_optional_1162","An object member cannot be declared optional."),A_yield_expression_is_only_allowed_in_a_generator_body:t(1163,e.DiagnosticCategory.Error,"A_yield_expression_is_only_allowed_in_a_generator_body_1163","A 'yield' expression is only allowed in a generator body."),Computed_property_names_are_not_allowed_in_enums:t(1164,e.DiagnosticCategory.Error,"Computed_property_names_are_not_allowed_in_enums_1164","Computed property names are not allowed in enums."),A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:t(1165,e.DiagnosticCategory.Error,"A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165","A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type:t(1166,e.DiagnosticCategory.Error,"A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_1166","A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type."),A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:t(1168,e.DiagnosticCategory.Error,"A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_ty_1168","A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:t(1169,e.DiagnosticCategory.Error,"A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169","A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type:t(1170,e.DiagnosticCategory.Error,"A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type__1170","A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type."),A_comma_expression_is_not_allowed_in_a_computed_property_name:t(1171,e.DiagnosticCategory.Error,"A_comma_expression_is_not_allowed_in_a_computed_property_name_1171","A comma expression is not allowed in a computed property name."),extends_clause_already_seen:t(1172,e.DiagnosticCategory.Error,"extends_clause_already_seen_1172","'extends' clause already seen."),extends_clause_must_precede_implements_clause:t(1173,e.DiagnosticCategory.Error,"extends_clause_must_precede_implements_clause_1173","'extends' clause must precede 'implements' clause."),Classes_can_only_extend_a_single_class:t(1174,e.DiagnosticCategory.Error,"Classes_can_only_extend_a_single_class_1174","Classes can only extend a single class."),implements_clause_already_seen:t(1175,e.DiagnosticCategory.Error,"implements_clause_already_seen_1175","'implements' clause already seen."),Interface_declaration_cannot_have_implements_clause:t(1176,e.DiagnosticCategory.Error,"Interface_declaration_cannot_have_implements_clause_1176","Interface declaration cannot have 'implements' clause."),Binary_digit_expected:t(1177,e.DiagnosticCategory.Error,"Binary_digit_expected_1177","Binary digit expected."),Octal_digit_expected:t(1178,e.DiagnosticCategory.Error,"Octal_digit_expected_1178","Octal digit expected."),Unexpected_token_expected:t(1179,e.DiagnosticCategory.Error,"Unexpected_token_expected_1179","Unexpected token. '{' expected."),Property_destructuring_pattern_expected:t(1180,e.DiagnosticCategory.Error,"Property_destructuring_pattern_expected_1180","Property destructuring pattern expected."),Array_element_destructuring_pattern_expected:t(1181,e.DiagnosticCategory.Error,"Array_element_destructuring_pattern_expected_1181","Array element destructuring pattern expected."),A_destructuring_declaration_must_have_an_initializer:t(1182,e.DiagnosticCategory.Error,"A_destructuring_declaration_must_have_an_initializer_1182","A destructuring declaration must have an initializer."),An_implementation_cannot_be_declared_in_ambient_contexts:t(1183,e.DiagnosticCategory.Error,"An_implementation_cannot_be_declared_in_ambient_contexts_1183","An implementation cannot be declared in ambient contexts."),Modifiers_cannot_appear_here:t(1184,e.DiagnosticCategory.Error,"Modifiers_cannot_appear_here_1184","Modifiers cannot appear here."),Merge_conflict_marker_encountered:t(1185,e.DiagnosticCategory.Error,"Merge_conflict_marker_encountered_1185","Merge conflict marker encountered."),A_rest_element_cannot_have_an_initializer:t(1186,e.DiagnosticCategory.Error,"A_rest_element_cannot_have_an_initializer_1186","A rest element cannot have an initializer."),A_parameter_property_may_not_be_declared_using_a_binding_pattern:t(1187,e.DiagnosticCategory.Error,"A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187","A parameter property may not be declared using a binding pattern."),Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement:t(1188,e.DiagnosticCategory.Error,"Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188","Only a single variable declaration is allowed in a 'for...of' statement."),The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer:t(1189,e.DiagnosticCategory.Error,"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189","The variable declaration of a 'for...in' statement cannot have an initializer."),The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer:t(1190,e.DiagnosticCategory.Error,"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190","The variable declaration of a 'for...of' statement cannot have an initializer."),An_import_declaration_cannot_have_modifiers:t(1191,e.DiagnosticCategory.Error,"An_import_declaration_cannot_have_modifiers_1191","An import declaration cannot have modifiers."),Module_0_has_no_default_export:t(1192,e.DiagnosticCategory.Error,"Module_0_has_no_default_export_1192","Module '{0}' has no default export."),An_export_declaration_cannot_have_modifiers:t(1193,e.DiagnosticCategory.Error,"An_export_declaration_cannot_have_modifiers_1193","An export declaration cannot have modifiers."),Export_declarations_are_not_permitted_in_a_namespace:t(1194,e.DiagnosticCategory.Error,"Export_declarations_are_not_permitted_in_a_namespace_1194","Export declarations are not permitted in a namespace."),export_Asterisk_does_not_re_export_a_default:t(1195,e.DiagnosticCategory.Error,"export_Asterisk_does_not_re_export_a_default_1195","'export *' does not re-export a default."),Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified:t(1196,e.DiagnosticCategory.Error,"Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified_1196","Catch clause variable type annotation must be 'any' or 'unknown' if specified."),Catch_clause_variable_cannot_have_an_initializer:t(1197,e.DiagnosticCategory.Error,"Catch_clause_variable_cannot_have_an_initializer_1197","Catch clause variable cannot have an initializer."),An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive:t(1198,e.DiagnosticCategory.Error,"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198","An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."),Unterminated_Unicode_escape_sequence:t(1199,e.DiagnosticCategory.Error,"Unterminated_Unicode_escape_sequence_1199","Unterminated Unicode escape sequence."),Line_terminator_not_permitted_before_arrow:t(1200,e.DiagnosticCategory.Error,"Line_terminator_not_permitted_before_arrow_1200","Line terminator not permitted before arrow."),Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead:t(1202,e.DiagnosticCategory.Error,"Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202","Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead."),Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead:t(1203,e.DiagnosticCategory.Error,"Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203","Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead."),Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type:t(1205,e.DiagnosticCategory.Error,"Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type_1205","Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'."),Decorators_are_not_valid_here:t(1206,e.DiagnosticCategory.Error,"Decorators_are_not_valid_here_1206","Decorators are not valid here."),Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name:t(1207,e.DiagnosticCategory.Error,"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207","Decorators cannot be applied to multiple get/set accessors of the same name."),_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module:t(1208,e.DiagnosticCategory.Error,"_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208","'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."),Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode:t(1210,e.DiagnosticCategory.Error,"Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210","Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."),A_class_declaration_without_the_default_modifier_must_have_a_name:t(1211,e.DiagnosticCategory.Error,"A_class_declaration_without_the_default_modifier_must_have_a_name_1211","A class declaration without the 'default' modifier must have a name."),Identifier_expected_0_is_a_reserved_word_in_strict_mode:t(1212,e.DiagnosticCategory.Error,"Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212","Identifier expected. '{0}' is a reserved word in strict mode."),Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode:t(1213,e.DiagnosticCategory.Error,"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213","Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."),Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode:t(1214,e.DiagnosticCategory.Error,"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214","Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."),Invalid_use_of_0_Modules_are_automatically_in_strict_mode:t(1215,e.DiagnosticCategory.Error,"Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215","Invalid use of '{0}'. Modules are automatically in strict mode."),Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules:t(1216,e.DiagnosticCategory.Error,"Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216","Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),Export_assignment_is_not_supported_when_module_flag_is_system:t(1218,e.DiagnosticCategory.Error,"Export_assignment_is_not_supported_when_module_flag_is_system_1218","Export assignment is not supported when '--module' flag is 'system'."),Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning:t(1219,e.DiagnosticCategory.Error,"Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219","Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),Generators_are_not_allowed_in_an_ambient_context:t(1221,e.DiagnosticCategory.Error,"Generators_are_not_allowed_in_an_ambient_context_1221","Generators are not allowed in an ambient context."),An_overload_signature_cannot_be_declared_as_a_generator:t(1222,e.DiagnosticCategory.Error,"An_overload_signature_cannot_be_declared_as_a_generator_1222","An overload signature cannot be declared as a generator."),_0_tag_already_specified:t(1223,e.DiagnosticCategory.Error,"_0_tag_already_specified_1223","'{0}' tag already specified."),Signature_0_must_be_a_type_predicate:t(1224,e.DiagnosticCategory.Error,"Signature_0_must_be_a_type_predicate_1224","Signature '{0}' must be a type predicate."),Cannot_find_parameter_0:t(1225,e.DiagnosticCategory.Error,"Cannot_find_parameter_0_1225","Cannot find parameter '{0}'."),Type_predicate_0_is_not_assignable_to_1:t(1226,e.DiagnosticCategory.Error,"Type_predicate_0_is_not_assignable_to_1_1226","Type predicate '{0}' is not assignable to '{1}'."),Parameter_0_is_not_in_the_same_position_as_parameter_1:t(1227,e.DiagnosticCategory.Error,"Parameter_0_is_not_in_the_same_position_as_parameter_1_1227","Parameter '{0}' is not in the same position as parameter '{1}'."),A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods:t(1228,e.DiagnosticCategory.Error,"A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228","A type predicate is only allowed in return type position for functions and methods."),A_type_predicate_cannot_reference_a_rest_parameter:t(1229,e.DiagnosticCategory.Error,"A_type_predicate_cannot_reference_a_rest_parameter_1229","A type predicate cannot reference a rest parameter."),A_type_predicate_cannot_reference_element_0_in_a_binding_pattern:t(1230,e.DiagnosticCategory.Error,"A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230","A type predicate cannot reference element '{0}' in a binding pattern."),An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration:t(1231,e.DiagnosticCategory.Error,"An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231","An export assignment must be at the top level of a file or module declaration."),An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module:t(1232,e.DiagnosticCategory.Error,"An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1232","An import declaration can only be used at the top level of a namespace or module."),An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module:t(1233,e.DiagnosticCategory.Error,"An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1233","An export declaration can only be used at the top level of a namespace or module."),An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file:t(1234,e.DiagnosticCategory.Error,"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234","An ambient module declaration is only allowed at the top level in a file."),A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module:t(1235,e.DiagnosticCategory.Error,"A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235","A namespace declaration is only allowed at the top level of a namespace or module."),The_return_type_of_a_property_decorator_function_must_be_either_void_or_any:t(1236,e.DiagnosticCategory.Error,"The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236","The return type of a property decorator function must be either 'void' or 'any'."),The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any:t(1237,e.DiagnosticCategory.Error,"The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237","The return type of a parameter decorator function must be either 'void' or 'any'."),Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression:t(1238,e.DiagnosticCategory.Error,"Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238","Unable to resolve signature of class decorator when called as an expression."),Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression:t(1239,e.DiagnosticCategory.Error,"Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239","Unable to resolve signature of parameter decorator when called as an expression."),Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression:t(1240,e.DiagnosticCategory.Error,"Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240","Unable to resolve signature of property decorator when called as an expression."),Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression:t(1241,e.DiagnosticCategory.Error,"Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241","Unable to resolve signature of method decorator when called as an expression."),abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration:t(1242,e.DiagnosticCategory.Error,"abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242","'abstract' modifier can only appear on a class, method, or property declaration."),_0_modifier_cannot_be_used_with_1_modifier:t(1243,e.DiagnosticCategory.Error,"_0_modifier_cannot_be_used_with_1_modifier_1243","'{0}' modifier cannot be used with '{1}' modifier."),Abstract_methods_can_only_appear_within_an_abstract_class:t(1244,e.DiagnosticCategory.Error,"Abstract_methods_can_only_appear_within_an_abstract_class_1244","Abstract methods can only appear within an abstract class."),Method_0_cannot_have_an_implementation_because_it_is_marked_abstract:t(1245,e.DiagnosticCategory.Error,"Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245","Method '{0}' cannot have an implementation because it is marked abstract."),An_interface_property_cannot_have_an_initializer:t(1246,e.DiagnosticCategory.Error,"An_interface_property_cannot_have_an_initializer_1246","An interface property cannot have an initializer."),A_type_literal_property_cannot_have_an_initializer:t(1247,e.DiagnosticCategory.Error,"A_type_literal_property_cannot_have_an_initializer_1247","A type literal property cannot have an initializer."),A_class_member_cannot_have_the_0_keyword:t(1248,e.DiagnosticCategory.Error,"A_class_member_cannot_have_the_0_keyword_1248","A class member cannot have the '{0}' keyword."),A_decorator_can_only_decorate_a_method_implementation_not_an_overload:t(1249,e.DiagnosticCategory.Error,"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249","A decorator can only decorate a method implementation, not an overload."),Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5:t(1250,e.DiagnosticCategory.Error,"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250","Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."),Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode:t(1251,e.DiagnosticCategory.Error,"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251","Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."),Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode:t(1252,e.DiagnosticCategory.Error,"Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252","Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."),A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference:t(1254,e.DiagnosticCategory.Error,"A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254","A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."),A_definite_assignment_assertion_is_not_permitted_in_this_context:t(1255,e.DiagnosticCategory.Error,"A_definite_assignment_assertion_is_not_permitted_in_this_context_1255","A definite assignment assertion '!' is not permitted in this context."),A_required_element_cannot_follow_an_optional_element:t(1257,e.DiagnosticCategory.Error,"A_required_element_cannot_follow_an_optional_element_1257","A required element cannot follow an optional element."),A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration:t(1258,e.DiagnosticCategory.Error,"A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration_1258","A default export must be at the top level of a file or module declaration."),Module_0_can_only_be_default_imported_using_the_1_flag:t(1259,e.DiagnosticCategory.Error,"Module_0_can_only_be_default_imported_using_the_1_flag_1259","Module '{0}' can only be default-imported using the '{1}' flag"),Keywords_cannot_contain_escape_characters:t(1260,e.DiagnosticCategory.Error,"Keywords_cannot_contain_escape_characters_1260","Keywords cannot contain escape characters."),Already_included_file_name_0_differs_from_file_name_1_only_in_casing:t(1261,e.DiagnosticCategory.Error,"Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261","Already included file name '{0}' differs from file name '{1}' only in casing."),Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module:t(1262,e.DiagnosticCategory.Error,"Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262","Identifier expected. '{0}' is a reserved word at the top-level of a module."),Declarations_with_initializers_cannot_also_have_definite_assignment_assertions:t(1263,e.DiagnosticCategory.Error,"Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263","Declarations with initializers cannot also have definite assignment assertions."),Declarations_with_definite_assignment_assertions_must_also_have_type_annotations:t(1264,e.DiagnosticCategory.Error,"Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264","Declarations with definite assignment assertions must also have type annotations."),A_rest_element_cannot_follow_another_rest_element:t(1265,e.DiagnosticCategory.Error,"A_rest_element_cannot_follow_another_rest_element_1265","A rest element cannot follow another rest element."),An_optional_element_cannot_follow_a_rest_element:t(1266,e.DiagnosticCategory.Error,"An_optional_element_cannot_follow_a_rest_element_1266","An optional element cannot follow a rest element."),Property_0_cannot_have_an_initializer_because_it_is_marked_abstract:t(1267,e.DiagnosticCategory.Error,"Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267","Property '{0}' cannot have an initializer because it is marked abstract."),An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type:t(1268,e.DiagnosticCategory.Error,"An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268","An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."),Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided:t(1269,e.DiagnosticCategory.Error,"Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269","Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),Decorator_function_return_type_0_is_not_assignable_to_type_1:t(1270,e.DiagnosticCategory.Error,"Decorator_function_return_type_0_is_not_assignable_to_type_1_1270","Decorator function return type '{0}' is not assignable to type '{1}'."),Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any:t(1271,e.DiagnosticCategory.Error,"Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271","Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled:t(1272,e.DiagnosticCategory.Error,"A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272","A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."),_0_modifier_cannot_appear_on_a_type_parameter:t(1273,e.DiagnosticCategory.Error,"_0_modifier_cannot_appear_on_a_type_parameter_1273","'{0}' modifier cannot appear on a type parameter"),_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias:t(1274,e.DiagnosticCategory.Error,"_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274","'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),with_statements_are_not_allowed_in_an_async_function_block:t(1300,e.DiagnosticCategory.Error,"with_statements_are_not_allowed_in_an_async_function_block_1300","'with' statements are not allowed in an async function block."),await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules:t(1308,e.DiagnosticCategory.Error,"await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308","'await' expressions are only allowed within async functions and at the top levels of modules."),The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level:t(1309,e.DiagnosticCategory.Error,"The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309","The current file is a CommonJS module and cannot use 'await' at the top level."),Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern:t(1312,e.DiagnosticCategory.Error,"Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312","Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),The_body_of_an_if_statement_cannot_be_the_empty_statement:t(1313,e.DiagnosticCategory.Error,"The_body_of_an_if_statement_cannot_be_the_empty_statement_1313","The body of an 'if' statement cannot be the empty statement."),Global_module_exports_may_only_appear_in_module_files:t(1314,e.DiagnosticCategory.Error,"Global_module_exports_may_only_appear_in_module_files_1314","Global module exports may only appear in module files."),Global_module_exports_may_only_appear_in_declaration_files:t(1315,e.DiagnosticCategory.Error,"Global_module_exports_may_only_appear_in_declaration_files_1315","Global module exports may only appear in declaration files."),Global_module_exports_may_only_appear_at_top_level:t(1316,e.DiagnosticCategory.Error,"Global_module_exports_may_only_appear_at_top_level_1316","Global module exports may only appear at top level."),A_parameter_property_cannot_be_declared_using_a_rest_parameter:t(1317,e.DiagnosticCategory.Error,"A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317","A parameter property cannot be declared using a rest parameter."),An_abstract_accessor_cannot_have_an_implementation:t(1318,e.DiagnosticCategory.Error,"An_abstract_accessor_cannot_have_an_implementation_1318","An abstract accessor cannot have an implementation."),A_default_export_can_only_be_used_in_an_ECMAScript_style_module:t(1319,e.DiagnosticCategory.Error,"A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319","A default export can only be used in an ECMAScript-style module."),Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:t(1320,e.DiagnosticCategory.Error,"Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320","Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:t(1321,e.DiagnosticCategory.Error,"Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321","Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:t(1322,e.DiagnosticCategory.Error,"Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322","Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext:t(1323,e.DiagnosticCategory.Error,"Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323","Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext:t(1324,e.DiagnosticCategory.Error,"Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324","Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),Argument_of_dynamic_import_cannot_be_spread_element:t(1325,e.DiagnosticCategory.Error,"Argument_of_dynamic_import_cannot_be_spread_element_1325","Argument of dynamic import cannot be spread element."),This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments:t(1326,e.DiagnosticCategory.Error,"This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326","This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),String_literal_with_double_quotes_expected:t(1327,e.DiagnosticCategory.Error,"String_literal_with_double_quotes_expected_1327","String literal with double quotes expected."),Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal:t(1328,e.DiagnosticCategory.Error,"Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328","Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."),_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0:t(1329,e.DiagnosticCategory.Error,"_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329","'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"),A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly:t(1330,e.DiagnosticCategory.Error,"A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330","A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'."),A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly:t(1331,e.DiagnosticCategory.Error,"A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331","A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'."),A_variable_whose_type_is_a_unique_symbol_type_must_be_const:t(1332,e.DiagnosticCategory.Error,"A_variable_whose_type_is_a_unique_symbol_type_must_be_const_1332","A variable whose type is a 'unique symbol' type must be 'const'."),unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name:t(1333,e.DiagnosticCategory.Error,"unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name_1333","'unique symbol' types may not be used on a variable declaration with a binding name."),unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement:t(1334,e.DiagnosticCategory.Error,"unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement_1334","'unique symbol' types are only allowed on variables in a variable statement."),unique_symbol_types_are_not_allowed_here:t(1335,e.DiagnosticCategory.Error,"unique_symbol_types_are_not_allowed_here_1335","'unique symbol' types are not allowed here."),An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead:t(1337,e.DiagnosticCategory.Error,"An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_o_1337","An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead."),infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type:t(1338,e.DiagnosticCategory.Error,"infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338","'infer' declarations are only permitted in the 'extends' clause of a conditional type."),Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here:t(1339,e.DiagnosticCategory.Error,"Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339","Module '{0}' does not refer to a value, but is used as a value here."),Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0:t(1340,e.DiagnosticCategory.Error,"Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340","Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),Type_arguments_cannot_be_used_here:t(1342,e.DiagnosticCategory.Error,"Type_arguments_cannot_be_used_here_1342","Type arguments cannot be used here."),The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext:t(1343,e.DiagnosticCategory.Error,"The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343","The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),A_label_is_not_allowed_here:t(1344,e.DiagnosticCategory.Error,"A_label_is_not_allowed_here_1344","'A label is not allowed here."),An_expression_of_type_void_cannot_be_tested_for_truthiness:t(1345,e.DiagnosticCategory.Error,"An_expression_of_type_void_cannot_be_tested_for_truthiness_1345","An expression of type 'void' cannot be tested for truthiness."),This_parameter_is_not_allowed_with_use_strict_directive:t(1346,e.DiagnosticCategory.Error,"This_parameter_is_not_allowed_with_use_strict_directive_1346","This parameter is not allowed with 'use strict' directive."),use_strict_directive_cannot_be_used_with_non_simple_parameter_list:t(1347,e.DiagnosticCategory.Error,"use_strict_directive_cannot_be_used_with_non_simple_parameter_list_1347","'use strict' directive cannot be used with non-simple parameter list."),Non_simple_parameter_declared_here:t(1348,e.DiagnosticCategory.Error,"Non_simple_parameter_declared_here_1348","Non-simple parameter declared here."),use_strict_directive_used_here:t(1349,e.DiagnosticCategory.Error,"use_strict_directive_used_here_1349","'use strict' directive used here."),Print_the_final_configuration_instead_of_building:t(1350,e.DiagnosticCategory.Message,"Print_the_final_configuration_instead_of_building_1350","Print the final configuration instead of building."),An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal:t(1351,e.DiagnosticCategory.Error,"An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351","An identifier or keyword cannot immediately follow a numeric literal."),A_bigint_literal_cannot_use_exponential_notation:t(1352,e.DiagnosticCategory.Error,"A_bigint_literal_cannot_use_exponential_notation_1352","A bigint literal cannot use exponential notation."),A_bigint_literal_must_be_an_integer:t(1353,e.DiagnosticCategory.Error,"A_bigint_literal_must_be_an_integer_1353","A bigint literal must be an integer."),readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types:t(1354,e.DiagnosticCategory.Error,"readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354","'readonly' type modifier is only permitted on array and tuple literal types."),A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals:t(1355,e.DiagnosticCategory.Error,"A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355","A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),Did_you_mean_to_mark_this_function_as_async:t(1356,e.DiagnosticCategory.Error,"Did_you_mean_to_mark_this_function_as_async_1356","Did you mean to mark this function as 'async'?"),An_enum_member_name_must_be_followed_by_a_or:t(1357,e.DiagnosticCategory.Error,"An_enum_member_name_must_be_followed_by_a_or_1357","An enum member name must be followed by a ',', '=', or '}'."),Tagged_template_expressions_are_not_permitted_in_an_optional_chain:t(1358,e.DiagnosticCategory.Error,"Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358","Tagged template expressions are not permitted in an optional chain."),Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here:t(1359,e.DiagnosticCategory.Error,"Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359","Identifier expected. '{0}' is a reserved word that cannot be used here."),_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type:t(1361,e.DiagnosticCategory.Error,"_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361","'{0}' cannot be used as a value because it was imported using 'import type'."),_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type:t(1362,e.DiagnosticCategory.Error,"_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362","'{0}' cannot be used as a value because it was exported using 'export type'."),A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both:t(1363,e.DiagnosticCategory.Error,"A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363","A type-only import can specify a default import or named bindings, but not both."),Convert_to_type_only_export:t(1364,e.DiagnosticCategory.Message,"Convert_to_type_only_export_1364","Convert to type-only export"),Convert_all_re_exported_types_to_type_only_exports:t(1365,e.DiagnosticCategory.Message,"Convert_all_re_exported_types_to_type_only_exports_1365","Convert all re-exported types to type-only exports"),Split_into_two_separate_import_declarations:t(1366,e.DiagnosticCategory.Message,"Split_into_two_separate_import_declarations_1366","Split into two separate import declarations"),Split_all_invalid_type_only_imports:t(1367,e.DiagnosticCategory.Message,"Split_all_invalid_type_only_imports_1367","Split all invalid type-only imports"),Did_you_mean_0:t(1369,e.DiagnosticCategory.Message,"Did_you_mean_0_1369","Did you mean '{0}'?"),This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error:t(1371,e.DiagnosticCategory.Error,"This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371","This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),Convert_to_type_only_import:t(1373,e.DiagnosticCategory.Message,"Convert_to_type_only_import_1373","Convert to type-only import"),Convert_all_imports_not_used_as_a_value_to_type_only_imports:t(1374,e.DiagnosticCategory.Message,"Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374","Convert all imports not used as a value to type-only imports"),await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module:t(1375,e.DiagnosticCategory.Error,"await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375","'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),_0_was_imported_here:t(1376,e.DiagnosticCategory.Message,"_0_was_imported_here_1376","'{0}' was imported here."),_0_was_exported_here:t(1377,e.DiagnosticCategory.Message,"_0_was_exported_here_1377","'{0}' was exported here."),Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher:t(1378,e.DiagnosticCategory.Error,"Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378","Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type:t(1379,e.DiagnosticCategory.Error,"An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379","An import alias cannot reference a declaration that was exported using 'export type'."),An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type:t(1380,e.DiagnosticCategory.Error,"An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380","An import alias cannot reference a declaration that was imported using 'import type'."),Unexpected_token_Did_you_mean_or_rbrace:t(1381,e.DiagnosticCategory.Error,"Unexpected_token_Did_you_mean_or_rbrace_1381","Unexpected token. Did you mean `{'}'}` or `&rbrace;`?"),Unexpected_token_Did_you_mean_or_gt:t(1382,e.DiagnosticCategory.Error,"Unexpected_token_Did_you_mean_or_gt_1382","Unexpected token. Did you mean `{'>'}` or `&gt;`?"),Only_named_exports_may_use_export_type:t(1383,e.DiagnosticCategory.Error,"Only_named_exports_may_use_export_type_1383","Only named exports may use 'export type'."),Function_type_notation_must_be_parenthesized_when_used_in_a_union_type:t(1385,e.DiagnosticCategory.Error,"Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385","Function type notation must be parenthesized when used in a union type."),Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type:t(1386,e.DiagnosticCategory.Error,"Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386","Constructor type notation must be parenthesized when used in a union type."),Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type:t(1387,e.DiagnosticCategory.Error,"Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387","Function type notation must be parenthesized when used in an intersection type."),Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type:t(1388,e.DiagnosticCategory.Error,"Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388","Constructor type notation must be parenthesized when used in an intersection type."),_0_is_not_allowed_as_a_variable_declaration_name:t(1389,e.DiagnosticCategory.Error,"_0_is_not_allowed_as_a_variable_declaration_name_1389","'{0}' is not allowed as a variable declaration name."),_0_is_not_allowed_as_a_parameter_name:t(1390,e.DiagnosticCategory.Error,"_0_is_not_allowed_as_a_parameter_name_1390","'{0}' is not allowed as a parameter name."),An_import_alias_cannot_use_import_type:t(1392,e.DiagnosticCategory.Error,"An_import_alias_cannot_use_import_type_1392","An import alias cannot use 'import type'"),Imported_via_0_from_file_1:t(1393,e.DiagnosticCategory.Message,"Imported_via_0_from_file_1_1393","Imported via {0} from file '{1}'"),Imported_via_0_from_file_1_with_packageId_2:t(1394,e.DiagnosticCategory.Message,"Imported_via_0_from_file_1_with_packageId_2_1394","Imported via {0} from file '{1}' with packageId '{2}'"),Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions:t(1395,e.DiagnosticCategory.Message,"Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions_1395","Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions"),Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions:t(1396,e.DiagnosticCategory.Message,"Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions_1396","Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions"),Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions:t(1397,e.DiagnosticCategory.Message,"Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions_1397","Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions"),Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions:t(1398,e.DiagnosticCategory.Message,"Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions_1398","Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions"),File_is_included_via_import_here:t(1399,e.DiagnosticCategory.Message,"File_is_included_via_import_here_1399","File is included via import here."),Referenced_via_0_from_file_1:t(1400,e.DiagnosticCategory.Message,"Referenced_via_0_from_file_1_1400","Referenced via '{0}' from file '{1}'"),File_is_included_via_reference_here:t(1401,e.DiagnosticCategory.Message,"File_is_included_via_reference_here_1401","File is included via reference here."),Type_library_referenced_via_0_from_file_1:t(1402,e.DiagnosticCategory.Message,"Type_library_referenced_via_0_from_file_1_1402","Type library referenced via '{0}' from file '{1}'"),Type_library_referenced_via_0_from_file_1_with_packageId_2:t(1403,e.DiagnosticCategory.Message,"Type_library_referenced_via_0_from_file_1_with_packageId_2_1403","Type library referenced via '{0}' from file '{1}' with packageId '{2}'"),File_is_included_via_type_library_reference_here:t(1404,e.DiagnosticCategory.Message,"File_is_included_via_type_library_reference_here_1404","File is included via type library reference here."),Library_referenced_via_0_from_file_1:t(1405,e.DiagnosticCategory.Message,"Library_referenced_via_0_from_file_1_1405","Library referenced via '{0}' from file '{1}'"),File_is_included_via_library_reference_here:t(1406,e.DiagnosticCategory.Message,"File_is_included_via_library_reference_here_1406","File is included via library reference here."),Matched_by_include_pattern_0_in_1:t(1407,e.DiagnosticCategory.Message,"Matched_by_include_pattern_0_in_1_1407","Matched by include pattern '{0}' in '{1}'"),File_is_matched_by_include_pattern_specified_here:t(1408,e.DiagnosticCategory.Message,"File_is_matched_by_include_pattern_specified_here_1408","File is matched by include pattern specified here."),Part_of_files_list_in_tsconfig_json:t(1409,e.DiagnosticCategory.Message,"Part_of_files_list_in_tsconfig_json_1409","Part of 'files' list in tsconfig.json"),File_is_matched_by_files_list_specified_here:t(1410,e.DiagnosticCategory.Message,"File_is_matched_by_files_list_specified_here_1410","File is matched by 'files' list specified here."),Output_from_referenced_project_0_included_because_1_specified:t(1411,e.DiagnosticCategory.Message,"Output_from_referenced_project_0_included_because_1_specified_1411","Output from referenced project '{0}' included because '{1}' specified"),Output_from_referenced_project_0_included_because_module_is_specified_as_none:t(1412,e.DiagnosticCategory.Message,"Output_from_referenced_project_0_included_because_module_is_specified_as_none_1412","Output from referenced project '{0}' included because '--module' is specified as 'none'"),File_is_output_from_referenced_project_specified_here:t(1413,e.DiagnosticCategory.Message,"File_is_output_from_referenced_project_specified_here_1413","File is output from referenced project specified here."),Source_from_referenced_project_0_included_because_1_specified:t(1414,e.DiagnosticCategory.Message,"Source_from_referenced_project_0_included_because_1_specified_1414","Source from referenced project '{0}' included because '{1}' specified"),Source_from_referenced_project_0_included_because_module_is_specified_as_none:t(1415,e.DiagnosticCategory.Message,"Source_from_referenced_project_0_included_because_module_is_specified_as_none_1415","Source from referenced project '{0}' included because '--module' is specified as 'none'"),File_is_source_from_referenced_project_specified_here:t(1416,e.DiagnosticCategory.Message,"File_is_source_from_referenced_project_specified_here_1416","File is source from referenced project specified here."),Entry_point_of_type_library_0_specified_in_compilerOptions:t(1417,e.DiagnosticCategory.Message,"Entry_point_of_type_library_0_specified_in_compilerOptions_1417","Entry point of type library '{0}' specified in compilerOptions"),Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1:t(1418,e.DiagnosticCategory.Message,"Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1_1418","Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'"),File_is_entry_point_of_type_library_specified_here:t(1419,e.DiagnosticCategory.Message,"File_is_entry_point_of_type_library_specified_here_1419","File is entry point of type library specified here."),Entry_point_for_implicit_type_library_0:t(1420,e.DiagnosticCategory.Message,"Entry_point_for_implicit_type_library_0_1420","Entry point for implicit type library '{0}'"),Entry_point_for_implicit_type_library_0_with_packageId_1:t(1421,e.DiagnosticCategory.Message,"Entry_point_for_implicit_type_library_0_with_packageId_1_1421","Entry point for implicit type library '{0}' with packageId '{1}'"),Library_0_specified_in_compilerOptions:t(1422,e.DiagnosticCategory.Message,"Library_0_specified_in_compilerOptions_1422","Library '{0}' specified in compilerOptions"),File_is_library_specified_here:t(1423,e.DiagnosticCategory.Message,"File_is_library_specified_here_1423","File is library specified here."),Default_library:t(1424,e.DiagnosticCategory.Message,"Default_library_1424","Default library"),Default_library_for_target_0:t(1425,e.DiagnosticCategory.Message,"Default_library_for_target_0_1425","Default library for target '{0}'"),File_is_default_library_for_target_specified_here:t(1426,e.DiagnosticCategory.Message,"File_is_default_library_for_target_specified_here_1426","File is default library for target specified here."),Root_file_specified_for_compilation:t(1427,e.DiagnosticCategory.Message,"Root_file_specified_for_compilation_1427","Root file specified for compilation"),File_is_output_of_project_reference_source_0:t(1428,e.DiagnosticCategory.Message,"File_is_output_of_project_reference_source_0_1428","File is output of project reference source '{0}'"),File_redirects_to_file_0:t(1429,e.DiagnosticCategory.Message,"File_redirects_to_file_0_1429","File redirects to file '{0}'"),The_file_is_in_the_program_because_Colon:t(1430,e.DiagnosticCategory.Message,"The_file_is_in_the_program_because_Colon_1430","The file is in the program because:"),for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module:t(1431,e.DiagnosticCategory.Error,"for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431","'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher:t(1432,e.DiagnosticCategory.Error,"Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432","Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),Decorators_may_not_be_applied_to_this_parameters:t(1433,e.DiagnosticCategory.Error,"Decorators_may_not_be_applied_to_this_parameters_1433","Decorators may not be applied to 'this' parameters."),Unexpected_keyword_or_identifier:t(1434,e.DiagnosticCategory.Error,"Unexpected_keyword_or_identifier_1434","Unexpected keyword or identifier."),Unknown_keyword_or_identifier_Did_you_mean_0:t(1435,e.DiagnosticCategory.Error,"Unknown_keyword_or_identifier_Did_you_mean_0_1435","Unknown keyword or identifier. Did you mean '{0}'?"),Decorators_must_precede_the_name_and_all_keywords_of_property_declarations:t(1436,e.DiagnosticCategory.Error,"Decorators_must_precede_the_name_and_all_keywords_of_property_declarations_1436","Decorators must precede the name and all keywords of property declarations."),Namespace_must_be_given_a_name:t(1437,e.DiagnosticCategory.Error,"Namespace_must_be_given_a_name_1437","Namespace must be given a name."),Interface_must_be_given_a_name:t(1438,e.DiagnosticCategory.Error,"Interface_must_be_given_a_name_1438","Interface must be given a name."),Type_alias_must_be_given_a_name:t(1439,e.DiagnosticCategory.Error,"Type_alias_must_be_given_a_name_1439","Type alias must be given a name."),Variable_declaration_not_allowed_at_this_location:t(1440,e.DiagnosticCategory.Error,"Variable_declaration_not_allowed_at_this_location_1440","Variable declaration not allowed at this location."),Cannot_start_a_function_call_in_a_type_annotation:t(1441,e.DiagnosticCategory.Error,"Cannot_start_a_function_call_in_a_type_annotation_1441","Cannot start a function call in a type annotation."),Expected_for_property_initializer:t(1442,e.DiagnosticCategory.Error,"Expected_for_property_initializer_1442","Expected '=' for property initializer."),Module_declaration_names_may_only_use_or_quoted_strings:t(1443,e.DiagnosticCategory.Error,"Module_declaration_names_may_only_use_or_quoted_strings_1443","Module declaration names may only use ' or \" quoted strings."),_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled:t(1444,e.DiagnosticCategory.Error,"_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedMod_1444","'{0}' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled:t(1446,e.DiagnosticCategory.Error,"_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446","'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled:t(1448,e.DiagnosticCategory.Error,"_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isol_1448","'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled."),Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed:t(1449,e.DiagnosticCategory.Message,"Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449","Preserve unused imported values in the JavaScript output that would otherwise be removed."),Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments:t(1450,e.DiagnosticCategory.Message,"Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450","Dynamic imports can only accept a module specifier and an optional assertion as arguments"),Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression:t(1451,e.DiagnosticCategory.Error,"Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451","Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext:t(1452,e.DiagnosticCategory.Error,"resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452","'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`."),resolution_mode_should_be_either_require_or_import:t(1453,e.DiagnosticCategory.Error,"resolution_mode_should_be_either_require_or_import_1453","`resolution-mode` should be either `require` or `import`."),resolution_mode_can_only_be_set_for_type_only_imports:t(1454,e.DiagnosticCategory.Error,"resolution_mode_can_only_be_set_for_type_only_imports_1454","`resolution-mode` can only be set for type-only imports."),resolution_mode_is_the_only_valid_key_for_type_import_assertions:t(1455,e.DiagnosticCategory.Error,"resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455","`resolution-mode` is the only valid key for type import assertions."),Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require:t(1456,e.DiagnosticCategory.Error,"Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456","Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."),The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output:t(1470,e.DiagnosticCategory.Error,"The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470","The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead:t(1471,e.DiagnosticCategory.Error,"Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471","Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),catch_or_finally_expected:t(1472,e.DiagnosticCategory.Error,"catch_or_finally_expected_1472","'catch' or 'finally' expected."),An_import_declaration_can_only_be_used_at_the_top_level_of_a_module:t(1473,e.DiagnosticCategory.Error,"An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473","An import declaration can only be used at the top level of a module."),An_export_declaration_can_only_be_used_at_the_top_level_of_a_module:t(1474,e.DiagnosticCategory.Error,"An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474","An export declaration can only be used at the top level of a module."),Control_what_method_is_used_to_detect_module_format_JS_files:t(1475,e.DiagnosticCategory.Message,"Control_what_method_is_used_to_detect_module_format_JS_files_1475","Control what method is used to detect module-format JS files."),auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules:t(1476,e.DiagnosticCategory.Message,"auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476",'"auto": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules.'),The_types_of_0_are_incompatible_between_these_types:t(2200,e.DiagnosticCategory.Error,"The_types_of_0_are_incompatible_between_these_types_2200","The types of '{0}' are incompatible between these types."),The_types_returned_by_0_are_incompatible_between_these_types:t(2201,e.DiagnosticCategory.Error,"The_types_returned_by_0_are_incompatible_between_these_types_2201","The types returned by '{0}' are incompatible between these types."),Call_signature_return_types_0_and_1_are_incompatible:t(2202,e.DiagnosticCategory.Error,"Call_signature_return_types_0_and_1_are_incompatible_2202","Call signature return types '{0}' and '{1}' are incompatible.",void 0,!0),Construct_signature_return_types_0_and_1_are_incompatible:t(2203,e.DiagnosticCategory.Error,"Construct_signature_return_types_0_and_1_are_incompatible_2203","Construct signature return types '{0}' and '{1}' are incompatible.",void 0,!0),Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1:t(2204,e.DiagnosticCategory.Error,"Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2204","Call signatures with no arguments have incompatible return types '{0}' and '{1}'.",void 0,!0),Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1:t(2205,e.DiagnosticCategory.Error,"Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205","Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.",void 0,!0),The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement:t(2206,e.DiagnosticCategory.Error,"The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206","The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement:t(2207,e.DiagnosticCategory.Error,"The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207","The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate:t(2209,e.DiagnosticCategory.Error,"The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209","The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate:t(2210,e.DiagnosticCategory.Error,"The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210","The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),Duplicate_identifier_0:t(2300,e.DiagnosticCategory.Error,"Duplicate_identifier_0_2300","Duplicate identifier '{0}'."),Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor:t(2301,e.DiagnosticCategory.Error,"Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301","Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),Static_members_cannot_reference_class_type_parameters:t(2302,e.DiagnosticCategory.Error,"Static_members_cannot_reference_class_type_parameters_2302","Static members cannot reference class type parameters."),Circular_definition_of_import_alias_0:t(2303,e.DiagnosticCategory.Error,"Circular_definition_of_import_alias_0_2303","Circular definition of import alias '{0}'."),Cannot_find_name_0:t(2304,e.DiagnosticCategory.Error,"Cannot_find_name_0_2304","Cannot find name '{0}'."),Module_0_has_no_exported_member_1:t(2305,e.DiagnosticCategory.Error,"Module_0_has_no_exported_member_1_2305","Module '{0}' has no exported member '{1}'."),File_0_is_not_a_module:t(2306,e.DiagnosticCategory.Error,"File_0_is_not_a_module_2306","File '{0}' is not a module."),Cannot_find_module_0_or_its_corresponding_type_declarations:t(2307,e.DiagnosticCategory.Error,"Cannot_find_module_0_or_its_corresponding_type_declarations_2307","Cannot find module '{0}' or its corresponding type declarations."),Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity:t(2308,e.DiagnosticCategory.Error,"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308","Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."),An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements:t(2309,e.DiagnosticCategory.Error,"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309","An export assignment cannot be used in a module with other exported elements."),Type_0_recursively_references_itself_as_a_base_type:t(2310,e.DiagnosticCategory.Error,"Type_0_recursively_references_itself_as_a_base_type_2310","Type '{0}' recursively references itself as a base type."),Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function:t(2311,e.DiagnosticCategory.Error,"Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function_2311","Cannot find name '{0}'. Did you mean to write this in an async function?"),An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members:t(2312,e.DiagnosticCategory.Error,"An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312","An interface can only extend an object type or intersection of object types with statically known members."),Type_parameter_0_has_a_circular_constraint:t(2313,e.DiagnosticCategory.Error,"Type_parameter_0_has_a_circular_constraint_2313","Type parameter '{0}' has a circular constraint."),Generic_type_0_requires_1_type_argument_s:t(2314,e.DiagnosticCategory.Error,"Generic_type_0_requires_1_type_argument_s_2314","Generic type '{0}' requires {1} type argument(s)."),Type_0_is_not_generic:t(2315,e.DiagnosticCategory.Error,"Type_0_is_not_generic_2315","Type '{0}' is not generic."),Global_type_0_must_be_a_class_or_interface_type:t(2316,e.DiagnosticCategory.Error,"Global_type_0_must_be_a_class_or_interface_type_2316","Global type '{0}' must be a class or interface type."),Global_type_0_must_have_1_type_parameter_s:t(2317,e.DiagnosticCategory.Error,"Global_type_0_must_have_1_type_parameter_s_2317","Global type '{0}' must have {1} type parameter(s)."),Cannot_find_global_type_0:t(2318,e.DiagnosticCategory.Error,"Cannot_find_global_type_0_2318","Cannot find global type '{0}'."),Named_property_0_of_types_1_and_2_are_not_identical:t(2319,e.DiagnosticCategory.Error,"Named_property_0_of_types_1_and_2_are_not_identical_2319","Named property '{0}' of types '{1}' and '{2}' are not identical."),Interface_0_cannot_simultaneously_extend_types_1_and_2:t(2320,e.DiagnosticCategory.Error,"Interface_0_cannot_simultaneously_extend_types_1_and_2_2320","Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."),Excessive_stack_depth_comparing_types_0_and_1:t(2321,e.DiagnosticCategory.Error,"Excessive_stack_depth_comparing_types_0_and_1_2321","Excessive stack depth comparing types '{0}' and '{1}'."),Type_0_is_not_assignable_to_type_1:t(2322,e.DiagnosticCategory.Error,"Type_0_is_not_assignable_to_type_1_2322","Type '{0}' is not assignable to type '{1}'."),Cannot_redeclare_exported_variable_0:t(2323,e.DiagnosticCategory.Error,"Cannot_redeclare_exported_variable_0_2323","Cannot redeclare exported variable '{0}'."),Property_0_is_missing_in_type_1:t(2324,e.DiagnosticCategory.Error,"Property_0_is_missing_in_type_1_2324","Property '{0}' is missing in type '{1}'."),Property_0_is_private_in_type_1_but_not_in_type_2:t(2325,e.DiagnosticCategory.Error,"Property_0_is_private_in_type_1_but_not_in_type_2_2325","Property '{0}' is private in type '{1}' but not in type '{2}'."),Types_of_property_0_are_incompatible:t(2326,e.DiagnosticCategory.Error,"Types_of_property_0_are_incompatible_2326","Types of property '{0}' are incompatible."),Property_0_is_optional_in_type_1_but_required_in_type_2:t(2327,e.DiagnosticCategory.Error,"Property_0_is_optional_in_type_1_but_required_in_type_2_2327","Property '{0}' is optional in type '{1}' but required in type '{2}'."),Types_of_parameters_0_and_1_are_incompatible:t(2328,e.DiagnosticCategory.Error,"Types_of_parameters_0_and_1_are_incompatible_2328","Types of parameters '{0}' and '{1}' are incompatible."),Index_signature_for_type_0_is_missing_in_type_1:t(2329,e.DiagnosticCategory.Error,"Index_signature_for_type_0_is_missing_in_type_1_2329","Index signature for type '{0}' is missing in type '{1}'."),_0_and_1_index_signatures_are_incompatible:t(2330,e.DiagnosticCategory.Error,"_0_and_1_index_signatures_are_incompatible_2330","'{0}' and '{1}' index signatures are incompatible."),this_cannot_be_referenced_in_a_module_or_namespace_body:t(2331,e.DiagnosticCategory.Error,"this_cannot_be_referenced_in_a_module_or_namespace_body_2331","'this' cannot be referenced in a module or namespace body."),this_cannot_be_referenced_in_current_location:t(2332,e.DiagnosticCategory.Error,"this_cannot_be_referenced_in_current_location_2332","'this' cannot be referenced in current location."),this_cannot_be_referenced_in_constructor_arguments:t(2333,e.DiagnosticCategory.Error,"this_cannot_be_referenced_in_constructor_arguments_2333","'this' cannot be referenced in constructor arguments."),this_cannot_be_referenced_in_a_static_property_initializer:t(2334,e.DiagnosticCategory.Error,"this_cannot_be_referenced_in_a_static_property_initializer_2334","'this' cannot be referenced in a static property initializer."),super_can_only_be_referenced_in_a_derived_class:t(2335,e.DiagnosticCategory.Error,"super_can_only_be_referenced_in_a_derived_class_2335","'super' can only be referenced in a derived class."),super_cannot_be_referenced_in_constructor_arguments:t(2336,e.DiagnosticCategory.Error,"super_cannot_be_referenced_in_constructor_arguments_2336","'super' cannot be referenced in constructor arguments."),Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors:t(2337,e.DiagnosticCategory.Error,"Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337","Super calls are not permitted outside constructors or in nested functions inside constructors."),super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class:t(2338,e.DiagnosticCategory.Error,"super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338","'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."),Property_0_does_not_exist_on_type_1:t(2339,e.DiagnosticCategory.Error,"Property_0_does_not_exist_on_type_1_2339","Property '{0}' does not exist on type '{1}'."),Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword:t(2340,e.DiagnosticCategory.Error,"Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340","Only public and protected methods of the base class are accessible via the 'super' keyword."),Property_0_is_private_and_only_accessible_within_class_1:t(2341,e.DiagnosticCategory.Error,"Property_0_is_private_and_only_accessible_within_class_1_2341","Property '{0}' is private and only accessible within class '{1}'."),This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0:t(2343,e.DiagnosticCategory.Error,"This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343","This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."),Type_0_does_not_satisfy_the_constraint_1:t(2344,e.DiagnosticCategory.Error,"Type_0_does_not_satisfy_the_constraint_1_2344","Type '{0}' does not satisfy the constraint '{1}'."),Argument_of_type_0_is_not_assignable_to_parameter_of_type_1:t(2345,e.DiagnosticCategory.Error,"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345","Argument of type '{0}' is not assignable to parameter of type '{1}'."),Call_target_does_not_contain_any_signatures:t(2346,e.DiagnosticCategory.Error,"Call_target_does_not_contain_any_signatures_2346","Call target does not contain any signatures."),Untyped_function_calls_may_not_accept_type_arguments:t(2347,e.DiagnosticCategory.Error,"Untyped_function_calls_may_not_accept_type_arguments_2347","Untyped function calls may not accept type arguments."),Value_of_type_0_is_not_callable_Did_you_mean_to_include_new:t(2348,e.DiagnosticCategory.Error,"Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348","Value of type '{0}' is not callable. Did you mean to include 'new'?"),This_expression_is_not_callable:t(2349,e.DiagnosticCategory.Error,"This_expression_is_not_callable_2349","This expression is not callable."),Only_a_void_function_can_be_called_with_the_new_keyword:t(2350,e.DiagnosticCategory.Error,"Only_a_void_function_can_be_called_with_the_new_keyword_2350","Only a void function can be called with the 'new' keyword."),This_expression_is_not_constructable:t(2351,e.DiagnosticCategory.Error,"This_expression_is_not_constructable_2351","This expression is not constructable."),Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first:t(2352,e.DiagnosticCategory.Error,"Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352","Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first."),Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1:t(2353,e.DiagnosticCategory.Error,"Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353","Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."),This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found:t(2354,e.DiagnosticCategory.Error,"This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354","This syntax requires an imported helper but module '{0}' cannot be found."),A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value:t(2355,e.DiagnosticCategory.Error,"A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355","A function whose declared type is neither 'void' nor 'any' must return a value."),An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type:t(2356,e.DiagnosticCategory.Error,"An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356","An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."),The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access:t(2357,e.DiagnosticCategory.Error,"The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357","The operand of an increment or decrement operator must be a variable or a property access."),The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter:t(2358,e.DiagnosticCategory.Error,"The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358","The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type:t(2359,e.DiagnosticCategory.Error,"The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359","The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol:t(2360,e.DiagnosticCategory.Error,"The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360","The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),The_right_hand_side_of_an_in_expression_must_not_be_a_primitive:t(2361,e.DiagnosticCategory.Error,"The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361","The right-hand side of an 'in' expression must not be a primitive."),The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type:t(2362,e.DiagnosticCategory.Error,"The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362","The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type:t(2363,e.DiagnosticCategory.Error,"The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363","The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access:t(2364,e.DiagnosticCategory.Error,"The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364","The left-hand side of an assignment expression must be a variable or a property access."),Operator_0_cannot_be_applied_to_types_1_and_2:t(2365,e.DiagnosticCategory.Error,"Operator_0_cannot_be_applied_to_types_1_and_2_2365","Operator '{0}' cannot be applied to types '{1}' and '{2}'."),Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined:t(2366,e.DiagnosticCategory.Error,"Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366","Function lacks ending return statement and return type does not include 'undefined'."),This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap:t(2367,e.DiagnosticCategory.Error,"This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367","This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."),Type_parameter_name_cannot_be_0:t(2368,e.DiagnosticCategory.Error,"Type_parameter_name_cannot_be_0_2368","Type parameter name cannot be '{0}'."),A_parameter_property_is_only_allowed_in_a_constructor_implementation:t(2369,e.DiagnosticCategory.Error,"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369","A parameter property is only allowed in a constructor implementation."),A_rest_parameter_must_be_of_an_array_type:t(2370,e.DiagnosticCategory.Error,"A_rest_parameter_must_be_of_an_array_type_2370","A rest parameter must be of an array type."),A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation:t(2371,e.DiagnosticCategory.Error,"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371","A parameter initializer is only allowed in a function or constructor implementation."),Parameter_0_cannot_reference_itself:t(2372,e.DiagnosticCategory.Error,"Parameter_0_cannot_reference_itself_2372","Parameter '{0}' cannot reference itself."),Parameter_0_cannot_reference_identifier_1_declared_after_it:t(2373,e.DiagnosticCategory.Error,"Parameter_0_cannot_reference_identifier_1_declared_after_it_2373","Parameter '{0}' cannot reference identifier '{1}' declared after it."),Duplicate_index_signature_for_type_0:t(2374,e.DiagnosticCategory.Error,"Duplicate_index_signature_for_type_0_2374","Duplicate index signature for type '{0}'."),Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties:t(2375,e.DiagnosticCategory.Error,"Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2375","Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers:t(2376,e.DiagnosticCategory.Error,"A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_2376","A 'super' call must be the first statement in the constructor to refer to 'super' or 'this' when a derived class contains initialized properties, parameter properties, or private identifiers."),Constructors_for_derived_classes_must_contain_a_super_call:t(2377,e.DiagnosticCategory.Error,"Constructors_for_derived_classes_must_contain_a_super_call_2377","Constructors for derived classes must contain a 'super' call."),A_get_accessor_must_return_a_value:t(2378,e.DiagnosticCategory.Error,"A_get_accessor_must_return_a_value_2378","A 'get' accessor must return a value."),Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties:t(2379,e.DiagnosticCategory.Error,"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379","Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type:t(2380,e.DiagnosticCategory.Error,"The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380","The return type of a 'get' accessor must be assignable to its 'set' accessor type"),Overload_signatures_must_all_be_exported_or_non_exported:t(2383,e.DiagnosticCategory.Error,"Overload_signatures_must_all_be_exported_or_non_exported_2383","Overload signatures must all be exported or non-exported."),Overload_signatures_must_all_be_ambient_or_non_ambient:t(2384,e.DiagnosticCategory.Error,"Overload_signatures_must_all_be_ambient_or_non_ambient_2384","Overload signatures must all be ambient or non-ambient."),Overload_signatures_must_all_be_public_private_or_protected:t(2385,e.DiagnosticCategory.Error,"Overload_signatures_must_all_be_public_private_or_protected_2385","Overload signatures must all be public, private or protected."),Overload_signatures_must_all_be_optional_or_required:t(2386,e.DiagnosticCategory.Error,"Overload_signatures_must_all_be_optional_or_required_2386","Overload signatures must all be optional or required."),Function_overload_must_be_static:t(2387,e.DiagnosticCategory.Error,"Function_overload_must_be_static_2387","Function overload must be static."),Function_overload_must_not_be_static:t(2388,e.DiagnosticCategory.Error,"Function_overload_must_not_be_static_2388","Function overload must not be static."),Function_implementation_name_must_be_0:t(2389,e.DiagnosticCategory.Error,"Function_implementation_name_must_be_0_2389","Function implementation name must be '{0}'."),Constructor_implementation_is_missing:t(2390,e.DiagnosticCategory.Error,"Constructor_implementation_is_missing_2390","Constructor implementation is missing."),Function_implementation_is_missing_or_not_immediately_following_the_declaration:t(2391,e.DiagnosticCategory.Error,"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391","Function implementation is missing or not immediately following the declaration."),Multiple_constructor_implementations_are_not_allowed:t(2392,e.DiagnosticCategory.Error,"Multiple_constructor_implementations_are_not_allowed_2392","Multiple constructor implementations are not allowed."),Duplicate_function_implementation:t(2393,e.DiagnosticCategory.Error,"Duplicate_function_implementation_2393","Duplicate function implementation."),This_overload_signature_is_not_compatible_with_its_implementation_signature:t(2394,e.DiagnosticCategory.Error,"This_overload_signature_is_not_compatible_with_its_implementation_signature_2394","This overload signature is not compatible with its implementation signature."),Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local:t(2395,e.DiagnosticCategory.Error,"Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395","Individual declarations in merged declaration '{0}' must be all exported or all local."),Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters:t(2396,e.DiagnosticCategory.Error,"Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396","Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."),Declaration_name_conflicts_with_built_in_global_identifier_0:t(2397,e.DiagnosticCategory.Error,"Declaration_name_conflicts_with_built_in_global_identifier_0_2397","Declaration name conflicts with built-in global identifier '{0}'."),constructor_cannot_be_used_as_a_parameter_property_name:t(2398,e.DiagnosticCategory.Error,"constructor_cannot_be_used_as_a_parameter_property_name_2398","'constructor' cannot be used as a parameter property name."),Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference:t(2399,e.DiagnosticCategory.Error,"Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399","Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."),Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference:t(2400,e.DiagnosticCategory.Error,"Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400","Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."),A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers:t(2401,e.DiagnosticCategory.Error,"A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_in_2401","A 'super' call must be a root-level statement within a constructor of a derived class that contains initialized properties, parameter properties, or private identifiers."),Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference:t(2402,e.DiagnosticCategory.Error,"Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402","Expression resolves to '_super' that compiler uses to capture base class reference."),Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2:t(2403,e.DiagnosticCategory.Error,"Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403","Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."),The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation:t(2404,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404","The left-hand side of a 'for...in' statement cannot use a type annotation."),The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any:t(2405,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405","The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."),The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access:t(2406,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406","The left-hand side of a 'for...in' statement must be a variable or a property access."),The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0:t(2407,e.DiagnosticCategory.Error,"The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407","The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."),Setters_cannot_return_a_value:t(2408,e.DiagnosticCategory.Error,"Setters_cannot_return_a_value_2408","Setters cannot return a value."),Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class:t(2409,e.DiagnosticCategory.Error,"Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409","Return type of constructor signature must be assignable to the instance type of the class."),The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any:t(2410,e.DiagnosticCategory.Error,"The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410","The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."),Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target:t(2412,e.DiagnosticCategory.Error,"Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412","Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target."),Property_0_of_type_1_is_not_assignable_to_2_index_type_3:t(2411,e.DiagnosticCategory.Error,"Property_0_of_type_1_is_not_assignable_to_2_index_type_3_2411","Property '{0}' of type '{1}' is not assignable to '{2}' index type '{3}'."),_0_index_type_1_is_not_assignable_to_2_index_type_3:t(2413,e.DiagnosticCategory.Error,"_0_index_type_1_is_not_assignable_to_2_index_type_3_2413","'{0}' index type '{1}' is not assignable to '{2}' index type '{3}'."),Class_name_cannot_be_0:t(2414,e.DiagnosticCategory.Error,"Class_name_cannot_be_0_2414","Class name cannot be '{0}'."),Class_0_incorrectly_extends_base_class_1:t(2415,e.DiagnosticCategory.Error,"Class_0_incorrectly_extends_base_class_1_2415","Class '{0}' incorrectly extends base class '{1}'."),Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2:t(2416,e.DiagnosticCategory.Error,"Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2_2416","Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'."),Class_static_side_0_incorrectly_extends_base_class_static_side_1:t(2417,e.DiagnosticCategory.Error,"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417","Class static side '{0}' incorrectly extends base class static side '{1}'."),Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1:t(2418,e.DiagnosticCategory.Error,"Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1_2418","Type of computed property's value is '{0}', which is not assignable to type '{1}'."),Types_of_construct_signatures_are_incompatible:t(2419,e.DiagnosticCategory.Error,"Types_of_construct_signatures_are_incompatible_2419","Types of construct signatures are incompatible."),Class_0_incorrectly_implements_interface_1:t(2420,e.DiagnosticCategory.Error,"Class_0_incorrectly_implements_interface_1_2420","Class '{0}' incorrectly implements interface '{1}'."),A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members:t(2422,e.DiagnosticCategory.Error,"A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_memb_2422","A class can only implement an object type or intersection of object types with statically known members."),Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor:t(2423,e.DiagnosticCategory.Error,"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423","Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."),Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function:t(2425,e.DiagnosticCategory.Error,"Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425","Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."),Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function:t(2426,e.DiagnosticCategory.Error,"Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426","Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."),Interface_name_cannot_be_0:t(2427,e.DiagnosticCategory.Error,"Interface_name_cannot_be_0_2427","Interface name cannot be '{0}'."),All_declarations_of_0_must_have_identical_type_parameters:t(2428,e.DiagnosticCategory.Error,"All_declarations_of_0_must_have_identical_type_parameters_2428","All declarations of '{0}' must have identical type parameters."),Interface_0_incorrectly_extends_interface_1:t(2430,e.DiagnosticCategory.Error,"Interface_0_incorrectly_extends_interface_1_2430","Interface '{0}' incorrectly extends interface '{1}'."),Enum_name_cannot_be_0:t(2431,e.DiagnosticCategory.Error,"Enum_name_cannot_be_0_2431","Enum name cannot be '{0}'."),In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element:t(2432,e.DiagnosticCategory.Error,"In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432","In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."),A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged:t(2433,e.DiagnosticCategory.Error,"A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433","A namespace declaration cannot be in a different file from a class or function with which it is merged."),A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged:t(2434,e.DiagnosticCategory.Error,"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434","A namespace declaration cannot be located prior to a class or function with which it is merged."),Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces:t(2435,e.DiagnosticCategory.Error,"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435","Ambient modules cannot be nested in other modules or namespaces."),Ambient_module_declaration_cannot_specify_relative_module_name:t(2436,e.DiagnosticCategory.Error,"Ambient_module_declaration_cannot_specify_relative_module_name_2436","Ambient module declaration cannot specify relative module name."),Module_0_is_hidden_by_a_local_declaration_with_the_same_name:t(2437,e.DiagnosticCategory.Error,"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437","Module '{0}' is hidden by a local declaration with the same name."),Import_name_cannot_be_0:t(2438,e.DiagnosticCategory.Error,"Import_name_cannot_be_0_2438","Import name cannot be '{0}'."),Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name:t(2439,e.DiagnosticCategory.Error,"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439","Import or export declaration in an ambient module declaration cannot reference module through relative module name."),Import_declaration_conflicts_with_local_declaration_of_0:t(2440,e.DiagnosticCategory.Error,"Import_declaration_conflicts_with_local_declaration_of_0_2440","Import declaration conflicts with local declaration of '{0}'."),Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module:t(2441,e.DiagnosticCategory.Error,"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441","Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."),Types_have_separate_declarations_of_a_private_property_0:t(2442,e.DiagnosticCategory.Error,"Types_have_separate_declarations_of_a_private_property_0_2442","Types have separate declarations of a private property '{0}'."),Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2:t(2443,e.DiagnosticCategory.Error,"Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443","Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."),Property_0_is_protected_in_type_1_but_public_in_type_2:t(2444,e.DiagnosticCategory.Error,"Property_0_is_protected_in_type_1_but_public_in_type_2_2444","Property '{0}' is protected in type '{1}' but public in type '{2}'."),Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses:t(2445,e.DiagnosticCategory.Error,"Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445","Property '{0}' is protected and only accessible within class '{1}' and its subclasses."),Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2:t(2446,e.DiagnosticCategory.Error,"Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_cl_2446","Property '{0}' is protected and only accessible through an instance of class '{1}'. This is an instance of class '{2}'."),The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead:t(2447,e.DiagnosticCategory.Error,"The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447","The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."),Block_scoped_variable_0_used_before_its_declaration:t(2448,e.DiagnosticCategory.Error,"Block_scoped_variable_0_used_before_its_declaration_2448","Block-scoped variable '{0}' used before its declaration."),Class_0_used_before_its_declaration:t(2449,e.DiagnosticCategory.Error,"Class_0_used_before_its_declaration_2449","Class '{0}' used before its declaration."),Enum_0_used_before_its_declaration:t(2450,e.DiagnosticCategory.Error,"Enum_0_used_before_its_declaration_2450","Enum '{0}' used before its declaration."),Cannot_redeclare_block_scoped_variable_0:t(2451,e.DiagnosticCategory.Error,"Cannot_redeclare_block_scoped_variable_0_2451","Cannot redeclare block-scoped variable '{0}'."),An_enum_member_cannot_have_a_numeric_name:t(2452,e.DiagnosticCategory.Error,"An_enum_member_cannot_have_a_numeric_name_2452","An enum member cannot have a numeric name."),Variable_0_is_used_before_being_assigned:t(2454,e.DiagnosticCategory.Error,"Variable_0_is_used_before_being_assigned_2454","Variable '{0}' is used before being assigned."),Type_alias_0_circularly_references_itself:t(2456,e.DiagnosticCategory.Error,"Type_alias_0_circularly_references_itself_2456","Type alias '{0}' circularly references itself."),Type_alias_name_cannot_be_0:t(2457,e.DiagnosticCategory.Error,"Type_alias_name_cannot_be_0_2457","Type alias name cannot be '{0}'."),An_AMD_module_cannot_have_multiple_name_assignments:t(2458,e.DiagnosticCategory.Error,"An_AMD_module_cannot_have_multiple_name_assignments_2458","An AMD module cannot have multiple name assignments."),Module_0_declares_1_locally_but_it_is_not_exported:t(2459,e.DiagnosticCategory.Error,"Module_0_declares_1_locally_but_it_is_not_exported_2459","Module '{0}' declares '{1}' locally, but it is not exported."),Module_0_declares_1_locally_but_it_is_exported_as_2:t(2460,e.DiagnosticCategory.Error,"Module_0_declares_1_locally_but_it_is_exported_as_2_2460","Module '{0}' declares '{1}' locally, but it is exported as '{2}'."),Type_0_is_not_an_array_type:t(2461,e.DiagnosticCategory.Error,"Type_0_is_not_an_array_type_2461","Type '{0}' is not an array type."),A_rest_element_must_be_last_in_a_destructuring_pattern:t(2462,e.DiagnosticCategory.Error,"A_rest_element_must_be_last_in_a_destructuring_pattern_2462","A rest element must be last in a destructuring pattern."),A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature:t(2463,e.DiagnosticCategory.Error,"A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463","A binding pattern parameter cannot be optional in an implementation signature."),A_computed_property_name_must_be_of_type_string_number_symbol_or_any:t(2464,e.DiagnosticCategory.Error,"A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464","A computed property name must be of type 'string', 'number', 'symbol', or 'any'."),this_cannot_be_referenced_in_a_computed_property_name:t(2465,e.DiagnosticCategory.Error,"this_cannot_be_referenced_in_a_computed_property_name_2465","'this' cannot be referenced in a computed property name."),super_cannot_be_referenced_in_a_computed_property_name:t(2466,e.DiagnosticCategory.Error,"super_cannot_be_referenced_in_a_computed_property_name_2466","'super' cannot be referenced in a computed property name."),A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type:t(2467,e.DiagnosticCategory.Error,"A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467","A computed property name cannot reference a type parameter from its containing type."),Cannot_find_global_value_0:t(2468,e.DiagnosticCategory.Error,"Cannot_find_global_value_0_2468","Cannot find global value '{0}'."),The_0_operator_cannot_be_applied_to_type_symbol:t(2469,e.DiagnosticCategory.Error,"The_0_operator_cannot_be_applied_to_type_symbol_2469","The '{0}' operator cannot be applied to type 'symbol'."),Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher:t(2472,e.DiagnosticCategory.Error,"Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472","Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."),Enum_declarations_must_all_be_const_or_non_const:t(2473,e.DiagnosticCategory.Error,"Enum_declarations_must_all_be_const_or_non_const_2473","Enum declarations must all be const or non-const."),const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values:t(2474,e.DiagnosticCategory.Error,"const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474","const enum member initializers can only contain literal values and other computed enum values."),const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query:t(2475,e.DiagnosticCategory.Error,"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475","'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."),A_const_enum_member_can_only_be_accessed_using_a_string_literal:t(2476,e.DiagnosticCategory.Error,"A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476","A const enum member can only be accessed using a string literal."),const_enum_member_initializer_was_evaluated_to_a_non_finite_value:t(2477,e.DiagnosticCategory.Error,"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477","'const' enum member initializer was evaluated to a non-finite value."),const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN:t(2478,e.DiagnosticCategory.Error,"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478","'const' enum member initializer was evaluated to disallowed value 'NaN'."),let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations:t(2480,e.DiagnosticCategory.Error,"let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480","'let' is not allowed to be used as a name in 'let' or 'const' declarations."),Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1:t(2481,e.DiagnosticCategory.Error,"Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481","Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."),The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation:t(2483,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483","The left-hand side of a 'for...of' statement cannot use a type annotation."),Export_declaration_conflicts_with_exported_declaration_of_0:t(2484,e.DiagnosticCategory.Error,"Export_declaration_conflicts_with_exported_declaration_of_0_2484","Export declaration conflicts with exported declaration of '{0}'."),The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access:t(2487,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487","The left-hand side of a 'for...of' statement must be a variable or a property access."),Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator:t(2488,e.DiagnosticCategory.Error,"Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488","Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."),An_iterator_must_have_a_next_method:t(2489,e.DiagnosticCategory.Error,"An_iterator_must_have_a_next_method_2489","An iterator must have a 'next()' method."),The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property:t(2490,e.DiagnosticCategory.Error,"The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490","The type returned by the '{0}()' method of an iterator must have a 'value' property."),The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern:t(2491,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491","The left-hand side of a 'for...in' statement cannot be a destructuring pattern."),Cannot_redeclare_identifier_0_in_catch_clause:t(2492,e.DiagnosticCategory.Error,"Cannot_redeclare_identifier_0_in_catch_clause_2492","Cannot redeclare identifier '{0}' in catch clause."),Tuple_type_0_of_length_1_has_no_element_at_index_2:t(2493,e.DiagnosticCategory.Error,"Tuple_type_0_of_length_1_has_no_element_at_index_2_2493","Tuple type '{0}' of length '{1}' has no element at index '{2}'."),Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher:t(2494,e.DiagnosticCategory.Error,"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494","Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."),Type_0_is_not_an_array_type_or_a_string_type:t(2495,e.DiagnosticCategory.Error,"Type_0_is_not_an_array_type_or_a_string_type_2495","Type '{0}' is not an array type or a string type."),The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression:t(2496,e.DiagnosticCategory.Error,"The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496","The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."),This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export:t(2497,e.DiagnosticCategory.Error,"This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497","This module can only be referenced with ECMAScript imports/exports by turning on the '{0}' flag and referencing its default export."),Module_0_uses_export_and_cannot_be_used_with_export_Asterisk:t(2498,e.DiagnosticCategory.Error,"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498","Module '{0}' uses 'export =' and cannot be used with 'export *'."),An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments:t(2499,e.DiagnosticCategory.Error,"An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499","An interface can only extend an identifier/qualified-name with optional type arguments."),A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments:t(2500,e.DiagnosticCategory.Error,"A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500","A class can only implement an identifier/qualified-name with optional type arguments."),A_rest_element_cannot_contain_a_binding_pattern:t(2501,e.DiagnosticCategory.Error,"A_rest_element_cannot_contain_a_binding_pattern_2501","A rest element cannot contain a binding pattern."),_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation:t(2502,e.DiagnosticCategory.Error,"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502","'{0}' is referenced directly or indirectly in its own type annotation."),Cannot_find_namespace_0:t(2503,e.DiagnosticCategory.Error,"Cannot_find_namespace_0_2503","Cannot find namespace '{0}'."),Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator:t(2504,e.DiagnosticCategory.Error,"Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504","Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."),A_generator_cannot_have_a_void_type_annotation:t(2505,e.DiagnosticCategory.Error,"A_generator_cannot_have_a_void_type_annotation_2505","A generator cannot have a 'void' type annotation."),_0_is_referenced_directly_or_indirectly_in_its_own_base_expression:t(2506,e.DiagnosticCategory.Error,"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506","'{0}' is referenced directly or indirectly in its own base expression."),Type_0_is_not_a_constructor_function_type:t(2507,e.DiagnosticCategory.Error,"Type_0_is_not_a_constructor_function_type_2507","Type '{0}' is not a constructor function type."),No_base_constructor_has_the_specified_number_of_type_arguments:t(2508,e.DiagnosticCategory.Error,"No_base_constructor_has_the_specified_number_of_type_arguments_2508","No base constructor has the specified number of type arguments."),Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members:t(2509,e.DiagnosticCategory.Error,"Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_2509","Base constructor return type '{0}' is not an object type or intersection of object types with statically known members."),Base_constructors_must_all_have_the_same_return_type:t(2510,e.DiagnosticCategory.Error,"Base_constructors_must_all_have_the_same_return_type_2510","Base constructors must all have the same return type."),Cannot_create_an_instance_of_an_abstract_class:t(2511,e.DiagnosticCategory.Error,"Cannot_create_an_instance_of_an_abstract_class_2511","Cannot create an instance of an abstract class."),Overload_signatures_must_all_be_abstract_or_non_abstract:t(2512,e.DiagnosticCategory.Error,"Overload_signatures_must_all_be_abstract_or_non_abstract_2512","Overload signatures must all be abstract or non-abstract."),Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression:t(2513,e.DiagnosticCategory.Error,"Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513","Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2:t(2515,e.DiagnosticCategory.Error,"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515","Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),All_declarations_of_an_abstract_method_must_be_consecutive:t(2516,e.DiagnosticCategory.Error,"All_declarations_of_an_abstract_method_must_be_consecutive_2516","All declarations of an abstract method must be consecutive."),Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type:t(2517,e.DiagnosticCategory.Error,"Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517","Cannot assign an abstract constructor type to a non-abstract constructor type."),A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard:t(2518,e.DiagnosticCategory.Error,"A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518","A 'this'-based type guard is not compatible with a parameter-based type guard."),An_async_iterator_must_have_a_next_method:t(2519,e.DiagnosticCategory.Error,"An_async_iterator_must_have_a_next_method_2519","An async iterator must have a 'next()' method."),Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions:t(2520,e.DiagnosticCategory.Error,"Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520","Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."),The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method:t(2522,e.DiagnosticCategory.Error,"The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522","The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method."),yield_expressions_cannot_be_used_in_a_parameter_initializer:t(2523,e.DiagnosticCategory.Error,"yield_expressions_cannot_be_used_in_a_parameter_initializer_2523","'yield' expressions cannot be used in a parameter initializer."),await_expressions_cannot_be_used_in_a_parameter_initializer:t(2524,e.DiagnosticCategory.Error,"await_expressions_cannot_be_used_in_a_parameter_initializer_2524","'await' expressions cannot be used in a parameter initializer."),Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value:t(2525,e.DiagnosticCategory.Error,"Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525","Initializer provides no value for this binding element and the binding element has no default value."),A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface:t(2526,e.DiagnosticCategory.Error,"A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526","A 'this' type is available only in a non-static member of a class or interface."),The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary:t(2527,e.DiagnosticCategory.Error,"The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527","The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."),A_module_cannot_have_multiple_default_exports:t(2528,e.DiagnosticCategory.Error,"A_module_cannot_have_multiple_default_exports_2528","A module cannot have multiple default exports."),Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions:t(2529,e.DiagnosticCategory.Error,"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529","Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."),Property_0_is_incompatible_with_index_signature:t(2530,e.DiagnosticCategory.Error,"Property_0_is_incompatible_with_index_signature_2530","Property '{0}' is incompatible with index signature."),Object_is_possibly_null:t(2531,e.DiagnosticCategory.Error,"Object_is_possibly_null_2531","Object is possibly 'null'."),Object_is_possibly_undefined:t(2532,e.DiagnosticCategory.Error,"Object_is_possibly_undefined_2532","Object is possibly 'undefined'."),Object_is_possibly_null_or_undefined:t(2533,e.DiagnosticCategory.Error,"Object_is_possibly_null_or_undefined_2533","Object is possibly 'null' or 'undefined'."),A_function_returning_never_cannot_have_a_reachable_end_point:t(2534,e.DiagnosticCategory.Error,"A_function_returning_never_cannot_have_a_reachable_end_point_2534","A function returning 'never' cannot have a reachable end point."),Enum_type_0_has_members_with_initializers_that_are_not_literals:t(2535,e.DiagnosticCategory.Error,"Enum_type_0_has_members_with_initializers_that_are_not_literals_2535","Enum type '{0}' has members with initializers that are not literals."),Type_0_cannot_be_used_to_index_type_1:t(2536,e.DiagnosticCategory.Error,"Type_0_cannot_be_used_to_index_type_1_2536","Type '{0}' cannot be used to index type '{1}'."),Type_0_has_no_matching_index_signature_for_type_1:t(2537,e.DiagnosticCategory.Error,"Type_0_has_no_matching_index_signature_for_type_1_2537","Type '{0}' has no matching index signature for type '{1}'."),Type_0_cannot_be_used_as_an_index_type:t(2538,e.DiagnosticCategory.Error,"Type_0_cannot_be_used_as_an_index_type_2538","Type '{0}' cannot be used as an index type."),Cannot_assign_to_0_because_it_is_not_a_variable:t(2539,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_not_a_variable_2539","Cannot assign to '{0}' because it is not a variable."),Cannot_assign_to_0_because_it_is_a_read_only_property:t(2540,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_a_read_only_property_2540","Cannot assign to '{0}' because it is a read-only property."),Index_signature_in_type_0_only_permits_reading:t(2542,e.DiagnosticCategory.Error,"Index_signature_in_type_0_only_permits_reading_2542","Index signature in type '{0}' only permits reading."),Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference:t(2543,e.DiagnosticCategory.Error,"Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543","Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference."),Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference:t(2544,e.DiagnosticCategory.Error,"Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544","Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference."),A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any:t(2545,e.DiagnosticCategory.Error,"A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545","A mixin class must have a constructor with a single rest parameter of type 'any[]'."),The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property:t(2547,e.DiagnosticCategory.Error,"The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_pro_2547","The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property."),Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator:t(2548,e.DiagnosticCategory.Error,"Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548","Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator."),Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator:t(2549,e.DiagnosticCategory.Error,"Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549","Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator."),Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later:t(2550,e.DiagnosticCategory.Error,"Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_c_2550","Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{2}' or later."),Property_0_does_not_exist_on_type_1_Did_you_mean_2:t(2551,e.DiagnosticCategory.Error,"Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551","Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?"),Cannot_find_name_0_Did_you_mean_1:t(2552,e.DiagnosticCategory.Error,"Cannot_find_name_0_Did_you_mean_1_2552","Cannot find name '{0}'. Did you mean '{1}'?"),Computed_values_are_not_permitted_in_an_enum_with_string_valued_members:t(2553,e.DiagnosticCategory.Error,"Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553","Computed values are not permitted in an enum with string valued members."),Expected_0_arguments_but_got_1:t(2554,e.DiagnosticCategory.Error,"Expected_0_arguments_but_got_1_2554","Expected {0} arguments, but got {1}."),Expected_at_least_0_arguments_but_got_1:t(2555,e.DiagnosticCategory.Error,"Expected_at_least_0_arguments_but_got_1_2555","Expected at least {0} arguments, but got {1}."),A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter:t(2556,e.DiagnosticCategory.Error,"A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter_2556","A spread argument must either have a tuple type or be passed to a rest parameter."),Expected_0_type_arguments_but_got_1:t(2558,e.DiagnosticCategory.Error,"Expected_0_type_arguments_but_got_1_2558","Expected {0} type arguments, but got {1}."),Type_0_has_no_properties_in_common_with_type_1:t(2559,e.DiagnosticCategory.Error,"Type_0_has_no_properties_in_common_with_type_1_2559","Type '{0}' has no properties in common with type '{1}'."),Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it:t(2560,e.DiagnosticCategory.Error,"Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it_2560","Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?"),Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2:t(2561,e.DiagnosticCategory.Error,"Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561","Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?"),Base_class_expressions_cannot_reference_class_type_parameters:t(2562,e.DiagnosticCategory.Error,"Base_class_expressions_cannot_reference_class_type_parameters_2562","Base class expressions cannot reference class type parameters."),The_containing_function_or_module_body_is_too_large_for_control_flow_analysis:t(2563,e.DiagnosticCategory.Error,"The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563","The containing function or module body is too large for control flow analysis."),Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor:t(2564,e.DiagnosticCategory.Error,"Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor_2564","Property '{0}' has no initializer and is not definitely assigned in the constructor."),Property_0_is_used_before_being_assigned:t(2565,e.DiagnosticCategory.Error,"Property_0_is_used_before_being_assigned_2565","Property '{0}' is used before being assigned."),A_rest_element_cannot_have_a_property_name:t(2566,e.DiagnosticCategory.Error,"A_rest_element_cannot_have_a_property_name_2566","A rest element cannot have a property name."),Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations:t(2567,e.DiagnosticCategory.Error,"Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567","Enum declarations can only merge with namespace or other enum declarations."),Property_0_may_not_exist_on_type_1_Did_you_mean_2:t(2568,e.DiagnosticCategory.Error,"Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568","Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"),Could_not_find_name_0_Did_you_mean_1:t(2570,e.DiagnosticCategory.Error,"Could_not_find_name_0_Did_you_mean_1_2570","Could not find name '{0}'. Did you mean '{1}'?"),Object_is_of_type_unknown:t(2571,e.DiagnosticCategory.Error,"Object_is_of_type_unknown_2571","Object is of type 'unknown'."),A_rest_element_type_must_be_an_array_type:t(2574,e.DiagnosticCategory.Error,"A_rest_element_type_must_be_an_array_type_2574","A rest element type must be an array type."),No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments:t(2575,e.DiagnosticCategory.Error,"No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments_2575","No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments."),Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead:t(2576,e.DiagnosticCategory.Error,"Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead_2576","Property '{0}' does not exist on type '{1}'. Did you mean to access the static member '{2}' instead?"),Return_type_annotation_circularly_references_itself:t(2577,e.DiagnosticCategory.Error,"Return_type_annotation_circularly_references_itself_2577","Return type annotation circularly references itself."),Unused_ts_expect_error_directive:t(2578,e.DiagnosticCategory.Error,"Unused_ts_expect_error_directive_2578","Unused '@ts-expect-error' directive."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode:t(2580,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580","Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery:t(2581,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2581","Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha:t(2582,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2582","Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`."),Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later:t(2583,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2583","Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{1}' or later."),Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom:t(2584,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584","Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'."),_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later:t(2585,e.DiagnosticCategory.Error,"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585","'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later."),Cannot_assign_to_0_because_it_is_a_constant:t(2588,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_a_constant_2588","Cannot assign to '{0}' because it is a constant."),Type_instantiation_is_excessively_deep_and_possibly_infinite:t(2589,e.DiagnosticCategory.Error,"Type_instantiation_is_excessively_deep_and_possibly_infinite_2589","Type instantiation is excessively deep and possibly infinite."),Expression_produces_a_union_type_that_is_too_complex_to_represent:t(2590,e.DiagnosticCategory.Error,"Expression_produces_a_union_type_that_is_too_complex_to_represent_2590","Expression produces a union type that is too complex to represent."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig:t(2591,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591","Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig:t(2592,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592","Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."),Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig:t(2593,e.DiagnosticCategory.Error,"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593","Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."),This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag:t(2594,e.DiagnosticCategory.Error,"This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594","This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),_0_can_only_be_imported_by_using_a_default_import:t(2595,e.DiagnosticCategory.Error,"_0_can_only_be_imported_by_using_a_default_import_2595","'{0}' can only be imported by using a default import."),_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import:t(2596,e.DiagnosticCategory.Error,"_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596","'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."),_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import:t(2597,e.DiagnosticCategory.Error,"_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597","'{0}' can only be imported by using a 'require' call or by using a default import."),_0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import:t(2598,e.DiagnosticCategory.Error,"_0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using__2598","'{0}' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import."),JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist:t(2602,e.DiagnosticCategory.Error,"JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602","JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),Property_0_in_type_1_is_not_assignable_to_type_2:t(2603,e.DiagnosticCategory.Error,"Property_0_in_type_1_is_not_assignable_to_type_2_2603","Property '{0}' in type '{1}' is not assignable to type '{2}'."),JSX_element_type_0_does_not_have_any_construct_or_call_signatures:t(2604,e.DiagnosticCategory.Error,"JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604","JSX element type '{0}' does not have any construct or call signatures."),Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property:t(2606,e.DiagnosticCategory.Error,"Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606","Property '{0}' of JSX spread attribute is not assignable to target property."),JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property:t(2607,e.DiagnosticCategory.Error,"JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607","JSX element class does not support attributes because it does not have a '{0}' property."),The_global_type_JSX_0_may_not_have_more_than_one_property:t(2608,e.DiagnosticCategory.Error,"The_global_type_JSX_0_may_not_have_more_than_one_property_2608","The global type 'JSX.{0}' may not have more than one property."),JSX_spread_child_must_be_an_array_type:t(2609,e.DiagnosticCategory.Error,"JSX_spread_child_must_be_an_array_type_2609","JSX spread child must be an array type."),_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property:t(2610,e.DiagnosticCategory.Error,"_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property_2610","'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property."),_0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor:t(2611,e.DiagnosticCategory.Error,"_0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor_2611","'{0}' is defined as a property in class '{1}', but is overridden here in '{2}' as an accessor."),Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration:t(2612,e.DiagnosticCategory.Error,"Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_2612","Property '{0}' will overwrite the base property in '{1}'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration."),Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead:t(2613,e.DiagnosticCategory.Error,"Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead_2613","Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?"),Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead:t(2614,e.DiagnosticCategory.Error,"Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614","Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?"),Type_of_property_0_circularly_references_itself_in_mapped_type_1:t(2615,e.DiagnosticCategory.Error,"Type_of_property_0_circularly_references_itself_in_mapped_type_1_2615","Type of property '{0}' circularly references itself in mapped type '{1}'."),_0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import:t(2616,e.DiagnosticCategory.Error,"_0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import_2616","'{0}' can only be imported by using 'import {1} = require({2})' or a default import."),_0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import:t(2617,e.DiagnosticCategory.Error,"_0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_us_2617","'{0}' can only be imported by using 'import {1} = require({2})' or by turning on the 'esModuleInterop' flag and using a default import."),Source_has_0_element_s_but_target_requires_1:t(2618,e.DiagnosticCategory.Error,"Source_has_0_element_s_but_target_requires_1_2618","Source has {0} element(s) but target requires {1}."),Source_has_0_element_s_but_target_allows_only_1:t(2619,e.DiagnosticCategory.Error,"Source_has_0_element_s_but_target_allows_only_1_2619","Source has {0} element(s) but target allows only {1}."),Target_requires_0_element_s_but_source_may_have_fewer:t(2620,e.DiagnosticCategory.Error,"Target_requires_0_element_s_but_source_may_have_fewer_2620","Target requires {0} element(s) but source may have fewer."),Target_allows_only_0_element_s_but_source_may_have_more:t(2621,e.DiagnosticCategory.Error,"Target_allows_only_0_element_s_but_source_may_have_more_2621","Target allows only {0} element(s) but source may have more."),Source_provides_no_match_for_required_element_at_position_0_in_target:t(2623,e.DiagnosticCategory.Error,"Source_provides_no_match_for_required_element_at_position_0_in_target_2623","Source provides no match for required element at position {0} in target."),Source_provides_no_match_for_variadic_element_at_position_0_in_target:t(2624,e.DiagnosticCategory.Error,"Source_provides_no_match_for_variadic_element_at_position_0_in_target_2624","Source provides no match for variadic element at position {0} in target."),Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target:t(2625,e.DiagnosticCategory.Error,"Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target_2625","Variadic element at position {0} in source does not match element at position {1} in target."),Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target:t(2626,e.DiagnosticCategory.Error,"Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target_2626","Type at position {0} in source is not compatible with type at position {1} in target."),Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target:t(2627,e.DiagnosticCategory.Error,"Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target_2627","Type at positions {0} through {1} in source is not compatible with type at position {2} in target."),Cannot_assign_to_0_because_it_is_an_enum:t(2628,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_an_enum_2628","Cannot assign to '{0}' because it is an enum."),Cannot_assign_to_0_because_it_is_a_class:t(2629,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_a_class_2629","Cannot assign to '{0}' because it is a class."),Cannot_assign_to_0_because_it_is_a_function:t(2630,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_a_function_2630","Cannot assign to '{0}' because it is a function."),Cannot_assign_to_0_because_it_is_a_namespace:t(2631,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_a_namespace_2631","Cannot assign to '{0}' because it is a namespace."),Cannot_assign_to_0_because_it_is_an_import:t(2632,e.DiagnosticCategory.Error,"Cannot_assign_to_0_because_it_is_an_import_2632","Cannot assign to '{0}' because it is an import."),JSX_property_access_expressions_cannot_include_JSX_namespace_names:t(2633,e.DiagnosticCategory.Error,"JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633","JSX property access expressions cannot include JSX namespace names"),_0_index_signatures_are_incompatible:t(2634,e.DiagnosticCategory.Error,"_0_index_signatures_are_incompatible_2634","'{0}' index signatures are incompatible."),Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable:t(2635,e.DiagnosticCategory.Error,"Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635","Type '{0}' has no signatures for which the type argument list is applicable."),Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation:t(2636,e.DiagnosticCategory.Error,"Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636","Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types:t(2637,e.DiagnosticCategory.Error,"Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637","Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity:t(2649,e.DiagnosticCategory.Error,"Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649","Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums:t(2651,e.DiagnosticCategory.Error,"A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651","A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead:t(2652,e.DiagnosticCategory.Error,"Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652","Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1:t(2653,e.DiagnosticCategory.Error,"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653","Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),JSX_expressions_must_have_one_parent_element:t(2657,e.DiagnosticCategory.Error,"JSX_expressions_must_have_one_parent_element_2657","JSX expressions must have one parent element."),Type_0_provides_no_match_for_the_signature_1:t(2658,e.DiagnosticCategory.Error,"Type_0_provides_no_match_for_the_signature_1_2658","Type '{0}' provides no match for the signature '{1}'."),super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher:t(2659,e.DiagnosticCategory.Error,"super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659","'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions:t(2660,e.DiagnosticCategory.Error,"super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660","'super' can only be referenced in members of derived classes or object literal expressions."),Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module:t(2661,e.DiagnosticCategory.Error,"Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661","Cannot export '{0}'. Only local declarations can be exported from a module."),Cannot_find_name_0_Did_you_mean_the_static_member_1_0:t(2662,e.DiagnosticCategory.Error,"Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662","Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"),Cannot_find_name_0_Did_you_mean_the_instance_member_this_0:t(2663,e.DiagnosticCategory.Error,"Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663","Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"),Invalid_module_name_in_augmentation_module_0_cannot_be_found:t(2664,e.DiagnosticCategory.Error,"Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664","Invalid module name in augmentation, module '{0}' cannot be found."),Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented:t(2665,e.DiagnosticCategory.Error,"Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665","Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented."),Exports_and_export_assignments_are_not_permitted_in_module_augmentations:t(2666,e.DiagnosticCategory.Error,"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666","Exports and export assignments are not permitted in module augmentations."),Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module:t(2667,e.DiagnosticCategory.Error,"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667","Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."),export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible:t(2668,e.DiagnosticCategory.Error,"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668","'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."),Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations:t(2669,e.DiagnosticCategory.Error,"Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669","Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."),Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context:t(2670,e.DiagnosticCategory.Error,"Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670","Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."),Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity:t(2671,e.DiagnosticCategory.Error,"Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671","Cannot augment module '{0}' because it resolves to a non-module entity."),Cannot_assign_a_0_constructor_type_to_a_1_constructor_type:t(2672,e.DiagnosticCategory.Error,"Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672","Cannot assign a '{0}' constructor type to a '{1}' constructor type."),Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration:t(2673,e.DiagnosticCategory.Error,"Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673","Constructor of class '{0}' is private and only accessible within the class declaration."),Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration:t(2674,e.DiagnosticCategory.Error,"Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674","Constructor of class '{0}' is protected and only accessible within the class declaration."),Cannot_extend_a_class_0_Class_constructor_is_marked_as_private:t(2675,e.DiagnosticCategory.Error,"Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675","Cannot extend a class '{0}'. Class constructor is marked as private."),Accessors_must_both_be_abstract_or_non_abstract:t(2676,e.DiagnosticCategory.Error,"Accessors_must_both_be_abstract_or_non_abstract_2676","Accessors must both be abstract or non-abstract."),A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type:t(2677,e.DiagnosticCategory.Error,"A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677","A type predicate's type must be assignable to its parameter's type."),Type_0_is_not_comparable_to_type_1:t(2678,e.DiagnosticCategory.Error,"Type_0_is_not_comparable_to_type_1_2678","Type '{0}' is not comparable to type '{1}'."),A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void:t(2679,e.DiagnosticCategory.Error,"A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679","A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'."),A_0_parameter_must_be_the_first_parameter:t(2680,e.DiagnosticCategory.Error,"A_0_parameter_must_be_the_first_parameter_2680","A '{0}' parameter must be the first parameter."),A_constructor_cannot_have_a_this_parameter:t(2681,e.DiagnosticCategory.Error,"A_constructor_cannot_have_a_this_parameter_2681","A constructor cannot have a 'this' parameter."),this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation:t(2683,e.DiagnosticCategory.Error,"this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683","'this' implicitly has type 'any' because it does not have a type annotation."),The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1:t(2684,e.DiagnosticCategory.Error,"The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684","The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'."),The_this_types_of_each_signature_are_incompatible:t(2685,e.DiagnosticCategory.Error,"The_this_types_of_each_signature_are_incompatible_2685","The 'this' types of each signature are incompatible."),_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead:t(2686,e.DiagnosticCategory.Error,"_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686","'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead."),All_declarations_of_0_must_have_identical_modifiers:t(2687,e.DiagnosticCategory.Error,"All_declarations_of_0_must_have_identical_modifiers_2687","All declarations of '{0}' must have identical modifiers."),Cannot_find_type_definition_file_for_0:t(2688,e.DiagnosticCategory.Error,"Cannot_find_type_definition_file_for_0_2688","Cannot find type definition file for '{0}'."),Cannot_extend_an_interface_0_Did_you_mean_implements:t(2689,e.DiagnosticCategory.Error,"Cannot_extend_an_interface_0_Did_you_mean_implements_2689","Cannot extend an interface '{0}'. Did you mean 'implements'?"),_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0:t(2690,e.DiagnosticCategory.Error,"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690","'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead:t(2691,e.DiagnosticCategory.Error,"An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691","An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible:t(2692,e.DiagnosticCategory.Error,"_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692","'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),_0_only_refers_to_a_type_but_is_being_used_as_a_value_here:t(2693,e.DiagnosticCategory.Error,"_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693","'{0}' only refers to a type, but is being used as a value here."),Namespace_0_has_no_exported_member_1:t(2694,e.DiagnosticCategory.Error,"Namespace_0_has_no_exported_member_1_2694","Namespace '{0}' has no exported member '{1}'."),Left_side_of_comma_operator_is_unused_and_has_no_side_effects:t(2695,e.DiagnosticCategory.Error,"Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695","Left side of comma operator is unused and has no side effects.",!0),The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead:t(2696,e.DiagnosticCategory.Error,"The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696","The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"),An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option:t(2697,e.DiagnosticCategory.Error,"An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697","An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."),Spread_types_may_only_be_created_from_object_types:t(2698,e.DiagnosticCategory.Error,"Spread_types_may_only_be_created_from_object_types_2698","Spread types may only be created from object types."),Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1:t(2699,e.DiagnosticCategory.Error,"Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699","Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'."),Rest_types_may_only_be_created_from_object_types:t(2700,e.DiagnosticCategory.Error,"Rest_types_may_only_be_created_from_object_types_2700","Rest types may only be created from object types."),The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access:t(2701,e.DiagnosticCategory.Error,"The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701","The target of an object rest assignment must be a variable or a property access."),_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here:t(2702,e.DiagnosticCategory.Error,"_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702","'{0}' only refers to a type, but is being used as a namespace here."),The_operand_of_a_delete_operator_must_be_a_property_reference:t(2703,e.DiagnosticCategory.Error,"The_operand_of_a_delete_operator_must_be_a_property_reference_2703","The operand of a 'delete' operator must be a property reference."),The_operand_of_a_delete_operator_cannot_be_a_read_only_property:t(2704,e.DiagnosticCategory.Error,"The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704","The operand of a 'delete' operator cannot be a read-only property."),An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option:t(2705,e.DiagnosticCategory.Error,"An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705","An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."),Required_type_parameters_may_not_follow_optional_type_parameters:t(2706,e.DiagnosticCategory.Error,"Required_type_parameters_may_not_follow_optional_type_parameters_2706","Required type parameters may not follow optional type parameters."),Generic_type_0_requires_between_1_and_2_type_arguments:t(2707,e.DiagnosticCategory.Error,"Generic_type_0_requires_between_1_and_2_type_arguments_2707","Generic type '{0}' requires between {1} and {2} type arguments."),Cannot_use_namespace_0_as_a_value:t(2708,e.DiagnosticCategory.Error,"Cannot_use_namespace_0_as_a_value_2708","Cannot use namespace '{0}' as a value."),Cannot_use_namespace_0_as_a_type:t(2709,e.DiagnosticCategory.Error,"Cannot_use_namespace_0_as_a_type_2709","Cannot use namespace '{0}' as a type."),_0_are_specified_twice_The_attribute_named_0_will_be_overwritten:t(2710,e.DiagnosticCategory.Error,"_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710","'{0}' are specified twice. The attribute named '{0}' will be overwritten."),A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option:t(2711,e.DiagnosticCategory.Error,"A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711","A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."),A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option:t(2712,e.DiagnosticCategory.Error,"A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712","A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."),Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1:t(2713,e.DiagnosticCategory.Error,"Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_p_2713","Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?"),The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context:t(2714,e.DiagnosticCategory.Error,"The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714","The expression of an export assignment must be an identifier or qualified name in an ambient context."),Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor:t(2715,e.DiagnosticCategory.Error,"Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor_2715","Abstract property '{0}' in class '{1}' cannot be accessed in the constructor."),Type_parameter_0_has_a_circular_default:t(2716,e.DiagnosticCategory.Error,"Type_parameter_0_has_a_circular_default_2716","Type parameter '{0}' has a circular default."),Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2:t(2717,e.DiagnosticCategory.Error,"Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717","Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'."),Duplicate_property_0:t(2718,e.DiagnosticCategory.Error,"Duplicate_property_0_2718","Duplicate property '{0}'."),Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated:t(2719,e.DiagnosticCategory.Error,"Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719","Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated."),Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass:t(2720,e.DiagnosticCategory.Error,"Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720","Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?"),Cannot_invoke_an_object_which_is_possibly_null:t(2721,e.DiagnosticCategory.Error,"Cannot_invoke_an_object_which_is_possibly_null_2721","Cannot invoke an object which is possibly 'null'."),Cannot_invoke_an_object_which_is_possibly_undefined:t(2722,e.DiagnosticCategory.Error,"Cannot_invoke_an_object_which_is_possibly_undefined_2722","Cannot invoke an object which is possibly 'undefined'."),Cannot_invoke_an_object_which_is_possibly_null_or_undefined:t(2723,e.DiagnosticCategory.Error,"Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723","Cannot invoke an object which is possibly 'null' or 'undefined'."),_0_has_no_exported_member_named_1_Did_you_mean_2:t(2724,e.DiagnosticCategory.Error,"_0_has_no_exported_member_named_1_Did_you_mean_2_2724","'{0}' has no exported member named '{1}'. Did you mean '{2}'?"),Class_name_cannot_be_Object_when_targeting_ES5_with_module_0:t(2725,e.DiagnosticCategory.Error,"Class_name_cannot_be_Object_when_targeting_ES5_with_module_0_2725","Class name cannot be 'Object' when targeting ES5 with module {0}."),Cannot_find_lib_definition_for_0:t(2726,e.DiagnosticCategory.Error,"Cannot_find_lib_definition_for_0_2726","Cannot find lib definition for '{0}'."),Cannot_find_lib_definition_for_0_Did_you_mean_1:t(2727,e.DiagnosticCategory.Error,"Cannot_find_lib_definition_for_0_Did_you_mean_1_2727","Cannot find lib definition for '{0}'. Did you mean '{1}'?"),_0_is_declared_here:t(2728,e.DiagnosticCategory.Message,"_0_is_declared_here_2728","'{0}' is declared here."),Property_0_is_used_before_its_initialization:t(2729,e.DiagnosticCategory.Error,"Property_0_is_used_before_its_initialization_2729","Property '{0}' is used before its initialization."),An_arrow_function_cannot_have_a_this_parameter:t(2730,e.DiagnosticCategory.Error,"An_arrow_function_cannot_have_a_this_parameter_2730","An arrow function cannot have a 'this' parameter."),Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String:t(2731,e.DiagnosticCategory.Error,"Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_i_2731","Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'."),Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension:t(2732,e.DiagnosticCategory.Error,"Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension_2732","Cannot find module '{0}'. Consider using '--resolveJsonModule' to import module with '.json' extension."),Property_0_was_also_declared_here:t(2733,e.DiagnosticCategory.Error,"Property_0_was_also_declared_here_2733","Property '{0}' was also declared here."),Are_you_missing_a_semicolon:t(2734,e.DiagnosticCategory.Error,"Are_you_missing_a_semicolon_2734","Are you missing a semicolon?"),Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1:t(2735,e.DiagnosticCategory.Error,"Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1_2735","Did you mean for '{0}' to be constrained to type 'new (...args: any[]) => {1}'?"),Operator_0_cannot_be_applied_to_type_1:t(2736,e.DiagnosticCategory.Error,"Operator_0_cannot_be_applied_to_type_1_2736","Operator '{0}' cannot be applied to type '{1}'."),BigInt_literals_are_not_available_when_targeting_lower_than_ES2020:t(2737,e.DiagnosticCategory.Error,"BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737","BigInt literals are not available when targeting lower than ES2020."),An_outer_value_of_this_is_shadowed_by_this_container:t(2738,e.DiagnosticCategory.Message,"An_outer_value_of_this_is_shadowed_by_this_container_2738","An outer value of 'this' is shadowed by this container."),Type_0_is_missing_the_following_properties_from_type_1_Colon_2:t(2739,e.DiagnosticCategory.Error,"Type_0_is_missing_the_following_properties_from_type_1_Colon_2_2739","Type '{0}' is missing the following properties from type '{1}': {2}"),Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more:t(2740,e.DiagnosticCategory.Error,"Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more_2740","Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more."),Property_0_is_missing_in_type_1_but_required_in_type_2:t(2741,e.DiagnosticCategory.Error,"Property_0_is_missing_in_type_1_but_required_in_type_2_2741","Property '{0}' is missing in type '{1}' but required in type '{2}'."),The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary:t(2742,e.DiagnosticCategory.Error,"The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_a_2742","The inferred type of '{0}' cannot be named without a reference to '{1}'. This is likely not portable. A type annotation is necessary."),No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments:t(2743,e.DiagnosticCategory.Error,"No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments_2743","No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments."),Type_parameter_defaults_can_only_reference_previously_declared_type_parameters:t(2744,e.DiagnosticCategory.Error,"Type_parameter_defaults_can_only_reference_previously_declared_type_parameters_2744","Type parameter defaults can only reference previously declared type parameters."),This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided:t(2745,e.DiagnosticCategory.Error,"This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745","This JSX tag's '{0}' prop expects type '{1}' which requires multiple children, but only a single child was provided."),This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided:t(2746,e.DiagnosticCategory.Error,"This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746","This JSX tag's '{0}' prop expects a single child of type '{1}', but multiple children were provided."),_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2:t(2747,e.DiagnosticCategory.Error,"_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_t_2747","'{0}' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of '{1}' is '{2}'."),Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided:t(2748,e.DiagnosticCategory.Error,"Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided_2748","Cannot access ambient const enums when the '--isolatedModules' flag is provided."),_0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0:t(2749,e.DiagnosticCategory.Error,"_0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0_2749","'{0}' refers to a value, but is being used as a type here. Did you mean 'typeof {0}'?"),The_implementation_signature_is_declared_here:t(2750,e.DiagnosticCategory.Error,"The_implementation_signature_is_declared_here_2750","The implementation signature is declared here."),Circularity_originates_in_type_at_this_location:t(2751,e.DiagnosticCategory.Error,"Circularity_originates_in_type_at_this_location_2751","Circularity originates in type at this location."),The_first_export_default_is_here:t(2752,e.DiagnosticCategory.Error,"The_first_export_default_is_here_2752","The first export default is here."),Another_export_default_is_here:t(2753,e.DiagnosticCategory.Error,"Another_export_default_is_here_2753","Another export default is here."),super_may_not_use_type_arguments:t(2754,e.DiagnosticCategory.Error,"super_may_not_use_type_arguments_2754","'super' may not use type arguments."),No_constituent_of_type_0_is_callable:t(2755,e.DiagnosticCategory.Error,"No_constituent_of_type_0_is_callable_2755","No constituent of type '{0}' is callable."),Not_all_constituents_of_type_0_are_callable:t(2756,e.DiagnosticCategory.Error,"Not_all_constituents_of_type_0_are_callable_2756","Not all constituents of type '{0}' are callable."),Type_0_has_no_call_signatures:t(2757,e.DiagnosticCategory.Error,"Type_0_has_no_call_signatures_2757","Type '{0}' has no call signatures."),Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other:t(2758,e.DiagnosticCategory.Error,"Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_2758","Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other."),No_constituent_of_type_0_is_constructable:t(2759,e.DiagnosticCategory.Error,"No_constituent_of_type_0_is_constructable_2759","No constituent of type '{0}' is constructable."),Not_all_constituents_of_type_0_are_constructable:t(2760,e.DiagnosticCategory.Error,"Not_all_constituents_of_type_0_are_constructable_2760","Not all constituents of type '{0}' are constructable."),Type_0_has_no_construct_signatures:t(2761,e.DiagnosticCategory.Error,"Type_0_has_no_construct_signatures_2761","Type '{0}' has no construct signatures."),Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other:t(2762,e.DiagnosticCategory.Error,"Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_2762","Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other."),Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0:t(2763,e.DiagnosticCategory.Error,"Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_s_2763","Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'."),Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0:t(2764,e.DiagnosticCategory.Error,"Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_al_2764","Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'."),Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0:t(2765,e.DiagnosticCategory.Error,"Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring__2765","Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'."),Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0:t(2766,e.DiagnosticCategory.Error,"Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_co_2766","Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'."),The_0_property_of_an_iterator_must_be_a_method:t(2767,e.DiagnosticCategory.Error,"The_0_property_of_an_iterator_must_be_a_method_2767","The '{0}' property of an iterator must be a method."),The_0_property_of_an_async_iterator_must_be_a_method:t(2768,e.DiagnosticCategory.Error,"The_0_property_of_an_async_iterator_must_be_a_method_2768","The '{0}' property of an async iterator must be a method."),No_overload_matches_this_call:t(2769,e.DiagnosticCategory.Error,"No_overload_matches_this_call_2769","No overload matches this call."),The_last_overload_gave_the_following_error:t(2770,e.DiagnosticCategory.Error,"The_last_overload_gave_the_following_error_2770","The last overload gave the following error."),The_last_overload_is_declared_here:t(2771,e.DiagnosticCategory.Error,"The_last_overload_is_declared_here_2771","The last overload is declared here."),Overload_0_of_1_2_gave_the_following_error:t(2772,e.DiagnosticCategory.Error,"Overload_0_of_1_2_gave_the_following_error_2772","Overload {0} of {1}, '{2}', gave the following error."),Did_you_forget_to_use_await:t(2773,e.DiagnosticCategory.Error,"Did_you_forget_to_use_await_2773","Did you forget to use 'await'?"),This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead:t(2774,e.DiagnosticCategory.Error,"This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774","This condition will always return true since this function is always defined. Did you mean to call it instead?"),Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation:t(2775,e.DiagnosticCategory.Error,"Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation_2775","Assertions require every name in the call target to be declared with an explicit type annotation."),Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name:t(2776,e.DiagnosticCategory.Error,"Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name_2776","Assertions require the call target to be an identifier or qualified name."),The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access:t(2777,e.DiagnosticCategory.Error,"The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777","The operand of an increment or decrement operator may not be an optional property access."),The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access:t(2778,e.DiagnosticCategory.Error,"The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access_2778","The target of an object rest assignment may not be an optional property access."),The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access:t(2779,e.DiagnosticCategory.Error,"The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779","The left-hand side of an assignment expression may not be an optional property access."),The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access:t(2780,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access_2780","The left-hand side of a 'for...in' statement may not be an optional property access."),The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access:t(2781,e.DiagnosticCategory.Error,"The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access_2781","The left-hand side of a 'for...of' statement may not be an optional property access."),_0_needs_an_explicit_type_annotation:t(2782,e.DiagnosticCategory.Message,"_0_needs_an_explicit_type_annotation_2782","'{0}' needs an explicit type annotation."),_0_is_specified_more_than_once_so_this_usage_will_be_overwritten:t(2783,e.DiagnosticCategory.Error,"_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783","'{0}' is specified more than once, so this usage will be overwritten."),get_and_set_accessors_cannot_declare_this_parameters:t(2784,e.DiagnosticCategory.Error,"get_and_set_accessors_cannot_declare_this_parameters_2784","'get' and 'set' accessors cannot declare 'this' parameters."),This_spread_always_overwrites_this_property:t(2785,e.DiagnosticCategory.Error,"This_spread_always_overwrites_this_property_2785","This spread always overwrites this property."),_0_cannot_be_used_as_a_JSX_component:t(2786,e.DiagnosticCategory.Error,"_0_cannot_be_used_as_a_JSX_component_2786","'{0}' cannot be used as a JSX component."),Its_return_type_0_is_not_a_valid_JSX_element:t(2787,e.DiagnosticCategory.Error,"Its_return_type_0_is_not_a_valid_JSX_element_2787","Its return type '{0}' is not a valid JSX element."),Its_instance_type_0_is_not_a_valid_JSX_element:t(2788,e.DiagnosticCategory.Error,"Its_instance_type_0_is_not_a_valid_JSX_element_2788","Its instance type '{0}' is not a valid JSX element."),Its_element_type_0_is_not_a_valid_JSX_element:t(2789,e.DiagnosticCategory.Error,"Its_element_type_0_is_not_a_valid_JSX_element_2789","Its element type '{0}' is not a valid JSX element."),The_operand_of_a_delete_operator_must_be_optional:t(2790,e.DiagnosticCategory.Error,"The_operand_of_a_delete_operator_must_be_optional_2790","The operand of a 'delete' operator must be optional."),Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later:t(2791,e.DiagnosticCategory.Error,"Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791","Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later."),Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option:t(2792,e.DiagnosticCategory.Error,"Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_th_2792","Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?"),The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible:t(2793,e.DiagnosticCategory.Error,"The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_2793","The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible."),Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise:t(2794,e.DiagnosticCategory.Error,"Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise_2794","Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?"),The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types:t(2795,e.DiagnosticCategory.Error,"The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types_2795","The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types."),It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked:t(2796,e.DiagnosticCategory.Error,"It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tag_2796","It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked."),A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract:t(2797,e.DiagnosticCategory.Error,"A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_2797","A mixin class that extends from a type variable containing an abstract construct signature must also be declared 'abstract'."),The_declaration_was_marked_as_deprecated_here:t(2798,e.DiagnosticCategory.Error,"The_declaration_was_marked_as_deprecated_here_2798","The declaration was marked as deprecated here."),Type_produces_a_tuple_type_that_is_too_large_to_represent:t(2799,e.DiagnosticCategory.Error,"Type_produces_a_tuple_type_that_is_too_large_to_represent_2799","Type produces a tuple type that is too large to represent."),Expression_produces_a_tuple_type_that_is_too_large_to_represent:t(2800,e.DiagnosticCategory.Error,"Expression_produces_a_tuple_type_that_is_too_large_to_represent_2800","Expression produces a tuple type that is too large to represent."),This_condition_will_always_return_true_since_this_0_is_always_defined:t(2801,e.DiagnosticCategory.Error,"This_condition_will_always_return_true_since_this_0_is_always_defined_2801","This condition will always return true since this '{0}' is always defined."),Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher:t(2802,e.DiagnosticCategory.Error,"Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es201_2802","Type '{0}' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher."),Cannot_assign_to_private_method_0_Private_methods_are_not_writable:t(2803,e.DiagnosticCategory.Error,"Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803","Cannot assign to private method '{0}'. Private methods are not writable."),Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name:t(2804,e.DiagnosticCategory.Error,"Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name_2804","Duplicate identifier '{0}'. Static and instance elements cannot share the same private name."),Private_accessor_was_defined_without_a_getter:t(2806,e.DiagnosticCategory.Error,"Private_accessor_was_defined_without_a_getter_2806","Private accessor was defined without a getter."),This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0:t(2807,e.DiagnosticCategory.Error,"This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807","This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),A_get_accessor_must_be_at_least_as_accessible_as_the_setter:t(2808,e.DiagnosticCategory.Error,"A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808","A get accessor must be at least as accessible as the setter"),Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses:t(2809,e.DiagnosticCategory.Error,"Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809","Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments:t(2810,e.DiagnosticCategory.Error,"Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810","Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),Initializer_for_property_0:t(2811,e.DiagnosticCategory.Error,"Initializer_for_property_0_2811","Initializer for property '{0}'"),Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom:t(2812,e.DiagnosticCategory.Error,"Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812","Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),Class_declaration_cannot_implement_overload_list_for_0:t(2813,e.DiagnosticCategory.Error,"Class_declaration_cannot_implement_overload_list_for_0_2813","Class declaration cannot implement overload list for '{0}'."),Function_with_bodies_can_only_merge_with_classes_that_are_ambient:t(2814,e.DiagnosticCategory.Error,"Function_with_bodies_can_only_merge_with_classes_that_are_ambient_2814","Function with bodies can only merge with classes that are ambient."),arguments_cannot_be_referenced_in_property_initializers:t(2815,e.DiagnosticCategory.Error,"arguments_cannot_be_referenced_in_property_initializers_2815","'arguments' cannot be referenced in property initializers."),Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class:t(2816,e.DiagnosticCategory.Error,"Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class_2816","Cannot use 'this' in a static property initializer of a decorated class."),Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block:t(2817,e.DiagnosticCategory.Error,"Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817","Property '{0}' has no initializer and is not definitely assigned in a class static block."),Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers:t(2818,e.DiagnosticCategory.Error,"Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818","Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),Namespace_name_cannot_be_0:t(2819,e.DiagnosticCategory.Error,"Namespace_name_cannot_be_0_2819","Namespace name cannot be '{0}'."),Type_0_is_not_assignable_to_type_1_Did_you_mean_2:t(2820,e.DiagnosticCategory.Error,"Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820","Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext:t(2821,e.DiagnosticCategory.Error,"Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821","Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),Import_assertions_cannot_be_used_with_type_only_imports_or_exports:t(2822,e.DiagnosticCategory.Error,"Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822","Import assertions cannot be used with type-only imports or exports."),Cannot_find_namespace_0_Did_you_mean_1:t(2833,e.DiagnosticCategory.Error,"Cannot_find_namespace_0_Did_you_mean_1_2833","Cannot find namespace '{0}'. Did you mean '{1}'?"),Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path:t(2834,e.DiagnosticCategory.Error,"Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834","Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0:t(2835,e.DiagnosticCategory.Error,"Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835","Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls:t(2836,e.DiagnosticCategory.Error,"Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836","Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),Import_assertion_values_must_be_string_literal_expressions:t(2837,e.DiagnosticCategory.Error,"Import_assertion_values_must_be_string_literal_expressions_2837","Import assertion values must be string literal expressions."),All_declarations_of_0_must_have_identical_constraints:t(2838,e.DiagnosticCategory.Error,"All_declarations_of_0_must_have_identical_constraints_2838","All declarations of '{0}' must have identical constraints."),The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next:t(2841,e.DiagnosticCategory.Error,"The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841","The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),Import_declaration_0_is_using_private_name_1:t(4e3,e.DiagnosticCategory.Error,"Import_declaration_0_is_using_private_name_1_4000","Import declaration '{0}' is using private name '{1}'."),Type_parameter_0_of_exported_class_has_or_is_using_private_name_1:t(4002,e.DiagnosticCategory.Error,"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002","Type parameter '{0}' of exported class has or is using private name '{1}'."),Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1:t(4004,e.DiagnosticCategory.Error,"Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004","Type parameter '{0}' of exported interface has or is using private name '{1}'."),Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1:t(4006,e.DiagnosticCategory.Error,"Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006","Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."),Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1:t(4008,e.DiagnosticCategory.Error,"Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008","Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."),Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:t(4010,e.DiagnosticCategory.Error,"Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010","Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."),Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:t(4012,e.DiagnosticCategory.Error,"Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012","Type parameter '{0}' of public method from exported class has or is using private name '{1}'."),Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1:t(4014,e.DiagnosticCategory.Error,"Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014","Type parameter '{0}' of method from exported interface has or is using private name '{1}'."),Type_parameter_0_of_exported_function_has_or_is_using_private_name_1:t(4016,e.DiagnosticCategory.Error,"Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016","Type parameter '{0}' of exported function has or is using private name '{1}'."),Implements_clause_of_exported_class_0_has_or_is_using_private_name_1:t(4019,e.DiagnosticCategory.Error,"Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019","Implements clause of exported class '{0}' has or is using private name '{1}'."),extends_clause_of_exported_class_0_has_or_is_using_private_name_1:t(4020,e.DiagnosticCategory.Error,"extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020","'extends' clause of exported class '{0}' has or is using private name '{1}'."),extends_clause_of_exported_class_has_or_is_using_private_name_0:t(4021,e.DiagnosticCategory.Error,"extends_clause_of_exported_class_has_or_is_using_private_name_0_4021","'extends' clause of exported class has or is using private name '{0}'."),extends_clause_of_exported_interface_0_has_or_is_using_private_name_1:t(4022,e.DiagnosticCategory.Error,"extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022","'extends' clause of exported interface '{0}' has or is using private name '{1}'."),Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4023,e.DiagnosticCategory.Error,"Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023","Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."),Exported_variable_0_has_or_is_using_name_1_from_private_module_2:t(4024,e.DiagnosticCategory.Error,"Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024","Exported variable '{0}' has or is using name '{1}' from private module '{2}'."),Exported_variable_0_has_or_is_using_private_name_1:t(4025,e.DiagnosticCategory.Error,"Exported_variable_0_has_or_is_using_private_name_1_4025","Exported variable '{0}' has or is using private name '{1}'."),Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4026,e.DiagnosticCategory.Error,"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026","Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:t(4027,e.DiagnosticCategory.Error,"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027","Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_static_property_0_of_exported_class_has_or_is_using_private_name_1:t(4028,e.DiagnosticCategory.Error,"Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028","Public static property '{0}' of exported class has or is using private name '{1}'."),Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4029,e.DiagnosticCategory.Error,"Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029","Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:t(4030,e.DiagnosticCategory.Error,"Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030","Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_property_0_of_exported_class_has_or_is_using_private_name_1:t(4031,e.DiagnosticCategory.Error,"Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031","Public property '{0}' of exported class has or is using private name '{1}'."),Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:t(4032,e.DiagnosticCategory.Error,"Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032","Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),Property_0_of_exported_interface_has_or_is_using_private_name_1:t(4033,e.DiagnosticCategory.Error,"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033","Property '{0}' of exported interface has or is using private name '{1}'."),Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:t(4034,e.DiagnosticCategory.Error,"Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034","Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1:t(4035,e.DiagnosticCategory.Error,"Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035","Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'."),Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:t(4036,e.DiagnosticCategory.Error,"Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036","Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1:t(4037,e.DiagnosticCategory.Error,"Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037","Parameter type of public setter '{0}' from exported class has or is using private name '{1}'."),Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4038,e.DiagnosticCategory.Error,"Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_modul_4038","Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."),Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:t(4039,e.DiagnosticCategory.Error,"Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039","Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1:t(4040,e.DiagnosticCategory.Error,"Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040","Return type of public static getter '{0}' from exported class has or is using private name '{1}'."),Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4041,e.DiagnosticCategory.Error,"Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_4041","Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."),Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:t(4042,e.DiagnosticCategory.Error,"Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042","Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1:t(4043,e.DiagnosticCategory.Error,"Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043","Return type of public getter '{0}' from exported class has or is using private name '{1}'."),Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:t(4044,e.DiagnosticCategory.Error,"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044","Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0:t(4045,e.DiagnosticCategory.Error,"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045","Return type of constructor signature from exported interface has or is using private name '{0}'."),Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:t(4046,e.DiagnosticCategory.Error,"Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046","Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0:t(4047,e.DiagnosticCategory.Error,"Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047","Return type of call signature from exported interface has or is using private name '{0}'."),Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:t(4048,e.DiagnosticCategory.Error,"Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048","Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0:t(4049,e.DiagnosticCategory.Error,"Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049","Return type of index signature from exported interface has or is using private name '{0}'."),Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:t(4050,e.DiagnosticCategory.Error,"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050","Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."),Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:t(4051,e.DiagnosticCategory.Error,"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051","Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."),Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0:t(4052,e.DiagnosticCategory.Error,"Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052","Return type of public static method from exported class has or is using private name '{0}'."),Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:t(4053,e.DiagnosticCategory.Error,"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053","Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."),Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:t(4054,e.DiagnosticCategory.Error,"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054","Return type of public method from exported class has or is using name '{0}' from private module '{1}'."),Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0:t(4055,e.DiagnosticCategory.Error,"Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055","Return type of public method from exported class has or is using private name '{0}'."),Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1:t(4056,e.DiagnosticCategory.Error,"Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056","Return type of method from exported interface has or is using name '{0}' from private module '{1}'."),Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0:t(4057,e.DiagnosticCategory.Error,"Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057","Return type of method from exported interface has or is using private name '{0}'."),Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:t(4058,e.DiagnosticCategory.Error,"Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058","Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."),Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1:t(4059,e.DiagnosticCategory.Error,"Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059","Return type of exported function has or is using name '{0}' from private module '{1}'."),Return_type_of_exported_function_has_or_is_using_private_name_0:t(4060,e.DiagnosticCategory.Error,"Return_type_of_exported_function_has_or_is_using_private_name_0_4060","Return type of exported function has or is using private name '{0}'."),Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4061,e.DiagnosticCategory.Error,"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061","Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2:t(4062,e.DiagnosticCategory.Error,"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062","Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."),Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1:t(4063,e.DiagnosticCategory.Error,"Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063","Parameter '{0}' of constructor from exported class has or is using private name '{1}'."),Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:t(4064,e.DiagnosticCategory.Error,"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064","Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1:t(4065,e.DiagnosticCategory.Error,"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065","Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."),Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:t(4066,e.DiagnosticCategory.Error,"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066","Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1:t(4067,e.DiagnosticCategory.Error,"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067","Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."),Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4068,e.DiagnosticCategory.Error,"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068","Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:t(4069,e.DiagnosticCategory.Error,"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069","Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."),Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:t(4070,e.DiagnosticCategory.Error,"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070","Parameter '{0}' of public static method from exported class has or is using private name '{1}'."),Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4071,e.DiagnosticCategory.Error,"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071","Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:t(4072,e.DiagnosticCategory.Error,"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072","Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."),Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:t(4073,e.DiagnosticCategory.Error,"Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073","Parameter '{0}' of public method from exported class has or is using private name '{1}'."),Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2:t(4074,e.DiagnosticCategory.Error,"Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074","Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1:t(4075,e.DiagnosticCategory.Error,"Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075","Parameter '{0}' of method from exported interface has or is using private name '{1}'."),Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4076,e.DiagnosticCategory.Error,"Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076","Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."),Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2:t(4077,e.DiagnosticCategory.Error,"Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077","Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."),Parameter_0_of_exported_function_has_or_is_using_private_name_1:t(4078,e.DiagnosticCategory.Error,"Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078","Parameter '{0}' of exported function has or is using private name '{1}'."),Exported_type_alias_0_has_or_is_using_private_name_1:t(4081,e.DiagnosticCategory.Error,"Exported_type_alias_0_has_or_is_using_private_name_1_4081","Exported type alias '{0}' has or is using private name '{1}'."),Default_export_of_the_module_has_or_is_using_private_name_0:t(4082,e.DiagnosticCategory.Error,"Default_export_of_the_module_has_or_is_using_private_name_0_4082","Default export of the module has or is using private name '{0}'."),Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1:t(4083,e.DiagnosticCategory.Error,"Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083","Type parameter '{0}' of exported type alias has or is using private name '{1}'."),Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2:t(4084,e.DiagnosticCategory.Error,"Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084","Exported type alias '{0}' has or is using private name '{1}' from module {2}."),Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict:t(4090,e.DiagnosticCategory.Error,"Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090","Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:t(4091,e.DiagnosticCategory.Error,"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091","Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1:t(4092,e.DiagnosticCategory.Error,"Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092","Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),Property_0_of_exported_class_expression_may_not_be_private_or_protected:t(4094,e.DiagnosticCategory.Error,"Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094","Property '{0}' of exported class expression may not be private or protected."),Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4095,e.DiagnosticCategory.Error,"Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095","Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:t(4096,e.DiagnosticCategory.Error,"Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096","Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_static_method_0_of_exported_class_has_or_is_using_private_name_1:t(4097,e.DiagnosticCategory.Error,"Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097","Public static method '{0}' of exported class has or is using private name '{1}'."),Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4098,e.DiagnosticCategory.Error,"Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098","Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:t(4099,e.DiagnosticCategory.Error,"Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099","Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),Public_method_0_of_exported_class_has_or_is_using_private_name_1:t(4100,e.DiagnosticCategory.Error,"Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100","Public method '{0}' of exported class has or is using private name '{1}'."),Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:t(4101,e.DiagnosticCategory.Error,"Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101","Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),Method_0_of_exported_interface_has_or_is_using_private_name_1:t(4102,e.DiagnosticCategory.Error,"Method_0_of_exported_interface_has_or_is_using_private_name_1_4102","Method '{0}' of exported interface has or is using private name '{1}'."),Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1:t(4103,e.DiagnosticCategory.Error,"Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103","Type parameter '{0}' of exported mapped object type is using private name '{1}'."),The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1:t(4104,e.DiagnosticCategory.Error,"The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104","The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter:t(4105,e.DiagnosticCategory.Error,"Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter_4105","Private or protected member '{0}' cannot be accessed on a type parameter."),Parameter_0_of_accessor_has_or_is_using_private_name_1:t(4106,e.DiagnosticCategory.Error,"Parameter_0_of_accessor_has_or_is_using_private_name_1_4106","Parameter '{0}' of accessor has or is using private name '{1}'."),Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2:t(4107,e.DiagnosticCategory.Error,"Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107","Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:t(4108,e.DiagnosticCategory.Error,"Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108","Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),Type_arguments_for_0_circularly_reference_themselves:t(4109,e.DiagnosticCategory.Error,"Type_arguments_for_0_circularly_reference_themselves_4109","Type arguments for '{0}' circularly reference themselves."),Tuple_type_arguments_circularly_reference_themselves:t(4110,e.DiagnosticCategory.Error,"Tuple_type_arguments_circularly_reference_themselves_4110","Tuple type arguments circularly reference themselves."),Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0:t(4111,e.DiagnosticCategory.Error,"Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111","Property '{0}' comes from an index signature, so it must be accessed with ['{0}']."),This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class:t(4112,e.DiagnosticCategory.Error,"This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another__4112","This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class."),This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0:t(4113,e.DiagnosticCategory.Error,"This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_4113","This member cannot have an 'override' modifier because it is not declared in the base class '{0}'."),This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0:t(4114,e.DiagnosticCategory.Error,"This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114","This member must have an 'override' modifier because it overrides a member in the base class '{0}'."),This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0:t(4115,e.DiagnosticCategory.Error,"This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0_4115","This parameter property must have an 'override' modifier because it overrides a member in base class '{0}'."),This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0:t(4116,e.DiagnosticCategory.Error,"This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116","This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."),This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1:t(4117,e.DiagnosticCategory.Error,"This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117","This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"),The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized:t(4118,e.DiagnosticCategory.Error,"The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118","The type of this node cannot be serialized because its property '{0}' cannot be serialized."),This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0:t(4119,e.DiagnosticCategory.Error,"This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119","This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0:t(4120,e.DiagnosticCategory.Error,"This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120","This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class:t(4121,e.DiagnosticCategory.Error,"This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121","This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0:t(4122,e.DiagnosticCategory.Error,"This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122","This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1:t(4123,e.DiagnosticCategory.Error,"This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123","This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next:t(4124,e.DiagnosticCategory.Error,"Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124","Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next:t(4125,e.DiagnosticCategory.Error,"resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125","'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),The_current_host_does_not_support_the_0_option:t(5001,e.DiagnosticCategory.Error,"The_current_host_does_not_support_the_0_option_5001","The current host does not support the '{0}' option."),Cannot_find_the_common_subdirectory_path_for_the_input_files:t(5009,e.DiagnosticCategory.Error,"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009","Cannot find the common subdirectory path for the input files."),File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0:t(5010,e.DiagnosticCategory.Error,"File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010","File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),Cannot_read_file_0_Colon_1:t(5012,e.DiagnosticCategory.Error,"Cannot_read_file_0_Colon_1_5012","Cannot read file '{0}': {1}."),Failed_to_parse_file_0_Colon_1:t(5014,e.DiagnosticCategory.Error,"Failed_to_parse_file_0_Colon_1_5014","Failed to parse file '{0}': {1}."),Unknown_compiler_option_0:t(5023,e.DiagnosticCategory.Error,"Unknown_compiler_option_0_5023","Unknown compiler option '{0}'."),Compiler_option_0_requires_a_value_of_type_1:t(5024,e.DiagnosticCategory.Error,"Compiler_option_0_requires_a_value_of_type_1_5024","Compiler option '{0}' requires a value of type {1}."),Unknown_compiler_option_0_Did_you_mean_1:t(5025,e.DiagnosticCategory.Error,"Unknown_compiler_option_0_Did_you_mean_1_5025","Unknown compiler option '{0}'. Did you mean '{1}'?"),Could_not_write_file_0_Colon_1:t(5033,e.DiagnosticCategory.Error,"Could_not_write_file_0_Colon_1_5033","Could not write file '{0}': {1}."),Option_project_cannot_be_mixed_with_source_files_on_a_command_line:t(5042,e.DiagnosticCategory.Error,"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042","Option 'project' cannot be mixed with source files on a command line."),Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher:t(5047,e.DiagnosticCategory.Error,"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047","Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."),Option_0_cannot_be_specified_when_option_target_is_ES3:t(5048,e.DiagnosticCategory.Error,"Option_0_cannot_be_specified_when_option_target_is_ES3_5048","Option '{0}' cannot be specified when option 'target' is 'ES3'."),Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided:t(5051,e.DiagnosticCategory.Error,"Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051","Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."),Option_0_cannot_be_specified_without_specifying_option_1:t(5052,e.DiagnosticCategory.Error,"Option_0_cannot_be_specified_without_specifying_option_1_5052","Option '{0}' cannot be specified without specifying option '{1}'."),Option_0_cannot_be_specified_with_option_1:t(5053,e.DiagnosticCategory.Error,"Option_0_cannot_be_specified_with_option_1_5053","Option '{0}' cannot be specified with option '{1}'."),A_tsconfig_json_file_is_already_defined_at_Colon_0:t(5054,e.DiagnosticCategory.Error,"A_tsconfig_json_file_is_already_defined_at_Colon_0_5054","A 'tsconfig.json' file is already defined at: '{0}'."),Cannot_write_file_0_because_it_would_overwrite_input_file:t(5055,e.DiagnosticCategory.Error,"Cannot_write_file_0_because_it_would_overwrite_input_file_5055","Cannot write file '{0}' because it would overwrite input file."),Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files:t(5056,e.DiagnosticCategory.Error,"Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056","Cannot write file '{0}' because it would be overwritten by multiple input files."),Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0:t(5057,e.DiagnosticCategory.Error,"Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057","Cannot find a tsconfig.json file at the specified directory: '{0}'."),The_specified_path_does_not_exist_Colon_0:t(5058,e.DiagnosticCategory.Error,"The_specified_path_does_not_exist_Colon_0_5058","The specified path does not exist: '{0}'."),Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier:t(5059,e.DiagnosticCategory.Error,"Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059","Invalid value for '--reactNamespace'. '{0}' is not a valid identifier."),Pattern_0_can_have_at_most_one_Asterisk_character:t(5061,e.DiagnosticCategory.Error,"Pattern_0_can_have_at_most_one_Asterisk_character_5061","Pattern '{0}' can have at most one '*' character."),Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character:t(5062,e.DiagnosticCategory.Error,"Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character_5062","Substitution '{0}' in pattern '{1}' can have at most one '*' character."),Substitutions_for_pattern_0_should_be_an_array:t(5063,e.DiagnosticCategory.Error,"Substitutions_for_pattern_0_should_be_an_array_5063","Substitutions for pattern '{0}' should be an array."),Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2:t(5064,e.DiagnosticCategory.Error,"Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064","Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'."),File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0:t(5065,e.DiagnosticCategory.Error,"File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065","File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'."),Substitutions_for_pattern_0_shouldn_t_be_an_empty_array:t(5066,e.DiagnosticCategory.Error,"Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066","Substitutions for pattern '{0}' shouldn't be an empty array."),Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name:t(5067,e.DiagnosticCategory.Error,"Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067","Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."),Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig:t(5068,e.DiagnosticCategory.Error,"Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068","Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."),Option_0_cannot_be_specified_without_specifying_option_1_or_option_2:t(5069,e.DiagnosticCategory.Error,"Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069","Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."),Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy:t(5070,e.DiagnosticCategory.Error,"Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070","Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy."),Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext:t(5071,e.DiagnosticCategory.Error,"Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071","Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),Unknown_build_option_0:t(5072,e.DiagnosticCategory.Error,"Unknown_build_option_0_5072","Unknown build option '{0}'."),Build_option_0_requires_a_value_of_type_1:t(5073,e.DiagnosticCategory.Error,"Build_option_0_requires_a_value_of_type_1_5073","Build option '{0}' requires a value of type {1}."),Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified:t(5074,e.DiagnosticCategory.Error,"Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074","Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."),_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2:t(5075,e.DiagnosticCategory.Error,"_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075","'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),_0_and_1_operations_cannot_be_mixed_without_parentheses:t(5076,e.DiagnosticCategory.Error,"_0_and_1_operations_cannot_be_mixed_without_parentheses_5076","'{0}' and '{1}' operations cannot be mixed without parentheses."),Unknown_build_option_0_Did_you_mean_1:t(5077,e.DiagnosticCategory.Error,"Unknown_build_option_0_Did_you_mean_1_5077","Unknown build option '{0}'. Did you mean '{1}'?"),Unknown_watch_option_0:t(5078,e.DiagnosticCategory.Error,"Unknown_watch_option_0_5078","Unknown watch option '{0}'."),Unknown_watch_option_0_Did_you_mean_1:t(5079,e.DiagnosticCategory.Error,"Unknown_watch_option_0_Did_you_mean_1_5079","Unknown watch option '{0}'. Did you mean '{1}'?"),Watch_option_0_requires_a_value_of_type_1:t(5080,e.DiagnosticCategory.Error,"Watch_option_0_requires_a_value_of_type_1_5080","Watch option '{0}' requires a value of type {1}."),Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0:t(5081,e.DiagnosticCategory.Error,"Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081","Cannot find a tsconfig.json file at the current directory: {0}."),_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1:t(5082,e.DiagnosticCategory.Error,"_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082","'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."),Cannot_read_file_0:t(5083,e.DiagnosticCategory.Error,"Cannot_read_file_0_5083","Cannot read file '{0}'."),Tuple_members_must_all_have_names_or_all_not_have_names:t(5084,e.DiagnosticCategory.Error,"Tuple_members_must_all_have_names_or_all_not_have_names_5084","Tuple members must all have names or all not have names."),A_tuple_member_cannot_be_both_optional_and_rest:t(5085,e.DiagnosticCategory.Error,"A_tuple_member_cannot_be_both_optional_and_rest_5085","A tuple member cannot be both optional and rest."),A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type:t(5086,e.DiagnosticCategory.Error,"A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086","A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."),A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type:t(5087,e.DiagnosticCategory.Error,"A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087","A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."),The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary:t(5088,e.DiagnosticCategory.Error,"The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088","The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary."),Option_0_cannot_be_specified_when_option_jsx_is_1:t(5089,e.DiagnosticCategory.Error,"Option_0_cannot_be_specified_when_option_jsx_is_1_5089","Option '{0}' cannot be specified when option 'jsx' is '{1}'."),Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash:t(5090,e.DiagnosticCategory.Error,"Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash_5090","Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?"),Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled:t(5091,e.DiagnosticCategory.Error,"Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled_5091","Option 'preserveConstEnums' cannot be disabled when 'isolatedModules' is enabled."),The_root_value_of_a_0_file_must_be_an_object:t(5092,e.DiagnosticCategory.Error,"The_root_value_of_a_0_file_must_be_an_object_5092","The root value of a '{0}' file must be an object."),Compiler_option_0_may_only_be_used_with_build:t(5093,e.DiagnosticCategory.Error,"Compiler_option_0_may_only_be_used_with_build_5093","Compiler option '--{0}' may only be used with '--build'."),Compiler_option_0_may_not_be_used_with_build:t(5094,e.DiagnosticCategory.Error,"Compiler_option_0_may_not_be_used_with_build_5094","Compiler option '--{0}' may not be used with '--build'."),Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later:t(5095,e.DiagnosticCategory.Error,"Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095","Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),Generates_a_sourcemap_for_each_corresponding_d_ts_file:t(6e3,e.DiagnosticCategory.Message,"Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000","Generates a sourcemap for each corresponding '.d.ts' file."),Concatenate_and_emit_output_to_single_file:t(6001,e.DiagnosticCategory.Message,"Concatenate_and_emit_output_to_single_file_6001","Concatenate and emit output to single file."),Generates_corresponding_d_ts_file:t(6002,e.DiagnosticCategory.Message,"Generates_corresponding_d_ts_file_6002","Generates corresponding '.d.ts' file."),Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations:t(6004,e.DiagnosticCategory.Message,"Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004","Specify the location where debugger should locate TypeScript files instead of source locations."),Watch_input_files:t(6005,e.DiagnosticCategory.Message,"Watch_input_files_6005","Watch input files."),Redirect_output_structure_to_the_directory:t(6006,e.DiagnosticCategory.Message,"Redirect_output_structure_to_the_directory_6006","Redirect output structure to the directory."),Do_not_erase_const_enum_declarations_in_generated_code:t(6007,e.DiagnosticCategory.Message,"Do_not_erase_const_enum_declarations_in_generated_code_6007","Do not erase const enum declarations in generated code."),Do_not_emit_outputs_if_any_errors_were_reported:t(6008,e.DiagnosticCategory.Message,"Do_not_emit_outputs_if_any_errors_were_reported_6008","Do not emit outputs if any errors were reported."),Do_not_emit_comments_to_output:t(6009,e.DiagnosticCategory.Message,"Do_not_emit_comments_to_output_6009","Do not emit comments to output."),Do_not_emit_outputs:t(6010,e.DiagnosticCategory.Message,"Do_not_emit_outputs_6010","Do not emit outputs."),Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking:t(6011,e.DiagnosticCategory.Message,"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011","Allow default imports from modules with no default export. This does not affect code emit, just typechecking."),Skip_type_checking_of_declaration_files:t(6012,e.DiagnosticCategory.Message,"Skip_type_checking_of_declaration_files_6012","Skip type checking of declaration files."),Do_not_resolve_the_real_path_of_symlinks:t(6013,e.DiagnosticCategory.Message,"Do_not_resolve_the_real_path_of_symlinks_6013","Do not resolve the real path of symlinks."),Only_emit_d_ts_declaration_files:t(6014,e.DiagnosticCategory.Message,"Only_emit_d_ts_declaration_files_6014","Only emit '.d.ts' declaration files."),Specify_ECMAScript_target_version:t(6015,e.DiagnosticCategory.Message,"Specify_ECMAScript_target_version_6015","Specify ECMAScript target version."),Specify_module_code_generation:t(6016,e.DiagnosticCategory.Message,"Specify_module_code_generation_6016","Specify module code generation."),Print_this_message:t(6017,e.DiagnosticCategory.Message,"Print_this_message_6017","Print this message."),Print_the_compiler_s_version:t(6019,e.DiagnosticCategory.Message,"Print_the_compiler_s_version_6019","Print the compiler's version."),Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json:t(6020,e.DiagnosticCategory.Message,"Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020","Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'."),Syntax_Colon_0:t(6023,e.DiagnosticCategory.Message,"Syntax_Colon_0_6023","Syntax: {0}"),options:t(6024,e.DiagnosticCategory.Message,"options_6024","options"),file:t(6025,e.DiagnosticCategory.Message,"file_6025","file"),Examples_Colon_0:t(6026,e.DiagnosticCategory.Message,"Examples_Colon_0_6026","Examples: {0}"),Options_Colon:t(6027,e.DiagnosticCategory.Message,"Options_Colon_6027","Options:"),Version_0:t(6029,e.DiagnosticCategory.Message,"Version_0_6029","Version {0}"),Insert_command_line_options_and_files_from_a_file:t(6030,e.DiagnosticCategory.Message,"Insert_command_line_options_and_files_from_a_file_6030","Insert command line options and files from a file."),Starting_compilation_in_watch_mode:t(6031,e.DiagnosticCategory.Message,"Starting_compilation_in_watch_mode_6031","Starting compilation in watch mode..."),File_change_detected_Starting_incremental_compilation:t(6032,e.DiagnosticCategory.Message,"File_change_detected_Starting_incremental_compilation_6032","File change detected. Starting incremental compilation..."),KIND:t(6034,e.DiagnosticCategory.Message,"KIND_6034","KIND"),FILE:t(6035,e.DiagnosticCategory.Message,"FILE_6035","FILE"),VERSION:t(6036,e.DiagnosticCategory.Message,"VERSION_6036","VERSION"),LOCATION:t(6037,e.DiagnosticCategory.Message,"LOCATION_6037","LOCATION"),DIRECTORY:t(6038,e.DiagnosticCategory.Message,"DIRECTORY_6038","DIRECTORY"),STRATEGY:t(6039,e.DiagnosticCategory.Message,"STRATEGY_6039","STRATEGY"),FILE_OR_DIRECTORY:t(6040,e.DiagnosticCategory.Message,"FILE_OR_DIRECTORY_6040","FILE OR DIRECTORY"),Errors_Files:t(6041,e.DiagnosticCategory.Message,"Errors_Files_6041","Errors Files"),Generates_corresponding_map_file:t(6043,e.DiagnosticCategory.Message,"Generates_corresponding_map_file_6043","Generates corresponding '.map' file."),Compiler_option_0_expects_an_argument:t(6044,e.DiagnosticCategory.Error,"Compiler_option_0_expects_an_argument_6044","Compiler option '{0}' expects an argument."),Unterminated_quoted_string_in_response_file_0:t(6045,e.DiagnosticCategory.Error,"Unterminated_quoted_string_in_response_file_0_6045","Unterminated quoted string in response file '{0}'."),Argument_for_0_option_must_be_Colon_1:t(6046,e.DiagnosticCategory.Error,"Argument_for_0_option_must_be_Colon_1_6046","Argument for '{0}' option must be: {1}."),Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1:t(6048,e.DiagnosticCategory.Error,"Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048","Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'."),Unable_to_open_file_0:t(6050,e.DiagnosticCategory.Error,"Unable_to_open_file_0_6050","Unable to open file '{0}'."),Corrupted_locale_file_0:t(6051,e.DiagnosticCategory.Error,"Corrupted_locale_file_0_6051","Corrupted locale file {0}."),Raise_error_on_expressions_and_declarations_with_an_implied_any_type:t(6052,e.DiagnosticCategory.Message,"Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052","Raise error on expressions and declarations with an implied 'any' type."),File_0_not_found:t(6053,e.DiagnosticCategory.Error,"File_0_not_found_6053","File '{0}' not found."),File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1:t(6054,e.DiagnosticCategory.Error,"File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1_6054","File '{0}' has an unsupported extension. The only supported extensions are {1}."),Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures:t(6055,e.DiagnosticCategory.Message,"Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055","Suppress noImplicitAny errors for indexing objects lacking index signatures."),Do_not_emit_declarations_for_code_that_has_an_internal_annotation:t(6056,e.DiagnosticCategory.Message,"Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056","Do not emit declarations for code that has an '@internal' annotation."),Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir:t(6058,e.DiagnosticCategory.Message,"Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058","Specify the root directory of input files. Use to control the output directory structure with --outDir."),File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files:t(6059,e.DiagnosticCategory.Error,"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059","File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."),Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix:t(6060,e.DiagnosticCategory.Message,"Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060","Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."),NEWLINE:t(6061,e.DiagnosticCategory.Message,"NEWLINE_6061","NEWLINE"),Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line:t(6064,e.DiagnosticCategory.Error,"Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line_6064","Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line."),Enables_experimental_support_for_ES7_decorators:t(6065,e.DiagnosticCategory.Message,"Enables_experimental_support_for_ES7_decorators_6065","Enables experimental support for ES7 decorators."),Enables_experimental_support_for_emitting_type_metadata_for_decorators:t(6066,e.DiagnosticCategory.Message,"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066","Enables experimental support for emitting type metadata for decorators."),Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6:t(6069,e.DiagnosticCategory.Message,"Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069","Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)."),Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file:t(6070,e.DiagnosticCategory.Message,"Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070","Initializes a TypeScript project and creates a tsconfig.json file."),Successfully_created_a_tsconfig_json_file:t(6071,e.DiagnosticCategory.Message,"Successfully_created_a_tsconfig_json_file_6071","Successfully created a tsconfig.json file."),Suppress_excess_property_checks_for_object_literals:t(6072,e.DiagnosticCategory.Message,"Suppress_excess_property_checks_for_object_literals_6072","Suppress excess property checks for object literals."),Stylize_errors_and_messages_using_color_and_context_experimental:t(6073,e.DiagnosticCategory.Message,"Stylize_errors_and_messages_using_color_and_context_experimental_6073","Stylize errors and messages using color and context (experimental)."),Do_not_report_errors_on_unused_labels:t(6074,e.DiagnosticCategory.Message,"Do_not_report_errors_on_unused_labels_6074","Do not report errors on unused labels."),Report_error_when_not_all_code_paths_in_function_return_a_value:t(6075,e.DiagnosticCategory.Message,"Report_error_when_not_all_code_paths_in_function_return_a_value_6075","Report error when not all code paths in function return a value."),Report_errors_for_fallthrough_cases_in_switch_statement:t(6076,e.DiagnosticCategory.Message,"Report_errors_for_fallthrough_cases_in_switch_statement_6076","Report errors for fallthrough cases in switch statement."),Do_not_report_errors_on_unreachable_code:t(6077,e.DiagnosticCategory.Message,"Do_not_report_errors_on_unreachable_code_6077","Do not report errors on unreachable code."),Disallow_inconsistently_cased_references_to_the_same_file:t(6078,e.DiagnosticCategory.Message,"Disallow_inconsistently_cased_references_to_the_same_file_6078","Disallow inconsistently-cased references to the same file."),Specify_library_files_to_be_included_in_the_compilation:t(6079,e.DiagnosticCategory.Message,"Specify_library_files_to_be_included_in_the_compilation_6079","Specify library files to be included in the compilation."),Specify_JSX_code_generation:t(6080,e.DiagnosticCategory.Message,"Specify_JSX_code_generation_6080","Specify JSX code generation."),File_0_has_an_unsupported_extension_so_skipping_it:t(6081,e.DiagnosticCategory.Message,"File_0_has_an_unsupported_extension_so_skipping_it_6081","File '{0}' has an unsupported extension, so skipping it."),Only_amd_and_system_modules_are_supported_alongside_0:t(6082,e.DiagnosticCategory.Error,"Only_amd_and_system_modules_are_supported_alongside_0_6082","Only 'amd' and 'system' modules are supported alongside --{0}."),Base_directory_to_resolve_non_absolute_module_names:t(6083,e.DiagnosticCategory.Message,"Base_directory_to_resolve_non_absolute_module_names_6083","Base directory to resolve non-absolute module names."),Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit:t(6084,e.DiagnosticCategory.Message,"Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084","[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit"),Enable_tracing_of_the_name_resolution_process:t(6085,e.DiagnosticCategory.Message,"Enable_tracing_of_the_name_resolution_process_6085","Enable tracing of the name resolution process."),Resolving_module_0_from_1:t(6086,e.DiagnosticCategory.Message,"Resolving_module_0_from_1_6086","======== Resolving module '{0}' from '{1}'. ========"),Explicitly_specified_module_resolution_kind_Colon_0:t(6087,e.DiagnosticCategory.Message,"Explicitly_specified_module_resolution_kind_Colon_0_6087","Explicitly specified module resolution kind: '{0}'."),Module_resolution_kind_is_not_specified_using_0:t(6088,e.DiagnosticCategory.Message,"Module_resolution_kind_is_not_specified_using_0_6088","Module resolution kind is not specified, using '{0}'."),Module_name_0_was_successfully_resolved_to_1:t(6089,e.DiagnosticCategory.Message,"Module_name_0_was_successfully_resolved_to_1_6089","======== Module name '{0}' was successfully resolved to '{1}'. ========"),Module_name_0_was_not_resolved:t(6090,e.DiagnosticCategory.Message,"Module_name_0_was_not_resolved_6090","======== Module name '{0}' was not resolved. ========"),paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0:t(6091,e.DiagnosticCategory.Message,"paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091","'paths' option is specified, looking for a pattern to match module name '{0}'."),Module_name_0_matched_pattern_1:t(6092,e.DiagnosticCategory.Message,"Module_name_0_matched_pattern_1_6092","Module name '{0}', matched pattern '{1}'."),Trying_substitution_0_candidate_module_location_Colon_1:t(6093,e.DiagnosticCategory.Message,"Trying_substitution_0_candidate_module_location_Colon_1_6093","Trying substitution '{0}', candidate module location: '{1}'."),Resolving_module_name_0_relative_to_base_url_1_2:t(6094,e.DiagnosticCategory.Message,"Resolving_module_name_0_relative_to_base_url_1_2_6094","Resolving module name '{0}' relative to base url '{1}' - '{2}'."),Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1:t(6095,e.DiagnosticCategory.Message,"Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095","Loading module as file / folder, candidate module location '{0}', target file type '{1}'."),File_0_does_not_exist:t(6096,e.DiagnosticCategory.Message,"File_0_does_not_exist_6096","File '{0}' does not exist."),File_0_exist_use_it_as_a_name_resolution_result:t(6097,e.DiagnosticCategory.Message,"File_0_exist_use_it_as_a_name_resolution_result_6097","File '{0}' exist - use it as a name resolution result."),Loading_module_0_from_node_modules_folder_target_file_type_1:t(6098,e.DiagnosticCategory.Message,"Loading_module_0_from_node_modules_folder_target_file_type_1_6098","Loading module '{0}' from 'node_modules' folder, target file type '{1}'."),Found_package_json_at_0:t(6099,e.DiagnosticCategory.Message,"Found_package_json_at_0_6099","Found 'package.json' at '{0}'."),package_json_does_not_have_a_0_field:t(6100,e.DiagnosticCategory.Message,"package_json_does_not_have_a_0_field_6100","'package.json' does not have a '{0}' field."),package_json_has_0_field_1_that_references_2:t(6101,e.DiagnosticCategory.Message,"package_json_has_0_field_1_that_references_2_6101","'package.json' has '{0}' field '{1}' that references '{2}'."),Allow_javascript_files_to_be_compiled:t(6102,e.DiagnosticCategory.Message,"Allow_javascript_files_to_be_compiled_6102","Allow javascript files to be compiled."),Checking_if_0_is_the_longest_matching_prefix_for_1_2:t(6104,e.DiagnosticCategory.Message,"Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104","Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'."),Expected_type_of_0_field_in_package_json_to_be_1_got_2:t(6105,e.DiagnosticCategory.Message,"Expected_type_of_0_field_in_package_json_to_be_1_got_2_6105","Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'."),baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1:t(6106,e.DiagnosticCategory.Message,"baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106","'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'."),rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0:t(6107,e.DiagnosticCategory.Message,"rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107","'rootDirs' option is set, using it to resolve relative module name '{0}'."),Longest_matching_prefix_for_0_is_1:t(6108,e.DiagnosticCategory.Message,"Longest_matching_prefix_for_0_is_1_6108","Longest matching prefix for '{0}' is '{1}'."),Loading_0_from_the_root_dir_1_candidate_location_2:t(6109,e.DiagnosticCategory.Message,"Loading_0_from_the_root_dir_1_candidate_location_2_6109","Loading '{0}' from the root dir '{1}', candidate location '{2}'."),Trying_other_entries_in_rootDirs:t(6110,e.DiagnosticCategory.Message,"Trying_other_entries_in_rootDirs_6110","Trying other entries in 'rootDirs'."),Module_resolution_using_rootDirs_has_failed:t(6111,e.DiagnosticCategory.Message,"Module_resolution_using_rootDirs_has_failed_6111","Module resolution using 'rootDirs' has failed."),Do_not_emit_use_strict_directives_in_module_output:t(6112,e.DiagnosticCategory.Message,"Do_not_emit_use_strict_directives_in_module_output_6112","Do not emit 'use strict' directives in module output."),Enable_strict_null_checks:t(6113,e.DiagnosticCategory.Message,"Enable_strict_null_checks_6113","Enable strict null checks."),Unknown_option_excludes_Did_you_mean_exclude:t(6114,e.DiagnosticCategory.Error,"Unknown_option_excludes_Did_you_mean_exclude_6114","Unknown option 'excludes'. Did you mean 'exclude'?"),Raise_error_on_this_expressions_with_an_implied_any_type:t(6115,e.DiagnosticCategory.Message,"Raise_error_on_this_expressions_with_an_implied_any_type_6115","Raise error on 'this' expressions with an implied 'any' type."),Resolving_type_reference_directive_0_containing_file_1_root_directory_2:t(6116,e.DiagnosticCategory.Message,"Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116","======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========"),Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2:t(6119,e.DiagnosticCategory.Message,"Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119","======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========"),Type_reference_directive_0_was_not_resolved:t(6120,e.DiagnosticCategory.Message,"Type_reference_directive_0_was_not_resolved_6120","======== Type reference directive '{0}' was not resolved. ========"),Resolving_with_primary_search_path_0:t(6121,e.DiagnosticCategory.Message,"Resolving_with_primary_search_path_0_6121","Resolving with primary search path '{0}'."),Root_directory_cannot_be_determined_skipping_primary_search_paths:t(6122,e.DiagnosticCategory.Message,"Root_directory_cannot_be_determined_skipping_primary_search_paths_6122","Root directory cannot be determined, skipping primary search paths."),Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set:t(6123,e.DiagnosticCategory.Message,"Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123","======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========"),Type_declaration_files_to_be_included_in_compilation:t(6124,e.DiagnosticCategory.Message,"Type_declaration_files_to_be_included_in_compilation_6124","Type declaration files to be included in compilation."),Looking_up_in_node_modules_folder_initial_location_0:t(6125,e.DiagnosticCategory.Message,"Looking_up_in_node_modules_folder_initial_location_0_6125","Looking up in 'node_modules' folder, initial location '{0}'."),Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder:t(6126,e.DiagnosticCategory.Message,"Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126","Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."),Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1:t(6127,e.DiagnosticCategory.Message,"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127","======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========"),Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set:t(6128,e.DiagnosticCategory.Message,"Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128","======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========"),Resolving_real_path_for_0_result_1:t(6130,e.DiagnosticCategory.Message,"Resolving_real_path_for_0_result_1_6130","Resolving real path for '{0}', result '{1}'."),Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system:t(6131,e.DiagnosticCategory.Error,"Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131","Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."),File_name_0_has_a_1_extension_stripping_it:t(6132,e.DiagnosticCategory.Message,"File_name_0_has_a_1_extension_stripping_it_6132","File name '{0}' has a '{1}' extension - stripping it."),_0_is_declared_but_its_value_is_never_read:t(6133,e.DiagnosticCategory.Error,"_0_is_declared_but_its_value_is_never_read_6133","'{0}' is declared but its value is never read.",!0),Report_errors_on_unused_locals:t(6134,e.DiagnosticCategory.Message,"Report_errors_on_unused_locals_6134","Report errors on unused locals."),Report_errors_on_unused_parameters:t(6135,e.DiagnosticCategory.Message,"Report_errors_on_unused_parameters_6135","Report errors on unused parameters."),The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files:t(6136,e.DiagnosticCategory.Message,"The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136","The maximum dependency depth to search under node_modules and load JavaScript files."),Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1:t(6137,e.DiagnosticCategory.Error,"Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137","Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."),Property_0_is_declared_but_its_value_is_never_read:t(6138,e.DiagnosticCategory.Error,"Property_0_is_declared_but_its_value_is_never_read_6138","Property '{0}' is declared but its value is never read.",!0),Import_emit_helpers_from_tslib:t(6139,e.DiagnosticCategory.Message,"Import_emit_helpers_from_tslib_6139","Import emit helpers from 'tslib'."),Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2:t(6140,e.DiagnosticCategory.Error,"Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140","Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."),Parse_in_strict_mode_and_emit_use_strict_for_each_source_file:t(6141,e.DiagnosticCategory.Message,"Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141",'Parse in strict mode and emit "use strict" for each source file.'),Module_0_was_resolved_to_1_but_jsx_is_not_set:t(6142,e.DiagnosticCategory.Error,"Module_0_was_resolved_to_1_but_jsx_is_not_set_6142","Module '{0}' was resolved to '{1}', but '--jsx' is not set."),Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1:t(6144,e.DiagnosticCategory.Message,"Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144","Module '{0}' was resolved as locally declared ambient module in file '{1}'."),Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified:t(6145,e.DiagnosticCategory.Message,"Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145","Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."),Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h:t(6146,e.DiagnosticCategory.Message,"Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146","Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."),Resolution_for_module_0_was_found_in_cache_from_location_1:t(6147,e.DiagnosticCategory.Message,"Resolution_for_module_0_was_found_in_cache_from_location_1_6147","Resolution for module '{0}' was found in cache from location '{1}'."),Directory_0_does_not_exist_skipping_all_lookups_in_it:t(6148,e.DiagnosticCategory.Message,"Directory_0_does_not_exist_skipping_all_lookups_in_it_6148","Directory '{0}' does not exist, skipping all lookups in it."),Show_diagnostic_information:t(6149,e.DiagnosticCategory.Message,"Show_diagnostic_information_6149","Show diagnostic information."),Show_verbose_diagnostic_information:t(6150,e.DiagnosticCategory.Message,"Show_verbose_diagnostic_information_6150","Show verbose diagnostic information."),Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file:t(6151,e.DiagnosticCategory.Message,"Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151","Emit a single file with source maps instead of having a separate file."),Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set:t(6152,e.DiagnosticCategory.Message,"Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152","Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set."),Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule:t(6153,e.DiagnosticCategory.Message,"Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153","Transpile each file as a separate module (similar to 'ts.transpileModule')."),Print_names_of_generated_files_part_of_the_compilation:t(6154,e.DiagnosticCategory.Message,"Print_names_of_generated_files_part_of_the_compilation_6154","Print names of generated files part of the compilation."),Print_names_of_files_part_of_the_compilation:t(6155,e.DiagnosticCategory.Message,"Print_names_of_files_part_of_the_compilation_6155","Print names of files part of the compilation."),The_locale_used_when_displaying_messages_to_the_user_e_g_en_us:t(6156,e.DiagnosticCategory.Message,"The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156","The locale used when displaying messages to the user (e.g. 'en-us')"),Do_not_generate_custom_helper_functions_like_extends_in_compiled_output:t(6157,e.DiagnosticCategory.Message,"Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157","Do not generate custom helper functions like '__extends' in compiled output."),Do_not_include_the_default_library_file_lib_d_ts:t(6158,e.DiagnosticCategory.Message,"Do_not_include_the_default_library_file_lib_d_ts_6158","Do not include the default library file (lib.d.ts)."),Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files:t(6159,e.DiagnosticCategory.Message,"Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159","Do not add triple-slash references or imported modules to the list of compiled files."),Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files:t(6160,e.DiagnosticCategory.Message,"Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160","[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files."),List_of_folders_to_include_type_definitions_from:t(6161,e.DiagnosticCategory.Message,"List_of_folders_to_include_type_definitions_from_6161","List of folders to include type definitions from."),Disable_size_limitations_on_JavaScript_projects:t(6162,e.DiagnosticCategory.Message,"Disable_size_limitations_on_JavaScript_projects_6162","Disable size limitations on JavaScript projects."),The_character_set_of_the_input_files:t(6163,e.DiagnosticCategory.Message,"The_character_set_of_the_input_files_6163","The character set of the input files."),Do_not_truncate_error_messages:t(6165,e.DiagnosticCategory.Message,"Do_not_truncate_error_messages_6165","Do not truncate error messages."),Output_directory_for_generated_declaration_files:t(6166,e.DiagnosticCategory.Message,"Output_directory_for_generated_declaration_files_6166","Output directory for generated declaration files."),A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl:t(6167,e.DiagnosticCategory.Message,"A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167","A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."),List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime:t(6168,e.DiagnosticCategory.Message,"List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168","List of root folders whose combined content represents the structure of the project at runtime."),Show_all_compiler_options:t(6169,e.DiagnosticCategory.Message,"Show_all_compiler_options_6169","Show all compiler options."),Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file:t(6170,e.DiagnosticCategory.Message,"Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170","[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file"),Command_line_Options:t(6171,e.DiagnosticCategory.Message,"Command_line_Options_6171","Command-line Options"),Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3:t(6179,e.DiagnosticCategory.Message,"Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179","Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'."),Enable_all_strict_type_checking_options:t(6180,e.DiagnosticCategory.Message,"Enable_all_strict_type_checking_options_6180","Enable all strict type-checking options."),Scoped_package_detected_looking_in_0:t(6182,e.DiagnosticCategory.Message,"Scoped_package_detected_looking_in_0_6182","Scoped package detected, looking in '{0}'"),Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2:t(6183,e.DiagnosticCategory.Message,"Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_6183","Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."),Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3:t(6184,e.DiagnosticCategory.Message,"Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package__6184","Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."),Enable_strict_checking_of_function_types:t(6186,e.DiagnosticCategory.Message,"Enable_strict_checking_of_function_types_6186","Enable strict checking of function types."),Enable_strict_checking_of_property_initialization_in_classes:t(6187,e.DiagnosticCategory.Message,"Enable_strict_checking_of_property_initialization_in_classes_6187","Enable strict checking of property initialization in classes."),Numeric_separators_are_not_allowed_here:t(6188,e.DiagnosticCategory.Error,"Numeric_separators_are_not_allowed_here_6188","Numeric separators are not allowed here."),Multiple_consecutive_numeric_separators_are_not_permitted:t(6189,e.DiagnosticCategory.Error,"Multiple_consecutive_numeric_separators_are_not_permitted_6189","Multiple consecutive numeric separators are not permitted."),Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen:t(6191,e.DiagnosticCategory.Message,"Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191","Whether to keep outdated console output in watch mode instead of clearing the screen."),All_imports_in_import_declaration_are_unused:t(6192,e.DiagnosticCategory.Error,"All_imports_in_import_declaration_are_unused_6192","All imports in import declaration are unused.",!0),Found_1_error_Watching_for_file_changes:t(6193,e.DiagnosticCategory.Message,"Found_1_error_Watching_for_file_changes_6193","Found 1 error. Watching for file changes."),Found_0_errors_Watching_for_file_changes:t(6194,e.DiagnosticCategory.Message,"Found_0_errors_Watching_for_file_changes_6194","Found {0} errors. Watching for file changes."),Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols:t(6195,e.DiagnosticCategory.Message,"Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195","Resolve 'keyof' to string valued property names only (no numbers or symbols)."),_0_is_declared_but_never_used:t(6196,e.DiagnosticCategory.Error,"_0_is_declared_but_never_used_6196","'{0}' is declared but never used.",!0),Include_modules_imported_with_json_extension:t(6197,e.DiagnosticCategory.Message,"Include_modules_imported_with_json_extension_6197","Include modules imported with '.json' extension"),All_destructured_elements_are_unused:t(6198,e.DiagnosticCategory.Error,"All_destructured_elements_are_unused_6198","All destructured elements are unused.",!0),All_variables_are_unused:t(6199,e.DiagnosticCategory.Error,"All_variables_are_unused_6199","All variables are unused.",!0),Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0:t(6200,e.DiagnosticCategory.Error,"Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0_6200","Definitions of the following identifiers conflict with those in another file: {0}"),Conflicts_are_in_this_file:t(6201,e.DiagnosticCategory.Message,"Conflicts_are_in_this_file_6201","Conflicts are in this file."),Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0:t(6202,e.DiagnosticCategory.Error,"Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202","Project references may not form a circular graph. Cycle detected: {0}"),_0_was_also_declared_here:t(6203,e.DiagnosticCategory.Message,"_0_was_also_declared_here_6203","'{0}' was also declared here."),and_here:t(6204,e.DiagnosticCategory.Message,"and_here_6204","and here."),All_type_parameters_are_unused:t(6205,e.DiagnosticCategory.Error,"All_type_parameters_are_unused_6205","All type parameters are unused."),package_json_has_a_typesVersions_field_with_version_specific_path_mappings:t(6206,e.DiagnosticCategory.Message,"package_json_has_a_typesVersions_field_with_version_specific_path_mappings_6206","'package.json' has a 'typesVersions' field with version-specific path mappings."),package_json_does_not_have_a_typesVersions_entry_that_matches_version_0:t(6207,e.DiagnosticCategory.Message,"package_json_does_not_have_a_typesVersions_entry_that_matches_version_0_6207","'package.json' does not have a 'typesVersions' entry that matches version '{0}'."),package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2:t(6208,e.DiagnosticCategory.Message,"package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_ma_6208","'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'."),package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range:t(6209,e.DiagnosticCategory.Message,"package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range_6209","'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range."),An_argument_for_0_was_not_provided:t(6210,e.DiagnosticCategory.Message,"An_argument_for_0_was_not_provided_6210","An argument for '{0}' was not provided."),An_argument_matching_this_binding_pattern_was_not_provided:t(6211,e.DiagnosticCategory.Message,"An_argument_matching_this_binding_pattern_was_not_provided_6211","An argument matching this binding pattern was not provided."),Did_you_mean_to_call_this_expression:t(6212,e.DiagnosticCategory.Message,"Did_you_mean_to_call_this_expression_6212","Did you mean to call this expression?"),Did_you_mean_to_use_new_with_this_expression:t(6213,e.DiagnosticCategory.Message,"Did_you_mean_to_use_new_with_this_expression_6213","Did you mean to use 'new' with this expression?"),Enable_strict_bind_call_and_apply_methods_on_functions:t(6214,e.DiagnosticCategory.Message,"Enable_strict_bind_call_and_apply_methods_on_functions_6214","Enable strict 'bind', 'call', and 'apply' methods on functions."),Using_compiler_options_of_project_reference_redirect_0:t(6215,e.DiagnosticCategory.Message,"Using_compiler_options_of_project_reference_redirect_0_6215","Using compiler options of project reference redirect '{0}'."),Found_1_error:t(6216,e.DiagnosticCategory.Message,"Found_1_error_6216","Found 1 error."),Found_0_errors:t(6217,e.DiagnosticCategory.Message,"Found_0_errors_6217","Found {0} errors."),Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2:t(6218,e.DiagnosticCategory.Message,"Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218","======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3:t(6219,e.DiagnosticCategory.Message,"Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219","======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),package_json_had_a_falsy_0_field:t(6220,e.DiagnosticCategory.Message,"package_json_had_a_falsy_0_field_6220","'package.json' had a falsy '{0}' field."),Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects:t(6221,e.DiagnosticCategory.Message,"Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects_6221","Disable use of source files instead of declaration files from referenced projects."),Emit_class_fields_with_Define_instead_of_Set:t(6222,e.DiagnosticCategory.Message,"Emit_class_fields_with_Define_instead_of_Set_6222","Emit class fields with Define instead of Set."),Generates_a_CPU_profile:t(6223,e.DiagnosticCategory.Message,"Generates_a_CPU_profile_6223","Generates a CPU profile."),Disable_solution_searching_for_this_project:t(6224,e.DiagnosticCategory.Message,"Disable_solution_searching_for_this_project_6224","Disable solution searching for this project."),Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling_UseFsEvents_UseFsEventsOnParentDirectory:t(6225,e.DiagnosticCategory.Message,"Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_Dynami_6225","Specify strategy for watching file: 'FixedPollingInterval' (default), 'PriorityPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling', 'UseFsEvents', 'UseFsEventsOnParentDirectory'."),Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively_Colon_UseFsEvents_default_FixedPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling:t(6226,e.DiagnosticCategory.Message,"Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively__6226","Specify strategy for watching directory on platforms that don't support recursive watching natively: 'UseFsEvents' (default), 'FixedPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling'."),Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_FixedInterval_default_PriorityInterval_DynamicPriority_FixedChunkSize:t(6227,e.DiagnosticCategory.Message,"Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_6227","Specify strategy for creating a polling watch when it fails to create using file system events: 'FixedInterval' (default), 'PriorityInterval', 'DynamicPriority', 'FixedChunkSize'."),Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3:t(6229,e.DiagnosticCategory.Error,"Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3_6229","Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'."),Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line:t(6230,e.DiagnosticCategory.Error,"Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line_6230","Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line."),Could_not_resolve_the_path_0_with_the_extensions_Colon_1:t(6231,e.DiagnosticCategory.Error,"Could_not_resolve_the_path_0_with_the_extensions_Colon_1_6231","Could not resolve the path '{0}' with the extensions: {1}."),Declaration_augments_declaration_in_another_file_This_cannot_be_serialized:t(6232,e.DiagnosticCategory.Error,"Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232","Declaration augments declaration in another file. This cannot be serialized."),This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file:t(6233,e.DiagnosticCategory.Error,"This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233","This is the declaration being augmented. Consider moving the augmenting declaration into the same file."),This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without:t(6234,e.DiagnosticCategory.Error,"This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without_6234","This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?"),Disable_loading_referenced_projects:t(6235,e.DiagnosticCategory.Message,"Disable_loading_referenced_projects_6235","Disable loading referenced projects."),Arguments_for_the_rest_parameter_0_were_not_provided:t(6236,e.DiagnosticCategory.Error,"Arguments_for_the_rest_parameter_0_were_not_provided_6236","Arguments for the rest parameter '{0}' were not provided."),Generates_an_event_trace_and_a_list_of_types:t(6237,e.DiagnosticCategory.Message,"Generates_an_event_trace_and_a_list_of_types_6237","Generates an event trace and a list of types."),Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react:t(6238,e.DiagnosticCategory.Error,"Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react_6238","Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react"),File_0_exists_according_to_earlier_cached_lookups:t(6239,e.DiagnosticCategory.Message,"File_0_exists_according_to_earlier_cached_lookups_6239","File '{0}' exists according to earlier cached lookups."),File_0_does_not_exist_according_to_earlier_cached_lookups:t(6240,e.DiagnosticCategory.Message,"File_0_does_not_exist_according_to_earlier_cached_lookups_6240","File '{0}' does not exist according to earlier cached lookups."),Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1:t(6241,e.DiagnosticCategory.Message,"Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241","Resolution for type reference directive '{0}' was found in cache from location '{1}'."),Resolving_type_reference_directive_0_containing_file_1:t(6242,e.DiagnosticCategory.Message,"Resolving_type_reference_directive_0_containing_file_1_6242","======== Resolving type reference directive '{0}', containing file '{1}'. ========"),Interpret_optional_property_types_as_written_rather_than_adding_undefined:t(6243,e.DiagnosticCategory.Message,"Interpret_optional_property_types_as_written_rather_than_adding_undefined_6243","Interpret optional property types as written, rather than adding 'undefined'."),Modules:t(6244,e.DiagnosticCategory.Message,"Modules_6244","Modules"),File_Management:t(6245,e.DiagnosticCategory.Message,"File_Management_6245","File Management"),Emit:t(6246,e.DiagnosticCategory.Message,"Emit_6246","Emit"),JavaScript_Support:t(6247,e.DiagnosticCategory.Message,"JavaScript_Support_6247","JavaScript Support"),Type_Checking:t(6248,e.DiagnosticCategory.Message,"Type_Checking_6248","Type Checking"),Editor_Support:t(6249,e.DiagnosticCategory.Message,"Editor_Support_6249","Editor Support"),Watch_and_Build_Modes:t(6250,e.DiagnosticCategory.Message,"Watch_and_Build_Modes_6250","Watch and Build Modes"),Compiler_Diagnostics:t(6251,e.DiagnosticCategory.Message,"Compiler_Diagnostics_6251","Compiler Diagnostics"),Interop_Constraints:t(6252,e.DiagnosticCategory.Message,"Interop_Constraints_6252","Interop Constraints"),Backwards_Compatibility:t(6253,e.DiagnosticCategory.Message,"Backwards_Compatibility_6253","Backwards Compatibility"),Language_and_Environment:t(6254,e.DiagnosticCategory.Message,"Language_and_Environment_6254","Language and Environment"),Projects:t(6255,e.DiagnosticCategory.Message,"Projects_6255","Projects"),Output_Formatting:t(6256,e.DiagnosticCategory.Message,"Output_Formatting_6256","Output Formatting"),Completeness:t(6257,e.DiagnosticCategory.Message,"Completeness_6257","Completeness"),_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file:t(6258,e.DiagnosticCategory.Error,"_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258","'{0}' should be set inside the 'compilerOptions' object of the config json file"),Found_1_error_in_1:t(6259,e.DiagnosticCategory.Message,"Found_1_error_in_1_6259","Found 1 error in {1}"),Found_0_errors_in_the_same_file_starting_at_Colon_1:t(6260,e.DiagnosticCategory.Message,"Found_0_errors_in_the_same_file_starting_at_Colon_1_6260","Found {0} errors in the same file, starting at: {1}"),Found_0_errors_in_1_files:t(6261,e.DiagnosticCategory.Message,"Found_0_errors_in_1_files_6261","Found {0} errors in {1} files."),Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve:t(6270,e.DiagnosticCategory.Message,"Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270","Directory '{0}' has no containing package.json scope. Imports will not resolve."),Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1:t(6271,e.DiagnosticCategory.Message,"Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271","Import specifier '{0}' does not exist in package.json scope at path '{1}'."),Invalid_import_specifier_0_has_no_possible_resolutions:t(6272,e.DiagnosticCategory.Message,"Invalid_import_specifier_0_has_no_possible_resolutions_6272","Invalid import specifier '{0}' has no possible resolutions."),package_json_scope_0_has_no_imports_defined:t(6273,e.DiagnosticCategory.Message,"package_json_scope_0_has_no_imports_defined_6273","package.json scope '{0}' has no imports defined."),package_json_scope_0_explicitly_maps_specifier_1_to_null:t(6274,e.DiagnosticCategory.Message,"package_json_scope_0_explicitly_maps_specifier_1_to_null_6274","package.json scope '{0}' explicitly maps specifier '{1}' to null."),package_json_scope_0_has_invalid_type_for_target_of_specifier_1:t(6275,e.DiagnosticCategory.Message,"package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275","package.json scope '{0}' has invalid type for target of specifier '{1}'"),Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1:t(6276,e.DiagnosticCategory.Message,"Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276","Export specifier '{0}' does not exist in package.json scope at path '{1}'."),Enable_project_compilation:t(6302,e.DiagnosticCategory.Message,"Enable_project_compilation_6302","Enable project compilation"),Composite_projects_may_not_disable_declaration_emit:t(6304,e.DiagnosticCategory.Error,"Composite_projects_may_not_disable_declaration_emit_6304","Composite projects may not disable declaration emit."),Output_file_0_has_not_been_built_from_source_file_1:t(6305,e.DiagnosticCategory.Error,"Output_file_0_has_not_been_built_from_source_file_1_6305","Output file '{0}' has not been built from source file '{1}'."),Referenced_project_0_must_have_setting_composite_Colon_true:t(6306,e.DiagnosticCategory.Error,"Referenced_project_0_must_have_setting_composite_Colon_true_6306","Referenced project '{0}' must have setting \"composite\": true."),File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern:t(6307,e.DiagnosticCategory.Error,"File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_includ_6307","File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern."),Cannot_prepend_project_0_because_it_does_not_have_outFile_set:t(6308,e.DiagnosticCategory.Error,"Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308","Cannot prepend project '{0}' because it does not have 'outFile' set"),Output_file_0_from_project_1_does_not_exist:t(6309,e.DiagnosticCategory.Error,"Output_file_0_from_project_1_does_not_exist_6309","Output file '{0}' from project '{1}' does not exist"),Referenced_project_0_may_not_disable_emit:t(6310,e.DiagnosticCategory.Error,"Referenced_project_0_may_not_disable_emit_6310","Referenced project '{0}' may not disable emit."),Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2:t(6350,e.DiagnosticCategory.Message,"Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350","Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'"),Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2:t(6351,e.DiagnosticCategory.Message,"Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351","Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'"),Project_0_is_out_of_date_because_output_file_1_does_not_exist:t(6352,e.DiagnosticCategory.Message,"Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352","Project '{0}' is out of date because output file '{1}' does not exist"),Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date:t(6353,e.DiagnosticCategory.Message,"Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353","Project '{0}' is out of date because its dependency '{1}' is out of date"),Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies:t(6354,e.DiagnosticCategory.Message,"Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354","Project '{0}' is up to date with .d.ts files from its dependencies"),Projects_in_this_build_Colon_0:t(6355,e.DiagnosticCategory.Message,"Projects_in_this_build_Colon_0_6355","Projects in this build: {0}"),A_non_dry_build_would_delete_the_following_files_Colon_0:t(6356,e.DiagnosticCategory.Message,"A_non_dry_build_would_delete_the_following_files_Colon_0_6356","A non-dry build would delete the following files: {0}"),A_non_dry_build_would_build_project_0:t(6357,e.DiagnosticCategory.Message,"A_non_dry_build_would_build_project_0_6357","A non-dry build would build project '{0}'"),Building_project_0:t(6358,e.DiagnosticCategory.Message,"Building_project_0_6358","Building project '{0}'..."),Updating_output_timestamps_of_project_0:t(6359,e.DiagnosticCategory.Message,"Updating_output_timestamps_of_project_0_6359","Updating output timestamps of project '{0}'..."),Project_0_is_up_to_date:t(6361,e.DiagnosticCategory.Message,"Project_0_is_up_to_date_6361","Project '{0}' is up to date"),Skipping_build_of_project_0_because_its_dependency_1_has_errors:t(6362,e.DiagnosticCategory.Message,"Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362","Skipping build of project '{0}' because its dependency '{1}' has errors"),Project_0_can_t_be_built_because_its_dependency_1_has_errors:t(6363,e.DiagnosticCategory.Message,"Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363","Project '{0}' can't be built because its dependency '{1}' has errors"),Build_one_or_more_projects_and_their_dependencies_if_out_of_date:t(6364,e.DiagnosticCategory.Message,"Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364","Build one or more projects and their dependencies, if out of date"),Delete_the_outputs_of_all_projects:t(6365,e.DiagnosticCategory.Message,"Delete_the_outputs_of_all_projects_6365","Delete the outputs of all projects."),Show_what_would_be_built_or_deleted_if_specified_with_clean:t(6367,e.DiagnosticCategory.Message,"Show_what_would_be_built_or_deleted_if_specified_with_clean_6367","Show what would be built (or deleted, if specified with '--clean')"),Option_build_must_be_the_first_command_line_argument:t(6369,e.DiagnosticCategory.Error,"Option_build_must_be_the_first_command_line_argument_6369","Option '--build' must be the first command line argument."),Options_0_and_1_cannot_be_combined:t(6370,e.DiagnosticCategory.Error,"Options_0_and_1_cannot_be_combined_6370","Options '{0}' and '{1}' cannot be combined."),Updating_unchanged_output_timestamps_of_project_0:t(6371,e.DiagnosticCategory.Message,"Updating_unchanged_output_timestamps_of_project_0_6371","Updating unchanged output timestamps of project '{0}'..."),Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed:t(6372,e.DiagnosticCategory.Message,"Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372","Project '{0}' is out of date because output of its dependency '{1}' has changed"),Updating_output_of_project_0:t(6373,e.DiagnosticCategory.Message,"Updating_output_of_project_0_6373","Updating output of project '{0}'..."),A_non_dry_build_would_update_timestamps_for_output_of_project_0:t(6374,e.DiagnosticCategory.Message,"A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374","A non-dry build would update timestamps for output of project '{0}'"),A_non_dry_build_would_update_output_of_project_0:t(6375,e.DiagnosticCategory.Message,"A_non_dry_build_would_update_output_of_project_0_6375","A non-dry build would update output of project '{0}'"),Cannot_update_output_of_project_0_because_there_was_error_reading_file_1:t(6376,e.DiagnosticCategory.Message,"Cannot_update_output_of_project_0_because_there_was_error_reading_file_1_6376","Cannot update output of project '{0}' because there was error reading file '{1}'"),Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1:t(6377,e.DiagnosticCategory.Error,"Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1_6377","Cannot write file '{0}' because it will overwrite '.tsbuildinfo' file generated by referenced project '{1}'"),Composite_projects_may_not_disable_incremental_compilation:t(6379,e.DiagnosticCategory.Error,"Composite_projects_may_not_disable_incremental_compilation_6379","Composite projects may not disable incremental compilation."),Specify_file_to_store_incremental_compilation_information:t(6380,e.DiagnosticCategory.Message,"Specify_file_to_store_incremental_compilation_information_6380","Specify file to store incremental compilation information"),Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2:t(6381,e.DiagnosticCategory.Message,"Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381","Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"),Skipping_build_of_project_0_because_its_dependency_1_was_not_built:t(6382,e.DiagnosticCategory.Message,"Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382","Skipping build of project '{0}' because its dependency '{1}' was not built"),Project_0_can_t_be_built_because_its_dependency_1_was_not_built:t(6383,e.DiagnosticCategory.Message,"Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383","Project '{0}' can't be built because its dependency '{1}' was not built"),Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it:t(6384,e.DiagnosticCategory.Message,"Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384","Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."),_0_is_deprecated:t(6385,e.DiagnosticCategory.Suggestion,"_0_is_deprecated_6385","'{0}' is deprecated.",void 0,void 0,!0),Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found:t(6386,e.DiagnosticCategory.Message,"Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_nativ_6386","Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found."),The_signature_0_of_1_is_deprecated:t(6387,e.DiagnosticCategory.Suggestion,"The_signature_0_of_1_is_deprecated_6387","The signature '{0}' of '{1}' is deprecated.",void 0,void 0,!0),Project_0_is_being_forcibly_rebuilt:t(6388,e.DiagnosticCategory.Message,"Project_0_is_being_forcibly_rebuilt_6388","Project '{0}' is being forcibly rebuilt"),Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved:t(6389,e.DiagnosticCategory.Message,"Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved_6389","Reusing resolution of module '{0}' from '{1}' of old program, it was not resolved."),Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2:t(6390,e.DiagnosticCategory.Message,"Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6390","Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."),Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3:t(6391,e.DiagnosticCategory.Message,"Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6391","Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."),Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved:t(6392,e.DiagnosticCategory.Message,"Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved_6392","Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was not resolved."),Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3:t(6393,e.DiagnosticCategory.Message,"Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6393","Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4:t(6394,e.DiagnosticCategory.Message,"Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6394","Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved:t(6395,e.DiagnosticCategory.Message,"Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved_6395","Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3:t(6396,e.DiagnosticCategory.Message,"Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396","Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4:t(6397,e.DiagnosticCategory.Message,"Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397","Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved:t(6398,e.DiagnosticCategory.Message,"Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398","Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1:t(6500,e.DiagnosticCategory.Message,"The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500","The expected type comes from property '{0}' which is declared here on type '{1}'"),The_expected_type_comes_from_this_index_signature:t(6501,e.DiagnosticCategory.Message,"The_expected_type_comes_from_this_index_signature_6501","The expected type comes from this index signature."),The_expected_type_comes_from_the_return_type_of_this_signature:t(6502,e.DiagnosticCategory.Message,"The_expected_type_comes_from_the_return_type_of_this_signature_6502","The expected type comes from the return type of this signature."),Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing:t(6503,e.DiagnosticCategory.Message,"Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing_6503","Print names of files that are part of the compilation and then stop processing."),File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option:t(6504,e.DiagnosticCategory.Error,"File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option_6504","File '{0}' is a JavaScript file. Did you mean to enable the 'allowJs' option?"),Print_names_of_files_and_the_reason_they_are_part_of_the_compilation:t(6505,e.DiagnosticCategory.Message,"Print_names_of_files_and_the_reason_they_are_part_of_the_compilation_6505","Print names of files and the reason they are part of the compilation."),Consider_adding_a_declare_modifier_to_this_class:t(6506,e.DiagnosticCategory.Message,"Consider_adding_a_declare_modifier_to_this_class_6506","Consider adding a 'declare' modifier to this class."),Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files:t(6600,e.DiagnosticCategory.Message,"Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these__6600","Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files."),Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export:t(6601,e.DiagnosticCategory.Message,"Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export_6601","Allow 'import x from y' when a module doesn't have a default export."),Allow_accessing_UMD_globals_from_modules:t(6602,e.DiagnosticCategory.Message,"Allow_accessing_UMD_globals_from_modules_6602","Allow accessing UMD globals from modules."),Disable_error_reporting_for_unreachable_code:t(6603,e.DiagnosticCategory.Message,"Disable_error_reporting_for_unreachable_code_6603","Disable error reporting for unreachable code."),Disable_error_reporting_for_unused_labels:t(6604,e.DiagnosticCategory.Message,"Disable_error_reporting_for_unused_labels_6604","Disable error reporting for unused labels."),Ensure_use_strict_is_always_emitted:t(6605,e.DiagnosticCategory.Message,"Ensure_use_strict_is_always_emitted_6605","Ensure 'use strict' is always emitted."),Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it:t(6606,e.DiagnosticCategory.Message,"Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_wi_6606","Have recompiles in projects that use 'incremental' and 'watch' mode assume that changes within a file will only affect files directly depending on it."),Specify_the_base_directory_to_resolve_non_relative_module_names:t(6607,e.DiagnosticCategory.Message,"Specify_the_base_directory_to_resolve_non_relative_module_names_6607","Specify the base directory to resolve non-relative module names."),No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files:t(6608,e.DiagnosticCategory.Message,"No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files_6608","No longer supported. In early versions, manually set the text encoding for reading files."),Enable_error_reporting_in_type_checked_JavaScript_files:t(6609,e.DiagnosticCategory.Message,"Enable_error_reporting_in_type_checked_JavaScript_files_6609","Enable error reporting in type-checked JavaScript files."),Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references:t(6611,e.DiagnosticCategory.Message,"Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references_6611","Enable constraints that allow a TypeScript project to be used with project references."),Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project:t(6612,e.DiagnosticCategory.Message,"Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project_6612","Generate .d.ts files from TypeScript and JavaScript files in your project."),Specify_the_output_directory_for_generated_declaration_files:t(6613,e.DiagnosticCategory.Message,"Specify_the_output_directory_for_generated_declaration_files_6613","Specify the output directory for generated declaration files."),Create_sourcemaps_for_d_ts_files:t(6614,e.DiagnosticCategory.Message,"Create_sourcemaps_for_d_ts_files_6614","Create sourcemaps for d.ts files."),Output_compiler_performance_information_after_building:t(6615,e.DiagnosticCategory.Message,"Output_compiler_performance_information_after_building_6615","Output compiler performance information after building."),Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project:t(6616,e.DiagnosticCategory.Message,"Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project_6616","Disables inference for type acquisition by looking at filenames in a project."),Reduce_the_number_of_projects_loaded_automatically_by_TypeScript:t(6617,e.DiagnosticCategory.Message,"Reduce_the_number_of_projects_loaded_automatically_by_TypeScript_6617","Reduce the number of projects loaded automatically by TypeScript."),Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server:t(6618,e.DiagnosticCategory.Message,"Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server_6618","Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server."),Opt_a_project_out_of_multi_project_reference_checking_when_editing:t(6619,e.DiagnosticCategory.Message,"Opt_a_project_out_of_multi_project_reference_checking_when_editing_6619","Opt a project out of multi-project reference checking when editing."),Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects:t(6620,e.DiagnosticCategory.Message,"Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects_6620","Disable preferring source files instead of declaration files when referencing composite projects."),Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration:t(6621,e.DiagnosticCategory.Message,"Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration_6621","Emit more compliant, but verbose and less performant JavaScript for iteration."),Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files:t(6622,e.DiagnosticCategory.Message,"Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6622","Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."),Only_output_d_ts_files_and_not_JavaScript_files:t(6623,e.DiagnosticCategory.Message,"Only_output_d_ts_files_and_not_JavaScript_files_6623","Only output d.ts files and not JavaScript files."),Emit_design_type_metadata_for_decorated_declarations_in_source_files:t(6624,e.DiagnosticCategory.Message,"Emit_design_type_metadata_for_decorated_declarations_in_source_files_6624","Emit design-type metadata for decorated declarations in source files."),Disable_the_type_acquisition_for_JavaScript_projects:t(6625,e.DiagnosticCategory.Message,"Disable_the_type_acquisition_for_JavaScript_projects_6625","Disable the type acquisition for JavaScript projects"),Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility:t(6626,e.DiagnosticCategory.Message,"Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheti_6626","Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility."),Filters_results_from_the_include_option:t(6627,e.DiagnosticCategory.Message,"Filters_results_from_the_include_option_6627","Filters results from the `include` option."),Remove_a_list_of_directories_from_the_watch_process:t(6628,e.DiagnosticCategory.Message,"Remove_a_list_of_directories_from_the_watch_process_6628","Remove a list of directories from the watch process."),Remove_a_list_of_files_from_the_watch_mode_s_processing:t(6629,e.DiagnosticCategory.Message,"Remove_a_list_of_files_from_the_watch_mode_s_processing_6629","Remove a list of files from the watch mode's processing."),Enable_experimental_support_for_TC39_stage_2_draft_decorators:t(6630,e.DiagnosticCategory.Message,"Enable_experimental_support_for_TC39_stage_2_draft_decorators_6630","Enable experimental support for TC39 stage 2 draft decorators."),Print_files_read_during_the_compilation_including_why_it_was_included:t(6631,e.DiagnosticCategory.Message,"Print_files_read_during_the_compilation_including_why_it_was_included_6631","Print files read during the compilation including why it was included."),Output_more_detailed_compiler_performance_information_after_building:t(6632,e.DiagnosticCategory.Message,"Output_more_detailed_compiler_performance_information_after_building_6632","Output more detailed compiler performance information after building."),Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_are_inherited:t(6633,e.DiagnosticCategory.Message,"Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_a_6633","Specify one or more path or node module references to base configuration files from which settings are inherited."),Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers:t(6634,e.DiagnosticCategory.Message,"Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers_6634","Specify what approach the watcher should use if the system runs out of native file watchers."),Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include:t(6635,e.DiagnosticCategory.Message,"Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include_6635","Include a list of files. This does not support glob patterns, as opposed to `include`."),Build_all_projects_including_those_that_appear_to_be_up_to_date:t(6636,e.DiagnosticCategory.Message,"Build_all_projects_including_those_that_appear_to_be_up_to_date_6636","Build all projects, including those that appear to be up to date."),Ensure_that_casing_is_correct_in_imports:t(6637,e.DiagnosticCategory.Message,"Ensure_that_casing_is_correct_in_imports_6637","Ensure that casing is correct in imports."),Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging:t(6638,e.DiagnosticCategory.Message,"Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging_6638","Emit a v8 CPU profile of the compiler run for debugging."),Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file:t(6639,e.DiagnosticCategory.Message,"Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file_6639","Allow importing helper functions from tslib once per project, instead of including them per-file."),Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation:t(6641,e.DiagnosticCategory.Message,"Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation_6641","Specify a list of glob patterns that match files to be included in compilation."),Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects:t(6642,e.DiagnosticCategory.Message,"Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642","Save .tsbuildinfo files to allow for incremental compilation of projects."),Include_sourcemap_files_inside_the_emitted_JavaScript:t(6643,e.DiagnosticCategory.Message,"Include_sourcemap_files_inside_the_emitted_JavaScript_6643","Include sourcemap files inside the emitted JavaScript."),Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript:t(6644,e.DiagnosticCategory.Message,"Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript_6644","Include source code in the sourcemaps inside the emitted JavaScript."),Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports:t(6645,e.DiagnosticCategory.Message,"Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports_6645","Ensure that each file can be safely transpiled without relying on other imports."),Specify_what_JSX_code_is_generated:t(6646,e.DiagnosticCategory.Message,"Specify_what_JSX_code_is_generated_6646","Specify what JSX code is generated."),Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h:t(6647,e.DiagnosticCategory.Message,"Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h_6647","Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'."),Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment:t(6648,e.DiagnosticCategory.Message,"Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragme_6648","Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'."),Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk:t(6649,e.DiagnosticCategory.Message,"Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Ast_6649","Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'."),Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option:t(6650,e.DiagnosticCategory.Message,"Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650","Make keyof only return strings instead of string, numbers or symbols. Legacy option."),Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment:t(6651,e.DiagnosticCategory.Message,"Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment_6651","Specify a set of bundled library declaration files that describe the target runtime environment."),Print_the_names_of_emitted_files_after_a_compilation:t(6652,e.DiagnosticCategory.Message,"Print_the_names_of_emitted_files_after_a_compilation_6652","Print the names of emitted files after a compilation."),Print_all_of_the_files_read_during_the_compilation:t(6653,e.DiagnosticCategory.Message,"Print_all_of_the_files_read_during_the_compilation_6653","Print all of the files read during the compilation."),Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit:t(6654,e.DiagnosticCategory.Message,"Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit_6654","Set the language of the messaging from TypeScript. This does not affect emit."),Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations:t(6655,e.DiagnosticCategory.Message,"Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6655","Specify the location where debugger should locate map files instead of generated locations."),Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs:t(6656,e.DiagnosticCategory.Message,"Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicabl_6656","Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'."),Specify_what_module_code_is_generated:t(6657,e.DiagnosticCategory.Message,"Specify_what_module_code_is_generated_6657","Specify what module code is generated."),Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier:t(6658,e.DiagnosticCategory.Message,"Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier_6658","Specify how TypeScript looks up a file from a given module specifier."),Set_the_newline_character_for_emitting_files:t(6659,e.DiagnosticCategory.Message,"Set_the_newline_character_for_emitting_files_6659","Set the newline character for emitting files."),Disable_emitting_files_from_a_compilation:t(6660,e.DiagnosticCategory.Message,"Disable_emitting_files_from_a_compilation_6660","Disable emitting files from a compilation."),Disable_generating_custom_helper_functions_like_extends_in_compiled_output:t(6661,e.DiagnosticCategory.Message,"Disable_generating_custom_helper_functions_like_extends_in_compiled_output_6661","Disable generating custom helper functions like '__extends' in compiled output."),Disable_emitting_files_if_any_type_checking_errors_are_reported:t(6662,e.DiagnosticCategory.Message,"Disable_emitting_files_if_any_type_checking_errors_are_reported_6662","Disable emitting files if any type checking errors are reported."),Disable_truncating_types_in_error_messages:t(6663,e.DiagnosticCategory.Message,"Disable_truncating_types_in_error_messages_6663","Disable truncating types in error messages."),Enable_error_reporting_for_fallthrough_cases_in_switch_statements:t(6664,e.DiagnosticCategory.Message,"Enable_error_reporting_for_fallthrough_cases_in_switch_statements_6664","Enable error reporting for fallthrough cases in switch statements."),Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type:t(6665,e.DiagnosticCategory.Message,"Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type_6665","Enable error reporting for expressions and declarations with an implied 'any' type."),Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier:t(6666,e.DiagnosticCategory.Message,"Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier_6666","Ensure overriding members in derived classes are marked with an override modifier."),Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function:t(6667,e.DiagnosticCategory.Message,"Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function_6667","Enable error reporting for codepaths that do not explicitly return in a function."),Enable_error_reporting_when_this_is_given_the_type_any:t(6668,e.DiagnosticCategory.Message,"Enable_error_reporting_when_this_is_given_the_type_any_6668","Enable error reporting when 'this' is given the type 'any'."),Disable_adding_use_strict_directives_in_emitted_JavaScript_files:t(6669,e.DiagnosticCategory.Message,"Disable_adding_use_strict_directives_in_emitted_JavaScript_files_6669","Disable adding 'use strict' directives in emitted JavaScript files."),Disable_including_any_library_files_including_the_default_lib_d_ts:t(6670,e.DiagnosticCategory.Message,"Disable_including_any_library_files_including_the_default_lib_d_ts_6670","Disable including any library files, including the default lib.d.ts."),Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type:t(6671,e.DiagnosticCategory.Message,"Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type_6671","Enforces using indexed accessors for keys declared using an indexed type."),Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project:t(6672,e.DiagnosticCategory.Message,"Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add__6672","Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project."),Disable_strict_checking_of_generic_signatures_in_function_types:t(6673,e.DiagnosticCategory.Message,"Disable_strict_checking_of_generic_signatures_in_function_types_6673","Disable strict checking of generic signatures in function types."),Add_undefined_to_a_type_when_accessed_using_an_index:t(6674,e.DiagnosticCategory.Message,"Add_undefined_to_a_type_when_accessed_using_an_index_6674","Add 'undefined' to a type when accessed using an index."),Enable_error_reporting_when_local_variables_aren_t_read:t(6675,e.DiagnosticCategory.Message,"Enable_error_reporting_when_local_variables_aren_t_read_6675","Enable error reporting when local variables aren't read."),Raise_an_error_when_a_function_parameter_isn_t_read:t(6676,e.DiagnosticCategory.Message,"Raise_an_error_when_a_function_parameter_isn_t_read_6676","Raise an error when a function parameter isn't read."),Deprecated_setting_Use_outFile_instead:t(6677,e.DiagnosticCategory.Message,"Deprecated_setting_Use_outFile_instead_6677","Deprecated setting. Use 'outFile' instead."),Specify_an_output_folder_for_all_emitted_files:t(6678,e.DiagnosticCategory.Message,"Specify_an_output_folder_for_all_emitted_files_6678","Specify an output folder for all emitted files."),Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output:t(6679,e.DiagnosticCategory.Message,"Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designa_6679","Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output."),Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations:t(6680,e.DiagnosticCategory.Message,"Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations_6680","Specify a set of entries that re-map imports to additional lookup locations."),Specify_a_list_of_language_service_plugins_to_include:t(6681,e.DiagnosticCategory.Message,"Specify_a_list_of_language_service_plugins_to_include_6681","Specify a list of language service plugins to include."),Disable_erasing_const_enum_declarations_in_generated_code:t(6682,e.DiagnosticCategory.Message,"Disable_erasing_const_enum_declarations_in_generated_code_6682","Disable erasing 'const enum' declarations in generated code."),Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node:t(6683,e.DiagnosticCategory.Message,"Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node_6683","Disable resolving symlinks to their realpath. This correlates to the same flag in node."),Disable_wiping_the_console_in_watch_mode:t(6684,e.DiagnosticCategory.Message,"Disable_wiping_the_console_in_watch_mode_6684","Disable wiping the console in watch mode."),Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read:t(6685,e.DiagnosticCategory.Message,"Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read_6685","Enable color and formatting in TypeScript's output to make compiler errors easier to read."),Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit:t(6686,e.DiagnosticCategory.Message,"Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit_6686","Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit."),Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references:t(6687,e.DiagnosticCategory.Message,"Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references_6687","Specify an array of objects that specify paths for projects. Used in project references."),Disable_emitting_comments:t(6688,e.DiagnosticCategory.Message,"Disable_emitting_comments_6688","Disable emitting comments."),Enable_importing_json_files:t(6689,e.DiagnosticCategory.Message,"Enable_importing_json_files_6689","Enable importing .json files."),Specify_the_root_folder_within_your_source_files:t(6690,e.DiagnosticCategory.Message,"Specify_the_root_folder_within_your_source_files_6690","Specify the root folder within your source files."),Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules:t(6691,e.DiagnosticCategory.Message,"Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules_6691","Allow multiple folders to be treated as one when resolving modules."),Skip_type_checking_d_ts_files_that_are_included_with_TypeScript:t(6692,e.DiagnosticCategory.Message,"Skip_type_checking_d_ts_files_that_are_included_with_TypeScript_6692","Skip type checking .d.ts files that are included with TypeScript."),Skip_type_checking_all_d_ts_files:t(6693,e.DiagnosticCategory.Message,"Skip_type_checking_all_d_ts_files_6693","Skip type checking all .d.ts files."),Create_source_map_files_for_emitted_JavaScript_files:t(6694,e.DiagnosticCategory.Message,"Create_source_map_files_for_emitted_JavaScript_files_6694","Create source map files for emitted JavaScript files."),Specify_the_root_path_for_debuggers_to_find_the_reference_source_code:t(6695,e.DiagnosticCategory.Message,"Specify_the_root_path_for_debuggers_to_find_the_reference_source_code_6695","Specify the root path for debuggers to find the reference source code."),Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function:t(6697,e.DiagnosticCategory.Message,"Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function_6697","Check that the arguments for 'bind', 'call', and 'apply' methods match the original function."),When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible:t(6698,e.DiagnosticCategory.Message,"When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible_6698","When assigning functions, check to ensure parameters and the return values are subtype-compatible."),When_type_checking_take_into_account_null_and_undefined:t(6699,e.DiagnosticCategory.Message,"When_type_checking_take_into_account_null_and_undefined_6699","When type checking, take into account 'null' and 'undefined'."),Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor:t(6700,e.DiagnosticCategory.Message,"Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor_6700","Check for class properties that are declared but not set in the constructor."),Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments:t(6701,e.DiagnosticCategory.Message,"Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments_6701","Disable emitting declarations that have '@internal' in their JSDoc comments."),Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals:t(6702,e.DiagnosticCategory.Message,"Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals_6702","Disable reporting of excess property errors during the creation of object literals."),Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures:t(6703,e.DiagnosticCategory.Message,"Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures_6703","Suppress 'noImplicitAny' errors when indexing objects that lack index signatures."),Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively:t(6704,e.DiagnosticCategory.Message,"Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_supp_6704","Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively."),Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations:t(6705,e.DiagnosticCategory.Message,"Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declaratio_6705","Set the JavaScript language version for emitted JavaScript and include compatible library declarations."),Log_paths_used_during_the_moduleResolution_process:t(6706,e.DiagnosticCategory.Message,"Log_paths_used_during_the_moduleResolution_process_6706","Log paths used during the 'moduleResolution' process."),Specify_the_path_to_tsbuildinfo_incremental_compilation_file:t(6707,e.DiagnosticCategory.Message,"Specify_the_path_to_tsbuildinfo_incremental_compilation_file_6707","Specify the path to .tsbuildinfo incremental compilation file."),Specify_options_for_automatic_acquisition_of_declaration_files:t(6709,e.DiagnosticCategory.Message,"Specify_options_for_automatic_acquisition_of_declaration_files_6709","Specify options for automatic acquisition of declaration files."),Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types:t(6710,e.DiagnosticCategory.Message,"Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types_6710","Specify multiple folders that act like './node_modules/@types'."),Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file:t(6711,e.DiagnosticCategory.Message,"Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file_6711","Specify type package names to be included without being referenced in a source file."),Emit_ECMAScript_standard_compliant_class_fields:t(6712,e.DiagnosticCategory.Message,"Emit_ECMAScript_standard_compliant_class_fields_6712","Emit ECMAScript-standard-compliant class fields."),Enable_verbose_logging:t(6713,e.DiagnosticCategory.Message,"Enable_verbose_logging_6713","Enable verbose logging."),Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality:t(6714,e.DiagnosticCategory.Message,"Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality_6714","Specify how directories are watched on systems that lack recursive file-watching functionality."),Specify_how_the_TypeScript_watch_mode_works:t(6715,e.DiagnosticCategory.Message,"Specify_how_the_TypeScript_watch_mode_works_6715","Specify how the TypeScript watch mode works."),Require_undeclared_properties_from_index_signatures_to_use_element_accesses:t(6717,e.DiagnosticCategory.Message,"Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717","Require undeclared properties from index signatures to use element accesses."),Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types:t(6718,e.DiagnosticCategory.Message,"Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718","Specify emit/checking behavior for imports that are only used for types."),Default_catch_clause_variables_as_unknown_instead_of_any:t(6803,e.DiagnosticCategory.Message,"Default_catch_clause_variables_as_unknown_instead_of_any_6803","Default catch clause variables as 'unknown' instead of 'any'."),one_of_Colon:t(6900,e.DiagnosticCategory.Message,"one_of_Colon_6900","one of:"),one_or_more_Colon:t(6901,e.DiagnosticCategory.Message,"one_or_more_Colon_6901","one or more:"),type_Colon:t(6902,e.DiagnosticCategory.Message,"type_Colon_6902","type:"),default_Colon:t(6903,e.DiagnosticCategory.Message,"default_Colon_6903","default:"),module_system_or_esModuleInterop:t(6904,e.DiagnosticCategory.Message,"module_system_or_esModuleInterop_6904",'module === "system" or esModuleInterop'),false_unless_strict_is_set:t(6905,e.DiagnosticCategory.Message,"false_unless_strict_is_set_6905","`false`, unless `strict` is set"),false_unless_composite_is_set:t(6906,e.DiagnosticCategory.Message,"false_unless_composite_is_set_6906","`false`, unless `composite` is set"),node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified:t(6907,e.DiagnosticCategory.Message,"node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified_6907",'`["node_modules", "bower_components", "jspm_packages"]`, plus the value of `outDir` if one is specified.'),if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk:t(6908,e.DiagnosticCategory.Message,"if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk_6908",'`[]` if `files` is specified, otherwise `["**/*"]`'),true_if_composite_false_otherwise:t(6909,e.DiagnosticCategory.Message,"true_if_composite_false_otherwise_6909","`true` if `composite`, `false` otherwise"),module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node:t(69010,e.DiagnosticCategory.Message,"module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node_69010","module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`"),Computed_from_the_list_of_input_files:t(6911,e.DiagnosticCategory.Message,"Computed_from_the_list_of_input_files_6911","Computed from the list of input files"),Platform_specific:t(6912,e.DiagnosticCategory.Message,"Platform_specific_6912","Platform specific"),You_can_learn_about_all_of_the_compiler_options_at_0:t(6913,e.DiagnosticCategory.Message,"You_can_learn_about_all_of_the_compiler_options_at_0_6913","You can learn about all of the compiler options at {0}"),Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon:t(6914,e.DiagnosticCategory.Message,"Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_conf_6914","Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:"),Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0:t(6915,e.DiagnosticCategory.Message,"Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915","Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at {0}"),COMMON_COMMANDS:t(6916,e.DiagnosticCategory.Message,"COMMON_COMMANDS_6916","COMMON COMMANDS"),ALL_COMPILER_OPTIONS:t(6917,e.DiagnosticCategory.Message,"ALL_COMPILER_OPTIONS_6917","ALL COMPILER OPTIONS"),WATCH_OPTIONS:t(6918,e.DiagnosticCategory.Message,"WATCH_OPTIONS_6918","WATCH OPTIONS"),BUILD_OPTIONS:t(6919,e.DiagnosticCategory.Message,"BUILD_OPTIONS_6919","BUILD OPTIONS"),COMMON_COMPILER_OPTIONS:t(6920,e.DiagnosticCategory.Message,"COMMON_COMPILER_OPTIONS_6920","COMMON COMPILER OPTIONS"),COMMAND_LINE_FLAGS:t(6921,e.DiagnosticCategory.Message,"COMMAND_LINE_FLAGS_6921","COMMAND LINE FLAGS"),tsc_Colon_The_TypeScript_Compiler:t(6922,e.DiagnosticCategory.Message,"tsc_Colon_The_TypeScript_Compiler_6922","tsc: The TypeScript Compiler"),Compiles_the_current_project_tsconfig_json_in_the_working_directory:t(6923,e.DiagnosticCategory.Message,"Compiles_the_current_project_tsconfig_json_in_the_working_directory_6923","Compiles the current project (tsconfig.json in the working directory.)"),Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options:t(6924,e.DiagnosticCategory.Message,"Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options_6924","Ignoring tsconfig.json, compiles the specified files with default compiler options."),Build_a_composite_project_in_the_working_directory:t(6925,e.DiagnosticCategory.Message,"Build_a_composite_project_in_the_working_directory_6925","Build a composite project in the working directory."),Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory:t(6926,e.DiagnosticCategory.Message,"Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory_6926","Creates a tsconfig.json with the recommended settings in the working directory."),Compiles_the_TypeScript_project_located_at_the_specified_path:t(6927,e.DiagnosticCategory.Message,"Compiles_the_TypeScript_project_located_at_the_specified_path_6927","Compiles the TypeScript project located at the specified path."),An_expanded_version_of_this_information_showing_all_possible_compiler_options:t(6928,e.DiagnosticCategory.Message,"An_expanded_version_of_this_information_showing_all_possible_compiler_options_6928","An expanded version of this information, showing all possible compiler options"),Compiles_the_current_project_with_additional_settings:t(6929,e.DiagnosticCategory.Message,"Compiles_the_current_project_with_additional_settings_6929","Compiles the current project, with additional settings."),true_for_ES2022_and_above_including_ESNext:t(6930,e.DiagnosticCategory.Message,"true_for_ES2022_and_above_including_ESNext_6930","`true` for ES2022 and above, including ESNext."),List_of_file_name_suffixes_to_search_when_resolving_a_module:t(6931,e.DiagnosticCategory.Error,"List_of_file_name_suffixes_to_search_when_resolving_a_module_6931","List of file name suffixes to search when resolving a module."),Variable_0_implicitly_has_an_1_type:t(7005,e.DiagnosticCategory.Error,"Variable_0_implicitly_has_an_1_type_7005","Variable '{0}' implicitly has an '{1}' type."),Parameter_0_implicitly_has_an_1_type:t(7006,e.DiagnosticCategory.Error,"Parameter_0_implicitly_has_an_1_type_7006","Parameter '{0}' implicitly has an '{1}' type."),Member_0_implicitly_has_an_1_type:t(7008,e.DiagnosticCategory.Error,"Member_0_implicitly_has_an_1_type_7008","Member '{0}' implicitly has an '{1}' type."),new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type:t(7009,e.DiagnosticCategory.Error,"new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009","'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type:t(7010,e.DiagnosticCategory.Error,"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010","'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type:t(7011,e.DiagnosticCategory.Error,"Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011","Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type:t(7013,e.DiagnosticCategory.Error,"Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013","Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type:t(7014,e.DiagnosticCategory.Error,"Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014","Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number:t(7015,e.DiagnosticCategory.Error,"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015","Element implicitly has an 'any' type because index expression is not of type 'number'."),Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type:t(7016,e.DiagnosticCategory.Error,"Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016","Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type."),Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature:t(7017,e.DiagnosticCategory.Error,"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017","Element implicitly has an 'any' type because type '{0}' has no index signature."),Object_literal_s_property_0_implicitly_has_an_1_type:t(7018,e.DiagnosticCategory.Error,"Object_literal_s_property_0_implicitly_has_an_1_type_7018","Object literal's property '{0}' implicitly has an '{1}' type."),Rest_parameter_0_implicitly_has_an_any_type:t(7019,e.DiagnosticCategory.Error,"Rest_parameter_0_implicitly_has_an_any_type_7019","Rest parameter '{0}' implicitly has an 'any[]' type."),Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type:t(7020,e.DiagnosticCategory.Error,"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020","Call signature, which lacks return-type annotation, implicitly has an 'any' return type."),_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer:t(7022,e.DiagnosticCategory.Error,"_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022","'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."),_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions:t(7023,e.DiagnosticCategory.Error,"_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023","'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."),Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions:t(7024,e.DiagnosticCategory.Error,"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024","Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."),Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation:t(7025,e.DiagnosticCategory.Error,"Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_retu_7025","Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation."),JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists:t(7026,e.DiagnosticCategory.Error,"JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026","JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."),Unreachable_code_detected:t(7027,e.DiagnosticCategory.Error,"Unreachable_code_detected_7027","Unreachable code detected.",!0),Unused_label:t(7028,e.DiagnosticCategory.Error,"Unused_label_7028","Unused label.",!0),Fallthrough_case_in_switch:t(7029,e.DiagnosticCategory.Error,"Fallthrough_case_in_switch_7029","Fallthrough case in switch."),Not_all_code_paths_return_a_value:t(7030,e.DiagnosticCategory.Error,"Not_all_code_paths_return_a_value_7030","Not all code paths return a value."),Binding_element_0_implicitly_has_an_1_type:t(7031,e.DiagnosticCategory.Error,"Binding_element_0_implicitly_has_an_1_type_7031","Binding element '{0}' implicitly has an '{1}' type."),Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation:t(7032,e.DiagnosticCategory.Error,"Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032","Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation."),Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation:t(7033,e.DiagnosticCategory.Error,"Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033","Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation."),Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined:t(7034,e.DiagnosticCategory.Error,"Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034","Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined."),Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0:t(7035,e.DiagnosticCategory.Error,"Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare__7035","Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"),Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0:t(7036,e.DiagnosticCategory.Error,"Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036","Dynamic import's specifier must be of type 'string', but here has type '{0}'."),Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports:t(7037,e.DiagnosticCategory.Message,"Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037","Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."),Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead:t(7038,e.DiagnosticCategory.Message,"Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038","Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead."),Mapped_object_type_implicitly_has_an_any_template_type:t(7039,e.DiagnosticCategory.Error,"Mapped_object_type_implicitly_has_an_any_template_type_7039","Mapped object type implicitly has an 'any' template type."),If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1:t(7040,e.DiagnosticCategory.Error,"If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_S_7040","If the '{0}' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/{1}'"),The_containing_arrow_function_captures_the_global_value_of_this:t(7041,e.DiagnosticCategory.Error,"The_containing_arrow_function_captures_the_global_value_of_this_7041","The containing arrow function captures the global value of 'this'."),Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used:t(7042,e.DiagnosticCategory.Error,"Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used_7042","Module '{0}' was resolved to '{1}', but '--resolveJsonModule' is not used."),Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage:t(7043,e.DiagnosticCategory.Suggestion,"Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7043","Variable '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage:t(7044,e.DiagnosticCategory.Suggestion,"Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7044","Parameter '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage:t(7045,e.DiagnosticCategory.Suggestion,"Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7045","Member '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage:t(7046,e.DiagnosticCategory.Suggestion,"Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage_7046","Variable '{0}' implicitly has type '{1}' in some locations, but a better type may be inferred from usage."),Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage:t(7047,e.DiagnosticCategory.Suggestion,"Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage_7047","Rest parameter '{0}' implicitly has an 'any[]' type, but a better type may be inferred from usage."),Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage:t(7048,e.DiagnosticCategory.Suggestion,"Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage_7048","Property '{0}' implicitly has type 'any', but a better type for its get accessor may be inferred from usage."),Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage:t(7049,e.DiagnosticCategory.Suggestion,"Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049","Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage:t(7050,e.DiagnosticCategory.Suggestion,"_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050","'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1:t(7051,e.DiagnosticCategory.Error,"Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051","Parameter has a name but no type. Did you mean '{0}: {1}'?"),Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1:t(7052,e.DiagnosticCategory.Error,"Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052","Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?"),Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1:t(7053,e.DiagnosticCategory.Error,"Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053","Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1:t(7054,e.DiagnosticCategory.Error,"No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054","No index signature with a parameter of type '{0}' was found on type '{1}'."),_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type:t(7055,e.DiagnosticCategory.Error,"_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055","'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type."),The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed:t(7056,e.DiagnosticCategory.Error,"The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056","The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."),yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation:t(7057,e.DiagnosticCategory.Error,"yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057","'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."),If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1:t(7058,e.DiagnosticCategory.Error,"If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058","If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"),This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead:t(7059,e.DiagnosticCategory.Error,"This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059","This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint:t(7060,e.DiagnosticCategory.Error,"This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060","This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),A_mapped_type_may_not_declare_properties_or_methods:t(7061,e.DiagnosticCategory.Error,"A_mapped_type_may_not_declare_properties_or_methods_7061","A mapped type may not declare properties or methods."),You_cannot_rename_this_element:t(8e3,e.DiagnosticCategory.Error,"You_cannot_rename_this_element_8000","You cannot rename this element."),You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library:t(8001,e.DiagnosticCategory.Error,"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001","You cannot rename elements that are defined in the standard TypeScript library."),import_can_only_be_used_in_TypeScript_files:t(8002,e.DiagnosticCategory.Error,"import_can_only_be_used_in_TypeScript_files_8002","'import ... =' can only be used in TypeScript files."),export_can_only_be_used_in_TypeScript_files:t(8003,e.DiagnosticCategory.Error,"export_can_only_be_used_in_TypeScript_files_8003","'export =' can only be used in TypeScript files."),Type_parameter_declarations_can_only_be_used_in_TypeScript_files:t(8004,e.DiagnosticCategory.Error,"Type_parameter_declarations_can_only_be_used_in_TypeScript_files_8004","Type parameter declarations can only be used in TypeScript files."),implements_clauses_can_only_be_used_in_TypeScript_files:t(8005,e.DiagnosticCategory.Error,"implements_clauses_can_only_be_used_in_TypeScript_files_8005","'implements' clauses can only be used in TypeScript files."),_0_declarations_can_only_be_used_in_TypeScript_files:t(8006,e.DiagnosticCategory.Error,"_0_declarations_can_only_be_used_in_TypeScript_files_8006","'{0}' declarations can only be used in TypeScript files."),Type_aliases_can_only_be_used_in_TypeScript_files:t(8008,e.DiagnosticCategory.Error,"Type_aliases_can_only_be_used_in_TypeScript_files_8008","Type aliases can only be used in TypeScript files."),The_0_modifier_can_only_be_used_in_TypeScript_files:t(8009,e.DiagnosticCategory.Error,"The_0_modifier_can_only_be_used_in_TypeScript_files_8009","The '{0}' modifier can only be used in TypeScript files."),Type_annotations_can_only_be_used_in_TypeScript_files:t(8010,e.DiagnosticCategory.Error,"Type_annotations_can_only_be_used_in_TypeScript_files_8010","Type annotations can only be used in TypeScript files."),Type_arguments_can_only_be_used_in_TypeScript_files:t(8011,e.DiagnosticCategory.Error,"Type_arguments_can_only_be_used_in_TypeScript_files_8011","Type arguments can only be used in TypeScript files."),Parameter_modifiers_can_only_be_used_in_TypeScript_files:t(8012,e.DiagnosticCategory.Error,"Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012","Parameter modifiers can only be used in TypeScript files."),Non_null_assertions_can_only_be_used_in_TypeScript_files:t(8013,e.DiagnosticCategory.Error,"Non_null_assertions_can_only_be_used_in_TypeScript_files_8013","Non-null assertions can only be used in TypeScript files."),Type_assertion_expressions_can_only_be_used_in_TypeScript_files:t(8016,e.DiagnosticCategory.Error,"Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016","Type assertion expressions can only be used in TypeScript files."),Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0:t(8017,e.DiagnosticCategory.Error,"Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017","Octal literal types must use ES2015 syntax. Use the syntax '{0}'."),Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0:t(8018,e.DiagnosticCategory.Error,"Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018","Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."),Report_errors_in_js_files:t(8019,e.DiagnosticCategory.Message,"Report_errors_in_js_files_8019","Report errors in .js files."),JSDoc_types_can_only_be_used_inside_documentation_comments:t(8020,e.DiagnosticCategory.Error,"JSDoc_types_can_only_be_used_inside_documentation_comments_8020","JSDoc types can only be used inside documentation comments."),JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags:t(8021,e.DiagnosticCategory.Error,"JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021","JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."),JSDoc_0_is_not_attached_to_a_class:t(8022,e.DiagnosticCategory.Error,"JSDoc_0_is_not_attached_to_a_class_8022","JSDoc '@{0}' is not attached to a class."),JSDoc_0_1_does_not_match_the_extends_2_clause:t(8023,e.DiagnosticCategory.Error,"JSDoc_0_1_does_not_match_the_extends_2_clause_8023","JSDoc '@{0} {1}' does not match the 'extends {2}' clause."),JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name:t(8024,e.DiagnosticCategory.Error,"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024","JSDoc '@param' tag has name '{0}', but there is no parameter with that name."),Class_declarations_cannot_have_more_than_one_augments_or_extends_tag:t(8025,e.DiagnosticCategory.Error,"Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025","Class declarations cannot have more than one '@augments' or '@extends' tag."),Expected_0_type_arguments_provide_these_with_an_extends_tag:t(8026,e.DiagnosticCategory.Error,"Expected_0_type_arguments_provide_these_with_an_extends_tag_8026","Expected {0} type arguments; provide these with an '@extends' tag."),Expected_0_1_type_arguments_provide_these_with_an_extends_tag:t(8027,e.DiagnosticCategory.Error,"Expected_0_1_type_arguments_provide_these_with_an_extends_tag_8027","Expected {0}-{1} type arguments; provide these with an '@extends' tag."),JSDoc_may_only_appear_in_the_last_parameter_of_a_signature:t(8028,e.DiagnosticCategory.Error,"JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028","JSDoc '...' may only appear in the last parameter of a signature."),JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type:t(8029,e.DiagnosticCategory.Error,"JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029","JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type."),The_type_of_a_function_declaration_must_match_the_function_s_signature:t(8030,e.DiagnosticCategory.Error,"The_type_of_a_function_declaration_must_match_the_function_s_signature_8030","The type of a function declaration must match the function's signature."),You_cannot_rename_a_module_via_a_global_import:t(8031,e.DiagnosticCategory.Error,"You_cannot_rename_a_module_via_a_global_import_8031","You cannot rename a module via a global import."),Qualified_name_0_is_not_allowed_without_a_leading_param_object_1:t(8032,e.DiagnosticCategory.Error,"Qualified_name_0_is_not_allowed_without_a_leading_param_object_1_8032","Qualified name '{0}' is not allowed without a leading '@param {object} {1}'."),A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags:t(8033,e.DiagnosticCategory.Error,"A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033","A JSDoc '@typedef' comment may not contain multiple '@type' tags."),The_tag_was_first_specified_here:t(8034,e.DiagnosticCategory.Error,"The_tag_was_first_specified_here_8034","The tag was first specified here."),Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit:t(9005,e.DiagnosticCategory.Error,"Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005","Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit:t(9006,e.DiagnosticCategory.Error,"Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006","Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),JSX_attributes_must_only_be_assigned_a_non_empty_expression:t(17e3,e.DiagnosticCategory.Error,"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000","JSX attributes must only be assigned a non-empty 'expression'."),JSX_elements_cannot_have_multiple_attributes_with_the_same_name:t(17001,e.DiagnosticCategory.Error,"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001","JSX elements cannot have multiple attributes with the same name."),Expected_corresponding_JSX_closing_tag_for_0:t(17002,e.DiagnosticCategory.Error,"Expected_corresponding_JSX_closing_tag_for_0_17002","Expected corresponding JSX closing tag for '{0}'."),Cannot_use_JSX_unless_the_jsx_flag_is_provided:t(17004,e.DiagnosticCategory.Error,"Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004","Cannot use JSX unless the '--jsx' flag is provided."),A_constructor_cannot_contain_a_super_call_when_its_class_extends_null:t(17005,e.DiagnosticCategory.Error,"A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005","A constructor cannot contain a 'super' call when its class extends 'null'."),An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses:t(17006,e.DiagnosticCategory.Error,"An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006","An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."),A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses:t(17007,e.DiagnosticCategory.Error,"A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007","A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."),JSX_element_0_has_no_corresponding_closing_tag:t(17008,e.DiagnosticCategory.Error,"JSX_element_0_has_no_corresponding_closing_tag_17008","JSX element '{0}' has no corresponding closing tag."),super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class:t(17009,e.DiagnosticCategory.Error,"super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009","'super' must be called before accessing 'this' in the constructor of a derived class."),Unknown_type_acquisition_option_0:t(17010,e.DiagnosticCategory.Error,"Unknown_type_acquisition_option_0_17010","Unknown type acquisition option '{0}'."),super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class:t(17011,e.DiagnosticCategory.Error,"super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011","'super' must be called before accessing a property of 'super' in the constructor of a derived class."),_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2:t(17012,e.DiagnosticCategory.Error,"_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012","'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"),Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor:t(17013,e.DiagnosticCategory.Error,"Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013","Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."),JSX_fragment_has_no_corresponding_closing_tag:t(17014,e.DiagnosticCategory.Error,"JSX_fragment_has_no_corresponding_closing_tag_17014","JSX fragment has no corresponding closing tag."),Expected_corresponding_closing_tag_for_JSX_fragment:t(17015,e.DiagnosticCategory.Error,"Expected_corresponding_closing_tag_for_JSX_fragment_17015","Expected corresponding closing tag for JSX fragment."),The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option:t(17016,e.DiagnosticCategory.Error,"The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016","The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments:t(17017,e.DiagnosticCategory.Error,"An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017","An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),Unknown_type_acquisition_option_0_Did_you_mean_1:t(17018,e.DiagnosticCategory.Error,"Unknown_type_acquisition_option_0_Did_you_mean_1_17018","Unknown type acquisition option '{0}'. Did you mean '{1}'?"),Circularity_detected_while_resolving_configuration_Colon_0:t(18e3,e.DiagnosticCategory.Error,"Circularity_detected_while_resolving_configuration_Colon_0_18000","Circularity detected while resolving configuration: {0}"),The_files_list_in_config_file_0_is_empty:t(18002,e.DiagnosticCategory.Error,"The_files_list_in_config_file_0_is_empty_18002","The 'files' list in config file '{0}' is empty."),No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2:t(18003,e.DiagnosticCategory.Error,"No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003","No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module:t(80001,e.DiagnosticCategory.Suggestion,"File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001","File is a CommonJS module; it may be converted to an ES module."),This_constructor_function_may_be_converted_to_a_class_declaration:t(80002,e.DiagnosticCategory.Suggestion,"This_constructor_function_may_be_converted_to_a_class_declaration_80002","This constructor function may be converted to a class declaration."),Import_may_be_converted_to_a_default_import:t(80003,e.DiagnosticCategory.Suggestion,"Import_may_be_converted_to_a_default_import_80003","Import may be converted to a default import."),JSDoc_types_may_be_moved_to_TypeScript_types:t(80004,e.DiagnosticCategory.Suggestion,"JSDoc_types_may_be_moved_to_TypeScript_types_80004","JSDoc types may be moved to TypeScript types."),require_call_may_be_converted_to_an_import:t(80005,e.DiagnosticCategory.Suggestion,"require_call_may_be_converted_to_an_import_80005","'require' call may be converted to an import."),This_may_be_converted_to_an_async_function:t(80006,e.DiagnosticCategory.Suggestion,"This_may_be_converted_to_an_async_function_80006","This may be converted to an async function."),await_has_no_effect_on_the_type_of_this_expression:t(80007,e.DiagnosticCategory.Suggestion,"await_has_no_effect_on_the_type_of_this_expression_80007","'await' has no effect on the type of this expression."),Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers:t(80008,e.DiagnosticCategory.Suggestion,"Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008","Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),Add_missing_super_call:t(90001,e.DiagnosticCategory.Message,"Add_missing_super_call_90001","Add missing 'super()' call"),Make_super_call_the_first_statement_in_the_constructor:t(90002,e.DiagnosticCategory.Message,"Make_super_call_the_first_statement_in_the_constructor_90002","Make 'super()' call the first statement in the constructor"),Change_extends_to_implements:t(90003,e.DiagnosticCategory.Message,"Change_extends_to_implements_90003","Change 'extends' to 'implements'"),Remove_unused_declaration_for_Colon_0:t(90004,e.DiagnosticCategory.Message,"Remove_unused_declaration_for_Colon_0_90004","Remove unused declaration for: '{0}'"),Remove_import_from_0:t(90005,e.DiagnosticCategory.Message,"Remove_import_from_0_90005","Remove import from '{0}'"),Implement_interface_0:t(90006,e.DiagnosticCategory.Message,"Implement_interface_0_90006","Implement interface '{0}'"),Implement_inherited_abstract_class:t(90007,e.DiagnosticCategory.Message,"Implement_inherited_abstract_class_90007","Implement inherited abstract class"),Add_0_to_unresolved_variable:t(90008,e.DiagnosticCategory.Message,"Add_0_to_unresolved_variable_90008","Add '{0}.' to unresolved variable"),Remove_variable_statement:t(90010,e.DiagnosticCategory.Message,"Remove_variable_statement_90010","Remove variable statement"),Remove_template_tag:t(90011,e.DiagnosticCategory.Message,"Remove_template_tag_90011","Remove template tag"),Remove_type_parameters:t(90012,e.DiagnosticCategory.Message,"Remove_type_parameters_90012","Remove type parameters"),Import_0_from_1:t(90013,e.DiagnosticCategory.Message,"Import_0_from_1_90013","Import '{0}' from \"{1}\""),Change_0_to_1:t(90014,e.DiagnosticCategory.Message,"Change_0_to_1_90014","Change '{0}' to '{1}'"),Declare_property_0:t(90016,e.DiagnosticCategory.Message,"Declare_property_0_90016","Declare property '{0}'"),Add_index_signature_for_property_0:t(90017,e.DiagnosticCategory.Message,"Add_index_signature_for_property_0_90017","Add index signature for property '{0}'"),Disable_checking_for_this_file:t(90018,e.DiagnosticCategory.Message,"Disable_checking_for_this_file_90018","Disable checking for this file"),Ignore_this_error_message:t(90019,e.DiagnosticCategory.Message,"Ignore_this_error_message_90019","Ignore this error message"),Initialize_property_0_in_the_constructor:t(90020,e.DiagnosticCategory.Message,"Initialize_property_0_in_the_constructor_90020","Initialize property '{0}' in the constructor"),Initialize_static_property_0:t(90021,e.DiagnosticCategory.Message,"Initialize_static_property_0_90021","Initialize static property '{0}'"),Change_spelling_to_0:t(90022,e.DiagnosticCategory.Message,"Change_spelling_to_0_90022","Change spelling to '{0}'"),Declare_method_0:t(90023,e.DiagnosticCategory.Message,"Declare_method_0_90023","Declare method '{0}'"),Declare_static_method_0:t(90024,e.DiagnosticCategory.Message,"Declare_static_method_0_90024","Declare static method '{0}'"),Prefix_0_with_an_underscore:t(90025,e.DiagnosticCategory.Message,"Prefix_0_with_an_underscore_90025","Prefix '{0}' with an underscore"),Rewrite_as_the_indexed_access_type_0:t(90026,e.DiagnosticCategory.Message,"Rewrite_as_the_indexed_access_type_0_90026","Rewrite as the indexed access type '{0}'"),Declare_static_property_0:t(90027,e.DiagnosticCategory.Message,"Declare_static_property_0_90027","Declare static property '{0}'"),Call_decorator_expression:t(90028,e.DiagnosticCategory.Message,"Call_decorator_expression_90028","Call decorator expression"),Add_async_modifier_to_containing_function:t(90029,e.DiagnosticCategory.Message,"Add_async_modifier_to_containing_function_90029","Add async modifier to containing function"),Replace_infer_0_with_unknown:t(90030,e.DiagnosticCategory.Message,"Replace_infer_0_with_unknown_90030","Replace 'infer {0}' with 'unknown'"),Replace_all_unused_infer_with_unknown:t(90031,e.DiagnosticCategory.Message,"Replace_all_unused_infer_with_unknown_90031","Replace all unused 'infer' with 'unknown'"),Add_parameter_name:t(90034,e.DiagnosticCategory.Message,"Add_parameter_name_90034","Add parameter name"),Declare_private_property_0:t(90035,e.DiagnosticCategory.Message,"Declare_private_property_0_90035","Declare private property '{0}'"),Replace_0_with_Promise_1:t(90036,e.DiagnosticCategory.Message,"Replace_0_with_Promise_1_90036","Replace '{0}' with 'Promise<{1}>'"),Fix_all_incorrect_return_type_of_an_async_functions:t(90037,e.DiagnosticCategory.Message,"Fix_all_incorrect_return_type_of_an_async_functions_90037","Fix all incorrect return type of an async functions"),Declare_private_method_0:t(90038,e.DiagnosticCategory.Message,"Declare_private_method_0_90038","Declare private method '{0}'"),Remove_unused_destructuring_declaration:t(90039,e.DiagnosticCategory.Message,"Remove_unused_destructuring_declaration_90039","Remove unused destructuring declaration"),Remove_unused_declarations_for_Colon_0:t(90041,e.DiagnosticCategory.Message,"Remove_unused_declarations_for_Colon_0_90041","Remove unused declarations for: '{0}'"),Declare_a_private_field_named_0:t(90053,e.DiagnosticCategory.Message,"Declare_a_private_field_named_0_90053","Declare a private field named '{0}'."),Includes_imports_of_types_referenced_by_0:t(90054,e.DiagnosticCategory.Message,"Includes_imports_of_types_referenced_by_0_90054","Includes imports of types referenced by '{0}'"),Remove_type_from_import_declaration_from_0:t(90055,e.DiagnosticCategory.Message,"Remove_type_from_import_declaration_from_0_90055","Remove 'type' from import declaration from \"{0}\""),Remove_type_from_import_of_0_from_1:t(90056,e.DiagnosticCategory.Message,"Remove_type_from_import_of_0_from_1_90056","Remove 'type' from import of '{0}' from \"{1}\""),Add_import_from_0:t(90057,e.DiagnosticCategory.Message,"Add_import_from_0_90057",'Add import from "{0}"'),Update_import_from_0:t(90058,e.DiagnosticCategory.Message,"Update_import_from_0_90058",'Update import from "{0}"'),Convert_function_to_an_ES2015_class:t(95001,e.DiagnosticCategory.Message,"Convert_function_to_an_ES2015_class_95001","Convert function to an ES2015 class"),Convert_0_to_1_in_0:t(95003,e.DiagnosticCategory.Message,"Convert_0_to_1_in_0_95003","Convert '{0}' to '{1} in {0}'"),Extract_to_0_in_1:t(95004,e.DiagnosticCategory.Message,"Extract_to_0_in_1_95004","Extract to {0} in {1}"),Extract_function:t(95005,e.DiagnosticCategory.Message,"Extract_function_95005","Extract function"),Extract_constant:t(95006,e.DiagnosticCategory.Message,"Extract_constant_95006","Extract constant"),Extract_to_0_in_enclosing_scope:t(95007,e.DiagnosticCategory.Message,"Extract_to_0_in_enclosing_scope_95007","Extract to {0} in enclosing scope"),Extract_to_0_in_1_scope:t(95008,e.DiagnosticCategory.Message,"Extract_to_0_in_1_scope_95008","Extract to {0} in {1} scope"),Annotate_with_type_from_JSDoc:t(95009,e.DiagnosticCategory.Message,"Annotate_with_type_from_JSDoc_95009","Annotate with type from JSDoc"),Infer_type_of_0_from_usage:t(95011,e.DiagnosticCategory.Message,"Infer_type_of_0_from_usage_95011","Infer type of '{0}' from usage"),Infer_parameter_types_from_usage:t(95012,e.DiagnosticCategory.Message,"Infer_parameter_types_from_usage_95012","Infer parameter types from usage"),Convert_to_default_import:t(95013,e.DiagnosticCategory.Message,"Convert_to_default_import_95013","Convert to default import"),Install_0:t(95014,e.DiagnosticCategory.Message,"Install_0_95014","Install '{0}'"),Replace_import_with_0:t(95015,e.DiagnosticCategory.Message,"Replace_import_with_0_95015","Replace import with '{0}'."),Use_synthetic_default_member:t(95016,e.DiagnosticCategory.Message,"Use_synthetic_default_member_95016","Use synthetic 'default' member."),Convert_to_ES_module:t(95017,e.DiagnosticCategory.Message,"Convert_to_ES_module_95017","Convert to ES module"),Add_undefined_type_to_property_0:t(95018,e.DiagnosticCategory.Message,"Add_undefined_type_to_property_0_95018","Add 'undefined' type to property '{0}'"),Add_initializer_to_property_0:t(95019,e.DiagnosticCategory.Message,"Add_initializer_to_property_0_95019","Add initializer to property '{0}'"),Add_definite_assignment_assertion_to_property_0:t(95020,e.DiagnosticCategory.Message,"Add_definite_assignment_assertion_to_property_0_95020","Add definite assignment assertion to property '{0}'"),Convert_all_type_literals_to_mapped_type:t(95021,e.DiagnosticCategory.Message,"Convert_all_type_literals_to_mapped_type_95021","Convert all type literals to mapped type"),Add_all_missing_members:t(95022,e.DiagnosticCategory.Message,"Add_all_missing_members_95022","Add all missing members"),Infer_all_types_from_usage:t(95023,e.DiagnosticCategory.Message,"Infer_all_types_from_usage_95023","Infer all types from usage"),Delete_all_unused_declarations:t(95024,e.DiagnosticCategory.Message,"Delete_all_unused_declarations_95024","Delete all unused declarations"),Prefix_all_unused_declarations_with_where_possible:t(95025,e.DiagnosticCategory.Message,"Prefix_all_unused_declarations_with_where_possible_95025","Prefix all unused declarations with '_' where possible"),Fix_all_detected_spelling_errors:t(95026,e.DiagnosticCategory.Message,"Fix_all_detected_spelling_errors_95026","Fix all detected spelling errors"),Add_initializers_to_all_uninitialized_properties:t(95027,e.DiagnosticCategory.Message,"Add_initializers_to_all_uninitialized_properties_95027","Add initializers to all uninitialized properties"),Add_definite_assignment_assertions_to_all_uninitialized_properties:t(95028,e.DiagnosticCategory.Message,"Add_definite_assignment_assertions_to_all_uninitialized_properties_95028","Add definite assignment assertions to all uninitialized properties"),Add_undefined_type_to_all_uninitialized_properties:t(95029,e.DiagnosticCategory.Message,"Add_undefined_type_to_all_uninitialized_properties_95029","Add undefined type to all uninitialized properties"),Change_all_jsdoc_style_types_to_TypeScript:t(95030,e.DiagnosticCategory.Message,"Change_all_jsdoc_style_types_to_TypeScript_95030","Change all jsdoc-style types to TypeScript"),Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types:t(95031,e.DiagnosticCategory.Message,"Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031","Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)"),Implement_all_unimplemented_interfaces:t(95032,e.DiagnosticCategory.Message,"Implement_all_unimplemented_interfaces_95032","Implement all unimplemented interfaces"),Install_all_missing_types_packages:t(95033,e.DiagnosticCategory.Message,"Install_all_missing_types_packages_95033","Install all missing types packages"),Rewrite_all_as_indexed_access_types:t(95034,e.DiagnosticCategory.Message,"Rewrite_all_as_indexed_access_types_95034","Rewrite all as indexed access types"),Convert_all_to_default_imports:t(95035,e.DiagnosticCategory.Message,"Convert_all_to_default_imports_95035","Convert all to default imports"),Make_all_super_calls_the_first_statement_in_their_constructor:t(95036,e.DiagnosticCategory.Message,"Make_all_super_calls_the_first_statement_in_their_constructor_95036","Make all 'super()' calls the first statement in their constructor"),Add_qualifier_to_all_unresolved_variables_matching_a_member_name:t(95037,e.DiagnosticCategory.Message,"Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037","Add qualifier to all unresolved variables matching a member name"),Change_all_extended_interfaces_to_implements:t(95038,e.DiagnosticCategory.Message,"Change_all_extended_interfaces_to_implements_95038","Change all extended interfaces to 'implements'"),Add_all_missing_super_calls:t(95039,e.DiagnosticCategory.Message,"Add_all_missing_super_calls_95039","Add all missing super calls"),Implement_all_inherited_abstract_classes:t(95040,e.DiagnosticCategory.Message,"Implement_all_inherited_abstract_classes_95040","Implement all inherited abstract classes"),Add_all_missing_async_modifiers:t(95041,e.DiagnosticCategory.Message,"Add_all_missing_async_modifiers_95041","Add all missing 'async' modifiers"),Add_ts_ignore_to_all_error_messages:t(95042,e.DiagnosticCategory.Message,"Add_ts_ignore_to_all_error_messages_95042","Add '@ts-ignore' to all error messages"),Annotate_everything_with_types_from_JSDoc:t(95043,e.DiagnosticCategory.Message,"Annotate_everything_with_types_from_JSDoc_95043","Annotate everything with types from JSDoc"),Add_to_all_uncalled_decorators:t(95044,e.DiagnosticCategory.Message,"Add_to_all_uncalled_decorators_95044","Add '()' to all uncalled decorators"),Convert_all_constructor_functions_to_classes:t(95045,e.DiagnosticCategory.Message,"Convert_all_constructor_functions_to_classes_95045","Convert all constructor functions to classes"),Generate_get_and_set_accessors:t(95046,e.DiagnosticCategory.Message,"Generate_get_and_set_accessors_95046","Generate 'get' and 'set' accessors"),Convert_require_to_import:t(95047,e.DiagnosticCategory.Message,"Convert_require_to_import_95047","Convert 'require' to 'import'"),Convert_all_require_to_import:t(95048,e.DiagnosticCategory.Message,"Convert_all_require_to_import_95048","Convert all 'require' to 'import'"),Move_to_a_new_file:t(95049,e.DiagnosticCategory.Message,"Move_to_a_new_file_95049","Move to a new file"),Remove_unreachable_code:t(95050,e.DiagnosticCategory.Message,"Remove_unreachable_code_95050","Remove unreachable code"),Remove_all_unreachable_code:t(95051,e.DiagnosticCategory.Message,"Remove_all_unreachable_code_95051","Remove all unreachable code"),Add_missing_typeof:t(95052,e.DiagnosticCategory.Message,"Add_missing_typeof_95052","Add missing 'typeof'"),Remove_unused_label:t(95053,e.DiagnosticCategory.Message,"Remove_unused_label_95053","Remove unused label"),Remove_all_unused_labels:t(95054,e.DiagnosticCategory.Message,"Remove_all_unused_labels_95054","Remove all unused labels"),Convert_0_to_mapped_object_type:t(95055,e.DiagnosticCategory.Message,"Convert_0_to_mapped_object_type_95055","Convert '{0}' to mapped object type"),Convert_namespace_import_to_named_imports:t(95056,e.DiagnosticCategory.Message,"Convert_namespace_import_to_named_imports_95056","Convert namespace import to named imports"),Convert_named_imports_to_namespace_import:t(95057,e.DiagnosticCategory.Message,"Convert_named_imports_to_namespace_import_95057","Convert named imports to namespace import"),Add_or_remove_braces_in_an_arrow_function:t(95058,e.DiagnosticCategory.Message,"Add_or_remove_braces_in_an_arrow_function_95058","Add or remove braces in an arrow function"),Add_braces_to_arrow_function:t(95059,e.DiagnosticCategory.Message,"Add_braces_to_arrow_function_95059","Add braces to arrow function"),Remove_braces_from_arrow_function:t(95060,e.DiagnosticCategory.Message,"Remove_braces_from_arrow_function_95060","Remove braces from arrow function"),Convert_default_export_to_named_export:t(95061,e.DiagnosticCategory.Message,"Convert_default_export_to_named_export_95061","Convert default export to named export"),Convert_named_export_to_default_export:t(95062,e.DiagnosticCategory.Message,"Convert_named_export_to_default_export_95062","Convert named export to default export"),Add_missing_enum_member_0:t(95063,e.DiagnosticCategory.Message,"Add_missing_enum_member_0_95063","Add missing enum member '{0}'"),Add_all_missing_imports:t(95064,e.DiagnosticCategory.Message,"Add_all_missing_imports_95064","Add all missing imports"),Convert_to_async_function:t(95065,e.DiagnosticCategory.Message,"Convert_to_async_function_95065","Convert to async function"),Convert_all_to_async_functions:t(95066,e.DiagnosticCategory.Message,"Convert_all_to_async_functions_95066","Convert all to async functions"),Add_missing_call_parentheses:t(95067,e.DiagnosticCategory.Message,"Add_missing_call_parentheses_95067","Add missing call parentheses"),Add_all_missing_call_parentheses:t(95068,e.DiagnosticCategory.Message,"Add_all_missing_call_parentheses_95068","Add all missing call parentheses"),Add_unknown_conversion_for_non_overlapping_types:t(95069,e.DiagnosticCategory.Message,"Add_unknown_conversion_for_non_overlapping_types_95069","Add 'unknown' conversion for non-overlapping types"),Add_unknown_to_all_conversions_of_non_overlapping_types:t(95070,e.DiagnosticCategory.Message,"Add_unknown_to_all_conversions_of_non_overlapping_types_95070","Add 'unknown' to all conversions of non-overlapping types"),Add_missing_new_operator_to_call:t(95071,e.DiagnosticCategory.Message,"Add_missing_new_operator_to_call_95071","Add missing 'new' operator to call"),Add_missing_new_operator_to_all_calls:t(95072,e.DiagnosticCategory.Message,"Add_missing_new_operator_to_all_calls_95072","Add missing 'new' operator to all calls"),Add_names_to_all_parameters_without_names:t(95073,e.DiagnosticCategory.Message,"Add_names_to_all_parameters_without_names_95073","Add names to all parameters without names"),Enable_the_experimentalDecorators_option_in_your_configuration_file:t(95074,e.DiagnosticCategory.Message,"Enable_the_experimentalDecorators_option_in_your_configuration_file_95074","Enable the 'experimentalDecorators' option in your configuration file"),Convert_parameters_to_destructured_object:t(95075,e.DiagnosticCategory.Message,"Convert_parameters_to_destructured_object_95075","Convert parameters to destructured object"),Extract_type:t(95077,e.DiagnosticCategory.Message,"Extract_type_95077","Extract type"),Extract_to_type_alias:t(95078,e.DiagnosticCategory.Message,"Extract_to_type_alias_95078","Extract to type alias"),Extract_to_typedef:t(95079,e.DiagnosticCategory.Message,"Extract_to_typedef_95079","Extract to typedef"),Infer_this_type_of_0_from_usage:t(95080,e.DiagnosticCategory.Message,"Infer_this_type_of_0_from_usage_95080","Infer 'this' type of '{0}' from usage"),Add_const_to_unresolved_variable:t(95081,e.DiagnosticCategory.Message,"Add_const_to_unresolved_variable_95081","Add 'const' to unresolved variable"),Add_const_to_all_unresolved_variables:t(95082,e.DiagnosticCategory.Message,"Add_const_to_all_unresolved_variables_95082","Add 'const' to all unresolved variables"),Add_await:t(95083,e.DiagnosticCategory.Message,"Add_await_95083","Add 'await'"),Add_await_to_initializer_for_0:t(95084,e.DiagnosticCategory.Message,"Add_await_to_initializer_for_0_95084","Add 'await' to initializer for '{0}'"),Fix_all_expressions_possibly_missing_await:t(95085,e.DiagnosticCategory.Message,"Fix_all_expressions_possibly_missing_await_95085","Fix all expressions possibly missing 'await'"),Remove_unnecessary_await:t(95086,e.DiagnosticCategory.Message,"Remove_unnecessary_await_95086","Remove unnecessary 'await'"),Remove_all_unnecessary_uses_of_await:t(95087,e.DiagnosticCategory.Message,"Remove_all_unnecessary_uses_of_await_95087","Remove all unnecessary uses of 'await'"),Enable_the_jsx_flag_in_your_configuration_file:t(95088,e.DiagnosticCategory.Message,"Enable_the_jsx_flag_in_your_configuration_file_95088","Enable the '--jsx' flag in your configuration file"),Add_await_to_initializers:t(95089,e.DiagnosticCategory.Message,"Add_await_to_initializers_95089","Add 'await' to initializers"),Extract_to_interface:t(95090,e.DiagnosticCategory.Message,"Extract_to_interface_95090","Extract to interface"),Convert_to_a_bigint_numeric_literal:t(95091,e.DiagnosticCategory.Message,"Convert_to_a_bigint_numeric_literal_95091","Convert to a bigint numeric literal"),Convert_all_to_bigint_numeric_literals:t(95092,e.DiagnosticCategory.Message,"Convert_all_to_bigint_numeric_literals_95092","Convert all to bigint numeric literals"),Convert_const_to_let:t(95093,e.DiagnosticCategory.Message,"Convert_const_to_let_95093","Convert 'const' to 'let'"),Prefix_with_declare:t(95094,e.DiagnosticCategory.Message,"Prefix_with_declare_95094","Prefix with 'declare'"),Prefix_all_incorrect_property_declarations_with_declare:t(95095,e.DiagnosticCategory.Message,"Prefix_all_incorrect_property_declarations_with_declare_95095","Prefix all incorrect property declarations with 'declare'"),Convert_to_template_string:t(95096,e.DiagnosticCategory.Message,"Convert_to_template_string_95096","Convert to template string"),Add_export_to_make_this_file_into_a_module:t(95097,e.DiagnosticCategory.Message,"Add_export_to_make_this_file_into_a_module_95097","Add 'export {}' to make this file into a module"),Set_the_target_option_in_your_configuration_file_to_0:t(95098,e.DiagnosticCategory.Message,"Set_the_target_option_in_your_configuration_file_to_0_95098","Set the 'target' option in your configuration file to '{0}'"),Set_the_module_option_in_your_configuration_file_to_0:t(95099,e.DiagnosticCategory.Message,"Set_the_module_option_in_your_configuration_file_to_0_95099","Set the 'module' option in your configuration file to '{0}'"),Convert_invalid_character_to_its_html_entity_code:t(95100,e.DiagnosticCategory.Message,"Convert_invalid_character_to_its_html_entity_code_95100","Convert invalid character to its html entity code"),Convert_all_invalid_characters_to_HTML_entity_code:t(95101,e.DiagnosticCategory.Message,"Convert_all_invalid_characters_to_HTML_entity_code_95101","Convert all invalid characters to HTML entity code"),Convert_function_expression_0_to_arrow_function:t(95105,e.DiagnosticCategory.Message,"Convert_function_expression_0_to_arrow_function_95105","Convert function expression '{0}' to arrow function"),Convert_function_declaration_0_to_arrow_function:t(95106,e.DiagnosticCategory.Message,"Convert_function_declaration_0_to_arrow_function_95106","Convert function declaration '{0}' to arrow function"),Fix_all_implicit_this_errors:t(95107,e.DiagnosticCategory.Message,"Fix_all_implicit_this_errors_95107","Fix all implicit-'this' errors"),Wrap_invalid_character_in_an_expression_container:t(95108,e.DiagnosticCategory.Message,"Wrap_invalid_character_in_an_expression_container_95108","Wrap invalid character in an expression container"),Wrap_all_invalid_characters_in_an_expression_container:t(95109,e.DiagnosticCategory.Message,"Wrap_all_invalid_characters_in_an_expression_container_95109","Wrap all invalid characters in an expression container"),Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file:t(95110,e.DiagnosticCategory.Message,"Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file_95110","Visit https://aka.ms/tsconfig to read more about this file"),Add_a_return_statement:t(95111,e.DiagnosticCategory.Message,"Add_a_return_statement_95111","Add a return statement"),Remove_braces_from_arrow_function_body:t(95112,e.DiagnosticCategory.Message,"Remove_braces_from_arrow_function_body_95112","Remove braces from arrow function body"),Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal:t(95113,e.DiagnosticCategory.Message,"Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113","Wrap the following body with parentheses which should be an object literal"),Add_all_missing_return_statement:t(95114,e.DiagnosticCategory.Message,"Add_all_missing_return_statement_95114","Add all missing return statement"),Remove_braces_from_all_arrow_function_bodies_with_relevant_issues:t(95115,e.DiagnosticCategory.Message,"Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115","Remove braces from all arrow function bodies with relevant issues"),Wrap_all_object_literal_with_parentheses:t(95116,e.DiagnosticCategory.Message,"Wrap_all_object_literal_with_parentheses_95116","Wrap all object literal with parentheses"),Move_labeled_tuple_element_modifiers_to_labels:t(95117,e.DiagnosticCategory.Message,"Move_labeled_tuple_element_modifiers_to_labels_95117","Move labeled tuple element modifiers to labels"),Convert_overload_list_to_single_signature:t(95118,e.DiagnosticCategory.Message,"Convert_overload_list_to_single_signature_95118","Convert overload list to single signature"),Generate_get_and_set_accessors_for_all_overriding_properties:t(95119,e.DiagnosticCategory.Message,"Generate_get_and_set_accessors_for_all_overriding_properties_95119","Generate 'get' and 'set' accessors for all overriding properties"),Wrap_in_JSX_fragment:t(95120,e.DiagnosticCategory.Message,"Wrap_in_JSX_fragment_95120","Wrap in JSX fragment"),Wrap_all_unparented_JSX_in_JSX_fragment:t(95121,e.DiagnosticCategory.Message,"Wrap_all_unparented_JSX_in_JSX_fragment_95121","Wrap all unparented JSX in JSX fragment"),Convert_arrow_function_or_function_expression:t(95122,e.DiagnosticCategory.Message,"Convert_arrow_function_or_function_expression_95122","Convert arrow function or function expression"),Convert_to_anonymous_function:t(95123,e.DiagnosticCategory.Message,"Convert_to_anonymous_function_95123","Convert to anonymous function"),Convert_to_named_function:t(95124,e.DiagnosticCategory.Message,"Convert_to_named_function_95124","Convert to named function"),Convert_to_arrow_function:t(95125,e.DiagnosticCategory.Message,"Convert_to_arrow_function_95125","Convert to arrow function"),Remove_parentheses:t(95126,e.DiagnosticCategory.Message,"Remove_parentheses_95126","Remove parentheses"),Could_not_find_a_containing_arrow_function:t(95127,e.DiagnosticCategory.Message,"Could_not_find_a_containing_arrow_function_95127","Could not find a containing arrow function"),Containing_function_is_not_an_arrow_function:t(95128,e.DiagnosticCategory.Message,"Containing_function_is_not_an_arrow_function_95128","Containing function is not an arrow function"),Could_not_find_export_statement:t(95129,e.DiagnosticCategory.Message,"Could_not_find_export_statement_95129","Could not find export statement"),This_file_already_has_a_default_export:t(95130,e.DiagnosticCategory.Message,"This_file_already_has_a_default_export_95130","This file already has a default export"),Could_not_find_import_clause:t(95131,e.DiagnosticCategory.Message,"Could_not_find_import_clause_95131","Could not find import clause"),Could_not_find_namespace_import_or_named_imports:t(95132,e.DiagnosticCategory.Message,"Could_not_find_namespace_import_or_named_imports_95132","Could not find namespace import or named imports"),Selection_is_not_a_valid_type_node:t(95133,e.DiagnosticCategory.Message,"Selection_is_not_a_valid_type_node_95133","Selection is not a valid type node"),No_type_could_be_extracted_from_this_type_node:t(95134,e.DiagnosticCategory.Message,"No_type_could_be_extracted_from_this_type_node_95134","No type could be extracted from this type node"),Could_not_find_property_for_which_to_generate_accessor:t(95135,e.DiagnosticCategory.Message,"Could_not_find_property_for_which_to_generate_accessor_95135","Could not find property for which to generate accessor"),Name_is_not_valid:t(95136,e.DiagnosticCategory.Message,"Name_is_not_valid_95136","Name is not valid"),Can_only_convert_property_with_modifier:t(95137,e.DiagnosticCategory.Message,"Can_only_convert_property_with_modifier_95137","Can only convert property with modifier"),Switch_each_misused_0_to_1:t(95138,e.DiagnosticCategory.Message,"Switch_each_misused_0_to_1_95138","Switch each misused '{0}' to '{1}'"),Convert_to_optional_chain_expression:t(95139,e.DiagnosticCategory.Message,"Convert_to_optional_chain_expression_95139","Convert to optional chain expression"),Could_not_find_convertible_access_expression:t(95140,e.DiagnosticCategory.Message,"Could_not_find_convertible_access_expression_95140","Could not find convertible access expression"),Could_not_find_matching_access_expressions:t(95141,e.DiagnosticCategory.Message,"Could_not_find_matching_access_expressions_95141","Could not find matching access expressions"),Can_only_convert_logical_AND_access_chains:t(95142,e.DiagnosticCategory.Message,"Can_only_convert_logical_AND_access_chains_95142","Can only convert logical AND access chains"),Add_void_to_Promise_resolved_without_a_value:t(95143,e.DiagnosticCategory.Message,"Add_void_to_Promise_resolved_without_a_value_95143","Add 'void' to Promise resolved without a value"),Add_void_to_all_Promises_resolved_without_a_value:t(95144,e.DiagnosticCategory.Message,"Add_void_to_all_Promises_resolved_without_a_value_95144","Add 'void' to all Promises resolved without a value"),Use_element_access_for_0:t(95145,e.DiagnosticCategory.Message,"Use_element_access_for_0_95145","Use element access for '{0}'"),Use_element_access_for_all_undeclared_properties:t(95146,e.DiagnosticCategory.Message,"Use_element_access_for_all_undeclared_properties_95146","Use element access for all undeclared properties."),Delete_all_unused_imports:t(95147,e.DiagnosticCategory.Message,"Delete_all_unused_imports_95147","Delete all unused imports"),Infer_function_return_type:t(95148,e.DiagnosticCategory.Message,"Infer_function_return_type_95148","Infer function return type"),Return_type_must_be_inferred_from_a_function:t(95149,e.DiagnosticCategory.Message,"Return_type_must_be_inferred_from_a_function_95149","Return type must be inferred from a function"),Could_not_determine_function_return_type:t(95150,e.DiagnosticCategory.Message,"Could_not_determine_function_return_type_95150","Could not determine function return type"),Could_not_convert_to_arrow_function:t(95151,e.DiagnosticCategory.Message,"Could_not_convert_to_arrow_function_95151","Could not convert to arrow function"),Could_not_convert_to_named_function:t(95152,e.DiagnosticCategory.Message,"Could_not_convert_to_named_function_95152","Could not convert to named function"),Could_not_convert_to_anonymous_function:t(95153,e.DiagnosticCategory.Message,"Could_not_convert_to_anonymous_function_95153","Could not convert to anonymous function"),Can_only_convert_string_concatenation:t(95154,e.DiagnosticCategory.Message,"Can_only_convert_string_concatenation_95154","Can only convert string concatenation"),Selection_is_not_a_valid_statement_or_statements:t(95155,e.DiagnosticCategory.Message,"Selection_is_not_a_valid_statement_or_statements_95155","Selection is not a valid statement or statements"),Add_missing_function_declaration_0:t(95156,e.DiagnosticCategory.Message,"Add_missing_function_declaration_0_95156","Add missing function declaration '{0}'"),Add_all_missing_function_declarations:t(95157,e.DiagnosticCategory.Message,"Add_all_missing_function_declarations_95157","Add all missing function declarations"),Method_not_implemented:t(95158,e.DiagnosticCategory.Message,"Method_not_implemented_95158","Method not implemented."),Function_not_implemented:t(95159,e.DiagnosticCategory.Message,"Function_not_implemented_95159","Function not implemented."),Add_override_modifier:t(95160,e.DiagnosticCategory.Message,"Add_override_modifier_95160","Add 'override' modifier"),Remove_override_modifier:t(95161,e.DiagnosticCategory.Message,"Remove_override_modifier_95161","Remove 'override' modifier"),Add_all_missing_override_modifiers:t(95162,e.DiagnosticCategory.Message,"Add_all_missing_override_modifiers_95162","Add all missing 'override' modifiers"),Remove_all_unnecessary_override_modifiers:t(95163,e.DiagnosticCategory.Message,"Remove_all_unnecessary_override_modifiers_95163","Remove all unnecessary 'override' modifiers"),Can_only_convert_named_export:t(95164,e.DiagnosticCategory.Message,"Can_only_convert_named_export_95164","Can only convert named export"),Add_missing_properties:t(95165,e.DiagnosticCategory.Message,"Add_missing_properties_95165","Add missing properties"),Add_all_missing_properties:t(95166,e.DiagnosticCategory.Message,"Add_all_missing_properties_95166","Add all missing properties"),Add_missing_attributes:t(95167,e.DiagnosticCategory.Message,"Add_missing_attributes_95167","Add missing attributes"),Add_all_missing_attributes:t(95168,e.DiagnosticCategory.Message,"Add_all_missing_attributes_95168","Add all missing attributes"),Add_undefined_to_optional_property_type:t(95169,e.DiagnosticCategory.Message,"Add_undefined_to_optional_property_type_95169","Add 'undefined' to optional property type"),Convert_named_imports_to_default_import:t(95170,e.DiagnosticCategory.Message,"Convert_named_imports_to_default_import_95170","Convert named imports to default import"),Delete_unused_param_tag_0:t(95171,e.DiagnosticCategory.Message,"Delete_unused_param_tag_0_95171","Delete unused '@param' tag '{0}'"),Delete_all_unused_param_tags:t(95172,e.DiagnosticCategory.Message,"Delete_all_unused_param_tags_95172","Delete all unused '@param' tags"),Rename_param_tag_name_0_to_1:t(95173,e.DiagnosticCategory.Message,"Rename_param_tag_name_0_to_1_95173","Rename '@param' tag name '{0}' to '{1}'"),No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer:t(18004,e.DiagnosticCategory.Error,"No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004","No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),Classes_may_not_have_a_field_named_constructor:t(18006,e.DiagnosticCategory.Error,"Classes_may_not_have_a_field_named_constructor_18006","Classes may not have a field named 'constructor'."),JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array:t(18007,e.DiagnosticCategory.Error,"JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007","JSX expressions may not use the comma operator. Did you mean to write an array?"),Private_identifiers_cannot_be_used_as_parameters:t(18009,e.DiagnosticCategory.Error,"Private_identifiers_cannot_be_used_as_parameters_18009","Private identifiers cannot be used as parameters."),An_accessibility_modifier_cannot_be_used_with_a_private_identifier:t(18010,e.DiagnosticCategory.Error,"An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010","An accessibility modifier cannot be used with a private identifier."),The_operand_of_a_delete_operator_cannot_be_a_private_identifier:t(18011,e.DiagnosticCategory.Error,"The_operand_of_a_delete_operator_cannot_be_a_private_identifier_18011","The operand of a 'delete' operator cannot be a private identifier."),constructor_is_a_reserved_word:t(18012,e.DiagnosticCategory.Error,"constructor_is_a_reserved_word_18012","'#constructor' is a reserved word."),Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier:t(18013,e.DiagnosticCategory.Error,"Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier_18013","Property '{0}' is not accessible outside class '{1}' because it has a private identifier."),The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling:t(18014,e.DiagnosticCategory.Error,"The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_priv_18014","The property '{0}' cannot be accessed on type '{1}' within this class because it is shadowed by another private identifier with the same spelling."),Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2:t(18015,e.DiagnosticCategory.Error,"Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2_18015","Property '{0}' in type '{1}' refers to a different member that cannot be accessed from within type '{2}'."),Private_identifiers_are_not_allowed_outside_class_bodies:t(18016,e.DiagnosticCategory.Error,"Private_identifiers_are_not_allowed_outside_class_bodies_18016","Private identifiers are not allowed outside class bodies."),The_shadowing_declaration_of_0_is_defined_here:t(18017,e.DiagnosticCategory.Error,"The_shadowing_declaration_of_0_is_defined_here_18017","The shadowing declaration of '{0}' is defined here"),The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here:t(18018,e.DiagnosticCategory.Error,"The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018","The declaration of '{0}' that you probably intended to use is defined here"),_0_modifier_cannot_be_used_with_a_private_identifier:t(18019,e.DiagnosticCategory.Error,"_0_modifier_cannot_be_used_with_a_private_identifier_18019","'{0}' modifier cannot be used with a private identifier."),An_enum_member_cannot_be_named_with_a_private_identifier:t(18024,e.DiagnosticCategory.Error,"An_enum_member_cannot_be_named_with_a_private_identifier_18024","An enum member cannot be named with a private identifier."),can_only_be_used_at_the_start_of_a_file:t(18026,e.DiagnosticCategory.Error,"can_only_be_used_at_the_start_of_a_file_18026","'#!' can only be used at the start of a file."),Compiler_reserves_name_0_when_emitting_private_identifier_downlevel:t(18027,e.DiagnosticCategory.Error,"Compiler_reserves_name_0_when_emitting_private_identifier_downlevel_18027","Compiler reserves name '{0}' when emitting private identifier downlevel."),Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher:t(18028,e.DiagnosticCategory.Error,"Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher_18028","Private identifiers are only available when targeting ECMAScript 2015 and higher."),Private_identifiers_are_not_allowed_in_variable_declarations:t(18029,e.DiagnosticCategory.Error,"Private_identifiers_are_not_allowed_in_variable_declarations_18029","Private identifiers are not allowed in variable declarations."),An_optional_chain_cannot_contain_private_identifiers:t(18030,e.DiagnosticCategory.Error,"An_optional_chain_cannot_contain_private_identifiers_18030","An optional chain cannot contain private identifiers."),The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents:t(18031,e.DiagnosticCategory.Error,"The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituent_18031","The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents."),The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some:t(18032,e.DiagnosticCategory.Error,"The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_pr_18032","The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some."),Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead:t(18033,e.DiagnosticCategory.Error,"Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033","Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead."),Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment:t(18034,e.DiagnosticCategory.Message,"Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034","Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."),Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name:t(18035,e.DiagnosticCategory.Error,"Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035","Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."),Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator:t(18036,e.DiagnosticCategory.Error,"Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036","Class decorators can't be used with static private identifier. Consider removing the experimental decorator."),Await_expression_cannot_be_used_inside_a_class_static_block:t(18037,e.DiagnosticCategory.Error,"Await_expression_cannot_be_used_inside_a_class_static_block_18037","Await expression cannot be used inside a class static block."),For_await_loops_cannot_be_used_inside_a_class_static_block:t(18038,e.DiagnosticCategory.Error,"For_await_loops_cannot_be_used_inside_a_class_static_block_18038","'For await' loops cannot be used inside a class static block."),Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block:t(18039,e.DiagnosticCategory.Error,"Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block_18039","Invalid use of '{0}'. It cannot be used inside a class static block."),A_return_statement_cannot_be_used_inside_a_class_static_block:t(18041,e.DiagnosticCategory.Error,"A_return_statement_cannot_be_used_inside_a_class_static_block_18041","A 'return' statement cannot be used inside a class static block.")};}(t),function(e){var t;function r(e){return e>=79}e.tokenIsIdentifierOrKeyword=r,e.tokenIsIdentifierOrKeywordOrGreaterThan=function(e){return 31===e||r(e)},e.textToKeywordObj=((t={abstract:126,any:130,as:127,asserts:128,assert:129,bigint:158,boolean:133,break:81,case:82,catch:83,class:84,continue:86,const:85}).constructor=134,t.debugger=87,t.declare=135,t.default=88,t.delete=89,t.do=90,t.else=91,t.enum=92,t.export=93,t.extends=94,t.false=95,t.finally=96,t.for=97,t.from=156,t.function=98,t.get=136,t.if=99,t.implements=117,t.import=100,t.in=101,t.infer=137,t.instanceof=102,t.interface=118,t.intrinsic=138,t.is=139,t.keyof=140,t.let=119,t.module=141,t.namespace=142,t.never=143,t.new=103,t.null=104,t.number=147,t.object=148,t.package=120,t.private=121,t.protected=122,t.public=123,t.override=159,t.out=144,t.readonly=145,t.require=146,t.global=157,t.return=105,t.set=149,t.static=124,t.string=150,t.super=106,t.switch=107,t.symbol=151,t.this=108,t.throw=109,t.true=110,t.try=111,t.type=152,t.typeof=112,t.undefined=153,t.unique=154,t.unknown=155,t.var=113,t.void=114,t.while=115,t.with=116,t.yield=125,t.async=131,t.await=132,t.of=160,t);var n=new e.Map(e.getEntries(e.textToKeywordObj)),a=new e.Map(e.getEntries(i$1(i$1({},e.textToKeywordObj),{"{":18,"}":19,"(":20,")":21,"[":22,"]":23,".":24,"...":25,";":26,",":27,"<":29,">":31,"<=":32,">=":33,"==":34,"!=":35,"===":36,"!==":37,"=>":38,"+":39,"-":40,"**":42,"*":41,"/":43,"%":44,"++":45,"--":46,"<<":47,"</":30,">>":48,">>>":49,"&":50,"|":51,"^":52,"!":53,"~":54,"&&":55,"||":56,"?":57,"??":60,"?.":28,":":58,"=":63,"+=":64,"-=":65,"*=":66,"**=":67,"/=":68,"%=":69,"<<=":70,">>=":71,">>>=":72,"&=":73,"|=":74,"^=":78,"||=":75,"&&=":76,"??=":77,"@":59,"#":62,"`":61}))),o=[170,170,181,181,186,186,192,214,216,246,248,543,546,563,592,685,688,696,699,705,720,721,736,740,750,750,890,890,902,902,904,906,908,908,910,929,931,974,976,983,986,1011,1024,1153,1164,1220,1223,1224,1227,1228,1232,1269,1272,1273,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1569,1594,1600,1610,1649,1747,1749,1749,1765,1766,1786,1788,1808,1808,1810,1836,1920,1957,2309,2361,2365,2365,2384,2384,2392,2401,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2784,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2877,2877,2908,2909,2911,2913,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3294,3294,3296,3297,3333,3340,3342,3344,3346,3368,3370,3385,3424,3425,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3805,3840,3840,3904,3911,3913,3946,3976,3979,4096,4129,4131,4135,4137,4138,4176,4181,4256,4293,4304,4342,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,5024,5108,5121,5740,5743,5750,5761,5786,5792,5866,6016,6067,6176,6263,6272,6312,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8319,8319,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8544,8579,12293,12295,12321,12329,12337,12341,12344,12346,12353,12436,12445,12446,12449,12538,12540,12542,12549,12588,12593,12686,12704,12727,13312,19893,19968,40869,40960,42124,44032,55203,63744,64045,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65138,65140,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],s=[170,170,181,181,186,186,192,214,216,246,248,543,546,563,592,685,688,696,699,705,720,721,736,740,750,750,768,846,864,866,890,890,902,902,904,906,908,908,910,929,931,974,976,983,986,1011,1024,1153,1155,1158,1164,1220,1223,1224,1227,1228,1232,1269,1272,1273,1329,1366,1369,1369,1377,1415,1425,1441,1443,1465,1467,1469,1471,1471,1473,1474,1476,1476,1488,1514,1520,1522,1569,1594,1600,1621,1632,1641,1648,1747,1749,1756,1759,1768,1770,1773,1776,1788,1808,1836,1840,1866,1920,1968,2305,2307,2309,2361,2364,2381,2384,2388,2392,2403,2406,2415,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2492,2494,2500,2503,2504,2507,2509,2519,2519,2524,2525,2527,2531,2534,2545,2562,2562,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2649,2652,2654,2654,2662,2676,2689,2691,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2784,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2876,2883,2887,2888,2891,2893,2902,2903,2908,2909,2911,2913,2918,2927,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3006,3010,3014,3016,3018,3021,3031,3031,3047,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3134,3140,3142,3144,3146,3149,3157,3158,3168,3169,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3262,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3297,3302,3311,3330,3331,3333,3340,3342,3344,3346,3368,3370,3385,3390,3395,3398,3400,3402,3405,3415,3415,3424,3425,3430,3439,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3805,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3946,3953,3972,3974,3979,3984,3991,3993,4028,4038,4038,4096,4129,4131,4135,4137,4138,4140,4146,4150,4153,4160,4169,4176,4185,4256,4293,4304,4342,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,4969,4977,5024,5108,5121,5740,5743,5750,5761,5786,5792,5866,6016,6099,6112,6121,6160,6169,6176,6263,6272,6313,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8255,8256,8319,8319,8400,8412,8417,8417,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8544,8579,12293,12295,12321,12335,12337,12341,12344,12346,12353,12436,12441,12442,12445,12446,12449,12542,12549,12588,12593,12686,12704,12727,13312,19893,19968,40869,40960,42124,44032,55203,63744,64045,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65056,65059,65075,65076,65101,65103,65136,65138,65140,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65381,65470,65474,65479,65482,65487,65490,65495,65498,65500],c=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1319,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2208,2208,2210,2220,2308,2361,2365,2365,2384,2384,2392,2401,2417,2423,2425,2431,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3133,3160,3161,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3424,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6263,6272,6312,6314,6314,6320,6389,6400,6428,6480,6509,6512,6516,6528,6571,6593,6599,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7401,7404,7406,7409,7413,7414,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42647,42656,42735,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43648,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],l=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1319,1329,1366,1369,1369,1377,1415,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1520,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2048,2093,2112,2139,2208,2208,2210,2220,2276,2302,2304,2403,2406,2415,2417,2423,2425,2431,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3161,3168,3171,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3330,3331,3333,3340,3342,3344,3346,3386,3389,3396,3398,3400,3402,3406,3415,3415,3424,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6263,6272,6314,6320,6389,6400,6428,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7376,7378,7380,7414,7424,7654,7676,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42647,42655,42737,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43047,43072,43123,43136,43204,43216,43225,43232,43255,43259,43259,43264,43309,43312,43347,43360,43388,43392,43456,43471,43481,43520,43574,43584,43597,43600,43609,43616,43638,43642,43643,43648,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65062,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],u=[65,90,97,122,170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2144,2154,2208,2228,2230,2237,2308,2361,2365,2365,2384,2384,2392,2401,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2556,2556,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2809,2809,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3129,3133,3133,3160,3162,3168,3169,3200,3200,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6264,6272,6312,6314,6314,6320,6389,6400,6430,6480,6509,6512,6516,6528,6571,6576,6601,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7296,7304,7312,7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8472,8477,8484,8484,8486,8486,8488,8488,8490,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12443,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12730,12784,12799,13312,19893,19968,40943,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42653,42656,42735,42775,42783,42786,42888,42891,42943,42946,42950,42999,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43261,43262,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43488,43492,43494,43503,43514,43518,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43646,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43879,43888,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66176,66204,66208,66256,66304,66335,66349,66378,66384,66421,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66736,66771,66776,66811,66816,66855,66864,66915,67072,67382,67392,67413,67424,67431,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,69376,69404,69415,69415,69424,69445,69600,69622,69635,69687,69763,69807,69840,69864,69891,69926,69956,69956,69968,70002,70006,70006,70019,70066,70081,70084,70106,70106,70108,70108,70144,70161,70163,70187,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,70461,70480,70480,70493,70497,70656,70708,70727,70730,70751,70751,70784,70831,70852,70853,70855,70855,71040,71086,71128,71131,71168,71215,71236,71236,71296,71338,71352,71352,71424,71450,71680,71723,71840,71903,71935,71935,72096,72103,72106,72144,72161,72161,72163,72163,72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,72384,72440,72704,72712,72714,72750,72768,72768,72818,72847,72960,72966,72968,72969,72971,73008,73030,73030,73056,73061,73063,73064,73066,73097,73112,73112,73440,73458,73728,74649,74752,74862,74880,75075,77824,78894,82944,83526,92160,92728,92736,92766,92880,92909,92928,92975,92992,92995,93027,93047,93053,93071,93760,93823,93952,94026,94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101106,110592,110878,110928,110930,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,123136,123180,123191,123197,123214,123214,123584,123627,124928,125124,125184,125251,125259,125259,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,131072,173782,173824,177972,177984,178205,178208,183969,183984,191456,194560,195101],_=[48,57,65,90,95,95,97,122,170,170,181,181,183,183,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,895,895,902,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1327,1329,1366,1369,1369,1376,1416,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1519,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2045,2045,2048,2093,2112,2139,2144,2154,2208,2228,2230,2237,2259,2273,2275,2403,2406,2415,2417,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2556,2556,2558,2558,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2809,2815,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3072,3084,3086,3088,3090,3112,3114,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3162,3168,3171,3174,3183,3200,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3328,3331,3333,3340,3342,3344,3346,3396,3398,3400,3402,3406,3412,3415,3423,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3558,3567,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4969,4977,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6264,6272,6314,6320,6389,6400,6430,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6618,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6832,6845,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7296,7304,7312,7354,7357,7359,7376,7378,7380,7418,7424,7673,7675,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8472,8477,8484,8484,8486,8486,8488,8488,8490,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12730,12784,12799,13312,19893,19968,40943,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42737,42775,42783,42786,42888,42891,42943,42946,42950,42999,43047,43072,43123,43136,43205,43216,43225,43232,43255,43259,43259,43261,43309,43312,43347,43360,43388,43392,43456,43471,43481,43488,43518,43520,43574,43584,43597,43600,43609,43616,43638,43642,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43879,43888,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65071,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66045,66045,66176,66204,66208,66256,66272,66272,66304,66335,66349,66378,66384,66426,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66720,66729,66736,66771,66776,66811,66816,66855,66864,66915,67072,67382,67392,67413,67424,67431,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68099,68101,68102,68108,68115,68117,68119,68121,68149,68152,68154,68159,68159,68192,68220,68224,68252,68288,68295,68297,68326,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68903,68912,68921,69376,69404,69415,69415,69424,69456,69600,69622,69632,69702,69734,69743,69759,69818,69840,69864,69872,69881,69888,69940,69942,69951,69956,69958,69968,70003,70006,70006,70016,70084,70089,70092,70096,70106,70108,70108,70144,70161,70163,70199,70206,70206,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70378,70384,70393,70400,70403,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70459,70468,70471,70472,70475,70477,70480,70480,70487,70487,70493,70499,70502,70508,70512,70516,70656,70730,70736,70745,70750,70751,70784,70853,70855,70855,70864,70873,71040,71093,71096,71104,71128,71133,71168,71232,71236,71236,71248,71257,71296,71352,71360,71369,71424,71450,71453,71467,71472,71481,71680,71738,71840,71913,71935,71935,72096,72103,72106,72151,72154,72161,72163,72164,72192,72254,72263,72263,72272,72345,72349,72349,72384,72440,72704,72712,72714,72758,72760,72768,72784,72793,72818,72847,72850,72871,72873,72886,72960,72966,72968,72969,72971,73014,73018,73018,73020,73021,73023,73031,73040,73049,73056,73061,73063,73064,73066,73102,73104,73105,73107,73112,73120,73129,73440,73462,73728,74649,74752,74862,74880,75075,77824,78894,82944,83526,92160,92728,92736,92766,92768,92777,92880,92909,92912,92916,92928,92982,92992,92995,93008,93017,93027,93047,93053,93071,93760,93823,93952,94026,94031,94087,94095,94111,94176,94177,94179,94179,94208,100343,100352,101106,110592,110878,110928,110930,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,113821,113822,119141,119145,119149,119154,119163,119170,119173,119179,119210,119213,119362,119364,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,120782,120831,121344,121398,121403,121452,121461,121461,121476,121476,121499,121503,121505,121519,122880,122886,122888,122904,122907,122913,122915,122916,122918,122922,123136,123180,123184,123197,123200,123209,123214,123214,123584,123641,124928,125124,125136,125142,125184,125259,125264,125273,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,131072,173782,173824,177972,177984,178205,178208,183969,183984,191456,194560,195101,917760,917999],d=/^\/\/\/?\s*@(ts-expect-error|ts-ignore)/,p=/^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/;function f(e,t){if(e<t[0])return !1;for(var r,n=0,i=t.length;n+1<i;){if(r=n+(i-n)/2,t[r-=r%2]<=e&&e<=t[r+1])return !0;e<t[r]?i=r:n=r+2;}return !1}function g(e,t){return f(e,t>=2?u:1===t?c:o)}e.isUnicodeIdentifierStart=g;var m,y=(m=[],a.forEach((function(e,t){m[e]=t;})),m);function v(e){for(var t=new Array,r=0,n=0;r<e.length;){var i=e.charCodeAt(r);switch(r++,i){case 13:10===e.charCodeAt(r)&&r++;case 10:t.push(n),n=r;break;default:i>127&&C(i)&&(t.push(n),n=r);}}return t.push(n),t}function h(t,r,n,i,a){(r<0||r>=t.length)&&(a?r=r<0?0:r>=t.length?t.length-1:r:e.Debug.fail("Bad line number. Line: ".concat(r,", lineStarts.length: ").concat(t.length," , line map is correct? ").concat(void 0!==i?e.arraysEqual(t,v(i)):"unknown")));var o=t[r]+n;return a?o>t[r+1]?t[r+1]:"string"==typeof i&&o>i.length?i.length:o:(r<t.length-1?e.Debug.assert(o<t[r+1]):void 0!==i&&e.Debug.assert(o<=i.length),o)}function b(e){return e.lineMap||(e.lineMap=v(e.text))}function x(e,t){var r=D(e,t);return {line:r,character:t-e[r]}}function D(t,r,n){var i=e.binarySearch(t,r,e.identity,e.compareValues,n);return i<0&&(i=~i-1,e.Debug.assert(-1!==i,"position cannot precede the beginning of the file")),i}function S(e){return T(e)||C(e)}function T(e){return 32===e||9===e||11===e||12===e||160===e||133===e||5760===e||e>=8192&&e<=8203||8239===e||8287===e||12288===e||65279===e}function C(e){return 10===e||13===e||8232===e||8233===e}function k(e){return e>=48&&e<=57}function E(e){return k(e)||e>=65&&e<=70||e>=97&&e<=102}function N(e){return e>=48&&e<=55}e.tokenToString=function(e){return y[e]},e.stringToToken=function(e){return a.get(e)},e.computeLineStarts=v,e.getPositionOfLineAndCharacter=function(e,t,r,n){return e.getPositionOfLineAndCharacter?e.getPositionOfLineAndCharacter(t,r,n):h(b(e),t,r,e.text,n)},e.computePositionOfLineAndCharacter=h,e.getLineStarts=b,e.computeLineAndCharacterOfPosition=x,e.computeLineOfPosition=D,e.getLinesBetweenPositions=function(e,t,r){if(t===r)return 0;var n=b(e),i=Math.min(t,r),a=i===r,o=a?t:r,s=D(n,i),c=D(n,o,s);return a?s-c:c-s},e.getLineAndCharacterOfPosition=function(e,t){return x(b(e),t)},e.isWhiteSpaceLike=S,e.isWhiteSpaceSingleLine=T,e.isLineBreak=C,e.isOctalDigit=N,e.couldStartTrivia=function(e,t){var r=e.charCodeAt(t);switch(r){case 13:case 10:case 9:case 11:case 12:case 32:case 47:case 60:case 124:case 61:case 62:return !0;case 35:return 0===t;default:return r>127}},e.skipTrivia=function(t,r,n,i,a){if(e.positionIsSynthesized(r))return r;for(var o=!1;;){var s=t.charCodeAt(r);switch(s){case 13:10===t.charCodeAt(r+1)&&r++;case 10:if(r++,n)return r;o=!!a;continue;case 9:case 11:case 12:case 32:r++;continue;case 47:if(i)break;if(47===t.charCodeAt(r+1)){for(r+=2;r<t.length&&!C(t.charCodeAt(r));)r++;o=!1;continue}if(42===t.charCodeAt(r+1)){for(r+=2;r<t.length;){if(42===t.charCodeAt(r)&&47===t.charCodeAt(r+1)){r+=2;break}r++;}o=!1;continue}break;case 60:case 124:case 61:case 62:if(A(t,r)){r=P(t,r),o=!1;continue}break;case 35:if(0===r&&I(t,r)){r=O(t,r),o=!1;continue}break;case 42:if(o){r++,o=!1;continue}break;default:if(s>127&&S(s)){r++;continue}}return r}};var F="<<<<<<<".length;function A(t,r){if(e.Debug.assert(r>=0),0===r||C(t.charCodeAt(r-1))){var n=t.charCodeAt(r);if(r+F<t.length){for(var i=0;i<F;i++)if(t.charCodeAt(r+i)!==n)return !1;return 61===n||32===t.charCodeAt(r+F)}}return !1}function P(t,r,n){n&&n(e.Diagnostics.Merge_conflict_marker_encountered,r,F);var i=t.charCodeAt(r),a=t.length;if(60===i||62===i)for(;r<a&&!C(t.charCodeAt(r));)r++;else for(e.Debug.assert(124===i||61===i);r<a;){var o=t.charCodeAt(r);if((61===o||62===o)&&o!==i&&A(t,r))break;r++;}return r}var w=/^#!.*/;function I(t,r){return e.Debug.assert(0===r),w.test(t)}function O(e,t){return t+w.exec(e)[0].length}function M(e,t,r,n,i,a,o){var s,c,l,u,_=!1,d=n,p=o;if(0===r){d=!0;var f=j(t);f&&(r=f.length);}e:for(;r>=0&&r<t.length;){var g=t.charCodeAt(r);switch(g){case 13:10===t.charCodeAt(r+1)&&r++;case 10:if(r++,n)break e;d=!0,_&&(u=!0);continue;case 9:case 11:case 12:case 32:r++;continue;case 47:var m=t.charCodeAt(r+1),y=!1;if(47===m||42===m){var v=47===m?2:3,h=r;if(r+=2,47===m)for(;r<t.length;){if(C(t.charCodeAt(r))){y=!0;break}r++;}else for(;r<t.length;){if(42===t.charCodeAt(r)&&47===t.charCodeAt(r+1)){r+=2;break}r++;}if(d){if(_&&(p=i(s,c,l,u,a,p),!e&&p))return p;s=h,c=r,l=v,u=y,_=!0;}continue}break e;default:if(g>127&&S(g)){_&&C(g)&&(u=!0),r++;continue}break e}}return _&&(p=i(s,c,l,u,a,p)),p}function L(e,t,r,n,i){return M(!0,e,t,!1,r,n,i)}function R(e,t,r,n,i){return M(!0,e,t,!0,r,n,i)}function B(e,t,r,n,i,a){return a||(a=[]),a.push({kind:r,pos:e,end:t,hasTrailingNewLine:n}),a}function j(e){var t=w.exec(e);if(t)return t[0]}function J(e,t){return e>=65&&e<=90||e>=97&&e<=122||36===e||95===e||e>127&&g(e,t)}function z(e,t,r){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||36===e||95===e||1===r&&(45===e||58===e)||e>127&&function(e,t){return f(e,t>=2?_:1===t?l:s)}(e,t)}e.isShebangTrivia=I,e.scanShebangTrivia=O,e.forEachLeadingCommentRange=function(e,t,r,n){return M(!1,e,t,!1,r,n)},e.forEachTrailingCommentRange=function(e,t,r,n){return M(!1,e,t,!0,r,n)},e.reduceEachLeadingCommentRange=L,e.reduceEachTrailingCommentRange=R,e.getLeadingCommentRanges=function(e,t){return L(e,t,B,void 0,void 0)},e.getTrailingCommentRanges=function(e,t){return R(e,t,B,void 0,void 0)},e.getShebang=j,e.isIdentifierStart=J,e.isIdentifierPart=z,e.isIdentifierText=function(e,t,r){var n=K(e,0);if(!J(n,t))return !1;for(var i=U(n);i<e.length;i+=U(n))if(!z(n=K(e,i),t,r))return !1;return !0},e.createScanner=function(t,i,a,o,s,c,l){void 0===a&&(a=0);var u,_,f,g,m,y,v,h,b=o,x=0;le(b,c,l);var D={getStartPos:function(){return f},getTextPos:function(){return u},getToken:function(){return m},getTokenPos:function(){return g},getTokenText:function(){return b.substring(g,u)},getTokenValue:function(){return y},hasUnicodeEscape:function(){return 0!=(1024&v)},hasExtendedUnicodeEscape:function(){return 0!=(8&v)},hasPrecedingLineBreak:function(){return 0!=(1&v)},hasPrecedingJSDocComment:function(){return 0!=(2&v)},isIdentifier:function(){return 79===m||m>116},isReservedWord:function(){return m>=81&&m<=116},isUnterminated:function(){return 0!=(4&v)},getCommentDirectives:function(){return h},getNumericLiteralFlags:function(){return 1008&v},getTokenFlags:function(){return v},reScanGreaterToken:function(){if(31===m){if(62===b.charCodeAt(u))return 62===b.charCodeAt(u+1)?61===b.charCodeAt(u+2)?(u+=3,m=72):(u+=2,m=49):61===b.charCodeAt(u+1)?(u+=2,m=71):(u++,m=48);if(61===b.charCodeAt(u))return u++,m=33}return m},reScanAsteriskEqualsToken:function(){return e.Debug.assert(66===m,"'reScanAsteriskEqualsToken' should only be called on a '*='"),u=g+1,m=63},reScanSlashToken:function(){if(43===m||68===m){for(var r=g+1,n=!1,i=!1;;){if(r>=_){v|=4,F(e.Diagnostics.Unterminated_regular_expression_literal);break}var a=b.charCodeAt(r);if(C(a)){v|=4,F(e.Diagnostics.Unterminated_regular_expression_literal);break}if(n)n=!1;else {if(47===a&&!i){r++;break}91===a?i=!0:92===a?n=!0:93===a&&(i=!1);}r++;}for(;r<_&&z(b.charCodeAt(r),t);)r++;u=r,y=b.substring(g,u),m=13;}return m},reScanTemplateToken:function(t){return e.Debug.assert(19===m,"'reScanTemplateToken' should only be called on a '}'"),u=g,m=H(t)},reScanTemplateHeadOrNoSubstitutionTemplate:function(){return u=g,m=H(!0)},scanJsxIdentifier:function(){if(r(m)){for(var e=!1;u<_;){var t=b.charCodeAt(u);if(45!==t)if(58!==t||e){var n=u;if(y+=$(),u===n)break}else y+=":",u++,e=!0,m=79;else y+="-",u++;}return ":"===y.slice(-1)&&(y=y.slice(0,-1),u--),ee()}return m},scanJsxAttributeValue:se,reScanJsxAttributeValue:function(){return u=g=f,se()},reScanJsxToken:function(e){return void 0===e&&(e=!0),u=g=f,m=oe(e)},reScanLessThanToken:function(){return 47===m?(u=g+1,m=29):m},reScanHashToken:function(){return 80===m?(u=g+1,m=62):m},reScanQuestionToken:function(){return e.Debug.assert(60===m,"'reScanQuestionToken' should only be called on a '??'"),u=g+1,m=57},reScanInvalidIdentifier:function(){e.Debug.assert(0===m,"'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'."),u=g=f,v=0;var t=K(b,u),r=ie(t,99);return r?m=r:(u+=U(t),m)},scanJsxToken:oe,scanJsDocToken:function(){if(f=g=u,v=0,u>=_)return m=1;var e=K(b,u);switch(u+=U(e),e){case 9:case 11:case 12:case 32:for(;u<_&&T(b.charCodeAt(u));)u++;return m=5;case 64:return m=59;case 13:10===b.charCodeAt(u)&&u++;case 10:return v|=1,m=4;case 42:return m=41;case 123:return m=18;case 125:return m=19;case 91:return m=22;case 93:return m=23;case 60:return m=29;case 62:return m=31;case 61:return m=63;case 44:return m=27;case 46:return m=24;case 96:return m=61;case 35:return m=62;case 92:u--;var r=Z();if(r>=0&&J(r,t))return u+=3,v|=8,y=X()+$(),m=ee();var n=Y();return n>=0&&J(n,t)?(u+=6,v|=1024,y=String.fromCharCode(n)+$(),m=ee()):(u++,m=0)}if(J(e,t)){for(var i=e;u<_&&z(i=K(b,u),t)||45===b.charCodeAt(u);)u+=U(i);return y=b.substring(g,u),92===i&&(y+=$()),m=ee()}return m=0},scan:ne,getText:function(){return b},clearCommentDirectives:function(){h=void 0;},setText:le,setScriptTarget:function(e){t=e;},setLanguageVariant:function(e){a=e;},setOnError:function(e){s=e;},setTextPos:ue,setInJSDocType:function(e){x+=e?1:-1;},tryScan:function(e){return ce(e,!1)},lookAhead:function(e){return ce(e,!0)},scanRange:function(e,t,r){var n=_,i=u,a=f,o=g,s=m,c=y,l=v,d=h;le(b,e,t);var p=r();return _=n,u=i,f=a,g=o,m=s,y=c,v=l,h=d,p}};return e.Debug.isDebugging&&Object.defineProperty(D,"__debugShowCurrentPositionInText",{get:function(){var e=D.getText();return e.slice(0,D.getStartPos())+"║"+e.slice(D.getStartPos())}}),D;function F(e,t,r){if(void 0===t&&(t=u),s){var n=u;u=t,s(e,r||0),u=n;}}function w(){for(var t=u,r=!1,n=!1,i="";;){var a=b.charCodeAt(u);if(95!==a){if(!k(a))break;r=!0,n=!1,u++;}else v|=512,r?(r=!1,n=!0,i+=b.substring(t,u)):F(n?e.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted:e.Diagnostics.Numeric_separators_are_not_allowed_here,u,1),t=++u;}return 95===b.charCodeAt(u-1)&&F(e.Diagnostics.Numeric_separators_are_not_allowed_here,u-1,1),i+b.substring(t,u)}function M(){var t,r,n=u,i=w();46===b.charCodeAt(u)&&(u++,t=w());var a,o=u;if(69===b.charCodeAt(u)||101===b.charCodeAt(u)){u++,v|=16,43!==b.charCodeAt(u)&&45!==b.charCodeAt(u)||u++;var s=u,c=w();c?(r=b.substring(o,s)+c,o=u):F(e.Diagnostics.Digit_expected);}if(512&v?(a=i,t&&(a+="."+t),r&&(a+=r)):a=b.substring(n,o),void 0!==t||16&v)return L(n,void 0===t&&!!(16&v)),{type:8,value:""+ +a};y=a;var l=re();return L(n),{type:l,value:y}}function L(r,n){if(J(K(b,u),t)){var i=u,a=$().length;1===a&&"n"===b[i]?F(n?e.Diagnostics.A_bigint_literal_cannot_use_exponential_notation:e.Diagnostics.A_bigint_literal_must_be_an_integer,r,i-r+1):(F(e.Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal,i,a),u=i);}}function R(){for(var e=u;N(b.charCodeAt(u));)u++;return +b.substring(e,u)}function B(e,t){var r=V(e,!1,t);return r?parseInt(r,16):-1}function j(e,t){return V(e,!0,t)}function V(t,r,n){for(var i=[],a=!1,o=!1;i.length<t||r;){var s=b.charCodeAt(u);if(n&&95===s)v|=512,a?(a=!1,o=!0):F(o?e.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted:e.Diagnostics.Numeric_separators_are_not_allowed_here,u,1),u++;else {if(a=n,s>=65&&s<=70)s+=32;else if(!(s>=48&&s<=57||s>=97&&s<=102))break;i.push(s),u++,o=!1;}}return i.length<t&&(i=[]),95===b.charCodeAt(u-1)&&F(e.Diagnostics.Numeric_separators_are_not_allowed_here,u-1,1),String.fromCharCode.apply(String,i)}function W(t){void 0===t&&(t=!1);for(var r=b.charCodeAt(u),n="",i=++u;;){if(u>=_){n+=b.substring(i,u),v|=4,F(e.Diagnostics.Unterminated_string_literal);break}var a=b.charCodeAt(u);if(a===r){n+=b.substring(i,u),u++;break}if(92!==a||t){if(C(a)&&!t){n+=b.substring(i,u),v|=4,F(e.Diagnostics.Unterminated_string_literal);break}u++;}else n+=b.substring(i,u),n+=G(),i=u;}return n}function H(t){for(var r,n=96===b.charCodeAt(u),i=++u,a="";;){if(u>=_){a+=b.substring(i,u),v|=4,F(e.Diagnostics.Unterminated_template_literal),r=n?14:17;break}var o=b.charCodeAt(u);if(96===o){a+=b.substring(i,u),u++,r=n?14:17;break}if(36===o&&u+1<_&&123===b.charCodeAt(u+1)){a+=b.substring(i,u),u+=2,r=n?15:16;break}92!==o?13!==o?u++:(a+=b.substring(i,u),++u<_&&10===b.charCodeAt(u)&&u++,a+="\n",i=u):(a+=b.substring(i,u),a+=G(t),i=u);}return e.Debug.assert(void 0!==r),y=a,r}function G(t){var r=u;if(++u>=_)return F(e.Diagnostics.Unexpected_end_of_text),"";var n=b.charCodeAt(u);switch(u++,n){case 48:return t&&u<_&&k(b.charCodeAt(u))?(u++,v|=2048,b.substring(r,u)):"\0";case 98:return "\b";case 116:return "\t";case 110:return "\n";case 118:return "\v";case 102:return "\f";case 114:return "\r";case 39:return "'";case 34:return '"';case 117:if(t)for(var i=u;i<u+4;i++)if(i<_&&!E(b.charCodeAt(i))&&123!==b.charCodeAt(i))return u=i,v|=2048,b.substring(r,u);if(u<_&&123===b.charCodeAt(u)){if(u++,t&&!E(b.charCodeAt(u)))return v|=2048,b.substring(r,u);if(t){var a=u,o=j(1,!1);if(!((o?parseInt(o,16):-1)<=1114111&&125===b.charCodeAt(u)))return v|=2048,b.substring(r,u);u=a;}return v|=8,X()}return v|=1024,Q(4);case 120:if(t){if(!E(b.charCodeAt(u)))return v|=2048,b.substring(r,u);if(!E(b.charCodeAt(u+1)))return u++,v|=2048,b.substring(r,u)}return Q(2);case 13:u<_&&10===b.charCodeAt(u)&&u++;case 10:case 8232:case 8233:return "";default:return String.fromCharCode(n)}}function Q(t){var r=B(t,!1);return r>=0?String.fromCharCode(r):(F(e.Diagnostics.Hexadecimal_digit_expected),"")}function X(){var t=j(1,!1),r=t?parseInt(t,16):-1,n=!1;return r<0?(F(e.Diagnostics.Hexadecimal_digit_expected),n=!0):r>1114111&&(F(e.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive),n=!0),u>=_?(F(e.Diagnostics.Unexpected_end_of_text),n=!0):125===b.charCodeAt(u)?u++:(F(e.Diagnostics.Unterminated_Unicode_escape_sequence),n=!0),n?"":q(r)}function Y(){if(u+5<_&&117===b.charCodeAt(u+1)){var e=u;u+=2;var t=B(4,!1);return u=e,t}return -1}function Z(){if(t>=2&&117===K(b,u+1)&&123===K(b,u+2)){var e=u;u+=3;var r=j(1,!1),n=r?parseInt(r,16):-1;return u=e,n}return -1}function $(){for(var e="",r=u;u<_;){var n=K(b,u);if(z(n,t))u+=U(n);else {if(92!==n)break;if((n=Z())>=0&&z(n,t)){u+=3,v|=8,e+=X(),r=u;continue}if(!((n=Y())>=0&&z(n,t)))break;v|=1024,e+=b.substring(r,u),e+=q(n),r=u+=6;}}return e+b.substring(r,u)}function ee(){var e=y.length;if(e>=2&&e<=12){var t=y.charCodeAt(0);if(t>=97&&t<=122){var r=n.get(y);if(void 0!==r)return m=r}}return m=79}function te(t){for(var r="",n=!1,i=!1;;){var a=b.charCodeAt(u);if(95!==a){if(n=!0,!k(a)||a-48>=t)break;r+=b[u],u++,i=!1;}else v|=512,n?(n=!1,i=!0):F(i?e.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted:e.Diagnostics.Numeric_separators_are_not_allowed_here,u,1),u++;}return 95===b.charCodeAt(u-1)&&F(e.Diagnostics.Numeric_separators_are_not_allowed_here,u-1,1),r}function re(){if(110===b.charCodeAt(u))return y+="n",384&v&&(y=e.parsePseudoBigInt(y)+"n"),u++,9;var t=128&v?parseInt(y.slice(2),2):256&v?parseInt(y.slice(2),8):+y;return y=""+t,8}function ne(){var r;f=u,v=0;for(var n=!1;;){if(g=u,u>=_)return m=1;var o=K(b,u);if(35===o&&0===u&&I(b,u)){if(u=O(b,u),i)continue;return m=6}switch(o){case 10:case 13:if(v|=1,i){u++;continue}return 13===o&&u+1<_&&10===b.charCodeAt(u+1)?u+=2:u++,m=4;case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8203:case 8239:case 8287:case 12288:case 65279:if(i){u++;continue}for(;u<_&&T(b.charCodeAt(u));)u++;return m=5;case 33:return 61===b.charCodeAt(u+1)?61===b.charCodeAt(u+2)?(u+=3,m=37):(u+=2,m=35):(u++,m=53);case 34:case 39:return y=W(),m=10;case 96:return m=H(!1);case 37:return 61===b.charCodeAt(u+1)?(u+=2,m=69):(u++,m=44);case 38:return 38===b.charCodeAt(u+1)?61===b.charCodeAt(u+2)?(u+=3,m=76):(u+=2,m=55):61===b.charCodeAt(u+1)?(u+=2,m=73):(u++,m=50);case 40:return u++,m=20;case 41:return u++,m=21;case 42:if(61===b.charCodeAt(u+1))return u+=2,m=66;if(42===b.charCodeAt(u+1))return 61===b.charCodeAt(u+2)?(u+=3,m=67):(u+=2,m=42);if(u++,x&&!n&&1&v){n=!0;continue}return m=41;case 43:return 43===b.charCodeAt(u+1)?(u+=2,m=45):61===b.charCodeAt(u+1)?(u+=2,m=64):(u++,m=39);case 44:return u++,m=27;case 45:return 45===b.charCodeAt(u+1)?(u+=2,m=46):61===b.charCodeAt(u+1)?(u+=2,m=65):(u++,m=40);case 46:return k(b.charCodeAt(u+1))?(y=M().value,m=8):46===b.charCodeAt(u+1)&&46===b.charCodeAt(u+2)?(u+=3,m=25):(u++,m=24);case 47:if(47===b.charCodeAt(u+1)){for(u+=2;u<_&&!C(b.charCodeAt(u));)u++;if(h=ae(h,b.slice(g,u),d,g),i)continue;return m=2}if(42===b.charCodeAt(u+1)){u+=2,42===b.charCodeAt(u)&&47!==b.charCodeAt(u+1)&&(v|=2);for(var s=!1,c=g;u<_;){var l=b.charCodeAt(u);if(42===l&&47===b.charCodeAt(u+1)){u+=2,s=!0;break}u++,C(l)&&(c=u,v|=1);}if(h=ae(h,b.slice(c,u),p,c),s||F(e.Diagnostics.Asterisk_Slash_expected),i)continue;return s||(v|=4),m=3}return 61===b.charCodeAt(u+1)?(u+=2,m=68):(u++,m=43);case 48:if(u+2<_&&(88===b.charCodeAt(u+1)||120===b.charCodeAt(u+1)))return u+=2,(y=j(1,!0))||(F(e.Diagnostics.Hexadecimal_digit_expected),y="0"),y="0x"+y,v|=64,m=re();if(u+2<_&&(66===b.charCodeAt(u+1)||98===b.charCodeAt(u+1)))return u+=2,(y=te(2))||(F(e.Diagnostics.Binary_digit_expected),y="0"),y="0b"+y,v|=128,m=re();if(u+2<_&&(79===b.charCodeAt(u+1)||111===b.charCodeAt(u+1)))return u+=2,(y=te(8))||(F(e.Diagnostics.Octal_digit_expected),y="0"),y="0o"+y,v|=256,m=re();if(u+1<_&&N(b.charCodeAt(u+1)))return y=""+R(),v|=32,m=8;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return r=M(),m=r.type,y=r.value,m;case 58:return u++,m=58;case 59:return u++,m=26;case 60:if(A(b,u)){if(u=P(b,u,F),i)continue;return m=7}return 60===b.charCodeAt(u+1)?61===b.charCodeAt(u+2)?(u+=3,m=70):(u+=2,m=47):61===b.charCodeAt(u+1)?(u+=2,m=32):1===a&&47===b.charCodeAt(u+1)&&42!==b.charCodeAt(u+2)?(u+=2,m=30):(u++,m=29);case 61:if(A(b,u)){if(u=P(b,u,F),i)continue;return m=7}return 61===b.charCodeAt(u+1)?61===b.charCodeAt(u+2)?(u+=3,m=36):(u+=2,m=34):62===b.charCodeAt(u+1)?(u+=2,m=38):(u++,m=63);case 62:if(A(b,u)){if(u=P(b,u,F),i)continue;return m=7}return u++,m=31;case 63:return 46!==b.charCodeAt(u+1)||k(b.charCodeAt(u+2))?63===b.charCodeAt(u+1)?61===b.charCodeAt(u+2)?(u+=3,m=77):(u+=2,m=60):(u++,m=57):(u+=2,m=28);case 91:return u++,m=22;case 93:return u++,m=23;case 94:return 61===b.charCodeAt(u+1)?(u+=2,m=78):(u++,m=52);case 123:return u++,m=18;case 124:if(A(b,u)){if(u=P(b,u,F),i)continue;return m=7}return 124===b.charCodeAt(u+1)?61===b.charCodeAt(u+2)?(u+=3,m=75):(u+=2,m=56):61===b.charCodeAt(u+1)?(u+=2,m=74):(u++,m=51);case 125:return u++,m=19;case 126:return u++,m=54;case 64:return u++,m=59;case 92:var D=Z();if(D>=0&&J(D,t))return u+=3,v|=8,y=X()+$(),m=ee();var S=Y();return S>=0&&J(S,t)?(u+=6,v|=1024,y=String.fromCharCode(S)+$(),m=ee()):(F(e.Diagnostics.Invalid_character),u++,m=0);case 35:return 0!==u&&"!"===b[u+1]?(F(e.Diagnostics.can_only_be_used_at_the_start_of_a_file),u++,m=0):(J(K(b,u+1),t)?(u++,ie(K(b,u),t)):(y=String.fromCharCode(K(b,u)),F(e.Diagnostics.Invalid_character,u++,U(o))),m=80);default:var E=ie(o,t);if(E)return m=E;if(T(o)){u+=U(o);continue}if(C(o)){v|=1,u+=U(o);continue}var w=U(o);return F(e.Diagnostics.Invalid_character,u,w),u+=w,m=0}}}function ie(e,t){var r=e;if(J(r,t)){for(u+=U(r);u<_&&z(r=K(b,u),t);)u+=U(r);return y=b.substring(g,u),92===r&&(y+=$()),ee()}}function ae(t,r,n,i){var a=function(e,t){var r=t.exec(e);if(r)switch(r[1]){case"ts-expect-error":return 0;case"ts-ignore":return 1}}(e.trimStringStart(r),n);return void 0===a?t:e.append(t,{range:{pos:i,end:u},type:a})}function oe(t){if(void 0===t&&(t=!0),f=g=u,u>=_)return m=1;var r=b.charCodeAt(u);if(60===r)return 47===b.charCodeAt(u+1)?(u+=2,m=30):(u++,m=29);if(123===r)return u++,m=18;for(var n=0;u<_&&123!==(r=b.charCodeAt(u));){if(60===r){if(A(b,u))return u=P(b,u,F),m=7;break}if(62===r&&F(e.Diagnostics.Unexpected_token_Did_you_mean_or_gt,u,1),125===r&&F(e.Diagnostics.Unexpected_token_Did_you_mean_or_rbrace,u,1),C(r)&&0===n)n=-1;else {if(!t&&C(r)&&n>0)break;S(r)||(n=u);}u++;}return y=b.substring(f,u),-1===n?12:11}function se(){switch(f=u,b.charCodeAt(u)){case 34:case 39:return y=W(!0),m=10;default:return ne()}}function ce(e,t){var r=u,n=f,i=g,a=m,o=y,s=v,c=e();return c&&!t||(u=r,f=n,g=i,m=a,y=o,v=s),c}function le(e,t,r){b=e||"",_=void 0===r?b.length:t+r,ue(t||0);}function ue(t){e.Debug.assert(t>=0),u=t,f=t,g=t,m=0,y=void 0,v=0;}};var K=String.prototype.codePointAt?function(e,t){return e.codePointAt(t)}:function(e,t){var r=e.length;if(!(t<0||t>=r)){var n=e.charCodeAt(t);if(n>=55296&&n<=56319&&r>t+1){var i=e.charCodeAt(t+1);if(i>=56320&&i<=57343)return 1024*(n-55296)+i-56320+65536}return n}};function U(e){return e>=65536?2:1}var V=String.fromCodePoint?function(e){return String.fromCodePoint(e)}:function(t){if(e.Debug.assert(0<=t&&t<=1114111),t<=65535)return String.fromCharCode(t);var r=Math.floor((t-65536)/1024)+55296,n=(t-65536)%1024+56320;return String.fromCharCode(r,n)};function q(e){return V(e)}e.utf16EncodeAsString=q;}(t),function(e){function t(e){return e.start+e.length}function r(e){return 0===e.length}function n(e,t){var r=a(e,t);return r&&0===r.length?void 0:r}function i(e,t,r,n){return r<=e+t&&r+n>=e}function a(e,r){var n=Math.max(e.start,r.start),i=Math.min(t(e),t(r));return n<=i?s(n,i):void 0}function o(e,t){if(e<0)throw new Error("start < 0");if(t<0)throw new Error("length < 0");return {start:e,length:t}}function s(e,t){return o(e,t-e)}function c(e,t){if(t<0)throw new Error("newLength < 0");return {span:e,newLength:t}}function l(t){return !!Z(t)&&e.every(t.elements,u)}function u(t){return !!e.isOmittedExpression(t)||l(t.name)}function _(t){for(var r=t.parent;e.isBindingElement(r.parent);)r=r.parent.parent;return r.parent}function d(t,r){e.isBindingElement(t)&&(t=_(t));var n=r(t);return 254===t.kind&&(t=t.parent),t&&255===t.kind&&(n|=r(t),t=t.parent),t&&237===t.kind&&(n|=r(t)),n}function p(e){return 0==(8&e.flags)}function f(e){var t=e;return t.length>=3&&95===t.charCodeAt(0)&&95===t.charCodeAt(1)&&95===t.charCodeAt(2)?t.substr(1):t}function g(e){return f(e.escapedText)}function m(t){var r=t.parent.parent;if(r){if(se(r))return y(r);switch(r.kind){case 237:if(r.declarationList&&r.declarationList.declarations[0])return y(r.declarationList.declarations[0]);break;case 238:var n=r.expression;switch(221===n.kind&&63===n.operatorToken.kind&&(n=n.left),n.kind){case 206:return n.name;case 207:var i=n.argumentExpression;if(e.isIdentifier(i))return i}break;case 212:return y(r.expression);case 250:if(se(r.statement)||ne(r.statement))return y(r.statement)}}}function y(t){var r=x(t);return r&&e.isIdentifier(r)?r:void 0}function v(e){return e.name||m(e)}function h(e){return !!e.name}function b(t){switch(t.kind){case 79:return t;case 347:case 340:var r=t.name;if(161===r.kind)return r.right;break;case 208:case 221:var n=t;switch(e.getAssignmentDeclarationKind(n)){case 1:case 4:case 5:case 3:return e.getElementOrPropertyAccessArgumentExpressionOrName(n.left);case 7:case 8:case 9:return n.arguments[1];default:return}case 345:return v(t);case 339:return m(t);case 271:var i=t.expression;return e.isIdentifier(i)?i:void 0;case 207:var a=t;if(e.isBindableStaticElementAccessExpression(a))return a.argumentExpression}return t.name}function x(t){if(void 0!==t)return b(t)||(e.isFunctionExpression(t)||e.isArrowFunction(t)||e.isClassExpression(t)?D(t):void 0)}function D(t){if(t.parent){if(e.isPropertyAssignment(t.parent)||e.isBindingElement(t.parent))return t.parent.name;if(e.isBinaryExpression(t.parent)&&t===t.parent.right){if(e.isIdentifier(t.parent.left))return t.parent.left;if(e.isAccessExpression(t.parent.left))return e.getElementOrPropertyAccessArgumentExpressionOrName(t.parent.left)}else if(e.isVariableDeclaration(t.parent)&&e.isIdentifier(t.parent.name))return t.parent.name}}function S(t,r){if(t.name){if(e.isIdentifier(t.name)){var n=t.name.escapedText;return F(t.parent,r).filter((function(t){return e.isJSDocParameterTag(t)&&e.isIdentifier(t.name)&&t.name.escapedText===n}))}var i=t.parent.parameters.indexOf(t);e.Debug.assert(i>-1,"Parameters should always be in their parents' parameter list");var a=F(t.parent,r).filter(e.isJSDocParameterTag);if(i<a.length)return [a[i]]}return e.emptyArray}function T(e){return S(e,!1)}function C(t,r){var n=t.name.escapedText;return F(t.parent,r).filter((function(t){return e.isJSDocTemplateTag(t)&&t.typeParameters.some((function(e){return e.name.escapedText===n}))}))}function k(t){return P(t,e.isJSDocReturnTag)}function E(t){var r=P(t,e.isJSDocTypeTag);if(r&&r.typeExpression&&r.typeExpression.type)return r}function N(t){var r=P(t,e.isJSDocTypeTag);return !r&&e.isParameter(t)&&(r=e.find(T(t),(function(e){return !!e.typeExpression}))),r&&r.typeExpression&&r.typeExpression.type}function F(t,r){var n=t.jsDocCache;if(void 0===n||r){var i=e.getJSDocCommentsAndTags(t,r);e.Debug.assert(i.length<2||i[0]!==i[1]),n=e.flatMap(i,(function(t){return e.isJSDoc(t)?t.tags:t})),r||(t.jsDocCache=n);}return n}function A(e){return F(e,!1)}function P(t,r,n){return e.find(F(t,n),r)}function w(e,t){return A(e).filter(t)}function I(e){var t=e.kind;return !!(32&e.flags)&&(206===t||207===t||208===t||230===t)}function O(t){return I(t)&&!e.isNonNullExpression(t)&&!!t.questionDotToken}function M(t){return e.skipOuterExpressions(t,8)}function L(e){switch(e.kind){case 302:case 303:return !0;default:return !1}}function R(e){return e>=161}function B(e){return e>=0&&e<=160}function j(e){return 8<=e&&e<=14}function J(e){return 14<=e&&e<=17}function z(t){return (e.isPropertyDeclaration(t)||Q(t))&&e.isPrivateIdentifier(t.name)}function K(e){switch(e){case 126:case 131:case 85:case 135:case 88:case 93:case 101:case 123:case 121:case 122:case 145:case 124:case 144:case 159:return !0}return !1}function U(t){return !!(16476&e.modifierToFlag(t))}function V(e){return !!e&&W(e.kind)}function q(e){switch(e){case 256:case 169:case 171:case 172:case 173:case 213:case 214:return !0;default:return !1}}function W(e){switch(e){case 168:case 174:case 323:case 175:case 176:case 179:case 317:case 180:return !0;default:return q(e)}}function H(e){var t=e.kind;return 171===t||167===t||169===t||172===t||173===t||176===t||170===t||234===t}function G(e){return e&&(257===e.kind||226===e.kind)}function Q(e){switch(e.kind){case 169:case 172:case 173:return !0;default:return !1}}function X(e){var t=e.kind;return 175===t||174===t||166===t||168===t||176===t||172===t||173===t}function Y(e){var t=e.kind;return 296===t||297===t||298===t||169===t||172===t||173===t}function Z(e){if(e){var t=e.kind;return 202===t||201===t}return !1}function $(e){switch(e.kind){case 201:case 205:return !0}return !1}function ee(e){switch(e.kind){case 202:case 204:return !0}return !1}function te(e){switch(e){case 206:case 207:case 209:case 208:case 278:case 279:case 282:case 210:case 204:case 212:case 205:case 226:case 213:case 79:case 80:case 13:case 8:case 9:case 10:case 14:case 223:case 95:case 104:case 108:case 110:case 106:case 230:case 228:case 231:case 100:return !0;default:return !1}}function re(e){switch(e){case 219:case 220:case 215:case 216:case 217:case 218:case 211:return !0;default:return te(e)}}function ne(e){return function(e){switch(e){case 222:case 224:case 214:case 221:case 225:case 229:case 227:case 351:case 350:return !0;default:return re(e)}}(M(e).kind)}function ie(t){return e.isExportAssignment(t)||e.isExportDeclaration(t)}function ae(e){return 256===e||276===e||257===e||258===e||259===e||260===e||261===e||266===e||265===e||272===e||271===e||264===e}function oe(e){return 246===e||245===e||253===e||240===e||238===e||236===e||243===e||244===e||242===e||239===e||250===e||247===e||249===e||251===e||252===e||237===e||241===e||248===e||349===e||353===e||352===e}function se(t){return 163===t.kind?t.parent&&344!==t.parent.kind||e.isInJSFile(t):214===(r=t.kind)||203===r||257===r||226===r||170===r||171===r||260===r||299===r||275===r||256===r||213===r||172===r||267===r||265===r||270===r||258===r||285===r||169===r||168===r||261===r||264===r||268===r||274===r||164===r||296===r||167===r||166===r||173===r||297===r||259===r||163===r||254===r||345===r||338===r||347===r;var r;}function ce(e){return e.kind>=327&&e.kind<=347}e.isExternalModuleNameRelative=function(t){return e.pathIsRelative(t)||e.isRootedDiskPath(t)},e.sortAndDeduplicateDiagnostics=function(t){return e.sortAndDeduplicate(t,e.compareDiagnostics)},e.getDefaultLibFileName=function(t){switch(e.getEmitScriptTarget(t)){case 99:return "lib.esnext.full.d.ts";case 9:return "lib.es2022.full.d.ts";case 8:return "lib.es2021.full.d.ts";case 7:return "lib.es2020.full.d.ts";case 6:return "lib.es2019.full.d.ts";case 5:return "lib.es2018.full.d.ts";case 4:return "lib.es2017.full.d.ts";case 3:return "lib.es2016.full.d.ts";case 2:return "lib.es6.d.ts";default:return "lib.d.ts"}},e.textSpanEnd=t,e.textSpanIsEmpty=r,e.textSpanContainsPosition=function(e,r){return r>=e.start&&r<t(e)},e.textRangeContainsPositionInclusive=function(e,t){return t>=e.pos&&t<=e.end},e.textSpanContainsTextSpan=function(e,r){return r.start>=e.start&&t(r)<=t(e)},e.textSpanOverlapsWith=function(e,t){return void 0!==n(e,t)},e.textSpanOverlap=n,e.textSpanIntersectsWithTextSpan=function(e,t){return i(e.start,e.length,t.start,t.length)},e.textSpanIntersectsWith=function(e,t,r){return i(e.start,e.length,t,r)},e.decodedTextSpanIntersectsWith=i,e.textSpanIntersectsWithPosition=function(e,r){return r<=t(e)&&r>=e.start},e.textSpanIntersection=a,e.createTextSpan=o,e.createTextSpanFromBounds=s,e.textChangeRangeNewSpan=function(e){return o(e.span.start,e.newLength)},e.textChangeRangeIsUnchanged=function(e){return r(e.span)&&0===e.newLength},e.createTextChangeRange=c,e.unchangedTextChangeRange=c(o(0,0),0),e.collapseTextChangeRangesAcrossMultipleVersions=function(r){if(0===r.length)return e.unchangedTextChangeRange;if(1===r.length)return r[0];for(var n=r[0],i=n.span.start,a=t(n.span),o=i+n.newLength,l=1;l<r.length;l++){var u=r[l],_=i,d=a,p=o,f=u.span.start,g=t(u.span),m=f+u.newLength;i=Math.min(_,f),a=Math.max(d,d+(g-p)),o=Math.max(m,m+(p-g));}return c(s(i,a),o-i)},e.getTypeParameterOwner=function(e){if(e&&163===e.kind)for(var t=e;t;t=t.parent)if(V(t)||G(t)||258===t.kind)return t},e.isParameterPropertyDeclaration=function(t,r){return e.hasSyntacticModifier(t,16476)&&171===r.kind},e.isEmptyBindingPattern=l,e.isEmptyBindingElement=u,e.walkUpBindingElementsAndPatterns=_,e.getCombinedModifierFlags=function(t){return d(t,e.getEffectiveModifierFlags)},e.getCombinedNodeFlagsAlwaysIncludeJSDoc=function(t){return d(t,e.getEffectiveModifierFlagsAlwaysIncludeJSDoc)},e.getCombinedNodeFlags=function(e){return d(e,(function(e){return e.flags}))},e.supportedLocaleDirectories=["cs","de","es","fr","it","ja","ko","pl","pt-br","ru","tr","zh-cn","zh-tw"],e.validateLocaleAndSetLanguage=function(t,r,n){var i=t.toLowerCase(),a=/^([a-z]+)([_\-]([a-z]+))?$/.exec(i);if(a){var o=a[1],s=a[3];e.contains(e.supportedLocaleDirectories,i)&&!c(o,s,n)&&c(o,void 0,n),e.setUILocale(t);}else n&&n.push(e.createCompilerDiagnostic(e.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1,"en","ja-jp"));function c(t,n,i){var a=e.normalizePath(r.getExecutingFilePath()),o=e.getDirectoryPath(a),s=e.combinePaths(o,t);if(n&&(s=s+"-"+n),s=r.resolvePath(e.combinePaths(s,"diagnosticMessages.generated.json")),!r.fileExists(s))return !1;var c="";try{c=r.readFile(s);}catch(t){return i&&i.push(e.createCompilerDiagnostic(e.Diagnostics.Unable_to_open_file_0,s)),!1}try{e.setLocalizedDiagnosticMessages(JSON.parse(c));}catch(t){return i&&i.push(e.createCompilerDiagnostic(e.Diagnostics.Corrupted_locale_file_0,s)),!1}return !0}},e.getOriginalNode=function(e,t){if(e)for(;void 0!==e.original;)e=e.original;return !t||t(e)?e:void 0},e.findAncestor=function(e,t){for(;e;){var r=t(e);if("quit"===r)return;if(r)return e;e=e.parent;}},e.isParseTreeNode=p,e.getParseTreeNode=function(e,t){if(void 0===e||p(e))return e;for(e=e.original;e;){if(p(e))return !t||t(e)?e:void 0;e=e.original;}},e.escapeLeadingUnderscores=function(e){return e.length>=2&&95===e.charCodeAt(0)&&95===e.charCodeAt(1)?"_"+e:e},e.unescapeLeadingUnderscores=f,e.idText=g,e.symbolName=function(e){return e.valueDeclaration&&z(e.valueDeclaration)?g(e.valueDeclaration.name):f(e.escapedName)},e.nodeHasName=function t(r,n){return !(!h(r)||!e.isIdentifier(r.name)||g(r.name)!==g(n))||!(!e.isVariableStatement(r)||!e.some(r.declarationList.declarations,(function(e){return t(e,n)})))},e.getNameOfJSDocTypedef=v,e.isNamedDeclaration=h,e.getNonAssignedNameOfDeclaration=b,e.getNameOfDeclaration=x,e.getAssignedName=D,e.getJSDocParameterTags=T,e.getJSDocParameterTagsNoCache=function(e){return S(e,!0)},e.getJSDocTypeParameterTags=function(e){return C(e,!1)},e.getJSDocTypeParameterTagsNoCache=function(e){return C(e,!0)},e.hasJSDocParameterTags=function(t){return !!P(t,e.isJSDocParameterTag)},e.getJSDocAugmentsTag=function(t){return P(t,e.isJSDocAugmentsTag)},e.getJSDocImplementsTags=function(t){return w(t,e.isJSDocImplementsTag)},e.getJSDocClassTag=function(t){return P(t,e.isJSDocClassTag)},e.getJSDocPublicTag=function(t){return P(t,e.isJSDocPublicTag)},e.getJSDocPublicTagNoCache=function(t){return P(t,e.isJSDocPublicTag,!0)},e.getJSDocPrivateTag=function(t){return P(t,e.isJSDocPrivateTag)},e.getJSDocPrivateTagNoCache=function(t){return P(t,e.isJSDocPrivateTag,!0)},e.getJSDocProtectedTag=function(t){return P(t,e.isJSDocProtectedTag)},e.getJSDocProtectedTagNoCache=function(t){return P(t,e.isJSDocProtectedTag,!0)},e.getJSDocReadonlyTag=function(t){return P(t,e.isJSDocReadonlyTag)},e.getJSDocReadonlyTagNoCache=function(t){return P(t,e.isJSDocReadonlyTag,!0)},e.getJSDocOverrideTagNoCache=function(t){return P(t,e.isJSDocOverrideTag,!0)},e.getJSDocDeprecatedTag=function(t){return P(t,e.isJSDocDeprecatedTag)},e.getJSDocDeprecatedTagNoCache=function(t){return P(t,e.isJSDocDeprecatedTag,!0)},e.getJSDocEnumTag=function(t){return P(t,e.isJSDocEnumTag)},e.getJSDocThisTag=function(t){return P(t,e.isJSDocThisTag)},e.getJSDocReturnTag=k,e.getJSDocTemplateTag=function(t){return P(t,e.isJSDocTemplateTag)},e.getJSDocTypeTag=E,e.getJSDocType=N,e.getJSDocReturnType=function(t){var r=k(t);if(r&&r.typeExpression)return r.typeExpression.type;var n=E(t);if(n&&n.typeExpression){var i=n.typeExpression.type;if(e.isTypeLiteralNode(i)){var a=e.find(i.members,e.isCallSignatureDeclaration);return a&&a.type}if(e.isFunctionTypeNode(i)||e.isJSDocFunctionType(i))return i.type}},e.getJSDocTags=A,e.getJSDocTagsNoCache=function(e){return F(e,!0)},e.getAllJSDocTags=w,e.getAllJSDocTagsOfKind=function(e,t){return A(e).filter((function(e){return e.kind===t}))},e.getTextOfJSDocComment=function(t){return "string"==typeof t?t:null==t?void 0:t.map((function(t){return 321===t.kind?t.text:(n=324===(r=t).kind?"link":325===r.kind?"linkcode":"linkplain",i=r.name?e.entityNameToString(r.name):"",a=r.name&&r.text.startsWith("://")?"":" ","{@".concat(n," ").concat(i).concat(a).concat(r.text,"}"));var r,n,i,a;})).join("")},e.getEffectiveTypeParameterDeclarations=function(t){if(e.isJSDocSignature(t))return e.emptyArray;if(e.isJSDocTypeAlias(t))return e.Debug.assert(320===t.parent.kind),e.flatMap(t.parent.tags,(function(t){return e.isJSDocTemplateTag(t)?t.typeParameters:void 0}));if(t.typeParameters)return t.typeParameters;if(e.isInJSFile(t)){var r=e.getJSDocTypeParameterDeclarations(t);if(r.length)return r;var n=N(t);if(n&&e.isFunctionTypeNode(n)&&n.typeParameters)return n.typeParameters}return e.emptyArray},e.getEffectiveConstraintOfTypeParameter=function(t){return t.constraint?t.constraint:e.isJSDocTemplateTag(t.parent)&&t===t.parent.typeParameters[0]?t.parent.constraint:void 0},e.isMemberName=function(e){return 79===e.kind||80===e.kind},e.isGetOrSetAccessorDeclaration=function(e){return 173===e.kind||172===e.kind},e.isPropertyAccessChain=function(t){return e.isPropertyAccessExpression(t)&&!!(32&t.flags)},e.isElementAccessChain=function(t){return e.isElementAccessExpression(t)&&!!(32&t.flags)},e.isCallChain=function(t){return e.isCallExpression(t)&&!!(32&t.flags)},e.isOptionalChain=I,e.isOptionalChainRoot=O,e.isExpressionOfOptionalChainRoot=function(e){return O(e.parent)&&e.parent.expression===e},e.isOutermostOptionalChain=function(e){return !I(e.parent)||O(e.parent)||e!==e.parent.expression},e.isNullishCoalesce=function(e){return 221===e.kind&&60===e.operatorToken.kind},e.isConstTypeReference=function(t){return e.isTypeReferenceNode(t)&&e.isIdentifier(t.typeName)&&"const"===t.typeName.escapedText&&!t.typeArguments},e.skipPartiallyEmittedExpressions=M,e.isNonNullChain=function(t){return e.isNonNullExpression(t)&&!!(32&t.flags)},e.isBreakOrContinueStatement=function(e){return 246===e.kind||245===e.kind},e.isNamedExportBindings=function(e){return 274===e.kind||273===e.kind},e.isUnparsedTextLike=L,e.isUnparsedNode=function(e){return L(e)||300===e.kind||304===e.kind},e.isJSDocPropertyLikeTag=function(e){return 347===e.kind||340===e.kind},e.isNode=function(e){return R(e.kind)},e.isNodeKind=R,e.isTokenKind=B,e.isToken=function(e){return B(e.kind)},e.isNodeArray=function(e){return e.hasOwnProperty("pos")&&e.hasOwnProperty("end")},e.isLiteralKind=j,e.isLiteralExpression=function(e){return j(e.kind)},e.isTemplateLiteralKind=J,e.isTemplateLiteralToken=function(e){return J(e.kind)},e.isTemplateMiddleOrTemplateTail=function(e){var t=e.kind;return 16===t||17===t},e.isImportOrExportSpecifier=function(t){return e.isImportSpecifier(t)||e.isExportSpecifier(t)},e.isTypeOnlyImportOrExportDeclaration=function(e){switch(e.kind){case 270:case 275:return e.isTypeOnly||e.parent.parent.isTypeOnly;case 268:return e.parent.isTypeOnly;case 267:case 265:return e.isTypeOnly;default:return !1}},e.isAssertionKey=function(t){return e.isStringLiteral(t)||e.isIdentifier(t)},e.isStringTextContainingNode=function(e){return 10===e.kind||J(e.kind)},e.isGeneratedIdentifier=function(t){return e.isIdentifier(t)&&(7&t.autoGenerateFlags)>0},e.isPrivateIdentifierClassElementDeclaration=z,e.isPrivateIdentifierPropertyAccessExpression=function(t){return e.isPropertyAccessExpression(t)&&e.isPrivateIdentifier(t.name)},e.isModifierKind=K,e.isParameterPropertyModifier=U,e.isClassMemberModifier=function(e){return U(e)||124===e||159===e},e.isModifier=function(e){return K(e.kind)},e.isEntityName=function(e){var t=e.kind;return 161===t||79===t},e.isPropertyName=function(e){var t=e.kind;return 79===t||80===t||10===t||8===t||162===t},e.isBindingName=function(e){var t=e.kind;return 79===t||201===t||202===t},e.isFunctionLike=V,e.isFunctionLikeOrClassStaticBlockDeclaration=function(t){return !!t&&(W(t.kind)||e.isClassStaticBlockDeclaration(t))},e.isFunctionLikeDeclaration=function(e){return e&&q(e.kind)},e.isBooleanLiteral=function(e){return 110===e.kind||95===e.kind},e.isFunctionLikeKind=W,e.isFunctionOrModuleBlock=function(t){return e.isSourceFile(t)||e.isModuleBlock(t)||e.isBlock(t)&&V(t.parent)},e.isClassElement=H,e.isClassLike=G,e.isAccessor=function(e){return e&&(172===e.kind||173===e.kind)},e.isMethodOrAccessor=Q,e.isTypeElement=X,e.isClassOrTypeElement=function(e){return X(e)||H(e)},e.isObjectLiteralElementLike=Y,e.isTypeNode=function(t){return e.isTypeNodeKind(t.kind)},e.isFunctionOrConstructorTypeNode=function(e){switch(e.kind){case 179:case 180:return !0}return !1},e.isBindingPattern=Z,e.isAssignmentPattern=function(e){var t=e.kind;return 204===t||205===t},e.isArrayBindingElement=function(e){var t=e.kind;return 203===t||227===t},e.isDeclarationBindingElement=function(e){switch(e.kind){case 254:case 164:case 203:return !0}return !1},e.isBindingOrAssignmentPattern=function(e){return $(e)||ee(e)},e.isObjectBindingOrAssignmentPattern=$,e.isObjectBindingOrAssignmentElement=function(e){switch(e.kind){case 203:case 296:case 297:case 298:return !0}return !1},e.isArrayBindingOrAssignmentPattern=ee,e.isPropertyAccessOrQualifiedNameOrImportTypeNode=function(e){var t=e.kind;return 206===t||161===t||200===t},e.isPropertyAccessOrQualifiedName=function(e){var t=e.kind;return 206===t||161===t},e.isCallLikeExpression=function(e){switch(e.kind){case 280:case 279:case 208:case 209:case 210:case 165:return !0;default:return !1}},e.isCallOrNewExpression=function(e){return 208===e.kind||209===e.kind},e.isTemplateLiteral=function(e){var t=e.kind;return 223===t||14===t},e.isLeftHandSideExpression=function(e){return te(M(e).kind)},e.isUnaryExpression=function(e){return re(M(e).kind)},e.isUnaryExpressionWithWrite=function(e){switch(e.kind){case 220:return !0;case 219:return 45===e.operator||46===e.operator;default:return !1}},e.isExpression=ne,e.isAssertionExpression=function(e){var t=e.kind;return 211===t||229===t},e.isNotEmittedOrPartiallyEmittedNode=function(t){return e.isNotEmittedStatement(t)||e.isPartiallyEmittedExpression(t)},e.isIterationStatement=function e(t,r){switch(t.kind){case 242:case 243:case 244:case 240:case 241:return !0;case 250:return r&&e(t.statement,r)}return !1},e.isScopeMarker=ie,e.hasScopeMarker=function(t){return e.some(t,ie)},e.needsScopeMarker=function(t){return !(e.isAnyImportOrReExport(t)||e.isExportAssignment(t)||e.hasSyntacticModifier(t,1)||e.isAmbientModule(t))},e.isExternalModuleIndicator=function(t){return e.isAnyImportOrReExport(t)||e.isExportAssignment(t)||e.hasSyntacticModifier(t,1)},e.isForInOrOfStatement=function(e){return 243===e.kind||244===e.kind},e.isConciseBody=function(t){return e.isBlock(t)||ne(t)},e.isFunctionBody=function(t){return e.isBlock(t)},e.isForInitializer=function(t){return e.isVariableDeclarationList(t)||ne(t)},e.isModuleBody=function(e){var t=e.kind;return 262===t||261===t||79===t},e.isNamespaceBody=function(e){var t=e.kind;return 262===t||261===t},e.isJSDocNamespaceBody=function(e){var t=e.kind;return 79===t||261===t},e.isNamedImportBindings=function(e){var t=e.kind;return 269===t||268===t},e.isModuleOrEnumDeclaration=function(e){return 261===e.kind||260===e.kind},e.isDeclaration=se,e.isDeclarationStatement=function(e){return ae(e.kind)},e.isStatementButNotDeclaration=function(e){return oe(e.kind)},e.isStatement=function(t){var r=t.kind;return oe(r)||ae(r)||function(t){return 235===t.kind&&((void 0===t.parent||252!==t.parent.kind&&292!==t.parent.kind)&&!e.isFunctionBlock(t))}(t)},e.isStatementOrBlock=function(e){var t=e.kind;return oe(t)||ae(t)||235===t},e.isModuleReference=function(e){var t=e.kind;return 277===t||161===t||79===t},e.isJsxTagNameExpression=function(e){var t=e.kind;return 108===t||79===t||206===t},e.isJsxChild=function(e){var t=e.kind;return 278===t||288===t||279===t||11===t||282===t},e.isJsxAttributeLike=function(e){var t=e.kind;return 285===t||287===t},e.isStringLiteralOrJsxExpression=function(e){var t=e.kind;return 10===t||288===t},e.isJsxOpeningLikeElement=function(e){var t=e.kind;return 280===t||279===t},e.isCaseOrDefaultClause=function(e){var t=e.kind;return 289===t||290===t},e.isJSDocNode=function(e){return e.kind>=309&&e.kind<=347},e.isJSDocCommentContainingNode=function(t){return 320===t.kind||319===t.kind||321===t.kind||ue(t)||ce(t)||e.isJSDocTypeLiteral(t)||e.isJSDocSignature(t)},e.isJSDocTag=ce,e.isSetAccessor=function(e){return 173===e.kind},e.isGetAccessor=function(e){return 172===e.kind},e.hasJSDocNodes=function(e){var t=e.jsDoc;return !!t&&t.length>0},e.hasType=function(e){return !!e.type},e.hasInitializer=function(e){return !!e.initializer},e.hasOnlyExpressionInitializer=function(e){switch(e.kind){case 254:case 164:case 203:case 166:case 167:case 296:case 299:return !0;default:return !1}},e.isObjectLiteralElement=function(e){return 285===e.kind||287===e.kind||Y(e)},e.isTypeReferenceType=function(e){return 178===e.kind||228===e.kind};var le=1073741823;function ue(e){return 324===e.kind||325===e.kind||326===e.kind}e.guessIndentation=function(t){for(var r=le,n=0,i=t;n<i.length;n++){var a=i[n];if(a.length){for(var o=0;o<a.length&&o<r&&e.isWhiteSpaceLike(a.charCodeAt(o));o++);if(o<r&&(r=o),0===r)return 0}}return r===le?void 0:r},e.isStringLiteralLike=function(e){return 10===e.kind||14===e.kind},e.isJSDocLinkLike=ue;}(t),function(e){e.resolvingEmptyArray=[],e.externalHelpersModuleNameText="tslib",e.defaultMaximumTruncationLength=160,e.noTruncationMaximumTruncationLength=1e6,e.getDeclarationOfKind=function(e,t){var r=e.declarations;if(r)for(var n=0,i=r;n<i.length;n++){var a=i[n];if(a.kind===t)return a}},e.getDeclarationsOfKind=function(t,r){return e.filter(t.declarations||e.emptyArray,(function(e){return e.kind===r}))},e.createSymbolTable=function(t){var r=new e.Map;if(t)for(var n=0,i=t;n<i.length;n++){var a=i[n];r.set(a.escapedName,a);}return r},e.isTransientSymbol=function(e){return 0!=(33554432&e.flags)};var t,r,a,o=(t="",{getText:function(){return t},write:r=function(e){return t+=e},rawWrite:r,writeKeyword:r,writeOperator:r,writePunctuation:r,writeSpace:r,writeStringLiteral:r,writeLiteral:r,writeParameter:r,writeProperty:r,writeSymbol:function(e,t){return r(e)},writeTrailingSemicolon:r,writeComment:r,getTextPos:function(){return t.length},getLine:function(){return 0},getColumn:function(){return 0},getIndent:function(){return 0},isAtStartOfLine:function(){return !1},hasTrailingComment:function(){return !1},hasTrailingWhitespace:function(){return !!t.length&&e.isWhiteSpaceLike(t.charCodeAt(t.length-1))},writeLine:function(){return t+=" "},increaseIndent:e.noop,decreaseIndent:e.noop,clear:function(){return t=""},trackSymbol:function(){return !1},reportInaccessibleThisError:e.noop,reportInaccessibleUniqueSymbolError:e.noop,reportPrivateInBaseOfClassExpression:e.noop});function s(t,r){return c(t,r,e.moduleResolutionOptionDeclarations)}function c(e,t,r){return e!==t&&r.some((function(r){return !xi(Jn(e,r),Jn(t,r))}))}function l(e){return e.end-e.pos}function u(e){var t=e.name,r=e.subModuleName;return r?"".concat(t,"/").concat(r):t}function _(e){for(;e&&305!==e.kind;)e=e.parent;return e}function d(t,r){e.Debug.assert(t>=0);var n=e.getLineStarts(r),i=t,a=r.text;if(i+1===n.length)return a.length-1;var o=n[i],s=n[i+1]-1;for(e.Debug.assert(e.isLineBreak(a.charCodeAt(s)));o<=s&&e.isLineBreak(a.charCodeAt(s));)s--;return s}function p(e){return void 0===e||e.pos===e.end&&e.pos>=0&&1!==e.kind}function f(e){return !p(e)}function g(e,t,r){if(void 0===t||0===t.length)return e;for(var i=0;i<e.length&&r(e[i]);++i);return e.splice.apply(e,n$4([i,0],t,!1)),e}function m(e,t,r){if(void 0===t)return e;for(var n=0;n<e.length&&r(e[n]);++n);return e.splice(n,0,t),e}function y(e){return Q(e)||!!(1048576&T(e))}function v(e,t){return 42===e.charCodeAt(t+1)&&33===e.charCodeAt(t+2)}function h(t,r,n){return p(t)?t.pos:e.isJSDocNode(t)||11===t.kind?e.skipTrivia((r||_(t)).text,t.pos,!1,!0):n&&e.hasJSDocNodes(t)?h(t.jsDoc[0],r):348===t.kind&&t._children.length>0?h(t._children[0],r,n):e.skipTrivia((r||_(t)).text,t.pos,!1,!1,Te(t))}function b(e,t,r){return void 0===r&&(r=!1),x(e.text,t,r)}function x(t,r,n){if(void 0===n&&(n=!1),p(r))return "";var i=t.substring(n?r.pos:e.skipTrivia(t,r.pos),r.end);return function(t){return !!e.findAncestor(t,e.isJSDocTypeExpression)}(r)&&(i=i.split(/\r\n|\n|\r/).map((function(t){return e.trimStringStart(t.replace(/^\s*\*/,""))})).join("\n")),i}function D(e,t){return void 0===t&&(t=!1),b(_(e),e,t)}function S(e){return e.pos}function T(e){var t=e.emitNode;return t&&t.flags||0}function C(e){var t=wt(e);return 254===t.kind&&292===t.parent.kind}function k(t){return e.isModuleDeclaration(t)&&(10===t.name.kind||N(t))}function E(t){return e.isModuleDeclaration(t)||e.isIdentifier(t)}function N(e){return !!(1024&e.flags)}function F(e){return k(e)&&A(e)}function A(t){switch(t.parent.kind){case 305:return e.isExternalModule(t.parent);case 262:return k(t.parent.parent)&&e.isSourceFile(t.parent.parent.parent)&&!e.isExternalModule(t.parent.parent.parent)}return !1}function P(t){var r;return null===(r=t.declarations)||void 0===r?void 0:r.find((function(t){return !(F(t)||e.isModuleDeclaration(t)&&N(t))}))}function w(t,r){switch(t.kind){case 305:case 263:case 292:case 261:case 242:case 243:case 244:case 171:case 169:case 172:case 173:case 256:case 213:case 214:case 167:case 170:return !0;case 235:return !e.isFunctionLikeOrClassStaticBlockDeclaration(r)}return !1}function I(t){switch(t.kind){case 174:case 175:case 168:case 176:case 179:case 180:case 317:case 257:case 226:case 258:case 259:case 344:case 256:case 169:case 171:case 172:case 173:case 213:case 214:return !0;default:return e.assertType(t),!1}}function O(e){switch(e.kind){case 266:case 265:return !0;default:return !1}}function M(t){return O(t)||e.isExportDeclaration(t)}function L(t){return e.findAncestor(t.parent,(function(e){return w(e,e.parent)}))}function R(e){return e&&0!==l(e)?D(e):"(Missing)"}function B(t){switch(t.kind){case 79:case 80:return t.escapedText;case 10:case 8:case 14:return e.escapeLeadingUnderscores(t.text);case 162:return Ct(t.expression)?e.escapeLeadingUnderscores(t.expression.text):void 0;default:return e.Debug.assertNever(t)}}function j(t){switch(t.kind){case 108:return "this";case 80:case 79:return 0===l(t)?e.idText(t):D(t);case 161:return j(t.left)+"."+j(t.right);case 206:return e.isIdentifier(t.name)||e.isPrivateIdentifier(t.name)?j(t.expression)+"."+j(t.name):e.Debug.assertNever(t.name);case 311:return j(t.left)+j(t.right);default:return e.Debug.assertNever(t)}}function J(e,t,r,n,i,a,o){var s=V(e,t);return Tn(e,s.start,s.length,r,n,i,a,o)}function z(t,r,n){e.Debug.assertGreaterThanOrEqual(r,0),e.Debug.assertGreaterThanOrEqual(n,0),t&&(e.Debug.assertLessThanOrEqual(r,t.text.length),e.Debug.assertLessThanOrEqual(r+n,t.text.length));}function K(e,t,r,n,i){return z(e,t,r),{file:e,start:t,length:r,code:n.code,category:n.category,messageText:n.next?n:n.messageText,relatedInformation:i}}function U(t,r){var n=e.createScanner(t.languageVersion,!0,t.languageVariant,t.text,void 0,r);n.scan();var i=n.getTokenPos();return e.createTextSpanFromBounds(i,n.getTextPos())}function V(t,r){var n=r;switch(r.kind){case 305:var i=e.skipTrivia(t.text,0,!1);return i===t.text.length?e.createTextSpan(0,0):U(t,i);case 254:case 203:case 257:case 226:case 258:case 261:case 260:case 299:case 256:case 213:case 169:case 172:case 173:case 259:case 167:case 166:case 268:n=r.name;break;case 214:return function(t,r){var n=e.skipTrivia(t.text,r.pos);if(r.body&&235===r.body.kind){var i=e.getLineAndCharacterOfPosition(t,r.body.pos).line;if(i<e.getLineAndCharacterOfPosition(t,r.body.end).line)return e.createTextSpan(n,d(i,t)-n+1)}return e.createTextSpanFromBounds(n,r.end)}(t,r);case 289:case 290:var a=e.skipTrivia(t.text,r.pos),o=r.statements.length>0?r.statements[0].pos:r.end;return e.createTextSpanFromBounds(a,o)}if(void 0===n)return U(t,r.pos);e.Debug.assert(!e.isJSDoc(n));var s=p(n),c=s||e.isJsxText(r)?n.pos:e.skipTrivia(t.text,n.pos);return s?(e.Debug.assert(c===n.pos,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"),e.Debug.assert(c===n.end,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809")):(e.Debug.assert(c>=n.pos,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"),e.Debug.assert(c<=n.end,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809")),e.createTextSpanFromBounds(c,n.end)}function q(e){return 6===e.scriptKind}function W(t){return !!(2&e.getCombinedNodeFlags(t))}function H(e){return 208===e.kind&&100===e.expression.kind}function G(t){return e.isImportTypeNode(t)&&e.isLiteralTypeNode(t.argument)&&e.isStringLiteral(t.argument.literal)}function Q(e){return 238===e.kind&&10===e.expression.kind}function X(e){return !!(1048576&T(e))}function Y(t){return e.isIdentifier(t.name)&&!t.initializer}e.changesAffectModuleResolution=function(e,t){return e.configFilePath!==t.configFilePath||s(e,t)},e.optionsHaveModuleResolutionChanges=s,e.changesAffectingProgramStructure=function(t,r){return c(t,r,e.optionsAffectingProgramStructure)},e.optionsHaveChanges=c,e.forEachAncestor=function(t,r){for(;;){var n=r(t);if("quit"===n)return;if(void 0!==n)return n;if(e.isSourceFile(t))return;t=t.parent;}},e.forEachEntry=function(e,t){for(var r=e.entries(),n=r.next();!n.done;n=r.next()){var i=n.value,a=i[0],o=t(i[1],a);if(o)return o}},e.forEachKey=function(e,t){for(var r=e.keys(),n=r.next();!n.done;n=r.next()){var i=t(n.value);if(i)return i}},e.copyEntries=function(e,t){e.forEach((function(e,r){t.set(r,e);}));},e.usingSingleLineStringWriter=function(e){var t=o.getText();try{return e(o),o.getText()}finally{o.clear(),o.writeKeyword(t);}},e.getFullWidth=l,e.getResolvedModule=function(e,t,r){return e&&e.resolvedModules&&e.resolvedModules.get(t,r)},e.setResolvedModule=function(t,r,n,i){t.resolvedModules||(t.resolvedModules=e.createModeAwareCache()),t.resolvedModules.set(r,i,n);},e.setResolvedTypeReferenceDirective=function(t,r,n){t.resolvedTypeReferenceDirectiveNames||(t.resolvedTypeReferenceDirectiveNames=e.createModeAwareCache()),t.resolvedTypeReferenceDirectiveNames.set(r,void 0,n);},e.projectReferenceIsEqualTo=function(e,t){return e.path===t.path&&!e.prepend==!t.prepend&&!e.circular==!t.circular},e.moduleResolutionIsEqualTo=function(e,t){return e.isExternalLibraryImport===t.isExternalLibraryImport&&e.extension===t.extension&&e.resolvedFileName===t.resolvedFileName&&e.originalPath===t.originalPath&&((r=e.packageId)===(n=t.packageId)||!!r&&!!n&&r.name===n.name&&r.subModuleName===n.subModuleName&&r.version===n.version);var r,n;},e.packageIdToPackageName=u,e.packageIdToString=function(e){return "".concat(u(e),"@").concat(e.version)},e.typeDirectiveIsEqualTo=function(e,t){return e.resolvedFileName===t.resolvedFileName&&e.primary===t.primary&&e.originalPath===t.originalPath},e.hasChangesInResolutions=function(t,r,n,i,a){e.Debug.assert(t.length===r.length);for(var o=0;o<t.length;o++){var s=r[o],c=t[o],l=e.isString(c)?c:c.fileName.toLowerCase(),u=e.isString(c)?i&&e.getModeForResolutionAtIndex(i,o):e.getModeForFileReference(c,null==i?void 0:i.impliedNodeFormat),_=n&&n.get(l,u);if(_?!s||!a(_,s):s)return !0}return !1},e.containsParseError=function t(r){return function(r){1048576&r.flags||((0!=(131072&r.flags)||e.forEachChild(r,t))&&(r.flags|=524288),r.flags|=1048576);}(r),0!=(524288&r.flags)},e.getSourceFileOfNode=_,e.getSourceFileOfModule=function(e){return _(e.valueDeclaration||P(e))},e.isPlainJsFile=function(e,t){return !(!e||1!==e.scriptKind&&2!==e.scriptKind||e.checkJsDirective||void 0!==t)},e.isStatementWithLocals=function(e){switch(e.kind){case 235:case 263:case 242:case 243:case 244:return !0}return !1},e.getStartPositionOfLine=function(t,r){return e.Debug.assert(t>=0),e.getLineStarts(r)[t]},e.nodePosToString=function(t){var r=_(t),n=e.getLineAndCharacterOfPosition(r,t.pos);return "".concat(r.fileName,"(").concat(n.line+1,",").concat(n.character+1,")")},e.getEndLinePosition=d,e.isFileLevelUniqueName=function(e,t,r){return !(r&&r(t)||e.identifiers.has(t))},e.nodeIsMissing=p,e.nodeIsPresent=f,e.insertStatementsAfterStandardPrologue=function(e,t){return g(e,t,Q)},e.insertStatementsAfterCustomPrologue=function(e,t){return g(e,t,y)},e.insertStatementAfterStandardPrologue=function(e,t){return m(e,t,Q)},e.insertStatementAfterCustomPrologue=function(e,t){return m(e,t,y)},e.isRecognizedTripleSlashComment=function(t,r,n){if(47===t.charCodeAt(r+1)&&r+2<n&&47===t.charCodeAt(r+2)){var i=t.substring(r,n);return !!(e.fullTripleSlashReferencePathRegEx.test(i)||e.fullTripleSlashAMDReferencePathRegEx.test(i)||Z.test(i)||ne.test(i))}return !1},e.isPinnedComment=v,e.createCommentDirectivesMap=function(t,r){var n=new e.Map(r.map((function(r){return ["".concat(e.getLineAndCharacterOfPosition(t,r.range.end).line),r]}))),i=new e.Map;return {getUnusedExpectations:function(){return e.arrayFrom(n.entries()).filter((function(e){var t=e[0];return 0===e[1].type&&!i.get(t)})).map((function(e){return e[1]}))},markUsed:function(e){return !!n.has("".concat(e))&&(i.set("".concat(e),!0),!0)}}},e.getTokenPosOfNode=h,e.getNonDecoratorTokenPosOfNode=function(t,r){return p(t)||!t.decorators?h(t,r):e.skipTrivia((r||_(t)).text,t.decorators.end)},e.getSourceTextOfNodeFromSourceFile=b,e.isExportNamespaceAsDefaultDeclaration=function(t){return !!(e.isExportDeclaration(t)&&t.exportClause&&e.isNamespaceExport(t.exportClause)&&"default"===t.exportClause.name.escapedText)},e.getTextOfNodeFromSourceText=x,e.getTextOfNode=D,e.indexOfNode=function(t,r){return e.binarySearch(t,r,S,e.compareValues)},e.getEmitFlags=T,e.getScriptTargetFeatures=function(){return {es2015:{Array:["find","findIndex","fill","copyWithin","entries","keys","values"],RegExp:["flags","sticky","unicode"],Reflect:["apply","construct","defineProperty","deleteProperty","get"," getOwnPropertyDescriptor","getPrototypeOf","has","isExtensible","ownKeys","preventExtensions","set","setPrototypeOf"],ArrayConstructor:["from","of"],ObjectConstructor:["assign","getOwnPropertySymbols","keys","is","setPrototypeOf"],NumberConstructor:["isFinite","isInteger","isNaN","isSafeInteger","parseFloat","parseInt"],Math:["clz32","imul","sign","log10","log2","log1p","expm1","cosh","sinh","tanh","acosh","asinh","atanh","hypot","trunc","fround","cbrt"],Map:["entries","keys","values"],Set:["entries","keys","values"],Promise:e.emptyArray,PromiseConstructor:["all","race","reject","resolve"],Symbol:["for","keyFor"],WeakMap:["entries","keys","values"],WeakSet:["entries","keys","values"],Iterator:e.emptyArray,AsyncIterator:e.emptyArray,String:["codePointAt","includes","endsWith","normalize","repeat","startsWith","anchor","big","blink","bold","fixed","fontcolor","fontsize","italics","link","small","strike","sub","sup"],StringConstructor:["fromCodePoint","raw"]},es2016:{Array:["includes"]},es2017:{Atomics:e.emptyArray,SharedArrayBuffer:e.emptyArray,String:["padStart","padEnd"],ObjectConstructor:["values","entries","getOwnPropertyDescriptors"],DateTimeFormat:["formatToParts"]},es2018:{Promise:["finally"],RegExpMatchArray:["groups"],RegExpExecArray:["groups"],RegExp:["dotAll"],Intl:["PluralRules"],AsyncIterable:e.emptyArray,AsyncIterableIterator:e.emptyArray,AsyncGenerator:e.emptyArray,AsyncGeneratorFunction:e.emptyArray,NumberFormat:["formatToParts"]},es2019:{Array:["flat","flatMap"],ObjectConstructor:["fromEntries"],String:["trimStart","trimEnd","trimLeft","trimRight"],Symbol:["description"]},es2020:{BigInt:e.emptyArray,BigInt64Array:e.emptyArray,BigUint64Array:e.emptyArray,PromiseConstructor:["allSettled"],SymbolConstructor:["matchAll"],String:["matchAll"],DataView:["setBigInt64","setBigUint64","getBigInt64","getBigUint64"],RelativeTimeFormat:["format","formatToParts","resolvedOptions"]},es2021:{PromiseConstructor:["any"],String:["replaceAll"]},es2022:{Array:["at"],String:["at"],Int8Array:["at"],Uint8Array:["at"],Uint8ClampedArray:["at"],Int16Array:["at"],Uint16Array:["at"],Int32Array:["at"],Uint32Array:["at"],Float32Array:["at"],Float64Array:["at"],BigInt64Array:["at"],BigUint64Array:["at"],ObjectConstructor:["hasOwn"],Error:["cause"]}}},(a=e.GetLiteralTextFlags||(e.GetLiteralTextFlags={}))[a.None=0]="None",a[a.NeverAsciiEscape=1]="NeverAsciiEscape",a[a.JsxAttributeEscape=2]="JsxAttributeEscape",a[a.TerminateUnterminatedLiterals=4]="TerminateUnterminatedLiterals",a[a.AllowNumericSeparator=8]="AllowNumericSeparator",e.getLiteralText=function(t,r,n){var i;if(r&&function(t,r){return !(It(t)||!t.parent||4&r&&t.isUnterminated)&&(e.isNumericLiteral(t)&&512&t.numericLiteralFlags?!!(8&r):!e.isBigIntLiteral(t))}(t,n))return b(r,t);switch(t.kind){case 10:var a=2&n?Zt:1&n||16777216&T(t)?qt:Ht;return t.singleQuote?"'"+a(t.text,39)+"'":'"'+a(t.text,34)+'"';case 14:case 15:case 16:case 17:a=1&n||16777216&T(t)?qt:Ht;var o=null!==(i=t.rawText)&&void 0!==i?i:function(e){return e.replace(Bt,"\\${")}(a(t.text,96));switch(t.kind){case 14:return "`"+o+"`";case 15:return "`"+o+"${";case 16:return "}"+o+"${";case 17:return "}"+o+"`"}break;case 8:case 9:return t.text;case 13:return 4&n&&t.isUnterminated?t.text+(92===t.text.charCodeAt(t.text.length-1)?" /":"/"):t.text}return e.Debug.fail("Literal kind '".concat(t.kind,"' not accounted for."))},e.getTextOfConstantValue=function(t){return e.isString(t)?'"'+Ht(t)+'"':""+t},e.makeIdentifierFromModuleName=function(t){return e.getBaseFileName(t).replace(/^(\d)/,"_$1").replace(/\W/g,"_")},e.isBlockOrCatchScoped=function(t){return 0!=(3&e.getCombinedNodeFlags(t))||C(t)},e.isCatchClauseVariableDeclarationOrBindingElement=C,e.isAmbientModule=k,e.isModuleWithStringLiteralName=function(t){return e.isModuleDeclaration(t)&&10===t.name.kind},e.isNonGlobalAmbientModule=function(t){return e.isModuleDeclaration(t)&&e.isStringLiteral(t.name)},e.isEffectiveModuleDeclaration=E,e.isShorthandAmbientModuleSymbol=function(e){return !!(t=e.valueDeclaration)&&261===t.kind&&!t.body;var t;},e.isBlockScopedContainerTopLevel=function(t){return 305===t.kind||261===t.kind||e.isFunctionLikeOrClassStaticBlockDeclaration(t)},e.isGlobalScopeAugmentation=N,e.isExternalModuleAugmentation=F,e.isModuleAugmentationExternal=A,e.getNonAugmentationDeclaration=P,e.isEffectiveExternalModule=function(t,r){return e.isExternalModule(t)||r.isolatedModules||((n=On(r))===e.ModuleKind.CommonJS||n===e.ModuleKind.Node16||n===e.ModuleKind.NodeNext)&&!!t.commonJsModuleIndicator;var n;},e.isEffectiveStrictModeSourceFile=function(t,r){switch(t.scriptKind){case 1:case 3:case 2:case 4:break;default:return !1}return !(t.isDeclarationFile||!Bn(r,"alwaysStrict")&&!e.startsWithUseStrict(t.statements)&&(!e.isExternalModule(t)&&!r.isolatedModules||!(On(r)>=e.ModuleKind.ES2015)&&r.noImplicitUseStrict))},e.isBlockScope=w,e.isDeclarationWithTypeParameters=function(t){switch(t.kind){case 338:case 345:case 323:return !0;default:return e.assertType(t),I(t)}},e.isDeclarationWithTypeParameterChildren=I,e.isAnyImportSyntax=O,e.isAnyImportOrBareOrAccessedRequire=function(e){return O(e)||Ee(e)},e.isLateVisibilityPaintedStatement=function(e){switch(e.kind){case 266:case 265:case 237:case 257:case 256:case 261:case 259:case 258:case 260:return !0;default:return !1}},e.hasPossibleExternalModuleReference=function(t){return M(t)||e.isModuleDeclaration(t)||e.isImportTypeNode(t)||H(t)},e.isAnyImportOrReExport=M,e.getEnclosingBlockScopeContainer=L,e.forEachEnclosingBlockScopeContainer=function(e,t){for(var r=L(e);r;)t(r),r=L(r);},e.declarationNameToString=R,e.getNameFromIndexInfo=function(e){return e.declaration?R(e.declaration.parameters[0].name):void 0},e.isComputedNonLiteralName=function(e){return 162===e.kind&&!Ct(e.expression)},e.tryGetTextOfPropertyName=B,e.getTextOfPropertyName=function(t){return e.Debug.checkDefined(B(t))},e.entityNameToString=j,e.createDiagnosticForNode=function(e,t,r,n,i,a){return J(_(e),e,t,r,n,i,a)},e.createDiagnosticForNodeArray=function(t,r,n,i,a,o,s){var c=e.skipTrivia(t.text,r.pos);return Tn(t,c,r.end-c,n,i,a,o,s)},e.createDiagnosticForNodeInSourceFile=J,e.createDiagnosticForNodeFromMessageChain=function(e,t,r){var n=_(e),i=V(n,e);return K(n,i.start,i.length,t,r)},e.createFileDiagnosticFromMessageChain=K,e.createDiagnosticForFileFromMessageChain=function(e,t,r){return {file:e,start:0,length:0,code:t.code,category:t.category,messageText:t.next?t:t.messageText,relatedInformation:r}},e.createDiagnosticMessageChainFromDiagnostic=function(e){return "string"==typeof e.messageText?{code:e.code,category:e.category,messageText:e.messageText,next:e.next}:e.messageText},e.createDiagnosticForRange=function(e,t,r){return {file:e,start:t.pos,length:t.end-t.pos,code:r.code,category:r.category,messageText:r.message}},e.getSpanOfTokenAtPosition=U,e.getErrorSpanForNode=V,e.isExternalOrCommonJsModule=function(e){return void 0!==(e.externalModuleIndicator||e.commonJsModuleIndicator)},e.isJsonSourceFile=q,e.isEnumConst=function(t){return !!(2048&e.getCombinedModifierFlags(t))},e.isDeclarationReadonly=function(t){return !(!(64&e.getCombinedModifierFlags(t))||e.isParameterPropertyDeclaration(t,t.parent))},e.isVarConst=W,e.isLet=function(t){return !!(1&e.getCombinedNodeFlags(t))},e.isSuperCall=function(e){return 208===e.kind&&106===e.expression.kind},e.isImportCall=H,e.isImportMeta=function(t){return e.isMetaProperty(t)&&100===t.keywordToken&&"meta"===t.name.escapedText},e.isLiteralImportTypeNode=G,e.isPrologueDirective=Q,e.isCustomPrologue=X,e.isHoistedFunction=function(t){return X(t)&&e.isFunctionDeclaration(t)},e.isHoistedVariableStatement=function(t){return X(t)&&e.isVariableStatement(t)&&e.every(t.declarationList.declarations,Y)},e.getLeadingCommentRangesOfNode=function(t,r){return 11!==t.kind?e.getLeadingCommentRanges(r.text,t.pos):void 0},e.getJSDocCommentRanges=function(t,r){var n=164===t.kind||163===t.kind||213===t.kind||214===t.kind||212===t.kind||254===t.kind||275===t.kind?e.concatenate(e.getTrailingCommentRanges(r,t.pos),e.getLeadingCommentRanges(r,t.pos)):e.getLeadingCommentRanges(r,t.pos);return e.filter(n,(function(e){return 42===r.charCodeAt(e.pos+1)&&42===r.charCodeAt(e.pos+2)&&47!==r.charCodeAt(e.pos+3)}))},e.fullTripleSlashReferencePathRegEx=/^(\/\/\/\s*<reference\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;var Z=/^(\/\/\/\s*<reference\s+types\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;e.fullTripleSlashAMDReferencePathRegEx=/^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;var $,ee,te,re,ne=/^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)(('[^']*')|("[^"]*"))\s*\/>/;function ie(t){if(177<=t.kind&&t.kind<=200)return !0;switch(t.kind){case 130:case 155:case 147:case 158:case 150:case 133:case 151:case 148:case 153:case 143:return !0;case 114:return 217!==t.parent.kind;case 228:return e.isHeritageClause(t.parent)&&!Vr(t);case 163:return 195===t.parent.kind||190===t.parent.kind;case 79:(161===t.parent.kind&&t.parent.right===t||206===t.parent.kind&&t.parent.name===t)&&(t=t.parent),e.Debug.assert(79===t.kind||161===t.kind||206===t.kind,"'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");case 161:case 206:case 108:var r=t.parent;if(181===r.kind)return !1;if(200===r.kind)return !r.isTypeOf;if(177<=r.kind&&r.kind<=200)return !0;switch(r.kind){case 228:return e.isHeritageClause(r.parent)&&!Vr(r);case 163:case 344:return t===r.constraint;case 167:case 166:case 164:case 254:return t===r.type;case 256:case 213:case 214:case 171:case 169:case 168:case 172:case 173:return t===r.type;case 174:case 175:case 176:case 211:return t===r.type;case 208:case 209:return e.contains(r.typeArguments,t);case 210:return !1}}return !1}function ae(e){if(e)switch(e.kind){case 203:case 299:case 164:case 296:case 167:case 166:case 297:case 254:return !0}return !1}function oe(e){return 255===e.parent.kind&&237===e.parent.parent.kind}function se(t){return !!Se(t)&&e.isBinaryExpression(t)&&1===Re(t)}function ce(e,t,r){return e.properties.filter((function(e){if(296===e.kind){var n=B(e.name);return t===n||!!r&&r===n}return !1}))}function le(t){if(t&&t.statements.length){var r=t.statements[0].expression;return e.tryCast(r,e.isObjectLiteralExpression)}}function ue(t,r){var n=le(t);return n?ce(n,r):e.emptyArray}function _e(t,r){for(e.Debug.assert(305!==t.kind);;){if(!(t=t.parent))return e.Debug.fail();switch(t.kind){case 162:if(e.isClassLike(t.parent.parent))return t;t=t.parent;break;case 165:164===t.parent.kind&&e.isClassElement(t.parent.parent)?t=t.parent.parent:e.isClassElement(t.parent)&&(t=t.parent);break;case 214:if(!r)continue;case 256:case 213:case 261:case 170:case 167:case 166:case 169:case 168:case 171:case 172:case 173:case 174:case 175:case 176:case 260:case 305:return t}}}function de(e){var t=e.kind;return (206===t||207===t)&&106===e.expression.kind}function pe(t,r,n){if(e.isNamedDeclaration(t)&&e.isPrivateIdentifier(t.name))return !1;switch(t.kind){case 257:return !0;case 167:return 257===r.kind;case 172:case 173:case 169:return void 0!==t.body&&257===r.kind;case 164:return void 0!==r.body&&(171===r.kind||169===r.kind||173===r.kind)&&257===n.kind}return !1}function fe(e,t,r){return void 0!==e.decorators&&pe(e,t,r)}function ge(e,t,r){return fe(e,t,r)||me(e,t)}function me(t,r){switch(t.kind){case 257:return e.some(t.members,(function(e){return ge(e,t,r)}));case 169:case 173:case 171:return e.some(t.parameters,(function(e){return fe(e,t,r)}));default:return !1}}function ye(e){var t=e.parent;return (280===t.kind||279===t.kind||281===t.kind)&&t.tagName===e}function ve(t){switch(t.kind){case 106:case 104:case 110:case 95:case 13:case 204:case 205:case 206:case 207:case 208:case 209:case 210:case 229:case 211:case 230:case 212:case 213:case 226:case 214:case 217:case 215:case 216:case 219:case 220:case 221:case 222:case 225:case 223:case 227:case 278:case 279:case 282:case 224:case 218:case 231:return !0;case 228:return !e.isHeritageClause(t.parent);case 161:for(;161===t.parent.kind;)t=t.parent;return 181===t.parent.kind||e.isJSDocLinkLike(t.parent)||e.isJSDocNameReference(t.parent)||e.isJSDocMemberName(t.parent)||ye(t);case 311:for(;e.isJSDocMemberName(t.parent);)t=t.parent;return 181===t.parent.kind||e.isJSDocLinkLike(t.parent)||e.isJSDocNameReference(t.parent)||e.isJSDocMemberName(t.parent)||ye(t);case 80:return e.isBinaryExpression(t.parent)&&t.parent.left===t&&101===t.parent.operatorToken.kind;case 79:if(181===t.parent.kind||e.isJSDocLinkLike(t.parent)||e.isJSDocNameReference(t.parent)||e.isJSDocMemberName(t.parent)||ye(t))return !0;case 8:case 9:case 10:case 14:case 108:return he(t);default:return !1}}function he(e){var t=e.parent;switch(t.kind){case 254:case 164:case 167:case 166:case 299:case 296:case 203:return t.initializer===e;case 238:case 239:case 240:case 241:case 247:case 248:case 249:case 289:case 251:return t.expression===e;case 242:var r=t;return r.initializer===e&&255!==r.initializer.kind||r.condition===e||r.incrementor===e;case 243:case 244:var n=t;return n.initializer===e&&255!==n.initializer.kind||n.expression===e;case 211:case 229:case 233:case 162:return e===t.expression;case 165:case 288:case 287:case 298:return !0;case 228:return t.expression===e&&!ie(t);case 297:return t.objectAssignmentInitializer===e;default:return ve(t)}}function be(e){for(;161===e.kind||79===e.kind;)e=e.parent;return 181===e.kind}function xe(e){return 265===e.kind&&277===e.moduleReference.kind}function De(e){return Se(e)}function Se(e){return !!e&&!!(262144&e.flags)}function Te(e){return !!e&&!!(8388608&e.flags)}function Ce(t,r){if(208!==t.kind)return !1;var n=t,i=n.expression,a=n.arguments;if(79!==i.kind||"require"!==i.escapedText)return !1;if(1!==a.length)return !1;var o=a[0];return !r||e.isStringLiteralLike(o)}function ke(e){return Ne(e,!1)}function Ee(e){return Ne(e,!0)}function Ne(t,r){return e.isVariableDeclaration(t)&&!!t.initializer&&Ce(r?dn(t.initializer):t.initializer,!0)}function Fe(t){return e.isBinaryExpression(t)||_n(t)||e.isIdentifier(t)||e.isCallExpression(t)}function Ae(t){return Se(t)&&t.initializer&&e.isBinaryExpression(t.initializer)&&(56===t.initializer.operatorToken.kind||60===t.initializer.operatorToken.kind)&&t.name&&qr(t.name)&&we(t.name,t.initializer.left)?t.initializer.right:t.initializer}function Pe(t,r){if(e.isCallExpression(t)){var n=pt(t.expression);return 213===n.kind||214===n.kind?t:void 0}return 213===t.kind||226===t.kind||214===t.kind||e.isObjectLiteralExpression(t)&&(0===t.properties.length||r)?t:void 0}function we(t,r){return At(t)&&At(r)?Pt(t)===Pt(r):e.isMemberName(t)&&je(r)&&(108===r.expression.kind||e.isIdentifier(r.expression)&&("window"===r.expression.escapedText||"self"===r.expression.escapedText||"global"===r.expression.escapedText))?we(t,Ve(r)):!(!je(t)||!je(r))&&We(t)===We(r)&&we(t.expression,r.expression)}function Ie(e){for(;Ur(e,!0);)e=e.right;return e}function Oe(t){return e.isIdentifier(t)&&"exports"===t.escapedText}function Me(t){return e.isIdentifier(t)&&"module"===t.escapedText}function Le(t){return (e.isPropertyAccessExpression(t)||Je(t))&&Me(t.expression)&&"exports"===We(t)}function Re(t){var r=function(t){if(e.isCallExpression(t)){if(!Be(t))return 0;var r=t.arguments[0];return Oe(r)||Le(r)?8:ze(r)&&"prototype"===We(r)?9:7}return 63!==t.operatorToken.kind||!_n(t.left)||(n=Ie(t),e.isVoidExpression(n)&&e.isNumericLiteral(n.expression)&&"0"===n.expression.text)?0:Ue(t.left.expression,!0)&&"prototype"===We(t.left)&&e.isObjectLiteralExpression(Ge(t))?6:He(t.left);var n;}(t);return 5===r||Se(t)?r:0}function Be(t){return 3===e.length(t.arguments)&&e.isPropertyAccessExpression(t.expression)&&e.isIdentifier(t.expression.expression)&&"Object"===e.idText(t.expression.expression)&&"defineProperty"===e.idText(t.expression.name)&&Ct(t.arguments[1])&&Ue(t.arguments[0],!0)}function je(t){return e.isPropertyAccessExpression(t)||Je(t)}function Je(t){return e.isElementAccessExpression(t)&&Ct(t.argumentExpression)}function ze(t,r){return e.isPropertyAccessExpression(t)&&(!r&&108===t.expression.kind||e.isIdentifier(t.name)&&Ue(t.expression,!0))||Ke(t,r)}function Ke(e,t){return Je(e)&&(!t&&108===e.expression.kind||qr(e.expression)||ze(e.expression,!0))}function Ue(e,t){return qr(e)||ze(e,t)}function Ve(t){return e.isPropertyAccessExpression(t)?t.name:t.argumentExpression}function qe(t){if(e.isPropertyAccessExpression(t))return t.name;var r=pt(t.argumentExpression);return e.isNumericLiteral(r)||e.isStringLiteralLike(r)?r:t}function We(t){var r=qe(t);if(r){if(e.isIdentifier(r))return r.escapedText;if(e.isStringLiteralLike(r)||e.isNumericLiteral(r))return e.escapeLeadingUnderscores(r.text)}}function He(t){if(108===t.expression.kind)return 4;if(Le(t))return 2;if(Ue(t.expression,!0)){if(Hr(t.expression))return 3;for(var r=t;!e.isIdentifier(r.expression);)r=r.expression;var n=r.expression;if(("exports"===n.escapedText||"module"===n.escapedText&&"exports"===We(r))&&ze(t))return 1;if(Ue(t,!0)||e.isElementAccessExpression(t)&&Nt(t))return 5}return 0}function Ge(t){for(;e.isBinaryExpression(t.right);)t=t.right;return t.right}function Qe(t){switch(t.parent.kind){case 266:case 272:return t.parent;case 277:return t.parent.parent;case 208:return H(t.parent)||Ce(t.parent,!1)?t.parent:void 0;case 196:return e.Debug.assert(e.isStringLiteral(t)),e.tryCast(t.parent.parent,e.isImportTypeNode);default:return}}function Xe(t){switch(t.kind){case 266:case 272:return t.moduleSpecifier;case 265:return 277===t.moduleReference.kind?t.moduleReference.expression:void 0;case 200:return G(t)?t.argument.literal:void 0;case 208:return t.arguments[0];case 261:return 10===t.name.kind?t.name:void 0;default:return e.Debug.assertNever(t)}}function Ye(e){return 345===e.kind||338===e.kind||339===e.kind}function Ze(t){return e.isExpressionStatement(t)&&e.isBinaryExpression(t.expression)&&0!==Re(t.expression)&&e.isBinaryExpression(t.expression.right)&&(56===t.expression.right.operatorToken.kind||60===t.expression.right.operatorToken.kind)?t.expression.right.right:void 0}function $e(e){switch(e.kind){case 237:var t=et(e);return t&&t.initializer;case 167:case 296:return e.initializer}}function et(t){return e.isVariableStatement(t)?e.firstOrUndefined(t.declarationList.declarations):void 0}function tt(t){return e.isModuleDeclaration(t)&&t.body&&261===t.body.kind?t.body:void 0}function rt(t,r){if(e.isJSDoc(r)){var n=e.filter(r.tags,(function(e){return nt(t,e)}));return r.tags===n?[r]:n}return nt(t,r)?[r]:void 0}function nt(t,r){return !(e.isJSDocTypeTag(r)&&r.parent&&e.isJSDoc(r.parent)&&e.isParenthesizedExpression(r.parent.parent)&&r.parent.parent!==t)}function it(t){var r=t.parent;return 296===r.kind||271===r.kind||167===r.kind||238===r.kind&&206===t.kind||247===r.kind||tt(r)||e.isBinaryExpression(t)&&63===t.operatorToken.kind?r:r.parent&&(et(r.parent)===t||e.isBinaryExpression(r)&&63===r.operatorToken.kind)?r.parent:r.parent&&r.parent.parent&&(et(r.parent.parent)||$e(r.parent.parent)===t||Ze(r.parent.parent))?r.parent.parent:void 0}function at(t){var r=ot(t);if(r)return e.isPropertySignature(r)&&r.type&&e.isFunctionLike(r.type)?r.type:e.isFunctionLike(r)?r:void 0}function ot(t){var r=st(t);if(r)return Ze(r)||function(t){return e.isExpressionStatement(t)&&e.isBinaryExpression(t.expression)&&63===t.expression.operatorToken.kind?Ie(t.expression):void 0}(r)||$e(r)||et(r)||tt(r)||r}function st(t){var r=ct(t);if(r){var n=r.parent;return n&&n.jsDoc&&r===e.lastOrUndefined(n.jsDoc)?n:void 0}}function ct(t){return e.findAncestor(t.parent,e.isJSDoc)}function lt(t){var r=e.isJSDocParameterTag(t)?t.typeExpression&&t.typeExpression.type:t.type;return void 0!==t.dotDotDotToken||!!r&&318===r.kind}function ut(e){for(var t=e.parent;;){switch(t.kind){case 221:var r=t.operatorToken.kind;return Jr(r)&&t.left===e?63===r||jr(r)?1:2:0;case 219:case 220:var n=t.operator;return 45===n||46===n?2:0;case 243:case 244:return t.initializer===e?1:0;case 212:case 204:case 225:case 230:e=t;break;case 298:e=t.parent;break;case 297:if(t.name!==e)return 0;e=t.parent;break;case 296:if(t.name===e)return 0;e=t.parent;break;default:return 0}t=e.parent;}}function _t(e,t){for(;e&&e.kind===t;)e=e.parent;return e}function dt(e){return _t(e,212)}function pt(t,r){var n=r?17:1;return e.skipOuterExpressions(t,n)}function ft(t){return qr(t)||e.isClassExpression(t)}function gt(e){return ft(mt(e))}function mt(t){return e.isExportAssignment(t)?t.expression:t.right}function yt(t){var r=vt(t);if(r&&Se(t)){var n=e.getJSDocAugmentsTag(t);if(n)return n.class}return r}function vt(e){var t=xt(e.heritageClauses,94);return t&&t.types.length>0?t.types[0]:void 0}function ht(t){if(Se(t))return e.getJSDocImplementsTags(t).map((function(e){return e.class}));var r=xt(t.heritageClauses,117);return null==r?void 0:r.types}function bt(e){var t=xt(e.heritageClauses,94);return t?t.types:void 0}function xt(e,t){if(e)for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i.token===t)return i}}function Dt(e){return 81<=e&&e<=160}function St(e){return 126<=e&&e<=160}function Tt(e){return Dt(e)&&!St(e)}function Ct(t){return e.isStringLiteralLike(t)||e.isNumericLiteral(t)}function kt(t){return e.isPrefixUnaryExpression(t)&&(39===t.operator||40===t.operator)&&e.isNumericLiteral(t.operand)}function Et(t){var r=e.getNameOfDeclaration(t);return !!r&&Nt(r)}function Nt(t){if(162!==t.kind&&207!==t.kind)return !1;var r=e.isElementAccessExpression(t)?pt(t.argumentExpression):t.expression;return !Ct(r)&&!kt(r)}function Ft(t){switch(t.kind){case 79:case 80:return t.escapedText;case 10:case 8:return e.escapeLeadingUnderscores(t.text);case 162:var r=t.expression;return Ct(r)?e.escapeLeadingUnderscores(r.text):kt(r)?40===r.operator?e.tokenToString(r.operator)+r.operand.text:r.operand.text:void 0;default:return e.Debug.assertNever(t)}}function At(e){switch(e.kind){case 79:case 10:case 14:case 8:return !0;default:return !1}}function Pt(t){return e.isMemberName(t)?e.idText(t):t.text}function wt(e){for(;203===e.kind;)e=e.parent.parent;return e}function It(e){return vi(e.pos)||vi(e.end)}function Ot(e,t,r){switch(e){case 209:return r?0:1;case 219:case 216:case 217:case 215:case 218:case 222:case 224:return 1;case 221:switch(t){case 42:case 63:case 64:case 65:case 67:case 66:case 68:case 69:case 70:case 71:case 72:case 73:case 78:case 74:case 75:case 76:case 77:return 1}}return 0}function Mt(e){return 221===e.kind?e.operatorToken.kind:219===e.kind||220===e.kind?e.operator:e.kind}function Lt(e,t,r){switch(e){case 351:return 0;case 225:return 1;case 224:return 2;case 222:return 4;case 221:switch(t){case 27:return 0;case 63:case 64:case 65:case 67:case 66:case 68:case 69:case 70:case 71:case 72:case 73:case 78:case 74:case 75:case 76:case 77:return 3;default:return Rt(t)}case 211:case 230:case 219:case 216:case 217:case 215:case 218:return 16;case 220:return 17;case 208:return 18;case 209:return r?19:18;case 210:case 206:case 207:case 231:return 19;case 229:return 11;case 108:case 106:case 79:case 80:case 104:case 110:case 95:case 8:case 9:case 10:case 204:case 205:case 213:case 214:case 226:case 13:case 14:case 223:case 212:case 227:case 278:case 279:case 282:return 20;default:return -1}}function Rt(e){switch(e){case 60:return 4;case 56:return 5;case 55:return 6;case 51:return 7;case 52:return 8;case 50:return 9;case 34:case 35:case 36:case 37:return 10;case 29:case 31:case 32:case 33:case 102:case 101:case 127:return 11;case 47:case 48:case 49:return 12;case 39:case 40:return 13;case 41:case 43:case 44:return 14;case 42:return 15}return -1}e.isPartOfTypeNode=ie,e.isChildOfNodeWithKind=function(e,t){for(;e;){if(e.kind===t)return !0;e=e.parent;}return !1},e.forEachReturnStatement=function(t,r){return function t(n){switch(n.kind){case 247:return r(n);case 263:case 235:case 239:case 240:case 241:case 242:case 243:case 244:case 248:case 249:case 289:case 290:case 250:case 252:case 292:return e.forEachChild(n,t)}}(t)},e.forEachYieldExpression=function(t,r){return function t(n){switch(n.kind){case 224:r(n);var i=n.expression;return void(i&&t(i));case 260:case 258:case 261:case 259:return;default:if(e.isFunctionLike(n)){if(n.name&&162===n.name.kind)return void t(n.name.expression)}else ie(n)||e.forEachChild(n,t);}}(t)},e.getRestParameterElementType=function(t){return t&&183===t.kind?t.elementType:t&&178===t.kind?e.singleOrUndefined(t.typeArguments):void 0},e.getMembersOfDeclaration=function(e){switch(e.kind){case 258:case 257:case 226:case 182:return e.members;case 205:return e.properties}},e.isVariableLike=ae,e.isVariableLikeOrAccessor=function(t){return ae(t)||e.isAccessor(t)},e.isVariableDeclarationInVariableStatement=oe,e.isCommonJsExportedExpression=function(t){return !!Se(t)&&(e.isObjectLiteralExpression(t.parent)&&e.isBinaryExpression(t.parent.parent)&&2===Re(t.parent.parent)||se(t.parent))},e.isCommonJsExportPropertyAssignment=se,e.isValidESSymbolDeclaration=function(t){return (e.isVariableDeclaration(t)?W(t)&&e.isIdentifier(t.name)&&oe(t):e.isPropertyDeclaration(t)?Fr(t)&&Nr(t):e.isPropertySignature(t)&&Fr(t))||se(t)},e.introducesArgumentsExoticObject=function(e){switch(e.kind){case 169:case 168:case 171:case 172:case 173:case 256:case 213:return !0}return !1},e.unwrapInnermostStatementOfLabel=function(e,t){for(;;){if(t&&t(e),250!==e.statement.kind)return e.statement;e=e.statement;}},e.isFunctionBlock=function(t){return t&&235===t.kind&&e.isFunctionLike(t.parent)},e.isObjectLiteralMethod=function(e){return e&&169===e.kind&&205===e.parent.kind},e.isObjectLiteralOrClassExpressionMethodOrAccessor=function(e){return !(169!==e.kind&&172!==e.kind&&173!==e.kind||205!==e.parent.kind&&226!==e.parent.kind)},e.isIdentifierTypePredicate=function(e){return e&&1===e.kind},e.isThisTypePredicate=function(e){return e&&0===e.kind},e.getPropertyAssignment=ce,e.getPropertyArrayElementValue=function(t,r,n){return e.firstDefined(ce(t,r),(function(t){return e.isArrayLiteralExpression(t.initializer)?e.find(t.initializer.elements,(function(t){return e.isStringLiteral(t)&&t.text===n})):void 0}))},e.getTsConfigObjectLiteralExpression=le,e.getTsConfigPropArrayElementValue=function(t,r,n){return e.firstDefined(ue(t,r),(function(t){return e.isArrayLiteralExpression(t.initializer)?e.find(t.initializer.elements,(function(t){return e.isStringLiteral(t)&&t.text===n})):void 0}))},e.getTsConfigPropArray=ue,e.getContainingFunction=function(t){return e.findAncestor(t.parent,e.isFunctionLike)},e.getContainingFunctionDeclaration=function(t){return e.findAncestor(t.parent,e.isFunctionLikeDeclaration)},e.getContainingClass=function(t){return e.findAncestor(t.parent,e.isClassLike)},e.getContainingClassStaticBlock=function(t){return e.findAncestor(t.parent,(function(t){return e.isClassLike(t)||e.isFunctionLike(t)?"quit":e.isClassStaticBlockDeclaration(t)}))},e.getContainingFunctionOrClassStaticBlock=function(t){return e.findAncestor(t.parent,e.isFunctionLikeOrClassStaticBlockDeclaration)},e.getThisContainer=_e,e.isThisContainerOrFunctionBlock=function(e){switch(e.kind){case 214:case 256:case 213:case 167:return !0;case 235:switch(e.parent.kind){case 171:case 169:case 172:case 173:return !0;default:return !1}default:return !1}},e.isInTopLevelContext=function(t){e.isIdentifier(t)&&(e.isClassDeclaration(t.parent)||e.isFunctionDeclaration(t.parent))&&t.parent.name===t&&(t=t.parent);var r=_e(t,!0);return e.isSourceFile(r)},e.getNewTargetContainer=function(e){var t=_e(e,!1);if(t)switch(t.kind){case 171:case 256:case 213:return t}},e.getSuperContainer=function(t,r){for(;;){if(!(t=t.parent))return t;switch(t.kind){case 162:t=t.parent;break;case 256:case 213:case 214:if(!r)continue;case 167:case 166:case 169:case 168:case 171:case 172:case 173:case 170:return t;case 165:164===t.parent.kind&&e.isClassElement(t.parent.parent)?t=t.parent.parent:e.isClassElement(t.parent)&&(t=t.parent);}}},e.getImmediatelyInvokedFunctionExpression=function(e){if(213===e.kind||214===e.kind){for(var t=e,r=e.parent;212===r.kind;)t=r,r=r.parent;if(208===r.kind&&r.expression===t)return r}},e.isSuperOrSuperProperty=function(e){return 106===e.kind||de(e)},e.isSuperProperty=de,e.isThisProperty=function(e){var t=e.kind;return (206===t||207===t)&&108===e.expression.kind},e.isThisInitializedDeclaration=function(t){var r;return !!t&&e.isVariableDeclaration(t)&&108===(null===(r=t.initializer)||void 0===r?void 0:r.kind)},e.isThisInitializedObjectBindingExpression=function(t){return !!t&&(e.isShorthandPropertyAssignment(t)||e.isPropertyAssignment(t))&&e.isBinaryExpression(t.parent.parent)&&63===t.parent.parent.operatorToken.kind&&108===t.parent.parent.right.kind},e.getEntityNameFromTypeNode=function(e){switch(e.kind){case 178:return e.typeName;case 228:return qr(e.expression)?e.expression:void 0;case 79:case 161:return e}},e.getInvokedExpression=function(e){switch(e.kind){case 210:return e.tag;case 280:case 279:return e.tagName;default:return e.expression}},e.nodeCanBeDecorated=pe,e.nodeIsDecorated=fe,e.nodeOrChildIsDecorated=ge,e.childIsDecorated=me,e.classOrConstructorParameterIsDecorated=function(e){if(fe(e))return !0;var t=fr(e);return !!t&&me(t,e)},e.isJSXTagName=ye,e.isExpressionNode=ve,e.isInExpressionContext=he,e.isPartOfTypeQuery=be,e.isNamespaceReexportDeclaration=function(t){return e.isNamespaceExport(t)&&!!t.parent.moduleSpecifier},e.isExternalModuleImportEqualsDeclaration=xe,e.getExternalModuleImportEqualsDeclarationExpression=function(t){return e.Debug.assert(xe(t)),t.moduleReference.expression},e.getExternalModuleRequireArgument=function(e){return Ee(e)&&dn(e.initializer).arguments[0]},e.isInternalModuleImportEqualsDeclaration=function(e){return 265===e.kind&&277!==e.moduleReference.kind},e.isSourceFileJS=De,e.isSourceFileNotJS=function(e){return !Se(e)},e.isInJSFile=Se,e.isInJsonFile=function(e){return !!e&&!!(67108864&e.flags)},e.isSourceFileNotJson=function(e){return !q(e)},e.isInJSDoc=Te,e.isJSDocIndexSignature=function(t){return e.isTypeReferenceNode(t)&&e.isIdentifier(t.typeName)&&"Object"===t.typeName.escapedText&&t.typeArguments&&2===t.typeArguments.length&&(150===t.typeArguments[0].kind||147===t.typeArguments[0].kind)},e.isRequireCall=Ce,e.isVariableDeclarationInitializedToRequire=ke,e.isVariableDeclarationInitializedToBareOrAccessedRequire=Ee,e.isRequireVariableStatement=function(t){return e.isVariableStatement(t)&&t.declarationList.declarations.length>0&&e.every(t.declarationList.declarations,(function(e){return ke(e)}))},e.isSingleOrDoubleQuote=function(e){return 39===e||34===e},e.isStringDoubleQuoted=function(e,t){return 34===b(t,e).charCodeAt(0)},e.isAssignmentDeclaration=Fe,e.getEffectiveInitializer=Ae,e.getDeclaredExpandoInitializer=function(e){var t=Ae(e);return t&&Pe(t,Hr(e.name))},e.getAssignedExpandoInitializer=function(t){if(t&&t.parent&&e.isBinaryExpression(t.parent)&&63===t.parent.operatorToken.kind){var r=Hr(t.parent.left);return Pe(t.parent.right,r)||function(t,r,n){var i=e.isBinaryExpression(r)&&(56===r.operatorToken.kind||60===r.operatorToken.kind)&&Pe(r.right,n);if(i&&we(t,r.left))return i}(t.parent.left,t.parent.right,r)}if(t&&e.isCallExpression(t)&&Be(t)){var n=function(t,r){return e.forEach(t.properties,(function(t){return e.isPropertyAssignment(t)&&e.isIdentifier(t.name)&&"value"===t.name.escapedText&&t.initializer&&Pe(t.initializer,r)}))}(t.arguments[2],"prototype"===t.arguments[1].text);if(n)return n}},e.getExpandoInitializer=Pe,e.isDefaultedExpandoInitializer=function(t){var r=e.isVariableDeclaration(t.parent)?t.parent.name:e.isBinaryExpression(t.parent)&&63===t.parent.operatorToken.kind?t.parent.left:void 0;return r&&Pe(t.right,Hr(r))&&qr(r)&&we(r,t.left)},e.getNameOfExpando=function(t){if(e.isBinaryExpression(t.parent)){var r=56!==t.parent.operatorToken.kind&&60!==t.parent.operatorToken.kind||!e.isBinaryExpression(t.parent.parent)?t.parent:t.parent.parent;if(63===r.operatorToken.kind&&e.isIdentifier(r.left))return r.left}else if(e.isVariableDeclaration(t.parent))return t.parent.name},e.isSameEntityName=we,e.getRightMostAssignedExpression=Ie,e.isExportsIdentifier=Oe,e.isModuleIdentifier=Me,e.isModuleExportsAccessExpression=Le,e.getAssignmentDeclarationKind=Re,e.isBindableObjectDefinePropertyCall=Be,e.isLiteralLikeAccess=je,e.isLiteralLikeElementAccess=Je,e.isBindableStaticAccessExpression=ze,e.isBindableStaticElementAccessExpression=Ke,e.isBindableStaticNameExpression=Ue,e.getNameOrArgument=Ve,e.getElementOrPropertyAccessArgumentExpressionOrName=qe,e.getElementOrPropertyAccessName=We,e.getAssignmentDeclarationPropertyAccessKind=He,e.getInitializerOfBinaryExpression=Ge,e.isPrototypePropertyAssignment=function(t){return e.isBinaryExpression(t)&&3===Re(t)},e.isSpecialPropertyDeclaration=function(t){return Se(t)&&t.parent&&238===t.parent.kind&&(!e.isElementAccessExpression(t)||Je(t))&&!!e.getJSDocTypeTag(t.parent)},e.setValueDeclaration=function(e,t){var r=e.valueDeclaration;(!r||(!(16777216&t.flags)||16777216&r.flags)&&Fe(r)&&!Fe(t)||r.kind!==t.kind&&E(r))&&(e.valueDeclaration=t);},e.isFunctionSymbol=function(t){if(!t||!t.valueDeclaration)return !1;var r=t.valueDeclaration;return 256===r.kind||e.isVariableDeclaration(r)&&r.initializer&&e.isFunctionLike(r.initializer)},e.tryGetModuleSpecifierFromDeclaration=function(t){var r,n;switch(t.kind){case 254:return null===(r=e.findAncestor(t.initializer,(function(e){return Ce(e,!0)})))||void 0===r?void 0:r.arguments[0];case 266:return e.tryCast(t.moduleSpecifier,e.isStringLiteralLike);case 265:return e.tryCast(null===(n=e.tryCast(t.moduleReference,e.isExternalModuleReference))||void 0===n?void 0:n.expression,e.isStringLiteralLike);default:e.Debug.assertNever(t);}},e.importFromModuleSpecifier=function(t){return Qe(t)||e.Debug.failBadSyntaxKind(t.parent)},e.tryGetImportFromModuleSpecifier=Qe,e.getExternalModuleName=Xe,e.getNamespaceDeclarationNode=function(t){switch(t.kind){case 266:return t.importClause&&e.tryCast(t.importClause.namedBindings,e.isNamespaceImport);case 265:return t;case 272:return t.exportClause&&e.tryCast(t.exportClause,e.isNamespaceExport);default:return e.Debug.assertNever(t)}},e.isDefaultImport=function(e){return 266===e.kind&&!!e.importClause&&!!e.importClause.name},e.forEachImportClauseDeclaration=function(t,r){var n;return t.name&&(n=r(t))||t.namedBindings&&(n=e.isNamespaceImport(t.namedBindings)?r(t.namedBindings):e.forEach(t.namedBindings.elements,r))?n:void 0},e.hasQuestionToken=function(e){if(e)switch(e.kind){case 164:case 169:case 168:case 297:case 296:case 167:case 166:return void 0!==e.questionToken}return !1},e.isJSDocConstructSignature=function(t){var r=e.isJSDocFunctionType(t)?e.firstOrUndefined(t.parameters):void 0,n=e.tryCast(r&&r.name,e.isIdentifier);return !!n&&"new"===n.escapedText},e.isJSDocTypeAlias=Ye,e.isTypeAlias=function(t){return Ye(t)||e.isTypeAliasDeclaration(t)},e.getSingleInitializerOfVariableStatementOrPropertyDeclaration=$e,e.getSingleVariableOfVariableStatement=et,e.getJSDocCommentsAndTags=function(t,r){var n;ae(t)&&e.hasInitializer(t)&&e.hasJSDocNodes(t.initializer)&&(n=e.addRange(n,rt(t,e.last(t.initializer.jsDoc))));for(var i=t;i&&i.parent;){if(e.hasJSDocNodes(i)&&(n=e.addRange(n,rt(t,e.last(i.jsDoc)))),164===i.kind){n=e.addRange(n,(r?e.getJSDocParameterTagsNoCache:e.getJSDocParameterTags)(i));break}if(163===i.kind){n=e.addRange(n,(r?e.getJSDocTypeParameterTagsNoCache:e.getJSDocTypeParameterTags)(i));break}i=it(i);}return n||e.emptyArray},e.getNextJSDocCommentLocation=it,e.getParameterSymbolFromJSDoc=function(t){if(t.symbol)return t.symbol;if(e.isIdentifier(t.name)){var r=t.name.escapedText,n=at(t);if(n){var i=e.find(n.parameters,(function(e){return 79===e.name.kind&&e.name.escapedText===r}));return i&&i.symbol}}},e.getEffectiveContainerForJSDocTemplateTag=function(t){if(e.isJSDoc(t.parent)&&t.parent.tags){var r=e.find(t.parent.tags,Ye);if(r)return r}return at(t)},e.getHostSignatureFromJSDoc=at,e.getEffectiveJSDocHost=ot,e.getJSDocHost=st,e.getJSDocRoot=ct,e.getTypeParameterFromJsDoc=function(t){var r=t.name.escapedText,n=t.parent.parent.parent.typeParameters;return n&&e.find(n,(function(e){return e.name.escapedText===r}))},e.hasRestParameter=function(t){var r=e.lastOrUndefined(t.parameters);return !!r&&lt(r)},e.isRestParameter=lt,e.hasTypeArguments=function(e){return !!e.typeArguments},(re=e.AssignmentKind||(e.AssignmentKind={}))[re.None=0]="None",re[re.Definite=1]="Definite",re[re.Compound=2]="Compound",e.getAssignmentTargetKind=ut,e.isAssignmentTarget=function(e){return 0!==ut(e)},e.isNodeWithPossibleHoistedDeclaration=function(e){switch(e.kind){case 235:case 237:case 248:case 239:case 249:case 263:case 289:case 290:case 250:case 242:case 243:case 244:case 240:case 241:case 252:case 292:return !0}return !1},e.isValueSignatureDeclaration=function(t){return e.isFunctionExpression(t)||e.isArrowFunction(t)||e.isMethodOrAccessor(t)||e.isFunctionDeclaration(t)||e.isConstructorDeclaration(t)},e.walkUpParenthesizedTypes=function(e){return _t(e,191)},e.walkUpParenthesizedExpressions=dt,e.walkUpParenthesizedTypesAndGetParentAndChild=function(e){for(var t;e&&191===e.kind;)t=e,e=e.parent;return [t,e]},e.skipParentheses=pt,e.isDeleteTarget=function(e){return (206===e.kind||207===e.kind)&&(e=dt(e.parent))&&215===e.kind},e.isNodeDescendantOf=function(e,t){for(;e;){if(e===t)return !0;e=e.parent;}return !1},e.isDeclarationName=function(t){return !e.isSourceFile(t)&&!e.isBindingPattern(t)&&e.isDeclaration(t.parent)&&t.parent.name===t},e.getDeclarationFromName=function(t){var r=t.parent;switch(t.kind){case 10:case 14:case 8:if(e.isComputedPropertyName(r))return r.parent;case 79:if(e.isDeclaration(r))return r.name===t?r:void 0;if(e.isQualifiedName(r)){var n=r.parent;return e.isJSDocParameterTag(n)&&n.name===r?n:void 0}var i=r.parent;return e.isBinaryExpression(i)&&0!==Re(i)&&(i.left.symbol||i.symbol)&&e.getNameOfDeclaration(i)===t?i:void 0;case 80:return e.isDeclaration(r)&&r.name===t?r:void 0;default:return}},e.isLiteralComputedPropertyDeclarationName=function(t){return Ct(t)&&162===t.parent.kind&&e.isDeclaration(t.parent.parent)},e.isIdentifierName=function(e){var t=e.parent;switch(t.kind){case 167:case 166:case 169:case 168:case 172:case 173:case 299:case 296:case 206:return t.name===e;case 161:return t.right===e;case 203:case 270:return t.propertyName===e;case 275:case 285:case 279:case 280:case 281:return !0}return !1},e.isAliasSymbolDeclaration=function(t){return !!(265===t.kind||264===t.kind||267===t.kind&&t.name||268===t.kind||274===t.kind||270===t.kind||275===t.kind||271===t.kind&&gt(t))||Se(t)&&(e.isBinaryExpression(t)&&2===Re(t)&&gt(t)||e.isPropertyAccessExpression(t)&&e.isBinaryExpression(t.parent)&&t.parent.left===t&&63===t.parent.operatorToken.kind&&ft(t.parent.right))},e.getAliasDeclarationFromName=function e(t){switch(t.parent.kind){case 267:case 270:case 268:case 275:case 271:case 265:case 274:return t.parent;case 161:do{t=t.parent;}while(161===t.parent.kind);return e(t)}},e.isAliasableExpression=ft,e.exportAssignmentIsAlias=gt,e.getExportAssignmentExpression=mt,e.getPropertyAssignmentAliasLikeExpression=function(e){return 297===e.kind?e.name:296===e.kind?e.initializer:e.parent.right},e.getEffectiveBaseTypeNode=yt,e.getClassExtendsHeritageElement=vt,e.getEffectiveImplementsTypeNodes=ht,e.getAllSuperTypeNodes=function(t){return e.isInterfaceDeclaration(t)?bt(t)||e.emptyArray:e.isClassLike(t)&&e.concatenate(e.singleElementArray(yt(t)),ht(t))||e.emptyArray},e.getInterfaceBaseTypeNodes=bt,e.getHeritageClause=xt,e.getAncestor=function(e,t){for(;e;){if(e.kind===t)return e;e=e.parent;}},e.isKeyword=Dt,e.isContextualKeyword=St,e.isNonContextualKeyword=Tt,e.isFutureReservedKeyword=function(e){return 117<=e&&e<=125},e.isStringANonContextualKeyword=function(t){var r=e.stringToToken(t);return void 0!==r&&Tt(r)},e.isStringAKeyword=function(t){var r=e.stringToToken(t);return void 0!==r&&Dt(r)},e.isIdentifierANonContextualKeyword=function(e){var t=e.originalKeywordKind;return !!t&&!St(t)},e.isTrivia=function(e){return 2<=e&&e<=7},(te=e.FunctionFlags||(e.FunctionFlags={}))[te.Normal=0]="Normal",te[te.Generator=1]="Generator",te[te.Async=2]="Async",te[te.Invalid=4]="Invalid",te[te.AsyncGenerator=3]="AsyncGenerator",e.getFunctionFlags=function(e){if(!e)return 4;var t=0;switch(e.kind){case 256:case 213:case 169:e.asteriskToken&&(t|=1);case 214:kr(e,256)&&(t|=2);}return e.body||(t|=4),t},e.isAsyncFunction=function(e){switch(e.kind){case 256:case 213:case 214:case 169:return void 0!==e.body&&void 0===e.asteriskToken&&kr(e,256)}return !1},e.isStringOrNumericLiteralLike=Ct,e.isSignedNumericLiteral=kt,e.hasDynamicName=Et,e.isDynamicName=Nt,e.getPropertyNameForPropertyNameNode=Ft,e.isPropertyNameLiteral=At,e.getTextOfIdentifierOrLiteral=Pt,e.getEscapedTextOfIdentifierOrLiteral=function(t){return e.isMemberName(t)?t.escapedText:e.escapeLeadingUnderscores(t.text)},e.getPropertyNameForUniqueESSymbol=function(t){return "__@".concat(e.getSymbolId(t),"@").concat(t.escapedName)},e.getSymbolNameForPrivateIdentifier=function(t,r){return "__#".concat(e.getSymbolId(t),"@").concat(r)},e.isKnownSymbol=function(t){return e.startsWith(t.escapedName,"__@")},e.isPrivateIdentifierSymbol=function(t){return e.startsWith(t.escapedName,"__#")},e.isESSymbolIdentifier=function(e){return 79===e.kind&&"Symbol"===e.escapedText},e.isPushOrUnshiftIdentifier=function(e){return "push"===e.escapedText||"unshift"===e.escapedText},e.isParameterDeclaration=function(e){return 164===wt(e).kind},e.getRootDeclaration=wt,e.nodeStartsNewLexicalEnvironment=function(e){var t=e.kind;return 171===t||213===t||256===t||214===t||169===t||172===t||173===t||261===t||305===t},e.nodeIsSynthesized=It,e.getOriginalSourceFile=function(t){return e.getParseTreeNode(t,e.isSourceFile)||t},(ee=e.Associativity||(e.Associativity={}))[ee.Left=0]="Left",ee[ee.Right=1]="Right",e.getExpressionAssociativity=function(e){var t=Mt(e),r=209===e.kind&&void 0!==e.arguments;return Ot(e.kind,t,r)},e.getOperatorAssociativity=Ot,e.getExpressionPrecedence=function(e){var t=Mt(e),r=209===e.kind&&void 0!==e.arguments;return Lt(e.kind,t,r)},e.getOperator=Mt,($=e.OperatorPrecedence||(e.OperatorPrecedence={}))[$.Comma=0]="Comma",$[$.Spread=1]="Spread",$[$.Yield=2]="Yield",$[$.Assignment=3]="Assignment",$[$.Conditional=4]="Conditional",$[$.Coalesce=4]="Coalesce",$[$.LogicalOR=5]="LogicalOR",$[$.LogicalAND=6]="LogicalAND",$[$.BitwiseOR=7]="BitwiseOR",$[$.BitwiseXOR=8]="BitwiseXOR",$[$.BitwiseAND=9]="BitwiseAND",$[$.Equality=10]="Equality",$[$.Relational=11]="Relational",$[$.Shift=12]="Shift",$[$.Additive=13]="Additive",$[$.Multiplicative=14]="Multiplicative",$[$.Exponentiation=15]="Exponentiation",$[$.Unary=16]="Unary",$[$.Update=17]="Update",$[$.LeftHandSide=18]="LeftHandSide",$[$.Member=19]="Member",$[$.Primary=20]="Primary",$[$.Highest=20]="Highest",$[$.Lowest=0]="Lowest",$[$.Invalid=-1]="Invalid",e.getOperatorPrecedence=Lt,e.getBinaryOperatorPrecedence=Rt,e.getSemanticJsxChildren=function(t){return e.filter(t,(function(e){switch(e.kind){case 288:return !!e.expression;case 11:return !e.containsOnlyTriviaWhiteSpaces;default:return !0}}))},e.createDiagnosticCollection=function(){var t=[],r=[],n=new e.Map,i=!1;return {add:function(a){var o;a.file?(o=n.get(a.file.fileName))||(o=[],n.set(a.file.fileName,o),e.insertSorted(r,a.file.fileName,e.compareStringsCaseSensitive)):(i&&(i=!1,t=t.slice()),o=t),e.insertSorted(o,a,En);},lookup:function(r){var i;if(i=r.file?n.get(r.file.fileName):t){var a=e.binarySearch(i,r,e.identity,Nn);return a>=0?i[a]:void 0}},getGlobalDiagnostics:function(){return i=!0,t},getDiagnostics:function(i){if(i)return n.get(i)||[];var a=e.flatMapToMutable(r,(function(e){return n.get(e)}));return t.length?(a.unshift.apply(a,t),a):a}}};var Bt=/\$\{/g;e.hasInvalidEscape=function(t){return t&&!!(e.isNoSubstitutionTemplateLiteral(t)?t.templateFlags:t.head.templateFlags||e.some(t.templateSpans,(function(e){return !!e.literal.templateFlags})))};var jt=/[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g,Jt=/[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g,zt=/\r\n|[\\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g,Kt=new e.Map(e.getEntries({"\t":"\\t","\v":"\\v","\f":"\\f","\b":"\\b","\r":"\\r","\n":"\\n","\\":"\\\\",'"':'\\"',"'":"\\'","`":"\\`","\u2028":"\\u2028","\u2029":"\\u2029","…":"\\u0085","\r\n":"\\r\\n"}));function Ut(e){return "\\u"+("0000"+e.toString(16).toUpperCase()).slice(-4)}function Vt(e,t,r){if(0===e.charCodeAt(0)){var n=r.charCodeAt(t+e.length);return n>=48&&n<=57?"\\x00":"\\0"}return Kt.get(e)||Ut(e.charCodeAt(0))}function qt(e,t){var r=96===t?zt:39===t?Jt:jt;return e.replace(r,Vt)}e.escapeString=qt;var Wt=/[^\u0000-\u007F]/g;function Ht(e,t){return e=qt(e,t),Wt.test(e)?e.replace(Wt,(function(e){return Ut(e.charCodeAt(0))})):e}e.escapeNonAsciiString=Ht;var Gt=/[\"\u0000-\u001f\u2028\u2029\u0085]/g,Qt=/[\'\u0000-\u001f\u2028\u2029\u0085]/g,Xt=new e.Map(e.getEntries({'"':"&quot;","'":"&apos;"}));function Yt(e){return 0===e.charCodeAt(0)?"&#0;":Xt.get(e)||"&#x"+e.charCodeAt(0).toString(16).toUpperCase()+";"}function Zt(e,t){var r=39===t?Qt:Gt;return e.replace(r,Yt)}e.escapeJsxAttributeString=Zt,e.stripQuotes=function(e){var t,r=e.length;return r>=2&&e.charCodeAt(0)===e.charCodeAt(r-1)&&(39===(t=e.charCodeAt(0))||34===t||96===t)?e.substring(1,r-1):e},e.isIntrinsicJsxName=function(t){var r=t.charCodeAt(0);return r>=97&&r<=122||e.stringContains(t,"-")||e.stringContains(t,":")};var $t=[""," "];function er(e){for(var t=$t[1],r=$t.length;r<=e;r++)$t.push($t[r-1]+t);return $t[e]}function tr(){return $t[1].length}function rr(e){return !!e.useCaseSensitiveFileNames&&e.useCaseSensitiveFileNames()}function nr(e,t,r){return t.moduleName||ar(e,t.fileName,r&&r.fileName)}function ir(t,r){return t.getCanonicalFileName(e.getNormalizedAbsolutePath(r,t.getCurrentDirectory()))}function ar(t,r,n){var i=function(e){return t.getCanonicalFileName(e)},a=e.toPath(n?e.getDirectoryPath(n):t.getCommonSourceDirectory(),t.getCurrentDirectory(),i),o=e.getNormalizedAbsolutePath(r,t.getCurrentDirectory()),s=fi(e.getRelativePathToDirectoryOrUrl(a,o,a,i,!1));return n?e.ensurePathIsNonModuleName(s):s}function or(e,t,r,n,i){var a=t.declarationDir||t.outDir,o=a?_r(e,a,r,n,i):e,s=sr(o);return fi(o)+s}function sr(t){return e.fileExtensionIsOneOf(t,[".mjs",".mts"])?".d.mts":e.fileExtensionIsOneOf(t,[".cjs",".cts"])?".d.cts":e.fileExtensionIsOneOf(t,[".json"])?".json.d.ts":".d.ts"}function cr(e){return e.outFile||e.out}function lr(e,t,r){return !(t.getCompilerOptions().noEmitForJsFiles&&De(e))&&!e.isDeclarationFile&&!t.isSourceFileFromExternalLibrary(e)&&(r||!(q(e)&&t.getResolvedProjectReferenceToRedirect(e.fileName))&&!t.isSourceOfProjectReferenceRedirect(e.fileName))}function ur(e,t,r){return _r(e,r,t.getCurrentDirectory(),t.getCommonSourceDirectory(),(function(e){return t.getCanonicalFileName(e)}))}function _r(t,r,n,i,a){var o=e.getNormalizedAbsolutePath(t,n);return o=0===a(o).indexOf(a(i))?o.substring(i.length):o,e.combinePaths(r,o)}function dr(t,r,n){t.length>e.getRootLength(t)&&!n(t)&&(dr(e.getDirectoryPath(t),r,n),r(t));}function pr(t,r){return e.computeLineOfPosition(t,r)}function fr(t){return e.find(t.members,(function(t){return e.isConstructorDeclaration(t)&&f(t.body)}))}function gr(e){if(e&&e.parameters.length>0){var t=2===e.parameters.length&&mr(e.parameters[0]);return e.parameters[t?1:0]}}function mr(e){return yr(e.name)}function yr(e){return !!e&&79===e.kind&&vr(e)}function vr(e){return 108===e.originalKeywordKind}function hr(t){if(Se(t)||!e.isFunctionDeclaration(t)){var r=t.type;return r||!Se(t)?r:e.isJSDocPropertyLikeTag(t)?t.typeExpression&&t.typeExpression.type:e.getJSDocType(t)}}function br(e,t,r,n){xr(e,t,r.pos,n);}function xr(e,t,r,n){n&&n.length&&r!==n[0].pos&&pr(e,r)!==pr(e,n[0].pos)&&t.writeLine();}function Dr(e,t,r,n,i,a,o,s){if(n&&n.length>0){i&&r.writeSpace(" ");for(var c=!1,l=0,u=n;l<u.length;l++){var _=u[l];c&&(r.writeSpace(" "),c=!1),s(e,t,r,_.pos,_.end,o),_.hasTrailingNewLine?r.writeLine():c=!0;}c&&a&&r.writeSpace(" ");}}function Sr(t,r,n,i,a,o){var s=Math.min(r,o-1),c=e.trimString(t.substring(a,s));c?(n.writeComment(c),s!==r&&n.writeLine()):n.rawWrite(i);}function Tr(t,r,n){for(var i=0;r<n&&e.isWhiteSpaceSingleLine(t.charCodeAt(r));r++)9===t.charCodeAt(r)?i+=tr()-i%tr():i++;return i}function Cr(e,t){return !!Ar(e,t)}function kr(e,t){return !!Pr(e,t)}function Er(t){return e.isClassElement(t)&&Nr(t)||e.isClassStaticBlockDeclaration(t)}function Nr(e){return kr(e,32)}function Fr(e){return Cr(e,64)}function Ar(e,t){return Ir(e)&t}function Pr(e,t){return Or(e)&t}function wr(e,t,r){return e.kind>=0&&e.kind<=160?0:(536870912&e.modifierFlagsCache||(e.modifierFlagsCache=536870912|Lr(e)),!t||4096&e.modifierFlagsCache||!r&&!Se(e)||!e.parent||(e.modifierFlagsCache|=4096|Mr(e)),-536875009&e.modifierFlagsCache)}function Ir(e){return wr(e,!0)}function Or(e){return wr(e,!1)}function Mr(t){var r=0;return t.parent&&!e.isParameter(t)&&(Se(t)&&(e.getJSDocPublicTagNoCache(t)&&(r|=4),e.getJSDocPrivateTagNoCache(t)&&(r|=8),e.getJSDocProtectedTagNoCache(t)&&(r|=16),e.getJSDocReadonlyTagNoCache(t)&&(r|=64),e.getJSDocOverrideTagNoCache(t)&&(r|=16384)),e.getJSDocDeprecatedTagNoCache(t)&&(r|=8192)),r}function Lr(e){var t=Rr(e.modifiers);return (4&e.flags||79===e.kind&&e.isInJSDocNamespace)&&(t|=1),t}function Rr(e){var t=0;if(e)for(var r=0,n=e;r<n.length;r++)t|=Br(n[r].kind);return t}function Br(e){switch(e){case 124:return 32;case 123:return 4;case 122:return 16;case 121:return 8;case 126:return 128;case 93:return 1;case 135:return 2;case 85:return 2048;case 88:return 512;case 131:return 256;case 145:return 64;case 159:return 16384;case 101:return 32768;case 144:return 65536}return 0}function jr(e){return 75===e||76===e||77===e}function Jr(e){return e>=63&&e<=78}function zr(e){var t=Kr(e);return t&&!t.isImplements?t.class:void 0}function Kr(t){return e.isExpressionWithTypeArguments(t)&&e.isHeritageClause(t.parent)&&e.isClassLike(t.parent.parent)?{class:t.parent.parent,isImplements:117===t.parent.token}:void 0}function Ur(t,r){return e.isBinaryExpression(t)&&(r?63===t.operatorToken.kind:Jr(t.operatorToken.kind))&&e.isLeftHandSideExpression(t.left)}function Vr(e){return void 0!==zr(e)}function qr(e){return 79===e.kind||Wr(e)}function Wr(t){return e.isPropertyAccessExpression(t)&&e.isIdentifier(t.name)&&qr(t.expression)}function Hr(e){return ze(e)&&"prototype"===We(e)}function Gr(t){return e.isPropertyAccessExpression(t.parent)&&t.parent.name===t||e.isElementAccessExpression(t.parent)&&t.parent.argumentExpression===t}e.getIndentString=er,e.getIndentSize=tr,e.isNightly=function(){return e.stringContains(e.version,"-dev")||e.stringContains(e.version,"-insiders")},e.createTextWriter=function(t){var r,n,i,a,o,s=!1;function c(t){var n=e.computeLineStarts(t);n.length>1?(a=a+n.length-1,o=r.length-t.length+e.last(n),i=o-r.length==0):i=!1;}function l(e){e&&e.length&&(i&&(e=er(n)+e,i=!1),r+=e,c(e));}function u(e){e&&(s=!1),l(e);}function _(){r="",n=0,i=!0,a=0,o=0,s=!1;}return _(),{write:u,rawWrite:function(e){void 0!==e&&(r+=e,c(e),s=!1);},writeLiteral:function(e){e&&e.length&&u(e);},writeLine:function(e){i&&!e||(a++,o=(r+=t).length,i=!0,s=!1);},increaseIndent:function(){n++;},decreaseIndent:function(){n--;},getIndent:function(){return n},getTextPos:function(){return r.length},getLine:function(){return a},getColumn:function(){return i?n*tr():r.length-o},getText:function(){return r},isAtStartOfLine:function(){return i},hasTrailingComment:function(){return s},hasTrailingWhitespace:function(){return !!r.length&&e.isWhiteSpaceLike(r.charCodeAt(r.length-1))},clear:_,reportInaccessibleThisError:e.noop,reportPrivateInBaseOfClassExpression:e.noop,reportInaccessibleUniqueSymbolError:e.noop,trackSymbol:function(){return !1},writeKeyword:u,writeOperator:u,writeParameter:u,writeProperty:u,writePunctuation:u,writeSpace:u,writeStringLiteral:u,writeSymbol:function(e,t){return u(e)},writeTrailingSemicolon:u,writeComment:function(e){e&&(s=!0),l(e);},getTextPosWithWriteLine:function(){return i?r.length:r.length+t.length}}},e.getTrailingSemicolonDeferringWriter=function(e){var t=!1;function r(){t&&(e.writeTrailingSemicolon(";"),t=!1);}return i$1(i$1({},e),{writeTrailingSemicolon:function(){t=!0;},writeLiteral:function(t){r(),e.writeLiteral(t);},writeStringLiteral:function(t){r(),e.writeStringLiteral(t);},writeSymbol:function(t,n){r(),e.writeSymbol(t,n);},writePunctuation:function(t){r(),e.writePunctuation(t);},writeKeyword:function(t){r(),e.writeKeyword(t);},writeOperator:function(t){r(),e.writeOperator(t);},writeParameter:function(t){r(),e.writeParameter(t);},writeSpace:function(t){r(),e.writeSpace(t);},writeProperty:function(t){r(),e.writeProperty(t);},writeComment:function(t){r(),e.writeComment(t);},writeLine:function(){r(),e.writeLine();},increaseIndent:function(){r(),e.increaseIndent();},decreaseIndent:function(){r(),e.decreaseIndent();}})},e.hostUsesCaseSensitiveFileNames=rr,e.hostGetCanonicalFileName=function(t){return e.createGetCanonicalFileName(rr(t))},e.getResolvedExternalModuleName=nr,e.getExternalModuleNameFromDeclaration=function(t,r,n){var i=r.getExternalModuleFileFromDeclaration(n);if(i&&!i.isDeclarationFile){var a=Xe(n);if(!a||!e.isStringLiteralLike(a)||e.pathIsRelative(a.text)||-1!==ir(t,i.path).indexOf(ir(t,e.ensureTrailingDirectorySeparator(t.getCommonSourceDirectory()))))return nr(t,i)}},e.getExternalModuleNameFromPath=ar,e.getOwnEmitOutputFilePath=function(e,t,r){var n=t.getCompilerOptions();return (n.outDir?fi(ur(e,t,n.outDir)):fi(e))+r},e.getDeclarationEmitOutputFilePath=function(e,t){return or(e,t.getCompilerOptions(),t.getCurrentDirectory(),t.getCommonSourceDirectory(),(function(e){return t.getCanonicalFileName(e)}))},e.getDeclarationEmitOutputFilePathWorker=or,e.getDeclarationEmitExtensionForPath=sr,e.getPossibleOriginalInputExtensionForExtension=function(t){return e.fileExtensionIsOneOf(t,[".d.mts",".mjs",".mts"])?[".mts",".mjs"]:e.fileExtensionIsOneOf(t,[".d.cts",".cjs",".cts"])?[".cts",".cjs"]:e.fileExtensionIsOneOf(t,[".json.d.ts"])?[".json"]:[".tsx",".ts",".jsx",".js"]},e.outFile=cr,e.getPathsBasePath=function(t,r){var n,i;if(t.paths)return null!==(n=t.baseUrl)&&void 0!==n?n:e.Debug.checkDefined(t.pathsBasePath||(null===(i=r.getCurrentDirectory)||void 0===i?void 0:i.call(r)),"Encountered 'paths' without a 'baseUrl', config file, or host 'getCurrentDirectory'.")},e.getSourceFilesToEmit=function(t,r,n){var i=t.getCompilerOptions();if(cr(i)){var a=On(i),o=i.emitDeclarationOnly||a===e.ModuleKind.AMD||a===e.ModuleKind.System;return e.filter(t.getSourceFiles(),(function(r){return (o||!e.isExternalModule(r))&&lr(r,t,n)}))}var s=void 0===r?t.getSourceFiles():[r];return e.filter(s,(function(e){return lr(e,t,n)}))},e.sourceFileMayBeEmitted=lr,e.getSourceFilePathInNewDir=ur,e.getSourceFilePathInNewDirWorker=_r,e.writeFile=function(t,r,n,i,a,o,s){t.writeFile(n,i,a,(function(t){r.add(Cn(e.Diagnostics.Could_not_write_file_0_Colon_1,n,t));}),o,s);},e.writeFileEnsuringDirectories=function(t,r,n,i,a,o){try{i(t,r,n);}catch(s){dr(e.getDirectoryPath(e.normalizePath(t)),a,o),i(t,r,n);}},e.getLineOfLocalPosition=function(t,r){var n=e.getLineStarts(t);return e.computeLineOfPosition(n,r)},e.getLineOfLocalPositionFromLineMap=pr,e.getFirstConstructorWithBody=fr,e.getSetAccessorValueParameter=gr,e.getSetAccessorTypeAnnotationNode=function(e){var t=gr(e);return t&&t.type},e.getThisParameter=function(t){if(t.parameters.length&&!e.isJSDocSignature(t)){var r=t.parameters[0];if(mr(r))return r}},e.parameterIsThisKeyword=mr,e.isThisIdentifier=yr,e.isThisInTypeQuery=function(t){if(!yr(t))return !1;for(;e.isQualifiedName(t.parent)&&t.parent.left===t;)t=t.parent;return 181===t.parent.kind},e.identifierIsThisKeyword=vr,e.getAllAccessorDeclarations=function(t,r){var n,i,a,o;return Et(r)?(n=r,172===r.kind?a=r:173===r.kind?o=r:e.Debug.fail("Accessor has wrong kind")):e.forEach(t,(function(t){e.isAccessor(t)&&Er(t)===Er(r)&&Ft(t.name)===Ft(r.name)&&(n?i||(i=t):n=t,172!==t.kind||a||(a=t),173!==t.kind||o||(o=t));})),{firstAccessor:n,secondAccessor:i,getAccessor:a,setAccessor:o}},e.getEffectiveTypeAnnotationNode=hr,e.getTypeAnnotationNode=function(e){return e.type},e.getEffectiveReturnTypeNode=function(t){return e.isJSDocSignature(t)?t.type&&t.type.typeExpression&&t.type.typeExpression.type:t.type||(Se(t)?e.getJSDocReturnType(t):void 0)},e.getJSDocTypeParameterDeclarations=function(t){return e.flatMap(e.getJSDocTags(t),(function(t){return function(t){return e.isJSDocTemplateTag(t)&&!(320===t.parent.kind&&t.parent.tags.some(Ye))}(t)?t.typeParameters:void 0}))},e.getEffectiveSetAccessorTypeAnnotationNode=function(e){var t=gr(e);return t&&hr(t)},e.emitNewLineBeforeLeadingComments=br,e.emitNewLineBeforeLeadingCommentsOfPosition=xr,e.emitNewLineBeforeLeadingCommentOfPosition=function(e,t,r,n){r!==n&&pr(e,r)!==pr(e,n)&&t.writeLine();},e.emitComments=Dr,e.emitDetachedComments=function(t,r,n,i,a,o,s){var c,l;if(s?0===a.pos&&(c=e.filter(e.getLeadingCommentRanges(t,a.pos),(function(e){return v(t,e.pos)}))):c=e.getLeadingCommentRanges(t,a.pos),c){for(var u=[],_=void 0,d=0,p=c;d<p.length;d++){var f=p[d];if(_){var g=pr(r,_.end);if(pr(r,f.pos)>=g+2)break}u.push(f),_=f;}u.length&&(g=pr(r,e.last(u).end),pr(r,e.skipTrivia(t,a.pos))>=g+2&&(br(r,n,a,c),Dr(t,r,n,u,!1,!0,o,i),l={nodePos:a.pos,detachedCommentEndPos:e.last(u).end}));}return l},e.writeCommentRange=function(t,r,n,i,a,o){if(42===t.charCodeAt(i+1))for(var s=e.computeLineAndCharacterOfPosition(r,i),c=r.length,l=void 0,u=i,_=s.line;u<a;_++){var d=_+1===c?t.length+1:r[_+1];if(u!==i){void 0===l&&(l=Tr(t,r[s.line],i));var p=n.getIndent()*tr()-l+Tr(t,u,d);if(p>0){var f=p%tr(),g=er((p-f)/tr());for(n.rawWrite(g);f;)n.rawWrite(" "),f--;}else n.rawWrite("");}Sr(t,a,n,o,u,d),u=d;}else n.writeComment(t.substring(i,a));},e.hasEffectiveModifiers=function(e){return 0!==Ir(e)},e.hasSyntacticModifiers=function(e){return 0!==Or(e)},e.hasEffectiveModifier=Cr,e.hasSyntacticModifier=kr,e.isStatic=Er,e.hasStaticModifier=Nr,e.hasOverrideModifier=function(e){return Cr(e,16384)},e.hasAbstractModifier=function(e){return kr(e,128)},e.hasAmbientModifier=function(e){return kr(e,2)},e.hasEffectiveReadonlyModifier=Fr,e.getSelectedEffectiveModifierFlags=Ar,e.getSelectedSyntacticModifierFlags=Pr,e.getEffectiveModifierFlags=Ir,e.getEffectiveModifierFlagsAlwaysIncludeJSDoc=function(e){return wr(e,!0,!0)},e.getSyntacticModifierFlags=Or,e.getEffectiveModifierFlagsNoCache=function(e){return Lr(e)|Mr(e)},e.getSyntacticModifierFlagsNoCache=Lr,e.modifiersToFlags=Rr,e.modifierToFlag=Br,e.createModifiers=function(t){return t?e.factory.createNodeArray(e.factory.createModifiersFromModifierFlags(t)):void 0},e.isLogicalOperator=function(e){return 56===e||55===e||53===e},e.isLogicalOrCoalescingAssignmentOperator=jr,e.isLogicalOrCoalescingAssignmentExpression=function(e){return jr(e.operatorToken.kind)},e.isAssignmentOperator=Jr,e.tryGetClassExtendingExpressionWithTypeArguments=zr,e.tryGetClassImplementingOrExtendingExpressionWithTypeArguments=Kr,e.isAssignmentExpression=Ur,e.isLeftHandSideOfAssignment=function(e){return Ur(e.parent)&&e.parent.left===e},e.isDestructuringAssignment=function(e){if(Ur(e,!0)){var t=e.left.kind;return 205===t||204===t}return !1},e.isExpressionWithTypeArgumentsInClassExtendsClause=Vr,e.isEntityNameExpression=qr,e.getFirstIdentifier=function(e){switch(e.kind){case 79:return e;case 161:do{e=e.left;}while(79!==e.kind);return e;case 206:do{e=e.expression;}while(79!==e.kind);return e}},e.isDottedName=function e(t){return 79===t.kind||108===t.kind||106===t.kind||231===t.kind||206===t.kind&&e(t.expression)||212===t.kind&&e(t.expression)},e.isPropertyAccessEntityNameExpression=Wr,e.tryGetPropertyAccessOrIdentifierToString=function t(r){if(e.isPropertyAccessExpression(r)){if(void 0!==(n=t(r.expression)))return n+"."+j(r.name)}else if(e.isElementAccessExpression(r)){var n;if(void 0!==(n=t(r.expression))&&e.isPropertyName(r.argumentExpression))return n+"."+Ft(r.argumentExpression)}else if(e.isIdentifier(r))return e.unescapeLeadingUnderscores(r.escapedText)},e.isPrototypeAccess=Hr,e.isRightSideOfQualifiedNameOrPropertyAccess=function(e){return 161===e.parent.kind&&e.parent.right===e||206===e.parent.kind&&e.parent.name===e},e.isRightSideOfAccessExpression=Gr,e.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName=function(t){return e.isQualifiedName(t.parent)&&t.parent.right===t||e.isPropertyAccessExpression(t.parent)&&t.parent.name===t||e.isJSDocMemberName(t.parent)&&t.parent.right===t},e.isEmptyObjectLiteral=function(e){return 205===e.kind&&0===e.properties.length},e.isEmptyArrayLiteral=function(e){return 204===e.kind&&0===e.elements.length},e.getLocalSymbolForExportDefault=function(t){if(function(t){return t&&e.length(t.declarations)>0&&kr(t.declarations[0],512)}(t)&&t.declarations)for(var r=0,n=t.declarations;r<n.length;r++){var i=n[r];if(i.localSymbol)return i.localSymbol}},e.tryExtractTSExtension=function(t){return e.find(si,(function(r){return e.fileExtensionIs(t,r)}))};var Qr,Xr,Yr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Zr(t){for(var r,n,i,a,o="",s=function(t){for(var r=[],n=t.length,i=0;i<n;i++){var a=t.charCodeAt(i);a<128?r.push(a):a<2048?(r.push(a>>6|192),r.push(63&a|128)):a<65536?(r.push(a>>12|224),r.push(a>>6&63|128),r.push(63&a|128)):a<131072?(r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)):e.Debug.assert(!1,"Unexpected code point");}return r}(t),c=0,l=s.length;c<l;)r=s[c]>>2,n=(3&s[c])<<4|s[c+1]>>4,i=(15&s[c+1])<<2|s[c+2]>>6,a=63&s[c+2],c+1>=l?i=a=64:c+2>=l&&(a=64),o+=Yr.charAt(r)+Yr.charAt(n)+Yr.charAt(i)+Yr.charAt(a),c+=3;return o}function $r(t,r){return void 0===r&&(r=t),e.Debug.assert(r>=t||-1===r),{pos:t,end:r}}function en(e,t){return $r(t,e.end)}function tn(e){return e.decorators&&e.decorators.length>0?en(e,e.decorators.end):e}function rn(e,t,r){return nn(an(e,r,!1),t.end,r)}function nn(t,r,n){return 0===e.getLinesBetweenPositions(n,t,r)}function an(t,r,n){return vi(t.pos)?-1:e.skipTrivia(r.text,t.pos,!1,n)}function on(e){return void 0!==e.initializer}function sn(e){return 33554432&e.flags?e.checkFlags:0}function cn(t){var r=t.parent;if(!r)return 0;switch(r.kind){case 212:return cn(r);case 220:case 219:var n=r.operator;return 45===n||46===n?c():0;case 221:var i=r,a=i.left,o=i.operatorToken;return a===t&&Jr(o.kind)?63===o.kind?1:c():0;case 206:return r.name!==t?0:cn(r);case 296:var s=cn(r.parent);return t===r.name?function(t){switch(t){case 0:return 1;case 1:return 0;case 2:return 2;default:return e.Debug.assertNever(t)}}(s):s;case 297:return t===r.objectAssignmentInitializer?0:cn(r.parent);case 204:return cn(r);default:return 0}function c(){return r.parent&&238===dt(r.parent).kind?1:2}}function ln(e,t,r){var n=r.onDeleteValue,i=r.onExistingValue;e.forEach((function(r,a){var o=t.get(a);void 0===o?(e.delete(a),n(r,a)):i&&i(r,o,a);}));}function un(t){var r;return null===(r=t.declarations)||void 0===r?void 0:r.find(e.isClassLike)}function _n(e){return 206===e.kind||207===e.kind}function dn(e){for(;_n(e);)e=e.expression;return e}function pn(e,t){this.flags=e,this.escapedName=t,this.declarations=void 0,this.valueDeclaration=void 0,this.id=void 0,this.mergeId=void 0,this.parent=void 0;}function fn(t,r){this.flags=r,(e.Debug.isDebugging||e.tracing)&&(this.checker=t);}function gn(t,r){this.flags=r,e.Debug.isDebugging&&(this.checker=t);}function mn(e,t,r){this.pos=t,this.end=r,this.kind=e,this.id=0,this.flags=0,this.modifierFlagsCache=0,this.transformFlags=0,this.parent=void 0,this.original=void 0;}function yn(e,t,r){this.pos=t,this.end=r,this.kind=e,this.id=0,this.flags=0,this.transformFlags=0,this.parent=void 0;}function vn(e,t,r){this.pos=t,this.end=r,this.kind=e,this.id=0,this.flags=0,this.transformFlags=0,this.parent=void 0,this.original=void 0,this.flowNode=void 0;}function hn(e,t,r){this.fileName=e,this.text=t,this.skipTrivia=r||function(e){return e};}function bn(t,r,n){return void 0===n&&(n=0),t.replace(/{(\d+)}/g,(function(t,i){return ""+e.Debug.checkDefined(r[+i+n])}))}function xn(e){return Xr&&Xr[e.key]||e.message}function Dn(e){return void 0===e.file&&void 0!==e.start&&void 0!==e.length&&"string"==typeof e.fileName}function Sn(t,r){var n=r.fileName||"",i=r.text.length;e.Debug.assertEqual(t.fileName,n),e.Debug.assertLessThanOrEqual(t.start,i),e.Debug.assertLessThanOrEqual(t.start+t.length,i);var a={file:r,start:t.start,length:t.length,messageText:t.messageText,category:t.category,code:t.code,reportsUnnecessary:t.reportsUnnecessary};if(t.relatedInformation){a.relatedInformation=[];for(var o=0,s=t.relatedInformation;o<s.length;o++){var c=s[o];Dn(c)&&c.fileName===n?(e.Debug.assertLessThanOrEqual(c.start,i),e.Debug.assertLessThanOrEqual(c.start+c.length,i),a.relatedInformation.push(Sn(c,r))):a.relatedInformation.push(c);}}return a}function Tn(e,t,r,n){z(e,t,r);var i=xn(n);return arguments.length>4&&(i=bn(i,arguments,4)),{file:e,start:t,length:r,messageText:i,category:n.category,code:n.code,reportsUnnecessary:n.reportsUnnecessary,reportsDeprecated:n.reportsDeprecated}}function Cn(e){var t=xn(e);return arguments.length>1&&(t=bn(t,arguments,1)),{file:void 0,start:void 0,length:void 0,messageText:t,category:e.category,code:e.code,reportsUnnecessary:e.reportsUnnecessary,reportsDeprecated:e.reportsDeprecated}}function kn(e){return e.file?e.file.path:void 0}function En(t,r){return Nn(t,r)||function(t,r){return t.relatedInformation||r.relatedInformation?t.relatedInformation&&r.relatedInformation?e.compareValues(t.relatedInformation.length,r.relatedInformation.length)||e.forEach(t.relatedInformation,(function(e,t){return En(e,r.relatedInformation[t])}))||0:t.relatedInformation?-1:1:0}(t,r)||0}function Nn(t,r){return e.compareStringsCaseSensitive(kn(t),kn(r))||e.compareValues(t.start,r.start)||e.compareValues(t.length,r.length)||e.compareValues(t.code,r.code)||Fn(t.messageText,r.messageText)||0}function Fn(t,r){if("string"==typeof t&&"string"==typeof r)return e.compareStringsCaseSensitive(t,r);if("string"==typeof t)return -1;if("string"==typeof r)return 1;var n=e.compareStringsCaseSensitive(t.messageText,r.messageText);if(n)return n;if(!t.next&&!r.next)return 0;if(!t.next)return -1;if(!r.next)return 1;for(var i=Math.min(t.next.length,r.next.length),a=0;a<i;a++)if(n=Fn(t.next[a],r.next[a]))return n;return t.next.length<r.next.length?-1:t.next.length>r.next.length?1:0}function An(t){if(2&t.transformFlags)return e.isJsxOpeningLikeElement(t)||e.isJsxFragment(t)?t:e.forEachChild(t,An)}function Pn(e){return e.isDeclarationFile?void 0:An(e)}function wn(t){return !(t.impliedNodeFormat!==e.ModuleKind.ESNext&&!e.fileExtensionIsOneOf(t.fileName,[".cjs",".cts"])||t.isDeclarationFile)||void 0}function In(t){return t.target||t.module===e.ModuleKind.Node16&&9||t.module===e.ModuleKind.NodeNext&&99||0}function On(t){return "number"==typeof t.module?t.module:In(t)>=2?e.ModuleKind.ES2015:e.ModuleKind.CommonJS}function Mn(t){return t.moduleDetection||(On(t)===e.ModuleKind.Node16||On(t)===e.ModuleKind.NodeNext?e.ModuleDetectionKind.Force:e.ModuleDetectionKind.Auto)}function Ln(t){if(void 0!==t.esModuleInterop)return t.esModuleInterop;switch(On(t)){case e.ModuleKind.Node16:case e.ModuleKind.NodeNext:return !0}}function Rn(e){return !(!e.declaration&&!e.composite)}function Bn(e,t){return void 0===e[t]?!!e.strict:!!e[t]}function jn(e){return void 0===e.allowJs?!!e.checkJs:e.allowJs}function Jn(e,t){return t.strictFlag?Bn(e,t.name):e[t.name]}function zn(t,r){return void 0!==t&&("node_modules"===r(t)||e.startsWith(t,"@"))}e.convertToBase64=Zr,e.base64encode=function(e,t){return e&&e.base64encode?e.base64encode(t):Zr(t)},e.base64decode=function(e,t){if(e&&e.base64decode)return e.base64decode(t);for(var r=t.length,n=[],i=0;i<r&&t.charCodeAt(i)!==Yr.charCodeAt(64);){var a=Yr.indexOf(t[i]),o=Yr.indexOf(t[i+1]),s=Yr.indexOf(t[i+2]),c=Yr.indexOf(t[i+3]),l=(63&a)<<2|o>>4&3,u=(15&o)<<4|s>>2&15,_=(3&s)<<6|63&c;0===u&&0!==s?n.push(l):0===_&&0!==c?n.push(l,u):n.push(l,u,_),i+=4;}return function(e){for(var t="",r=0,n=e.length;r<n;){var i=e[r];if(i<128)t+=String.fromCharCode(i),r++;else if(192==(192&i)){for(var a=63&i,o=e[++r];128==(192&o);)a=a<<6|63&o,o=e[++r];t+=String.fromCharCode(a);}else t+=String.fromCharCode(i),r++;}return t}(n)},e.readJson=function(t,r){try{var n=r.readFile(t);if(!n)return {};var i=e.parseConfigFileTextToJson(t,n);return i.error?{}:i.config}catch(e){return {}}},e.directoryProbablyExists=function(e,t){return !t.directoryExists||t.directoryExists(e)},e.getNewLineCharacter=function(t,r){switch(t.newLine){case 0:return "\r\n";case 1:return "\n"}return r?r():e.sys?e.sys.newLine:"\r\n"},e.createRange=$r,e.moveRangeEnd=function(e,t){return $r(e.pos,t)},e.moveRangePos=en,e.moveRangePastDecorators=tn,e.moveRangePastModifiers=function(e){return e.modifiers&&e.modifiers.length>0?en(e,e.modifiers.end):tn(e)},e.isCollapsedRange=function(e){return e.pos===e.end},e.createTokenRange=function(t,r){return $r(t,t+e.tokenToString(r).length)},e.rangeIsOnSingleLine=function(e,t){return rn(e,e,t)},e.rangeStartPositionsAreOnSameLine=function(e,t,r){return nn(an(e,r,!1),an(t,r,!1),r)},e.rangeEndPositionsAreOnSameLine=function(e,t,r){return nn(e.end,t.end,r)},e.rangeStartIsOnSameLineAsRangeEnd=rn,e.rangeEndIsOnSameLineAsRangeStart=function(e,t,r){return nn(e.end,an(t,r,!1),r)},e.getLinesBetweenRangeEndAndRangeStart=function(t,r,n,i){var a=an(r,n,i);return e.getLinesBetweenPositions(n,t.end,a)},e.getLinesBetweenRangeEndPositions=function(t,r,n){return e.getLinesBetweenPositions(n,t.end,r.end)},e.isNodeArrayMultiLine=function(e,t){return !nn(e.pos,e.end,t)},e.positionsAreOnSameLine=nn,e.getStartPositionOfRange=an,e.getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter=function(t,r,n,i){var a=e.skipTrivia(n.text,t,!1,i),o=function(t,r,n){for(void 0===r&&(r=0);t-- >r;)if(!e.isWhiteSpaceLike(n.text.charCodeAt(t)))return t}(a,r,n);return e.getLinesBetweenPositions(n,null!=o?o:r,a)},e.getLinesBetweenPositionAndNextNonWhitespaceCharacter=function(t,r,n,i){var a=e.skipTrivia(n.text,t,!1,i);return e.getLinesBetweenPositions(n,t,Math.min(r,a))},e.isDeclarationNameOfEnumOrNamespace=function(t){var r=e.getParseTreeNode(t);if(r)switch(r.parent.kind){case 260:case 261:return r===r.parent.name}return !1},e.getInitializedVariables=function(t){return e.filter(t.declarations,on)},e.isWatchSet=function(e){return e.watch&&e.hasOwnProperty("watch")},e.closeFileWatcher=function(e){e.close();},e.getCheckFlags=sn,e.getDeclarationModifierFlagsFromSymbol=function(t,r){if(void 0===r&&(r=!1),t.valueDeclaration){var n=r&&t.declarations&&e.find(t.declarations,(function(e){return 173===e.kind}))||t.valueDeclaration,i=e.getCombinedModifierFlags(n);return t.parent&&32&t.parent.flags?i:-29&i}if(6&sn(t)){var a=t.checkFlags;return (1024&a?8:256&a?4:16)|(2048&a?32:0)}return 4194304&t.flags?36:0},e.skipAlias=function(e,t){return 2097152&e.flags?t.getAliasedSymbol(e):e},e.getCombinedLocalAndExportSymbolFlags=function(e){return e.exportSymbol?e.exportSymbol.flags|e.flags:e.flags},e.isWriteOnlyAccess=function(e){return 1===cn(e)},e.isWriteAccess=function(e){return 0!==cn(e)},function(e){e[e.Read=0]="Read",e[e.Write=1]="Write",e[e.ReadWrite=2]="ReadWrite";}(Qr||(Qr={})),e.compareDataObjects=function e(t,r){if(!t||!r||Object.keys(t).length!==Object.keys(r).length)return !1;for(var n in t)if("object"==typeof t[n]){if(!e(t[n],r[n]))return !1}else if("function"!=typeof t[n]&&t[n]!==r[n])return !1;return !0},e.clearMap=function(e,t){e.forEach(t),e.clear();},e.mutateMapSkippingNewValues=ln,e.mutateMap=function(e,t,r){ln(e,t,r);var n=r.createNewValue;t.forEach((function(t,r){e.has(r)||e.set(r,n(r,t));}));},e.isAbstractConstructorSymbol=function(e){if(32&e.flags){var t=un(e);return !!t&&kr(t,128)}return !1},e.getClassLikeDeclarationOfSymbol=un,e.getObjectFlags=function(e){return 3899393&e.flags?e.objectFlags:0},e.typeHasCallOrConstructSignatures=function(e,t){return 0!==t.getSignaturesOfType(e,0).length||0!==t.getSignaturesOfType(e,1).length},e.forSomeAncestorDirectory=function(t,r){return !!e.forEachAncestorDirectory(t,(function(e){return !!r(e)||void 0}))},e.isUMDExportSymbol=function(t){return !!t&&!!t.declarations&&!!t.declarations[0]&&e.isNamespaceExportDeclaration(t.declarations[0])},e.showModuleSpecifier=function(t){var r=t.moduleSpecifier;return e.isStringLiteral(r)?r.text:D(r)},e.getLastChild=function(t){var r;return e.forEachChild(t,(function(e){f(e)&&(r=e);}),(function(e){for(var t=e.length-1;t>=0;t--)if(f(e[t])){r=e[t];break}})),r},e.addToSeen=function(e,t,r){return void 0===r&&(r=!0),!e.has(t)&&(e.set(t,r),!0)},e.isObjectTypeDeclaration=function(t){return e.isClassLike(t)||e.isInterfaceDeclaration(t)||e.isTypeLiteralNode(t)},e.isTypeNodeKind=function(e){return e>=177&&e<=200||130===e||155===e||147===e||158===e||148===e||133===e||150===e||151===e||114===e||153===e||143===e||228===e||312===e||313===e||314===e||315===e||316===e||317===e||318===e},e.isAccessExpression=_n,e.getNameOfAccessExpression=function(t){return 206===t.kind?t.name:(e.Debug.assert(207===t.kind),t.argumentExpression)},e.isBundleFileTextLike=function(e){switch(e.kind){case"text":case"internal":return !0;default:return !1}},e.isNamedImportsOrExports=function(e){return 269===e.kind||273===e.kind},e.getLeftmostAccessExpression=dn,e.forEachNameInAccessChainWalkingLeft=function(t,r){if(_n(t.parent)&&Gr(t))return function t(n){if(206===n.kind){if(void 0!==(i=r(n.name)))return i}else if(207===n.kind){if(!e.isIdentifier(n.argumentExpression)&&!e.isStringLiteralLike(n.argumentExpression))return;var i;if(void 0!==(i=r(n.argumentExpression)))return i}return _n(n.expression)?t(n.expression):e.isIdentifier(n.expression)?r(n.expression):void 0}(t.parent)},e.getLeftmostExpression=function(e,t){for(;;){switch(e.kind){case 220:e=e.operand;continue;case 221:e=e.left;continue;case 222:e=e.condition;continue;case 210:e=e.tag;continue;case 208:if(t)return e;case 229:case 207:case 206:case 230:case 350:e=e.expression;continue}return e}},e.objectAllocator={getNodeConstructor:function(){return mn},getTokenConstructor:function(){return yn},getIdentifierConstructor:function(){return vn},getPrivateIdentifierConstructor:function(){return mn},getSourceFileConstructor:function(){return mn},getSymbolConstructor:function(){return pn},getTypeConstructor:function(){return fn},getSignatureConstructor:function(){return gn},getSourceMapSourceConstructor:function(){return hn}},e.setObjectAllocator=function(t){Object.assign(e.objectAllocator,t);},e.formatStringFromArgs=bn,e.setLocalizedDiagnosticMessages=function(e){Xr=e;},e.maybeSetLocalizedDiagnosticMessages=function(e){!Xr&&e&&(Xr=e());},e.getLocaleSpecificMessage=xn,e.createDetachedDiagnostic=function(e,t,r,n){z(void 0,t,r);var i=xn(n);return arguments.length>4&&(i=bn(i,arguments,4)),{file:void 0,start:t,length:r,messageText:i,category:n.category,code:n.code,reportsUnnecessary:n.reportsUnnecessary,fileName:e}},e.attachFileToDiagnostics=function(e,t){for(var r=[],n=0,i=e;n<i.length;n++){var a=i[n];r.push(Sn(a,t));}return r},e.createFileDiagnostic=Tn,e.formatMessage=function(e,t){var r=xn(t);return arguments.length>2&&(r=bn(r,arguments,2)),r},e.createCompilerDiagnostic=Cn,e.createCompilerDiagnosticFromMessageChain=function(e,t){return {file:void 0,start:void 0,length:void 0,code:e.code,category:e.category,messageText:e.next?e:e.messageText,relatedInformation:t}},e.chainDiagnosticMessages=function(e,t){var r=xn(t);return arguments.length>2&&(r=bn(r,arguments,2)),{messageText:r,category:t.category,code:t.code,next:void 0===e||Array.isArray(e)?e:[e]}},e.concatenateDiagnosticMessageChains=function(e,t){for(var r=e;r.next;)r=r.next[0];r.next=[t];},e.compareDiagnostics=En,e.compareDiagnosticsSkipRelatedInformation=Nn,e.getLanguageVariant=function(e){return 4===e||2===e||1===e||6===e?1:0},e.getSetExternalModuleIndicator=function(t){switch(Mn(t)){case e.ModuleDetectionKind.Force:return function(t){t.externalModuleIndicator=e.isFileProbablyExternalModule(t)||!t.isDeclarationFile||void 0;};case e.ModuleDetectionKind.Legacy:return function(t){t.externalModuleIndicator=e.isFileProbablyExternalModule(t);};case e.ModuleDetectionKind.Auto:var r=[e.isFileProbablyExternalModule];4!==t.jsx&&5!==t.jsx||r.push(Pn);var n=On(t);n!==e.ModuleKind.Node16&&n!==e.ModuleKind.NodeNext||r.push(wn);var i=e.or.apply(void 0,r);return function(e){e.externalModuleIndicator=i(e);}}},e.getEmitScriptTarget=In,e.getEmitModuleKind=On,e.getEmitModuleResolutionKind=function(t){var r=t.moduleResolution;if(void 0===r)switch(On(t)){case e.ModuleKind.CommonJS:r=e.ModuleResolutionKind.NodeJs;break;case e.ModuleKind.Node16:r=e.ModuleResolutionKind.Node16;break;case e.ModuleKind.NodeNext:r=e.ModuleResolutionKind.NodeNext;break;default:r=e.ModuleResolutionKind.Classic;}return r},e.getEmitModuleDetectionKind=Mn,e.hasJsonModuleEmitEnabled=function(t){switch(On(t)){case e.ModuleKind.CommonJS:case e.ModuleKind.AMD:case e.ModuleKind.ES2015:case e.ModuleKind.ES2020:case e.ModuleKind.ES2022:case e.ModuleKind.ESNext:case e.ModuleKind.Node16:case e.ModuleKind.NodeNext:return !0;default:return !1}},e.unreachableCodeIsError=function(e){return !1===e.allowUnreachableCode},e.unusedLabelIsError=function(e){return !1===e.allowUnusedLabels},e.getAreDeclarationMapsEnabled=function(e){return !(!Rn(e)||!e.declarationMap)},e.getESModuleInterop=Ln,e.getAllowSyntheticDefaultImports=function(t){var r=On(t);return void 0!==t.allowSyntheticDefaultImports?t.allowSyntheticDefaultImports:Ln(t)||r===e.ModuleKind.System},e.getEmitDeclarations=Rn,e.shouldPreserveConstEnums=function(e){return !(!e.preserveConstEnums&&!e.isolatedModules)},e.isIncrementalCompilation=function(e){return !(!e.incremental&&!e.composite)},e.getStrictOptionValue=Bn,e.getAllowJSCompilerOption=jn,e.getUseDefineForClassFields=function(e){return void 0===e.useDefineForClassFields?In(e)>=9:e.useDefineForClassFields},e.compilerOptionsAffectSemanticDiagnostics=function(t,r){return c(r,t,e.semanticDiagnosticsOptionDeclarations)},e.compilerOptionsAffectEmit=function(t,r){return c(r,t,e.affectsEmitOptionDeclarations)},e.getCompilerOptionValue=Jn,e.getJSXTransformEnabled=function(e){var t=e.jsx;return 2===t||4===t||5===t},e.getJSXImplicitImportBase=function(t,r){var n=null==r?void 0:r.pragmas.get("jsximportsource"),i=e.isArray(n)?n[n.length-1]:n;return 4===t.jsx||5===t.jsx||t.jsxImportSource||i?(null==i?void 0:i.arguments.factory)||t.jsxImportSource||"react":void 0},e.getJSXRuntimeImport=function(e,t){return e?"".concat(e,"/").concat(5===t.jsx?"jsx-dev-runtime":"jsx-runtime"):void 0},e.hasZeroOrOneAsteriskCharacter=function(e){for(var t=!1,r=0;r<e.length;r++)if(42===e.charCodeAt(r)){if(t)return !1;t=!0;}return !0},e.createSymlinkCache=function(t,r){var n,i,a,o=!1;return {getSymlinkedFiles:function(){return a},getSymlinkedDirectories:function(){return n},getSymlinkedDirectoriesByRealpath:function(){return i},setSymlinkedFile:function(t,r){return (a||(a=new e.Map)).set(t,r)},setSymlinkedDirectory:function(a,o){var s=e.toPath(a,t,r);Ei(s)||(s=e.ensureTrailingDirectorySeparator(s),!1===o||(null==n?void 0:n.has(s))||(i||(i=e.createMultiMap())).add(e.ensureTrailingDirectorySeparator(o.realPath),a),(n||(n=new e.Map)).set(s,o));},setSymlinksFromResolutions:function(t,r){var n,i=this;e.Debug.assert(!o),o=!0;for(var a=0,c=t;a<c.length;a++)null===(n=c[a].resolvedModules)||void 0===n||n.forEach((function(e){return s(i,e)}));null==r||r.forEach((function(e){return s(i,e)}));},hasProcessedResolutions:function(){return o}};function s(n,i){if(i&&i.originalPath&&i.resolvedFileName){var a=i.resolvedFileName,o=i.originalPath;n.setSymlinkedFile(e.toPath(o,t,r),a);var s=function(t,r,n,i){for(var a=e.getPathComponents(e.getNormalizedAbsolutePath(t,n)),o=e.getPathComponents(e.getNormalizedAbsolutePath(r,n)),s=!1;a.length>=2&&o.length>=2&&!zn(a[a.length-2],i)&&!zn(o[o.length-2],i)&&i(a[a.length-1])===i(o[o.length-1]);)a.pop(),o.pop(),s=!0;return s?[e.getPathFromPathComponents(a),e.getPathFromPathComponents(o)]:void 0}(a,o,t,r)||e.emptyArray,c=s[0],l=s[1];c&&l&&n.setSymlinkedDirectory(l,{real:c,realPath:e.toPath(c,t,r)});}}},e.tryRemoveDirectoryPrefix=function(t,r,n){var i,a=e.tryRemovePrefix(t,r,n);return void 0===a?void 0:(i=a,e.isAnyDirectorySeparator(i.charCodeAt(0))?i.slice(1):void 0)};var Kn=/[^\w\s\/]/g;function Un(e){return "\\"+e}e.regExpEscape=function(e){return e.replace(Kn,Un)};var Vn=[42,63];e.commonPackageFolders=["node_modules","bower_components","jspm_packages"];var qn="(?!(".concat(e.commonPackageFolders.join("|"),")(/|$))"),Wn={singleAsteriskRegexFragment:"([^./]|(\\.(?!min\\.js$))?)*",doubleAsteriskRegexFragment:"(/".concat(qn,"[^/.][^/]*)*?"),replaceWildcardCharacter:function(e){return ei(e,Wn.singleAsteriskRegexFragment)}},Hn={singleAsteriskRegexFragment:"[^/]*",doubleAsteriskRegexFragment:"(/".concat(qn,"[^/.][^/]*)*?"),replaceWildcardCharacter:function(e){return ei(e,Hn.singleAsteriskRegexFragment)}},Gn={singleAsteriskRegexFragment:"[^/]*",doubleAsteriskRegexFragment:"(/.+?)?",replaceWildcardCharacter:function(e){return ei(e,Gn.singleAsteriskRegexFragment)}},Qn={files:Wn,directories:Hn,exclude:Gn};function Xn(e,t,r){var n=Yn(e,t,r);if(n&&n.length){var i=n.map((function(e){return "(".concat(e,")")})).join("|"),a="exclude"===r?"($|/)":"$";return "^(".concat(i,")").concat(a)}}function Yn(t,r,n){if(void 0!==t&&0!==t.length)return e.flatMap(t,(function(e){return e&&$n(e,r,n,Qn[n])}))}function Zn(e){return !/[.*?]/.test(e)}function $n(t,r,n,i){var a=i.singleAsteriskRegexFragment,o=i.doubleAsteriskRegexFragment,s=i.replaceWildcardCharacter,c="",l=!1,u=e.getNormalizedPathComponents(t,r),_=e.last(u);if("exclude"===n||"**"!==_){u[0]=e.removeTrailingDirectorySeparator(u[0]),Zn(_)&&u.push("**","*");for(var d=0,p=0,f=u;p<f.length;p++){var g=f[p];if("**"===g)c+=o;else if("directories"===n&&(c+="(",d++),l&&(c+=e.directorySeparator),"exclude"!==n){var m="";42===g.charCodeAt(0)?(m+="([^./]"+a+")?",g=g.substr(1)):63===g.charCodeAt(0)&&(m+="[^./]",g=g.substr(1)),(m+=g.replace(Kn,s))!==g&&(c+=qn),c+=m;}else c+=g.replace(Kn,s);l=!0;}for(;d>0;)c+=")?",d--;return c}}function ei(e,t){return "*"===e?t:"?"===e?"[^/]":"\\"+e}function ti(t,r,n,i,a){t=e.normalizePath(t),a=e.normalizePath(a);var o=e.combinePaths(a,t);return {includeFilePatterns:e.map(Yn(n,o,"files"),(function(e){return "^".concat(e,"$")})),includeFilePattern:Xn(n,o,"files"),includeDirectoryPattern:Xn(n,o,"directories"),excludePattern:Xn(r,o,"exclude"),basePaths:ni(t,n,i)}}function ri(e,t){return new RegExp(e,t?"":"i")}function ni(t,r,n){var i=[t];if(r){for(var a=[],o=0,s=r;o<s.length;o++){var c=s[o],l=e.isRootedDiskPath(c)?c:e.normalizePath(e.combinePaths(t,c));a.push(ii(l));}a.sort(e.getStringComparer(!n));for(var u=function(r){e.every(i,(function(i){return !e.containsPath(i,r,t,!n)}))&&i.push(r);},_=0,d=a;_<d.length;_++)u(d[_]);}return i}function ii(t){var r=e.indexOfAnyCharCode(t,Vn);return r<0?e.hasExtension(t)?e.removeTrailingDirectorySeparator(e.getDirectoryPath(t)):t:t.substring(0,t.lastIndexOf(e.directorySeparator,r))}function ai(e){switch(e.substr(e.lastIndexOf(".")).toLowerCase()){case".js":case".cjs":case".mjs":return 1;case".jsx":return 2;case".ts":case".cts":case".mts":return 3;case".tsx":return 4;case".json":return 6;default:return 0}}e.getRegularExpressionForWildcard=Xn,e.getRegularExpressionsForWildcards=Yn,e.isImplicitGlob=Zn,e.getPatternFromSpec=function(e,t,r){var n=e&&$n(e,t,r,Qn[r]);return n&&"^(".concat(n,")").concat("exclude"===r?"($|/)":"$")},e.getFileMatcherPatterns=ti,e.getRegexFromPattern=ri,e.matchFiles=function(t,r,n,i,a,o,s,c,l){t=e.normalizePath(t),o=e.normalizePath(o);for(var u=ti(t,n,i,a,o),_=u.includeFilePatterns&&u.includeFilePatterns.map((function(e){return ri(e,a)})),d=u.includeDirectoryPattern&&ri(u.includeDirectoryPattern,a),p=u.excludePattern&&ri(u.excludePattern,a),f=_?_.map((function(){return []})):[[]],g=new e.Map,m=e.createGetCanonicalFileName(a),y=0,v=u.basePaths;y<v.length;y++){var h=v[y];b(h,e.combinePaths(o,h),s);}return e.flatten(f);function b(t,n,i){var a=m(l(n));if(!g.has(a)){g.set(a,!0);for(var o=c(t),s=o.files,u=o.directories,y=function(i){var a=e.combinePaths(t,i),o=e.combinePaths(n,i);if(r&&!e.fileExtensionIsOneOf(a,r))return "continue";if(p&&p.test(o))return "continue";if(_){var s=e.findIndex(_,(function(e){return e.test(o)}));-1!==s&&f[s].push(a);}else f[0].push(a);},v=0,h=e.sort(s,e.compareStringsCaseSensitive);v<h.length;v++)y(S=h[v]);if(void 0===i||0!=--i)for(var x=0,D=e.sort(u,e.compareStringsCaseSensitive);x<D.length;x++){var S=D[x],T=e.combinePaths(t,S),C=e.combinePaths(n,S);d&&!d.test(C)||p&&p.test(C)||b(T,C,i);}}}},e.ensureScriptKind=function(e,t){return t||ai(e)||3},e.getScriptKindFromFileName=ai,e.supportedTSExtensions=[[".ts",".tsx",".d.ts"],[".cts",".d.cts"],[".mts",".d.mts"]],e.supportedTSExtensionsFlat=e.flatten(e.supportedTSExtensions);var oi=n$4(n$4([],e.supportedTSExtensions,!0),[[".json"]],!1),si=[".d.ts",".d.cts",".d.mts",".cts",".mts",".ts",".tsx",".cts",".mts"];e.supportedJSExtensions=[[".js",".jsx"],[".mjs"],[".cjs"]],e.supportedJSExtensionsFlat=e.flatten(e.supportedJSExtensions);var ci=[[".ts",".tsx",".d.ts",".js",".jsx"],[".cts",".d.cts",".cjs"],[".mts",".d.mts",".mjs"]],li=n$4(n$4([],ci,!0),[[".json"]],!1);function ui(t,r){var i=t&&jn(t);if(!r||0===r.length)return i?ci:e.supportedTSExtensions;var a=i?ci:e.supportedTSExtensions,o=e.flatten(a);return n$4(n$4([],a,!0),e.mapDefined(r,(function(e){return 7===e.scriptKind||i&&(1===(t=e.scriptKind)||2===t)&&-1===o.indexOf(e.extension)?[e.extension]:void 0;var t;})),!0)}function _i(t,r){return t&&t.resolveJsonModule?r===ci?li:r===e.supportedTSExtensions?oi:n$4(n$4([],r,!0),[[".json"]],!1):r}function di(e){var t=e.match(/\//g);return t?t.length:0}e.supportedDeclarationExtensions=[".d.ts",".d.cts",".d.mts"],e.getSupportedExtensions=ui,e.getSupportedExtensionsWithJsonIfResolveJsonModule=_i,e.hasJSFileExtension=function(t){return e.some(e.supportedJSExtensionsFlat,(function(r){return e.fileExtensionIs(t,r)}))},e.hasTSFileExtension=function(t){return e.some(e.supportedTSExtensionsFlat,(function(r){return e.fileExtensionIs(t,r)}))},e.isSupportedSourceFileName=function(t,r,n){if(!t)return !1;for(var i=ui(r,n),a=0,o=e.flatten(_i(r,i));a<o.length;a++){var s=o[a];if(e.fileExtensionIs(t,s))return !0}return !1},e.compareNumberOfDirectorySeparators=function(t,r){return e.compareValues(di(t),di(r))};var pi=[".d.ts",".d.mts",".d.cts",".mjs",".mts",".cjs",".cts",".ts",".js",".tsx",".jsx",".json"];function fi(e){for(var t=0,r=pi;t<r.length;t++){var n=gi(e,r[t]);if(void 0!==n)return n}return e}function gi(t,r){return e.fileExtensionIs(t,r)?mi(t,r):void 0}function mi(e,t){return e.substring(0,e.length-t.length)}function yi(e){var t=e.indexOf("*");return -1===t?e:-1!==e.indexOf("*",t+1)?void 0:{prefix:e.substr(0,t),suffix:e.substr(t+1)}}function vi(e){return !(e>=0)}function hi(e){return ".ts"===e||".tsx"===e||".d.ts"===e||".cts"===e||".mts"===e||".d.mts"===e||".d.cts"===e}function bi(t){return e.find(pi,(function(r){return e.fileExtensionIs(t,r)}))}function xi(t,r){return t===r||"object"==typeof t&&null!==t&&"object"==typeof r&&null!==r&&e.equalOwnProperties(t,r,xi)}function Di(e,t){return e.pos=t,e}function Si(e,t){return e.end=t,e}function Ti(e,t,r){return Si(Di(e,t),r)}function Ci(e,t){return e&&t&&(e.parent=t),e}function ki(t){return !e.isOmittedExpression(t)}function Ei(t){return e.some(e.ignoredPaths,(function(r){return e.stringContains(t,r)}))}function Ni(e){return 254===e.kind&&292===e.parent.kind}function Fi(e){return (+e).toString()===e}e.removeFileExtension=fi,e.tryRemoveExtension=gi,e.removeExtension=mi,e.changeExtension=function(t,r){return e.changeAnyExtension(t,r,pi,!1)},e.tryParsePattern=yi,e.tryParsePatterns=function(t){return e.mapDefined(e.getOwnKeys(t),(function(e){return yi(e)}))},e.positionIsSynthesized=vi,e.extensionIsTS=hi,e.resolutionExtensionIsTSOrJson=function(e){return hi(e)||".json"===e},e.extensionFromPath=function(t){var r=bi(t);return void 0!==r?r:e.Debug.fail("File ".concat(t," has unknown extension."))},e.isAnySupportedFileExtension=function(e){return void 0!==bi(e)},e.tryGetExtensionFromPath=bi,e.isCheckJsEnabledForFile=function(e,t){return e.checkJsDirective?e.checkJsDirective.enabled:t.checkJs},e.emptyFileSystemEntries={files:e.emptyArray,directories:e.emptyArray},e.matchPatternOrExact=function(t,r){for(var n=[],i=0,a=t;i<a.length;i++){var o=a[i];if(o===r)return r;e.isString(o)||n.push(o);}return e.findBestPatternMatch(n,(function(e){return e}),r)},e.sliceAfter=function(t,r){var n=t.indexOf(r);return e.Debug.assert(-1!==n),t.slice(n)},e.addRelatedInfo=function(t){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return n.length?(t.relatedInformation||(t.relatedInformation=[]),e.Debug.assert(t.relatedInformation!==e.emptyArray,"Diagnostic had empty array singleton for related info, but is still being constructed!"),(r=t.relatedInformation).push.apply(r,n),t):t},e.minAndMax=function(t,r){e.Debug.assert(0!==t.length);for(var n=r(t[0]),i=n,a=1;a<t.length;a++){var o=r(t[a]);o<n?n=o:o>i&&(i=o);}return {min:n,max:i}},e.rangeOfNode=function(e){return {pos:h(e),end:e.end}},e.rangeOfTypeParameters=function(t,r){return {pos:r.pos-1,end:e.skipTrivia(t.text,r.end)+1}},e.skipTypeChecking=function(e,t,r){return t.skipLibCheck&&e.isDeclarationFile||t.skipDefaultLibCheck&&e.hasNoDefaultLib||r.isSourceOfProjectReferenceRedirect(e.fileName)},e.isJsonEqual=xi,e.parsePseudoBigInt=function(e){var t;switch(e.charCodeAt(1)){case 98:case 66:t=1;break;case 111:case 79:t=3;break;case 120:case 88:t=4;break;default:for(var r=e.length-1,n=0;48===e.charCodeAt(n);)n++;return e.slice(n,r)||"0"}for(var i=e.length-1,a=(i-2)*t,o=new Uint16Array((a>>>4)+(15&a?1:0)),s=i-1,c=0;s>=2;s--,c+=t){var l=c>>>4,u=e.charCodeAt(s),_=(u<=57?u-48:10+u-(u<=70?65:97))<<(15&c);o[l]|=_;var d=_>>>16;d&&(o[l+1]|=d);}for(var p="",f=o.length-1,g=!0;g;){var m=0;for(g=!1,l=f;l>=0;l--){var y=m<<16|o[l],v=y/10|0;o[l]=v,m=y-10*v,v&&!g&&(f=l,g=!0);}p=m+p;}return p},e.pseudoBigIntToString=function(e){var t=e.negative,r=e.base10Value;return (t&&"0"!==r?"-":"")+r},e.isValidTypeOnlyAliasUseSite=function(t){return !!(16777216&t.flags)||be(t)||function(t){if(79!==t.kind)return !1;var r=e.findAncestor(t.parent,(function(e){switch(e.kind){case 291:return !0;case 206:case 228:return !1;default:return "quit"}}));return 117===(null==r?void 0:r.token)||258===(null==r?void 0:r.parent.kind)}(t)||function(e){for(;79===e.kind||206===e.kind;)e=e.parent;if(162!==e.kind)return !1;if(kr(e.parent,128))return !0;var t=e.parent.parent.kind;return 258===t||182===t}(t)||!(ve(t)||function(t){return e.isIdentifier(t)&&e.isShorthandPropertyAssignment(t.parent)&&t.parent.name===t}(t))},e.isIdentifierTypeReference=function(t){return e.isTypeReferenceNode(t)&&e.isIdentifier(t.typeName)},e.arrayIsHomogeneous=function(t,r){if(void 0===r&&(r=e.equateValues),t.length<2)return !0;for(var n=t[0],i=1,a=t.length;i<a;i++)if(!r(n,t[i]))return !1;return !0},e.setTextRangePos=Di,e.setTextRangeEnd=Si,e.setTextRangePosEnd=Ti,e.setTextRangePosWidth=function(e,t,r){return Ti(e,t,t+r)},e.setNodeFlags=function(e,t){return e&&(e.flags=t),e},e.setParent=Ci,e.setEachParent=function(e,t){if(e)for(var r=0,n=e;r<n.length;r++)Ci(n[r],t);return e},e.setParentRecursive=function(t,r){return t?(e.forEachChildRecursively(t,e.isJSDocNode(t)?n:function(t,r){return n(t,r)||function(t){if(e.hasJSDocNodes(t))for(var r=0,i=t.jsDoc;r<i.length;r++){var a=i[r];n(a,t),e.forEachChildRecursively(a,n);}}(t)}),t):t;function n(e,t){if(r&&e.parent===t)return "skip";Ci(e,t);}},e.isPackedArrayLiteral=function(t){return e.isArrayLiteralExpression(t)&&e.every(t.elements,ki)},e.expressionResultIsUnused=function(t){for(e.Debug.assertIsDefined(t.parent);;){var r=t.parent;if(e.isParenthesizedExpression(r))t=r;else {if(e.isExpressionStatement(r)||e.isVoidExpression(r)||e.isForStatement(r)&&(r.initializer===t||r.incrementor===t))return !0;if(e.isCommaListExpression(r)){if(t!==e.last(r.elements))return !0;t=r;}else {if(!e.isBinaryExpression(r)||27!==r.operatorToken.kind)return !1;if(t===r.left)return !0;t=r;}}}},e.containsIgnoredPath=Ei,e.getContainingNodeArray=function(t){if(t.parent){switch(t.kind){case 163:var r=t.parent;return 190===r.kind?void 0:r.typeParameters;case 164:return t.parent.parameters;case 199:case 233:return t.parent.templateSpans;case 165:return t.parent.decorators;case 291:return t.parent.heritageClauses}var n=t.parent;if(e.isJSDocTag(t))return e.isJSDocTypeLiteral(t.parent)?void 0:t.parent.tags;switch(n.kind){case 182:case 258:return e.isTypeElement(t)?n.members:void 0;case 187:case 188:return n.types;case 184:case 204:case 351:case 269:case 273:return n.elements;case 205:case 286:return n.properties;case 208:case 209:return e.isTypeNode(t)?n.typeArguments:n.expression===t?void 0:n.arguments;case 278:case 282:return e.isJsxChild(t)?n.children:void 0;case 280:case 279:return e.isTypeNode(t)?n.typeArguments:void 0;case 235:case 289:case 290:case 262:return n.statements;case 263:return n.clauses;case 257:case 226:return e.isClassElement(t)?n.members:void 0;case 260:return e.isEnumMember(t)?n.members:void 0;case 305:return n.statements}}},e.hasContextSensitiveParameters=function(t){if(!t.typeParameters){if(e.some(t.parameters,(function(e){return !hr(e)})))return !0;if(214!==t.kind){var r=e.firstOrUndefined(t.parameters);if(!r||!mr(r))return !0}}return !1},e.isInfinityOrNaNString=function(e){return "Infinity"===e||"-Infinity"===e||"NaN"===e},e.isCatchClauseVariableDeclaration=Ni,e.isParameterOrCatchClauseVariable=function(t){var r=t.valueDeclaration&&wt(t.valueDeclaration);return !!r&&(e.isParameter(r)||Ni(r))},e.isFunctionExpressionOrArrowFunction=function(e){return 213===e.kind||214===e.kind},e.escapeSnippetText=function(e){return e.replace(/\$/gm,(function(){return "\\$"}))},e.isNumericLiteralName=Fi,e.createPropertyNameNodeForIdentifierOrLiteral=function(t,r,n,i){return e.isIdentifierText(t,r)?e.factory.createIdentifier(t):!i&&Fi(t)&&+t>=0?e.factory.createNumericLiteral(+t):e.factory.createStringLiteral(t,!!n)},e.isThisTypeParameter=function(e){return !!(262144&e.flags&&e.isThisType)},e.getNodeModulePathParts=function(t){var r,n=0,i=0,a=0;!function(e){e[e.BeforeNodeModules=0]="BeforeNodeModules",e[e.NodeModules=1]="NodeModules",e[e.Scope=2]="Scope",e[e.PackageContent=3]="PackageContent";}(r||(r={}));for(var o=0,s=0,c=0;s>=0;)switch(o=s,s=t.indexOf("/",o+1),c){case 0:t.indexOf(e.nodeModulesPathPart,o)===o&&(n=o,i=s,c=1);break;case 1:case 2:1===c&&"@"===t.charAt(o+1)?c=2:(a=s,c=3);break;case 3:c=t.indexOf(e.nodeModulesPathPart,o)===o?1:3;}return c>1?{topLevelNodeModulesIndex:n,topLevelPackageNameIndex:i,packageRootIndex:a,fileNameIndex:o}:void 0},e.getParameterTypeNode=function(e){var t;return 340===e.kind?null===(t=e.typeExpression)||void 0===t?void 0:t.type:e.type};}(t),function(e){e.createBaseNodeFactory=function(){var t,r,n,i,a;return {createBaseSourceFileNode:function(t){return new(a||(a=e.objectAllocator.getSourceFileConstructor()))(t,-1,-1)},createBaseIdentifierNode:function(t){return new(n||(n=e.objectAllocator.getIdentifierConstructor()))(t,-1,-1)},createBasePrivateIdentifierNode:function(t){return new(i||(i=e.objectAllocator.getPrivateIdentifierConstructor()))(t,-1,-1)},createBaseTokenNode:function(t){return new(r||(r=e.objectAllocator.getTokenConstructor()))(t,-1,-1)},createBaseNode:function(r){return new(t||(t=e.objectAllocator.getNodeConstructor()))(r,-1,-1)}}};}(t),function(e){e.createParenthesizerRules=function(t){var r,n;return {getParenthesizeLeftSideOfBinaryForOperator:function(t){r||(r=new e.Map);var n=r.get(t);return n||(n=function(e){return o(t,e)},r.set(t,n)),n},getParenthesizeRightSideOfBinaryForOperator:function(t){n||(n=new e.Map);var r=n.get(t);return r||(r=function(e){return s(t,void 0,e)},n.set(t,r)),r},parenthesizeLeftSideOfBinary:o,parenthesizeRightSideOfBinary:s,parenthesizeExpressionOfComputedPropertyName:function(r){return e.isCommaSequence(r)?t.createParenthesizedExpression(r):r},parenthesizeConditionOfConditionalExpression:function(r){var n=e.getOperatorPrecedence(222,57),i=e.skipPartiallyEmittedExpressions(r),a=e.getExpressionPrecedence(i);return 1!==e.compareValues(a,n)?t.createParenthesizedExpression(r):r},parenthesizeBranchOfConditionalExpression:function(r){var n=e.skipPartiallyEmittedExpressions(r);return e.isCommaSequence(n)?t.createParenthesizedExpression(r):r},parenthesizeExpressionOfExportDefault:function(r){var n=e.skipPartiallyEmittedExpressions(r),i=e.isCommaSequence(n);if(!i)switch(e.getLeftmostExpression(n,!1).kind){case 226:case 213:i=!0;}return i?t.createParenthesizedExpression(r):r},parenthesizeExpressionOfNew:function(r){var n=e.getLeftmostExpression(r,!0);switch(n.kind){case 208:return t.createParenthesizedExpression(r);case 209:return n.arguments?r:t.createParenthesizedExpression(r)}return c(r)},parenthesizeLeftSideOfAccess:c,parenthesizeOperandOfPostfixUnary:function(r){return e.isLeftHandSideExpression(r)?r:e.setTextRange(t.createParenthesizedExpression(r),r)},parenthesizeOperandOfPrefixUnary:function(r){return e.isUnaryExpression(r)?r:e.setTextRange(t.createParenthesizedExpression(r),r)},parenthesizeExpressionsOfCommaDelimitedList:function(r){var n=e.sameMap(r,l);return e.setTextRange(t.createNodeArray(n,r.hasTrailingComma),r)},parenthesizeExpressionForDisallowedComma:l,parenthesizeExpressionOfExpressionStatement:function(r){var n=e.skipPartiallyEmittedExpressions(r);if(e.isCallExpression(n)){var i=n.expression,a=e.skipPartiallyEmittedExpressions(i).kind;if(213===a||214===a){var o=t.updateCallExpression(n,e.setTextRange(t.createParenthesizedExpression(i),i),n.typeArguments,n.arguments);return t.restoreOuterExpressions(r,o,8)}}var s=e.getLeftmostExpression(n,!1).kind;return 205===s||213===s?e.setTextRange(t.createParenthesizedExpression(r),r):r},parenthesizeConciseBodyOfArrowFunction:function(r){return e.isBlock(r)||!e.isCommaSequence(r)&&205!==e.getLeftmostExpression(r,!1).kind?r:e.setTextRange(t.createParenthesizedExpression(r),r)},parenthesizeCheckTypeOfConditionalType:u,parenthesizeExtendsTypeOfConditionalType:function(e){switch(e.kind){case 189:return t.createParenthesizedType(e)}return e},parenthesizeConstituentTypesOfUnionType:function(r){return t.createNodeArray(e.sameMap(r,_))},parenthesizeConstituentTypeOfUnionType:_,parenthesizeConstituentTypesOfIntersectionType:function(r){return t.createNodeArray(e.sameMap(r,d))},parenthesizeConstituentTypeOfIntersectionType:d,parenthesizeOperandOfTypeOperator:p,parenthesizeOperandOfReadonlyTypeOperator:function(e){switch(e.kind){case 193:return t.createParenthesizedType(e)}return p(e)},parenthesizeNonArrayTypeOfPostfixType:f,parenthesizeElementTypesOfTupleType:function(r){return t.createNodeArray(e.sameMap(r,g))},parenthesizeElementTypeOfTupleType:g,parenthesizeTypeOfOptionalType:function(e){return m(e)?t.createParenthesizedType(e):f(e)},parenthesizeTypeArguments:function(r){if(e.some(r))return t.createNodeArray(e.sameMap(r,v))},parenthesizeLeadingTypeArgument:y};function i(t){if(t=e.skipPartiallyEmittedExpressions(t),e.isLiteralKind(t.kind))return t.kind;if(221===t.kind&&39===t.operatorToken.kind){if(void 0!==t.cachedLiteralKind)return t.cachedLiteralKind;var r=i(t.left),n=e.isLiteralKind(r)&&r===i(t.right)?r:0;return t.cachedLiteralKind=n,n}return 0}function a(r,n,a,o){return 212===e.skipPartiallyEmittedExpressions(n).kind?n:function(t,r,n,a){var o=e.getOperatorPrecedence(221,t),s=e.getOperatorAssociativity(221,t),c=e.skipPartiallyEmittedExpressions(r);if(!n&&214===r.kind&&o>3)return !0;var l=e.getExpressionPrecedence(c);switch(e.compareValues(l,o)){case-1:return !(!n&&1===s&&224===r.kind);case 1:return !1;case 0:if(n)return 1===s;if(e.isBinaryExpression(c)&&c.operatorToken.kind===t){if(function(e){return 41===e||51===e||50===e||52===e}(t))return !1;if(39===t){var u=a?i(a):0;if(e.isLiteralKind(u)&&u===i(c))return !1}}return 0===e.getExpressionAssociativity(c)}}(r,n,a,o)?t.createParenthesizedExpression(n):n}function o(e,t){return a(e,t,!0)}function s(e,t,r){return a(e,r,!1,t)}function c(r){var n=e.skipPartiallyEmittedExpressions(r);return e.isLeftHandSideExpression(n)&&(209!==n.kind||n.arguments)?r:e.setTextRange(t.createParenthesizedExpression(r),r)}function l(r){var n=e.skipPartiallyEmittedExpressions(r);return e.getExpressionPrecedence(n)>e.getOperatorPrecedence(221,27)?r:e.setTextRange(t.createParenthesizedExpression(r),r)}function u(e){switch(e.kind){case 179:case 180:case 189:return t.createParenthesizedType(e)}return e}function _(e){switch(e.kind){case 187:case 188:return t.createParenthesizedType(e)}return u(e)}function d(e){switch(e.kind){case 187:case 188:return t.createParenthesizedType(e)}return _(e)}function p(e){switch(e.kind){case 188:return t.createParenthesizedType(e)}return d(e)}function f(e){switch(e.kind){case 190:case 193:case 181:return t.createParenthesizedType(e)}return p(e)}function g(e){return m(e)?t.createParenthesizedType(e):e}function m(t){return e.isJSDocNullableType(t)?t.postfix:e.isNamedTupleMember(t)||e.isFunctionTypeNode(t)||e.isConstructorTypeNode(t)||e.isTypeOperatorNode(t)?m(t.type):e.isConditionalTypeNode(t)?m(t.falseType):e.isUnionTypeNode(t)||e.isIntersectionTypeNode(t)?m(e.last(t.types)):!!e.isInferTypeNode(t)&&!!t.typeParameter.constraint&&m(t.typeParameter.constraint)}function y(r){return e.isFunctionOrConstructorTypeNode(r)&&r.typeParameters?t.createParenthesizedType(r):r}function v(e,t){return 0===t?y(e):e}},e.nullParenthesizerRules={getParenthesizeLeftSideOfBinaryForOperator:function(t){return e.identity},getParenthesizeRightSideOfBinaryForOperator:function(t){return e.identity},parenthesizeLeftSideOfBinary:function(e,t){return t},parenthesizeRightSideOfBinary:function(e,t,r){return r},parenthesizeExpressionOfComputedPropertyName:e.identity,parenthesizeConditionOfConditionalExpression:e.identity,parenthesizeBranchOfConditionalExpression:e.identity,parenthesizeExpressionOfExportDefault:e.identity,parenthesizeExpressionOfNew:function(t){return e.cast(t,e.isLeftHandSideExpression)},parenthesizeLeftSideOfAccess:function(t){return e.cast(t,e.isLeftHandSideExpression)},parenthesizeOperandOfPostfixUnary:function(t){return e.cast(t,e.isLeftHandSideExpression)},parenthesizeOperandOfPrefixUnary:function(t){return e.cast(t,e.isUnaryExpression)},parenthesizeExpressionsOfCommaDelimitedList:function(t){return e.cast(t,e.isNodeArray)},parenthesizeExpressionForDisallowedComma:e.identity,parenthesizeExpressionOfExpressionStatement:e.identity,parenthesizeConciseBodyOfArrowFunction:e.identity,parenthesizeCheckTypeOfConditionalType:e.identity,parenthesizeExtendsTypeOfConditionalType:e.identity,parenthesizeConstituentTypesOfUnionType:function(t){return e.cast(t,e.isNodeArray)},parenthesizeConstituentTypeOfUnionType:e.identity,parenthesizeConstituentTypesOfIntersectionType:function(t){return e.cast(t,e.isNodeArray)},parenthesizeConstituentTypeOfIntersectionType:e.identity,parenthesizeOperandOfTypeOperator:e.identity,parenthesizeOperandOfReadonlyTypeOperator:e.identity,parenthesizeNonArrayTypeOfPostfixType:e.identity,parenthesizeElementTypesOfTupleType:function(t){return e.cast(t,e.isNodeArray)},parenthesizeElementTypeOfTupleType:e.identity,parenthesizeTypeOfOptionalType:e.identity,parenthesizeTypeArguments:function(t){return t&&e.cast(t,e.isNodeArray)},parenthesizeLeadingTypeArgument:e.identity};}(t),function(e){e.createNodeConverters=function(t){return {convertToFunctionBlock:function(r,n){if(e.isBlock(r))return r;var i=t.createReturnStatement(r);e.setTextRange(i,r);var a=t.createBlock([i],n);return e.setTextRange(a,r),a},convertToFunctionExpression:function(r){if(!r.body)return e.Debug.fail("Cannot convert a FunctionDeclaration without a body");var n=t.createFunctionExpression(r.modifiers,r.asteriskToken,r.name,r.typeParameters,r.parameters,r.type,r.body);return e.setOriginalNode(n,r),e.setTextRange(n,r),e.getStartsOnNewLine(r)&&e.setStartsOnNewLine(n,!0),n},convertToArrayAssignmentElement:r,convertToObjectAssignmentElement:n,convertToAssignmentPattern:i,convertToObjectAssignmentPattern:a,convertToArrayAssignmentPattern:o,convertToAssignmentElementTarget:s};function r(r){if(e.isBindingElement(r)){if(r.dotDotDotToken)return e.Debug.assertNode(r.name,e.isIdentifier),e.setOriginalNode(e.setTextRange(t.createSpreadElement(r.name),r),r);var n=s(r.name);return r.initializer?e.setOriginalNode(e.setTextRange(t.createAssignment(n,r.initializer),r),r):n}return e.cast(r,e.isExpression)}function n(r){if(e.isBindingElement(r)){if(r.dotDotDotToken)return e.Debug.assertNode(r.name,e.isIdentifier),e.setOriginalNode(e.setTextRange(t.createSpreadAssignment(r.name),r),r);if(r.propertyName){var n=s(r.name);return e.setOriginalNode(e.setTextRange(t.createPropertyAssignment(r.propertyName,r.initializer?t.createAssignment(n,r.initializer):n),r),r)}return e.Debug.assertNode(r.name,e.isIdentifier),e.setOriginalNode(e.setTextRange(t.createShorthandPropertyAssignment(r.name,r.initializer),r),r)}return e.cast(r,e.isObjectLiteralElementLike)}function i(e){switch(e.kind){case 202:case 204:return o(e);case 201:case 205:return a(e)}}function a(r){return e.isObjectBindingPattern(r)?e.setOriginalNode(e.setTextRange(t.createObjectLiteralExpression(e.map(r.elements,n)),r),r):e.cast(r,e.isObjectLiteralExpression)}function o(n){return e.isArrayBindingPattern(n)?e.setOriginalNode(e.setTextRange(t.createArrayLiteralExpression(e.map(n.elements,r)),n),n):e.cast(n,e.isArrayLiteralExpression)}function s(t){return e.isBindingPattern(t)?i(t):e.cast(t,e.isExpression)}},e.nullNodeConverters={convertToFunctionBlock:e.notImplemented,convertToFunctionExpression:e.notImplemented,convertToArrayAssignmentElement:e.notImplemented,convertToObjectAssignmentElement:e.notImplemented,convertToAssignmentPattern:e.notImplemented,convertToObjectAssignmentPattern:e.notImplemented,convertToArrayAssignmentPattern:e.notImplemented,convertToAssignmentElementTarget:e.notImplemented};}(t),function(e){var t,r,i=0;function a(r,a){var f=8&r?o:s,g=e.memoize((function(){return 1&r?e.nullParenthesizerRules:e.createParenthesizerRules(A)})),m=e.memoize((function(){return 2&r?e.nullNodeConverters:e.createNodeConverters(A)})),y=e.memoizeOne((function(e){return function(t,r){return Rt(t,e,r)}})),v=e.memoizeOne((function(e){return function(t){return Mt(e,t)}})),b=e.memoizeOne((function(e){return function(t){return Lt(t,e)}})),x=e.memoizeOne((function(e){return function(){return function(e){return w(e)}(e)}})),D=e.memoizeOne((function(e){return function(t){return on(e,t)}})),S=e.memoizeOne((function(e){return function(t,r){return function(e,t,r){return t.type!==r?f(on(e,r),t):t}(e,t,r)}})),T=e.memoizeOne((function(e){return function(t,r){return an(e,t,r)}})),C=e.memoizeOne((function(e){return function(t,r){return function(e,t,r){return t.type!==r?f(an(e,r,t.postfix),t):t}(e,t,r)}})),k=e.memoizeOne((function(e){return function(t,r){return kn(e,t,r)}})),E=e.memoizeOne((function(e){return function(t,r,n){return function(e,t,r,n){return void 0===r&&(r=_n(t)),t.tagName!==r||t.comment!==n?f(kn(e,r,n),t):t}(e,t,r,n)}})),N=e.memoizeOne((function(e){return function(t,r,n){return En(e,t,r,n)}})),F=e.memoizeOne((function(e){return function(t,r,n,i){return function(e,t,r,n,i){return void 0===r&&(r=_n(t)),t.tagName!==r||t.typeExpression!==n||t.comment!==i?f(En(e,r,n,i),t):t}(e,t,r,n,i)}})),A={get parenthesizer(){return g()},get converters(){return m()},baseFactory:a,flags:r,createNodeArray:P,createNumericLiteral:q,createBigIntLiteral:W,createStringLiteral:G,createStringLiteralFromNode:function(t){var r=H(e.getTextOfIdentifierOrLiteral(t),void 0);return r.textSourceNode=t,r},createRegularExpressionLiteral:Q,createLiteralLikeNode:function(e,t){switch(e){case 8:return q(t,0);case 9:return W(t);case 10:return G(t,void 0);case 11:return Ln(t,!1);case 12:return Ln(t,!0);case 13:return Q(t);case 14:return Kt(e,t,void 0,0)}},createIdentifier:Z,updateIdentifier:function(t,r){return t.typeArguments!==r?f(Z(e.idText(t),r),t):t},createTempVariable:$,createLoopVariable:function(e){var t=2;return e&&(t|=8),Y("",t)},createUniqueName:function(t,r){return void 0===r&&(r=0),e.Debug.assert(!(7&r),"Argument out of range: flags"),e.Debug.assert(32!=(48&r),"GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"),Y(t,3|r)},getGeneratedNameForNode:ee,createPrivateIdentifier:function(t){e.startsWith(t,"#")||e.Debug.fail("First character of private identifier must be #: "+t);var r=a.createBasePrivateIdentifierNode(80);return r.escapedText=e.escapeLeadingUnderscores(t),r.transformFlags|=8388608,r},createToken:re,createSuper:function(){return re(106)},createThis:ne,createNull:function(){return re(104)},createTrue:ie,createFalse:ae,createModifier:oe,createModifiersFromModifierFlags:se,createQualifiedName:ce,updateQualifiedName:function(e,t,r){return e.left!==t||e.right!==r?f(ce(t,r),e):e},createComputedPropertyName:le,updateComputedPropertyName:function(e,t){return e.expression!==t?f(le(t),e):e},createTypeParameterDeclaration:ue,updateTypeParameterDeclaration:function(t,r,n,i,a){var o,s,c;return void 0===r||e.isArray(r)?(s=r,o=n,c=i):(s=void 0,o=r,c=n),t.modifiers!==s||t.name!==o||t.constraint!==c||t.default!==a?f(ue(s,o,c,a),t):t},createParameterDeclaration:_e,updateParameterDeclaration:de,createDecorator:pe,updateDecorator:function(e,t){return e.expression!==t?f(pe(t),e):e},createPropertySignature:fe,updatePropertySignature:ge,createPropertyDeclaration:me,updatePropertyDeclaration:ye,createMethodSignature:ve,updateMethodSignature:he,createMethodDeclaration:be,updateMethodDeclaration:xe,createConstructorDeclaration:Se,updateConstructorDeclaration:Te,createGetAccessorDeclaration:Ce,updateGetAccessorDeclaration:ke,createSetAccessorDeclaration:Ee,updateSetAccessorDeclaration:Ne,createCallSignature:Fe,updateCallSignature:function(e,t,r,n){return e.typeParameters!==t||e.parameters!==r||e.type!==n?R(Fe(t,r,n),e):e},createConstructSignature:Ae,updateConstructSignature:function(e,t,r,n){return e.typeParameters!==t||e.parameters!==r||e.type!==n?R(Ae(t,r,n),e):e},createIndexSignature:Pe,updateIndexSignature:we,createClassStaticBlockDeclaration:De,updateClassStaticBlockDeclaration:function(e,t,r,n){return e.decorators!==t||e.modifier!==r||e.body!==n?f(De(t,r,n),e):e},createTemplateLiteralTypeSpan:Ie,updateTemplateLiteralTypeSpan:function(e,t,r){return e.type!==t||e.literal!==r?f(Ie(t,r),e):e},createKeywordTypeNode:function(e){return re(e)},createTypePredicateNode:Oe,updateTypePredicateNode:function(e,t,r,n){return e.assertsModifier!==t||e.parameterName!==r||e.type!==n?f(Oe(t,r,n),e):e},createTypeReferenceNode:Me,updateTypeReferenceNode:function(e,t,r){return e.typeName!==t||e.typeArguments!==r?f(Me(t,r),e):e},createFunctionTypeNode:Le,updateFunctionTypeNode:function(e,t,r,n){return e.typeParameters!==t||e.parameters!==r||e.type!==n?R(Le(t,r,n),e):e},createConstructorTypeNode:Re,updateConstructorTypeNode:function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 5===t.length?Je.apply(void 0,t):4===t.length?ze.apply(void 0,t):e.Debug.fail("Incorrect number of arguments specified.")},createTypeQueryNode:Ke,updateTypeQueryNode:function(e,t,r){return e.exprName!==t||e.typeArguments!==r?f(Ke(t,r),e):e},createTypeLiteralNode:Ue,updateTypeLiteralNode:function(e,t){return e.members!==t?f(Ue(t),e):e},createArrayTypeNode:Ve,updateArrayTypeNode:function(e,t){return e.elementType!==t?f(Ve(t),e):e},createTupleTypeNode:qe,updateTupleTypeNode:function(e,t){return e.elements!==t?f(qe(t),e):e},createNamedTupleMember:We,updateNamedTupleMember:function(e,t,r,n,i){return e.dotDotDotToken!==t||e.name!==r||e.questionToken!==n||e.type!==i?f(We(t,r,n,i),e):e},createOptionalTypeNode:He,updateOptionalTypeNode:function(e,t){return e.type!==t?f(He(t),e):e},createRestTypeNode:Ge,updateRestTypeNode:function(e,t){return e.type!==t?f(Ge(t),e):e},createUnionTypeNode:function(e){return Qe(187,e,g().parenthesizeConstituentTypesOfUnionType)},updateUnionTypeNode:function(e,t){return Xe(e,t,g().parenthesizeConstituentTypesOfUnionType)},createIntersectionTypeNode:function(e){return Qe(188,e,g().parenthesizeConstituentTypesOfIntersectionType)},updateIntersectionTypeNode:function(e,t){return Xe(e,t,g().parenthesizeConstituentTypesOfIntersectionType)},createConditionalTypeNode:Ye,updateConditionalTypeNode:function(e,t,r,n,i){return e.checkType!==t||e.extendsType!==r||e.trueType!==n||e.falseType!==i?f(Ye(t,r,n,i),e):e},createInferTypeNode:Ze,updateInferTypeNode:function(e,t){return e.typeParameter!==t?f(Ze(t),e):e},createImportTypeNode:et,updateImportTypeNode:function(t,r,n,i,a,o){var s=n&&295===n.kind?n:void 0,c=n&&e.isEntityName(n)?n:i&&!e.isArray(i)?i:void 0,l=e.isArray(i)?i:e.isArray(a)?a:void 0;return o="boolean"==typeof a?a:"boolean"==typeof o?o:t.isTypeOf,t.argument!==r||t.assertions!==s||t.qualifier!==c||t.typeArguments!==l||t.isTypeOf!==o?f(et(r,s,c,l,o),t):t},createParenthesizedType:tt,updateParenthesizedType:function(e,t){return e.type!==t?f(tt(t),e):e},createThisTypeNode:function(){var e=w(192);return e.transformFlags=1,e},createTypeOperatorNode:rt,updateTypeOperatorNode:function(e,t){return e.type!==t?f(rt(e.operator,t),e):e},createIndexedAccessTypeNode:nt,updateIndexedAccessTypeNode:function(e,t,r){return e.objectType!==t||e.indexType!==r?f(nt(t,r),e):e},createMappedTypeNode:it,updateMappedTypeNode:function(e,t,r,n,i,a,o){return e.readonlyToken!==t||e.typeParameter!==r||e.nameType!==n||e.questionToken!==i||e.type!==a||e.members!==o?f(it(t,r,n,i,a,o),e):e},createLiteralTypeNode:at,updateLiteralTypeNode:function(e,t){return e.literal!==t?f(at(t),e):e},createTemplateLiteralType:$e,updateTemplateLiteralType:function(e,t,r){return e.head!==t||e.templateSpans!==r?f($e(t,r),e):e},createObjectBindingPattern:ot,updateObjectBindingPattern:function(e,t){return e.elements!==t?f(ot(t),e):e},createArrayBindingPattern:st,updateArrayBindingPattern:function(e,t){return e.elements!==t?f(st(t),e):e},createBindingElement:ct,updateBindingElement:function(e,t,r,n,i){return e.propertyName!==r||e.dotDotDotToken!==t||e.name!==n||e.initializer!==i?f(ct(t,r,n,i),e):e},createArrayLiteralExpression:ut,updateArrayLiteralExpression:function(e,t){return e.elements!==t?f(ut(t,e.multiLine),e):e},createObjectLiteralExpression:_t,updateObjectLiteralExpression:function(e,t){return e.properties!==t?f(_t(t,e.multiLine),e):e},createPropertyAccessExpression:4&r?function(t,r){return e.setEmitFlags(dt(t,r),131072)}:dt,updatePropertyAccessExpression:function(t,r,n){return e.isPropertyAccessChain(t)?ft(t,r,t.questionDotToken,e.cast(n,e.isIdentifier)):t.expression!==r||t.name!==n?f(dt(r,n),t):t},createPropertyAccessChain:4&r?function(t,r,n){return e.setEmitFlags(pt(t,r,n),131072)}:pt,updatePropertyAccessChain:ft,createElementAccessExpression:gt,updateElementAccessExpression:function(t,r,n){return e.isElementAccessChain(t)?yt(t,r,t.questionDotToken,n):t.expression!==r||t.argumentExpression!==n?f(gt(r,n),t):t},createElementAccessChain:mt,updateElementAccessChain:yt,createCallExpression:vt,updateCallExpression:function(t,r,n,i){return e.isCallChain(t)?bt(t,r,t.questionDotToken,n,i):t.expression!==r||t.typeArguments!==n||t.arguments!==i?f(vt(r,n,i),t):t},createCallChain:ht,updateCallChain:bt,createNewExpression:xt,updateNewExpression:function(e,t,r,n){return e.expression!==t||e.typeArguments!==r||e.arguments!==n?f(xt(t,r,n),e):e},createTaggedTemplateExpression:Dt,updateTaggedTemplateExpression:function(e,t,r,n){return e.tag!==t||e.typeArguments!==r||e.template!==n?f(Dt(t,r,n),e):e},createTypeAssertion:St,updateTypeAssertion:Tt,createParenthesizedExpression:Ct,updateParenthesizedExpression:kt,createFunctionExpression:Et,updateFunctionExpression:Nt,createArrowFunction:Ft,updateArrowFunction:At,createDeleteExpression:Pt,updateDeleteExpression:function(e,t){return e.expression!==t?f(Pt(t),e):e},createTypeOfExpression:wt,updateTypeOfExpression:function(e,t){return e.expression!==t?f(wt(t),e):e},createVoidExpression:It,updateVoidExpression:function(e,t){return e.expression!==t?f(It(t),e):e},createAwaitExpression:Ot,updateAwaitExpression:function(e,t){return e.expression!==t?f(Ot(t),e):e},createPrefixUnaryExpression:Mt,updatePrefixUnaryExpression:function(e,t){return e.operand!==t?f(Mt(e.operator,t),e):e},createPostfixUnaryExpression:Lt,updatePostfixUnaryExpression:function(e,t){return e.operand!==t?f(Lt(t,e.operator),e):e},createBinaryExpression:Rt,updateBinaryExpression:function(e,t,r,n){return e.left!==t||e.operatorToken!==r||e.right!==n?f(Rt(t,r,n),e):e},createConditionalExpression:jt,updateConditionalExpression:function(e,t,r,n,i,a){return e.condition!==t||e.questionToken!==r||e.whenTrue!==n||e.colonToken!==i||e.whenFalse!==a?f(jt(t,r,n,i,a),e):e},createTemplateExpression:Jt,updateTemplateExpression:function(e,t,r){return e.head!==t||e.templateSpans!==r?f(Jt(t,r),e):e},createTemplateHead:function(e,t,r){return zt(15,e,t,r)},createTemplateMiddle:function(e,t,r){return zt(16,e,t,r)},createTemplateTail:function(e,t,r){return zt(17,e,t,r)},createNoSubstitutionTemplateLiteral:function(e,t,r){return zt(14,e,t,r)},createTemplateLiteralLikeNode:Kt,createYieldExpression:Ut,updateYieldExpression:function(e,t,r){return e.expression!==r||e.asteriskToken!==t?f(Ut(t,r),e):e},createSpreadElement:Vt,updateSpreadElement:function(e,t){return e.expression!==t?f(Vt(t),e):e},createClassExpression:qt,updateClassExpression:Wt,createOmittedExpression:function(){return lt(227)},createExpressionWithTypeArguments:Ht,updateExpressionWithTypeArguments:function(e,t,r){return e.expression!==t||e.typeArguments!==r?f(Ht(t,r),e):e},createAsExpression:Gt,updateAsExpression:Qt,createNonNullExpression:Xt,updateNonNullExpression:Yt,createNonNullChain:Zt,updateNonNullChain:$t,createMetaProperty:er,updateMetaProperty:function(e,t){return e.name!==t?f(er(e.keywordToken,t),e):e},createTemplateSpan:tr,updateTemplateSpan:function(e,t,r){return e.expression!==t||e.literal!==r?f(tr(t,r),e):e},createSemicolonClassElement:function(){var e=w(234);return e.transformFlags|=1024,e},createBlock:rr,updateBlock:function(e,t){return e.statements!==t?f(rr(t,e.multiLine),e):e},createVariableStatement:nr,updateVariableStatement:ir,createEmptyStatement:ar,createExpressionStatement:or,updateExpressionStatement:function(e,t){return e.expression!==t?f(or(t),e):e},createIfStatement:sr,updateIfStatement:function(e,t,r,n){return e.expression!==t||e.thenStatement!==r||e.elseStatement!==n?f(sr(t,r,n),e):e},createDoStatement:cr,updateDoStatement:function(e,t,r){return e.statement!==t||e.expression!==r?f(cr(t,r),e):e},createWhileStatement:lr,updateWhileStatement:function(e,t,r){return e.expression!==t||e.statement!==r?f(lr(t,r),e):e},createForStatement:ur,updateForStatement:function(e,t,r,n,i){return e.initializer!==t||e.condition!==r||e.incrementor!==n||e.statement!==i?f(ur(t,r,n,i),e):e},createForInStatement:_r,updateForInStatement:function(e,t,r,n){return e.initializer!==t||e.expression!==r||e.statement!==n?f(_r(t,r,n),e):e},createForOfStatement:dr,updateForOfStatement:function(e,t,r,n,i){return e.awaitModifier!==t||e.initializer!==r||e.expression!==n||e.statement!==i?f(dr(t,r,n,i),e):e},createContinueStatement:pr,updateContinueStatement:function(e,t){return e.label!==t?f(pr(t),e):e},createBreakStatement:fr,updateBreakStatement:function(e,t){return e.label!==t?f(fr(t),e):e},createReturnStatement:gr,updateReturnStatement:function(e,t){return e.expression!==t?f(gr(t),e):e},createWithStatement:mr,updateWithStatement:function(e,t,r){return e.expression!==t||e.statement!==r?f(mr(t,r),e):e},createSwitchStatement:yr,updateSwitchStatement:function(e,t,r){return e.expression!==t||e.caseBlock!==r?f(yr(t,r),e):e},createLabeledStatement:vr,updateLabeledStatement:hr,createThrowStatement:br,updateThrowStatement:function(e,t){return e.expression!==t?f(br(t),e):e},createTryStatement:xr,updateTryStatement:function(e,t,r,n){return e.tryBlock!==t||e.catchClause!==r||e.finallyBlock!==n?f(xr(t,r,n),e):e},createDebuggerStatement:function(){return w(253)},createVariableDeclaration:Dr,updateVariableDeclaration:function(e,t,r,n,i){return e.name!==t||e.type!==n||e.exclamationToken!==r||e.initializer!==i?f(Dr(t,r,n,i),e):e},createVariableDeclarationList:Sr,updateVariableDeclarationList:function(e,t){return e.declarations!==t?f(Sr(t,e.flags),e):e},createFunctionDeclaration:Tr,updateFunctionDeclaration:Cr,createClassDeclaration:kr,updateClassDeclaration:Er,createInterfaceDeclaration:Nr,updateInterfaceDeclaration:Fr,createTypeAliasDeclaration:Ar,updateTypeAliasDeclaration:Pr,createEnumDeclaration:wr,updateEnumDeclaration:Ir,createModuleDeclaration:Or,updateModuleDeclaration:Mr,createModuleBlock:Lr,updateModuleBlock:function(e,t){return e.statements!==t?f(Lr(t),e):e},createCaseBlock:Rr,updateCaseBlock:function(e,t){return e.clauses!==t?f(Rr(t),e):e},createNamespaceExportDeclaration:Br,updateNamespaceExportDeclaration:function(e,t){return e.name!==t?f(Br(t),e):e},createImportEqualsDeclaration:jr,updateImportEqualsDeclaration:Jr,createImportDeclaration:zr,updateImportDeclaration:Kr,createImportClause:Ur,updateImportClause:function(e,t,r,n){return e.isTypeOnly!==t||e.name!==r||e.namedBindings!==n?f(Ur(t,r,n),e):e},createAssertClause:Vr,updateAssertClause:function(e,t,r){return e.elements!==t||e.multiLine!==r?f(Vr(t,r),e):e},createAssertEntry:qr,updateAssertEntry:function(e,t,r){return e.name!==t||e.value!==r?f(qr(t,r),e):e},createImportTypeAssertionContainer:Wr,updateImportTypeAssertionContainer:function(e,t,r){return e.assertClause!==t||e.multiLine!==r?f(Wr(t,r),e):e},createNamespaceImport:Hr,updateNamespaceImport:function(e,t){return e.name!==t?f(Hr(t),e):e},createNamespaceExport:Gr,updateNamespaceExport:function(e,t){return e.name!==t?f(Gr(t),e):e},createNamedImports:Qr,updateNamedImports:function(e,t){return e.elements!==t?f(Qr(t),e):e},createImportSpecifier:Xr,updateImportSpecifier:function(e,t,r,n){return e.isTypeOnly!==t||e.propertyName!==r||e.name!==n?f(Xr(t,r,n),e):e},createExportAssignment:Yr,updateExportAssignment:Zr,createExportDeclaration:$r,updateExportDeclaration:en,createNamedExports:tn,updateNamedExports:function(e,t){return e.elements!==t?f(tn(t),e):e},createExportSpecifier:rn,updateExportSpecifier:function(e,t,r,n){return e.isTypeOnly!==t||e.propertyName!==r||e.name!==n?f(rn(t,r,n),e):e},createMissingDeclaration:function(){return I(276,void 0,void 0)},createExternalModuleReference:nn,updateExternalModuleReference:function(e,t){return e.expression!==t?f(nn(t),e):e},get createJSDocAllType(){return x(312)},get createJSDocUnknownType(){return x(313)},get createJSDocNonNullableType(){return T(315)},get updateJSDocNonNullableType(){return C(315)},get createJSDocNullableType(){return T(314)},get updateJSDocNullableType(){return C(314)},get createJSDocOptionalType(){return D(316)},get updateJSDocOptionalType(){return S(316)},get createJSDocVariadicType(){return D(318)},get updateJSDocVariadicType(){return S(318)},get createJSDocNamepathType(){return D(319)},get updateJSDocNamepathType(){return S(319)},createJSDocFunctionType:sn,updateJSDocFunctionType:function(e,t,r){return e.parameters!==t||e.type!==r?f(sn(t,r),e):e},createJSDocTypeLiteral:cn,updateJSDocTypeLiteral:function(e,t,r){return e.jsDocPropertyTags!==t||e.isArrayType!==r?f(cn(t,r),e):e},createJSDocTypeExpression:ln,updateJSDocTypeExpression:function(e,t){return e.type!==t?f(ln(t),e):e},createJSDocSignature:un,updateJSDocSignature:function(e,t,r,n){return e.typeParameters!==t||e.parameters!==r||e.type!==n?f(un(t,r,n),e):e},createJSDocTemplateTag:pn,updateJSDocTemplateTag:function(e,t,r,n,i){return void 0===t&&(t=_n(e)),e.tagName!==t||e.constraint!==r||e.typeParameters!==n||e.comment!==i?f(pn(t,r,n,i),e):e},createJSDocTypedefTag:fn,updateJSDocTypedefTag:function(e,t,r,n,i){return void 0===t&&(t=_n(e)),e.tagName!==t||e.typeExpression!==r||e.fullName!==n||e.comment!==i?f(fn(t,r,n,i),e):e},createJSDocParameterTag:gn,updateJSDocParameterTag:function(e,t,r,n,i,a,o){return void 0===t&&(t=_n(e)),e.tagName!==t||e.name!==r||e.isBracketed!==n||e.typeExpression!==i||e.isNameFirst!==a||e.comment!==o?f(gn(t,r,n,i,a,o),e):e},createJSDocPropertyTag:mn,updateJSDocPropertyTag:function(e,t,r,n,i,a,o){return void 0===t&&(t=_n(e)),e.tagName!==t||e.name!==r||e.isBracketed!==n||e.typeExpression!==i||e.isNameFirst!==a||e.comment!==o?f(mn(t,r,n,i,a,o),e):e},createJSDocCallbackTag:yn,updateJSDocCallbackTag:function(e,t,r,n,i){return void 0===t&&(t=_n(e)),e.tagName!==t||e.typeExpression!==r||e.fullName!==n||e.comment!==i?f(yn(t,r,n,i),e):e},createJSDocAugmentsTag:vn,updateJSDocAugmentsTag:function(e,t,r,n){return void 0===t&&(t=_n(e)),e.tagName!==t||e.class!==r||e.comment!==n?f(vn(t,r,n),e):e},createJSDocImplementsTag:hn,updateJSDocImplementsTag:function(e,t,r,n){return void 0===t&&(t=_n(e)),e.tagName!==t||e.class!==r||e.comment!==n?f(hn(t,r,n),e):e},createJSDocSeeTag:bn,updateJSDocSeeTag:function(e,t,r,n){return e.tagName!==t||e.name!==r||e.comment!==n?f(bn(t,r,n),e):e},createJSDocNameReference:xn,updateJSDocNameReference:function(e,t){return e.name!==t?f(xn(t),e):e},createJSDocMemberName:Dn,updateJSDocMemberName:function(e,t,r){return e.left!==t||e.right!==r?f(Dn(t,r),e):e},createJSDocLink:Sn,updateJSDocLink:function(e,t,r){return e.name!==t?f(Sn(t,r),e):e},createJSDocLinkCode:Tn,updateJSDocLinkCode:function(e,t,r){return e.name!==t?f(Tn(t,r),e):e},createJSDocLinkPlain:Cn,updateJSDocLinkPlain:function(e,t,r){return e.name!==t?f(Cn(t,r),e):e},get createJSDocTypeTag(){return N(343)},get updateJSDocTypeTag(){return F(343)},get createJSDocReturnTag(){return N(341)},get updateJSDocReturnTag(){return F(341)},get createJSDocThisTag(){return N(342)},get updateJSDocThisTag(){return F(342)},get createJSDocEnumTag(){return N(339)},get updateJSDocEnumTag(){return F(339)},get createJSDocAuthorTag(){return k(330)},get updateJSDocAuthorTag(){return E(330)},get createJSDocClassTag(){return k(332)},get updateJSDocClassTag(){return E(332)},get createJSDocPublicTag(){return k(333)},get updateJSDocPublicTag(){return E(333)},get createJSDocPrivateTag(){return k(334)},get updateJSDocPrivateTag(){return E(334)},get createJSDocProtectedTag(){return k(335)},get updateJSDocProtectedTag(){return E(335)},get createJSDocReadonlyTag(){return k(336)},get updateJSDocReadonlyTag(){return E(336)},get createJSDocOverrideTag(){return k(337)},get updateJSDocOverrideTag(){return E(337)},get createJSDocDeprecatedTag(){return k(331)},get updateJSDocDeprecatedTag(){return E(331)},createJSDocUnknownTag:Nn,updateJSDocUnknownTag:function(e,t,r){return e.tagName!==t||e.comment!==r?f(Nn(t,r),e):e},createJSDocText:Fn,updateJSDocText:function(e,t){return e.text!==t?f(Fn(t),e):e},createJSDocComment:An,updateJSDocComment:function(e,t,r){return e.comment!==t||e.tags!==r?f(An(t,r),e):e},createJsxElement:Pn,updateJsxElement:function(e,t,r,n){return e.openingElement!==t||e.children!==r||e.closingElement!==n?f(Pn(t,r,n),e):e},createJsxSelfClosingElement:wn,updateJsxSelfClosingElement:function(e,t,r,n){return e.tagName!==t||e.typeArguments!==r||e.attributes!==n?f(wn(t,r,n),e):e},createJsxOpeningElement:In,updateJsxOpeningElement:function(e,t,r,n){return e.tagName!==t||e.typeArguments!==r||e.attributes!==n?f(In(t,r,n),e):e},createJsxClosingElement:On,updateJsxClosingElement:function(e,t){return e.tagName!==t?f(On(t),e):e},createJsxFragment:Mn,createJsxText:Ln,updateJsxText:function(e,t,r){return e.text!==t||e.containsOnlyTriviaWhiteSpaces!==r?f(Ln(t,r),e):e},createJsxOpeningFragment:function(){var e=w(283);return e.transformFlags|=2,e},createJsxJsxClosingFragment:function(){var e=w(284);return e.transformFlags|=2,e},updateJsxFragment:function(e,t,r,n){return e.openingFragment!==t||e.children!==r||e.closingFragment!==n?f(Mn(t,r,n),e):e},createJsxAttribute:Rn,updateJsxAttribute:function(e,t,r){return e.name!==t||e.initializer!==r?f(Rn(t,r),e):e},createJsxAttributes:Bn,updateJsxAttributes:function(e,t){return e.properties!==t?f(Bn(t),e):e},createJsxSpreadAttribute:jn,updateJsxSpreadAttribute:function(e,t){return e.expression!==t?f(jn(t),e):e},createJsxExpression:Jn,updateJsxExpression:function(e,t){return e.expression!==t?f(Jn(e.dotDotDotToken,t),e):e},createCaseClause:zn,updateCaseClause:function(e,t,r){return e.expression!==t||e.statements!==r?f(zn(t,r),e):e},createDefaultClause:Kn,updateDefaultClause:function(e,t){return e.statements!==t?f(Kn(t),e):e},createHeritageClause:Un,updateHeritageClause:function(e,t){return e.types!==t?f(Un(e.token,t),e):e},createCatchClause:Vn,updateCatchClause:function(e,t,r){return e.variableDeclaration!==t||e.block!==r?f(Vn(t,r),e):e},createPropertyAssignment:qn,updatePropertyAssignment:function(e,t,r){return e.name!==t||e.initializer!==r?(n=qn(t,r),(i=e).decorators&&(n.decorators=i.decorators),i.modifiers&&(n.modifiers=i.modifiers),i.questionToken&&(n.questionToken=i.questionToken),i.exclamationToken&&(n.exclamationToken=i.exclamationToken),f(n,i)):e;var n,i;},createShorthandPropertyAssignment:Wn,updateShorthandPropertyAssignment:function(e,t,r){return e.name!==t||e.objectAssignmentInitializer!==r?(n=Wn(t,r),(i=e).decorators&&(n.decorators=i.decorators),i.modifiers&&(n.modifiers=i.modifiers),i.equalsToken&&(n.equalsToken=i.equalsToken),i.questionToken&&(n.questionToken=i.questionToken),i.exclamationToken&&(n.exclamationToken=i.exclamationToken),f(n,i)):e;var n,i;},createSpreadAssignment:Hn,updateSpreadAssignment:function(e,t){return e.expression!==t?f(Hn(t),e):e},createEnumMember:Gn,updateEnumMember:function(e,t,r){return e.name!==t||e.initializer!==r?f(Gn(t,r),e):e},createSourceFile:function(e,t,r){var n=a.createBaseSourceFileNode(305);return n.statements=P(e),n.endOfFileToken=t,n.flags|=r,n.fileName="",n.text="",n.languageVersion=0,n.languageVariant=0,n.scriptKind=0,n.isDeclarationFile=!1,n.hasNoDefaultLib=!1,n.transformFlags|=d(n.statements)|_(n.endOfFileToken),n},updateSourceFile:function(t,r,n,i,o,s,c){return void 0===n&&(n=t.isDeclarationFile),void 0===i&&(i=t.referencedFiles),void 0===o&&(o=t.typeReferenceDirectives),void 0===s&&(s=t.hasNoDefaultLib),void 0===c&&(c=t.libReferenceDirectives),t.statements!==r||t.isDeclarationFile!==n||t.referencedFiles!==i||t.typeReferenceDirectives!==o||t.hasNoDefaultLib!==s||t.libReferenceDirectives!==c?f(function(t,r,n,i,o,s,c){var l=t.redirectInfo?Object.create(t.redirectInfo.redirectTarget):a.createBaseSourceFileNode(305);for(var u in t)"emitNode"!==u&&!e.hasProperty(l,u)&&e.hasProperty(t,u)&&(l[u]=t[u]);return l.flags|=t.flags,l.statements=P(r),l.endOfFileToken=t.endOfFileToken,l.isDeclarationFile=n,l.referencedFiles=i,l.typeReferenceDirectives=o,l.hasNoDefaultLib=s,l.libReferenceDirectives=c,l.transformFlags=d(l.statements)|_(l.endOfFileToken),l.impliedNodeFormat=t.impliedNodeFormat,l}(t,r,n,i,o,s,c),t):t},createBundle:Qn,updateBundle:function(t,r,n){return void 0===n&&(n=e.emptyArray),t.sourceFiles!==r||t.prepends!==n?f(Qn(r,n),t):t},createUnparsedSource:function(t,r,n){var i=w(307);return i.prologues=t,i.syntheticReferences=r,i.texts=n,i.fileName="",i.text="",i.referencedFiles=e.emptyArray,i.libReferenceDirectives=e.emptyArray,i.getLineAndCharacterOfPosition=function(t){return e.getLineAndCharacterOfPosition(i,t)},i},createUnparsedPrologue:function(e){return Xn(300,e)},createUnparsedPrepend:function(e,t){var r=Xn(301,e);return r.texts=t,r},createUnparsedTextLike:function(e,t){return Xn(t?303:302,e)},createUnparsedSyntheticReference:function(e){var t=w(304);return t.data=e.data,t.section=e,t},createInputFiles:function(){var e=w(308);return e.javascriptText="",e.declarationText="",e},createSyntheticExpression:function(e,t,r){void 0===t&&(t=!1);var n=w(232);return n.type=e,n.isSpread=t,n.tupleNameSource=r,n},createSyntaxList:function(e){var t=w(348);return t._children=e,t},createNotEmittedStatement:function(t){var r=w(349);return r.original=t,e.setTextRange(r,t),r},createPartiallyEmittedExpression:Yn,updatePartiallyEmittedExpression:Zn,createCommaListExpression:ei,updateCommaListExpression:function(e,t){return e.elements!==t?f(ei(t),e):e},createEndOfDeclarationMarker:function(e){var t=w(353);return t.emitNode={},t.original=e,t},createMergeDeclarationMarker:function(e){var t=w(352);return t.emitNode={},t.original=e,t},createSyntheticReferenceExpression:ti,updateSyntheticReferenceExpression:function(e,t,r){return e.expression!==t||e.thisArg!==r?f(ti(t,r),e):e},cloneNode:ri,get createComma(){return y(27)},get createAssignment(){return y(63)},get createLogicalOr(){return y(56)},get createLogicalAnd(){return y(55)},get createBitwiseOr(){return y(51)},get createBitwiseXor(){return y(52)},get createBitwiseAnd(){return y(50)},get createStrictEquality(){return y(36)},get createStrictInequality(){return y(37)},get createEquality(){return y(34)},get createInequality(){return y(35)},get createLessThan(){return y(29)},get createLessThanEquals(){return y(32)},get createGreaterThan(){return y(31)},get createGreaterThanEquals(){return y(33)},get createLeftShift(){return y(47)},get createRightShift(){return y(48)},get createUnsignedRightShift(){return y(49)},get createAdd(){return y(39)},get createSubtract(){return y(40)},get createMultiply(){return y(41)},get createDivide(){return y(43)},get createModulo(){return y(44)},get createExponent(){return y(42)},get createPrefixPlus(){return v(39)},get createPrefixMinus(){return v(40)},get createPrefixIncrement(){return v(45)},get createPrefixDecrement(){return v(46)},get createBitwiseNot(){return v(54)},get createLogicalNot(){return v(53)},get createPostfixIncrement(){return b(45)},get createPostfixDecrement(){return b(46)},createImmediatelyInvokedFunctionExpression:function(e,t,r){return vt(Et(void 0,void 0,void 0,void 0,t?[t]:[],void 0,rr(e,!0)),void 0,r?[r]:[])},createImmediatelyInvokedArrowFunction:function(e,t,r){return vt(Ft(void 0,void 0,t?[t]:[],void 0,void 0,rr(e,!0)),void 0,r?[r]:[])},createVoidZero:ni,createExportDefault:function(e){return Yr(void 0,void 0,!1,e)},createExternalModuleExport:function(e){return $r(void 0,void 0,!1,tn([rn(!1,void 0,e)]))},createTypeCheck:function(e,t){return "undefined"===t?A.createStrictEquality(e,ni()):A.createStrictEquality(wt(e),G(t))},createMethodCall:ii,createGlobalMethodCall:ai,createFunctionBindCall:function(e,t,r){return ii(e,"bind",n$4([t],r,!0))},createFunctionCallCall:function(e,t,r){return ii(e,"call",n$4([t],r,!0))},createFunctionApplyCall:function(e,t,r){return ii(e,"apply",[t,r])},createArraySliceCall:function(e,t){return ii(e,"slice",void 0===t?[]:[yi(t)])},createArrayConcatCall:function(e,t){return ii(e,"concat",t)},createObjectDefinePropertyCall:function(e,t,r){return ai("Object","defineProperty",[e,yi(t),r])},createReflectGetCall:function(e,t,r){return ai("Reflect","get",r?[e,t,r]:[e,t])},createReflectSetCall:function(e,t,r,n){return ai("Reflect","set",n?[e,t,r,n]:[e,t,r])},createPropertyDescriptor:function(t,r){var n=[];oi(n,"enumerable",yi(t.enumerable)),oi(n,"configurable",yi(t.configurable));var i=oi(n,"writable",yi(t.writable));i=oi(n,"value",t.value)||i;var a=oi(n,"get",t.get);return a=oi(n,"set",t.set)||a,e.Debug.assert(!(i&&a),"A PropertyDescriptor may not be both an accessor descriptor and a data descriptor."),_t(n,!r)},createCallBinding:function(t,r,n,i){void 0===i&&(i=!1);var a,o,s=e.skipOuterExpressions(t,15);return e.isSuperProperty(s)?(a=ne(),o=s):e.isSuperKeyword(s)?(a=ne(),o=void 0!==n&&n<2?e.setTextRange(Z("_super"),s):s):4096&e.getEmitFlags(s)?(a=ni(),o=g().parenthesizeLeftSideOfAccess(s)):e.isPropertyAccessExpression(s)?si(s.expression,i)?(a=$(r),o=dt(e.setTextRange(A.createAssignment(a,s.expression),s.expression),s.name),e.setTextRange(o,s)):(a=s.expression,o=s):e.isElementAccessExpression(s)?si(s.expression,i)?(a=$(r),o=gt(e.setTextRange(A.createAssignment(a,s.expression),s.expression),s.argumentExpression),e.setTextRange(o,s)):(a=s.expression,o=s):(a=ni(),o=g().parenthesizeLeftSideOfAccess(t)),{target:o,thisArg:a}},createAssignmentTargetWrapper:function(e,t){return dt(Ct(_t([Ee(void 0,void 0,"value",[_e(void 0,void 0,void 0,e,void 0,void 0,void 0)],rr([or(t)]))])),"value")},inlineExpressions:function(t){return t.length>10?ei(t):e.reduceLeft(t,A.createComma)},getInternalName:function(e,t,r){return ci(e,t,r,49152)},getLocalName:function(e,t,r){return ci(e,t,r,16384)},getExportName:li,getDeclarationName:function(e,t,r){return ci(e,t,r)},getNamespaceMemberName:ui,getExternalModuleOrNamespaceExportName:function(t,r,n,i){return t&&e.hasSyntacticModifier(r,1)?ui(t,ci(r),n,i):li(r,n,i)},restoreOuterExpressions:function t(r,n,i){return void 0===i&&(i=15),r&&e.isOuterExpression(r,i)&&(a=r,!(e.isParenthesizedExpression(a)&&e.nodeIsSynthesized(a)&&e.nodeIsSynthesized(e.getSourceMapRange(a))&&e.nodeIsSynthesized(e.getCommentRange(a)))||e.some(e.getSyntheticLeadingComments(a))||e.some(e.getSyntheticTrailingComments(a)))?function(e,t){switch(e.kind){case 212:return kt(e,t);case 211:return Tt(e,e.type,t);case 229:return Qt(e,t,e.type);case 230:return Yt(e,t);case 350:return Zn(e,t)}}(r,t(r.expression,n)):n;var a;},restoreEnclosingLabel:function t(r,n,i){if(!n)return r;var a=hr(n,n.label,e.isLabeledStatement(n.statement)?t(r,n.statement):r);return i&&i(n),a},createUseStrictPrologue:_i,copyPrologue:function(e,t,r,n){return pi(e,t,di(e,t,0,r),n)},copyStandardPrologue:di,copyCustomPrologue:pi,ensureUseStrict:function(t){return e.findUseStrictPrologue(t)?t:e.setTextRange(P(n$4([_i()],t,!0)),t)},liftToBlock:function(t){return e.Debug.assert(e.every(t,e.isStatementOrBlock),"Cannot lift nodes to a Block."),e.singleOrUndefined(t)||rr(t)},mergeLexicalEnvironment:function(t,r){if(!e.some(r))return t;var i=fi(t,e.isPrologueDirective,0),a=fi(t,e.isHoistedFunction,i),o=fi(t,e.isHoistedVariableStatement,a),s=fi(r,e.isPrologueDirective,0),c=fi(r,e.isHoistedFunction,s),l=fi(r,e.isHoistedVariableStatement,c),u=fi(r,e.isCustomPrologue,l);e.Debug.assert(u===r.length,"Expected declarations to be valid standard or custom prologues");var _=e.isNodeArray(t)?t.slice():t;if(u>l&&_.splice.apply(_,n$4([o,0],r.slice(l,u),!1)),l>c&&_.splice.apply(_,n$4([a,0],r.slice(c,l),!1)),c>s&&_.splice.apply(_,n$4([i,0],r.slice(s,c),!1)),s>0)if(0===i)_.splice.apply(_,n$4([0,0],r.slice(0,s),!1));else {for(var d=new e.Map,p=0;p<i;p++){var f=t[p];d.set(f.expression.text,!0);}for(p=s-1;p>=0;p--){var g=r[p];d.has(g.expression.text)||_.unshift(g);}}return e.isNodeArray(t)?e.setTextRange(P(_,t.hasTrailingComma),t):t},updateModifiers:function(t,r){var n,i;return i="number"==typeof r?se(r):r,e.isParameter(t)?de(t,t.decorators,i,t.dotDotDotToken,t.name,t.questionToken,t.type,t.initializer):e.isPropertySignature(t)?ge(t,i,t.name,t.questionToken,t.type):e.isPropertyDeclaration(t)?ye(t,t.decorators,i,t.name,null!==(n=t.questionToken)&&void 0!==n?n:t.exclamationToken,t.type,t.initializer):e.isMethodSignature(t)?he(t,i,t.name,t.questionToken,t.typeParameters,t.parameters,t.type):e.isMethodDeclaration(t)?xe(t,t.decorators,i,t.asteriskToken,t.name,t.questionToken,t.typeParameters,t.parameters,t.type,t.body):e.isConstructorDeclaration(t)?Te(t,t.decorators,i,t.parameters,t.body):e.isGetAccessorDeclaration(t)?ke(t,t.decorators,i,t.name,t.parameters,t.type,t.body):e.isSetAccessorDeclaration(t)?Ne(t,t.decorators,i,t.name,t.parameters,t.body):e.isIndexSignatureDeclaration(t)?we(t,t.decorators,i,t.parameters,t.type):e.isFunctionExpression(t)?Nt(t,i,t.asteriskToken,t.name,t.typeParameters,t.parameters,t.type,t.body):e.isArrowFunction(t)?At(t,i,t.typeParameters,t.parameters,t.type,t.equalsGreaterThanToken,t.body):e.isClassExpression(t)?Wt(t,t.decorators,i,t.name,t.typeParameters,t.heritageClauses,t.members):e.isVariableStatement(t)?ir(t,i,t.declarationList):e.isFunctionDeclaration(t)?Cr(t,t.decorators,i,t.asteriskToken,t.name,t.typeParameters,t.parameters,t.type,t.body):e.isClassDeclaration(t)?Er(t,t.decorators,i,t.name,t.typeParameters,t.heritageClauses,t.members):e.isInterfaceDeclaration(t)?Fr(t,t.decorators,i,t.name,t.typeParameters,t.heritageClauses,t.members):e.isTypeAliasDeclaration(t)?Pr(t,t.decorators,i,t.name,t.typeParameters,t.type):e.isEnumDeclaration(t)?Ir(t,t.decorators,i,t.name,t.members):e.isModuleDeclaration(t)?Mr(t,t.decorators,i,t.name,t.body):e.isImportEqualsDeclaration(t)?Jr(t,t.decorators,i,t.isTypeOnly,t.name,t.moduleReference):e.isImportDeclaration(t)?Kr(t,t.decorators,i,t.importClause,t.moduleSpecifier,t.assertClause):e.isExportAssignment(t)?Zr(t,t.decorators,i,t.expression):e.isExportDeclaration(t)?en(t,t.decorators,i,t.isTypeOnly,t.exportClause,t.moduleSpecifier,t.assertClause):e.Debug.assertNever(t)}};return A;function P(t,r){if(void 0===t||t===e.emptyArray)t=[];else if(e.isNodeArray(t)){if(void 0===r||t.hasTrailingComma===r)return void 0===t.transformFlags&&p(t),e.Debug.attachNodeArrayDebugInfo(t),t;var n=t.slice();return n.pos=t.pos,n.end=t.end,n.hasTrailingComma=r,n.transformFlags=t.transformFlags,e.Debug.attachNodeArrayDebugInfo(n),n}var i=t.length,a=i>=1&&i<=4?t.slice():t;return e.setTextRangePosEnd(a,-1,-1),a.hasTrailingComma=!!r,p(a),e.Debug.attachNodeArrayDebugInfo(a),a}function w(e){return a.createBaseNode(e)}function I(e,t,r){var n=w(e);return n.decorators=gi(t),n.modifiers=gi(r),n.transformFlags|=d(n.decorators)|d(n.modifiers),n.symbol=void 0,n.localSymbol=void 0,n.locals=void 0,n.nextContainer=void 0,n}function O(t,r,n,i){var a=I(t,r,n);if(i=mi(i),a.name=i,i)switch(a.kind){case 169:case 172:case 173:case 167:case 296:if(e.isIdentifier(i)){a.transformFlags|=u(i);break}default:a.transformFlags|=_(i);}return a}function M(e,t,r,n,i){var a=O(e,t,r,n);return a.typeParameters=gi(i),a.transformFlags|=d(a.typeParameters),i&&(a.transformFlags|=1),a}function L(e,t,r,n,i,a,o){var s=M(e,t,r,n,i);return s.parameters=P(a),s.type=o,s.transformFlags|=d(s.parameters)|_(s.type),o&&(s.transformFlags|=1),s}function R(e,t){return t.typeArguments&&(e.typeArguments=t.typeArguments),f(e,t)}function B(e,t,r,n,i,a,o,s){var c=L(e,t,r,n,i,a,o);return c.body=s,c.transformFlags|=-16777217&_(c.body),s||(c.transformFlags|=1),c}function j(e,t){return t.exclamationToken&&(e.exclamationToken=t.exclamationToken),t.typeArguments&&(e.typeArguments=t.typeArguments),R(e,t)}function J(e,t,r,n,i,a){var o=M(e,t,r,n,i);return o.heritageClauses=gi(a),o.transformFlags|=d(o.heritageClauses),o}function z(e,t,r,n,i,a,o){var s=J(e,t,r,n,i,a);return s.members=P(o),s.transformFlags|=d(s.members),s}function K(e,t,r,n,i){var a=O(e,t,r,n);return a.initializer=i,a.transformFlags|=_(a.initializer),a}function U(e,t,r,n,i,a){var o=K(e,t,r,n,a);return o.type=i,o.transformFlags|=_(i),i&&(o.transformFlags|=1),o}function V(e,t){var r=te(e);return r.text=t,r}function q(e,t){void 0===t&&(t=0);var r=V(8,"number"==typeof e?e+"":e);return r.numericLiteralFlags=t,384&t&&(r.transformFlags|=1024),r}function W(t){var r=V(9,"string"==typeof t?t:e.pseudoBigIntToString(t)+"n");return r.transformFlags|=4,r}function H(e,t){var r=V(10,e);return r.singleQuote=t,r}function G(e,t,r){var n=H(e,t);return n.hasExtendedUnicodeEscape=r,r&&(n.transformFlags|=1024),n}function Q(e){return V(13,e)}function X(t,r){void 0===r&&t&&(r=e.stringToToken(t)),79===r&&(r=void 0);var n=a.createBaseIdentifierNode(79);return n.originalKeywordKind=r,n.escapedText=e.escapeLeadingUnderscores(t),n}function Y(e,t){var r=X(e,void 0);return r.autoGenerateFlags=t,r.autoGenerateId=i,i++,r}function Z(e,t,r){var n=X(e,r);return t&&(n.typeArguments=P(t)),132===n.originalKeywordKind&&(n.transformFlags|=16777216),n}function $(e,t){var r=1;t&&(r|=8);var n=Y("",r);return e&&e(n),n}function ee(t,r){void 0===r&&(r=0),e.Debug.assert(!(7&r),"Argument out of range: flags");var n=Y(t&&e.isIdentifier(t)?e.idText(t):"",4|r);return n.original=t,n}function te(e){return a.createBaseTokenNode(e)}function re(t){e.Debug.assert(t>=0&&t<=160,"Invalid token"),e.Debug.assert(t<=14||t>=17,"Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."),e.Debug.assert(t<=8||t>=14,"Invalid token. Use 'createLiteralLikeNode' to create literals."),e.Debug.assert(79!==t,"Invalid token. Use 'createIdentifier' to create identifiers");var r=te(t),n=0;switch(t){case 131:n=384;break;case 123:case 121:case 122:case 145:case 126:case 135:case 85:case 130:case 147:case 158:case 143:case 148:case 101:case 144:case 159:case 150:case 133:case 151:case 114:case 155:case 153:n=1;break;case 106:n=33555456;break;case 124:n=1024;break;case 108:n=8192;}return n&&(r.transformFlags|=n),r}function ne(){return re(108)}function ie(){return re(110)}function ae(){return re(95)}function oe(e){return re(e)}function se(e){var t=[];return 1&e&&t.push(oe(93)),2&e&&t.push(oe(135)),512&e&&t.push(oe(88)),2048&e&&t.push(oe(85)),4&e&&t.push(oe(123)),8&e&&t.push(oe(121)),16&e&&t.push(oe(122)),128&e&&t.push(oe(126)),32&e&&t.push(oe(124)),16384&e&&t.push(oe(159)),64&e&&t.push(oe(145)),256&e&&t.push(oe(131)),32768&e&&t.push(oe(101)),65536&e&&t.push(oe(144)),t.length?t:void 0}function ce(e,t){var r=w(161);return r.left=e,r.right=mi(t),r.transformFlags|=_(r.left)|u(r.right),r}function le(e){var t=w(162);return t.expression=g().parenthesizeExpressionOfComputedPropertyName(e),t.transformFlags|=66560|_(t.expression),t}function ue(t,r,n,i){var a,o,s;void 0===t||e.isArray(t)?(o=t,a=r,s=n):(o=void 0,a=t,s=r);var c=O(163,void 0,o,a);return c.constraint=s,c.default=i,c.transformFlags=1,c}function _e(t,r,n,i,a,o,s){var c=U(164,t,r,i,o,s&&g().parenthesizeExpressionForDisallowedComma(s));return c.dotDotDotToken=n,c.questionToken=a,e.isThisIdentifier(c.name)?c.transformFlags=1:(c.transformFlags|=_(c.dotDotDotToken)|_(c.questionToken),a&&(c.transformFlags|=1),16476&e.modifiersToFlags(c.modifiers)&&(c.transformFlags|=4096),(s||n)&&(c.transformFlags|=1024)),c}function de(e,t,r,n,i,a,o,s){return e.decorators!==t||e.modifiers!==r||e.dotDotDotToken!==n||e.name!==i||e.questionToken!==a||e.type!==o||e.initializer!==s?f(_e(t,r,n,i,a,o,s),e):e}function pe(e){var t=w(165);return t.expression=g().parenthesizeLeftSideOfAccess(e),t.transformFlags|=4097|_(t.expression),t}function fe(e,t,r,n){var i=O(166,void 0,e,t);return i.type=n,i.questionToken=r,i.transformFlags=1,i}function ge(e,t,r,n,i){return e.modifiers!==t||e.name!==r||e.questionToken!==n||e.type!==i?f(fe(t,r,n,i),e):e}function me(t,r,n,i,a,o){var s=U(167,t,r,n,a,o);return s.questionToken=i&&e.isQuestionToken(i)?i:void 0,s.exclamationToken=i&&e.isExclamationToken(i)?i:void 0,s.transformFlags|=_(s.questionToken)|_(s.exclamationToken)|8388608,(e.isComputedPropertyName(s.name)||e.hasStaticModifier(s)&&s.initializer)&&(s.transformFlags|=4096),(i||2&e.modifiersToFlags(s.modifiers))&&(s.transformFlags|=1),s}function ye(t,r,n,i,a,o,s){return t.decorators!==r||t.modifiers!==n||t.name!==i||t.questionToken!==(void 0!==a&&e.isQuestionToken(a)?a:void 0)||t.exclamationToken!==(void 0!==a&&e.isExclamationToken(a)?a:void 0)||t.type!==o||t.initializer!==s?f(me(r,n,i,a,o,s),t):t}function ve(e,t,r,n,i,a){var o=L(168,void 0,e,t,n,i,a);return o.questionToken=r,o.transformFlags=1,o}function he(e,t,r,n,i,a,o){return e.modifiers!==t||e.name!==r||e.questionToken!==n||e.typeParameters!==i||e.parameters!==a||e.type!==o?R(ve(t,r,n,i,a,o),e):e}function be(t,r,n,i,a,o,s,c,l){var u=B(169,t,r,i,o,s,c,l);return u.asteriskToken=n,u.questionToken=a,u.transformFlags|=_(u.asteriskToken)|_(u.questionToken)|1024,a&&(u.transformFlags|=1),256&e.modifiersToFlags(u.modifiers)?u.transformFlags|=n?128:256:n&&(u.transformFlags|=2048),u}function xe(e,t,r,n,i,a,o,s,c,l){return e.decorators!==t||e.modifiers!==r||e.asteriskToken!==n||e.name!==i||e.questionToken!==a||e.typeParameters!==o||e.parameters!==s||e.type!==c||e.body!==l?j(be(t,r,n,i,a,o,s,c,l),e):e}function De(e,t,r){var n=M(170,e,t,void 0,void 0);return n.body=r,n.transformFlags=8388608|_(r),n}function Se(e,t,r,n){var i=B(171,e,t,void 0,void 0,r,void 0,n);return i.transformFlags|=1024,i}function Te(e,t,r,n,i){return e.decorators!==t||e.modifiers!==r||e.parameters!==n||e.body!==i?j(Se(t,r,n,i),e):e}function Ce(e,t,r,n,i,a){return B(172,e,t,r,void 0,n,i,a)}function ke(e,t,r,n,i,a,o){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.parameters!==i||e.type!==a||e.body!==o?j(Ce(t,r,n,i,a,o),e):e}function Ee(e,t,r,n,i){return B(173,e,t,r,void 0,n,void 0,i)}function Ne(e,t,r,n,i,a){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.parameters!==i||e.body!==a?j(Ee(t,r,n,i,a),e):e}function Fe(e,t,r){var n=L(174,void 0,void 0,void 0,e,t,r);return n.transformFlags=1,n}function Ae(e,t,r){var n=L(175,void 0,void 0,void 0,e,t,r);return n.transformFlags=1,n}function Pe(e,t,r,n){var i=L(176,e,t,void 0,void 0,r,n);return i.transformFlags=1,i}function we(e,t,r,n,i){return e.parameters!==n||e.type!==i||e.decorators!==t||e.modifiers!==r?R(Pe(t,r,n,i),e):e}function Ie(e,t){var r=w(199);return r.type=e,r.literal=t,r.transformFlags=1,r}function Oe(e,t,r){var n=w(177);return n.assertsModifier=e,n.parameterName=mi(t),n.type=r,n.transformFlags=1,n}function Me(e,t){var r=w(178);return r.typeName=mi(e),r.typeArguments=t&&g().parenthesizeTypeArguments(P(t)),r.transformFlags=1,r}function Le(e,t,r){var n=L(179,void 0,void 0,void 0,e,t,r);return n.transformFlags=1,n}function Re(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 4===t.length?Be.apply(void 0,t):3===t.length?je.apply(void 0,t):e.Debug.fail("Incorrect number of arguments specified.")}function Be(e,t,r,n){var i=L(180,void 0,e,void 0,t,r,n);return i.transformFlags=1,i}function je(e,t,r){return Be(void 0,e,t,r)}function Je(e,t,r,n,i){return e.modifiers!==t||e.typeParameters!==r||e.parameters!==n||e.type!==i?R(Re(t,r,n,i),e):e}function ze(e,t,r,n){return Je(e,e.modifiers,t,r,n)}function Ke(e,t){var r=w(181);return r.exprName=e,r.typeArguments=t&&g().parenthesizeTypeArguments(t),r.transformFlags=1,r}function Ue(e){var t=w(182);return t.members=P(e),t.transformFlags=1,t}function Ve(e){var t=w(183);return t.elementType=g().parenthesizeNonArrayTypeOfPostfixType(e),t.transformFlags=1,t}function qe(e){var t=w(184);return t.elements=P(g().parenthesizeElementTypesOfTupleType(e)),t.transformFlags=1,t}function We(e,t,r,n){var i=w(197);return i.dotDotDotToken=e,i.name=t,i.questionToken=r,i.type=n,i.transformFlags=1,i}function He(e){var t=w(185);return t.type=g().parenthesizeTypeOfOptionalType(e),t.transformFlags=1,t}function Ge(e){var t=w(186);return t.type=e,t.transformFlags=1,t}function Qe(e,t,r){var n=w(e);return n.types=A.createNodeArray(r(t)),n.transformFlags=1,n}function Xe(e,t,r){return e.types!==t?f(Qe(e.kind,t,r),e):e}function Ye(e,t,r,n){var i=w(189);return i.checkType=g().parenthesizeCheckTypeOfConditionalType(e),i.extendsType=g().parenthesizeExtendsTypeOfConditionalType(t),i.trueType=r,i.falseType=n,i.transformFlags=1,i}function Ze(e){var t=w(190);return t.typeParameter=e,t.transformFlags=1,t}function $e(e,t){var r=w(198);return r.head=e,r.templateSpans=P(t),r.transformFlags=1,r}function et(t,r,n,i,a){var o=r&&295===r.kind?r:void 0,s=r&&e.isEntityName(r)?r:n&&!e.isArray(n)?n:void 0,c=e.isArray(n)?n:e.isArray(i)?i:void 0;a="boolean"==typeof i?i:"boolean"==typeof a&&a;var l=w(200);return l.argument=t,l.assertions=o,l.qualifier=s,l.typeArguments=c&&g().parenthesizeTypeArguments(c),l.isTypeOf=a,l.transformFlags=1,l}function tt(e){var t=w(191);return t.type=e,t.transformFlags=1,t}function rt(e,t){var r=w(193);return r.operator=e,r.type=145===e?g().parenthesizeOperandOfReadonlyTypeOperator(t):g().parenthesizeOperandOfTypeOperator(t),r.transformFlags=1,r}function nt(e,t){var r=w(194);return r.objectType=g().parenthesizeNonArrayTypeOfPostfixType(e),r.indexType=t,r.transformFlags=1,r}function it(e,t,r,n,i,a){var o=w(195);return o.readonlyToken=e,o.typeParameter=t,o.nameType=r,o.questionToken=n,o.type=i,o.members=a&&P(a),o.transformFlags=1,o}function at(e){var t=w(196);return t.literal=e,t.transformFlags=1,t}function ot(e){var t=w(201);return t.elements=P(e),t.transformFlags|=263168|d(t.elements),16384&t.transformFlags&&(t.transformFlags|=32896),t}function st(e){var t=w(202);return t.elements=P(e),t.transformFlags|=263168|d(t.elements),t}function ct(t,r,n,i){var a=K(203,void 0,void 0,n,i&&g().parenthesizeExpressionForDisallowedComma(i));return a.propertyName=mi(r),a.dotDotDotToken=t,a.transformFlags|=1024|_(a.dotDotDotToken),a.propertyName&&(a.transformFlags|=e.isIdentifier(a.propertyName)?u(a.propertyName):_(a.propertyName)),t&&(a.transformFlags|=16384),a}function lt(e){return w(e)}function ut(t,r){var n=lt(204),i=t&&e.lastOrUndefined(t),a=P(t,!(!i||!e.isOmittedExpression(i))||void 0);return n.elements=g().parenthesizeExpressionsOfCommaDelimitedList(a),n.multiLine=r,n.transformFlags|=d(n.elements),n}function _t(e,t){var r=lt(205);return r.properties=P(e),r.multiLine=t,r.transformFlags|=d(r.properties),r}function dt(t,r){var n=lt(206);return n.expression=g().parenthesizeLeftSideOfAccess(t),n.name=mi(r),n.transformFlags=_(n.expression)|(e.isIdentifier(n.name)?u(n.name):_(n.name)),e.isSuperKeyword(t)&&(n.transformFlags|=384),n}function pt(t,r,n){var i=lt(206);return i.flags|=32,i.expression=g().parenthesizeLeftSideOfAccess(t),i.questionDotToken=r,i.name=mi(n),i.transformFlags|=32|_(i.expression)|_(i.questionDotToken)|(e.isIdentifier(i.name)?u(i.name):_(i.name)),i}function ft(t,r,n,i){return e.Debug.assert(!!(32&t.flags),"Cannot update a PropertyAccessExpression using updatePropertyAccessChain. Use updatePropertyAccess instead."),t.expression!==r||t.questionDotToken!==n||t.name!==i?f(pt(r,n,i),t):t}function gt(t,r){var n=lt(207);return n.expression=g().parenthesizeLeftSideOfAccess(t),n.argumentExpression=yi(r),n.transformFlags|=_(n.expression)|_(n.argumentExpression),e.isSuperKeyword(t)&&(n.transformFlags|=384),n}function mt(e,t,r){var n=lt(207);return n.flags|=32,n.expression=g().parenthesizeLeftSideOfAccess(e),n.questionDotToken=t,n.argumentExpression=yi(r),n.transformFlags|=_(n.expression)|_(n.questionDotToken)|_(n.argumentExpression)|32,n}function yt(t,r,n,i){return e.Debug.assert(!!(32&t.flags),"Cannot update a ElementAccessExpression using updateElementAccessChain. Use updateElementAccess instead."),t.expression!==r||t.questionDotToken!==n||t.argumentExpression!==i?f(mt(r,n,i),t):t}function vt(t,r,n){var i=lt(208);return i.expression=g().parenthesizeLeftSideOfAccess(t),i.typeArguments=gi(r),i.arguments=g().parenthesizeExpressionsOfCommaDelimitedList(P(n)),i.transformFlags|=_(i.expression)|d(i.typeArguments)|d(i.arguments),i.typeArguments&&(i.transformFlags|=1),e.isImportKeyword(i.expression)?i.transformFlags|=4194304:e.isSuperProperty(i.expression)&&(i.transformFlags|=8192),i}function ht(t,r,n,i){var a=lt(208);return a.flags|=32,a.expression=g().parenthesizeLeftSideOfAccess(t),a.questionDotToken=r,a.typeArguments=gi(n),a.arguments=g().parenthesizeExpressionsOfCommaDelimitedList(P(i)),a.transformFlags|=_(a.expression)|_(a.questionDotToken)|d(a.typeArguments)|d(a.arguments)|32,a.typeArguments&&(a.transformFlags|=1),e.isSuperProperty(a.expression)&&(a.transformFlags|=8192),a}function bt(t,r,n,i,a){return e.Debug.assert(!!(32&t.flags),"Cannot update a CallExpression using updateCallChain. Use updateCall instead."),t.expression!==r||t.questionDotToken!==n||t.typeArguments!==i||t.arguments!==a?f(ht(r,n,i,a),t):t}function xt(e,t,r){var n=lt(209);return n.expression=g().parenthesizeExpressionOfNew(e),n.typeArguments=gi(t),n.arguments=r?g().parenthesizeExpressionsOfCommaDelimitedList(r):void 0,n.transformFlags|=_(n.expression)|d(n.typeArguments)|d(n.arguments)|32,n.typeArguments&&(n.transformFlags|=1),n}function Dt(t,r,n){var i=lt(210);return i.tag=g().parenthesizeLeftSideOfAccess(t),i.typeArguments=gi(r),i.template=n,i.transformFlags|=_(i.tag)|d(i.typeArguments)|_(i.template)|1024,i.typeArguments&&(i.transformFlags|=1),e.hasInvalidEscape(i.template)&&(i.transformFlags|=128),i}function St(e,t){var r=lt(211);return r.expression=g().parenthesizeOperandOfPrefixUnary(t),r.type=e,r.transformFlags|=_(r.expression)|_(r.type)|1,r}function Tt(e,t,r){return e.type!==t||e.expression!==r?f(St(t,r),e):e}function Ct(e){var t=lt(212);return t.expression=e,t.transformFlags=_(t.expression),t}function kt(e,t){return e.expression!==t?f(Ct(t),e):e}function Et(t,r,n,i,a,o,s){var c=B(213,void 0,t,n,i,a,o,s);return c.asteriskToken=r,c.transformFlags|=_(c.asteriskToken),c.typeParameters&&(c.transformFlags|=1),256&e.modifiersToFlags(c.modifiers)?c.asteriskToken?c.transformFlags|=128:c.transformFlags|=256:c.asteriskToken&&(c.transformFlags|=2048),c}function Nt(e,t,r,n,i,a,o,s){return e.name!==n||e.modifiers!==t||e.asteriskToken!==r||e.typeParameters!==i||e.parameters!==a||e.type!==o||e.body!==s?j(Et(t,r,n,i,a,o,s),e):e}function Ft(t,r,n,i,a,o){var s=B(214,void 0,t,void 0,r,n,i,g().parenthesizeConciseBodyOfArrowFunction(o));return s.equalsGreaterThanToken=null!=a?a:re(38),s.transformFlags|=1024|_(s.equalsGreaterThanToken),256&e.modifiersToFlags(s.modifiers)&&(s.transformFlags|=8448),s}function At(e,t,r,n,i,a,o){return e.modifiers!==t||e.typeParameters!==r||e.parameters!==n||e.type!==i||e.equalsGreaterThanToken!==a||e.body!==o?j(Ft(t,r,n,i,a,o),e):e}function Pt(e){var t=lt(215);return t.expression=g().parenthesizeOperandOfPrefixUnary(e),t.transformFlags|=_(t.expression),t}function wt(e){var t=lt(216);return t.expression=g().parenthesizeOperandOfPrefixUnary(e),t.transformFlags|=_(t.expression),t}function It(e){var t=lt(217);return t.expression=g().parenthesizeOperandOfPrefixUnary(e),t.transformFlags|=_(t.expression),t}function Ot(e){var t=lt(218);return t.expression=g().parenthesizeOperandOfPrefixUnary(e),t.transformFlags|=1048960|_(t.expression),t}function Mt(t,r){var n=lt(219);return n.operator=t,n.operand=g().parenthesizeOperandOfPrefixUnary(r),n.transformFlags|=_(n.operand),45!==t&&46!==t||!e.isIdentifier(n.operand)||e.isGeneratedIdentifier(n.operand)||e.isLocalName(n.operand)||(n.transformFlags|=67108864),n}function Lt(t,r){var n=lt(220);return n.operator=r,n.operand=g().parenthesizeOperandOfPostfixUnary(t),n.transformFlags|=_(n.operand),!e.isIdentifier(n.operand)||e.isGeneratedIdentifier(n.operand)||e.isLocalName(n.operand)||(n.transformFlags|=67108864),n}function Rt(t,r,n){var i,a=lt(221),o="number"==typeof(i=r)?re(i):i,s=o.kind;return a.left=g().parenthesizeLeftSideOfBinary(s,t),a.operatorToken=o,a.right=g().parenthesizeRightSideOfBinary(s,a.left,n),a.transformFlags|=_(a.left)|_(a.operatorToken)|_(a.right),60===s?a.transformFlags|=32:63===s?e.isObjectLiteralExpression(a.left)?a.transformFlags|=5248|Bt(a.left):e.isArrayLiteralExpression(a.left)&&(a.transformFlags|=5120|Bt(a.left)):42===s||67===s?a.transformFlags|=512:e.isLogicalOrCoalescingAssignmentOperator(s)&&(a.transformFlags|=16),a}function Bt(t){if(32768&t.transformFlags)return 32768;if(128&t.transformFlags)for(var r=0,n=e.getElementsOfBindingOrAssignmentPattern(t);r<n.length;r++){var i=n[r],a=e.getTargetOfBindingOrAssignmentElement(i);if(a&&e.isAssignmentPattern(a)){if(32768&a.transformFlags)return 32768;if(128&a.transformFlags){var o=Bt(a);if(o)return o}}}return 0}function jt(e,t,r,n,i){var a=lt(222);return a.condition=g().parenthesizeConditionOfConditionalExpression(e),a.questionToken=null!=t?t:re(57),a.whenTrue=g().parenthesizeBranchOfConditionalExpression(r),a.colonToken=null!=n?n:re(58),a.whenFalse=g().parenthesizeBranchOfConditionalExpression(i),a.transformFlags|=_(a.condition)|_(a.questionToken)|_(a.whenTrue)|_(a.colonToken)|_(a.whenFalse),a}function Jt(e,t){var r=lt(223);return r.head=e,r.templateSpans=P(t),r.transformFlags|=_(r.head)|d(r.templateSpans)|1024,r}function zt(r,n,i,a){void 0===a&&(a=0),e.Debug.assert(!(-2049&a),"Unsupported template flags.");var o=void 0;if(void 0!==i&&i!==n&&"object"==typeof(o=function(r,n){switch(t||(t=e.createScanner(99,!1,0)),r){case 14:t.setText("`"+n+"`");break;case 15:t.setText("`"+n+"${");break;case 16:t.setText("}"+n+"${");break;case 17:t.setText("}"+n+"`");}var i,a=t.scan();if(19===a&&(a=t.reScanTemplateToken(!1)),t.isUnterminated())return t.setText(void 0),l;switch(a){case 14:case 15:case 16:case 17:i=t.getTokenValue();}return void 0===i||1!==t.scan()?(t.setText(void 0),l):(t.setText(void 0),i)}(r,i)))return e.Debug.fail("Invalid raw text");if(void 0===n){if(void 0===o)return e.Debug.fail("Arguments 'text' and 'rawText' may not both be undefined.");n=o;}else void 0!==o&&e.Debug.assert(n===o,"Expected argument 'text' to be the normalized (i.e. 'cooked') version of argument 'rawText'.");return Kt(r,n,i,a)}function Kt(e,t,r,n){var i=te(e);return i.text=t,i.rawText=r,i.templateFlags=2048&n,i.transformFlags|=1024,i.templateFlags&&(i.transformFlags|=128),i}function Ut(t,r){e.Debug.assert(!t||!!r,"A `YieldExpression` with an asteriskToken must have an expression.");var n=lt(224);return n.expression=r&&g().parenthesizeExpressionForDisallowedComma(r),n.asteriskToken=t,n.transformFlags|=_(n.expression)|_(n.asteriskToken)|525440,n}function Vt(e){var t=lt(225);return t.expression=g().parenthesizeExpressionForDisallowedComma(e),t.transformFlags|=17408|_(t.expression),t}function qt(e,t,r,n,i,a){var o=z(226,e,t,r,n,i,a);return o.transformFlags|=1024,o}function Wt(e,t,r,n,i,a,o){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.typeParameters!==i||e.heritageClauses!==a||e.members!==o?f(qt(t,r,n,i,a,o),e):e}function Ht(e,t){var r=w(228);return r.expression=g().parenthesizeLeftSideOfAccess(e),r.typeArguments=t&&g().parenthesizeTypeArguments(t),r.transformFlags|=_(r.expression)|d(r.typeArguments)|1024,r}function Gt(e,t){var r=lt(229);return r.expression=e,r.type=t,r.transformFlags|=_(r.expression)|_(r.type)|1,r}function Qt(e,t,r){return e.expression!==t||e.type!==r?f(Gt(t,r),e):e}function Xt(e){var t=lt(230);return t.expression=g().parenthesizeLeftSideOfAccess(e),t.transformFlags|=1|_(t.expression),t}function Yt(t,r){return e.isNonNullChain(t)?$t(t,r):t.expression!==r?f(Xt(r),t):t}function Zt(e){var t=lt(230);return t.flags|=32,t.expression=g().parenthesizeLeftSideOfAccess(e),t.transformFlags|=1|_(t.expression),t}function $t(t,r){return e.Debug.assert(!!(32&t.flags),"Cannot update a NonNullExpression using updateNonNullChain. Use updateNonNullExpression instead."),t.expression!==r?f(Zt(r),t):t}function er(t,r){var n=lt(231);switch(n.keywordToken=t,n.name=r,n.transformFlags|=_(n.name),t){case 103:n.transformFlags|=1024;break;case 100:n.transformFlags|=4;break;default:return e.Debug.assertNever(t)}return n}function tr(e,t){var r=w(233);return r.expression=e,r.literal=t,r.transformFlags|=_(r.expression)|_(r.literal)|1024,r}function rr(e,t){var r=w(235);return r.statements=P(e),r.multiLine=t,r.transformFlags|=d(r.statements),r}function nr(t,r){var n=I(237,void 0,t);return n.declarationList=e.isArray(r)?Sr(r):r,n.transformFlags|=_(n.declarationList),2&e.modifiersToFlags(n.modifiers)&&(n.transformFlags=1),n}function ir(e,t,r){return e.modifiers!==t||e.declarationList!==r?f(nr(t,r),e):e}function ar(){return w(236)}function or(e){var t=w(238);return t.expression=g().parenthesizeExpressionOfExpressionStatement(e),t.transformFlags|=_(t.expression),t}function sr(e,t,r){var n=w(239);return n.expression=e,n.thenStatement=vi(t),n.elseStatement=vi(r),n.transformFlags|=_(n.expression)|_(n.thenStatement)|_(n.elseStatement),n}function cr(e,t){var r=w(240);return r.statement=vi(e),r.expression=t,r.transformFlags|=_(r.statement)|_(r.expression),r}function lr(e,t){var r=w(241);return r.expression=e,r.statement=vi(t),r.transformFlags|=_(r.expression)|_(r.statement),r}function ur(e,t,r,n){var i=w(242);return i.initializer=e,i.condition=t,i.incrementor=r,i.statement=vi(n),i.transformFlags|=_(i.initializer)|_(i.condition)|_(i.incrementor)|_(i.statement),i}function _r(e,t,r){var n=w(243);return n.initializer=e,n.expression=t,n.statement=vi(r),n.transformFlags|=_(n.initializer)|_(n.expression)|_(n.statement),n}function dr(e,t,r,n){var i=w(244);return i.awaitModifier=e,i.initializer=t,i.expression=g().parenthesizeExpressionForDisallowedComma(r),i.statement=vi(n),i.transformFlags|=_(i.awaitModifier)|_(i.initializer)|_(i.expression)|_(i.statement)|1024,e&&(i.transformFlags|=128),i}function pr(e){var t=w(245);return t.label=mi(e),t.transformFlags|=2097152|_(t.label),t}function fr(e){var t=w(246);return t.label=mi(e),t.transformFlags|=2097152|_(t.label),t}function gr(e){var t=w(247);return t.expression=e,t.transformFlags|=2097280|_(t.expression),t}function mr(e,t){var r=w(248);return r.expression=e,r.statement=vi(t),r.transformFlags|=_(r.expression)|_(r.statement),r}function yr(e,t){var r=w(249);return r.expression=g().parenthesizeExpressionForDisallowedComma(e),r.caseBlock=t,r.transformFlags|=_(r.expression)|_(r.caseBlock),r}function vr(e,t){var r=w(250);return r.label=mi(e),r.statement=vi(t),r.transformFlags|=_(r.label)|_(r.statement),r}function hr(e,t,r){return e.label!==t||e.statement!==r?f(vr(t,r),e):e}function br(e){var t=w(251);return t.expression=e,t.transformFlags|=_(t.expression),t}function xr(e,t,r){var n=w(252);return n.tryBlock=e,n.catchClause=t,n.finallyBlock=r,n.transformFlags|=_(n.tryBlock)|_(n.catchClause)|_(n.finallyBlock),n}function Dr(e,t,r,n){var i=U(254,void 0,void 0,e,r,n&&g().parenthesizeExpressionForDisallowedComma(n));return i.exclamationToken=t,i.transformFlags|=_(i.exclamationToken),t&&(i.transformFlags|=1),i}function Sr(e,t){void 0===t&&(t=0);var r=w(255);return r.flags|=3&t,r.declarations=P(e),r.transformFlags|=2097152|d(r.declarations),3&t&&(r.transformFlags|=132096),r}function Tr(t,r,n,i,a,o,s,c){var l=B(256,t,r,i,a,o,s,c);return l.asteriskToken=n,!l.body||2&e.modifiersToFlags(l.modifiers)?l.transformFlags=1:(l.transformFlags|=2097152|_(l.asteriskToken),256&e.modifiersToFlags(l.modifiers)?l.asteriskToken?l.transformFlags|=128:l.transformFlags|=256:l.asteriskToken&&(l.transformFlags|=2048)),l}function Cr(e,t,r,n,i,a,o,s,c){return e.decorators!==t||e.modifiers!==r||e.asteriskToken!==n||e.name!==i||e.typeParameters!==a||e.parameters!==o||e.type!==s||e.body!==c?j(Tr(t,r,n,i,a,o,s,c),e):e}function kr(t,r,n,i,a,o){var s=z(257,t,r,n,i,a,o);return 2&e.modifiersToFlags(s.modifiers)?s.transformFlags=1:(s.transformFlags|=1024,4096&s.transformFlags&&(s.transformFlags|=1)),s}function Er(e,t,r,n,i,a,o){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.typeParameters!==i||e.heritageClauses!==a||e.members!==o?f(kr(t,r,n,i,a,o),e):e}function Nr(e,t,r,n,i,a){var o=J(258,e,t,r,n,i);return o.members=P(a),o.transformFlags=1,o}function Fr(e,t,r,n,i,a,o){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.typeParameters!==i||e.heritageClauses!==a||e.members!==o?f(Nr(t,r,n,i,a,o),e):e}function Ar(e,t,r,n,i){var a=M(259,e,t,r,n);return a.type=i,a.transformFlags=1,a}function Pr(e,t,r,n,i,a){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.typeParameters!==i||e.type!==a?f(Ar(t,r,n,i,a),e):e}function wr(e,t,r,n){var i=O(260,e,t,r);return i.members=P(n),i.transformFlags|=1|d(i.members),i.transformFlags&=-16777217,i}function Ir(e,t,r,n,i){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.members!==i?f(wr(t,r,n,i),e):e}function Or(t,r,n,i,a){void 0===a&&(a=0);var o=I(261,t,r);return o.flags|=1044&a,o.name=n,o.body=i,2&e.modifiersToFlags(o.modifiers)?o.transformFlags=1:o.transformFlags|=_(o.name)|_(o.body)|1,o.transformFlags&=-16777217,o}function Mr(e,t,r,n,i){return e.decorators!==t||e.modifiers!==r||e.name!==n||e.body!==i?f(Or(t,r,n,i,e.flags),e):e}function Lr(e){var t=w(262);return t.statements=P(e),t.transformFlags|=d(t.statements),t}function Rr(e){var t=w(263);return t.clauses=P(e),t.transformFlags|=d(t.clauses),t}function Br(e){var t=O(264,void 0,void 0,e);return t.transformFlags=1,t}function jr(t,r,n,i,a){var o=O(265,t,r,i);return o.isTypeOnly=n,o.moduleReference=a,o.transformFlags|=_(o.moduleReference),e.isExternalModuleReference(o.moduleReference)||(o.transformFlags|=1),o.transformFlags&=-16777217,o}function Jr(e,t,r,n,i,a){return e.decorators!==t||e.modifiers!==r||e.isTypeOnly!==n||e.name!==i||e.moduleReference!==a?f(jr(t,r,n,i,a),e):e}function zr(e,t,r,n,i){var a=I(266,e,t);return a.importClause=r,a.moduleSpecifier=n,a.assertClause=i,a.transformFlags|=_(a.importClause)|_(a.moduleSpecifier),a.transformFlags&=-16777217,a}function Kr(e,t,r,n,i,a){return e.decorators!==t||e.modifiers!==r||e.importClause!==n||e.moduleSpecifier!==i||e.assertClause!==a?f(zr(t,r,n,i,a),e):e}function Ur(e,t,r){var n=w(267);return n.isTypeOnly=e,n.name=t,n.namedBindings=r,n.transformFlags|=_(n.name)|_(n.namedBindings),e&&(n.transformFlags|=1),n.transformFlags&=-16777217,n}function Vr(e,t){var r=w(293);return r.elements=P(e),r.multiLine=t,r.transformFlags|=4,r}function qr(e,t){var r=w(294);return r.name=e,r.value=t,r.transformFlags|=4,r}function Wr(e,t){var r=w(295);return r.assertClause=e,r.multiLine=t,r}function Hr(e){var t=w(268);return t.name=e,t.transformFlags|=_(t.name),t.transformFlags&=-16777217,t}function Gr(e){var t=w(274);return t.name=e,t.transformFlags|=4|_(t.name),t.transformFlags&=-16777217,t}function Qr(e){var t=w(269);return t.elements=P(e),t.transformFlags|=d(t.elements),t.transformFlags&=-16777217,t}function Xr(e,t,r){var n=w(270);return n.isTypeOnly=e,n.propertyName=t,n.name=r,n.transformFlags|=_(n.propertyName)|_(n.name),n.transformFlags&=-16777217,n}function Yr(e,t,r,n){var i=I(271,e,t);return i.isExportEquals=r,i.expression=r?g().parenthesizeRightSideOfBinary(63,void 0,n):g().parenthesizeExpressionOfExportDefault(n),i.transformFlags|=_(i.expression),i.transformFlags&=-16777217,i}function Zr(e,t,r,n){return e.decorators!==t||e.modifiers!==r||e.expression!==n?f(Yr(t,r,e.isExportEquals,n),e):e}function $r(e,t,r,n,i,a){var o=I(272,e,t);return o.isTypeOnly=r,o.exportClause=n,o.moduleSpecifier=i,o.assertClause=a,o.transformFlags|=_(o.exportClause)|_(o.moduleSpecifier),o.transformFlags&=-16777217,o}function en(e,t,r,n,i,a,o){return e.decorators!==t||e.modifiers!==r||e.isTypeOnly!==n||e.exportClause!==i||e.moduleSpecifier!==a||e.assertClause!==o?f($r(t,r,n,i,a,o),e):e}function tn(e){var t=w(273);return t.elements=P(e),t.transformFlags|=d(t.elements),t.transformFlags&=-16777217,t}function rn(e,t,r){var n=w(275);return n.isTypeOnly=e,n.propertyName=mi(t),n.name=mi(r),n.transformFlags|=_(n.propertyName)|_(n.name),n.transformFlags&=-16777217,n}function nn(e){var t=w(277);return t.expression=e,t.transformFlags|=_(t.expression),t.transformFlags&=-16777217,t}function an(e,t,r){void 0===r&&(r=!1);var n=on(e,r?t&&g().parenthesizeNonArrayTypeOfPostfixType(t):t);return n.postfix=r,n}function on(e,t){var r=w(e);return r.type=t,r}function sn(e,t){return L(317,void 0,void 0,void 0,void 0,e,t)}function cn(e,t){void 0===t&&(t=!1);var r=w(322);return r.jsDocPropertyTags=gi(e),r.isArrayType=t,r}function ln(e){var t=w(309);return t.type=e,t}function un(e,t,r){var n=w(323);return n.typeParameters=gi(e),n.parameters=P(t),n.type=r,n}function _n(t){var r=c(t.kind);return t.tagName.escapedText===e.escapeLeadingUnderscores(r)?t.tagName:Z(r)}function dn(e,t,r){var n=w(e);return n.tagName=t,n.comment=r,n}function pn(e,t,r,n){var i=dn(344,null!=e?e:Z("template"),n);return i.constraint=t,i.typeParameters=P(r),i}function fn(t,r,n,i){var a=dn(345,null!=t?t:Z("typedef"),i);return a.typeExpression=r,a.fullName=n,a.name=e.getJSDocTypeAliasName(n),a}function gn(e,t,r,n,i,a){var o=dn(340,null!=e?e:Z("param"),a);return o.typeExpression=n,o.name=t,o.isNameFirst=!!i,o.isBracketed=r,o}function mn(e,t,r,n,i,a){var o=dn(347,null!=e?e:Z("prop"),a);return o.typeExpression=n,o.name=t,o.isNameFirst=!!i,o.isBracketed=r,o}function yn(t,r,n,i){var a=dn(338,null!=t?t:Z("callback"),i);return a.typeExpression=r,a.fullName=n,a.name=e.getJSDocTypeAliasName(n),a}function vn(e,t,r){var n=dn(328,null!=e?e:Z("augments"),r);return n.class=t,n}function hn(e,t,r){var n=dn(329,null!=e?e:Z("implements"),r);return n.class=t,n}function bn(e,t,r){var n=dn(346,null!=e?e:Z("see"),r);return n.name=t,n}function xn(e){var t=w(310);return t.name=e,t}function Dn(e,t){var r=w(311);return r.left=e,r.right=t,r.transformFlags|=_(r.left)|_(r.right),r}function Sn(e,t){var r=w(324);return r.name=e,r.text=t,r}function Tn(e,t){var r=w(325);return r.name=e,r.text=t,r}function Cn(e,t){var r=w(326);return r.name=e,r.text=t,r}function kn(e,t,r){return dn(e,null!=t?t:Z(c(e)),r)}function En(e,t,r,n){var i=dn(e,null!=t?t:Z(c(e)),n);return i.typeExpression=r,i}function Nn(e,t){return dn(327,e,t)}function Fn(e){var t=w(321);return t.text=e,t}function An(e,t){var r=w(320);return r.comment=e,r.tags=gi(t),r}function Pn(e,t,r){var n=w(278);return n.openingElement=e,n.children=P(t),n.closingElement=r,n.transformFlags|=_(n.openingElement)|d(n.children)|_(n.closingElement)|2,n}function wn(e,t,r){var n=w(279);return n.tagName=e,n.typeArguments=gi(t),n.attributes=r,n.transformFlags|=_(n.tagName)|d(n.typeArguments)|_(n.attributes)|2,n.typeArguments&&(n.transformFlags|=1),n}function In(e,t,r){var n=w(280);return n.tagName=e,n.typeArguments=gi(t),n.attributes=r,n.transformFlags|=_(n.tagName)|d(n.typeArguments)|_(n.attributes)|2,t&&(n.transformFlags|=1),n}function On(e){var t=w(281);return t.tagName=e,t.transformFlags|=2|_(t.tagName),t}function Mn(e,t,r){var n=w(282);return n.openingFragment=e,n.children=P(t),n.closingFragment=r,n.transformFlags|=_(n.openingFragment)|d(n.children)|_(n.closingFragment)|2,n}function Ln(e,t){var r=w(11);return r.text=e,r.containsOnlyTriviaWhiteSpaces=!!t,r.transformFlags|=2,r}function Rn(e,t){var r=w(285);return r.name=e,r.initializer=t,r.transformFlags|=_(r.name)|_(r.initializer)|2,r}function Bn(e){var t=w(286);return t.properties=P(e),t.transformFlags|=2|d(t.properties),t}function jn(e){var t=w(287);return t.expression=e,t.transformFlags|=2|_(t.expression),t}function Jn(e,t){var r=w(288);return r.dotDotDotToken=e,r.expression=t,r.transformFlags|=_(r.dotDotDotToken)|_(r.expression)|2,r}function zn(e,t){var r=w(289);return r.expression=g().parenthesizeExpressionForDisallowedComma(e),r.statements=P(t),r.transformFlags|=_(r.expression)|d(r.statements),r}function Kn(e){var t=w(290);return t.statements=P(e),t.transformFlags=d(t.statements),t}function Un(t,r){var n=w(291);switch(n.token=t,n.types=P(r),n.transformFlags|=d(n.types),t){case 94:n.transformFlags|=1024;break;case 117:n.transformFlags|=1;break;default:return e.Debug.assertNever(t)}return n}function Vn(t,r){var n=w(292);return ("string"==typeof t||t&&!e.isVariableDeclaration(t))&&(t=Dr(t,void 0,void 0,void 0)),n.variableDeclaration=t,n.block=r,n.transformFlags|=_(n.variableDeclaration)|_(n.block),t||(n.transformFlags|=64),n}function qn(e,t){var r=O(296,void 0,void 0,e);return r.initializer=g().parenthesizeExpressionForDisallowedComma(t),r.transformFlags|=_(r.name)|_(r.initializer),r}function Wn(e,t){var r=O(297,void 0,void 0,e);return r.objectAssignmentInitializer=t&&g().parenthesizeExpressionForDisallowedComma(t),r.transformFlags|=1024|_(r.objectAssignmentInitializer),r}function Hn(e){var t=w(298);return t.expression=g().parenthesizeExpressionForDisallowedComma(e),t.transformFlags|=32896|_(t.expression),t}function Gn(e,t){var r=w(299);return r.name=mi(e),r.initializer=t&&g().parenthesizeExpressionForDisallowedComma(t),r.transformFlags|=_(r.name)|_(r.initializer)|1,r}function Qn(t,r){void 0===r&&(r=e.emptyArray);var n=w(306);return n.prepends=r,n.sourceFiles=t,n}function Xn(e,t){var r=w(e);return r.data=t,r}function Yn(t,r){var n=w(350);return n.expression=t,n.original=r,n.transformFlags|=1|_(n.expression),e.setTextRange(n,r),n}function Zn(e,t){return e.expression!==t?f(Yn(t,e.original),e):e}function $n(t){if(e.nodeIsSynthesized(t)&&!e.isParseTreeNode(t)&&!t.original&&!t.emitNode&&!t.id){if(e.isCommaListExpression(t))return t.elements;if(e.isBinaryExpression(t)&&e.isCommaToken(t.operatorToken))return [t.left,t.right]}return t}function ei(t){var r=w(351);return r.elements=P(e.sameFlatMap(t,$n)),r.transformFlags|=d(r.elements),r}function ti(e,t){var r=w(354);return r.expression=e,r.thisArg=t,r.transformFlags|=_(r.expression)|_(r.thisArg),r}function ri(t){if(void 0===t)return t;var r=e.isSourceFile(t)?a.createBaseSourceFileNode(305):e.isIdentifier(t)?a.createBaseIdentifierNode(79):e.isPrivateIdentifier(t)?a.createBasePrivateIdentifierNode(80):e.isNodeKind(t.kind)?a.createBaseNode(t.kind):a.createBaseTokenNode(t.kind);for(var n in r.flags|=-9&t.flags,r.transformFlags=t.transformFlags,h(r,t),t)!r.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(r[n]=t[n]);return r}function ni(){return It(q("0"))}function ii(t,r,n){return e.isCallChain(t)?ht(pt(t,void 0,r),void 0,void 0,n):vt(dt(t,r),void 0,n)}function ai(e,t,r){return ii(Z(e),t,r)}function oi(e,t,r){return !!r&&(e.push(qn(t,r)),!0)}function si(t,r){var n=e.skipParentheses(t);switch(n.kind){case 79:return r;case 108:case 8:case 9:case 10:return !1;case 204:return 0!==n.elements.length;case 205:return n.properties.length>0;default:return !0}}function ci(t,r,n,i){void 0===i&&(i=0);var a=e.getNameOfDeclaration(t);if(a&&e.isIdentifier(a)&&!e.isGeneratedIdentifier(a)){var o=e.setParent(e.setTextRange(ri(a),a),a.parent);return i|=e.getEmitFlags(a),n||(i|=48),r||(i|=1536),i&&e.setEmitFlags(o,i),o}return ee(t)}function li(e,t,r){return ci(e,t,r,8192)}function ui(t,r,n,i){var a=dt(t,e.nodeIsSynthesized(r)?r:ri(r));e.setTextRange(a,r);var o=0;return i||(o|=48),n||(o|=1536),o&&e.setEmitFlags(a,o),a}function _i(){return e.startOnNewLine(or(G("use strict")))}function di(t,r,n,i){void 0===n&&(n=0),e.Debug.assert(0===r.length,"Prologue directives should be at the first statement in the target statements array");for(var a,o=!1,s=t.length;n<s;){var c=t[n];if(!e.isPrologueDirective(c))break;a=c,e.isStringLiteral(a.expression)&&"use strict"===a.expression.text&&(o=!0),r.push(c),n++;}return i&&!o&&r.push(_i()),n}function pi(t,r,n,i,a){void 0===a&&(a=e.returnTrue);for(var o=t.length;void 0!==n&&n<o;){var s=t[n];if(!(1048576&e.getEmitFlags(s)&&a(s)))break;e.append(r,i?e.visitNode(s,i,e.isStatement):s),n++;}return n}function fi(e,t,r){for(var n=r;n<e.length&&t(e[n]);)n++;return n}function gi(e){return e?P(e):void 0}function mi(e){return "string"==typeof e?Z(e):e}function yi(e){return "string"==typeof e?G(e):"number"==typeof e?q(e):"boolean"==typeof e?e?ie():ae():e}function vi(t){return t&&e.isNotEmittedStatement(t)?e.setTextRange(h(ar(),t),t):t}}function o(t,r){return t!==r&&e.setTextRange(t,r),t}function s(t,r){return t!==r&&(h(t,r),e.setTextRange(t,r)),t}function c(t){switch(t){case 343:return "type";case 341:return "returns";case 342:return "this";case 339:return "enum";case 330:return "author";case 332:return "class";case 333:return "public";case 334:return "private";case 335:return "protected";case 336:return "readonly";case 337:return "override";case 344:return "template";case 345:return "typedef";case 340:return "param";case 347:return "prop";case 338:return "callback";case 328:return "augments";case 329:return "implements";default:return e.Debug.fail("Unsupported kind: ".concat(e.Debug.formatSyntaxKind(t)))}}(r=e.NodeFactoryFlags||(e.NodeFactoryFlags={}))[r.None=0]="None",r[r.NoParenthesizerRules=1]="NoParenthesizerRules",r[r.NoNodeConverters=2]="NoNodeConverters",r[r.NoIndentationOnFreshPropertyAccess=4]="NoIndentationOnFreshPropertyAccess",r[r.NoOriginalNode=8]="NoOriginalNode",e.createNodeFactory=a;var l={};function u(e){return -16777217&_(e)}function _(t){if(!t)return 0;var r=t.transformFlags&~f(t.kind);return e.isNamedDeclaration(t)&&e.isPropertyName(t.name)?r|33562624&t.name.transformFlags:r}function d(e){return e?e.transformFlags:0}function p(e){for(var t=0,r=0,n=e;r<n.length;r++)t|=_(n[r]);e.transformFlags=t;}function f(e){if(e>=177&&e<=200)return -2;switch(e){case 208:case 209:case 204:return 536887296;case 261:return 589443072;case 164:return 536870912;case 214:return 557748224;case 213:case 256:return 591310848;case 255:return 537165824;case 257:case 226:return 536940544;case 171:return 591306752;case 167:return 570433536;case 169:case 172:case 173:return 574529536;case 130:case 147:case 158:case 143:case 150:case 148:case 133:case 151:case 114:case 163:case 166:case 168:case 174:case 175:case 176:case 258:case 259:return -2;case 205:return 536973312;case 292:return 536903680;case 201:case 202:return 536887296;case 211:case 229:case 350:case 212:case 106:return 536870912;case 206:case 207:default:return 536870912}}e.getTransformFlagsSubtreeExclusions=f;var g=e.createBaseNodeFactory();function m(e){return e.flags|=8,e}var y,v={createBaseSourceFileNode:function(e){return m(g.createBaseSourceFileNode(e))},createBaseIdentifierNode:function(e){return m(g.createBaseIdentifierNode(e))},createBasePrivateIdentifierNode:function(e){return m(g.createBasePrivateIdentifierNode(e))},createBaseTokenNode:function(e){return m(g.createBaseTokenNode(e))},createBaseNode:function(e){return m(g.createBaseNode(e))}};function h(t,r){if(t.original=r,r){var n=r.emitNode;n&&(t.emitNode=function(t,r){var n=t.flags,i=t.leadingComments,a=t.trailingComments,o=t.commentRange,s=t.sourceMapRange,c=t.tokenSourceMapRanges,l=t.constantValue,u=t.helpers,_=t.startsOnNewLine;if(r||(r={}),i&&(r.leadingComments=e.addRange(i.slice(),r.leadingComments)),a&&(r.trailingComments=e.addRange(a.slice(),r.trailingComments)),n&&(r.flags=-268435457&n),o&&(r.commentRange=o),s&&(r.sourceMapRange=s),c&&(r.tokenSourceMapRanges=function(e,t){for(var r in t||(t=[]),e)t[r]=e[r];return t}(c,r.tokenSourceMapRanges)),void 0!==l&&(r.constantValue=l),u)for(var d=0,p=u;d<p.length;d++){var f=p[d];r.helpers=e.appendIfUnique(r.helpers,f);}return void 0!==_&&(r.startsOnNewLine=_),r}(n,t.emitNode));}return t}e.factory=a(4,v),e.createUnparsedSourceFile=function(t,r,n){var i,a,o,s,c,l,u,_,d,p;e.isString(t)?(o="",s=t,c=t.length,l=r,u=n):(e.Debug.assert("js"===r||"dts"===r),o=("js"===r?t.javascriptPath:t.declarationPath)||"",l="js"===r?t.javascriptMapPath:t.declarationMapPath,_=function(){return "js"===r?t.javascriptText:t.declarationText},d=function(){return "js"===r?t.javascriptMapText:t.declarationMapText},c=function(){return _().length},t.buildInfo&&t.buildInfo.bundle&&(e.Debug.assert(void 0===n||"boolean"==typeof n),i=n,a="js"===r?t.buildInfo.bundle.js:t.buildInfo.bundle.dts,p=t.oldFileOfCurrentEmit));var f=p?function(t){for(var r,n,i=0,a=t.sections;i<a.length;i++){var o=a[i];switch(o.kind){case"internal":case"text":r=e.append(r,e.setTextRange(e.factory.createUnparsedTextLike(o.data,"internal"===o.kind),o));break;case"no-default-lib":case"reference":case"type":case"type-import":case"type-require":case"lib":n=e.append(n,e.setTextRange(e.factory.createUnparsedSyntheticReference(o),o));break;case"prologue":case"emitHelpers":case"prepend":break;default:e.Debug.assertNever(o);}}var s=e.factory.createUnparsedSource(e.emptyArray,n,null!=r?r:e.emptyArray);return e.setEachParent(n,s),e.setEachParent(r,s),s.helpers=e.map(t.sources&&t.sources.helpers,(function(t){return e.getAllUnscopedEmitHelpers().get(t)})),s}(e.Debug.checkDefined(a)):function(t,r,n){for(var i,a,o,s,c,l,u,_,d=0,p=t?t.sections:e.emptyArray;d<p.length;d++){var f=p[d];switch(f.kind){case"prologue":i=e.append(i,e.setTextRange(e.factory.createUnparsedPrologue(f.data),f));break;case"emitHelpers":a=e.append(a,e.getAllUnscopedEmitHelpers().get(f.data));break;case"no-default-lib":_=!0;break;case"reference":o=e.append(o,{pos:-1,end:-1,fileName:f.data});break;case"type":s=e.append(s,{pos:-1,end:-1,fileName:f.data});break;case"type-import":s=e.append(s,{pos:-1,end:-1,fileName:f.data,resolutionMode:e.ModuleKind.ESNext});break;case"type-require":s=e.append(s,{pos:-1,end:-1,fileName:f.data,resolutionMode:e.ModuleKind.CommonJS});break;case"lib":c=e.append(c,{pos:-1,end:-1,fileName:f.data});break;case"prepend":for(var g=void 0,m=0,y=f.texts;m<y.length;m++){var v=y[m];r&&"internal"===v.kind||(g=e.append(g,e.setTextRange(e.factory.createUnparsedTextLike(v.data,"internal"===v.kind),v)));}l=e.addRange(l,g),u=e.append(u,e.factory.createUnparsedPrepend(f.data,null!=g?g:e.emptyArray));break;case"internal":if(r){u||(u=[]);break}case"text":u=e.append(u,e.setTextRange(e.factory.createUnparsedTextLike(f.data,"internal"===f.kind),f));break;default:e.Debug.assertNever(f);}}if(!u){var h=e.factory.createUnparsedTextLike(void 0,!1);e.setTextRangePosWidth(h,0,"function"==typeof n?n():n),u=[h];}var b=e.parseNodeFactory.createUnparsedSource(null!=i?i:e.emptyArray,void 0,u);return e.setEachParent(i,b),e.setEachParent(u,b),e.setEachParent(l,b),b.hasNoDefaultLib=_,b.helpers=a,b.referencedFiles=o||e.emptyArray,b.typeReferenceDirectives=s,b.libReferenceDirectives=c||e.emptyArray,b}(a,i,c);return f.fileName=o,f.sourceMapPath=l,f.oldFileOfCurrentEmit=p,_&&d?(Object.defineProperty(f,"text",{get:_}),Object.defineProperty(f,"sourceMapText",{get:d})):(e.Debug.assert(!p),f.text=null!=s?s:"",f.sourceMapText=u),f},e.createInputFiles=function(t,r,n,i,a,o,s,c,l,u,_){var d=e.parseNodeFactory.createInputFiles();if(e.isString(t))d.javascriptText=t,d.javascriptMapPath=n,d.javascriptMapText=i,d.declarationText=r,d.declarationMapPath=a,d.declarationMapText=o,d.javascriptPath=s,d.declarationPath=c,d.buildInfoPath=l,d.buildInfo=u,d.oldFileOfCurrentEmit=_;else {var p,f=new e.Map,g=function(e){if(void 0!==e){var r=f.get(e);return void 0===r&&(r=t(e),f.set(e,void 0!==r&&r)),!1!==r?r:void 0}},m=function(e){var t=g(e);return void 0!==t?t:"/* Input file ".concat(e," was missing */\r\n")};d.javascriptPath=r,d.javascriptMapPath=n,d.declarationPath=e.Debug.checkDefined(i),d.declarationMapPath=a,d.buildInfoPath=o,Object.defineProperties(d,{javascriptText:{get:function(){return m(r)}},javascriptMapText:{get:function(){return g(n)}},declarationText:{get:function(){return m(e.Debug.checkDefined(i))}},declarationMapText:{get:function(){return g(a)}},buildInfo:{get:function(){return function(t){if(void 0===p){var r=g(o);p=void 0!==r&&e.getBuildInfo(r);}return p||void 0}()}}});}return d},e.createSourceMapSource=function(t,r,n){return new(y||(y=e.objectAllocator.getSourceMapSourceConstructor()))(t,r,n)},e.setOriginalNode=h;}(t),function(e){function t(r){var n;if(r.emitNode)e.Debug.assert(!(268435456&r.emitNode.flags),"Invalid attempt to mutate an immutable node.");else {if(e.isParseTreeNode(r)){if(305===r.kind)return r.emitNode={annotatedNodes:[r]};t(null!==(n=e.getSourceFileOfNode(e.getParseTreeNode(e.getSourceFileOfNode(r))))&&void 0!==n?n:e.Debug.fail("Could not determine parsed source file.")).annotatedNodes.push(r);}r.emitNode={};}return r.emitNode}function r(e){var t;return null===(t=e.emitNode)||void 0===t?void 0:t.leadingComments}function n(e,r){return t(e).leadingComments=r,e}function i(e){var t;return null===(t=e.emitNode)||void 0===t?void 0:t.trailingComments}function a(e,r){return t(e).trailingComments=r,e}e.getOrCreateEmitNode=t,e.disposeEmitNodes=function(t){var r,n,i=null===(n=null===(r=e.getSourceFileOfNode(e.getParseTreeNode(t)))||void 0===r?void 0:r.emitNode)||void 0===n?void 0:n.annotatedNodes;if(i)for(var a=0,o=i;a<o.length;a++)o[a].emitNode=void 0;},e.removeAllComments=function(e){var r=t(e);return r.flags|=1536,r.leadingComments=void 0,r.trailingComments=void 0,e},e.setEmitFlags=function(e,r){return t(e).flags=r,e},e.addEmitFlags=function(e,r){var n=t(e);return n.flags=n.flags|r,e},e.getSourceMapRange=function(e){var t,r;return null!==(r=null===(t=e.emitNode)||void 0===t?void 0:t.sourceMapRange)&&void 0!==r?r:e},e.setSourceMapRange=function(e,r){return t(e).sourceMapRange=r,e},e.getTokenSourceMapRange=function(e,t){var r,n;return null===(n=null===(r=e.emitNode)||void 0===r?void 0:r.tokenSourceMapRanges)||void 0===n?void 0:n[t]},e.setTokenSourceMapRange=function(e,r,n){var i,a=t(e);return (null!==(i=a.tokenSourceMapRanges)&&void 0!==i?i:a.tokenSourceMapRanges=[])[r]=n,e},e.getStartsOnNewLine=function(e){var t;return null===(t=e.emitNode)||void 0===t?void 0:t.startsOnNewLine},e.setStartsOnNewLine=function(e,r){return t(e).startsOnNewLine=r,e},e.getCommentRange=function(e){var t,r;return null!==(r=null===(t=e.emitNode)||void 0===t?void 0:t.commentRange)&&void 0!==r?r:e},e.setCommentRange=function(e,r){return t(e).commentRange=r,e},e.getSyntheticLeadingComments=r,e.setSyntheticLeadingComments=n,e.addSyntheticLeadingComment=function(t,i,a,o){return n(t,e.append(r(t),{kind:i,pos:-1,end:-1,hasTrailingNewLine:o,text:a}))},e.getSyntheticTrailingComments=i,e.setSyntheticTrailingComments=a,e.addSyntheticTrailingComment=function(t,r,n,o){return a(t,e.append(i(t),{kind:r,pos:-1,end:-1,hasTrailingNewLine:o,text:n}))},e.moveSyntheticComments=function(e,o){n(e,r(o)),a(e,i(o));var s=t(o);return s.leadingComments=void 0,s.trailingComments=void 0,e},e.getConstantValue=function(e){var t;return null===(t=e.emitNode)||void 0===t?void 0:t.constantValue},e.setConstantValue=function(e,r){return t(e).constantValue=r,e},e.addEmitHelper=function(r,n){var i=t(r);return i.helpers=e.append(i.helpers,n),r},e.addEmitHelpers=function(r,n){if(e.some(n))for(var i=t(r),a=0,o=n;a<o.length;a++){var s=o[a];i.helpers=e.appendIfUnique(i.helpers,s);}return r},e.removeEmitHelper=function(t,r){var n,i=null===(n=t.emitNode)||void 0===n?void 0:n.helpers;return !!i&&e.orderedRemoveItem(i,r)},e.getEmitHelpers=function(e){var t;return null===(t=e.emitNode)||void 0===t?void 0:t.helpers},e.moveEmitHelpers=function(r,n,i){var a=r.emitNode,o=a&&a.helpers;if(e.some(o)){for(var s=t(n),c=0,l=0;l<o.length;l++){var u=o[l];i(u)?(c++,s.helpers=e.appendIfUnique(s.helpers,u)):c>0&&(o[l-c]=u);}c>0&&(o.length-=c);}},e.getSnippetElement=function(e){var t;return null===(t=e.emitNode)||void 0===t?void 0:t.snippetElement},e.setSnippetElement=function(e,r){return t(e).snippetElement=r,e},e.ignoreSourceNewlines=function(e){return t(e).flags|=134217728,e},e.setTypeNode=function(e,r){return t(e).typeNode=r,e},e.getTypeNode=function(e){var t;return null===(t=e.emitNode)||void 0===t?void 0:t.typeNode};}(t),function(e){function t(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r){for(var n="",i=0;i<t.length;i++)n+=e[i],n+=r(t[i]);return n+e[e.length-1]}}var r;e.createEmitHelperFactory=function(t){var r=t.factory,i=e.memoize((function(){return e.setEmitFlags(r.createTrue(),268435456)})),a=e.memoize((function(){return e.setEmitFlags(r.createFalse(),268435456)}));return {getUnscopedHelperName:o,createDecorateHelper:function(n,i,a,s){t.requestEmitHelper(e.decorateHelper);var c=[];return c.push(r.createArrayLiteralExpression(n,!0)),c.push(i),a&&(c.push(a),s&&c.push(s)),r.createCallExpression(o("__decorate"),void 0,c)},createMetadataHelper:function(n,i){return t.requestEmitHelper(e.metadataHelper),r.createCallExpression(o("__metadata"),void 0,[r.createStringLiteral(n),i])},createParamHelper:function(n,i,a){return t.requestEmitHelper(e.paramHelper),e.setTextRange(r.createCallExpression(o("__param"),void 0,[r.createNumericLiteral(i+""),n]),a)},createAssignHelper:function(n){return e.getEmitScriptTarget(t.getCompilerOptions())>=2?r.createCallExpression(r.createPropertyAccessExpression(r.createIdentifier("Object"),"assign"),void 0,n):(t.requestEmitHelper(e.assignHelper),r.createCallExpression(o("__assign"),void 0,n))},createAwaitHelper:function(n){return t.requestEmitHelper(e.awaitHelper),r.createCallExpression(o("__await"),void 0,[n])},createAsyncGeneratorHelper:function(n,i){return t.requestEmitHelper(e.awaitHelper),t.requestEmitHelper(e.asyncGeneratorHelper),(n.emitNode||(n.emitNode={})).flags|=786432,r.createCallExpression(o("__asyncGenerator"),void 0,[i?r.createThis():r.createVoidZero(),r.createIdentifier("arguments"),n])},createAsyncDelegatorHelper:function(n){return t.requestEmitHelper(e.awaitHelper),t.requestEmitHelper(e.asyncDelegator),r.createCallExpression(o("__asyncDelegator"),void 0,[n])},createAsyncValuesHelper:function(n){return t.requestEmitHelper(e.asyncValues),r.createCallExpression(o("__asyncValues"),void 0,[n])},createRestHelper:function(n,i,a,s){t.requestEmitHelper(e.restHelper);for(var c=[],l=0,u=0;u<i.length-1;u++){var _=e.getPropertyNameOfBindingOrAssignmentElement(i[u]);if(_)if(e.isComputedPropertyName(_)){e.Debug.assertIsDefined(a,"Encountered computed property name but 'computedTempVariables' argument was not provided.");var d=a[l];l++,c.push(r.createConditionalExpression(r.createTypeCheck(d,"symbol"),void 0,d,void 0,r.createAdd(d,r.createStringLiteral(""))));}else c.push(r.createStringLiteralFromNode(_));}return r.createCallExpression(o("__rest"),void 0,[n,e.setTextRange(r.createArrayLiteralExpression(c),s)])},createAwaiterHelper:function(n,i,a,s){t.requestEmitHelper(e.awaiterHelper);var c=r.createFunctionExpression(void 0,r.createToken(41),void 0,void 0,[],void 0,s);return (c.emitNode||(c.emitNode={})).flags|=786432,r.createCallExpression(o("__awaiter"),void 0,[n?r.createThis():r.createVoidZero(),i?r.createIdentifier("arguments"):r.createVoidZero(),a?e.createExpressionFromEntityName(r,a):r.createVoidZero(),c])},createExtendsHelper:function(n){return t.requestEmitHelper(e.extendsHelper),r.createCallExpression(o("__extends"),void 0,[n,r.createUniqueName("_super",48)])},createTemplateObjectHelper:function(n,i){return t.requestEmitHelper(e.templateObjectHelper),r.createCallExpression(o("__makeTemplateObject"),void 0,[n,i])},createSpreadArrayHelper:function(n,s,c){return t.requestEmitHelper(e.spreadArrayHelper),r.createCallExpression(o("__spreadArray"),void 0,[n,s,c?i():a()])},createValuesHelper:function(n){return t.requestEmitHelper(e.valuesHelper),r.createCallExpression(o("__values"),void 0,[n])},createReadHelper:function(n,i){return t.requestEmitHelper(e.readHelper),r.createCallExpression(o("__read"),void 0,void 0!==i?[n,r.createNumericLiteral(i+"")]:[n])},createGeneratorHelper:function(n){return t.requestEmitHelper(e.generatorHelper),r.createCallExpression(o("__generator"),void 0,[r.createThis(),n])},createCreateBindingHelper:function(i,a,s){return t.requestEmitHelper(e.createBindingHelper),r.createCallExpression(o("__createBinding"),void 0,n$4([r.createIdentifier("exports"),i,a],s?[s]:[],!0))},createImportStarHelper:function(n){return t.requestEmitHelper(e.importStarHelper),r.createCallExpression(o("__importStar"),void 0,[n])},createImportStarCallbackHelper:function(){return t.requestEmitHelper(e.importStarHelper),o("__importStar")},createImportDefaultHelper:function(n){return t.requestEmitHelper(e.importDefaultHelper),r.createCallExpression(o("__importDefault"),void 0,[n])},createExportStarHelper:function(n,i){return void 0===i&&(i=r.createIdentifier("exports")),t.requestEmitHelper(e.exportStarHelper),t.requestEmitHelper(e.createBindingHelper),r.createCallExpression(o("__exportStar"),void 0,[n,i])},createClassPrivateFieldGetHelper:function(n,i,a,s){var c;return t.requestEmitHelper(e.classPrivateFieldGetHelper),c=s?[n,i,r.createStringLiteral(a),s]:[n,i,r.createStringLiteral(a)],r.createCallExpression(o("__classPrivateFieldGet"),void 0,c)},createClassPrivateFieldSetHelper:function(n,i,a,s,c){var l;return t.requestEmitHelper(e.classPrivateFieldSetHelper),l=c?[n,i,a,r.createStringLiteral(s),c]:[n,i,a,r.createStringLiteral(s)],r.createCallExpression(o("__classPrivateFieldSet"),void 0,l)},createClassPrivateFieldInHelper:function(n,i){return t.requestEmitHelper(e.classPrivateFieldInHelper),r.createCallExpression(o("__classPrivateFieldIn"),void 0,[n,i])}};function o(t){return e.setEmitFlags(r.createIdentifier(t),4098)}},e.compareEmitHelpers=function(t,r){return t===r||t.priority===r.priority?0:void 0===t.priority?1:void 0===r.priority?-1:e.compareValues(t.priority,r.priority)},e.helperString=t,e.decorateHelper={name:"typescript:decorate",importName:"__decorate",scoped:!1,priority:2,text:'\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };'},e.metadataHelper={name:"typescript:metadata",importName:"__metadata",scoped:!1,priority:3,text:'\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);\n };'},e.paramHelper={name:"typescript:param",importName:"__param",scoped:!1,priority:4,text:"\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"},e.assignHelper={name:"typescript:assign",importName:"__assign",scoped:!1,priority:1,text:"\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"},e.awaitHelper={name:"typescript:await",importName:"__await",scoped:!1,text:"\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"},e.asyncGeneratorHelper={name:"typescript:asyncGenerator",importName:"__asyncGenerator",scoped:!1,dependencies:[e.awaitHelper],text:'\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume("next", value); }\n function reject(value) { resume("throw", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };'},e.asyncDelegator={name:"typescript:asyncDelegator",importName:"__asyncDelegator",scoped:!1,dependencies:[e.awaitHelper],text:'\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }\n };'},e.asyncValues={name:"typescript:asyncValues",importName:"__asyncValues",scoped:!1,text:'\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };'},e.restHelper={name:"typescript:rest",importName:"__rest",scoped:!1,text:'\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };'},e.awaiterHelper={name:"typescript:awaiter",importName:"__awaiter",scoped:!1,priority:5,text:'\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };'},e.extendsHelper={name:"typescript:extends",importName:"__extends",scoped:!1,priority:0,text:'\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();'},e.templateObjectHelper={name:"typescript:makeTemplateObject",importName:"__makeTemplateObject",scoped:!1,priority:0,text:'\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };'},e.readHelper={name:"typescript:read",importName:"__read",scoped:!1,text:'\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };'},e.spreadArrayHelper={name:"typescript:spreadArray",importName:"__spreadArray",scoped:!1,text:"\n var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n };"},e.valuesHelper={name:"typescript:values",importName:"__values",scoped:!1,text:'\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n };'},e.generatorHelper={name:"typescript:generator",importName:"__generator",scoped:!1,priority:6,text:'\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };'},e.createBindingHelper={name:"typescript:commonjscreatebinding",importName:"__createBinding",scoped:!1,priority:1,text:'\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n }) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n }));'},e.setModuleDefaultHelper={name:"typescript:commonjscreatevalue",importName:"__setModuleDefault",scoped:!1,priority:1,text:'\n var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, "default", { enumerable: true, value: v });\n }) : function(o, v) {\n o["default"] = v;\n });'},e.importStarHelper={name:"typescript:commonjsimportstar",importName:"__importStar",scoped:!1,dependencies:[e.createBindingHelper,e.setModuleDefaultHelper],priority:2,text:'\n var __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n };'},e.importDefaultHelper={name:"typescript:commonjsimportdefault",importName:"__importDefault",scoped:!1,text:'\n var __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { "default": mod };\n };'},e.exportStarHelper={name:"typescript:export-star",importName:"__exportStar",scoped:!1,dependencies:[e.createBindingHelper],priority:2,text:'\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n };'},e.classPrivateFieldGetHelper={name:"typescript:classPrivateFieldGet",importName:"__classPrivateFieldGet",scoped:!1,text:'\n var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");\n return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);\n };'},e.classPrivateFieldSetHelper={name:"typescript:classPrivateFieldSet",importName:"__classPrivateFieldSet",scoped:!1,text:'\n var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === "m") throw new TypeError("Private method is not writable");\n if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");\n return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n };'},e.classPrivateFieldInHelper={name:"typescript:classPrivateFieldIn",importName:"__classPrivateFieldIn",scoped:!1,text:'\n var __classPrivateFieldIn = (this && this.__classPrivateFieldIn) || function(state, receiver) {\n if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use \'in\' operator on non-object");\n return typeof state === "function" ? receiver === state : state.has(receiver);\n };'},e.getAllUnscopedEmitHelpers=function(){return r||(r=e.arrayToMap([e.decorateHelper,e.metadataHelper,e.paramHelper,e.assignHelper,e.awaitHelper,e.asyncGeneratorHelper,e.asyncDelegator,e.asyncValues,e.restHelper,e.awaiterHelper,e.extendsHelper,e.templateObjectHelper,e.spreadArrayHelper,e.valuesHelper,e.readHelper,e.generatorHelper,e.importStarHelper,e.importDefaultHelper,e.exportStarHelper,e.classPrivateFieldGetHelper,e.classPrivateFieldSetHelper,e.classPrivateFieldInHelper,e.createBindingHelper,e.setModuleDefaultHelper],(function(e){return e.name})))},e.asyncSuperHelper={name:"typescript:async-super",scoped:!0,text:t(a(["\n const "," = name => super[name];"],["\n const "," = name => super[name];"]),"_superIndex")},e.advancedAsyncSuperHelper={name:"typescript:advanced-async-super",scoped:!0,text:t(a(["\n const "," = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"],["\n const "," = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]),"_superIndex")},e.isCallToHelper=function(t,r){return e.isCallExpression(t)&&e.isIdentifier(t.expression)&&0!=(4096&e.getEmitFlags(t.expression))&&t.expression.escapedText===r};}(t),function(e){e.isNumericLiteral=function(e){return 8===e.kind},e.isBigIntLiteral=function(e){return 9===e.kind},e.isStringLiteral=function(e){return 10===e.kind},e.isJsxText=function(e){return 11===e.kind},e.isRegularExpressionLiteral=function(e){return 13===e.kind},e.isNoSubstitutionTemplateLiteral=function(e){return 14===e.kind},e.isTemplateHead=function(e){return 15===e.kind},e.isTemplateMiddle=function(e){return 16===e.kind},e.isTemplateTail=function(e){return 17===e.kind},e.isDotDotDotToken=function(e){return 25===e.kind},e.isCommaToken=function(e){return 27===e.kind},e.isPlusToken=function(e){return 39===e.kind},e.isMinusToken=function(e){return 40===e.kind},e.isAsteriskToken=function(e){return 41===e.kind},e.isExclamationToken=function(e){return 53===e.kind},e.isQuestionToken=function(e){return 57===e.kind},e.isColonToken=function(e){return 58===e.kind},e.isQuestionDotToken=function(e){return 28===e.kind},e.isEqualsGreaterThanToken=function(e){return 38===e.kind},e.isIdentifier=function(e){return 79===e.kind},e.isPrivateIdentifier=function(e){return 80===e.kind},e.isExportModifier=function(e){return 93===e.kind},e.isAsyncModifier=function(e){return 131===e.kind},e.isAssertsKeyword=function(e){return 128===e.kind},e.isAwaitKeyword=function(e){return 132===e.kind},e.isReadonlyKeyword=function(e){return 145===e.kind},e.isStaticModifier=function(e){return 124===e.kind},e.isAbstractModifier=function(e){return 126===e.kind},e.isSuperKeyword=function(e){return 106===e.kind},e.isImportKeyword=function(e){return 100===e.kind},e.isQualifiedName=function(e){return 161===e.kind},e.isComputedPropertyName=function(e){return 162===e.kind},e.isTypeParameterDeclaration=function(e){return 163===e.kind},e.isParameter=function(e){return 164===e.kind},e.isDecorator=function(e){return 165===e.kind},e.isPropertySignature=function(e){return 166===e.kind},e.isPropertyDeclaration=function(e){return 167===e.kind},e.isMethodSignature=function(e){return 168===e.kind},e.isMethodDeclaration=function(e){return 169===e.kind},e.isClassStaticBlockDeclaration=function(e){return 170===e.kind},e.isConstructorDeclaration=function(e){return 171===e.kind},e.isGetAccessorDeclaration=function(e){return 172===e.kind},e.isSetAccessorDeclaration=function(e){return 173===e.kind},e.isCallSignatureDeclaration=function(e){return 174===e.kind},e.isConstructSignatureDeclaration=function(e){return 175===e.kind},e.isIndexSignatureDeclaration=function(e){return 176===e.kind},e.isTypePredicateNode=function(e){return 177===e.kind},e.isTypeReferenceNode=function(e){return 178===e.kind},e.isFunctionTypeNode=function(e){return 179===e.kind},e.isConstructorTypeNode=function(e){return 180===e.kind},e.isTypeQueryNode=function(e){return 181===e.kind},e.isTypeLiteralNode=function(e){return 182===e.kind},e.isArrayTypeNode=function(e){return 183===e.kind},e.isTupleTypeNode=function(e){return 184===e.kind},e.isNamedTupleMember=function(e){return 197===e.kind},e.isOptionalTypeNode=function(e){return 185===e.kind},e.isRestTypeNode=function(e){return 186===e.kind},e.isUnionTypeNode=function(e){return 187===e.kind},e.isIntersectionTypeNode=function(e){return 188===e.kind},e.isConditionalTypeNode=function(e){return 189===e.kind},e.isInferTypeNode=function(e){return 190===e.kind},e.isParenthesizedTypeNode=function(e){return 191===e.kind},e.isThisTypeNode=function(e){return 192===e.kind},e.isTypeOperatorNode=function(e){return 193===e.kind},e.isIndexedAccessTypeNode=function(e){return 194===e.kind},e.isMappedTypeNode=function(e){return 195===e.kind},e.isLiteralTypeNode=function(e){return 196===e.kind},e.isImportTypeNode=function(e){return 200===e.kind},e.isTemplateLiteralTypeSpan=function(e){return 199===e.kind},e.isTemplateLiteralTypeNode=function(e){return 198===e.kind},e.isObjectBindingPattern=function(e){return 201===e.kind},e.isArrayBindingPattern=function(e){return 202===e.kind},e.isBindingElement=function(e){return 203===e.kind},e.isArrayLiteralExpression=function(e){return 204===e.kind},e.isObjectLiteralExpression=function(e){return 205===e.kind},e.isPropertyAccessExpression=function(e){return 206===e.kind},e.isElementAccessExpression=function(e){return 207===e.kind},e.isCallExpression=function(e){return 208===e.kind},e.isNewExpression=function(e){return 209===e.kind},e.isTaggedTemplateExpression=function(e){return 210===e.kind},e.isTypeAssertionExpression=function(e){return 211===e.kind},e.isParenthesizedExpression=function(e){return 212===e.kind},e.isFunctionExpression=function(e){return 213===e.kind},e.isArrowFunction=function(e){return 214===e.kind},e.isDeleteExpression=function(e){return 215===e.kind},e.isTypeOfExpression=function(e){return 216===e.kind},e.isVoidExpression=function(e){return 217===e.kind},e.isAwaitExpression=function(e){return 218===e.kind},e.isPrefixUnaryExpression=function(e){return 219===e.kind},e.isPostfixUnaryExpression=function(e){return 220===e.kind},e.isBinaryExpression=function(e){return 221===e.kind},e.isConditionalExpression=function(e){return 222===e.kind},e.isTemplateExpression=function(e){return 223===e.kind},e.isYieldExpression=function(e){return 224===e.kind},e.isSpreadElement=function(e){return 225===e.kind},e.isClassExpression=function(e){return 226===e.kind},e.isOmittedExpression=function(e){return 227===e.kind},e.isExpressionWithTypeArguments=function(e){return 228===e.kind},e.isAsExpression=function(e){return 229===e.kind},e.isNonNullExpression=function(e){return 230===e.kind},e.isMetaProperty=function(e){return 231===e.kind},e.isSyntheticExpression=function(e){return 232===e.kind},e.isPartiallyEmittedExpression=function(e){return 350===e.kind},e.isCommaListExpression=function(e){return 351===e.kind},e.isTemplateSpan=function(e){return 233===e.kind},e.isSemicolonClassElement=function(e){return 234===e.kind},e.isBlock=function(e){return 235===e.kind},e.isVariableStatement=function(e){return 237===e.kind},e.isEmptyStatement=function(e){return 236===e.kind},e.isExpressionStatement=function(e){return 238===e.kind},e.isIfStatement=function(e){return 239===e.kind},e.isDoStatement=function(e){return 240===e.kind},e.isWhileStatement=function(e){return 241===e.kind},e.isForStatement=function(e){return 242===e.kind},e.isForInStatement=function(e){return 243===e.kind},e.isForOfStatement=function(e){return 244===e.kind},e.isContinueStatement=function(e){return 245===e.kind},e.isBreakStatement=function(e){return 246===e.kind},e.isReturnStatement=function(e){return 247===e.kind},e.isWithStatement=function(e){return 248===e.kind},e.isSwitchStatement=function(e){return 249===e.kind},e.isLabeledStatement=function(e){return 250===e.kind},e.isThrowStatement=function(e){return 251===e.kind},e.isTryStatement=function(e){return 252===e.kind},e.isDebuggerStatement=function(e){return 253===e.kind},e.isVariableDeclaration=function(e){return 254===e.kind},e.isVariableDeclarationList=function(e){return 255===e.kind},e.isFunctionDeclaration=function(e){return 256===e.kind},e.isClassDeclaration=function(e){return 257===e.kind},e.isInterfaceDeclaration=function(e){return 258===e.kind},e.isTypeAliasDeclaration=function(e){return 259===e.kind},e.isEnumDeclaration=function(e){return 260===e.kind},e.isModuleDeclaration=function(e){return 261===e.kind},e.isModuleBlock=function(e){return 262===e.kind},e.isCaseBlock=function(e){return 263===e.kind},e.isNamespaceExportDeclaration=function(e){return 264===e.kind},e.isImportEqualsDeclaration=function(e){return 265===e.kind},e.isImportDeclaration=function(e){return 266===e.kind},e.isImportClause=function(e){return 267===e.kind},e.isImportTypeAssertionContainer=function(e){return 295===e.kind},e.isAssertClause=function(e){return 293===e.kind},e.isAssertEntry=function(e){return 294===e.kind},e.isNamespaceImport=function(e){return 268===e.kind},e.isNamespaceExport=function(e){return 274===e.kind},e.isNamedImports=function(e){return 269===e.kind},e.isImportSpecifier=function(e){return 270===e.kind},e.isExportAssignment=function(e){return 271===e.kind},e.isExportDeclaration=function(e){return 272===e.kind},e.isNamedExports=function(e){return 273===e.kind},e.isExportSpecifier=function(e){return 275===e.kind},e.isMissingDeclaration=function(e){return 276===e.kind},e.isNotEmittedStatement=function(e){return 349===e.kind},e.isSyntheticReference=function(e){return 354===e.kind},e.isMergeDeclarationMarker=function(e){return 352===e.kind},e.isEndOfDeclarationMarker=function(e){return 353===e.kind},e.isExternalModuleReference=function(e){return 277===e.kind},e.isJsxElement=function(e){return 278===e.kind},e.isJsxSelfClosingElement=function(e){return 279===e.kind},e.isJsxOpeningElement=function(e){return 280===e.kind},e.isJsxClosingElement=function(e){return 281===e.kind},e.isJsxFragment=function(e){return 282===e.kind},e.isJsxOpeningFragment=function(e){return 283===e.kind},e.isJsxClosingFragment=function(e){return 284===e.kind},e.isJsxAttribute=function(e){return 285===e.kind},e.isJsxAttributes=function(e){return 286===e.kind},e.isJsxSpreadAttribute=function(e){return 287===e.kind},e.isJsxExpression=function(e){return 288===e.kind},e.isCaseClause=function(e){return 289===e.kind},e.isDefaultClause=function(e){return 290===e.kind},e.isHeritageClause=function(e){return 291===e.kind},e.isCatchClause=function(e){return 292===e.kind},e.isPropertyAssignment=function(e){return 296===e.kind},e.isShorthandPropertyAssignment=function(e){return 297===e.kind},e.isSpreadAssignment=function(e){return 298===e.kind},e.isEnumMember=function(e){return 299===e.kind},e.isUnparsedPrepend=function(e){return 301===e.kind},e.isSourceFile=function(e){return 305===e.kind},e.isBundle=function(e){return 306===e.kind},e.isUnparsedSource=function(e){return 307===e.kind},e.isJSDocTypeExpression=function(e){return 309===e.kind},e.isJSDocNameReference=function(e){return 310===e.kind},e.isJSDocMemberName=function(e){return 311===e.kind},e.isJSDocLink=function(e){return 324===e.kind},e.isJSDocLinkCode=function(e){return 325===e.kind},e.isJSDocLinkPlain=function(e){return 326===e.kind},e.isJSDocAllType=function(e){return 312===e.kind},e.isJSDocUnknownType=function(e){return 313===e.kind},e.isJSDocNullableType=function(e){return 314===e.kind},e.isJSDocNonNullableType=function(e){return 315===e.kind},e.isJSDocOptionalType=function(e){return 316===e.kind},e.isJSDocFunctionType=function(e){return 317===e.kind},e.isJSDocVariadicType=function(e){return 318===e.kind},e.isJSDocNamepathType=function(e){return 319===e.kind},e.isJSDoc=function(e){return 320===e.kind},e.isJSDocTypeLiteral=function(e){return 322===e.kind},e.isJSDocSignature=function(e){return 323===e.kind},e.isJSDocAugmentsTag=function(e){return 328===e.kind},e.isJSDocAuthorTag=function(e){return 330===e.kind},e.isJSDocClassTag=function(e){return 332===e.kind},e.isJSDocCallbackTag=function(e){return 338===e.kind},e.isJSDocPublicTag=function(e){return 333===e.kind},e.isJSDocPrivateTag=function(e){return 334===e.kind},e.isJSDocProtectedTag=function(e){return 335===e.kind},e.isJSDocReadonlyTag=function(e){return 336===e.kind},e.isJSDocOverrideTag=function(e){return 337===e.kind},e.isJSDocDeprecatedTag=function(e){return 331===e.kind},e.isJSDocSeeTag=function(e){return 346===e.kind},e.isJSDocEnumTag=function(e){return 339===e.kind},e.isJSDocParameterTag=function(e){return 340===e.kind},e.isJSDocReturnTag=function(e){return 341===e.kind},e.isJSDocThisTag=function(e){return 342===e.kind},e.isJSDocTypeTag=function(e){return 343===e.kind},e.isJSDocTemplateTag=function(e){return 344===e.kind},e.isJSDocTypedefTag=function(e){return 345===e.kind},e.isJSDocUnknownTag=function(e){return 327===e.kind},e.isJSDocPropertyTag=function(e){return 347===e.kind},e.isJSDocImplementsTag=function(e){return 329===e.kind},e.isSyntaxList=function(e){return 348===e.kind};}(t),function(e){function t(t,r,n,i){if(e.isComputedPropertyName(n))return e.setTextRange(t.createElementAccessExpression(r,n.expression),i);var a=e.setTextRange(e.isMemberName(n)?t.createPropertyAccessExpression(r,n):t.createElementAccessExpression(r,n),n);return e.getOrCreateEmitNode(a).flags|=64,a}function r(t,r){var n=e.parseNodeFactory.createIdentifier(t||"React");return e.setParent(n,e.getParseTreeNode(r)),n}function i(t,n,a){if(e.isQualifiedName(n)){var o=i(t,n.left,a),s=t.createIdentifier(e.idText(n.right));return s.escapedText=n.right.escapedText,t.createPropertyAccessExpression(o,s)}return r(e.idText(n),a)}function a(e,t,n,a){return t?i(e,t,a):e.createPropertyAccessExpression(r(n,a),"createElement")}function o(t,r){return e.isIdentifier(r)?t.createStringLiteralFromNode(r):e.isComputedPropertyName(r)?e.setParent(e.setTextRange(t.cloneNode(r.expression),r.expression),r.expression.parent):e.setParent(e.setTextRange(t.cloneNode(r),r),r.parent)}function s(t){return e.isStringLiteral(t.expression)&&"use strict"===t.expression.text}function c(t){return e.isParenthesizedExpression(t)&&e.isInJSFile(t)&&!!e.getJSDocTypeTag(t)}function l(e,t){switch(void 0===t&&(t=15),e.kind){case 212:return !(16&t&&c(e))&&0!=(1&t);case 211:case 229:return 0!=(2&t);case 230:return 0!=(4&t);case 350:return 0!=(8&t)}return !1}function u(e,t){for(void 0===t&&(t=15);l(e,t);)e=e.expression;return e}function _(t){return e.setStartsOnNewLine(t,!0)}function d(t){var r=e.getOriginalNode(t,e.isSourceFile),n=r&&r.emitNode;return n&&n.externalHelpersModuleName}function p(t,r,n,i,a){if(n.importHelpers&&e.isEffectiveExternalModule(r,n)){var o=d(r);if(o)return o;var s=e.getEmitModuleKind(n),c=(i||e.getESModuleInterop(n)&&a)&&s!==e.ModuleKind.System&&(s<e.ModuleKind.ES2015||r.impliedNodeFormat===e.ModuleKind.CommonJS);if(!c){var l=e.getEmitHelpers(r);if(l)for(var u=0,_=l;u<_.length;u++)if(!_[u].scoped){c=!0;break}}if(c){var p=e.getOriginalNode(r,e.isSourceFile),f=e.getOrCreateEmitNode(p);return f.externalHelpersModuleName||(f.externalHelpersModuleName=t.createUniqueName(e.externalHelpersModuleNameText))}}}function f(t,r,n,i){if(r)return r.moduleName?t.createStringLiteral(r.moduleName):!r.isDeclarationFile&&e.outFile(i)?t.createStringLiteral(e.getExternalModuleNameFromPath(n,r.fileName)):void 0}function g(t){if(e.isDeclarationBindingElement(t))return t.name;if(!e.isObjectLiteralElementLike(t))return e.isAssignmentExpression(t,!0)?g(t.left):e.isSpreadElement(t)?g(t.expression):t;switch(t.kind){case 296:return g(t.initializer);case 297:return t.name;case 298:return g(t.expression)}}function m(t){switch(t.kind){case 203:if(t.propertyName){var r=t.propertyName;return e.isPrivateIdentifier(r)?e.Debug.failBadSyntaxKind(r):e.isComputedPropertyName(r)&&y(r.expression)?r.expression:r}break;case 296:if(t.name)return r=t.name,e.isPrivateIdentifier(r)?e.Debug.failBadSyntaxKind(r):e.isComputedPropertyName(r)&&y(r.expression)?r.expression:r;break;case 298:return t.name&&e.isPrivateIdentifier(t.name)?e.Debug.failBadSyntaxKind(t.name):t.name}var n=g(t);if(n&&e.isPropertyName(n))return n}function y(e){var t=e.kind;return 10===t||8===t}var v;e.createEmptyExports=function(e){return e.createExportDeclaration(void 0,void 0,!1,e.createNamedExports([]),void 0)},e.createMemberAccessForPropertyName=t,e.createJsxFactoryExpression=a,e.createExpressionForJsxElement=function(t,r,n,i,a,o){var s=[n];if(i&&s.push(i),a&&a.length>0)if(i||s.push(t.createNull()),a.length>1)for(var c=0,l=a;c<l.length;c++){var u=l[c];_(u),s.push(u);}else s.push(a[0]);return e.setTextRange(t.createCallExpression(r,void 0,s),o)},e.createExpressionForJsxFragment=function(t,n,o,s,c,l,u){var d=[function(e,t,n,a){return t?i(e,t,a):e.createPropertyAccessExpression(r(n,a),"Fragment")}(t,o,s,l),t.createNull()];if(c&&c.length>0)if(c.length>1)for(var p=0,f=c;p<f.length;p++){var g=f[p];_(g),d.push(g);}else d.push(c[0]);return e.setTextRange(t.createCallExpression(a(t,n,s,l),void 0,d),u)},e.createForOfBindingStatement=function(t,r,n){if(e.isVariableDeclarationList(r)){var i=e.first(r.declarations),a=t.updateVariableDeclaration(i,i.name,void 0,void 0,n);return e.setTextRange(t.createVariableStatement(void 0,t.updateVariableDeclarationList(r,[a])),r)}var o=e.setTextRange(t.createAssignment(r,n),r);return e.setTextRange(t.createExpressionStatement(o),r)},e.insertLeadingStatement=function(t,r,i){return e.isBlock(r)?t.updateBlock(r,e.setTextRange(t.createNodeArray(n$4([i],r.statements,!0)),r.statements)):t.createBlock(t.createNodeArray([r,i]),!0)},e.createExpressionFromEntityName=function t(r,n){if(e.isQualifiedName(n)){var i=t(r,n.left),a=e.setParent(e.setTextRange(r.cloneNode(n.right),n.right),n.right.parent);return e.setTextRange(r.createPropertyAccessExpression(i,a),n)}return e.setParent(e.setTextRange(r.cloneNode(n),n),n.parent)},e.createExpressionForPropertyName=o,e.createExpressionForObjectLiteralElementLike=function(r,n,i,a){switch(i.name&&e.isPrivateIdentifier(i.name)&&e.Debug.failBadSyntaxKind(i.name,"Private identifiers are not allowed in object literals."),i.kind){case 172:case 173:return function(t,r,n,i,a){var s=e.getAllAccessorDeclarations(r,n),c=s.firstAccessor,l=s.getAccessor,u=s.setAccessor;if(n===c)return e.setTextRange(t.createObjectDefinePropertyCall(i,o(t,n.name),t.createPropertyDescriptor({enumerable:t.createFalse(),configurable:!0,get:l&&e.setTextRange(e.setOriginalNode(t.createFunctionExpression(l.modifiers,void 0,void 0,void 0,l.parameters,void 0,l.body),l),l),set:u&&e.setTextRange(e.setOriginalNode(t.createFunctionExpression(u.modifiers,void 0,void 0,void 0,u.parameters,void 0,u.body),u),u)},!a)),c)}(r,n.properties,i,a,!!n.multiLine);case 296:return function(r,n,i){return e.setOriginalNode(e.setTextRange(r.createAssignment(t(r,i,n.name,n.name),n.initializer),n),n)}(r,i,a);case 297:return function(r,n,i){return e.setOriginalNode(e.setTextRange(r.createAssignment(t(r,i,n.name,n.name),r.cloneNode(n.name)),n),n)}(r,i,a);case 169:return function(r,n,i){return e.setOriginalNode(e.setTextRange(r.createAssignment(t(r,i,n.name,n.name),e.setOriginalNode(e.setTextRange(r.createFunctionExpression(n.modifiers,n.asteriskToken,void 0,void 0,n.parameters,void 0,n.body),n),n)),n),n)}(r,i,a)}},e.expandPreOrPostfixIncrementOrDecrementExpression=function(t,r,n,i,a){var o=r.operator;e.Debug.assert(45===o||46===o,"Expected 'node' to be a pre- or post-increment or pre- or post-decrement expression");var s=t.createTempVariable(i);n=t.createAssignment(s,n),e.setTextRange(n,r.operand);var c=e.isPrefixUnaryExpression(r)?t.createPrefixUnaryExpression(o,s):t.createPostfixUnaryExpression(s,o);return e.setTextRange(c,r),a&&(c=t.createAssignment(a,c),e.setTextRange(c,r)),n=t.createComma(n,c),e.setTextRange(n,r),e.isPostfixUnaryExpression(r)&&(n=t.createComma(n,s),e.setTextRange(n,r)),n},e.isInternalName=function(t){return 0!=(32768&e.getEmitFlags(t))},e.isLocalName=function(t){return 0!=(16384&e.getEmitFlags(t))},e.isExportName=function(t){return 0!=(8192&e.getEmitFlags(t))},e.findUseStrictPrologue=function(t){for(var r=0,n=t;r<n.length;r++){var i=n[r];if(!e.isPrologueDirective(i))break;if(s(i))return i}},e.startsWithUseStrict=function(t){var r=e.firstOrUndefined(t);return void 0!==r&&e.isPrologueDirective(r)&&s(r)},e.isCommaSequence=function(e){return 221===e.kind&&27===e.operatorToken.kind||351===e.kind},e.isJSDocTypeAssertion=c,e.getJSDocTypeAssertionType=function(t){var r=e.getJSDocType(t);return e.Debug.assertIsDefined(r),r},e.isOuterExpression=l,e.skipOuterExpressions=u,e.skipAssertions=function(e){return u(e,6)},e.startOnNewLine=_,e.getExternalHelpersModuleName=d,e.hasRecordedExternalHelpers=function(t){var r=e.getOriginalNode(t,e.isSourceFile),n=r&&r.emitNode;return !(!n||!n.externalHelpersModuleName&&!n.externalHelpers)},e.createExternalHelpersImportDeclarationIfNeeded=function(t,r,n,i,a,o,s){if(i.importHelpers&&e.isEffectiveExternalModule(n,i)){var c=void 0,l=e.getEmitModuleKind(i);if(l>=e.ModuleKind.ES2015&&l<=e.ModuleKind.ESNext||n.impliedNodeFormat===e.ModuleKind.ESNext){var u=e.getEmitHelpers(n);if(u){for(var _=[],d=0,f=u;d<f.length;d++){var g=f[d];if(!g.scoped){var m=g.importName;m&&e.pushIfUnique(_,m);}}if(e.some(_)){_.sort(e.compareStringsCaseSensitive),c=t.createNamedImports(e.map(_,(function(i){return e.isFileLevelUniqueName(n,i)?t.createImportSpecifier(!1,void 0,t.createIdentifier(i)):t.createImportSpecifier(!1,t.createIdentifier(i),r.getUnscopedHelperName(i))})));var y=e.getOriginalNode(n,e.isSourceFile);e.getOrCreateEmitNode(y).externalHelpers=!0;}}}else {var v=p(t,n,i,a,o||s);v&&(c=t.createNamespaceImport(v));}if(c){var h=t.createImportDeclaration(void 0,void 0,t.createImportClause(!1,void 0,c),t.createStringLiteral(e.externalHelpersModuleNameText),void 0);return e.addEmitFlags(h,67108864),h}}},e.getOrCreateExternalHelpersModuleNameIfNeeded=p,e.getLocalNameForExternalImport=function(t,r,n){var i=e.getNamespaceDeclarationNode(r);if(i&&!e.isDefaultImport(r)&&!e.isExportNamespaceAsDefaultDeclaration(r)){var a=i.name;return e.isGeneratedIdentifier(a)?a:t.createIdentifier(e.getSourceTextOfNodeFromSourceFile(n,a)||e.idText(a))}return 266===r.kind&&r.importClause||272===r.kind&&r.moduleSpecifier?t.getGeneratedNameForNode(r):void 0},e.getExternalModuleNameLiteral=function(t,r,n,i,a,o){var s=e.getExternalModuleName(r);if(s&&e.isStringLiteral(s))return function(e,t,r,n,i){return f(r,n.getExternalModuleFileFromDeclaration(e),t,i)}(r,i,t,a,o)||function(e,t,r){var n=r.renamedDependencies&&r.renamedDependencies.get(t.text);return n?e.createStringLiteral(n):void 0}(t,s,n)||t.cloneNode(s)},e.tryGetModuleNameFromFile=f,e.getInitializerOfBindingOrAssignmentElement=function t(r){if(e.isDeclarationBindingElement(r))return r.initializer;if(e.isPropertyAssignment(r)){var n=r.initializer;return e.isAssignmentExpression(n,!0)?n.right:void 0}return e.isShorthandPropertyAssignment(r)?r.objectAssignmentInitializer:e.isAssignmentExpression(r,!0)?r.right:e.isSpreadElement(r)?t(r.expression):void 0},e.getTargetOfBindingOrAssignmentElement=g,e.getRestIndicatorOfBindingOrAssignmentElement=function(e){switch(e.kind){case 164:case 203:return e.dotDotDotToken;case 225:case 298:return e}},e.getPropertyNameOfBindingOrAssignmentElement=function(t){var r=m(t);return e.Debug.assert(!!r||e.isSpreadAssignment(t),"Invalid property name for binding element."),r},e.tryGetPropertyNameOfBindingOrAssignmentElement=m,e.getElementsOfBindingOrAssignmentPattern=function(e){switch(e.kind){case 201:case 202:case 204:return e.elements;case 205:return e.properties}},e.getJSDocTypeAliasName=function(t){if(t)for(var r=t;;){if(e.isIdentifier(r)||!r.body)return e.isIdentifier(r)?r:r.name;r=r.body;}},e.canHaveModifiers=function(e){var t=e.kind;return 164===t||166===t||167===t||168===t||169===t||171===t||172===t||173===t||176===t||213===t||214===t||226===t||237===t||256===t||257===t||258===t||259===t||260===t||261===t||265===t||266===t||271===t||272===t},e.isTypeNodeOrTypeParameterDeclaration=e.or(e.isTypeNode,e.isTypeParameterDeclaration),e.isQuestionOrExclamationToken=e.or(e.isQuestionToken,e.isExclamationToken),e.isIdentifierOrThisTypeNode=e.or(e.isIdentifier,e.isThisTypeNode),e.isReadonlyKeywordOrPlusOrMinusToken=e.or(e.isReadonlyKeyword,e.isPlusToken,e.isMinusToken),e.isQuestionOrPlusOrMinusToken=e.or(e.isQuestionToken,e.isPlusToken,e.isMinusToken),e.isModuleName=e.or(e.isIdentifier,e.isStringLiteral),e.isLiteralTypeLikeExpression=function(t){var r=t.kind;return 104===r||110===r||95===r||e.isLiteralExpression(t)||e.isPrefixUnaryExpression(t)},e.isBinaryOperatorToken=function(t){return function(t){return 60===t||function(e){return function(e){return 55===e||56===e}(e)||function(e){return function(e){return 50===e||51===e||52===e}(e)||function(e){return function(e){return 34===e||36===e||35===e||37===e}(e)||function(e){return function(e){return 29===e||32===e||31===e||33===e||102===e||101===e}(e)||function(e){return function(e){return 47===e||48===e||49===e}(e)||function(e){return function(e){return 39===e||40===e}(e)||function(e){return function(e){return 42===e}(e)||function(e){return 41===e||43===e||44===e}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(t)||e.isAssignmentOperator(t)}(r=t.kind)||27===r;var r;},function(t){function r(t,n,i,a,o,s,l){var u=n>0?o[n-1]:void 0;return e.Debug.assertEqual(i[n],r),o[n]=t.onEnter(a[n],u,l),i[n]=c(t,r),n}function n(t,r,i,a,o,s,_){e.Debug.assertEqual(i[r],n),e.Debug.assertIsDefined(t.onLeft),i[r]=c(t,n);var d=t.onLeft(a[r].left,o[r],a[r]);return d?(u(r,a,d),l(r,i,a,o,d)):r}function i(t,r,n,a,o,s,l){return e.Debug.assertEqual(n[r],i),e.Debug.assertIsDefined(t.onOperator),n[r]=c(t,i),t.onOperator(a[r].operatorToken,o[r],a[r]),r}function a(t,r,n,i,o,s,_){e.Debug.assertEqual(n[r],a),e.Debug.assertIsDefined(t.onRight),n[r]=c(t,a);var d=t.onRight(i[r].right,o[r],i[r]);return d?(u(r,i,d),l(r,n,i,o,d)):r}function o(t,r,n,i,a,s,l){e.Debug.assertEqual(n[r],o),n[r]=c(t,o);var u=t.onExit(i[r],a[r]);if(r>0){if(r--,t.foldState){var _=n[r]===o?"right":"left";a[r]=t.foldState(a[r],u,_);}}else s.value=u;return r}function s(t,r,n,i,a,o,c){return e.Debug.assertEqual(n[r],s),r}function c(t,c){switch(c){case r:if(t.onLeft)return n;case n:if(t.onOperator)return i;case i:if(t.onRight)return a;case a:return o;case o:case s:return s;default:e.Debug.fail("Invalid state");}}function l(e,t,n,i,a){return t[++e]=r,n[e]=a,i[e]=void 0,e}function u(t,r,n){if(e.Debug.shouldAssert(2))for(;t>=0;)e.Debug.assert(r[t]!==n,"Circular traversal detected."),t--;}t.enter=r,t.left=n,t.operator=i,t.right=a,t.exit=o,t.done=s,t.nextState=c;}(v||(v={}));var h=function(e,t,r,n,i,a){this.onEnter=e,this.onLeft=t,this.onOperator=r,this.onRight=n,this.onExit=i,this.foldState=a;};e.createBinaryExpressionTrampoline=function(t,r,n,i,a,o){var s=new h(t,r,n,i,a,o);return function(t,r){for(var n={value:void 0},i=[v.enter],a=[t],o=[void 0],c=0;i[c]!==v.done;)c=i[c](s,c,i,a,o,n,r);return e.Debug.assertEqual(c,0),n.value}};}(t),function(e){e.setTextRange=function(t,r){return r?e.setTextRangePosEnd(t,r.pos,r.end):t};}(t),function(e){var t,r,a,o,s,c,l,u,_;function d(e,t){return t&&e(t)}function p(e,t,r){if(r){if(t)return t(r);for(var n=0,i=r;n<i.length;n++){var a=e(i[n]);if(a)return a}}}function f(e,t){return 42===e.charCodeAt(t+1)&&42===e.charCodeAt(t+2)&&47!==e.charCodeAt(t+3)}function g(t){return e.forEach(t.statements,m)||function(e){return 4194304&e.flags?y(e):void 0}(t)}function m(t){return function(t,r){return e.some(t.modifiers,(function(e){return 93===e.kind}))}(t)||e.isImportEqualsDeclaration(t)&&e.isExternalModuleReference(t.moduleReference)||e.isImportDeclaration(t)||e.isExportAssignment(t)||e.isExportDeclaration(t)?t:void 0}function y(t){return function(t){return e.isMetaProperty(t)&&100===t.keywordToken&&"meta"===t.name.escapedText}(t)?t:v(t,y)}function v(t,r,n){if(t&&!(t.kind<=160))switch(t.kind){case 161:return d(r,t.left)||d(r,t.right);case 163:return p(r,n,t.modifiers)||d(r,t.name)||d(r,t.constraint)||d(r,t.default)||d(r,t.expression);case 297:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||d(r,t.questionToken)||d(r,t.exclamationToken)||d(r,t.equalsToken)||d(r,t.objectAssignmentInitializer);case 298:return d(r,t.expression);case 164:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.dotDotDotToken)||d(r,t.name)||d(r,t.questionToken)||d(r,t.type)||d(r,t.initializer);case 167:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||d(r,t.questionToken)||d(r,t.exclamationToken)||d(r,t.type)||d(r,t.initializer);case 166:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||d(r,t.questionToken)||d(r,t.type)||d(r,t.initializer);case 296:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||d(r,t.questionToken)||d(r,t.initializer);case 254:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||d(r,t.exclamationToken)||d(r,t.type)||d(r,t.initializer);case 203:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.dotDotDotToken)||d(r,t.propertyName)||d(r,t.name)||d(r,t.initializer);case 179:case 180:case 174:case 175:case 176:return p(r,n,t.decorators)||p(r,n,t.modifiers)||p(r,n,t.typeParameters)||p(r,n,t.parameters)||d(r,t.type);case 169:case 168:case 171:case 172:case 173:case 213:case 256:case 214:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.asteriskToken)||d(r,t.name)||d(r,t.questionToken)||d(r,t.exclamationToken)||p(r,n,t.typeParameters)||p(r,n,t.parameters)||d(r,t.type)||d(r,t.equalsGreaterThanToken)||d(r,t.body);case 170:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.body);case 178:return d(r,t.typeName)||p(r,n,t.typeArguments);case 177:return d(r,t.assertsModifier)||d(r,t.parameterName)||d(r,t.type);case 181:return d(r,t.exprName)||p(r,n,t.typeArguments);case 182:return p(r,n,t.members);case 183:return d(r,t.elementType);case 184:return p(r,n,t.elements);case 187:case 188:return p(r,n,t.types);case 189:return d(r,t.checkType)||d(r,t.extendsType)||d(r,t.trueType)||d(r,t.falseType);case 190:return d(r,t.typeParameter);case 200:return d(r,t.argument)||d(r,t.assertions)||d(r,t.qualifier)||p(r,n,t.typeArguments);case 295:return d(r,t.assertClause);case 191:case 193:return d(r,t.type);case 194:return d(r,t.objectType)||d(r,t.indexType);case 195:return d(r,t.readonlyToken)||d(r,t.typeParameter)||d(r,t.nameType)||d(r,t.questionToken)||d(r,t.type)||p(r,n,t.members);case 196:return d(r,t.literal);case 197:return d(r,t.dotDotDotToken)||d(r,t.name)||d(r,t.questionToken)||d(r,t.type);case 201:case 202:case 204:return p(r,n,t.elements);case 205:return p(r,n,t.properties);case 206:return d(r,t.expression)||d(r,t.questionDotToken)||d(r,t.name);case 207:return d(r,t.expression)||d(r,t.questionDotToken)||d(r,t.argumentExpression);case 208:case 209:return d(r,t.expression)||d(r,t.questionDotToken)||p(r,n,t.typeArguments)||p(r,n,t.arguments);case 210:return d(r,t.tag)||d(r,t.questionDotToken)||p(r,n,t.typeArguments)||d(r,t.template);case 211:return d(r,t.type)||d(r,t.expression);case 212:case 215:case 216:case 217:return d(r,t.expression);case 219:return d(r,t.operand);case 224:return d(r,t.asteriskToken)||d(r,t.expression);case 218:return d(r,t.expression);case 220:return d(r,t.operand);case 221:return d(r,t.left)||d(r,t.operatorToken)||d(r,t.right);case 229:return d(r,t.expression)||d(r,t.type);case 230:return d(r,t.expression);case 231:return d(r,t.name);case 222:return d(r,t.condition)||d(r,t.questionToken)||d(r,t.whenTrue)||d(r,t.colonToken)||d(r,t.whenFalse);case 225:return d(r,t.expression);case 235:case 262:return p(r,n,t.statements);case 305:return p(r,n,t.statements)||d(r,t.endOfFileToken);case 237:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.declarationList);case 255:return p(r,n,t.declarations);case 238:return d(r,t.expression);case 239:return d(r,t.expression)||d(r,t.thenStatement)||d(r,t.elseStatement);case 240:return d(r,t.statement)||d(r,t.expression);case 241:return d(r,t.expression)||d(r,t.statement);case 242:return d(r,t.initializer)||d(r,t.condition)||d(r,t.incrementor)||d(r,t.statement);case 243:return d(r,t.initializer)||d(r,t.expression)||d(r,t.statement);case 244:return d(r,t.awaitModifier)||d(r,t.initializer)||d(r,t.expression)||d(r,t.statement);case 245:case 246:return d(r,t.label);case 247:return d(r,t.expression);case 248:return d(r,t.expression)||d(r,t.statement);case 249:return d(r,t.expression)||d(r,t.caseBlock);case 263:return p(r,n,t.clauses);case 289:return d(r,t.expression)||p(r,n,t.statements);case 290:return p(r,n,t.statements);case 250:return d(r,t.label)||d(r,t.statement);case 251:return d(r,t.expression);case 252:return d(r,t.tryBlock)||d(r,t.catchClause)||d(r,t.finallyBlock);case 292:return d(r,t.variableDeclaration)||d(r,t.block);case 165:return d(r,t.expression);case 257:case 226:case 258:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||p(r,n,t.typeParameters)||p(r,n,t.heritageClauses)||p(r,n,t.members);case 259:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||p(r,n,t.typeParameters)||d(r,t.type);case 260:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||p(r,n,t.members);case 299:return d(r,t.name)||d(r,t.initializer);case 261:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||d(r,t.body);case 265:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.name)||d(r,t.moduleReference);case 266:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.importClause)||d(r,t.moduleSpecifier)||d(r,t.assertClause);case 267:return d(r,t.name)||d(r,t.namedBindings);case 293:return p(r,n,t.elements);case 294:return d(r,t.name)||d(r,t.value);case 264:case 268:case 274:return d(r,t.name);case 269:case 273:return p(r,n,t.elements);case 272:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.exportClause)||d(r,t.moduleSpecifier)||d(r,t.assertClause);case 270:case 275:return d(r,t.propertyName)||d(r,t.name);case 271:return p(r,n,t.decorators)||p(r,n,t.modifiers)||d(r,t.expression);case 223:return d(r,t.head)||p(r,n,t.templateSpans);case 233:return d(r,t.expression)||d(r,t.literal);case 198:return d(r,t.head)||p(r,n,t.templateSpans);case 199:return d(r,t.type)||d(r,t.literal);case 162:return d(r,t.expression);case 291:return p(r,n,t.types);case 228:return d(r,t.expression)||p(r,n,t.typeArguments);case 277:return d(r,t.expression);case 276:return p(r,n,t.decorators);case 351:return p(r,n,t.elements);case 278:return d(r,t.openingElement)||p(r,n,t.children)||d(r,t.closingElement);case 282:return d(r,t.openingFragment)||p(r,n,t.children)||d(r,t.closingFragment);case 279:case 280:return d(r,t.tagName)||p(r,n,t.typeArguments)||d(r,t.attributes);case 286:return p(r,n,t.properties);case 285:return d(r,t.name)||d(r,t.initializer);case 287:return d(r,t.expression);case 288:return d(r,t.dotDotDotToken)||d(r,t.expression);case 281:return d(r,t.tagName);case 185:case 186:case 309:case 315:case 314:case 316:case 318:return d(r,t.type);case 317:return p(r,n,t.parameters)||d(r,t.type);case 320:return ("string"==typeof t.comment?void 0:p(r,n,t.comment))||p(r,n,t.tags);case 346:return d(r,t.tagName)||d(r,t.name)||("string"==typeof t.comment?void 0:p(r,n,t.comment));case 310:return d(r,t.name);case 311:return d(r,t.left)||d(r,t.right);case 340:case 347:return d(r,t.tagName)||(t.isNameFirst?d(r,t.name)||d(r,t.typeExpression)||("string"==typeof t.comment?void 0:p(r,n,t.comment)):d(r,t.typeExpression)||d(r,t.name)||("string"==typeof t.comment?void 0:p(r,n,t.comment)));case 330:return d(r,t.tagName)||("string"==typeof t.comment?void 0:p(r,n,t.comment));case 329:case 328:return d(r,t.tagName)||d(r,t.class)||("string"==typeof t.comment?void 0:p(r,n,t.comment));case 344:return d(r,t.tagName)||d(r,t.constraint)||p(r,n,t.typeParameters)||("string"==typeof t.comment?void 0:p(r,n,t.comment));case 345:return d(r,t.tagName)||(t.typeExpression&&309===t.typeExpression.kind?d(r,t.typeExpression)||d(r,t.fullName)||("string"==typeof t.comment?void 0:p(r,n,t.comment)):d(r,t.fullName)||d(r,t.typeExpression)||("string"==typeof t.comment?void 0:p(r,n,t.comment)));case 338:return d(r,t.tagName)||d(r,t.fullName)||d(r,t.typeExpression)||("string"==typeof t.comment?void 0:p(r,n,t.comment));case 341:case 343:case 342:case 339:return d(r,t.tagName)||d(r,t.typeExpression)||("string"==typeof t.comment?void 0:p(r,n,t.comment));case 323:return e.forEach(t.typeParameters,r)||e.forEach(t.parameters,r)||d(r,t.type);case 324:case 325:case 326:return d(r,t.name);case 322:return e.forEach(t.jsDocPropertyTags,r);case 327:case 332:case 333:case 334:case 335:case 336:case 331:return d(r,t.tagName)||("string"==typeof t.comment?void 0:p(r,n,t.comment));case 350:return d(r,t.expression)}}function h(e){var t=[];return v(e,r,r),t;function r(e){t.unshift(e);}}function b(e){e.externalModuleIndicator=g(e);}function x(e){return void 0!==e.externalModuleIndicator}function D(t){return e.fileExtensionIsOneOf(t,e.supportedDeclarationExtensions)}function S(t,r){for(var n=[],i=0,a=e.getLeadingCommentRanges(r,0)||e.emptyArray;i<a.length;i++){var o=a[i];F(n,o,r.substring(o.pos,o.end));}t.pragmas=new e.Map;for(var s=0,c=n;s<c.length;s++){var l=c[s];if(t.pragmas.has(l.name)){var u=t.pragmas.get(l.name);u instanceof Array?u.push(l.args):t.pragmas.set(l.name,[u,l.args]);}else t.pragmas.set(l.name,l.args);}}function T(t,r){t.checkJsDirective=void 0,t.referencedFiles=[],t.typeReferenceDirectives=[],t.libReferenceDirectives=[],t.amdDependencies=[],t.hasNoDefaultLib=!1,t.pragmas.forEach((function(n,a){switch(a){case"reference":var o=t.referencedFiles,s=t.typeReferenceDirectives,c=t.libReferenceDirectives;e.forEach(e.toArray(n),(function(n){var a=n.arguments,l=a.types,u=a.lib,_=a.path,d=a["resolution-mode"];if(n.arguments["no-default-lib"])t.hasNoDefaultLib=!0;else if(l){var p=function(t,r,n,i){if(t)return "import"===t?e.ModuleKind.ESNext:"require"===t?e.ModuleKind.CommonJS:void i(r,n-r,e.Diagnostics.resolution_mode_should_be_either_require_or_import)}(d,l.pos,l.end,r);s.push(i$1({pos:l.pos,end:l.end,fileName:l.value},p?{resolutionMode:p}:{}));}else u?c.push({pos:u.pos,end:u.end,fileName:u.value}):_?o.push({pos:_.pos,end:_.end,fileName:_.value}):r(n.range.pos,n.range.end-n.range.pos,e.Diagnostics.Invalid_reference_directive_syntax);}));break;case"amd-dependency":t.amdDependencies=e.map(e.toArray(n),(function(e){return {name:e.arguments.name,path:e.arguments.path}}));break;case"amd-module":if(n instanceof Array)for(var l=0,u=n;l<u.length;l++){var _=u[l];t.moduleName&&r(_.range.pos,_.range.end-_.range.pos,e.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments),t.moduleName=_.arguments.name;}else t.moduleName=n.arguments.name;break;case"ts-nocheck":case"ts-check":e.forEach(e.toArray(n),(function(e){(!t.checkJsDirective||e.range.pos>t.checkJsDirective.pos)&&(t.checkJsDirective={enabled:"ts-check"===a,end:e.range.end,pos:e.range.pos});}));break;case"jsx":case"jsxfrag":case"jsximportsource":case"jsxruntime":return;default:e.Debug.fail("Unhandled pragma kind");}}));}!function(e){e[e.None=0]="None",e[e.Yield=1]="Yield",e[e.Await=2]="Await",e[e.Type=4]="Type",e[e.IgnoreMissingOpenBrace=16]="IgnoreMissingOpenBrace",e[e.JSDoc=32]="JSDoc";}(t||(t={})),function(e){e[e.TryParse=0]="TryParse",e[e.Lookahead=1]="Lookahead",e[e.Reparse=2]="Reparse";}(r||(r={})),e.parseBaseNodeFactory={createBaseSourceFileNode:function(t){return new(l||(l=e.objectAllocator.getSourceFileConstructor()))(t,-1,-1)},createBaseIdentifierNode:function(t){return new(s||(s=e.objectAllocator.getIdentifierConstructor()))(t,-1,-1)},createBasePrivateIdentifierNode:function(t){return new(c||(c=e.objectAllocator.getPrivateIdentifierConstructor()))(t,-1,-1)},createBaseTokenNode:function(t){return new(o||(o=e.objectAllocator.getTokenConstructor()))(t,-1,-1)},createBaseNode:function(t){return new(a||(a=e.objectAllocator.getNodeConstructor()))(t,-1,-1)}},e.parseNodeFactory=e.createNodeFactory(1,e.parseBaseNodeFactory),e.isJSDocLikeText=f,e.isFileProbablyExternalModule=g,e.forEachChild=v,e.forEachChildRecursively=function(t,r,n){for(var i=h(t),a=[];a.length<i.length;)a.push(t);for(;0!==i.length;){var o=i.pop(),s=a.pop();if(e.isArray(o)){if(n&&(l=n(o,s))){if("skip"===l)continue;return l}for(var c=o.length-1;c>=0;--c)i.push(o[c]),a.push(s);}else {var l;if(l=r(o,s)){if("skip"===l)continue;return l}if(o.kind>=161)for(var u=0,_=h(o);u<_.length;u++){var d=_[u];i.push(d),a.push(o);}}}},e.createSourceFile=function(t,r,n,i,a){var o;void 0===i&&(i=!1),null===e.tracing||void 0===e.tracing||e.tracing.push("parse","createSourceFile",{path:t},!0),e.performance.mark("beforeParse"),e.perfLogger.logStartParseSourceFile(t);var s="object"==typeof n?n:{languageVersion:n},c=s.languageVersion,l=s.setExternalModuleIndicator,_=s.impliedNodeFormat;if(100===c)o=u.parseSourceFile(t,r,c,void 0,i,6,e.noop);else {var d=void 0===_?l:function(e){return e.impliedNodeFormat=_,(l||b)(e)};o=u.parseSourceFile(t,r,c,void 0,i,a,d);}return e.perfLogger.logStopParseSourceFile(),e.performance.mark("afterParse"),e.performance.measure("Parse","beforeParse","afterParse"),null===e.tracing||void 0===e.tracing||e.tracing.pop(),o},e.parseIsolatedEntityName=function(e,t){return u.parseIsolatedEntityName(e,t)},e.parseJsonText=function(e,t){return u.parseJsonText(e,t)},e.isExternalModule=x,e.updateSourceFile=function(e,t,r,n){void 0===n&&(n=!1);var i=_.updateSourceFile(e,t,r,n);return i.flags|=6291456&e.flags,i},e.parseIsolatedJSDocComment=function(e,t,r){var n=u.JSDocParser.parseIsolatedJSDocComment(e,t,r);return n&&n.jsDoc&&u.fixupParentReferences(n.jsDoc),n},e.parseJSDocTypeExpressionForTests=function(e,t,r){return u.JSDocParser.parseJSDocTypeExpressionForTests(e,t,r)},function(t){var r,i,a,o,s,c=e.createScanner(99,!0);function l(e){return E++,e}var u,d,p,g,m,y,v,h,C,k,E,N,F,A,w,I,O,M={createBaseSourceFileNode:function(e){return l(new s(e,0,0))},createBaseIdentifierNode:function(e){return l(new a(e,0,0))},createBasePrivateIdentifierNode:function(e){return l(new o(e,0,0))},createBaseTokenNode:function(e){return l(new i(e,0,0))},createBaseNode:function(e){return l(new r(e,0,0))}},L=e.createNodeFactory(11,M),R=!0,B=!1;function j(t,r,n,i,a){void 0===n&&(n=2),void 0===a&&(a=!1),J(t,r,n,i,6),d=O,xe();var o,s,c=me();if(1===ve())o=Xe([],c,c),s=We();else {for(var l=void 0;1!==ve();){var u=void 0;switch(ve()){case 22:u=Nn();break;case 110:case 95:case 104:u=We();break;case 40:u=Ae((function(){return 8===xe()&&58!==xe()}))?rn():An();break;case 8:case 10:if(Ae((function(){return 58!==xe()}))){u=jt();break}default:u=An();}l&&e.isArray(l)?l.push(u):l?l=[l,u]:(l=u,1!==ve()&&_e(e.Diagnostics.Unexpected_token));}var _=e.isArray(l)?Ye(L.createArrayLiteralExpression(l),c):e.Debug.checkDefined(l),p=L.createExpressionStatement(_);Ye(p,c),o=Xe([p],c),s=qe(1,e.Diagnostics.Unexpected_token);}var f=H(t,2,6,!1,o,s,d,e.noop);a&&W(f),f.nodeCount=E,f.identifierCount=A,f.identifiers=N,f.parseDiagnostics=e.attachFileToDiagnostics(v,f),h&&(f.jsDocDiagnostics=e.attachFileToDiagnostics(h,f));var g=f;return z(),g}function J(t,n,l,_,f){switch(r=e.objectAllocator.getNodeConstructor(),i=e.objectAllocator.getTokenConstructor(),a=e.objectAllocator.getIdentifierConstructor(),o=e.objectAllocator.getPrivateIdentifierConstructor(),s=e.objectAllocator.getSourceFileConstructor(),u=e.normalizePath(t),p=n,g=l,C=_,m=f,y=e.getLanguageVariant(f),v=[],w=0,N=new e.Map,F=new e.Map,A=0,E=0,d=0,R=!0,m){case 1:case 2:O=262144;break;case 6:O=67371008;break;default:O=0;}B=!1,c.setText(p),c.setOnError(ge),c.setScriptTarget(g),c.setLanguageVariant(y);}function z(){c.clearCommentDirectives(),c.setText(""),c.setOnError(void 0),p=void 0,g=void 0,C=void 0,m=void 0,y=void 0,d=0,v=void 0,h=void 0,w=0,N=void 0,I=void 0,R=!0;}function K(t,r,n,i){var a=D(u);a&&(O|=16777216),d=O,xe();var o=St(0,qn);e.Debug.assert(1===ve());var s=q(We()),l=H(u,t,n,a,o,s,d,i);return S(l,p),T(l,(function(t,r,n){v.push(e.createDetachedDiagnostic(u,t,r,n));})),l.commentDirectives=c.getCommentDirectives(),l.nodeCount=E,l.identifierCount=A,l.identifiers=N,l.parseDiagnostics=e.attachFileToDiagnostics(v,l),h&&(l.jsDocDiagnostics=e.attachFileToDiagnostics(h,l)),r&&W(l),l}function U(e,t){return t?q(e):e}t.parseSourceFile=function(t,r,n,i,a,o,s){var c;if(void 0===a&&(a=!1),6===(o=e.ensureScriptKind(t,o))){var l=j(t,r,n,i,a);return e.convertToObjectWorker(l,null===(c=l.statements[0])||void 0===c?void 0:c.expression,l.parseDiagnostics,!1,void 0,void 0),l.referencedFiles=e.emptyArray,l.typeReferenceDirectives=e.emptyArray,l.libReferenceDirectives=e.emptyArray,l.amdDependencies=e.emptyArray,l.hasNoDefaultLib=!1,l.pragmas=e.emptyMap,l}J(t,r,n,i,o);var u=K(n,a,o,s||b);return z(),u},t.parseIsolatedEntityName=function(e,t){J("",e,t,void 0,1),xe();var r=wt(!0),n=1===ve()&&!v.length;return z(),n?r:void 0},t.parseJsonText=j;var V=!1;function q(t){e.Debug.assert(!t.jsDoc);var r=e.mapDefined(e.getJSDocCommentRanges(t,p),(function(e){return Re.parseJSDocComment(t,e.pos,e.end-e.pos)}));return r.length&&(t.jsDoc=r),V&&(V=!1,t.flags|=268435456),t}function W(t){e.setParentRecursive(t,!0);}function H(t,r,n,i,a,o,s,l){var u=L.createSourceFile(a,o,s);return e.setTextRangePosWidth(u,0,p.length),d(u),!i&&x(u)&&16777216&u.transformFlags&&d(u=function(t){var r=C,n=_.createSyntaxCursor(t);C={currentNode:function(e){var t=n.currentNode(e);return R&&t&&p(t)&&(t.intersectsChange=!0),t}};var i=[],a=v;v=[];for(var o=0,s=f(t.statements,0),l=function(){var r=t.statements[o],n=t.statements[s];e.addRange(i,t.statements,o,s),o=g(t.statements,s);var l=e.findIndex(a,(function(e){return e.start>=r.pos})),u=l>=0?e.findIndex(a,(function(e){return e.start>=n.pos}),l):-1;l>=0&&e.addRange(v,a,l,u>=0?u:void 0),Fe((function(){var e=O;for(O|=32768,c.setTextPos(n.pos),xe();1!==ve();){var r=c.getStartPos(),a=Tt(0,qn);if(i.push(a),r===c.getStartPos()&&xe(),o>=0){var s=t.statements[o];if(a.end===s.pos)break;a.end>s.pos&&(o=g(t.statements,o+1));}}O=e;}),2),s=o>=0?f(t.statements,o):-1;};-1!==s;)l();if(o>=0){var u=t.statements[o];e.addRange(i,t.statements,o);var d=e.findIndex(a,(function(e){return e.start>=u.pos}));d>=0&&e.addRange(v,a,d);}return C=r,L.updateSourceFile(t,e.setTextRange(L.createNodeArray(i),t.statements));function p(e){return !(32768&e.flags||!(16777216&e.transformFlags))}function f(e,t){for(var r=t;r<e.length;r++)if(p(e[r]))return r;return -1}function g(e,t){for(var r=t;r<e.length;r++)if(!p(e[r]))return r;return -1}}(u)),u;function d(a){a.text=p,a.bindDiagnostics=[],a.bindSuggestionDiagnostics=void 0,a.languageVersion=r,a.fileName=t,a.languageVariant=e.getLanguageVariant(n),a.isDeclarationFile=i,a.scriptKind=n,l(a),a.setExternalModuleIndicator=l;}}function G(e,t){e?O|=t:O&=~t;}function Q(e){G(e,4096);}function X(e){G(e,8192);}function Y(e){G(e,16384);}function Z(e){G(e,32768);}function $(e,t){var r=e&O;if(r){G(!1,r);var n=t();return G(!0,r),n}return t()}function ee(e,t){var r=e&~O;if(r){G(!0,r);var n=t();return G(!1,r),n}return t()}function te(e){return $(4096,e)}function re(e){return $(65536,e)}function ne(e){return ee(65536,e)}function ie(e){return ee(32768,e)}function ae(e){return 0!=(O&e)}function oe(){return ae(8192)}function se(){return ae(4096)}function ce(){return ae(65536)}function le(){return ae(16384)}function ue(){return ae(32768)}function _e(e,t){return pe(c.getTokenPos(),c.getTextPos(),e,t)}function de(t,r,n,i){var a,o=e.lastOrUndefined(v);return o&&t===o.start||(a=e.createDetachedDiagnostic(u,t,r,n,i),v.push(a)),B=!0,a}function pe(e,t,r,n){return de(e,t-e,r,n)}function fe(e,t,r){pe(e.pos,e.end,t,r);}function ge(e,t){de(c.getTextPos(),t,e);}function me(){return c.getStartPos()}function ye(){return c.hasPrecedingJSDocComment()}function ve(){return k}function he(){return k=c.scan()}function be(e){return xe(),e()}function xe(){return e.isKeyword(k)&&(c.hasUnicodeEscape()||c.hasExtendedUnicodeEscape())&&pe(c.getTokenPos(),c.getTextPos(),e.Diagnostics.Keywords_cannot_contain_escape_characters),he()}function De(){return k=c.scanJsDocToken()}function Se(){return k=c.reScanGreaterToken()}function Te(){return k=c.reScanTemplateHeadOrNoSubstitutionTemplate()}function Ce(){return k=c.reScanLessThanToken()}function ke(){return k=c.reScanHashToken()}function Ee(){return k=c.scanJsxIdentifier()}function Ne(){return k=c.scanJsxToken()}function Fe(t,r){var n=k,i=v.length,a=B,o=O,s=0!==r?c.lookAhead(t):c.tryScan(t);return e.Debug.assert(o===O),s&&0===r||(k=n,2!==r&&(v.length=i),B=a),s}function Ae(e){return Fe(e,1)}function Pe(e){return Fe(e,0)}function we(){return 79===ve()||ve()>116}function Ie(){return 79===ve()||(125!==ve()||!oe())&&(132!==ve()||!ue())&&ve()>116}function Oe(t,r,n){return void 0===n&&(n=!0),ve()===t?(n&&xe(),!0):(r?_e(r):_e(e.Diagnostics._0_expected,e.tokenToString(t)),!1)}t.fixupParentReferences=W;var Me,Le,Re,Be=Object.keys(e.textToKeywordObj).filter((function(e){return e.length>2}));function je(t){var r;if(e.isTaggedTemplateExpression(t))pe(e.skipTrivia(p,t.template.pos),t.template.end,e.Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings);else {var n=e.isIdentifier(t)?e.idText(t):void 0;if(n&&e.isIdentifierText(n,g)){var i=e.skipTrivia(p,t.pos);switch(n){case"const":case"let":case"var":return void pe(i,t.end,e.Diagnostics.Variable_declaration_not_allowed_at_this_location);case"declare":return;case"interface":return void Je(e.Diagnostics.Interface_name_cannot_be_0,e.Diagnostics.Interface_must_be_given_a_name,18);case"is":return void pe(i,c.getTextPos(),e.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);case"module":case"namespace":return void Je(e.Diagnostics.Namespace_name_cannot_be_0,e.Diagnostics.Namespace_must_be_given_a_name,18);case"type":return void Je(e.Diagnostics.Type_alias_name_cannot_be_0,e.Diagnostics.Type_alias_must_be_given_a_name,63)}var a=null!==(r=e.getSpellingSuggestion(n,Be,(function(e){return e})))&&void 0!==r?r:function(t){for(var r=0,n=Be;r<n.length;r++){var i=n[r];if(t.length>i.length+2&&e.startsWith(t,i))return "".concat(i," ").concat(t.slice(i.length))}}(n);a?pe(i,t.end,e.Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0,a):0!==ve()&&pe(i,t.end,e.Diagnostics.Unexpected_keyword_or_identifier);}else _e(e.Diagnostics._0_expected,e.tokenToString(26));}}function Je(e,t,r){ve()===r?_e(t):_e(e,c.getTokenValue());}function ze(t){return ve()===t?(De(),!0):(_e(e.Diagnostics._0_expected,e.tokenToString(t)),!1)}function Ke(t,r,n,i){if(ve()!==r){var a=_e(e.Diagnostics._0_expected,e.tokenToString(r));n&&a&&e.addRelatedInfo(a,e.createDetachedDiagnostic(u,i,1,e.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here,e.tokenToString(t),e.tokenToString(r)));}else xe();}function Ue(e){return ve()===e&&(xe(),!0)}function Ve(e){if(ve()===e)return We()}function qe(t,r,n){return Ve(t)||Ze(t,!1,r||e.Diagnostics._0_expected,n||e.tokenToString(t))}function We(){var e=me(),t=ve();return xe(),Ye(L.createToken(t),e)}function He(){return 26===ve()||19===ve()||1===ve()||c.hasPrecedingLineBreak()}function Ge(){return !!He()&&(26===ve()&&xe(),!0)}function Qe(){return Ge()||Oe(26)}function Xe(t,r,n,i){var a=L.createNodeArray(t,i);return e.setTextRangePosEnd(a,r,null!=n?n:c.getStartPos()),a}function Ye(t,r,n){return e.setTextRangePosEnd(t,r,null!=n?n:c.getStartPos()),O&&(t.flags|=O),B&&(B=!1,t.flags|=131072),t}function Ze(t,r,n,i){r?de(c.getStartPos(),0,n,i):n&&_e(n,i);var a=me();return Ye(79===t?L.createIdentifier("",void 0,void 0):e.isTemplateLiteralKind(t)?L.createTemplateLiteralLikeNode(t,"","",void 0):8===t?L.createNumericLiteral("",void 0):10===t?L.createStringLiteral("",void 0):276===t?L.createMissingDeclaration():L.createToken(t),a)}function $e(e){var t=N.get(e);return void 0===t&&N.set(e,t=e),t}function et(t,r,n){if(t){A++;var i=me(),a=ve(),o=$e(c.getTokenValue());return he(),Ye(L.createIdentifier(o,void 0,a),i)}if(80===ve())return _e(n||e.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies),et(!0);if(0===ve()&&c.tryScan((function(){return 79===c.reScanInvalidIdentifier()})))return et(!0);A++;var s=1===ve(),l=c.isReservedWord(),u=c.getTokenText(),_=l?e.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here:e.Diagnostics.Identifier_expected;return Ze(79,s,r||_,u)}function tt(e){return et(we(),void 0,e)}function rt(e,t){return et(Ie(),e,t)}function nt(t){return et(e.tokenIsIdentifierOrKeyword(ve()),t)}function it(){return e.tokenIsIdentifierOrKeyword(ve())||10===ve()||8===ve()}function at(){return function(e){if(10===ve()||8===ve()){var t=jt();return t.text=$e(t.text),t}return e&&22===ve()?function(){var e=me();Oe(22);var t=te(Ur);return Oe(23),Ye(L.createComputedPropertyName(t),e)}():80===ve()?ot():nt()}(!0)}function ot(){var e,t,r=me(),n=L.createPrivateIdentifier((e=c.getTokenText(),void 0===(t=F.get(e))&&F.set(e,t=e),t));return xe(),Ye(n,r)}function st(e){return ve()===e&&Pe(lt)}function ct(){return xe(),!c.hasPrecedingLineBreak()&&dt()}function lt(){switch(ve()){case 85:return 92===xe();case 93:return xe(),88===ve()?Ae(pt):152===ve()?Ae(_t):ut();case 88:return pt();case 124:case 136:case 149:return xe(),dt();default:return ct()}}function ut(){return 41!==ve()&&127!==ve()&&18!==ve()&&dt()}function _t(){return xe(),ut()}function dt(){return 22===ve()||18===ve()||41===ve()||25===ve()||it()}function pt(){return xe(),84===ve()||98===ve()||118===ve()||126===ve()&&Ae(Bn)||131===ve()&&Ae(jn)}function ft(t,r){if(Ct(t))return !0;switch(t){case 0:case 1:case 3:return !(26===ve()&&r)&&Un();case 2:return 82===ve()||88===ve();case 4:return Ae(cr);case 5:return Ae(ui)||26===ve()&&!r;case 6:return 22===ve()||it();case 12:switch(ve()){case 22:case 41:case 25:case 24:return !0;default:return it()}case 18:return it();case 9:return 22===ve()||25===ve()||it();case 24:return e.tokenIsIdentifierOrKeyword(ve())||10===ve();case 7:return 18===ve()?Ae(gt):r?Ie()&&!ht():zr()&&!ht();case 8:return Zn();case 10:return 27===ve()||25===ve()||Zn();case 19:return 101===ve()||Ie();case 15:switch(ve()){case 27:case 24:return !0}case 11:return 25===ve()||Kr();case 16:return Yt(!1);case 17:return Yt(!0);case 20:case 21:return 27===ve()||kr();case 22:return Ti();case 23:return e.tokenIsIdentifierOrKeyword(ve());case 13:return e.tokenIsIdentifierOrKeyword(ve())||18===ve();case 14:return !0}return e.Debug.fail("Non-exhaustive case in 'isListElement'.")}function gt(){if(e.Debug.assert(18===ve()),19===xe()){var t=xe();return 27===t||18===t||94===t||117===t}return !0}function mt(){return xe(),Ie()}function yt(){return xe(),e.tokenIsIdentifierOrKeyword(ve())}function vt(){return xe(),e.tokenIsIdentifierOrKeywordOrGreaterThan(ve())}function ht(){return (117===ve()||94===ve())&&Ae(bt)}function bt(){return xe(),Kr()}function xt(){return xe(),kr()}function Dt(e){if(1===ve())return !0;switch(e){case 1:case 2:case 4:case 5:case 6:case 12:case 9:case 23:case 24:return 19===ve();case 3:return 19===ve()||82===ve()||88===ve();case 7:return 18===ve()||94===ve()||117===ve();case 8:return !!He()||!!$r(ve())||38===ve();case 19:return 31===ve()||20===ve()||18===ve()||94===ve()||117===ve();case 11:return 21===ve()||26===ve();case 15:case 21:case 10:return 23===ve();case 17:case 16:case 18:return 21===ve()||23===ve();case 20:return 27!==ve();case 22:return 18===ve()||19===ve();case 13:return 31===ve()||43===ve();case 14:return 29===ve()&&Ae(Pi);default:return !1}}function St(e,t){var r=w;w|=1<<e;for(var n=[],i=me();!Dt(e);)if(ft(e,!1))n.push(Tt(e,t));else if(Et(e))break;return w=r,Xe(n,i)}function Tt(e,t){var r=Ct(e);return r?kt(r):t()}function Ct(t){if(C&&function(e){switch(e){case 5:case 2:case 0:case 1:case 3:case 6:case 4:case 8:case 17:case 16:return !0}return !1}(t)&&!B){var r=C.currentNode(c.getStartPos());if(!(e.nodeIsMissing(r)||r.intersectsChange||e.containsParseError(r))&&(50720768&r.flags)===O&&function(e,t){switch(t){case 5:return function(e){if(e)switch(e.kind){case 171:case 176:case 172:case 173:case 167:case 234:return !0;case 169:var t=e;return !(79===t.name.kind&&134===t.name.originalKeywordKind)}return !1}(e);case 2:return function(e){if(e)switch(e.kind){case 289:case 290:return !0}return !1}(e);case 0:case 1:case 3:return function(e){if(e)switch(e.kind){case 256:case 237:case 235:case 239:case 238:case 251:case 247:case 249:case 246:case 245:case 243:case 244:case 242:case 241:case 248:case 236:case 252:case 250:case 240:case 253:case 266:case 265:case 272:case 271:case 261:case 257:case 258:case 260:case 259:return !0}return !1}(e);case 6:return function(e){return 299===e.kind}(e);case 4:return function(e){if(e)switch(e.kind){case 175:case 168:case 176:case 166:case 174:return !0}return !1}(e);case 8:return function(e){return 254===e.kind&&void 0===e.initializer}(e);case 17:case 16:return function(e){return 164===e.kind&&void 0===e.initializer}(e)}return !1}(r,t))return r.jsDocCache&&(r.jsDocCache=void 0),r}}function kt(e){return c.setTextPos(e.end),xe(),e}function Et(t){return function(t){switch(t){case 0:return 88===ve()?_e(e.Diagnostics._0_expected,e.tokenToString(93)):_e(e.Diagnostics.Declaration_or_statement_expected);case 1:return _e(e.Diagnostics.Declaration_or_statement_expected);case 2:return _e(e.Diagnostics.case_or_default_expected);case 3:return _e(e.Diagnostics.Statement_expected);case 18:case 4:return _e(e.Diagnostics.Property_or_signature_expected);case 5:return _e(e.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected);case 6:return _e(e.Diagnostics.Enum_member_expected);case 7:return _e(e.Diagnostics.Expression_expected);case 8:return e.isKeyword(ve())?_e(e.Diagnostics._0_is_not_allowed_as_a_variable_declaration_name,e.tokenToString(ve())):_e(e.Diagnostics.Variable_declaration_expected);case 9:return _e(e.Diagnostics.Property_destructuring_pattern_expected);case 10:return _e(e.Diagnostics.Array_element_destructuring_pattern_expected);case 11:return _e(e.Diagnostics.Argument_expression_expected);case 12:return _e(e.Diagnostics.Property_assignment_expected);case 15:return _e(e.Diagnostics.Expression_or_comma_expected);case 17:return _e(e.Diagnostics.Parameter_declaration_expected);case 16:return e.isKeyword(ve())?_e(e.Diagnostics._0_is_not_allowed_as_a_parameter_name,e.tokenToString(ve())):_e(e.Diagnostics.Parameter_declaration_expected);case 19:return _e(e.Diagnostics.Type_parameter_declaration_expected);case 20:return _e(e.Diagnostics.Type_argument_expected);case 21:return _e(e.Diagnostics.Type_expected);case 22:return _e(e.Diagnostics.Unexpected_token_expected);case 23:case 13:case 14:_e(e.Diagnostics.Identifier_expected);}}(t),!!function(){for(var e=0;e<25;e++)if(w&1<<e&&(ft(e,!0)||Dt(e)))return !0;return !1}()||(xe(),!1)}function Nt(e,t,r){var n=w;w|=1<<e;for(var i=[],a=me(),o=-1;;)if(ft(e,!1)){var s=c.getStartPos(),l=Tt(e,t);if(!l)return void(w=n);if(i.push(l),o=c.getTokenPos(),Ue(27))continue;if(o=-1,Dt(e))break;Oe(27,Ft(e)),r&&26===ve()&&!c.hasPrecedingLineBreak()&&xe(),s===c.getStartPos()&&xe();}else {if(Dt(e))break;if(Et(e))break}return w=n,Xe(i,a,void 0,o>=0)}function Ft(t){return 6===t?e.Diagnostics.An_enum_member_name_must_be_followed_by_a_or:void 0}function At(){var e=Xe([],me());return e.isMissingList=!0,e}function Pt(e,t,r,n){if(Oe(r)){var i=Nt(e,t);return Oe(n),i}return At()}function wt(e,t){for(var r=me(),n=e?nt(t):rt(t),i=me();Ue(24);){if(29===ve()){n.jsdocDotPos=i;break}i=me(),n=Ye(L.createQualifiedName(n,Ot(e,!1)),r);}return n}function It(e,t){return Ye(L.createQualifiedName(e,t),e.pos)}function Ot(t,r){if(c.hasPrecedingLineBreak()&&e.tokenIsIdentifierOrKeyword(ve())&&Ae(Rn))return Ze(79,!0,e.Diagnostics.Identifier_expected);if(80===ve()){var n=ot();return r?n:Ze(79,!0,e.Diagnostics.Identifier_expected)}return t?nt():rt()}function Mt(e){var t=me();return Ye(L.createTemplateExpression(Jt(e),function(e){var t,r=me(),n=[];do{t=Bt(e),n.push(t);}while(16===t.literal.kind);return Xe(n,r)}(e)),t)}function Lt(){var e=me();return Ye(L.createTemplateLiteralTypeSpan(jr(),Rt(!1)),e)}function Rt(t){return 19===ve()?(function(e){k=c.reScanTemplateToken(e);}(t),r=zt(ve()),e.Debug.assert(16===r.kind||17===r.kind,"Template fragment has wrong token kind"),r):qe(17,e.Diagnostics._0_expected,e.tokenToString(19));var r;}function Bt(e){var t=me();return Ye(L.createTemplateSpan(te(Ur),Rt(e)),t)}function jt(){return zt(ve())}function Jt(t){t&&Te();var r=zt(ve());return e.Debug.assert(15===r.kind,"Template head has wrong token kind"),r}function zt(t){var r=me(),n=e.isTemplateLiteralKind(t)?L.createTemplateLiteralLikeNode(t,c.getTokenValue(),function(e){var t=14===e||17===e,r=c.getTokenText();return r.substring(1,r.length-(c.isUnterminated()?0:t?1:2))}(t),2048&c.getTokenFlags()):8===t?L.createNumericLiteral(c.getTokenValue(),c.getNumericLiteralFlags()):10===t?L.createStringLiteral(c.getTokenValue(),void 0,c.hasExtendedUnicodeEscape()):e.isLiteralKind(t)?L.createLiteralLikeNode(t,c.getTokenValue()):e.Debug.fail();return c.hasExtendedUnicodeEscape()&&(n.hasExtendedUnicodeEscape=!0),c.isUnterminated()&&(n.isUnterminated=!0),xe(),Ye(n,r)}function Kt(){return wt(!0,e.Diagnostics.Type_expected)}function Ut(){if(!c.hasPrecedingLineBreak()&&29===Ce())return Pt(20,jr,29,31)}function Vt(){var e=me();return Ye(L.createTypeReferenceNode(Kt(),Ut()),e)}function qt(t){switch(t.kind){case 178:return e.nodeIsMissing(t.typeName);case 179:case 180:var r=t,n=r.parameters,i=r.type;return !!n.isMissingList||qt(i);case 191:return qt(t.type);default:return !1}}function Wt(){var e=me();return xe(),Ye(L.createThisTypeNode(),e)}function Ht(){var e,t=me();return 108!==ve()&&103!==ve()||(e=nt(),Oe(58)),Ye(L.createParameterDeclaration(void 0,void 0,void 0,e,void 0,Gt(),void 0),t)}function Gt(){c.setInJSDocType(!0);var e=me();if(Ue(141)){var t=L.createJSDocNamepathType(void 0);e:for(;;)switch(ve()){case 19:case 1:case 27:case 5:break e;default:De();}return c.setInJSDocType(!1),Ye(t,e)}var r=Ue(25),n=Rr();return c.setInJSDocType(!1),r&&(n=Ye(L.createJSDocVariadicType(n),e)),63===ve()?(xe(),Ye(L.createJSDocOptionalType(n),e)):n}function Qt(){var e,t,r=me(),n=gi(),i=rt();Ue(94)&&(kr()||!Kr()?e=jr():t=nn());var a=Ue(63)?jr():void 0,o=L.createTypeParameterDeclaration(n,i,e,a);return o.expression=t,Ye(o,r)}function Xt(){if(29===ve())return Pt(19,Qt,29,31)}function Yt(t){return 25===ve()||Zn()||e.isModifierKind(ve())||59===ve()||kr(!t)}function Zt(e){return $t(e)}function $t(t,r){void 0===r&&(r=!0);var n=me(),i=ye(),a=t?ie(pi):pi();if(108===ve()){var o=L.createParameterDeclaration(a,void 0,void 0,et(!0),void 0,Jr(),void 0);return a&&fe(a[0],e.Diagnostics.Decorators_may_not_be_applied_to_this_parameters),U(Ye(o,n),i)}var s=R;R=!1;var c=gi(),l=Ve(25);if(r||we()||22===ve()||18===ve()){var u=U(Ye(L.createParameterDeclaration(a,c,l,function(t){var r=$n(e.Diagnostics.Private_identifiers_cannot_be_used_as_parameters);return 0===e.getFullWidth(r)&&!e.some(t)&&e.isModifierKind(ve())&&xe(),r}(c),Ve(57),Jr(),Vr()),n),i);return R=s,u}}function er(t,r){if(function(t,r){return 38===t?(Oe(t),!0):!!Ue(58)||!(!r||38!==ve())&&(_e(e.Diagnostics._0_expected,e.tokenToString(58)),xe(),!0)}(t,r))return re(Rr)}function tr(e,t){var r=oe(),n=ue();X(!!(1&e)),Z(!!(2&e));var i=32&e?Nt(17,Ht):Nt(16,(function(){return t?Zt(n):$t(n,!1)}));return X(r),Z(n),i}function rr(e){if(!Oe(20))return At();var t=tr(e,!0);return Oe(21),t}function nr(){Ue(27)||Qe();}function ir(e){var t=me(),r=ye();175===e&&Oe(103);var n=Xt(),i=rr(4),a=er(58,!0);return nr(),U(Ye(174===e?L.createCallSignature(n,i,a):L.createConstructSignature(n,i,a),t),r)}function ar(){return 22===ve()&&Ae(or)}function or(){if(xe(),25===ve()||23===ve())return !0;if(e.isModifierKind(ve())){if(xe(),Ie())return !0}else {if(!Ie())return !1;xe();}return 58===ve()||27===ve()||57===ve()&&(xe(),58===ve()||27===ve()||23===ve())}function sr(e,t,r,n){var i=Pt(16,(function(){return Zt(!1)}),22,23),a=Jr();return nr(),U(Ye(L.createIndexSignature(r,n,i,a),e),t)}function cr(){if(20===ve()||29===ve()||136===ve()||149===ve())return !0;for(var t=!1;e.isModifierKind(ve());)t=!0,xe();return 22===ve()||(it()&&(t=!0,xe()),!!t&&(20===ve()||29===ve()||57===ve()||58===ve()||27===ve()||He()))}function lr(){if(20===ve()||29===ve())return ir(174);if(103===ve()&&Ae(ur))return ir(175);var e=me(),t=ye(),r=gi();return st(136)?li(e,t,void 0,r,172):st(149)?li(e,t,void 0,r,173):ar()?sr(e,t,void 0,r):function(e,t,r){var n,i=at(),a=Ve(57);if(20===ve()||29===ve()){var o=Xt(),s=rr(4),c=er(58,!0);n=L.createMethodSignature(r,i,a,o,s,c);}else c=Jr(),n=L.createPropertySignature(r,i,a,c),63===ve()&&(n.initializer=Vr());return nr(),U(Ye(n,e),t)}(e,t,r)}function ur(){return xe(),20===ve()||29===ve()}function _r(){return 24===xe()}function dr(){switch(xe()){case 20:case 29:case 24:return !0}return !1}function pr(){var e;return Oe(18)?(e=St(4,lr),Oe(19)):e=At(),e}function fr(){return xe(),39===ve()||40===ve()?145===xe():(145===ve()&&xe(),22===ve()&&mt()&&101===xe())}function gr(){var t=me();if(Ue(25))return Ye(L.createRestTypeNode(jr()),t);var r=jr();if(e.isJSDocNullableType(r)&&r.pos===r.type.pos){var n=L.createOptionalTypeNode(r.type);return e.setTextRange(n,r),n.flags=r.flags,n}return r}function mr(){return 58===xe()||57===ve()&&58===xe()}function yr(){return 25===ve()?e.tokenIsIdentifierOrKeyword(xe())&&mr():e.tokenIsIdentifierOrKeyword(ve())&&mr()}function vr(){if(Ae(yr)){var e=me(),t=ye(),r=Ve(25),n=nt(),i=Ve(57);Oe(58);var a=gr();return U(Ye(L.createNamedTupleMember(r,n,i,a),e),t)}return gr()}function hr(){var e=me(),t=ye(),r=function(){var e;if(126===ve()){var t=me();xe(),e=Xe([Ye(L.createToken(126),t)],t);}return e}(),n=Ue(103),i=Xt(),a=rr(4),o=er(38,!1),s=n?L.createConstructorTypeNode(r,i,a,o):L.createFunctionTypeNode(i,a,o);return n||(s.modifiers=r),U(Ye(s,e),t)}function br(){var e=We();return 24===ve()?void 0:e}function xr(e){var t=me();e&&xe();var r=110===ve()||95===ve()||104===ve()?We():zt(ve());return e&&(r=Ye(L.createPrefixUnaryExpression(40,r),t)),Ye(L.createLiteralTypeNode(r),t)}function Dr(){return xe(),100===ve()}function Sr(){d|=2097152;var t=me(),r=Ue(112);Oe(100),Oe(20);var n,i=jr();Ue(27)&&(n=function(){var t=me(),r=c.getTokenPos();Oe(18);var n=c.hasPrecedingLineBreak();Oe(129),Oe(58);var i=Ii(!0);if(!Oe(19)){var a=e.lastOrUndefined(v);a&&a.code===e.Diagnostics._0_expected.code&&e.addRelatedInfo(a,e.createDetachedDiagnostic(u,r,1,e.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here,"{","}"));}return Ye(L.createImportTypeAssertionContainer(i,n),t)}()),Oe(21);var a=Ue(24)?Kt():void 0,o=Ut();return Ye(L.createImportTypeNode(i,n,a,o,r),t)}function Tr(){return xe(),8===ve()||9===ve()}function Cr(){switch(ve()){case 130:case 155:case 150:case 147:case 158:case 151:case 133:case 153:case 143:case 148:return Pe(br)||Vt();case 66:c.reScanAsteriskEqualsToken();case 41:return r=me(),xe(),Ye(L.createJSDocAllType(),r);case 60:c.reScanQuestionToken();case 57:return function(){var e=me();return xe(),27===ve()||19===ve()||21===ve()||31===ve()||63===ve()||51===ve()?Ye(L.createJSDocUnknownType(),e):Ye(L.createJSDocNullableType(jr(),!1),e)}();case 98:return function(){var e=me(),t=ye();if(Ae(Fi)){xe();var r=rr(36),n=er(58,!1);return U(Ye(L.createJSDocFunctionType(r,n),e),t)}return Ye(L.createTypeReferenceNode(nt(),void 0),e)}();case 53:return function(){var e=me();return xe(),Ye(L.createJSDocNonNullableType(Cr(),!1),e)}();case 14:case 10:case 8:case 9:case 110:case 95:case 104:return xr();case 40:return Ae(Tr)?xr(!0):Vt();case 114:return We();case 108:var e=Wt();return 139!==ve()||c.hasPrecedingLineBreak()?e:(t=e,xe(),Ye(L.createTypePredicateNode(void 0,t,jr()),t.pos));case 112:return Ae(Dr)?Sr():function(){var e=me();Oe(112);var t=wt(!0),r=c.hasPrecedingLineBreak()?void 0:Si();return Ye(L.createTypeQueryNode(t,r),e)}();case 18:return Ae(fr)?function(){var e,t=me();Oe(18),145!==ve()&&39!==ve()&&40!==ve()||145!==(e=We()).kind&&Oe(145),Oe(22);var r,n=function(){var e=me(),t=nt();Oe(101);var r=jr();return Ye(L.createTypeParameterDeclaration(void 0,t,r,void 0),e)}(),i=Ue(127)?jr():void 0;Oe(23),57!==ve()&&39!==ve()&&40!==ve()||57!==(r=We()).kind&&Oe(57);var a=Jr();Qe();var o=St(4,lr);return Oe(19),Ye(L.createMappedTypeNode(e,n,i,r,a,o),t)}():function(){var e=me();return Ye(L.createTypeLiteralNode(pr()),e)}();case 22:return function(){var e=me();return Ye(L.createTupleTypeNode(Pt(21,vr,22,23)),e)}();case 20:return function(){var e=me();Oe(20);var t=jr();return Oe(21),Ye(L.createParenthesizedType(t),e)}();case 100:return Sr();case 128:return Ae(Rn)?function(){var e=me(),t=qe(128),r=108===ve()?Wt():rt(),n=Ue(139)?jr():void 0;return Ye(L.createTypePredicateNode(t,r,n),e)}():Vt();case 15:return function(){var e=me();return Ye(L.createTemplateLiteralType(Jt(!1),function(){var e,t=me(),r=[];do{e=Lt(),r.push(e);}while(16===e.literal.kind);return Xe(r,t)}()),e)}();default:return Vt()}var t,r;}function kr(e){switch(ve()){case 130:case 155:case 150:case 147:case 158:case 133:case 145:case 151:case 154:case 114:case 153:case 104:case 108:case 112:case 143:case 18:case 22:case 29:case 51:case 50:case 103:case 10:case 8:case 9:case 110:case 95:case 148:case 41:case 57:case 53:case 25:case 137:case 100:case 128:case 14:case 15:return !0;case 98:return !e;case 40:return !e&&Ae(Tr);case 20:return !e&&Ae(Er);default:return Ie()}}function Er(){return xe(),21===ve()||Yt(!1)||kr()}function Nr(){for(var e=me(),t=Cr();!c.hasPrecedingLineBreak();)switch(ve()){case 53:xe(),t=Ye(L.createJSDocNonNullableType(t,!0),e);break;case 57:if(Ae(xt))return t;xe(),t=Ye(L.createJSDocNullableType(t,!0),e);break;case 22:if(Oe(22),kr()){var r=jr();Oe(23),t=Ye(L.createIndexedAccessTypeNode(t,r),e);}else Oe(23),t=Ye(L.createArrayTypeNode(t),e);break;default:return t}return t}function Fr(){if(Ue(94)){var e=ne(jr);if(ce()||57!==ve())return e}}function Ar(){var e,t=ve();switch(t){case 140:case 154:case 145:return function(e){var t=me();return Oe(e),Ye(L.createTypeOperatorNode(e,Ar()),t)}(t);case 137:return e=me(),Oe(137),Ye(L.createInferTypeNode(function(){var e=me(),t=rt(),r=Pe(Fr);return Ye(L.createTypeParameterDeclaration(void 0,t,r),e)}()),e)}return re(Nr)}function Pr(t){if(Mr()){var r=hr();return fe(r,e.isFunctionTypeNode(r)?t?e.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_a_union_type:e.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type:t?e.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type:e.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type),r}}function wr(e,t,r){var n=me(),i=51===e,a=Ue(e),o=a&&Pr(i)||t();if(ve()===e||a){for(var s=[o];Ue(e);)s.push(Pr(i)||t());o=Ye(r(Xe(s,n)),n);}return o}function Ir(){return wr(50,Ar,L.createIntersectionTypeNode)}function Or(){return xe(),103===ve()}function Mr(){return 29===ve()||!(20!==ve()||!Ae(Lr))||103===ve()||126===ve()&&Ae(Or)}function Lr(){if(xe(),21===ve()||25===ve())return !0;if(function(){if(e.isModifierKind(ve())&&gi(),Ie()||108===ve())return xe(),!0;if(22===ve()||18===ve()){var t=v.length;return $n(),t===v.length}return !1}()){if(58===ve()||27===ve()||57===ve()||63===ve())return !0;if(21===ve()&&(xe(),38===ve()))return !0}return !1}function Rr(){var e=me(),t=Ie()&&Pe(Br),r=jr();return t?Ye(L.createTypePredicateNode(void 0,t,r),e):r}function Br(){var e=rt();if(139===ve()&&!c.hasPrecedingLineBreak())return xe(),e}function jr(){if(40960&O)return $(40960,jr);if(Mr())return hr();var e=me(),t=wr(51,Ir,L.createUnionTypeNode);if(!ce()&&!c.hasPrecedingLineBreak()&&Ue(94)){var r=ne(jr);Oe(57);var n=re(jr);Oe(58);var i=re(jr);return Ye(L.createConditionalTypeNode(t,r,n,i),e)}return t}function Jr(){return Ue(58)?jr():void 0}function zr(){switch(ve()){case 108:case 106:case 104:case 110:case 95:case 8:case 9:case 10:case 14:case 15:case 20:case 22:case 18:case 98:case 84:case 103:case 43:case 68:case 79:return !0;case 100:return Ae(dr);default:return Ie()}}function Kr(){if(zr())return !0;switch(ve()){case 39:case 40:case 54:case 53:case 89:case 112:case 114:case 45:case 46:case 29:case 132:case 125:case 80:return !0;default:return !(se()&&101===ve()||!(e.getBinaryOperatorPrecedence(ve())>0))||Ie()}}function Ur(){var e=le();e&&Y(!1);for(var t,r=me(),n=qr();t=Ve(27);)n=tn(n,t,qr(),r);return e&&Y(!0),n}function Vr(){return Ue(63)?qr():void 0}function qr(){if(125===ve()&&(oe()||Ae(Jn)))return function(){var e=me();return xe(),c.hasPrecedingLineBreak()||41!==ve()&&!Kr()?Ye(L.createYieldExpression(void 0,void 0),e):Ye(L.createYieldExpression(Ve(41),qr()),e)}();var t=function(){var e=20===ve()||29===ve()||131===ve()?Ae(Hr):38===ve()?1:0;if(0!==e)return 1===e?Xr(!0):Pe(Gr)}()||function(){if(131===ve()&&1===Ae(Qr)){var e=me(),t=mi();return Wr(e,Zr(0),t)}}();if(t)return t;var r=me(),n=Zr(0);return 79===n.kind&&38===ve()?Wr(r,n,void 0):e.isLeftHandSideExpression(n)&&e.isAssignmentOperator(Se())?tn(n,We(),qr(),r):function(t,r){var n,i=Ve(57);return i?Ye(L.createConditionalExpression(t,i,$(20480,qr),n=qe(58),e.nodeIsPresent(n)?qr():Ze(79,!1,e.Diagnostics._0_expected,e.tokenToString(58))),r):t}(n,r)}function Wr(t,r,n){e.Debug.assert(38===ve(),"parseSimpleArrowFunctionExpression should only have been called if we had a =>");var i=L.createParameterDeclaration(void 0,void 0,void 0,r,void 0,void 0,void 0);Ye(i,r.pos);var a=Xe([i],i.pos,i.end),o=qe(38),s=Yr(!!n);return q(Ye(L.createArrowFunction(n,void 0,a,void 0,o,s),t))}function Hr(){if(131===ve()){if(xe(),c.hasPrecedingLineBreak())return 0;if(20!==ve()&&29!==ve())return 0}var t=ve(),r=xe();if(20===t){if(21===r)switch(xe()){case 38:case 58:case 18:return 1;default:return 0}if(22===r||18===r)return 2;if(25===r)return 1;if(e.isModifierKind(r)&&131!==r&&Ae(mt))return Ae((function(){return 127===xe()}))?0:1;if(!Ie()&&108!==r)return 0;switch(xe()){case 58:return 1;case 57:return xe(),58===ve()||27===ve()||63===ve()||21===ve()?1:0;case 27:case 63:case 21:return 2}return 0}return e.Debug.assert(29===t),Ie()?1===y?Ae((function(){var e=xe();if(94===e)switch(xe()){case 63:case 31:return !1;default:return !0}else if(27===e||63===e)return !0;return !1}))?1:0:2:0}function Gr(){var t=c.getTokenPos();if(!(null==I?void 0:I.has(t))){var r=Xr(!1);return r||(I||(I=new e.Set)).add(t),r}}function Qr(){if(131===ve()){if(xe(),c.hasPrecedingLineBreak()||38===ve())return 0;var e=Zr(0);if(!c.hasPrecedingLineBreak()&&79===e.kind&&38===ve())return 1}return 0}function Xr(t){var r,n=me(),i=ye(),a=mi(),o=e.some(a,e.isAsyncModifier)?2:0,s=Xt();if(Oe(20)){if(t)r=tr(o,t);else {var c=tr(o,t);if(!c)return;r=c;}if(!Oe(21)&&!t)return}else {if(!t)return;r=At();}var l=er(58,!1);if(!l||t||!qt(l)){for(var u=l;191===(null==u?void 0:u.kind);)u=u.type;var _=u&&e.isJSDocFunctionType(u);if(t||38===ve()||!_&&18===ve()){var d=ve(),p=qe(38),f=38===d||18===d?Yr(e.some(a,e.isAsyncModifier)):rt();return U(Ye(L.createArrowFunction(a,s,r,l,p,f),n),i)}}}function Yr(e){if(18===ve())return On(e?2:0);if(26!==ve()&&98!==ve()&&84!==ve()&&Un()&&(18===ve()||98===ve()||84===ve()||59===ve()||!Kr()))return On(16|(e?2:0));var t=R;R=!1;var r=e?ie(qr):$(32768,qr);return R=t,r}function Zr(e){var t=me();return en(e,nn(),t)}function $r(e){return 101===e||160===e}function en(t,r,n){for(;;){Se();var i=e.getBinaryOperatorPrecedence(ve());if(!(42===ve()?i>=t:i>t))break;if(101===ve()&&se())break;if(127===ve()){if(c.hasPrecedingLineBreak())break;xe(),a=r,o=jr(),r=Ye(L.createAsExpression(a,o),a.pos);}else r=tn(r,We(),Zr(i),n);}var a,o;return r}function tn(e,t,r,n){return Ye(L.createBinaryExpression(e,t,r),n)}function rn(){var e=me();return Ye(L.createPrefixUnaryExpression(ve(),be(an)),e)}function nn(){if(function(){switch(ve()){case 39:case 40:case 54:case 53:case 89:case 112:case 114:case 132:return !1;case 29:if(1!==y)return !1;default:return !0}}()){var t=me(),r=on();return 42===ve()?en(e.getBinaryOperatorPrecedence(ve()),r,t):r}var n=ve(),i=an();if(42===ve()){t=e.skipTrivia(p,i.pos);var a=i.end;211===i.kind?pe(t,a,e.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses):pe(t,a,e.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses,e.tokenToString(n));}return i}function an(){switch(ve()){case 39:case 40:case 54:case 53:return rn();case 89:return e=me(),Ye(L.createDeleteExpression(be(an)),e);case 112:return function(){var e=me();return Ye(L.createTypeOfExpression(be(an)),e)}();case 114:return function(){var e=me();return Ye(L.createVoidExpression(be(an)),e)}();case 29:return function(){var e=me();Oe(29);var t=jr();Oe(31);var r=an();return Ye(L.createTypeAssertion(t,r),e)}();case 132:if(132===ve()&&(ue()||Ae(Jn)))return function(){var e=me();return Ye(L.createAwaitExpression(be(an)),e)}();default:return on()}var e;}function on(){if(45===ve()||46===ve()){var t=me();return Ye(L.createPrefixUnaryExpression(ve(),be(sn)),t)}if(1===y&&29===ve()&&Ae(vt))return ln(!0);var r=sn();if(e.Debug.assert(e.isLeftHandSideExpression(r)),(45===ve()||46===ve())&&!c.hasPrecedingLineBreak()){var n=ve();return xe(),Ye(L.createPostfixUnaryExpression(r,n),r.pos)}return r}function sn(){var t,r=me();return 100===ve()?Ae(ur)?(d|=2097152,t=We()):Ae(_r)?(xe(),xe(),t=Ye(L.createMetaProperty(100,nt()),r),d|=4194304):t=cn():t=106===ve()?function(){var t=me(),r=We();if(29===ve()){var n=me();void 0!==Pe(Tn)&&pe(n,me(),e.Diagnostics.super_may_not_use_type_arguments);}return 20===ve()||24===ve()||22===ve()?r:(qe(24,e.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access),Ye(L.createPropertyAccessExpression(r,Ot(!0,!0)),t))}():cn(),Dn(r,t)}function cn(){return hn(me(),Cn(),!0)}function ln(t,r,i){var a,o=me(),s=function(e){var t=me();if(Oe(29),31===ve())return Ne(),Ye(L.createJsxOpeningFragment(),t);var r,n=dn(),i=0==(262144&O)?Si():void 0,a=function(){var e=me();return Ye(L.createJsxAttributes(St(13,fn)),e)}();return 31===ve()?(Ne(),r=L.createJsxOpeningElement(n,i,a)):(Oe(43),Oe(31,void 0,!1)&&(e?xe():Ne()),r=L.createJsxSelfClosingElement(n,i,a)),Ye(r,t)}(t);if(280===s.kind){var c=_n(s),l=void 0,u=c[c.length-1];if(278===(null==u?void 0:u.kind)&&!P(u.openingElement.tagName,u.closingElement.tagName)&&P(s.tagName,u.closingElement.tagName)){var _=u.children.end,d=Ye(L.createJsxElement(u.openingElement,u.children,Ye(L.createJsxClosingElement(Ye(L.createIdentifier(""),_,_)),_,_)),u.openingElement.pos,_);c=Xe(n$4(n$4([],c.slice(0,c.length-1),!0),[d],!1),c.pos,_),l=u.closingElement;}else l=function(e,t){var r=me();Oe(30);var n=dn();return Oe(31,void 0,!1)&&(t||!P(e.tagName,n)?xe():Ne()),Ye(L.createJsxClosingElement(n),r)}(s,t),P(s.tagName,l.tagName)||(i&&e.isJsxOpeningElement(i)&&P(l.tagName,i.tagName)?fe(s.tagName,e.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag,e.getTextOfNodeFromSourceText(p,s.tagName)):fe(l.tagName,e.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0,e.getTextOfNodeFromSourceText(p,s.tagName)));a=Ye(L.createJsxElement(s,c,l),o);}else 283===s.kind?a=Ye(L.createJsxFragment(s,_n(s),function(t){var r=me();return Oe(30),e.tokenIsIdentifierOrKeyword(ve())&&fe(dn(),e.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment),Oe(31,void 0,!1)&&(t?xe():Ne()),Ye(L.createJsxJsxClosingFragment(),r)}(t)),o):(e.Debug.assert(279===s.kind),a=s);if(t&&29===ve()){var f=void 0===r?a.pos:r,g=Pe((function(){return ln(!0,f)}));if(g){var m=Ze(27,!1);return e.setTextRangePosWidth(m,g.pos,0),pe(e.skipTrivia(p,f),g.end,e.Diagnostics.JSX_expressions_must_have_one_parent_element),Ye(L.createBinaryExpression(a,m,g),o)}}return a}function un(t,r){switch(r){case 1:if(e.isJsxOpeningFragment(t))fe(t,e.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);else {var n=t.tagName;pe(e.skipTrivia(p,n.pos),n.end,e.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag,e.getTextOfNodeFromSourceText(p,t.tagName));}return;case 30:case 7:return;case 11:case 12:return i=me(),a=L.createJsxText(c.getTokenValue(),12===k),k=c.scanJsxToken(),Ye(a,i);case 18:return pn(!1);case 29:return ln(!1,void 0,t);default:return e.Debug.assertNever(r)}var i,a;}function _n(t){var r=[],n=me(),i=w;for(w|=16384;;){var a=un(t,k=c.reScanJsxToken());if(!a)break;if(r.push(a),e.isJsxOpeningElement(t)&&278===(null==a?void 0:a.kind)&&!P(a.openingElement.tagName,a.closingElement.tagName)&&P(t.tagName,a.closingElement.tagName))break}return w=i,Xe(r,n)}function dn(){var e=me();Ee();for(var t=108===ve()?We():nt();Ue(24);)t=Ye(L.createPropertyAccessExpression(t,Ot(!0,!1)),e);return t}function pn(e){var t,r,n=me();if(Oe(18))return 19!==ve()&&(t=Ve(25),r=Ur()),e?Oe(19):Oe(19,void 0,!1)&&Ne(),Ye(L.createJsxExpression(t,r),n)}function fn(){if(18===ve())return function(){var e=me();Oe(18),Oe(25);var t=Ur();return Oe(19),Ye(L.createJsxSpreadAttribute(t),e)}();Ee();var e=me();return Ye(L.createJsxAttribute(nt(),63!==ve()?void 0:10===(k=c.scanJsxAttributeValue())?jt():pn(!0)),e)}function gn(){return xe(),e.tokenIsIdentifierOrKeyword(ve())||22===ve()||bn()}function mn(t){if(32&t.flags)return !0;if(e.isNonNullExpression(t)){for(var r=t.expression;e.isNonNullExpression(r)&&!(32&r.flags);)r=r.expression;if(32&r.flags){for(;e.isNonNullExpression(t);)t.flags|=32,t=t.expression;return !0}}return !1}function yn(t,r,n){var i=Ot(!0,!0),a=n||mn(r),o=a?L.createPropertyAccessChain(r,n,i):L.createPropertyAccessExpression(r,i);return a&&e.isPrivateIdentifier(o.name)&&fe(o.name,e.Diagnostics.An_optional_chain_cannot_contain_private_identifiers),Ye(o,t)}function vn(t,r,n){var i;if(23===ve())i=Ze(79,!0,e.Diagnostics.An_element_access_expression_should_take_an_argument);else {var a=te(Ur);e.isStringOrNumericLiteralLike(a)&&(a.text=$e(a.text)),i=a;}return Oe(23),Ye(n||mn(r)?L.createElementAccessChain(r,n,i):L.createElementAccessExpression(r,i),t)}function hn(t,r,n){for(;;){var i=void 0,a=!1;if(n&&28===ve()&&Ae(gn)?(i=qe(28),a=e.tokenIsIdentifierOrKeyword(ve())):a=Ue(24),a)r=yn(t,r,i);else if(!i&&le()||!Ue(22)){if(!bn()){if(!i){if(53===ve()&&!c.hasPrecedingLineBreak()){xe(),r=Ye(L.createNonNullExpression(r),t);continue}var o=Pe(Tn);if(o){r=Ye(L.createExpressionWithTypeArguments(r,o),t);continue}}return r}r=i||228!==r.kind?xn(t,r,i,void 0):xn(t,r.expression,i,r.typeArguments);}else r=vn(t,r,i);}}function bn(){return 14===ve()||15===ve()}function xn(e,t,r,n){var i=L.createTaggedTemplateExpression(t,n,14===ve()?(Te(),jt()):Mt(!0));return (r||32&t.flags)&&(i.flags|=32),i.questionDotToken=r,Ye(i,e)}function Dn(t,r){for(;;){r=hn(t,r,!0);var n=void 0,i=Ve(28);if(i&&(n=Pe(Tn),bn()))r=xn(t,r,i,n);else {if(!n&&20!==ve()){if(i){var a=Ze(79,!1,e.Diagnostics.Identifier_expected);r=Ye(L.createPropertyAccessChain(r,i,a),t);}break}i||228!==r.kind||(n=r.typeArguments,r=r.expression);var o=Sn();r=Ye(i||mn(r)?L.createCallChain(r,i,n,o):L.createCallExpression(r,n,o),t);}}return r}function Sn(){Oe(20);var e=Nt(11,En);return Oe(21),e}function Tn(){if(0==(262144&O)&&29===Ce()){xe();var e=Nt(20,jr);if(31===Se())return xe(),e&&function(){switch(ve()){case 20:case 14:case 15:return !0}return !Kr()}()?e:void 0}}function Cn(){switch(ve()){case 8:case 9:case 10:case 14:return jt();case 108:case 106:case 104:case 110:case 95:return We();case 20:return function(){var e=me(),t=ye();Oe(20);var r=te(Ur);return Oe(21),U(Ye(L.createParenthesizedExpression(r),e),t)}();case 22:return Nn();case 18:return An();case 131:if(!Ae(jn))break;return Pn();case 84:return hi(me(),ye(),void 0,void 0,226);case 98:return Pn();case 103:return function(){var e=me();if(Oe(103),Ue(24)){var t=nt();return Ye(L.createMetaProperty(103,t),e)}var r,n=hn(me(),Cn(),!1);228===n.kind&&(r=n.typeArguments,n=n.expression);var i=20===ve()?Sn():void 0;return Ye(L.createNewExpression(n,r,i),e)}();case 43:case 68:if(13===(k=c.reScanSlashToken()))return jt();break;case 15:return Mt(!1);case 80:return ot()}return rt(e.Diagnostics.Expression_expected)}function kn(){return 25===ve()?function(){var e=me();Oe(25);var t=qr();return Ye(L.createSpreadElement(t),e)}():27===ve()?Ye(L.createOmittedExpression(),me()):qr()}function En(){return $(20480,kn)}function Nn(){var e=me(),t=c.getTokenPos(),r=Oe(22),n=c.hasPrecedingLineBreak(),i=Nt(15,kn);return Ke(22,23,r,t),Ye(L.createArrayLiteralExpression(i,n),e)}function Fn(){var e=me(),t=ye();if(Ve(25)){var r=qr();return U(Ye(L.createSpreadAssignment(r),e),t)}var n=pi(),i=gi();if(st(136))return li(e,t,n,i,172);if(st(149))return li(e,t,n,i,173);var a,o=Ve(41),s=Ie(),c=at(),l=Ve(57),u=Ve(53);if(o||20===ve()||29===ve())return oi(e,t,n,i,o,c,l,u);if(s&&58!==ve()){var _=Ve(63),d=_?te(qr):void 0;(a=L.createShorthandPropertyAssignment(c,d)).equalsToken=_;}else {Oe(58);var p=te(qr);a=L.createPropertyAssignment(c,p);}return a.decorators=n,a.modifiers=i,a.questionToken=l,a.exclamationToken=u,U(Ye(a,e),t)}function An(){var e=me(),t=c.getTokenPos(),r=Oe(18),n=c.hasPrecedingLineBreak(),i=Nt(12,Fn,!0);return Ke(18,19,r,t),Ye(L.createObjectLiteralExpression(i,n),e)}function Pn(){var t=le();Y(!1);var r=me(),n=ye(),i=gi();Oe(98);var a=Ve(41),o=a?1:0,s=e.some(i,e.isAsyncModifier)?2:0,c=o&&s?ee(40960,wn):o?ee(8192,wn):s?ie(wn):wn(),l=Xt(),u=rr(o|s),_=er(58,!1),d=On(o|s);return Y(t),U(Ye(L.createFunctionExpression(i,a,c,l,u,_,d),r),n)}function wn(){return we()?tt():void 0}function In(t,r){var n=me(),i=ye(),a=c.getTokenPos(),o=Oe(18,r);if(o||t){var s=c.hasPrecedingLineBreak(),l=St(1,qn);Ke(18,19,o,a);var u=U(Ye(L.createBlock(l,s),n),i);return 63===ve()&&(_e(e.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses),xe()),u}return l=At(),U(Ye(L.createBlock(l,void 0),n),i)}function On(e,t){var r=oe();X(!!(1&e));var n=ue();Z(!!(2&e));var i=R;R=!1;var a=le();a&&Y(!1);var o=In(!!(16&e),t);return a&&Y(!0),R=i,X(r),Z(n),o}function Mn(e){var t=me(),r=ye();Oe(246===e?81:86);var n=He()?void 0:rt();return Qe(),U(Ye(246===e?L.createBreakStatement(n):L.createContinueStatement(n),t),r)}function Ln(){return 82===ve()?function(){var e=me(),t=ye();Oe(82);var r=te(Ur);Oe(58);var n=St(3,qn);return U(Ye(L.createCaseClause(r,n),e),t)}():function(){var e=me();Oe(88),Oe(58);var t=St(3,qn);return Ye(L.createDefaultClause(t),e)}()}function Rn(){return xe(),e.tokenIsIdentifierOrKeyword(ve())&&!c.hasPrecedingLineBreak()}function Bn(){return xe(),84===ve()&&!c.hasPrecedingLineBreak()}function jn(){return xe(),98===ve()&&!c.hasPrecedingLineBreak()}function Jn(){return xe(),(e.tokenIsIdentifierOrKeyword(ve())||8===ve()||9===ve()||10===ve())&&!c.hasPrecedingLineBreak()}function zn(){for(;;)switch(ve()){case 113:case 119:case 85:case 98:case 84:case 92:return !0;case 118:case 152:return xe(),!c.hasPrecedingLineBreak()&&Ie();case 141:case 142:return xe(),!c.hasPrecedingLineBreak()&&(Ie()||10===ve());case 126:case 131:case 135:case 121:case 122:case 123:case 145:if(xe(),c.hasPrecedingLineBreak())return !1;continue;case 157:return xe(),18===ve()||79===ve()||93===ve();case 100:return xe(),10===ve()||41===ve()||18===ve()||e.tokenIsIdentifierOrKeyword(ve());case 93:var t=xe();if(152===t&&(t=Ae(xe)),63===t||41===t||18===t||88===t||127===t)return !0;continue;case 124:xe();continue;default:return !1}}function Kn(){return Ae(zn)}function Un(){switch(ve()){case 59:case 26:case 18:case 113:case 119:case 98:case 84:case 92:case 99:case 90:case 115:case 97:case 86:case 81:case 105:case 116:case 107:case 109:case 111:case 87:case 83:case 96:return !0;case 100:return Kn()||Ae(dr);case 85:case 93:return Kn();case 131:case 135:case 118:case 141:case 142:case 152:case 157:return !0;case 123:case 121:case 122:case 124:case 145:return Kn()||!Ae(Rn);default:return Kr()}}function Vn(){return xe(),we()||18===ve()||22===ve()}function qn(){switch(ve()){case 26:return t=me(),r=ye(),Oe(26),U(Ye(L.createEmptyStatement(),t),r);case 18:return In(!1);case 113:return ii(me(),ye(),void 0,void 0);case 119:if(Ae(Vn))return ii(me(),ye(),void 0,void 0);break;case 98:return ai(me(),ye(),void 0,void 0);case 84:return vi(me(),ye(),void 0,void 0);case 99:return function(){var e=me(),t=ye();Oe(99);var r=c.getTokenPos(),n=Oe(20),i=te(Ur);Ke(20,21,n,r);var a=qn(),o=Ue(91)?qn():void 0;return U(Ye(L.createIfStatement(i,a,o),e),t)}();case 90:return function(){var e=me(),t=ye();Oe(90);var r=qn();Oe(115);var n=c.getTokenPos(),i=Oe(20),a=te(Ur);return Ke(20,21,i,n),Ue(26),U(Ye(L.createDoStatement(r,a),e),t)}();case 115:return function(){var e=me(),t=ye();Oe(115);var r=c.getTokenPos(),n=Oe(20),i=te(Ur);Ke(20,21,n,r);var a=qn();return U(Ye(L.createWhileStatement(i,a),e),t)}();case 97:return function(){var e=me(),t=ye();Oe(97);var r,n,i=Ve(132);if(Oe(20),26!==ve()&&(r=113===ve()||119===ve()||85===ve()?ri(!0):ee(4096,Ur)),i?Oe(160):Ue(160)){var a=te(qr);Oe(21),n=L.createForOfStatement(i,r,a,qn());}else if(Ue(101))a=te(Ur),Oe(21),n=L.createForInStatement(r,a,qn());else {Oe(26);var o=26!==ve()&&21!==ve()?te(Ur):void 0;Oe(26);var s=21!==ve()?te(Ur):void 0;Oe(21),n=L.createForStatement(r,o,s,qn());}return U(Ye(n,e),t)}();case 86:return Mn(245);case 81:return Mn(246);case 105:return function(){var e=me(),t=ye();Oe(105);var r=He()?void 0:te(Ur);return Qe(),U(Ye(L.createReturnStatement(r),e),t)}();case 116:return function(){var e=me(),t=ye();Oe(116);var r=c.getTokenPos(),n=Oe(20),i=te(Ur);Ke(20,21,n,r);var a=ee(33554432,qn);return U(Ye(L.createWithStatement(i,a),e),t)}();case 107:return function(){var e=me(),t=ye();Oe(107),Oe(20);var r=te(Ur);Oe(21);var n=function(){var e=me();Oe(18);var t=St(2,Ln);return Oe(19),Ye(L.createCaseBlock(t),e)}();return U(Ye(L.createSwitchStatement(r,n),e),t)}();case 109:return function(){var e=me(),t=ye();Oe(109);var r=c.hasPrecedingLineBreak()?void 0:te(Ur);return void 0===r&&(A++,r=Ye(L.createIdentifier(""),me())),Ge()||je(r),U(Ye(L.createThrowStatement(r),e),t)}();case 111:case 83:case 96:return function(){var t=me(),r=ye();Oe(111);var n,i=In(!1),a=83===ve()?function(){var e,t=me();Oe(83),Ue(20)?(e=ti(),Oe(21)):e=void 0;var r=In(!1);return Ye(L.createCatchClause(e,r),t)}():void 0;return a&&96!==ve()||(Oe(96,e.Diagnostics.catch_or_finally_expected),n=In(!1)),U(Ye(L.createTryStatement(i,a,n),t),r)}();case 87:return function(){var e=me(),t=ye();return Oe(87),Qe(),U(Ye(L.createDebuggerStatement(),e),t)}();case 59:return Hn();case 131:case 118:case 152:case 141:case 142:case 135:case 85:case 92:case 93:case 100:case 121:case 122:case 123:case 126:case 124:case 145:case 157:if(Kn())return Hn()}var t,r;return function(){var t,r=me(),n=ye(),i=20===ve(),a=te(Ur);return e.isIdentifier(a)&&Ue(58)?t=L.createLabeledStatement(a,qn()):(Ge()||je(a),t=L.createExpressionStatement(a),i&&(n=!1)),U(Ye(t,r),n)}()}function Wn(e){return 135===e.kind}function Hn(){var t=e.some(Ae((function(){return pi(),gi()})),Wn);if(t){var r=ee(16777216,(function(){var e=Ct(w);if(e)return kt(e)}));if(r)return r}var n=me(),i=ye(),a=pi(),o=gi();if(t){for(var s=0,c=o;s<c.length;s++)c[s].flags|=16777216;return ee(16777216,(function(){return Gn(n,i,a,o)}))}return Gn(n,i,a,o)}function Gn(t,r,n,i){switch(ve()){case 113:case 119:case 85:return ii(t,r,n,i);case 98:return ai(t,r,n,i);case 84:return vi(t,r,n,i);case 118:return function(e,t,r,n){Oe(118);var i=rt(),a=Xt(),o=bi(),s=pr();return U(Ye(L.createInterfaceDeclaration(r,n,i,a,o,s),e),t)}(t,r,n,i);case 152:return function(e,t,r,n){Oe(152);var i=rt(),a=Xt();Oe(63);var o=138===ve()&&Pe(br)||jr();return Qe(),U(Ye(L.createTypeAliasDeclaration(r,n,i,a,o),e),t)}(t,r,n,i);case 92:return function(e,t,r,n){Oe(92);var i,a=rt();return Oe(18)?(i=$(40960,(function(){return Nt(6,Ci)})),Oe(19)):i=At(),U(Ye(L.createEnumDeclaration(r,n,a,i),e),t)}(t,r,n,i);case 157:case 141:case 142:return function(e,t,r,n){var i=0;if(157===ve())return Ni(e,t,r,n);if(Ue(142))i|=16;else if(Oe(141),10===ve())return Ni(e,t,r,n);return Ei(e,t,r,n,i)}(t,r,n,i);case 100:return function(e,t,r,n){Oe(100);var i,a=c.getStartPos();Ie()&&(i=rt());var o,s=!1;if(156===ve()||"type"!==(null==i?void 0:i.escapedText)||!Ie()&&41!==ve()&&18!==ve()||(s=!0,i=Ie()?rt():void 0),i&&27!==ve()&&156!==ve())return function(e,t,r,n,i,a){Oe(63);var o=146===ve()&&Ae(Fi)?function(){var e=me();Oe(146),Oe(20);var t=Oi();return Oe(21),Ye(L.createExternalModuleReference(t),e)}():wt(!1);return Qe(),U(Ye(L.createImportEqualsDeclaration(r,n,a,i,o),e),t)}(e,t,r,n,i,s);(i||41===ve()||18===ve())&&(o=function(e,t,r){var n;return e&&!Ue(27)||(n=41===ve()?function(){var e=me();Oe(41),Oe(127);var t=rt();return Ye(L.createNamespaceImport(t),e)}():Mi(269)),Ye(L.createImportClause(r,e,n),t)}(i,a,s),Oe(156));var l,u=Oi();return 129!==ve()||c.hasPrecedingLineBreak()||(l=Ii()),Qe(),U(Ye(L.createImportDeclaration(r,n,o,u,l),e),t)}(t,r,n,i);case 93:switch(xe(),ve()){case 88:case 63:return function(e,t,r,n){var i,a=ue();Z(!0),Ue(63)?i=!0:Oe(88);var o=qr();return Qe(),Z(a),U(Ye(L.createExportAssignment(r,n,i,o),e),t)}(t,r,n,i);case 127:return function(e,t,r,n){Oe(127),Oe(142);var i=rt();Qe();var a=L.createNamespaceExportDeclaration(i);return a.decorators=r,a.modifiers=n,U(Ye(a,e),t)}(t,r,n,i);default:return function(e,t,r,n){var i,a,o,s=ue();Z(!0);var l=Ue(152),u=me();return Ue(41)?(Ue(127)&&(i=function(e){return Ye(L.createNamespaceExport(nt()),e)}(u)),Oe(156),a=Oi()):(i=Mi(273),(156===ve()||10===ve()&&!c.hasPrecedingLineBreak())&&(Oe(156),a=Oi())),a&&129===ve()&&!c.hasPrecedingLineBreak()&&(o=Ii()),Qe(),Z(s),U(Ye(L.createExportDeclaration(r,n,l,i,a,o),e),t)}(t,r,n,i)}default:if(n||i){var a=Ze(276,!0,e.Diagnostics.Declaration_expected);return e.setTextRangePos(a,t),a.decorators=n,a.modifiers=i,a}return}}function Qn(e,t){if(18===ve()||!He())return On(e,t);Qe();}function Xn(){var e=me();if(27===ve())return Ye(L.createOmittedExpression(),e);var t=Ve(25),r=$n(),n=Vr();return Ye(L.createBindingElement(t,void 0,r,n),e)}function Yn(){var e,t=me(),r=Ve(25),n=we(),i=at();n&&58!==ve()?(e=i,i=void 0):(Oe(58),e=$n());var a=Vr();return Ye(L.createBindingElement(r,i,e,a),t)}function Zn(){return 18===ve()||22===ve()||80===ve()||we()}function $n(e){return 22===ve()?function(){var e=me();Oe(22);var t=Nt(10,Xn);return Oe(23),Ye(L.createArrayBindingPattern(t),e)}():18===ve()?function(){var e=me();Oe(18);var t=Nt(9,Yn);return Oe(19),Ye(L.createObjectBindingPattern(t),e)}():tt(e)}function ei(){return ti(!0)}function ti(t){var r,n=me(),i=ye(),a=$n(e.Diagnostics.Private_identifiers_are_not_allowed_in_variable_declarations);t&&79===a.kind&&53===ve()&&!c.hasPrecedingLineBreak()&&(r=We());var o=Jr(),s=$r(ve())?void 0:Vr();return U(Ye(L.createVariableDeclaration(a,r,o,s),n),i)}function ri(t){var r,n=me(),i=0;switch(ve()){case 113:break;case 119:i|=1;break;case 85:i|=2;break;default:e.Debug.fail();}if(xe(),160===ve()&&Ae(ni))r=At();else {var a=se();Q(t),r=Nt(8,t?ti:ei),Q(a);}return Ye(L.createVariableDeclarationList(r,i),n)}function ni(){return mt()&&21===xe()}function ii(e,t,r,n){var i=ri(!1);Qe();var a=L.createVariableStatement(n,i);return a.decorators=r,U(Ye(a,e),t)}function ai(t,r,n,i){var a=ue(),o=e.modifiersToFlags(i);Oe(98);var s=Ve(41),c=512&o?wn():tt(),l=s?1:0,u=256&o?2:0,_=Xt();1&o&&Z(!0);var d=rr(l|u),p=er(58,!1),f=Qn(l|u,e.Diagnostics.or_expected);return Z(a),U(Ye(L.createFunctionDeclaration(n,i,s,c,_,d,p,f),t),r)}function oi(t,r,n,i,a,o,s,c,l){var u=a?1:0,_=e.some(i,e.isAsyncModifier)?2:0,d=Xt(),p=rr(u|_),f=er(58,!1),g=Qn(u|_,l),m=L.createMethodDeclaration(n,i,a,o,s,d,p,f,g);return m.exclamationToken=c,U(Ye(m,t),r)}function si(t,r,n,i,a,o){var s=o||c.hasPrecedingLineBreak()?void 0:Ve(53),l=Jr(),u=$(45056,Vr);return function(t,r,n){if(59!==ve()||c.hasPrecedingLineBreak())return 20===ve()?(_e(e.Diagnostics.Cannot_start_a_function_call_in_a_type_annotation),void xe()):void(!r||He()?Ge()||(n?_e(e.Diagnostics._0_expected,e.tokenToString(26)):je(t)):n?_e(e.Diagnostics._0_expected,e.tokenToString(26)):_e(e.Diagnostics.Expected_for_property_initializer));_e(e.Diagnostics.Decorators_must_precede_the_name_and_all_keywords_of_property_declarations);}(a,l,u),U(Ye(L.createPropertyDeclaration(n,i,a,o||s,l,u),t),r)}function ci(t,r,n,i){var a=Ve(41),o=at(),s=Ve(57);return a||20===ve()||29===ve()?oi(t,r,n,i,a,o,s,void 0,e.Diagnostics.or_expected):si(t,r,n,i,o,s)}function li(e,t,r,n,i){var a=at(),o=Xt(),s=rr(0),c=er(58,!1),l=Qn(0),u=172===i?L.createGetAccessorDeclaration(r,n,a,s,c,l):L.createSetAccessorDeclaration(r,n,a,s,l);return u.typeParameters=o,c&&173===u.kind&&(u.type=c),U(Ye(u,e),t)}function ui(){var t;if(59===ve())return !0;for(;e.isModifierKind(ve());){if(t=ve(),e.isClassMemberModifier(t))return !0;xe();}if(41===ve())return !0;if(it()&&(t=ve(),xe()),22===ve())return !0;if(void 0!==t){if(!e.isKeyword(t)||149===t||136===t)return !0;switch(ve()){case 20:case 29:case 53:case 58:case 63:case 57:return !0;default:return He()}}return !1}function _i(){if(ue()&&132===ve()){var t=me(),r=rt(e.Diagnostics.Expression_expected);return xe(),Dn(t,hn(t,r,!0))}return sn()}function di(){var e=me();if(Ue(59)){var t=ee(16384,_i);return Ye(L.createDecorator(t),e)}}function pi(){for(var t,r,n=me();r=di();)t=e.append(t,r);return t&&Xe(t,n)}function fi(t,r,n){var i=me(),a=ve();if(85===ve()&&t){if(!Pe(ct))return}else {if(r&&124===ve()&&Ae(Ai))return;if(n&&124===ve())return;if(!e.isModifierKind(ve())||!Pe(lt))return}return Ye(L.createToken(a),i)}function gi(t,r){for(var n,i,a=me(),o=!1;i=fi(t,r,o);)124===i.kind&&(o=!0),n=e.append(n,i);return n&&Xe(n,a)}function mi(){var e;if(131===ve()){var t=me();xe(),e=Xe([Ye(L.createToken(131),t)],t);}return e}function yi(){var t=me();if(26===ve())return xe(),Ye(L.createSemicolonClassElement(),t);var r=ye(),n=pi(),i=gi(!0,!0);if(124===ve()&&Ae(Ai))return function(e,t,r,n){qe(124);var i=function(){var e=oe(),t=ue();X(!1),Z(!0);var r=In(!1);return X(e),Z(t),r}();return U(Ye(L.createClassStaticBlockDeclaration(r,n,i),e),t)}(t,r,n,i);if(st(136))return li(t,r,n,i,172);if(st(149))return li(t,r,n,i,173);if(134===ve()||10===ve()){var a=function(t,r,n,i){return Pe((function(){if(134===ve()?Oe(134):10===ve()&&20===Ae(xe)?Pe((function(){var e=jt();return "constructor"===e.text?e:void 0})):void 0){var a=Xt(),o=rr(0),s=er(58,!1),c=Qn(0,e.Diagnostics.or_expected),l=L.createConstructorDeclaration(n,i,o,c);return l.typeParameters=a,l.type=s,U(Ye(l,t),r)}}))}(t,r,n,i);if(a)return a}if(ar())return sr(t,r,n,i);if(e.tokenIsIdentifierOrKeyword(ve())||10===ve()||8===ve()||41===ve()||22===ve()){if(e.some(i,Wn)){for(var o=0,s=i;o<s.length;o++)s[o].flags|=16777216;return ee(16777216,(function(){return ci(t,r,n,i)}))}return ci(t,r,n,i)}if(n||i){var c=Ze(79,!0,e.Diagnostics.Declaration_expected);return si(t,r,n,i,c,void 0)}return e.Debug.fail("Should not have attempted to parse class member declaration.")}function vi(e,t,r,n){return hi(e,t,r,n,257)}function hi(t,r,n,i,a){var o=ue();Oe(84);var s=!we()||117===ve()&&Ae(yt)?void 0:et(we()),c=Xt();e.some(i,e.isExportModifier)&&Z(!0);var l,u=bi();return Oe(18)?(l=St(5,yi),Oe(19)):l=At(),Z(o),U(Ye(257===a?L.createClassDeclaration(n,i,s,c,u,l):L.createClassExpression(n,i,s,c,u,l),t),r)}function bi(){if(Ti())return St(22,xi)}function xi(){var t=me(),r=ve();e.Debug.assert(94===r||117===r),xe();var n=Nt(7,Di);return Ye(L.createHeritageClause(r,n),t)}function Di(){var e=me(),t=sn();if(228===t.kind)return t;var r=Si();return Ye(L.createExpressionWithTypeArguments(t,r),e)}function Si(){return 29===ve()?Pt(20,jr,29,31):void 0}function Ti(){return 94===ve()||117===ve()}function Ci(){var e=me(),t=ye(),r=at(),n=te(Vr);return U(Ye(L.createEnumMember(r,n),e),t)}function ki(){var e,t=me();return Oe(18)?(e=St(1,qn),Oe(19)):e=At(),Ye(L.createModuleBlock(e),t)}function Ei(e,t,r,n,i){var a=16&i,o=rt(),s=Ue(24)?Ei(me(),!1,void 0,void 0,4|a):ki();return U(Ye(L.createModuleDeclaration(r,n,o,s,i),e),t)}function Ni(e,t,r,n){var i,a,o=0;return 157===ve()?(i=rt(),o|=1024):(i=jt()).text=$e(i.text),18===ve()?a=ki():Qe(),U(Ye(L.createModuleDeclaration(r,n,i,a,o),e),t)}function Fi(){return 20===xe()}function Ai(){return 18===xe()}function Pi(){return 43===xe()}function wi(){var t=me(),r=e.tokenIsIdentifierOrKeyword(ve())?nt():zt(10);Oe(58);var n=qr();return Ye(L.createAssertEntry(r,n),t)}function Ii(t){var r=me();t||Oe(129);var n=c.getTokenPos();if(Oe(18)){var i=c.hasPrecedingLineBreak(),a=Nt(24,wi,!0);if(!Oe(19)){var o=e.lastOrUndefined(v);o&&o.code===e.Diagnostics._0_expected.code&&e.addRelatedInfo(o,e.createDetachedDiagnostic(u,n,1,e.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here,"{","}"));}return Ye(L.createAssertClause(a,i),r)}return a=Xe([],me(),void 0,!1),Ye(L.createAssertClause(a,!1),r)}function Oi(){if(10===ve()){var e=jt();return e.text=$e(e.text),e}return Ur()}function Mi(e){var t=me();return Ye(269===e?L.createNamedImports(Pt(23,Ri,18,19)):L.createNamedExports(Pt(23,Li,18,19)),t)}function Li(){var e=ye();return U(Bi(275),e)}function Ri(){return Bi(270)}function Bi(t){var r,n=me(),i=e.isKeyword(ve())&&!Ie(),a=c.getTokenPos(),o=c.getTextPos(),s=!1,l=!0,u=nt();if("type"===u.escapedText)if(127===ve()){var _=nt();if(127===ve()){var d=nt();e.tokenIsIdentifierOrKeyword(ve())?(s=!0,r=_,u=p(),l=!1):(r=u,u=d,l=!1);}else e.tokenIsIdentifierOrKeyword(ve())?(r=u,l=!1,u=p()):(s=!0,u=_);}else e.tokenIsIdentifierOrKeyword(ve())&&(s=!0,u=p());return l&&127===ve()&&(r=u,Oe(127),u=p()),270===t&&i&&pe(a,o,e.Diagnostics.Identifier_expected),Ye(270===t?L.createImportSpecifier(s,r,u):L.createExportSpecifier(s,r,u),n);function p(){return i=e.isKeyword(ve())&&!Ie(),a=c.getTokenPos(),o=c.getTextPos(),nt()}}!function(e){e[e.SourceElements=0]="SourceElements",e[e.BlockStatements=1]="BlockStatements",e[e.SwitchClauses=2]="SwitchClauses",e[e.SwitchClauseStatements=3]="SwitchClauseStatements",e[e.TypeMembers=4]="TypeMembers",e[e.ClassMembers=5]="ClassMembers",e[e.EnumMembers=6]="EnumMembers",e[e.HeritageClauseElement=7]="HeritageClauseElement",e[e.VariableDeclarations=8]="VariableDeclarations",e[e.ObjectBindingElements=9]="ObjectBindingElements",e[e.ArrayBindingElements=10]="ArrayBindingElements",e[e.ArgumentExpressions=11]="ArgumentExpressions",e[e.ObjectLiteralMembers=12]="ObjectLiteralMembers",e[e.JsxAttributes=13]="JsxAttributes",e[e.JsxChildren=14]="JsxChildren",e[e.ArrayLiteralMembers=15]="ArrayLiteralMembers",e[e.Parameters=16]="Parameters",e[e.JSDocParameters=17]="JSDocParameters",e[e.RestProperties=18]="RestProperties",e[e.TypeParameters=19]="TypeParameters",e[e.TypeArguments=20]="TypeArguments",e[e.TupleElementTypes=21]="TupleElementTypes",e[e.HeritageClauses=22]="HeritageClauses",e[e.ImportOrExportSpecifiers=23]="ImportOrExportSpecifiers",e[e.AssertEntries=24]="AssertEntries",e[e.Count=25]="Count";}(Me||(Me={})),function(e){e[e.False=0]="False",e[e.True=1]="True",e[e.Unknown=2]="Unknown";}(Le||(Le={})),function(t){function r(e){var t=me(),r=(e?Ue:Oe)(18),n=ee(8388608,Gt);e&&!r||ze(19);var i=L.createJSDocTypeExpression(n);return W(i),Ye(i,t)}function n(){for(var e=me(),t=Ue(18),r=me(),n=wt(!1);80===ve();)ke(),De(),n=Ye(L.createJSDocMemberName(n,rt()),r);t&&ze(19);var i=L.createJSDocNameReference(n);return W(i),Ye(i,e)}var i,a;function o(t,i){void 0===t&&(t=0);var a=p,o=void 0===i?a.length:t+i;if(i=o-t,e.Debug.assert(t>=0),e.Debug.assert(t<=o),e.Debug.assert(o<=a.length),f(a,t)){var s,l,_,d,g,m=[],y=[];return c.scanRange(t+3,i-5,(function(){var r,n,i=1,u=t-(a.lastIndexOf("\n",t)+1)+4;function p(e){r||(r=u),m.push(e),u+=e.length;}for(De();W(5););W(4)&&(i=0,u=0);e:for(;;){switch(ve()){case 59:0===i||1===i?(h(m),g||(g=me()),(n=S(u))&&(s?s.push(n):(s=[n],l=n.pos),_=n.end),i=0,r=void 0):p(c.getTokenText());break;case 4:m.push(c.getTokenText()),i=0,u=0;break;case 41:var f=c.getTokenText();1===i||2===i?(i=2,p(f)):(i=1,u+=f.length);break;case 5:var b=c.getTokenText();2===i?m.push(b):void 0!==r&&u+b.length>r&&m.push(b.slice(r-u)),u+=b.length;break;case 1:break e;case 18:i=2;var x=c.getStartPos(),D=E(c.getTextPos()-1);if(D){d||v(m),y.push(Ye(L.createJSDocText(m.join("")),null!=d?d:t,x)),y.push(D),m=[],d=c.getTextPos();break}default:i=2,p(c.getTokenText());}De();}h(m),y.length&&m.length&&y.push(Ye(L.createJSDocText(m.join("")),null!=d?d:t,g)),y.length&&s&&e.Debug.assertIsDefined(g,"having parsed tags implies that the end of the comment span should be set");var T=s&&Xe(s,l,_);return Ye(L.createJSDocComment(y.length?Xe(y,t,g):m.length?m.join(""):void 0,T),t,o)}))}function v(e){for(;e.length&&("\n"===e[0]||"\r"===e[0]);)e.shift();}function h(e){for(;e.length&&""===e[e.length-1].trim();)e.pop();}function b(){for(;;){if(De(),1===ve())return !0;if(5!==ve()&&4!==ve())return !1}}function x(){if(5!==ve()&&4!==ve()||!Ae(b))for(;5===ve()||4===ve();)De();}function D(){if((5===ve()||4===ve())&&Ae(b))return "";for(var e=c.hasPrecedingLineBreak(),t=!1,r="";e&&41===ve()||5===ve()||4===ve();)r+=c.getTokenText(),4===ve()?(e=!0,t=!0,r=""):41===ve()&&(e=!1),De();return t?r:""}function S(t){e.Debug.assert(59===ve());var i=c.getTokenPos();De();var a,o=H(void 0),l=D();switch(o.escapedText){case"author":a=function(t,r,n,i){var a=me(),o=function(){for(var e=[],t=!1,r=c.getToken();1!==r&&4!==r;){if(29===r)t=!0;else {if(59===r&&!t)break;if(31===r&&t){e.push(c.getTokenText()),c.setTextPos(c.getTokenPos()+1);break}}e.push(c.getTokenText()),r=De();}return L.createJSDocText(e.join(""))}(),s=c.getStartPos(),l=T(t,s,n,i);l||(s=c.getStartPos());var u="string"!=typeof l?Xe(e.concatenate([Ye(o,a,s)],l),a):o.text+l;return Ye(L.createJSDocAuthorTag(r,u),t)}(i,o,t,l);break;case"implements":a=function(e,t,r,n){var i=R();return Ye(L.createJSDocImplementsTag(t,i,T(e,me(),r,n)),e)}(i,o,t,l);break;case"augments":case"extends":a=function(e,t,r,n){var i=R();return Ye(L.createJSDocAugmentsTag(t,i,T(e,me(),r,n)),e)}(i,o,t,l);break;case"class":case"constructor":a=B(i,L.createJSDocClassTag,o,t,l);break;case"public":a=B(i,L.createJSDocPublicTag,o,t,l);break;case"private":a=B(i,L.createJSDocPrivateTag,o,t,l);break;case"protected":a=B(i,L.createJSDocProtectedTag,o,t,l);break;case"readonly":a=B(i,L.createJSDocReadonlyTag,o,t,l);break;case"override":a=B(i,L.createJSDocOverrideTag,o,t,l);break;case"deprecated":V=!0,a=B(i,L.createJSDocDeprecatedTag,o,t,l);break;case"this":a=function(e,t,n,i){var a=r(!0);return x(),Ye(L.createJSDocThisTag(t,a,T(e,me(),n,i)),e)}(i,o,t,l);break;case"enum":a=function(e,t,n,i){var a=r(!0);return x(),Ye(L.createJSDocEnumTag(t,a,T(e,me(),n,i)),e)}(i,o,t,l);break;case"arg":case"argument":case"param":return O(i,o,2,t);case"return":case"returns":a=function(t,r,n,i){e.some(s,e.isJSDocReturnTag)&&pe(r.pos,c.getTokenPos(),e.Diagnostics._0_tag_already_specified,r.escapedText);var a=P();return Ye(L.createJSDocReturnTag(r,a,T(t,me(),n,i)),t)}(i,o,t,l);break;case"template":a=function(e,t,n,i){var a=18===ve()?r():void 0,o=function(){var e=me(),t=[];do{x();var r=q();void 0!==r&&t.push(r),D();}while(W(27));return Xe(t,e)}();return Ye(L.createJSDocTemplateTag(t,a,o,T(e,me(),n,i)),e)}(i,o,t,l);break;case"type":a=M(i,o,t,l);break;case"typedef":a=function(t,r,n,i){var a,o=P();D();var s=j();x();var c,l=C(n);if(!o||I(o.type)){for(var _=void 0,d=void 0,p=void 0,f=!1;_=Pe((function(){return z(n)}));)if(f=!0,343===_.kind){if(d){var g=_e(e.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);g&&e.addRelatedInfo(g,e.createDetachedDiagnostic(u,0,0,e.Diagnostics.The_tag_was_first_specified_here));break}d=_;}else p=e.append(p,_);if(f){var m=o&&183===o.type.kind,y=L.createJSDocTypeLiteral(p,m);c=(o=d&&d.typeExpression&&!I(d.typeExpression.type)?d.typeExpression:Ye(y,t)).end;}}return c=c||void 0!==l?me():(null!==(a=null!=s?s:o)&&void 0!==a?a:r).end,l||(l=T(t,c,n,i)),Ye(L.createJSDocTypedefTag(r,o,s,l),t,c)}(i,o,t,l);break;case"callback":a=function(t,r,n,i){var a=j();x();var o=C(n),s=function(t){for(var r,n,i=me();r=Pe((function(){return K(4,t)}));)n=e.append(n,r);return Xe(n||[],i)}(n),c=Pe((function(){if(W(59)){var e=S(n);if(e&&341===e.kind)return e}})),l=Ye(L.createJSDocSignature(void 0,s,c),t);o||(o=T(t,me(),n,i));var u=void 0!==o?me():l.end;return Ye(L.createJSDocCallbackTag(r,l,a,o),t,u)}(i,o,t,l);break;case"see":a=function(t,r,i,a){var o=22===ve()||Ae((function(){return 59===De()&&e.tokenIsIdentifierOrKeyword(De())&&F(c.getTokenValue())}))?void 0:n(),s=void 0!==i&&void 0!==a?T(t,me(),i,a):void 0;return Ye(L.createJSDocSeeTag(r,o,s),t)}(i,o,t,l);break;default:a=function(e,t,r,n){return Ye(L.createJSDocUnknownTag(t,T(e,me(),r,n)),e)}(i,o,t,l);}return a}function T(e,t,r,n){return n||(r+=t-e),C(r,n.slice(r))}function C(e,t){var r,n,i=me(),a=[],o=[],s=0,l=!0;function u(t){n||(n=e),a.push(t),e+=t.length;}void 0!==t&&(""!==t&&u(t),s=1);var _=ve();e:for(;;){switch(_){case 4:s=0,a.push(c.getTokenText()),e=0;break;case 59:if(3===s||2===s&&(!l||Ae(k))){a.push(c.getTokenText());break}c.setTextPos(c.getTextPos()-1);case 1:break e;case 5:if(2===s||3===s)u(c.getTokenText());else {var d=c.getTokenText();void 0!==n&&e+d.length>n&&a.push(d.slice(n-e)),e+=d.length;}break;case 18:s=2;var p=c.getStartPos(),f=E(c.getTextPos()-1);f?(o.push(Ye(L.createJSDocText(a.join("")),null!=r?r:i,p)),o.push(f),a=[],r=c.getTextPos()):u(c.getTokenText());break;case 61:s=3===s?2:3,u(c.getTokenText());break;case 41:if(0===s){s=1,e+=1;break}default:3!==s&&(s=2),u(c.getTokenText());}l=5===ve(),_=De();}return v(a),h(a),o.length?(a.length&&o.push(Ye(L.createJSDocText(a.join("")),null!=r?r:i)),Xe(o,i,c.getTextPos())):a.length?a.join(""):void 0}function k(){var e=De();return 5===e||4===e}function E(t){var r=Pe(N);if(r){De(),x();var n=me(),i=e.tokenIsIdentifierOrKeyword(ve())?wt(!0):void 0;if(i)for(;80===ve();)ke(),De(),i=Ye(L.createJSDocMemberName(i,rt()),n);for(var a=[];19!==ve()&&4!==ve()&&1!==ve();)a.push(c.getTokenText()),De();return Ye(("link"===r?L.createJSDocLink:"linkcode"===r?L.createJSDocLinkCode:L.createJSDocLinkPlain)(i,a.join("")),t,c.getTextPos())}}function N(){if(D(),18===ve()&&59===De()&&e.tokenIsIdentifierOrKeyword(De())){var t=c.getTokenValue();if(F(t))return t}}function F(e){return "link"===e||"linkcode"===e||"linkplain"===e}function P(){return D(),18===ve()?r():void 0}function w(){var t=W(22);t&&x();var r=W(61),n=function(){var e=H();for(Ue(22)&&Oe(23);Ue(24);){var t=H();Ue(22)&&Oe(23),e=It(e,t);}return e}();return r&&(function(e){if(ve()===e)return t=me(),r=ve(),De(),Ye(L.createToken(r),t);var t,r;}(61)||Ze(61,!1,e.Diagnostics._0_expected,e.tokenToString(61))),t&&(x(),Ve(63)&&Ur(),Oe(23)),{name:n,isBracketed:t}}function I(t){switch(t.kind){case 148:return !0;case 183:return I(t.elementType);default:return e.isTypeReferenceNode(t)&&e.isIdentifier(t.typeName)&&"Object"===t.typeName.escapedText&&!t.typeArguments}}function O(t,r,n,i){var a=P(),o=!a;D();var s=w(),c=s.name,l=s.isBracketed,u=D();o&&!Ae(N)&&(a=P());var _=T(t,me(),i,u),d=4!==n&&function(t,r,n,i){if(t&&I(t.type)){for(var a=me(),o=void 0,s=void 0;o=Pe((function(){return K(n,i,r)}));)340!==o.kind&&347!==o.kind||(s=e.append(s,o));if(s){var c=Ye(L.createJSDocTypeLiteral(s,183===t.type.kind),a);return Ye(L.createJSDocTypeExpression(c),a)}}}(a,c,n,i);return d&&(a=d,o=!0),Ye(1===n?L.createJSDocPropertyTag(r,c,l,a,o,_):L.createJSDocParameterTag(r,c,l,a,o,_),t)}function M(t,n,i,a){e.some(s,e.isJSDocTypeTag)&&pe(n.pos,c.getTokenPos(),e.Diagnostics._0_tag_already_specified,n.escapedText);var o=r(!0),l=void 0!==i&&void 0!==a?T(t,me(),i,a):void 0;return Ye(L.createJSDocTypeTag(n,o,l),t)}function R(){var e=Ue(18),t=me(),r=function(){for(var e=me(),t=H();Ue(24);){var r=H();t=Ye(L.createPropertyAccessExpression(t,r),e);}return t}(),n=Si(),i=Ye(L.createExpressionWithTypeArguments(r,n),t);return e&&Oe(19),i}function B(e,t,r,n,i){return Ye(t(r,T(e,me(),n,i)),e)}function j(t){var r=c.getTokenPos();if(e.tokenIsIdentifierOrKeyword(ve())){var n=H();if(Ue(24)){var i=j(!0);return Ye(L.createModuleDeclaration(void 0,void 0,n,i,t?4:void 0),r)}return t&&(n.isInJSDocNamespace=!0),n}}function J(t,r){for(;!e.isIdentifier(t)||!e.isIdentifier(r);){if(e.isIdentifier(t)||e.isIdentifier(r)||t.right.escapedText!==r.right.escapedText)return !1;t=t.left,r=r.left;}return t.escapedText===r.escapedText}function z(e){return K(1,e)}function K(t,r,n){for(var i=!0,a=!1;;)switch(De()){case 59:if(i){var o=U(t,r);return !(o&&(340===o.kind||347===o.kind)&&4!==t&&n&&(e.isIdentifier(o.name)||!J(n,o.name.left)))&&o}a=!1;break;case 4:i=!0,a=!1;break;case 41:a&&(i=!1),a=!0;break;case 79:i=!1;break;case 1:return !1}}function U(t,r){e.Debug.assert(59===ve());var n=c.getStartPos();De();var i,a=H();switch(x(),a.escapedText){case"type":return 1===t&&M(n,a);case"prop":case"property":i=1;break;case"arg":case"argument":case"param":i=6;break;default:return !1}return !!(t&i)&&O(n,a,t,r)}function q(){var t=me(),r=W(22);r&&x();var n,i=H(e.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);if(r&&(x(),Oe(63),n=ee(8388608,Gt),Oe(23)),!e.nodeIsMissing(i))return Ye(L.createTypeParameterDeclaration(void 0,i,void 0,n),t)}function W(e){return ve()===e&&(De(),!0)}function H(t){if(!e.tokenIsIdentifierOrKeyword(ve()))return Ze(79,!t,t||e.Diagnostics.Identifier_expected);A++;var r=c.getTokenPos(),n=c.getTextPos(),i=ve(),a=$e(c.getTokenValue()),o=Ye(L.createIdentifier(a,void 0,i),r,n);return De(),o}}t.parseJSDocTypeExpressionForTests=function(t,n,i){J("file.js",t,99,void 0,1),c.setText(t,n,i),k=c.scan();var a=r(),o=H("file.js",99,1,!1,[],L.createToken(1),0,e.noop),s=e.attachFileToDiagnostics(v,o);return h&&(o.jsDocDiagnostics=e.attachFileToDiagnostics(h,o)),z(),a?{jsDocTypeExpression:a,diagnostics:s}:void 0},t.parseJSDocTypeExpression=r,t.parseJSDocNameReference=n,t.parseIsolatedJSDocComment=function(t,r,n){J("",t,99,void 0,1);var i=ee(8388608,(function(){return o(r,n)})),a={languageVariant:0,text:t},s=e.attachFileToDiagnostics(v,a);return z(),i?{jsDoc:i,diagnostics:s}:void 0},t.parseJSDocComment=function(t,r,n){var i=k,a=v.length,s=B,c=ee(8388608,(function(){return o(r,n)}));return e.setParent(c,t),262144&O&&(h||(h=[]),h.push.apply(h,v)),k=i,v.length=a,B=s,c},function(e){e[e.BeginningOfLine=0]="BeginningOfLine",e[e.SawAsterisk=1]="SawAsterisk",e[e.SavingComments=2]="SavingComments",e[e.SavingBackticks=3]="SavingBackticks";}(i||(i={})),function(e){e[e.Property=1]="Property",e[e.Parameter=2]="Parameter",e[e.CallbackParameter=4]="CallbackParameter";}(a||(a={}));}(Re=t.JSDocParser||(t.JSDocParser={}));}(u||(u={})),function(t){function r(t,r,i,o,s,c){return void(r?u(t):l(t));function l(t){var r="";if(c&&n(t)&&(r=o.substring(t.pos,t.end)),t._children&&(t._children=void 0),e.setTextRangePosEnd(t,t.pos+i,t.end+i),c&&n(t)&&e.Debug.assert(r===s.substring(t.pos,t.end)),v(t,l,u),e.hasJSDocNodes(t))for(var _=0,d=t.jsDoc;_<d.length;_++)l(d[_]);a(t,c);}function u(t){t._children=void 0,e.setTextRangePosEnd(t,t.pos+i,t.end+i);for(var r=0,n=t;r<n.length;r++)l(n[r]);}}function n(e){switch(e.kind){case 10:case 8:case 79:return !0}return !1}function i(t,r,n,i,a){e.Debug.assert(t.end>=r,"Adjusting an element that was entirely before the change range"),e.Debug.assert(t.pos<=n,"Adjusting an element that was entirely after the change range"),e.Debug.assert(t.pos<=t.end);var o=Math.min(t.pos,i),s=t.end>=n?t.end+a:Math.min(t.end,i);e.Debug.assert(o<=s),t.parent&&(e.Debug.assertGreaterThanOrEqual(o,t.parent.pos),e.Debug.assertLessThanOrEqual(s,t.parent.end)),e.setTextRangePosEnd(t,o,s);}function a(t,r){if(r){var n=t.pos,i=function(t){e.Debug.assert(t.pos>=n),n=t.end;};if(e.hasJSDocNodes(t))for(var a=0,o=t.jsDoc;a<o.length;a++)i(o[a]);v(t,i),e.Debug.assert(n<=t.end);}}function o(t,r){var n,i=t;if(v(t,(function t(a){if(!e.nodeIsMissing(a))return a.pos<=r?(a.pos>=i.pos&&(i=a),r<a.end?(v(a,t),!0):(e.Debug.assert(a.end<=r),void(n=a))):(e.Debug.assert(a.pos>r),!0)})),n){var a=function(t){for(;;){var r=e.getLastChild(t);if(!r)return t;t=r;}}(n);a.pos>i.pos&&(i=a);}return i}function s(t,r,n,i){var a=t.text;if(n&&(e.Debug.assert(a.length-n.span.length+n.newLength===r.length),i||e.Debug.shouldAssert(3))){var o=a.substr(0,n.span.start),s=r.substr(0,n.span.start);e.Debug.assert(o===s);var c=a.substring(e.textSpanEnd(n.span),a.length),l=r.substring(e.textSpanEnd(e.textChangeRangeNewSpan(n)),r.length);e.Debug.assert(c===l);}}function c(t){var r=t.statements,n=0;e.Debug.assert(n<r.length);var i=r[n],a=-1;return {currentNode:function(o){return o!==a&&(i&&i.end===o&&n<r.length-1&&(n++,i=r[n]),i&&i.pos===o||function(e){return r=void 0,n=-1,i=void 0,void v(t,a,o);function a(t){return e>=t.pos&&e<t.end&&(v(t,a,o),!0)}function o(t){if(e>=t.pos&&e<t.end)for(var s=0;s<t.length;s++){var c=t[s];if(c){if(c.pos===e)return r=t,n=s,i=c,!0;if(c.pos<e&&e<c.end)return v(c,a,o),!0}}return !1}}(o)),a=o,e.Debug.assert(!i||i.pos===o),i}}}var l;t.updateSourceFile=function(t,n,l,_){if(s(t,n,l,_=_||e.Debug.shouldAssert(2)),e.textChangeRangeIsUnchanged(l))return t;if(0===t.statements.length)return u.parseSourceFile(t.fileName,n,t.languageVersion,void 0,!0,t.scriptKind,t.setExternalModuleIndicator);var d=t;e.Debug.assert(!d.hasBeenIncrementallyParsed),d.hasBeenIncrementallyParsed=!0,u.fixupParentReferences(d);var p=t.text,f=c(t),g=function(t,r){for(var n=r.span.start,i=0;n>0&&i<=1;i++){var a=o(t,n);e.Debug.assert(a.pos<=n);var s=a.pos;n=Math.max(0,s-1);}var c=e.createTextSpanFromBounds(n,e.textSpanEnd(r.span)),l=r.newLength+(r.span.start-n);return e.createTextChangeRange(c,l)}(t,l);s(t,n,g,_),e.Debug.assert(g.span.start<=l.span.start),e.Debug.assert(e.textSpanEnd(g.span)===e.textSpanEnd(l.span)),e.Debug.assert(e.textSpanEnd(e.textChangeRangeNewSpan(g))===e.textSpanEnd(e.textChangeRangeNewSpan(l)));var m=e.textChangeRangeNewSpan(g).length-g.span.length;!function(t,n,o,s,c,l,u,_){return void d(t);function d(t){if(e.Debug.assert(t.pos<=t.end),t.pos>o)r(t,!1,c,l,u,_);else {var f=t.end;if(f>=n){if(t.intersectsChange=!0,t._children=void 0,i(t,n,o,s,c),v(t,d,p),e.hasJSDocNodes(t))for(var g=0,m=t.jsDoc;g<m.length;g++)d(m[g]);a(t,_);}else e.Debug.assert(f<n);}}function p(t){if(e.Debug.assert(t.pos<=t.end),t.pos>o)r(t,!0,c,l,u,_);else {var a=t.end;if(a>=n){t.intersectsChange=!0,t._children=void 0,i(t,n,o,s,c);for(var p=0,f=t;p<f.length;p++)d(f[p]);}else e.Debug.assert(a<n);}}}(d,g.span.start,e.textSpanEnd(g.span),e.textSpanEnd(e.textChangeRangeNewSpan(g)),m,p,n,_);var y=u.parseSourceFile(t.fileName,n,t.languageVersion,f,!0,t.scriptKind,t.setExternalModuleIndicator);return y.commentDirectives=function(t,r,n,i,a,o,s,c){if(!t)return r;for(var l,u=!1,_=0,d=t;_<d.length;_++){var p=d[_],f=p.range,g=p.type;if(f.end<n)l=e.append(l,p);else if(f.pos>i){y();var m={range:{pos:f.pos+a,end:f.end+a},type:g};l=e.append(l,m),c&&e.Debug.assert(o.substring(f.pos,f.end)===s.substring(m.range.pos,m.range.end));}}return y(),l;function y(){u||(u=!0,l?r&&l.push.apply(l,r):l=r);}}(t.commentDirectives,y.commentDirectives,g.span.start,e.textSpanEnd(g.span),m,p,n,_),y.impliedNodeFormat=t.impliedNodeFormat,y},t.createSyntaxCursor=c,function(e){e[e.Value=-1]="Value";}(l||(l={}));}(_||(_={})),e.isDeclarationFileName=D,e.processCommentPragmas=S,e.processPragmasIntoFields=T;var C=new e.Map;function k(e){if(C.has(e))return C.get(e);var t=new RegExp("(\\s".concat(e,"\\s*=\\s*)(?:(?:'([^']*)')|(?:\"([^\"]*)\"))"),"im");return C.set(e,t),t}var E=/^\/\/\/\s*<(\S+)\s.*?\/>/im,N=/^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im;function F(t,r,n){var i=2===r.kind&&E.exec(n);if(i){var a=i[1].toLowerCase(),o=e.commentPragmas[a];if(!(o&&1&o.kind))return;if(o.args){for(var s={},c=0,l=o.args;c<l.length;c++){var u=l[c],_=k(u.name).exec(n);if(!_&&!u.optional)return;if(_){var d=_[2]||_[3];if(u.captureSpan){var p=r.pos+_.index+_[1].length+1;s[u.name]={value:d,pos:p,end:p+d.length};}else s[u.name]=d;}}t.push({name:a,args:{arguments:s,range:r}});}else t.push({name:a,args:{arguments:{},range:r}});}else {var f=2===r.kind&&N.exec(n);if(f)return A(t,r,2,f);if(3===r.kind)for(var g=/@(\S+)(\s+.*)?$/gim,m=void 0;m=g.exec(n);)A(t,r,4,m);}}function A(t,r,n,i){if(i){var a=i[1].toLowerCase(),o=e.commentPragmas[a];if(o&&o.kind&n){var s=function(t,r){if(!r)return {};if(!t.args)return {};for(var n=e.trimString(r).split(/\s+/),i={},a=0;a<t.args.length;a++){var o=t.args[a];if(!n[a]&&!o.optional)return "fail";if(o.captureSpan)return e.Debug.fail("Capture spans not yet implemented for non-xml pragmas");i[o.name]=n[a];}return i}(o,i[2]);"fail"!==s&&t.push({name:a,args:{arguments:s,range:r}});}}}function P(e,t){return e.kind===t.kind&&(79===e.kind?e.escapedText===t.escapedText:108===e.kind||e.name.escapedText===t.name.escapedText&&P(e.expression,t.expression))}e.tagNamesAreEquivalent=P;}(t),function(e){e.compileOnSaveCommandLineOption={name:"compileOnSave",type:"boolean",defaultValueDescription:!1};var t=new e.Map(e.getEntries({preserve:1,"react-native":3,react:2,"react-jsx":4,"react-jsxdev":5}));e.inverseJsxOptionMap=new e.Map(e.arrayFrom(e.mapIterator(t.entries(),(function(e){var t=e[0];return [""+e[1],t]}))));var r=[["es5","lib.es5.d.ts"],["es6","lib.es2015.d.ts"],["es2015","lib.es2015.d.ts"],["es7","lib.es2016.d.ts"],["es2016","lib.es2016.d.ts"],["es2017","lib.es2017.d.ts"],["es2018","lib.es2018.d.ts"],["es2019","lib.es2019.d.ts"],["es2020","lib.es2020.d.ts"],["es2021","lib.es2021.d.ts"],["es2022","lib.es2022.d.ts"],["esnext","lib.esnext.d.ts"],["dom","lib.dom.d.ts"],["dom.iterable","lib.dom.iterable.d.ts"],["webworker","lib.webworker.d.ts"],["webworker.importscripts","lib.webworker.importscripts.d.ts"],["webworker.iterable","lib.webworker.iterable.d.ts"],["scripthost","lib.scripthost.d.ts"],["es2015.core","lib.es2015.core.d.ts"],["es2015.collection","lib.es2015.collection.d.ts"],["es2015.generator","lib.es2015.generator.d.ts"],["es2015.iterable","lib.es2015.iterable.d.ts"],["es2015.promise","lib.es2015.promise.d.ts"],["es2015.proxy","lib.es2015.proxy.d.ts"],["es2015.reflect","lib.es2015.reflect.d.ts"],["es2015.symbol","lib.es2015.symbol.d.ts"],["es2015.symbol.wellknown","lib.es2015.symbol.wellknown.d.ts"],["es2016.array.include","lib.es2016.array.include.d.ts"],["es2017.object","lib.es2017.object.d.ts"],["es2017.sharedmemory","lib.es2017.sharedmemory.d.ts"],["es2017.string","lib.es2017.string.d.ts"],["es2017.intl","lib.es2017.intl.d.ts"],["es2017.typedarrays","lib.es2017.typedarrays.d.ts"],["es2018.asyncgenerator","lib.es2018.asyncgenerator.d.ts"],["es2018.asynciterable","lib.es2018.asynciterable.d.ts"],["es2018.intl","lib.es2018.intl.d.ts"],["es2018.promise","lib.es2018.promise.d.ts"],["es2018.regexp","lib.es2018.regexp.d.ts"],["es2019.array","lib.es2019.array.d.ts"],["es2019.object","lib.es2019.object.d.ts"],["es2019.string","lib.es2019.string.d.ts"],["es2019.symbol","lib.es2019.symbol.d.ts"],["es2020.bigint","lib.es2020.bigint.d.ts"],["es2020.date","lib.es2020.date.d.ts"],["es2020.promise","lib.es2020.promise.d.ts"],["es2020.sharedmemory","lib.es2020.sharedmemory.d.ts"],["es2020.string","lib.es2020.string.d.ts"],["es2020.symbol.wellknown","lib.es2020.symbol.wellknown.d.ts"],["es2020.intl","lib.es2020.intl.d.ts"],["es2020.number","lib.es2020.number.d.ts"],["es2021.promise","lib.es2021.promise.d.ts"],["es2021.string","lib.es2021.string.d.ts"],["es2021.weakref","lib.es2021.weakref.d.ts"],["es2021.intl","lib.es2021.intl.d.ts"],["es2022.array","lib.es2022.array.d.ts"],["es2022.error","lib.es2022.error.d.ts"],["es2022.intl","lib.es2022.intl.d.ts"],["es2022.object","lib.es2022.object.d.ts"],["es2022.string","lib.es2022.string.d.ts"],["esnext.array","lib.es2022.array.d.ts"],["esnext.symbol","lib.es2019.symbol.d.ts"],["esnext.asynciterable","lib.es2018.asynciterable.d.ts"],["esnext.intl","lib.esnext.intl.d.ts"],["esnext.bigint","lib.es2020.bigint.d.ts"],["esnext.string","lib.es2022.string.d.ts"],["esnext.promise","lib.es2021.promise.d.ts"],["esnext.weakref","lib.es2021.weakref.d.ts"]];e.libs=r.map((function(e){return e[0]})),e.libMap=new e.Map(r),e.optionsForWatch=[{name:"watchFile",type:new e.Map(e.getEntries({fixedpollinginterval:e.WatchFileKind.FixedPollingInterval,prioritypollinginterval:e.WatchFileKind.PriorityPollingInterval,dynamicprioritypolling:e.WatchFileKind.DynamicPriorityPolling,fixedchunksizepolling:e.WatchFileKind.FixedChunkSizePolling,usefsevents:e.WatchFileKind.UseFsEvents,usefseventsonparentdirectory:e.WatchFileKind.UseFsEventsOnParentDirectory})),category:e.Diagnostics.Watch_and_Build_Modes,description:e.Diagnostics.Specify_how_the_TypeScript_watch_mode_works,defaultValueDescription:e.WatchFileKind.UseFsEvents},{name:"watchDirectory",type:new e.Map(e.getEntries({usefsevents:e.WatchDirectoryKind.UseFsEvents,fixedpollinginterval:e.WatchDirectoryKind.FixedPollingInterval,dynamicprioritypolling:e.WatchDirectoryKind.DynamicPriorityPolling,fixedchunksizepolling:e.WatchDirectoryKind.FixedChunkSizePolling})),category:e.Diagnostics.Watch_and_Build_Modes,description:e.Diagnostics.Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality,defaultValueDescription:e.WatchDirectoryKind.UseFsEvents},{name:"fallbackPolling",type:new e.Map(e.getEntries({fixedinterval:e.PollingWatchKind.FixedInterval,priorityinterval:e.PollingWatchKind.PriorityInterval,dynamicpriority:e.PollingWatchKind.DynamicPriority,fixedchunksize:e.PollingWatchKind.FixedChunkSize})),category:e.Diagnostics.Watch_and_Build_Modes,description:e.Diagnostics.Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers,defaultValueDescription:e.PollingWatchKind.PriorityInterval},{name:"synchronousWatchDirectory",type:"boolean",category:e.Diagnostics.Watch_and_Build_Modes,description:e.Diagnostics.Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively,defaultValueDescription:!1},{name:"excludeDirectories",type:"list",element:{name:"excludeDirectory",type:"string",isFilePath:!0,extraValidation:Te},category:e.Diagnostics.Watch_and_Build_Modes,description:e.Diagnostics.Remove_a_list_of_directories_from_the_watch_process},{name:"excludeFiles",type:"list",element:{name:"excludeFile",type:"string",isFilePath:!0,extraValidation:Te},category:e.Diagnostics.Watch_and_Build_Modes,description:e.Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing}],e.commonOptionsWithBuild=[{name:"help",shortName:"h",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Print_this_message,defaultValueDescription:!1},{name:"help",shortName:"?",type:"boolean",defaultValueDescription:!1},{name:"watch",shortName:"w",type:"boolean",showInSimplifiedHelpView:!0,isCommandLineOnly:!0,category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Watch_input_files,defaultValueDescription:!1},{name:"preserveWatchOutput",type:"boolean",showInSimplifiedHelpView:!1,category:e.Diagnostics.Output_Formatting,description:e.Diagnostics.Disable_wiping_the_console_in_watch_mode,defaultValueDescription:!1},{name:"listFiles",type:"boolean",category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Print_all_of_the_files_read_during_the_compilation,defaultValueDescription:!1},{name:"explainFiles",type:"boolean",category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Print_files_read_during_the_compilation_including_why_it_was_included,defaultValueDescription:!1},{name:"listEmittedFiles",type:"boolean",category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Print_the_names_of_emitted_files_after_a_compilation,defaultValueDescription:!1},{name:"pretty",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Output_Formatting,description:e.Diagnostics.Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read,defaultValueDescription:!0},{name:"traceResolution",type:"boolean",category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Log_paths_used_during_the_moduleResolution_process,defaultValueDescription:!1},{name:"diagnostics",type:"boolean",category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Output_compiler_performance_information_after_building,defaultValueDescription:!1},{name:"extendedDiagnostics",type:"boolean",category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Output_more_detailed_compiler_performance_information_after_building,defaultValueDescription:!1},{name:"generateCpuProfile",type:"string",isFilePath:!0,paramType:e.Diagnostics.FILE_OR_DIRECTORY,category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging,defaultValueDescription:"profile.cpuprofile"},{name:"generateTrace",type:"string",isFilePath:!0,isCommandLineOnly:!0,paramType:e.Diagnostics.DIRECTORY,category:e.Diagnostics.Compiler_Diagnostics,description:e.Diagnostics.Generates_an_event_trace_and_a_list_of_types},{name:"incremental",shortName:"i",type:"boolean",category:e.Diagnostics.Projects,description:e.Diagnostics.Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects,transpileOptionValue:void 0,defaultValueDescription:e.Diagnostics.false_unless_composite_is_set},{name:"assumeChangesOnlyAffectDirectDependencies",type:"boolean",affectsSemanticDiagnostics:!0,affectsEmit:!0,category:e.Diagnostics.Watch_and_Build_Modes,description:e.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,defaultValueDescription:!1},{name:"locale",type:"string",category:e.Diagnostics.Command_line_Options,isCommandLineOnly:!0,description:e.Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit,defaultValueDescription:e.Diagnostics.Platform_specific}],e.targetOptionDeclaration={name:"target",shortName:"t",type:new e.Map(e.getEntries({es3:0,es5:1,es6:2,es2015:2,es2016:3,es2017:4,es2018:5,es2019:6,es2020:7,es2021:8,es2022:9,esnext:99})),affectsSourceFile:!0,affectsModuleResolution:!0,affectsEmit:!0,paramType:e.Diagnostics.VERSION,showInSimplifiedHelpView:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,defaultValueDescription:0};var a,o=[{name:"all",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Show_all_compiler_options,defaultValueDescription:!1},{name:"version",shortName:"v",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Print_the_compiler_s_version,defaultValueDescription:!1},{name:"init",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,defaultValueDescription:!1},{name:"project",shortName:"p",type:"string",isFilePath:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Command_line_Options,paramType:e.Diagnostics.FILE_OR_DIRECTORY,description:e.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json},{name:"build",type:"boolean",shortName:"b",showInSimplifiedHelpView:!0,category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,defaultValueDescription:!1},{name:"showConfig",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Command_line_Options,isCommandLineOnly:!0,description:e.Diagnostics.Print_the_final_configuration_instead_of_building,defaultValueDescription:!1},{name:"listFilesOnly",type:"boolean",category:e.Diagnostics.Command_line_Options,affectsSemanticDiagnostics:!0,affectsEmit:!0,isCommandLineOnly:!0,description:e.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,defaultValueDescription:!1},e.targetOptionDeclaration,{name:"module",shortName:"m",type:new e.Map(e.getEntries({none:e.ModuleKind.None,commonjs:e.ModuleKind.CommonJS,amd:e.ModuleKind.AMD,system:e.ModuleKind.System,umd:e.ModuleKind.UMD,es6:e.ModuleKind.ES2015,es2015:e.ModuleKind.ES2015,es2020:e.ModuleKind.ES2020,es2022:e.ModuleKind.ES2022,esnext:e.ModuleKind.ESNext,node16:e.ModuleKind.Node16,nodenext:e.ModuleKind.NodeNext})),affectsModuleResolution:!0,affectsEmit:!0,paramType:e.Diagnostics.KIND,showInSimplifiedHelpView:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Specify_what_module_code_is_generated,defaultValueDescription:void 0},{name:"lib",type:"list",element:{name:"lib",type:e.libMap,defaultValueDescription:void 0},affectsProgramStructure:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment,transpileOptionValue:void 0},{name:"allowJs",type:"boolean",affectsModuleResolution:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.JavaScript_Support,description:e.Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,defaultValueDescription:!1},{name:"checkJs",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.JavaScript_Support,description:e.Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,defaultValueDescription:!1},{name:"jsx",type:t,affectsSourceFile:!0,affectsEmit:!0,affectsModuleResolution:!0,paramType:e.Diagnostics.KIND,showInSimplifiedHelpView:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Specify_what_JSX_code_is_generated,defaultValueDescription:void 0},{name:"declaration",shortName:"d",type:"boolean",affectsEmit:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,transpileOptionValue:void 0,description:e.Diagnostics.Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project,defaultValueDescription:e.Diagnostics.false_unless_composite_is_set},{name:"declarationMap",type:"boolean",affectsEmit:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,transpileOptionValue:void 0,defaultValueDescription:!1,description:e.Diagnostics.Create_sourcemaps_for_d_ts_files},{name:"emitDeclarationOnly",type:"boolean",affectsEmit:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,transpileOptionValue:void 0,defaultValueDescription:!1},{name:"sourceMap",type:"boolean",affectsEmit:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,defaultValueDescription:!1,description:e.Diagnostics.Create_source_map_files_for_emitted_JavaScript_files},{name:"outFile",type:"string",affectsEmit:!0,isFilePath:!0,paramType:e.Diagnostics.FILE,showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output,transpileOptionValue:void 0},{name:"outDir",type:"string",affectsEmit:!0,isFilePath:!0,paramType:e.Diagnostics.DIRECTORY,showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Specify_an_output_folder_for_all_emitted_files},{name:"rootDir",type:"string",affectsEmit:!0,isFilePath:!0,paramType:e.Diagnostics.LOCATION,category:e.Diagnostics.Modules,description:e.Diagnostics.Specify_the_root_folder_within_your_source_files,defaultValueDescription:e.Diagnostics.Computed_from_the_list_of_input_files},{name:"composite",type:"boolean",affectsEmit:!0,isTSConfigOnly:!0,category:e.Diagnostics.Projects,transpileOptionValue:void 0,defaultValueDescription:!1,description:e.Diagnostics.Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references},{name:"tsBuildInfoFile",type:"string",affectsEmit:!0,isFilePath:!0,paramType:e.Diagnostics.FILE,category:e.Diagnostics.Projects,transpileOptionValue:void 0,defaultValueDescription:".tsbuildinfo",description:e.Diagnostics.Specify_the_path_to_tsbuildinfo_incremental_compilation_file},{name:"removeComments",type:"boolean",affectsEmit:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,defaultValueDescription:!1,description:e.Diagnostics.Disable_emitting_comments},{name:"noEmit",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Disable_emitting_files_from_a_compilation,transpileOptionValue:void 0,defaultValueDescription:!1},{name:"importHelpers",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,defaultValueDescription:!1},{name:"importsNotUsedAsValues",type:new e.Map(e.getEntries({remove:0,preserve:1,error:2})),affectsEmit:!0,affectsSemanticDiagnostics:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,defaultValueDescription:0},{name:"downlevelIteration",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,defaultValueDescription:!1},{name:"isolatedModules",type:"boolean",category:e.Diagnostics.Interop_Constraints,description:e.Diagnostics.Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports,transpileOptionValue:!0,defaultValueDescription:!1},{name:"strict",type:"boolean",showInSimplifiedHelpView:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Enable_all_strict_type_checking_options,defaultValueDescription:!1},{name:"noImplicitAny",type:"boolean",affectsSemanticDiagnostics:!0,strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,defaultValueDescription:e.Diagnostics.false_unless_strict_is_set},{name:"strictNullChecks",type:"boolean",affectsSemanticDiagnostics:!0,strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.When_type_checking_take_into_account_null_and_undefined,defaultValueDescription:e.Diagnostics.false_unless_strict_is_set},{name:"strictFunctionTypes",type:"boolean",strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,defaultValueDescription:e.Diagnostics.false_unless_strict_is_set},{name:"strictBindCallApply",type:"boolean",strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,defaultValueDescription:e.Diagnostics.false_unless_strict_is_set},{name:"strictPropertyInitialization",type:"boolean",affectsSemanticDiagnostics:!0,strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,defaultValueDescription:e.Diagnostics.false_unless_strict_is_set},{name:"noImplicitThis",type:"boolean",affectsSemanticDiagnostics:!0,strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,defaultValueDescription:e.Diagnostics.false_unless_strict_is_set},{name:"useUnknownInCatchVariables",type:"boolean",affectsSemanticDiagnostics:!0,strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,defaultValueDescription:!1},{name:"alwaysStrict",type:"boolean",affectsSourceFile:!0,strictFlag:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Ensure_use_strict_is_always_emitted,defaultValueDescription:e.Diagnostics.false_unless_strict_is_set},{name:"noUnusedLocals",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,defaultValueDescription:!1},{name:"noUnusedParameters",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,defaultValueDescription:!1},{name:"exactOptionalPropertyTypes",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,defaultValueDescription:!1},{name:"noImplicitReturns",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,defaultValueDescription:!1},{name:"noFallthroughCasesInSwitch",type:"boolean",affectsBindDiagnostics:!0,affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,defaultValueDescription:!1},{name:"noUncheckedIndexedAccess",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,defaultValueDescription:!1},{name:"noImplicitOverride",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,defaultValueDescription:!1},{name:"noPropertyAccessFromIndexSignature",type:"boolean",showInSimplifiedHelpView:!1,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,defaultValueDescription:!1},{name:"moduleResolution",type:new e.Map(e.getEntries({node:e.ModuleResolutionKind.NodeJs,classic:e.ModuleResolutionKind.Classic,node16:e.ModuleResolutionKind.Node16,nodenext:e.ModuleResolutionKind.NodeNext})),affectsModuleResolution:!0,paramType:e.Diagnostics.STRATEGY,category:e.Diagnostics.Modules,description:e.Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,defaultValueDescription:e.Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node},{name:"baseUrl",type:"string",affectsModuleResolution:!0,isFilePath:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Specify_the_base_directory_to_resolve_non_relative_module_names},{name:"paths",type:"object",affectsModuleResolution:!0,isTSConfigOnly:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations,transpileOptionValue:void 0},{name:"rootDirs",type:"list",isTSConfigOnly:!0,element:{name:"rootDirs",type:"string",isFilePath:!0},affectsModuleResolution:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules,transpileOptionValue:void 0,defaultValueDescription:e.Diagnostics.Computed_from_the_list_of_input_files},{name:"typeRoots",type:"list",element:{name:"typeRoots",type:"string",isFilePath:!0},affectsModuleResolution:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types},{name:"types",type:"list",element:{name:"types",type:"string"},affectsProgramStructure:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file,transpileOptionValue:void 0},{name:"allowSyntheticDefaultImports",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Interop_Constraints,description:e.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,defaultValueDescription:e.Diagnostics.module_system_or_esModuleInterop},{name:"esModuleInterop",type:"boolean",affectsSemanticDiagnostics:!0,affectsEmit:!0,showInSimplifiedHelpView:!0,category:e.Diagnostics.Interop_Constraints,description:e.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,defaultValueDescription:!1},{name:"preserveSymlinks",type:"boolean",category:e.Diagnostics.Interop_Constraints,description:e.Diagnostics.Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node,defaultValueDescription:!1},{name:"allowUmdGlobalAccess",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Allow_accessing_UMD_globals_from_modules,defaultValueDescription:!1},{name:"moduleSuffixes",type:"list",element:{name:"suffix",type:"string"},listPreserveFalsyValues:!0,affectsModuleResolution:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.List_of_file_name_suffixes_to_search_when_resolving_a_module},{name:"sourceRoot",type:"string",affectsEmit:!0,paramType:e.Diagnostics.LOCATION,category:e.Diagnostics.Emit,description:e.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code},{name:"mapRoot",type:"string",affectsEmit:!0,paramType:e.Diagnostics.LOCATION,category:e.Diagnostics.Emit,description:e.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations},{name:"inlineSourceMap",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,defaultValueDescription:!1},{name:"inlineSources",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,defaultValueDescription:!1},{name:"experimentalDecorators",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,defaultValueDescription:!1},{name:"emitDecoratorMetadata",type:"boolean",affectsSemanticDiagnostics:!0,affectsEmit:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,defaultValueDescription:!1},{name:"jsxFactory",type:"string",category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h,defaultValueDescription:"`React.createElement`"},{name:"jsxFragmentFactory",type:"string",category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment,defaultValueDescription:"React.Fragment"},{name:"jsxImportSource",type:"string",affectsSemanticDiagnostics:!0,affectsEmit:!0,affectsModuleResolution:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,defaultValueDescription:"react"},{name:"resolveJsonModule",type:"boolean",affectsModuleResolution:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Enable_importing_json_files,defaultValueDescription:!1},{name:"out",type:"string",affectsEmit:!0,isFilePath:!1,category:e.Diagnostics.Backwards_Compatibility,paramType:e.Diagnostics.FILE,transpileOptionValue:void 0,description:e.Diagnostics.Deprecated_setting_Use_outFile_instead},{name:"reactNamespace",type:"string",affectsEmit:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,defaultValueDescription:"`React`"},{name:"skipDefaultLibCheck",type:"boolean",category:e.Diagnostics.Completeness,description:e.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,defaultValueDescription:!1},{name:"charset",type:"string",category:e.Diagnostics.Backwards_Compatibility,description:e.Diagnostics.No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files,defaultValueDescription:"utf8"},{name:"emitBOM",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,defaultValueDescription:!1},{name:"newLine",type:new e.Map(e.getEntries({crlf:0,lf:1})),affectsEmit:!0,paramType:e.Diagnostics.NEWLINE,category:e.Diagnostics.Emit,description:e.Diagnostics.Set_the_newline_character_for_emitting_files,defaultValueDescription:e.Diagnostics.Platform_specific},{name:"noErrorTruncation",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Output_Formatting,description:e.Diagnostics.Disable_truncating_types_in_error_messages,defaultValueDescription:!1},{name:"noLib",type:"boolean",category:e.Diagnostics.Language_and_Environment,affectsProgramStructure:!0,description:e.Diagnostics.Disable_including_any_library_files_including_the_default_lib_d_ts,transpileOptionValue:!0,defaultValueDescription:!1},{name:"noResolve",type:"boolean",affectsModuleResolution:!0,category:e.Diagnostics.Modules,description:e.Diagnostics.Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project,transpileOptionValue:!0,defaultValueDescription:!1},{name:"stripInternal",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,defaultValueDescription:!1},{name:"disableSizeLimit",type:"boolean",affectsProgramStructure:!0,category:e.Diagnostics.Editor_Support,description:e.Diagnostics.Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server,defaultValueDescription:!1},{name:"disableSourceOfProjectReferenceRedirect",type:"boolean",isTSConfigOnly:!0,category:e.Diagnostics.Projects,description:e.Diagnostics.Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects,defaultValueDescription:!1},{name:"disableSolutionSearching",type:"boolean",isTSConfigOnly:!0,category:e.Diagnostics.Projects,description:e.Diagnostics.Opt_a_project_out_of_multi_project_reference_checking_when_editing,defaultValueDescription:!1},{name:"disableReferencedProjectLoad",type:"boolean",isTSConfigOnly:!0,category:e.Diagnostics.Projects,description:e.Diagnostics.Reduce_the_number_of_projects_loaded_automatically_by_TypeScript,defaultValueDescription:!1},{name:"noImplicitUseStrict",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Backwards_Compatibility,description:e.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,defaultValueDescription:!1},{name:"noEmitHelpers",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,defaultValueDescription:!1},{name:"noEmitOnError",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,transpileOptionValue:void 0,description:e.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,defaultValueDescription:!1},{name:"preserveConstEnums",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,defaultValueDescription:!1},{name:"declarationDir",type:"string",affectsEmit:!0,isFilePath:!0,paramType:e.Diagnostics.DIRECTORY,category:e.Diagnostics.Emit,transpileOptionValue:void 0,description:e.Diagnostics.Specify_the_output_directory_for_generated_declaration_files},{name:"skipLibCheck",type:"boolean",category:e.Diagnostics.Completeness,description:e.Diagnostics.Skip_type_checking_all_d_ts_files,defaultValueDescription:!1},{name:"allowUnusedLabels",type:"boolean",affectsBindDiagnostics:!0,affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Disable_error_reporting_for_unused_labels,defaultValueDescription:void 0},{name:"allowUnreachableCode",type:"boolean",affectsBindDiagnostics:!0,affectsSemanticDiagnostics:!0,category:e.Diagnostics.Type_Checking,description:e.Diagnostics.Disable_error_reporting_for_unreachable_code,defaultValueDescription:void 0},{name:"suppressExcessPropertyErrors",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Backwards_Compatibility,description:e.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,defaultValueDescription:!1},{name:"suppressImplicitAnyIndexErrors",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Backwards_Compatibility,description:e.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,defaultValueDescription:!1},{name:"forceConsistentCasingInFileNames",type:"boolean",affectsModuleResolution:!0,category:e.Diagnostics.Interop_Constraints,description:e.Diagnostics.Ensure_that_casing_is_correct_in_imports,defaultValueDescription:!1},{name:"maxNodeModuleJsDepth",type:"number",affectsModuleResolution:!0,category:e.Diagnostics.JavaScript_Support,description:e.Diagnostics.Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs,defaultValueDescription:0},{name:"noStrictGenericChecks",type:"boolean",affectsSemanticDiagnostics:!0,category:e.Diagnostics.Backwards_Compatibility,description:e.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,defaultValueDescription:!1},{name:"useDefineForClassFields",type:"boolean",affectsSemanticDiagnostics:!0,affectsEmit:!0,category:e.Diagnostics.Language_and_Environment,description:e.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,defaultValueDescription:e.Diagnostics.true_for_ES2022_and_above_including_ESNext},{name:"preserveValueImports",type:"boolean",affectsEmit:!0,category:e.Diagnostics.Emit,description:e.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,defaultValueDescription:!1},{name:"keyofStringsOnly",type:"boolean",category:e.Diagnostics.Backwards_Compatibility,description:e.Diagnostics.Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option,defaultValueDescription:!1},{name:"plugins",type:"list",isTSConfigOnly:!0,element:{name:"plugin",type:"object"},description:e.Diagnostics.Specify_a_list_of_language_service_plugins_to_include,category:e.Diagnostics.Editor_Support},{name:"moduleDetection",type:new e.Map(e.getEntries({auto:e.ModuleDetectionKind.Auto,legacy:e.ModuleDetectionKind.Legacy,force:e.ModuleDetectionKind.Force})),affectsModuleResolution:!0,description:e.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,category:e.Diagnostics.Language_and_Environment,defaultValueDescription:e.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules}];function s(t){var r=new e.Map,n=new e.Map;return e.forEach(t,(function(e){r.set(e.name.toLowerCase(),e),e.shortName&&n.set(e.shortName,e.name);})),{optionsNameMap:r,shortOptionNames:n}}function c(){return a||(a=s(e.optionDeclarations))}e.optionDeclarations=n$4(n$4([],e.commonOptionsWithBuild,!0),o,!0),e.semanticDiagnosticsOptionDeclarations=e.optionDeclarations.filter((function(e){return !!e.affectsSemanticDiagnostics})),e.affectsEmitOptionDeclarations=e.optionDeclarations.filter((function(e){return !!e.affectsEmit})),e.moduleResolutionOptionDeclarations=e.optionDeclarations.filter((function(e){return !!e.affectsModuleResolution})),e.sourceFileAffectingCompilerOptions=e.optionDeclarations.filter((function(e){return !!e.affectsSourceFile||!!e.affectsModuleResolution||!!e.affectsBindDiagnostics})),e.optionsAffectingProgramStructure=e.optionDeclarations.filter((function(e){return !!e.affectsProgramStructure})),e.transpileOptionValueCompilerOptions=e.optionDeclarations.filter((function(t){return e.hasProperty(t,"transpileOptionValue")})),e.optionsForBuild=[{name:"verbose",shortName:"v",category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Enable_verbose_logging,type:"boolean",defaultValueDescription:!1},{name:"dry",shortName:"d",category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Show_what_would_be_built_or_deleted_if_specified_with_clean,type:"boolean",defaultValueDescription:!1},{name:"force",shortName:"f",category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Build_all_projects_including_those_that_appear_to_be_up_to_date,type:"boolean",defaultValueDescription:!1},{name:"clean",category:e.Diagnostics.Command_line_Options,description:e.Diagnostics.Delete_the_outputs_of_all_projects,type:"boolean",defaultValueDescription:!1}],e.buildOpts=n$4(n$4([],e.commonOptionsWithBuild,!0),e.optionsForBuild,!0),e.typeAcquisitionDeclarations=[{name:"enableAutoDiscovery",type:"boolean",defaultValueDescription:!1},{name:"enable",type:"boolean",defaultValueDescription:!1},{name:"include",type:"list",element:{name:"include",type:"string"}},{name:"exclude",type:"list",element:{name:"exclude",type:"string"}},{name:"disableFilenameBasedTypeAcquisition",type:"boolean",defaultValueDescription:!1}],e.createOptionNameMap=s,e.getOptionsNameMap=c;var l,u={diagnostic:e.Diagnostics.Compiler_option_0_may_only_be_used_with_build,getOptionsNameMap:D};function _(e){return e&&void 0!==e.enableAutoDiscovery&&void 0===e.enable?{enable:e.enableAutoDiscovery,include:e.include||[],exclude:e.exclude||[]}:e}function d(t){return p(t,e.createCompilerDiagnostic)}function p(t,r){var n=e.arrayFrom(t.type.keys()).map((function(e){return "'".concat(e,"'")})).join(", ");return r(e.Diagnostics.Argument_for_0_option_must_be_Colon_1,"--".concat(t.name),n)}function f(t,r,n){return ye(t,e.trimString(r||""),n)}function g(t,r,n){if(void 0===r&&(r=""),r=e.trimString(r),!e.startsWith(r,"-")){if(""===r)return [];var i=r.split(",");switch(t.element.type){case"number":return e.mapDefined(i,(function(e){return me(t.element,parseInt(e),n)}));case"string":return e.mapDefined(i,(function(e){return me(t.element,e||"",n)}));default:return e.mapDefined(i,(function(e){return f(t.element,e,n)}))}}}function m(e){return e.name}function y(t,r,n,i){var a;if(null===(a=r.alternateMode)||void 0===a?void 0:a.getOptionsNameMap().optionsNameMap.has(t.toLowerCase()))return n(r.alternateMode.diagnostic,t);var o=e.getSpellingSuggestion(t,r.optionDeclarations,m);return o?n(r.unknownDidYouMeanDiagnostic,i||t,o.name):n(r.unknownOptionDiagnostic,i||t)}function v(t,r,n){var i,a={},o=[],s=[];return c(r),{options:a,watchOptions:i,fileNames:o,errors:s};function c(r){for(var n=0;n<r.length;){var c=r[n];if(n++,64===c.charCodeAt(0))l(c.slice(1));else if(45===c.charCodeAt(0)){var u=c.slice(45===c.charCodeAt(1)?2:1),_=x(t.getOptionsNameMap,u,!0);if(_)n=h(r,n,t,_,a,s);else {var d=x(M.getOptionsNameMap,u,!0);d?n=h(r,n,M,d,i||(i={}),s):s.push(y(u,t,e.createCompilerDiagnostic,c));}}else o.push(c);}}function l(t){var r=k(t,n||function(t){return e.sys.readFile(t)});if(e.isString(r)){for(var i=[],a=0;;){for(;a<r.length&&r.charCodeAt(a)<=32;)a++;if(a>=r.length)break;var o=a;if(34===r.charCodeAt(o)){for(a++;a<r.length&&34!==r.charCodeAt(a);)a++;a<r.length?(i.push(r.substring(o+1,a)),a++):s.push(e.createCompilerDiagnostic(e.Diagnostics.Unterminated_quoted_string_in_response_file_0,t));}else {for(;r.charCodeAt(a)>32;)a++;i.push(r.substring(o,a));}}c(i);}else s.push(r);}}function h(t,r,n,i,a,o){if(i.isTSConfigOnly)"null"===(s=t[r])?(a[i.name]=void 0,r++):"boolean"===i.type?"false"===s?(a[i.name]=me(i,!1,o),r++):("true"===s&&r++,o.push(e.createCompilerDiagnostic(e.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line,i.name))):(o.push(e.createCompilerDiagnostic(e.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line,i.name)),s&&!e.startsWith(s,"-")&&r++);else if(t[r]||"boolean"===i.type||o.push(e.createCompilerDiagnostic(n.optionTypeMismatchDiagnostic,i.name,K(i))),"null"!==t[r])switch(i.type){case"number":a[i.name]=me(i,parseInt(t[r]),o),r++;break;case"boolean":var s=t[r];a[i.name]=me(i,"false"!==s,o),"false"!==s&&"true"!==s||r++;break;case"string":a[i.name]=me(i,t[r]||"",o),r++;break;case"list":var c=g(i,t[r],o);a[i.name]=c||[],c&&r++;break;default:a[i.name]=f(i,t[r],o),r++;}else a[i.name]=void 0,r++;return r}function b(e,t){return x(c,e,t)}function x(e,t,r){void 0===r&&(r=!1),t=t.toLowerCase();var n=e(),i=n.optionsNameMap,a=n.shortOptionNames;if(r){var o=a.get(t);void 0!==o&&(t=o);}return i.get(t)}function D(){return l||(l=s(e.buildOpts))}e.defaultInitCompilerOptions={module:e.ModuleKind.CommonJS,target:3,strict:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,skipLibCheck:!0},e.convertEnableAutoDiscoveryToEnable=_,e.createCompilerDiagnosticForInvalidCustomType=d,e.parseCustomTypeOption=f,e.parseListTypeOption=g,e.parseCommandLineWorker=v,e.compilerOptionsDidYouMeanDiagnostics={alternateMode:u,getOptionsNameMap:c,optionDeclarations:e.optionDeclarations,unknownOptionDiagnostic:e.Diagnostics.Unknown_compiler_option_0,unknownDidYouMeanDiagnostic:e.Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,optionTypeMismatchDiagnostic:e.Diagnostics.Compiler_option_0_expects_an_argument},e.parseCommandLine=function(t,r){return v(e.compilerOptionsDidYouMeanDiagnostics,t,r)},e.getOptionFromName=b;var S={alternateMode:{diagnostic:e.Diagnostics.Compiler_option_0_may_not_be_used_with_build,getOptionsNameMap:c},getOptionsNameMap:D,optionDeclarations:e.buildOpts,unknownOptionDiagnostic:e.Diagnostics.Unknown_build_option_0,unknownDidYouMeanDiagnostic:e.Diagnostics.Unknown_build_option_0_Did_you_mean_1,optionTypeMismatchDiagnostic:e.Diagnostics.Build_option_0_requires_a_value_of_type_1};function T(t,r){var n=e.parseJsonText(t,r);return {config:j(n,n.parseDiagnostics,!1,void 0),error:n.parseDiagnostics.length?n.parseDiagnostics[0]:void 0}}function C(t,r){var n=k(t,r);return e.isString(n)?e.parseJsonText(t,n):{fileName:t,parseDiagnostics:[n]}}function k(t,r){var n;try{n=r(t);}catch(r){return e.createCompilerDiagnostic(e.Diagnostics.Cannot_read_file_0_Colon_1,t,r.message)}return void 0===n?e.createCompilerDiagnostic(e.Diagnostics.Cannot_read_file_0,t):n}function E(t){return e.arrayToMap(t,m)}e.parseBuildCommand=function(t){var r=v(S,t),n=r.options,i=r.watchOptions,a=r.fileNames,o=r.errors,s=n;return 0===a.length&&a.push("."),s.clean&&s.force&&o.push(e.createCompilerDiagnostic(e.Diagnostics.Options_0_and_1_cannot_be_combined,"clean","force")),s.clean&&s.verbose&&o.push(e.createCompilerDiagnostic(e.Diagnostics.Options_0_and_1_cannot_be_combined,"clean","verbose")),s.clean&&s.watch&&o.push(e.createCompilerDiagnostic(e.Diagnostics.Options_0_and_1_cannot_be_combined,"clean","watch")),s.watch&&s.dry&&o.push(e.createCompilerDiagnostic(e.Diagnostics.Options_0_and_1_cannot_be_combined,"watch","dry")),{buildOptions:s,watchOptions:i,projects:a,errors:o}},e.getDiagnosticText=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=e.createCompilerDiagnostic.apply(void 0,arguments);return i.messageText},e.getParsedCommandLineOfConfigFile=function(t,r,n,i,a,o){var s=k(t,(function(e){return n.readFile(e)}));if(e.isString(s)){var c=e.parseJsonText(t,s),l=n.getCurrentDirectory();return c.path=e.toPath(t,l,e.createGetCanonicalFileName(n.useCaseSensitiveFileNames)),c.resolvedPath=c.path,c.originalFileName=c.fileName,Z(c,n,e.getNormalizedAbsolutePath(e.getDirectoryPath(t),l),r,e.getNormalizedAbsolutePath(t,l),void 0,o,i,a)}n.onUnRecoverableConfigFileDiagnostic(s);},e.readConfigFile=function(t,r){var n=k(t,r);return e.isString(n)?T(t,n):{config:{},error:n}},e.parseConfigFileTextToJson=T,e.readJsonConfigFile=C,e.tryReadFile=k;var N,F={optionDeclarations:e.typeAcquisitionDeclarations,unknownOptionDiagnostic:e.Diagnostics.Unknown_type_acquisition_option_0,unknownDidYouMeanDiagnostic:e.Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1};function A(){return N||(N=s(e.optionsForWatch))}var P,w,I,O,M={getOptionsNameMap:A,optionDeclarations:e.optionsForWatch,unknownOptionDiagnostic:e.Diagnostics.Unknown_watch_option_0,unknownDidYouMeanDiagnostic:e.Diagnostics.Unknown_watch_option_0_Did_you_mean_1,optionTypeMismatchDiagnostic:e.Diagnostics.Watch_option_0_requires_a_value_of_type_1};function L(){return P||(P=E(e.optionDeclarations))}function R(){return w||(w=E(e.optionsForWatch))}function B(){return I||(I=E(e.typeAcquisitionDeclarations))}function j(t,r,n,i){var a,o=null===(a=t.statements[0])||void 0===a?void 0:a.expression,s=n?(void 0===O&&(O={name:void 0,type:"object",elementOptions:E([{name:"compilerOptions",type:"object",elementOptions:L(),extraKeyDiagnostics:e.compilerOptionsDidYouMeanDiagnostics},{name:"watchOptions",type:"object",elementOptions:R(),extraKeyDiagnostics:M},{name:"typingOptions",type:"object",elementOptions:B(),extraKeyDiagnostics:F},{name:"typeAcquisition",type:"object",elementOptions:B(),extraKeyDiagnostics:F},{name:"extends",type:"string",category:e.Diagnostics.File_Management},{name:"references",type:"list",element:{name:"references",type:"object"},category:e.Diagnostics.Projects},{name:"files",type:"list",element:{name:"files",type:"string"},category:e.Diagnostics.File_Management},{name:"include",type:"list",element:{name:"include",type:"string"},category:e.Diagnostics.File_Management,defaultValueDescription:e.Diagnostics.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk},{name:"exclude",type:"list",element:{name:"exclude",type:"string"},category:e.Diagnostics.File_Management,defaultValueDescription:e.Diagnostics.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified},e.compileOnSaveCommandLineOption])}),O):void 0;if(o&&205!==o.kind){if(r.push(e.createDiagnosticForNodeInSourceFile(t,o,e.Diagnostics.The_root_value_of_a_0_file_must_be_an_object,"jsconfig.json"===e.getBaseFileName(t.fileName)?"jsconfig.json":"tsconfig.json")),e.isArrayLiteralExpression(o)){var c=e.find(o.elements,e.isObjectLiteralExpression);if(c)return z(t,c,r,!0,s,i)}return {}}return z(t,o,r,!0,s,i)}function J(e,t){var r;return z(e,null===(r=e.statements[0])||void 0===r?void 0:r.expression,t,!0,void 0,void 0)}function z(t,r,i,a,o,s){return r?u(r,o):a?{}:void 0;function c(e){return o&&o.elementOptions===e}function l(r,n,o,l){for(var d=a?{}:void 0,p=function(r){if(296!==r.kind)return i.push(e.createDiagnosticForNodeInSourceFile(t,r,e.Diagnostics.Property_assignment_expected)),"continue";r.questionToken&&i.push(e.createDiagnosticForNodeInSourceFile(t,r.questionToken,e.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files,"?")),_(r.name)||i.push(e.createDiagnosticForNodeInSourceFile(t,r.name,e.Diagnostics.String_literal_with_double_quotes_expected));var p=e.isComputedNonLiteralName(r.name)?void 0:e.getTextOfPropertyName(r.name),f=p&&e.unescapeLeadingUnderscores(p),g=f&&n?n.get(f):void 0;f&&o&&!g&&(n?i.push(y(f,o,(function(n,i,a){return e.createDiagnosticForNodeInSourceFile(t,r.name,n,i,a)}))):i.push(e.createDiagnosticForNodeInSourceFile(t,r.name,o.unknownOptionDiagnostic,f)));var m=u(r.initializer,g);if(void 0!==f&&(a&&(d[f]=m),s&&(l||c(n)))){var v=U(g,m);l?v&&s.onSetValidOptionKeyValueInParent(l,g,m):c(n)&&(v?s.onSetValidOptionKeyValueInRoot(f,r.name,m,r.initializer):g||s.onSetUnknownOptionKeyValueInRoot(f,r.name,m,r.initializer));}},f=0,g=r.properties;f<g.length;f++)p(g[f]);return d}function u(r,o){var s;switch(r.kind){case 110:return y(o&&"boolean"!==o.type),m(!0);case 95:return y(o&&"boolean"!==o.type),m(!1);case 104:return y(o&&"extends"===o.name),m(null);case 10:_(r)||i.push(e.createDiagnosticForNodeInSourceFile(t,r,e.Diagnostics.String_literal_with_double_quotes_expected)),y(o&&e.isString(o.type)&&"string"!==o.type);var c=r.text;if(o&&!e.isString(o.type)){var d=o;d.type.has(c.toLowerCase())||(i.push(p(d,(function(n,i,a){return e.createDiagnosticForNodeInSourceFile(t,r,n,i,a)}))),s=!0);}return m(c);case 8:return y(o&&"number"!==o.type),m(Number(r.text));case 219:if(40!==r.operator||8!==r.operand.kind)break;return y(o&&"number"!==o.type),m(-Number(r.operand.text));case 205:y(o&&"object"!==o.type);var f=r;if(o){var g=o;return m(l(f,g.elementOptions,g.extraKeyDiagnostics,g.name))}return m(l(f,void 0,void 0,void 0));case 204:return y(o&&"list"!==o.type),m(function(t,r){if(a)return e.filter(t.map((function(e){return u(e,r)})),(function(e){return void 0!==e}));t.forEach((function(e){return u(e,r)}));}(r.elements,o&&o.element))}return void(o?y(!0):i.push(e.createDiagnosticForNodeInSourceFile(t,r,e.Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal)));function m(a){var c;if(!s){var l=null===(c=null==o?void 0:o.extraValidation)||void 0===c?void 0:c.call(o,a);if(l)return void i.push(e.createDiagnosticForNodeInSourceFile.apply(void 0,n$4([t,r],l,!1)))}return a}function y(n){n&&(i.push(e.createDiagnosticForNodeInSourceFile(t,r,e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,o.name,K(o))),s=!0);}}function _(r){return e.isStringLiteral(r)&&e.isStringDoubleQuoted(r,t)}}function K(t){return "list"===t.type?"Array":e.isString(t.type)?t.type:"string"}function U(t,r){return !!t&&(!!ee(r)||("list"===t.type?e.isArray(r):typeof r===(e.isString(t.type)?t.type:"string")))}function V(t){return i$1({},e.arrayFrom(t.entries()).reduce((function(e,t){var r;return i$1(i$1({},e),((r={})[t[0]]=t[1],r))}),{}))}function q(t){if(e.length(t)){if(1!==e.length(t))return t;if("**/*"!==t[0])return t}}function W(e){return "string"===e.type||"number"===e.type||"boolean"===e.type||"object"===e.type?void 0:"list"===e.type?W(e.element):e.type}function H(t,r){return e.forEachEntry(r,(function(e,r){if(e===t)return r}))}function G(e,t){return Q(e,c(),t)}function Q(t,r,n){var i=r.optionsNameMap,a=new e.Map,o=n&&e.createGetCanonicalFileName(n.useCaseSensitiveFileNames),s=function(r){if(e.hasProperty(t,r)){if(i.has(r)&&(i.get(r).category===e.Diagnostics.Command_line_Options||i.get(r).category===e.Diagnostics.Output_Formatting))return "continue";var s=t[r],c=i.get(r.toLowerCase());if(c){var l=W(c);l?"list"===c.type?a.set(r,s.map((function(e){return H(e,l)}))):a.set(r,H(s,l)):n&&c.isFilePath?a.set(r,e.getRelativePathFromFile(n.configFilePath,e.getNormalizedAbsolutePath(s,e.getDirectoryPath(n.configFilePath)),o)):a.set(r,s);}}};for(var c in t)s(c);return a}function X(t){return G(e.extend(t,e.defaultInitCompilerOptions))}function Y(e,t,r){if(e&&!ee(t))if("list"===e.type){var n=t;if(e.element.isFilePath&&n.length)return n.map(r)}else if(e.isFilePath)return r(t);return t}function Z(t,r,n,i,a,o,s,c,l){null===e.tracing||void 0===e.tracing||e.tracing.push("parse","parseJsonSourceFileConfigFileContent",{path:t.fileName});var u=re(void 0,t,r,n,i,l,a,o,s,c);return null===e.tracing||void 0===e.tracing||e.tracing.pop(),u}function $(e,t){t&&Object.defineProperty(e,"configFile",{enumerable:!1,writable:!1,value:t});}function ee(e){return null==e}function te(t,r){return e.getDirectoryPath(e.getNormalizedAbsolutePath(t,r))}function re(t,r,n,i,a,o,s,c,l,u){void 0===a&&(a={}),void 0===c&&(c=[]),void 0===l&&(l=[]),e.Debug.assert(void 0===t&&void 0!==r||void 0!==t&&void 0===r);var _=[],d=oe(t,r,n,i,s,c,_,u),p=d.raw,f=e.extend(a,d.options||{}),g=o&&d.watchOptions?e.extend(o,d.watchOptions):d.watchOptions||o;f.configFilePath=s&&e.normalizeSlashes(s);var m=function(){var t=b("references",(function(e){return "object"==typeof e}),"object"),n=v(h("files"));if(n){var i="no-prop"===t||e.isArray(t)&&0===t.length,a=e.hasProperty(p,"extends");if(0===n.length&&i&&!a)if(r){var o=s||"tsconfig.json",c=e.Diagnostics.The_files_list_in_config_file_0_is_empty,l=e.firstDefined(e.getTsConfigPropArray(r,"files"),(function(e){return e.initializer})),u=l?e.createDiagnosticForNodeInSourceFile(r,l,c,o):e.createCompilerDiagnostic(c,o);_.push(u);}else x(e.Diagnostics.The_files_list_in_config_file_0_is_empty,s||"tsconfig.json");}var d,f,g=v(h("include")),m=h("exclude"),y=v(m);if("no-prop"===m&&p.compilerOptions){var D=p.compilerOptions.outDir,S=p.compilerOptions.declarationDir;(D||S)&&(y=[D,S].filter((function(e){return !!e})));}return void 0===n&&void 0===g&&(g=["**/*"]),g&&(d=Se(g,_,!0,r,"include")),y&&(f=Se(y,_,!1,r,"exclude")),{filesSpecs:n,includeSpecs:g,excludeSpecs:y,validatedFilesSpec:e.filter(n,e.isString),validatedIncludeSpecs:d,validatedExcludeSpecs:f,pathPatterns:void 0}}();r&&(r.configFileSpecs=m),$(f,r);var y=e.normalizePath(s?te(s,i):i);return {options:f,watchOptions:g,fileNames:function(e){var t=be(m,e,f,n,l);return ie(t,ae(p),c)&&_.push(ne(m,s)),t}(y),projectReferences:function(t){var r,n=b("references",(function(e){return "object"==typeof e}),"object");if(e.isArray(n))for(var i=0,a=n;i<a.length;i++){var o=a[i];"string"!=typeof o.path?x(e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,"reference.path","string"):(r||(r=[])).push({path:e.getNormalizedAbsolutePath(o.path,t),originalPath:o.path,prepend:o.prepend,circular:o.circular});}return r}(y),typeAcquisition:d.typeAcquisition||ue(),raw:p,errors:_,wildcardDirectories:Ce(m,y,n.useCaseSensitiveFileNames),compileOnSave:!!p.compileOnSave};function v(t){return e.isArray(t)?t:void 0}function h(t){return b(t,e.isString,"string")}function b(t,n,i){if(e.hasProperty(p,t)&&!ee(p[t])){if(e.isArray(p[t])){var a=p[t];return r||e.every(a,n)||_.push(e.createCompilerDiagnostic(e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,t,i)),a}return x(e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,t,"Array"),"not-array"}return "no-prop"}function x(t,n,i){r||_.push(e.createCompilerDiagnostic(t,n,i));}}function ne(t,r){var n=t.includeSpecs,i=t.excludeSpecs;return e.createCompilerDiagnostic(e.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2,r||"tsconfig.json",JSON.stringify(n||[]),JSON.stringify(i||[]))}function ie(e,t,r){return 0===e.length&&t&&(!r||0===r.length)}function ae(t){return !e.hasProperty(t,"files")&&!e.hasProperty(t,"references")}function oe(t,r,i,a,s,c,l,u){var _;a=e.normalizeSlashes(a);var d=e.getNormalizedAbsolutePath(s||"",a);if(c.indexOf(d)>=0)return l.push(e.createCompilerDiagnostic(e.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0,n$4(n$4([],c,!0),[d],!1).join(" -> "))),{raw:t||J(r,l)};var p=t?function(t,r,n,i,a){e.hasProperty(t,"excludes")&&a.push(e.createCompilerDiagnostic(e.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));var o,s=le(t.compilerOptions,n,a,i),c=_e(t.typeAcquisition||t.typingOptions,n,a,i),l=function(e,t,r){return de(R(),e,t,void 0,M,r)}(t.watchOptions,n,a);if(t.compileOnSave=function(t,r,n){if(!e.hasProperty(t,e.compileOnSaveCommandLineOption.name))return !1;var i=pe(e.compileOnSaveCommandLineOption,t.compileOnSave,r,n);return "boolean"==typeof i&&i}(t,n,a),t.extends)if(e.isString(t.extends)){var u=i?te(i,n):n;o=se(t.extends,r,u,a,e.createCompilerDiagnostic);}else a.push(e.createCompilerDiagnostic(e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,"extends","string"));return {raw:t,options:s,watchOptions:l,typeAcquisition:c,extendedConfigPath:o}}(t,i,a,s,l):function(t,r,n,i,a){var s,c,l,u,_,d=ce(i),p={onSetValidOptionKeyValueInParent:function(t,r,a){var o;switch(t){case"compilerOptions":o=d;break;case"watchOptions":o=l||(l={});break;case"typeAcquisition":o=s||(s=ue(i));break;case"typingOptions":o=c||(c=ue(i));break;default:e.Debug.fail("Unknown option");}o[r.name]=fe(r,n,a);},onSetValidOptionKeyValueInRoot:function(o,s,c,l){switch(o){case"extends":var _=i?te(i,n):n;return void(u=se(c,r,_,a,(function(r,n){return e.createDiagnosticForNodeInSourceFile(t,l,r,n)})))}},onSetUnknownOptionKeyValueInRoot:function(r,n,i,s){"excludes"===r&&a.push(e.createDiagnosticForNodeInSourceFile(t,n,e.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)),e.find(o,(function(e){return e.name===r}))&&(_=e.append(_,n));}},f=j(t,a,!0,p);return s||(s=c?void 0!==c.enableAutoDiscovery?{enable:c.enableAutoDiscovery,include:c.include,exclude:c.exclude}:c:ue(i)),_&&f&&void 0===f.compilerOptions&&a.push(e.createDiagnosticForNodeInSourceFile(t,_[0],e.Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file,e.getTextOfPropertyName(_[0]))),{raw:f,options:d,watchOptions:l,typeAcquisition:s,extendedConfigPath:u}}(r,i,a,s,l);if((null===(_=p.options)||void 0===_?void 0:_.paths)&&(p.options.pathsBasePath=a),p.extendedConfigPath){c=c.concat([d]);var f=function(t,r,n,i,a,o){var s,c,l,u,_=n.useCaseSensitiveFileNames?r:e.toFileNameLowerCase(r);if(o&&(c=o.get(_))?(l=c.extendedResult,u=c.extendedConfig):((l=C(r,(function(e){return n.readFile(e)}))).parseDiagnostics.length||(u=oe(void 0,l,n,e.getDirectoryPath(r),e.getBaseFileName(r),i,a,o)),o&&o.set(_,{extendedResult:l,extendedConfig:u})),t&&(t.extendedSourceFiles=[l.fileName],l.extendedSourceFiles&&(s=t.extendedSourceFiles).push.apply(s,l.extendedSourceFiles)),!l.parseDiagnostics.length)return u;a.push.apply(a,l.parseDiagnostics);}(r,p.extendedConfigPath,i,c,l,u);if(f&&f.options){var g,m=f.raw,y=p.raw,v=function(t){!y[t]&&m[t]&&(y[t]=e.map(m[t],(function(t){return e.isRootedDiskPath(t)?t:e.combinePaths(g||(g=e.convertToRelativePath(e.getDirectoryPath(p.extendedConfigPath),a,e.createGetCanonicalFileName(i.useCaseSensitiveFileNames))),t)})));};v("include"),v("exclude"),v("files"),void 0===y.compileOnSave&&(y.compileOnSave=m.compileOnSave),p.options=e.assign({},f.options,p.options),p.watchOptions=p.watchOptions&&f.watchOptions?e.assign({},f.watchOptions,p.watchOptions):p.watchOptions||f.watchOptions;}}return p}function se(t,r,n,i,a){if(t=e.normalizeSlashes(t),e.isRootedDiskPath(t)||e.startsWith(t,"./")||e.startsWith(t,"../")){var o=e.getNormalizedAbsolutePath(t,n);return r.fileExists(o)||e.endsWith(o,".json")||(o="".concat(o,".json"),r.fileExists(o))?o:void i.push(a(e.Diagnostics.File_0_not_found,t))}var s=e.nodeModuleNameResolver(t,e.combinePaths(n,"tsconfig.json"),{moduleResolution:e.ModuleResolutionKind.NodeJs},r,void 0,void 0,!0);if(s.resolvedModule)return s.resolvedModule.resolvedFileName;i.push(a(e.Diagnostics.File_0_not_found,t));}function ce(t){return t&&"jsconfig.json"===e.getBaseFileName(t)?{allowJs:!0,maxNodeModuleJsDepth:2,allowSyntheticDefaultImports:!0,skipLibCheck:!0,noEmit:!0}:{}}function le(t,r,n,i){var a=ce(i);return de(L(),t,r,a,e.compilerOptionsDidYouMeanDiagnostics,n),i&&(a.configFilePath=e.normalizeSlashes(i)),a}function ue(t){return {enable:!!t&&"jsconfig.json"===e.getBaseFileName(t),include:[],exclude:[]}}function _e(e,t,r,n){var i=ue(n),a=_(e);return de(B(),a,t,i,F,r),i}function de(t,r,n,i,a,o){if(r){for(var s in r){var c=t.get(s);c?(i||(i={}))[c.name]=pe(c,r[s],n,o):o.push(y(s,a,e.createCompilerDiagnostic));}return i}}function pe(t,r,n,i){if(U(t,r)){var a=t.type;if("list"===a&&e.isArray(r))return function(t,r,n,i){return e.filter(e.map(r,(function(e){return pe(t.element,e,n,i)})),(function(e){return !!t.listPreserveFalsyValues||!!e}))}(t,r,n,i);if(!e.isString(a))return ye(t,r,i);var o=me(t,r,i);return ee(o)?o:ge(t,n,o)}i.push(e.createCompilerDiagnostic(e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,t.name,K(t)));}function fe(t,r,n){if(!ee(n)){if("list"===t.type){var i=t;return i.element.isFilePath||!e.isString(i.element.type)?e.filter(e.map(n,(function(e){return fe(i.element,r,e)})),(function(e){return !!i.listPreserveFalsyValues||!!e})):n}return e.isString(t.type)?ge(t,r,n):t.type.get(e.isString(n)?n.toLowerCase():n)}}function ge(t,r,n){return t.isFilePath&&""===(n=e.getNormalizedAbsolutePath(n,r))&&(n="."),n}function me(t,r,n){var i;if(!ee(r)){var a=null===(i=t.extraValidation)||void 0===i?void 0:i.call(t,r);if(!a)return r;n.push(e.createCompilerDiagnostic.apply(void 0,a));}}function ye(e,t,r){if(!ee(t)){var n=t.toLowerCase(),i=e.type.get(n);if(void 0!==i)return me(e,i,r);r.push(d(e));}}e.convertToObject=J,e.convertToObjectWorker=z,e.convertToTSConfig=function(t,r,n){var a,o,s,c=e.createGetCanonicalFileName(n.useCaseSensitiveFileNames),l=e.map(e.filter(t.fileNames,(null===(o=null===(a=t.options.configFile)||void 0===a?void 0:a.configFileSpecs)||void 0===o?void 0:o.validatedIncludeSpecs)?function(t,r,n,i){if(!r)return e.returnTrue;var a=e.getFileMatcherPatterns(t,n,r,i.useCaseSensitiveFileNames,i.getCurrentDirectory()),o=a.excludePattern&&e.getRegexFromPattern(a.excludePattern,i.useCaseSensitiveFileNames),s=a.includeFilePattern&&e.getRegexFromPattern(a.includeFilePattern,i.useCaseSensitiveFileNames);return s?o?function(e){return !(s.test(e)&&!o.test(e))}:function(e){return !s.test(e)}:o?function(e){return o.test(e)}:e.returnTrue}(r,t.options.configFile.configFileSpecs.validatedIncludeSpecs,t.options.configFile.configFileSpecs.validatedExcludeSpecs,n):e.returnTrue),(function(t){return e.getRelativePathFromFile(e.getNormalizedAbsolutePath(r,n.getCurrentDirectory()),e.getNormalizedAbsolutePath(t,n.getCurrentDirectory()),c)})),u=G(t.options,{configFilePath:e.getNormalizedAbsolutePath(r,n.getCurrentDirectory()),useCaseSensitiveFileNames:n.useCaseSensitiveFileNames}),_=t.watchOptions&&Q(t.watchOptions,A());return i$1(i$1({compilerOptions:i$1(i$1({},V(u)),{showConfig:void 0,configFile:void 0,configFilePath:void 0,help:void 0,init:void 0,listFiles:void 0,listEmittedFiles:void 0,project:void 0,build:void 0,version:void 0}),watchOptions:_&&V(_),references:e.map(t.projectReferences,(function(e){return i$1(i$1({},e),{path:e.originalPath?e.originalPath:"",originalPath:void 0})})),files:e.length(l)?l:void 0},(null===(s=t.options.configFile)||void 0===s?void 0:s.configFileSpecs)?{include:q(t.options.configFile.configFileSpecs.validatedIncludeSpecs),exclude:t.options.configFile.configFileSpecs.validatedExcludeSpecs}:{}),{compileOnSave:!!t.compileOnSave||void 0})},e.getCompilerOptionsDiffValue=function(t,r){var n,i,a=X(t);return n=[],i=Array(3).join(" "),o.forEach((function(t){if(a.has(t.name)){var r=a.get(t.name),o=Ne(t);r!==o?n.push("".concat(i).concat(t.name,": ").concat(r)):e.hasProperty(e.defaultInitCompilerOptions,t.name)&&n.push("".concat(i).concat(t.name,": ").concat(o));}})),n.join(r)+r},e.generateTSConfig=function(t,r,n){var i=X(t);return function(){for(var t=e.createMultiMap(),s=0,c=e.optionDeclarations;s<c.length;s++){var l=c[s],u=l.category;o(l)&&t.add(e.getLocaleSpecificMessage(u),l);}var _=0,d=0,p=[];t.forEach((function(t,r){0!==p.length&&p.push({value:""}),p.push({value:"/* ".concat(r," */")});for(var n=0,a=t;n<a.length;n++){var o,s=a[n];o=i.has(s.name)?'"'.concat(s.name,'": ').concat(JSON.stringify(i.get(s.name))).concat((d+=1)===i.size?"":","):'// "'.concat(s.name,'": ').concat(JSON.stringify(Ne(s)),","),p.push({value:o,description:"/* ".concat(s.description&&e.getLocaleSpecificMessage(s.description)||s.name," */")}),_=Math.max(o.length,_);}}));var f=a(2),g=[];g.push("{"),g.push("".concat(f,'"compilerOptions": {')),g.push("".concat(f).concat(f,"/* ").concat(e.getLocaleSpecificMessage(e.Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file)," */")),g.push("");for(var m=0,y=p;m<y.length;m++){var v=y[m],h=v.value,b=v.description,x=void 0===b?"":b;g.push(h&&"".concat(f).concat(f).concat(h).concat(x&&a(_-h.length+2)+x));}if(r.length){g.push("".concat(f,"},")),g.push("".concat(f,'"files": ['));for(var D=0;D<r.length;D++)g.push("".concat(f).concat(f).concat(JSON.stringify(r[D])).concat(D===r.length-1?"":","));g.push("".concat(f,"]"));}else g.push("".concat(f,"}"));return g.push("}"),g.join(n)+n}();function a(e){return Array(e+1).join(" ")}function o(t){var r=t.category,n=t.name,a=t.isCommandLineOnly,o=[e.Diagnostics.Command_line_Options,e.Diagnostics.Editor_Support,e.Diagnostics.Compiler_Diagnostics,e.Diagnostics.Backwards_Compatibility,e.Diagnostics.Watch_and_Build_Modes,e.Diagnostics.Output_Formatting];return !a&&void 0!==r&&(!o.includes(r)||i.has(n))}},e.convertToOptionsWithAbsolutePaths=function(t,r){var n={},i=c().optionsNameMap;for(var a in t)e.hasProperty(t,a)&&(n[a]=Y(i.get(a.toLowerCase()),t[a],r));return n.configFilePath&&(n.configFilePath=r(n.configFilePath)),n},e.parseJsonConfigFileContent=function(e,t,r,n,i,a,o,s,c){return re(e,void 0,t,r,n,c,i,a,o,s)},e.parseJsonSourceFileConfigFileContent=Z,e.setConfigFileInOptions=$,e.canJsonReportNoInputFiles=ae,e.updateErrorForNoInputFiles=function(t,r,n,i,a){var o=i.length;return ie(t,a)?i.push(ne(n,r)):e.filterMutate(i,(function(t){return !function(t){return t.code===e.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code}(t)})),o!==i.length},e.convertCompilerOptionsFromJson=function(e,t,r){var n=[];return {options:le(e,t,n,r),errors:n}},e.convertTypeAcquisitionFromJson=function(e,t,r){var n=[];return {options:_e(e,t,n,r),errors:n}},e.convertJsonOption=pe;var ve=/(^|\/)\*\*\/?$/,he=/^[^*?]*(?=\/[^/]*[*?])/;function be(t,r,n,i,a){void 0===a&&(a=e.emptyArray),r=e.normalizePath(r);var o,s=e.createGetCanonicalFileName(i.useCaseSensitiveFileNames),c=new e.Map,l=new e.Map,u=new e.Map,_=t.validatedFilesSpec,d=t.validatedIncludeSpecs,p=t.validatedExcludeSpecs,f=e.getSupportedExtensions(n,a),g=e.getSupportedExtensionsWithJsonIfResolveJsonModule(n,f);if(_)for(var m=0,y=_;m<y.length;m++){var v=y[m],h=e.getNormalizedAbsolutePath(v,r);c.set(s(h),h);}if(d&&d.length>0)for(var b=function(t){if(e.fileExtensionIs(t,".json")){if(!o){var n=d.filter((function(t){return e.endsWith(t,".json")})),a=e.map(e.getRegularExpressionsForWildcards(n,r,"files"),(function(e){return "^".concat(e,"$")}));o=a?a.map((function(t){return e.getRegexFromPattern(t,i.useCaseSensitiveFileNames)})):e.emptyArray;}if(-1!==e.findIndex(o,(function(e){return e.test(t)}))){var _=s(t);c.has(_)||u.has(_)||u.set(_,t);}return "continue"}if(function(t,r,n,i,a){var o=e.forEach(i,(function(r){return e.fileExtensionIsOneOf(t,r)?r:void 0}));if(!o)return !1;for(var s=0,c=o;s<c.length;s++){var l=c[s];if(e.fileExtensionIs(t,l))return !1;var u=a(e.changeExtension(t,l));if(r.has(u)||n.has(u)){if(".d.ts"===l&&(e.fileExtensionIs(t,".js")||e.fileExtensionIs(t,".jsx")))continue;return !0}}return !1}(t,c,l,f,s))return "continue";!function(t,r,n,i){var a=e.forEach(n,(function(r){return e.fileExtensionIsOneOf(t,r)?r:void 0}));if(a)for(var o=a.length-1;o>=0;o--){var s=a[o];if(e.fileExtensionIs(t,s))return;var c=i(e.changeExtension(t,s));r.delete(c);}}(t,l,f,s);var p=s(t);c.has(p)||l.has(p)||l.set(p,t);},x=0,D=i.readDirectory(r,e.flatten(g),p,d,void 0);x<D.length;x++)b(h=D[x]);var S=e.arrayFrom(c.values()),T=e.arrayFrom(l.values());return S.concat(T,e.arrayFrom(u.values()))}function xe(t){var r=e.startsWith(t,"**/")?0:t.indexOf("/**/");return -1!==r&&(e.endsWith(t,"/..")?t.length:t.lastIndexOf("/../"))>r}function De(t,r,n,i,a){var o=e.getRegularExpressionForWildcard(r,e.combinePaths(e.normalizePath(i),a),"exclude"),s=o&&e.getRegexFromPattern(o,n);return !!s&&(!!s.test(t)||!e.hasExtension(t)&&s.test(e.ensureTrailingDirectorySeparator(t)))}function Se(t,r,n,i,a){return t.filter((function(t){if(!e.isString(t))return !1;var i=Te(t,n);return void 0!==i&&r.push(o.apply(void 0,i)),void 0===i}));function o(t,r){var n=e.getTsConfigPropArrayElementValue(i,a,r);return n?e.createDiagnosticForNodeInSourceFile(i,n,t,r):e.createCompilerDiagnostic(t,r)}}function Te(t,r){return r&&ve.test(t)?[e.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0,t]:xe(t)?[e.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0,t]:void 0}function Ce(t,r,n){var i=t.validatedIncludeSpecs,a=t.validatedExcludeSpecs,o=e.getRegularExpressionForWildcard(a,r,"exclude"),s=o&&new RegExp(o,n?"":"i"),c={};if(void 0!==i){for(var l=[],u=0,_=i;u<_.length;u++){var d=_[u],p=e.normalizePath(e.combinePaths(r,d));if(!s||!s.test(p)){var f=ke(p,n);if(f){var g=f.key,m=f.flags,y=c[g];(void 0===y||y<m)&&(c[g]=m,1===m&&l.push(g));}}}for(var g in c)if(e.hasProperty(c,g))for(var v=0,h=l;v<h.length;v++){var b=h[v];g!==b&&e.containsPath(b,g,r,!n)&&delete c[g];}}return c}function ke(t,r){var n=he.exec(t);if(n){var i=t.indexOf("?"),a=t.indexOf("*"),o=t.lastIndexOf(e.directorySeparator);return {key:r?n[0]:e.toFileNameLowerCase(n[0]),flags:-1!==i&&i<o||-1!==a&&a<o?1:0}}if(e.isImplicitGlob(t.substring(t.lastIndexOf(e.directorySeparator)+1)))return {key:e.removeTrailingDirectorySeparator(r?t:e.toFileNameLowerCase(t)),flags:1}}function Ee(t,r){switch(r.type){case"object":case"string":return "";case"number":return "number"==typeof t?t:"";case"boolean":return "boolean"==typeof t?t:"";case"list":var n=r.element;return e.isArray(t)?t.map((function(e){return Ee(e,n)})):"";default:return e.forEachEntry(r.type,(function(e,r){if(e===t)return r}))}}function Ne(t){switch(t.type){case"number":return 1;case"boolean":return !0;case"string":var r=t.defaultValueDescription;return t.isFilePath?"./".concat(r&&"string"==typeof r?r:""):"";case"list":return [];case"object":return {};default:var n=t.type.keys().next();return n.done?e.Debug.fail("Expected 'option.type' to have entries."):n.value}}e.getFileNamesFromConfigSpecs=be,e.isExcludedFile=function(t,r,n,i,a){var o=r.validatedFilesSpec,s=r.validatedIncludeSpecs,c=r.validatedExcludeSpecs;if(!e.length(s)||!e.length(c))return !1;n=e.normalizePath(n);var l=e.createGetCanonicalFileName(i);if(o)for(var u=0,_=o;u<_.length;u++){var d=_[u];if(l(e.getNormalizedAbsolutePath(d,n))===t)return !1}return De(t,c,i,a,n)},e.matchesExclude=function(t,r,n,i){return De(t,e.filter(r,(function(e){return !xe(e)})),n,i)},e.convertCompilerOptionsForTelemetry=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=b(r);void 0!==n&&(t[r]=Ee(e[r],n));}return t};}(t),function(e){function t(t){t.trace(e.formatMessage.apply(void 0,arguments));}function r(e,t){return !!e.traceResolution&&void 0!==t.trace}function a(t,r){var n;if(r&&t){var i=t.packageJsonContent;"string"==typeof i.name&&"string"==typeof i.version&&(n={name:i.name,subModuleName:r.path.slice(t.packageDirectory.length+e.directorySeparator.length),version:i.version});}return r&&{path:r.path,extension:r.ext,packageId:n}}function o(e){return a(void 0,e)}function s(t){if(t)return e.Debug.assert(void 0===t.packageId),{path:t.path,ext:t.extension}}var c,l;function u(t){if(t)return e.Debug.assert(e.extensionIsTS(t.extension)),{fileName:t.path,packageId:t.packageId}}function _(e,t,r,n,i){var a;return i?((a=i.failedLookupLocations).push.apply(a,r),i):{resolvedModule:e&&{resolvedFileName:e.path,originalPath:!0===e.originalPath?void 0:e.originalPath,extension:e.extension,isExternalLibraryImport:t,packageId:e.packageId},failedLookupLocations:r,resolutionDiagnostics:n}}function d(r,n,i,a){if(e.hasProperty(r,n)){var o=r[n];if(typeof o===i&&null!==o)return o;a.traceEnabled&&t(a.host,e.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2,n,i,null===o?"null":typeof o);}else a.traceEnabled&&t(a.host,e.Diagnostics.package_json_does_not_have_a_0_field,n);}function p(r,n,i,a){var o=d(r,n,"string",a);if(void 0!==o){if(o){var s=e.normalizePath(e.combinePaths(i,o));return a.traceEnabled&&t(a.host,e.Diagnostics.package_json_has_0_field_1_that_references_2,n,o,s),s}a.traceEnabled&&t(a.host,e.Diagnostics.package_json_had_a_falsy_0_field,n);}}function f(e,t,r){return p(e,"typings",t,r)||p(e,"types",t,r)}function g(e,t,r){return p(e,"main",t,r)}function m(r,n){var i=function(r,n){var i=d(r,"typesVersions","object",n);if(void 0!==i)return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_has_a_typesVersions_field_with_version_specific_path_mappings),i}(r,n);if(void 0!==i){if(n.traceEnabled)for(var a in i)e.hasProperty(i,a)&&!e.VersionRange.tryParse(a)&&t(n.host,e.Diagnostics.package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range,a);var o=y(i);if(o){var s=o.version,c=o.paths;if("object"==typeof c)return o;n.traceEnabled&&t(n.host,e.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2,"typesVersions['".concat(s,"']"),"object",typeof c);}else n.traceEnabled&&t(n.host,e.Diagnostics.package_json_does_not_have_a_typesVersions_entry_that_matches_version_0,e.versionMajorMinor);}}function y(t){for(var r in l||(l=new e.Version(e.version)),t)if(e.hasProperty(t,r)){var n=e.VersionRange.tryParse(r);if(void 0!==n&&n.test(l))return {version:r,paths:t[r]}}}function v(t,r){return t.typeRoots?t.typeRoots:(t.configFilePath?n=e.getDirectoryPath(t.configFilePath):r.getCurrentDirectory&&(n=r.getCurrentDirectory()),void 0!==n?function(t,r){return r.directoryExists?(e.forEachAncestorDirectory(e.normalizePath(t),(function(t){var i=e.combinePaths(t,b);r.directoryExists(i)&&(n||(n=[])).push(i);})),n):[e.combinePaths(t,b)];var n;}(n,r):void 0);var n;}e.trace=t,e.isTraceEnabled=r,function(e){e[e.TypeScript=0]="TypeScript",e[e.JavaScript=1]="JavaScript",e[e.Json=2]="Json",e[e.TSConfig=3]="TSConfig",e[e.DtsOnly=4]="DtsOnly",e[e.TsOnly=5]="TsOnly";}(c||(c={})),e.getPackageJsonTypesVersionsPaths=y,e.getEffectiveTypeRoots=v;var h,b=e.combinePaths("node_modules","@types");function x(t,r,n){var i="function"==typeof n.useCaseSensitiveFileNames?n.useCaseSensitiveFileNames():n.useCaseSensitiveFileNames;return 0===e.comparePaths(t,r,!i)}function D(t){return e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.Node16?h.Node16Default:e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.NodeNext?h.NodeNextDefault:h.None}function S(t){var r=new e.Map,n=new e.Map;return {getOwnMap:function(){return r},redirectsMap:n,getOrCreateMapOfCacheRedirects:function(i){if(!i)return r;var a=i.sourceFile.path,o=n.get(a);return o||(o=!t||e.optionsHaveModuleResolutionChanges(t,i.commandLine.options)?new e.Map:r,n.set(a,o)),o},clear:function(){r.clear(),n.clear();},setOwnOptions:function(e){t=e;},setOwnMap:function(e){r=e;}}}function T(t,r){var n;return {getPackageJsonInfo:function(i){return null==n?void 0:n.get(e.toPath(i,t,r))},setPackageJsonInfo:function(i,a){(n||(n=new e.Map)).set(e.toPath(i,t,r),a);},clear:function(){n=void 0;},entries:function(){var t=null==n?void 0:n.entries();return t?e.arrayFrom(t):[]}}}function C(e,t,r,n){var i=e.getOrCreateMapOfCacheRedirects(t),a=i.get(r);return a||(a=n(),i.set(r,a)),a}function k(t,r,n){if(t.configFile){if(0===r.redirectsMap.size)e.Debug.assert(!n||0===n.redirectsMap.size),e.Debug.assert(0===r.getOwnMap().size),e.Debug.assert(!n||0===n.getOwnMap().size),r.redirectsMap.set(t.configFile.path,r.getOwnMap()),null==n||n.redirectsMap.set(t.configFile.path,n.getOwnMap());else {e.Debug.assert(!n||n.redirectsMap.size>0);var i={sourceFile:t.configFile,commandLine:{options:t}};r.setOwnMap(r.getOrCreateMapOfCacheRedirects(i)),null==n||n.setOwnMap(n.getOrCreateMapOfCacheRedirects(i));}r.setOwnOptions(t),null==n||n.setOwnOptions(t);}}function E(t,r,n){return {getOrCreateCacheForDirectory:function(i,a){var o=e.toPath(i,t,r);return C(n,a,o,(function(){return N()}))},clear:function(){n.clear();},update:function(e){k(e,n);}}}function N(){var t=new e.Map,r=new e.Map,n={get:function(e,r){return t.get(i(e,r))},set:function(e,r,a){return t.set(i(e,r),a),n},delete:function(e,r){return t.delete(i(e,r)),n},has:function(e,r){return t.has(i(e,r))},forEach:function(e){return t.forEach((function(t,n){var i=r.get(n),a=i[0],o=i[1];return e(t,a,o)}))},size:function(){return t.size}};return n;function i(e,t){var n=void 0===t?e:"".concat(t,"|").concat(e);return r.set(n,[e,t]),n}}function F(r,n,i,a,o){var s=function(r,n,i,a){var o,s=a.compilerOptions,c=s.baseUrl,l=s.paths,u=s.configFile;if(l&&!e.pathIsRelative(n))return a.traceEnabled&&(c&&t(a.host,e.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1,c,n),t(a.host,e.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0,n)),de(r,n,e.getPathsBasePath(a.compilerOptions,a.host),l,(null==u?void 0:u.configFileSpecs)?(o=u.configFileSpecs).pathPatterns||(o.pathPatterns=e.tryParsePatterns(l)):void 0,i,!1,a)}(r,n,a,o);return s?s.value:e.isExternalModuleNameRelative(n)?function(r,n,i,a,o){if(o.compilerOptions.rootDirs){o.traceEnabled&&t(o.host,e.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0,n);for(var s,c,l=e.normalizePath(e.combinePaths(i,n)),u=0,_=o.compilerOptions.rootDirs;u<_.length;u++){var d=_[u],p=e.normalizePath(d);e.endsWith(p,e.directorySeparator)||(p+=e.directorySeparator);var f=e.startsWith(l,p)&&(void 0===c||c.length<p.length);o.traceEnabled&&t(o.host,e.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2,p,l,f),f&&(c=p,s=d);}if(c){o.traceEnabled&&t(o.host,e.Diagnostics.Longest_matching_prefix_for_0_is_1,l,c);var g=l.substr(c.length);o.traceEnabled&&t(o.host,e.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2,g,c,l);var m=a(r,l,!e.directoryProbablyExists(i,o.host),o);if(m)return m;o.traceEnabled&&t(o.host,e.Diagnostics.Trying_other_entries_in_rootDirs);for(var y=0,v=o.compilerOptions.rootDirs;y<v.length;y++)if((d=v[y])!==s){var h=e.combinePaths(e.normalizePath(d),g);o.traceEnabled&&t(o.host,e.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2,g,d,h);var b=e.getDirectoryPath(h),x=a(r,h,!e.directoryProbablyExists(b,o.host),o);if(x)return x}o.traceEnabled&&t(o.host,e.Diagnostics.Module_resolution_using_rootDirs_has_failed);}}}(r,n,i,a,o):function(r,n,i,a){var o=a.compilerOptions.baseUrl;if(o){a.traceEnabled&&t(a.host,e.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1,o,n);var s=e.normalizePath(e.combinePaths(o,n));return a.traceEnabled&&t(a.host,e.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2,n,o,s),i(r,s,!e.directoryProbablyExists(e.getDirectoryPath(s),a.host),a)}}(r,n,a,o)}e.resolveTypeReferenceDirective=function(n,i,a,o,s,l,_){e.Debug.assert("string"==typeof n,"Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");var d=r(a,o);s&&(a=s.commandLine.options);var p=i?e.getDirectoryPath(i):void 0,f=p?l&&l.getOrCreateCacheForDirectory(p,s):void 0,g=f&&f.get(n,_);if(g)return d&&(t(o,e.Diagnostics.Resolving_type_reference_directive_0_containing_file_1,n,i),s&&t(o,e.Diagnostics.Using_compiler_options_of_project_reference_redirect_0,s.sourceFile.fileName),t(o,e.Diagnostics.Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1,n,p),w(g)),g;var m=v(a,o);d&&(void 0===i?void 0===m?t(o,e.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set,n):t(o,e.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1,n,m):void 0===m?t(o,e.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set,n,i):t(o,e.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2,n,i,m),s&&t(o,e.Diagnostics.Using_compiler_options_of_project_reference_redirect_0,s.sourceFile.fileName));var y=[],b=D(a);_!==e.ModuleKind.ESNext||e.getEmitModuleResolutionKind(a)!==e.ModuleResolutionKind.Node16&&e.getEmitModuleResolutionKind(a)!==e.ModuleResolutionKind.NodeNext||(b|=h.EsmMode);var S,T=b&h.Exports?b&h.EsmMode?["node","import","types"]:["node","require","types"]:[],C=[],k={compilerOptions:a,host:o,traceEnabled:d,failedLookupLocations:y,packageJsonInfoCache:l,features:b,conditions:T,requestContainingDirectory:p,reportDiagnostic:function(e){C.push(e);}},E=function(){if(m&&m.length)return d&&t(o,e.Diagnostics.Resolving_with_primary_search_path_0,m.join(", ")),e.firstDefined(m,(function(r){var i=e.combinePaths(r,n),a=e.getDirectoryPath(i),s=e.directoryProbablyExists(a,o);return !s&&d&&t(o,e.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,a),u(X(c.DtsOnly,i,!s,k))}));d&&t(o,e.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths);}(),N=!0;if(E||(E=function(){var r=i&&e.getDirectoryPath(i);if(void 0!==r){var a;if(d&&t(o,e.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0,r),e.isExternalModuleNameRelative(n)){var s=R(r,n).path;a=j(c.DtsOnly,s,!1,k,!0);}else {var l=ce(c.DtsOnly,n,r,k,void 0,void 0);a=l&&l.value;}return u(a)}d&&t(o,e.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);}(),N=!1),E){var F=E.fileName,A=E.packageId,P=a.preserveSymlinks?F:B(F,o,d);S={primary:N,resolvedFileName:P,originalPath:x(F,P,o)?void 0:F,packageId:A,isExternalLibraryImport:J(F)};}return g={resolvedTypeReferenceDirective:S,failedLookupLocations:y,resolutionDiagnostics:C},null==f||f.set(n,_,g),d&&w(g),g;function w(r){var i;(null===(i=r.resolvedTypeReferenceDirective)||void 0===i?void 0:i.resolvedFileName)?r.resolvedTypeReferenceDirective.packageId?t(o,e.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3,n,r.resolvedTypeReferenceDirective.resolvedFileName,e.packageIdToString(r.resolvedTypeReferenceDirective.packageId),r.resolvedTypeReferenceDirective.primary):t(o,e.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2,n,r.resolvedTypeReferenceDirective.resolvedFileName,r.resolvedTypeReferenceDirective.primary):t(o,e.Diagnostics.Type_reference_directive_0_was_not_resolved,n);}},e.resolvePackageNameToPackageJson=function(t,n,i,a,o){var s={compilerOptions:i,host:a,traceEnabled:r(i,a),failedLookupLocations:[],packageJsonInfoCache:null==o?void 0:o.getPackageJsonInfoCache(),conditions:e.emptyArray,features:h.None,requestContainingDirectory:n,reportDiagnostic:e.noop};return e.forEachAncestorDirectory(n,(function(r){if("node_modules"!==e.getBaseFileName(r)){var n=e.combinePaths(r,"node_modules");return $(e.combinePaths(n,t),!1,s)}}))},e.getAutomaticTypeDirectiveNames=function(t,r){if(t.types)return t.types;var n=[];if(r.directoryExists&&r.getDirectories){var i=v(t,r);if(i)for(var a=0,o=i;a<o.length;a++){var s=o[a];if(r.directoryExists(s))for(var c=0,l=r.getDirectories(s);c<l.length;c++){var u=l[c],_=e.normalizePath(u),d=e.combinePaths(s,_,"package.json");if(!r.fileExists(d)||null!==e.readJson(d,r).typings){var p=e.getBaseFileName(_);46!==p.charCodeAt(0)&&n.push(p);}}}}return n},e.createCacheWithRedirects=S,e.createModeAwareCache=N,e.zipToModeAwareCache=function(t,r,n){e.Debug.assert(r.length===n.length);for(var i=N(),a=0;a<r.length;++a){var o=r[a],s=e.isString(o)?o:o.fileName.toLowerCase(),c=e.isString(o)?e.getModeForResolutionAtIndex(t,a):o.resolutionMode||t.impliedNodeFormat;i.set(s,c,n[a]);}return i},e.createModuleResolutionCache=function(t,r,n,a,o){var s=E(t,r,a||(a=S(n)));o||(o=S(n));var c=T(t,r);return i$1(i$1(i$1({},c),s),{getOrCreateCacheForModuleName:function(t,r,n){return e.Debug.assert(!e.isExternalModuleNameRelative(t)),C(o,n,void 0===r?t:"".concat(r,"|").concat(t),l)},clear:function(){s.clear(),o.clear(),c.clear();},update:function(e){k(e,a,o);},getPackageJsonInfoCache:function(){return c}});function l(){var n=new e.Map;return {get:function(i){return n.get(e.toPath(i,t,r))},set:function(i,a){var o=e.toPath(i,t,r);if(!n.has(o)){n.set(o,a);for(var s=a.resolvedModule&&(a.resolvedModule.originalPath||a.resolvedModule.resolvedFileName),c=s&&function(n,i){for(var a=e.toPath(e.getDirectoryPath(i),t,r),o=0,s=Math.min(n.length,a.length);o<s&&n.charCodeAt(o)===a.charCodeAt(o);)o++;if(o===n.length&&(a.length===o||a[o]===e.directorySeparator))return n;var c=e.getRootLength(n);if(!(o<c)){var l=n.lastIndexOf(e.directorySeparator,o-1);if(-1!==l)return n.substr(0,Math.max(l,c))}}(o,s),l=o;l!==c;){var u=e.getDirectoryPath(l);if(u===l||n.has(u))break;n.set(u,a),l=u;}}}}}},e.createTypeReferenceDirectiveResolutionCache=function(e,t,r,n,a){var o=E(e,t,a||(a=S(r)));return n||(n=T(e,t)),i$1(i$1(i$1({},n),o),{clear:function(){o.clear(),n.clear();}})},e.resolveModuleNameFromCache=function(t,r,n,i){var a=e.getDirectoryPath(r),o=n&&n.getOrCreateCacheForDirectory(a);if(o)return o.get(t,i)},e.resolveModuleName=function(n,i,a,o,s,c,l){var u=r(a,o);c&&(a=c.commandLine.options),u&&(t(o,e.Diagnostics.Resolving_module_0_from_1,n,i),c&&t(o,e.Diagnostics.Using_compiler_options_of_project_reference_redirect_0,c.sourceFile.fileName));var _=e.getDirectoryPath(i),d=s&&s.getOrCreateCacheForDirectory(_,c),p=d&&d.get(n,l);if(p)u&&t(o,e.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1,n,_);else {var f=a.moduleResolution;if(void 0===f){switch(e.getEmitModuleKind(a)){case e.ModuleKind.CommonJS:f=e.ModuleResolutionKind.NodeJs;break;case e.ModuleKind.Node16:f=e.ModuleResolutionKind.Node16;break;case e.ModuleKind.NodeNext:f=e.ModuleResolutionKind.NodeNext;break;default:f=e.ModuleResolutionKind.Classic;}u&&t(o,e.Diagnostics.Module_resolution_kind_is_not_specified_using_0,e.ModuleResolutionKind[f]);}else u&&t(o,e.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0,e.ModuleResolutionKind[f]);switch(e.perfLogger.logStartResolveModule(n),f){case e.ModuleResolutionKind.Node16:p=function(e,t,r,n,i,a,o){return O(h.Node16Default,e,t,r,n,i,a,o)}(n,i,a,o,s,c,l);break;case e.ModuleResolutionKind.NodeNext:p=function(e,t,r,n,i,a,o){return O(h.NodeNextDefault,e,t,r,n,i,a,o)}(n,i,a,o,s,c,l);break;case e.ModuleResolutionKind.NodeJs:p=M(n,i,a,o,s,c);break;case e.ModuleResolutionKind.Classic:p=ye(n,i,a,o,s,c);break;default:return e.Debug.fail("Unexpected moduleResolution: ".concat(f))}p&&p.resolvedModule&&e.perfLogger.logInfoEvent('Module "'.concat(n,'" resolved to "').concat(p.resolvedModule.resolvedFileName,'"')),e.perfLogger.logStopResolveModule(p&&p.resolvedModule?""+p.resolvedModule.resolvedFileName:"null"),d&&(d.set(n,l,p),e.isExternalModuleNameRelative(n)||s.getOrCreateCacheForModuleName(n,l,c).set(_,p));}return u&&(p.resolvedModule?p.resolvedModule.packageId?t(o,e.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2,n,p.resolvedModule.resolvedFileName,e.packageIdToString(p.resolvedModule.packageId)):t(o,e.Diagnostics.Module_name_0_was_successfully_resolved_to_1,n,p.resolvedModule.resolvedFileName):t(o,e.Diagnostics.Module_name_0_was_not_resolved,n)),p},e.resolveJSModule=function(t,r,n){var i=function(t,r,n){return L(h.None,t,r,{moduleResolution:e.ModuleResolutionKind.NodeJs,allowJs:!0},n,void 0,A,void 0)}(t,r,n),a=i.resolvedModule,o=i.failedLookupLocations;if(!a)throw new Error("Could not resolve JS module '".concat(t,"' starting at '").concat(r,"'. Looked in: ").concat(o.join(", ")));return a.resolvedFileName},function(e){e[e.None=0]="None",e[e.Imports=2]="Imports",e[e.SelfName=4]="SelfName",e[e.Exports=8]="Exports",e[e.ExportsPatternTrailers=16]="ExportsPatternTrailers",e[e.AllFeatures=30]="AllFeatures",e[e.Node16Default=30]="Node16Default",e[e.NodeNextDefault=30]="NodeNextDefault",e[e.EsmMode=32]="EsmMode";}(h||(h={}));var A=[c.JavaScript],P=[c.TypeScript,c.JavaScript],w=n$4(n$4([],P,!0),[c.Json],!1),I=[c.TSConfig];function O(t,r,i,a,o,s,l,u){var _=e.getDirectoryPath(i),d=u===e.ModuleKind.ESNext?h.EsmMode:0,p=a.noDtsResolution?[c.TsOnly,c.JavaScript]:P;return a.resolveJsonModule&&(p=n$4(n$4([],p,!0),[c.Json],!1)),L(t|d,r,_,a,o,s,p,l)}function M(t,r,n,i,a,o,s){var l;return s?l=I:n.noDtsResolution?(l=[c.TsOnly],n.allowJs&&l.push(c.JavaScript),n.resolveJsonModule&&l.push(c.Json)):l=n.resolveJsonModule?w:P,L(h.None,t,e.getDirectoryPath(r),n,i,a,l,o)}function L(n,a,o,s,l,u,d,p){var f,g,m=r(s,l),y=[],v=n&h.EsmMode?["node","import","types"]:["node","require","types"];s.noDtsResolution&&v.pop();var b=[],D={compilerOptions:s,host:l,traceEnabled:m,failedLookupLocations:y,packageJsonInfoCache:u,features:n,conditions:v,requestContainingDirectory:o,reportDiagnostic:function(e){b.push(e);}},S=e.forEach(d,(function(r){return function(r){var _,d=F(r,a,o,(function(e,t,r,n){return j(e,t,r,n,!0)}),D);if(d)return ve({resolved:d,isExternalLibraryImport:J(d.path)});if(e.isExternalModuleNameRelative(a)){var f=R(o,a),g=f.path,y=f.parts,v=j(r,g,!1,D,!0);return v&&ve({resolved:v,isExternalLibraryImport:e.contains(y,"node_modules")})}if(n&h.Imports&&e.startsWith(a,"#")&&(_=function(r,n,i,a,o,s){var c,l;if("#"===n||e.startsWith(n,"#/"))return a.traceEnabled&&t(a.host,e.Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions,n),ve(void 0);var u="function"==typeof a.host.useCaseSensitiveFileNames?a.host.useCaseSensitiveFileNames():a.host.useCaseSensitiveFileNames,_=e.toPath(e.combinePaths(i,"dummy"),null===(l=(c=a.host).getCurrentDirectory)||void 0===l?void 0:l.call(c),e.createGetCanonicalFileName(void 0===u||u)),d=Z(_,a.packageJsonInfoCache,a.host,a.compilerOptions);if(!d)return a.traceEnabled&&t(a.host,e.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve,_),ve(void 0);if(!d.packageJsonContent.imports)return a.traceEnabled&&t(a.host,e.Diagnostics.package_json_scope_0_has_no_imports_defined,d.packageDirectory),ve(void 0);var p=ae(r,a,o,s,n,d.packageJsonContent.imports,d,!0);return p||(a.traceEnabled&&t(a.host,e.Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1,n,d.packageDirectory),ve(void 0))}(r,a,o,D,u,p)),!_&&n&h.SelfName&&(_=function(t,r,n,i,a,o){var s,c,l="function"==typeof i.host.useCaseSensitiveFileNames?i.host.useCaseSensitiveFileNames():i.host.useCaseSensitiveFileNames,u=Z(e.toPath(e.combinePaths(n,"dummy"),null===(c=(s=i.host).getCurrentDirectory)||void 0===c?void 0:c.call(s),e.createGetCanonicalFileName(void 0===l||l)),i.packageJsonInfoCache,i.host,i.compilerOptions);if(u&&u.packageJsonContent.exports&&"string"==typeof u.packageJsonContent.name){var _=e.getPathComponents(r),d=e.getPathComponents(u.packageJsonContent.name);if(e.every(d,(function(e,t){return _[t]===e}))){var p=_.slice(d.length);return ne(u,t,e.length(p)?".".concat(e.directorySeparator).concat(p.join(e.directorySeparator)):".",i,a,o)}}}(r,a,o,D,u,p)),_||(m&&t(l,e.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1,a,c[r]),_=ce(r,a,o,D,u,p)),_){var b=_.value;if(!s.preserveSymlinks&&b&&!b.originalPath){var S=B(b.path,l,m),T=x(S,b.path,l)?void 0:b.path;b=i$1(i$1({},b),{path:S,originalPath:T});}return {value:b&&{resolved:b,isExternalLibraryImport:!0}}}}(r)}));return _(null===(f=null==S?void 0:S.value)||void 0===f?void 0:f.resolved,null===(g=null==S?void 0:S.value)||void 0===g?void 0:g.isExternalLibraryImport,y,b,D.resultFromCache)}function R(t,r){var n=e.combinePaths(t,r),i=e.getPathComponents(n),a=e.lastOrUndefined(i);return {path:"."===a||".."===a?e.ensureTrailingDirectorySeparator(e.normalizePath(n)):e.normalizePath(n),parts:i}}function B(r,n,i){if(!n.realpath)return r;var a=e.normalizePath(n.realpath(r));return i&&t(n,e.Diagnostics.Resolving_real_path_for_0_result_1,r,a),e.Debug.assert(n.fileExists(a),"".concat(r," linked to nonexistent file ").concat(a)),a}function j(r,n,i,o,s){if(o.traceEnabled&&t(o.host,e.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1,n,c[r]),!e.hasTrailingDirectorySeparator(n)){if(!i){var l=e.getDirectoryPath(n);e.directoryProbablyExists(l,o.host)||(o.traceEnabled&&t(o.host,e.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,l),i=!0);}var u=V(r,n,i,o);if(u){var _=s?z(u.path):void 0;return a(_?$(_,!1,o):void 0,u)}}if(i||e.directoryProbablyExists(n,o.host)||(o.traceEnabled&&t(o.host,e.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,n),i=!0),!(o.features&h.EsmMode))return X(r,n,i,o,s)}function J(t){return e.stringContains(t,e.nodeModulesPathPart)}function z(t){var r=e.normalizePath(t),n=r.lastIndexOf(e.nodeModulesPathPart);if(-1!==n){var i=n+e.nodeModulesPathPart.length,a=K(r,i);return 64===r.charCodeAt(i)&&(a=K(r,a)),r.slice(0,a)}}function K(t,r){var n=t.indexOf(e.directorySeparator,r+1);return -1===n?r:n}function U(e,t,r,n){return o(V(e,t,r,n))}function V(t,r,n,i){if(t===c.Json||t===c.TSConfig){var a=e.tryRemoveExtension(r,".json"),o=a?r.substring(a.length):"";return void 0===a&&t===c.Json?void 0:H(a||r,t,o,n,i)}if(!(i.features&h.EsmMode)){var s=H(r,t,"",n,i);if(s)return s}return q(t,r,n,i)}function q(r,n,i,a){if(e.hasJSFileExtension(n)||e.fileExtensionIs(n,".json")&&a.compilerOptions.resolveJsonModule){var o=e.removeFileExtension(n),s=n.substring(o.length);return a.traceEnabled&&t(a.host,e.Diagnostics.File_name_0_has_a_1_extension_stripping_it,n,s),H(o,r,s,i,a)}}function W(t,r,n,i){return t!==c.TypeScript&&t!==c.DtsOnly||!e.fileExtensionIsOneOf(r,e.supportedTSExtensionsFlat)?q(t,r,n,i):void 0!==G(r,n,i)?{path:r,ext:e.tryExtractTSExtension(r)}:void 0}function H(t,r,n,i,a){if(!i){var o=e.getDirectoryPath(t);o&&(i=!e.directoryProbablyExists(o,a.host));}switch(r){case c.DtsOnly:switch(n){case".mjs":case".mts":case".d.mts":return l(".d.mts");case".cjs":case".cts":case".d.cts":return l(".d.cts");case".json":return t+=".json",l(".d.ts");default:return l(".d.ts")}case c.TypeScript:case c.TsOnly:var s=r===c.TypeScript;switch(n){case".mjs":case".mts":case".d.mts":return l(".mts")||(s?l(".d.mts"):void 0);case".cjs":case".cts":case".d.cts":return l(".cts")||(s?l(".d.cts"):void 0);case".json":return t+=".json",s?l(".d.ts"):void 0;default:return l(".ts")||l(".tsx")||(s?l(".d.ts"):void 0)}case c.JavaScript:switch(n){case".mjs":case".mts":case".d.mts":return l(".mjs");case".cjs":case".cts":case".d.cts":return l(".cjs");case".json":return l(".json");default:return l(".js")||l(".jsx")}case c.TSConfig:case c.Json:return l(".json")}function l(e){var r=G(t+e,i,a);return void 0===r?void 0:{path:r,ext:e}}}function G(t,r,n){var i,a;if(!(null===(i=n.compilerOptions.moduleSuffixes)||void 0===i?void 0:i.length))return Q(t,r,n);var o=null!==(a=e.tryGetExtensionFromPath(t))&&void 0!==a?a:"",s=o?e.removeExtension(t,o):t;return e.forEach(n.compilerOptions.moduleSuffixes,(function(e){return Q(s+e+o,r,n)}))}function Q(r,n,i){if(!n){if(i.host.fileExists(r))return i.traceEnabled&&t(i.host,e.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result,r),r;i.traceEnabled&&t(i.host,e.Diagnostics.File_0_does_not_exist,r);}i.failedLookupLocations.push(r);}function X(e,t,r,n,i){void 0===i&&(i=!0);var o=i?$(t,r,n):void 0;return a(o,ee(e,t,r,n,o&&o.packageJsonContent,o&&o.versionPaths))}function Y(t,r,n,i){var a;if(e.isArray(r))for(var o=0,s=r;o<s.length;o++)l(s[o]);else if("object"==typeof r&&null!==r&&re(r))for(var c in r)l(r[c]);else l(r);return a;function l(r){var o,s;if("string"==typeof r&&e.startsWith(r,"./")&&-1===r.indexOf("*")){var c=e.getPathComponents(r).slice(2);if(c.indexOf("..")>=0||c.indexOf(".")>=0||c.indexOf("node_modules")>=0)return !1;var u=e.combinePaths(t.packageDirectory,r),_=e.getNormalizedAbsolutePath(u,null===(s=(o=n.host).getCurrentDirectory)||void 0===s?void 0:s.call(o)),d=W(i,_,!1,n);if(d)return a=e.appendIfUnique(a,d,(function(e,t){return e.path===t.path})),!0}else if(Array.isArray(r)){for(var p=0,f=r;p<f.length;p++)if(l(f[p]))return !0}else if("object"==typeof r&&null!==r)return e.forEach(e.getOwnKeys(r),(function(t){if("default"===t||e.contains(n.conditions,t)||se(n.conditions,t))return l(r[t]),!0}))}}function Z(t,n,i,a){var o={host:i,compilerOptions:a,traceEnabled:r(a,i),failedLookupLocations:[],packageJsonInfoCache:n,features:0,conditions:[],requestContainingDirectory:void 0,reportDiagnostic:e.noop},s=e.getPathComponents(t);for(s.pop();s.length>0;){var c=$(e.getPathFromPathComponents(s),!1,o);if(c)return c;s.pop();}}function $(r,n,i){var a,o,s,c=i.host,l=i.traceEnabled,u=e.combinePaths(r,"package.json");if(n)i.failedLookupLocations.push(u);else {var _=null===(a=i.packageJsonInfoCache)||void 0===a?void 0:a.getPackageJsonInfo(u);if(void 0!==_)return "boolean"!=typeof _?(l&&t(c,e.Diagnostics.File_0_exists_according_to_earlier_cached_lookups,u),_):(_&&l&&t(c,e.Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups,u),void i.failedLookupLocations.push(u));var d=e.directoryProbablyExists(r,c);if(d&&c.fileExists(u)){var p=e.readJson(u,c);l&&t(c,e.Diagnostics.Found_package_json_at_0,u);var f={packageDirectory:r,packageJsonContent:p,versionPaths:m(p,i),resolvedEntrypoints:void 0};return null===(o=i.packageJsonInfoCache)||void 0===o||o.setPackageJsonInfo(u,f),f}d&&l&&t(c,e.Diagnostics.File_0_does_not_exist,u),null===(s=i.packageJsonInfoCache)||void 0===s||s.setPackageJsonInfo(u,d),i.failedLookupLocations.push(u);}}function ee(r,n,i,a,l,u){var _;if(l)switch(r){case c.JavaScript:case c.Json:case c.TsOnly:_=g(l,n,a);break;case c.TypeScript:_=f(l,n,a)||g(l,n,a);break;case c.DtsOnly:_=f(l,n,a);break;case c.TSConfig:_=function(e,t,r){return p(e,"tsconfig",t,r)}(l,n,a);break;default:return e.Debug.assertNever(r)}var d=function(r,n,i,a){var s=G(n,i,a);if(s){var u=function(t,r){var n=e.tryGetExtensionFromPath(r);return void 0!==n&&function(e,t){switch(e){case c.JavaScript:return ".js"===t||".jsx"===t||".mjs"===t||".cjs"===t;case c.TSConfig:case c.Json:return ".json"===t;case c.TypeScript:return ".ts"===t||".tsx"===t||".mts"===t||".cts"===t||".d.ts"===t||".d.mts"===t||".d.cts"===t;case c.TsOnly:return ".ts"===t||".tsx"===t||".mts"===t||".cts"===t;case c.DtsOnly:return ".d.ts"===t||".d.mts"===t||".d.cts"===t}}(t,n)?{path:r,ext:n}:void 0}(r,s);if(u)return o(u);a.traceEnabled&&t(a.host,e.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it,s);}var _=r===c.DtsOnly?c.TypeScript:r,d=a.features;"module"!==(null==l?void 0:l.type)&&(a.features&=~h.EsmMode);var p=j(_,n,i,a,!1);return a.features=d,p},m=_?!e.directoryProbablyExists(e.getDirectoryPath(_),a.host):void 0,y=i||!e.directoryProbablyExists(n,a.host),v=e.combinePaths(n,r===c.TSConfig?"tsconfig":"index");if(u&&(!_||e.containsPath(n,_))){var b=e.getRelativePathFromDirectory(n,_||v,!1);a.traceEnabled&&t(a.host,e.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2,u.version,e.version,b);var x=de(r,b,n,u.paths,void 0,d,m||y,a);if(x)return s(x.value)}return _&&s(d(r,_,m,a))||(a.features&h.EsmMode?void 0:V(r,v,y,a))}function te(t){var r=t.indexOf(e.directorySeparator);return "@"===t[0]&&(r=t.indexOf(e.directorySeparator,r+1)),-1===r?{packageName:t,rest:""}:{packageName:t.slice(0,r),rest:t.slice(r+1)}}function re(t){return e.every(e.getOwnKeys(t),(function(t){return e.startsWith(t,".")}))}function ne(r,n,i,a,o,s){if(r.packageJsonContent.exports){if("."===i){var c=void 0;if("string"==typeof r.packageJsonContent.exports||Array.isArray(r.packageJsonContent.exports)||"object"==typeof r.packageJsonContent.exports&&(u=r.packageJsonContent.exports,!e.some(e.getOwnKeys(u),(function(t){return e.startsWith(t,".")})))?c=r.packageJsonContent.exports:e.hasProperty(r.packageJsonContent.exports,".")&&(c=r.packageJsonContent.exports["."]),c)return oe(n,a,o,s,i,r,!1)(c,"",!1)}else if(re(r.packageJsonContent.exports)){if("object"!=typeof r.packageJsonContent.exports)return a.traceEnabled&&t(a.host,e.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1,i,r.packageDirectory),ve(void 0);var l=ae(n,a,o,s,i,r.packageJsonContent.exports,r,!1);if(l)return l}var u;return a.traceEnabled&&t(a.host,e.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1,i,r.packageDirectory),ve(void 0)}}function ie(e,t){var r=e.indexOf("*"),n=t.indexOf("*"),i=-1===r?e.length:r+1,a=-1===n?t.length:n+1;return i>a?-1:a>i||-1===r?1:-1===n||e.length>t.length?-1:t.length>e.length?1:0}function ae(t,r,n,i,a,o,s,c){var l=oe(t,r,n,i,a,s,c);if(!e.endsWith(a,e.directorySeparator)&&-1===a.indexOf("*")&&e.hasProperty(o,a))return l(p=o[a],"",!1);for(var u=0,_=e.sort(e.filter(e.getOwnKeys(o),(function(t){return -1!==t.indexOf("*")||e.endsWith(t,"/")})),ie);u<_.length;u++){var d=_[u];if(r.features&h.ExportsPatternTrailers&&g(d,a)){var p=o[d],f=d.indexOf("*");return l(p,a.substring(d.substring(0,f).length,a.length-(d.length-1-f)),!0)}if(e.endsWith(d,"*")&&e.startsWith(a,d.substring(0,d.length-1)))return l(p=o[d],a.substring(d.length-1),!0);if(e.startsWith(a,d))return l(p=o[d],a.substring(d.length),!1)}function g(t,r){if(e.endsWith(t,"*"))return !1;var n=t.indexOf("*");return -1!==n&&e.startsWith(r,t.substring(0,n))&&e.endsWith(r,t.substring(n+1))}}function oe(r,n,i,o,s,l,u){return function _(d,p,f){if("string"==typeof d){if(!f&&p.length>0&&!e.endsWith(d,"/"))return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1,l.packageDirectory,s),ve(void 0);if(!e.startsWith(d,"./")){if(u&&!e.startsWith(d,"../")&&!e.startsWith(d,"/")&&!e.isRootedDiskPath(d)){var g=f?d.replace(/\*/g,p):d+p;return ve((C=L(n.features,g,l.packageDirectory+"/",n.compilerOptions,n.host,i,[r],o)).resolvedModule?{path:C.resolvedModule.resolvedFileName,extension:C.resolvedModule.extension,packageId:C.resolvedModule.packageId,originalPath:C.resolvedModule.originalPath}:void 0)}return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1,l.packageDirectory,s),ve(void 0)}var m=(e.pathIsRelative(d)?e.getPathComponents(d).slice(1):e.getPathComponents(d)).slice(1);if(m.indexOf("..")>=0||m.indexOf(".")>=0||m.indexOf("node_modules")>=0)return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1,l.packageDirectory,s),ve(void 0);var y=e.combinePaths(l.packageDirectory,d),v=e.getPathComponents(p);if(v.indexOf("..")>=0||v.indexOf(".")>=0||v.indexOf("node_modules")>=0)return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1,l.packageDirectory,s),ve(void 0);var h=k(f?y.replace(/\*/g,p):y+p);return function(t,i,o,s){var u,_,d,p;if((r===c.TypeScript||r===c.JavaScript||r===c.Json)&&(n.compilerOptions.declarationDir||n.compilerOptions.outDir)&&-1===t.indexOf("/node_modules/")&&(!n.compilerOptions.configFile||e.startsWith(k(n.compilerOptions.configFile.fileName),l.packageDirectory))){var f=e.hostGetCanonicalFileName({useCaseSensitiveFileNames:N}),g=[];if(n.compilerOptions.rootDir||n.compilerOptions.composite&&n.compilerOptions.configFilePath){var m=k(e.getCommonSourceDirectory(n.compilerOptions,(function(){return []}),(null===(_=(u=n.host).getCurrentDirectory)||void 0===_?void 0:_.call(u))||"",f));g.push(m);}else if(n.requestContainingDirectory){var y=k(e.combinePaths(n.requestContainingDirectory,"index.ts"));m=k(e.getCommonSourceDirectory(n.compilerOptions,(function(){return [y,k(o)]}),(null===(p=(d=n.host).getCurrentDirectory)||void 0===p?void 0:p.call(d))||"",f)),g.push(m);for(var v=e.ensureTrailingDirectorySeparator(m);v&&v.length>1;){var h=e.getPathComponents(v);h.pop();var b=e.getPathFromPathComponents(h);g.unshift(b),v=e.ensureTrailingDirectorySeparator(b);}}g.length>1&&n.reportDiagnostic(e.createCompilerDiagnostic(s?e.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate:e.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate,""===i?".":i,o));for(var x=0,D=g;x<D.length;x++)for(var S=D[x],T=0,C=j(S);T<C.length;T++){var F=C[T];if(e.startsWith(t,F))for(var A=t.slice(F.length+1),P=e.combinePaths(S,A),w=0,I=[".mjs",".cjs",".js",".json",".d.mts",".d.cts",".d.ts"];w<I.length;w++){var O=I[w];if(e.fileExtensionIs(P,O))for(var M=0,L=e.getPossibleOriginalInputExtensionForExtension(P);M<L.length;M++){var R=L[M],B=e.changeAnyExtension(P,R,O,!N());if(!(r===c.TypeScript&&e.hasJSFileExtension(B)||r===c.JavaScript&&e.hasTSFileExtension(B))&&n.host.fileExists(B))return ve(a(l,W(r,B,!1,n)))}}}}return;function j(e){var t,r,i=n.compilerOptions.configFile?(null===(r=(t=n.host).getCurrentDirectory)||void 0===r?void 0:r.call(t))||"":e,a=[];return n.compilerOptions.declarationDir&&a.push(k(E(i,n.compilerOptions.declarationDir))),n.compilerOptions.outDir&&n.compilerOptions.outDir!==n.compilerOptions.declarationDir&&a.push(k(E(i,n.compilerOptions.outDir))),a}}(h,p,e.combinePaths(l.packageDirectory,"package.json"),u)||ve(a(l,W(r,h,!1,n)))}if("object"==typeof d&&null!==d){if(!Array.isArray(d)){for(var b=0,x=e.getOwnKeys(d);b<x.length;b++){var D=x[b];if("default"===D||n.conditions.indexOf(D)>=0||se(n.conditions,D))if(C=_(d[D],p,f))return C}return}if(!e.length(d))return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1,l.packageDirectory,s),ve(void 0);for(var S=0,T=d;S<T.length;S++){var C;if(C=_(T[S],p,f))return C}}else if(null===d)return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null,l.packageDirectory,s),ve(void 0);return n.traceEnabled&&t(n.host,e.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1,l.packageDirectory,s),ve(void 0);function k(t){var r,i;return void 0===t?t:e.hostGetCanonicalFileName({useCaseSensitiveFileNames:N})(e.getNormalizedAbsolutePath(t,null===(i=(r=n.host).getCurrentDirectory)||void 0===i?void 0:i.call(r)))}function E(t,r){return e.ensureTrailingDirectorySeparator(e.combinePaths(t,r))}function N(){return !n.host.useCaseSensitiveFileNames||("boolean"==typeof n.host.useCaseSensitiveFileNames?n.host.useCaseSensitiveFileNames:n.host.useCaseSensitiveFileNames())}}}function se(t,r){if(-1===t.indexOf("types"))return !1;if(!e.startsWith(r,"types@"))return !1;var n=e.VersionRange.tryParse(r.substring("types@".length));return !!n&&n.test(e.version)}function ce(e,t,r,n,i,a){return le(e,t,r,n,!1,i,a)}function le(t,r,n,i,a,o,s){var c=o&&o.getOrCreateCacheForModuleName(r,0===i.features?void 0:i.features&h.EsmMode?e.ModuleKind.ESNext:e.ModuleKind.CommonJS,s);return e.forEachAncestorDirectory(e.normalizeSlashes(n),(function(n){if("node_modules"!==e.getBaseFileName(n))return me(c,r,n,i)||ve(ue(t,r,n,i,a,o,s))}))}function ue(r,n,i,a,o,s,l){var u=e.combinePaths(i,"node_modules"),_=e.directoryProbablyExists(u,a.host);!_&&a.traceEnabled&&t(a.host,e.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,u);var d=o?void 0:_e(r,n,u,_,a,s,l);if(d)return d;if(r===c.TypeScript||r===c.DtsOnly){var p=e.combinePaths(u,"@types"),f=_;return _&&!e.directoryProbablyExists(p,a.host)&&(a.traceEnabled&&t(a.host,e.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,p),f=!1),_e(c.DtsOnly,function(r,n){var i=fe(r);return n.traceEnabled&&i!==r&&t(n.host,e.Diagnostics.Scoped_package_detected_looking_in_0,i),i}(n,a),p,f,a,s,l)}}function _e(r,n,i,s,c,l,u){var _=e.normalizePath(e.combinePaths(i,n)),d=$(_,!s,c);if(!(c.features&h.Exports)&&d){var p=V(r,_,!s,c);if(p)return o(p);var f=ee(r,_,!s,c,d.packageJsonContent,d.versionPaths);return a(d,f)}var g=te(n),m=g.packageName,y=g.rest,v=function(t,r,n,i){var o;if(d&&d.packageJsonContent.exports&&i.features&h.Exports)return null===(o=ne(d,t,e.combinePaths(".",y),i,l,u))||void 0===o?void 0:o.value;var s=V(t,r,n,i)||ee(t,r,n,i,d&&d.packageJsonContent,d&&d.versionPaths);return !s&&d&&(void 0===d.packageJsonContent.exports||null===d.packageJsonContent.exports)&&i.features&h.EsmMode&&(s=V(t,e.combinePaths(r,"index.js"),n,i)),a(d,s)};if(""!==y){var b=e.combinePaths(i,m);if((d=$(b,!s,c))&&d.versionPaths){c.traceEnabled&&t(c.host,e.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2,d.versionPaths.version,e.version,y);var x=s&&e.directoryProbablyExists(b,c.host),D=de(r,y,b,d.versionPaths.paths,void 0,v,!x,c);if(D)return D.value}}return v(r,_,!s,c)}function de(r,n,i,a,s,c,l,u){s||(s=e.tryParsePatterns(a));var _=e.matchPatternOrExact(s,n);if(_){var d=e.isString(_)?void 0:e.matchedText(_,n),p=e.isString(_)?_:e.patternText(_);return u.traceEnabled&&t(u.host,e.Diagnostics.Module_name_0_matched_pattern_1,n,p),{value:e.forEach(a[p],(function(n){var a=d?n.replace("*",d):n,s=e.normalizePath(e.combinePaths(i,a));u.traceEnabled&&t(u.host,e.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1,n,a);var _=e.tryGetExtensionFromPath(n);if(void 0!==_){var p=G(s,l,u);if(void 0!==p)return o({path:p,ext:_})}return c(r,s,l||!e.directoryProbablyExists(e.getDirectoryPath(s),u.host),u)}))}}}e.nodeModuleNameResolver=M,e.nodeModulesPathPart="/node_modules/",e.pathContainsNodeModules=J,e.parseNodeModuleFromPath=z,e.getEntrypointsFromPackageJsonInfo=function(t,n,a,o,s){if(!s&&void 0!==t.resolvedEntrypoints)return t.resolvedEntrypoints;var l,u=s?c.JavaScript:c.TypeScript,_=D(n),d={compilerOptions:n,host:a,traceEnabled:r(n,a),failedLookupLocations:[],packageJsonInfoCache:null==o?void 0:o.getPackageJsonInfoCache(),conditions:["node","require","types"],features:_,requestContainingDirectory:t.packageDirectory,reportDiagnostic:e.noop},p=ee(u,t.packageDirectory,!1,d,t.packageJsonContent,t.versionPaths);if(l=e.append(l,null==p?void 0:p.path),_&h.Exports&&t.packageJsonContent.exports)for(var f=0,g=[["node","import","types"],["node","require","types"]];f<g.length;f++){var m=g[f],y=i$1(i$1({},d),{failedLookupLocations:[],conditions:m}),v=Y(t,t.packageJsonContent.exports,y,u);if(v)for(var b=0,x=v;b<x.length;b++){var S=x[b];l=e.appendIfUnique(l,S.path);}}return t.resolvedEntrypoints=l||!1},e.getPackageScopeForPath=Z,e.getPackageJsonInfo=$,e.parsePackageName=te,e.allKeysStartWithDot=re,e.isApplicableVersionedTypesKey=se;var pe="__";function fe(t){if(e.startsWith(t,"@")){var r=t.replace(e.directorySeparator,pe);if(r!==t)return r.slice(1)}return t}function ge(t){return e.stringContains(t,pe)?"@"+t.replace(pe,e.directorySeparator):t}function me(r,n,i,a){var o=r&&r.get(i);if(o)return a.traceEnabled&&t(a.host,e.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1,n,i),a.resultFromCache=o,{value:o.resolvedModule&&{path:o.resolvedModule.resolvedFileName,originalPath:o.resolvedModule.originalPath||!0,extension:o.resolvedModule.extension,packageId:o.resolvedModule.packageId}}}function ye(t,n,i,a,o,s){var l=r(i,a),u=[],d=e.getDirectoryPath(n),p=[],f={compilerOptions:i,host:a,traceEnabled:l,failedLookupLocations:u,packageJsonInfoCache:o,features:h.None,conditions:[],requestContainingDirectory:d,reportDiagnostic:function(e){p.push(e);}},g=m(c.TypeScript)||m(c.JavaScript);return _(g&&g.value,!1,u,p,f.resultFromCache);function m(r){var n=F(r,t,d,U,f);if(n)return {value:n};if(e.isExternalModuleNameRelative(t)){var i=e.normalizePath(e.combinePaths(d,t));return ve(U(r,i,!1,f))}var a=o&&o.getOrCreateCacheForModuleName(t,void 0,s);return e.forEachAncestorDirectory(d,(function(n){var i=me(a,t,n,f);if(i)return i;var o=e.normalizePath(e.combinePaths(n,t));return ve(U(r,o,!1,f))}))||(r===c.TypeScript?function(e,t,r){return le(c.DtsOnly,e,t,r,!0,void 0,void 0)}(t,d,f):void 0)}}function ve(e){return void 0!==e?{value:e}:void 0}e.getTypesPackageName=function(e){return "@types/".concat(fe(e))},e.mangleScopedPackageName=fe,e.getPackageNameFromTypesPackageName=function(t){var r=e.removePrefix(t,"@types/");return r!==t?ge(r):t},e.unmangleScopedPackageName=ge,e.classicNameResolver=ye,e.loadModuleFromGlobalCache=function(n,i,a,o,s,l){var u=r(a,o);u&&t(o,e.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2,i,n,s);var d=[],p=[],f={compilerOptions:a,host:o,traceEnabled:u,failedLookupLocations:d,packageJsonInfoCache:l,features:h.None,conditions:[],requestContainingDirectory:void 0,reportDiagnostic:function(e){p.push(e);}};return _(ue(c.DtsOnly,n,s,f,!1,void 0,void 0),!0,d,p,f.resultFromCache)};}(t),function(e){var t,r;function a(t,r){return t.body&&!t.body.parent&&(e.setParent(t.body,t),e.setParentRecursive(t.body,!1)),t.body?o(t.body,r):1}function o(t,r){void 0===r&&(r=new e.Map);var n=e.getNodeId(t);if(r.has(n))return r.get(n)||0;r.set(n,void 0);var i=function(t,r){switch(t.kind){case 258:case 259:return 0;case 260:if(e.isEnumConst(t))return 2;break;case 266:case 265:if(!e.hasSyntacticModifier(t,1))return 0;break;case 272:var n=t;if(!n.moduleSpecifier&&n.exportClause&&273===n.exportClause.kind){for(var i=0,c=0,l=n.exportClause.elements;c<l.length;c++){var u=s(l[c],r);if(u>i&&(i=u),1===i)return i}return i}break;case 262:var _=0;return e.forEachChild(t,(function(t){var n=o(t,r);switch(n){case 0:return;case 2:return void(_=2);case 1:return _=1,!0;default:e.Debug.assertNever(n);}})),_;case 261:return a(t,r);case 79:if(t.isInJSDocNamespace)return 0}return 1}(t,r);return r.set(n,i),i}function s(t,r){for(var n=t.propertyName||t.name,i=t.parent;i;){if(e.isBlock(i)||e.isModuleBlock(i)||e.isSourceFile(i)){for(var a=void 0,s=0,c=i.statements;s<c.length;s++){var l=c[s];if(e.nodeHasName(l,n)){l.parent||(e.setParent(l,i),e.setParentRecursive(l,!1));var u=o(l,r);if((void 0===a||u>a)&&(a=u),1===a)return a}}if(void 0!==a)return a}i=i.parent;}return 1}function c(t){return e.Debug.attachFlowNodeDebugInfo(t),t}(r=e.ModuleInstanceState||(e.ModuleInstanceState={}))[r.NonInstantiated=0]="NonInstantiated",r[r.Instantiated=1]="Instantiated",r[r.ConstEnumOnly=2]="ConstEnumOnly",e.getModuleInstanceState=a,function(e){e[e.None=0]="None",e[e.IsContainer=1]="IsContainer",e[e.IsBlockScopedContainer=2]="IsBlockScopedContainer",e[e.IsControlFlowContainer=4]="IsControlFlowContainer",e[e.IsFunctionLike=8]="IsFunctionLike",e[e.IsFunctionExpression=16]="IsFunctionExpression",e[e.HasLocals=32]="HasLocals",e[e.IsInterface=64]="IsInterface",e[e.IsObjectLiteralOrClassExpressionMethodOrAccessor=128]="IsObjectLiteralOrClassExpressionMethodOrAccessor";}(t||(t={}));var l=function(){var t,r,o,s,l,p,f,g,m,y,v,h,b,x,D,S,T,C,k,E,N,F,A,P,w=!1,I=0,O={flags:1},M={flags:1},L=function(){return e.createBinaryExpressionTrampoline((function(t,r){if(r){r.stackIndex++,e.setParent(t,s);var n=F;Be(t);var i=s;s=t,r.skip=!1,r.inStrictModeStack[r.stackIndex]=n,r.parentStack[r.stackIndex]=i;}else r={stackIndex:0,skip:!1,inStrictModeStack:[void 0],parentStack:[void 0]};var a=t.operatorToken.kind;if(55===a||56===a||60===a||e.isLogicalOrCoalescingAssignmentOperator(a)){if(ue(t)){var o=$();he(t,o,o),v=ce(o);}else he(t,D,S);r.skip=!0;}return r}),(function(e,r,n){if(!r.skip){var i=t(e);return 27===n.operatorToken.kind&&me(e),i}}),(function(e,t,r){t.skip||Me(e);}),(function(e,r,n){if(!r.skip){var i=t(e);return 27===n.operatorToken.kind&&me(e),i}}),(function(t,r){if(!r.skip){var n=t.operatorToken.kind;e.isAssignmentOperator(n)&&!e.isAssignmentTarget(t)&&(ve(t.left),63===n&&207===t.left.kind&&Z(t.left.expression)&&(v=oe(256,v,t)));}var i=r.inStrictModeStack[r.stackIndex],a=r.parentStack[r.stackIndex];void 0!==i&&(F=i),void 0!==a&&(s=a),r.skip=!1,r.stackIndex--;}),void 0);function t(t){if(t&&e.isBinaryExpression(t)&&!e.isDestructuringAssignment(t))return t;Me(t);}}();function R(r,n,i,a,o){return e.createDiagnosticForNodeInSourceFile(e.getSourceFileOfNode(r)||t,r,n,i,a,o)}return function(n,i){t=n,r=i,o=e.getEmitScriptTarget(r),F=function(t,r){return !(!e.getStrictOptionValue(r,"alwaysStrict")||t.isDeclarationFile)||!!t.externalModuleIndicator}(t,i),P=new e.Set,I=0,A=e.objectAllocator.getSymbolConstructor(),e.Debug.attachFlowNodeDebugInfo(O),e.Debug.attachFlowNodeDebugInfo(M),t.locals||(null===e.tracing||void 0===e.tracing||e.tracing.push("bind","bindSourceFile",{path:t.path},!0),Me(t),null===e.tracing||void 0===e.tracing||e.tracing.pop(),t.symbolCount=I,t.classifiableNames=P,function(){if(m){for(var r=l,n=g,i=f,a=s,o=v,u=0,d=m;u<d.length;u++){var p=d[u],y=p.parent.parent;l=e.findAncestor(y.parent,(function(e){return !!(1&Te(e))}))||t,f=e.getEnclosingBlockScopeContainer(y)||t,v=c({flags:2}),s=p,Me(p.typeExpression);var h=e.getNameOfDeclaration(p);if((e.isJSDocEnumTag(p)||!p.fullName)&&h&&e.isPropertyAccessEntityNameExpression(h.parent)){var b=Xe(h.parent);if(b){Ge(t.symbol,h.parent,b,!!e.findAncestor(h,(function(t){return e.isPropertyAccessExpression(t)&&"prototype"===t.name.escapedText})),!1);var x=l;switch(e.getAssignmentDeclarationPropertyAccessKind(h.parent)){case 1:case 2:l=e.isExternalOrCommonJsModule(t)?t:void 0;break;case 4:l=h.parent.expression;break;case 3:l=h.parent.expression.name;break;case 5:l=_(t,h.parent.expression)?t:e.isPropertyAccessExpression(h.parent.expression)?h.parent.expression.name:h.parent.expression;break;case 0:return e.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration")}l&&U(p,524288,788968),l=x;}}else e.isJSDocEnumTag(p)||!p.fullName||79===p.fullName.kind?(s=p.parent,Ae(p,524288,788968)):Me(p.fullName);}l=r,g=n,f=i,s=a,v=o;}}()),t=void 0,r=void 0,o=void 0,s=void 0,l=void 0,p=void 0,f=void 0,g=void 0,m=void 0,y=!1,v=void 0,h=void 0,b=void 0,x=void 0,D=void 0,S=void 0,T=void 0,k=void 0,E=!1,w=!1,N=0;};function B(e,t){return I++,new A(e,t)}function j(t,r,n){t.flags|=n,r.symbol=t,t.declarations=e.appendIfUnique(t.declarations,r),1955&n&&!t.exports&&(t.exports=e.createSymbolTable()),6240&n&&!t.members&&(t.members=e.createSymbolTable()),t.constEnumOnlyModule&&304&t.flags&&(t.constEnumOnlyModule=!1),111551&n&&e.setValueDeclaration(t,r);}function J(t){if(271===t.kind)return t.isExportEquals?"export=":"default";var r=e.getNameOfDeclaration(t);if(r){if(e.isAmbientModule(t)){var n=e.getTextOfIdentifierOrLiteral(r);return e.isGlobalScopeAugmentation(t)?"__global":'"'.concat(n,'"')}if(162===r.kind){var i=r.expression;if(e.isStringOrNumericLiteralLike(i))return e.escapeLeadingUnderscores(i.text);if(e.isSignedNumericLiteral(i))return e.tokenToString(i.operator)+i.operand.text;e.Debug.fail("Only computed properties with literal names have declaration names");}if(e.isPrivateIdentifier(r)){var a=e.getContainingClass(t);if(!a)return;var o=a.symbol;return e.getSymbolNameForPrivateIdentifier(o,r.escapedText)}return e.isPropertyNameLiteral(r)?e.getEscapedTextOfIdentifierOrLiteral(r):void 0}switch(t.kind){case 171:return "__constructor";case 179:case 174:case 323:return "__call";case 180:case 175:return "__new";case 176:return "__index";case 272:return "__export";case 305:return "export=";case 221:if(2===e.getAssignmentDeclarationKind(t))return "export=";e.Debug.fail("Unknown binary declaration kind");break;case 317:return e.isJSDocConstructSignature(t)?"__new":"__call";case 164:return e.Debug.assert(317===t.parent.kind,"Impossible parameter parent kind",(function(){return "parent is: ".concat(e.SyntaxKind?e.SyntaxKind[t.parent.kind]:t.parent.kind,", expected JSDocFunctionType")})),"arg"+t.parent.parameters.indexOf(t)}}function z(t){return e.isNamedDeclaration(t)?e.declarationNameToString(t.name):e.unescapeLeadingUnderscores(e.Debug.checkDefined(J(t)))}function K(r,i,a,o,s,c,l){e.Debug.assert(l||!e.hasDynamicName(a));var u,_=e.hasSyntacticModifier(a,512)||e.isExportSpecifier(a)&&"default"===a.name.escapedText,d=l?"__computed":_&&i?"default":J(a);if(void 0===d)u=B(0,"__missing");else if(u=r.get(d),2885600&o&&P.add(d),u){if(c&&!u.isReplaceableByMethod)return u;if(u.flags&s)if(u.isReplaceableByMethod)r.set(d,u=B(0,d));else if(!(3&o&&67108864&u.flags)){e.isNamedDeclaration(a)&&e.setParent(a.name,a);var p=2&u.flags?e.Diagnostics.Cannot_redeclare_block_scoped_variable_0:e.Diagnostics.Duplicate_identifier_0,f=!0;(384&u.flags||384&o)&&(p=e.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations,f=!1);var g=!1;e.length(u.declarations)&&(_||u.declarations&&u.declarations.length&&271===a.kind&&!a.isExportEquals)&&(p=e.Diagnostics.A_module_cannot_have_multiple_default_exports,f=!1,g=!0);var m=[];e.isTypeAliasDeclaration(a)&&e.nodeIsMissing(a.type)&&e.hasSyntacticModifier(a,1)&&2887656&u.flags&&m.push(R(a,e.Diagnostics.Did_you_mean_0,"export type { ".concat(e.unescapeLeadingUnderscores(a.name.escapedText)," }")));var y=e.getNameOfDeclaration(a)||a;e.forEach(u.declarations,(function(r,n){var i=e.getNameOfDeclaration(r)||r,a=R(i,p,f?z(r):void 0);t.bindDiagnostics.push(g?e.addRelatedInfo(a,R(y,0===n?e.Diagnostics.Another_export_default_is_here:e.Diagnostics.and_here)):a),g&&m.push(R(i,e.Diagnostics.The_first_export_default_is_here));}));var v=R(y,p,f?z(a):void 0);t.bindDiagnostics.push(e.addRelatedInfo.apply(void 0,n$4([v],m,!1))),u=B(0,d);}}else r.set(d,u=B(0,d)),c&&(u.isReplaceableByMethod=!0);return j(u,a,o),u.parent?e.Debug.assert(u.parent===i,"Existing symbol parent should match new one"):u.parent=i,u}function U(t,r,n){var i=!!(1&e.getCombinedModifierFlags(t))||function(t){if(t.parent&&e.isModuleDeclaration(t)&&(t=t.parent),!e.isJSDocTypeAlias(t))return !1;if(!e.isJSDocEnumTag(t)&&t.fullName)return !0;var r=e.getNameOfDeclaration(t);return !!(r&&(e.isPropertyAccessEntityNameExpression(r.parent)&&Xe(r.parent)||e.isDeclaration(r.parent)&&1&e.getCombinedModifierFlags(r.parent)))}(t);if(2097152&r)return 275===t.kind||265===t.kind&&i?K(l.symbol.exports,l.symbol,t,r,n):K(l.locals,void 0,t,r,n);if(e.isJSDocTypeAlias(t)&&e.Debug.assert(e.isInJSFile(t)),!e.isAmbientModule(t)&&(i||64&l.flags)){if(!l.locals||e.hasSyntacticModifier(t,512)&&!J(t))return K(l.symbol.exports,l.symbol,t,r,n);var a=111551&r?1048576:0,o=K(l.locals,void 0,t,a,n);return o.exportSymbol=K(l.symbol.exports,l.symbol,t,r,n),t.localSymbol=o,o}return K(l.locals,void 0,t,r,n)}function V(e){q(e,(function(e){return 256===e.kind?Me(e):void 0})),q(e,(function(e){return 256!==e.kind?Me(e):void 0}));}function q(t,r){void 0===r&&(r=Me),void 0!==t&&e.forEach(t,r);}function W(t){e.forEachChild(t,Me,q);}function H(t){var n=w;if(w=!1,function(t){if(!(1&v.flags))return !1;if(v===O&&(e.isStatementButNotDeclaration(t)&&236!==t.kind||257===t.kind||261===t.kind&&function(t){var n=a(t);return 1===n||2===n&&e.shouldPreserveConstEnums(r)}(t))&&(v=M,!r.allowUnreachableCode)){var n=e.unreachableCodeIsError(r)&&!(16777216&t.flags)&&(!e.isVariableStatement(t)||!!(3&e.getCombinedNodeFlags(t.declarationList))||t.declarationList.declarations.some((function(e){return !!e.initializer})));!function(t,r){if(e.isStatement(t)&&u(t)&&e.isBlock(t.parent)){var n=t.parent.statements,i=e.sliceAfter(n,t);e.getRangesWhere(i,u,(function(e,t){return r(i[e],i[t-1])}));}else r(t,t);}(t,(function(t,r){return Oe(n,t,r,e.Diagnostics.Unreachable_code_detected)}));}return !0}(t))return W(t),Le(t),void(w=n);switch(t.kind>=237&&t.kind<=253&&!r.allowUnreachableCode&&(t.flowNode=v),t.kind){case 241:!function(e){var t=fe(e,ee()),r=$(),n=$();ne(t,v),v=t,de(e.expression,r,n),v=ce(r),pe(e.statement,n,t),ne(t,v),v=ce(n);}(t);break;case 240:!function(e){var t=ee(),r=fe(e,$()),n=$();ne(t,v),v=t,pe(e.statement,n,r),ne(r,v),v=ce(r),de(e.expression,t,n),v=ce(n);}(t);break;case 242:!function(e){var t=fe(e,ee()),r=$(),n=$();Me(e.initializer),ne(t,v),v=t,de(e.condition,r,n),v=ce(r),pe(e.statement,n,t),Me(e.incrementor),ne(t,v),v=ce(n);}(t);break;case 243:case 244:!function(e){var t=fe(e,ee()),r=$();Me(e.expression),ne(t,v),v=t,244===e.kind&&Me(e.awaitModifier),ne(r,v),Me(e.initializer),255!==e.initializer.kind&&ve(e.initializer),pe(e.statement,r,t),ne(t,v),v=ce(r);}(t);break;case 239:!function(e){var t=$(),r=$(),n=$();de(e.expression,t,r),v=ce(t),Me(e.thenStatement),ne(n,v),v=ce(r),Me(e.elseStatement),ne(n,v),v=ce(n);}(t);break;case 247:case 251:!function(e){Me(e.expression),247===e.kind&&(E=!0,x&&ne(x,v)),v=O;}(t);break;case 246:case 245:!function(e){if(Me(e.label),e.label){var t=function(e){for(var t=k;t;t=t.next)if(t.name===e)return t}(e.label.escapedText);t&&(t.referenced=!0,ge(e,t.breakTarget,t.continueTarget));}else ge(e,h,b);}(t);break;case 252:!function(t){var r=x,n=T,i=$(),a=$(),o=$();if(t.finallyBlock&&(x=a),ne(o,v),T=o,Me(t.tryBlock),ne(i,v),t.catchClause&&(v=ce(o),ne(o=$(),v),T=o,Me(t.catchClause),ne(i,v)),x=r,T=n,t.finallyBlock){var s=$();s.antecedents=e.concatenate(e.concatenate(i.antecedents,o.antecedents),a.antecedents),v=s,Me(t.finallyBlock),1&v.flags?v=O:(x&&a.antecedents&&ne(x,te(s,a.antecedents,v)),T&&o.antecedents&&ne(T,te(s,o.antecedents,v)),v=i.antecedents?te(s,i.antecedents,v):O);}else v=ce(i);}(t);break;case 249:!function(t){var r=$();Me(t.expression);var n=h,i=C;h=r,C=v,Me(t.caseBlock),ne(r,v);var a=e.forEach(t.caseBlock.clauses,(function(e){return 290===e.kind}));t.possiblyExhaustive=!a&&!r.antecedents,a||ne(r,ae(C,t,0,0)),h=n,C=i,v=ce(r);}(t);break;case 263:!function(e){for(var t=e.clauses,n=G(e.parent.expression),i=O,a=0;a<t.length;a++){for(var o=a;!t[a].statements.length&&a+1<t.length;)Me(t[a]),a++;var s=$();ne(s,n?ae(C,e.parent,o,a+1):C),ne(s,i),v=ce(s);var c=t[a];Me(c),i=v,1&v.flags||a===t.length-1||!r.noFallthroughCasesInSwitch||(c.fallthroughFlowNode=v);}}(t);break;case 289:!function(e){var t=v;v=C,Me(e.expression),v=t,q(e.statements);}(t);break;case 238:!function(e){Me(e.expression),me(e.expression);}(t);break;case 250:!function(t){var n=$();k={next:k,name:t.label.escapedText,breakTarget:n,continueTarget:void 0,referenced:!1},Me(t.label),Me(t.statement),k.referenced||r.allowUnusedLabels||function(e,t,r){Oe(e,t,t,r);}(e.unusedLabelIsError(r),t.label,e.Diagnostics.Unused_label),k=k.next,ne(n,v),v=ce(n);}(t);break;case 219:!function(e){if(53===e.operator){var t=D;D=S,S=t,W(e),S=D,D=t;}else W(e),45!==e.operator&&46!==e.operator||ve(e.operand);}(t);break;case 220:!function(e){W(e),(45===e.operator||46===e.operator)&&ve(e.operand);}(t);break;case 221:if(e.isDestructuringAssignment(t))return w=n,void function(e){w?(w=!1,Me(e.operatorToken),Me(e.right),w=!0,Me(e.left)):(w=!0,Me(e.left),w=!1,Me(e.operatorToken),Me(e.right)),ve(e.left);}(t);L(t);break;case 215:!function(e){W(e),206===e.expression.kind&&ve(e.expression);}(t);break;case 222:!function(e){var t=$(),r=$(),n=$();de(e.condition,t,r),v=ce(t),Me(e.questionToken),Me(e.whenTrue),ne(n,v),v=ce(r),Me(e.colonToken),Me(e.whenFalse),ne(n,v),v=ce(n);}(t);break;case 254:!function(t){W(t),(t.initializer||e.isForInOrOfStatement(t.parent.parent))&&be(t);}(t);break;case 206:case 207:!function(t){e.isOptionalChain(t)?Se(t):W(t);}(t);break;case 208:!function(t){if(e.isOptionalChain(t))Se(t);else {var r=e.skipParentheses(t.expression);213===r.kind||214===r.kind?(q(t.typeArguments),q(t.arguments),Me(t.expression)):(W(t),106===t.expression.kind&&(v=se(v,t)));}if(206===t.expression.kind){var n=t.expression;e.isIdentifier(n.name)&&Z(n.expression)&&e.isPushOrUnshiftIdentifier(n.name)&&(v=oe(256,v,t));}}(t);break;case 230:!function(t){e.isOptionalChain(t)?Se(t):W(t);}(t);break;case 345:case 338:case 339:!function(t){Me(t.tagName),339!==t.kind&&t.fullName&&(e.setParent(t.fullName,t),e.setParentRecursive(t.fullName,!1)),"string"!=typeof t.comment&&q(t.comment);}(t);break;case 305:V(t.statements),Me(t.endOfFileToken);break;case 235:case 262:V(t.statements);break;case 203:!function(t){e.isBindingPattern(t.name)?(q(t.decorators),q(t.modifiers),Me(t.dotDotDotToken),Me(t.propertyName),Me(t.initializer),Me(t.name)):W(t);}(t);break;case 205:case 204:case 296:case 225:w=n;default:W(t);}Le(t),w=n;}function G(e){switch(e.kind){case 79:case 80:case 108:case 206:case 207:return X(e);case 208:return function(e){if(e.arguments)for(var t=0,r=e.arguments;t<r.length;t++)if(X(r[t]))return !0;return !(206!==e.expression.kind||!X(e.expression.expression))}(e);case 212:case 230:return G(e.expression);case 221:return function(e){switch(e.operatorToken.kind){case 63:case 75:case 76:case 77:return X(e.left);case 34:case 35:case 36:case 37:return Z(e.left)||Z(e.right)||Y(e.right,e.left)||Y(e.left,e.right);case 102:return Z(e.left);case 101:case 27:return G(e.right)}return !1}(e);case 219:return 53===e.operator&&G(e.operand);case 216:return G(e.expression)}return !1}function Q(t){return e.isDottedName(t)||(e.isPropertyAccessExpression(t)||e.isNonNullExpression(t)||e.isParenthesizedExpression(t))&&Q(t.expression)||e.isBinaryExpression(t)&&27===t.operatorToken.kind&&Q(t.right)||e.isElementAccessExpression(t)&&(e.isStringOrNumericLiteralLike(t.argumentExpression)||e.isEntityNameExpression(t.argumentExpression))&&Q(t.expression)||e.isAssignmentExpression(t)&&Q(t.left)}function X(t){return Q(t)||e.isOptionalChain(t)&&X(t.expression)}function Y(t,r){return e.isTypeOfExpression(t)&&Z(t.expression)&&e.isStringLiteralLike(r)}function Z(e){switch(e.kind){case 212:return Z(e.expression);case 221:switch(e.operatorToken.kind){case 63:return Z(e.left);case 27:return Z(e.right)}}return X(e)}function $(){return c({flags:4,antecedents:void 0})}function ee(){return c({flags:8,antecedents:void 0})}function te(e,t,r){return c({flags:1024,target:e,antecedents:t,antecedent:r})}function re(e){e.flags|=2048&e.flags?4096:2048;}function ne(t,r){1&r.flags||e.contains(t.antecedents,r)||((t.antecedents||(t.antecedents=[])).push(r),re(r));}function ie(t,r,n){return 1&r.flags?r:n?!(110===n.kind&&64&t||95===n.kind&&32&t)||e.isExpressionOfOptionalChainRoot(n)||e.isNullishCoalesce(n.parent)?G(n)?(re(r),c({flags:t,antecedent:r,node:n})):r:O:32&t?r:O}function ae(e,t,r,n){return re(e),c({flags:128,antecedent:e,switchStatement:t,clauseStart:r,clauseEnd:n})}function oe(e,t,r){re(t);var n=c({flags:e,antecedent:t,node:r});return T&&ne(T,n),n}function se(e,t){return re(e),c({flags:512,antecedent:e,node:t})}function ce(e){var t=e.antecedents;return t?1===t.length?t[0]:e:O}function le(e){for(;;)if(212===e.kind)e=e.expression;else {if(219!==e.kind||53!==e.operator)return 221===e.kind&&(55===e.operatorToken.kind||56===e.operatorToken.kind||60===e.operatorToken.kind);e=e.operand;}}function ue(t){for(;e.isParenthesizedExpression(t.parent)||e.isPrefixUnaryExpression(t.parent)&&53===t.parent.operator;)t=t.parent;return !(function(e){var t=e.parent;switch(t.kind){case 239:case 241:case 240:return t.expression===e;case 242:case 222:return t.condition===e}return !1}(t)||le(t.parent)||e.isOptionalChain(t.parent)&&t.parent.expression===t)}function _e(e,t,r,n){var i=D,a=S;D=r,S=n,e(t),D=i,S=a;}function de(t,r,n){_e(Me,t,r,n),t&&(function(t){return t=e.skipParentheses(t),e.isBinaryExpression(t)&&e.isLogicalOrCoalescingAssignmentOperator(t.operatorToken.kind)}(t)||le(t)||e.isOptionalChain(t)&&e.isOutermostOptionalChain(t))||(ne(r,ie(32,v,t)),ne(n,ie(64,v,t)));}function pe(e,t,r){var n=h,i=b;h=t,b=r,Me(e),h=n,b=i;}function fe(e,t){for(var r=k;r&&250===e.parent.kind;)r.continueTarget=t,r=r.next,e=e.parent;return t}function ge(e,t,r){var n=246===e.kind?t:r;n&&(ne(n,v),v=O);}function me(t){if(208===t.kind){var r=t;106!==r.expression.kind&&e.isDottedName(r.expression)&&(v=se(v,r));}}function ye(e){221===e.kind&&63===e.operatorToken.kind?ve(e.left):ve(e);}function ve(e){if(Q(e))v=oe(16,v,e);else if(204===e.kind)for(var t=0,r=e.elements;t<r.length;t++){var n=r[t];225===n.kind?ve(n.expression):ye(n);}else if(205===e.kind)for(var i=0,a=e.properties;i<a.length;i++){var o=a[i];296===o.kind?ye(o.initializer):297===o.kind?ve(o.name):298===o.kind&&ve(o.expression);}}function he(t,r,n){var i=$();55===t.operatorToken.kind||76===t.operatorToken.kind?de(t.left,i,n):de(t.left,r,i),v=ce(i),Me(t.operatorToken),e.isLogicalOrCoalescingAssignmentOperator(t.operatorToken.kind)?(_e(Me,t.right,r,n),ve(t.left),ne(r,ie(32,v,t)),ne(n,ie(64,v,t))):de(t.right,r,n);}function be(t){var r=e.isOmittedExpression(t)?void 0:t.name;if(e.isBindingPattern(r))for(var n=0,i=r.elements;n<i.length;n++)be(i[n]);else v=oe(16,v,t);}function xe(e){switch(e.kind){case 206:Me(e.questionDotToken),Me(e.name);break;case 207:Me(e.questionDotToken),Me(e.argumentExpression);break;case 208:Me(e.questionDotToken),q(e.typeArguments),q(e.arguments);}}function De(t,r,n){var i=e.isOptionalChainRoot(t)?$():void 0;!function(t,r,n){_e(Me,t,r,n),e.isOptionalChain(t)&&!e.isOutermostOptionalChain(t)||(ne(r,ie(32,v,t)),ne(n,ie(64,v,t)));}(t.expression,i||r,n),i&&(v=ce(i)),_e(xe,t,r,n),e.isOutermostOptionalChain(t)&&(ne(r,ie(32,v,t)),ne(n,ie(64,v,t)));}function Se(e){if(ue(e)){var t=$();De(e,t,t),v=ce(t);}else De(e,D,S);}function Te(t){switch(t.kind){case 226:case 257:case 260:case 205:case 182:case 322:case 286:return 1;case 258:return 65;case 261:case 259:case 195:case 176:return 33;case 305:return 37;case 172:case 173:case 169:if(e.isObjectLiteralOrClassExpressionMethodOrAccessor(t))return 173;case 171:case 256:case 168:case 174:case 323:case 317:case 179:case 175:case 180:case 170:return 45;case 213:case 214:return 61;case 262:return 4;case 167:return t.initializer?4:0;case 292:case 242:case 243:case 244:case 263:return 2;case 235:return e.isFunctionLike(t.parent)||e.isClassStaticBlockDeclaration(t.parent)?0:2}return 0}function Ce(e){g&&(g.nextContainer=e),g=e;}function ke(r,n,i){switch(l.kind){case 261:return U(r,n,i);case 305:return function(r,n,i){return e.isExternalModule(t)?U(r,n,i):K(t.locals,void 0,r,n,i)}(r,n,i);case 226:case 257:return function(t,r,n){return e.isStatic(t)?K(l.symbol.exports,l.symbol,t,r,n):K(l.symbol.members,l.symbol,t,r,n)}(r,n,i);case 260:return K(l.symbol.exports,l.symbol,r,n,i);case 182:case 322:case 205:case 258:case 286:return K(l.symbol.members,l.symbol,r,n,i);case 179:case 180:case 174:case 175:case 323:case 176:case 169:case 168:case 171:case 172:case 173:case 256:case 213:case 214:case 317:case 345:case 338:case 170:case 259:case 195:return K(l.locals,void 0,r,n,i)}}function Ee(t){16777216&t.flags&&!function(t){var r=e.isSourceFile(t)?t:e.tryCast(t.body,e.isModuleBlock);return !!r&&r.statements.some((function(t){return e.isExportDeclaration(t)||e.isExportAssignment(t)}))}(t)?t.flags|=64:t.flags&=-65;}function Ne(e){var t=a(e),r=0!==t;return ke(e,r?512:1024,r?110735:0),t}function Fe(e,t,r){var n=B(t,r);return 106508&t&&(n.parent=l.symbol),j(n,e,t),n}function Ae(t,r,n){switch(f.kind){case 261:U(t,r,n);break;case 305:if(e.isExternalOrCommonJsModule(l)){U(t,r,n);break}default:f.locals||(f.locals=e.createSymbolTable(),Ce(f)),K(f.locals,void 0,t,r,n);}}function Pe(r,n){if(n&&79===n.kind){var i=n;if(o=i,e.isIdentifier(o)&&("eval"===o.escapedText||"arguments"===o.escapedText)){var a=e.getErrorSpanForNode(t,n);t.bindDiagnostics.push(e.createFileDiagnostic(t,a.start,a.length,function(r){return e.getContainingClass(r)?e.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode:t.externalModuleIndicator?e.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode:e.Diagnostics.Invalid_use_of_0_in_strict_mode}(r),e.idText(i)));}}var o;}function we(e){F&&Pe(e,e.name);}function Ie(r,n,i,a,o){var s=e.getSpanOfTokenAtPosition(t,r.pos);t.bindDiagnostics.push(e.createFileDiagnostic(t,s.start,s.length,n,i,a,o));}function Oe(r,n,a,o){!function(r,n,a){var o=e.createFileDiagnostic(t,n.pos,n.end-n.pos,a);r?t.bindDiagnostics.push(o):t.bindSuggestionDiagnostics=e.append(t.bindSuggestionDiagnostics,i$1(i$1({},o),{category:e.DiagnosticCategory.Suggestion}));}(r,{pos:e.getTokenPosOfNode(n,t),end:a.end},o);}function Me(r){if(r){e.setParent(r,s),e.tracing&&(r.tracingPath=t.path);var n=F;if(Be(r),r.kind>160){var i=s;s=r;var a=Te(r);0===a?H(r):function(t,r){var n=l,i=p,a=f;if(1&r?(214!==t.kind&&(p=l),l=f=t,32&r&&(l.locals=e.createSymbolTable()),Ce(l)):2&r&&((f=t).locals=void 0),4&r){var o=v,s=h,u=b,_=x,d=T,g=k,m=E,D=16&r&&!e.hasSyntacticModifier(t,256)&&!t.asteriskToken&&!!e.getImmediatelyInvokedFunctionExpression(t)||170===t.kind;D||(v=c({flags:2}),144&r&&(v.node=t)),x=D||171===t.kind||e.isInJSFile(t)&&(256===t.kind||213===t.kind)?$():void 0,T=void 0,h=void 0,b=void 0,k=void 0,E=!1,H(t),t.flags&=-2817,!(1&v.flags)&&8&r&&e.nodeIsPresent(t.body)&&(t.flags|=256,E&&(t.flags|=512),t.endFlowNode=v),305===t.kind&&(t.flags|=N,t.endFlowNode=v),x&&(ne(x,v),v=ce(x),(171===t.kind||170===t.kind||e.isInJSFile(t)&&(256===t.kind||213===t.kind))&&(t.returnFlowNode=v)),D||(v=o),h=s,b=u,x=_,T=d,k=g,E=m;}else 64&r?(y=!1,H(t),t.flags=y?128|t.flags:-129&t.flags):H(t);l=n,p=i,f=a;}(r,a),s=i;}else i=s,1===r.kind&&(s=r),Le(r),s=i;F=n;}}function Le(t){if(e.hasJSDocNodes(t))if(e.isInJSFile(t))for(var r=0,n=t.jsDoc;r<n.length;r++)Me(o=n[r]);else for(var i=0,a=t.jsDoc;i<a.length;i++){var o=a[i];e.setParent(o,t),e.setParentRecursive(o,!1);}}function Re(r){if(!F)for(var n=0,i=r;n<i.length;n++){var a=i[n];if(!e.isPrologueDirective(a))return;if(o=a,'"use strict"'===(s=e.getSourceTextOfNodeFromSourceFile(t,o.expression))||"'use strict'"===s)return void(F=!0)}var o,s;}function Be(n){switch(n.kind){case 79:if(n.isInJSDocNamespace){for(var i=n.parent;i&&!e.isJSDocTypeAlias(i);)i=i.parent;Ae(i,524288,788968);break}case 108:return v&&(e.isExpression(n)||297===s.kind)&&(n.flowNode=v),function(r){t.parseDiagnostics.length||16777216&r.flags||8388608&r.flags||e.isIdentifierName(r)||(F&&r.originalKeywordKind>=117&&r.originalKeywordKind<=125?t.bindDiagnostics.push(R(r,function(r){return e.getContainingClass(r)?e.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode:t.externalModuleIndicator?e.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode:e.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode}(r),e.declarationNameToString(r))):132===r.originalKeywordKind?e.isExternalModule(t)&&e.isInTopLevelContext(r)?t.bindDiagnostics.push(R(r,e.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module,e.declarationNameToString(r))):32768&r.flags&&t.bindDiagnostics.push(R(r,e.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,e.declarationNameToString(r))):125===r.originalKeywordKind&&8192&r.flags&&t.bindDiagnostics.push(R(r,e.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,e.declarationNameToString(r))));}(n);case 161:v&&e.isPartOfTypeQuery(n)&&(n.flowNode=v);break;case 231:case 106:n.flowNode=v;break;case 80:return function(r){"#constructor"===r.escapedText&&(t.parseDiagnostics.length||t.bindDiagnostics.push(R(r,e.Diagnostics.constructor_is_a_reserved_word,e.declarationNameToString(r))));}(n);case 206:case 207:var a=n;v&&Q(a)&&(a.flowNode=v),e.isSpecialPropertyDeclaration(a)&&function(t){108===t.expression.kind?Ue(t):e.isBindableStaticAccessExpression(t)&&305===t.parent.parent.kind&&(e.isPrototypeAccess(t.expression)?We(t,t.parent):He(t));}(a),e.isInJSFile(a)&&t.commonJsModuleIndicator&&e.isModuleExportsAccessExpression(a)&&!d(f,"module")&&K(t.locals,void 0,a.expression,134217729,111550);break;case 221:switch(e.getAssignmentDeclarationKind(n)){case 1:ze(n);break;case 2:!function(r){if(Je(r)){var n=e.getRightMostAssignedExpression(r.right);if(!(e.isEmptyObjectLiteral(n)||l===t&&_(t,n)))if(e.isObjectLiteralExpression(n)&&e.every(n.properties,e.isShorthandPropertyAssignment))e.forEach(n.properties,Ke);else {var i=e.exportAssignmentIsAlias(r)?2097152:1049092,a=K(t.symbol.exports,t.symbol,r,67108864|i,0);e.setValueDeclaration(a,r);}}}(n);break;case 3:We(n.left,n);break;case 6:!function(t){e.setParent(t.left,t),e.setParent(t.right,t),Ye(t.left.expression,t.left,!1,!0);}(n);break;case 4:Ue(n);break;case 5:var c=n.left.expression;if(e.isInJSFile(n)&&e.isIdentifier(c)){var u=d(f,c.escapedText);if(e.isThisInitializedDeclaration(null==u?void 0:u.valueDeclaration)){Ue(n);break}}!function(r){var n,i=Ze(r.left.expression,l)||Ze(r.left.expression,f);if(e.isInJSFile(r)||e.isFunctionSymbol(i)){var a=e.getLeftmostAccessExpression(r.left);e.isIdentifier(a)&&2097152&(null===(n=d(l,a.escapedText))||void 0===n?void 0:n.flags)||(e.setParent(r.left,r),e.setParent(r.right,r),e.isIdentifier(r.left.expression)&&l===t&&_(t,r.left.expression)?ze(r):e.hasDynamicName(r)?(Fe(r,67108868,"__computed"),qe(r,Ge(i,r.left.expression,Xe(r.left),!1,!1))):He(e.cast(r.left,e.isBindableStaticNameExpression)));}}(n);break;case 0:break;default:e.Debug.fail("Unknown binary expression special property assignment kind");}return function(t){F&&e.isLeftHandSideExpression(t.left)&&e.isAssignmentOperator(t.operatorToken.kind)&&Pe(t,t.left);}(n);case 292:return function(e){F&&e.variableDeclaration&&Pe(e,e.variableDeclaration.name);}(n);case 215:return function(r){if(F&&79===r.expression.kind){var n=e.getErrorSpanForNode(t,r.expression);t.bindDiagnostics.push(e.createFileDiagnostic(t,n.start,n.length,e.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));}}(n);case 8:return function(r){o<1&&F&&32&r.numericLiteralFlags&&t.bindDiagnostics.push(R(r,e.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));}(n);case 220:return function(e){F&&Pe(e,e.operand);}(n);case 219:return function(e){F&&(45!==e.operator&&46!==e.operator||Pe(e,e.operand));}(n);case 248:return function(t){F&&Ie(t,e.Diagnostics.with_statements_are_not_allowed_in_strict_mode);}(n);case 250:return function(t){F&&e.getEmitScriptTarget(r)>=2&&(e.isDeclarationStatement(t.statement)||e.isVariableStatement(t.statement))&&Ie(t.label,e.Diagnostics.A_label_is_not_allowed_here);}(n);case 192:return void(y=!0);case 177:break;case 163:return function(t){if(e.isJSDocTemplateTag(t.parent)){var r=e.getEffectiveContainerForJSDocTemplateTag(t.parent);r?(r.locals||(r.locals=e.createSymbolTable()),K(r.locals,void 0,t,262144,526824)):ke(t,262144,526824);}else if(190===t.parent.kind){var n=function(t){var r=e.findAncestor(t,(function(t){return t.parent&&e.isConditionalTypeNode(t.parent)&&t.parent.extendsType===t}));return r&&r.parent}(t.parent);n?(n.locals||(n.locals=e.createSymbolTable()),K(n.locals,void 0,t,262144,526824)):Fe(t,262144,J(t));}else ke(t,262144,526824);}(n);case 164:return tt(n);case 254:return et(n);case 203:return n.flowNode=v,et(n);case 167:case 166:return function(e){return rt(e,4|(e.questionToken?16777216:0),0)}(n);case 296:case 297:return rt(n,4,0);case 299:return rt(n,8,900095);case 174:case 175:case 176:return ke(n,131072,0);case 169:case 168:return rt(n,8192|(n.questionToken?16777216:0),e.isObjectLiteralMethod(n)?0:103359);case 256:return function(r){t.isDeclarationFile||16777216&r.flags||e.isAsyncFunction(r)&&(N|=2048),we(r),F?(function(r){if(o<2&&305!==f.kind&&261!==f.kind&&!e.isFunctionLikeOrClassStaticBlockDeclaration(f)){var n=e.getErrorSpanForNode(t,r);t.bindDiagnostics.push(e.createFileDiagnostic(t,n.start,n.length,function(r){return e.getContainingClass(r)?e.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode:t.externalModuleIndicator?e.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode:e.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5}(r)));}}(r),Ae(r,16,110991)):ke(r,16,110991);}(n);case 171:return ke(n,16384,0);case 172:return rt(n,32768,46015);case 173:return rt(n,65536,78783);case 179:case 317:case 323:case 180:return function(t){var r=B(131072,J(t));j(r,t,131072);var n=B(2048,"__type");j(n,t,2048),n.members=e.createSymbolTable(),n.members.set(r.escapedName,r);}(n);case 182:case 322:case 195:return function(e){return Fe(e,2048,"__type")}(n);case 332:return function(t){W(t);var r=e.getHostSignatureFromJSDoc(t);r&&169!==r.kind&&j(r.symbol,r,32);}(n);case 205:return function(t){var r;if(function(e){e[e.Property=1]="Property",e[e.Accessor=2]="Accessor";}(r||(r={})),F&&!e.isAssignmentTarget(t))for(var n=new e.Map,i=0,a=t.properties;i<a.length;i++){var o=a[i];if(298!==o.kind&&79===o.name.kind){var s=o.name,c=296===o.kind||297===o.kind||169===o.kind?1:2;n.get(s.escapedText)||n.set(s.escapedText,c);}}return Fe(t,4096,"__object")}(n);case 213:case 214:return function(r){return t.isDeclarationFile||16777216&r.flags||e.isAsyncFunction(r)&&(N|=2048),v&&(r.flowNode=v),we(r),Fe(r,16,r.name?r.name.escapedText:"__function")}(n);case 208:switch(e.getAssignmentDeclarationKind(n)){case 7:return function(e){var t=Ze(e.arguments[0]),r=305===e.parent.parent.kind;Qe(e,t=Ge(t,e.arguments[0],r,!1,!1),!1);}(n);case 8:return function(e){if(Je(e)){var t=$e(e.arguments[0],void 0,(function(e,t){return t&&j(t,e,67110400),t}));if(t){K(t.exports,t,e,1048580,0);}}}(n);case 9:return function(e){var t=Ze(e.arguments[0].expression);t&&t.valueDeclaration&&j(t,t.valueDeclaration,32),Qe(e,t,!0);}(n);case 0:break;default:return e.Debug.fail("Unknown call expression assignment declaration kind")}e.isInJSFile(n)&&function(r){!t.commonJsModuleIndicator&&e.isRequireCall(r,!1)&&Je(r);}(n);break;case 226:case 257:return F=!0,function(r){257===r.kind?Ae(r,32,899503):(Fe(r,32,r.name?r.name.escapedText:"__class"),r.name&&P.add(r.name.escapedText));var n=r.symbol,i=B(4194308,"prototype"),a=n.exports.get(i.escapedName);a&&(r.name&&e.setParent(r.name,r),t.bindDiagnostics.push(R(a.declarations[0],e.Diagnostics.Duplicate_identifier_0,e.symbolName(i)))),n.exports.set(i.escapedName,i),i.parent=n;}(n);case 258:return Ae(n,64,788872);case 259:return Ae(n,524288,788968);case 260:return function(t){return e.isEnumConst(t)?Ae(t,128,899967):Ae(t,256,899327)}(n);case 261:return function(r){if(Ee(r),e.isAmbientModule(r))if(e.hasSyntacticModifier(r,1)&&Ie(r,e.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible),e.isModuleAugmentationExternal(r))Ne(r);else {var n=void 0;if(10===r.name.kind){var i=r.name.text;void 0===(n=e.tryParsePattern(i))&&Ie(r.name,e.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character,i);}var a=ke(r,512,110735);t.patternAmbientModules=e.append(t.patternAmbientModules,n&&!e.isString(n)?{pattern:n,symbol:a}:void 0);}else {var o=Ne(r);0!==o&&((a=r.symbol).constEnumOnlyModule=!(304&a.flags)&&2===o&&!1!==a.constEnumOnlyModule);}}(n);case 286:return function(e){return Fe(e,4096,"__jsxAttributes")}(n);case 285:return function(e,t,r){return ke(e,4,0)}(n);case 265:case 268:case 270:case 275:return ke(n,2097152,2097152);case 264:return function(r){r.modifiers&&r.modifiers.length&&t.bindDiagnostics.push(R(r,e.Diagnostics.Modifiers_cannot_appear_here));var n=e.isSourceFile(r.parent)?e.isExternalModule(r.parent)?r.parent.isDeclarationFile?void 0:e.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files:e.Diagnostics.Global_module_exports_may_only_appear_in_module_files:e.Diagnostics.Global_module_exports_may_only_appear_at_top_level;n?t.bindDiagnostics.push(R(r,n)):(t.symbol.globalExports=t.symbol.globalExports||e.createSymbolTable(),K(t.symbol.globalExports,t.symbol,r,2097152,2097152));}(n);case 267:return function(e){e.name&&ke(e,2097152,2097152);}(n);case 272:return function(t){l.symbol&&l.symbol.exports?t.exportClause?e.isNamespaceExport(t.exportClause)&&(e.setParent(t.exportClause,t),K(l.symbol.exports,l.symbol,t.exportClause,2097152,2097152)):K(l.symbol.exports,l.symbol,t,8388608,0):Fe(t,8388608,J(t));}(n);case 271:return function(t){if(l.symbol&&l.symbol.exports){var r=e.exportAssignmentIsAlias(t)?2097152:4,n=K(l.symbol.exports,l.symbol,t,r,67108863);t.isExportEquals&&e.setValueDeclaration(n,t);}else Fe(t,111551,J(t));}(n);case 305:return Re(n.statements),function(){if(Ee(t),e.isExternalModule(t))je();else if(e.isJsonSourceFile(t)){je();var r=t.symbol;K(t.symbol.exports,t.symbol,t,4,67108863),t.symbol=r;}}();case 235:if(!e.isFunctionLikeOrClassStaticBlockDeclaration(n.parent))return;case 262:return Re(n.statements);case 340:if(323===n.parent.kind)return tt(n);if(322!==n.parent.kind)break;case 347:var p=n;return ke(p,p.isBracketed||p.typeExpression&&316===p.typeExpression.type.kind?16777220:4,0);case 345:case 338:case 339:return (m||(m=[])).push(n)}}function je(){Fe(t,512,'"'.concat(e.removeFileExtension(t.fileName),'"'));}function Je(e){return !(t.externalModuleIndicator&&!0!==t.externalModuleIndicator||(t.commonJsModuleIndicator||(t.commonJsModuleIndicator=e,t.externalModuleIndicator||je()),0))}function ze(t){if(Je(t)){var r=$e(t.left.expression,void 0,(function(e,t){return t&&j(t,e,67110400),t}));if(r){var n=e.isAliasableExpression(t.right)&&(e.isExportsIdentifier(t.left.expression)||e.isModuleExportsAccessExpression(t.left.expression))?2097152:1048580;e.setParent(t.left,t),K(r.exports,r,t.left,n,0);}}}function Ke(e){K(t.symbol.exports,t.symbol,e,69206016,0);}function Ue(t){if(e.Debug.assert(e.isInJSFile(t)),!(e.isBinaryExpression(t)&&e.isPropertyAccessExpression(t.left)&&e.isPrivateIdentifier(t.left.name)||e.isPropertyAccessExpression(t)&&e.isPrivateIdentifier(t.name))){var r=e.getThisContainer(t,!1);switch(r.kind){case 256:case 213:var n=r.symbol;if(e.isBinaryExpression(r.parent)&&63===r.parent.operatorToken.kind){var i=r.parent.left;e.isBindableStaticAccessExpression(i)&&e.isPrototypeAccess(i.expression)&&(n=Ze(i.expression.expression,p));}n&&n.valueDeclaration&&(n.members=n.members||e.createSymbolTable(),e.hasDynamicName(t)?Ve(t,n,n.members):K(n.members,n,t,67108868,0),j(n,n.valueDeclaration,32));break;case 171:case 167:case 169:case 172:case 173:case 170:var a=r.parent,o=e.isStatic(r)?a.symbol.exports:a.symbol.members;e.hasDynamicName(t)?Ve(t,a.symbol,o):K(o,a.symbol,t,67108868,0,!0);break;case 305:if(e.hasDynamicName(t))break;r.commonJsModuleIndicator?K(r.symbol.exports,r.symbol,t,1048580,0):ke(t,1,111550);break;default:e.Debug.failBadSyntaxKind(r);}}}function Ve(e,t,r){K(r,t,e,4,0,!0,!0),qe(e,t);}function qe(t,r){r&&(r.assignmentDeclarationMembers||(r.assignmentDeclarationMembers=new e.Map)).set(e.getNodeId(t),t);}function We(t,r){var n=t.expression,i=n.expression;e.setParent(i,n),e.setParent(n,t),e.setParent(t,r),Ye(i,t,!0,!0);}function He(t){e.Debug.assert(!e.isIdentifier(t)),e.setParent(t.expression,t),Ye(t.expression,t,!1,!1);}function Ge(r,n,i,a,o){if(2097152&(null==r?void 0:r.flags))return r;if(i&&!a){var s=67110400;r=$e(n,r,(function(r,n,i){return n?(j(n,r,s),n):K(i?i.exports:t.jsGlobalAugmentations||(t.jsGlobalAugmentations=e.createSymbolTable()),i,r,s,110735)}));}return o&&r&&r.valueDeclaration&&j(r,r.valueDeclaration,32),r}function Qe(t,r,n){if(r&&function(t){if(1072&t.flags)return !0;var r=t.valueDeclaration;if(r&&e.isCallExpression(r))return !!e.getAssignedExpandoInitializer(r);var n=r?e.isVariableDeclaration(r)?r.initializer:e.isBinaryExpression(r)?r.right:e.isPropertyAccessExpression(r)&&e.isBinaryExpression(r.parent)?r.parent.right:void 0:void 0;if(n=n&&e.getRightMostAssignedExpression(n)){var i=e.isPrototypeAccess(e.isVariableDeclaration(r)?r.name:e.isBinaryExpression(r)?r.left:r);return !!e.getExpandoInitializer(!e.isBinaryExpression(n)||56!==n.operatorToken.kind&&60!==n.operatorToken.kind?n:n.right,i)}return !1}(r)){var i=n?r.members||(r.members=e.createSymbolTable()):r.exports||(r.exports=e.createSymbolTable()),a=0,o=0;e.isFunctionLikeDeclaration(e.getAssignedExpandoInitializer(t))?(a=8192,o=103359):e.isCallExpression(t)&&e.isBindableObjectDefinePropertyCall(t)&&(e.some(t.arguments[2].properties,(function(t){var r=e.getNameOfDeclaration(t);return !!r&&e.isIdentifier(r)&&"set"===e.idText(r)}))&&(a|=65540,o|=78783),e.some(t.arguments[2].properties,(function(t){var r=e.getNameOfDeclaration(t);return !!r&&e.isIdentifier(r)&&"get"===e.idText(r)}))&&(a|=32772,o|=46015)),0===a&&(a=4,o=0),K(i,r,t,67108864|a,-67108865&o);}}function Xe(t){return e.isBinaryExpression(t.parent)?305===function(t){for(;e.isBinaryExpression(t.parent);)t=t.parent;return t.parent}(t.parent).parent.kind:305===t.parent.parent.kind}function Ye(e,t,r,n){var i=Ze(e,l)||Ze(e,f),a=Xe(t);Qe(t,i=Ge(i,t.expression,a,r,n),r);}function Ze(t,r){if(void 0===r&&(r=l),e.isIdentifier(t))return d(r,t.escapedText);var n=Ze(t.expression);return n&&n.exports&&n.exports.get(e.getElementOrPropertyAccessName(t))}function $e(r,n,i){if(_(t,r))return t.symbol;if(e.isIdentifier(r))return i(r,Ze(r),n);var a=$e(r.expression,n,i),o=e.getNameOrArgument(r);return e.isPrivateIdentifier(o)&&e.Debug.fail("unexpected PrivateIdentifier"),i(o,a&&a.exports&&a.exports.get(e.getElementOrPropertyAccessName(r)),a)}function et(t){if(F&&Pe(t,t.name),!e.isBindingPattern(t.name)){var r=254===t.kind?t:t.parent.parent;!e.isInJSFile(t)||!e.isVariableDeclarationInitializedToBareOrAccessedRequire(r)||e.getJSDocTypeTag(t)||1&e.getCombinedModifierFlags(t)?e.isBlockOrCatchScoped(t)?Ae(t,2,111551):e.isParameterDeclaration(t)?ke(t,1,111551):ke(t,1,111550):ke(t,2097152,2097152);}}function tt(t){if((340!==t.kind||323===l.kind)&&(!F||16777216&t.flags||Pe(t,t.name),e.isBindingPattern(t.name)?Fe(t,1,"__"+t.parent.parameters.indexOf(t)):ke(t,1,111551),e.isParameterPropertyDeclaration(t,t.parent))){var r=t.parent.parent;K(r.symbol.members,r.symbol,t,4|(t.questionToken?16777216:0),0);}}function rt(r,n,i){return t.isDeclarationFile||16777216&r.flags||!e.isAsyncFunction(r)||(N|=2048),v&&e.isObjectLiteralOrClassExpressionMethodOrAccessor(r)&&(r.flowNode=v),e.hasDynamicName(r)?Fe(r,n,"__computed"):ke(r,n,i)}}();function u(t){return !(e.isFunctionDeclaration(t)||function(t){switch(t.kind){case 258:case 259:return !0;case 261:return 1!==a(t);case 260:return e.hasSyntacticModifier(t,2048);default:return !1}}(t)||e.isEnumDeclaration(t)||e.isVariableStatement(t)&&!(3&e.getCombinedNodeFlags(t))&&t.declarationList.declarations.some((function(e){return !e.initializer})))}function _(t,r){for(var n=0,i=[r];i.length&&n<100;){if(n++,r=i.shift(),e.isExportsIdentifier(r)||e.isModuleExportsAccessExpression(r))return !0;if(e.isIdentifier(r)){var a=d(t,r.escapedText);if(a&&a.valueDeclaration&&e.isVariableDeclaration(a.valueDeclaration)&&a.valueDeclaration.initializer){var o=a.valueDeclaration.initializer;i.push(o),e.isAssignmentExpression(o,!0)&&(i.push(o.left),i.push(o.right));}}}return !1}function d(t,r){var n=t.locals&&t.locals.get(r);return n?n.exportSymbol||n:e.isSourceFile(t)&&t.jsGlobalAugmentations&&t.jsGlobalAugmentations.has(r)?t.jsGlobalAugmentations.get(r):t.symbol&&t.symbol.exports&&t.symbol.exports.get(r)}e.bindSourceFile=function(t,r){e.performance.mark("beforeBind"),e.perfLogger.logStartBindFile(""+t.fileName),l(t,r),e.perfLogger.logStopBindFile(),e.performance.mark("afterBind"),e.performance.measure("Bind","beforeBind","afterBind");},e.isExportsOrModuleExportsOrAlias=_;}(t),function(e){e.createGetSymbolWalker=function(t,r,n,i,a,o,s,c,l,u){return function(_){void 0===_&&(_=function(){return !0});var d=[],p=[];return {walkType:function(t){try{return f(t),{visitedTypes:e.getOwnValues(d),visitedSymbols:e.getOwnValues(p)}}finally{e.clear(d),e.clear(p);}},walkSymbol:function(t){try{return y(t),{visitedTypes:e.getOwnValues(d),visitedSymbols:e.getOwnValues(p)}}finally{e.clear(d),e.clear(p);}}};function f(t){if(t&&!d[t.id]&&(d[t.id]=t,!y(t.symbol))){if(524288&t.flags){var r=t,n=r.objectFlags;4&n&&function(t){f(t.target),e.forEach(u(t),f);}(t),32&n&&function(e){f(e.typeParameter),f(e.constraintType),f(e.templateType),f(e.modifiersType);}(t),3&n&&(m(a=t),e.forEach(a.typeParameters,f),e.forEach(i(a),f),f(a.thisType)),24&n&&m(r);}var a;262144&t.flags&&function(e){f(c(e));}(t),3145728&t.flags&&function(t){e.forEach(t.types,f);}(t),4194304&t.flags&&function(e){f(e.type);}(t),8388608&t.flags&&function(e){f(e.objectType),f(e.indexType),f(e.constraint);}(t);}}function g(i){var a=r(i);a&&f(a.type),e.forEach(i.typeParameters,f);for(var o=0,s=i.parameters;o<s.length;o++)y(s[o]);f(t(i)),f(n(i));}function m(e){for(var t=a(e),r=0,n=t.indexInfos;r<n.length;r++){var i=n[r];f(i.keyType),f(i.type);}for(var o=0,s=t.callSignatures;o<s.length;o++)g(s[o]);for(var c=0,l=t.constructSignatures;c<l.length;c++)g(l[c]);for(var u=0,_=t.properties;u<_.length;u++)y(_[u]);}function y(t){if(!t)return !1;var r=e.getSymbolId(t);return !p[r]&&(p[r]=t,!_(t)||(f(o(t)),t.exports&&t.exports.forEach(y),e.forEach(t.declarations,(function(e){if(e.type&&181===e.type.kind){var t=e.type;y(s(l(t.exprName)));}})),!1))}}};}(t),function(e){var t,r,a,s,c=/^".+"$/,l="(anonymous)",u=1,_=1,d=1,p=1;!function(e){e[e.AllowsSyncIterablesFlag=1]="AllowsSyncIterablesFlag",e[e.AllowsAsyncIterablesFlag=2]="AllowsAsyncIterablesFlag",e[e.AllowsStringInputFlag=4]="AllowsStringInputFlag",e[e.ForOfFlag=8]="ForOfFlag",e[e.YieldStarFlag=16]="YieldStarFlag",e[e.SpreadFlag=32]="SpreadFlag",e[e.DestructuringFlag=64]="DestructuringFlag",e[e.PossiblyOutOfBounds=128]="PossiblyOutOfBounds",e[e.Element=1]="Element",e[e.Spread=33]="Spread",e[e.Destructuring=65]="Destructuring",e[e.ForOf=13]="ForOf",e[e.ForAwaitOf=15]="ForAwaitOf",e[e.YieldStar=17]="YieldStar",e[e.AsyncYieldStar=19]="AsyncYieldStar",e[e.GeneratorReturnType=1]="GeneratorReturnType",e[e.AsyncGeneratorReturnType=2]="AsyncGeneratorReturnType";}(t||(t={})),function(e){e[e.Yield=0]="Yield",e[e.Return=1]="Return",e[e.Next=2]="Next";}(r||(r={})),function(e){e[e.Normal=0]="Normal",e[e.FunctionReturn=1]="FunctionReturn",e[e.GeneratorNext=2]="GeneratorNext",e[e.GeneratorYield=3]="GeneratorYield";}(a||(a={})),function(e){e[e.None=0]="None",e[e.TypeofEQString=1]="TypeofEQString",e[e.TypeofEQNumber=2]="TypeofEQNumber",e[e.TypeofEQBigInt=4]="TypeofEQBigInt",e[e.TypeofEQBoolean=8]="TypeofEQBoolean",e[e.TypeofEQSymbol=16]="TypeofEQSymbol",e[e.TypeofEQObject=32]="TypeofEQObject",e[e.TypeofEQFunction=64]="TypeofEQFunction",e[e.TypeofEQHostObject=128]="TypeofEQHostObject",e[e.TypeofNEString=256]="TypeofNEString",e[e.TypeofNENumber=512]="TypeofNENumber",e[e.TypeofNEBigInt=1024]="TypeofNEBigInt",e[e.TypeofNEBoolean=2048]="TypeofNEBoolean",e[e.TypeofNESymbol=4096]="TypeofNESymbol",e[e.TypeofNEObject=8192]="TypeofNEObject",e[e.TypeofNEFunction=16384]="TypeofNEFunction",e[e.TypeofNEHostObject=32768]="TypeofNEHostObject",e[e.EQUndefined=65536]="EQUndefined",e[e.EQNull=131072]="EQNull",e[e.EQUndefinedOrNull=262144]="EQUndefinedOrNull",e[e.NEUndefined=524288]="NEUndefined",e[e.NENull=1048576]="NENull",e[e.NEUndefinedOrNull=2097152]="NEUndefinedOrNull",e[e.Truthy=4194304]="Truthy",e[e.Falsy=8388608]="Falsy",e[e.All=16777215]="All",e[e.BaseStringStrictFacts=3735041]="BaseStringStrictFacts",e[e.BaseStringFacts=12582401]="BaseStringFacts",e[e.StringStrictFacts=16317953]="StringStrictFacts",e[e.StringFacts=16776705]="StringFacts",e[e.EmptyStringStrictFacts=12123649]="EmptyStringStrictFacts",e[e.EmptyStringFacts=12582401]="EmptyStringFacts",e[e.NonEmptyStringStrictFacts=7929345]="NonEmptyStringStrictFacts",e[e.NonEmptyStringFacts=16776705]="NonEmptyStringFacts",e[e.BaseNumberStrictFacts=3734786]="BaseNumberStrictFacts",e[e.BaseNumberFacts=12582146]="BaseNumberFacts",e[e.NumberStrictFacts=16317698]="NumberStrictFacts",e[e.NumberFacts=16776450]="NumberFacts",e[e.ZeroNumberStrictFacts=12123394]="ZeroNumberStrictFacts",e[e.ZeroNumberFacts=12582146]="ZeroNumberFacts",e[e.NonZeroNumberStrictFacts=7929090]="NonZeroNumberStrictFacts",e[e.NonZeroNumberFacts=16776450]="NonZeroNumberFacts",e[e.BaseBigIntStrictFacts=3734276]="BaseBigIntStrictFacts",e[e.BaseBigIntFacts=12581636]="BaseBigIntFacts",e[e.BigIntStrictFacts=16317188]="BigIntStrictFacts",e[e.BigIntFacts=16775940]="BigIntFacts",e[e.ZeroBigIntStrictFacts=12122884]="ZeroBigIntStrictFacts",e[e.ZeroBigIntFacts=12581636]="ZeroBigIntFacts",e[e.NonZeroBigIntStrictFacts=7928580]="NonZeroBigIntStrictFacts",e[e.NonZeroBigIntFacts=16775940]="NonZeroBigIntFacts",e[e.BaseBooleanStrictFacts=3733256]="BaseBooleanStrictFacts",e[e.BaseBooleanFacts=12580616]="BaseBooleanFacts",e[e.BooleanStrictFacts=16316168]="BooleanStrictFacts",e[e.BooleanFacts=16774920]="BooleanFacts",e[e.FalseStrictFacts=12121864]="FalseStrictFacts",e[e.FalseFacts=12580616]="FalseFacts",e[e.TrueStrictFacts=7927560]="TrueStrictFacts",e[e.TrueFacts=16774920]="TrueFacts",e[e.SymbolStrictFacts=7925520]="SymbolStrictFacts",e[e.SymbolFacts=16772880]="SymbolFacts",e[e.ObjectStrictFacts=7888800]="ObjectStrictFacts",e[e.ObjectFacts=16736160]="ObjectFacts",e[e.FunctionStrictFacts=7880640]="FunctionStrictFacts",e[e.FunctionFacts=16728e3]="FunctionFacts",e[e.UndefinedFacts=9830144]="UndefinedFacts",e[e.NullFacts=9363232]="NullFacts",e[e.EmptyObjectStrictFacts=16318463]="EmptyObjectStrictFacts",e[e.AllTypeofNE=556800]="AllTypeofNE",e[e.EmptyObjectFacts=16777215]="EmptyObjectFacts",e[e.OrFactsMask=8256]="OrFactsMask",e[e.AndFactsMask=16768959]="AndFactsMask";}(s||(s={}));var f,g,m,y,v,h,b,x,D,S=new e.Map(e.getEntries({string:1,number:2,bigint:4,boolean:8,symbol:16,undefined:65536,object:32,function:64})),T=new e.Map(e.getEntries({string:256,number:512,bigint:1024,boolean:2048,symbol:4096,undefined:524288,object:8192,function:16384}));!function(e){e[e.Type=0]="Type",e[e.ResolvedBaseConstructorType=1]="ResolvedBaseConstructorType",e[e.DeclaredType=2]="DeclaredType",e[e.ResolvedReturnType=3]="ResolvedReturnType",e[e.ImmediateBaseConstraint=4]="ImmediateBaseConstraint",e[e.EnumTagType=5]="EnumTagType",e[e.ResolvedTypeArguments=6]="ResolvedTypeArguments",e[e.ResolvedBaseTypes=7]="ResolvedBaseTypes",e[e.WriteType=8]="WriteType";}(f||(f={})),function(e){e[e.Normal=0]="Normal",e[e.Contextual=1]="Contextual",e[e.Inferential=2]="Inferential",e[e.SkipContextSensitive=4]="SkipContextSensitive",e[e.SkipGenericFunctions=8]="SkipGenericFunctions",e[e.IsForSignatureHelp=16]="IsForSignatureHelp",e[e.IsForStringLiteralArgumentCompletions=32]="IsForStringLiteralArgumentCompletions",e[e.RestBindingElement=64]="RestBindingElement";}(g||(g={})),function(e){e[e.BivariantCallback=1]="BivariantCallback",e[e.StrictCallback=2]="StrictCallback",e[e.IgnoreReturnTypes=4]="IgnoreReturnTypes",e[e.StrictArity=8]="StrictArity",e[e.Callback=3]="Callback";}(m||(m={})),function(e){e[e.None=0]="None",e[e.Source=1]="Source",e[e.Target=2]="Target",e[e.PropertyCheck=4]="PropertyCheck",e[e.InPropertyCheck=8]="InPropertyCheck";}(y||(y={})),function(e){e[e.None=0]="None",e[e.Source=1]="Source",e[e.Target=2]="Target",e[e.Both=3]="Both";}(v||(v={})),function(e){e[e.IncludeReadonly=1]="IncludeReadonly",e[e.ExcludeReadonly=2]="ExcludeReadonly",e[e.IncludeOptional=4]="IncludeOptional",e[e.ExcludeOptional=8]="ExcludeOptional";}(h||(h={})),function(e){e[e.None=0]="None",e[e.Source=1]="Source",e[e.Target=2]="Target",e[e.Both=3]="Both";}(b||(b={})),function(e){e.resolvedExports="resolvedExports",e.resolvedMembers="resolvedMembers";}(x||(x={})),function(e){e[e.Local=0]="Local",e[e.Parameter=1]="Parameter";}(D||(D={}));var C,k,E,N,F=e.and(R,(function(t){return !e.isAccessor(t)}));!function(e){e[e.GetAccessor=1]="GetAccessor",e[e.SetAccessor=2]="SetAccessor",e[e.PropertyAssignment=4]="PropertyAssignment",e[e.Method=8]="Method",e[e.PrivateStatic=16]="PrivateStatic",e[e.GetOrSetAccessor=3]="GetOrSetAccessor",e[e.PropertyAssignmentOrMethod=12]="PropertyAssignmentOrMethod";}(C||(C={})),function(e){e[e.None=0]="None",e[e.ExportValue=1]="ExportValue",e[e.ExportType=2]="ExportType",e[e.ExportNamespace=4]="ExportNamespace";}(k||(k={})),function(e){e[e.None=0]="None",e[e.StrongArityForUntypedJS=1]="StrongArityForUntypedJS",e[e.VoidIsNonOptional=2]="VoidIsNonOptional";}(E||(E={})),function(e){e[e.Uppercase=0]="Uppercase",e[e.Lowercase=1]="Lowercase",e[e.Capitalize=2]="Capitalize",e[e.Uncapitalize=3]="Uncapitalize";}(N||(N={}));var A,P=new e.Map(e.getEntries({Uppercase:0,Lowercase:1,Capitalize:2,Uncapitalize:3}));function w(){}function I(){this.flags=0;}function O(e){return e.id||(e.id=_,_++),e.id}function M(e){return e.id||(e.id=u,u++),e.id}function L(t,r){var n=e.getModuleInstanceState(t);return 1===n||r&&2===n}function R(e){return 256!==e.kind&&169!==e.kind||!!e.body}function B(t){switch(t.parent.kind){case 270:case 275:return e.isIdentifier(t);default:return e.isDeclarationName(t)}}function j(e){switch(e){case 0:return "yieldType";case 1:return "returnType";case 2:return "nextType"}}function J(e){return !!(1&e.flags)}function z(e){return !!(2&e.flags)}e.getNodeId=O,e.getSymbolId=M,e.isInstantiatedModule=L,e.createTypeChecker=function(t){var r,a,s,u,_,f=e.memoize((function(){var r=new e.Map;return t.getSourceFiles().forEach((function(e){e.resolvedModules&&e.resolvedModules.forEach((function(e){e&&e.packageId&&r.set(e.packageId.name,".d.ts"===e.extension||!!r.get(e.packageId.name));}));})),r})),g=[],m=function(e){g.push(e);},y=e.objectAllocator.getSymbolConstructor(),v=e.objectAllocator.getTypeConstructor(),h=e.objectAllocator.getSignatureConstructor(),b=0,x=0,D=0,C=0,k=0,E=0,N=0,K=e.createSymbolTable(),U=[1],V=t.getCompilerOptions(),q=e.getEmitScriptTarget(V),W=e.getEmitModuleKind(V),H=e.getUseDefineForClassFields(V),G=e.getAllowSyntheticDefaultImports(V),Q=e.getStrictOptionValue(V,"strictNullChecks"),X=e.getStrictOptionValue(V,"strictFunctionTypes"),Y=e.getStrictOptionValue(V,"strictBindCallApply"),Z=e.getStrictOptionValue(V,"strictPropertyInitialization"),$=e.getStrictOptionValue(V,"noImplicitAny"),ee=e.getStrictOptionValue(V,"noImplicitThis"),te=e.getStrictOptionValue(V,"useUnknownInCatchVariables"),re=!!V.keyofStringsOnly,ne=V.suppressExcessPropertyErrors?0:8192,ie=V.exactOptionalPropertyTypes,ae=function(){var t=e.createBinaryExpressionTrampoline((function(t,r,i){return r?(r.stackIndex++,r.skip=!1,n(r,void 0),a(r,void 0)):r={checkMode:i,skip:!1,stackIndex:0,typeStack:[void 0,void 0]},e.isInJSFile(t)&&e.getAssignedExpandoInitializer(t)?(r.skip=!0,a(r,kx(t.right,i)),r):(function(t){var r=t.left,n=t.operatorToken,i=t.right;60===n.kind&&(!e.isBinaryExpression(r)||56!==r.operatorToken.kind&&55!==r.operatorToken.kind||DC(r,e.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses,e.tokenToString(r.operatorToken.kind),e.tokenToString(n.kind)),!e.isBinaryExpression(i)||56!==i.operatorToken.kind&&55!==i.operatorToken.kind||DC(i,e.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses,e.tokenToString(i.operatorToken.kind),e.tokenToString(n.kind)));}(t),63!==t.operatorToken.kind||205!==t.left.kind&&204!==t.left.kind||(r.skip=!0,a(r,ex(t.left,kx(t.right,i),i,108===t.right.kind))),r)}),(function(e,t,n){if(!t.skip)return r(t,e)}),(function(t,r,o){if(!r.skip){var s=i(r);e.Debug.assertIsDefined(s),n(r,s),a(r,void 0);var c=t.kind;if(55===c||56===c||60===c){if(55===c){var l=e.walkUpParenthesizedExpressions(o.parent);LD(o.left,e.isIfStatement(l)?l.thenStatement:void 0);}RD(s,o.left);}}}),(function(e,t,n){if(!t.skip)return r(t,e)}),(function(t,r){var o;if(r.skip)o=i(r);else {var s=function(e){return e.typeStack[e.stackIndex]}(r);e.Debug.assertIsDefined(s);var c=i(r);e.Debug.assertIsDefined(c),o=nx(t.left,t.operatorToken,t.right,s,c,t);}return r.skip=!1,n(r,void 0),a(r,void 0),r.stackIndex--,o}),(function(e,t,r){return a(e,t),e}));return function(r,n){var i=t(r,n);return e.Debug.assertIsDefined(i),i};function r(t,r){if(e.isBinaryExpression(r))return r;a(t,kx(r,t.checkMode));}function n(e,t){e.typeStack[e.stackIndex]=t;}function i(e){return e.typeStack[e.stackIndex+1]}function a(e,t){e.typeStack[e.stackIndex+1]=t;}}(),oe=function(){var r,n=t.getResolvedTypeReferenceDirectives();return n&&(r=new e.Map,n.forEach((function(e,r,n){if(e&&e.resolvedFileName){var i=t.getSourceFile(e.resolvedFileName);i&&a(i,r,n);}}))),{getReferencedExportContainer:mT,getReferencedImportDeclaration:yT,getReferencedDeclarationWithCollidingName:hT,isDeclarationWithCollidingName:bT,isValueAliasDeclaration:function(t){var r=e.getParseTreeNode(t);return !r||xT(r)},hasGlobalName:JT,isReferencedAliasDeclaration:function(t,r){var n=e.getParseTreeNode(t);return !n||CT(n,r)},getNodeCheckFlags:function(t){var r=e.getParseTreeNode(t);return r?PT(r):0},isTopLevelValueImportEqualsWithEntityName:DT,isDeclarationVisible:no,isImplementationOfOverload:kT,isRequiredInitializedParameter:ET,isOptionalUninitializedParameterProperty:NT,isExpandoFunctionDeclaration:FT,getPropertiesOfContainerFunction:AT,createTypeOfDeclaration:RT,createReturnTypeOfSignatureDeclaration:BT,createTypeOfExpression:jT,createLiteralConstValue:VT,isSymbolAccessible:La,isEntityNameVisible:Ka,getConstantValue:function(t){var r=e.getParseTreeNode(t,IT);return r?OT(r):void 0},collectLinkedAliases:io,getReferencedValueDeclaration:KT,getTypeReferenceSerializationKind:LT,isOptionalParameter:gl,moduleExportsSomeValue:gT,isArgumentsLocalBinding:fT,getExternalModuleFileFromDeclaration:function(t){var r=e.getParseTreeNode(t,e.hasPossibleExternalModuleReference);return r&&HT(r)},getTypeReferenceDirectivesForEntityName:function(e){if(r){var t=790504;(79===e.kind&&Ug(e)||206===e.kind&&!function(e){return e.parent&&228===e.parent.kind&&e.parent.parent&&291===e.parent.parent.kind}(e))&&(t=1160127);var n=qi(e,t,!0);return n&&n!==we?i(n,t):void 0}},getTypeReferenceDirectivesForSymbol:i,isLiteralConstDeclaration:UT,isLateBound:function(t){var r=e.getParseTreeNode(t,e.isDeclaration),n=r&&la(r);return !!(n&&4096&e.getCheckFlags(n))},getJsxFactoryEntity:qT,getJsxFragmentFactoryEntity:WT,getAllAccessorDeclarations:function(t){var r=173===(t=e.getParseTreeNode(t,e.isGetOrSetAccessorDeclaration)).kind?172:173,n=e.getDeclarationOfKind(la(t),r);return {firstAccessor:n&&n.pos<t.pos?n:t,secondAccessor:n&&n.pos<t.pos?t:n,setAccessor:173===t.kind?t:n,getAccessor:172===t.kind?t:n}},getSymbolOfExternalModuleSpecifier:function(e){return Gi(e,e,void 0)},isBindingCapturedByNode:function(t,r){var n=e.getParseTreeNode(t),i=e.getParseTreeNode(r);return !!n&&!!i&&(e.isVariableDeclaration(i)||e.isBindingElement(i))&&function(t,r){var n=ni(t);return !!n&&e.contains(n.capturedBlockScopeBindings,la(r))}(n,i)},getDeclarationStatementsForSourceFile:function(t,r,n,i){var a=e.getParseTreeNode(t);e.Debug.assert(a&&305===a.kind,"Non-sourcefile node passed into getDeclarationsForSourceFile");var o=la(t);return o?o.exports?se.symbolTableToDeclarationStatements(o.exports,t,r,n,i):[]:t.locals?se.symbolTableToDeclarationStatements(t.locals,t,r,n,i):[]},isImportRequiredByAugmentation:function(t){var r=e.getSourceFileOfNode(t);if(!r.symbol)return !1;var n=HT(t);if(!n)return !1;if(n===r)return !1;for(var i=aa(r.symbol),a=0,o=e.arrayFrom(i.values());a<o.length;a++){var s=o[a];if(s.mergeId){var c=ca(s);if(c.declarations)for(var l=0,u=c.declarations;l<u.length;l++){var _=u[l];if(e.getSourceFileOfNode(_)===n)return !0}}}return !1}};function i(t,n){if(r&&function(t){if(!t.declarations)return !1;for(var n=t;;){var i=ua(n);if(!i)break;n=i;}if(n.valueDeclaration&&305===n.valueDeclaration.kind&&512&n.flags)return !1;for(var a=0,o=t.declarations;a<o.length;a++){var s=o[a],c=e.getSourceFileOfNode(s);if(r.has(c.path))return !0}return !1}(t)){for(var i,a=0,o=t.declarations;a<o.length;a++){var s=o[a];if(s.symbol&&s.symbol.flags&n){var c=e.getSourceFileOfNode(s),l=r.get(c.path);if(!l)return;(i||(i=[])).push(l);}}return i}}function a(n,i,o){if(!r.has(n.path)){r.set(n.path,[i,o]);for(var s=0,c=n.referencedFiles;s<c.length;s++){var l=c[s],u=l.fileName,_=l.resolutionMode,d=e.resolveTripleslashReference(u,n.fileName),p=t.getSourceFile(d);p&&a(p,i,_||n.impliedNodeFormat);}}}}(),se=function(){return {typeToTypeNode:function(e,t,r,n){return a(t,r,n,(function(t){return l(e,t)}))},indexInfoToIndexSignatureDeclaration:function(e,t,r,n){return a(t,r,n,(function(t){return g(e,t,void 0)}))},signatureToSignatureDeclaration:function(e,t,r,n,i){return a(r,n,i,(function(r){return m(e,t,r)}))},symbolToEntityName:function(e,t,r,n,i){return a(r,n,i,(function(r){return P(e,r,t,!1)}))},symbolToExpression:function(e,t,r,n,i){return a(r,n,i,(function(r){return w(e,r,t)}))},symbolToTypeParameterDeclarations:function(e,t,r,n){return a(t,r,n,(function(t){return S(e,t)}))},symbolToParameterDeclaration:function(e,t,r,n){return a(t,r,n,(function(t){return h(e,t)}))},typeParameterToDeclaration:function(e,t,r,n){return a(t,r,n,(function(t){return v(e,t)}))},symbolTableToDeclarationStatements:function(t,r,s,c,u){return a(r,s,c,(function(r){return function(t,r,a){var s=X(e.factory.createPropertyDeclaration,169,!0),c=X((function(t,r,n,i,a){return e.factory.createPropertySignature(r,n,i,a)}),168,!1),u=r.enclosingDeclaration,_=[],d=new e.Set,p=[],f=r;(r=i$1(i$1({},f),{usedSymbolNames:new e.Set(f.usedSymbolNames),remappedSymbolNames:new e.Map,tracker:i$1(i$1({},f.tracker),{trackSymbol:function(e,t,n){if(0===La(e,t,n,!1).accessibility){var i=D(e,r,n);4&e.flags||F(i[0]);}else if(f.tracker&&f.tracker.trackSymbol)return f.tracker.trackSymbol(e,t,n);return !1}})})).tracker=o(r,r.tracker),e.forEachEntry(t,(function(t,r){ne(t,e.unescapeLeadingUnderscores(r));}));var y,h=!a,b=t.get("export=");return b&&t.size>1&&2097152&b.flags&&(t=e.createSymbolTable()).set("export=",b),E(t),y=function(t){var r=e.findIndex(t,(function(t){return e.isExportDeclaration(t)&&!t.moduleSpecifier&&!t.assertClause&&!!t.exportClause&&e.isNamedExports(t.exportClause)}));if(r>=0){var n=t[r],i=e.mapDefined(n.exportClause.elements,(function(r){if(!r.propertyName){var n=e.indicesOf(t),i=e.filter(n,(function(n){return e.nodeHasName(t[n],r.name)}));if(e.length(i)&&e.every(i,(function(e){return S(t[e])}))){for(var a=0,o=i;a<o.length;a++){var s=o[a];t[s]=T(t[s]);}return}}return r}));e.length(i)?t[r]=e.factory.updateExportDeclaration(n,n.decorators,n.modifiers,n.isTypeOnly,e.factory.updateNamedExports(n.exportClause,i),n.moduleSpecifier,n.assertClause):e.orderedRemoveItemAt(t,r);}return t}(y=function(t){var r=e.filter(t,(function(t){return e.isExportDeclaration(t)&&!t.moduleSpecifier&&!!t.exportClause&&e.isNamedExports(t.exportClause)}));if(e.length(r)>1){var i=e.filter(t,(function(t){return !e.isExportDeclaration(t)||!!t.moduleSpecifier||!t.exportClause}));t=n$4(n$4([],i,!0),[e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports(e.flatMap(r,(function(t){return e.cast(t.exportClause,e.isNamedExports).elements}))),void 0)],!1);}var a=e.filter(t,(function(t){return e.isExportDeclaration(t)&&!!t.moduleSpecifier&&!!t.exportClause&&e.isNamedExports(t.exportClause)}));if(e.length(a)>1){var o=e.group(a,(function(t){return e.isStringLiteral(t.moduleSpecifier)?">"+t.moduleSpecifier.text:">"}));if(o.length!==a.length)for(var s=function(r){r.length>1&&(t=n$4(n$4([],e.filter(t,(function(e){return -1===r.indexOf(e)})),!0),[e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports(e.flatMap(r,(function(t){return e.cast(t.exportClause,e.isNamedExports).elements}))),r[0].moduleSpecifier)],!1));},c=0,l=o;c<l.length;c++)s(l[c]);}return t}(y=function(t){var r=e.find(t,e.isExportAssignment),i=e.findIndex(t,e.isModuleDeclaration),a=-1!==i?t[i]:void 0;if(a&&r&&r.isExportEquals&&e.isIdentifier(r.expression)&&e.isIdentifier(a.name)&&e.idText(a.name)===e.idText(r.expression)&&a.body&&e.isModuleBlock(a.body)){var o=e.filter(t,(function(t){return !!(1&e.getEffectiveModifierFlags(t))})),s=a.name,c=a.body;if(e.length(o)&&(a=e.factory.updateModuleDeclaration(a,a.decorators,a.modifiers,a.name,c=e.factory.updateModuleBlock(c,e.factory.createNodeArray(n$4(n$4([],a.body.statements,!0),[e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports(e.map(e.flatMap(o,(function(t){return r=t,e.isVariableStatement(r)?e.filter(e.map(r.declarationList.declarations,e.getNameOfDeclaration),x):e.filter([e.getNameOfDeclaration(r)],x);var r;})),(function(t){return e.factory.createExportSpecifier(!1,void 0,t)}))),void 0)],!1)))),t=n$4(n$4(n$4([],t.slice(0,i),!0),[a],!1),t.slice(i+1),!0)),!e.find(t,(function(t){return t!==a&&e.nodeHasName(t,s)}))){_=[];var l=!e.some(c.statements,(function(t){return e.hasSyntacticModifier(t,1)||e.isExportAssignment(t)||e.isExportDeclaration(t)}));e.forEach(c.statements,(function(e){A(e,l?1:0);})),t=n$4(n$4([],e.filter(t,(function(e){return e!==a&&e!==r})),!0),_,!0);}}return t}(y=_))),u&&(e.isSourceFile(u)&&e.isExternalOrCommonJsModule(u)||e.isModuleDeclaration(u))&&(!e.some(y,e.isExternalModuleIndicator)||!e.hasScopeMarker(y)&&e.some(y,e.needsScopeMarker))&&y.push(e.createEmptyExports(e.factory)),y;function x(e){return !!e&&79===e.kind}function S(t){return e.isEnumDeclaration(t)||e.isVariableStatement(t)||e.isFunctionDeclaration(t)||e.isClassDeclaration(t)||e.isModuleDeclaration(t)&&!e.isExternalModuleAugmentation(t)&&!e.isGlobalScopeAugmentation(t)||e.isInterfaceDeclaration(t)||$S(t)}function T(t){var r=-3&(1|e.getEffectiveModifierFlags(t));return e.factory.updateModifiers(t,r)}function C(t){var r=-2&e.getEffectiveModifierFlags(t);return e.factory.updateModifiers(t,r)}function E(t,r,n){r||p.push(new e.Map),t.forEach((function(e){N(e,!1,!!n);})),r||(p[p.length-1].forEach((function(e){N(e,!0,!!n);})),p.pop());}function N(t,_,p){var g=ca(t);if(!d.has(M(g))&&(d.add(M(g)),!_||e.length(t.declarations)&&e.some(t.declarations,(function(t){return !!e.findAncestor(t,(function(e){return e===u}))})))){var m=r;r=function(t){var r=i$1({},t);return r.typeParameterNames&&(r.typeParameterNames=new e.Map(r.typeParameterNames)),r.typeParameterNamesByText&&(r.typeParameterNamesByText=new e.Set(r.typeParameterNamesByText)),r.typeParameterSymbolList&&(r.typeParameterSymbolList=new e.Set(r.typeParameterSymbolList)),r.tracker=o(r,r.tracker),r}(r);var y=function(t,i,o){var _,d,p,f,g=e.unescapeLeadingUnderscores(t.escapedName),m="default"===t.escapedName;if(!i||131072&r.flags||!e.isStringANonContextualKeyword(g)||m){var y=m&&!!(-113&t.flags||16&t.flags&&e.length(Nc($o(t))))&&!(2097152&t.flags),h=!y&&!i&&e.isStringANonContextualKeyword(g)&&!m;(y||h)&&(i=!0);var b=(i?0:1)|(m&&!y?512:0),x=1536&t.flags&&7&t.flags&&"export="!==t.escapedName,D=x&&Q($o(t),t);if((8208&t.flags||D)&&O($o(t),t,ne(t,g),b),524288&t.flags&&function(t,n,i){var o,s=hs(t),c=ri(t).typeParameters,u=e.map(c,(function(e){return v(e,r)})),_=null===(o=t.declarations)||void 0===o?void 0:o.find(e.isJSDocTypeAlias),d=e.getTextOfJSDocComment(_?_.comment||_.parent.comment:void 0),p=r.flags;r.flags|=8388608;var f=r.enclosingDeclaration;r.enclosingDeclaration=_;var g=_&&_.typeExpression&&e.isJSDocTypeExpression(_.typeExpression)&&K(r,_.typeExpression.type,F,a)||l(s,r);A(e.setSyntheticLeadingComments(e.factory.createTypeAliasDeclaration(void 0,void 0,ne(t,n),u,g),d?[{kind:3,text:"*\n * "+d.replace(/\n/g,"\n * ")+"\n ",pos:-1,end:-1,hasTrailingNewLine:!0}]:[]),i),r.flags=p,r.enclosingDeclaration=f;}(t,g,b),7&t.flags&&"export="!==t.escapedName&&!(4194304&t.flags)&&!(32&t.flags)&&!D)if(o)G(t)&&(h=!1,y=!1);else {var S=$o(t),T=ne(t,g);if(16&t.flags||!Q(S,t)){var C=2&t.flags?ey(t)?2:1:(null===(_=t.parent)||void 0===_?void 0:_.valueDeclaration)&&e.isSourceFile(null===(d=t.parent)||void 0===d?void 0:d.valueDeclaration)?2:void 0,E=!y&&4&t.flags?te(T,t):T,N=t.declarations&&e.find(t.declarations,(function(t){return e.isVariableDeclaration(t)}));N&&e.isVariableDeclarationList(N.parent)&&1===N.parent.declarations.length&&(N=N.parent.parent);var P=null===(p=t.declarations)||void 0===p?void 0:p.find(e.isPropertyAccessExpression);if(P&&e.isBinaryExpression(P.parent)&&e.isIdentifier(P.parent.right)&&(null===(f=S.symbol)||void 0===f?void 0:f.valueDeclaration)&&e.isSourceFile(S.symbol.valueDeclaration)){var w=T===P.parent.right.escapedText?void 0:P.parent.right;A(e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports([e.factory.createExportSpecifier(!1,w,T)])),0),r.tracker.trackSymbol(S.symbol,r.enclosingDeclaration,111551);}else A(e.setTextRange(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(E,void 0,J(r,S,t,u,F,a))],C)),N),E!==T?-2&b:b),E===T||i||(A(e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports([e.factory.createExportSpecifier(!1,E,T)])),0),h=!1,y=!1);}else O(S,t,T,b);}if(384&t.flags&&function(t,r,n){A(e.factory.createEnumDeclaration(void 0,e.factory.createModifiersFromModifierFlags(Yb(t)?2048:0),ne(t,r),e.map(e.filter(Nc($o(t)),(function(e){return !!(8&e.flags)})),(function(t){var r=t.declarations&&t.declarations[0]&&e.isEnumMember(t.declarations[0])?OT(t.declarations[0]):void 0;return e.factory.createEnumMember(e.unescapeLeadingUnderscores(t.escapedName),void 0===r?void 0:"string"==typeof r?e.factory.createStringLiteral(r):e.factory.createNumericLiteral(r))}))),n);}(t,g,b),32&t.flags&&(4&t.flags&&t.valueDeclaration&&e.isBinaryExpression(t.valueDeclaration.parent)&&e.isClassExpression(t.valueDeclaration.parent.right)?W(t,ne(t,g),b):function(t,i,o){var c,u,_=null===(c=t.declarations)||void 0===c?void 0:c.find(e.isClassLike),d=r.enclosingDeclaration;r.enclosingDeclaration=_||d;var p=ss(t),f=e.map(p,(function(e){return v(e,r)})),g=vs(t),m=gs(g),y=_&&e.getEffectiveImplementsTypeNodes(_),h=y&&function(t){var n=e.mapDefined(t,(function(t){var n,i=r.enclosingDeclaration;r.enclosingDeclaration=t;var o=t.expression;if(e.isEntityNameExpression(o)){if(e.isIdentifier(o)&&""===e.idText(o))return c(void 0);var s=void 0;if(s=(n=z(o,r,F)).introducesError,o=n.node,s)return c(void 0)}return c(e.factory.createExpressionWithTypeArguments(o,e.map(t.typeArguments,(function(e){return K(r,e,F,a)||l(kd(e),r)}))));function c(e){return r.enclosingDeclaration=i,e}}));if(n.length===t.length)return n}(y)||e.mapDefined(function(t){var r=e.emptyArray;if(t.symbol.declarations)for(var n=0,i=t.symbol.declarations;n<i.length;n++){var a=i[n],o=e.getEffectiveImplementsTypeNodes(a);if(o)for(var s=0,c=o;s<c.length;s++){var l=kd(c[s]);po(l)||(r===e.emptyArray?r=[l]:r.push(l));}}return r}(g),ee),b=$o(t),x=!!(null===(u=b.symbol)||void 0===u?void 0:u.valueDeclaration)&&e.isClassLike(b.symbol.valueDeclaration),D=x?ps(b):Le,S=n$4(n$4([],e.length(m)?[e.factory.createHeritageClause(94,e.map(m,(function(t){return function(t,n,i){var a=$(t,111551);if(a)return a;var o=te("".concat(i,"_base"));return A(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(o,void 0,l(n,r))],2)),0),e.factory.createExpressionWithTypeArguments(e.factory.createIdentifier(o),void 0)}(t,D,i)})))]:[],!0),e.length(h)?[e.factory.createHeritageClause(117,h)]:[],!0),T=function(t,r,n){if(!e.length(r))return n;var i=new e.Map;e.forEach(n,(function(e){i.set(e.escapedName,e);}));for(var a=0,o=r;a<o.length;a++)for(var s=0,c=Nc(Hs(o[a],t.thisType));s<c.length;s++){var l=c[s],u=i.get(l.escapedName);u&&l.parent===u.parent&&i.delete(l.escapedName);}return e.arrayFrom(i.values())}(g,m,Nc(g)),C=e.filter(T,(function(t){var r=t.valueDeclaration;return !(!r||e.isNamedDeclaration(r)&&e.isPrivateIdentifier(r.name))})),k=e.some(T,(function(t){var r=t.valueDeclaration;return !!r&&e.isNamedDeclaration(r)&&e.isPrivateIdentifier(r.name)}))?[e.factory.createPropertyDeclaration(void 0,void 0,e.factory.createPrivateIdentifier("#private"),void 0,void 0,void 0)]:e.emptyArray,E=e.flatMap(C,(function(e){return s(e,!1,m[0])})),N=e.flatMap(e.filter(Nc(b),(function(e){return !(4194304&e.flags||"prototype"===e.escapedName||U(e))})),(function(e){return s(e,!0,D)})),P=!x&&t.valueDeclaration&&e.isInJSFile(t.valueDeclaration)&&!e.some(el(b,1))?[e.factory.createConstructorDeclaration(void 0,e.factory.createModifiersFromModifierFlags(8),[],void 0)]:Y(1,b,D,171),w=Z(g,m[0]);r.enclosingDeclaration=d,A(e.setTextRange(e.factory.createClassDeclaration(void 0,void 0,i,f,S,n$4(n$4(n$4(n$4(n$4([],w,!0),N,!0),P,!0),E,!0),k,!0)),t.declarations&&e.filter(t.declarations,(function(t){return e.isClassDeclaration(t)||e.isClassExpression(t)}))[0]),o);}(t,ne(t,g),b)),(1536&t.flags&&(!x||function(t){return e.every(I(t),(function(e){return !(111551&Li(e).flags)}))}(t))||D)&&function(t,n,i){var a=I(t),o=e.arrayToMultiMap(a,(function(e){return e.parent&&e.parent===t?"real":"merged"})),s=o.get("real")||e.emptyArray,c=o.get("merged")||e.emptyArray;if(e.length(s)&&j(s,u=ne(t,n),i,!!(67108880&t.flags)),e.length(c)){var l=e.getSourceFileOfNode(r.enclosingDeclaration),u=ne(t,n),_=e.factory.createModuleBlock([e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports(e.mapDefined(e.filter(c,(function(e){return "export="!==e.escapedName})),(function(n){var i,a,o=e.unescapeLeadingUnderscores(n.escapedName),s=ne(n,o),c=n.declarations&&xi(n);if(!l||(c?l===e.getSourceFileOfNode(c):e.some(n.declarations,(function(t){return e.getSourceFileOfNode(t)===l})))){var u=c&&Oi(c,!0);F(u||n);var _=u?ne(u,e.unescapeLeadingUnderscores(u.escapedName)):s;return e.factory.createExportSpecifier(!1,o===_?void 0:_,o)}null===(a=null===(i=r.tracker)||void 0===i?void 0:i.reportNonlocalAugmentation)||void 0===a||a.call(i,l,t,n);}))))]);A(e.factory.createModuleDeclaration(void 0,void 0,e.factory.createIdentifier(u),_,16),0);}}(t,g,b),64&t.flags&&!(32&t.flags)&&function(t,i,a){var o=vs(t),s=ss(t),l=e.map(s,(function(e){return v(e,r)})),u=gs(o),_=e.length(u)?p_(u):void 0,d=e.flatMap(Nc(o),(function(e){return function(e,t){return c(e,!1,t)}(e,_)})),p=Y(0,o,_,174),f=Y(1,o,_,175),g=Z(o,_),m=e.length(u)?[e.factory.createHeritageClause(94,e.mapDefined(u,(function(e){return $(e,111551)})))]:void 0;A(e.factory.createInterfaceDeclaration(void 0,void 0,ne(t,i),l,m,n$4(n$4(n$4(n$4([],g,!0),f,!0),p,!0),d,!0)),a);}(t,g,b),2097152&t.flags&&W(t,ne(t,g),b),4&t.flags&&"export="===t.escapedName&&G(t),8388608&t.flags&&t.declarations)for(var M=0,L=t.declarations;M<L.length;M++){var R=L[M],B=Hi(R,R.moduleSpecifier);B&&A(e.factory.createExportDeclaration(void 0,void 0,!1,void 0,e.factory.createStringLiteral(k(B,r))),0);}y?A(e.factory.createExportAssignment(void 0,void 0,!1,e.factory.createIdentifier(ne(t,g))),0):h&&A(e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports([e.factory.createExportSpecifier(!1,ne(t,g),g)])),0);}else r.encounteredError=!0;}(t,_,p);return r.reportedDiagnostic&&(f.reportedDiagnostic=r.reportedDiagnostic),r=m,y}}function F(t){if(!e.some(t.declarations,e.isParameterDeclaration)){e.Debug.assertIsDefined(p[p.length-1]),te(e.unescapeLeadingUnderscores(t.escapedName),t);var r=!!(2097152&t.flags)&&!e.some(t.declarations,(function(t){return !!e.findAncestor(t,e.isExportDeclaration)||e.isNamespaceExport(t)||e.isImportEqualsDeclaration(t)&&!e.isExternalModuleReference(t.moduleReference)}));p[r?0:p.length-1].set(M(t),t);}}function A(t,n){if(e.canHaveModifiers(t)){var i=0,a=r.enclosingDeclaration&&(e.isJSDocTypeAlias(r.enclosingDeclaration)?e.getSourceFileOfNode(r.enclosingDeclaration):r.enclosingDeclaration);1&n&&a&&(function(t){return e.isSourceFile(t)&&(e.isExternalOrCommonJsModule(t)||e.isJsonSourceFile(t))||e.isAmbientModule(t)&&!e.isGlobalScopeAugmentation(t)}(a)||e.isModuleDeclaration(a))&&S(t)&&(i|=1),!h||1&i||a&&16777216&a.flags||!(e.isEnumDeclaration(t)||e.isVariableStatement(t)||e.isFunctionDeclaration(t)||e.isClassDeclaration(t)||e.isModuleDeclaration(t))||(i|=2),512&n&&(e.isClassDeclaration(t)||e.isInterfaceDeclaration(t)||e.isFunctionDeclaration(t))&&(i|=512),i&&(t=e.factory.updateModifiers(t,i|e.getEffectiveModifierFlags(t)));}_.push(t);}function I(t){return t.exports?e.filter(e.arrayFrom(t.exports.values()),U):[]}function O(t,n,i,o){for(var s=0,c=el(t,0);s<c.length;s++){var l=c[s],u=m(l,256,r,{name:e.factory.createIdentifier(i),privateSymbolVisitor:F,bundledImports:a});A(e.setTextRange(u,L(l)),o);}1536&n.flags&&n.exports&&n.exports.size||j(e.filter(Nc(t),U),i,o,!0);}function L(t){if(t.declaration&&t.declaration.parent){if(e.isBinaryExpression(t.declaration.parent)&&5===e.getAssignmentDeclarationKind(t.declaration.parent))return t.declaration.parent;if(e.isVariableDeclaration(t.declaration.parent)&&t.declaration.parent.parent)return t.declaration.parent.parent}return t.declaration}function j(t,n,a,o){if(e.length(t)){var s=e.arrayToMultiMap(t,(function(t){return !e.length(t.declarations)||e.some(t.declarations,(function(t){return e.getSourceFileOfNode(t)===e.getSourceFileOfNode(r.enclosingDeclaration)}))?"local":"remote"})).get("local")||e.emptyArray,c=e.parseNodeFactory.createModuleDeclaration(void 0,void 0,e.factory.createIdentifier(n),e.factory.createModuleBlock([]),16);e.setParent(c,u),c.locals=e.createSymbolTable(t),c.symbol=t[0].parent;var l=_;_=[];var d=h;h=!1;var p=i$1(i$1({},r),{enclosingDeclaration:c}),f=r;r=p,E(e.createSymbolTable(s),o,!0),r=f,h=d;var g=_;_=l;var m=e.map(g,(function(t){return e.isExportAssignment(t)&&!t.isExportEquals&&e.isIdentifier(t.expression)?e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports([e.factory.createExportSpecifier(!1,t.expression,e.factory.createIdentifier("default"))])):t})),y=e.every(m,(function(t){return e.hasSyntacticModifier(t,1)}))?e.map(m,C):m;A(c=e.factory.updateModuleDeclaration(c,c.decorators,c.modifiers,c.name,e.factory.createModuleBlock(y)),a);}}function U(t){return !!(2887656&t.flags)||!(4194304&t.flags||"prototype"===t.escapedName||t.valueDeclaration&&e.isStatic(t.valueDeclaration)&&e.isClassLike(t.valueDeclaration.parent))}function W(t,n,i){var a,o,s,c,l,u=xi(t);if(!u)return e.Debug.fail();var _,d=ca(Oi(u,!0));if(d){var p=e.isShorthandAmbientModuleSymbol(d)&&(_=t.declarations,e.firstDefined(_,(function(t){if(e.isImportSpecifier(t)||e.isExportSpecifier(t))return e.idText(t.propertyName||t.name);if(e.isBinaryExpression(t)||e.isExportAssignment(t)){var r=e.isExportAssignment(t)?t.expression:t.right;if(e.isPropertyAccessExpression(r))return e.idText(r.name)}if(Di(t)){var n=e.getNameOfDeclaration(t);if(n&&e.isIdentifier(n))return e.idText(n)}})))||e.unescapeLeadingUnderscores(d.escapedName);"export="===p&&(e.getESModuleInterop(V)||V.allowSyntheticDefaultImports)&&(p="default");var f=ne(d,p);switch(F(d),u.kind){case 203:if(254===(null===(o=null===(a=u.parent)||void 0===a?void 0:a.parent)||void 0===o?void 0:o.kind)){var g=k(d.parent||d,r),m=u.propertyName;A(e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,void 0,e.factory.createNamedImports([e.factory.createImportSpecifier(!1,m&&e.isIdentifier(m)?e.factory.createIdentifier(e.idText(m)):void 0,e.factory.createIdentifier(n))])),e.factory.createStringLiteral(g),void 0),0);break}e.Debug.failBadSyntaxKind((null===(s=u.parent)||void 0===s?void 0:s.parent)||u,"Unhandled binding element grandparent kind in declaration serialization");break;case 297:221===(null===(l=null===(c=u.parent)||void 0===c?void 0:c.parent)||void 0===l?void 0:l.kind)&&H(e.unescapeLeadingUnderscores(t.escapedName),f);break;case 254:if(e.isPropertyAccessExpression(u.initializer)){var y=u.initializer,v=e.factory.createUniqueName(n),h=k(d.parent||d,r);A(e.factory.createImportEqualsDeclaration(void 0,void 0,!1,v,e.factory.createExternalModuleReference(e.factory.createStringLiteral(h))),0),A(e.factory.createImportEqualsDeclaration(void 0,void 0,!1,e.factory.createIdentifier(n),e.factory.createQualifiedName(v,y.name)),i);break}case 265:if("export="===d.escapedName&&e.some(d.declarations,e.isJsonSourceFile)){G(t);break}var b=!(512&d.flags||e.isVariableDeclaration(u));A(e.factory.createImportEqualsDeclaration(void 0,void 0,!1,e.factory.createIdentifier(n),b?P(d,r,67108863,!1):e.factory.createExternalModuleReference(e.factory.createStringLiteral(k(d,r)))),b?i:0);break;case 264:A(e.factory.createNamespaceExportDeclaration(e.idText(u.name)),0);break;case 267:A(e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,e.factory.createIdentifier(n),void 0),e.factory.createStringLiteral(k(d.parent||d,r)),void 0),0);break;case 268:A(e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,void 0,e.factory.createNamespaceImport(e.factory.createIdentifier(n))),e.factory.createStringLiteral(k(d,r)),void 0),0);break;case 274:A(e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamespaceExport(e.factory.createIdentifier(n)),e.factory.createStringLiteral(k(d,r))),0);break;case 270:A(e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,void 0,e.factory.createNamedImports([e.factory.createImportSpecifier(!1,n!==p?e.factory.createIdentifier(p):void 0,e.factory.createIdentifier(n))])),e.factory.createStringLiteral(k(d.parent||d,r)),void 0),0);break;case 275:var x=u.parent.parent.moduleSpecifier;H(e.unescapeLeadingUnderscores(t.escapedName),x?p:f,x&&e.isStringLiteralLike(x)?e.factory.createStringLiteral(x.text):void 0);break;case 271:G(t);break;case 221:case 206:case 207:"default"===t.escapedName||"export="===t.escapedName?G(t):H(n,f);break;default:return e.Debug.failBadSyntaxKind(u,"Unhandled alias declaration kind in symbol serializer!")}}}function H(t,r,n){A(e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports([e.factory.createExportSpecifier(!1,t!==r?r:void 0,t)]),n),0);}function G(t){if(4194304&t.flags)return !1;var n=e.unescapeLeadingUnderscores(t.escapedName),i="export="===n,o=i||"default"===n,s=t.declarations&&xi(t),c=s&&Oi(s,!0);if(c&&e.length(c.declarations)&&e.some(c.declarations,(function(t){return e.getSourceFileOfNode(t)===e.getSourceFileOfNode(u)}))){var l=s&&(e.isExportAssignment(s)||e.isBinaryExpression(s)?e.getExportAssignmentExpression(s):e.getPropertyAssignmentAliasLikeExpression(s)),d=l&&e.isEntityNameExpression(l)?function(t){switch(t.kind){case 79:return t;case 161:do{t=t.left;}while(79!==t.kind);return t;case 206:do{if(e.isModuleExportsAccessExpression(t.expression)&&!e.isPrivateIdentifier(t.name))return t.name;t=t.expression;}while(79!==t.kind);return t}}(l):void 0,p=d&&qi(d,67108863,!0,!0,u);(p||c)&&F(p||c);var f=r.tracker.trackSymbol;if(r.tracker.trackSymbol=function(){return !1},o)_.push(e.factory.createExportAssignment(void 0,void 0,i,w(c,r,67108863)));else if(d===l&&d)H(n,e.idText(d));else if(l&&e.isClassExpression(l))H(n,ne(c,e.symbolName(c)));else {var g=te(n,t);A(e.factory.createImportEqualsDeclaration(void 0,void 0,!1,e.factory.createIdentifier(g),P(c,r,67108863,!1)),0),H(n,g);}return r.tracker.trackSymbol=f,!0}g=te(n,t);var m=rg($o(ca(t)));return Q(m,t)?O(m,t,g,o?0:1):A(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(g,void 0,J(r,m,t,u,F,a))],2)),c&&4&c.flags&&"export="===c.escapedName?2:n===g?1:0),o?(_.push(e.factory.createExportAssignment(void 0,void 0,i,e.factory.createIdentifier(g))),!0):n!==g&&(H(n,g),!0)}function Q(t,n){var i=e.getSourceFileOfNode(r.enclosingDeclaration);return 48&e.getObjectFlags(t)&&!e.length(al(t))&&!Xa(t)&&!(!e.length(e.filter(Nc(t),U))&&!e.length(el(t,0)))&&!e.length(el(t,1))&&!B(n,u)&&!(t.symbol&&e.some(t.symbol.declarations,(function(t){return e.getSourceFileOfNode(t)!==i})))&&!e.some(Nc(t),(function(e){return js(e.escapedName)}))&&!e.some(Nc(t),(function(t){return e.some(t.declarations,(function(t){return e.getSourceFileOfNode(t)!==i}))}))&&e.every(Nc(t),(function(t){return e.isIdentifierText(e.symbolName(t),q)}))}function X(t,n,i){return function(o,s,c){var l,_,d,p,f,g=e.getDeclarationModifierFlagsFromSymbol(o),y=!!(8&g);if(s&&2887656&o.flags)return [];if(4194304&o.flags||c&&Zc(c,o.escapedName)&&Kb(Zc(c,o.escapedName))===Kb(o)&&(16777216&o.flags)==(16777216&Zc(c,o.escapedName).flags)&&op($o(o),uo(c,o.escapedName)))return [];var v=-257&g|(s?32:0),h=R(o,r),b=null===(l=o.declarations)||void 0===l?void 0:l.find(e.or(e.isPropertyDeclaration,e.isAccessor,e.isVariableDeclaration,e.isPropertySignature,e.isBinaryExpression,e.isPropertyAccessExpression));if(98304&o.flags&&i){var x=[];if(65536&o.flags&&x.push(e.setTextRange(e.factory.createSetAccessorDeclaration(void 0,e.factory.createModifiersFromModifierFlags(v),h,[e.factory.createParameterDeclaration(void 0,void 0,void 0,"arg",void 0,y?void 0:J(r,$o(o),o,u,F,a))],void 0),(null===(_=o.declarations)||void 0===_?void 0:_.find(e.isSetAccessor))||b)),32768&o.flags){var D=8&g;x.push(e.setTextRange(e.factory.createGetAccessorDeclaration(void 0,e.factory.createModifiersFromModifierFlags(v),h,[],D?void 0:J(r,$o(o),o,u,F,a),void 0),(null===(d=o.declarations)||void 0===d?void 0:d.find(e.isGetAccessor))||b));}return x}if(98311&o.flags)return e.setTextRange(t(void 0,e.factory.createModifiersFromModifierFlags((Kb(o)?64:0)|v),h,16777216&o.flags?e.factory.createToken(57):void 0,y?void 0:J(r,$o(o),o,u,F,a),void 0),(null===(p=o.declarations)||void 0===p?void 0:p.find(e.or(e.isPropertyDeclaration,e.isVariableDeclaration)))||b);if(8208&o.flags){var S=el($o(o),0);if(8&v)return e.setTextRange(t(void 0,e.factory.createModifiersFromModifierFlags((Kb(o)?64:0)|v),h,16777216&o.flags?e.factory.createToken(57):void 0,void 0,void 0),(null===(f=o.declarations)||void 0===f?void 0:f.find(e.isFunctionLikeDeclaration))||S[0]&&S[0].declaration||o.declarations&&o.declarations[0]);for(var T=[],C=0,k=S;C<k.length;C++){var E=k[C],N=m(E,n,r,{name:h,questionToken:16777216&o.flags?e.factory.createToken(57):void 0,modifiers:v?e.factory.createModifiersFromModifierFlags(v):void 0}),A=E.declaration&&e.isPrototypePropertyAssignment(E.declaration.parent)?E.declaration.parent:E.declaration;T.push(e.setTextRange(N,A));}return T}return e.Debug.fail("Unhandled class member kind! ".concat(o.__debugFlags||o.flags))}}function Y(t,n,i,a){var o=el(n,t);if(1===t){if(!i&&e.every(o,(function(t){return 0===e.length(t.parameters)})))return [];if(i){var s=el(i,1);if(!e.length(s)&&e.every(o,(function(t){return 0===e.length(t.parameters)})))return [];if(s.length===o.length){for(var c=!1,l=0;l<s.length;l++)if(!of(o[l],s[l],!1,!1,!0,sp)){c=!0;break}if(!c)return []}}for(var u=0,_=0,d=o;_<d.length;_++){var p=d[_];p.declaration&&(u|=e.getSelectedEffectiveModifierFlags(p.declaration,24));}if(u)return [e.setTextRange(e.factory.createConstructorDeclaration(void 0,e.factory.createModifiersFromModifierFlags(u),[],void 0),o[0].declaration)]}for(var f=[],g=0,y=o;g<y.length;g++){var v=y[g],h=m(v,a,r);f.push(e.setTextRange(h,v.declaration));}return f}function Z(e,t){for(var n=[],i=0,a=al(e);i<a.length;i++){var o=a[i];if(t){var s=ol(t,o.keyType);if(s&&op(o.type,s.type))continue}n.push(g(o,r,void 0));}return n}function $(t,n){var i,a;if(t.target&&Oa(t.target.symbol,u,n)?(i=e.map(eu(t),(function(e){return l(e,r)})),a=w(t.target.symbol,r,788968)):t.symbol&&Oa(t.symbol,u,n)&&(a=w(t.symbol,r,788968)),a)return e.factory.createExpressionWithTypeArguments(a,i)}function ee(t){return $(t,788968)||(t.symbol?e.factory.createExpressionWithTypeArguments(w(t.symbol,r,788968),void 0):void 0)}function te(e,t){var n,i,a=t?M(t):void 0;if(a&&r.remappedSymbolNames.has(a))return r.remappedSymbolNames.get(a);t&&(e=re(t,e));for(var o=0,s=e;null===(n=r.usedSymbolNames)||void 0===n?void 0:n.has(e);)o++,e="".concat(s,"_").concat(o);return null===(i=r.usedSymbolNames)||void 0===i||i.add(e),a&&r.remappedSymbolNames.set(a,e),e}function re(t,n){if("default"===n||"__class"===n||"__function"===n){var i=r.flags;r.flags|=16777216;var a=ro(t,r);r.flags=i,n=a.length>0&&e.isSingleOrDoubleQuote(a.charCodeAt(0))?e.stripQuotes(a):a;}return "default"===n?n="_default":"export="===n&&(n="_exports"),e.isIdentifierText(n,q)&&!e.isStringANonContextualKeyword(n)?n:"_"+n.replace(/[^a-zA-Z0-9]/g,"_")}function ne(e,t){var n=M(e);return r.remappedSymbolNames.has(n)?r.remappedSymbolNames.get(n):(t=re(e,t),r.remappedSymbolNames.set(n,t),t)}}(t,r,u)}))}};function a(r,n,i,a){var s,c;e.Debug.assert(void 0===r||0==(8&r.flags));var l={enclosingDeclaration:r,flags:n||0,tracker:i&&i.trackSymbol?i:{trackSymbol:function(){return !1},moduleResolverHost:134217728&n?{getCommonSourceDirectory:t.getCommonSourceDirectory?function(){return t.getCommonSourceDirectory()}:function(){return ""},getCurrentDirectory:function(){return t.getCurrentDirectory()},getSymlinkCache:e.maybeBind(t,t.getSymlinkCache),getPackageJsonInfoCache:function(){var e;return null===(e=t.getPackageJsonInfoCache)||void 0===e?void 0:e.call(t)},useCaseSensitiveFileNames:e.maybeBind(t,t.useCaseSensitiveFileNames),redirectTargetsMap:t.redirectTargetsMap,getProjectReferenceRedirect:function(e){return t.getProjectReferenceRedirect(e)},isSourceOfProjectReferenceRedirect:function(e){return t.isSourceOfProjectReferenceRedirect(e)},fileExists:function(e){return t.fileExists(e)},getFileIncludeReasons:function(){return t.getFileIncludeReasons()},readFile:t.readFile?function(e){return t.readFile(e)}:void 0}:void 0},encounteredError:!1,reportedDiagnostic:!1,visitedTypes:void 0,symbolDepth:void 0,inferTypeParameters:void 0,approximateLength:0};l.tracker=o(l,l.tracker);var u=a(l);return l.truncating&&1&l.flags&&(null===(c=null===(s=l.tracker)||void 0===s?void 0:s.reportTruncationError)||void 0===c||c.call(s)),l.encounteredError?void 0:u}function o(e,t){var r=t.trackSymbol;return i$1(i$1({},t),{reportCyclicStructureError:n(t.reportCyclicStructureError),reportInaccessibleThisError:n(t.reportInaccessibleThisError),reportInaccessibleUniqueSymbolError:n(t.reportInaccessibleUniqueSymbolError),reportLikelyUnsafeImportRequiredError:n(t.reportLikelyUnsafeImportRequiredError),reportNonlocalAugmentation:n(t.reportNonlocalAugmentation),reportPrivateInBaseOfClassExpression:n(t.reportPrivateInBaseOfClassExpression),reportNonSerializableProperty:n(t.reportNonSerializableProperty),trackSymbol:r&&function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=r.apply(void 0,t);return i&&(e.reportedDiagnostic=!0),i}});function n(t){return t?function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.reportedDiagnostic=!0,t.apply(void 0,r)}:t}}function s(t){return t.truncating?t.truncating:t.truncating=t.approximateLength>(1&t.flags?e.noTruncationMaximumTruncationLength:e.defaultMaximumTruncationLength)}function l(t,n){r&&r.throwIfCancellationRequested&&r.throwIfCancellationRequested();var i=8388608&n.flags;if(n.flags&=-8388609,!t)return 262144&n.flags?(n.approximateLength+=3,e.factory.createKeywordTypeNode(130)):void(n.encounteredError=!0);if(536870912&n.flags||(t=Hc(t)),1&t.flags)return t.aliasSymbol?e.factory.createTypeReferenceNode(E(t.aliasSymbol),f(t.aliasTypeArguments,n)):t===Je?e.addSyntheticLeadingComment(e.factory.createKeywordTypeNode(130),3,"unresolved"):(n.approximateLength+=3,e.factory.createKeywordTypeNode(t===Ke?138:130));if(2&t.flags)return e.factory.createKeywordTypeNode(155);if(4&t.flags)return n.approximateLength+=6,e.factory.createKeywordTypeNode(150);if(8&t.flags)return n.approximateLength+=6,e.factory.createKeywordTypeNode(147);if(64&t.flags)return n.approximateLength+=6,e.factory.createKeywordTypeNode(158);if(16&t.flags&&!t.aliasSymbol)return n.approximateLength+=7,e.factory.createKeywordTypeNode(133);if(1024&t.flags&&!(1048576&t.flags)){var a=ua(t.symbol),o=N(a,n,788968);if(Es(a)===t)return o;var c=e.symbolName(t.symbol);return e.isIdentifierText(c,0)?q(o,e.factory.createTypeReferenceNode(c,void 0)):e.isImportTypeNode(o)?(o.isTypeOf=!0,e.factory.createIndexedAccessTypeNode(o,e.factory.createLiteralTypeNode(e.factory.createStringLiteral(c)))):e.isTypeReferenceNode(o)?e.factory.createIndexedAccessTypeNode(e.factory.createTypeQueryNode(o.typeName),e.factory.createLiteralTypeNode(e.factory.createStringLiteral(c))):e.Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.")}if(1056&t.flags)return N(t.symbol,n,788968);if(128&t.flags)return n.approximateLength+=t.value.length+2,e.factory.createLiteralTypeNode(e.setEmitFlags(e.factory.createStringLiteral(t.value,!!(268435456&n.flags)),16777216));if(256&t.flags){var d=t.value;return n.approximateLength+=(""+d).length,e.factory.createLiteralTypeNode(d<0?e.factory.createPrefixUnaryExpression(40,e.factory.createNumericLiteral(-d)):e.factory.createNumericLiteral(d))}if(2048&t.flags)return n.approximateLength+=e.pseudoBigIntToString(t.value).length+1,e.factory.createLiteralTypeNode(e.factory.createBigIntLiteral(t.value));if(512&t.flags)return n.approximateLength+=t.intrinsicName.length,e.factory.createLiteralTypeNode("true"===t.intrinsicName?e.factory.createTrue():e.factory.createFalse());if(8192&t.flags){if(!(1048576&n.flags)){if(Ia(t.symbol,n.enclosingDeclaration))return n.approximateLength+=6,N(t.symbol,n,111551);n.tracker.reportInaccessibleUniqueSymbolError&&n.tracker.reportInaccessibleUniqueSymbolError();}return n.approximateLength+=13,e.factory.createTypeOperatorNode(154,e.factory.createKeywordTypeNode(151))}if(16384&t.flags)return n.approximateLength+=4,e.factory.createKeywordTypeNode(114);if(32768&t.flags)return n.approximateLength+=9,e.factory.createKeywordTypeNode(153);if(65536&t.flags)return n.approximateLength+=4,e.factory.createLiteralTypeNode(e.factory.createNull());if(131072&t.flags)return n.approximateLength+=5,e.factory.createKeywordTypeNode(143);if(4096&t.flags)return n.approximateLength+=6,e.factory.createKeywordTypeNode(151);if(67108864&t.flags)return n.approximateLength+=6,e.factory.createKeywordTypeNode(148);if(e.isThisTypeParameter(t))return 4194304&n.flags&&(n.encounteredError||32768&n.flags||(n.encounteredError=!0),n.tracker.reportInaccessibleThisError&&n.tracker.reportInaccessibleThisError()),n.approximateLength+=4,e.factory.createThisTypeNode();if(!i&&t.aliasSymbol&&(16384&n.flags||wa(t.aliasSymbol,n.enclosingDeclaration))){var v=f(t.aliasTypeArguments,n);return !Sa(t.aliasSymbol.escapedName)||32&t.aliasSymbol.flags?N(t.aliasSymbol,n,788968,v):e.factory.createTypeReferenceNode(e.factory.createIdentifier(""),v)}var h=e.getObjectFlags(t);if(4&h)return e.Debug.assert(!!(524288&t.flags)),t.node?K(t,V):V(t);if(262144&t.flags||3&h){if(262144&t.flags&&e.contains(n.inferTypeParameters,t)){n.approximateLength+=e.symbolName(t.symbol).length+6;var b=void 0,x=Ac(t);if(x){var D=ql(t,!0);D&&op(x,D)||(n.approximateLength+=9,b=x&&l(x,n));}return e.factory.createInferTypeNode(y(t,n,b))}if(4&n.flags&&262144&t.flags&&!wa(t.symbol,n.enclosingDeclaration)){var S=A(t,n);return n.approximateLength+=e.idText(S).length,e.factory.createTypeReferenceNode(e.factory.createIdentifier(e.idText(S)),void 0)}if(t.symbol)return N(t.symbol,n,788968);var T=(t===wt||t===It)&&_&&_.symbol?(t===It?"sub-":"super-")+e.symbolName(_.symbol):"?";return e.factory.createTypeReferenceNode(e.factory.createIdentifier(T),void 0)}if(1048576&t.flags&&t.origin&&(t=t.origin),3145728&t.flags){var C=1048576&t.flags?function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e[n];if(r|=i.flags,!(98304&i.flags)){if(1536&i.flags){var a=512&i.flags?it:Ss(i);if(1048576&a.flags){var o=a.types.length;if(n+o<=e.length&&md(e[n+o-1])===md(a.types[o-1])){t.push(a),n+=o-1;continue}}}t.push(i);}}return 65536&r&&t.push(Qe),32768&r&&t.push(qe),t||e}(t.types):t.types;if(1===e.length(C))return l(C[0],n);var k=f(C,n,!0);return k&&k.length>0?1048576&t.flags?e.factory.createUnionTypeNode(k):e.factory.createIntersectionTypeNode(k):void(n.encounteredError||262144&n.flags||(n.encounteredError=!0))}if(48&h)return e.Debug.assert(!!(524288&t.flags)),z(t);if(4194304&t.flags){var F=t.type;n.approximateLength+=6;var P=l(F,n);return e.factory.createTypeOperatorNode(140,P)}if(134217728&t.flags){var w=t.texts,I=t.types,L=e.factory.createTemplateHead(w[0]),R=e.factory.createNodeArray(e.map(I,(function(t,r){return e.factory.createTemplateLiteralTypeSpan(l(t,n),(r<I.length-1?e.factory.createTemplateMiddle:e.factory.createTemplateTail)(w[r+1]))})));return n.approximateLength+=2,e.factory.createTemplateLiteralType(L,R)}if(268435456&t.flags){var B=l(t.type,n);return N(t.symbol,n,788968,[B])}if(8388608&t.flags){var j=l(t.objectType,n);return P=l(t.indexType,n),n.approximateLength+=2,e.factory.createIndexedAccessTypeNode(j,P)}return 16777216&t.flags?K(t,(function(t){return function(t){var r=l(t.checkType,n);if(n.approximateLength+=15,4&n.flags&&t.root.isDistributive&&!(262144&t.checkType.flags)){var i=Da(Hn(262144,"T")),a=A(i,n),o=e.factory.createTypeReferenceNode(a);n.approximateLength+=37;var s=jd(t.root.checkType,i,t.combinedMapper||t.mapper),c=n.inferTypeParameters;n.inferTypeParameters=t.root.inferTypeParameters;var u=l(Yd(t.root.extendsType,s),n);n.inferTypeParameters=c;var _=J(Yd(kd(t.root.node.trueType),s)),d=J(Yd(kd(t.root.node.falseType),s));return e.factory.createConditionalTypeNode(r,e.factory.createInferTypeNode(e.factory.createTypeParameterDeclaration(void 0,e.factory.cloneNode(o.typeName))),e.factory.createConditionalTypeNode(e.factory.createTypeReferenceNode(e.factory.cloneNode(a)),l(t.checkType,n),e.factory.createConditionalTypeNode(o,u,_,d),e.factory.createKeywordTypeNode(143)),e.factory.createKeywordTypeNode(143))}var p=n.inferTypeParameters;n.inferTypeParameters=t.root.inferTypeParameters;var f=l(t.extendsType,n);n.inferTypeParameters=p;var g=J($_(t)),m=J(ed(t));return e.factory.createConditionalTypeNode(r,f,g,m)}(t)})):33554432&t.flags?l(t.baseType,n):e.Debug.fail("Should be unreachable.");function J(e){var t,r,i;return 1048576&e.flags?(null===(t=n.visitedTypes)||void 0===t?void 0:t.has(Zu(e)))?(131072&n.flags||(n.encounteredError=!0,null===(i=null===(r=n.tracker)||void 0===r?void 0:r.reportCyclicStructureError)||void 0===i||i.call(r)),u(n)):K(e,(function(e){return l(e,n)})):l(e,n)}function z(t){var r,i=t.id,a=t.symbol;if(a){var o=Xa(t)?788968:111551;if(Gh(a.valueDeclaration))return N(a,n,o);if(32&a.flags&&!Ho(a)&&!(a.valueDeclaration&&226===a.valueDeclaration.kind&&2048&n.flags)||896&a.flags||function(){var t,r=!!(8192&a.flags)&&e.some(a.declarations,(function(t){return e.isStatic(t)})),o=!!(16&a.flags)&&(a.parent||e.forEach(a.declarations,(function(e){return 305===e.parent.kind||262===e.parent.kind})));if(r||o)return (!!(4096&n.flags)||(null===(t=n.visitedTypes)||void 0===t?void 0:t.has(i)))&&(!(8&n.flags)||Ia(a,n.enclosingDeclaration))}())return N(a,n,o);if(null===(r=n.visitedTypes)||void 0===r?void 0:r.has(i)){var s=function(t){if(t.symbol&&2048&t.symbol.flags&&t.symbol.declarations){var r=e.walkUpParenthesizedTypes(t.symbol.declarations[0].parent);if(259===r.kind)return la(r)}}(t);return s?N(s,n,788968):u(n)}return K(t,U)}return U(t)}function K(t,r){var i,a,o=t.id,s=16&e.getObjectFlags(t)&&t.symbol&&32&t.symbol.flags,c=4&e.getObjectFlags(t)&&t.node?"N"+O(t.node):16777216&t.flags?"N"+O(t.root.node):t.symbol?(s?"+":"")+M(t.symbol):void 0;n.visitedTypes||(n.visitedTypes=new e.Set),c&&!n.symbolDepth&&(n.symbolDepth=new e.Map);var l=n.enclosingDeclaration&&ni(n.enclosingDeclaration),_="".concat(Zu(t),"|").concat(n.flags);l&&(l.serializedTypes||(l.serializedTypes=new e.Map));var d,p=null===(i=null==l?void 0:l.serializedTypes)||void 0===i?void 0:i.get(_);if(p)return p.truncating&&(n.truncating=!0),n.approximateLength+=p.addedLength,function t(r){return e.nodeIsSynthesized(r)||e.getParseTreeNode(r)!==r?e.setTextRange(e.factory.cloneNode(e.visitEachChild(r,t,e.nullTransformationContext,y)),r):r}(p);if(c){if((d=n.symbolDepth.get(c)||0)>10)return u(n);n.symbolDepth.set(c,d+1);}n.visitedTypes.add(o);var f=n.approximateLength,g=r(t),m=n.approximateLength-f;return n.reportedDiagnostic||n.encounteredError||(n.truncating&&(g.truncating=!0),g.addedLength=m,null===(a=null==l?void 0:l.serializedTypes)||void 0===a||a.set(_,g)),n.visitedTypes.delete(o),c&&n.symbolDepth.set(c,d),g;function y(t,r,n,i,a){return t&&0===t.length?e.setTextRange(e.factory.createNodeArray(void 0,t.hasTrailingComma),t):e.visitNodes(t,r,n,i,a)}}function U(t){if(Sc(t)||t.containsError)return function(t){e.Debug.assert(!!(524288&t.flags));var r,i,a=t.declaration.readonlyToken?e.factory.createToken(t.declaration.readonlyToken.kind):void 0,o=t.declaration.questionToken?e.factory.createToken(t.declaration.questionToken.kind):void 0;if(vc(t)){if(!(262144&hc(t).flags)&&4&n.flags){var s=A(Da(Hn(262144,"T")),n);i=e.factory.createTypeReferenceNode(s);}r=e.factory.createTypeOperatorNode(140,i||l(hc(t),n));}else r=l(fc(t),n);var c=y(pc(t),n,r),u=t.declaration.nameType?l(gc(t),n):void 0,_=l(qf(mc(t),!!(4&bc(t))),n),d=e.factory.createMappedTypeNode(a,c,u,o,_,void 0);n.approximateLength+=10;var p=e.setEmitFlags(d,1);return vc(t)&&!(262144&hc(t).flags)&&4&n.flags?e.factory.createConditionalTypeNode(l(hc(t),n),e.factory.createInferTypeNode(e.factory.createTypeParameterDeclaration(void 0,e.factory.cloneNode(i.typeName))),p,e.factory.createKeywordTypeNode(143)):p}(t);var r=Tc(t);if(!r.properties.length&&!r.indexInfos.length){if(!r.callSignatures.length&&!r.constructSignatures.length)return n.approximateLength+=2,e.setEmitFlags(e.factory.createTypeLiteralNode(void 0),1);if(1===r.callSignatures.length&&!r.constructSignatures.length)return m(r.callSignatures[0],179,n);if(1===r.constructSignatures.length&&!r.callSignatures.length)return m(r.constructSignatures[0],180,n)}var i=e.filter(r.constructSignatures,(function(e){return !!(4&e.flags)}));if(e.some(i)){var a=e.map(i,Rl);return r.callSignatures.length+(r.constructSignatures.length-i.length)+r.indexInfos.length+(2048&n.flags?e.countWhere(r.properties,(function(e){return !(4194304&e.flags)})):e.length(r.properties))&&a.push(function(t){if(0===t.constructSignatures.length)return t;if(t.objectTypeWithoutAbstractConstructSignatures)return t.objectTypeWithoutAbstractConstructSignatures;var r=e.filter(t.constructSignatures,(function(e){return !(4&e.flags)}));if(t.constructSignatures===r)return t;var n=Ea(t.symbol,t.members,t.callSignatures,e.some(r)?r:e.emptyArray,t.indexInfos);return t.objectTypeWithoutAbstractConstructSignatures=n,n.objectTypeWithoutAbstractConstructSignatures=n,n}(r)),l(p_(a),n)}var o=n.flags;n.flags|=4194304;var c=function(t){if(s(n))return [e.factory.createPropertySignature(void 0,"...",void 0,void 0)];for(var r=[],i=0,a=t.callSignatures;i<a.length;i++){var o=a[i];r.push(m(o,174,n));}for(var c=0,l=t.constructSignatures;c<l.length;c++)4&(o=l[c]).flags||r.push(m(o,175,n));for(var _=0,d=t.indexInfos;_<d.length;_++){var f=d[_];r.push(g(f,n,1024&t.objectFlags?u(n):void 0));}var y=t.properties;if(!y)return r;for(var v=0,h=0,b=y;h<b.length;h++){var x=b[h];if(v++,2048&n.flags){if(4194304&x.flags)continue;24&e.getDeclarationModifierFlagsFromSymbol(x)&&n.tracker.reportPrivateInBaseOfClassExpression&&n.tracker.reportPrivateInBaseOfClassExpression(e.unescapeLeadingUnderscores(x.escapedName));}if(s(n)&&v+2<y.length-1){r.push(e.factory.createPropertySignature(void 0,"... ".concat(y.length-v," more ..."),void 0,void 0)),p(y[y.length-1],n,r);break}p(x,n,r);}return r.length?r:void 0}(r);n.flags=o;var _=e.factory.createTypeLiteralNode(c);return n.approximateLength+=2,e.setEmitFlags(_,1024&n.flags?0:1),_}function V(t){var r=eu(t);if(t.target===Kt||t.target===Ut){if(2&n.flags){var i=l(r[0],n);return e.factory.createTypeReferenceNode(t.target===Kt?"Array":"ReadonlyArray",[i])}var a=l(r[0],n),o=e.factory.createArrayTypeNode(a);return t.target===Kt?o:e.factory.createTypeOperatorNode(145,o)}if(!(8&t.target.objectFlags)){if(2048&n.flags&&t.symbol.valueDeclaration&&e.isClassLike(t.symbol.valueDeclaration)&&!Ia(t.symbol,n.enclosingDeclaration))return z(t);var s=t.target.outerTypeParameters,c=void(D=0);if(s)for(var u=s.length;D<u;){var _=D,d=Hl(s[D]);do{D++;}while(D<u&&Hl(s[D])===d);if(!e.rangeEquals(s,r,_,D)){var p=f(r.slice(_,D),n),g=n.flags;n.flags|=16;var m=N(d,n,788968,p);n.flags=g,c=c?q(c,m):m;}}var y=void 0;if(r.length>0){var v=(t.target.typeParameters||e.emptyArray).length;y=f(r.slice(D,v),n);}S=n.flags,n.flags|=16;var h=N(t.symbol,n,788968,y);return n.flags=S,c?q(c,h):h}if((r=e.sameMap(r,(function(e,r){return qf(e,!!(2&t.target.elementFlags[r]))}))).length>0){var b=tu(t),x=f(r.slice(0,b),n);if(x){if(t.target.labeledElementDeclarations)for(var D=0;D<x.length;D++){var S=t.target.elementFlags[D];x[D]=e.factory.createNamedTupleMember(12&S?e.factory.createToken(25):void 0,e.factory.createIdentifier(e.unescapeLeadingUnderscores(ub(t.target.labeledElementDeclarations[D]))),2&S?e.factory.createToken(57):void 0,4&S?e.factory.createArrayTypeNode(x[D]):x[D]);}else for(D=0;D<Math.min(b,x.length);D++){S=t.target.elementFlags[D];x[D]=12&S?e.factory.createRestTypeNode(4&S?e.factory.createArrayTypeNode(x[D]):x[D]):2&S?e.factory.createOptionalTypeNode(x[D]):x[D];}var T=e.setEmitFlags(e.factory.createTupleTypeNode(x),1);return t.target.readonly?e.factory.createTypeOperatorNode(145,T):T}}if(n.encounteredError||524288&n.flags)return T=e.setEmitFlags(e.factory.createTupleTypeNode([]),1),t.target.readonly?e.factory.createTypeOperatorNode(145,T):T;n.encounteredError=!0;}function q(t,r){if(e.isImportTypeNode(t)){var n=t.typeArguments,i=t.qualifier;i&&(i=e.isIdentifier(i)?e.factory.updateIdentifier(i,n):e.factory.updateQualifiedName(i,i.left,e.factory.updateIdentifier(i.right,n))),n=r.typeArguments;for(var a=0,o=W(r);a<o.length;a++){var s=o[a];i=i?e.factory.createQualifiedName(i,s):s;}return e.factory.updateImportTypeNode(t,t.argument,i,n,t.isTypeOf)}n=t.typeArguments;var c=t.typeName;c=e.isIdentifier(c)?e.factory.updateIdentifier(c,n):e.factory.updateQualifiedName(c,c.left,e.factory.updateIdentifier(c.right,n)),n=r.typeArguments;for(var l=0,u=W(r);l<u.length;l++)s=u[l],c=e.factory.createQualifiedName(c,s);return e.factory.updateTypeReferenceNode(t,c,n)}function W(t){for(var r=t.typeName,n=[];!e.isIdentifier(r);)n.unshift(r.right),r=r.left;return n.unshift(r),n}}function u(t){return t.approximateLength+=3,1&t.flags?e.factory.createKeywordTypeNode(130):e.factory.createTypeReferenceNode(e.factory.createIdentifier("..."),void 0)}function d(t,r){var n;return !!(8192&e.getCheckFlags(t))&&(e.contains(r.reverseMappedStack,t)||(null===(n=r.reverseMappedStack)||void 0===n?void 0:n[0])&&!(16&e.getObjectFlags(e.last(r.reverseMappedStack).propertyType)))}function p(t,r,n){var i,a,o=!!(8192&e.getCheckFlags(t)),s=d(t,r)?Le:es(t),c=r.enclosingDeclaration;if(r.enclosingDeclaration=void 0,r.tracker.trackSymbol&&4096&e.getCheckFlags(t)&&js(t.escapedName))if(t.declarations){var l=e.first(t.declarations);if(Js(l))if(e.isBinaryExpression(l)){var _=e.getNameOfDeclaration(l);_&&e.isElementAccessExpression(_)&&e.isPropertyAccessEntityNameExpression(_.argumentExpression)&&b(_.argumentExpression,c,r);}else b(l.name.expression,c,r);}else (null===(i=r.tracker)||void 0===i?void 0:i.reportNonSerializableProperty)&&r.tracker.reportNonSerializableProperty(Ua(t));r.enclosingDeclaration=t.valueDeclaration||(null===(a=t.declarations)||void 0===a?void 0:a[0])||c;var p=R(t,r);r.enclosingDeclaration=c,r.approximateLength+=e.symbolName(t).length+1;var f=16777216&t.flags?e.factory.createToken(57):void 0;if(8208&t.flags&&!Cc(s).length&&!Kb(t))for(var g=0,y=el(km(s,(function(e){return !(32768&e.flags)})),0);g<y.length;g++){var v=m(y[g],168,r,{name:p,questionToken:f});n.push(S(v));}else {var h=void 0;d(t,r)?h=u(r):(o&&(r.reverseMappedStack||(r.reverseMappedStack=[]),r.reverseMappedStack.push(t)),h=s?J(r,s,t,c):e.factory.createKeywordTypeNode(130),o&&r.reverseMappedStack.pop());var x=Kb(t)?[e.factory.createToken(145)]:void 0;x&&(r.approximateLength+=9);var D=e.factory.createPropertySignature(x,p,f,h);n.push(S(D));}function S(r){var n;if(e.some(t.declarations,(function(e){return 347===e.kind}))){var i=null===(n=t.declarations)||void 0===n?void 0:n.find((function(e){return 347===e.kind})),a=e.getTextOfJSDocComment(i.comment);a&&e.setSyntheticLeadingComments(r,[{kind:3,text:"*\n * "+a.replace(/\n/g,"\n * ")+"\n ",pos:-1,end:-1,hasTrailingNewLine:!0}]);}else t.valueDeclaration&&e.setCommentRange(r,t.valueDeclaration);return r}}function f(t,r,n){if(e.some(t)){if(s(r)){if(!n)return [e.factory.createTypeReferenceNode("...",void 0)];if(t.length>2)return [l(t[0],r),e.factory.createTypeReferenceNode("... ".concat(t.length-2," more ..."),void 0),l(t[t.length-1],r)]}for(var i=64&r.flags?void 0:e.createUnderscoreEscapedMultiMap(),a=[],o=0,c=0,u=t;c<u.length;c++){var _=u[c];if(o++,s(r)&&o+2<t.length-1){a.push(e.factory.createTypeReferenceNode("... ".concat(t.length-o," more ..."),void 0));var d=l(t[t.length-1],r);d&&a.push(d);break}r.approximateLength+=2;var p=l(_,r);p&&(a.push(p),i&&e.isIdentifierTypeReference(p)&&i.add(p.typeName.escapedText,[_,a.length-1]));}if(i){var f=r.flags;r.flags|=64,i.forEach((function(t){if(!e.arrayIsHomogeneous(t,(function(e,t){return r=e[0],n=t[0],r===n||!!r.symbol&&r.symbol===n.symbol||!!r.aliasSymbol&&r.aliasSymbol===n.aliasSymbol;var r,n;})))for(var n=0,i=t;n<i.length;n++){var o=i[n],s=o[0],c=o[1];a[c]=l(s,r);}})),r.flags=f;}return a}}function g(t,r,n){var i=e.getNameFromIndexInfo(t)||"x",a=l(t.keyType,r),o=e.factory.createParameterDeclaration(void 0,void 0,void 0,i,void 0,a,void 0);return n||(n=l(t.type||Le,r)),t.type||2097152&r.flags||(r.encounteredError=!0),r.approximateLength+=i.length+4,e.factory.createIndexSignature(void 0,t.isReadonly?[e.factory.createToken(145)]:void 0,[o],n)}function m(t,r,n,i){var a,o,s,c,u,_,d=256&n.flags;d&&(n.flags&=-257),n.approximateLength+=3,32&n.flags&&t.target&&t.mapper&&t.target.typeParameters?_=t.target.typeParameters.map((function(e){return l(Yd(e,t.mapper),n)})):u=t.typeParameters&&t.typeParameters.map((function(e){return v(e,n)}));var p,f=$s(t,!0)[0],g=(e.some(f,(function(t){return t!==f[f.length-1]&&!!(32768&e.getCheckFlags(t))}))?t.parameters:f).map((function(e){return h(e,n,171===r,null==i?void 0:i.privateSymbolVisitor,null==i?void 0:i.bundledImports)})),m=function(t,r){if(t.thisParameter)return h(t.thisParameter,r);if(t.declaration){var n=e.getJSDocThisTag(t.declaration);if(n&&n.typeExpression)return e.factory.createParameterDeclaration(void 0,void 0,void 0,"this",void 0,l(kd(n.typeExpression),r))}}(t,n);m&&g.unshift(m);var y=kl(t);if(y){var b=2===y.kind||3===y.kind?e.factory.createToken(128):void 0,x=1===y.kind||3===y.kind?e.setEmitFlags(e.factory.createIdentifier(y.parameterName),16777216):e.factory.createThisTypeNode(),D=y.type&&l(y.type,n);p=e.factory.createTypePredicateNode(b,x,D);}else {var S=Nl(t);!S||d&&_o(S)?d||(p=e.factory.createKeywordTypeNode(130)):p=function(t,r,n,i,a){if(!po(r)&&t.enclosingDeclaration){var o=n.declaration&&e.getEffectiveReturnTypeNode(n.declaration);if(e.findAncestor(o,(function(e){return e===t.enclosingDeclaration}))&&o){var s=kd(o);if((262144&s.flags&&s.isThisType?Yd(s,n.mapper):s)===r&&j(o,r)){var c=K(t,o,i,a);if(c)return c}}}return l(r,t)}(n,S,t,null==i?void 0:i.privateSymbolVisitor,null==i?void 0:i.bundledImports);}var T=null==i?void 0:i.modifiers;if(180===r&&4&t.flags){var C=e.modifiersToFlags(T);T=e.factory.createModifiersFromModifierFlags(128|C);}var k=174===r?e.factory.createCallSignature(u,g,p):175===r?e.factory.createConstructSignature(u,g,p):168===r?e.factory.createMethodSignature(T,null!==(a=null==i?void 0:i.name)&&void 0!==a?a:e.factory.createIdentifier(""),null==i?void 0:i.questionToken,u,g,p):169===r?e.factory.createMethodDeclaration(void 0,T,void 0,null!==(o=null==i?void 0:i.name)&&void 0!==o?o:e.factory.createIdentifier(""),void 0,u,g,p,void 0):171===r?e.factory.createConstructorDeclaration(void 0,T,g,void 0):172===r?e.factory.createGetAccessorDeclaration(void 0,T,null!==(s=null==i?void 0:i.name)&&void 0!==s?s:e.factory.createIdentifier(""),g,p,void 0):173===r?e.factory.createSetAccessorDeclaration(void 0,T,null!==(c=null==i?void 0:i.name)&&void 0!==c?c:e.factory.createIdentifier(""),g,void 0):176===r?e.factory.createIndexSignature(void 0,T,g,p):317===r?e.factory.createJSDocFunctionType(g,p):179===r?e.factory.createFunctionTypeNode(u,g,null!=p?p:e.factory.createTypeReferenceNode(e.factory.createIdentifier(""))):180===r?e.factory.createConstructorTypeNode(T,u,g,null!=p?p:e.factory.createTypeReferenceNode(e.factory.createIdentifier(""))):256===r?e.factory.createFunctionDeclaration(void 0,T,void 0,(null==i?void 0:i.name)?e.cast(i.name,e.isIdentifier):e.factory.createIdentifier(""),u,g,p,void 0):213===r?e.factory.createFunctionExpression(T,void 0,(null==i?void 0:i.name)?e.cast(i.name,e.isIdentifier):e.factory.createIdentifier(""),u,g,p,e.factory.createBlock([])):214===r?e.factory.createArrowFunction(T,u,g,p,void 0,e.factory.createBlock([])):e.Debug.assertNever(r);return _&&(k.typeArguments=e.factory.createNodeArray(_)),k}function y(t,r,n){var i=r.flags;r.flags&=-513;var a=e.factory.createModifiersFromModifierFlags(Gp(t)),o=A(t,r),s=Jc(t),c=s&&l(s,r);return r.flags=i,e.factory.createTypeParameterDeclaration(a,o,n,c)}function v(e,t,r){return void 0===r&&(r=Ac(e)),y(e,t,r&&l(r,t))}function h(t,r,n,i,a){var o=e.getDeclarationOfKind(t,164);o||e.isTransientSymbol(t)||(o=e.getDeclarationOfKind(t,340));var s=$o(t);o&&ET(o)&&(s=jf(s));var c=J(r,s,t,r.enclosingDeclaration,i,a),l=!(8192&r.flags)&&n&&o&&o.modifiers?o.modifiers.map(e.factory.cloneNode):void 0,u=o&&e.isRestParameter(o)||32768&e.getCheckFlags(t)?e.factory.createToken(25):void 0,_=o&&o.name?79===o.name.kind?e.setEmitFlags(e.factory.cloneNode(o.name),16777216):161===o.name.kind?e.setEmitFlags(e.factory.cloneNode(o.name.right),16777216):function t(n){r.tracker.trackSymbol&&e.isComputedPropertyName(n)&&Bs(n)&&b(n.expression,r.enclosingDeclaration,r);var i=e.visitEachChild(n,t,e.nullTransformationContext,void 0,t);return e.isBindingElement(i)&&(i=e.factory.updateBindingElement(i,i.dotDotDotToken,i.propertyName,i.name,void 0)),e.nodeIsSynthesized(i)||(i=e.factory.cloneNode(i)),e.setEmitFlags(i,16777217)}(o.name):e.symbolName(t),d=o&&gl(o)||16384&e.getCheckFlags(t)?e.factory.createToken(57):void 0,p=e.factory.createParameterDeclaration(void 0,l,u,_,d,c,void 0);return r.approximateLength+=e.symbolName(t).length+3,p}function b(t,r,n){if(n.tracker.trackSymbol){var i=e.getFirstIdentifier(t),a=li(i,i.escapedText,1160127,void 0,void 0,!0);a&&n.tracker.trackSymbol(a,r,111551);}}function x(e,t,r,n){return t.tracker.trackSymbol(e,t.enclosingDeclaration,r),D(e,t,r,n)}function D(t,r,n,i){var a;return 262144&t.flags||!(r.enclosingDeclaration||64&r.flags)||134217728&r.flags?a=[t]:(a=e.Debug.checkDefined(function t(n,a,o){var s,c=Aa(n,r.enclosingDeclaration,a,!!(128&r.flags));if(!c||Pa(c[0],r.enclosingDeclaration,1===c.length?a:Fa(a))){var l=_a(c?c[0]:n,r.enclosingDeclaration,a);if(e.length(l)){s=l.map((function(t){return e.some(t.declarations,Ja)?k(t,r):void 0}));var u=l.map((function(e,t){return t}));u.sort((function(t,r){var n=s[t],i=s[r];if(n&&i){var a=e.pathIsRelative(i);return e.pathIsRelative(n)===a?e.moduleSpecifiers.countPathComponents(n)-e.moduleSpecifiers.countPathComponents(i):a?-1:1}return 0}));for(var _=0,d=u.map((function(e){return l[e]}));_<d.length;_++){var p=d[_],f=t(p,Fa(a),!1);if(f){if(p.exports&&p.exports.get("export=")&&fa(p.exports.get("export="),n)){c=f;break}c=f.concat(c||[pa(p,n)||n]);break}}}}if(c)return c;if(o||!(6144&n.flags)){if(!o&&!i&&e.forEach(n.declarations,Ja))return;return [n]}}(t,n,!0)),e.Debug.assert(a&&a.length>0)),a}function S(t,r){var n;return 524384&TS(t).flags&&(n=e.factory.createNodeArray(e.map(ss(t),(function(e){return v(e,r)})))),n}function T(t,r,n){var i;e.Debug.assert(t&&0<=r&&r<t.length);var a=t[r],o=M(a);if(!(null===(i=n.typeParameterSymbolList)||void 0===i?void 0:i.has(o))){var s;if((n.typeParameterSymbolList||(n.typeParameterSymbolList=new e.Set)).add(o),512&n.flags&&r<t.length-1){var c=a,l=t[r+1];if(1&e.getCheckFlags(l)){var u=function(t){return e.concatenate(os(t),ss(t))}(2097152&c.flags?Ri(c):c);s=f(e.map(u,(function(e){return Id(e,l.mapper)})),n);}else s=S(a,n);}return s}}function C(t){return e.isIndexedAccessTypeNode(t.objectType)?C(t.objectType):t}function k(t,r,n){var a,o=e.getDeclarationOfKind(t,305);if(!o){var s=e.firstDefined(t.declarations,(function(e){return da(e,t)}));s&&(o=e.getDeclarationOfKind(s,305));}if(o&&void 0!==o.moduleName)return o.moduleName;if(!o){if(r.tracker.trackReferencedAmbientModule){var l=e.filter(t.declarations,e.isAmbientModule);if(e.length(l))for(var u=0,_=l;u<_.length;u++){var d=_[u];r.tracker.trackReferencedAmbientModule(d,t);}}if(c.test(t.escapedName))return t.escapedName.substring(1,t.escapedName.length-1)}if(!r.enclosingDeclaration||!r.tracker.moduleResolverHost)return c.test(t.escapedName)?t.escapedName.substring(1,t.escapedName.length-1):e.getSourceFileOfNode(e.getNonAugmentationDeclaration(t)).fileName;var p,f,g=e.getSourceFileOfNode(e.getOriginalNode(r.enclosingDeclaration)),m=n||(null==g?void 0:g.impliedNodeFormat),y=(p=g.path,void 0===(f=m)?p:"".concat(f,"|").concat(p)),v=ri(t),h=v.specifierCache&&v.specifierCache.get(y);if(!h){var b=!!e.outFile(V),x=r.tracker.moduleResolverHost,D=b?i$1(i$1({},V),{baseUrl:x.getCommonSourceDirectory()}):V;h=e.first(e.moduleSpecifiers.getModuleSpecifiers(t,fe,D,g,x,{importModuleSpecifierPreference:b?"non-relative":"project-relative",importModuleSpecifierEnding:b?"minimal":m===e.ModuleKind.ESNext?"js":void 0},{overrideImportMode:n})),null!==(a=v.specifierCache)&&void 0!==a||(v.specifierCache=new e.Map),v.specifierCache.set(y,h);}return h}function E(t){var r=e.factory.createIdentifier(e.unescapeLeadingUnderscores(t.escapedName));return t.parent?e.factory.createQualifiedName(E(t.parent),r):r}function N(t,r,n,i){var a,o,s,c,l=x(t,r,n,!(16384&r.flags)),u=111551===n;if(e.some(l[0].declarations,Ja)){var _=l.length>1?F(l,l.length-1,1):void 0,d=i||T(l,0,r),p=e.getSourceFileOfNode(e.getOriginalNode(r.enclosingDeclaration)),f=e.getSourceFileOfModule(l[0]),g=void 0,m=void 0;if(e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.Node16&&e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.NodeNext||(null==f?void 0:f.impliedNodeFormat)===e.ModuleKind.ESNext&&f.impliedNodeFormat!==(null==p?void 0:p.impliedNodeFormat)&&(g=k(l[0],r,e.ModuleKind.ESNext),m=e.factory.createImportTypeAssertionContainer(e.factory.createAssertClause(e.factory.createNodeArray([e.factory.createAssertEntry(e.factory.createStringLiteral("resolution-mode"),e.factory.createStringLiteral("import"))]))),null===(o=(a=r.tracker).reportImportTypeNodeResolutionModeOverride)||void 0===o||o.call(a)),g||(g=k(l[0],r)),!(67108864&r.flags)&&e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.Classic&&g.indexOf("/node_modules/")>=0){var y=g;if(e.getEmitModuleResolutionKind(V)===e.ModuleResolutionKind.Node16||e.getEmitModuleResolutionKind(V)===e.ModuleResolutionKind.NodeNext){var v=(null==p?void 0:p.impliedNodeFormat)===e.ModuleKind.ESNext?e.ModuleKind.CommonJS:e.ModuleKind.ESNext;(g=k(l[0],r,v)).indexOf("/node_modules/")>=0?g=y:(m=e.factory.createImportTypeAssertionContainer(e.factory.createAssertClause(e.factory.createNodeArray([e.factory.createAssertEntry(e.factory.createStringLiteral("resolution-mode"),e.factory.createStringLiteral(v===e.ModuleKind.ESNext?"import":"require"))]))),null===(c=(s=r.tracker).reportImportTypeNodeResolutionModeOverride)||void 0===c||c.call(s));}m||(r.encounteredError=!0,r.tracker.reportLikelyUnsafeImportRequiredError&&r.tracker.reportLikelyUnsafeImportRequiredError(y));}var h=e.factory.createLiteralTypeNode(e.factory.createStringLiteral(g));if(r.tracker.trackExternalModuleSymbolOfImportTypeNode&&r.tracker.trackExternalModuleSymbolOfImportTypeNode(l[0]),r.approximateLength+=g.length+10,!_||e.isEntityName(_))return _&&((E=e.isIdentifier(_)?_:_.right).typeArguments=void 0),e.factory.createImportTypeNode(h,m,_,d,u);var b=C(_),D=b.objectType.typeName;return e.factory.createIndexedAccessTypeNode(e.factory.createImportTypeNode(h,m,D,d,u),b.indexType)}var S=F(l,l.length-1,0);if(e.isIndexedAccessTypeNode(S))return S;if(u)return e.factory.createTypeQueryNode(S);var E,N=(E=e.isIdentifier(S)?S:S.right).typeArguments;return E.typeArguments=void 0,e.factory.createTypeReferenceNode(S,N);function F(t,n,a){var o,s=n===t.length-1?i:T(t,n,r),c=t[n],l=t[n-1];if(0===n)r.flags|=16777216,o=ro(c,r),r.approximateLength+=(o?o.length:0)+1,r.flags^=16777216;else if(l&&ia(l)){var u=ia(l);e.forEachEntry(u,(function(t,r){if(fa(t,c)&&!js(r)&&"export="!==r)return o=e.unescapeLeadingUnderscores(r),!0}));}if(void 0===o){var _=e.firstDefined(c.declarations,e.getNameOfDeclaration);if(_&&e.isComputedPropertyName(_)&&e.isEntityName(_.expression)){var d=F(t,n-1,a);return e.isEntityName(d)?e.factory.createIndexedAccessTypeNode(e.factory.createParenthesizedType(e.factory.createTypeQueryNode(d)),e.factory.createTypeQueryNode(_.expression)):d}o=ro(c,r);}if(r.approximateLength+=o.length+1,!(16&r.flags)&&l&&qs(l)&&qs(l).get(c.escapedName)&&fa(qs(l).get(c.escapedName),c))return d=F(t,n-1,a),e.isIndexedAccessTypeNode(d)?e.factory.createIndexedAccessTypeNode(d,e.factory.createLiteralTypeNode(e.factory.createStringLiteral(o))):e.factory.createIndexedAccessTypeNode(e.factory.createTypeReferenceNode(d,s),e.factory.createLiteralTypeNode(e.factory.createStringLiteral(o)));var p=e.setEmitFlags(e.factory.createIdentifier(o,s),16777216);return p.symbol=c,n>a?(d=F(t,n-1,a),e.isEntityName(d)?e.factory.createQualifiedName(d,p):e.Debug.fail("Impossible construct - an export of an indexed access cannot be reachable")):p}}function F(e,t,r){var n=li(t.enclosingDeclaration,e,788968,void 0,e,!1);return !(!n||262144&n.flags&&n===r.symbol)}function A(t,r){var n,i;if(4&r.flags&&r.typeParameterNames){var a=r.typeParameterNames.get(Zu(t));if(a)return a}var o=P(t.symbol,r,788968,!0);if(!(79&o.kind))return e.factory.createIdentifier("(Missing type parameter)");if(4&r.flags){for(var s=o.escapedText,c=(null===(n=r.typeParameterNamesByTextNextNameCount)||void 0===n?void 0:n.get(s))||0,l=s;(null===(i=r.typeParameterNamesByText)||void 0===i?void 0:i.has(l))||F(l,r,t);)c++,l="".concat(s,"_").concat(c);l!==s&&(o=e.factory.createIdentifier(l,o.typeArguments)),(r.typeParameterNamesByTextNextNameCount||(r.typeParameterNamesByTextNextNameCount=new e.Map)).set(s,c),(r.typeParameterNames||(r.typeParameterNames=new e.Map)).set(Zu(t),o),(r.typeParameterNamesByText||(r.typeParameterNamesByText=new e.Set)).add(s);}return o}function P(t,r,n,i){var a=x(t,r,n);return !i||1===a.length||r.encounteredError||65536&r.flags||(r.encounteredError=!0),function t(n,i){var a=T(n,i,r),o=n[i];0===i&&(r.flags|=16777216);var s=ro(o,r);0===i&&(r.flags^=16777216);var c=e.setEmitFlags(e.factory.createIdentifier(s,a),16777216);return c.symbol=o,i>0?e.factory.createQualifiedName(t(n,i-1),c):c}(a,a.length-1)}function w(t,r,n){var i=x(t,r,n);return function t(n,i){var a=T(n,i,r),o=n[i];0===i&&(r.flags|=16777216);var s=ro(o,r);0===i&&(r.flags^=16777216);var c=s.charCodeAt(0);if(e.isSingleOrDoubleQuote(c)&&e.some(o.declarations,Ja))return e.factory.createStringLiteral(k(o,r));var l=35===c?s.length>1&&e.isIdentifierStart(s.charCodeAt(1),q):e.isIdentifierStart(c,q);if(0===i||l){var u=e.setEmitFlags(e.factory.createIdentifier(s,a),16777216);return u.symbol=o,i>0?e.factory.createPropertyAccessExpression(t(n,i-1),u):u}91===c&&(c=(s=s.substring(1,s.length-1)).charCodeAt(0));var _=void 0;return !e.isSingleOrDoubleQuote(c)||8&o.flags?""+ +s===s&&(_=e.factory.createNumericLiteral(+s)):_=e.factory.createStringLiteral(e.stripQuotes(s).replace(/\\./g,(function(e){return e.substring(1)})),39===c),_||((_=e.setEmitFlags(e.factory.createIdentifier(s,a),16777216)).symbol=o),e.factory.createElementAccessExpression(t(n,i-1),_)}(i,i.length-1)}function I(t){var r=e.getNameOfDeclaration(t);return !!r&&e.isStringLiteral(r)}function L(t){var r=e.getNameOfDeclaration(t);return !!(r&&e.isStringLiteral(r)&&(r.singleQuote||!e.nodeIsSynthesized(r)&&e.startsWith(e.getTextOfNode(r,!1),"'")))}function R(t,r){var n=!!e.length(t.declarations)&&e.every(t.declarations,L),i=function(t,r,n){var i=ri(t).nameType;if(i){if(384&i.flags){var a=""+i.value;return e.isIdentifierText(a,e.getEmitScriptTarget(V))||e.isNumericLiteralName(a)?e.isNumericLiteralName(a)&&e.startsWith(a,"-")?e.factory.createComputedPropertyName(e.factory.createNumericLiteral(+a)):e.createPropertyNameNodeForIdentifierOrLiteral(a,e.getEmitScriptTarget(V)):e.factory.createStringLiteral(a,!!n)}if(8192&i.flags)return e.factory.createComputedPropertyName(w(i.symbol,r,111551))}}(t,r,n);if(i)return i;var a=e.unescapeLeadingUnderscores(t.escapedName),o=!!e.length(t.declarations)&&e.every(t.declarations,I);return e.createPropertyNameNodeForIdentifierOrLiteral(a,e.getEmitScriptTarget(V),n,o)}function B(t,r){return t.declarations&&e.find(t.declarations,(function(t){return !(!e.getEffectiveTypeAnnotationNode(t)||r&&!e.findAncestor(t,(function(e){return e===r})))}))}function j(t,r){return !(4&e.getObjectFlags(r))||!e.isTypeReferenceNode(t)||e.length(t.typeArguments)>=vl(r.target.typeParameters)}function J(t,r,n,i,a,o){if(!po(r)&&i){var s=B(n,i);if(s&&!e.isFunctionLikeDeclaration(s)&&!e.isGetAccessorDeclaration(s)){var c=e.getEffectiveTypeAnnotationNode(s);if(function(t,r,n){var i=kd(t);return i===n||!(!e.isParameter(r)||!r.questionToken)&&om(n,524288)===i}(c,s,r)&&j(c,r)){var u=K(t,c,a,o);if(u)return u}}}var _=t.flags;8192&r.flags&&r.symbol===n&&(!t.enclosingDeclaration||e.some(n.declarations,(function(r){return e.getSourceFileOfNode(r)===e.getSourceFileOfNode(t.enclosingDeclaration)})))&&(t.flags|=1048576);var d=l(r,t);return t.flags=_,d}function z(t,r,n){var i,a,o=!1,s=e.getFirstIdentifier(t);if(e.isInJSFile(t)&&(e.isExportsIdentifier(s)||e.isModuleExportsAccessExpression(s.parent)||e.isQualifiedName(s.parent)&&e.isModuleIdentifier(s.parent.left)&&e.isExportsIdentifier(s.parent.right)))return {introducesError:o=!0,node:t};var c=qi(s,67108863,!0,!0);if(c&&(0!==La(c,r.enclosingDeclaration,67108863,!1).accessibility?o=!0:(null===(a=null===(i=r.tracker)||void 0===i?void 0:i.trackSymbol)||void 0===a||a.call(i,c,r.enclosingDeclaration,67108863),null==n||n(c)),e.isIdentifier(t))){var l=Es(c),u=262144&c.flags&&!wa(l.symbol,r.enclosingDeclaration)?A(l,r):e.factory.cloneNode(t);return u.symbol=c,{introducesError:o,node:e.setEmitFlags(e.setOriginalNode(u,t),16777216)}}return {introducesError:o,node:t}}function K(n,i,a,o){r&&r.throwIfCancellationRequested&&r.throwIfCancellationRequested();var s=!1,c=e.getSourceFileOfNode(i),u=e.visitNode(i,(function r(i){if(e.isJSDocAllType(i)||319===i.kind)return e.factory.createKeywordTypeNode(130);if(e.isJSDocUnknownType(i))return e.factory.createKeywordTypeNode(155);if(e.isJSDocNullableType(i))return e.factory.createUnionTypeNode([e.visitNode(i.type,r),e.factory.createLiteralTypeNode(e.factory.createNull())]);if(e.isJSDocOptionalType(i))return e.factory.createUnionTypeNode([e.visitNode(i.type,r),e.factory.createKeywordTypeNode(153)]);if(e.isJSDocNonNullableType(i))return e.visitNode(i.type,r);if(e.isJSDocVariadicType(i))return e.factory.createArrayTypeNode(e.visitNode(i.type,r));if(e.isJSDocTypeLiteral(i))return e.factory.createTypeLiteralNode(e.map(i.jsDocPropertyTags,(function(t){var a=e.isIdentifier(t.name)?t.name:t.name.right,o=uo(kd(i),a.escapedText),s=o&&t.typeExpression&&kd(t.typeExpression.type)!==o?l(o,n):void 0;return e.factory.createPropertySignature(void 0,a,t.isBracketed||t.typeExpression&&e.isJSDocOptionalType(t.typeExpression.type)?e.factory.createToken(57):void 0,s||t.typeExpression&&e.visitNode(t.typeExpression.type,r)||e.factory.createKeywordTypeNode(130))})));if(e.isTypeReferenceNode(i)&&e.isIdentifier(i.typeName)&&""===i.typeName.escapedText)return e.setOriginalNode(e.factory.createKeywordTypeNode(130),i);if((e.isExpressionWithTypeArguments(i)||e.isTypeReferenceNode(i))&&e.isJSDocIndexSignature(i))return e.factory.createTypeLiteralNode([e.factory.createIndexSignature(void 0,void 0,[e.factory.createParameterDeclaration(void 0,void 0,void 0,"x",void 0,e.visitNode(i.typeArguments[0],r))],e.visitNode(i.typeArguments[1],r))]);var u;if(e.isJSDocFunctionType(i))return e.isJSDocConstructSignature(i)?e.factory.createConstructorTypeNode(i.modifiers,e.visitNodes(i.typeParameters,r),e.mapDefined(i.parameters,(function(t,n){return t.name&&e.isIdentifier(t.name)&&"new"===t.name.escapedText?void(u=t.type):e.factory.createParameterDeclaration(void 0,void 0,g(t),m(t,n),t.questionToken,e.visitNode(t.type,r),void 0)})),e.visitNode(u||i.type,r)||e.factory.createKeywordTypeNode(130)):e.factory.createFunctionTypeNode(e.visitNodes(i.typeParameters,r),e.map(i.parameters,(function(t,n){return e.factory.createParameterDeclaration(void 0,void 0,g(t),m(t,n),t.questionToken,e.visitNode(t.type,r),void 0)})),e.visitNode(i.type,r)||e.factory.createKeywordTypeNode(130));if(e.isTypeReferenceNode(i)&&e.isInJSDoc(i)&&(!j(i,kd(i))||gu(i)||we===su(i,788968,!0)))return e.setOriginalNode(l(kd(i),n),i);if(e.isLiteralImportTypeNode(i)){var _=ni(i).resolvedSymbol;return !e.isInJSDoc(i)||!_||(i.isTypeOf||788968&_.flags)&&e.length(i.typeArguments)>=vl(ss(_))?e.factory.updateImportTypeNode(i,e.factory.updateLiteralTypeNode(i.argument,function(r,i){if(o){if(n.tracker&&n.tracker.moduleResolverHost){var a=HT(r);if(a){var s={getCanonicalFileName:e.createGetCanonicalFileName(!!t.useCaseSensitiveFileNames),getCurrentDirectory:function(){return n.tracker.moduleResolverHost.getCurrentDirectory()},getCommonSourceDirectory:function(){return n.tracker.moduleResolverHost.getCommonSourceDirectory()}},c=e.getResolvedExternalModuleName(s,a);return e.factory.createStringLiteral(c)}}}else if(n.tracker&&n.tracker.trackExternalModuleSymbolOfImportTypeNode){var l=Gi(i,i,void 0);l&&n.tracker.trackExternalModuleSymbolOfImportTypeNode(l);}return i}(i,i.argument.literal)),i.qualifier,e.visitNodes(i.typeArguments,r,e.isTypeNode),i.isTypeOf):e.setOriginalNode(l(kd(i),n),i)}if(e.isEntityName(i)||e.isEntityNameExpression(i)){var d=z(i,n,a),p=d.introducesError,f=d.node;if(s=s||p,f!==i)return f}return c&&e.isTupleTypeNode(i)&&e.getLineAndCharacterOfPosition(c,i.pos).line===e.getLineAndCharacterOfPosition(c,i.end).line&&e.setEmitFlags(i,1),e.visitEachChild(i,r,e.nullTransformationContext);function g(t){return t.dotDotDotToken||(t.type&&e.isJSDocVariadicType(t.type)?e.factory.createToken(25):void 0)}function m(t,r){return t.name&&e.isIdentifier(t.name)&&"this"===t.name.escapedText?"this":g(t)?"args":"arg".concat(r)}}));if(!s)return u===i?e.setTextRange(e.factory.cloneNode(i),i):u}}(),ce=e.createSymbolTable(),le=Hn(4,"undefined");le.declarations=[];var ue=Hn(1536,"globalThis",8);ue.exports=ce,ue.declarations=[],ce.set(ue.escapedName,ue);var _e,de=Hn(4,"arguments"),pe=Hn(4,"require"),fe={getNodeCount:function(){return e.sum(t.getSourceFiles(),"nodeCount")},getIdentifierCount:function(){return e.sum(t.getSourceFiles(),"identifierCount")},getSymbolCount:function(){return e.sum(t.getSourceFiles(),"symbolCount")+x},getTypeCount:function(){return b},getInstantiationCount:function(){return C},getRelationCacheSizes:function(){return {assignable:Fn.size,identity:Pn.size,subtype:En.size,strictSubtype:Nn.size}},isUndefinedSymbol:function(e){return e===le},isArgumentsSymbol:function(e){return e===de},isUnknownSymbol:function(e){return e===we},getMergedSymbol:ca,getDiagnostics:XS,getGlobalDiagnostics:function(){return YS(),Sn.getGlobalDiagnostics()},getRecursionIdentity:nf,getUnmatchedProperties:Tg,getTypeOfSymbolAtLocation:function(t,r){var n=e.getParseTreeNode(r);return n?function(t,r){if(t=t.exportSymbol||t,(79===r.kind||80===r.kind)&&(e.isRightSideOfQualifiedNameOrPropertyAccess(r)&&(r=r.parent),e.isExpressionNode(r)&&(!e.isAssignmentTarget(r)||e.isWriteAccess(r)))){var n=Sx(r);if(ga(ni(r).resolvedSymbol)===t)return n}return e.isDeclarationName(r)&&e.isSetAccessor(r.parent)&&Uo(r.parent)?Wo(r.parent.symbol):es(t)}(t,n):je},getTypeOfSymbol:$o,getSymbolsOfParameterPropertyDeclaration:function(t,r){var n=e.getParseTreeNode(t,e.isParameter);return void 0===n?e.Debug.fail("Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."):function(t,r){var n=t.parent,i=t.parent.parent,a=ai(n.locals,r,111551),o=ai(qs(i.symbol),r,111551);return a&&o?[a,o]:e.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration")}(n,e.escapeLeadingUnderscores(r))},getDeclaredTypeOfSymbol:Es,getPropertiesOfType:Nc,getPropertyOfType:function(t,r){return Zc(t,e.escapeLeadingUnderscores(r))},getPrivateIdentifierPropertyOfType:function(t,r,n){var i=e.getParseTreeNode(n);if(i){var a=Ov(e.escapeLeadingUnderscores(r),i);return a?Lv(t,a):void 0}},getTypeOfPropertyOfType:function(t,r){return uo(t,e.escapeLeadingUnderscores(r))},getIndexInfoOfType:function(e,t){return ol(e,0===t?Ye:Ze)},getIndexInfosOfType:al,getSignaturesOfType:el,getIndexTypeOfType:function(e,t){return sl(e,0===t?Ye:Ze)},getIndexType:function(e){return D_(e)},getBaseTypes:gs,getBaseTypeOfLiteralType:Sf,getWidenedType:rg,getTypeFromTypeNode:function(t){var r=e.getParseTreeNode(t,e.isTypeNode);return r?kd(r):je},getParameterType:gb,getParameterIdentifierNameAtPosition:function(e,t){var r;if(317!==(null===(r=e.declaration)||void 0===r?void 0:r.kind)){var n=e.parameters.length-(J(e)?1:0);if(t<n){var i=e.parameters[t];return db(i)?[i.escapedName,!1]:void 0}var a=e.parameters[n]||we;if(db(a)){var o=$o(a);if(Nf(o)){var s=o.target.labeledElementDeclarations,c=null==s?void 0:s[t-n],l=!!(null==c?void 0:c.dotDotDotToken);return c?[ub(c),l]:void 0}return t===n?[a.escapedName,!0]:void 0}}},getPromisedTypeOfPromise:Hx,getAwaitedType:function(e){return Zx(e)},getReturnTypeOfSignature:Nl,isNullableType:Tv,getNullableType:Bf,getNonNullableType:Jf,getNonOptionalType:Kf,getTypeArguments:eu,typeToTypeNode:se.typeToTypeNode,indexInfoToIndexSignatureDeclaration:se.indexInfoToIndexSignatureDeclaration,signatureToSignatureDeclaration:se.signatureToSignatureDeclaration,symbolToEntityName:se.symbolToEntityName,symbolToExpression:se.symbolToExpression,symbolToTypeParameterDeclarations:se.symbolToTypeParameterDeclarations,symbolToParameterDeclaration:se.symbolToParameterDeclaration,typeParameterToDeclaration:se.typeParameterToDeclaration,getSymbolsInScope:function(t,r){var n=e.getParseTreeNode(t);return n?function(t,r){if(33554432&t.flags)return [];var n=e.createSymbolTable(),i=!1;return function(){for(;t;){switch(t.locals&&!ii(t)&&o(t.locals,r),t.kind){case 305:if(!e.isExternalModule(t))break;case 261:s(la(t).exports,2623475&r);break;case 260:o(la(t).exports,8&r);break;case 226:t.name&&a(t.symbol,r);case 257:case 258:i||o(qs(la(t)),788968&r);break;case 213:t.name&&a(t.symbol,r);}e.introducesArgumentsExoticObject(t)&&a(de,r),i=e.isStatic(t),t=t.parent;}o(ce,r);}(),n.delete("this"),dl(n);function a(t,r){if(e.getCombinedLocalAndExportSymbolFlags(t)&r){var i=t.escapedName;n.has(i)||n.set(i,t);}}function o(e,t){t&&e.forEach((function(e){a(e,t);}));}function s(t,r){r&&t.forEach((function(t){e.getDeclarationOfKind(t,275)||e.getDeclarationOfKind(t,274)||a(t,r);}));}}(n,r):[]},getSymbolAtLocation:function(t){var r=e.getParseTreeNode(t);return r?oT(r,!0):void 0},getIndexInfosAtLocation:function(t){var r=e.getParseTreeNode(t);return r?function(t){if(e.isIdentifier(t)&&e.isPropertyAccessExpression(t.parent)&&t.parent.name===t){var r=v_(t),n=Sx(t.parent.expression),i=1048576&n.flags?n.types:[n];return e.flatMap(i,(function(t){return e.filter(al(t),(function(e){return nl(r,e.keyType)}))}))}}(r):void 0},getShorthandAssignmentValueSymbol:function(t){var r=e.getParseTreeNode(t);return r?function(e){if(e&&297===e.kind)return qi(e.name,2208703)}(r):void 0},getExportSpecifierLocalTargetSymbol:function(t){var r=e.getParseTreeNode(t,e.isExportSpecifier);return r?function(t){return e.isExportSpecifier(t)?t.parent.parent.moduleSpecifier?Ai(t.parent.parent,t):qi(t.propertyName||t.name,2998271):qi(t,2998271)}(r):void 0},getExportSymbolOfSymbol:function(e){return ca(e.exportSymbol||e)},getTypeAtLocation:function(t){var r=e.getParseTreeNode(t);return r?sT(r):je},getTypeOfAssignmentPattern:function(t){var r=e.getParseTreeNode(t,e.isAssignmentPattern);return r&&cT(r)||je},getPropertySymbolOfDestructuringAssignment:function(t){var r=e.getParseTreeNode(t,e.isIdentifier);return r?function(t){var r=cT(e.cast(t.parent.parent,e.isAssignmentPattern));return r&&Zc(r,t.escapedText)}(r):void 0},signatureToString:function(t,r,n,i){return Va(t,e.getParseTreeNode(r),n,i)},typeToString:function(t,r,n){return qa(t,e.getParseTreeNode(r),n)},symbolToString:function(t,r,n,i){return Ua(t,e.getParseTreeNode(r),n,i)},typePredicateToString:function(t,r,n){return Ya(t,e.getParseTreeNode(r),n)},writeSignature:function(t,r,n,i,a){return Va(t,e.getParseTreeNode(r),n,i,a)},writeType:function(t,r,n,i){return qa(t,e.getParseTreeNode(r),n,i)},writeSymbol:function(t,r,n,i,a){return Ua(t,e.getParseTreeNode(r),n,i,a)},writeTypePredicate:function(t,r,n,i){return Ya(t,e.getParseTreeNode(r),n,i)},getAugmentedPropertiesOfType:dT,getRootSymbols:function t(r){var n=function(t){if(6&e.getCheckFlags(t))return e.mapDefined(ri(t).containingType.types,(function(e){return Zc(e,t.escapedName)}));if(33554432&t.flags){var r=t,n=r.leftSpread,i=r.rightSpread,a=r.syntheticOrigin;return n?[n,i]:a?[a]:e.singleElementArray(function(e){for(var t,r=e;r=ri(r).target;)t=r;return t}(t))}}(r);return n?e.flatMap(n,t):[r]},getSymbolOfExpando:Xh,getContextualType:function(t,r){var n=e.getParseTreeNode(t,e.isExpression);if(n)return 4&r?ge(n,(function(){return Ly(n,r)})):Ly(n,r)},getContextualTypeForObjectLiteralElement:function(t){var r=e.getParseTreeNode(t,e.isObjectLiteralElementLike);return r?Fy(r):void 0},getContextualTypeForArgumentAtIndex:function(t,r){var n=e.getParseTreeNode(t,e.isCallLikeExpression);return n&&Ty(n,r)},getContextualTypeForJsxAttribute:function(t){var r=e.getParseTreeNode(t,e.isJsxAttributeLike);return r&&Py(r)},isContextSensitive:rp,getTypeOfPropertyOfContextualType:Ey,getFullyQualifiedName:Vi,getResolvedSignature:function(e,t,r){return me(e,t,r,0)},getResolvedSignatureForStringLiteralCompletions:function(e,t,r){return me(e,r,void 0,32,t)},getResolvedSignatureForSignatureHelp:function(e,t,r){return me(e,t,r,16)},getExpandedParameters:$s,hasEffectiveRestParameter:bb,containsArgumentsReference:Dl,getConstantValue:function(t){var r=e.getParseTreeNode(t,IT);return r?OT(r):void 0},isValidPropertyAccess:function(t,r){var n=e.getParseTreeNode(t,e.isPropertyAccessOrQualifiedNameOrImportTypeNode);return !!n&&function(e,t){switch(e.kind){case 206:return th(e,106===e.expression.kind,t,rg(kx(e.expression)));case 161:return th(e,!1,t,rg(kx(e.left)));case 200:return th(e,!1,t,kd(e))}}(n,e.escapeLeadingUnderscores(r))},isValidPropertyAccessForCompletions:function(t,r,n){var i=e.getParseTreeNode(t,e.isPropertyAccessExpression);return !!i&&eh(i,r,n)},getSignatureFromDeclaration:function(t){var r=e.getParseTreeNode(t,e.isFunctionLike);return r?bl(r):void 0},isImplementationOfOverload:function(t){var r=e.getParseTreeNode(t,e.isFunctionLike);return r?kT(r):void 0},getImmediateAliasedSymbol:Xy,getAliasedSymbol:Ri,getEmitResolver:function(e,t){return XS(e,t),oe},getExportsOfModule:ta,getExportsAndPropertiesOfModule:function(t){var r=ta(t),n=Yi(t);if(n!==t){var i=$o(n);na(i)&&e.addRange(r,Nc(i));}return r},forEachExportAndPropertyOfModule:function(e,t){aa(e).forEach((function(e,r){Sa(r)||t(e,r);}));var r=Yi(e);if(r!==e){var n=$o(r);na(n)&&function(e,r){3670016&(e=Uc(e)).flags&&Tc(e).members.forEach((function(e,r){Ca(e,r)&&function(e,r){t(e,r);}(e,r);}));}(n);}},getSymbolWalker:e.createGetSymbolWalker((function(e){return Pl(e)||Le}),kl,Nl,gs,Tc,$o,Kg,Ac,e.getFirstIdentifier,eu),getAmbientModules:function(){return Mt||(Mt=[],ce.forEach((function(e,t){c.test(t)&&Mt.push(e);}))),Mt},getJsxIntrinsicTagNamesAt:function(t){var r=nv(A.IntrinsicElements,t);return r?Nc(r):e.emptyArray},isOptionalParameter:function(t){var r=e.getParseTreeNode(t,e.isParameter);return !!r&&gl(r)},tryGetMemberInModuleExports:function(t,r){return ra(e.escapeLeadingUnderscores(t),r)},tryGetMemberInModuleExportsAndProperties:function(t,r){return function(e,t){var r=ra(e,t);if(r)return r;var n=Yi(t);if(n!==t){var i=$o(n);return na(i)?Zc(i,e):void 0}}(e.escapeLeadingUnderscores(t),r)},tryFindAmbientModule:function(e){return fl(e,!0)},tryFindAmbientModuleWithoutAugmentations:function(e){return fl(e,!1)},getApparentType:Kc,getUnionType:a_,isTypeAssignableTo:_p,createAnonymousType:Ea,createSignature:Qs,createSymbol:Hn,createIndexInfo:Jl,getAnyType:function(){return Le},getStringType:function(){return Ye},getNumberType:function(){return Ze},createPromiseType:Nb,createArrayType:Bu,getElementTypeOfArrayType:df,getBooleanType:function(){return it},getFalseType:function(e){return e?et:tt},getTrueType:function(e){return e?rt:nt},getVoidType:function(){return ot},getUndefinedType:function(){return qe},getNullType:function(){return Qe},getESSymbolType:function(){return at},getNeverType:function(){return st},getOptionalType:function(){return He},getPromiseType:function(){return Au(!1)},getPromiseLikeType:function(){return Pu(!1)},isSymbolAccessible:La,isArrayType:cf,isTupleType:Nf,isArrayLikeType:pf,isTypeInvalidDueToUnionDiscriminant:function(e,t){return t.properties.some((function(t){var r=t.name&&v_(t.name),n=r&&Rs(r)?Ks(r):void 0,i=void 0===n?void 0:uo(e,n);return !!i&&Df(i)&&!_p(sT(t),i)}))},getExactOptionalProperties:function(e){return Nc(e).filter((function(e){return Wf($o(e))}))},getAllPossiblePropertiesOfTypes:function(t){var r=a_(t);if(!(1048576&r.flags))return dT(r);for(var n=e.createSymbolTable(),i=0,a=t;i<a.length;i++)for(var o=0,s=dT(a[i]);o<s.length;o++){var c=s[o].escapedName;if(!n.has(c)){var l=Vc(r,c);l&&n.set(c,l);}}return e.arrayFrom(n.values())},getSuggestedSymbolForNonexistentProperty:Wv,getSuggestionForNonexistentProperty:Gv,getSuggestedSymbolForNonexistentJSXAttribute:Hv,getSuggestedSymbolForNonexistentSymbol:function(t,r,n){return Qv(t,e.escapeLeadingUnderscores(r),n)},getSuggestionForNonexistentSymbol:function(t,r,n){return function(t,r,n){var i=Qv(t,r,n);return i&&e.symbolName(i)}(t,e.escapeLeadingUnderscores(r),n)},getSuggestedSymbolForNonexistentModule:Xv,getSuggestionForNonexistentExport:function(t,r){var n=Xv(t,r);return n&&e.symbolName(n)},getSuggestedSymbolForNonexistentClassMember:qv,getBaseConstraintOfType:Mc,getDefaultFromTypeParameter:function(e){return e&&262144&e.flags?Jc(e):void 0},resolveName:function(t,r,n,i){return li(r,e.escapeLeadingUnderscores(t),n,void 0,void 0,!1,i)},getJsxNamespace:function(t){return e.unescapeLeadingUnderscores(Mn(t))},getJsxFragmentFactory:function(t){var r=WT(t);return r&&e.unescapeLeadingUnderscores(e.getFirstIdentifier(r).escapedText)},getAccessibleSymbolChain:Aa,getTypePredicateOfSignature:kl,resolveExternalModuleName:function(t){var r=e.getParseTreeNode(t,e.isExpression);return r&&Hi(r,r,!0)},resolveExternalModuleSymbol:Yi,tryGetThisTypeAt:function(t,r){var n=e.getParseTreeNode(t);return n&&dy(n,r)},getTypeArgumentConstraint:function(t){var r=e.getParseTreeNode(t,e.isTypeNode);return r&&function(t){var r=e.tryCast(t.parent,e.isTypeReferenceType);if(r){var n=jx(r);if(n){var i=Ac(n[r.typeArguments.indexOf(t)]);return i&&Yd(i,wd(n,Rx(r,n)))}}}(r)},getSuggestionDiagnostics:function(n,a){var o,s=e.getParseTreeNode(n,e.isSourceFile)||e.Debug.fail("Could not determine parsed source file.");if(e.skipTypeChecking(s,V,t))return e.emptyArray;try{return r=a,ZS(s),e.Debug.assert(!!(1&ni(s).flags)),o=e.addRange(o,Tn.getDiagnostics(s.fileName)),uD(QS(s),(function(t,r,n){e.containsParseError(t)||GS(r,!!(16777216&t.flags))||(o||(o=[])).push(i$1(i$1({},n),{category:e.DiagnosticCategory.Suggestion}));})),o||e.emptyArray}finally{r=void 0;}},runWithCancellationToken:function(e,t){try{return r=e,t(fe)}finally{r=void 0;}},getLocalTypeParametersOfClassOrInterfaceOrTypeAlias:ss,isDeclarationVisible:no,isPropertyAccessible:rh,getTypeOnlyAliasDeclaration:Ji,getMemberOverrideModifierStatus:function(t,r){if(!r.name)return 0;var n=la(t),i=Es(n),a=Hs(i),o=$o(n),s=e.getEffectiveBaseTypeNode(t)&&gs(i),c=(null==s?void 0:s.length)?Hs(e.first(s),i.thisType):void 0,l=ps(i),u=r.parent?e.hasOverrideModifier(r):e.hasSyntacticModifier(r,16384),_=e.unescapeLeadingUnderscores(e.getTextOfPropertyName(r.name));return DS(t,o,l,c,i,a,u,e.hasAbstractModifier(r),e.isStatic(r),!1,_)}};function ge(t,r){var n=e.findAncestor(t,e.isCallLikeExpression),i=n&&ni(n).resolvedSignature;if(n){var a=t;do{ni(a).skipDirectInference=!0,a=a.parent;}while(a&&a!==n);ni(n).resolvedSignature=void 0;}var o=r();if(n){a=t;do{ni(a).skipDirectInference=void 0,a=a.parent;}while(a&&a!==n);ni(n).resolvedSignature=i;}return o}function me(t,r,n,i,a){var o=e.getParseTreeNode(t,e.isCallLikeExpression);_e=n;var s=o?a?ge(a,(function(){return Hh(o,r,i)})):Hh(o,r,i):void 0;return _e=void 0,s}var ye=new e.Map,ve=new e.Map,he=new e.Map,be=new e.Map,xe=new e.Map,De=new e.Map,Se=new e.Map,Te=new e.Map,Ce=new e.Map,ke=new e.Map,Ee=new e.Map,Ne=new e.Map,Fe=[],Ae=new e.Map,Pe=new e.Set,we=Hn(4,"unknown"),Ie=Hn(0,"__resolving__"),Oe=new e.Map,Me=new e.Map,Le=ba(1,"any"),Re=ba(1,"any"),Be=ba(1,"any"),je=ba(1,"error"),Je=ba(1,"unresolved"),ze=ba(1,"any",65536),Ke=ba(1,"intrinsic"),Ue=ba(2,"unknown"),Ve=ba(2,"unknown"),qe=ba(32768,"undefined"),We=Q?qe:ba(32768,"undefined",65536),He=ba(32768,"undefined"),Ge=ie?ba(32768,"undefined"):qe,Qe=ba(65536,"null"),Xe=Q?Qe:ba(65536,"null",65536),Ye=ba(4,"string"),Ze=ba(8,"number"),$e=ba(64,"bigint"),et=ba(512,"false"),tt=ba(512,"false"),rt=ba(512,"true"),nt=ba(512,"true");rt.regularType=nt,rt.freshType=rt,nt.regularType=nt,nt.freshType=rt,et.regularType=tt,et.freshType=et,tt.regularType=tt,tt.freshType=et;var it=a_([tt,nt]),at=ba(4096,"symbol"),ot=ba(16384,"void"),st=ba(131072,"never"),ct=ba(131072,"never"),lt=ba(131072,"never",262144),ut=ba(131072,"never"),_t=ba(131072,"never"),dt=ba(67108864,"object"),pt=a_([Ye,Ze]),ft=a_([Ye,Ze,at]),gt=re?Ye:ft,mt=a_([Ze,$e]),yt=a_([Ye,Ze,it,$e,Qe,qe]),vt=T_(["",""],[Ze]),ht=Md((function(e){return 262144&e.flags?(t=e).constraint===Ue?t:t.restrictiveInstantiation||(t.restrictiveInstantiation=Da(t.symbol),t.restrictiveInstantiation.constraint=Ue,t.restrictiveInstantiation):e;var t;})),bt=Md((function(e){return 262144&e.flags?Be:e})),xt=ba(131072,"never"),Dt=Md((function(e){return 262144&e.flags?xt:e})),St=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray),Tt=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray);Tt.objectFlags|=2048;var Ct=Hn(2048,"__type");Ct.members=e.createSymbolTable();var kt=Ea(Ct,K,e.emptyArray,e.emptyArray,e.emptyArray),Et=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray);Et.instantiations=new e.Map;var Nt=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray);Nt.objectFlags|=262144;var Ft=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray),At=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray),Pt=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray),wt=Da(),It=Da();It.constraint=wt;var Ot,Mt,Lt,Rt,Bt,jt,Jt,zt,Kt,Ut,Vt,qt,Wt,Ht,Gt,Qt,Xt,Yt,Zt,$t,er,tr,rr,nr,ir,ar,or,sr,cr,lr,ur,_r,dr,pr,fr,gr,mr,yr,vr,hr,br,xr,Dr,Sr,Tr,Cr,kr,Er,Nr,Fr,Ar,Pr=Da(),wr=yl(1,"<<unresolved>>",0,Le),Ir=Qs(void 0,void 0,void 0,e.emptyArray,Le,void 0,0,0),Or=Qs(void 0,void 0,void 0,e.emptyArray,je,void 0,0,0),Mr=Qs(void 0,void 0,void 0,e.emptyArray,Le,void 0,0,0),Lr=Qs(void 0,void 0,void 0,e.emptyArray,ct,void 0,0,0),Rr=Jl(Ze,Ye,!0),Br=new e.Map,jr={get yieldType(){return e.Debug.fail("Not supported")},get returnType(){return e.Debug.fail("Not supported")},get nextType(){return e.Debug.fail("Not supported")}},Jr=VD(Le,Le,Le),zr=VD(Le,Le,Ue),Kr=VD(st,Le,qe),Ur={iterableCacheKey:"iterationTypesOfAsyncIterable",iteratorCacheKey:"iterationTypesOfAsyncIterator",iteratorSymbolName:"asyncIterator",getGlobalIteratorType:function(e){return fr||(fr=Tu("AsyncIterator",3,e))||Et},getGlobalIterableType:function(e){return pr||(pr=Tu("AsyncIterable",1,e))||Et},getGlobalIterableIteratorType:function(e){return gr||(gr=Tu("AsyncIterableIterator",1,e))||Et},getGlobalGeneratorType:function(e){return mr||(mr=Tu("AsyncGenerator",3,e))||Et},resolveIterationType:Zx,mustHaveANextMethodDiagnostic:e.Diagnostics.An_async_iterator_must_have_a_next_method,mustBeAMethodDiagnostic:e.Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,mustHaveAValueDiagnostic:e.Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property},Vr={iterableCacheKey:"iterationTypesOfIterable",iteratorCacheKey:"iterationTypesOfIterator",iteratorSymbolName:"iterator",getGlobalIteratorType:function(e){return cr||(cr=Tu("Iterator",3,e))||Et},getGlobalIterableType:Iu,getGlobalIterableIteratorType:function(e){return lr||(lr=Tu("IterableIterator",1,e))||Et},getGlobalGeneratorType:function(e){return ur||(ur=Tu("Generator",3,e))||Et},resolveIterationType:function(e,t){return e},mustHaveANextMethodDiagnostic:e.Diagnostics.An_iterator_must_have_a_next_method,mustBeAMethodDiagnostic:e.Diagnostics.The_0_property_of_an_iterator_must_be_a_method,mustHaveAValueDiagnostic:e.Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property},qr=new e.Map,Wr=!1,Hr=new e.Map,Gr=0,Qr=0,Xr=0,Yr=!1,Zr=0,$r=vd(""),en=hd(0),tn=bd({negative:!1,base10Value:"0"}),rn=[],nn=[],an=[],on=0,sn=[],cn=[],ln=[],un=[],_n=[],dn=[],pn=[],fn=[],gn=[],mn=[],yn=[],vn=[],hn=[],bn=[],xn=[],Dn=[],Sn=e.createDiagnosticCollection(),Tn=e.createDiagnosticCollection(),Cn=new e.Map(e.getEntries({string:Ye,number:Ze,bigint:$e,boolean:it,symbol:at,undefined:qe})),kn=a_(e.arrayFrom(S.keys(),vd)),En=new e.Map,Nn=new e.Map,Fn=new e.Map,An=new e.Map,Pn=new e.Map,wn=new e.Map,In=e.createSymbolTable();In.set(le.escapedName,le);var On=[[".mts",".mjs"],[".ts",".js"],[".cts",".cjs"],[".mjs",".mjs"],[".js",".js"],[".cjs",".cjs"],[".tsx",1===V.jsx?".jsx":".js"],[".jsx",".jsx"],[".json",".json"]];return function(){for(var r=0,n=t.getSourceFiles();r<n.length;r++){var i=n[r];e.bindSourceFile(i,V);}var a,o,s,c;Ot=new e.Map;for(var l=0,u=t.getSourceFiles();l<u.length;l++)if(!(i=u[l]).redirectInfo){if(!e.isExternalOrCommonJsModule(i)){var _=i.locals.get("globalThis");if(null==_?void 0:_.declarations)for(var d=0,p=_.declarations;d<p.length;d++){var f=p[d];Sn.add(e.createDiagnosticForNode(f,e.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0,"globalThis"));}ei(ce,i.locals);}i.jsGlobalAugmentations&&ei(ce,i.jsGlobalAugmentations),i.patternAmbientModules&&i.patternAmbientModules.length&&(Lt=e.concatenate(Lt,i.patternAmbientModules)),i.moduleAugmentations.length&&(a||(a=[])).push(i.moduleAugmentations),i.symbol&&i.symbol.globalExports&&i.symbol.globalExports.forEach((function(e,t){ce.has(t)||ce.set(t,e);}));}if(a)for(var g=0,m=a;g<m.length;g++)for(var y=m[g],v=0,h=y;v<h.length;v++){var b=h[v];e.isGlobalScopeAugmentation(b.parent)&&ti(b);}if(o=ce,s=In,c=e.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0,s.forEach((function(t,r){var n=o.get(r);n?e.forEach(n.declarations,function(t,r){return function(n){return Sn.add(e.createDiagnosticForNode(n,r,t))}}(e.unescapeLeadingUnderscores(r),c)):o.set(r,t);})),ri(le).type=We,ri(de).type=Tu("IArguments",0,!0),ri(we).type=je,ri(ue).type=xa(16,ue),Kt=Tu("Array",1,!0),Bt=Tu("Object",0,!0),jt=Tu("Function",0,!0),Jt=Y&&Tu("CallableFunction",0,!0)||jt,zt=Y&&Tu("NewableFunction",0,!0)||jt,Vt=Tu("String",0,!0),qt=Tu("Number",0,!0),Wt=Tu("Boolean",0,!0),Ht=Tu("RegExp",0,!0),Qt=Bu(Le),(Xt=Bu(Re))===St&&(Xt=Ea(void 0,K,e.emptyArray,e.emptyArray,e.emptyArray)),Ut=Ou("ReadonlyArray",1)||Kt,Yt=Ut?Lu(Ut,[Le]):Qt,Gt=Ou("ThisType",1),a)for(var x=0,D=a;x<D.length;x++)for(var S=0,T=y=D[x];S<T.length;S++)b=T[S],e.isGlobalScopeAugmentation(b.parent)||ti(b);Ot.forEach((function(t){var r=t.firstFile,n=t.secondFile,i=t.conflictingSymbols;if(i.size<8)i.forEach((function(t,r){for(var n=t.isBlockScoped,i=t.firstFileLocations,a=t.secondFileLocations,o=n?e.Diagnostics.Cannot_redeclare_block_scoped_variable_0:e.Diagnostics.Duplicate_identifier_0,s=0,c=i;s<c.length;s++)$n(c[s],o,r,a);for(var l=0,u=a;l<u.length;l++)$n(u[l],o,r,i);}));else {var a=e.arrayFrom(i.keys()).join(", ");Sn.add(e.addRelatedInfo(e.createDiagnosticForNode(r,e.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0,a),e.createDiagnosticForNode(n,e.Diagnostics.Conflicts_are_in_this_file))),Sn.add(e.addRelatedInfo(e.createDiagnosticForNode(n,e.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0,a),e.createDiagnosticForNode(r,e.Diagnostics.Conflicts_are_in_this_file)));}})),Ot=void 0;}(),fe;function Mn(t){if(t){var r=e.getSourceFileOfNode(t);if(r)if(e.isJsxOpeningFragment(t)){if(r.localJsxFragmentNamespace)return r.localJsxFragmentNamespace;var n=r.pragmas.get("jsxfrag");if(n){var i=e.isArray(n)?n[0]:n;if(r.localJsxFragmentFactory=e.parseIsolatedEntityName(i.arguments.factory,q),e.visitNode(r.localJsxFragmentFactory,Rn),r.localJsxFragmentFactory)return r.localJsxFragmentNamespace=e.getFirstIdentifier(r.localJsxFragmentFactory).escapedText}var a=WT(t);if(a)return r.localJsxFragmentFactory=a,r.localJsxFragmentNamespace=e.getFirstIdentifier(a).escapedText}else {var o=Ln(r);if(o)return r.localJsxNamespace=o}}return Nr||(Nr="React",V.jsxFactory?(Fr=e.parseIsolatedEntityName(V.jsxFactory,q),e.visitNode(Fr,Rn),Fr&&(Nr=e.getFirstIdentifier(Fr).escapedText)):V.reactNamespace&&(Nr=e.escapeLeadingUnderscores(V.reactNamespace))),Fr||(Fr=e.factory.createQualifiedName(e.factory.createIdentifier(e.unescapeLeadingUnderscores(Nr)),"createElement")),Nr}function Ln(t){if(t.localJsxNamespace)return t.localJsxNamespace;var r=t.pragmas.get("jsx");if(r){var n=e.isArray(r)?r[0]:r;if(t.localJsxFactory=e.parseIsolatedEntityName(n.arguments.factory,q),e.visitNode(t.localJsxFactory,Rn),t.localJsxFactory)return t.localJsxNamespace=e.getFirstIdentifier(t.localJsxFactory).escapedText}}function Rn(t){return e.setTextRangePosEnd(t,-1,-1),e.visitEachChild(t,Rn,e.nullTransformationContext)}function Bn(e,t,r,n,i,a,o){var s=Jn(t,r,n,i,a,o);return s.skippedOn=e,s}function jn(t,r,n,i,a,o){return t?e.createDiagnosticForNode(t,r,n,i,a,o):e.createCompilerDiagnostic(r,n,i,a,o)}function Jn(e,t,r,n,i,a){var o=jn(e,t,r,n,i,a);return Sn.add(o),o}function zn(t,r){t?Sn.add(r):Tn.add(i$1(i$1({},r),{category:e.DiagnosticCategory.Suggestion}));}function Kn(t,r,n,i,a,o,s){if(r.pos<0||r.end<0){if(!t)return;var c=e.getSourceFileOfNode(r);zn(t,"message"in n?e.createFileDiagnostic(c,0,0,n,i,a,o,s):e.createDiagnosticForFileFromMessageChain(c,n));}else zn(t,"message"in n?e.createDiagnosticForNode(r,n,i,a,o,s):e.createDiagnosticForNodeFromMessageChain(r,n));}function Un(t,r,n,i,a,o,s){var c=Jn(t,n,i,a,o,s);if(r){var l=e.createDiagnosticForNode(t,e.Diagnostics.Did_you_forget_to_use_await);e.addRelatedInfo(c,l);}return c}function Vn(t,r){var n=Array.isArray(t)?e.forEach(t,e.getJSDocDeprecatedTag):e.getJSDocDeprecatedTag(t);return n&&e.addRelatedInfo(r,e.createDiagnosticForNode(n,e.Diagnostics.The_declaration_was_marked_as_deprecated_here)),Tn.add(r),r}function qn(e){return !!(268435456&vv(e))}function Wn(t,r,n){return Vn(r,e.createDiagnosticForNode(t,e.Diagnostics._0_is_deprecated,n))}function Hn(e,t,r){x++;var n=new y(33554432|e,t);return n.checkFlags=r||0,n}function Gn(e){var t=0;return 2&e&&(t|=111551),1&e&&(t|=111550),4&e&&(t|=0),8&e&&(t|=900095),16&e&&(t|=110991),32&e&&(t|=899503),64&e&&(t|=788872),256&e&&(t|=899327),128&e&&(t|=899967),512&e&&(t|=110735),8192&e&&(t|=103359),32768&e&&(t|=46015),65536&e&&(t|=78783),262144&e&&(t|=526824),524288&e&&(t|=788968),2097152&e&&(t|=2097152),t}function Qn(e,t){t.mergeId||(t.mergeId=d,d++),sn[t.mergeId]=e;}function Xn(t){var r=Hn(t.flags,t.escapedName);return r.declarations=t.declarations?t.declarations.slice():[],r.parent=t.parent,t.valueDeclaration&&(r.valueDeclaration=t.valueDeclaration),t.constEnumOnlyModule&&(r.constEnumOnlyModule=!0),t.members&&(r.members=new e.Map(t.members)),t.exports&&(r.exports=new e.Map(t.exports)),Qn(r,t),r}function Yn(t,r,n){if(void 0===n&&(n=!1),!(t.flags&Gn(r.flags))||67108864&(r.flags|t.flags)){if(r===t)return t;if(!(33554432&t.flags)){var i=Li(t);if(i===we)return r;t=Xn(i);}512&r.flags&&512&t.flags&&t.constEnumOnlyModule&&!r.constEnumOnlyModule&&(t.constEnumOnlyModule=!1),t.flags|=r.flags,r.valueDeclaration&&e.setValueDeclaration(t,r.valueDeclaration),e.addRange(t.declarations,r.declarations),r.members&&(t.members||(t.members=e.createSymbolTable()),ei(t.members,r.members,n)),r.exports&&(t.exports||(t.exports=e.createSymbolTable()),ei(t.exports,r.exports,n)),n||Qn(t,r);}else if(1024&t.flags)t!==ue&&Jn(r.declarations&&e.getNameOfDeclaration(r.declarations[0]),e.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity,Ua(t));else {var a=!!(384&t.flags||384&r.flags),o=!!(2&t.flags||2&r.flags),s=a?e.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations:o?e.Diagnostics.Cannot_redeclare_block_scoped_variable_0:e.Diagnostics.Duplicate_identifier_0,c=r.declarations&&e.getSourceFileOfNode(r.declarations[0]),l=t.declarations&&e.getSourceFileOfNode(t.declarations[0]),u=e.isPlainJsFile(c,V.checkJs),_=e.isPlainJsFile(l,V.checkJs),d=Ua(r);if(c&&l&&Ot&&!a&&c!==l){var p=-1===e.comparePaths(c.path,l.path)?c:l,f=p===c?l:c,g=e.getOrUpdate(Ot,"".concat(p.path,"|").concat(f.path),(function(){return {firstFile:p,secondFile:f,conflictingSymbols:new e.Map}})),m=e.getOrUpdate(g.conflictingSymbols,d,(function(){return {isBlockScoped:o,firstFileLocations:[],secondFileLocations:[]}}));u||y(m.firstFileLocations,r),_||y(m.secondFileLocations,t);}else u||Zn(r,s,d,t),_||Zn(t,s,d,r);}return t;function y(t,r){if(r.declarations)for(var n=0,i=r.declarations;n<i.length;n++){var a=i[n];e.pushIfUnique(t,a);}}}function Zn(t,r,n,i){e.forEach(t.declarations,(function(e){$n(e,r,n,i.declarations);}));}function $n(t,r,n,i){for(var a=(e.getExpandoInitializer(t,!1)?e.getNameOfExpando(t):e.getNameOfDeclaration(t))||t,o=function(t,r,n,i,a,o){var s=t?e.createDiagnosticForNode(t,r,n,i,a,o):e.createCompilerDiagnostic(r,n,i,a,o);return Sn.lookup(s)||(Sn.add(s),s)}(a,r,n),s=function(t){var r=(e.getExpandoInitializer(t,!1)?e.getNameOfExpando(t):e.getNameOfDeclaration(t))||t;if(r===a)return "continue";o.relatedInformation=o.relatedInformation||[];var i=e.createDiagnosticForNode(r,e.Diagnostics._0_was_also_declared_here,n),s=e.createDiagnosticForNode(r,e.Diagnostics.and_here);if(e.length(o.relatedInformation)>=5||e.some(o.relatedInformation,(function(t){return 0===e.compareDiagnostics(t,s)||0===e.compareDiagnostics(t,i)})))return "continue";e.addRelatedInfo(o,e.length(o.relatedInformation)?s:i);},c=0,l=i||e.emptyArray;c<l.length;c++)s(l[c]);}function ei(e,t,r){void 0===r&&(r=!1),t.forEach((function(t,n){var i=e.get(n);e.set(n,i?Yn(i,t,r):t);}));}function ti(t){var r,n,i,a=t.parent;if((null===(r=a.symbol.declarations)||void 0===r?void 0:r[0])===a)if(e.isGlobalScopeAugmentation(a))ei(ce,a.symbol.exports);else {var o=Gi(t,t,16777216&t.parent.parent.flags?void 0:e.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found,!0);if(!o)return;if(1920&(o=Yi(o)).flags)if(e.some(Lt,(function(e){return o===e.symbol}))){var s=Yn(a.symbol,o,!0);Rt||(Rt=new e.Map),Rt.set(t.text,s);}else {if((null===(n=o.exports)||void 0===n?void 0:n.get("__export"))&&(null===(i=a.symbol.exports)||void 0===i?void 0:i.size))for(var c=Vs(o,"resolvedExports"),l=0,u=e.arrayFrom(a.symbol.exports.entries());l<u.length;l++){var _=u[l],d=_[0],p=_[1];c.has(d)&&!o.exports.has(d)&&Yn(c.get(d),p);}Yn(o,a.symbol);}else Jn(t,e.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity,t.text);}else e.Debug.assert(a.symbol.declarations.length>1);}function ri(e){if(33554432&e.flags)return e;var t=M(e);return cn[t]||(cn[t]=new w)}function ni(e){var t=O(e);return ln[t]||(ln[t]=new I)}function ii(t){return 305===t.kind&&!e.isExternalOrCommonJsModule(t)}function ai(t,r,n){if(n){var i=ca(t.get(r));if(i){if(e.Debug.assert(0==(1&e.getCheckFlags(i)),"Should never get an instantiated symbol here."),i.flags&n)return i;if(2097152&i.flags){var a=Ri(i);if(a===we||a.flags&n)return i}}}}function oi(r,n){var i=e.getSourceFileOfNode(r),a=e.getSourceFileOfNode(n),o=e.getEnclosingBlockScopeContainer(r);if(i!==a){if(W&&(i.externalModuleIndicator||a.externalModuleIndicator)||!e.outFile(V)||Ug(n)||16777216&r.flags)return !0;if(l(n,r))return !0;var s=t.getSourceFiles();return s.indexOf(i)<=s.indexOf(a)}if(r.pos<=n.pos&&(!e.isPropertyDeclaration(r)||!e.isThisProperty(n.parent)||r.initializer||r.exclamationToken)){if(203===r.kind){var c=e.getAncestor(n,203);return c?e.findAncestor(c,e.isBindingElement)!==e.findAncestor(r,e.isBindingElement)||r.pos<c.pos:oi(e.getAncestor(r,254),n)}return 254===r.kind?!function(t,r){switch(t.parent.parent.kind){case 237:case 242:case 244:if(hi(r,t,o))return !0}var n=t.parent.parent;return e.isForInOrOfStatement(n)&&hi(r,n.expression,o)}(r,n):e.isClassDeclaration(r)?!e.findAncestor(n,(function(t){return e.isComputedPropertyName(t)&&t.parent.parent===r})):e.isPropertyDeclaration(r)?!u(r,n,!1):!e.isParameterPropertyDeclaration(r,r.parent)||!(99===e.getEmitScriptTarget(V)&&H&&e.getContainingClass(r)===e.getContainingClass(n)&&l(n,r))}return !(!(275===n.parent.kind||271===n.parent.kind&&n.parent.isExportEquals)&&(271!==n.kind||!n.isExportEquals)&&!(8388608&n.flags||Ug(n)||e.findAncestor(n,(function(t){return e.isInterfaceDeclaration(t)||e.isTypeAliasDeclaration(t)})))&&(!l(n,r)||99===e.getEmitScriptTarget(V)&&H&&e.getContainingClass(r)&&(e.isPropertyDeclaration(r)||e.isParameterPropertyDeclaration(r,r.parent))&&u(r,n,!0)));function l(t,r){return !!e.findAncestor(t,(function(n){if(n===o)return "quit";if(e.isFunctionLike(n))return !0;if(e.isClassStaticBlockDeclaration(n))return r.pos<t.pos;var i=e.tryCast(n.parent,e.isPropertyDeclaration);if(i&&i.initializer===n)if(e.isStatic(n.parent)){if(169===r.kind)return !0;if(e.isPropertyDeclaration(r)&&e.getContainingClass(t)===e.getContainingClass(r)){var a=r.name;if((e.isIdentifier(a)||e.isPrivateIdentifier(a))&&function(t,r,n,i,a){for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.pos>=i&&c.pos<=a){var l=e.factory.createPropertyAccessExpression(e.factory.createThis(),t);if(e.setParent(l.expression,l),e.setParent(l,c),l.flowNode=c.returnFlowNode,!(32768&Mf(Xm(l,r,jf(r)))))return !0}}return !1}(a,$o(la(r)),e.filter(r.parent.members,e.isClassStaticBlockDeclaration),r.parent.pos,n.pos))return !0}}else if(167!==r.kind||e.isStatic(r)||e.getContainingClass(t)!==e.getContainingClass(r))return !0;return !1}))}function u(t,r,n){return !(r.end>t.end)&&void 0===e.findAncestor(r,(function(r){if(r===t)return "quit";switch(r.kind){case 214:return !0;case 167:return !n||!(e.isPropertyDeclaration(t)&&r.parent===t.parent||e.isParameterPropertyDeclaration(t,t.parent)&&r.parent===t.parent.parent)||"quit";case 235:switch(r.parent.kind){case 172:case 169:case 173:return !0;default:return !1}default:return !1}}))}}function si(t,r,n){var i=e.getEmitScriptTarget(V),a=r;if(e.isParameter(n)&&a.body&&t.valueDeclaration&&t.valueDeclaration.pos>=a.body.pos&&t.valueDeclaration.end<=a.body.end&&i>=2){var o=ni(a);return void 0===o.declarationRequiresScopeChange&&(o.declarationRequiresScopeChange=e.forEach(a.parameters,(function(e){return s(e.name)||!!e.initializer&&s(e.initializer)}))||!1),!o.declarationRequiresScopeChange}return !1;function s(t){switch(t.kind){case 214:case 213:case 256:case 171:return !1;case 169:case 172:case 173:case 296:return s(t.name);case 167:return e.hasStaticModifier(t)?i<99||!H:s(t.name);default:return e.isNullishCoalesce(t)||e.isOptionalChain(t)?i<7:e.isBindingElement(t)&&t.dotDotDotToken&&e.isObjectBindingPattern(t.parent)?i<4:!e.isTypeNode(t)&&(e.forEachChild(t,s)||!1)}}}function ci(t){return e.isAssertionExpression(t)&&e.isConstTypeReference(t.type)||e.isJSDocTypeTag(t)&&e.isConstTypeReference(t.typeExpression)}function li(e,t,r,n,i,a,o,s){return void 0===o&&(o=!1),void 0===s&&(s=!0),ui(e,t,r,n,i,a,o,s,ai)}function ui(t,r,n,i,a,o,s,c,l){var u,_,d,p,f,g,y,v,h,b=t,x=!1,D=t,S=!1;e:for(;t;){if("const"===r&&ci(t))return;if(t.locals&&!ii(t)&&(p=l(t.locals,r,n))){var T=!0;if(e.isFunctionLike(t)&&f&&f!==t.body?(n&p.flags&788968&&320!==f.kind&&(T=!!(262144&p.flags)&&(f===t.type||164===f.kind||340===f.kind||341===f.kind||163===f.kind)),n&p.flags&3&&(si(p,t,f)?T=!1:1&p.flags&&(T=164===f.kind||f===t.type&&!!e.findAncestor(p.valueDeclaration,e.isParameter)))):189===t.kind&&(T=f===t.trueType),T)break e;p=void 0;}switch(x=x||di(t,f),t.kind){case 305:if(!e.isExternalOrCommonJsModule(t))break;S=!0;case 261:var C=(null===(u=la(t))||void 0===u?void 0:u.exports)||K;if(305===t.kind||e.isModuleDeclaration(t)&&16777216&t.flags&&!e.isGlobalScopeAugmentation(t)){if(p=C.get("default")){var k=e.getLocalSymbolForExportDefault(p);if(k&&p.flags&n&&k.escapedName===r)break e;p=void 0;}var E=C.get(r);if(E&&2097152===E.flags&&(e.getDeclarationOfKind(E,275)||e.getDeclarationOfKind(E,274)))break}if("default"!==r&&(p=l(C,r,2623475&n))){if(!e.isSourceFile(t)||!t.commonJsModuleIndicator||(null===(_=p.declarations)||void 0===_?void 0:_.some(e.isJSDocTypeAlias)))break e;p=void 0;}break;case 260:if(p=l((null===(d=la(t))||void 0===d?void 0:d.exports)||K,r,8&n))break e;break;case 167:if(!e.isStatic(t)){var N=ya(t.parent);N&&N.locals&&l(N.locals,r,111551&n)&&(y=t);}break;case 257:case 226:case 258:if(p=l(la(t).members||K,r,788968&n)){if(!gi(p,t)){p=void 0;break}if(f&&e.isStatic(f))return void Jn(D,e.Diagnostics.Static_members_cannot_reference_class_type_parameters);break e}if(226===t.kind&&32&n){var F=t.name;if(F&&r===F.escapedText){p=t.symbol;break e}}break;case 228:if(f===t.expression&&94===t.parent.token){var A=t.parent.parent;if(e.isClassLike(A)&&(p=l(la(A).members,r,788968&n)))return void(i&&Jn(D,e.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters))}break;case 162:if(h=t.parent.parent,(e.isClassLike(h)||258===h.kind)&&(p=l(la(h).members,r,788968&n)))return void Jn(D,e.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);break;case 214:if(e.getEmitScriptTarget(V)>=2)break;case 169:case 171:case 172:case 173:case 256:if(3&n&&"arguments"===r){p=de;break e}break;case 213:if(3&n&&"arguments"===r){p=de;break e}if(16&n){var P=t.name;if(P&&r===P.escapedText){p=t.symbol;break e}}break;case 165:t.parent&&164===t.parent.kind&&(t=t.parent),t.parent&&(e.isClassElement(t.parent)||257===t.parent.kind)&&(t=t.parent);break;case 345:case 338:case 339:var w=e.getJSDocRoot(t);w&&(t=w.parent);break;case 164:f&&(f===t.initializer||f===t.name&&e.isBindingPattern(f))&&(v||(v=t));break;case 203:f&&(f===t.initializer||f===t.name&&e.isBindingPattern(f))&&e.isParameterDeclaration(t)&&!v&&(v=t);break;case 190:if(262144&n){var I=t.typeParameter.name;if(I&&r===I.escapedText){p=t.typeParameter.symbol;break e}}}pi(t)&&(g=t),f=t,t=e.isJSDocTemplateTag(t)?e.getEffectiveContainerForJSDocTemplateTag(t)||t.parent:(e.isJSDocParameterTag(t)||e.isJSDocReturnTag(t))&&e.getHostSignatureFromJSDoc(t)||t.parent;}if(!o||!p||g&&p===g.symbol||(p.isReferenced|=n),!p){if(f&&(e.Debug.assert(305===f.kind),f.commonJsModuleIndicator&&"exports"===r&&n&f.symbol.flags))return f.symbol;s||(p=l(ce,r,n));}if(!p&&b&&e.isInJSFile(b)&&b.parent&&e.isRequireCall(b.parent,!1))return pe;if(p){if(!y||99===e.getEmitScriptTarget(V)&&H)return i&&m((function(){if(D&&(2&n||(32&n||384&n)&&111551==(111551&n))){var t=ga(p);(2&t.flags||32&t.flags||384&t.flags)&&function(t,r){var n;if(e.Debug.assert(!!(2&t.flags||32&t.flags||384&t.flags)),!(67108881&t.flags&&32&t.flags)){var i=null===(n=t.declarations)||void 0===n?void 0:n.find((function(t){return e.isBlockOrCatchScoped(t)||e.isClassLike(t)||260===t.kind}));if(void 0===i)return e.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");if(!(16777216&i.flags||oi(i,r))){var a=void 0,o=e.declarationNameToString(e.getNameOfDeclaration(i));2&t.flags?a=Jn(r,e.Diagnostics.Block_scoped_variable_0_used_before_its_declaration,o):32&t.flags?a=Jn(r,e.Diagnostics.Class_0_used_before_its_declaration,o):256&t.flags?a=Jn(r,e.Diagnostics.Enum_0_used_before_its_declaration,o):(e.Debug.assert(!!(128&t.flags)),e.shouldPreserveConstEnums(V)&&(a=Jn(r,e.Diagnostics.Enum_0_used_before_its_declaration,o))),a&&e.addRelatedInfo(a,e.createDiagnosticForNode(i,e.Diagnostics._0_is_declared_here,o));}}}(t,D);}if(p&&S&&111551==(111551&n)&&!(8388608&b.flags)){var i=ca(p);e.length(i.declarations)&&e.every(i.declarations,(function(t){return e.isNamespaceExportDeclaration(t)||e.isSourceFile(t)&&!!t.symbol.globalExports}))&&Kn(!V.allowUmdGlobalAccess,D,e.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead,e.unescapeLeadingUnderscores(r));}if(p&&v&&!x&&111551==(111551&n)){var a=ca(Ws(p)),o=e.getRootDeclaration(v);a===la(v)?Jn(D,e.Diagnostics.Parameter_0_cannot_reference_itself,e.declarationNameToString(v.name)):a.valueDeclaration&&a.valueDeclaration.pos>v.pos&&o.parent.locals&&l(o.parent.locals,a.escapedName,n)===a&&Jn(D,e.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it,e.declarationNameToString(v.name),e.declarationNameToString(D));}if(p&&D&&111551&n&&2097152&p.flags&&!(111551&p.flags)&&!e.isValidTypeOnlyAliasUseSite(D)){var s=Ji(p);if(s){var c=275===s.kind?e.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type:e.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type,u=e.unescapeLeadingUnderscores(r);_i(Jn(D,c,u),s,u);}}})),p;var O=y.name;Jn(D,e.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,e.declarationNameToString(O),fi(a));}else i&&m((function(){if(!D||!(function(t,r,n){if(!e.isIdentifier(t)||t.escapedText!==r||eT(t)||Ug(t))return !1;for(var i=e.getThisContainer(t,!1),a=i;a;){if(e.isClassLike(a.parent)){var o=la(a.parent);if(!o)break;if(Zc($o(o),r))return Jn(t,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0,fi(n),Ua(o)),!0;if(a===i&&!e.isStatic(a)&&Zc(Es(o).thisType,r))return Jn(t,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0,fi(n)),!0}a=a.parent;}return !1}(D,r,a)||mi(D)||function(t,r,n){var i=1920|(e.isInJSFile(t)?111551:0);if(n===i){var a=Li(li(t,r,788968&~i,void 0,void 0,!1)),o=t.parent;if(a){if(e.isQualifiedName(o)){e.Debug.assert(o.left===t,"Should only be resolving left side of qualified name as a namespace");var s=o.right.escapedText;if(Zc(Es(a),s))return Jn(o,e.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1,e.unescapeLeadingUnderscores(r),e.unescapeLeadingUnderscores(s)),!0}return Jn(t,e.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here,e.unescapeLeadingUnderscores(r)),!0}}return !1}(D,r,n)||function(t,r){return !(!vi(r)||275!==t.parent.kind)&&(Jn(t,e.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module,r),!0)}(D,r)||function(t,r,n){if(111551&n){if(vi(r))return Jn(t,e.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here,e.unescapeLeadingUnderscores(r)),!0;var i=Li(li(t,r,788544,void 0,void 0,!1));if(i&&!(1024&i.flags)){var a=e.unescapeLeadingUnderscores(r);return function(e){switch(e){case"Promise":case"Symbol":case"Map":case"WeakMap":case"Set":case"WeakSet":return !0}return !1}(r)?Jn(t,e.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later,a):function(t,r){var n=e.findAncestor(t.parent,(function(t){return !e.isComputedPropertyName(t)&&!e.isPropertySignature(t)&&(e.isTypeLiteralNode(t)||"quit")}));if(n&&1===n.members.length){var i=Es(r);return !!(1048576&i.flags)&&Qb(i,384,!0)}return !1}(t,i)?Jn(t,e.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0,a,"K"===a?"P":"K"):Jn(t,e.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here,a),!0}}return !1}(D,r,n)||function(t,r,n){if(111127&n){if(Li(li(t,r,1024,void 0,void 0,!1)))return Jn(t,e.Diagnostics.Cannot_use_namespace_0_as_a_value,e.unescapeLeadingUnderscores(r)),!0}else if(788544&n&&Li(li(t,r,1536,void 0,void 0,!1)))return Jn(t,e.Diagnostics.Cannot_use_namespace_0_as_a_type,e.unescapeLeadingUnderscores(r)),!0;return !1}(D,r,n)||function(t,r,n){if(788584&n){var i=Li(li(t,r,111127,void 0,void 0,!1));if(i&&!(1920&i.flags))return Jn(t,e.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0,e.unescapeLeadingUnderscores(r)),!0}return !1}(D,r,n))){var t=void 0;if(c&&on<10&&((null==(t=Qv(b,r,n))?void 0:t.valueDeclaration)&&e.isAmbientModule(t.valueDeclaration)&&e.isGlobalScopeAugmentation(t.valueDeclaration)&&(t=void 0),t)){var o=Ua(t),s=jv(b,t,!1),l=1920===n||a&&"string"!=typeof a&&e.nodeIsSynthesized(a)?e.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1:s?e.Diagnostics.Could_not_find_name_0_Did_you_mean_1:e.Diagnostics.Cannot_find_name_0_Did_you_mean_1,u=jn(D,l,fi(a),o);zn(!s,u),t.valueDeclaration&&e.addRelatedInfo(u,e.createDiagnosticForNode(t.valueDeclaration,e.Diagnostics._0_is_declared_here,o));}if(!t&&a){var _=function(t){for(var r=fi(t),n=e.getScriptTargetFeatures(),i=0,a=e.getOwnKeys(n);i<a.length;i++){var o=a[i],s=e.getOwnKeys(n[o]);if(void 0!==s&&e.contains(s,r))return o}}(a);_?Jn(D,i,fi(a),_):Jn(D,i,fi(a));}on++;}}));}function _i(t,r,n){return r?e.addRelatedInfo(t,e.createDiagnosticForNode(r,275===r.kind?e.Diagnostics._0_was_exported_here:e.Diagnostics._0_was_imported_here,n)):t}function di(t,r){return 214!==t.kind&&213!==t.kind?e.isTypeQueryNode(t)||(e.isFunctionLikeDeclaration(t)||167===t.kind&&!e.isStatic(t))&&(!r||r!==t.name):!(r&&r===t.name||!t.asteriskToken&&!e.hasSyntacticModifier(t,256)&&e.getImmediatelyInvokedFunctionExpression(t))}function pi(e){switch(e.kind){case 256:case 257:case 258:case 260:case 259:case 261:return !0;default:return !1}}function fi(t){return e.isString(t)?e.unescapeLeadingUnderscores(t):e.declarationNameToString(t)}function gi(t,r){if(t.declarations)for(var n=0,i=t.declarations;n<i.length;n++){var a=i[n];if(163===a.kind&&(e.isJSDocTemplateTag(a.parent)?e.getJSDocHost(a.parent):a.parent)===r)return !(e.isJSDocTemplateTag(a.parent)&&e.find(a.parent.parent.tags,e.isJSDocTypeAlias))}return !1}function mi(t){var r=yi(t);return !(!r||!qi(r,64,!0)||(Jn(t,e.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements,e.getTextOfNode(r)),0))}function yi(t){switch(t.kind){case 79:case 206:return t.parent?yi(t.parent):void 0;case 228:if(e.isEntityNameExpression(t.expression))return t.expression;default:return}}function vi(e){return "any"===e||"string"===e||"number"===e||"boolean"===e||"never"===e||"unknown"===e}function hi(t,r,n){return !!r&&!!e.findAncestor(t,(function(t){return t===r||!(t!==n&&(!e.isFunctionLike(t)||e.getImmediatelyInvokedFunctionExpression(t)))&&"quit"}))}function bi(e){switch(e.kind){case 265:return e;case 267:return e.parent;case 268:return e.parent.parent;case 270:return e.parent.parent.parent;default:return}}function xi(t){return t.declarations&&e.findLast(t.declarations,Di)}function Di(t){return 265===t.kind||264===t.kind||267===t.kind&&!!t.name||268===t.kind||274===t.kind||270===t.kind||275===t.kind||271===t.kind&&e.exportAssignmentIsAlias(t)||e.isBinaryExpression(t)&&2===e.getAssignmentDeclarationKind(t)&&e.exportAssignmentIsAlias(t)||e.isAccessExpression(t)&&e.isBinaryExpression(t.parent)&&t.parent.left===t&&63===t.parent.operatorToken.kind&&Si(t.parent.right)||297===t.kind||296===t.kind&&Si(t.initializer)||254===t.kind&&e.isVariableDeclarationInitializedToBareOrAccessedRequire(t)||203===t.kind&&e.isVariableDeclarationInitializedToBareOrAccessedRequire(t.parent.parent)}function Si(t){return e.isAliasableExpression(t)||e.isFunctionExpression(t)&&Gh(t)}function Ti(e,t,r,n){var i=e.exports.get("export="),a=i?Zc($o(i),t):e.exports.get(t),o=Li(a,n);return Bi(r,a,o,!1),o}function Ci(t){return e.isExportAssignment(t)&&!t.isExportEquals||e.hasSyntacticModifier(t,512)||e.isExportSpecifier(t)}function ki(t){return e.isStringLiteralLike(t)?e.getModeForUsageLocation(e.getSourceFileOfNode(t),t):void 0}function Ei(t,r){return t===e.ModuleKind.ESNext&&r===e.ModuleKind.CommonJS}function Ni(t){return ki(t)===e.ModuleKind.ESNext&&e.endsWith(t.text,".json")}function Fi(t,r,n,i){var a=t&&ki(i);if(t&&void 0!==a){var o=Ei(a,t.impliedNodeFormat);if(a===e.ModuleKind.ESNext||o)return o}if(!G)return !1;if(!t||t.isDeclarationFile){var s=Ti(r,"default",void 0,!0);return !(s&&e.some(s.declarations,Ci)||Ti(r,e.escapeLeadingUnderscores("__esModule"),void 0,n))}return e.isSourceFileJS(t)?"object"!=typeof t.externalModuleIndicator&&!Ti(r,e.escapeLeadingUnderscores("__esModule"),void 0,n):ea(r)}function Ai(t,r,i){var a,o;void 0===i&&(i=!1);var s=e.getExternalModuleRequireArgument(t)||t.moduleSpecifier,c=Hi(t,s),l=!e.isPropertyAccessExpression(r)&&r.propertyName||r.name;if(e.isIdentifier(l)){var u=Zi(c,s,!1,"default"===l.escapedText&&!(!V.allowSyntheticDefaultImports&&!e.getESModuleInterop(V)));if(u&&l.escapedText){if(e.isShorthandAmbientModuleSymbol(c))return c;var _=void 0;_=c&&c.exports&&c.exports.get("export=")?Zc($o(u),l.escapedText,!0):function(e,t){if(3&e.flags){var r=e.valueDeclaration.type;if(r)return Li(Zc(kd(r),t))}}(u,l.escapedText),_=Li(_,i);var d=function(e,t,r,n){if(1536&e.flags){var i=ia(e).get(t.escapedText),a=Li(i,n);return Bi(r,i,a,!1),a}}(u,l,r,i);if(void 0===d&&"default"===l.escapedText){var p=null===(a=c.declarations)||void 0===a?void 0:a.find(e.isSourceFile);(Ni(s)||Fi(p,c,i,s))&&(d=Yi(c,i)||Li(c,i));}var f=d&&_&&d!==_?function(t,r){if(t===we&&r===we)return we;if(790504&t.flags)return t;var n=Hn(t.flags|r.flags,t.escapedName);return n.declarations=e.deduplicate(e.concatenate(t.declarations,r.declarations),e.equateValues),n.parent=t.parent||r.parent,t.valueDeclaration&&(n.valueDeclaration=t.valueDeclaration),r.members&&(n.members=new e.Map(r.members)),t.exports&&(n.exports=new e.Map(t.exports)),n}(_,d):d||_;if(!f){var g=Vi(c,t),m=e.declarationNameToString(l),y=Xv(l,u);if(void 0!==y){var v=Ua(y),h=Jn(l,e.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2,g,m,v);y.valueDeclaration&&e.addRelatedInfo(h,e.createDiagnosticForNode(y.valueDeclaration,e.Diagnostics._0_is_declared_here,v));}else (null===(o=c.exports)||void 0===o?void 0:o.has("default"))?Jn(l,e.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,g,m):function(t,r,i,a,o){var s,c,l=null===(c=null===(s=a.valueDeclaration)||void 0===s?void 0:s.locals)||void 0===c?void 0:c.get(r.escapedText),u=a.exports;if(l){var _=null==u?void 0:u.get("export=");if(_)fa(_,l)?function(t,r,n,i){W>=e.ModuleKind.ES2015?Jn(r,e.getESModuleInterop(V)?e.Diagnostics._0_can_only_be_imported_by_using_a_default_import:e.Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import,n):e.isInJSFile(t)?Jn(r,e.getESModuleInterop(V)?e.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import:e.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import,n):Jn(r,e.getESModuleInterop(V)?e.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import:e.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import,n,n,i);}(t,r,i,o):Jn(r,e.Diagnostics.Module_0_has_no_exported_member_1,o,i);else {var d=u?e.find(dl(u),(function(e){return !!fa(e,l)})):void 0,p=d?Jn(r,e.Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2,o,i,Ua(d)):Jn(r,e.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported,o,i);l.declarations&&e.addRelatedInfo.apply(void 0,n$4([p],e.map(l.declarations,(function(t,r){return e.createDiagnosticForNode(t,0===r?e.Diagnostics._0_is_declared_here:e.Diagnostics.and_here,i)})),!1));}}else Jn(r,e.Diagnostics.Module_0_has_no_exported_member_1,o,i);}(t,l,m,c,g);}return f}}}function Pi(t){if(e.isVariableDeclaration(t)&&t.initializer&&e.isPropertyAccessExpression(t.initializer))return t.initializer}function wi(e,t,r){var n=e.parent.parent.moduleSpecifier?Ai(e.parent.parent,e,r):qi(e.propertyName||e.name,t,!1,r);return Bi(e,void 0,n,!1),n}function Ii(t,r){return e.isClassExpression(t)?cx(t).symbol:e.isEntityName(t)||e.isEntityNameExpression(t)?qi(t,901119,!0,r)||(cx(t),ni(t).resolvedSymbol):void 0}function Oi(t,r){switch(void 0===r&&(r=!1),t.kind){case 265:case 254:return function(t,r){var n=Pi(t);if(n){var i=e.getLeftmostAccessExpression(n.expression).arguments[0];return e.isIdentifier(n.name)?Li(Zc(Tl(i),n.name.escapedText)):void 0}if(e.isVariableDeclaration(t)||277===t.moduleReference.kind){var a=Hi(t,e.getExternalModuleRequireArgument(t)||e.getExternalModuleImportEqualsDeclarationExpression(t)),o=Yi(a);return Bi(t,a,o,!1),o}var s=Ui(t.moduleReference,r);return function(t,r){if(Bi(t,void 0,r,!1)&&!t.isTypeOnly){var n=Ji(la(t)),i=275===n.kind,a=i?e.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type:e.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type,o=i?e.Diagnostics._0_was_exported_here:e.Diagnostics._0_was_imported_here,s=e.unescapeLeadingUnderscores(n.name.escapedText);e.addRelatedInfo(Jn(t.moduleReference,a),e.createDiagnosticForNode(n,o,s));}}(t,s),s}(t,r);case 267:return function(t,r){var n,i=Hi(t,t.parent.moduleSpecifier);if(i){var a;a=e.isShorthandAmbientModuleSymbol(i)?i:Ti(i,"default",t,r);var o=null===(n=i.declarations)||void 0===n?void 0:n.find(e.isSourceFile),s=Ni(t.parent.moduleSpecifier),c=Fi(o,i,r,t.parent.moduleSpecifier);if(a||c||s){if(c||s){var l=Yi(i,r)||Li(i,r);return Bi(t,i,l,!1),l}}else if(ea(i)){var u=W>=e.ModuleKind.ES2015?"allowSyntheticDefaultImports":"esModuleInterop",_=i.exports.get("export=").valueDeclaration,d=Jn(t.name,e.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag,Ua(i),u);_&&e.addRelatedInfo(d,e.createDiagnosticForNode(_,e.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,u));}else !function(t,r){var n,i,a;if(null===(n=t.exports)||void 0===n?void 0:n.has(r.symbol.escapedName))Jn(r.name,e.Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,Ua(t),Ua(r.symbol));else {var o=Jn(r.name,e.Diagnostics.Module_0_has_no_default_export,Ua(t)),s=null===(i=t.exports)||void 0===i?void 0:i.get("__export");if(s){var c=null===(a=s.declarations)||void 0===a?void 0:a.find((function(t){var r,n;return !!(e.isExportDeclaration(t)&&t.moduleSpecifier&&(null===(n=null===(r=Hi(t,t.moduleSpecifier))||void 0===r?void 0:r.exports)||void 0===n?void 0:n.has("default")))}));c&&e.addRelatedInfo(o,e.createDiagnosticForNode(c,e.Diagnostics.export_Asterisk_does_not_re_export_a_default));}}}(i,t);return Bi(t,a,void 0,!1),a}}(t,r);case 268:return function(e,t){var r=e.parent.parent.moduleSpecifier,n=Hi(e,r),i=Zi(n,r,t,!1);return Bi(e,n,i,!1),i}(t,r);case 274:return function(e,t){var r=e.parent.moduleSpecifier,n=r&&Hi(e,r),i=r&&Zi(n,r,t,!1);return Bi(e,n,i,!1),i}(t,r);case 270:case 203:return function(t,r){var n=e.isBindingElement(t)?e.getRootDeclaration(t):t.parent.parent.parent,i=Pi(n),a=Ai(n,i||t,r),o=t.propertyName||t.name;return i&&a&&e.isIdentifier(o)?Li(Zc($o(a),o.escapedText),r):(Bi(t,void 0,a,!1),a)}(t,r);case 275:return wi(t,901119,r);case 271:case 221:return function(t,r){var n=Ii(e.isExportAssignment(t)?t.expression:t.right,r);return Bi(t,void 0,n,!1),n}(t,r);case 264:return function(e,t){var r=Yi(e.parent.symbol,t);return Bi(e,void 0,r,!1),r}(t,r);case 297:return qi(t.name,901119,!0,r);case 296:return function(e,t){return Ii(e.initializer,t)}(t,r);case 207:case 206:return function(t,r){if(e.isBinaryExpression(t.parent)&&t.parent.left===t&&63===t.parent.operatorToken.kind)return Ii(t.parent.right,r)}(t,r);default:return e.Debug.fail()}}function Mi(e,t){return void 0===t&&(t=901119),!(!e||2097152!=(e.flags&(2097152|t))&&!(2097152&e.flags&&67108864&e.flags))}function Li(e,t){return !t&&Mi(e)?Ri(e):e}function Ri(t){e.Debug.assert(0!=(2097152&t.flags),"Should only get Alias here.");var r=ri(t);if(r.aliasTarget)r.aliasTarget===Ie&&(r.aliasTarget=we);else {r.aliasTarget=Ie;var n=xi(t);if(!n)return e.Debug.fail();var i=Oi(n);r.aliasTarget===Ie?r.aliasTarget=i||we:Jn(n,e.Diagnostics.Circular_definition_of_import_alias_0,Ua(t));}return r.aliasTarget}function Bi(t,r,n,i){if(!t||e.isPropertyAccessExpression(t))return !1;var a=la(t);if(e.isTypeOnlyImportOrExportDeclaration(t))return ri(a).typeOnlyDeclaration=t,!0;var o=ri(a);return ji(o,r,i)||ji(o,n,i)}function ji(t,r,n){var i,a,o;if(r&&(void 0===t.typeOnlyDeclaration||n&&!1===t.typeOnlyDeclaration)){var s=null!==(a=null===(i=r.exports)||void 0===i?void 0:i.get("export="))&&void 0!==a?a:r,c=s.declarations&&e.find(s.declarations,e.isTypeOnlyImportOrExportDeclaration);t.typeOnlyDeclaration=null!==(o=null!=c?c:ri(s).typeOnlyDeclaration)&&void 0!==o&&o;}return !!t.typeOnlyDeclaration}function Ji(e){if(2097152&e.flags)return ri(e).typeOnlyDeclaration||void 0}function zi(e){var t=la(e),r=Ri(t);r&&(r===we||111551&r.flags&&!TT(r)&&!Ji(t))&&Ki(t);}function Ki(t){var r=ri(t);if(!r.referenced){r.referenced=!0;var n=xi(t);if(!n)return e.Debug.fail();if(e.isInternalModuleImportEqualsDeclaration(n)){var i=Li(t);(i===we||111551&i.flags)&&cx(n.moduleReference);}}}function Ui(t,r){return 79===t.kind&&e.isRightSideOfQualifiedNameOrPropertyAccess(t)&&(t=t.parent),79===t.kind||161===t.parent.kind?qi(t,1920,!1,r):(e.Debug.assert(265===t.parent.kind),qi(t,901119,!1,r))}function Vi(e,t){return e.parent?Vi(e.parent,t)+"."+Ua(e):Ua(e,t,void 0,20)}function qi(t,r,n,i,a){if(!e.nodeIsMissing(t)){var o,s=1920|(e.isInJSFile(t)?111551&r:0);if(79===t.kind){var c=r===s||e.nodeIsSynthesized(t)?e.Diagnostics.Cannot_find_namespace_0:zg(e.getFirstIdentifier(t)),l=e.isInJSFile(t)&&!e.nodeIsSynthesized(t)?function(t,r){if(pu(t.parent)){var n=function(t){if(!e.findAncestor(t,(function(t){return e.isJSDocNode(t)||8388608&t.flags?e.isJSDocTypeAlias(t):"quit"}))){var r=e.getJSDocHost(t);if(r&&e.isExpressionStatement(r)&&e.isPrototypePropertyAssignment(r.expression)&&(n=la(r.expression.left)))return Wi(n);if(r&&e.isFunctionExpression(r)&&e.isPrototypePropertyAssignment(r.parent)&&e.isExpressionStatement(r.parent.parent)&&(n=la(r.parent.left)))return Wi(n);if(r&&(e.isObjectLiteralMethod(r)||e.isPropertyAssignment(r))&&e.isBinaryExpression(r.parent.parent)&&6===e.getAssignmentDeclarationKind(r.parent.parent)&&(n=la(r.parent.parent.left)))return Wi(n);var n,i=e.getEffectiveJSDocHost(t);if(i&&e.isFunctionLike(i))return (n=la(i))&&n.valueDeclaration}}(t.parent);if(n)return li(n,t.escapedText,r,void 0,t,!0)}}(t,r):void 0;if(!(o=ca(li(a||t,t.escapedText,r,n||l?void 0:c,t,!0,!1))))return ca(l)}else {if(161!==t.kind&&206!==t.kind)throw e.Debug.assertNever(t,"Unknown entity name kind.");var u=161===t.kind?t.left:t.expression,_=161===t.kind?t.right:t.name,d=qi(u,s,n,!1,a);if(!d||e.nodeIsMissing(_))return;if(d===we)return d;if(d.valueDeclaration&&e.isInJSFile(d.valueDeclaration)&&e.isVariableDeclaration(d.valueDeclaration)&&d.valueDeclaration.initializer&&nb(d.valueDeclaration.initializer)){var p=d.valueDeclaration.initializer.arguments[0],f=Hi(p,p);if(f){var g=Yi(f);g&&(d=g);}}if(!(o=ca(ai(ia(d),_.escapedText,r)))){if(!n){var m=Vi(d),y=e.declarationNameToString(_),v=Xv(_,d);if(v)return void Jn(_,e.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2,m,y,Ua(v));var h=e.isQualifiedName(t)&&function(t){for(;e.isQualifiedName(t.parent);)t=t.parent;return t}(t);if(Bt&&788968&r&&h&&!e.isTypeOfExpression(h.parent)&&function(t){var r=e.getFirstIdentifier(t),n=li(r,r.escapedText,111551,void 0,r,!0);if(n){for(;e.isQualifiedName(r.parent);){if(!(n=Zc($o(n),r.parent.right.escapedText)))return;r=r.parent;}return n}}(h))return void Jn(h,e.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0,e.entityNameToString(h));if(1920&r&&e.isQualifiedName(t.parent)){var b=ca(ai(ia(d),_.escapedText,788968));if(b)return void Jn(t.parent.right,e.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1,Ua(b),e.unescapeLeadingUnderscores(t.parent.right.escapedText))}Jn(_,e.Diagnostics.Namespace_0_has_no_exported_member_1,m,y);}return}}return e.Debug.assert(0==(1&e.getCheckFlags(o)),"Should never get an instantiated symbol here."),!e.nodeIsSynthesized(t)&&e.isEntityName(t)&&(2097152&o.flags||271===t.parent.kind)&&Bi(e.getAliasDeclarationFromName(t),o,void 0,!0),o.flags&r||i?o:Ri(o)}}function Wi(t){var r=t.parent.valueDeclaration;if(r)return (e.isAssignmentDeclaration(r)?e.getAssignedExpandoInitializer(r):e.hasOnlyExpressionInitializer(r)?e.getDeclaredExpandoInitializer(r):void 0)||r}function Hi(t,r,n){var i=e.getEmitModuleResolutionKind(V)===e.ModuleResolutionKind.Classic?e.Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option:e.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;return Gi(t,r,n?void 0:i)}function Gi(t,r,n,i){return void 0===i&&(i=!1),e.isStringLiteralLike(r)?Qi(t,r.text,n,r,i):void 0}function Qi(r,n,i,a,o){var s,c,l,u,_,d,p,f;void 0===o&&(o=!1),e.startsWith(n,"@types/")&&Jn(a,w=e.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1,e.removePrefix(n,"@types/"),n);var g=fl(n,!0);if(g)return g;var m=e.getSourceFileOfNode(r),y=e.isStringLiteralLike(r)?r:(null===(s=e.findAncestor(r,e.isImportCall))||void 0===s?void 0:s.arguments[0])||(null===(c=e.findAncestor(r,e.isImportDeclaration))||void 0===c?void 0:c.moduleSpecifier)||(null===(l=e.findAncestor(r,e.isExternalModuleImportEqualsDeclaration))||void 0===l?void 0:l.moduleReference.expression)||(null===(u=e.findAncestor(r,e.isExportDeclaration))||void 0===u?void 0:u.moduleSpecifier)||(null===(_=e.isModuleDeclaration(r)?r:r.parent&&e.isModuleDeclaration(r.parent)&&r.parent.name===r?r.parent:void 0)||void 0===_?void 0:_.name)||(null===(d=e.isLiteralImportTypeNode(r)?r:void 0)||void 0===d?void 0:d.argument.literal),v=y&&e.isStringLiteralLike(y)?e.getModeForUsageLocation(m,y):m.impliedNodeFormat,h=e.getResolvedModule(m,n,v),b=h&&e.getResolutionDiagnostic(V,h),x=h&&(!b||b===e.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)&&t.getSourceFile(h.resolvedFileName);if(x){if(b&&Jn(a,b,n,h.resolvedFileName),x.symbol){if(h.isExternalLibraryImport&&!e.resolutionExtensionIsTSOrJson(h.extension)&&Xi(!1,a,h,n),e.getEmitModuleResolutionKind(V)===e.ModuleResolutionKind.Node16||e.getEmitModuleResolutionKind(V)===e.ModuleResolutionKind.NodeNext){var D=m.impliedNodeFormat===e.ModuleKind.CommonJS&&!e.findAncestor(r,e.isImportCall)||!!e.findAncestor(r,e.isImportEqualsDeclaration),S=e.findAncestor(r,(function(t){return e.isImportTypeNode(t)||e.isExportDeclaration(t)||e.isImportDeclaration(t)})),T=S&&e.isImportTypeNode(S)?null===(p=S.assertions)||void 0===p?void 0:p.assertClause:null==S?void 0:S.assertClause;D&&x.impliedNodeFormat===e.ModuleKind.ESNext&&!e.getResolutionModeOverrideForClause(T)&&Jn(a,e.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead,n);}return ca(x.symbol)}i&&Jn(a,e.Diagnostics.File_0_is_not_a_module,x.fileName);}else {if(Lt){var C=e.findBestPatternMatch(Lt,(function(e){return e.pattern}),n);if(C){var k=Rt&&Rt.get(n);return ca(k||C.symbol)}}if(h&&!e.resolutionExtensionIsTSOrJson(h.extension)&&void 0===b||b===e.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type)o?Jn(a,w=e.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented,n,h.resolvedFileName):Xi($&&!!i,a,h,n);else if(i){if(h){var E=t.getProjectReferenceRedirect(h.resolvedFileName);if(E)return void Jn(a,e.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1,E,h.resolvedFileName)}if(b)Jn(a,b,n,h.resolvedFileName);else {var N=e.tryExtractTSExtension(n),F=e.pathIsRelative(n)&&!e.hasExtension(n),A=e.getEmitModuleResolutionKind(V),P=A===e.ModuleResolutionKind.Node16||A===e.ModuleResolutionKind.NodeNext;if(N){var w=e.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead,I=e.removeExtension(n,N);W>=e.ModuleKind.ES2015&&(I+=".mts"===N?".mjs":".cts"===N?".cjs":".js"),Jn(a,w,N,I);}else if(!V.resolveJsonModule&&e.fileExtensionIs(n,".json")&&e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.Classic&&e.hasJsonModuleEmitEnabled(V))Jn(a,e.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension,n);else if(v===e.ModuleKind.ESNext&&P&&F){var O=e.getNormalizedAbsolutePath(n,e.getDirectoryPath(m.path)),M=null===(f=On.find((function(e){var r=e[0];return t.fileExists(O+r)})))||void 0===f?void 0:f[1];M?Jn(a,e.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,n+M):Jn(a,e.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);}else Jn(a,i,n);}}}}function Xi(t,r,n,i){var a,o=n.packageId,s=n.resolvedFileName,c=!e.isExternalModuleNameRelative(i)&&o?(a=o.name,f().has(e.getTypesPackageName(a))?e.chainDiagnosticMessages(void 0,e.Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1,o.name,e.mangleScopedPackageName(o.name)):function(e){return !!f().get(e)}(o.name)?e.chainDiagnosticMessages(void 0,e.Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,o.name,i):e.chainDiagnosticMessages(void 0,e.Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,i,e.mangleScopedPackageName(o.name))):void 0;Kn(t,r,e.chainDiagnosticMessages(c,e.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type,i,s));}function Yi(t,r){if(null==t?void 0:t.exports){var n=function(t,r){if(!t||t===we||t===r||1===r.exports.size||2097152&t.flags)return t;var n=ri(t);if(n.cjsExportMerged)return n.cjsExportMerged;var i=33554432&t.flags?t:Xn(t);return i.flags=512|i.flags,void 0===i.exports&&(i.exports=e.createSymbolTable()),r.exports.forEach((function(e,t){"export="!==t&&i.exports.set(t,i.exports.has(t)?Yn(i.exports.get(t),e):e);})),ri(i).cjsExportMerged=i,n.cjsExportMerged=i}(ca(Li(t.exports.get("export="),r)),ca(t));return ca(n)||t}}function Zi(t,r,n,i){var a,o=Yi(t,n);if(!n&&o){if(!(i||1539&o.flags||e.getDeclarationOfKind(o,305))){var s=W>=e.ModuleKind.ES2015?"allowSyntheticDefaultImports":"esModuleInterop";return Jn(r,e.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export,s),o}var c=r.parent;if(e.isImportDeclaration(c)&&e.getNamespaceDeclarationNode(c)||e.isImportCall(c)){var l=e.isImportCall(c)?c.arguments[0]:c.moduleSpecifier,u=$o(o),_=tb(u,o,t,l);if(_)return $i(o,_,c);var d=null===(a=null==t?void 0:t.declarations)||void 0===a?void 0:a.find(e.isSourceFile),p=d&&Ei(ki(l),d.impliedNodeFormat);if(e.getESModuleInterop(V)||p){var f=$c(u,0);if(f&&f.length||(f=$c(u,1)),f&&f.length||Zc(u,"default",!0)||p)return $i(o,rb(u,o,t,l),c)}}}return o}function $i(t,r,n){var i=Hn(t.flags,t.escapedName);i.declarations=t.declarations?t.declarations.slice():[],i.parent=t.parent,i.target=t,i.originatingImport=n,t.valueDeclaration&&(i.valueDeclaration=t.valueDeclaration),t.constEnumOnlyModule&&(i.constEnumOnlyModule=!0),t.members&&(i.members=new e.Map(t.members)),t.exports&&(i.exports=new e.Map(t.exports));var a=Tc(r);return i.type=Ea(i,a.members,e.emptyArray,e.emptyArray,a.indexInfos),i}function ea(e){return void 0!==e.exports.get("export=")}function ta(e){return dl(aa(e))}function ra(e,t){var r=aa(t);if(r)return r.get(e)}function na(t){return !(131068&t.flags||1&e.getObjectFlags(t)||cf(t)||Nf(t))}function ia(e){return 6256&e.flags?Vs(e,"resolvedExports"):1536&e.flags?aa(e):e.exports||K}function aa(e){var t=ri(e);return t.resolvedExports||(t.resolvedExports=sa(e))}function oa(t,r,n,i){r&&r.forEach((function(r,a){if("default"!==a){var o=t.get(a);if(o){if(n&&i&&o&&Li(o)!==Li(r)){var s=n.get(a);s.exportsWithDuplicate?s.exportsWithDuplicate.push(i):s.exportsWithDuplicate=[i];}}else t.set(a,r),n&&i&&n.set(a,{specifierText:e.getTextOfNode(i.moduleSpecifier)});}}));}function sa(t){var r=[];return function t(n){if(n&&n.exports&&e.pushIfUnique(r,n)){var i=new e.Map(n.exports),a=n.exports.get("__export");if(a){var o=e.createSymbolTable(),s=new e.Map;if(a.declarations)for(var c=0,l=a.declarations;c<l.length;c++){var u=l[c];oa(o,t(Hi(u,u.moduleSpecifier)),s,u);}s.forEach((function(t,r){var n=t.exportsWithDuplicate;if("export="!==r&&n&&n.length&&!i.has(r))for(var a=0,o=n;a<o.length;a++){var c=o[a];Sn.add(e.createDiagnosticForNode(c,e.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity,s.get(r).specifierText,e.unescapeLeadingUnderscores(r)));}})),oa(i,o);}return i}}(t=Yi(t))||K}function ca(e){var t;return e&&e.mergeId&&(t=sn[e.mergeId])?t:e}function la(e){return ca(e.symbol&&Ws(e.symbol))}function ua(e){return ca(e.parent&&Ws(e.parent))}function _a(r,i,a){var o=ua(r);if(o&&!(262144&r.flags)){var s=e.mapDefined(o.declarations,(function(e){return o&&da(e,o)})),c=i&&function(r,n){var i,a=e.getSourceFileOfNode(n),o=O(a),s=ri(r);if(s.extendedContainersByFile&&(i=s.extendedContainersByFile.get(o)))return i;if(a&&a.imports){for(var c=0,l=a.imports;c<l.length;c++){var u=l[c];if(!e.nodeIsSynthesized(u)){var _=Hi(n,u,!0);_&&pa(_,r)&&(i=e.append(i,_));}}if(e.length(i))return (s.extendedContainersByFile||(s.extendedContainersByFile=new e.Map)).set(o,i),i}if(s.extendedContainers)return s.extendedContainers;for(var d=0,p=t.getSourceFiles();d<p.length;d++){var f=p[d];if(e.isExternalModule(f)){var g=la(f);pa(g,r)&&(i=e.append(i,g));}}return s.extendedContainers=i||e.emptyArray}(r,i),l=function(t,r){var n=!!e.length(t.declarations)&&e.first(t.declarations);if(111551&r&&n&&n.parent&&e.isVariableDeclaration(n.parent)&&(e.isObjectLiteralExpression(n)&&n===n.parent.initializer||e.isTypeLiteralNode(n)&&n===n.parent.type))return la(n.parent)}(o,a);if(i&&o.flags&Fa(a)&&Aa(o,i,1920,!1))return e.append(e.concatenate(e.concatenate([o],s),c),l);var u=!(o.flags&Fa(a))&&788968&o.flags&&524288&Es(o).flags&&111551===a?Na(i,(function(t){return e.forEachEntry(t,(function(e){if(e.flags&Fa(a)&&$o(e)===Es(o))return e}))})):void 0,_=n$4(n$4(u?[u]:[],s,!0),[o],!1);return _=e.append(_,l),e.addRange(_,c)}var d=e.mapDefined(r.declarations,(function(t){if(!e.isAmbientModule(t)&&t.parent){if(Ja(t.parent))return la(t.parent);if(e.isModuleBlock(t.parent)&&t.parent.parent&&Yi(la(t.parent.parent))===r)return la(t.parent.parent)}if(e.isClassExpression(t)&&e.isBinaryExpression(t.parent)&&63===t.parent.operatorToken.kind&&e.isAccessExpression(t.parent.left)&&e.isEntityNameExpression(t.parent.left.expression))return e.isModuleExportsAccessExpression(t.parent.left)||e.isExportsIdentifier(t.parent.left.expression)?la(e.getSourceFileOfNode(t)):(cx(t.parent.left.expression),ni(t.parent.left.expression).resolvedSymbol)}));if(e.length(d))return e.mapDefined(d,(function(e){return pa(e,r)?e:void 0}))}function da(e,t){var r=Ba(e),n=r&&r.exports&&r.exports.get("export=");return n&&fa(n,t)?r:void 0}function pa(t,r){if(t===ua(r))return r;var n=t.exports&&t.exports.get("export=");if(n&&fa(n,r))return t;var i=ia(t),a=i.get(r.escapedName);return a&&fa(a,r)?a:e.forEachEntry(i,(function(e){if(fa(e,r))return e}))}function fa(e,t){if(ca(Li(ca(e)))===ca(Li(ca(t))))return e}function ga(e){return ca(e&&0!=(1048576&e.flags)&&e.exportSymbol||e)}function ma(e){return !!(111551&e.flags||2097152&e.flags&&111551&Ri(e).flags&&!Ji(e))}function ya(t){for(var r=0,n=t.members;r<n.length;r++){var i=n[r];if(171===i.kind&&e.nodeIsPresent(i.body))return i}}function va(t){var r=new v(fe,t);return b++,r.id=b,null===e.tracing||void 0===e.tracing||e.tracing.recordType(r),r}function ha(e){return new v(fe,e)}function ba(e,t,r){void 0===r&&(r=0);var n=va(e);return n.intrinsicName=t,n.objectFlags=r,n}function xa(e,t){var r=va(524288);return r.objectFlags=e,r.symbol=t,r.members=void 0,r.properties=void 0,r.callSignatures=void 0,r.constructSignatures=void 0,r.indexInfos=void 0,r}function Da(e){var t=va(262144);return e&&(t.symbol=e),t}function Sa(e){return 95===e.charCodeAt(0)&&95===e.charCodeAt(1)&&95!==e.charCodeAt(2)&&64!==e.charCodeAt(2)&&35!==e.charCodeAt(2)}function Ta(t){var r;return t.forEach((function(e,t){Ca(e,t)&&(r||(r=[])).push(e);})),r||e.emptyArray}function Ca(e,t){return !Sa(t)&&ma(e)}function ka(t,r,n,i,a){var o=t;return o.members=r,o.properties=e.emptyArray,o.callSignatures=n,o.constructSignatures=i,o.indexInfos=a,r!==K&&(o.properties=Ta(r)),o}function Ea(e,t,r,n,i){return ka(xa(16,e),t,r,n,i)}function Na(t,r){for(var n,i=function(t){if(t.locals&&!ii(t)&&(n=r(t.locals,void 0,!0,t)))return {value:n};switch(t.kind){case 305:if(!e.isExternalOrCommonJsModule(t))break;case 261:var i=la(t);if(n=r((null==i?void 0:i.exports)||K,void 0,!0,t))return {value:n};break;case 257:case 226:case 258:var a;if((la(t).members||K).forEach((function(t,r){788968&t.flags&&(a||(a=e.createSymbolTable())).set(r,t);})),a&&(n=r(a,void 0,!1,t)))return {value:n}}},a=t;a;a=a.parent){var o=i(a);if("object"==typeof o)return o.value}return r(ce,void 0,!0)}function Fa(e){return 111551===e?111551:1920}function Aa(t,r,n,i,a){if(void 0===a&&(a=new e.Map),t&&!function(e){if(e.declarations&&e.declarations.length){for(var t=0,r=e.declarations;t<r.length;t++)switch(r[t].kind){case 167:case 169:case 172:case 173:continue;default:return !1}return !0}return !1}(t)){var o=ri(t),s=o.accessibleChainCache||(o.accessibleChainCache=new e.Map),c=Na(r,(function(e,t,r,n){return n})),l="".concat(i?0:1,"|").concat(c&&O(c),"|").concat(n);if(s.has(l))return s.get(l);var u=M(t),_=a.get(u);_||a.set(u,_=[]);var d=Na(r,p);return s.set(l,d),d}function p(n,a,o){if(e.pushIfUnique(_,n)){var s=function(n,a,o){return g(n.get(t.escapedName),void 0,a)?[t]:e.forEachEntry(n,(function(n){if(2097152&n.flags&&"export="!==n.escapedName&&"default"!==n.escapedName&&!(e.isUMDExportSymbol(n)&&r&&e.isExternalModule(e.getSourceFileOfNode(r)))&&(!i||e.some(n.declarations,e.isExternalModuleImportEqualsDeclaration))&&(!o||!e.some(n.declarations,e.isNamespaceReexportDeclaration))&&(a||!e.getDeclarationOfKind(n,275))){var s=m(n,Ri(n),a);if(s)return s}if(n.escapedName===t.escapedName&&n.exportSymbol&&g(ca(n.exportSymbol),void 0,a))return [t]}))||(n===ce?m(ue,ue,a):void 0)}(n,a,o);return _.pop(),s}}function f(e,t){return !Pa(e,r,t)||!!Aa(e.parent,r,Fa(t),i,a)}function g(r,i,a){return (t===(i||r)||ca(t)===ca(i||r))&&!e.some(r.declarations,Ja)&&(a||f(ca(r),n))}function m(e,t,r){if(g(e,t,r))return [e];var i=ia(t),a=i&&p(i,!0);return a&&f(e,Fa(n))?[e].concat(a):void 0}}function Pa(t,r,n){var i=!1;return Na(r,(function(r){var a=ca(r.get(t.escapedName));return !!a&&(a===t||!!((a=2097152&a.flags&&!e.getDeclarationOfKind(a,275)?Ri(a):a).flags&n)&&(i=!0,!0))})),i}function wa(e,t){return 0===Ra(e,t,788968,!1,!0).accessibility}function Ia(e,t){return 0===Ra(e,t,111551,!1,!0).accessibility}function Oa(e,t,r){return 0===Ra(e,t,r,!1,!1).accessibility}function Ma(t,r,n,i,a,o){if(e.length(t)){for(var s,c=!1,l=0,u=t;l<u.length;l++){var _=u[l],d=Aa(_,r,i,!1);if(d){s=_;var p=za(d[0],a);if(p)return p}if(o&&e.some(_.declarations,Ja)){if(a){c=!0;continue}return {accessibility:0}}var f=Ma(_a(_,r,i),r,n,n===_?Fa(i):i,a,o);if(f)return f}return c?{accessibility:0}:s?{accessibility:1,errorSymbolName:Ua(n,r,i),errorModuleName:s!==n?Ua(s,r,1920):void 0}:void 0}}function La(e,t,r,n){return Ra(e,t,r,n,!0)}function Ra(t,r,n,i,a){if(t&&r){var o=Ma([t],r,t,n,i,a);if(o)return o;var s=e.forEach(t.declarations,Ba);return s&&s!==Ba(r)?{accessibility:2,errorSymbolName:Ua(t,r,n),errorModuleName:Ua(s),errorNode:e.isInJSFile(r)?r:void 0}:{accessibility:1,errorSymbolName:Ua(t,r,n)}}return {accessibility:0}}function Ba(t){var r=e.findAncestor(t,ja);return r&&la(r)}function ja(t){return e.isAmbientModule(t)||305===t.kind&&e.isExternalOrCommonJsModule(t)}function Ja(t){return e.isModuleWithStringLiteralName(t)||305===t.kind&&e.isExternalOrCommonJsModule(t)}function za(t,r){var n;if(e.every(e.filter(t.declarations,(function(e){return 79!==e.kind})),(function(r){var n,a;if(!no(r)){var o=bi(r);return o&&!e.hasSyntacticModifier(o,1)&&no(o.parent)?i(r,o):e.isVariableDeclaration(r)&&e.isVariableStatement(r.parent.parent)&&!e.hasSyntacticModifier(r.parent.parent,1)&&no(r.parent.parent.parent)?i(r,r.parent.parent):e.isLateVisibilityPaintedStatement(r)&&!e.hasSyntacticModifier(r,1)&&no(r.parent)?i(r,r):!!(2097152&t.flags&&e.isBindingElement(r)&&e.isInJSFile(r)&&(null===(n=r.parent)||void 0===n?void 0:n.parent)&&e.isVariableDeclaration(r.parent.parent)&&(null===(a=r.parent.parent.parent)||void 0===a?void 0:a.parent)&&e.isVariableStatement(r.parent.parent.parent.parent)&&!e.hasSyntacticModifier(r.parent.parent.parent.parent,1)&&r.parent.parent.parent.parent.parent&&no(r.parent.parent.parent.parent.parent))&&i(r,r.parent.parent.parent.parent)}return !0})))return {accessibility:0,aliasesToMakeVisible:n};function i(t,i){return r&&(ni(t).isVisible=!0,n=e.appendIfUnique(n,i)),!0}}function Ka(t,r){var n;n=181===t.parent.kind||228===t.parent.kind&&!e.isPartOfTypeNode(t.parent)||162===t.parent.kind?1160127:161===t.kind||206===t.kind||265===t.parent.kind?1920:788968;var i=e.getFirstIdentifier(t),a=li(r,i.escapedText,n,void 0,void 0,!1);return a&&262144&a.flags&&788968&n?{accessibility:0}:a&&za(a,!0)||{accessibility:1,errorSymbolName:e.getTextOfNode(i),errorNode:i}}function Ua(t,r,n,i,a){void 0===i&&(i=4);var o=70221824;2&i&&(o|=128),1&i&&(o|=512),8&i&&(o|=16384),16&i&&(o|=134217728);var s=4&i?se.symbolToExpression:se.symbolToEntityName;return a?c(a).getText():e.usingSingleLineStringWriter(c);function c(i){var a=s(t,n,r,o),c=305===(null==r?void 0:r.kind)?e.createPrinter({removeComments:!0,neverAsciiEscape:!0}):e.createPrinter({removeComments:!0}),l=r&&e.getSourceFileOfNode(r);return c.writeNode(4,a,l,i),i}}function Va(t,r,n,i,a){return void 0===n&&(n=0),a?o(a).getText():e.usingSingleLineStringWriter(o);function o(a){var o;o=262144&n?1===i?180:179:1===i?175:174;var s=se.signatureToSignatureDeclaration(t,o,r,70222336|Qa(n)),c=e.createPrinter({removeComments:!0,omitTrailingSemicolon:!0}),l=r&&e.getSourceFileOfNode(r);return c.writeNode(4,s,l,e.getTrailingSemicolonDeferringWriter(a)),a}}function qa(t,r,n,i){void 0===n&&(n=1064960),void 0===i&&(i=e.createTextWriter(""));var a=V.noErrorTruncation||1&n,o=se.typeToTypeNode(t,r,70221824|Qa(n)|(a?1:0),i);if(void 0===o)return e.Debug.fail("should always get typenode");var s={removeComments:t!==Je},c=e.createPrinter(s),l=r&&e.getSourceFileOfNode(r);c.writeNode(4,o,l,i);var u=i.getText(),_=a?2*e.noTruncationMaximumTruncationLength:2*e.defaultMaximumTruncationLength;return _&&u&&u.length>=_?u.substr(0,_-"...".length)+"...":u}function Wa(e,t){var r=Ga(e.symbol)?qa(e,e.symbol.valueDeclaration):qa(e),n=Ga(t.symbol)?qa(t,t.symbol.valueDeclaration):qa(t);return r===n&&(r=Ha(e),n=Ha(t)),[r,n]}function Ha(e){return qa(e,void 0,64)}function Ga(t){return t&&!!t.valueDeclaration&&e.isExpression(t.valueDeclaration)&&!rp(t.valueDeclaration)}function Qa(e){return void 0===e&&(e=0),814775659&e}function Xa(t){return !!(t.symbol&&32&t.symbol.flags&&(t===vs(t.symbol)||524288&t.flags&&16777216&e.getObjectFlags(t)))}function Ya(t,r,n,i){return void 0===n&&(n=16384),i?a(i).getText():e.usingSingleLineStringWriter(a);function a(i){var a=e.factory.createTypePredicateNode(2===t.kind||3===t.kind?e.factory.createToken(128):void 0,1===t.kind||3===t.kind?e.factory.createIdentifier(t.parameterName):e.factory.createThisTypeNode(),t.type&&se.typeToTypeNode(t.type,r,70222336|Qa(n))),o=e.createPrinter({removeComments:!0}),s=r&&e.getSourceFileOfNode(r);return o.writeNode(4,a,s,i),i}}function Za(e){return 8===e?"private":16===e?"protected":"public"}function $a(t){return t&&t.parent&&262===t.parent.kind&&e.isExternalModuleAugmentation(t.parent.parent)}function eo(t){return 305===t.kind||e.isAmbientModule(t)}function to(t,r){var n=ri(t).nameType;if(n){if(384&n.flags){var i=""+n.value;return e.isIdentifierText(i,e.getEmitScriptTarget(V))||e.isNumericLiteralName(i)?e.isNumericLiteralName(i)&&e.startsWith(i,"-")?"[".concat(i,"]"):i:'"'.concat(e.escapeString(i,34),'"')}if(8192&n.flags)return "[".concat(ro(n.symbol,r),"]")}}function ro(t,r){if(r&&"default"===t.escapedName&&!(16384&r.flags)&&(!(16777216&r.flags)||!t.declarations||r.enclosingDeclaration&&e.findAncestor(t.declarations[0],eo)!==e.findAncestor(r.enclosingDeclaration,eo)))return "default";if(t.declarations&&t.declarations.length){var n=e.firstDefined(t.declarations,(function(t){return e.getNameOfDeclaration(t)?t:void 0})),i=n&&e.getNameOfDeclaration(n);if(n&&i){if(e.isCallExpression(n)&&e.isBindableObjectDefinePropertyCall(n))return e.symbolName(t);if(e.isComputedPropertyName(i)&&!(4096&e.getCheckFlags(t))){var a=ri(t).nameType;if(a&&384&a.flags){var o=to(t,r);if(void 0!==o)return o}}return e.declarationNameToString(i)}if(n||(n=t.declarations[0]),n.parent&&254===n.parent.kind)return e.declarationNameToString(n.parent.name);switch(n.kind){case 226:case 213:case 214:return !r||r.encounteredError||131072&r.flags||(r.encounteredError=!0),226===n.kind?"(Anonymous class)":"(Anonymous function)"}}var s=to(t,r);return void 0!==s?s:e.symbolName(t)}function no(t){if(t){var r=ni(t);return void 0===r.isVisible&&(r.isVisible=!!function(){switch(t.kind){case 338:case 345:case 339:return !!(t.parent&&t.parent.parent&&t.parent.parent.parent&&e.isSourceFile(t.parent.parent.parent));case 203:return no(t.parent.parent);case 254:if(e.isBindingPattern(t.name)&&!t.name.elements.length)return !1;case 261:case 257:case 258:case 259:case 256:case 260:case 265:if(e.isExternalModuleAugmentation(t))return !0;var r=lo(t);return 1&e.getCombinedModifierFlags(t)||265!==t.kind&&305!==r.kind&&16777216&r.flags?no(r):ii(r);case 167:case 166:case 172:case 173:case 169:case 168:if(e.hasEffectiveModifier(t,24))return !1;case 171:case 175:case 174:case 176:case 164:case 262:case 179:case 180:case 182:case 178:case 183:case 184:case 187:case 188:case 191:case 197:return no(t.parent);case 267:case 268:case 270:return !1;case 163:case 305:case 264:return !0;case 271:default:return !1}}()),r.isVisible}return !1}function io(t,r){var n,i,a;return t.parent&&271===t.parent.kind?n=li(t,t.escapedText,2998271,void 0,t,!1):275===t.parent.kind&&(n=wi(t.parent,2998271)),n&&((a=new e.Set).add(M(n)),function t(n){e.forEach(n,(function(n){var o=bi(n)||n;if(r?ni(n).isVisible=!0:(i=i||[],e.pushIfUnique(i,o)),e.isInternalModuleImportEqualsDeclaration(n)){var s=n.moduleReference,c=li(n,e.getFirstIdentifier(s).escapedText,901119,void 0,void 0,!1);c&&a&&e.tryAddToSet(a,M(c))&&t(c.declarations);}}));}(n.declarations)),i}function ao(e,t){var r=oo(e,t);if(r>=0){for(var n=rn.length,i=r;i<n;i++)nn[i]=!1;return !1}return rn.push(e),nn.push(!0),an.push(t),!0}function oo(e,t){for(var r=rn.length-1;r>=0;r--){if(so(rn[r],an[r]))return -1;if(rn[r]===e&&an[r]===t)return r}return -1}function so(t,r){switch(r){case 0:return !!ri(t).type;case 5:return !!ni(t).resolvedEnumType;case 2:return !!ri(t).declaredType;case 1:return !!t.resolvedBaseConstructorType;case 3:return !!t.resolvedReturnType;case 4:return !!t.immediateBaseConstraint;case 6:return !!t.resolvedTypeArguments;case 7:return !!t.baseTypesResolved;case 8:return !!ri(t).writeType}return e.Debug.assertNever(r)}function co(){return rn.pop(),an.pop(),nn.pop()}function lo(t){return e.findAncestor(e.getRootDeclaration(t),(function(e){switch(e.kind){case 254:case 255:case 270:case 269:case 268:case 267:return !1;default:return !0}})).parent}function uo(e,t){var r=Zc(e,t);return r?$o(r):void 0}function _o(e){return e&&0!=(1&e.flags)}function po(e){return e===je||!!(1&e.flags&&e.aliasSymbol)}function fo(e,t){if(0!==t)return ko(e,!1,t);var r=la(e);return r&&ri(r).type||ko(e,!1,t)}function go(t,r,i){if(131072&(t=km(t,(function(e){return !(98304&e.flags)}))).flags)return St;if(1048576&t.flags)return Fm(t,(function(e){return go(e,r,i)}));for(var a=a_(e.map(r,v_)),o=[],s=[],c=0,l=Nc(t);c<l.length;c++){var u=h_(g=l[c],8576);_p(u,a)||24&e.getDeclarationModifierFlagsFromSymbol(g)||!dd(g)?s.push(u):o.push(g);}if(M_(t)||L_(a)){if(s.length&&(a=a_(n$4([a],s,!0))),131072&a.flags)return t;var _=(Dr||(Dr=Du("Omit",2,!0)||we),Dr===we?void 0:Dr);return _?nu(_,[t,a]):je}for(var d=e.createSymbolTable(),p=0,f=o;p<f.length;p++){var g=f[p];d.set(g.escapedName,pd(g,!1));}var m=Ea(i,d,e.emptyArray,e.emptyArray,al(t));return m.objectFlags|=4194304,m}function mo(e){return !!(465829888&e.flags)&&Hb(Mc(e)||Ue,32768)}function yo(e){return om(Tm(e,mo)?Fm(e,(function(e){return 465829888&e.flags?Lc(e):e})):e,524288)}function vo(e,t){var r=ho(e);return r?Xm(r,t):t}function ho(t){var r=function(e){var t=e.parent.parent;switch(t.kind){case 203:case 296:return ho(t);case 204:return ho(e.parent);case 254:return t.initializer;case 221:return t.right}}(t);if(r&&r.flowNode){var n=bo(t);if(n){var i=e.setTextRange(e.parseNodeFactory.createStringLiteral(n),t),a=e.isLeftHandSideExpression(r)?r:e.parseNodeFactory.createParenthesizedExpression(r),o=e.setTextRange(e.parseNodeFactory.createElementAccessExpression(a,i),t);return e.setParent(i,o),e.setParent(o,t),a!==r&&e.setParent(a,o),o.flowNode=r.flowNode,o}}}function bo(e){var t=e.parent;return 203===e.kind&&201===t.kind?xo(e.propertyName||e.name):296===e.kind||297===e.kind?xo(e.name):""+t.elements.indexOf(e)}function xo(e){var t=v_(e);return 384&t.flags?""+t.value:void 0}function Do(t,r){if(_o(r))return r;var n,i=t.parent;if(Q&&16777216&t.flags&&e.isParameterDeclaration(t)?r=Jf(r):!Q||!i.parent.initializer||65536&am(gm(i.parent.initializer))||(r=om(r,524288)),201===i.kind)if(t.dotDotDotToken){if(2&(r=Hc(r)).flags||!Yy(r))return Jn(t,e.Diagnostics.Rest_types_may_only_be_created_from_object_types),je;for(var a=[],o=0,s=i.elements;o<s.length;o++){var c=s[o];c.dotDotDotToken||a.push(c.propertyName||c.name);}n=go(r,a,t.symbol);}else {var l=t.propertyName||t.name;n=vo(t,K_(r,v_(l),32,l));}else {var u=zD(65|(t.dotDotDotToken?0:128),r,qe,i),_=i.elements.indexOf(t);n=t.dotDotDotToken?Cm(r,Nf)?Fm(r,(function(e){return Gu(e,_)})):Bu(u):pf(r)?vo(t,V_(r,hd(_),32|(Uy(t)?16:0),t.name)||je):u;}return t.initializer?e.getEffectiveTypeAnnotationNode(e.walkUpBindingElementsAndPatterns(t))?!Q||32768&Mf(ux(t,0))?n:yo(n):_x(t,a_([yo(n),ux(t,0)],2)):n}function So(t){var r=e.getJSDocType(t);if(r)return kd(r)}function To(t){var r=e.skipParentheses(t,!0);return 204===r.kind&&0===r.elements.length}function Co(e,t,r){return void 0===t&&(t=!1),void 0===r&&(r=!0),Q&&r?jf(e,t):e}function ko(t,r,n){if(e.isVariableDeclaration(t)&&243===t.parent.parent.kind){var i=D_(Cv(kx(t.parent.parent.expression,n)));return 4456448&i.flags?S_(i):Ye}if(e.isVariableDeclaration(t)&&244===t.parent.parent.kind)return JD(t.parent.parent)||Le;if(e.isBindingPattern(t.parent))return function(e){var t=e.dotDotDotToken?64:0,r=fo(e.parent.parent,t);return r&&Do(e,r)}(t);var a,o,s=e.isPropertyDeclaration(t)||e.isPropertySignature(t),c=r&&(s&&!!t.questionToken||e.isParameter(t)&&(!!t.questionToken||pl(t))||ml(t)),l=Ko(t);if(l)return Co(l,s,c);if(($||e.isInJSFile(t))&&e.isVariableDeclaration(t)&&!e.isBindingPattern(t.name)&&!(1&e.getCombinedModifierFlags(t))&&!(16777216&t.flags)){if(!(2&e.getCombinedNodeFlags(t)||t.initializer&&(a=t.initializer,o=e.skipParentheses(a,!0),104!==o.kind&&(79!==o.kind||Kg(o)!==le))))return Re;if(t.initializer&&To(t.initializer))return Xt}if(e.isParameter(t)){var u=t.parent;if(173===u.kind&&zs(u)){var _=e.getDeclarationOfKind(la(t.parent),172);if(_){var d=bl(_),p=uC(u);return p&&t===p?(e.Debug.assert(!p.type),$o(d.thisParameter)):Nl(d)}}if(e.isInJSFile(t)){var f=function(e,t){var r=xl(e);if(r){var n=e.parameters.indexOf(t);return t.dotDotDotToken?yb(r,n):gb(r,n)}}(u,t);if(f)return f}if(y="this"===t.symbol.escapedName?yy(u):vy(t))return Co(y,!1,c)}if(e.hasOnlyExpressionInitializer(t)&&t.initializer){if(e.isInJSFile(t)&&!e.isParameter(t)){var g=Io(t,la(t),e.getDeclaredExpandoInitializer(t));if(g)return g}return Co(y=_x(t,ux(t,n)),s,c)}if(e.isPropertyDeclaration(t)&&($||e.isInJSFile(t))){if(e.hasStaticModifier(t)){var m=e.filter(t.parent.members,e.isClassStaticBlockDeclaration);return (y=m.length?function(t,r){for(var n=e.startsWith(t.escapedName,"__#")?e.factory.createPrivateIdentifier(t.escapedName.split("@")[1]):e.unescapeLeadingUnderscores(t.escapedName),i=0,a=r;i<a.length;i++){var o=a[i],s=e.factory.createPropertyAccessExpression(e.factory.createThis(),n);e.setParent(s.expression,s),e.setParent(s,o),s.flowNode=o.returnFlowNode;var c=Po(s,t);if(!$||c!==Re&&c!==Xt||Jn(t.valueDeclaration,e.Diagnostics.Member_0_implicitly_has_an_1_type,Ua(t),qa(c)),!Cm(c,Tv))return AD(c)}}(t.symbol,m):2&e.getEffectiveModifierFlags(t)?ef(t.symbol):void 0)&&Co(y,!0,c)}var y,v=ya(t.parent);return (y=v?Ao(t.symbol,v):2&e.getEffectiveModifierFlags(t)?ef(t.symbol):void 0)&&Co(y,!0,c)}return e.isJsxAttribute(t)?rt:e.isBindingPattern(t.name)?Bo(t.name,!1,!0):void 0}function Eo(t){if(t.valueDeclaration&&e.isBinaryExpression(t.valueDeclaration)){var r=ri(t);return void 0===r.isConstructorDeclaredProperty&&(r.isConstructorDeclaredProperty=!1,r.isConstructorDeclaredProperty=!!Fo(t)&&e.every(t.declarations,(function(r){return e.isBinaryExpression(r)&&Cy(r)&&(207!==r.left.kind||e.isStringOrNumericLiteralLike(r.left.argumentExpression))&&!Oo(void 0,r,t,r)}))),r.isConstructorDeclaredProperty}return !1}function No(t){var r=t.valueDeclaration;return r&&e.isPropertyDeclaration(r)&&!e.getEffectiveTypeAnnotationNode(r)&&!r.initializer&&($||e.isInJSFile(r))}function Fo(t){if(t.declarations)for(var r=0,n=t.declarations;r<n.length;r++){var i=n[r],a=e.getThisContainer(i,!1);if(a&&(171===a.kind||Gh(a)))return a}}function Ao(t,r){var n=e.startsWith(t.escapedName,"__#")?e.factory.createPrivateIdentifier(t.escapedName.split("@")[1]):e.unescapeLeadingUnderscores(t.escapedName),i=e.factory.createPropertyAccessExpression(e.factory.createThis(),n);e.setParent(i.expression,i),e.setParent(i,r),i.flowNode=r.returnFlowNode;var a=Po(i,t);return !$||a!==Re&&a!==Xt||Jn(t.valueDeclaration,e.Diagnostics.Member_0_implicitly_has_an_1_type,Ua(t),qa(a)),Cm(a,Tv)?void 0:AD(a)}function Po(t,r){var n=(null==r?void 0:r.valueDeclaration)&&(!No(r)||2&e.getEffectiveModifierFlags(r.valueDeclaration))&&ef(r)||qe;return Xm(t,Re,n)}function wo(t,r){var n,i=e.getAssignedExpandoInitializer(t.valueDeclaration);if(i){var a=e.getJSDocTypeTag(i);return a&&a.typeExpression?kd(a.typeExpression):t.valueDeclaration&&Io(t.valueDeclaration,t,i)||Tf(cx(i))}var o=!1,s=!1;if(Eo(t)&&(n=Ao(t,Fo(t))),!n){var c=void 0;if(t.declarations){for(var l=void 0,u=0,_=t.declarations;u<_.length;u++){var d=_[u],p=e.isBinaryExpression(d)||e.isCallExpression(d)?d:e.isAccessExpression(d)?e.isBinaryExpression(d.parent)?d.parent:d:void 0;if(p){var f=e.isAccessExpression(p)?e.getAssignmentDeclarationPropertyAccessKind(p):e.getAssignmentDeclarationKind(p);(4===f||e.isBinaryExpression(p)&&Cy(p,f))&&(Lo(p)?o=!0:s=!0),e.isCallExpression(p)||(l=Oo(l,p,t,d)),l||(c||(c=[])).push(e.isBinaryExpression(p)||e.isCallExpression(p)?Mo(t,r,p,f):st);}}n=l;}if(!n){if(!e.length(c))return je;var g=o&&t.declarations?function(t,r){return e.Debug.assert(t.length===r.length),t.filter((function(t,n){var i=r[n],a=e.isBinaryExpression(i)?i:e.isBinaryExpression(i.parent)?i.parent:void 0;return a&&Lo(a)}))}(c,t.declarations):void 0;if(s){var m=ef(t);m&&((g||(g=[])).push(m),o=!0);}n=a_(e.some(g,(function(e){return !!(-98305&e.flags)}))?g:c);}}var y=rg(Co(n,!1,s&&!o));return t.valueDeclaration&&km(y,(function(e){return !!(-98305&e.flags)}))===st?(ag(t.valueDeclaration,Le),Le):y}function Io(t,r,n){var i,a;if(e.isInJSFile(t)&&n&&e.isObjectLiteralExpression(n)&&!n.properties.length){for(var o=e.createSymbolTable();e.isBinaryExpression(t)||e.isPropertyAccessExpression(t);){var s=la(t);(null===(i=null==s?void 0:s.exports)||void 0===i?void 0:i.size)&&ei(o,s.exports),t=e.isBinaryExpression(t)?t.parent:t.parent.parent;}var c=la(t);(null===(a=null==c?void 0:c.exports)||void 0===a?void 0:a.size)&&ei(o,c.exports);var l=Ea(r,o,e.emptyArray,e.emptyArray,e.emptyArray);return l.objectFlags|=4096,l}}function Oo(t,r,n,i){var a,o=e.getEffectiveTypeAnnotationNode(r.parent);if(o){var s=rg(kd(o));if(!t)return s;po(t)||po(s)||op(t,s)||wD(void 0,t,i,s);}if(null===(a=n.parent)||void 0===a?void 0:a.valueDeclaration){var c=e.getEffectiveTypeAnnotationNode(n.parent.valueDeclaration);if(c){var l=Zc(kd(c),n.escapedName);if(l)return es(l)}}return t}function Mo(t,r,n,i){if(e.isCallExpression(n)){if(r)return $o(r);var a=cx(n.arguments[2]),o=uo(a,"value");if(o)return o;var s=uo(a,"get");if(s){var c=fh(s);if(c)return Nl(c)}var l=uo(a,"set");if(l){var u=fh(l);if(u)return Sb(u)}return Le}if(function(t,r){return e.isPropertyAccessExpression(t)&&108===t.expression.kind&&e.forEachChildRecursively(r,(function(e){return qg(t,e)}))}(n.left,n.right))return Le;var _=1===i&&(e.isPropertyAccessExpression(n.left)||e.isElementAccessExpression(n.left))&&(e.isModuleExportsAccessExpression(n.left.expression)||e.isIdentifier(n.left.expression)&&e.isExportsIdentifier(n.left.expression)),d=r?$o(r):_?md(cx(n.right)):Tf(cx(n.right));if(524288&d.flags&&2===i&&"export="===t.escapedName){var p=Tc(d),f=e.createSymbolTable();e.copyEntries(p.members,f);var g=f.size;r&&!r.exports&&(r.exports=e.createSymbolTable()),(r||t).exports.forEach((function(t,r){var n,i=f.get(r);if(i&&i!==t)if(111551&t.flags&&111551&i.flags){if(t.valueDeclaration&&i.valueDeclaration&&e.getSourceFileOfNode(t.valueDeclaration)!==e.getSourceFileOfNode(i.valueDeclaration)){var a=e.unescapeLeadingUnderscores(t.escapedName),o=(null===(n=e.tryCast(i.valueDeclaration,e.isNamedDeclaration))||void 0===n?void 0:n.name)||i.valueDeclaration;e.addRelatedInfo(Jn(t.valueDeclaration,e.Diagnostics.Duplicate_identifier_0,a),e.createDiagnosticForNode(o,e.Diagnostics._0_was_also_declared_here,a)),e.addRelatedInfo(Jn(o,e.Diagnostics.Duplicate_identifier_0,a),e.createDiagnosticForNode(t.valueDeclaration,e.Diagnostics._0_was_also_declared_here,a));}var s=Hn(t.flags|i.flags,r);s.type=a_([$o(t),$o(i)]),s.valueDeclaration=i.valueDeclaration,s.declarations=e.concatenate(i.declarations,t.declarations),f.set(r,s);}else f.set(r,Yn(t,i));else f.set(r,t);}));var m=Ea(g!==f.size?void 0:p.symbol,f,p.callSignatures,p.constructSignatures,p.indexInfos);return m.objectFlags|=4096&e.getObjectFlags(d),m.symbol&&32&m.symbol.flags&&d===vs(m.symbol)&&(m.objectFlags|=16777216),m}return mf(d)?(ag(n,Qt),Qt):d}function Lo(t){var r=e.getThisContainer(t,!1);return 171===r.kind||256===r.kind||213===r.kind&&!e.isPrototypePropertyAssignment(r.parent)}function Ro(t,r,n){return t.initializer?Co(_x(t,ux(t,0,e.isBindingPattern(t.name)?Bo(t.name,!0,!1):Ue))):e.isBindingPattern(t.name)?Bo(t.name,r,n):(n&&!zo(t)&&ag(t,Le),r?ze:Le)}function Bo(t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=!1),201===t.kind?function(t,r,n){var i,a=e.createSymbolTable(),o=131200;e.forEach(t.elements,(function(e){var t=e.propertyName||e.name;if(e.dotDotDotToken)i=Jl(Ye,Le,!1);else {var s=v_(t);if(Rs(s)){var c=Ks(s),l=Hn(4|(e.initializer?16777216:0),c);l.type=Ro(e,r,n),l.bindingElement=e,a.set(l.escapedName,l);}else o|=512;}}));var s=Ea(void 0,a,e.emptyArray,e.emptyArray,i?[i]:e.emptyArray);return s.objectFlags|=o,r&&(s.pattern=t,s.objectFlags|=131072),s}(t,r,n):function(t,r,n){var i,a=t.elements,o=e.lastOrUndefined(a),s=o&&203===o.kind&&o.dotDotDotToken?o:void 0;if(0===a.length||1===a.length&&s)return q>=2?(i=Le,Lu(Iu(!0),[i])):Qt;var c=e.map(a,(function(t){return e.isOmittedExpression(t)?Le:Ro(t,r,n)})),l=e.findLastIndex(a,(function(t){return !(t===s||e.isOmittedExpression(t)||Uy(t))}),a.length-1)+1,u=Vu(c,e.map(a,(function(e,t){return e===s?4:t>=l?2:1})));return r&&((u=Zl(u)).pattern=t,u.objectFlags|=131072),u}(t,r,n)}function jo(e,t){return Jo(ko(e,!0,0),e,t)}function Jo(t,r,n){return t?(4096&t.flags&&(i=r.parent,a=la(i),(o=er||(er=xu("SymbolConstructor",!1)))&&a&&a===o)&&(t=Dd(r)),n&&og(r,t),8192&t.flags&&(e.isBindingElement(r)||!r.type)&&t.symbol!==la(r)&&(t=at),rg(t)):(t=e.isParameter(r)&&r.dotDotDotToken?Qt:Le,n&&(zo(r)||ag(r,t)),t);var i,a,o;}function zo(t){var r=e.getRootDeclaration(t);return Kx(164===r.kind?r.parent:r)}function Ko(t){var r=e.getEffectiveTypeAnnotationNode(t);if(r)return kd(r)}function Uo(t){if(t)return 172===t.kind?e.getEffectiveReturnTypeNode(t):e.getEffectiveSetAccessorTypeAnnotationNode(t)}function Vo(e){var t=Uo(e);return t&&kd(t)}function qo(t){var r=ri(t);if(!r.type){if(!ao(t,0))return je;var n=e.getDeclarationOfKind(t,172),i=e.getDeclarationOfKind(t,173),a=n&&e.isInJSFile(n)&&So(n)||Vo(n)||Vo(i)||n&&n.body&&Pb(n);a||(i&&!Kx(i)?Kn($,i,e.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation,Ua(t)):n&&!Kx(n)&&Kn($,n,e.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation,Ua(t)),a=Le),co()||(Uo(n)?Jn(n,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,Ua(t)):Uo(i)?Jn(i,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,Ua(t)):n&&$&&Jn(n,e.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions,Ua(t)),a=Le),r.type=a;}return r.type}function Wo(t){var r=ri(t);if(!r.writeType){if(!ao(t,8))return je;var n=e.getDeclarationOfKind(t,173),i=Vo(n);co()||(Uo(n)&&Jn(n,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,Ua(t)),i=Le),r.writeType=i||qo(t);}return r.writeType}function Ho(t){var r=ps(vs(t));return 8650752&r.flags?r:2097152&r.flags?e.find(r.types,(function(e){return !!(8650752&e.flags)})):void 0}function Go(t){var r=ri(t),n=r;if(!r.type){var i=t.valueDeclaration&&Xh(t.valueDeclaration,!1);if(i){var a=Qh(t,i);a&&(t=r=a);}n.type=r.type=function(t){var r=t.valueDeclaration;if(1536&t.flags&&e.isShorthandAmbientModuleSymbol(t))return Le;if(r&&(221===r.kind||e.isAccessExpression(r)&&221===r.parent.kind))return wo(t);if(512&t.flags&&r&&e.isSourceFile(r)&&r.commonJsModuleIndicator){var n=Yi(t);if(n!==t){if(!ao(t,0))return je;var i=ca(t.exports.get("export=")),a=wo(i,i===n?void 0:n);return co()?a:Xo(t)}}var o=xa(16,t);if(32&t.flags){var s=Ho(t);return s?p_([o,s]):o}return Q&&16777216&t.flags?jf(o):o}(t);}return r.type}function Qo(e){var t=ri(e);return t.type||(t.type=Cs(e))}function Xo(t){var r=t.valueDeclaration;return e.getEffectiveTypeAnnotationNode(r)?(Jn(t.valueDeclaration,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,Ua(t)),je):($&&(164!==r.kind||r.initializer)&&Jn(t.valueDeclaration,e.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,Ua(t)),Le)}function Yo(t){var r=ri(t);return r.type||(e.Debug.assertIsDefined(r.deferralParent),e.Debug.assertIsDefined(r.deferralConstituents),r.type=1048576&r.deferralParent.flags?a_(r.deferralConstituents):p_(r.deferralConstituents)),r.type}function Zo(t){var r=e.getCheckFlags(t);return 4&t.flags?2&r?65536&r?function(t){var r=ri(t);return !r.writeType&&r.deferralWriteConstituents&&(e.Debug.assertIsDefined(r.deferralParent),e.Debug.assertIsDefined(r.deferralConstituents),r.writeType=1048576&r.deferralParent.flags?a_(r.deferralWriteConstituents):p_(r.deferralWriteConstituents)),r.writeType}(t)||Yo(t):t.writeType||t.type:$o(t):98304&t.flags?1&r?function(e){var t=ri(e);return t.writeType||(t.writeType=Yd(Zo(t.target),t.mapper))}(t):Wo(t):$o(t)}function $o(t){var r=e.getCheckFlags(t);return 65536&r?Yo(t):1&r?function(e){var t=ri(e);return t.type||(t.type=Yd($o(t.target),t.mapper))}(t):262144&r?function(t){if(!t.type){var r=t.mappedType;if(!ao(t,0))return r.containsError=!0,je;var n=Yd(mc(r.target||r),Jd(r.mapper,pc(r),t.keyType)),i=Q&&16777216&t.flags&&!Hb(n,49152)?jf(n,!0):524288&t.checkFlags?Hf(n):n;co()||(Jn(u,e.Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1,Ua(t),qa(r)),i=je),t.type=i;}return t.type}(t):8192&r?function(e){var t=ri(e);return t.type||(t.type=Sg(e.propertyType,e.mappedType,e.constraintType)),t.type}(t):7&t.flags?function(t){var r=ri(t);if(!r.type){var n=function(t){if(4194304&t.flags)return (r=Es(ua(t))).typeParameters?Yl(r,e.map(r.typeParameters,(function(e){return Le}))):r;var r;if(t===pe)return Le;if(134217728&t.flags&&t.valueDeclaration){var n=la(e.getSourceFileOfNode(t.valueDeclaration)),i=Hn(n.flags,"exports");i.declarations=n.declarations?n.declarations.slice():[],i.parent=t,i.target=n,n.valueDeclaration&&(i.valueDeclaration=n.valueDeclaration),n.members&&(i.members=new e.Map(n.members)),n.exports&&(i.exports=new e.Map(n.exports));var a=e.createSymbolTable();return a.set("exports",i),Ea(t,a,e.emptyArray,e.emptyArray,e.emptyArray)}e.Debug.assertIsDefined(t.valueDeclaration);var o,s=t.valueDeclaration;if(e.isCatchClauseVariableDeclarationOrBindingElement(s)){var c=e.getEffectiveTypeAnnotationNode(s);if(void 0===c)return te?Ue:Le;var l=sT(c);return _o(l)||l===Ue?l:je}if(e.isSourceFile(s)&&e.isJsonSourceFile(s))return s.statements.length?rg(Tf(kx(s.statements[0].expression))):St;if(e.isAccessor(s))return qo(t);if(!ao(t,0))return 512&t.flags&&!(67108864&t.flags)?Go(t):Xo(t);if(271===s.kind)o=Jo(Ko(s)||cx(s.expression),s);else if(e.isBinaryExpression(s)||e.isInJSFile(s)&&(e.isCallExpression(s)||(e.isPropertyAccessExpression(s)||e.isBindableStaticElementAccessExpression(s))&&e.isBinaryExpression(s.parent)))o=wo(t);else if(e.isPropertyAccessExpression(s)||e.isElementAccessExpression(s)||e.isIdentifier(s)||e.isStringLiteralLike(s)||e.isNumericLiteral(s)||e.isClassDeclaration(s)||e.isFunctionDeclaration(s)||e.isMethodDeclaration(s)&&!e.isObjectLiteralMethod(s)||e.isMethodSignature(s)||e.isSourceFile(s)){if(9136&t.flags)return Go(t);o=e.isBinaryExpression(s.parent)?wo(t):Ko(s)||Le;}else if(e.isPropertyAssignment(s))o=Ko(s)||gx(s);else if(e.isJsxAttribute(s))o=Ko(s)||ev(s);else if(e.isShorthandPropertyAssignment(s))o=Ko(s)||fx(s.name,0);else if(e.isObjectLiteralMethod(s))o=Ko(s)||mx(s,0);else if(e.isParameter(s)||e.isPropertyDeclaration(s)||e.isPropertySignature(s)||e.isVariableDeclaration(s)||e.isBindingElement(s)||e.isJSDocPropertyLikeTag(s))o=jo(s,!0);else if(e.isEnumDeclaration(s))o=Go(t);else {if(!e.isEnumMember(s))return e.Debug.fail("Unhandled declaration kind! "+e.Debug.formatSyntaxKind(s.kind)+" for "+e.Debug.formatSymbol(t));o=Qo(t);}return co()?o:512&t.flags&&!(67108864&t.flags)?Go(t):Xo(t)}(t);r.type||(r.type=n);}return r.type}(t):9136&t.flags?Go(t):8&t.flags?Qo(t):98304&t.flags?qo(t):2097152&t.flags?function(t){var r=ri(t);if(!r.type){var n=Ri(t),i=t.declarations&&Oi(xi(t),!0),a=e.firstDefined(null==i?void 0:i.declarations,(function(t){return e.isExportAssignment(t)?Ko(t):void 0}));r.type=(null==i?void 0:i.declarations)&&US(i.declarations)&&t.declarations.length?function(t){var r=e.getSourceFileOfNode(t.declarations[0]),n=e.unescapeLeadingUnderscores(t.escapedName),i=t.declarations.every((function(t){return e.isInJSFile(t)&&e.isAccessExpression(t)&&e.isModuleExportsAccessExpression(t.expression)})),a=i?e.factory.createPropertyAccessExpression(e.factory.createPropertyAccessExpression(e.factory.createIdentifier("module"),e.factory.createIdentifier("exports")),n):e.factory.createPropertyAccessExpression(e.factory.createIdentifier("exports"),n);return i&&e.setParent(a.expression.expression,a.expression),e.setParent(a.expression,a),e.setParent(a,r),a.flowNode=r.endFlowNode,Xm(a,Re,qe)}(i):US(t.declarations)?Re:a||(111551&n.flags?$o(n):je);}return r.type}(t):je}function es(e){return qf($o(e),!!(16777216&e.flags))}function ts(t,r){return void 0!==t&&void 0!==r&&0!=(4&e.getObjectFlags(t))&&t.target===r}function rs(t){return 4&e.getObjectFlags(t)?t.target:t}function ns(t,r){return function t(n){if(7&e.getObjectFlags(n)){var i=rs(n);return i===r||e.some(gs(i),t)}return !!(2097152&n.flags)&&e.some(n.types,t)}(t)}function is(t,r){for(var n=0,i=r;n<i.length;n++){var a=i[n];t=e.appendIfUnique(t,ks(la(a)));}return t}function as(t,r){for(;;){if((t=t.parent)&&e.isBinaryExpression(t)){var n=e.getAssignmentDeclarationKind(t);if(6===n||3===n){var i=la(t.left);i&&i.parent&&!e.findAncestor(i.parent.valueDeclaration,(function(e){return t===e}))&&(t=i.parent.valueDeclaration);}}if(!t)return;switch(t.kind){case 257:case 226:case 258:case 174:case 175:case 168:case 179:case 180:case 317:case 256:case 169:case 213:case 214:case 259:case 344:case 345:case 339:case 338:case 195:case 189:var a=as(t,r);if(195===t.kind)return e.append(a,ks(la(t.typeParameter)));if(189===t.kind)return e.concatenate(a,td(t));var o=is(a,e.getEffectiveTypeParameterDeclarations(t)),s=r&&(257===t.kind||226===t.kind||258===t.kind||Gh(t))&&vs(la(t)).thisType;return s?e.append(o,s):o;case 340:var c=e.getParameterSymbolFromJSDoc(t);c&&(t=c.valueDeclaration);break;case 320:return a=as(t,r),t.tags?is(a,e.flatMap(t.tags,(function(t){return e.isJSDocTemplateTag(t)?t.typeParameters:void 0}))):a}}}function os(t){var r=32&t.flags?t.valueDeclaration:e.getDeclarationOfKind(t,258);return e.Debug.assert(!!r,"Class was missing valueDeclaration -OR- non-class had no interface declarations"),as(r)}function ss(t){if(t.declarations){for(var r,n=0,i=t.declarations;n<i.length;n++){var a=i[n];if(258===a.kind||257===a.kind||226===a.kind||Gh(a)||e.isTypeAlias(a)){var o=a;r=is(r,e.getEffectiveTypeParameterDeclarations(o));}}return r}}function cs(e){var t=el(e,1);if(1===t.length){var r=t[0];if(!r.typeParameters&&1===r.parameters.length&&J(r)){var n=lb(r.parameters[0]);return _o(n)||df(n)===Le}}return !1}function ls(e){if(el(e,1).length>0)return !0;if(8650752&e.flags){var t=Mc(e);return !!t&&cs(t)}return !1}function us(t){var r=e.getClassLikeDeclarationOfSymbol(t.symbol);return r&&e.getEffectiveBaseTypeNode(r)}function _s(t,r,n){var i=e.length(r),a=e.isInJSFile(n);return e.filter(el(t,1),(function(t){return (a||i>=vl(t.typeParameters))&&i<=e.length(t.typeParameters)}))}function ds(t,r,n){var i=_s(t,r,n),a=e.map(r,kd);return e.sameMap(i,(function(t){return e.some(t.typeParameters)?wl(t,a,e.isInJSFile(n)):t}))}function ps(t){if(!t.resolvedBaseConstructorType){var r=e.getClassLikeDeclarationOfSymbol(t.symbol),n=r&&e.getEffectiveBaseTypeNode(r),i=us(t);if(!i)return t.resolvedBaseConstructorType=qe;if(!ao(t,1))return je;var a=kx(i.expression);if(n&&i!==n&&(e.Debug.assert(!n.typeArguments),kx(n.expression)),2621440&a.flags&&Tc(a),!co())return Jn(t.symbol.valueDeclaration,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression,Ua(t.symbol)),t.resolvedBaseConstructorType=je;if(!(1&a.flags||a===Xe||ls(a))){var o=Jn(i.expression,e.Diagnostics.Type_0_is_not_a_constructor_function_type,qa(a));if(262144&a.flags){var s=Wl(a),c=Ue;if(s){var l=el(s,1);l[0]&&(c=Nl(l[0]));}a.symbol.declarations&&e.addRelatedInfo(o,e.createDiagnosticForNode(a.symbol.declarations[0],e.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1,Ua(a.symbol),qa(c)));}return t.resolvedBaseConstructorType=je}t.resolvedBaseConstructorType=a;}return t.resolvedBaseConstructorType}function fs(t,r){Jn(t,e.Diagnostics.Type_0_recursively_references_itself_as_a_base_type,qa(r,void 0,2));}function gs(t){if(!t.baseTypesResolved){if(ao(t,7)&&(8&t.objectFlags?t.resolvedBaseTypes=[ms(t)]:96&t.symbol.flags?(32&t.symbol.flags&&function(t){t.resolvedBaseTypes=e.resolvingEmptyArray;var r=Kc(ps(t));if(!(2621441&r.flags))return t.resolvedBaseTypes=e.emptyArray;var n,i=us(t),a=r.symbol?Es(r.symbol):void 0;if(r.symbol&&32&r.symbol.flags&&function(e){var t=e.outerTypeParameters;if(t){var r=t.length-1,n=eu(e);return t[r].symbol!==n[r].symbol}return !0}(a))n=ru(i,r.symbol);else if(1&r.flags)n=r;else {var o=ds(r,i.typeArguments,i);if(!o.length)return Jn(i.expression,e.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments),t.resolvedBaseTypes=e.emptyArray;n=Nl(o[0]);}if(po(n))return t.resolvedBaseTypes=e.emptyArray;var s=Hc(n);if(!ys(s)){var c=Yc(void 0,n),l=e.chainDiagnosticMessages(c,e.Diagnostics.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members,qa(s));return Sn.add(e.createDiagnosticForNodeFromMessageChain(i.expression,l)),t.resolvedBaseTypes=e.emptyArray}if(t===s||ns(s,t))return Jn(t.symbol.valueDeclaration,e.Diagnostics.Type_0_recursively_references_itself_as_a_base_type,qa(t,void 0,2)),t.resolvedBaseTypes=e.emptyArray;t.resolvedBaseTypes===e.resolvingEmptyArray&&(t.members=void 0),t.resolvedBaseTypes=[s];}(t),64&t.symbol.flags&&function(t){if(t.resolvedBaseTypes=t.resolvedBaseTypes||e.emptyArray,t.symbol.declarations)for(var r=0,n=t.symbol.declarations;r<n.length;r++){var i=n[r];if(258===i.kind&&e.getInterfaceBaseTypeNodes(i))for(var a=0,o=e.getInterfaceBaseTypeNodes(i);a<o.length;a++){var s=o[a],c=Hc(kd(s));po(c)||(ys(c)?t===c||ns(c,t)?fs(i,t):t.resolvedBaseTypes===e.emptyArray?t.resolvedBaseTypes=[c]:t.resolvedBaseTypes.push(c):Jn(s,e.Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members));}}}(t)):e.Debug.fail("type must be class or interface"),!co()&&t.symbol.declarations))for(var r=0,n=t.symbol.declarations;r<n.length;r++){var i=n[r];257!==i.kind&&258!==i.kind||fs(i,t);}t.baseTypesResolved=!0;}return t.resolvedBaseTypes}function ms(t){return Bu(a_(e.sameMap(t.typeParameters,(function(e,r){return 8&t.elementFlags[r]?K_(e,Ze):e}))||e.emptyArray),t.readonly)}function ys(t){if(262144&t.flags){var r=Mc(t);if(r)return ys(r)}return !!(67633153&t.flags&&!Sc(t)||2097152&t.flags&&e.every(t.types,ys))}function vs(t){var r,n,i,a,o,s=ri(t),c=s;if(!s.declaredType){var l=32&t.flags?1:2,u=Qh(t,t.valueDeclaration&&((o=(null==(a=null===(n=null==(i=(r=t.valueDeclaration)&&Xh(r,!0))?void 0:i.exports)||void 0===n?void 0:n.get("prototype"))?void 0:a.valueDeclaration)&&function(t){if(!t.parent)return !1;for(var r=t.parent;r&&206===r.kind;)r=r.parent;if(r&&e.isBinaryExpression(r)&&e.isPrototypeAccess(r.left)&&63===r.operatorToken.kind){var n=e.getInitializerOfBinaryExpression(r);return e.isObjectLiteralExpression(n)&&n}}(a.valueDeclaration))?la(o):void 0));u&&(t=s=u);var _=c.declaredType=s.declaredType=xa(l,t),d=os(t),p=ss(t);(d||p||1===l||!function(t){if(!t.declarations)return !0;for(var r=0,n=t.declarations;r<n.length;r++){var i=n[r];if(258===i.kind){if(128&i.flags)return !1;var a=e.getInterfaceBaseTypeNodes(i);if(a)for(var o=0,s=a;o<s.length;o++){var c=s[o];if(e.isEntityNameExpression(c.expression)){var l=qi(c.expression,788968,!0);if(!l||!(64&l.flags)||vs(l).thisType)return !1}}}}return !0}(t))&&(_.objectFlags|=4,_.typeParameters=e.concatenate(d,p),_.outerTypeParameters=d,_.localTypeParameters=p,_.instantiations=new e.Map,_.instantiations.set(Gl(_.typeParameters),_),_.target=_,_.resolvedTypeArguments=_.typeParameters,_.thisType=Da(t),_.thisType.isThisType=!0,_.thisType.constraint=_);}return s.declaredType}function hs(t){var r,n=ri(t);if(!n.declaredType){if(!ao(t,2))return je;var i=e.Debug.checkDefined(null===(r=t.declarations)||void 0===r?void 0:r.find(e.isTypeAlias),"Type alias symbol with no valid declaration found"),a=e.isJSDocTypeAlias(i)?i.typeExpression:i.type,o=a?kd(a):je;if(co()){var s=ss(t);s&&(n.typeParameters=s,n.instantiations=new e.Map,n.instantiations.set(Gl(s),o));}else o=je,339===i.kind?Jn(i.typeExpression.type,e.Diagnostics.Type_alias_0_circularly_references_itself,Ua(t)):Jn(e.isNamedDeclaration(i)?i.name:i||i,e.Diagnostics.Type_alias_0_circularly_references_itself,Ua(t));n.declaredType=o;}return n.declaredType}function bs(t){return !!e.isStringLiteralLike(t)||221===t.kind&&bs(t.left)&&bs(t.right)}function xs(t){var r=t.initializer;if(!r)return !(16777216&t.flags);switch(r.kind){case 10:case 8:case 14:return !0;case 219:return 40===r.operator&&8===r.operand.kind;case 79:return e.nodeIsMissing(r)||!!la(t.parent).exports.get(r.escapedText);case 221:return bs(r);default:return !1}}function Ds(t){var r=ri(t);if(void 0!==r.enumKind)return r.enumKind;var n=!1;if(t.declarations)for(var i=0,a=t.declarations;i<a.length;i++){var o=a[i];if(260===o.kind)for(var s=0,c=o.members;s<c.length;s++){var l=c[s];if(l.initializer&&e.isStringLiteralLike(l.initializer))return r.enumKind=1;xs(l)||(n=!0);}}return r.enumKind=n?0:1}function Ss(e){return 1024&e.flags&&!(1048576&e.flags)?Es(ua(e.symbol)):e}function Ts(e){var t=ri(e);if(t.declaredType)return t.declaredType;if(1===Ds(e)){D++;var r=[];if(e.declarations)for(var n=0,i=e.declarations;n<i.length;n++){var a=i[n];if(260===a.kind)for(var o=0,s=a.members;o<s.length;o++){var c=s[o],l=wT(c),u=gd(xd(void 0!==l?l:0,D,la(c)));ri(la(c)).declaredType=u,r.push(md(u));}}if(r.length){var _=a_(r,1,e,void 0);return 1048576&_.flags&&(_.flags|=1024,_.symbol=e),t.declaredType=_}}var d=va(32);return d.symbol=e,t.declaredType=d}function Cs(e){var t=ri(e);if(!t.declaredType){var r=Ts(ua(e));t.declaredType||(t.declaredType=r);}return t.declaredType}function ks(e){var t=ri(e);return t.declaredType||(t.declaredType=Da(e))}function Es(e){return Ns(e)||je}function Ns(e){return 96&e.flags?vs(e):524288&e.flags?hs(e):262144&e.flags?ks(e):384&e.flags?Ts(e):8&e.flags?Cs(e):2097152&e.flags?function(e){var t=ri(e);return t.declaredType||(t.declaredType=Es(Ri(e)))}(e):void 0}function Fs(e){switch(e.kind){case 130:case 155:case 150:case 147:case 158:case 133:case 151:case 148:case 114:case 153:case 143:case 196:return !0;case 183:return Fs(e.elementType);case 178:return !e.typeArguments||e.typeArguments.every(Fs)}return !1}function As(t){var r=e.getEffectiveConstraintOfTypeParameter(t);return !r||Fs(r)}function Ps(t){var r=e.getEffectiveTypeAnnotationNode(t);return r?Fs(r):!e.hasInitializer(t)}function ws(t){if(t.declarations&&1===t.declarations.length){var r=t.declarations[0];if(r)switch(r.kind){case 167:case 166:return Ps(r);case 169:case 168:case 171:case 172:case 173:return n=r,i=e.getEffectiveReturnTypeNode(n),a=e.getEffectiveTypeParameterDeclarations(n),(171===n.kind||!!i&&Fs(i))&&n.parameters.every(Ps)&&a.every(As)}}var n,i,a;return !1}function Is(t,r,n){for(var i=e.createSymbolTable(),a=0,o=t;a<o.length;a++){var s=o[a];i.set(s.escapedName,n&&ws(s)?s:Ud(s,r));}return i}function Os(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];e.has(i.escapedName)||Ms(i)||e.set(i.escapedName,i);}}function Ms(t){return !!t.valueDeclaration&&e.isPrivateIdentifierClassElementDeclaration(t.valueDeclaration)&&e.isStatic(t.valueDeclaration)}function Ls(t){if(!t.declaredProperties){var r=t.symbol,n=qs(r);t.declaredProperties=Ta(n),t.declaredCallSignatures=e.emptyArray,t.declaredConstructSignatures=e.emptyArray,t.declaredIndexInfos=e.emptyArray,t.declaredCallSignatures=Sl(n.get("__call")),t.declaredConstructSignatures=Sl(n.get("__new")),t.declaredIndexInfos=zl(r);}return t}function Rs(e){return !!(8576&e.flags)}function Bs(t){if(!e.isComputedPropertyName(t)&&!e.isElementAccessExpression(t))return !1;var r=e.isComputedPropertyName(t)?t.expression:t.argumentExpression;return e.isEntityNameExpression(r)&&Rs(e.isComputedPropertyName(t)?Hy(t):cx(r))}function js(e){return 95===e.charCodeAt(0)&&95===e.charCodeAt(1)&&64===e.charCodeAt(2)}function Js(t){var r=e.getNameOfDeclaration(t);return !!r&&Bs(r)}function zs(t){return !e.hasDynamicName(t)||Js(t)}function Ks(t){return 8192&t.flags?t.escapedName:384&t.flags?e.escapeLeadingUnderscores(""+t.value):e.Debug.fail()}function Us(t,r,n,i){e.Debug.assert(!!i.symbol,"The member is expected to have a symbol.");var a=ni(i);if(!a.resolvedSymbol){a.resolvedSymbol=i.symbol;var o=e.isBinaryExpression(i)?i.left:i.name,s=e.isElementAccessExpression(o)?cx(o.argumentExpression):Hy(o);if(Rs(s)){var c=Ks(s),l=i.symbol.flags,u=n.get(c);u||n.set(c,u=Hn(0,c,4096));var _=r&&r.get(c);if(u.flags&Gn(l)||_){var d=_?e.concatenate(_.declarations,u.declarations):u.declarations,p=!(8192&s.flags)&&e.unescapeLeadingUnderscores(c)||e.declarationNameToString(o);e.forEach(d,(function(t){return Jn(e.getNameOfDeclaration(t)||t,e.Diagnostics.Property_0_was_also_declared_here,p)})),Jn(o||i,e.Diagnostics.Duplicate_property_0,p),u=Hn(0,c,4096);}return u.nameType=s,function(t,r,n){e.Debug.assert(!!(4096&e.getCheckFlags(t)),"Expected a late-bound symbol."),t.flags|=n,ri(r.symbol).lateSymbol=t,t.declarations?r.symbol.isReplaceableByMethod||t.declarations.push(r):t.declarations=[r],111551&n&&(t.valueDeclaration&&t.valueDeclaration.kind===r.kind||(t.valueDeclaration=r));}(u,i,l),u.parent?e.Debug.assert(u.parent===t,"Existing symbol parent should match new one"):u.parent=t,a.resolvedSymbol=u}}return a.resolvedSymbol}function Vs(t,r){var n=ri(t);if(!n[r]){var i="resolvedExports"===r,a=i?1536&t.flags?sa(t):t.exports:t.members;n[r]=a||K;for(var o=e.createSymbolTable(),s=0,c=t.declarations||e.emptyArray;s<c.length;s++){var l=c[s],u=e.getMembersOfDeclaration(l);if(u)for(var _=0,d=u;_<d.length;_++){var p=d[_];i===e.hasStaticModifier(p)&&Js(p)&&Us(t,a,o,p);}}var f=t.assignmentDeclarationMembers;if(f)for(var g=0,m=e.arrayFrom(f.values());g<m.length;g++){p=m[g];var y=e.getAssignmentDeclarationKind(p);i===!(3===y||e.isBinaryExpression(p)&&Cy(p,y)||9===y||6===y)&&Js(p)&&Us(t,a,o,p);}n[r]=function(t,r){if(!(null==t?void 0:t.size))return r;if(!(null==r?void 0:r.size))return t;var n=e.createSymbolTable();return ei(n,t),ei(n,r),n}(a,o)||K;}return n[r]}function qs(e){return 6256&e.flags?Vs(e,"resolvedMembers"):e.members||K}function Ws(t){if(106500&t.flags&&"__computed"===t.escapedName){var r=ri(t);if(!r.lateSymbol&&e.some(t.declarations,Js)){var n=ca(t.parent);e.some(t.declarations,e.hasStaticModifier)?ia(n):qs(n);}return r.lateSymbol||(r.lateSymbol=t)}return t}function Hs(t,r,n){if(4&e.getObjectFlags(t)){var i=t.target,a=eu(t);if(e.length(i.typeParameters)===e.length(a)){var o=Yl(i,e.concatenate(a,[r||i.thisType]));return n?Kc(o):o}}else if(2097152&t.flags){var s=e.sameMap(t.types,(function(e){return Hs(e,r,n)}));return s!==t.types?p_(s):t}return n?Kc(t):t}function Gs(t,r,n,i){var a,o,s,c,l;e.rangeEquals(n,i,0,n.length)?(o=r.symbol?qs(r.symbol):e.createSymbolTable(r.declaredProperties),s=r.declaredCallSignatures,c=r.declaredConstructSignatures,l=r.declaredIndexInfos):(a=wd(n,i),o=Is(r.declaredProperties,a,1===n.length),s=Ad(r.declaredCallSignatures,a),c=Ad(r.declaredConstructSignatures,a),l=Pd(r.declaredIndexInfos,a));var u=gs(r);if(u.length){r.symbol&&o===qs(r.symbol)&&(o=e.createSymbolTable(r.declaredProperties)),ka(t,o,s,c,l);for(var _=e.lastOrUndefined(i),d=0,p=u;d<p.length;d++){var f=p[d],g=_?Hs(Yd(f,a),_):f;Os(o,Nc(g)),s=e.concatenate(s,el(g,0)),c=e.concatenate(c,el(g,1));var m=g!==Le?al(g):[Jl(Ye,Le,!1)];l=e.concatenate(l,e.filter(m,(function(e){return !tl(l,e.keyType)})));}}ka(t,o,s,c,l);}function Qs(e,t,r,n,i,a,o,s){var c=new h(fe,s);return c.declaration=e,c.typeParameters=t,c.parameters=n,c.thisParameter=r,c.resolvedReturnType=i,c.resolvedTypePredicate=a,c.minArgumentCount=o,c.resolvedMinArgumentCount=void 0,c.target=void 0,c.mapper=void 0,c.compositeSignatures=void 0,c.compositeKind=void 0,c}function Xs(e){var t=Qs(e.declaration,e.typeParameters,e.thisParameter,e.parameters,void 0,void 0,e.minArgumentCount,39&e.flags);return t.target=e.target,t.mapper=e.mapper,t.compositeSignatures=e.compositeSignatures,t.compositeKind=e.compositeKind,t}function Ys(e,t){var r=Xs(e);return r.compositeSignatures=t,r.compositeKind=1048576,r.target=void 0,r.mapper=void 0,r}function Zs(t,r){if((24&t.flags)===r)return t;t.optionalCallSignatureCache||(t.optionalCallSignatureCache={});var n=8===r?"inner":"outer";return t.optionalCallSignatureCache[n]||(t.optionalCallSignatureCache[n]=function(t,r){e.Debug.assert(8===r||16===r,"An optional call signature can either be for an inner call chain or an outer call chain, but not both.");var n=Xs(t);return n.flags|=r,n}(t,r))}function $s(t,r){if(J(t)){var n=t.parameters.length-1,i=$o(t.parameters[n]);if(Nf(i))return [a(i,n)];if(!r&&1048576&i.flags&&e.every(i.types,Nf))return e.map(i.types,(function(e){return a(e,n)}))}return [t.parameters];function a(r,n){var i=eu(r),a=r.target.labeledElementDeclarations,o=e.map(i,(function(e,i){var o=!!a&&ub(a[i])||_b(t,n+i,r),s=r.target.elementFlags[i],c=Hn(1,o,12&s?32768:2&s?16384:0);return c.type=4&s?Bu(e):e,c}));return e.concatenate(t.parameters.slice(0,n),o)}}function ec(e,t,r,n,i){for(var a=0,o=e;a<o.length;a++){var s=o[a];if(of(s,t,r,n,i,r?lp:sp))return s}}function tc(t,r,n){if(r.typeParameters){if(n>0)return;for(var i=1;i<t.length;i++)if(!ec(t[i],r,!1,!1,!1))return;return [r]}var a;for(i=0;i<t.length;i++){var o=i===n?r:ec(t[i],r,!0,!1,!0);if(!o)return;a=e.appendIfUnique(a,o);}return a}function rc(t){for(var r,n,i=0;i<t.length;i++){if(0===t[i].length)return e.emptyArray;t[i].length>1&&(n=void 0===n?i:-1);for(var a=0,o=t[i];a<o.length;a++){var s=o[a];if(!r||!ec(r,s,!1,!1,!0)){var c=tc(t,s,i);if(c){var l=s;if(c.length>1){var u=s.thisParameter,_=e.forEach(c,(function(e){return e.thisParameter}));_&&(u=Qf(_,p_(e.mapDefined(c,(function(e){return e.thisParameter&&$o(e.thisParameter)}))))),(l=Ys(s,c)).thisParameter=u;}(r||(r=[])).push(l);}}}}if(!e.length(r)&&-1!==n){for(var d=t[void 0!==n?n:0],p=d.slice(),f=function(t){if(t!==d){var r=t[0];if(e.Debug.assert(!!r,"getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass"),!(p=r.typeParameters&&e.some(p,(function(e){return !!e.typeParameters&&!nc(r.typeParameters,e.typeParameters)}))?void 0:e.map(p,(function(t){return function(t,r){var n,i=t.typeParameters||r.typeParameters;t.typeParameters&&r.typeParameters&&(n=wd(r.typeParameters,t.typeParameters));var a=t.declaration,o=function(e,t,r){for(var n=vb(e),i=vb(t),a=n>=i?e:t,o=a===e?t:e,s=a===e?n:i,c=bb(e)||bb(t),l=c&&!bb(a),u=new Array(s+(l?1:0)),_=0;_<s;_++){var d=mb(a,_);a===t&&(d=Yd(d,r));var p=mb(o,_)||Ue;o===t&&(p=Yd(p,r));var f=p_([d,p]),g=c&&!l&&_===s-1,m=_>=hb(a)&&_>=hb(o),y=_>=n?void 0:_b(e,_),v=_>=i?void 0:_b(t,_),h=Hn(1|(m&&!g?16777216:0),(y===v?y:y?v?void 0:y:v)||"arg".concat(_));h.type=g?Bu(f):f,u[_]=h;}if(l){var b=Hn(1,"args");b.type=Bu(gb(o,s)),o===t&&(b.type=Yd(b.type,r)),u[s]=b;}return u}(t,r,n),s=Qs(a,i,function(e,t,r){return e&&t?Qf(e,p_([$o(e),Yd($o(t),r)])):e||t}(t.thisParameter,r.thisParameter,n),o,void 0,void 0,Math.max(t.minArgumentCount,r.minArgumentCount),39&(t.flags|r.flags));return s.compositeKind=1048576,s.compositeSignatures=e.concatenate(2097152!==t.compositeKind&&t.compositeSignatures||[t],[r]),n&&(s.mapper=2097152!==t.compositeKind&&t.mapper&&t.compositeSignatures?Bd(t.mapper,n):n),s}(t,r)}))))return "break"}},g=0,m=t;g<m.length&&"break"!==f(m[g]);g++);r=p;}return r||e.emptyArray}function nc(t,r){if(e.length(t)!==e.length(r))return !1;if(!t||!r)return !0;for(var n=wd(r,t),i=0;i<t.length;i++){var a=t[i],o=r[i];if(a!==o&&!op(Wl(a)||Ue,Yd(Wl(o)||Ue,n)))return !1}return !0}function ic(t){var r=al(t[0]);if(r){for(var n=[],i=function(r){var i=r.keyType;e.every(t,(function(e){return !!ol(e,i)}))&&n.push(Jl(i,a_(e.map(t,(function(e){return sl(e,i)}))),e.some(t,(function(e){return ol(e,i).isReadonly}))));},a=0,o=r;a<o.length;a++)i(o[a]);return n}return e.emptyArray}function ac(e,t){return e?t?p_([e,t]):e:t}function oc(t){var r=e.countWhere(t,(function(e){return el(e,1).length>0})),n=e.map(t,cs);if(r>0&&r===e.countWhere(n,(function(e){return e}))){var i=n.indexOf(!0);n[i]=!1;}return n}function sc(t,r){for(var n=function(r){t&&!e.every(t,(function(e){return !of(e,r,!1,!1,!1,sp)}))||(t=e.append(t,r));},i=0,a=r;i<a.length;i++)n(a[i]);return t}function cc(t,r,n){if(t)for(var i=0;i<t.length;i++){var a=t[i];if(a.keyType===r.keyType)return t[i]=Jl(a.keyType,n?a_([a.type,r.type]):p_([a.type,r.type]),n?a.isReadonly||r.isReadonly:a.isReadonly&&r.isReadonly),t}return e.append(t,r)}function lc(e,t,r){return Yd(e,wd([t.indexType,t.objectType],[hd(0),Vu([r])]))}function uc(t){if(4194304&t.flags){var r=Kc(t.type);return Ff(r)?Qu(r):D_(r)}if(16777216&t.flags){if(t.root.isDistributive){var n=t.checkType,i=uc(n);if(i!==n)return Xd(t,jd(t.root.checkType,i,t.mapper))}return t}return 1048576&t.flags?Fm(t,uc):2097152&t.flags?p_(e.sameMap(t.types,uc)):t}function _c(t){return 4096&e.getCheckFlags(t)}function dc(e,t,r,n){for(var i=0,a=Nc(e);i<a.length;i++)n(h_(a[i],t));if(1&e.flags)n(Ye);else for(var o=0,s=al(e);o<s.length;o++){var c=s[o];(!r||134217732&c.keyType.flags)&&n(c.keyType);}}function pc(e){return e.typeParameter||(e.typeParameter=ks(la(e.declaration.typeParameter)))}function fc(e){return e.constraintType||(e.constraintType=Ac(pc(e))||je)}function gc(e){return e.declaration.nameType?e.nameType||(e.nameType=Yd(kd(e.declaration.nameType),e.mapper)):void 0}function mc(e){return e.templateType||(e.templateType=e.declaration.type?Yd(Co(kd(e.declaration.type),!0,!!(4&bc(e))),e.mapper):je)}function yc(t){return e.getEffectiveConstraintOfTypeParameter(t.declaration.typeParameter)}function vc(e){var t=yc(e);return 193===t.kind&&140===t.operator}function hc(e){if(!e.modifiersType)if(vc(e))e.modifiersType=Yd(kd(yc(e).type),e.mapper);else {var t=fc(W_(e.declaration)),r=t&&262144&t.flags?Ac(t):t;e.modifiersType=r&&4194304&r.flags?Yd(r.type,e.mapper):Ue;}return e.modifiersType}function bc(e){var t=e.declaration;return (t.readonlyToken?40===t.readonlyToken.kind?2:1:0)|(t.questionToken?40===t.questionToken.kind?8:4:0)}function xc(e){var t=bc(e);return 8&t?-1:4&t?1:0}function Dc(e){var t=xc(e),r=hc(e);return t||(Sc(r)?xc(r):0)}function Sc(t){return !!(32&e.getObjectFlags(t))&&L_(fc(t))}function Tc(t){return t.members||(524288&t.flags?4&t.objectFlags?function(t){var r=Ls(t.target),n=e.concatenate(r.typeParameters,[r.thisType]),i=eu(t);Gs(t,r,n,i.length===n.length?i:e.concatenate(i,[t]));}(t):3&t.objectFlags?function(t){Gs(t,Ls(t),e.emptyArray,e.emptyArray);}(t):1024&t.objectFlags?function(t){for(var r=ol(t.source,Ye),n=bc(t.mappedType),i=!(1&n),a=4&n?0:16777216,o=r?[Jl(Ye,Sg(r.type,t.mappedType,t.constraintType),i&&r.isReadonly)]:e.emptyArray,s=e.createSymbolTable(),c=0,l=Nc(t.source);c<l.length;c++){var u=l[c],_=8192|(i&&Kb(u)?8:0),d=Hn(4|u.flags&a,u.escapedName,_);if(d.declarations=u.declarations,d.nameType=ri(u).nameType,d.propertyType=$o(u),8388608&t.constraintType.type.flags&&262144&t.constraintType.type.objectType.flags&&262144&t.constraintType.type.indexType.flags){var p=t.constraintType.type.objectType,f=lc(t.mappedType,t.constraintType.type,p);d.mappedType=f,d.constraintType=D_(p);}else d.mappedType=t.mappedType,d.constraintType=t.constraintType;s.set(u.escapedName,d);}ka(t,s,e.emptyArray,e.emptyArray,o);}(t):16&t.objectFlags?function(t){if(t.target)return ka(t,K,e.emptyArray,e.emptyArray,e.emptyArray),void ka(t,Is(Cc(t.target),t.mapper,!1),i=Ad(el(t.target,0),t.mapper),a=Ad(el(t.target,1),t.mapper),Pd(al(t.target),t.mapper));var r=ca(t.symbol);if(2048&r.flags){ka(t,K,e.emptyArray,e.emptyArray,e.emptyArray);var n=qs(r),i=Sl(n.get("__call")),a=Sl(n.get("__new"));ka(t,n,i,a,zl(r));}else {var o,s,c=K;if(r.exports&&(c=ia(r),r===ue)){var l=new e.Map;c.forEach((function(t){var r;418&t.flags||512&t.flags&&(null===(r=t.declarations)||void 0===r?void 0:r.length)&&e.every(t.declarations,e.isAmbientModule)||l.set(t.escapedName,t);})),c=l;}if(ka(t,c,e.emptyArray,e.emptyArray,e.emptyArray),32&r.flags){var u=ps(vs(r));11272192&u.flags?Os(c=e.createSymbolTable(function(t){var r=Ta(t),n=jl(t);return n?e.concatenate(r,[n]):r}(c)),Nc(u)):u===Le&&(s=Jl(Ye,Le,!1));}var _=jl(c);if(_?o=Kl(_):(s&&(o=e.append(o,s)),384&r.flags&&(32&Es(r).flags||e.some(t.properties,(function(e){return !!(296&$o(e).flags)})))&&(o=e.append(o,Rr))),ka(t,c,e.emptyArray,e.emptyArray,o||e.emptyArray),8208&r.flags&&(t.callSignatures=Sl(r)),32&r.flags){var d=vs(r);a=r.members?Sl(r.members.get("__constructor")):e.emptyArray,16&r.flags&&(a=e.addRange(a.slice(),e.mapDefined(t.callSignatures,(function(e){return Gh(e.declaration)?Qs(e.declaration,e.typeParameters,e.thisParameter,e.parameters,d,void 0,e.minArgumentCount,39&e.flags):void 0})))),a.length||(a=function(t){var r=el(ps(t),1),n=e.getClassLikeDeclarationOfSymbol(t.symbol),i=!!n&&e.hasSyntacticModifier(n,128);if(0===r.length)return [Qs(void 0,t.localTypeParameters,void 0,e.emptyArray,t,void 0,0,i?4:0)];for(var a=us(t),o=e.isInJSFile(a),s=yu(a),c=e.length(s),l=[],u=0,_=r;u<_.length;u++){var d=_[u],p=vl(d.typeParameters),f=e.length(d.typeParameters);if(o||c>=p&&c<=f){var g=f?Ol(d,hl(s,d.typeParameters,p,o)):Xs(d);g.typeParameters=t.localTypeParameters,g.resolvedReturnType=t,g.flags=i?4|g.flags:-5&g.flags,l.push(g);}}return l}(d)),t.constructSignatures=a;}}}(t):32&t.objectFlags&&function(t){var r,n=e.createSymbolTable();ka(t,K,e.emptyArray,e.emptyArray,e.emptyArray);var i=pc(t),a=fc(t),o=gc(t.target||t),s=mc(t.target||t),c=Kc(hc(t)),l=bc(t),u=re?128:8576;function _(e){Sm(o?Yd(o,Jd(t.mapper,i,e)):e,(function(a){return function(e,a){if(Rs(a)){var u=Ks(a),_=n.get(u);if(_)_.nameType=a_([_.nameType,a]),_.keyType=a_([_.keyType,e]);else {var d=Rs(e)?Zc(c,Ks(e)):void 0,p=!!(4&l||!(8&l)&&d&&16777216&d.flags),f=!!(1&l||!(2&l)&&d&&Kb(d)),g=Q&&!p&&d&&16777216&d.flags,m=Hn(4|(p?16777216:0),u,262144|(d?_c(d):0)|(f?8:0)|(g?524288:0));m.mappedType=t,m.nameType=a,m.keyType=e,d&&(m.syntheticOrigin=d,m.declarations=o?void 0:d.declarations),n.set(u,m);}}else if(Ul(a)||33&a.flags){var y=Jl(5&a.flags?Ye:40&a.flags?Ze:a,Yd(s,Jd(t.mapper,i,e)),!!(1&l));r=cc(r,y,!0);}}(e,a)}));}vc(t)?dc(c,u,re,_):Sm(uc(a),_),ka(t,n,e.emptyArray,e.emptyArray,r||e.emptyArray);}(t):1048576&t.flags?function(t){var r=rc(e.map(t.types,(function(e){return e===jt?[Or]:el(e,0)}))),n=rc(e.map(t.types,(function(e){return el(e,1)}))),i=ic(t.types);ka(t,K,r,n,i);}(t):2097152&t.flags&&function(t){for(var r,n,i,a=t.types,o=oc(a),s=e.countWhere(o,(function(e){return e})),c=function(c){var l=t.types[c];if(!o[c]){var u=el(l,1);u.length&&s>0&&(u=e.map(u,(function(e){var t=Xs(e);return t.resolvedReturnType=function(e,t,r,n){for(var i=[],a=0;a<t.length;a++)a===n?i.push(e):r[a]&&i.push(Nl(el(t[a],1)[0]));return p_(i)}(Nl(e),a,o,c),t}))),n=sc(n,u);}r=sc(r,el(l,0)),i=e.reduceLeft(al(l),(function(e,t){return cc(e,t,!1)}),i);},l=0;l<a.length;l++)c(l);ka(t,K,r||e.emptyArray,n||e.emptyArray,i||e.emptyArray);}(t)),t}function Cc(t){return 524288&t.flags?Tc(t).properties:e.emptyArray}function kc(e,t){if(524288&e.flags){var r=Tc(e).members.get(t);if(r&&ma(r))return r}}function Ec(t){if(!t.resolvedProperties){for(var r=e.createSymbolTable(),n=0,i=t.types;n<i.length;n++){for(var a=i[n],o=0,s=Nc(a);o<s.length;o++){var c=s[o];if(!r.has(c.escapedName)){var l=Wc(t,c.escapedName);l&&r.set(c.escapedName,l);}}if(1048576&t.flags&&0===al(a).length)break}t.resolvedProperties=Ta(r);}return t.resolvedProperties}function Nc(e){return 3145728&(e=Uc(e)).flags?Ec(e):Cc(e)}function Fc(e){return 262144&e.flags?Ac(e):8388608&e.flags?function(e){return Rc(e)?function(e){if(zc(e))return z_(e.objectType,e.indexType);var t=Pc(e.indexType);if(t&&t!==e.indexType){var r=V_(e.objectType,t,e.accessFlags);if(r)return r}var n=Pc(e.objectType);return n&&n!==e.objectType?V_(n,e.indexType,e.accessFlags):void 0}(e):void 0}(e):16777216&e.flags?function(e){return Rc(e)?Oc(e):void 0}(e):Mc(e)}function Ac(e){return Rc(e)?Wl(e):void 0}function Pc(e){var t=B_(e,!1);return t!==e?t:Fc(e)}function wc(e){if(!e.resolvedDefaultConstraint){var t=function(e){return e.resolvedInferredTrueType||(e.resolvedInferredTrueType=e.combinedMapper?Yd(kd(e.root.node.trueType),e.combinedMapper):$_(e))}(e),r=ed(e);e.resolvedDefaultConstraint=_o(t)?r:_o(r)?t:a_([t,r]);}return e.resolvedDefaultConstraint}function Ic(e){if(e.root.isDistributive&&e.restrictiveInstantiation!==e){var t=B_(e.checkType,!1),r=t===e.checkType?Fc(t):t;if(r&&r!==e.checkType){var n=Xd(e,jd(e.root.checkType,r,e.mapper));if(!(131072&n.flags))return n}}}function Oc(e){return Ic(e)||wc(e)}function Mc(e){if(464781312&e.flags){var t=Bc(e);return t!==Ft&&t!==At?t:void 0}return 4194304&e.flags?gt:void 0}function Lc(e){return Mc(e)||e}function Rc(e){return Bc(e)!==At}function Bc(t){if(t.resolvedBaseConstraint)return t.resolvedBaseConstraint;var r=[];return t.resolvedBaseConstraint=Hs(n(t),t);function n(t){if(!t.immediateBaseConstraint){if(!ao(t,4))return At;var n=void 0,a=nf(t);if((r.length<10||r.length<50&&!e.contains(r,a))&&(r.push(a),n=function(t){if(262144&t.flags){var r=Wl(t);return t.isThisType||!r?r:i(r)}if(3145728&t.flags){for(var n=[],a=!1,o=0,s=u=t.types;o<s.length;o++){var c=s[o],l=i(c);l?(l!==c&&(a=!0),n.push(l)):a=!0;}return a?1048576&t.flags&&n.length===u.length?a_(n):2097152&t.flags&&n.length?p_(n):void 0:t}if(4194304&t.flags)return gt;if(134217728&t.flags){var u=t.types,_=e.mapDefined(u,i);return _.length===u.length?T_(t.texts,_):Ye}if(268435456&t.flags)return (r=i(t.type))?k_(t.symbol,r):Ye;if(8388608&t.flags){if(zc(t))return i(z_(t.objectType,t.indexType));var d=i(t.objectType),p=i(t.indexType),f=d&&p&&V_(d,p,t.accessFlags);return f&&i(f)}return 16777216&t.flags?(r=Oc(t))&&i(r):33554432&t.flags?i(t.substitute):t}(B_(t,!1)),r.pop()),!co()){if(262144&t.flags){var o=Vl(t);if(o){var s=Jn(o,e.Diagnostics.Type_parameter_0_has_a_circular_constraint,qa(t));!u||e.isNodeDescendantOf(o,u)||e.isNodeDescendantOf(u,o)||e.addRelatedInfo(s,e.createDiagnosticForNode(u,e.Diagnostics.Circularity_originates_in_type_at_this_location));}}n=At;}t.immediateBaseConstraint=n||Ft;}return t.immediateBaseConstraint}function i(e){var t=n(e);return t!==Ft&&t!==At?t:void 0}}function jc(t){if(t.default)t.default===Pt&&(t.default=At);else if(t.target){var r=jc(t.target);t.default=r?Yd(r,t.mapper):Ft;}else {t.default=Pt;var n=t.symbol&&e.forEach(t.symbol.declarations,(function(t){return e.isTypeParameterDeclaration(t)&&t.default})),i=n?kd(n):Ft;t.default===Pt&&(t.default=i);}return t.default}function Jc(e){var t=jc(e);return t!==Ft&&t!==At?t:void 0}function zc(t){var r;return !(!(8388608&t.flags&&32&e.getObjectFlags(r=t.objectType)&&!Sc(r)&&L_(t.indexType))||8&bc(r)||r.declaration.nameType)}function Kc(t){var r=465829888&t.flags?Mc(t)||Ue:t;return 32&e.getObjectFlags(r)?function(e){return e.resolvedApparentType||(e.resolvedApparentType=function(e){var t=qd(e);if(t&&!e.declaration.nameType){var r=Ac(t);if(r&&uf(r))return Yd(e,jd(t,r,e.mapper))}return e}(e))}(r):2097152&r.flags?function(e){return e.resolvedApparentType||(e.resolvedApparentType=Hs(e,e,!0))}(r):402653316&r.flags?Vt:296&r.flags?qt:2112&r.flags?Tr||(Tr=Tu("BigInt",0,!1))||St:528&r.flags?Wt:12288&r.flags?Fu():67108864&r.flags?St:4194304&r.flags?gt:2&r.flags&&!Q?St:r}function Uc(e){return Hc(Kc(Hc(e)))}function Vc(t,r,n){for(var i,a,o,s,c,l=1048576&t.flags,u=l?0:16777216,_=4,d=l?0:8,p=!1,f=0,g=t.types;f<g.length;f++)if(!(po(A=Kc(g[f]))||131072&A.flags)){var m=(F=Zc(A,r,n))?e.getDeclarationModifierFlagsFromSymbol(F):0;if(F){if(l?u|=16777216&F.flags:u&=F.flags,o){if(F!==o)if((TS(F)||F)===(TS(o)||o)&&-1===af(o,F,(function(e,t){return e===t?-1:0})))p=!!o.parent&&!!e.length(ss(o.parent));else {s||(s=new e.Map).set(M(o),o);var y=M(F);s.has(y)||s.set(y,F);}}else o=F;l&&Kb(F)?d|=8:l||Kb(F)||(d&=-9),d|=(24&m?0:256)|(16&m?512:0)|(8&m?1024:0)|(32&m?2048:0),hv(F)||(_=2);}else if(l){var v=!js(r)&&ul(A,r);v?(d|=32|(v.isReadonly?8:0),c=e.append(c,Nf(A)?Pf(A)||qe:v.type)):!Lg(A)||2097152&e.getObjectFlags(A)?d|=16:(d|=32,c=e.append(c,qe));}}if(o&&!(l&&(s||48&d)&&1536&d)){if(!(s||16&d||c)){if(p){var h=Qf(o,o.type);return h.parent=null===(a=null===(i=o.valueDeclaration)||void 0===i?void 0:i.symbol)||void 0===a?void 0:a.parent,h.containingType=t,h.mapper=o.mapper,h}return o}for(var b,x,D,S,T,C=[],k=!1,E=0,N=s?e.arrayFrom(s.values()):[o];E<N.length;E++){var F=N[E];T?F.valueDeclaration&&F.valueDeclaration!==T&&(k=!0):T=F.valueDeclaration,b=e.addRange(b,F.declarations);var A=$o(F);x||(x=A,D=ri(F).nameType);var P=Zo(F);S||P!==A?S=e.append(S||C.slice(),P):A!==x&&(d|=64),(Df(A)||I_(A)||A===xt)&&(d|=128),131072&A.flags&&A!==xt&&(d|=131072),C.push(A);}e.addRange(C,c);var w=Hn(4|u,r,_|d);return w.containingType=t,!k&&T&&(w.valueDeclaration=T,T.symbol.parent&&(w.parent=T.symbol.parent)),w.declarations=b,w.nameType=D,C.length>2?(w.checkFlags|=65536,w.deferralParent=t,w.deferralConstituents=C,w.deferralWriteConstituents=S):(w.type=l?a_(C):p_(C),S&&(w.writeType=l?a_(S):p_(S))),w}}function qc(t,r,n){var i,a,o=(null===(i=t.propertyCacheWithoutObjectFunctionPropertyAugment)||void 0===i?void 0:i.get(r))||!n?null===(a=t.propertyCache)||void 0===a?void 0:a.get(r):void 0;return o||(o=Vc(t,r,n))&&(n?t.propertyCacheWithoutObjectFunctionPropertyAugment||(t.propertyCacheWithoutObjectFunctionPropertyAugment=e.createSymbolTable()):t.propertyCache||(t.propertyCache=e.createSymbolTable())).set(r,o),o}function Wc(t,r,n){var i=qc(t,r,n);return !i||16&e.getCheckFlags(i)?void 0:i}function Hc(t){return 1048576&t.flags&&16777216&t.objectFlags?t.resolvedReducedType||(t.resolvedReducedType=function(t){var r=e.sameMap(t.types,Hc);if(r===t.types)return t;var n=a_(r);return 1048576&n.flags&&(n.resolvedReducedType=n),n}(t)):2097152&t.flags?(16777216&t.objectFlags||(t.objectFlags|=16777216|(e.some(Ec(t),Gc)?33554432:0)),33554432&t.objectFlags?st:t):t}function Gc(e){return Qc(e)||Xc(e)}function Qc(t){return !(16777216&t.flags||192!=(131264&e.getCheckFlags(t))||!(131072&$o(t).flags))}function Xc(t){return !t.valueDeclaration&&!!(1024&e.getCheckFlags(t))}function Yc(t,r){if(2097152&r.flags&&33554432&e.getObjectFlags(r)){var n=e.find(Ec(r),Qc);if(n)return e.chainDiagnosticMessages(t,e.Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents,qa(r,void 0,536870912),Ua(n));var i=e.find(Ec(r),Xc);if(i)return e.chainDiagnosticMessages(t,e.Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some,qa(r,void 0,536870912),Ua(i))}return t}function Zc(e,t,r){if(524288&(e=Uc(e)).flags){var n=Tc(e),i=n.members.get(t);if(i&&ma(i))return i;if(r)return;var a=n===Nt?jt:n.callSignatures.length?Jt:n.constructSignatures.length?zt:void 0;if(a){var o=kc(a,t);if(o)return o}return kc(Bt,t)}if(3145728&e.flags)return Wc(e,t,r)}function $c(t,r){if(3670016&t.flags){var n=Tc(t);return 0===r?n.callSignatures:n.constructSignatures}return e.emptyArray}function el(e,t){return $c(Uc(e),t)}function tl(t,r){return e.find(t,(function(e){return e.keyType===r}))}function rl(t,r){for(var n,i,a,o=0,s=t;o<s.length;o++){var c=s[o];c.keyType===Ye?n=c:nl(r,c.keyType)&&(i?(a||(a=[i])).push(c):i=c);}return a?Jl(Ue,p_(e.map(a,(function(e){return e.type}))),e.reduceLeft(a,(function(e,t){return e&&t.isReadonly}),!0)):i||(n&&nl(r,Ye)?n:void 0)}function nl(t,r){return _p(t,r)||r===Ye&&_p(t,Ze)||r===Ze&&(t===vt||!!(128&t.flags)&&e.isNumericLiteralName(t.value))}function il(t){return 3670016&t.flags?Tc(t).indexInfos:e.emptyArray}function al(e){return il(Uc(e))}function ol(e,t){return tl(al(e),t)}function sl(e,t){var r;return null===(r=ol(e,t))||void 0===r?void 0:r.type}function cl(e,t){return al(e).filter((function(e){return nl(t,e.keyType)}))}function ll(e,t){return rl(al(e),t)}function ul(t,r){return ll(t,js(r)?at:vd(e.unescapeLeadingUnderscores(r)))}function _l(t){for(var r,n=0,i=e.getEffectiveTypeParameterDeclarations(t);n<i.length;n++){var a=i[n];r=e.appendIfUnique(r,ks(a.symbol));}return r}function dl(e){var t=[];return e.forEach((function(e,r){Sa(r)||t.push(e);})),t}function pl(t){return e.isInJSFile(t)&&(t.type&&316===t.type.kind||e.getJSDocParameterTags(t).some((function(e){var t=e.isBracketed,r=e.typeExpression;return t||!!r&&316===r.type.kind})))}function fl(t,r){if(!e.isExternalModuleNameRelative(t)){var n=ai(ce,'"'+t+'"',512);return n&&r?ca(n):n}}function gl(t){if(e.hasQuestionToken(t)||ml(t)||pl(t))return !0;if(t.initializer){var r=bl(t.parent),n=t.parent.parameters.indexOf(t);return e.Debug.assert(n>=0),n>=hb(r,3)}var i=e.getImmediatelyInvokedFunctionExpression(t.parent);return !!i&&!t.type&&!t.dotDotDotToken&&t.parent.parameters.indexOf(t)>=i.arguments.length}function ml(t){if(!e.isJSDocPropertyLikeTag(t))return !1;var r=t.isBracketed,n=t.typeExpression;return r||!!n&&316===n.type.kind}function yl(e,t,r,n){return {kind:e,parameterName:t,parameterIndex:r,type:n}}function vl(t){var r,n=0;if(t)for(var i=0;i<t.length;i++)(r=t[i]).symbol&&e.forEach(r.symbol.declarations,(function(t){return e.isTypeParameterDeclaration(t)&&t.default}))||(n=i+1);return n}function hl(t,r,n,i){var a=e.length(r);if(!a)return [];var o=e.length(t);if(i||o>=n&&o<=a){for(var s=t?t.slice():[],c=o;c<a;c++)s[c]=je;var l=jg(i);for(c=o;c<a;c++){var u=Jc(r[c]);i&&u&&(op(u,Ue)||op(u,St))&&(u=Le),s[c]=u?Yd(u,wd(r,s)):l;}return s.length=r.length,s}return t&&t.slice()}function bl(t){var r,n=ni(t);if(!n.resolvedSignature){var i=[],a=0,o=0,s=void 0,c=!1,l=e.getImmediatelyInvokedFunctionExpression(t),u=e.isJSDocConstructSignature(t);!l&&e.isInJSFile(t)&&e.isValueSignatureDeclaration(t)&&!e.hasJSDocParameterTags(t)&&!e.getJSDocType(t)&&(a|=32);for(var _=u?1:0;_<t.parameters.length;_++){var d=t.parameters[_],p=d.symbol,f=e.isJSDocParameterTag(d)?d.typeExpression&&d.typeExpression.type:d.type;p&&4&p.flags&&!e.isBindingPattern(d.name)&&(p=li(d,p.escapedName,111551,void 0,void 0,!1)),0===_&&"this"===p.escapedName?(c=!0,s=d.symbol):i.push(p),f&&196===f.kind&&(a|=2),ml(d)||d.initializer||d.questionToken||e.isRestParameter(d)||l&&i.length>l.arguments.length&&!f||pl(d)||(o=i.length);}if((172===t.kind||173===t.kind)&&zs(t)&&(!c||!s)){var g=172===t.kind?173:172,m=e.getDeclarationOfKind(la(t),g);m&&(s=(r=uC(m))&&r.symbol);}var y=171===t.kind?vs(ca(t.parent.symbol)):void 0,v=y?y.localTypeParameters:_l(t);(e.hasRestParameter(t)||e.isInJSFile(t)&&function(t,r){if(e.isJSDocSignature(t)||!Dl(t))return !1;var n=e.lastOrUndefined(t.parameters),i=n?e.getJSDocParameterTags(n):e.getJSDocTags(t).filter(e.isJSDocParameterTag),a=e.firstDefined(i,(function(t){return t.typeExpression&&e.isJSDocVariadicType(t.typeExpression.type)?t.typeExpression.type:void 0})),o=Hn(3,"args",32768);return a?o.type=Bu(kd(a.type)):(o.checkFlags|=65536,o.deferralParent=st,o.deferralConstituents=[Qt],o.deferralWriteConstituents=[Qt]),a&&r.pop(),r.push(o),!0}(t,i))&&(a|=1),(e.isConstructorTypeNode(t)&&e.hasSyntacticModifier(t,128)||e.isConstructorDeclaration(t)&&e.hasSyntacticModifier(t.parent,128))&&(a|=4),n.resolvedSignature=Qs(t,v,s,i,void 0,void 0,o,a);}return n.resolvedSignature}function xl(t){if(e.isInJSFile(t)&&e.isFunctionLikeDeclaration(t)){var r=e.getJSDocTypeTag(t);return (null==r?void 0:r.typeExpression)&&fh(kd(r.typeExpression))}}function Dl(t){var r=ni(t);return void 0===r.containsArgumentsReference&&(8192&r.flags?r.containsArgumentsReference=!0:r.containsArgumentsReference=function t(r){if(!r)return !1;switch(r.kind){case 79:return r.escapedText===de.escapedName&&zT(r)===de;case 167:case 169:case 172:case 173:return 162===r.name.kind&&t(r.name);case 206:case 207:return t(r.expression);case 296:return t(r.initializer);default:return !e.nodeStartsNewLexicalEnvironment(r)&&!e.isPartOfTypeNode(r)&&!!e.forEachChild(r,t)}}(t.body)),r.containsArgumentsReference}function Sl(t){if(!t||!t.declarations)return e.emptyArray;for(var r=[],n=0;n<t.declarations.length;n++){var i=t.declarations[n];if(e.isFunctionLike(i)){if(n>0&&i.body){var a=t.declarations[n-1];if(i.parent===a.parent&&i.kind===a.kind&&i.pos===a.end)continue}r.push(bl(i));}}return r}function Tl(e){var t=Hi(e,e);if(t){var r=Yi(t);if(r)return $o(r)}return Le}function Cl(e){if(e.thisParameter)return $o(e.thisParameter)}function kl(t){if(!t.resolvedTypePredicate){if(t.target){var r=kl(t.target);t.resolvedTypePredicate=r?(o=r,s=t.mapper,yl(o.kind,o.parameterName,o.parameterIndex,Yd(o.type,s))):wr;}else if(t.compositeSignatures)t.resolvedTypePredicate=function(e,t){for(var r,n=[],i=0,a=e;i<a.length;i++){var o=kl(a[i]);if(!o||2===o.kind||3===o.kind){if(2097152!==t)continue;return}if(r){if(!o_(r,o))return}else r=o;n.push(o.type);}if(r){var s=El(n,t);return yl(r.kind,r.parameterName,r.parameterIndex,s)}}(t.compositeSignatures,t.compositeKind)||wr;else {var n=t.declaration&&e.getEffectiveReturnTypeNode(t.declaration),i=void 0;if(!n&&e.isInJSFile(t.declaration)){var a=xl(t.declaration);a&&t!==a&&(i=kl(a));}t.resolvedTypePredicate=n&&e.isTypePredicateNode(n)?function(t,r){var n=t.parameterName,i=t.type&&kd(t.type);return 192===n.kind?yl(t.assertsModifier?2:0,void 0,void 0,i):yl(t.assertsModifier?3:1,n.escapedText,e.findIndex(r.parameters,(function(e){return e.escapedName===n.escapedText})),i)}(n,t):i||wr;}e.Debug.assert(!!t.resolvedTypePredicate);}var o,s;return t.resolvedTypePredicate===wr?void 0:t.resolvedTypePredicate}function El(e,t,r){return 2097152!==t?a_(e,r):p_(e)}function Nl(t){if(!t.resolvedReturnType){if(!ao(t,3))return je;var r=t.target?Yd(Nl(t.target),t.mapper):t.compositeSignatures?Yd(El(e.map(t.compositeSignatures,Nl),t.compositeKind,2),t.mapper):Fl(t.declaration)||(e.nodeIsMissing(t.declaration.body)?Le:Pb(t.declaration));if(8&t.flags?r=zf(r):16&t.flags&&(r=jf(r)),!co()){if(t.declaration){var n=e.getEffectiveReturnTypeNode(t.declaration);if(n)Jn(n,e.Diagnostics.Return_type_annotation_circularly_references_itself);else if($){var i=t.declaration,a=e.getNameOfDeclaration(i);a?Jn(a,e.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions,e.declarationNameToString(a)):Jn(i,e.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);}}r=Le;}t.resolvedReturnType=r;}return t.resolvedReturnType}function Fl(t){if(171===t.kind)return vs(ca(t.parent.symbol));if(e.isJSDocConstructSignature(t))return kd(t.parameters[0].type);var r,n=e.getEffectiveReturnTypeNode(t);if(n)return kd(n);if(172===t.kind&&zs(t)){var i=e.isInJSFile(t)&&So(t);if(i)return i;var a=Vo(e.getDeclarationOfKind(la(t),173));if(a)return a}return (r=xl(t))&&Nl(r)}function Al(e){return !e.resolvedReturnType&&oo(e,3)>=0}function Pl(e){if(J(e)){var t=$o(e.parameters[e.parameters.length-1]),r=Nf(t)?Pf(t):t;return r&&sl(r,Ze)}}function wl(e,t,r,n){var i=Il(e,hl(t,e.typeParameters,vl(e.typeParameters),r));if(n){var a=gh(Nl(i));if(a){var o=Xs(a);o.typeParameters=n;var s=Xs(i);return s.resolvedReturnType=Rl(o),s}}return i}function Il(t,r){var n=t.instantiations||(t.instantiations=new e.Map),i=Gl(r),a=n.get(i);return a||n.set(i,a=Ol(t,r)),a}function Ol(e,t){return Kd(e,function(e,t){return wd(e.typeParameters,t)}(e,t),!0)}function Ml(e){return e.typeParameters?e.erasedSignatureCache||(e.erasedSignatureCache=function(e){return Kd(e,Rd(e.typeParameters),!0)}(e)):e}function Ll(t){var r=t.typeParameters;if(r){if(t.baseSignatureCache)return t.baseSignatureCache;for(var n=Rd(r),i=wd(r,e.map(r,(function(e){return Ac(e)||Ue}))),a=e.map(r,(function(e){return Yd(e,i)||Ue})),o=0;o<r.length-1;o++)a=Fd(a,i);return a=Fd(a,n),t.baseSignatureCache=Kd(t,wd(r,a),!0)}return t}function Rl(t){var r;if(!t.isolatedSignatureType){var n=null===(r=t.declaration)||void 0===r?void 0:r.kind,i=void 0===n||171===n||175===n||180===n,a=xa(16);a.members=K,a.properties=e.emptyArray,a.callSignatures=i?e.emptyArray:[t],a.constructSignatures=i?[t]:e.emptyArray,a.indexInfos=e.emptyArray,t.isolatedSignatureType=a;}return t.isolatedSignatureType}function Bl(e){return e.members?jl(e.members):void 0}function jl(e){return e.get("__index")}function Jl(e,t,r,n){return {keyType:e,type:t,isReadonly:r,declaration:n}}function zl(t){var r=Bl(t);return r?Kl(r):e.emptyArray}function Kl(t){if(t.declarations){for(var r=[],n=function(t){if(1===t.parameters.length){var n=t.parameters[0];n.type&&Sm(kd(n.type),(function(n){Ul(n)&&!tl(r,n)&&r.push(Jl(n,t.type?kd(t.type):Le,e.hasEffectiveModifier(t,64),t));}));}},i=0,a=t.declarations;i<a.length;i++)n(a[i]);return r}return e.emptyArray}function Ul(t){return !!(4108&t.flags)||I_(t)||!!(2097152&t.flags)&&!O_(t)&&e.some(t.types,Ul)}function Vl(t){return e.mapDefined(e.filter(t.symbol&&t.symbol.declarations,e.isTypeParameterDeclaration),e.getEffectiveConstraintOfTypeParameter)[0]}function ql(t,r){var n,i;if(null===(n=t.symbol)||void 0===n?void 0:n.declarations)for(var a=0,o=t.symbol.declarations;a<o.length;a++){var s=o[a];if(190===s.parent.kind){var c=e.walkUpParenthesizedTypesAndGetParentAndChild(s.parent.parent),l=c[0],u=void 0===l?s.parent:l,_=c[1];if(178!==_.kind||r){if(164===_.kind&&_.dotDotDotToken||186===_.kind||197===_.kind&&_.dotDotDotToken)i=e.append(i,Bu(Ue));else if(199===_.kind)i=e.append(i,Ye);else if(163===_.kind&&195===_.parent.kind)i=e.append(i,gt);else if(195===_.kind&&_.type&&e.skipParentheses(_.type)===s.parent&&189===_.parent.kind&&_.parent.extendsType===_&&195===_.parent.checkType.kind&&_.parent.checkType.type){var d=_.parent.checkType,p=kd(d.type);i=e.append(i,Yd(p,Od(ks(la(d.typeParameter)),d.typeParameter.constraint?kd(d.typeParameter.constraint):gt)));}}else {var f=_,g=jx(f);if(g){var m=f.typeArguments.indexOf(u);if(m<g.length){var y=Ac(g[m]);if(y){var v=Yd(y,wd(g,Rx(f,g)));v!==t&&(i=e.append(i,v));}}}}}}return i&&p_(i)}function Wl(e){if(!e.constraint)if(e.target){var t=Ac(e.target);e.constraint=t?Yd(t,e.mapper):Ft;}else {var r=Vl(e);if(r){var n=kd(r);1&n.flags&&!po(n)&&(n=195===r.parent.parent.kind?gt:Ue),e.constraint=n;}else e.constraint=ql(e)||Ft;}return e.constraint===Ft?void 0:e.constraint}function Hl(t){var r=e.getDeclarationOfKind(t.symbol,163),n=e.isJSDocTemplateTag(r.parent)?e.getEffectiveContainerForJSDocTemplateTag(r.parent):r.parent;return n&&la(n)}function Gl(e){var t="";if(e)for(var r=e.length,n=0;n<r;){for(var i=e[n].id,a=1;n+a<r&&e[n+a].id===i+a;)a++;t.length&&(t+=","),t+=i,a>1&&(t+=":"+a),n+=a;}return t}function Ql(e,t){return e?"@".concat(M(e))+(t?":".concat(Gl(t)):""):""}function Xl(t,r){for(var n=0,i=0,a=t;i<a.length;i++){var o=a[i];o.flags&r||(n|=e.getObjectFlags(o));}return 458752&n}function Yl(e,t){var r=Gl(t),n=e.instantiations.get(r);return n||(n=xa(4,e.symbol),e.instantiations.set(r,n),n.objectFlags|=t?Xl(t,0):0,n.target=e,n.resolvedTypeArguments=t),n}function Zl(e){var t=va(e.flags);return t.symbol=e.symbol,t.objectFlags=e.objectFlags,t.target=e.target,t.resolvedTypeArguments=e.resolvedTypeArguments,t}function $l(e,t,r,n,i){if(!n){var a=sd(n=od(t));i=r?Fd(a,r):a;}var o=xa(4,e.symbol);return o.target=e,o.node=t,o.mapper=r,o.aliasSymbol=n,o.aliasTypeArguments=i,o}function eu(t){var r,n;if(!t.resolvedTypeArguments){if(!ao(t,6))return (null===(r=t.target.localTypeParameters)||void 0===r?void 0:r.map((function(){return je})))||e.emptyArray;var i=t.node,a=i?178===i.kind?e.concatenate(t.target.outerTypeParameters,Rx(i,t.target.localTypeParameters)):183===i.kind?[kd(i.elementType)]:e.map(i.elements,kd):e.emptyArray;co()?t.resolvedTypeArguments=t.mapper?Fd(a,t.mapper):a:(t.resolvedTypeArguments=(null===(n=t.target.localTypeParameters)||void 0===n?void 0:n.map((function(){return je})))||e.emptyArray,Jn(t.node||u,t.target.symbol?e.Diagnostics.Type_arguments_for_0_circularly_reference_themselves:e.Diagnostics.Tuple_type_arguments_circularly_reference_themselves,t.target.symbol&&Ua(t.target.symbol)));}return t.resolvedTypeArguments}function tu(t){return e.length(t.target.typeParameters)}function ru(t,r){var n=Es(ca(r)),i=n.localTypeParameters;if(i){var a=e.length(t.typeArguments),o=vl(i),s=e.isInJSFile(t);if(($||!s)&&(a<o||a>i.length)){var c=s&&e.isExpressionWithTypeArguments(t)&&!e.isJSDocAugmentsTag(t.parent);if(Jn(t,o===i.length?c?e.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag:e.Diagnostics.Generic_type_0_requires_1_type_argument_s:c?e.Diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag:e.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,qa(n,void 0,2),o,i.length),!s)return je}return 178===t.kind&&zu(t,e.length(t.typeArguments)!==i.length)?$l(n,t,void 0):Yl(n,e.concatenate(n.outerTypeParameters,hl(yu(t),i,o,s)))}return fu(t,r)?n:je}function nu(t,r,n,i){var a=Es(t);if(a===Ke&&P.has(t.escapedName)&&r&&1===r.length)return k_(t,r[0]);var o=ri(t),s=o.typeParameters,c=Gl(r)+Ql(n,i),l=o.instantiations.get(c);return l||o.instantiations.set(c,l=Zd(a,wd(s,hl(r,s,vl(s),e.isInJSFile(t.valueDeclaration))),n,i)),l}function iu(t){var r,n=null===(r=t.declarations)||void 0===r?void 0:r.find(e.isTypeAlias);return !(!n||!e.getContainingFunction(n))}function au(e){return e.parent?"".concat(au(e.parent),".").concat(e.escapedName):e.escapedName}function ou(e){var t=(161===e.kind?e.right:206===e.kind?e.name:e).escapedText;if(t){var r=161===e.kind?ou(e.left):206===e.kind?ou(e.expression):void 0,n=r?"".concat(au(r),".").concat(t):t,i=Oe.get(n);return i||(Oe.set(n,i=Hn(524288,t,1048576)),i.parent=r,i.declaredType=Je),i}return we}function su(t,r,n){var i=function(t){switch(t.kind){case 178:return t.typeName;case 228:var r=t.expression;if(e.isEntityNameExpression(r))return r}}(t);if(!i)return we;var a=qi(i,r,n);return a&&a!==we?a:n?we:ou(i)}function cu(t,r){if(r===we)return je;if(96&(r=function(t){var r=t.valueDeclaration;if(r&&e.isInJSFile(r)&&!(524288&t.flags)&&!e.getExpandoInitializer(r,!1)){var n=e.isVariableDeclaration(r)?e.getDeclaredExpandoInitializer(r):e.getAssignedExpandoInitializer(r);if(n){var i=la(n);if(i)return Qh(i,t)}}}(r)||r).flags)return ru(t,r);if(524288&r.flags)return function(t,r){if(1048576&e.getCheckFlags(r)){var n=yu(t),i=Ql(r,n),a=Me.get(i);return a||((a=ba(1,"error")).aliasSymbol=r,a.aliasTypeArguments=n,Me.set(i,a)),a}var o=Es(r),s=ri(r).typeParameters;if(s){var c=e.length(t.typeArguments),l=vl(s);if(c<l||c>s.length)return Jn(t,l===s.length?e.Diagnostics.Generic_type_0_requires_1_type_argument_s:e.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,Ua(r),l,s.length),je;var u=od(t),_=!u||!iu(r)&&iu(u)?void 0:u;return nu(r,yu(t),_,sd(_))}return fu(t,r)?o:je}(t,r);var n=Ns(r);return n?fu(t,r)?md(n):je:111551&r.flags&&pu(t)?function(e,t){var r=ni(e);if(!r.resolvedJSDocType){var n=$o(t),i=n;if(t.valueDeclaration){var a=200===e.kind&&e.qualifier;n.symbol&&n.symbol!==t&&a&&(i=cu(e,n.symbol));}r.resolvedJSDocType=i;}return r.resolvedJSDocType}(t,r)||(su(t,788968),$o(r)):je}function lu(e,t){if(3&t.flags||t===e)return e;var r="".concat(Zu(e),">").concat(Zu(t)),n=Ee.get(r);if(n)return n;var i=va(33554432);return i.baseType=e,i.substitute=t,Ee.set(r,i),i}function uu(e){return 184===e.kind&&1===e.elements.length}function _u(e,t,r){return uu(t)&&uu(r)?_u(e,t.elements[0],r.elements[0]):H_(kd(t))===H_(e)?kd(r):void 0}function du(t,r){for(var n,i=!0;r&&!e.isStatement(r)&&320!==r.kind;){var a=r.parent;if(164===a.kind&&(i=!i),(i||8650752&t.flags)&&189===a.kind&&r===a.trueType)(s=_u(t,a.checkType,a.extendsType))&&(n=e.append(n,s));else if(262144&t.flags&&195===a.kind&&r===a.type){var o=kd(a);if(pc(o)===H_(t)){var s,c=qd(o);c&&(s=Ac(c))&&Cm(s,uf)&&(n=e.append(n,a_([Ze,vt])));}}r=a;}return n?lu(t,p_(e.append(n,t))):t}function pu(e){return !!(8388608&e.flags)&&(178===e.kind||200===e.kind)}function fu(t,r){return !t.typeArguments||(Jn(t,e.Diagnostics.Type_0_is_not_generic,r?Ua(r):t.typeName?e.declarationNameToString(t.typeName):l),!1)}function gu(t){if(e.isIdentifier(t.typeName)){var r=t.typeArguments;switch(t.typeName.escapedText){case"String":return fu(t),Ye;case"Number":return fu(t),Ze;case"Boolean":return fu(t),it;case"Void":return fu(t),ot;case"Undefined":return fu(t),qe;case"Null":return fu(t),Qe;case"Function":case"function":return fu(t),jt;case"array":return r&&r.length||$?void 0:Qt;case"promise":return r&&r.length||$?void 0:Nb(Le);case"Object":if(r&&2===r.length){if(e.isJSDocIndexSignature(t)){var n=kd(r[0]),i=kd(r[1]),a=n===Ye||n===Ze?[Jl(n,i,!1)]:e.emptyArray;return Ea(void 0,K,e.emptyArray,e.emptyArray,a)}return Le}return fu(t),$?void 0:Le}}}function mu(t){var r=ni(t);if(!r.resolvedType){if(e.isConstTypeReference(t)&&e.isAssertionExpression(t.parent))return r.resolvedSymbol=we,r.resolvedType=cx(t.parent.expression);var n=void 0,i=void 0,a=788968;pu(t)&&((i=gu(t))||((n=su(t,a,!0))===we?n=su(t,900095):su(t,a),i=cu(t,n))),i||(i=cu(t,n=su(t,a))),r.resolvedSymbol=n,r.resolvedType=i;}return r.resolvedType}function yu(t){return e.map(t.typeArguments,kd)}function vu(e){var t=ni(e);if(!t.resolvedType){var r=ob(e);t.resolvedType=md(rg(r));}return t.resolvedType}function hu(t,r){function n(e){var t=e.declarations;if(t)for(var r=0,n=t;r<n.length;r++){var i=n[r];switch(i.kind){case 257:case 258:case 260:return i}}}if(!t)return r?Et:St;var i=Es(t);return 524288&i.flags?e.length(i.typeParameters)!==r?(Jn(n(t),e.Diagnostics.Global_type_0_must_have_1_type_parameter_s,e.symbolName(t),r),r?Et:St):i:(Jn(n(t),e.Diagnostics.Global_type_0_must_be_a_class_or_interface_type,e.symbolName(t)),r?Et:St)}function bu(t,r){return Su(t,111551,r?e.Diagnostics.Cannot_find_global_value_0:void 0)}function xu(t,r){return Su(t,788968,r?e.Diagnostics.Cannot_find_global_type_0:void 0)}function Du(t,r,n){var i=Su(t,788968,n?e.Diagnostics.Cannot_find_global_type_0:void 0);if(!i||(Es(i),e.length(ri(i).typeParameters)===r))return i;Jn(i.declarations&&e.find(i.declarations,e.isTypeAliasDeclaration),e.Diagnostics.Global_type_0_must_have_1_type_parameter_s,e.symbolName(i),r);}function Su(e,t,r){return li(void 0,e,t,r,e,!1,!1,!1)}function Tu(e,t,r){var n=xu(e,r);return n||r?hu(n,t):void 0}function Cu(){return vr||(vr=Tu("ImportMeta",0,!0)||St)}function ku(){if(!hr){var t=Hn(0,"ImportMetaExpression"),r=Cu(),n=Hn(4,"meta",8);n.parent=t,n.type=r;var i=e.createSymbolTable([n]);t.members=i,hr=Ea(t,i,e.emptyArray,e.emptyArray,e.emptyArray);}return hr}function Eu(e){return br||(br=Tu("ImportCallOptions",0,e))||St}function Nu(e){return $t||($t=bu("Symbol",e))}function Fu(){return tr||(tr=Tu("Symbol",0,!1))||St}function Au(e){return nr||(nr=Tu("Promise",1,e))||Et}function Pu(e){return ir||(ir=Tu("PromiseLike",1,e))||Et}function wu(e){return ar||(ar=bu("Promise",e))}function Iu(e){return sr||(sr=Tu("Iterable",1,e))||Et}function Ou(e,t){void 0===t&&(t=0);var r=Su(e,788968,void 0);return r&&hu(r,t)}function Mu(e){return Sr||(Sr=Du("Awaited",1,e)||(e?we:void 0)),Sr===we?void 0:Sr}function Lu(e,t){return e!==Et?Yl(e,t):St}function Ru(e){return Lu(rr||(rr=Tu("TypedPropertyDescriptor",1,!0)||Et),[e])}function Bu(e,t){return Lu(t?Ut:Kt,[e])}function ju(e){switch(e.kind){case 185:return 2;case 186:return Ju(e);case 197:return e.questionToken?2:e.dotDotDotToken?Ju(e):1;default:return 1}}function Ju(e){return Cd(e.type)?4:8}function zu(t,r){return !!od(t)||Ku(t)&&(183===t.kind?Uu(t.elementType):184===t.kind?e.some(t.elements,Uu):r||e.some(t.typeArguments,Uu))}function Ku(e){var t=e.parent;switch(t.kind){case 191:case 197:case 178:case 187:case 188:case 194:case 189:case 193:case 183:case 184:return Ku(t);case 259:return !0}return !1}function Uu(t){switch(t.kind){case 178:return pu(t)||!!(524288&su(t,788968).flags);case 181:return !0;case 193:return 154!==t.operator&&Uu(t.type);case 191:case 185:case 197:case 316:case 314:case 315:case 309:return Uu(t.type);case 186:return 183!==t.type.kind||Uu(t.type.elementType);case 187:case 188:return e.some(t.types,Uu);case 194:return Uu(t.objectType)||Uu(t.indexType);case 189:return Uu(t.checkType)||Uu(t.extendsType)||Uu(t.trueType)||Uu(t.falseType)}return !1}function Vu(t,r,n,i){void 0===n&&(n=!1);var a=qu(r||e.map(t,(function(e){return 1})),n,i);return a===Et?St:t.length?Wu(a,t):a}function qu(t,r,n){if(1===t.length&&4&t[0])return r?Ut:Kt;var i=e.map(t,(function(e){return 1&e?"#":2&e?"?":4&e?".":"*"})).join()+(r?"R":"")+(n&&n.length?","+e.map(n,O).join(","):""),a=ye.get(i);return a||ye.set(i,a=function(t,r,n){var i,a=t.length,o=e.countWhere(t,(function(e){return !!(9&e)})),s=[],c=0;if(a){i=new Array(a);for(var l=0;l<a;l++){var u=i[l]=Da(),_=t[l];if(!(12&(c|=_))){var d=Hn(4|(2&_?16777216:0),""+l,r?8:0);d.tupleLabelDeclaration=null==n?void 0:n[l],d.type=u,s.push(d);}}}var p=s.length,f=Hn(4,"length",r?8:0);if(12&c)f.type=Ze;else {var g=[];for(l=o;l<=a;l++)g.push(hd(l));f.type=a_(g);}s.push(f);var m=xa(12);return m.typeParameters=i,m.outerTypeParameters=void 0,m.localTypeParameters=i,m.instantiations=new e.Map,m.instantiations.set(Gl(m.typeParameters),m),m.target=m,m.resolvedTypeArguments=m.typeParameters,m.thisType=Da(),m.thisType.isThisType=!0,m.thisType.constraint=m,m.declaredProperties=s,m.declaredCallSignatures=e.emptyArray,m.declaredConstructSignatures=e.emptyArray,m.declaredIndexInfos=e.emptyArray,m.elementFlags=t,m.minLength=o,m.fixedLength=p,m.hasRestElement=!!(12&c),m.combinedFlags=c,m.readonly=r,m.labeledElementDeclarations=n,m}(t,r,n)),a}function Wu(e,t){return 8&e.objectFlags?Hu(e,t):Yl(e,t)}function Hu(t,r){var n,i,a;if(!(14&t.combinedFlags))return Yl(t,r);if(8&t.combinedFlags){var o=e.findIndex(r,(function(e,r){return !!(8&t.elementFlags[r]&&1179648&e.flags)}));if(o>=0)return g_(e.map(r,(function(e,r){return 8&t.elementFlags[r]?e:Ue})))?Fm(r[o],(function(n){return Hu(t,e.replaceElement(r,o,n))})):je}for(var s=[],c=[],l=[],_=-1,d=-1,p=-1,f=function(o){var c=r[o],l=t.elementFlags[o];if(8&l)if(58982400&c.flags||Sc(c))v(c,8,null===(n=t.labeledElementDeclarations)||void 0===n?void 0:n[o]);else if(Nf(c)){var _=eu(c);if(_.length+s.length>=1e4)return Jn(u,e.isPartOfTypeNode(u)?e.Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent:e.Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent),{value:je};e.forEach(_,(function(e,t){var r;return v(e,c.target.elementFlags[t],null===(r=c.target.labeledElementDeclarations)||void 0===r?void 0:r[t])}));}else v(pf(c)&&sl(c,Ze)||je,4,null===(i=t.labeledElementDeclarations)||void 0===i?void 0:i[o]);else v(c,l,null===(a=t.labeledElementDeclarations)||void 0===a?void 0:a[o]);},g=0;g<r.length;g++){var m=f(g);if("object"==typeof m)return m.value}for(g=0;g<_;g++)2&c[g]&&(c[g]=1);d>=0&&d<p&&(s[d]=a_(e.sameMap(s.slice(d,p+1),(function(e,t){return 8&c[d+t]?K_(e,Ze):e}))),s.splice(d+1,p-d),c.splice(d+1,p-d),null==l||l.splice(d+1,p-d));var y=qu(c,t.readonly,l);return y===Et?St:c.length?Yl(y,s):y;function v(e,t,r){1&t&&(_=c.length),4&t&&d<0&&(d=c.length),6&t&&(p=c.length),s.push(e),c.push(t),l&&r?l.push(r):l=void 0;}}function Gu(t,r,n){void 0===n&&(n=0);var i=t.target,a=tu(t)-n;return r>i.fixedLength?function(e){var t=Pf(e);return t&&Bu(t)}(t)||Vu(e.emptyArray):Vu(eu(t).slice(r,a),i.elementFlags.slice(r,a),!1,i.labeledElementDeclarations&&i.labeledElementDeclarations.slice(r,a))}function Qu(t){return a_(e.append(e.arrayOf(t.target.fixedLength,(function(e){return vd(""+e)})),D_(t.target.readonly?Ut:Kt)))}function Xu(t,r){var n=e.findIndex(t.elementFlags,(function(e){return !(e&r)}));return n>=0?n:t.elementFlags.length}function Yu(t,r){return t.elementFlags.length-e.findLastIndex(t.elementFlags,(function(e){return !(e&r)}))-1}function Zu(e){return e.id}function $u(t,r){return e.binarySearch(t,r,Zu,e.compareValues)>=0}function e_(t,r){var n=e.binarySearch(t,r,Zu,e.compareValues);return n<0&&(t.splice(~n,0,r),!0)}function t_(t,r,n){var i=n.flags;if(1048576&i)return r_(t,r|(function(e){return !!(1048576&e.flags&&(e.aliasSymbol||e.origin))}(n)?1048576:0),n.types);if(!(131072&i))if(r|=205258751&i,465829888&i&&(r|=33554432),n===Be&&(r|=8388608),!Q&&98304&i)65536&e.getObjectFlags(n)||(r|=4194304);else {var a=t.length,o=a&&n.id>t[a-1].id?~a:e.binarySearch(t,n,Zu,e.compareValues);o<0&&t.splice(~o,0,n);}return r}function r_(e,t,r){for(var n=0,i=r;n<i.length;n++)t=t_(e,t,i[n]);return t}function n_(t,r){for(var n=0,i=r;n<i.length;n++){var a=i[n];if(1048576&a.flags){var o=a.origin;a.aliasSymbol||o&&!(1048576&o.flags)?e.pushIfUnique(t,a):o&&1048576&o.flags&&n_(t,o.types);}}}function i_(e,t){var r=ha(e);return r.types=t,r}function a_(t,r,n,i,a){if(void 0===r&&(r=1),0===t.length)return st;if(1===t.length)return t[0];var o=[],s=r_(o,0,t);if(0!==r){if(3&s)return 1&s?8388608&s?Be:Le:65536&s||$u(o,Ue)?Ue:Ve;if(ie&&32768&s){var c=e.binarySearch(o,Ge,Zu,e.compareValues);c>=0&&$u(o,qe)&&e.orderedRemoveItemAt(o,c);}if((402664320&s||16384&s&&32768&s)&&function(t,r,n){for(var i=t.length;i>0;){var a=t[--i],o=a.flags;(402653312&o&&4&r||256&o&&8&r||2048&o&&64&r||8192&o&&4096&r||n&&32768&o&&16384&r||yd(a)&&$u(t,a.regularType))&&e.orderedRemoveItemAt(t,i);}}(o,s,!!(2&r)),128&s&&134217728&s&&function(t){var r=e.filter(t,I_);if(r.length)for(var n=t.length,i=function(){n--;var i=t[n];128&i.flags&&e.some(r,(function(e){return Ag(i,e)}))&&e.orderedRemoveItemAt(t,n);};n>0;)i();}(o),2===r&&!(o=function(t,r){if(t.length<2)return t;var n=Gl(t),i=Ne.get(n);if(i)return i;for(var a=r&&e.some(t,(function(e){return !!(524288&e.flags)&&!Sc(e)&&Ep(Tc(e))})),o=t.length,s=o,c=0;s>0;){var l=t[--s];if(a||469499904&l.flags)for(var _=61603840&l.flags?e.find(Nc(l),(function(e){return bf($o(e))})):void 0,d=_&&md($o(_)),p=0,f=t;p<f.length;p++){var g=f[p];if(l!==g){if(1e5===c&&c/(o-s)*o>1e6)return null===e.tracing||void 0===e.tracing||e.tracing.instant("checkTypes","removeSubtypes_DepthLimit",{typeIds:t.map((function(e){return e.id}))}),void Jn(u,e.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);if(c++,_&&61603840&g.flags){var m=uo(g,_.escapedName);if(m&&bf(m)&&md(m)!==d)continue}if(Ip(l,g,Nn)&&(!(1&e.getObjectFlags(rs(l)))||!(1&e.getObjectFlags(rs(g)))||dp(l,g))){e.orderedRemoveItemAt(t,s);break}}}}return Ne.set(n,t),t}(o,!!(524288&s))))return je;if(0===o.length)return 65536&s?4194304&s?Qe:Xe:32768&s?4194304&s?qe:We:st}if(!a&&1048576&s){var l=[];n_(l,t);for(var _=[],d=function(t){e.some(l,(function(e){return $u(e.types,t)}))||_.push(t);},p=0,f=o;p<f.length;p++)d(f[p]);if(!n&&1===l.length&&0===_.length)return l[0];if(e.reduceLeft(l,(function(e,t){return e+t.types.length}),0)+_.length===o.length){for(var g=0,m=l;g<m.length;g++)e_(_,m[g]);a=i_(1048576,_);}}return s_(o,(36323363&s?0:32768)|(2097152&s?16777216:0),n,i,a)}function o_(e,t){return e.kind===t.kind&&e.parameterIndex===t.parameterIndex}function s_(e,t,r,n,i){if(0===e.length)return st;if(1===e.length)return e[0];var a=(i?1048576&i.flags?"|".concat(Gl(i.types)):2097152&i.flags?"&".concat(Gl(i.types)):"#".concat(i.type.id,"|").concat(Gl(e)):Gl(e))+Ql(r,n),o=ve.get(a);return o||((o=va(1048576)).objectFlags=t|Xl(e,98304),o.types=e,o.origin=i,o.aliasSymbol=r,o.aliasTypeArguments=n,2===e.length&&512&e[0].flags&&512&e[1].flags&&(o.flags|=16,o.intrinsicName="boolean"),ve.set(a,o)),o}function c_(e,t,r){var n=r.flags;return 2097152&n?l_(e,t,r.types):(Fp(r)?16777216&t||(t|=16777216,e.set(r.id.toString(),r)):(3&n?r===Be&&(t|=8388608):!Q&&98304&n||(ie&&r===Ge&&(t|=262144,r=qe),e.has(r.id.toString())||(109440&r.flags&&109440&t&&(t|=67108864),e.set(r.id.toString(),r))),t|=205258751&n),t)}function l_(e,t,r){for(var n=0,i=r;n<i.length;n++)t=c_(e,t,md(i[n]));return t}function u_(e,t){for(var r=0,n=e;r<n.length;r++){var i=n[r];if(!$u(i.types,t)){var a=128&t.flags?Ye:256&t.flags?Ze:2048&t.flags?$e:8192&t.flags?at:void 0;if(!a||!$u(i.types,a))return !1}}return !0}function __(t,r){return e.every(t,(function(t){return !!(1048576&t.flags)&&e.some(t.types,(function(e){return !!(e.flags&r)}))}))}function d_(e,t){for(var r=0;r<e.length;r++)e[r]=km(e[r],(function(e){return !(e.flags&t)}));}function p_(t,r,n){var i=new e.Map,a=l_(i,0,t),o=e.arrayFrom(i.values());if(131072&a)return e.contains(o,ct)?ct:st;if(Q&&98304&a&&84410368&a||67108864&a&&402783228&a||402653316&a&&67238776&a||296&a&&469891796&a||2112&a&&469889980&a||12288&a&&469879804&a||49152&a&&469842940&a)return st;if(134217728&a&&128&a&&function(t){for(var r=t.length,n=e.filter(t,(function(e){return !!(128&e.flags)}));r>0;){var i=t[--r];if(134217728&i.flags)for(var a=0,o=n;a<o.length;a++){if(up(o[a],i)){e.orderedRemoveItemAt(t,r);break}if(I_(i))return !0}}return !1}(o))return st;if(1&a)return 8388608&a?Be:Le;if(!Q&&98304&a)return 32768&a?qe:Qe;if((4&a&&402653312&a||8&a&&256&a||64&a&&2048&a||4096&a&&8192&a)&&function(t,r){for(var n=t.length;n>0;){var i=t[--n];(4&i.flags&&402653312&r||8&i.flags&&256&r||64&i.flags&&2048&r||4096&i.flags&&8192&r)&&e.orderedRemoveItemAt(t,n);}}(o,a),16777216&a&&524288&a&&e.orderedRemoveItemAt(o,e.findIndex(o,Fp)),262144&a&&(o[o.indexOf(qe)]=Ge),0===o.length)return Ue;if(1===o.length)return o[0];var s=Gl(o)+Ql(r,n),c=he.get(s);if(!c){if(1048576&a)if(function(t){var r,n=e.findIndex(t,(function(t){return !!(32768&e.getObjectFlags(t))}));if(n<0)return !1;for(var i=n+1;i<t.length;){var a=t[i];32768&e.getObjectFlags(a)?((r||(r=[t[n]])).push(a),e.orderedRemoveItemAt(t,i)):i++;}if(!r)return !1;for(var o=[],s=[],c=0,l=r;c<l.length;c++)for(var u=0,_=l[c].types;u<_.length;u++)e_(o,a=_[u])&&u_(r,a)&&e_(s,a);return t[n]=s_(s,32768),!0}(o))c=p_(o,r,n);else if(__(o,32768)){var l=ie&&e.some(o,(function(e){return $u(e.types,Ge)}))?Ge:qe;d_(o,32768),c=a_([p_(o),l],1,r,n);}else if(__(o,65536))d_(o,65536),c=a_([p_(o),Qe],1,r,n);else {if(!g_(o))return je;var u=function(e){for(var t=f_(e),r=[],n=0;n<t;n++){for(var i=e.slice(),a=n,o=e.length-1;o>=0;o--)if(1048576&e[o].flags){var s=e[o].types,c=s.length;i[o]=s[a%c],a=Math.floor(a/c);}var l=p_(i);131072&l.flags||r.push(l);}return r}(o);c=a_(u,1,r,n,e.some(u,(function(e){return !!(2097152&e.flags)}))?i_(2097152,o):void 0);}else c=function(e,t,r){var n=va(2097152);return n.objectFlags=Xl(e,98304),n.types=e,n.aliasSymbol=t,n.aliasTypeArguments=r,n}(o,r,n);he.set(s,c);}return c}function f_(t){return e.reduceLeft(t,(function(e,t){return 1048576&t.flags?e*t.types.length:131072&t.flags?0:e}),1)}function g_(t){var r=f_(t);return !(r>=1e5&&(null===e.tracing||void 0===e.tracing||e.tracing.instant("checkTypes","checkCrossProductUnion_DepthLimit",{typeIds:t.map((function(e){return e.id})),size:r}),Jn(u,e.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent),1))}function m_(e,t){var r=va(4194304);return r.type=e,r.stringsOnly=t,r}function y_(e,t){return t?e.resolvedStringIndexType||(e.resolvedStringIndexType=m_(e,!0)):e.resolvedIndexType||(e.resolvedIndexType=m_(e,!1))}function v_(t){return e.isPrivateIdentifier(t)?st:e.isIdentifier(t)?vd(e.unescapeLeadingUnderscores(t.escapedText)):md(e.isComputedPropertyName(t)?Hy(t):kx(t))}function h_(t,r,n){if(n||!(24&e.getDeclarationModifierFlagsFromSymbol(t))){var i=ri(Ws(t)).nameType;if(!i){var a=e.getNameOfDeclaration(t.valueDeclaration);i="default"===t.escapedName?vd("default"):a&&v_(a)||(e.isKnownSymbol(t)?void 0:vd(e.symbolName(t)));}if(i&&i.flags&r)return i}return st}function b_(t,r){return !!(t.flags&r||2097152&t.flags&&e.some(t.types,(function(e){return b_(e,r)})))}function x_(t,r,n){var i=n&&(7&e.getObjectFlags(t)||t.aliasSymbol)?function(e){var t=ha(4194304);return t.type=e,t}(t):void 0,a=e.map(Nc(t),(function(e){return h_(e,r)})),o=e.map(al(t),(function(e){return e!==Rr&&b_(e.keyType,r)?e.keyType===Ye&&8&r?pt:e.keyType:st}));return a_(e.concatenate(a,o),1,void 0,void 0,i)}function D_(t,r,n){return void 0===r&&(r=re),1048576&(t=Hc(t)).flags?function(t){return e.some(t.types,(function(e){var t=function(e){return 262143&e.flags?e:e.uniqueLiteralFilledInstantiation||(e.uniqueLiteralFilledInstantiation=Yd(e,Dt))}(e);return Hc(t)!==t}))}(t)?y_(t,r):p_(e.map(t.types,(function(e){return D_(e,r,n)}))):2097152&t.flags?a_(e.map(t.types,(function(e){return D_(e,r,n)}))):58982400&t.flags||Ff(t)||Sc(t)&&(a=pc(i=t),!function t(r){return !!(68157439&r.flags)||(16777216&r.flags?r.root.isDistributive&&r.checkType===a:137363456&r.flags?e.every(r.types,t):8388608&r.flags?t(r.objectType)&&t(r.indexType):33554432&r.flags?t(r.substitute):!!(268435456&r.flags)&&t(r.type))}(gc(i)||a))?y_(t,r):32&e.getObjectFlags(t)?function(e,t,r){var n=pc(e),i=fc(e),a=gc(e.target||e);if(!a&&!r)return i;var o=[];if(vc(e)){if(L_(i))return y_(e,t);dc(Kc(hc(e)),8576,t,c);}else Sm(uc(i),c);L_(i)&&Sm(i,c);var s=r?km(a_(o),(function(e){return !(5&e.flags)})):a_(o);return 1048576&s.flags&&1048576&i.flags&&Gl(s.types)===Gl(i.types)?i:s;function c(t){var r=a?Yd(a,Jd(e.mapper,n,t)):t;o.push(r===Ye?pt:r);}}(t,r,n):t===Be?Be:2&t.flags?st:131073&t.flags?gt:x_(t,(n?128:402653316)|(r?0:12584),r===re&&!n);var i,a;}function S_(e){if(re)return e;var t=(xr||(xr=Du("Extract",2,!0)||we),xr===we?void 0:xr);return t?nu(t,[e,Ye]):Ye}function T_(t,r){var n=e.findIndex(r,(function(e){return !!(1179648&e.flags)}));if(n>=0)return g_(r)?Fm(r[n],(function(i){return T_(t,e.replaceElement(r,n,i))})):je;if(e.contains(r,Be))return Be;var i=[],a=[],o=t[0];if(!function t(r,n){for(var s=e.isArray(r),c=0;c<n.length;c++){var l=n[c],u=s?r[c+1]:r;if(101248&l.flags){if(o+=C_(l)||"",o+=u,!s)return !0}else if(134217728&l.flags){if(o+=l.texts[0],!t(l.texts,l.types))return !1;if(o+=u,!s)return !0}else if(L_(l)||w_(l))i.push(l),a.push(o),o=u;else if(2097152&l.flags){if(!t(r[c+1],l.types))return !1}else if(s)return !1}return !0}(t,r))return Ye;if(0===i.length)return vd(o);if(a.push(o),e.every(a,(function(e){return ""===e}))&&e.every(i,(function(e){return !!(4&e.flags)})))return Ye;var s="".concat(Gl(i),"|").concat(e.map(a,(function(e){return e.length})).join(","),"|").concat(a.join("")),c=Ce.get(s);return c||Ce.set(s,c=function(e,t){var r=va(134217728);return r.texts=e,r.types=t,r}(a,i)),c}function C_(t){return 128&t.flags?t.value:256&t.flags?""+t.value:2048&t.flags?e.pseudoBigIntToString(t.value):98816&t.flags?t.intrinsicName:void 0}function k_(e,t){return 1179648&t.flags?Fm(t,(function(t){return k_(e,t)})):L_(t)?function(e,t){var r="".concat(M(e),",").concat(Zu(t)),n=ke.get(r);return n||ke.set(r,n=function(e,t){var r=va(268435456);return r.symbol=e,r.type=t,r}(e,t)),n}(e,t):128&t.flags?vd(function(e,t){switch(P.get(e.escapedName)){case 0:return t.toUpperCase();case 1:return t.toLowerCase();case 2:return t.charAt(0).toUpperCase()+t.slice(1);case 3:return t.charAt(0).toLowerCase()+t.slice(1)}return t}(e,t.value)):t}function E_(t){if($)return !1;if(4096&e.getObjectFlags(t))return !0;if(1048576&t.flags)return e.every(t.types,E_);if(2097152&t.flags)return e.some(t.types,E_);if(465829888&t.flags){var r=Bc(t);return r!==t&&E_(r)}return !1}function N_(t,r){return Rs(t)?Ks(t):r&&e.isPropertyName(r)?e.getPropertyNameForPropertyNameNode(r):void 0}function F_(t,r){if(8208&r.flags){var n=e.findAncestor(t.parent,(function(t){return !e.isAccessExpression(t)}))||t.parent;return e.isCallLikeExpression(n)?e.isCallOrNewExpression(n)&&e.isIdentifier(t)&&rm(n,t):e.every(r.declarations,(function(t){return !e.isFunctionLike(t)||!!(268435456&e.getCombinedNodeFlags(t))}))}return !0}function A_(t,r,n,i,a,o){var s,c=a&&207===a.kind?a:void 0,l=a&&e.isPrivateIdentifier(a)?void 0:N_(n,a);if(void 0!==l){if(256&o)return Ey(r,l)||Le;var u=Zc(r,l);if(u){if(64&o&&a&&u.declarations&&qn(u)&&F_(a,u)&&Wn(null!==(s=null==c?void 0:c.argumentExpression)&&void 0!==s?s:e.isIndexedAccessTypeNode(a)?a.indexType:a,u.declarations,l),c){if(Zv(u,c,$v(c.expression,r.symbol)),Ub(c,u,e.getAssignmentTargetKind(c)))return void Jn(c.argumentExpression,e.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property,Ua(u));if(8&o&&(ni(a).resolvedSymbol=u),Rv(c,u))return Re}var _=$o(u);return c&&1!==e.getAssignmentTargetKind(c)?Xm(c,_):_}if(Cm(r,Nf)&&e.isNumericLiteralName(l)&&+l>=0){if(a&&Cm(r,(function(e){return !e.target.hasRestElement}))&&!(16&o)){var d=P_(a);Nf(r)?Jn(d,e.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,qa(r),tu(r),e.unescapeLeadingUnderscores(l)):Jn(d,e.Diagnostics.Property_0_does_not_exist_on_type_1,e.unescapeLeadingUnderscores(l),qa(r));}return b(ol(r,Ze)),Fm(r,(function(e){var t=Pf(e)||qe;return 1&o?a_([t,qe]):t}))}}if(!(98304&n.flags)&&Gb(n,402665900)){if(131073&r.flags)return r;var p=ll(r,n)||ol(r,Ye);if(p)return 2&o&&p.keyType!==Ze?void(c&&Jn(c,e.Diagnostics.Type_0_cannot_be_used_to_index_type_1,qa(n),qa(t))):a&&p.keyType===Ye&&!Gb(n,12)?(Jn(d=P_(a),e.Diagnostics.Type_0_cannot_be_used_as_an_index_type,qa(n)),1&o?a_([p.type,qe]):p.type):(b(p),1&o?a_([p.type,qe]):p.type);if(131072&n.flags)return st;if(E_(r))return Le;if(c&&!Xb(r)){if(Lg(r)){if($&&384&n.flags)return Sn.add(e.createDiagnosticForNode(c,e.Diagnostics.Property_0_does_not_exist_on_type_1,n.value,qa(r))),qe;if(12&n.flags){var f=e.map(r.properties,(function(e){return $o(e)}));return a_(e.append(f,qe))}}if(r.symbol===ue&&void 0!==l&&ue.exports.has(l)&&418&ue.exports.get(l).flags)Jn(c,e.Diagnostics.Property_0_does_not_exist_on_type_1,e.unescapeLeadingUnderscores(l),qa(r));else if($&&!V.suppressImplicitAnyIndexErrors&&!(128&o))if(void 0!==l&&Vv(l,r)){var g=qa(r);Jn(c,e.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead,l,g,g+"["+e.getTextOfNode(c.argumentExpression)+"]");}else if(sl(r,Ze))Jn(c.argumentExpression,e.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);else {var m=void 0;if(void 0!==l&&(m=Gv(l,r)))void 0!==m&&Jn(c.argumentExpression,e.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2,l,qa(r),m);else {var y=function(t,r,n){var i=e.isAssignmentTarget(r)?"set":"get";if(function(e){var r=kc(t,e);if(r){var i=fh($o(r));return !!i&&hb(i)>=1&&_p(n,gb(i,0))}return !1}(i)){var a=e.tryGetPropertyAccessOrIdentifierToString(r.expression);return void 0===a?a=i:a+="."+i,a}}(r,c,n);if(void 0!==y)Jn(c,e.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1,qa(r),y);else {var v=void 0;if(1024&n.flags)v=e.chainDiagnosticMessages(void 0,e.Diagnostics.Property_0_does_not_exist_on_type_1,"["+qa(n)+"]",qa(r));else if(8192&n.flags){var h=Vi(n.symbol,c);v=e.chainDiagnosticMessages(void 0,e.Diagnostics.Property_0_does_not_exist_on_type_1,"["+h+"]",qa(r));}else 128&n.flags||256&n.flags?v=e.chainDiagnosticMessages(void 0,e.Diagnostics.Property_0_does_not_exist_on_type_1,n.value,qa(r)):12&n.flags&&(v=e.chainDiagnosticMessages(void 0,e.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1,qa(n),qa(r)));v=e.chainDiagnosticMessages(v,e.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1,qa(i),qa(r)),Sn.add(e.createDiagnosticForNodeFromMessageChain(c,v));}}}return}}return E_(r)?Le:(a&&(d=P_(a),384&n.flags?Jn(d,e.Diagnostics.Property_0_does_not_exist_on_type_1,""+n.value,qa(r)):12&n.flags?Jn(d,e.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1,qa(r),qa(n)):Jn(d,e.Diagnostics.Type_0_cannot_be_used_as_an_index_type,qa(n))),_o(n)?n:void 0);function b(t){t&&t.isReadonly&&c&&(e.isAssignmentTarget(c)||e.isDeleteTarget(c))&&Jn(c,e.Diagnostics.Index_signature_in_type_0_only_permits_reading,qa(r));}}function P_(e){return 207===e.kind?e.argumentExpression:194===e.kind?e.indexType:162===e.kind?e.expression:e}function w_(e){return !!(77&e.flags)}function I_(t){return !!(134217728&t.flags)&&e.every(t.types,w_)}function O_(e){return !!R_(e)}function M_(e){return !!(4194304&R_(e))}function L_(e){return !!(8388608&R_(e))}function R_(t){return 3145728&t.flags?(2097152&t.objectFlags||(t.objectFlags|=2097152|e.reduceLeft(t.types,(function(e,t){return e|R_(t)}),0)),12582912&t.objectFlags):33554432&t.flags?(2097152&t.objectFlags||(t.objectFlags|=2097152|R_(t.substitute)|R_(t.baseType)),12582912&t.objectFlags):(58982400&t.flags||Sc(t)||Ff(t)?4194304:0)|(465829888&t.flags&&!I_(t)?8388608:0)}function B_(t,r){return 8388608&t.flags?function(t,r){var n=r?"simplifiedForWriting":"simplifiedForReading";if(t[n])return t[n]===At?t:t[n];t[n]=At;var i=B_(t.objectType,r),a=B_(t.indexType,r),o=function(t,r,n){if(1048576&r.flags){var i=e.map(r.types,(function(e){return B_(K_(t,e),n)}));return n?p_(i):a_(i)}}(i,a,r);if(o)return t[n]=o;if(!(465829888&a.flags)){var s=j_(i,a,r);if(s)return t[n]=s}if(Ff(i)&&296&a.flags){var c=wf(i,8&a.flags?0:i.target.fixedLength,0,r);if(c)return t[n]=c}if(Sc(i)){var l=gc(i);if(!l||_p(l,pc(i)))return t[n]=Fm(z_(i,t.indexType),(function(e){return B_(e,r)}))}return t[n]=t}(t,r):16777216&t.flags?function(e,t){var r=e.checkType,n=e.extendsType,i=$_(e),a=ed(e);if(131072&a.flags&&H_(i)===H_(r)){if(1&r.flags||_p(ep(r),ep(n)))return B_(i,t);if(J_(r,n))return st}else if(131072&i.flags&&H_(a)===H_(r)){if(!(1&r.flags)&&_p(ep(r),ep(n)))return st;if(1&r.flags||J_(r,n))return B_(a,t)}return e}(t,r):t}function j_(t,r,n){if(3145728&t.flags){var i=e.map(t.types,(function(e){return B_(K_(e,r),n)}));return 2097152&t.flags||n?p_(i):a_(i)}}function J_(e,t){return !!(131072&a_([ac(e,t),st]).flags)}function z_(e,t){var r=wd([pc(e)],[t]),n=Bd(e.mapper,r);return Yd(mc(e),n)}function K_(e,t,r,n,i,a){return void 0===r&&(r=0),V_(e,t,r,n,i,a)||(n?je:Ue)}function U_(t,r){return Cm(t,(function(t){if(384&t.flags){var n=Ks(t);if(e.isNumericLiteralName(n)){var i=+n;return i>=0&&i<r}}return !1}))}function V_(e,t,r,n,i,a){if(void 0===r&&(r=0),e===Be||t===Be)return Be;if(!Ap(e)||98304&t.flags||!Gb(t,12)||(t=Ye),V.noUncheckedIndexedAccess&&32&r&&(r|=1),L_(t)||(n&&194!==n.kind?Ff(e)&&!U_(t,e.target.fixedLength):M_(e)&&(!Nf(e)||!U_(t,e.target.fixedLength)))){if(3&e.flags)return e;var o=1&r,s=e.id+","+t.id+","+o+Ql(i,a),c=Te.get(s);return c||Te.set(s,c=function(e,t,r,n,i){var a=va(8388608);return a.objectType=e,a.indexType=t,a.accessFlags=r,a.aliasSymbol=n,a.aliasTypeArguments=i,a}(e,t,o,i,a)),c}var l=Uc(e);if(1048576&t.flags&&!(16&t.flags)){for(var u=[],_=!1,d=0,p=t.types;d<p.length;d++){var f=A_(e,l,p[d],t,n,r|(_?128:0));if(f)u.push(f);else {if(!n)return;_=!0;}}if(_)return;return 4&r?p_(u,i,a):a_(u,1,i,a)}return A_(e,l,t,t,n,72|r)}function q_(e){var t=ni(e);if(!t.resolvedType){var r=kd(e.objectType),n=kd(e.indexType),i=od(e),a=K_(r,n,0,e,i,sd(i));t.resolvedType=8388608&a.flags&&a.objectType===r&&a.indexType===n?du(a,e):a;}return t.resolvedType}function W_(e){var t=ni(e);if(!t.resolvedType){var r=xa(32,e.symbol);r.declaration=e,r.aliasSymbol=od(e),r.aliasTypeArguments=sd(r.aliasSymbol),t.resolvedType=r,fc(r);}return t.resolvedType}function H_(e){return 33554432&e.flags?e.baseType:8388608&e.flags&&(33554432&e.objectType.flags||33554432&e.indexType.flags)?K_(H_(e.objectType),H_(e.indexType)):e}function G_(e){var t=Ac(e);return t&&(M_(t)||L_(t))?zd(e):e}function Q_(e){return !e.isDistributive&&X_(e.node.checkType)&&X_(e.node.extendsType)}function X_(t){return e.isTupleTypeNode(t)&&1===e.length(t.elements)&&!e.isOptionalTypeNode(t.elements[0])&&!e.isRestTypeNode(t.elements[0])&&!(e.isNamedTupleMember(t.elements[0])&&(t.elements[0].questionToken||t.elements[0].dotDotDotToken))}function Y_(e,t){return Q_(e)&&Nf(t)?eu(t)[0]:t}function Z_(t,r,n,i){for(var a,o,s=0,c=function(){if(1e3===s)return Jn(u,e.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite),a=je,"break";var c=Q_(t),l=Yd(Y_(t,H_(t.checkType)),r),d=O_(l),p=Yd(Y_(t,t.extendsType),r);if(l===Be||p===Be)return {value:Be};var f=void 0;if(t.inferTypeParameters){var g=e.sameMap(t.inferTypeParameters,G_),m=g!==t.inferTypeParameters?wd(t.inferTypeParameters,g):void 0,y=lg(g,void 0,0);if(m)for(var v=Bd(r,m),h=0,b=g;h<b.length;h++){var x=b[h];-1===t.inferTypeParameters.indexOf(x)&&(x.mapper=v);}d&&e.some(t.inferTypeParameters,(function(e){return e===p}))||Ig(y.inferences,l,Yd(p,m),1536);var D=Bd(m,y.mapper);f=r?Bd(D,r):D;}var S=f?Yd(Y_(t,t.extendsType),f):p;if(!d&&!O_(S)){if(!(3&S.flags)&&(1&l.flags&&!c||!_p($d(l),$d(S)))){1&l.flags&&!c&&(o||(o=[])).push(Yd(kd(t.node.trueType),f||r));var T=kd(t.node.falseType);if(16777216&T.flags){var C=T.root;if(C.node.parent===t.node&&(!C.isDistributive||C.checkType===t.checkType))return t=C,"continue";if(_(T,r))return "continue"}return a=Yd(T,r),"break"}if(3&S.flags||_p(ep(l),ep(S))){var k=kd(t.node.trueType),E=f||r;return _(k,E)?"continue":(a=Yd(k,E),"break")}}return (a=va(16777216)).root=t,a.checkType=Yd(t.checkType,r),a.extendsType=Yd(t.extendsType,r),a.mapper=r,a.combinedMapper=f,a.aliasSymbol=n||t.aliasSymbol,a.aliasTypeArguments=n?i:Fd(t.aliasTypeArguments,r),"break"};;){var l=c();if("object"==typeof l)return l.value;if("break"===l)break}return o?a_(e.append(o,a)):a;function _(a,o){if(16777216&a.flags&&o){var c=a.root;if(c.outerTypeParameters){var l=Bd(a.mapper,o),u=e.map(c.outerTypeParameters,(function(e){return Id(e,l)})),_=wd(c.outerTypeParameters,u),d=c.isDistributive?Id(c.checkType,_):void 0;if(!(d&&d!==c.checkType&&1179648&d.flags))return t=c,r=_,n=void 0,i=void 0,c.aliasSymbol&&s++,!0}}return !1}}function $_(e){return e.resolvedTrueType||(e.resolvedTrueType=Yd(kd(e.root.node.trueType),e.mapper))}function ed(e){return e.resolvedFalseType||(e.resolvedFalseType=Yd(kd(e.root.node.falseType),e.mapper))}function td(t){var r;return t.locals&&t.locals.forEach((function(t){262144&t.flags&&(r=e.append(r,Es(t)));})),r}function rd(t){return e.isIdentifier(t)?[t]:e.append(rd(t.left),t.right)}function nd(t){var r=ni(t);if(!r.resolvedType){if(t.isTypeOf&&t.typeArguments)return Jn(t,e.Diagnostics.Type_arguments_cannot_be_used_here),r.resolvedSymbol=we,r.resolvedType=je;if(!e.isLiteralImportTypeNode(t))return Jn(t.argument,e.Diagnostics.String_literal_expected),r.resolvedSymbol=we,r.resolvedType=je;var n=t.isTypeOf?111551:8388608&t.flags?900095:788968,i=Hi(t,t.argument.literal);if(!i)return r.resolvedSymbol=we,r.resolvedType=je;var a=Yi(i,!1);if(e.nodeIsMissing(t.qualifier))a.flags&n?r.resolvedType=id(t,r,a,n):(Jn(t,111551===n?e.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here:e.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0,t.argument.literal.text),r.resolvedSymbol=we,r.resolvedType=je);else {for(var o=rd(t.qualifier),s=a,c=void 0;c=o.shift();){var l=o.length?1920:n,u=ca(Li(s)),_=t.isTypeOf?Zc($o(u),c.escapedText):ai(ia(u),c.escapedText,l);if(!_)return Jn(c,e.Diagnostics.Namespace_0_has_no_exported_member_1,Vi(s),e.declarationNameToString(c)),r.resolvedType=je;ni(c).resolvedSymbol=_,ni(c.parent).resolvedSymbol=_,s=_;}r.resolvedType=id(t,r,s,n);}}return r.resolvedType}function id(e,t,r,n){var i=Li(r);return t.resolvedSymbol=i,111551===n?$o(r):cu(e,i)}function ad(t){var r=ni(t);if(!r.resolvedType){var n=od(t);if(0!==qs(t.symbol).size||n){var i=xa(16,t.symbol);i.aliasSymbol=n,i.aliasTypeArguments=sd(n),e.isJSDocTypeLiteral(t)&&t.isArrayType&&(i=Bu(i)),r.resolvedType=i;}else r.resolvedType=kt;}return r.resolvedType}function od(t){for(var r=t.parent;e.isParenthesizedTypeNode(r)||e.isJSDocTypeExpression(r)||e.isTypeOperatorNode(r)&&145===r.operator;)r=r.parent;return e.isTypeAlias(r)?la(r):void 0}function sd(e){return e?ss(e):void 0}function cd(e){return !!(524288&e.flags)&&!Sc(e)}function ld(e){return Np(e)||!!(474058748&e.flags)}function ud(t,r){if(!(1048576&t.flags))return t;if(e.every(t.types,ld))return e.find(t.types,Np)||St;var n=e.find(t.types,(function(e){return !ld(e)}));return n?e.find(t.types,(function(e){return e!==n&&!ld(e)}))?t:function(t){for(var n=e.createSymbolTable(),i=0,a=Nc(t);i<a.length;i++){var o=a[i];if(24&e.getDeclarationModifierFlagsFromSymbol(o));else if(dd(o)){var s=65536&o.flags&&!(32768&o.flags),c=Hn(16777220,o.escapedName,_c(o)|(r?8:0));c.type=s?qe:Co($o(o),!0),c.declarations=o.declarations,c.nameType=ri(o).nameType,c.syntheticOrigin=o,n.set(o.escapedName,c);}}var l=Ea(t.symbol,n,e.emptyArray,e.emptyArray,al(t));return l.objectFlags|=131200,l}(n):t}function _d(t,r,n,i,a){if(1&t.flags||1&r.flags)return Le;if(2&t.flags||2&r.flags)return Ue;if(131072&t.flags)return r;if(131072&r.flags)return t;if(1048576&(t=ud(t,a)).flags)return g_([t,r])?Fm(t,(function(e){return _d(e,r,n,i,a)})):je;if(1048576&(r=ud(r,a)).flags)return g_([t,r])?Fm(r,(function(e){return _d(t,e,n,i,a)})):je;if(473960444&r.flags)return t;if(M_(t)||M_(r)){if(Np(t))return r;if(2097152&t.flags){var o=t.types,s=o[o.length-1];if(cd(s)&&cd(r))return p_(e.concatenate(o.slice(0,o.length-1),[_d(s,r,n,i,a)]))}return p_([t,r])}for(var c=e.createSymbolTable(),l=new e.Set,u=t===St?al(r):ic([t,r]),_=0,d=Nc(r);_<d.length;_++){var p=d[_];24&e.getDeclarationModifierFlagsFromSymbol(p)?l.add(p.escapedName):dd(p)&&c.set(p.escapedName,pd(p,a));}for(var f=0,g=Nc(t);f<g.length;f++){var m=g[f];if(!l.has(m.escapedName)&&dd(m))if(c.has(m.escapedName)){var y=$o(p=c.get(m.escapedName));if(16777216&p.flags){var v=e.concatenate(m.declarations,p.declarations),h=Hn(4|16777216&m.flags,m.escapedName);h.type=a_([$o(m),Hf(y)],2),h.leftSpread=m,h.rightSpread=p,h.declarations=v,h.nameType=ri(m).nameType,c.set(m.escapedName,h);}}else c.set(m.escapedName,pd(m,a));}var b=Ea(n,c,e.emptyArray,e.emptyArray,e.sameMap(u,(function(e){return function(e,t){return e.isReadonly!==t?Jl(e.keyType,e.type,t,e.declaration):e}(e,a)})));return b.objectFlags|=2228352|i,b}function dd(t){var r;return !(e.some(t.declarations,e.isPrivateIdentifierClassElementDeclaration)||106496&t.flags&&(null===(r=t.declarations)||void 0===r?void 0:r.some((function(t){return e.isClassLike(t.parent)}))))}function pd(e,t){var r=65536&e.flags&&!(32768&e.flags);if(!r&&t===Kb(e))return e;var n=Hn(4|16777216&e.flags,e.escapedName,_c(e)|(t?8:0));return n.type=r?qe:$o(e),n.declarations=e.declarations,n.nameType=ri(e).nameType,n.syntheticOrigin=e,n}function fd(e,t,r,n){var i=va(e);return i.symbol=r,i.value=t,i.regularType=n||i,i}function gd(e){if(2944&e.flags){if(!e.freshType){var t=fd(e.flags,e.value,e.symbol,e);t.freshType=t,e.freshType=t;}return e.freshType}return e}function md(e){return 2944&e.flags?e.regularType:1048576&e.flags?e.regularType||(e.regularType=Fm(e,md)):e}function yd(e){return !!(2944&e.flags)&&e.freshType===e}function vd(e){var t;return be.get(e)||(be.set(e,t=fd(128,e)),t)}function hd(e){var t;return xe.get(e)||(xe.set(e,t=fd(256,e)),t)}function bd(t){var r,n=e.pseudoBigIntToString(t);return De.get(n)||(De.set(n,r=fd(2048,t)),r)}function xd(e,t,r){var n,i=t+("string"==typeof e?"@":"#")+e,a=1024|("string"==typeof e?128:256);return Se.get(i)||(Se.set(i,n=fd(a,e,r)),n)}function Dd(t){if(e.isValidESSymbolDeclaration(t)){var r=e.isCommonJsExportPropertyAssignment(t)?la(t.left):la(t);if(r){var n=ri(r);return n.uniqueESSymbolType||(n.uniqueESSymbolType=function(e){var t=va(8192);return t.symbol=e,t.escapedName="__@".concat(t.symbol.escapedName,"@").concat(M(t.symbol)),t}(r))}}return at}function Sd(t){var r=ni(t);return r.resolvedType||(r.resolvedType=function(t){var r=e.getThisContainer(t,!1),n=r&&r.parent;if(n&&(e.isClassLike(n)||258===n.kind)&&!e.isStatic(r)&&(!e.isConstructorDeclaration(r)||e.isNodeDescendantOf(t,r.body)))return vs(la(n)).thisType;if(n&&e.isObjectLiteralExpression(n)&&e.isBinaryExpression(n.parent)&&6===e.getAssignmentDeclarationKind(n.parent))return vs(la(n.parent.left).parent).thisType;var i=8388608&t.flags?e.getHostSignatureFromJSDoc(t):void 0;return i&&e.isFunctionExpression(i)&&e.isBinaryExpression(i.parent)&&3===e.getAssignmentDeclarationKind(i.parent)?vs(la(i.parent.left).parent).thisType:Gh(r)&&e.isNodeDescendantOf(t,r.body)?vs(la(r)).thisType:(Jn(t,e.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface),je)}(t)),r.resolvedType}function Td(e){return kd(Cd(e.type)||e.type)}function Cd(e){switch(e.kind){case 191:return Cd(e.type);case 184:if(1===e.elements.length&&(186===(e=e.elements[0]).kind||197===e.kind&&e.dotDotDotToken))return Cd(e.type);break;case 183:return e.elementType}}function kd(e){return du(Ed(e),e)}function Ed(t){switch(t.kind){case 130:case 312:case 313:return Le;case 155:return Ue;case 150:return Ye;case 147:return Ze;case 158:return $e;case 133:return it;case 151:return at;case 114:return ot;case 153:return qe;case 104:return Qe;case 143:return st;case 148:return 262144&t.flags&&!$?Le:dt;case 138:return Ke;case 192:case 108:return Sd(t);case 196:return function(e){if(104===e.literal.kind)return Qe;var t=ni(e);return t.resolvedType||(t.resolvedType=md(kx(e.literal))),t.resolvedType}(t);case 178:return mu(t);case 177:return t.assertsModifier?ot:it;case 228:return mu(t);case 181:return vu(t);case 183:case 184:return function(t){var r=ni(t);if(!r.resolvedType){var n=function(t){var r=function(t){return e.isTypeOperatorNode(t)&&145===t.operator}(t.parent);return Cd(t)?r?Ut:Kt:qu(e.map(t.elements,ju),r,e.some(t.elements,(function(e){return 197!==e.kind}))?void 0:t.elements)}(t);if(n===Et)r.resolvedType=St;else if(184===t.kind&&e.some(t.elements,(function(e){return !!(8&ju(e))}))||!zu(t)){var i=183===t.kind?[kd(t.elementType)]:e.map(t.elements,kd);r.resolvedType=Wu(n,i);}else r.resolvedType=184===t.kind&&0===t.elements.length?n:$l(n,t,void 0);}return r.resolvedType}(t);case 185:return function(e){return Co(kd(e.type),!0)}(t);case 187:return function(t){var r=ni(t);if(!r.resolvedType){var n=od(t);r.resolvedType=a_(e.map(t.types,kd),1,n,sd(n));}return r.resolvedType}(t);case 188:return function(t){var r=ni(t);if(!r.resolvedType){var n=od(t);r.resolvedType=p_(e.map(t.types,kd),n,sd(n));}return r.resolvedType}(t);case 314:return function(e){var t=kd(e.type);return Q?Bf(t,65536):t}(t);case 316:return Co(kd(t.type));case 197:return function(e){var t=ni(e);return t.resolvedType||(t.resolvedType=e.dotDotDotToken?Td(e):Co(kd(e.type),!0,!!e.questionToken))}(t);case 191:case 315:case 309:return kd(t.type);case 186:return Td(t);case 318:return function(t){var r=kd(t.type),n=t.parent,i=t.parent.parent;if(e.isJSDocTypeExpression(t.parent)&&e.isJSDocParameterTag(i)){var a=e.getHostSignatureFromJSDoc(i),o=e.isJSDocCallbackTag(i.parent.parent);if(a||o){var s=o?e.lastOrUndefined(i.parent.parent.typeExpression.parameters):e.lastOrUndefined(a.parameters),c=e.getParameterSymbolFromJSDoc(i);if(!s||c&&s.symbol===c&&e.isRestParameter(s))return Bu(r)}}return e.isParameter(n)&&e.isJSDocFunctionType(n.parent)?Bu(r):Co(r)}(t);case 179:case 180:case 182:case 322:case 317:case 323:return ad(t);case 193:return function(t){var r=ni(t);if(!r.resolvedType)switch(t.operator){case 140:r.resolvedType=D_(kd(t.type));break;case 154:r.resolvedType=151===t.type.kind?Dd(e.walkUpParenthesizedTypes(t.parent)):je;break;case 145:r.resolvedType=kd(t.type);break;default:throw e.Debug.assertNever(t.operator)}return r.resolvedType}(t);case 194:return q_(t);case 195:return W_(t);case 189:return function(t){var r=ni(t);if(!r.resolvedType){var n=kd(t.checkType),i=od(t),a=sd(i),o=as(t,!0),s=a?o:e.filter(o,(function(e){return Vd(e,t)})),c={node:t,checkType:n,extendsType:kd(t.extendsType),isDistributive:!!(262144&n.flags),inferTypeParameters:td(t),outerTypeParameters:s,instantiations:void 0,aliasSymbol:i,aliasTypeArguments:a};r.resolvedType=Z_(c,void 0),s&&(c.instantiations=new e.Map,c.instantiations.set(Gl(s),r.resolvedType));}return r.resolvedType}(t);case 190:return function(e){var t=ni(e);return t.resolvedType||(t.resolvedType=ks(la(e.typeParameter))),t.resolvedType}(t);case 198:return function(t){var r=ni(t);return r.resolvedType||(r.resolvedType=T_(n$4([t.head.text],e.map(t.templateSpans,(function(e){return e.literal.text})),!0),e.map(t.templateSpans,(function(e){return kd(e.type)})))),r.resolvedType}(t);case 200:return nd(t);case 79:case 161:case 206:var r=oT(t);return r?Es(r):je;default:return je}}function Nd(e,t,r){if(e&&e.length)for(var n=0;n<e.length;n++){var i=e[n],a=r(i,t);if(i!==a){var o=0===n?[]:e.slice(0,n);for(o.push(a),n++;n<e.length;n++)o.push(r(e[n],t));return o}}return e}function Fd(e,t){return Nd(e,t,Yd)}function Ad(e,t){return Nd(e,t,Kd)}function Pd(e,t){return Nd(e,t,tp)}function wd(e,t){return 1===e.length?Od(e[0],t?t[0]:Le):function(e,t){return {kind:1,sources:e,targets:t}}(e,t)}function Id(e,t){switch(t.kind){case 0:return e===t.source?t.target:e;case 1:for(var r=t.sources,n=t.targets,i=0;i<r.length;i++)if(e===r[i])return n?n[i]:Le;return e;case 2:return t.func(e);case 3:case 4:var a=Id(e,t.mapper1);return a!==e&&3===t.kind?Yd(a,t.mapper2):Id(a,t.mapper2)}}function Od(e,t){return {kind:0,source:e,target:t}}function Md(e){return {kind:2,func:e}}function Ld(e,t,r){return {kind:e,mapper1:t,mapper2:r}}function Rd(e){return wd(e,void 0)}function Bd(e,t){return e?Ld(3,e,t):t}function jd(e,t,r){return r?Ld(4,Od(e,t),r):Od(e,t)}function Jd(e,t,r){return e?Ld(4,e,Od(t,r)):Od(t,r)}function zd(e){var t=Da(e.symbol);return t.target=e,t}function Kd(t,r,n){var i;if(t.typeParameters&&!n){i=e.map(t.typeParameters,zd),r=Bd(wd(t.typeParameters,i),r);for(var a=0,o=i;a<o.length;a++)o[a].mapper=r;}var s=Qs(t.declaration,i,t.thisParameter&&Ud(t.thisParameter,r),Nd(t.parameters,r,Ud),void 0,void 0,t.minArgumentCount,39&t.flags);return s.target=t,s.mapper=r,s}function Ud(t,r){var n=ri(t);if(n.type&&!vg(n.type))return t;1&e.getCheckFlags(t)&&(t=n.target,r=Bd(n.mapper,r));var i=Hn(t.flags,t.escapedName,1|53256&e.getCheckFlags(t));return i.declarations=t.declarations,i.parent=t.parent,i.target=t,i.mapper=r,t.valueDeclaration&&(i.valueDeclaration=t.valueDeclaration),n.nameType&&(i.nameType=n.nameType),i}function Vd(t,r){if(t.symbol&&t.symbol.declarations&&1===t.symbol.declarations.length){for(var n=t.symbol.declarations[0].parent,i=r;i!==n;i=i.parent)if(!i||235===i.kind||189===i.kind&&e.forEachChild(i.extendsType,a))return !0;return a(r)}return !0;function a(r){switch(r.kind){case 192:return !!t.isThisType;case 79:return !t.isThisType&&e.isPartOfTypeNode(r)&&function(e){return !(178===e.parent.kind&&e.parent.typeArguments&&e===e.parent.typeName||200===e.parent.kind&&e.parent.typeArguments&&e===e.parent.qualifier)}(r)&&Ed(r)===t;case 181:return !0;case 169:case 168:return !r.type&&!!r.body||e.some(r.typeParameters,a)||e.some(r.parameters,a)||!!r.type&&a(r.type)}return !!e.forEachChild(r,a)}}function qd(e){var t=fc(e);if(4194304&t.flags){var r=H_(t.type);if(262144&r.flags)return r}}function Wd(t,r,n,i){var a=qd(t);if(a){var o=Yd(a,r);if(a!==o)return Am(Hc(o),(function(n){if(61603843&n.flags&&n!==Be&&!po(n)){if(!t.declaration.nameType){var i=void 0;if(cf(n)||1&n.flags&&oo(a,4)<0&&(i=Ac(a))&&Cm(i,uf))return function(e,t,r){var n=Gd(t,Ze,!0,r);return po(n)?je:Bu(n,Hd(lf(e),bc(t)))}(n,t,jd(a,n,r));if(Ff(n))return function(t,r,n,i){var a=t.target.elementFlags,o=e.map(eu(t),(function(e,t){var o=8&a[t]?e:4&a[t]?Bu(e):Vu([e],[a[t]]);return Wd(r,jd(n,o,i))})),s=Hd(t.target.readonly,bc(r));return Vu(o,e.map(o,(function(e){return 8})),s)}(n,t,a,r);if(Nf(n))return function(t,r,n){var i=t.target.elementFlags,a=e.map(eu(t),(function(e,t){return Gd(r,vd(""+t),!!(2&i[t]),n)})),o=bc(r),s=4&o?e.map(i,(function(e){return 1&e?2:e})):8&o?e.map(i,(function(e){return 2&e?1:e})):i,c=Hd(t.target.readonly,o);return e.contains(a,je)?je:Vu(a,s,c,t.target.labeledElementDeclarations)}(n,t,jd(a,n,r))}return Qd(t,jd(a,n,r))}return n}),n,i)}return Yd(fc(t),r)===Be?Be:Qd(t,r,n,i)}function Hd(e,t){return !!(1&t)||!(2&t)&&e}function Gd(e,t,r,n){var i=Jd(n,pc(e),t),a=Yd(mc(e.target||e),i),o=bc(e);return Q&&4&o&&!Hb(a,49152)?jf(a,!0):Q&&8&o&&r?om(a,524288):a}function Qd(e,t,r,n){var i=xa(64|e.objectFlags,e.symbol);if(32&e.objectFlags){i.declaration=e.declaration;var a=pc(e),o=zd(a);i.typeParameter=o,t=Bd(Od(a,o),t),o.mapper=t;}return 8388608&e.objectFlags&&(i.node=e.node),i.target=e,i.mapper=t,i.aliasSymbol=r||e.aliasSymbol,i.aliasTypeArguments=r?n:Fd(e.aliasTypeArguments,t),i}function Xd(t,r,n,i){var a=t.root;if(a.outerTypeParameters){var o=e.map(a.outerTypeParameters,(function(e){return Id(e,r)})),s=Gl(o)+Ql(n,i),c=a.instantiations.get(s);if(!c){var l=wd(a.outerTypeParameters,o),u=a.checkType,_=a.isDistributive?Id(u,l):void 0;c=_&&u!==_&&1179648&_.flags?Am(Hc(_),(function(e){return Z_(a,jd(u,e,l))}),n,i):Z_(a,l,n,i),a.instantiations.set(s,c);}return c}return t}function Yd(e,t){return e&&t?Zd(e,t,void 0,void 0):e}function Zd(t,r,n,i){if(!vg(t))return t;if(100===E||k>=5e6)return null===e.tracing||void 0===e.tracing||e.tracing.instant("checkTypes","instantiateType_DepthLimit",{typeId:t.id,instantiationDepth:E,instantiationCount:k}),Jn(u,e.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite),je;C++,k++,E++;var a=function(t,r,n,i){var a=t.flags;if(262144&a)return Id(t,r);if(524288&a){var o=t.objectFlags;if(52&o){if(4&o&&!t.node){var s=t.resolvedTypeArguments,c=Fd(s,r);return c!==s?Wu(t.target,c):t}return 1024&o?function(t,r){var n=Yd(t.mappedType,r);if(!(32&e.getObjectFlags(n)))return t;var i=Yd(t.constraintType,r);if(!(4194304&i.flags))return t;var a=xg(Yd(t.source,r),n,i);return a||t}(t,r):function(t,r,n,i){var a=4&t.objectFlags||8388608&t.objectFlags?t.node:t.symbol.declarations[0],o=ni(a),s=4&t.objectFlags?o.resolvedType:64&t.objectFlags?t.target:t,c=o.outerTypeParameters;if(!c){var l=as(a,!0);if(Gh(a)){var u=_l(a);l=e.addRange(l,u);}c=l||e.emptyArray;var _=8388612&t.objectFlags?[a]:t.symbol.declarations;c=(8388612&s.objectFlags||8192&s.symbol.flags||2048&s.symbol.flags)&&!s.aliasTypeArguments?e.filter(c,(function(t){return e.some(_,(function(e){return Vd(t,e)}))})):c,o.outerTypeParameters=c;}if(c.length){var d=Bd(t.mapper,r),p=e.map(c,(function(e){return Id(e,d)})),f=n||t.aliasSymbol,g=n?i:Fd(t.aliasTypeArguments,r),m=Gl(p)+Ql(f,g);s.instantiations||(s.instantiations=new e.Map,s.instantiations.set(Gl(c)+Ql(s.aliasSymbol,s.aliasTypeArguments),s));var y=s.instantiations.get(m);if(!y){var v=wd(c,p);y=4&s.objectFlags?$l(t.target,t.node,v,f,g):32&s.objectFlags?Wd(s,v,f,g):Qd(s,v,f,g),s.instantiations.set(m,y);}return y}return t}(t,r,n,i)}return t}if(3145728&a){var l=1048576&t.flags?t.origin:void 0,u=l&&3145728&l.flags?l.types:t.types,_=Fd(u,r);if(_===u&&n===t.aliasSymbol)return t;var d=n||t.aliasSymbol,p=n?i:Fd(t.aliasTypeArguments,r);return 2097152&a||l&&2097152&l.flags?p_(_,d,p):a_(_,1,d,p)}if(4194304&a)return D_(Yd(t.type,r));if(134217728&a)return T_(t.texts,Fd(t.types,r));if(268435456&a)return k_(t.symbol,Yd(t.type,r));if(8388608&a)return d=n||t.aliasSymbol,p=n?i:Fd(t.aliasTypeArguments,r),K_(Yd(t.objectType,r),Yd(t.indexType,r),t.accessFlags,void 0,d,p);if(16777216&a)return Xd(t,Bd(t.mapper,r),n,i);if(33554432&a){var f=Yd(t.baseType,r);if(8650752&f.flags)return lu(f,Yd(t.substitute,r));var g=Yd(t.substitute,r);return 3&g.flags||_p(ep(f),ep(g))?f:g}return t}(t,r,n,i);return E--,a}function $d(e){return 262143&e.flags?e:e.permissiveInstantiation||(e.permissiveInstantiation=Yd(e,bt))}function ep(e){return 262143&e.flags?e:(e.restrictiveInstantiation||(e.restrictiveInstantiation=Yd(e,ht),e.restrictiveInstantiation.restrictiveInstantiation=e.restrictiveInstantiation),e.restrictiveInstantiation)}function tp(e,t){return Jl(e.keyType,Yd(e.type,t),e.isReadonly,e.declaration)}function rp(t){switch(e.Debug.assert(169!==t.kind||e.isObjectLiteralMethod(t)),t.kind){case 213:case 214:case 169:case 256:return np(t);case 205:return e.some(t.properties,rp);case 204:return e.some(t.elements,rp);case 222:return rp(t.whenTrue)||rp(t.whenFalse);case 221:return (56===t.operatorToken.kind||60===t.operatorToken.kind)&&(rp(t.left)||rp(t.right));case 296:return rp(t.initializer);case 212:return rp(t.expression);case 286:return e.some(t.properties,rp)||e.isJsxOpeningElement(t.parent)&&e.some(t.parent.parent.children,rp);case 285:var r=t.initializer;return !!r&&rp(r);case 288:var n=t.expression;return !!n&&rp(n)}return !1}function np(t){return (!e.isFunctionDeclaration(t)||e.isInJSFile(t)&&!!So(t))&&(e.hasContextSensitiveParameters(t)||function(t){return !t.typeParameters&&!e.getEffectiveReturnTypeNode(t)&&!!t.body&&235!==t.body.kind&&rp(t.body)}(t))}function ip(t){return (e.isInJSFile(t)&&e.isFunctionDeclaration(t)||e.isFunctionExpressionOrArrowFunction(t)||e.isObjectLiteralMethod(t))&&np(t)}function ap(t){if(524288&t.flags){var r=Tc(t);if(r.constructSignatures.length||r.callSignatures.length){var n=xa(16,t.symbol);return n.members=r.members,n.properties=r.properties,n.callSignatures=e.emptyArray,n.constructSignatures=e.emptyArray,n.indexInfos=e.emptyArray,n}}else if(2097152&t.flags)return p_(e.map(t.types,ap));return t}function op(e,t){return Ip(e,t,Pn)}function sp(e,t){return Ip(e,t,Pn)?-1:0}function cp(e,t){return Ip(e,t,Fn)?-1:0}function lp(e,t){return Ip(e,t,En)?-1:0}function up(e,t){return Ip(e,t,En)}function _p(e,t){return Ip(e,t,Fn)}function dp(t,r){return 1048576&t.flags?e.every(t.types,(function(e){return dp(e,r)})):1048576&r.flags?e.some(r.types,(function(e){return dp(t,e)})):58982400&t.flags?dp(Mc(t)||Ue,r):r===Bt?!!(67633152&t.flags):r===jt?!!(524288&t.flags)&&im(t):ns(t,rs(r))||cf(r)&&!lf(r)&&dp(t,Ut)}function pp(e,t){return Ip(e,t,An)}function fp(e,t){return pp(e,t)||pp(t,e)}function gp(e,t,r,n,i,a){return Lp(e,t,Fn,r,n,i,a)}function mp(e,t,r,n,i,a){return yp(e,t,Fn,r,n,i,a,void 0)}function yp(e,t,r,n,i,a,o,s){return !!Ip(e,t,r)||(!n||!hp(i,e,t,r,a,o,s))&&Lp(e,t,r,n,a,o,s)}function vp(t){return !!(16777216&t.flags||2097152&t.flags&&e.some(t.types,vp))}function hp(t,r,n,a,s,c,l){if(!t||vp(n))return !1;if(!Lp(r,n,a,void 0)&&function(t,r,n,i,a,o,s){for(var c=el(r,0),l=el(r,1),u=0,_=[l,c];u<_.length;u++){var d=_[u];if(e.some(d,(function(e){var t=Nl(e);return !(131073&t.flags)&&Lp(t,n,i,void 0)}))){var p=s||{};gp(r,n,t,a,o,p);var f=p.errors[p.errors.length-1];return e.addRelatedInfo(f,e.createDiagnosticForNode(t,d===l?e.Diagnostics.Did_you_mean_to_use_new_with_this_expression:e.Diagnostics.Did_you_mean_to_call_this_expression)),!0}}return !1}(t,r,n,a,s,c,l))return !0;switch(t.kind){case 288:case 212:return hp(t.expression,r,n,a,s,c,l);case 221:switch(t.operatorToken.kind){case 63:case 27:return hp(t.right,r,n,a,s,c,l)}break;case 205:return function(t,r,n,i,a,s){return !(131068&n.flags)&&Dp(function(t){var r,n,i,a;return o(this,(function(o){switch(o.label){case 0:if(!e.length(t.properties))return [2];r=0,n=t.properties,o.label=1;case 1:if(!(r<n.length))return [3,8];if(i=n[r],e.isSpreadAssignment(i))return [3,7];if(!(a=h_(la(i),8576))||131072&a.flags)return [3,7];switch(i.kind){case 173:case 172:case 169:case 297:return [3,2];case 296:return [3,4]}return [3,6];case 2:return [4,{errorNode:i.name,innerExpression:void 0,nameType:a}];case 3:return o.sent(),[3,7];case 4:return [4,{errorNode:i.name,innerExpression:i.initializer,nameType:a,errorMessage:e.isComputedNonLiteralName(i.name)?e.Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1:void 0}];case 5:return o.sent(),[3,7];case 6:e.Debug.assertNever(i),o.label=7;case 7:return r++,[3,1];case 8:return [2]}}))}(t),r,n,i,a,s)}(t,r,n,a,c,l);case 204:return function(e,t,r,n,i,a){if(131068&r.flags)return !1;if(yf(t))return Dp(Tp(e,r),t,r,n,i,a);var o=e.contextualType;e.contextualType=r;try{var s=Vy(e,1,!0);return e.contextualType=o,!!yf(s)&&Dp(Tp(e,r),s,r,n,i,a)}finally{e.contextualType=o;}}(t,r,n,a,c,l);case 286:return function(t,r,n,a,s,c){var l,u=Dp(function(t){var r,n,i;return o(this,(function(a){switch(a.label){case 0:if(!e.length(t.properties))return [2];r=0,n=t.properties,a.label=1;case 1:return r<n.length?(i=n[r],e.isJsxSpreadAttribute(i)||Zy(e.idText(i.name))?[3,3]:[4,{errorNode:i.name,innerExpression:i.initializer,nameType:vd(e.idText(i.name))}]):[3,4];case 2:a.sent(),a.label=3;case 3:return r++,[3,1];case 4:return [2]}}))}(t),r,n,a,s,c);if(e.isJsxOpeningElement(t.parent)&&e.isJsxElement(t.parent.parent)){var _=t.parent.parent,d=cv(ov(t)),p=void 0===d?"children":e.unescapeLeadingUnderscores(d),f=vd(p),g=K_(n,f),m=e.getSemanticJsxChildren(_.children);if(!e.length(m))return u;var y=e.length(m)>1,v=km(g,vf),h=km(g,(function(e){return !vf(e)}));if(y){if(v!==st){var b=Vu(tv(_,0));u=Dp(function(t,r){var n,i,a,s,c;return o(this,(function(o){switch(o.label){case 0:if(!e.length(t.children))return [2];n=0,i=0,o.label=1;case 1:return i<t.children.length?(a=t.children[i],s=hd(i-n),(c=Sp(a,s,r))?[4,c]:[3,3]):[3,5];case 2:return o.sent(),[3,4];case 3:n++,o.label=4;case 4:return i++,[3,1];case 5:return [2]}}))}(_,S),b,v,a,s,c)||u;}else if(!Ip(K_(r,f),g,a)){u=!0;var x=Jn(_.openingElement.tagName,e.Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided,p,qa(g));c&&c.skipLogging&&(c.errors||(c.errors=[])).push(x);}}else if(h!==st){var D=Sp(m[0],f,S);D&&(u=Dp(function(){return o(this,(function(e){switch(e.label){case 0:return [4,D];case 1:return e.sent(),[2]}}))}(),r,n,a,s,c)||u);}else Ip(K_(r,f),g,a)||(u=!0,x=Jn(_.openingElement.tagName,e.Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided,p,qa(g)),c&&c.skipLogging&&(c.errors||(c.errors=[])).push(x));}return u;function S(){if(!l){var r=e.getTextOfNode(t.parent.tagName),a=cv(ov(t)),o=void 0===a?"children":e.unescapeLeadingUnderscores(a),s=K_(n,vd(o)),c=e.Diagnostics._0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2;l=i$1(i$1({},c),{key:"!!ALREADY FORMATTED!!",message:e.formatMessage(void 0,c,r,o,qa(s))});}return l}}(t,r,n,a,c,l);case 214:return function(t,r,n,i,a,o){if(e.isBlock(t.body))return !1;if(e.some(t.parameters,e.hasType))return !1;var s=fh(r);if(!s)return !1;var c=el(n,0);if(!e.length(c))return !1;var l=t.body,u=Nl(s),_=a_(e.map(c,Nl));if(!Lp(u,_,i,void 0)){var d=l&&hp(l,u,_,i,void 0,a,o);if(d)return d;var p=o||{};if(Lp(u,_,i,l,void 0,a,p),p.errors)return n.symbol&&e.length(n.symbol.declarations)&&e.addRelatedInfo(p.errors[p.errors.length-1],e.createDiagnosticForNode(n.symbol.declarations[0],e.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature)),0==(2&e.getFunctionFlags(t))&&!uo(u,"then")&&Lp(Nb(u),_,i,void 0)&&e.addRelatedInfo(p.errors[p.errors.length-1],e.createDiagnosticForNode(t,e.Diagnostics.Did_you_mean_to_mark_this_function_as_async)),!0}return !1}(t,r,n,a,c,l)}return !1}function bp(e,t,r){var n=V_(t,r);if(n)return n;if(1048576&t.flags){var i=Jp(e,t);if(i)return V_(i,r)}}function xp(e,t){e.contextualType=t;try{return fx(e,1,t)}finally{e.contextualType=void 0;}}function Dp(t,r,n,i,a,o){for(var s=!1,c=t.next();!c.done;c=t.next()){var l=c.value,u=l.errorNode,_=l.innerExpression,d=l.nameType,p=l.errorMessage,f=bp(r,n,d);if(f&&!(8388608&f.flags)){var g=V_(r,d);if(g){var m=N_(d,void 0);if(!Lp(g,f,i,void 0)&&(s=!0,!_||!hp(_,g,f,i,void 0,a,o))){var y=o||{},v=_?xp(_,g):g;if(ie&&jp(v,f)){var h=e.createDiagnosticForNode(u,e.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target,qa(v),qa(f));Sn.add(h),y.errors=[h];}else {var b=!!(m&&16777216&(Zc(n,m)||we).flags),x=!!(m&&16777216&(Zc(r,m)||we).flags);f=qf(f,b),g=qf(g,b&&x),Lp(v,f,i,u,p,a,y)&&v!==g&&Lp(g,f,i,u,p,a,y);}if(y.errors){var D=y.errors[y.errors.length-1],S=Rs(d)?Ks(d):void 0,T=void 0!==S?Zc(n,S):void 0,C=!1;if(!T){var k=ll(n,d);k&&k.declaration&&!e.getSourceFileOfNode(k.declaration).hasNoDefaultLib&&(C=!0,e.addRelatedInfo(D,e.createDiagnosticForNode(k.declaration,e.Diagnostics.The_expected_type_comes_from_this_index_signature)));}if(!C&&(T&&e.length(T.declarations)||n.symbol&&e.length(n.symbol.declarations))){var E=T&&e.length(T.declarations)?T.declarations[0]:n.symbol.declarations[0];e.getSourceFileOfNode(E).hasNoDefaultLib||e.addRelatedInfo(D,e.createDiagnosticForNode(E,e.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1,!S||8192&d.flags?qa(d):e.unescapeLeadingUnderscores(S),qa(n)));}}}}}}return s}function Sp(t,r,n){switch(t.kind){case 288:return {errorNode:t,innerExpression:t.expression,nameType:r};case 11:if(t.containsOnlyTriviaWhiteSpaces)break;return {errorNode:t,innerExpression:void 0,nameType:r,errorMessage:n()};case 278:case 279:case 282:return {errorNode:t,innerExpression:t,nameType:r};default:return e.Debug.assertNever(t,"Found invalid jsx child")}}function Tp(t,r){var n,i,a,s;return o(this,(function(o){switch(o.label){case 0:if(!(n=e.length(t.elements)))return [2];i=0,o.label=1;case 1:return i<n?yf(r)&&!Zc(r,""+i)?[3,3]:(a=t.elements[i],e.isOmittedExpression(a)?[3,3]:(s=hd(i),[4,{errorNode:a,innerExpression:a,nameType:s}])):[3,4];case 2:o.sent(),o.label=3;case 3:return i++,[3,1];case 4:return [2]}}))}function Cp(e,t,r,n,i){return Lp(e,t,An,r,n,i)}function kp(t,r,n,i,a,o,s,c){if(t===r)return -1;if(!(l=r).typeParameters&&(!l.thisParameter||_o(lb(l.thisParameter)))&&1===l.parameters.length&&J(l)&&(lb(l.parameters[0])===Qt||_o(lb(l.parameters[0])))&&_o(Nl(l)))return -1;var l,u,_=vb(r);if(!bb(r)&&(8&n?bb(t)||vb(t)>_:hb(t)>_))return 0;t.typeParameters&&t.typeParameters!==r.typeParameters&&(t=yh(t,r=(u=r).typeParameters?u.canonicalSignatureCache||(u.canonicalSignatureCache=function(t){return wl(t,e.map(t.typeParameters,(function(e){return e.target&&!Ac(e.target)?e.target:e})),e.isInJSFile(t.declaration))}(u)):u,void 0,s));var d=vb(t),p=Db(t),f=Db(r);(p||f)&&Yd(p||f,c);var g=r.declaration?r.declaration.kind:0,m=!(3&n)&&X&&169!==g&&168!==g&&171!==g,y=-1,v=Cl(t);if(v&&v!==ot){var h=Cl(r);if(h){if(!(C=!m&&s(v,h,!1)||s(h,v,i)))return i&&a(e.Diagnostics.The_this_types_of_each_signature_are_incompatible),0;y&=C;}}for(var b=p||f?Math.min(d,_):Math.max(d,_),x=p||f?b-1:-1,D=0;D<b;D++){var S=D===x?yb(t,D):mb(t,D),T=D===x?yb(r,D):mb(r,D);if(S&&T){var C,k=3&n?void 0:fh(Jf(S)),E=3&n?void 0:fh(Jf(T));if((C=k&&E&&!kl(k)&&!kl(E)&&(98304&Mf(S))==(98304&Mf(T))?kp(E,k,8&n|(m?2:1),i,a,o,s,c):!(3&n)&&!m&&s(S,T,!1)||s(T,S,i))&&8&n&&D>=hb(t)&&D<hb(r)&&s(S,T,!1)&&(C=0),!C)return i&&a(e.Diagnostics.Types_of_parameters_0_and_1_are_incompatible,e.unescapeLeadingUnderscores(_b(t,D)),e.unescapeLeadingUnderscores(_b(r,D))),0;y&=C;}}if(!(4&n)){var N=Al(r)?Le:r.declaration&&Gh(r.declaration)?vs(ca(r.declaration.symbol)):Nl(r);if(N===ot||N===Le)return y;var F=Al(t)?Le:t.declaration&&Gh(t.declaration)?vs(ca(t.declaration.symbol)):Nl(t),A=kl(r);if(A){var P=kl(t);if(P)y&=function(t,r,n,i,a){if(t.kind!==r.kind)return n&&(i(e.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard),i(e.Diagnostics.Type_predicate_0_is_not_assignable_to_1,Ya(t),Ya(r))),0;if((1===t.kind||3===t.kind)&&t.parameterIndex!==r.parameterIndex)return n&&(i(e.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1,t.parameterName,r.parameterName),i(e.Diagnostics.Type_predicate_0_is_not_assignable_to_1,Ya(t),Ya(r))),0;var o=t.type===r.type?-1:t.type&&r.type?a(t.type,r.type,n):0;return 0===o&&n&&i(e.Diagnostics.Type_predicate_0_is_not_assignable_to_1,Ya(t),Ya(r)),o}(P,A,i,a,s);else if(e.isIdentifierTypePredicate(A))return i&&a(e.Diagnostics.Signature_0_must_be_a_type_predicate,Va(t)),0}else !(y&=1&n&&s(N,F,!1)||s(F,N,i))&&i&&o&&o(F,N);}return y}function Ep(e){return e!==Nt&&0===e.properties.length&&0===e.callSignatures.length&&0===e.constructSignatures.length&&0===e.indexInfos.length}function Np(t){return 524288&t.flags?!Sc(t)&&Ep(Tc(t)):!!(67108864&t.flags)||(1048576&t.flags?e.some(t.types,Np):!!(2097152&t.flags)&&e.every(t.types,Np))}function Fp(t){return !!(16&e.getObjectFlags(t)&&(t.members&&Ep(t)||t.symbol&&2048&t.symbol.flags&&0===qs(t.symbol).size))}function Ap(t){return 524288&t.flags&&!Sc(t)&&0===Nc(t).length&&1===al(t).length&&!!ol(t,Ye)||3145728&t.flags&&e.every(t.types,Ap)||!1}function Pp(t,r,n){if(t===r)return !0;var i=M(t)+","+M(r),a=wn.get(i);if(void 0!==a&&(4&a||!(2&a)||!n))return !!(1&a);if(!(t.escapedName===r.escapedName&&256&t.flags&&256&r.flags))return wn.set(i,6),!1;for(var o=$o(r),s=0,c=Nc($o(t));s<c.length;s++){var l=c[s];if(8&l.flags){var u=Zc(o,l.escapedName);if(!(u&&8&u.flags))return n?(n(e.Diagnostics.Property_0_is_missing_in_type_1,e.symbolName(l),qa(Es(r),void 0,64)),wn.set(i,6)):wn.set(i,2),!1}}return wn.set(i,1),!0}function wp(e,t,r,n){var i=e.flags,a=t.flags;if(3&a||131072&i||e===Be)return !0;if(131072&a)return !1;if(402653316&i&&4&a)return !0;if(128&i&&1024&i&&128&a&&!(1024&a)&&e.value===t.value)return !0;if(296&i&&8&a)return !0;if(256&i&&1024&i&&256&a&&!(1024&a)&&e.value===t.value)return !0;if(2112&i&&64&a)return !0;if(528&i&&16&a)return !0;if(12288&i&&4096&a)return !0;if(32&i&&32&a&&Pp(e.symbol,t.symbol,n))return !0;if(1024&i&&1024&a){if(1048576&i&&1048576&a&&Pp(e.symbol,t.symbol,n))return !0;if(2944&i&&2944&a&&e.value===t.value&&Pp(ua(e.symbol),ua(t.symbol),n))return !0}if(32768&i&&(!Q&&!(3145728&a)||49152&a))return !0;if(65536&i&&(!Q&&!(3145728&a)||65536&a))return !0;if(524288&i&&67108864&a)return !0;if(r===Fn||r===An){if(1&i)return !0;if(264&i&&!(1024&i)&&(32&a||r===Fn&&256&a&&1024&a))return !0}return !1}function Ip(e,t,r){if(yd(e)&&(e=e.regularType),yd(t)&&(t=t.regularType),e===t)return !0;if(r!==Pn){if(r===An&&!(131072&t.flags)&&wp(t,e,r)||wp(e,t,r))return !0}else if(!(61865984&(e.flags|t.flags))){if(e.flags!==t.flags)return !1;if(67358815&e.flags)return !0}if(524288&e.flags&&524288&t.flags){var n=r.get(Yp(e,t,0,r,!1));if(void 0!==n)return !!(1&n)}return !!(469499904&e.flags||469499904&t.flags)&&Lp(e,t,r,void 0)}function Op(t,r){return 2048&e.getObjectFlags(t)&&Zy(r.escapedName)}function Mp(t,r){for(;;){var n=yd(t)?t.regularType:4&e.getObjectFlags(t)&&t.node?Yl(t.target,eu(t)):3145728&t.flags?Hc(t):33554432&t.flags?r?t.baseType:t.substitute:25165824&t.flags?B_(t,r):t;if((n=ff(n)||n)===t)break;t=n;}return t}function Lp(t,r,i,a,o,s,c){var _,d,p,f,g,m,y,v=0,h=0,b=0,x=0,D=!1,S=0,T=!1;e.Debug.assert(i!==Pn||!a,"no error reporting in identity checking");var C=J(t,r,3,!!a,o);if(y&&M(),D){null===e.tracing||void 0===e.tracing||e.tracing.instant("checkTypes","checkTypeRelatedTo_DepthLimit",{sourceId:t.id,targetId:r.id,depth:h,targetDepth:b});var k=Jn(a||u,e.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1,qa(t),qa(r));c&&(c.errors||(c.errors=[])).push(k);}else if(_){if(s){var E=s();E&&(e.concatenateDiagnosticMessageChains(E,_),_=E);}var N=void 0;if(o&&a&&!C&&t.symbol){var F=ri(t.symbol);if(F.originatingImport&&!e.isImportCall(F.originatingImport)&&Lp($o(F.target),r,i,void 0)){var P=e.createDiagnosticForNode(F.originatingImport,e.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead);N=e.append(N,P);}}k=e.createDiagnosticForNodeFromMessageChain(a,_,N),d&&e.addRelatedInfo.apply(void 0,n$4([k],d,!1)),c&&(c.errors||(c.errors=[])).push(k),c&&c.skipLogging||Sn.add(k);}return a&&c&&c.skipLogging&&0===C&&e.Debug.assert(!!c.errors,"missed opportunity to interact with error."),0!==C;function w(e){_=e.errorInfo,m=e.lastSkippedInfo,y=e.incompatibleStack,S=e.overrideNextErrorInfo,d=e.relatedInfo;}function I(){return {errorInfo:_,lastSkippedInfo:m,incompatibleStack:null==y?void 0:y.slice(),overrideNextErrorInfo:S,relatedInfo:null==d?void 0:d.slice()}}function O(e,t,r,n,i){S++,m=void 0,(y||(y=[])).push([e,t,r,n,i]);}function M(){var t=y||[];y=void 0;var r=m;if(m=void 0,1===t.length)return L.apply(void 0,t[0]),void(r&&R.apply(void 0,n$4([void 0],r,!1)));for(var i="",a=[];t.length;){var o=t.pop(),s=o[0],c=o.slice(1);switch(s.code){case e.Diagnostics.Types_of_property_0_are_incompatible.code:0===i.indexOf("new ")&&(i="(".concat(i,")"));var l=""+c[0];i=0===i.length?"".concat(l):e.isIdentifierText(l,e.getEmitScriptTarget(V))?"".concat(i,".").concat(l):"["===l[0]&&"]"===l[l.length-1]?"".concat(i).concat(l):"".concat(i,"[").concat(l,"]");break;case e.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible.code:case e.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code:case e.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code:case e.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code:if(0===i.length){var u=s;s.code===e.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code?u=e.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible:s.code===e.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code&&(u=e.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible),a.unshift([u,c[0],c[1]]);}else {var _=s.code===e.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code||s.code===e.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code?"new ":"",d=s.code===e.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code||s.code===e.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code?"":"...";i="".concat(_).concat(i,"(").concat(d,")");}break;case e.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target.code:a.unshift([e.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target,c[0],c[1]]);break;case e.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target.code:a.unshift([e.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target,c[0],c[1],c[2]]);break;default:return e.Debug.fail("Unhandled Diagnostic: ".concat(s.code))}}i?L(")"===i[i.length-1]?e.Diagnostics.The_types_returned_by_0_are_incompatible_between_these_types:e.Diagnostics.The_types_of_0_are_incompatible_between_these_types,i):a.shift();for(var p=0,f=a;p<f.length;p++){var g=f[p],v=(s=g[0],c=g.slice(1),s.elidedInCompatabilityPyramid);s.elidedInCompatabilityPyramid=!1,L.apply(void 0,n$4([s],c,!1)),s.elidedInCompatabilityPyramid=v;}r&&R.apply(void 0,n$4([void 0],r,!1));}function L(t,r,n,i,o){e.Debug.assert(!!a),y&&M(),t.elidedInCompatabilityPyramid||(_=e.chainDiagnosticMessages(_,t,r,n,i,o));}function R(t,r,n){y&&M();var a=Wa(r,n),o=a[0],s=a[1],c=r,l=o;if(Df(r)&&!Rp(n)&&(c=Sf(r),e.Debug.assert(!_p(c,n),"generalized source shouldn't be assignable"),l=Ha(c)),262144&n.flags&&n!==wt&&n!==It){var u=Mc(n),d=void 0;u&&(_p(c,u)||(d=_p(r,u)))?L(e.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2,d?o:l,s,qa(u)):(_=void 0,L(e.Diagnostics._0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1,s,l));}if(t)t===e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1&&ie&&Bp(r,n).length&&(t=e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties);else if(i===An)t=e.Diagnostics.Type_0_is_not_comparable_to_type_1;else if(o===s)t=e.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated;else if(ie&&Bp(r,n).length)t=e.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties;else {if(128&r.flags&&1048576&n.flags){var p=function(t,r){var n=r.types.filter((function(e){return !!(128&e.flags)}));return e.getSpellingSuggestion(t.value,n,(function(e){return e.value}))}(r,n);if(p)return void L(e.Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2,l,s,qa(p))}t=e.Diagnostics.Type_0_is_not_assignable_to_type_1;}L(t,l,s);}function B(t,r,n){return Nf(t)?t.target.readonly&&_f(r)?(n&&L(e.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1,qa(t),qa(r)),!1):uf(r):lf(t)&&_f(r)?(n&&L(e.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1,qa(t),qa(r)),!1):!Nf(r)||cf(t)}function j(e,t,r){return J(e,t,3,r)}function J(t,r,n,o,s,c){if(void 0===n&&(n=3),void 0===o&&(o=!1),void 0===c&&(c=0),524288&t.flags&&131068&r.flags)return wp(t,r,i,o?L:void 0)?-1:(o&&z(t,r,t,r,s),0);var l=Mp(t,!1),u=Mp(r,!0);if(l===u)return -1;if(i===Pn)return l.flags!==u.flags?0:67358815&l.flags?-1:(K(l,u),G(l,u,!1,0,n));if(262144&l.flags&&Fc(l)===u)return -1;if(470302716&l.flags&&1048576&u.flags){var _=u.types,d=2===_.length&&98304&_[0].flags?_[1]:3===_.length&&98304&_[0].flags&&98304&_[1].flags?_[2]:void 0;if(d&&!(98304&d.flags)&&l===(u=Mp(d,!0)))return -1}if(i===An&&!(131072&u.flags)&&wp(u,l,i)||wp(l,u,i,o?L:void 0))return -1;if(469499904&l.flags||469499904&u.flags){var p=!(2&c)&&Lg(l)&&8192&e.getObjectFlags(l);if(p&&function(t,r,n){var o;if(!yv(r)||!$&&4096&e.getObjectFlags(r))return !1;var s=!!(2048&e.getObjectFlags(t));if((i===Fn||i===An)&&(Dm(Bt,r)||!s&&Np(r)))return !1;var c,l=r;1048576&r.flags&&(l=EC(t,r,J)||function(e){if(Hb(e,67108864)){var t=km(e,(function(e){return !(131068&e.flags)}));if(!(131072&t.flags))return t}return e}(r),c=1048576&l.flags?l.types:[l]);for(var u=function(r){if(function(e,t){return e.valueDeclaration&&t.valueDeclaration&&e.valueDeclaration.parent===t.valueDeclaration}(r,t.symbol)&&!Op(t,r)){if(!mv(l,r.escapedName,s)){if(n){var i=km(l,yv);if(!a)return {value:e.Debug.fail()};if(e.isJsxAttributes(a)||e.isJsxOpeningLikeElement(a)||e.isJsxOpeningLikeElement(a.parent)){r.valueDeclaration&&e.isJsxAttribute(r.valueDeclaration)&&e.getSourceFileOfNode(a)===e.getSourceFileOfNode(r.valueDeclaration.name)&&(a=r.valueDeclaration.name);var u=Ua(r),_=Hv(u,i);(p=_?Ua(_):void 0)?L(e.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2,u,qa(i),p):L(e.Diagnostics.Property_0_does_not_exist_on_type_1,u,qa(i));}else {var d=(null===(o=t.symbol)||void 0===o?void 0:o.declarations)&&e.firstOrUndefined(t.symbol.declarations),p=void 0;if(r.valueDeclaration&&e.findAncestor(r.valueDeclaration,(function(e){return e===d}))&&e.getSourceFileOfNode(d)===e.getSourceFileOfNode(a)){var f=r.valueDeclaration;e.Debug.assertNode(f,e.isObjectLiteralElementLike),a=f;var g=f.name;e.isIdentifier(g)&&(p=Gv(g,i));}void 0!==p?L(e.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,Ua(r),qa(i),p):L(e.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,Ua(r),qa(i));}}return {value:!0}}if(c&&!J($o(r),function(t,r){return a_(e.reduceLeft(t,(function(t,n){var i,a=3145728&(n=Kc(n)).flags?Wc(n,r):kc(n,r),o=a&&$o(a)||(null===(i=ul(n,r))||void 0===i?void 0:i.type)||qe;return e.append(t,o)}),void 0)||e.emptyArray)}(c,r.escapedName),3,n))return n&&O(e.Diagnostics.Types_of_property_0_are_incompatible,Ua(r)),{value:!0}}},_=0,d=Nc(t);_<d.length;_++){var p=u(d[_]);if("object"==typeof p)return p.value}return !1}(l,u,o))return o&&R(s,l,r.aliasSymbol?r:u),0;var f=i!==An&&!(2&c)&&2752508&l.flags&&l!==Bt&&2621440&u.flags&&Kp(u)&&(Nc(l).length>0||pT(l)),g=!!(2048&e.getObjectFlags(l));if(f&&!function(e,t,r){for(var n=0,i=Nc(e);n<i.length;n++)if(mv(t,i[n].escapedName,r))return !0;return !1}(l,u,g)){if(o){var m=qa(t.aliasSymbol?t:l),y=qa(r.aliasSymbol?r:u),v=el(l,0),h=el(l,1);v.length>0&&J(Nl(v[0]),u,1,!1)||h.length>0&&J(Nl(h[0]),u,1,!1)?L(e.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it,m,y):L(e.Diagnostics.Type_0_has_no_properties_in_common_with_type_1,m,y);}return 0}K(l,u);var b=1048576&l.flags&&l.types.length<4&&!(1048576&u.flags)||1048576&u.flags&&u.types.length<4&&!(469499904&l.flags)?U(l,u,o,c):G(l,u,o,c,n);if(b&&!T&&(2097152&u.flags&&(p||f)||cd(u)&&!uf(u)&&2097152&l.flags&&3670016&Kc(l).flags&&!e.some(l.types,(function(t){return !!(262144&e.getObjectFlags(t))})))&&(T=!0,b&=G(l,u,o,4,n),T=!1),b)return b}return o&&z(t,r,l,u,s),0}function z(t,r,n,i,o){var s=!!ff(t),c=!!ff(r);n=t.aliasSymbol||s?t:n,i=r.aliasSymbol||c?r:i;var l=S>0;if(l&&S--,524288&n.flags&&524288&i.flags){var u=_;B(n,i,!0),_!==u&&(l=!!_);}if(524288&n.flags&&131068&i.flags)!function(t,r){var n=Ga(t.symbol)?qa(t,t.symbol.valueDeclaration):qa(t),i=Ga(r.symbol)?qa(r,r.symbol.valueDeclaration):qa(r);(Vt===t&&Ye===r||qt===t&&Ze===r||Wt===t&&it===r||Fu()===t&&at===r)&&L(e.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible,i,n);}(n,i);else if(n.symbol&&524288&n.flags&&Bt===n)L(e.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);else if(2048&e.getObjectFlags(n)&&2097152&i.flags){var d=i.types,p=nv(A.IntrinsicAttributes,a),f=nv(A.IntrinsicClassAttributes,a);if(!po(p)&&!po(f)&&(e.contains(d,p)||e.contains(d,f)))return}else _=Yc(_,r);o||!l?R(o,n,i):m=[n,i];}function K(t,r){if(e.tracing&&3145728&t.flags&&3145728&r.flags){var n=t,i=r;if(n.objectFlags&i.objectFlags&32768)return;var o=n.types.length,s=i.types.length;o*s>1e6&&e.tracing.instant("checkTypes","traceUnionsOrIntersectionsTooLarge_DepthLimit",{sourceId:t.id,sourceSize:o,targetId:r.id,targetSize:s,pos:null==a?void 0:a.pos,end:null==a?void 0:a.end});}}function U(t,r,n,a){if(1048576&t.flags)return i===An?H(t,r,n&&!(131068&t.flags),a):function(e,t,r,n){for(var i=-1,a=e.types,o=function(e,t){return 1048576&e.flags&&1048576&t.flags&&!(32768&e.types[0].flags)&&32768&t.types[0].flags?Pm(t,-32769):t}(e,t),s=0;s<a.length;s++){var c=a[s];if(1048576&o.flags&&a.length>=o.types.length&&a.length%o.types.length==0){var l=J(c,o.types[s%o.types.length],3,!1,void 0,n);if(l){i&=l;continue}}var u=J(c,t,1,r,void 0,n);if(!u)return 0;i&=u;}return i}(t,r,n&&!(131068&t.flags),a);if(1048576&r.flags)return W(Xf(t),r,n&&!(131068&t.flags)&&!(131068&r.flags));if(2097152&r.flags)return function(e,t,r,n){for(var i=-1,a=0,o=t.types;a<o.length;a++){var s=J(e,o[a],2,r,void 0,2);if(!s)return 0;i&=s;}return i}(Xf(t),r,n);if(i===An&&131068&r.flags){var o=e.sameMap(t.types,Lc);if(o!==t.types&&!(2097152&(t=p_(o)).flags))return J(t,r,1,!1)}return H(t,r,!1,1)}function q(e,t){for(var r=-1,n=0,i=e.types;n<i.length;n++){var a=W(i[n],t,!1);if(!a)return 0;r&=a;}return r}function W(e,t,r){var n=t.types;if(1048576&t.flags){if($u(n,e))return -1;var i=em(t,e);if(i&&(s=J(e,i,2,!1)))return s}for(var a=0,o=n;a<o.length;a++){var s;if(s=J(e,o[a],2,!1))return s}if(r){var c=Jp(e,t,J);c&&J(e,c,2,!0);}return 0}function H(e,t,r,n){var i=e.types;if(1048576&e.flags&&$u(i,t))return -1;for(var a=i.length,o=0;o<a;o++){var s=J(i[o],t,1,r&&o===a-1,void 0,n);if(s)return s}return 0}function G(t,r,a,o,s){if(D)return 0;var c=o|(T?8:0),l=Yp(t,r,c,i,!1),u=i.get(l);if(void 0!==u&&(!(a&&2&u)||4&u)){if(Ar){var d=24&u;8&d&&Yd(t,Md(X)),16&d&&Yd(t,Md(Y));}return 1&u?-1:0}if(p){for(var m=l.startsWith("*")?Yp(t,r,c,i,!0):void 0,y=0;y<v;y++)if(l===p[y]||m&&m===p[y])return 3;if(100===h||100===b)return D=!0,0}else p=[],f=[],g=[];var S=v;p[v]=l,v++;var C,k=x;1&s&&(f[h]=t,h++,1&x||!rf(t,f,h)||(x|=1)),2&s&&(g[b]=r,b++,2&x||!rf(r,g,b)||(x|=2));var E,N=0;if(Ar&&(C=Ar,Ar=function(e){return N|=e?16:8,C(e)}),3===x?(null===e.tracing||void 0===e.tracing||e.tracing.instant("checkTypes","recursiveTypeRelatedTo_DepthLimit",{sourceId:t.id,sourceIdStack:f.map((function(e){return e.id})),targetId:r.id,targetIdStack:g.map((function(e){return e.id})),depth:h,targetDepth:b}),E=3):(null===e.tracing||void 0===e.tracing||e.tracing.push("checkTypes","structuredTypeRelatedTo",{sourceId:t.id,targetId:r.id}),E=function(t,r,a,o){if(4&o)return te(t,r,a,void 0,0);var s,c,l,u,d=!1,p=I(),m=t.flags,y=r.flags;if(i===Pn){if(3145728&m){var v=q(t,r);return v&&(v&=q(r,t)),v}if(4194304&m)return J(t.type,r.type,3,!1);if(8388608&m&&(s=J(t.objectType,r.objectType,3,!1))&&(s&=J(t.indexType,r.indexType,3,!1)))return s;if(16777216&m&&t.root.isDistributive===r.root.isDistributive&&(s=J(t.checkType,r.checkType,3,!1))&&(s&=J(t.extendsType,r.extendsType,3,!1))&&(s&=J($_(t),$_(r),3,!1))&&(s&=J(ed(t),ed(r),3,!1)))return s;if(33554432&m)return J(t.substitute,r.substitute,3,!1);if(!(524288&m))return 0}else if(3145728&m||3145728&y){if(s=U(t,r,a,o))return s;if((2097152&t.flags||262144&t.flags&&1048576&r.flags)&&(ie=function(t,r){for(var n,i=!1,a=0,o=t;a<o.length;a++)if(465829888&(u=o[a]).flags){for(var s=Fc(u);s&&21233664&s.flags;)s=Fc(s);s&&(n=e.append(n,s),r&&(n=e.append(n,u)));}else 469892092&u.flags&&(i=!0);if(n&&(r||i)){if(i)for(var c=0,l=t;c<l.length;c++){var u;469892092&(u=l[c]).flags&&(n=e.append(n,u));}return p_(n)}}(2097152&t.flags?t.types:[t],!!(1048576&r.flags)))&&Cm(ie,(function(e){return e!==t}))&&(s=J(ie,r,1,!1,void 0,o)))return w(p),s;if(!(465829888&m||524288&m&&1048576&y||2097152&m&&467402752&y))return 0}if(17301504&m&&t.aliasSymbol&&t.aliasTypeArguments&&t.aliasSymbol===r.aliasSymbol&&!Hp(t)&&!Hp(r)){if((pe=Vp(t.aliasSymbol))===e.emptyArray)return 1;if(void 0!==(fe=he(t.aliasTypeArguments,r.aliasTypeArguments,pe,o)))return fe}if(Af(t)&&!t.target.readonly&&(s=J(eu(t)[0],r,1))||Af(r)&&(r.target.readonly||_f(Mc(t)||t))&&(s=J(t,eu(r)[0],2)))return s;if(262144&y){if(32&e.getObjectFlags(t)&&!t.declaration.nameType&&J(D_(r),fc(t),3)&&!(4&bc(t))){var x=mc(t),D=K_(r,pc(t));if(s=J(x,D,3,a))return s}}else if(4194304&y){var S=r.type;if(4194304&m&&(s=J(S,t.type,3,!1)))return s;if(Nf(S)){if(s=J(t,Qu(S),2,a))return s}else if(ie=Pc(S)){if(-1===J(t,D_(ie,r.stringsOnly),2,a))return -1}else if(Sc(S)){var T=gc(S),C=fc(S),k=void 0;if(T&&vc(S)){var E=Kc(hc(S)),N=[];dc(E,8576,!1,(function(e){N.push(Yd(T,Jd(S.mapper,pc(S),e)));})),k=a_(n$4(n$4([],N,!0),[T],!1));}else k=T||C;if(-1===J(t,k,2,a))return -1}}else if(8388608&y){if(8388608&m){if((s=J(t.objectType,r.objectType,3,a))&&(s&=J(t.indexType,r.indexType,3,a)),s)return w(p),s;a&&(c=_);}if(i===Fn||i===An){var F=r.objectType,A=r.indexType,P=Mc(F)||F,O=Mc(A)||A;if(!M_(P)&&!L_(O)&&(ie=V_(P,O,4|(P!==F?2:0)))){if(a&&c&&w(p),s=J(t,ie,2,a))return s;a&&c&&_&&(_=ve([c])<=ve([_])?c:_);}}a&&(c=void 0);}else if(Sc(r)&&i!==Pn){var M=!!r.declaration.nameType,L=(x=mc(r),bc(r));if(!(8&L)){if(!M&&8388608&x.flags&&x.objectType===t&&x.indexType===pc(r))return -1;if(!Sc(t)){k=M?gc(r):fc(r);var R=D_(t,void 0,!0),B=4&L,z=B?ac(k,R):void 0;if(B?!(131072&z.flags):J(k,R,3)){var K=mc(r),V=pc(r),W=Pm(K,-98305);if(!M&&8388608&W.flags&&W.indexType===V){if(s=J(t,W.objectType,2,a))return s}else {var H=M?z||k:z?p_([z,V]):V;if(D=K_(t,H),s=J(D,K,3,a))return s}}c=_,w(p);}}}else if(16777216&y){if(rf(r,g,b,10))return w(p),3;var G=r;if(!(G.root.inferTypeParameters||(l=G.root).isDistributive&&(Vd(l.checkType,l.node.trueType)||Vd(l.checkType,l.node.falseType)))){var Z=!_p($d(G.checkType),$d(G.extendsType)),$=!Z&&_p(ep(G.checkType),ep(G.extendsType));if((s=Z?-1:J(t,$_(G),2,!1))&&(s&=$?-1:J(t,ed(G),2,!1)))return w(p),s}}else if(134217728&y){if(134217728&m){if(i===An)return function(e,t){var r=e.texts[0],n=t.texts[0],i=e.texts[e.texts.length-1],a=t.texts[t.texts.length-1],o=Math.min(r.length,n.length),s=Math.min(i.length,a.length);return r.slice(0,o)!==n.slice(0,o)||i.slice(i.length-s)!==a.slice(a.length-s)}(t,r)?0:-1;Yd(t,Md(Y));}if(Ag(t,r))return -1}if(8650752&m){if(!(8388608&m&&8388608&y)){if(!(ie=Fc(t))||262144&m&&1&ie.flags){if(s=J(St,Pm(r,-67108865),3))return w(p),s}else {if(s=J(ie,r,1,!1,void 0,o))return w(p),s;if(s=J(Hs(ie,t),r,1,a&&!(y&m&262144),void 0,o))return w(p),s}if(zc(t)){var ne=Fc(t.indexType);if(ne&&(s=J(K_(t.objectType,ne),r,1,a)))return w(p),s}}}else if(4194304&m){if(s=J(gt,r,1,a))return w(p),s}else if(134217728&m&&!(524288&y)){if(!(134217728&y)&&(ie=Mc(t))&&ie!==t&&(s=J(ie,r,1,a)))return w(p),s}else if(268435456&m){var ie;if(268435456&y&&t.symbol===r.symbol){if(s=J(t.type,r.type,3,a))return w(p),s}else if((ie=Mc(t))&&(s=J(ie,r,1,a)))return w(p),s}else if(16777216&m){if(rf(t,f,h,10))return w(p),3;if(16777216&y){var ae=t.root.inferTypeParameters,oe=t.extendsType,se=void 0;if(ae){var le=lg(ae,void 0,0,j);Ig(le.inferences,r.extendsType,oe,1536),oe=Yd(oe,le.mapper),se=le.mapper;}if(op(oe,r.extendsType)&&(J(t.checkType,r.checkType,3)||J(r.checkType,t.checkType,3))&&((s=J(Yd($_(t),se),$_(r),3,a))&&(s&=J(ed(t),ed(r),3,a)),s))return w(p),s}else {var ue=Rc(t)?Ic(t):void 0;if(ue&&(s=J(ue,r,1,a)))return w(p),s}var _e=wc(t);if(_e&&(s=J(_e,r,1,a)))return w(p),s}else {if(i!==En&&i!==Nn&&(u=r,32&e.getObjectFlags(u)&&4&bc(u))&&Np(t))return -1;if(Sc(r))return Sc(t)&&(s=function(e,t,r){var n;if((i===An||(i===Pn?bc(e)===bc(t):Dc(e)<=Dc(t)))&&(n=J(fc(t),Yd(fc(e),Md(Dc(e)<0?X:Y)),3,r))){var a=wd([pc(e)],[pc(t)]);if(Yd(gc(e),a)===Yd(gc(t),a))return n&J(Yd(mc(e),a),mc(t),3,r)}return 0}(t,r,a))?(w(p),s):0;var de=!!(131068&m);if(i!==Pn)m=(t=Kc(t)).flags;else if(Sc(t))return 0;if(4&e.getObjectFlags(t)&&4&e.getObjectFlags(r)&&t.target===r.target&&!Nf(t)&&!Hp(t)&&!Hp(r)){if(mf(t))return -1;var pe,fe;if((pe=Up(t.target))===e.emptyArray)return 1;if(void 0!==(fe=he(eu(t),eu(r),pe,o)))return fe}else {if(lf(r)?uf(t):cf(r)&&Nf(t)&&!t.target.readonly)return i!==Pn?J(sl(t,Ze)||Le,sl(r,Ze)||Le,3,a):0;if((i===En||i===Nn)&&Np(r)&&8192&e.getObjectFlags(r)&&!Np(t))return 0}if(2621440&m&&524288&y){var ge=a&&_===p.errorInfo&&!de;if((s=te(t,r,ge,void 0,o))&&(s&=re(t,r,0,ge))&&(s&=re(t,r,1,ge))&&(s&=ce(t,r,de,ge,o)),d&&s)_=c||_||p.errorInfo;else if(s)return s}if(2621440&m&&1048576&y){var me=Pm(r,36175872);if(1048576&me.flags){var ye=function(t,r){var n=Yg(Nc(t),r);if(!n)return 0;for(var a=1,o=0,s=n;o<s.length;o++)if((a*=Nm(es(_=s[o])))>25)return null===e.tracing||void 0===e.tracing||e.tracing.instant("checkTypes","typeRelatedToDiscriminatedType_DepthLimit",{sourceId:t.id,targetId:r.id,numCombinations:a}),0;for(var c=new Array(n.length),l=new e.Set,u=0;u<n.length;u++){var _,d=es(_=n[u]);c[u]=1048576&d.flags?d.types:[d],l.add(_.escapedName);}for(var p=e.cartesianProduct(c),f=[],g=function(a){var o=!1;e:for(var s=0,c=r.types;s<c.length;s++){for(var l=c[s],u=function(e){var o=n[e],s=Zc(l,o.escapedName);return s?o===s?"continue":ee(t,r,o,s,(function(t){return a[e]}),!1,0,Q||i===An)?void 0:"continue-outer":"continue-outer"},_=0;_<n.length;_++)switch(u(_)){case"continue-outer":continue e}e.pushIfUnique(f,l,e.equateValues),o=!0;}if(!o)return {value:0}},m=0,y=p;m<y.length;m++){var v=g(y[m]);if("object"==typeof v)return v.value}for(var h=-1,b=0,x=f;b<x.length;b++){var D=x[b];if((h&=te(t,D,!1,l,0))&&(h&=re(t,D,0,!1))&&(!(h&=re(t,D,1,!1))||Nf(t)&&Nf(D)||(h&=ce(t,D,!1,!1,0))),!h)return h}return h}(t,me);if(ye)return ye}}}return 0;function ve(t){return t?e.reduceLeft(t,(function(e,t){return e+1+ve(t.next)}),0):0}function he(t,r,n,o){if(s=function(t,r,n,a,o){if(void 0===t&&(t=e.emptyArray),void 0===r&&(r=e.emptyArray),void 0===n&&(n=e.emptyArray),t.length!==r.length&&i===Pn)return 0;for(var s=t.length<=r.length?t.length:r.length,c=-1,l=0;l<s;l++){var u=l<n.length?n[l]:1,_=7&u;if(4!==_){var d=t[l],p=r[l],f=-1;if(8&u?f=i===Pn?J(d,p,3,!1):sp(d,p):1===_?f=J(d,p,3,a,void 0,o):2===_?f=J(p,d,3,a,void 0,o):3===_?(f=J(p,d,3,!1))||(f=J(d,p,3,a,void 0,o)):(f=J(d,p,3,a,void 0,o))&&(f&=J(p,d,3,a,void 0,o)),!f)return 0;c&=f;}}return c}(t,r,n,a,o))return s;if(e.some(n,(function(e){return !!(24&e)})))return c=void 0,void w(p);var l=r&&function(e,t){for(var r=0;r<t.length;r++)if(1==(7&t[r])&&16384&e[r].flags)return !0;return !1}(r,n);if(d=!l,n!==e.emptyArray&&!l){if(d&&(!a||!e.some(n,(function(e){return 0==(7&e)}))))return 0;c=_,w(p);}}}(t,r,a,o),null===e.tracing||void 0===e.tracing||e.tracing.pop()),Ar&&(Ar=C),1&s&&h--,2&s&&b--,x=k,E){if(-1===E||0===h&&0===b){if(-1===E||3===E)for(y=S;y<v;y++)i.set(p[y],1|N);v=S;}}else i.set(l,2|(a?4:0)|N),v=S;return E}function X(e){return !Ar||e!==wt&&e!==It&&e!==Pr||Ar(!1),e}function Y(e){return !Ar||e!==wt&&e!==It&&e!==Pr||Ar(!0),e}function Z(e,t){if(!t||0===e.length)return e;for(var r,n=0;n<e.length;n++)t.has(e[n].escapedName)?r||(r=e.slice(0,n)):r&&r.push(e[n]);return r||e}function ee(t,r,n,a,o,s,c,l){var u=e.getDeclarationModifierFlagsFromSymbol(n),_=e.getDeclarationModifierFlagsFromSymbol(a);if(8&u||8&_){if(n.valueDeclaration!==a.valueDeclaration)return s&&(8&u&&8&_?L(e.Diagnostics.Types_have_separate_declarations_of_a_private_property_0,Ua(a)):L(e.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2,Ua(a),qa(8&u?t:r),qa(8&u?r:t))),0}else if(16&_){if(!function(t,r){return !Zp(r,(function(r){return !!(16&e.getDeclarationModifierFlagsFromSymbol(r))&&(n=t,i=$p(r),!Zp(n,(function(e){var t=$p(e);return !!t&&ns(t,i)})));var n,i;}))}(n,a))return s&&L(e.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2,Ua(a),qa($p(n)||t),qa($p(a)||r)),0}else if(16&u)return s&&L(e.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2,Ua(a),qa(t),qa(r)),0;if(i===Nn&&Kb(n)&&!Kb(a))return 0;var d=function(t,r,n,i,a){var o=Q&&!!(48&e.getCheckFlags(r)),s=Co(es(r),!1,o);return J(n(t),s,3,i,void 0,a)}(n,a,o,s,c);return d?l||!(16777216&n.flags)||16777216&a.flags?d:(s&&L(e.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2,Ua(a),qa(t),qa(r)),0):(s&&O(e.Diagnostics.Types_of_property_0_are_incompatible,Ua(a)),0)}function te(t,r,a,s,c){if(i===Pn)return function(e,t,r){if(!(524288&e.flags&&524288&t.flags))return 0;var n=Z(Cc(e),r),i=Z(Cc(t),r);if(n.length!==i.length)return 0;for(var a=-1,o=0,s=n;o<s.length;o++){var c=s[o],l=kc(t,c.escapedName);if(!l)return 0;var u=af(c,l,J);if(!u)return 0;a&=u;}return a}(t,r,s);var u=-1;if(Nf(r)){if(uf(t)){if(!r.target.readonly&&(lf(t)||Nf(t)&&t.target.readonly))return 0;var p=tu(t),f=tu(r),g=Nf(t)?4&t.target.combinedFlags:4,m=4&r.target.combinedFlags,y=Nf(t)?t.target.minLength:0,v=r.target.minLength;if(!g&&p<v)return a&&L(e.Diagnostics.Source_has_0_element_s_but_target_requires_1,p,v),0;if(!m&&f<y)return a&&L(e.Diagnostics.Source_has_0_element_s_but_target_allows_only_1,y,f),0;if(!m&&(g||f<p))return a&&(y<v?L(e.Diagnostics.Target_requires_0_element_s_but_source_may_have_fewer,v):L(e.Diagnostics.Target_allows_only_0_element_s_but_source_may_have_more,f)),0;for(var h=eu(t),b=eu(r),x=Math.min(Nf(t)?Xu(t.target,11):0,Xu(r.target,11)),D=Math.min(Nf(t)?Yu(t.target,11):0,m?Yu(r.target,11):0),T=!!s,C=0;C<f;C++){var k=C<f-D?C:C+p-f,E=Nf(t)&&(C<x||C>=f-D)?t.target.elementFlags[k]:4,N=r.target.elementFlags[C];if(8&N&&!(8&E))return a&&L(e.Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target,C),0;if(8&E&&!(12&N))return a&&L(e.Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target,k,C),0;if(1&N&&!(1&E))return a&&L(e.Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target,C),0;if(!(T&&((12&E||12&N)&&(T=!1),T&&(null==s?void 0:s.has(""+C))))){var F=Nf(t)?C<x||C>=f-D?qf(h[k],!!(E&N&2)):wf(t,x,D)||st:h[0],A=b[C];if(!(W=J(F,8&E&&4&N?Bu(A):qf(A,!!(2&N)),3,a,void 0,c)))return a&&(f>1||p>1)&&(C<x||C>=f-D||p-x-D==1?O(e.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target,k,C):O(e.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target,x,p-D-1,C)),0;u&=W;}}return u}if(12&r.target.combinedFlags)return 0}var P=!(i!==En&&i!==Nn||Lg(t)||mf(t)||Nf(t)),w=Cg(t,r,P,!1);if(w)return a&&function(e,t){var r=$c(e,0),n=$c(e,1),i=Cc(e);return !((r.length||n.length)&&!i.length)||!!(el(t,0).length&&r.length||el(t,1).length&&n.length)}(t,r)&&function(t,r,i,a){var s=!1;if(i.valueDeclaration&&e.isNamedDeclaration(i.valueDeclaration)&&e.isPrivateIdentifier(i.valueDeclaration.name)&&t.symbol&&32&t.symbol.flags){var c=i.valueDeclaration.name.escapedText,u=e.getSymbolNameForPrivateIdentifier(t.symbol,c);if(u&&Zc(t,u)){var p=e.factory.getDeclarationName(t.symbol.valueDeclaration),f=e.factory.getDeclarationName(r.symbol.valueDeclaration);return void L(e.Diagnostics.Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2,fi(c),fi(""===p.escapedText?l:p),fi(""===f.escapedText?l:f))}}var g,m=e.arrayFrom(Tg(t,r,a,!1));if((!o||o.code!==e.Diagnostics.Class_0_incorrectly_implements_interface_1.code&&o.code!==e.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)&&(s=!0),1===m.length){var y=Ua(i);L.apply(void 0,n$4([e.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2,y],Wa(t,r),!1)),e.length(i.declarations)&&(g=e.createDiagnosticForNode(i.declarations[0],e.Diagnostics._0_is_declared_here,y),e.Debug.assert(!!_),d?d.push(g):d=[g]),s&&_&&S++;}else B(t,r,!1)&&(m.length>5?L(e.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more,qa(t),qa(r),e.map(m.slice(0,4),(function(e){return Ua(e)})).join(", "),m.length-4):L(e.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2,qa(t),qa(r),e.map(m,(function(e){return Ua(e)})).join(", ")),s&&_&&S++);}(t,r,w,P),0;if(Lg(r))for(var I=0,M=Z(Nc(t),s);I<M.length;I++)if(!(kc(r,(U=M[I]).escapedName)||32768&(F=$o(U)).flags))return a&&L(e.Diagnostics.Property_0_does_not_exist_on_type_1,Ua(U),qa(r)),0;for(var R=Nc(r),j=Nf(t)&&Nf(r),z=0,K=Z(R,s);z<K.length;z++){var U,V=K[z],q=V.escapedName;if(!(4194304&V.flags)&&(!j||e.isNumericLiteralName(q)||"length"===q)&&(U=Zc(t,q))&&U!==V){var W;if(!(W=ee(t,r,U,V,es,a,c,i===An)))return 0;u&=W;}}return u}function re(t,r,n,a){var o,s;if(i===Pn)return function(e,t,r){var n=el(e,r),i=el(t,r);if(n.length!==i.length)return 0;for(var a=-1,o=0;o<n.length;o++){var s=of(n[o],i[o],!1,!1,!1,J);if(!s)return 0;a&=s;}return a}(t,r,n);if(r===Nt||t===Nt)return -1;var c=t.symbol&&Gh(t.symbol.valueDeclaration),l=r.symbol&&Gh(r.symbol.valueDeclaration),u=el(t,c&&1===n?0:n),_=el(r,l&&1===n?0:n);if(1===n&&u.length&&_.length){var d=!!(4&u[0].flags),p=!!(4&_[0].flags);if(d&&!p)return a&&L(e.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type),0;if(!function(t,r,n){if(!t.declaration||!r.declaration)return !0;var i=e.getSelectedEffectiveModifierFlags(t.declaration,24),a=e.getSelectedEffectiveModifierFlags(r.declaration,24);return 8===a||(16===a&&8!==i||(16!==a&&!i||(n&&L(e.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type,Za(i),Za(a)),!1)))}(u[0],_[0],a))return 0}var f=-1,g=1===n?ae:ne,m=e.getObjectFlags(t),y=e.getObjectFlags(r);if(64&m&&64&y&&t.symbol===r.symbol||4&m&&4&y&&t.target===r.target)for(var v=0;v<_.length;v++){if(!(A=oe(u[v],_[v],!0,a,g(u[v],_[v]))))return 0;f&=A;}else if(1===u.length&&1===_.length){var h=i===An||!!V.noStrictGenericChecks,b=e.first(u),x=e.first(_);if(!(f=oe(b,x,h,a,g(b,x)))&&a&&1===n&&m&y&&(171===(null===(o=x.declaration)||void 0===o?void 0:o.kind)||171===(null===(s=b.declaration)||void 0===s?void 0:s.kind))){var D=function(e){return Va(e,void 0,262144,n)};return L(e.Diagnostics.Type_0_is_not_assignable_to_type_1,D(b),D(x)),L(e.Diagnostics.Types_of_construct_signatures_are_incompatible),f}}else e:for(var S=0,T=_;S<T.length;S++){for(var C=T[S],k=I(),E=a,N=0,F=u;N<F.length;N++){var A,P=F[N];if(A=oe(P,C,!0,E,g(P,C))){f&=A,w(k);continue e}E=!1;}return E&&L(e.Diagnostics.Type_0_provides_no_match_for_the_signature_1,qa(t),Va(C,void 0,void 0,n)),0}return f}function ne(t,r){return 0===t.parameters.length&&0===r.parameters.length?function(t,r){return O(e.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1,qa(t),qa(r))}:function(t,r){return O(e.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible,qa(t),qa(r))}}function ae(t,r){return 0===t.parameters.length&&0===r.parameters.length?function(t,r){return O(e.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1,qa(t),qa(r))}:function(t,r){return O(e.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible,qa(t),qa(r))}}function oe(e,t,r,n,a){return kp(r?Ml(e):e,r?Ml(t):t,i===Nn?8:0,n,L,a,j,Md(Y))}function se(t,r,n){var i=J(t.type,r.type,3,n);return !i&&n&&(t.keyType===r.keyType?L(e.Diagnostics._0_index_signatures_are_incompatible,qa(t.keyType)):L(e.Diagnostics._0_and_1_index_signatures_are_incompatible,qa(t.keyType),qa(r.keyType))),i}function ce(t,r,n,a,o){if(i===Pn)return function(e,t){var r=al(e),n=al(t);if(r.length!==n.length)return 0;for(var i=0,a=n;i<a.length;i++){var o=a[i],s=ol(e,o.keyType);if(!s||!J(s.type,o.type,3)||s.isReadonly!==o.isReadonly)return 0}return -1}(t,r);for(var s=al(r),c=e.some(s,(function(e){return e.keyType===Ye})),l=-1,u=0,_=s;u<_.length;u++){var d=_[u],p=!n&&c&&1&d.type.flags?-1:Sc(t)&&c?J(mc(t),d.type,3,a):le(t,d,a,o);if(!p)return 0;l&=p;}return l}function le(t,r,n,i){var a=ll(t,r.keyType);return a?se(a,r,n):1&i||!Gf(t)?(n&&L(e.Diagnostics.Index_signature_for_type_0_is_missing_in_type_1,qa(r.keyType),qa(t)),0):function(t,r,n){for(var i=-1,a=r.keyType,o=0,s=2097152&t.flags?Ec(t):Cc(t);o<s.length;o++){var c=s[o];if(!Op(t,c)&&nl(h_(c,8576),a)){var l=es(c);if(!(p=J(ie||32768&l.flags||a===Ze||!(16777216&c.flags)?l:om(l,524288),r.type,3,n)))return n&&L(e.Diagnostics.Property_0_is_incompatible_with_index_signature,Ua(c)),0;i&=p;}}for(var u=0,_=al(t);u<_.length;u++){var d=_[u];if(nl(d.keyType,a)){var p;if(!(p=se(d,r,n)))return 0;i&=p;}}return i}(t,r,n)}}function Rp(t){if(16&t.flags)return !1;if(3145728&t.flags)return !!e.forEach(t.types,Rp);if(465829888&t.flags){var r=Fc(t);if(r&&r!==t)return Rp(r)}return bf(t)||!!(134217728&t.flags)}function Bp(t,r){return Nf(t)&&Nf(r)?e.emptyArray:Nc(r).filter((function(e){return jp(uo(t,e.escapedName),$o(e))}))}function jp(e,t){return !!e&&!!t&&Hb(e,32768)&&!!Wf(t)}function Jp(t,r,n){return void 0===n&&(n=cp),EC(t,r,n,!0)||function(t,r){var n=e.getObjectFlags(t);if(20&n&&1048576&r.flags)return e.find(r.types,(function(r){if(524288&r.flags){var i=n&e.getObjectFlags(r);if(4&i)return t.target===r.target;if(16&i)return !!t.aliasSymbol&&t.aliasSymbol===r.aliasSymbol}return !1}))}(t,r)||function(t,r){if(128&e.getObjectFlags(t)&&Tm(r,pf))return e.find(r.types,(function(e){return !pf(e)}))}(t,r)||function(t,r){var n=0;if(el(t,n).length>0||el(t,n=1).length>0)return e.find(r.types,(function(e){return el(e,n).length>0}))}(t,r)||function(t,r){var n;if(!(406978556&t.flags))for(var i=0,a=0,o=r.types;a<o.length;a++){var s=o[a];if(!(406978556&s.flags)){var c=p_([D_(t),D_(s)]);if(4194304&c.flags)return s;if(bf(c)||1048576&c.flags){var l=1048576&c.flags?e.countWhere(c.types,bf):1;l>=i&&(n=s,i=l);}}}return n}(t,r)}function zp(t,r,n,i,a){for(var o=t.types.map((function(e){})),s=0,c=r;s<c.length;s++){var l=c[s],u=l[0],_=l[1],d=qc(t,_);if(!(a&&d&&16&e.getCheckFlags(d)))for(var p=0,f=0,g=t.types;f<g.length;f++){var m=uo(g[f],_);m&&n(u(),m)?o[p]=void 0===o[p]||o[p]:o[p]=!1,p++;}}var y=o.indexOf(!0);if(-1===y)return i;for(var v=o.indexOf(!0,y+1);-1!==v;){if(!op(t.types[y],t.types[v]))return i;v=o.indexOf(!0,v+1);}return t.types[y]}function Kp(t){if(524288&t.flags){var r=Tc(t);return 0===r.callSignatures.length&&0===r.constructSignatures.length&&0===r.indexInfos.length&&r.properties.length>0&&e.every(r.properties,(function(e){return !!(16777216&e.flags)}))}return !!(2097152&t.flags)&&e.every(t.types,Kp)}function Up(e){return e===Kt||e===Ut||8&e.objectFlags?U:qp(e.symbol,e.typeParameters)}function Vp(e){return qp(e,ri(e).typeParameters)}function qp(t,r){void 0===r&&(r=e.emptyArray);var n=ri(t);if(!n.variances){null===e.tracing||void 0===e.tracing||e.tracing.push("checkTypes","getVariancesWorker",{arity:r.length,id:Zu(Es(t))}),n.variances=e.emptyArray;for(var i=[],a=function(e){var r=Gp(e),n=65536&r?32768&r?0:1:32768&r?2:void 0;if(void 0===n){var a=!1,o=!1,s=Ar;Ar=function(e){return e?o=!0:a=!0};var c=Wp(t,e,wt),l=Wp(t,e,It);3==(n=(_p(l,c)?1:0)|(_p(c,l)?2:0))&&_p(Wp(t,e,Pr),c)&&(n=4),Ar=s,(a||o)&&(a&&(n|=8),o&&(n|=16));}i.push(n);},o=0,s=r;o<s.length;o++)a(s[o]);n.variances=i,null===e.tracing||void 0===e.tracing||e.tracing.pop();}return n.variances}function Wp(e,t,r){var n=Od(t,r),i=Es(e);if(po(i))return i;var a=524288&e.flags?nu(e,Fd(ri(e).typeParameters,n)):Yl(i,Fd(i.typeParameters,n));return Pe.add(Zu(a)),a}function Hp(e){return Pe.has(Zu(e))}function Gp(t){var r,n;return (e.some(null===(r=t.symbol)||void 0===r?void 0:r.declarations,(function(t){return e.hasSyntacticModifier(t,32768)}))?32768:0)|(e.some(null===(n=t.symbol)||void 0===n?void 0:n.declarations,(function(t){return e.hasSyntacticModifier(t,65536)}))?65536:0)}function Qp(e){return 262144&e.flags&&!Ac(e)}function Xp(t){return function(t){return !!(4&e.getObjectFlags(t))&&!t.node}(t)&&e.some(eu(t),(function(e){return !!(262144&e.flags)||Xp(e)}))}function Yp(e,t,r,n,i){if(n===Pn&&e.id>t.id){var a=e;e=t,t=a;}var o=r?":"+r:"";return Xp(e)&&Xp(t)?function(e,t,r,n){var i=[],a="",o=c(e,0),s=c(t,0);return "".concat(a).concat(o,",").concat(s).concat(r);function c(e,t){void 0===t&&(t=0);for(var r=""+e.target.id,o=0,s=eu(e);o<s.length;o++){var l=s[o];if(262144&l.flags){if(n||Qp(l)){var u=i.indexOf(l);u<0&&(u=i.length,i.push(l)),r+="="+u;continue}a="*";}else if(t<4&&Xp(l)){r+="<"+c(l,t+1)+">";continue}r+="-"+l.id;}return r}}(e,t,o,i):"".concat(e.id,",").concat(t.id).concat(o)}function Zp(t,r){if(!(6&e.getCheckFlags(t)))return r(t);for(var n=0,i=t.containingType.types;n<i.length;n++){var a=Zc(i[n],t.escapedName),o=a&&Zp(a,r);if(o)return o}}function $p(e){return e.parent&&32&e.parent.flags?Es(ua(e)):void 0}function ef(e){var t=$p(e),r=t&&gs(t)[0];return r&&uo(r,e.escapedName)}function tf(t,r,n){return Zp(r,(function(r){return !!(16&e.getDeclarationModifierFlagsFromSymbol(r,n))&&!ns(t,$p(r))}))?void 0:t}function rf(e,t,r,n){if(void 0===n&&(n=3),r>=n)for(var i=nf(e),a=0,o=0,s=0;s<r;s++){var c=t[s];if(nf(c)===i){if(c.id>=o&&++a>=n)return !0;o=c.id;}}return !1}function nf(t){if(524288&t.flags&&!Rg(t)){if(e.getObjectFlags(t)&&t.node)return t.node;if(t.symbol&&!(16&e.getObjectFlags(t)&&32&t.symbol.flags))return t.symbol;if(Nf(t))return t.target}if(262144&t.flags)return t.symbol;if(8388608&t.flags){do{t=t.objectType;}while(8388608&t.flags);return t}return 16777216&t.flags?t.root:t}function af(t,r,n){if(t===r)return -1;var i=24&e.getDeclarationModifierFlagsFromSymbol(t);if(i!==(24&e.getDeclarationModifierFlagsFromSymbol(r)))return 0;if(i){if(TS(t)!==TS(r))return 0}else if((16777216&t.flags)!=(16777216&r.flags))return 0;return Kb(t)!==Kb(r)?0:n($o(t),$o(r))}function of(t,r,n,i,a,o){if(t===r)return -1;if(!function(e,t,r){var n=vb(e),i=vb(t),a=hb(e),o=hb(t),s=bb(e),c=bb(t);return n===i&&a===o&&s===c||!!(r&&a<=o)}(t,r,n))return 0;if(e.length(t.typeParameters)!==e.length(r.typeParameters))return 0;if(r.typeParameters){for(var s=wd(t.typeParameters,r.typeParameters),c=0;c<r.typeParameters.length;c++)if(!((g=t.typeParameters[c])===(p=r.typeParameters[c])||o(Yd(Wl(g),s)||Ue,Wl(p)||Ue)&&o(Yd(Jc(g),s)||Ue,Jc(p)||Ue)))return 0;t=Kd(t,s,!0);}var l=-1;if(!i){var u=Cl(t);if(u){var _=Cl(r);if(_){if(!(f=o(u,_)))return 0;l&=f;}}}var d=vb(r);for(c=0;c<d;c++){var p,f,g=gb(t,c);if(!(f=o(p=gb(r,c),g)))return 0;l&=f;}if(!a){var m=kl(t),y=kl(r);l&=m||y?function(e,t,r){return e&&t&&o_(e,t)?e.type===t.type?-1:e.type&&t.type?r(e.type,t.type):0:0}(m,y,o):o(Nl(t),Nl(r));}return l}function sf(t){return 1===t.length?t[0]:function(e){for(var t,r=0,n=e;r<n.length;r++){var i=n[r],a=Sf(i);if(t||(t=a),a===i||a!==t)return !1}return !0}(t)?a_(t):e.reduceLeft(t,(function(e,t){return up(e,t)?t:e}))}function cf(t){return !!(4&e.getObjectFlags(t))&&(t.target===Kt||t.target===Ut)}function lf(t){return !!(4&e.getObjectFlags(t))&&t.target===Ut}function uf(e){return cf(e)||Nf(e)}function _f(e){return cf(e)&&!lf(e)||Nf(e)&&!e.target.readonly}function df(e){return cf(e)?eu(e)[0]:void 0}function pf(e){return cf(e)||!(98304&e.flags)&&_p(e,Yt)}function ff(t){if(4&e.getObjectFlags(t)&&3&e.getObjectFlags(t.target)){if(33554432&e.getObjectFlags(t))return 67108864&e.getObjectFlags(t)?t.cachedEquivalentBaseType:void 0;t.objectFlags|=33554432;var r=t.target;if(1&e.getObjectFlags(r)){var n=us(r);if(n&&79!==n.expression.kind&&206!==n.expression.kind)return}var i=gs(r);if(1===i.length&&!qs(t.symbol).size){var a=e.length(r.typeParameters)?Yd(i[0],wd(r.typeParameters,eu(t).slice(0,r.typeParameters.length))):i[0];return e.length(eu(t))>e.length(r.typeParameters)&&(a=Hs(a,e.last(eu(t)))),t.objectFlags|=67108864,t.cachedEquivalentBaseType=a}}}function gf(e){return Q?e===ut:e===We}function mf(e){var t=df(e);return !!t&&gf(t)}function yf(e){return Nf(e)||!!Zc(e,"0")}function vf(e){return pf(e)||yf(e)}function hf(e){return !(240512&e.flags)}function bf(e){return !!(109440&e.flags)}function xf(t){return 2097152&t.flags?e.some(t.types,bf):!!(109440&t.flags)}function Df(t){return !!(16&t.flags)||(1048576&t.flags?!!(1024&t.flags)||e.every(t.types,bf):bf(t))}function Sf(e){return 1024&e.flags?Ss(e):402653312&e.flags?Ye:256&e.flags?Ze:2048&e.flags?$e:512&e.flags?it:1048576&e.flags?Fm(e,Sf):e}function Tf(e){return 1024&e.flags&&yd(e)?Ss(e):128&e.flags&&yd(e)?Ye:256&e.flags&&yd(e)?Ze:2048&e.flags&&yd(e)?$e:512&e.flags&&yd(e)?it:1048576&e.flags?Fm(e,Tf):e}function Cf(e){return 8192&e.flags?at:1048576&e.flags?Fm(e,Cf):e}function kf(e,t){return dx(e,t)||(e=Cf(Tf(e))),e}function Ef(e,t,r,n){return e&&bf(e)&&(e=kf(e,t?lS(r,t,n):void 0)),e}function Nf(t){return !!(4&e.getObjectFlags(t)&&8&t.target.objectFlags)}function Ff(e){return Nf(e)&&!!(8&e.target.combinedFlags)}function Af(e){return Ff(e)&&1===e.target.elementFlags.length}function Pf(e){return wf(e,e.target.fixedLength)}function wf(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1);var i=tu(e)-r;if(t<i){for(var a=eu(e),o=[],s=t;s<i;s++){var c=a[s];o.push(8&e.target.elementFlags[s]?K_(c,Ze):c);}return n?p_(o):a_(o)}}function If(e){return "0"===e.value.base10Value}function Of(e){for(var t=0,r=0,n=e;r<n.length;r++)t|=Mf(n[r]);return t}function Mf(e){return 1048576&e.flags?Of(e.types):128&e.flags?""===e.value?128:0:256&e.flags?0===e.value?256:0:2048&e.flags?If(e)?2048:0:512&e.flags?e===et||e===tt?512:0:117724&e.flags}function Lf(e){return 117632&Mf(e)?km(e,(function(e){return !(117632&Mf(e))})):e}function Rf(e){return 4&e.flags?$r:8&e.flags?en:64&e.flags?tn:e===tt||e===et||114691&e.flags||128&e.flags&&""===e.value||256&e.flags&&0===e.value||2048&e.flags&&If(e)?e:st}function Bf(e,t){var r=t&~e.flags&98304;return 0===r?e:a_(32768===r?[e,qe]:65536===r?[e,Qe]:[e,qe,Qe])}function jf(t,r){return void 0===r&&(r=!1),e.Debug.assert(Q),32768&t.flags?t:a_([t,r?Ge:qe])}function Jf(e){return Q?function(e){var t=om(e,2097152);return Zt||(Zt=Su("NonNullable",524288,void 0)||we),Zt!==we?nu(Zt,[t]):t}(e):e}function zf(e){return Q?a_([e,He]):e}function Kf(e){return Q?Em(e,He):e}function Uf(t,r,n){return n?e.isOutermostOptionalChain(r)?jf(t):zf(t):t}function Vf(t,r){return e.isExpressionOfOptionalChainRoot(r)?Jf(t):e.isOptionalChain(r)?Kf(t):t}function qf(e,t){return ie&&t?Em(e,Ge):e}function Wf(e){return ie&&(e===Ge||1048576&e.flags&&$u(e.types,Ge))}function Hf(e){return ie?Em(e,Ge):om(e,524288)}function Gf(t){return 2097152&t.flags?e.every(t.types,Gf):!(!t.symbol||0==(7040&t.symbol.flags)||32&t.symbol.flags||pT(t))||!!(1024&e.getObjectFlags(t)&&Gf(t.source))}function Qf(t,r){var n=Hn(t.flags,t.escapedName,8&e.getCheckFlags(t));n.declarations=t.declarations,n.parent=t.parent,n.type=r,n.target=t,t.valueDeclaration&&(n.valueDeclaration=t.valueDeclaration);var i=ri(t).nameType;return i&&(n.nameType=i),n}function Xf(t){if(!(Lg(t)&&8192&e.getObjectFlags(t)))return t;var r=t.regularType;if(r)return r;var n=t,i=function(t,r){for(var n=e.createSymbolTable(),i=0,a=Cc(t);i<a.length;i++){var o=a[i],s=$o(o),c=r(s);n.set(o.escapedName,c===s?o:Qf(o,c));}return n}(t,Xf),a=Ea(n.symbol,i,n.callSignatures,n.constructSignatures,n.indexInfos);return a.flags=n.flags,a.objectFlags|=-8193&n.objectFlags,t.regularType=a,a}function Yf(e,t,r){return {parent:e,propertyName:t,siblings:r,resolvedProperties:void 0}}function Zf(e){if(!e.siblings){for(var t=[],r=0,n=Zf(e.parent);r<n.length;r++){var i=n[r];if(Lg(i)){var a=kc(i,e.propertyName);a&&Sm($o(a),(function(e){t.push(e);}));}}e.siblings=t;}return e.siblings}function $f(t){if(!t.resolvedProperties){for(var r=new e.Map,n=0,i=Zf(t);n<i.length;n++){var a=i[n];if(Lg(a)&&!(2097152&e.getObjectFlags(a)))for(var o=0,s=Nc(a);o<s.length;o++){var c=s[o];r.set(c.escapedName,c);}}t.resolvedProperties=e.arrayFrom(r.values());}return t.resolvedProperties}function eg(e,t){if(!(4&e.flags))return e;var r=$o(e),n=ng(r,t&&Yf(t,e.escapedName,void 0));return n===r?e:Qf(e,n)}function tg(e){var t=Ae.get(e.escapedName);if(t)return t;var r=Qf(e,Ge);return r.flags|=16777216,Ae.set(e.escapedName,r),r}function rg(e){return ng(e,void 0)}function ng(t,r){if(196608&e.getObjectFlags(t)){if(void 0===r&&t.widened)return t.widened;var n=void 0;if(98305&t.flags)n=Le;else if(Lg(t))n=function(t,r){for(var n=e.createSymbolTable(),i=0,a=Cc(t);i<a.length;i++){var o=a[i];n.set(o.escapedName,eg(o,r));}if(r)for(var s=0,c=$f(r);s<c.length;s++)o=c[s],n.has(o.escapedName)||n.set(o.escapedName,tg(o));var l=Ea(t.symbol,n,e.emptyArray,e.emptyArray,e.sameMap(al(t),(function(e){return Jl(e.keyType,rg(e.type),e.isReadonly)})));return l.objectFlags|=266240&e.getObjectFlags(t),l}(t,r);else if(1048576&t.flags){var i=r||Yf(void 0,void 0,t.types),a=e.sameMap(t.types,(function(e){return 98304&e.flags?e:ng(e,i)}));n=a_(a,e.some(a,Np)?2:1);}else 2097152&t.flags?n=p_(e.sameMap(t.types,rg)):uf(t)&&(n=Yl(t.target,e.sameMap(eu(t),rg)));return n&&void 0===r&&(t.widened=n),n||t}return t}function ig(t){var r=!1;if(65536&e.getObjectFlags(t)){if(1048576&t.flags)if(e.some(t.types,Np))r=!0;else for(var n=0,i=t.types;n<i.length;n++)ig(u=i[n])&&(r=!0);if(uf(t))for(var a=0,o=eu(t);a<o.length;a++)ig(u=o[a])&&(r=!0);if(Lg(t))for(var s=0,c=Cc(t);s<c.length;s++){var l=c[s],u=$o(l);65536&e.getObjectFlags(u)&&(ig(u)||Jn(l.valueDeclaration,e.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type,Ua(l),qa(rg(u))),r=!0);}}return r}function ag(t,r,n){var i=qa(rg(r));if(!e.isInJSFile(t)||e.isCheckJsEnabledForFile(e.getSourceFileOfNode(t),V)){var a;switch(t.kind){case 221:case 167:case 166:a=$?e.Diagnostics.Member_0_implicitly_has_an_1_type:e.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;break;case 164:var o=t;if(e.isIdentifier(o.name)&&(e.isCallSignatureDeclaration(o.parent)||e.isMethodSignature(o.parent)||e.isFunctionTypeNode(o.parent))&&o.parent.parameters.indexOf(o)>-1&&(li(o,o.name.escapedText,788968,void 0,o.name.escapedText,!0)||o.name.originalKeywordKind&&e.isTypeNodeKind(o.name.originalKeywordKind))){var s="arg"+o.parent.parameters.indexOf(o),c=e.declarationNameToString(o.name)+(o.dotDotDotToken?"[]":"");return void Kn($,t,e.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1,s,c)}a=t.dotDotDotToken?$?e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type:e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage:$?e.Diagnostics.Parameter_0_implicitly_has_an_1_type:e.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;break;case 203:if(a=e.Diagnostics.Binding_element_0_implicitly_has_an_1_type,!$)return;break;case 317:return void Jn(t,e.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type,i);case 256:case 169:case 168:case 172:case 173:case 213:case 214:if($&&!t.name)return void Jn(t,3===n?e.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation:e.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type,i);a=$?3===n?e.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type:e.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type:e.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage;break;case 195:return void($&&Jn(t,e.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type));default:a=$?e.Diagnostics.Variable_0_implicitly_has_an_1_type:e.Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;}Kn($,t,a,e.declarationNameToString(e.getNameOfDeclaration(t)),i);}}function og(t,r,n){m((function(){!($&&65536&e.getObjectFlags(r))||n&&zy(t)||ig(r)||ag(t,r,n);}));}function sg(e,t,r){var n=vb(e),i=vb(t),a=xb(e),o=xb(t),s=o?i-1:i,c=a?s:Math.min(n,s),l=Cl(e);if(l){var u=Cl(t);u&&r(l,u);}for(var _=0;_<c;_++)r(gb(e,_),gb(t,_));o&&r(yb(e,c),o);}function cg(e,t,r){var n=kl(e),i=kl(t);n&&i&&o_(n,i)&&n.type&&i.type?r(n.type,i.type):r(Nl(e),Nl(t));}function lg(e,t,r,n){return ug(e.map(gg),t,r,n||cp)}function ug(e,t,r,n){var i={inferences:e,signature:t,flags:r,compareTypes:n,mapper:Md((function(e){return _g(i,e,!0)})),nonFixingMapper:Md((function(e){return _g(i,e,!1)}))};return i}function _g(e,t,r){for(var n=e.inferences,i=0;i<n.length;i++){var a=n[i];if(t===a.typeParameter)return r&&!a.isFixed&&(fg(e),dg(n),a.isFixed=!0),Bg(e,i)}return t}function dg(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];n.isFixed||(n.inferredType=void 0);}}function pg(e,t,r){var n;(null!==(n=e.intraExpressionInferenceSites)&&void 0!==n?n:e.intraExpressionInferenceSites=[]).push({node:t,type:r});}function fg(e){if(e.intraExpressionInferenceSites){for(var t=0,r=e.intraExpressionInferenceSites;t<r.length;t++){var n=r[t],i=n.node,a=n.type,o=169===i.kind?Ny(i,2):Ly(i,2);o&&Ig(e.inferences,a,o);}e.intraExpressionInferenceSites=void 0;}}function gg(e){return {typeParameter:e,candidates:void 0,contraCandidates:void 0,inferredType:void 0,priority:void 0,topLevel:!0,isFixed:!1,impliedArity:void 0}}function mg(e){return {typeParameter:e.typeParameter,candidates:e.candidates&&e.candidates.slice(),contraCandidates:e.contraCandidates&&e.contraCandidates.slice(),inferredType:e.inferredType,priority:e.priority,topLevel:e.topLevel,isFixed:e.isFixed,impliedArity:e.impliedArity}}function yg(e){return e&&e.mapper}function vg(t){var r=e.getObjectFlags(t);if(524288&r)return !!(1048576&r);var n=!!(465829888&t.flags||524288&t.flags&&!hg(t)&&(4&r&&(t.node||e.forEach(eu(t),vg))||16&r&&t.symbol&&14384&t.symbol.flags&&t.symbol.declarations||12583968&r)||3145728&t.flags&&!(1024&t.flags)&&!hg(t)&&e.some(t.types,vg));return 3899393&t.flags&&(t.objectFlags|=524288|(n?1048576:0)),n}function hg(t){if(t.aliasSymbol&&!t.aliasTypeArguments){var r=e.getDeclarationOfKind(t.aliasSymbol,259);return !(!r||!e.findAncestor(r.parent,(function(e){return 305===e.kind||261!==e.kind&&"quit"})))}return !1}function bg(t,r){return !!(t===r||3145728&t.flags&&e.some(t.types,(function(e){return bg(e,r)}))||16777216&t.flags&&($_(t)===r||ed(t)===r))}function xg(t,r,n){if(!Wr){var i=t.id+","+r.id+","+n.id;if(qr.has(i))return qr.get(i);Wr=!0;var a=function(t,r,n){if(ol(t,Ye)||0!==Nc(t).length&&Dg(t)){if(cf(t))return Bu(Sg(eu(t)[0],r,n),lf(t));if(Nf(t))return Vu(e.map(eu(t),(function(e){return Sg(e,r,n)})),4&bc(r)?e.sameMap(t.target.elementFlags,(function(e){return 2&e?1:e})):t.target.elementFlags,t.target.readonly,t.target.labeledElementDeclarations);var i=xa(1040,void 0);return i.source=t,i.mappedType=r,i.constraintType=n,i}}(t,r,n);return Wr=!1,qr.set(i,a),a}}function Dg(t){return !(262144&e.getObjectFlags(t))||Lg(t)&&e.some(Nc(t),(function(e){return Dg($o(e))}))||Nf(t)&&e.some(eu(t),Dg)}function Sg(e,t,r){var n=K_(r.type,pc(t)),i=mc(t),a=gg(n);return Ig([a],e,i),kg(a)||Ue}function Tg(t,r,n,i){var a,s,c,l,u,_,d;return o(this,(function(o){switch(o.label){case 0:a=Nc(r),s=0,c=a,o.label=1;case 1:return s<c.length?Ms(l=c[s])||!n&&(16777216&l.flags||48&e.getCheckFlags(l))?[3,5]:(u=Zc(t,l.escapedName))?[3,3]:[4,l]:[3,6];case 2:return o.sent(),[3,5];case 3:return i&&109440&(_=$o(l)).flags?1&(d=$o(u)).flags||md(d)===md(_)?[3,5]:[4,l]:[3,5];case 4:o.sent(),o.label=5;case 5:return s++,[3,1];case 6:return [2]}}))}function Cg(e,t,r,n){var i=Tg(e,t,r,n).next();if(!i.done)return i.value}function kg(e){return e.candidates?a_(e.candidates,2):e.contraCandidates?p_(e.contraCandidates):void 0}function Eg(e){return !!ni(e).skipDirectInference}function Ng(t){return !(!t.symbol||!e.some(t.symbol.declarations,Eg))}function Fg(t,r){return 128&t.flags?wg([t.value],e.emptyArray,r):134217728&t.flags?e.arraysEqual(t.texts,r.texts)?e.map(t.types,Pg):wg(t.texts,t.types,r):void 0}function Ag(t,r){var n=Fg(t,r);return !!n&&e.every(n,(function(t,n){return function(t,r){if(t===r||5&r.flags)return !0;if(128&t.flags){var n=t.value;return !!(8&r.flags&&""!==n&&isFinite(+n)||64&r.flags&&""!==n&&function(t){var r=e.createScanner(99,!1),n=!0;r.setOnError((function(){return n=!1})),r.setText(t+"n");var i=r.scan();40===i&&(i=r.scan());var a=r.getTokenFlags();return n&&9===i&&r.getTextPos()===t.length+1&&!(512&a)}(n)||98816&r.flags&&n===r.intrinsicName)}if(134217728&t.flags){var i=t.texts;return 2===i.length&&""===i[0]&&""===i[1]&&_p(t.types[0],r)}return _p(t,r)}(t,r.types[n])}))}function Pg(e){return 402653317&e.flags?e:T_(["",""],[e])}function wg(e,t,r){var i=e.length-1,a=e[0],o=e[i],s=r.texts,c=s.length-1,l=s[0],u=s[c];if(!(0===i&&a.length<l.length+u.length)&&a.startsWith(l)&&o.endsWith(u)){for(var _=o.slice(0,o.length-u.length),d=[],p=0,f=l.length,g=1;g<c;g++){var m=s[g];if(m.length>0){for(var y=p,v=f;!((v=h(y).indexOf(m,v))>=0);){if(++y===e.length)return;v=0;}b(y,v),f+=m.length;}else if(f<h(p).length)b(p,f+1);else {if(!(p<i))return;b(p+1,0);}}return b(i,h(i).length),d}function h(t){return t<i?e[t]:_}function b(r,i){var a=r===p?vd(h(r).slice(f,i)):T_(n$4(n$4([e[p].slice(f)],e.slice(p+1,r),!0),[h(r).slice(0,i)],!1),t.slice(p,r));d.push(a),p=r,f=i;}}function Ig(t,r,n,i,a){void 0===i&&(i=0),void 0===a&&(a=!1);var o,s,c,l,u=!1,_=2048,d=!0,p=0;function f(r,s){if(vg(s)){if(r===Be){var c=o;return o=r,f(s,s),void(o=c)}if(r.aliasSymbol&&r.aliasTypeArguments&&r.aliasSymbol===s.aliasSymbol)v(r.aliasTypeArguments,s.aliasTypeArguments,Vp(r.aliasSymbol));else if(r===s&&3145728&r.flags)for(var l=0,p=r.types;l<p.length;l++){var h=p[l];f(h,h);}else {if(1048576&s.flags){var D=y(1048576&r.flags?r.types:[r],s.types,Og),C=y(D[0],D[1],Mg),k=C[0];if(0===(N=C[1]).length)return;if(s=a_(N),0===k.length)return void g(r,s,1);r=a_(k);}else if(2097152&s.flags&&e.some(s.types,(function(e){return !!b(e)||Sc(e)&&!!b(qd(e)||st)}))){if(!(1048576&r.flags)){var E=y(2097152&r.flags?r.types:[r],s.types,op),N=(k=E[0],E[1]);if(0===k.length||0===N.length)return;r=p_(k),s=p_(N);}}else 41943040&s.flags&&(s=H_(s));if(8650752&s.flags){if(r===ze||r===ct||128&i&&(r===Re||r===Xt)||Ng(r))return;var F=b(s);if(F){if(262144&e.getObjectFlags(r))return;if(!F.isFixed){if((void 0===F.priority||i<F.priority)&&(F.candidates=void 0,F.contraCandidates=void 0,F.topLevel=!0,F.priority=i),i===F.priority){var A=o||r;a&&!u?e.contains(F.contraCandidates,A)||(F.contraCandidates=e.append(F.contraCandidates,A),dg(t)):e.contains(F.candidates,A)||(F.candidates=e.append(F.candidates,A),dg(t));}!(128&i)&&262144&s.flags&&F.topLevel&&!bg(n,s)&&(F.topLevel=!1,dg(t));}return void(_=Math.min(_,i))}var P=B_(s,!1);if(P!==s)f(r,P);else if(8388608&s.flags){var w=B_(s.indexType,!1);if(465829888&w.flags){var I=j_(B_(s.objectType,!1),w,!1);I&&I!==s&&f(r,I);}}}if(!(4&e.getObjectFlags(r)&&4&e.getObjectFlags(s)&&(r.target===s.target||cf(r)&&cf(s)))||r.node&&s.node)if(4194304&r.flags&&4194304&s.flags)a=!a,f(r.type,s.type),a=!a;else if((Df(r)||4&r.flags)&&4194304&s.flags){var O=function(t){var r=e.createSymbolTable();Sm(t,(function(t){if(128&t.flags){var n=e.escapeLeadingUnderscores(t.value),i=Hn(4,n);i.type=Le,t.symbol&&(i.declarations=t.symbol.declarations,i.valueDeclaration=t.symbol.valueDeclaration),r.set(n,i);}}));var n=4&t.flags?[Jl(Ye,St,!1)]:e.emptyArray;return Ea(void 0,r,e.emptyArray,e.emptyArray,n)}(r);a=!a,g(O,s.type,256),a=!a;}else if(8388608&r.flags&&8388608&s.flags)f(r.objectType,s.objectType),f(r.indexType,s.indexType);else if(268435456&r.flags&&268435456&s.flags)r.symbol===s.symbol&&f(r.type,s.type);else if(33554432&r.flags){f(r.baseType,s);var M=i;i|=4,f(r.substitute,s),i=M;}else if(16777216&s.flags)m(r,s,S);else if(3145728&s.flags)x(r,s.types,s.flags);else if(1048576&r.flags)for(var L=0,R=r.types;L<R.length;L++)f(R[L],s);else if(134217728&s.flags)!function(t,r){var n=Fg(t,r),i=r.types;if(n||e.every(r.texts,(function(e){return 0===e.length})))for(var a=0;a<i.length;a++)f(n?n[a]:st,i[a]);}(r,s);else {if(r=Hc(r),!(512&i&&467927040&r.flags)){var B=Kc(r);if(B!==r&&d&&!(2621440&B.flags))return d=!1,f(B,s);r=B;}2621440&r.flags&&m(r,s,T);}else v(eu(r),eu(s),Up(r.target));}}}function g(e,t,r){var n=i;i|=r,f(e,t),i=n;}function m(t,r,n){var i=t.id+","+r.id,a=s&&s.get(i);if(void 0===a){(s||(s=new e.Map)).set(i,-1);var o=_;_=2048;var u=p,d=nf(t),f=nf(r);e.contains(c,d)&&(p|=1),e.contains(l,f)&&(p|=2),3!==p?((c||(c=[])).push(d),(l||(l=[])).push(f),n(t,r),l.pop(),c.pop()):_=-1,p=u,s.set(i,_),_=Math.min(_,o);}else _=Math.min(_,a);}function y(t,r,n){for(var i,a,o=0,s=r;o<s.length;o++)for(var c=s[o],l=0,u=t;l<u.length;l++){var _=u[l];n(_,c)&&(f(_,c),i=e.appendIfUnique(i,_),a=e.appendIfUnique(a,c));}return [i?e.filter(t,(function(t){return !e.contains(i,t)})):t,a?e.filter(r,(function(t){return !e.contains(a,t)})):r]}function v(e,t,r){for(var n=e.length<t.length?e.length:t.length,i=0;i<n;i++)i<r.length&&2==(7&r[i])?h(e[i],t[i]):f(e[i],t[i]);}function h(e,t){X||1024&i?(a=!a,f(e,t),a=!a):f(e,t);}function b(e){if(8650752&e.flags)for(var r=0,n=t;r<n.length;r++){var i=n[r];if(e===i.typeParameter)return i}}function x(t,r,n){var a=0;if(1048576&n){for(var o=void 0,s=1048576&t.flags?t.types:[t],c=new Array(s.length),l=!1,u=0,d=r;u<d.length;u++)if(b(T=d[u]))o=T,a++;else for(var p=0;p<s.length;p++){var m=_;_=2048,f(s[p],T),_===i&&(c[p]=!0),l=l||-1===_,_=Math.min(_,m);}if(0===a){var y=function(t){for(var r,n=0,i=t;n<i.length;n++){var a=i[n],o=2097152&a.flags&&e.find(a.types,(function(e){return !!b(e)}));if(!o||r&&o!==r)return;r=o;}return r}(r);return void(y&&g(t,y,1))}if(1===a&&!l){var v=e.flatMap(s,(function(e,t){return c[t]?void 0:e}));if(v.length)return void f(a_(v),o)}}else for(var h=0,x=r;h<x.length;h++)b(T=x[h])?a++:f(t,T);if(2097152&n?1===a:a>0)for(var D=0,S=r;D<S.length;D++){var T;b(T=S[D])&&g(t,T,1);}}function D(t,r,n){if(1048576&n.flags){for(var i=!1,a=0,o=n.types;a<o.length;a++)i=D(t,r,o[a])||i;return i}if(4194304&n.flags){var s=b(n.type);if(s&&!s.isFixed&&!Ng(t)){var c=xg(t,r,n);c&&g(c,s.typeParameter,262144&e.getObjectFlags(t)?16:8);}return !0}if(262144&n.flags){g(D_(t),n,32);var l=Fc(n);if(l&&D(t,r,l))return !0;var u=e.map(Nc(t),$o),_=e.map(al(t),(function(e){return e!==Rr?e.type:st}));return f(a_(e.concatenate(u,_)),mc(r)),!0}return !1}function S(e,t){if(16777216&e.flags)f(e.checkType,t.checkType),f(e.extendsType,t.extendsType),f($_(e),$_(t)),f(ed(e),ed(t));else {var r=i;i|=a?64:0,x(e,[$_(t),ed(t)],t.flags),i=r;}}function T(t,r){if(4&e.getObjectFlags(t)&&4&e.getObjectFlags(r)&&(t.target===r.target||cf(t)&&cf(r)))v(eu(t),eu(r),Up(t.target));else {if(Sc(t)&&Sc(r)){f(fc(t),fc(r)),f(mc(t),mc(r));var n=gc(t),i=gc(r);n&&i&&f(n,i);}var a,o;if(32&e.getObjectFlags(r)&&!r.declaration.nameType&&D(t,r,fc(r)))return;if(!function(e,t){return Nf(e)&&Nf(t)?function(e,t){return !(8&t.target.combinedFlags)&&t.target.minLength>e.target.minLength||!t.target.hasRestElement&&(e.target.hasRestElement||t.target.fixedLength<e.target.fixedLength)}(e,t):!!Cg(e,t,!1,!0)&&!!Cg(t,e,!1,!1)}(t,r)){if(uf(t)){if(Nf(r)){var s=tu(t),c=tu(r),l=eu(r),u=r.target.elementFlags;if(Nf(t)&&(o=r,tu(a=t)===tu(o)&&e.every(a.target.elementFlags,(function(e,t){return (12&e)==(12&o.target.elementFlags[t])})))){for(var _=0;_<c;_++)f(eu(t)[_],l[_]);return}var d=Nf(t)?Math.min(t.target.fixedLength,r.target.fixedLength):0,p=Math.min(Nf(t)?Yu(t.target,3):0,r.target.hasRestElement?Yu(r.target,3):0);for(_=0;_<d;_++)f(eu(t)[_],l[_]);if(!Nf(t)||s-d-p==1&&4&t.target.elementFlags[d]){var m=eu(t)[d];for(_=d;_<c-p;_++)f(8&u[_]?Bu(m):m,l[_]);}else {var y=c-d-p;if(2===y&&u[d]&u[d+1]&8&&Nf(t)){var h=b(l[d]);h&&void 0!==h.impliedArity&&(f(Gu(t,d,p+s-h.impliedArity),l[d]),f(Gu(t,d+h.impliedArity,p),l[d+1]));}else if(1===y&&8&u[d]){var x=2&r.target.elementFlags[c-1];g(Nf(t)?Gu(t,d,p):Bu(eu(t)[0]),l[d],x?2:0);}else 1===y&&4&u[d]&&(m=Nf(t)?wf(t,d,p):eu(t)[0])&&f(m,l[d]);}for(_=0;_<p;_++)f(eu(t)[s-_-1],l[c-_-1]);return}if(cf(r))return void E(t,r)}!function(t,r){for(var n=0,i=Cc(r);n<i.length;n++){var a=i[n],o=Zc(t,a.escapedName);o&&!e.some(o.declarations,Eg)&&f($o(o),$o(a));}}(t,r),C(t,r,0),C(t,r,1),E(t,r);}}}function C(t,r,n){for(var i=el(t,n),a=el(r,n),o=i.length,s=a.length,c=o<s?o:s,l=!!(262144&e.getObjectFlags(t)),u=0;u<c;u++)k(Ll(i[o-c+u]),Ml(a[s-c+u]),l);}function k(e,t,r){if(!r){var n=u,i=t.declaration?t.declaration.kind:0;u=u||169===i||168===i||171===i,sg(e,t,h),u=n;}cg(e,t,f);}function E(t,r){var n=e.getObjectFlags(t)&e.getObjectFlags(r)&32?8:0,i=al(r);if(Gf(t))for(var a=0,o=i;a<o.length;a++){for(var s=o[a],c=[],l=0,u=Nc(t);l<u.length;l++){var _=u[l];if(nl(h_(_,8576),s.keyType)){var d=$o(_);c.push(16777216&_.flags?Hf(d):d);}}for(var p=0,f=al(t);p<f.length;p++){var m=f[p];nl(m.keyType,s.keyType)&&c.push(m.type);}c.length&&g(a_(c),s.type,n);}for(var y=0,v=i;y<v.length;y++){var h=ll(t,(s=v[y]).keyType);h&&g(h.type,s.type,n);}}f(r,n);}function Og(e,t){return ie&&t===Ge?e===t:op(e,t)||!!(4&t.flags&&128&e.flags||8&t.flags&&256&e.flags)}function Mg(e,t){return !!(524288&e.flags&&524288&t.flags&&e.symbol&&e.symbol===t.symbol||e.aliasSymbol&&e.aliasTypeArguments&&e.aliasSymbol===t.aliasSymbol)}function Lg(t){return !!(128&e.getObjectFlags(t))}function Rg(t){return !!(16512&e.getObjectFlags(t))}function Bg(t,r){var n,i,a=t.inferences[r];if(!a.inferredType){var o=void 0,s=t.signature;if(s){var c=a.candidates?function(t,r){var n,i=function(t){if(t.length>1){var r=e.filter(t,Rg);if(r.length){var n=a_(r,2);return e.concatenate(e.filter(t,(function(e){return !Rg(e)})),[n])}}return t}(t.candidates),a=!!(n=Ac(t.typeParameter))&&Hb(16777216&n.flags?wc(n):n,406978556),o=!a&&t.topLevel&&(t.isFixed||!bg(Nl(r),t.typeParameter)),s=a?e.sameMap(i,md):o?e.sameMap(i,Tf):i;return rg(416&t.priority?a_(s,2):function(t){if(!Q)return sf(t);var r=e.filter(t,(function(e){return !(98304&e.flags)}));return r.length?Bf(sf(r),98304&Of(t)):a_(t,2)}(s))}(a,s):void 0;if(a.contraCandidates)o=!c||131072&c.flags||!e.some(a.contraCandidates,(function(e){return up(c,e)}))?function(t){return 416&t.priority?p_(t.contraCandidates):(r=t.contraCandidates,e.reduceLeft(r,(function(e,t){return up(t,e)?t:e})));var r;}(a):c;else if(c)o=c;else if(1&t.flags)o=ct;else {var l=Jc(a.typeParameter);l&&(o=Yd(l,(n=function(t,r){return Md((function(n){return e.findIndex(t.inferences,(function(e){return e.typeParameter===n}))>=r?Ue:n}))}(t,r),i=t.nonFixingMapper,n?Ld(4,n,i):i)));}}else o=kg(a);a.inferredType=o||jg(!!(2&t.flags));var u=Ac(a.typeParameter);if(u){var _=Yd(u,t.nonFixingMapper);o&&t.compareTypes(o,Hs(_,o))||(a.inferredType=o=_);}}return a.inferredType}function jg(e){return e?Le:Ue}function Jg(e){for(var t=[],r=0;r<e.inferences.length;r++)t.push(Bg(e,r));return t}function zg(t){switch(t.escapedText){case"document":case"console":return e.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;case"$":return V.types?e.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig:e.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery;case"describe":case"suite":case"it":case"test":return V.types?e.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig:e.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha;case"process":case"require":case"Buffer":case"module":return V.types?e.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig:e.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode;case"Map":case"Set":case"Promise":case"Symbol":case"WeakMap":case"WeakSet":case"Iterator":case"AsyncIterator":case"SharedArrayBuffer":case"Atomics":case"AsyncIterable":case"AsyncIterableIterator":case"AsyncGenerator":case"AsyncGeneratorFunction":case"BigInt":case"Reflect":case"BigInt64Array":case"BigUint64Array":return e.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later;case"await":if(e.isCallExpression(t.parent))return e.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function;default:return 297===t.parent.kind?e.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer:e.Diagnostics.Cannot_find_name_0}}function Kg(t){var r=ni(t);return r.resolvedSymbol||(r.resolvedSymbol=!e.nodeIsMissing(t)&&li(t,t.escapedText,1160127,zg(t),t,!e.isWriteOnlyAccess(t),!1)||we),r.resolvedSymbol}function Ug(t){return !!e.findAncestor(t,(function(e){return 181===e.kind||79!==e.kind&&161!==e.kind&&"quit"}))}function Vg(t,r,n,i){switch(t.kind){case 79:if(!e.isThisInTypeQuery(t)){var a=Kg(t);return a!==we?"".concat(i?O(i):"-1","|").concat(Zu(r),"|").concat(Zu(n),"|").concat(M(a)):void 0}case 108:return "0|".concat(i?O(i):"-1","|").concat(Zu(r),"|").concat(Zu(n));case 230:case 212:return Vg(t.expression,r,n,i);case 161:var o=Vg(t.left,r,n,i);return o&&o+"."+t.right.escapedText;case 206:case 207:var s=Wg(t);if(void 0!==s){var c=Vg(t.expression,r,n,i);return c&&c+"."+s}}}function qg(t,r){switch(r.kind){case 212:case 230:return qg(t,r.expression);case 221:return e.isAssignmentExpression(r)&&qg(t,r.left)||e.isBinaryExpression(r)&&27===r.operatorToken.kind&&qg(t,r.right)}switch(t.kind){case 231:return 231===r.kind&&t.keywordToken===r.keywordToken&&t.name.escapedText===r.name.escapedText;case 79:case 80:return e.isThisInTypeQuery(t)?108===r.kind:79===r.kind&&Kg(t)===Kg(r)||(254===r.kind||203===r.kind)&&ga(Kg(t))===la(r);case 108:return 108===r.kind;case 106:return 106===r.kind;case 230:case 212:return qg(t.expression,r);case 206:case 207:var n=Wg(t),i=e.isAccessExpression(r)?Wg(r):void 0;return void 0!==n&&void 0!==i&&i===n&&qg(t.expression,r.expression);case 161:return e.isAccessExpression(r)&&t.right.escapedText===Wg(r)&&qg(t.left,r.expression);case 221:return e.isBinaryExpression(t)&&27===t.operatorToken.kind&&qg(t.right,r)}return !1}function Wg(t){if(e.isPropertyAccessExpression(t))return t.name.escapedText;if(e.isElementAccessExpression(t))return function(t){if(e.isStringOrNumericLiteralLike(t.argumentExpression))return e.escapeLeadingUnderscores(t.argumentExpression.text);if(e.isEntityNameExpression(t.argumentExpression)){var r=qi(t.argumentExpression,111551,!0);if(!r||!ey(r))return;var n=r.valueDeclaration;if(void 0===n)return;var i=Ko(n);if(i){var a=Hg(i);if(void 0!==a)return a}if(e.hasOnlyExpressionInitializer(n)){var o=e.getEffectiveInitializer(n);return o&&Hg(Sx(o))}}}(t);if(e.isBindingElement(t)){var r=bo(t);return r?e.escapeLeadingUnderscores(r):void 0}return e.isParameter(t)?""+t.parent.parameters.indexOf(t):void 0}function Hg(t){return 8192&t.flags?t.escapedName:384&t.flags?e.escapeLeadingUnderscores(""+t.value):void 0}function Gg(t,r){for(;e.isAccessExpression(t);)if(qg(t=t.expression,r))return !0;return !1}function Qg(t,r){for(;e.isOptionalChain(t);)if(qg(t=t.expression,r))return !0;return !1}function Xg(t,r){if(t&&1048576&t.flags){var n=qc(t,r);if(n&&2&e.getCheckFlags(n))return void 0===n.isDiscriminantProperty&&(n.isDiscriminantProperty=192==(192&n.checkFlags)&&!O_($o(n))),!!n.isDiscriminantProperty}return !1}function Yg(e,t){for(var r,n=0,i=e;n<i.length;n++){var a=i[n];if(Xg(t,a.escapedName)){if(r){r.push(a);continue}r=[a];}}return r}function Zg(t){var r=t.types;if(!(r.length<10||32768&e.getObjectFlags(t)||e.countWhere(r,(function(e){return !!(59506688&e.flags)}))<10)){if(void 0===t.keyPropertyName){var n=e.forEach(r,(function(t){return 59506688&t.flags?e.forEach(Nc(t),(function(e){return bf($o(e))?e.escapedName:void 0})):void 0})),i=n&&function(t,r){for(var n=new e.Map,i=0,a=function(e){if(61603840&e.flags){var t=uo(e,r);if(t){if(!Df(t))return {value:void 0};var a=!1;Sm(t,(function(t){var r=Zu(md(t)),i=n.get(r);i?i!==Ue&&(n.set(r,Ue),a=!0):n.set(r,e);})),a||i++;}}},o=0,s=t;o<s.length;o++){var c=a(s[o]);if("object"==typeof c)return c.value}return i>=10&&2*i>=t.length?n:void 0}(r,n);t.keyPropertyName=i?n:"",t.constituentMap=i;}return t.keyPropertyName.length?t.keyPropertyName:void 0}}function $g(e,t){var r,n=null===(r=e.constituentMap)||void 0===r?void 0:r.get(Zu(md(t)));return n!==Ue?n:void 0}function em(e,t){var r=Zg(e),n=r&&uo(t,r);return n&&$g(e,n)}function tm(e,t){return qg(e,t)||Gg(e,t)}function rm(e,t){if(e.arguments)for(var r=0,n=e.arguments;r<n.length;r++)if(tm(t,n[r]))return !0;return !(206!==e.expression.kind||!tm(t,e.expression.expression))}function nm(e){return (!e.id||e.id<0)&&(e.id=p,p++),e.id}function im(e){var t=Tc(e);return !!(t.callSignatures.length||t.constructSignatures.length||t.members.get("bind")&&up(e,jt))}function am(t,r){void 0===r&&(r=!1);var n=t.flags;if(4&n)return Q?16317953:16776705;if(128&n){var i=""===t.value;return Q?i?12123649:7929345:i?12582401:16776705}if(40&n)return Q?16317698:16776450;if(256&n){var a=0===t.value;return Q?a?12123394:7929090:a?12582146:16776450}return 64&n?Q?16317188:16775940:2048&n?(a=If(t),Q?a?12122884:7928580:a?12581636:16775940):16&n?Q?16316168:16774920:528&n?Q?t===et||t===tt?12121864:7927560:t===et||t===tt?12580616:16774920:524288&n?r?16768959:16&e.getObjectFlags(t)&&Np(t)?Q?16318463:16777215:im(t)?Q?7880640:16728e3:Q?7888800:16736160:49152&n?9830144:65536&n?9363232:12288&n?Q?7925520:16772880:67108864&n?Q?7888800:16736160:131072&n?0:465829888&n?I_(t)?Q?7929345:16776705:am(Mc(t)||Ue,r):1048576&n?e.reduceLeft(t.types,(function(e,t){return e|am(t,r)}),0):2097152&n?(r||(r=Hb(t,131068)),function(e,t){for(var r=0,n=16777215,i=0,a=e.types;i<a.length;i++){var o=am(a[i],t);r|=o,n&=o;}return 8256&r|16768959&n}(t,r)):16777215}function om(e,t){return km(e,(function(e){return 0!=(am(e)&t)}))}function sm(e,t){return t?a_([yo(e),Sx(t)]):e}function cm(e,t){var r,n=v_(t);if(!Rs(n))return je;var i=Ks(n);return uo(e,i)||um(null===(r=ul(e,i))||void 0===r?void 0:r.type)||je}function lm(e,t){return Cm(e,yf)&&function(e,t){return uo(e,""+t)||(Cm(e,Nf)?Fm(e,(function(e){return Pf(e)||qe})):void 0)}(e,t)||um(zD(65,e,qe,void 0))||je}function um(e){return e&&V.noUncheckedIndexedAccess?a_([e,qe]):e}function _m(e){return Bu(zD(65,e,qe,void 0)||je)}function dm(e){return 221===e.parent.kind&&e.parent.left===e||244===e.parent.kind&&e.parent.initializer===e}function pm(e){return cm(fm(e.parent),e.name)}function fm(e){var t=e.parent;switch(t.kind){case 243:return Ye;case 244:return JD(t)||je;case 221:return function(e){return 204===e.parent.kind&&dm(e.parent)||296===e.parent.kind&&dm(e.parent.parent)?sm(fm(e),e.right):Sx(e.right)}(t);case 215:return qe;case 204:return function(e,t){return lm(fm(e),e.elements.indexOf(t))}(t,e);case 225:return function(e){return _m(fm(e.parent))}(t);case 296:return pm(t);case 297:return function(e){return sm(pm(e),e.objectAssignmentInitializer)}(t)}return je}function gm(e){return ni(e).resolvedType||Sx(e)}function mm(e){return 254===e.kind?function(e){return e.initializer?gm(e.initializer):243===e.parent.parent.kind?Ye:244===e.parent.parent.kind&&JD(e.parent.parent)||je}(e):function(e){var t=e.parent,r=mm(t.parent);return sm(201===t.kind?cm(r,e.propertyName||e.name):e.dotDotDotToken?_m(r):lm(r,t.elements.indexOf(e)),e.initializer)}(e)}function ym(e){switch(e.kind){case 212:return ym(e.expression);case 221:switch(e.operatorToken.kind){case 63:case 75:case 76:case 77:return ym(e.left);case 27:return ym(e.right)}}return e}function vm(e){var t=e.parent;return 212===t.kind||221===t.kind&&63===t.operatorToken.kind&&t.left===e||221===t.kind&&27===t.operatorToken.kind&&t.right===e?vm(t):e}function hm(e){return 289===e.kind?md(Sx(e.expression)):st}function bm(e){var t=ni(e);if(!t.switchTypes){t.switchTypes=[];for(var r=0,n=e.caseBlock.clauses;r<n.length;r++){var i=n[r];t.switchTypes.push(hm(i));}}return t.switchTypes}function xm(t,r){for(var n=[],i=0,a=t.caseBlock.clauses;i<a.length;i++){var o=a[i];if(289===o.kind){if(e.isStringLiteralLike(o.expression)){n.push(o.expression.text);continue}return e.emptyArray}r&&n.push(void 0);}return n}function Dm(e,t){return e===t||1048576&t.flags&&function(e,t){if(1048576&e.flags){for(var r=0,n=e.types;r<n.length;r++){var i=n[r];if(!$u(t.types,i))return !1}return !0}return !!(1024&e.flags&&Ss(e)===t)||$u(t.types,e)}(e,t)}function Sm(t,r){return 1048576&t.flags?e.forEach(t.types,r):r(t)}function Tm(t,r){return 1048576&t.flags?e.some(t.types,r):r(t)}function Cm(t,r){return 1048576&t.flags?e.every(t.types,r):r(t)}function km(t,r){if(1048576&t.flags){var n=t.types,i=e.filter(n,r);if(i===n)return t;var a=t.origin,o=void 0;if(a&&1048576&a.flags){var s=a.types,c=e.filter(s,(function(e){return !!(1048576&e.flags)||r(e)}));if(s.length-c.length==n.length-i.length){if(1===c.length)return c[0];o=i_(1048576,c);}}return s_(i,t.objectFlags,void 0,void 0,o)}return 131072&t.flags||r(t)?t:st}function Em(e,t){return km(e,(function(e){return e!==t}))}function Nm(e){return 1048576&e.flags?e.types.length:1}function Fm(e,t,r){if(131072&e.flags)return e;if(!(1048576&e.flags))return t(e);for(var n,i=e.origin,a=!1,o=0,s=i&&1048576&i.flags?i.types:e.types;o<s.length;o++){var c=s[o],l=1048576&c.flags?Fm(c,t,r):t(c);a||(a=c!==l),l&&(n?n.push(l):n=[l]);}return a?n&&a_(n,r?0:1):e}function Am(t,r,n,i){return 1048576&t.flags&&n?a_(e.map(t.types,r),1,n,i):Fm(t,r)}function Pm(e,t){return km(e,(function(e){return 0!=(e.flags&t)}))}function wm(e,t){return Hb(e,134217804)&&Hb(t,402655616)?Fm(e,(function(e){return 4&e.flags?Pm(t,402653316):I_(e)&&!Hb(t,402653188)?Pm(t,128):8&e.flags?Pm(t,264):64&e.flags?Pm(t,2112):e})):e}function Im(e){return 0===e.flags}function Om(e){return 0===e.flags?e.type:e}function Mm(e,t){return t?{flags:0,type:131072&e.flags?ct:e}:e}function Lm(e){return Fe[e.id]||(Fe[e.id]=function(e){var t=xa(256);return t.elementType=e,t}(e))}function Rm(e,t){var r=Xf(Sf(Cx(t)));return Dm(r,e.elementType)?e:Lm(a_([e.elementType,r]))}function Bm(t){return 256&e.getObjectFlags(t)?(r=t).finalArrayType||(r.finalArrayType=131072&(n=r.elementType).flags?Xt:Bu(1048576&n.flags?a_(n.types,2):n)):t;var r,n;}function jm(t){return 256&e.getObjectFlags(t)?t.elementType:st}function Jm(t){var r=vm(t),n=r.parent,i=e.isPropertyAccessExpression(n)&&("length"===n.name.escapedText||208===n.parent.kind&&e.isIdentifier(n.name)&&e.isPushOrUnshiftIdentifier(n.name)),a=207===n.kind&&n.expression===r&&221===n.parent.kind&&63===n.parent.operatorToken.kind&&n.parent.left===n&&!e.isAssignmentTarget(n.parent)&&Gb(Sx(n.argumentExpression),296);return i||a}function zm(t,r){if(8752&t.flags)return $o(t);if(7&t.flags){if(262144&e.getCheckFlags(t)){var n=t.syntheticOrigin;if(n&&zm(n))return $o(t)}var i=t.valueDeclaration;if(i){if(s=i,(e.isVariableDeclaration(s)||e.isPropertyDeclaration(s)||e.isPropertySignature(s)||e.isParameter(s))&&(e.getEffectiveTypeAnnotationNode(s)||e.isInJSFile(s)&&e.hasInitializer(s)&&s.initializer&&e.isFunctionExpressionOrArrowFunction(s.initializer)&&e.getEffectiveReturnTypeNode(s.initializer)))return $o(t);if(e.isVariableDeclaration(i)&&244===i.parent.parent.kind){var a=i.parent.parent,o=Km(a.expression,void 0);if(o)return zD(a.awaitModifier?15:13,o,qe,void 0)}r&&e.addRelatedInfo(r,e.createDiagnosticForNode(i,e.Diagnostics._0_needs_an_explicit_type_annotation,Ua(t)));}}var s;}function Km(t,r){if(!(33554432&t.flags))switch(t.kind){case 79:var n=ga(Kg(t));return zm(2097152&n.flags?Ri(n):n,r);case 108:return function(t){var r=e.getThisContainer(t,!1);if(e.isFunctionLike(r)){var n=bl(r);if(n.thisParameter)return zm(n.thisParameter)}if(e.isClassLike(r.parent)){var i=la(r.parent);return e.isStatic(r)?$o(i):Es(i).thisType}}(t);case 106:return fy(t);case 206:var i=Km(t.expression,r);if(i){var a=t.name,o=void 0;if(e.isPrivateIdentifier(a)){if(!i.symbol)return;o=Zc(i,e.getSymbolNameForPrivateIdentifier(i.symbol,a.escapedText));}else o=Zc(i,a.escapedText);return o&&zm(o,r)}return;case 212:return Km(t.expression,r)}}function Um(t){var r=ni(t),n=r.effectsSignature;if(void 0===n){var i=void 0;238===t.parent.kind?i=Km(t.expression,void 0):106!==t.expression.kind&&(i=e.isOptionalChain(t)?Fv(Vf(kx(t.expression),t.expression),t.expression):Sv(t.expression));var a=el(i&&Kc(i)||Ue,0),o=1!==a.length||a[0].typeParameters?e.some(a,Vm)?Hh(t):void 0:a[0];n=r.effectsSignature=o&&Vm(o)?o:Or;}return n===Or?void 0:n}function Vm(e){return !!(kl(e)||e.declaration&&131072&(Fl(e.declaration)||Ue).flags)}function qm(e){var t=Hm(e,!1);return Cr=e,kr=t,t}function Wm(t){var r=e.skipParentheses(t,!0);return 95===r.kind||221===r.kind&&(55===r.operatorToken.kind&&(Wm(r.left)||Wm(r.right))||56===r.operatorToken.kind&&Wm(r.left)&&Wm(r.right))}function Hm(t,r){for(;;){if(t===Cr)return kr;var n=t.flags;if(4096&n){if(!r){var i=nm(t),a=mn[i];return void 0!==a?a:mn[i]=Hm(t,!0)}r=!1;}if(368&n)t=t.antecedent;else if(512&n){var o=Um(t.node);if(o){var s=kl(o);if(s&&3===s.kind&&!s.type){var c=t.node.arguments[s.parameterIndex];if(c&&Wm(c))return !1}if(131072&Nl(o).flags)return !1}t=t.antecedent;}else {if(4&n)return e.some(t.antecedents,(function(e){return Hm(e,!1)}));if(8&n){var l=t.antecedents;if(void 0===l||0===l.length)return !1;t=l[0];}else {if(!(128&n)){if(1024&n){Cr=void 0;var u=t.target,_=u.antecedents;u.antecedents=t.antecedents;var d=Hm(t.antecedent,!1);return u.antecedents=_,d}return !(1&n)}if(t.clauseStart===t.clauseEnd&&Mb(t.switchStatement))return !1;t=t.antecedent;}}}}function Gm(t,r){for(;;){var n=t.flags;if(4096&n){if(!r){var i=nm(t),a=yn[i];return void 0!==a?a:yn[i]=Gm(t,!0)}r=!1;}if(496&n)t=t.antecedent;else if(512&n){if(106===t.node.expression.kind)return !0;t=t.antecedent;}else {if(4&n)return e.every(t.antecedents,(function(e){return Gm(e,!1)}));if(!(8&n)){if(1024&n){var o=t.target,s=o.antecedents;o.antecedents=t.antecedents;var c=Gm(t.antecedent,!1);return o.antecedents=s,c}return !!(1&n)}t=t.antecedents[0];}}}function Qm(t){switch(t.kind){case 79:var r=Kg(t);return ey(r)||e.isParameterOrCatchClauseVariable(r)&&!Zm(r);case 206:case 207:return Qm(t.expression)&&Kb(ni(t).resolvedSymbol||we)}return !1}function Xm(t,r,n,i,a){var o;void 0===n&&(n=r),void 0===a&&(a=t.flowNode);var s=!1,c=0;if(Yr)return je;if(!a)return r;Zr++;var l=Xr,u=Om(p(a));Xr=l;var _=256&e.getObjectFlags(u)&&Jm(t)?Xt:Bm(u);return _===_t||t.parent&&230===t.parent.kind&&!(131072&_.flags)&&131072&om(_,2097152).flags?r:_===Ve?Ue:_;function d(){return s?o:(s=!0,o=Vg(t,r,n,i))}function p(a){if(2e3===c)return null===e.tracing||void 0===e.tracing||e.tracing.instant("checkTypes","getTypeAtFlowNode_DepthLimit",{flowId:a.id}),Yr=!0,o=t,s=e.findAncestor(o,e.isFunctionOrModuleBlock),u=e.getSourceFileOfNode(o),_=e.getSpanOfTokenAtPosition(u,s.statements.pos),Sn.add(e.createFileDiagnostic(u,_.start,_.length,e.Diagnostics.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis)),je;var o,s,u,_,d;for(c++;;){var f=a.flags;if(4096&f){for(var m=l;m<Xr;m++)if(fn[m]===a)return c--,gn[m];d=a;}var S=void 0;if(16&f){if(!(S=g(a))){a=a.antecedent;continue}}else if(512&f){if(!(S=y(a))){a=a.antecedent;continue}}else if(96&f)S=h(a);else if(128&f)S=b(a);else if(12&f){if(1===a.antecedents.length){a=a.antecedents[0];continue}S=4&f?x(a):D(a);}else if(256&f){if(!(S=v(a))){a=a.antecedent;continue}}else if(1024&f){var T=a.target,C=T.antecedents;T.antecedents=a.antecedents,S=p(a.antecedent),T.antecedents=C;}else if(2&f){var k=a.node;if(k&&k!==i&&206!==t.kind&&207!==t.kind&&108!==t.kind){a=k.flowNode;continue}S=n;}else S=AD(r);return d&&(fn[Xr]=d,gn[Xr]=S,Xr++),c--,S}}function f(e){var r=e.node;return ny(254===r.kind||203===r.kind?mm(r):fm(r),t)}function g(n){var i=n.node;if(qg(t,i)){if(!qm(n))return _t;if(2===e.getAssignmentTargetKind(i)){var a=p(n.antecedent);return Mm(Sf(Om(a)),Im(a))}if(r===Re||r===Xt){if(function(e){return 254===e.kind&&e.initializer&&To(e.initializer)||203!==e.kind&&221===e.parent.kind&&To(e.parent.right)}(i))return Lm(st);var o=Tf(f(n));return _p(o,r)?o:Qt}return 1048576&r.flags?function(e,t){if(e!==t){if(131072&t.flags)return t;var r=km(e,(function(e){return function(e,t){if(!(1048576&e.flags))return _p(e,t);for(var r=0,n=e.types;r<n.length;r++)if(_p(n[r],t))return !0;return !1}(t,e)}));if(512&t.flags&&yd(t)&&(r=Fm(r,gd)),_p(t,r))return r}return e}(r,f(n)):r}if(Gg(t,i)){if(!qm(n))return _t;if(e.isVariableDeclaration(i)&&(e.isInJSFile(i)||e.isVarConst(i))){var s=e.getDeclaredExpandoInitializer(i);if(s&&(213===s.kind||214===s.kind))return p(n.antecedent)}return r}if(e.isVariableDeclaration(i)&&243===i.parent.parent.kind&&qg(t,i.parent.parent.expression))return Cv(Om(p(n.antecedent)))}function m(t,r){var n=e.skipParentheses(r,!0);if(95===n.kind)return _t;if(221===n.kind){if(55===n.operatorToken.kind)return m(m(t,n.left),n.right);if(56===n.operatorToken.kind)return a_([m(t,n.left),m(t,n.right)])}return U(t,n,!0)}function y(e){var t=Um(e.node);if(t){var r=kl(t);if(r&&(2===r.kind||3===r.kind)){var n=p(e.antecedent),i=Bm(Om(n)),a=r.type?K(i,r,e.node,!0):3===r.kind&&r.parameterIndex>=0&&r.parameterIndex<e.node.arguments.length?m(i,e.node.arguments[r.parameterIndex]):i;return a===i?n:Mm(a,Im(n))}if(131072&Nl(t).flags)return _t}}function v(n){if(r===Re||r===Xt){var i=n.node,a=208===i.kind?i.expression.expression:i.left.expression;if(qg(t,ym(a))){var o=p(n.antecedent),s=Om(o);if(256&e.getObjectFlags(s)){var c=s;if(208===i.kind)for(var l=0,u=i.arguments;l<u.length;l++)c=Rm(c,u[l]);else Gb(Cx(i.left.argumentExpression),296)&&(c=Rm(c,i.right));return c===s?o:Mm(c,Im(o))}return o}}}function h(e){var t=p(e.antecedent),r=Om(t);if(131072&r.flags)return t;var n=0!=(32&e.flags),i=Bm(r),a=U(i,e.node,n);return a===i?t:Mm(a,Im(t))}function b(r){var n=r.switchStatement.expression,i=p(r.antecedent),a=Om(i);if(qg(t,n))a=L(a,r.switchStatement,r.clauseStart,r.clauseEnd);else if(216===n.kind&&qg(t,n.expression))a=function(t,r,n,i){var a=xm(r,!0);if(!a.length)return t;var o,s,c=e.findIndex(a,(function(e){return void 0===e})),l=n===i||c>=n&&c<i;if(c>-1){var u=a.filter((function(e){return void 0!==e})),_=c<n?n-1:n,d=c<i?i-1:i;o=u.slice(_,d),s=Ob(_,d,u,l);}else o=a.slice(n,i),s=Ob(n,i,a,l);if(l)return km(t,(function(e){return (am(e)&s)===s}));var p=om(a_(o.map((function(e){return R(t,e)||t}))),s);return om(Fm(t,B(p)),s)}(a,r.switchStatement,r.clauseStart,r.clauseEnd);else {Q&&(Qg(n,t)?a=M(a,r.switchStatement,r.clauseStart,r.clauseEnd,(function(e){return !(163840&e.flags)})):216===n.kind&&Qg(n.expression,t)&&(a=M(a,r.switchStatement,r.clauseStart,r.clauseEnd,(function(e){return !(131072&e.flags||128&e.flags&&"undefined"===e.value)}))));var o=k(n,a);o&&(a=function(t,r,n,i,a){if(i<a&&1048576&t.flags&&Zg(t)===Wg(r)){var o=bm(n).slice(i,a),s=a_(e.map(o,(function(e){return $g(t,e)||Ue})));if(s!==Ue)return s}return E(t,r,(function(e){return L(e,n,i,a)}))}(a,o,r.switchStatement,r.clauseStart,r.clauseEnd));}return Mm(a,Im(i))}function x(t){for(var i,a=[],o=!1,s=!1,c=0,l=t.antecedents;c<l.length;c++){var u=l[c];if(!i&&128&u.flags&&u.clauseStart===u.clauseEnd)i=u;else {if((d=Om(_=p(u)))===r&&r===n)return d;e.pushIfUnique(a,d),Dm(d,r)||(o=!0),Im(_)&&(s=!0);}}if(i){var _,d=Om(_=p(i));if(!e.contains(a,d)&&!Mb(i.switchStatement)){if(d===r&&r===n)return d;a.push(d),Dm(d,r)||(o=!0),Im(_)&&(s=!0);}}return Mm(C(a,o?2:1),s)}function D(t){var n=nm(t),i=un[n]||(un[n]=new e.Map),a=d();if(!a)return r;var o=i.get(a);if(o)return o;for(var s=Gr;s<Qr;s++)if(_n[s]===t&&dn[s]===a&&pn[s].length)return Mm(C(pn[s],1),!0);for(var c,l=[],u=!1,_=0,f=t.antecedents;_<f.length;_++){var g=f[_],m=void 0;if(c){_n[Qr]=t,dn[Qr]=a,pn[Qr]=l,Qr++;var y=Er;Er=void 0,m=p(g),Er=y,Qr--;var v=i.get(a);if(v)return v}else m=c=p(g);var h=Om(m);if(e.pushIfUnique(l,h),Dm(h,r)||(u=!0),h===r)break}var b=C(l,u?2:1);return Im(c)?Mm(b,!0):(i.set(a,b),b)}function C(t,n){if(function(t){for(var r=!1,n=0,i=t;n<i.length;n++){var a=i[n];if(!(131072&a.flags)){if(!(256&e.getObjectFlags(a)))return !1;r=!0;}}return r}(t))return Lm(a_(e.map(t,jm)));var i=a_(e.sameMap(t,Bm),n);return i!==r&&i.flags&r.flags&1048576&&e.arraysEqual(i.types,r.types)?r:i}function k(n,i){var a=1048576&r.flags?r:i;if(1048576&a.flags){var o=function(r){if(e.isBindingPattern(t)||e.isFunctionExpressionOrArrowFunction(t)||e.isObjectLiteralMethod(t)){if(e.isIdentifier(r)&&(i=(n=Kg(r)).valueDeclaration)&&(e.isBindingElement(i)||e.isParameter(i))&&t===i.parent&&!i.initializer&&!i.dotDotDotToken)return i}else if(e.isAccessExpression(r)){if(qg(t,r.expression))return r}else if(e.isIdentifier(r)){var n;if(ey(n=Kg(r))){var i=n.valueDeclaration;if(e.isVariableDeclaration(i)&&!i.type&&i.initializer&&e.isAccessExpression(i.initializer)&&qg(t,i.initializer.expression))return i.initializer;if(e.isBindingElement(i)&&!i.initializer){var a=i.parent.parent;if(e.isVariableDeclaration(a)&&!a.type&&a.initializer&&(e.isIdentifier(a.initializer)||e.isAccessExpression(a.initializer))&&qg(t,a.initializer))return i}}}}(n);if(o){var s=Wg(o);if(s&&Xg(a,s))return o}}}function E(t,r,n){var i=Wg(r);if(void 0===i)return t;var a=Q&&e.isOptionalChain(r)&&Hb(t,98304),o=uo(a?om(t,2097152):t,i);if(!o)return t;var s=n(o=a?jf(o):o);return km(t,(function(e){var t=function(e,t){var r;return uo(e,t)||(null===(r=ul(e,t))||void 0===r?void 0:r.type)||Ue}(e,i);return !(131072&s.flags)&&pp(s,t)}))}function F(e,t,r,n,i){if((36===r||37===r)&&1048576&e.flags){var a=Zg(e);if(a&&a===Wg(t)){var o=$g(e,Sx(n));if(o)return r===(i?36:37)?o:bf(uo(o,a)||Ue)?Em(e,o):e}}return E(e,t,(function(e){return I(e,r,n,i)}))}function A(e,r,n){if(qg(t,r))return 2&e.flags&&n?Ve:om(e,n?4194304:8388608);Q&&n&&Qg(r,t)&&(e=om(e,2097152));var i=k(r,e);return i?E(e,i,(function(e){return om(e,n?4194304:8388608)})):e}function P(n,i,a){switch(i.operatorToken.kind){case 63:case 75:case 76:case 77:return A(U(n,i.right,a),i.left,a);case 34:case 35:case 36:case 37:var o=i.operatorToken.kind,s=ym(i.left),c=ym(i.right);if(216===s.kind&&e.isStringLiteralLike(c))return O(n,s,o,c,a);if(216===c.kind&&e.isStringLiteralLike(s))return O(n,c,o,s,a);if(qg(t,s))return I(n,o,c,a);if(qg(t,c))return I(n,o,s,a);Q&&(Qg(s,t)?n=w(n,o,c,a):Qg(c,t)&&(n=w(n,o,s,a)));var l=k(s,n);if(l)return F(n,l,o,c,a);var u=k(c,n);if(u)return F(n,u,o,s,a);if(j(s))return J(n,o,c,a);if(j(c))return J(n,o,s,a);break;case 102:return function(r,n,i){var a=ym(n.left);if(!qg(t,a))return i&&Q&&Qg(a,t)?om(r,2097152):r;var o,s=Sx(n.right);if(!dp(s,jt))return r;var c=Zc(s,"prototype");if(c){var l=$o(c);_o(l)||(o=l);}if(_o(r)&&(o===Bt||o===jt))return r;if(!o){var u=el(s,1);o=u.length?a_(e.map(u,(function(e){return Nl(Ml(e))}))):St;}return !i&&1048576&s.flags&&!e.find(s.types,(function(e){return !ls(e)}))?r:z(r,o,i,dp)}(n,i,a);case 101:if(e.isPrivateIdentifier(i.left))return function(r,n,i){var a=ym(n.right);if(!qg(t,a))return r;e.Debug.assertNode(n.left,e.isPrivateIdentifier);var o=Mv(n.left);if(void 0===o)return r;var s=o.parent;return z(r,e.hasStaticModifier(e.Debug.checkDefined(o.valueDeclaration,"should always have a declaration"))?$o(s):Es(s),i,dp)}(n,i,a);var _=ym(i.right),d=sT(i.left);if(128&d.flags){var p=e.escapeLeadingUnderscores(d.value);if(Wf(n)&&e.isAccessExpression(t)&&qg(t.expression,_)&&Wg(t)===p)return om(n,a?524288:65536);if(qg(t,_))return function(t,n,i){return 1048576&t.flags||524288&t.flags&&r!==t||e.isThisTypeParameter(t)||2097152&t.flags&&e.every(t.types,(function(e){return e.symbol!==ue}))?km(t,(function(e){return function(e,t,r){var n=Zc(e,t);return n?!!(16777216&n.flags)||r:!!ul(e,t)||!r}(e,n,i)})):t}(n,p,a)}break;case 27:return U(n,i.right,a);case 55:return a?U(U(n,i.left,!0),i.right,!0):a_([U(n,i.left,!1),U(n,i.right,!1)]);case 56:return a?a_([U(n,i.left,!0),U(n,i.right,!0)]):U(U(n,i.left,!1),i.right,!1)}return n}function w(e,t,r,n){var i=34===t||36===t,a=34===t||35===t?98304:32768,o=Sx(r);return i!==n&&Cm(o,(function(e){return !!(e.flags&a)}))||i===n&&Cm(o,(function(e){return !(e.flags&(3|a))}))?om(e,2097152):e}function I(e,t,r,n){if(1&e.flags)return e;35!==t&&37!==t||(n=!n);var i=Sx(r);if(n&&2&e.flags&&(34===t||35===t)&&65536&i.flags)return a_([Qe,qe]);if(2&e.flags&&n&&(36===t||37===t))return 67239932&i.flags?i:524288&i.flags?dt:e;if(98304&i.flags){if(!Q)return e;var a=34===t||35===t?n?262144:2097152:65536&i.flags?n?131072:1048576:n?65536:524288;return 2&e.flags&&3145728&a?Ve:om(e,a)}return n?wm(km(e,34===t?function(e){return fp(e,i)||(t=i,0!=(524&e.flags)&&0!=(28&t.flags));var t;}:function(e){return fp(e,i)}),i):bf(i)?km(e,(function(e){return !(xf(e)&&fp(e,i))})):e}function O(e,r,n,i,a){35!==n&&37!==n||(a=!a);var o=ym(r.expression);if(!qg(t,o))return Q&&Qg(o,t)&&a===("undefined"!==i.text)?om(e,2097152):e;if(1&e.flags&&"function"===i.text)return e;if(a&&2&e.flags&&"object"===i.text)return e===Ve?dt:a_([dt,Qe]);var s=a?S.get(i.text)||128:T.get(i.text)||32768,c=R(e,i.text);return om(a&&c?Fm(e,B(c)):e,s)}function M(t,r,n,i,a){return n!==i&&e.every(bm(r).slice(n,i),a)?om(t,2097152):t}function L(t,r,n,i){var a=bm(r);if(!a.length)return t;var o=a.slice(n,i),s=n===i||e.contains(o,st);if(2&t.flags&&!s){for(var c=void 0,l=0;l<o.length;l+=1){var u=o[l];if(67239932&u.flags)void 0!==c&&c.push(u);else {if(!(524288&u.flags))return t;void 0===c&&(c=o.slice(0,l)),c.push(dt);}}return a_(void 0===c?o:c)}var _=a_(o),d=131072&_.flags?st:wm(km(t,(function(e){return fp(_,e)})),_);if(!s)return d;var p=km(t,(function(t){return !(xf(t)&&e.contains(a,md(function(t){return 2097152&t.flags&&e.find(t.types,bf)||t}(t))))}));return 131072&d.flags?p:a_([d,p])}function R(e,t){switch(t){case"function":return 1&e.flags?e:jt;case"object":return 2&e.flags?a_([dt,Qe]):e;default:return Cn.get(t)}}function B(e){return function(t){if(up(t,e))return t;if(up(e,t))return e;if(465829888&t.flags){var r=Mc(t)||Le;if(up(e,r))return p_([t,e])}return t}}function j(r){return (e.isPropertyAccessExpression(r)&&"constructor"===e.idText(r.name)||e.isElementAccessExpression(r)&&e.isStringLiteralLike(r.argumentExpression)&&"constructor"===r.argumentExpression.text)&&qg(t,r.expression)}function J(t,r,n,i){if(i?34!==r&&36!==r:35!==r&&37!==r)return t;var a=Sx(n);if(!MT(a)&&!ls(a))return t;var o=Zc(a,"prototype");if(!o)return t;var s=$o(o),c=_o(s)?void 0:s;return c&&c!==Bt&&c!==jt?_o(t)?c:km(t,(function(t){return n=c,524288&(r=t).flags&&1&e.getObjectFlags(r)||524288&n.flags&&1&e.getObjectFlags(n)?r.symbol===n.symbol:up(r,n);var r,n;})):t}function z(e,t,r,n){if(!r)return km(e,(function(e){return !n(e,t)}));if(1048576&e.flags){var i=km(e,(function(e){return n(e,t)}));if(!(131072&i.flags))return i}return up(t,e)?t:_p(e,t)?e:_p(t,e)?t:p_([e,t])}function K(r,n,i,a){if(n.type&&(!_o(r)||n.type!==Bt&&n.type!==jt)){var o=function(t,r){if(1===t.kind||3===t.kind)return r.arguments[t.parameterIndex];var n=e.skipParentheses(r.expression);return e.isAccessExpression(n)?e.skipParentheses(n.expression):void 0}(n,i);if(o){if(qg(t,o))return z(r,n.type,a,up);Q&&a&&Qg(o,t)&&!(65536&am(n.type))&&(r=om(r,2097152));var s=k(o,r);if(s)return E(r,s,(function(e){return z(e,n.type,a,up)}))}}return r}function U(r,n,i){if(e.isExpressionOfOptionalChainRoot(n)||e.isBinaryExpression(n.parent)&&60===n.parent.operatorToken.kind&&n.parent.left===n)return function(e,r,n){if(qg(t,r))return om(e,n?2097152:262144);var i=k(r,e);return i?E(e,i,(function(e){return om(e,n?2097152:262144)})):e}(r,n,i);switch(n.kind){case 79:if(!qg(t,n)&&N<5){var a=Kg(n);if(ey(a)){var o=a.valueDeclaration;if(o&&e.isVariableDeclaration(o)&&!o.type&&o.initializer&&Qm(t)){N++;var s=U(r,o.initializer,i);return N--,s}}}case 108:case 106:case 206:case 207:return A(r,n,i);case 208:return function(r,n,i){if(rm(n,t)){var a=i||!e.isCallChain(n)?Um(n):void 0,o=a&&kl(a);if(o&&(0===o.kind||1===o.kind))return K(r,o,n,i)}if(Wf(r)&&e.isAccessExpression(t)&&e.isPropertyAccessExpression(n.expression)){var s=n.expression;if(qg(t.expression,ym(s.expression))&&e.isIdentifier(s.name)&&"hasOwnProperty"===s.name.escapedText&&1===n.arguments.length){var c=n.arguments[0];if(e.isStringLiteralLike(c)&&Wg(t)===e.escapeLeadingUnderscores(c.text))return om(r,i?524288:65536)}}return r}(r,n,i);case 212:case 230:return U(r,n.expression,i);case 221:return P(r,n,i);case 219:if(53===n.operator)return U(r,n.operand,!i)}return r}}function Ym(t){return e.findAncestor(t.parent,(function(t){return e.isFunctionLike(t)&&!e.getImmediatelyInvokedFunctionExpression(t)||262===t.kind||305===t.kind||167===t.kind}))}function Zm(t){if(!t.valueDeclaration)return !1;var r,n=e.getRootDeclaration(t.valueDeclaration).parent,i=ni(n);return 8388608&i.flags||(i.flags|=8388608,r=n,e.findAncestor(r.parent,(function(t){return (e.isFunctionLike(t)||e.isCatchClause(t))&&!!(8388608&ni(t).flags)}))||$m(n)),t.isAssigned||!1}function $m(t){if(79===t.kind){if(e.isAssignmentTarget(t)){var r=Kg(t);e.isParameterOrCatchClauseVariable(r)&&(r.isAssigned=!0);}}else e.forEachChild(t,$m);}function ey(e){return 3&e.flags&&0!=(2&vv(e))}function ty(e){return !!(465829888&e.flags&&1146880&Lc(e).flags)}function ry(e){return !(!(465829888&e.flags)||Hb(Lc(e),98304))}function ny(t,r,n){return n&&2&n||!Tm(t,ty)||!function(e,t){var r=t.parent;return 206===r.kind||161===r.kind||208===r.kind&&r.expression===t||207===r.kind&&r.expression===t&&!(Tm(e,ry)&&L_(Sx(r.argumentExpression)))}(t,r)&&!function(t,r){var n=(e.isIdentifier(t)||e.isPropertyAccessExpression(t)||e.isElementAccessExpression(t))&&!((e.isJsxOpeningElement(t.parent)||e.isJsxSelfClosingElement(t.parent))&&t.parent.tagName===t)&&(r&&64&r?Ly(t,8):Ly(t));return n&&!O_(n)}(r,n)?t:Fm(t,(function(e){return 465829888&e.flags?Lc(e):e}))}function iy(t){return !!e.findAncestor(t,(function(t){var r=t.parent;return void 0===r?"quit":e.isExportAssignment(r)?r.expression===t&&e.isEntityNameExpression(t):!!e.isExportSpecifier(r)&&(r.name===t||r.propertyName===t)}))}function ay(t,r){if(Mi(t,111551)&&!Ug(r)&&!Ji(t)){var n=Ri(t);111551&n.flags&&(V.isolatedModules||e.shouldPreserveConstEnums(V)&&iy(r)||!TT(n)?Ki(t):function(e){var t=ri(e);t.constEnumReferenced||(t.constEnumReferenced=!0);}(t));}}function oy(t){return e.findAncestor(t,(function(t){return !t||e.nodeStartsNewLexicalEnvironment(t)?"quit":e.isIterationStatement(t,!1)}))}function sy(e,t){ni(e).flags|=2,167===t.kind||171===t.kind?ni(t.parent).flags|=4:ni(t).flags|=4;}function cy(t){return e.isSuperCall(t)?t:e.isFunctionLike(t)?void 0:e.forEachChild(t,cy)}function ly(e){return ps(Es(la(e)))===Xe}function uy(t,r,n){var i=r.parent;e.getClassExtendsHeritageElement(i)&&!ly(i)&&t.flowNode&&!Gm(t.flowNode,!1)&&Jn(t,n);}function _y(t){var r=Ug(t),n=e.getThisContainer(t,!0),i=!1;switch(171===n.kind&&uy(t,n,e.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class),214===n.kind&&(n=e.getThisContainer(n,!1),i=!0),function(t,r){e.isPropertyDeclaration(r)&&e.hasStaticModifier(r)&&r.initializer&&e.textRangeContainsPositionInclusive(r.initializer,t.pos)&&e.length(r.parent.decorators)&&Jn(t,e.Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class);}(t,n),n.kind){case 261:Jn(t,e.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);break;case 260:Jn(t,e.Diagnostics.this_cannot_be_referenced_in_current_location);break;case 171:py(t,n)&&Jn(t,e.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);break;case 162:Jn(t,e.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);}!r&&i&&q<2&&sy(t,n);var a=dy(t,!0,n);if(ee){var o=$o(ue);if(a===o&&i)Jn(t,e.Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this);else if(!a){var s=Jn(t,e.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);if(!e.isSourceFile(n)){var c=dy(n);c&&c!==o&&e.addRelatedInfo(s,e.createDiagnosticForNode(n,e.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));}}}return a||Le}function dy(t,r,n){void 0===r&&(r=!0),void 0===n&&(n=e.getThisContainer(t,!1));var i=e.isInJSFile(t);if(e.isFunctionLike(n)&&(!by(t)||e.getThisParameter(n))){var a=Cl(bl(n))||i&&function(t){var r=e.getJSDocType(t);if(r&&317===r.kind){var n=r;if(n.parameters.length>0&&n.parameters[0].name&&"this"===n.parameters[0].name.escapedText)return kd(n.parameters[0].type)}var i=e.getJSDocThisTag(t);if(i&&i.typeExpression)return kd(i.typeExpression)}(n);if(!a){var o=function(t){return 213===t.kind&&e.isBinaryExpression(t.parent)&&3===e.getAssignmentDeclarationKind(t.parent)?t.parent.left.expression.expression:169===t.kind&&205===t.parent.kind&&e.isBinaryExpression(t.parent.parent)&&6===e.getAssignmentDeclarationKind(t.parent.parent)?t.parent.parent.left.expression:213===t.kind&&296===t.parent.kind&&205===t.parent.parent.kind&&e.isBinaryExpression(t.parent.parent.parent)&&6===e.getAssignmentDeclarationKind(t.parent.parent.parent)?t.parent.parent.parent.left.expression:213===t.kind&&e.isPropertyAssignment(t.parent)&&e.isIdentifier(t.parent.name)&&("value"===t.parent.name.escapedText||"get"===t.parent.name.escapedText||"set"===t.parent.name.escapedText)&&e.isObjectLiteralExpression(t.parent.parent)&&e.isCallExpression(t.parent.parent.parent)&&t.parent.parent.parent.arguments[2]===t.parent.parent&&9===e.getAssignmentDeclarationKind(t.parent.parent.parent)?t.parent.parent.parent.arguments[0].expression:e.isMethodDeclaration(t)&&e.isIdentifier(t.name)&&("value"===t.name.escapedText||"get"===t.name.escapedText||"set"===t.name.escapedText)&&e.isObjectLiteralExpression(t.parent)&&e.isCallExpression(t.parent.parent)&&t.parent.parent.arguments[2]===t.parent&&9===e.getAssignmentDeclarationKind(t.parent.parent)?t.parent.parent.arguments[0].expression:void 0}(n);if(i&&o){var s=kx(o).symbol;s&&s.members&&16&s.flags&&(a=Es(s).thisType);}else Gh(n)&&(a=Es(ca(n.symbol)).thisType);a||(a=yy(n));}if(a)return Xm(t,a)}if(e.isClassLike(n.parent)){var c=la(n.parent);return Xm(t,e.isStatic(n)?$o(c):Es(c).thisType)}if(e.isSourceFile(n)){if(n.commonJsModuleIndicator){var l=la(n);return l&&$o(l)}if(n.externalModuleIndicator)return qe;if(r)return $o(ue)}}function py(t,r){return !!e.findAncestor(t,(function(t){return e.isFunctionLikeDeclaration(t)?"quit":164===t.kind&&t.parent===r}))}function fy(t){var r=208===t.parent.kind&&t.parent.expression===t,n=e.getSuperContainer(t,!0),i=n,a=!1;if(!r)for(;i&&214===i.kind;)i=e.getSuperContainer(i,!0),a=q<2;var o=0;if(!function(t){return !!t&&(r?171===t.kind:!(!e.isClassLike(t.parent)&&205!==t.parent.kind)&&(e.isStatic(t)?169===t.kind||168===t.kind||172===t.kind||173===t.kind||167===t.kind||170===t.kind:169===t.kind||168===t.kind||172===t.kind||173===t.kind||167===t.kind||166===t.kind||171===t.kind))}(i)){var s=e.findAncestor(t,(function(e){return e===i?"quit":162===e.kind}));return s&&162===s.kind?Jn(t,e.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name):r?Jn(t,e.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors):i&&i.parent&&(e.isClassLike(i.parent)||205===i.parent.kind)?Jn(t,e.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class):Jn(t,e.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions),je}if(r||171!==n.kind||uy(t,i,e.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class),e.isStatic(i)||r?(o=512,!r&&q>=2&&q<=8&&(e.isPropertyDeclaration(i)||e.isClassStaticBlockDeclaration(i))&&e.forEachEnclosingBlockScopeContainer(t.parent,(function(t){e.isSourceFile(t)&&!e.isExternalOrCommonJsModule(t)||(ni(t).flags|=134217728);}))):o=256,ni(t).flags|=o,169===i.kind&&e.hasSyntacticModifier(i,256)&&(e.isSuperProperty(t.parent)&&e.isAssignmentTarget(t.parent)?ni(i).flags|=4096:ni(i).flags|=2048),a&&sy(t.parent,i),205===i.parent.kind)return q<2?(Jn(t,e.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher),je):Le;var c=i.parent;if(!e.getClassExtendsHeritageElement(c))return Jn(t,e.Diagnostics.super_can_only_be_referenced_in_a_derived_class),je;var l=Es(la(c)),u=l&&gs(l)[0];return u?171===i.kind&&py(t,i)?(Jn(t,e.Diagnostics.super_cannot_be_referenced_in_constructor_arguments),je):512===o?ps(l):Hs(u,l.thisType):je}function gy(t){return 4&e.getObjectFlags(t)&&t.target===Gt?eu(t)[0]:void 0}function my(t){return Fm(t,(function(t){return 2097152&t.flags?e.forEach(t.types,gy):gy(t)}))}function yy(t){if(214!==t.kind){if(ip(t)){var r=Ky(t);if(r){var n=r.thisParameter;if(n)return $o(n)}}var i=e.isInJSFile(t);if(ee||i){var a=function(e){return 169!==e.kind&&172!==e.kind&&173!==e.kind||205!==e.parent.kind?213===e.kind&&296===e.parent.kind?e.parent.parent:void 0:e.parent}(t);if(a){for(var o=Iy(a),s=a,c=o;c;){var l=my(c);if(l)return Yd(l,yg(Ry(a)));if(296!==s.parent.kind)break;c=Iy(s=s.parent.parent);}return rg(o?Jf(o):cx(a))}var u=e.walkUpParenthesizedExpressions(t.parent);if(221===u.kind&&63===u.operatorToken.kind){var _=u.left;if(e.isAccessExpression(_)){var d=_.expression;if(i&&e.isIdentifier(d)){var p=e.getSourceFileOfNode(u);if(p.commonJsModuleIndicator&&Kg(d)===p.symbol)return}return rg(cx(d))}}}}}function vy(t){var r=t.parent;if(ip(r)){var n=e.getImmediatelyInvokedFunctionExpression(r);if(n&&n.arguments){var i=Eh(n),a=r.parameters.indexOf(t);if(t.dotDotDotToken)return xh(i,a,i.length,Le,void 0,0);var o=ni(n),s=o.resolvedSignature;o.resolvedSignature=Ir;var c=a<i.length?Tf(kx(i[a])):t.initializer?void 0:We;return o.resolvedSignature=s,c}var l=Ky(r);if(l){var u=r.parameters.indexOf(t)-(e.getThisParameter(r)?1:0);return t.dotDotDotToken&&e.lastOrUndefined(r.parameters)===t?yb(l,u):mb(l,u)}}}function hy(t){var r=e.getEffectiveTypeAnnotationNode(t);if(r)return kd(r);switch(t.kind){case 164:return vy(t);case 203:return function(t){var r=t.parent.parent,n=t.propertyName||t.name,i=hy(r)||203!==r.kind&&r.initializer&&ux(r,t.dotDotDotToken?64:0);if(i&&!e.isBindingPattern(n)&&!e.isComputedNonLiteralName(n)){if(202===r.name.kind){var a=e.indexOfNode(t.parent.elements,t);if(a<0)return;return Ay(i,a)}var o=v_(n);return Rs(o)?uo(i,Ks(o)):void 0}}(t);case 167:if(e.isStatic(t))return function(t){var r=e.isExpression(t.parent)&&Ly(t.parent);return r?Ey(r,la(t).escapedName):void 0}(t)}}function by(t){for(var r=!1;t.parent&&!e.isFunctionLike(t.parent);){if(e.isParameter(t.parent)&&(r||t.parent.initializer===t))return !0;e.isBindingElement(t.parent)&&t.parent.initializer===t&&(r=!0),t=t.parent;}return !1}function xy(t,r){var n=!!(2&e.getFunctionFlags(r)),i=Dy(r);if(i)return lS(t,i,n)||void 0}function Dy(t){var r=Fl(t);if(r)return r;var n=zy(t);if(n&&!Al(n))return Nl(n);var i=e.getImmediatelyInvokedFunctionExpression(t);return i?Ly(i):void 0}function Sy(e,t){var r=Eh(e).indexOf(t);return -1===r?void 0:Ty(e,r)}function Ty(t,r){if(e.isImportCall(t))return 0===r?Ye:1===r?Eu(!1):Le;var n=ni(t).resolvedSignature===Mr?Mr:Hh(t);if(e.isJsxOpeningLikeElement(t)&&0===r)return By(n,t);var i=n.parameters.length-1;return J(n)&&r>=i?K_($o(n.parameters[i]),hd(r-i),256):gb(n,r)}function Cy(t,r){if(void 0===r&&(r=e.getAssignmentDeclarationKind(t)),4===r)return !0;if(!e.isInJSFile(t)||5!==r||!e.isIdentifier(t.left.expression))return !1;var n=t.left.expression.escapedText,i=li(t.left,n,111551,void 0,void 0,!0,!0);return e.isThisInitializedDeclaration(null==i?void 0:i.valueDeclaration)}function ky(t){if(!t.symbol)return Sx(t.left);if(t.symbol.valueDeclaration){var r=e.getEffectiveTypeAnnotationNode(t.symbol.valueDeclaration);if(r){var n=kd(r);if(n)return n}}var i=e.cast(t.left,e.isAccessExpression);if(e.isObjectLiteralMethod(e.getThisContainer(i.expression,!1))){var a=_y(i.expression),o=e.getElementOrPropertyAccessName(i);return void 0!==o&&Ey(a,o)||void 0}}function Ey(t,r,n){return Fm(t,(function(t){var i,a;if(Sc(t)&&!t.declaration.nameType){var o=fc(t),s=Mc(o)||o,c=n||vd(e.unescapeLeadingUnderscores(r));if(_p(c,s))return z_(t,c)}else if(3670016&t.flags){var l=Zc(t,r);if(l)return a=l,262144&e.getCheckFlags(a)&&!a.type&&oo(a,0)>=0?void 0:$o(l);if(Nf(t)){var u=Pf(t);if(u&&e.isNumericLiteralName(r)&&+r>=0)return u}return null===(i=rl(il(t),n||vd(e.unescapeLeadingUnderscores(r))))||void 0===i?void 0:i.type}}),!0)}function Ny(t,r){if(e.Debug.assert(e.isObjectLiteralMethod(t)),!(33554432&t.flags))return Fy(t,r)}function Fy(t,r){var n=t.parent,i=e.isPropertyAssignment(t)&&hy(t);if(i)return i;var a=Iy(n,r);if(a){if(zs(t)){var o=la(t);return Ey(a,o.escapedName,ri(o).nameType)}if(t.name){var s=v_(t.name);return Fm(a,(function(e){var t;return null===(t=rl(il(e),s))||void 0===t?void 0:t.type}),!0)}}}function Ay(e,t){return e&&(Ey(e,""+t)||Fm(e,(function(e){return KD(1,e,qe,void 0,!1)}),!0))}function Py(t){if(e.isJsxAttribute(t)){var r=Iy(t.parent);if(!r||_o(r))return;return Ey(r,t.name.escapedText)}return Ly(t.parent)}function wy(e){switch(e.kind){case 10:case 8:case 9:case 14:case 110:case 95:case 104:case 79:case 153:return !0;case 206:case 212:return wy(e.expression);case 288:return !e.expression||wy(e.expression)}return !1}function Iy(t,r){var n=Oy(e.isObjectLiteralMethod(t)?Ny(t,r):Ly(t,r),t,r);if(n&&!(r&&2&r&&8650752&n.flags)){var i=Fm(n,Kc,!0);return 1048576&i.flags&&e.isObjectLiteralExpression(t)?function(t,r){return function(t,r){var n=Zg(t),i=n&&e.find(r.properties,(function(e){return e.symbol&&296===e.kind&&e.symbol.escapedName===n&&wy(e.initializer)})),a=i&&Cx(i.initializer);return a&&$g(t,a)}(r,t)||zp(r,e.concatenate(e.map(e.filter(t.properties,(function(e){return !!e.symbol&&296===e.kind&&wy(e.initializer)&&Xg(r,e.symbol.escapedName)})),(function(e){return [function(){return Cx(e.initializer)},e.symbol.escapedName]})),e.map(e.filter(Nc(r),(function(e){var n;return !!(16777216&e.flags)&&!!(null===(n=null==t?void 0:t.symbol)||void 0===n?void 0:n.members)&&!t.symbol.members.has(e.escapedName)&&Xg(r,e.escapedName)})),(function(e){return [function(){return qe},e.escapedName]}))),_p,r)}(t,i):1048576&i.flags&&e.isJsxAttributes(t)?function(t,r){return zp(r,e.concatenate(e.map(e.filter(t.properties,(function(e){return !!e.symbol&&285===e.kind&&Xg(r,e.symbol.escapedName)&&(!e.initializer||wy(e.initializer))})),(function(e){return [e.initializer?function(){return Cx(e.initializer)}:function(){return rt},e.symbol.escapedName]})),e.map(e.filter(Nc(r),(function(e){var n;return !!(16777216&e.flags)&&!!(null===(n=null==t?void 0:t.symbol)||void 0===n?void 0:n.members)&&!t.symbol.members.has(e.escapedName)&&Xg(r,e.escapedName)})),(function(e){return [function(){return qe},e.escapedName]}))),_p,r)}(t,i):i}}function Oy(t,r,n){if(t&&Hb(t,465829888)){var i=Ry(r);if(i&&e.some(i.inferences,hx)){if(n&&1&n)return My(t,i.nonFixingMapper);if(i.returnMapper){var a=My(t,i.returnMapper);return 1048576&a.flags&&$u(a.types,tt)&&$u(a.types,nt)?km(a,(function(e){return e!==tt&&e!==nt})):a}}}return t}function My(t,r){return 465829888&t.flags?Yd(t,r):1048576&t.flags?a_(e.map(t.types,(function(e){return My(e,r)})),0):2097152&t.flags?p_(e.map(t.types,(function(e){return My(e,r)}))):t}function Ly(t,r){if(33554432&t.flags);else {if(t.contextualType)return t.contextualType;var n=t.parent;switch(n.kind){case 254:case 164:case 167:case 166:case 203:return function(t,r){var n=t.parent;if(e.hasInitializer(n)&&t===n.initializer){var i=hy(n);if(i)return i;if(!(8&r)&&e.isBindingPattern(n.name))return Bo(n.name,!0,!1)}}(t,r);case 214:case 247:return function(t){var r=e.getContainingFunction(t);if(r){var n=Dy(r);if(n){var i=e.getFunctionFlags(r);if(1&i){var a=GD(n,2&i?2:1,void 0);if(!a)return;n=a.returnType;}if(2&i){var o=Fm(n,$x);return o&&a_([o,Fb(o)])}return n}}}(t);case 224:return function(t){var r=e.getContainingFunction(t);if(r){var n=e.getFunctionFlags(r),i=Dy(r);if(i)return t.asteriskToken?i:lS(0,i,0!=(2&n))}}(n);case 218:return function(e,t){var r=Ly(e,t);if(r){var n=$x(r);return n&&a_([n,Fb(n)])}}(n,r);case 208:case 209:return Sy(n,t);case 211:case 229:return e.isConstTypeReference(n.type)?o(n):kd(n.type);case 221:return function(t,r){var n=t.parent,i=n.left,a=n.operatorToken,o=n.right;switch(a.kind){case 63:case 76:case 75:case 77:return t===o?function(t){var r,n,i=e.getAssignmentDeclarationKind(t);switch(i){case 0:case 4:var a=function(t){if(t.symbol)return t.symbol;if(e.isIdentifier(t))return Kg(t);if(e.isPropertyAccessExpression(t)){var r=Sx(t.expression);return e.isPrivateIdentifier(t.name)?function(e,t){var r=Ov(t.escapedText,t);return r&&Lv(e,r)}(r,t.name):Zc(r,t.name.escapedText)}}(t.left),o=a&&a.valueDeclaration;return o&&(e.isPropertyDeclaration(o)||e.isPropertySignature(o))?(c=e.getEffectiveTypeAnnotationNode(o))&&Yd(kd(c),ri(a).mapper)||o.initializer&&Sx(t.left):0===i?Sx(t.left):ky(t);case 5:if(Cy(t,i))return ky(t);if(t.left.symbol){var s=t.left.symbol.valueDeclaration;if(!s)return;var c,l=e.cast(t.left,e.isAccessExpression);if(c=e.getEffectiveTypeAnnotationNode(s))return kd(c);if(e.isIdentifier(l.expression)){var u=l.expression,_=li(u,u.escapedText,111551,void 0,u.escapedText,!0);if(_){var d=_.valueDeclaration&&e.getEffectiveTypeAnnotationNode(_.valueDeclaration);if(d){var p=e.getElementOrPropertyAccessName(l);if(void 0!==p)return Ey(kd(d),p)}return}}return e.isInJSFile(s)?void 0:Sx(t.left)}return Sx(t.left);case 1:case 6:case 3:var f=null===(r=t.left.symbol)||void 0===r?void 0:r.valueDeclaration;case 2:f||(f=null===(n=t.symbol)||void 0===n?void 0:n.valueDeclaration);var g=f&&e.getEffectiveTypeAnnotationNode(f);return g?kd(g):void 0;case 7:case 8:case 9:return e.Debug.fail("Does not apply");default:return e.Debug.assertNever(i)}}(n):void 0;case 56:case 60:var s=Ly(n,r);return t===o&&(s&&s.pattern||!s&&!e.isDefaultedExpandoInitializer(n))?Sx(i):s;case 55:case 27:return t===o?Ly(n,r):void 0;default:return}}(t,r);case 296:case 297:return Fy(n,r);case 298:return Ly(n.parent,r);case 204:var i=n;return Ay(Iy(i,r),e.indexOfNode(i.elements,t));case 222:return function(e,t){var r=e.parent;return e===r.whenTrue||e===r.whenFalse?Ly(r,t):void 0}(t,r);case 233:return e.Debug.assert(223===n.parent.kind),function(e,t){if(210===e.parent.kind)return Sy(e.parent,t)}(n.parent,t);case 212:var a=e.isInJSFile(n)?e.getJSDocTypeTag(n):void 0;return a?e.isJSDocTypeTag(a)&&e.isConstTypeReference(a.typeExpression.type)?o(n):kd(a.typeExpression.type):Ly(n,r);case 230:return Ly(n,r);case 271:return Ko(n);case 288:return function(t){var r=t.parent;return e.isJsxAttributeLike(r)?Ly(t):e.isJsxElement(r)?function(t,r){var n=Iy(t.openingElement.tagName),i=cv(ov(t));if(n&&!_o(n)&&i&&""!==i){var a=e.getSemanticJsxChildren(t.children),o=a.indexOf(r),s=Ey(n,i);return s&&(1===a.length?s:Fm(s,(function(e){return pf(e)?K_(e,hd(o)):e}),!0))}}(r,t):void 0}(n);case 285:case 287:return Py(n);case 280:case 279:return function(t,r){return e.isJsxOpeningElement(t)&&t.parent.contextualType&&4!==r?t.parent.contextualType:Ty(t,0)}(n,r)}}function o(e){return Ly(e)}}function Ry(t){var r=e.findAncestor(t,(function(e){return !!e.inferenceContext}));return r&&r.inferenceContext}function By(t,r){return 0!==Sh(r)?function(e,t){var r=Tb(e,Ue);r=jy(t,ov(t),r);var n=nv(A.IntrinsicAttributes,t);return po(n)||(r=ac(n,r)),r}(t,r):function(t,r){var n,i=ov(r),a=(n=i,sv(A.ElementAttributesPropertyNameContainer,n)),o=void 0===a?Tb(t,Ue):""===a?Nl(t):function(e,t){if(e.compositeSignatures){for(var r=[],n=0,i=e.compositeSignatures;n<i.length;n++){var a=Nl(i[n]);if(_o(a))return a;var o=uo(a,t);if(!o)return;r.push(o);}return p_(r)}var s=Nl(e);return _o(s)?s:uo(s,t)}(t,a);if(!o)return a&&e.length(r.attributes.properties)&&Jn(r,e.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property,e.unescapeLeadingUnderscores(a)),Ue;if(_o(o=jy(r,i,o)))return o;var s=o,c=nv(A.IntrinsicClassAttributes,r);if(!po(c)){var l=ss(c.symbol),u=Nl(t);s=ac(l?Yl(c,hl([u],l,vl(l),e.isInJSFile(r))):c,s);}var _=nv(A.IntrinsicAttributes,r);return po(_)||(s=ac(_,s)),s}(t,r)}function jy(t,r,n){var i,a=(i=r)&&ai(i.exports,A.LibraryManagedAttributes,788968);if(a){var o=Es(a),s=function(e){if($y(e.tagName))return Rl(Vh(e,t=_v(e)));var t,r=cx(e.tagName);return 128&r.flags?(t=uv(r,e))?Rl(Vh(e,t)):je:r}(t);if(524288&a.flags){var c=ri(a).typeParameters;if(e.length(c)>=2)return nu(a,hl([s,n],c,2,e.isInJSFile(t)))}if(e.length(o.typeParameters)>=2)return Yl(o,hl([s,n],o.typeParameters,2,e.isInJSFile(t)))}return n}function Jy(t,r){var n=el(t,0),i=e.filter(n,(function(t){return !function(t,r){for(var n=0;n<r.parameters.length;n++){var i=r.parameters[n];if(i.initializer||i.questionToken||i.dotDotDotToken||pl(i))break}return r.parameters.length&&e.parameterIsThisKeyword(r.parameters[0])&&n--,!bb(t)&&vb(t)<n}(t,r)}));return 1===i.length?i[0]:function(t){return e.getStrictOptionValue(V,"noImplicitAny")?e.reduceLeft(t,(function(t,r){return t!==r&&t?nc(t.typeParameters,r.typeParameters)?function(t,r){var n,i=t.typeParameters||r.typeParameters;t.typeParameters&&r.typeParameters&&(n=wd(r.typeParameters,t.typeParameters));var a=t.declaration,o=function(e,t,r){for(var n=vb(e),i=vb(t),a=n>=i?e:t,o=a===e?t:e,s=a===e?n:i,c=bb(e)||bb(t),l=c&&!bb(a),u=new Array(s+(l?1:0)),_=0;_<s;_++){var d=mb(a,_);a===t&&(d=Yd(d,r));var p=mb(o,_)||Ue;o===t&&(p=Yd(p,r));var f=a_([d,p]),g=c&&!l&&_===s-1,m=_>=hb(a)&&_>=hb(o),y=_>=n?void 0:_b(e,_),v=_>=i?void 0:_b(t,_),h=Hn(1|(m&&!g?16777216:0),(y===v?y:y?v?void 0:y:v)||"arg".concat(_));h.type=g?Bu(f):f,u[_]=h;}if(l){var b=Hn(1,"args");b.type=Bu(gb(o,s)),o===t&&(b.type=Yd(b.type,r)),u[s]=b;}return u}(t,r,n),s=Qs(a,i,function(e,t,r){return e&&t?Qf(e,a_([$o(e),Yd($o(t),r)])):e||t}(t.thisParameter,r.thisParameter,n),o,void 0,void 0,Math.max(t.minArgumentCount,r.minArgumentCount),39&(t.flags|r.flags));return s.compositeKind=2097152,s.compositeSignatures=e.concatenate(2097152===t.compositeKind&&t.compositeSignatures||[t],[r]),n&&(s.mapper=2097152===t.compositeKind&&t.mapper&&t.compositeSignatures?Bd(t.mapper,n):n),s}(t,r):void 0:t})):void 0}(i)}function zy(t){return e.isFunctionExpressionOrArrowFunction(t)||e.isObjectLiteralMethod(t)?Ky(t):void 0}function Ky(t){e.Debug.assert(169!==t.kind||e.isObjectLiteralMethod(t));var r=xl(t);if(r)return r;var n=Iy(t,1);if(n){if(!(1048576&n.flags))return Jy(n,t);for(var i,a=0,o=n.types;a<o.length;a++){var s=Jy(o[a],t);if(s)if(i){if(!of(i[0],s,!1,!0,!0,sp))return;i.push(s);}else i=[s];}return i?1===i.length?i[0]:Ys(i[0],i):void 0}}function Uy(e){return 203===e.kind&&!!e.initializer||221===e.kind&&63===e.operatorToken.kind}function Vy(t,r,n){for(var i=t.elements,a=i.length,o=[],s=[],c=Iy(t),l=e.isAssignmentTarget(t),u=px(t),_=!1,d=0;d<a;d++){var p=i[d];if(225===p.kind){q<2&&GT(p,V.downlevelIteration?1536:1024);var f=kx(p.expression,r,n);if(pf(f))o.push(f),s.push(8);else if(l){var g=sl(f,Ze)||KD(65,f,qe,void 0,!1)||Ue;o.push(g),s.push(4);}else o.push(zD(33,f,qe,p.expression)),s.push(4);}else if(ie&&227===p.kind)_=!0,o.push(Ge),s.push(2);else {var m=fx(p,r,Ay(c,o.length),n);if(o.push(Co(m,!0,_)),s.push(_?2:1),c&&Tm(c,yf)&&r&&2&r&&!(4&r)&&rp(p)){var y=Ry(t);e.Debug.assert(y),pg(y,p,m);}}}return l?Vu(o,s):n||u||c&&Tm(c,yf)?qy(Vu(o,s,u)):qy(Bu(o.length?a_(e.sameMap(o,(function(e,t){return 8&s[t]?V_(e,Ze)||Le:e})),2):Q?ut:We,u))}function qy(t){if(!(4&e.getObjectFlags(t)))return t;var r=t.literalType;return r||((r=t.literalType=Zl(t)).objectFlags|=147456),r}function Wy(t){switch(t.kind){case 162:return function(e){return Gb(Hy(e),296)}(t);case 79:return e.isNumericLiteralName(t.escapedText);case 8:case 10:return e.isNumericLiteralName(t.text);default:return !1}}function Hy(t){var r=ni(t.expression);if(!r.resolvedType){if((e.isTypeLiteralNode(t.parent.parent)||e.isClassLike(t.parent.parent)||e.isInterfaceDeclaration(t.parent.parent))&&e.isBinaryExpression(t.expression)&&101===t.expression.operatorToken.kind&&172!==t.parent.kind&&173!==t.parent.kind)return r.resolvedType=je;if(r.resolvedType=kx(t.expression),e.isPropertyDeclaration(t.parent)&&!e.hasStaticModifier(t.parent)&&e.isClassExpression(t.parent.parent)){var n=oy(e.getEnclosingBlockScopeContainer(t.parent.parent));n&&(ni(n).flags|=65536,ni(t).flags|=524288,ni(t.parent.parent).flags|=524288);}(98304&r.resolvedType.flags||!Gb(r.resolvedType,402665900)&&!_p(r.resolvedType,ft))&&Jn(t,e.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);}return r.resolvedType}function Gy(t){var r,n=null===(r=t.declarations)||void 0===r?void 0:r[0];return e.isKnownSymbol(t)||n&&e.isNamedDeclaration(n)&&e.isComputedPropertyName(n.name)&&Gb(Hy(n.name),4096)}function Qy(t,r,n,i){for(var a,o,s,c=[],l=r;l<n.length;l++){var u=n[l];(i===Ye&&!Gy(u)||i===Ze&&(s=null===(o=(a=u).declarations)||void 0===o?void 0:o[0],e.isNumericLiteralName(a.escapedName)||s&&e.isNamedDeclaration(s)&&Wy(s.name))||i===at&&Gy(u))&&c.push($o(n[l]));}return Jl(i,c.length?a_(c,2):qe,px(t))}function Xy(t){e.Debug.assert(0!=(2097152&t.flags),"Should only get Alias here.");var r=ri(t);if(!r.immediateTarget){var n=xi(t);if(!n)return e.Debug.fail();r.immediateTarget=Oi(n,!0);}return r.immediateTarget}function Yy(t){var r=Lf(Fm(t,Lc));return !!(126615553&r.flags||3145728&r.flags&&e.every(r.types,Yy))}function Zy(t){return e.stringContains(t,"-")}function $y(t){return 79===t.kind&&e.isIntrinsicJsxName(t.escapedText)}function ev(e,t){return e.initializer?fx(e.initializer,t):rt}function tv(e,t){for(var r=[],n=0,i=e.children;n<i.length;n++){var a=i[n];if(11===a.kind)a.containsOnlyTriviaWhiteSpaces||r.push(Ye);else {if(288===a.kind&&!a.expression)continue;r.push(fx(a,t));}}return r}function rv(t,r,n){for(var i=0,a=Nc(t);i<a.length;i++){var o=a[i];if(!(16777216&o.flags)){var s=r.get(o.escapedName);if(s){var c=Jn(s.valueDeclaration,e.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten,e.unescapeLeadingUnderscores(s.escapedName));e.addRelatedInfo(c,e.createDiagnosticForNode(n,e.Diagnostics.This_spread_always_overwrites_this_property));}}}}function nv(e,t){var r=ov(t),n=r&&ia(r),i=n&&ai(n,e,788968);return i?Es(i):je}function iv(t){var r=ni(t);if(!r.resolvedSymbol){var n=nv(A.IntrinsicElements,t);if(po(n))return $&&Jn(t,e.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists,e.unescapeLeadingUnderscores(A.IntrinsicElements)),r.resolvedSymbol=we;if(!e.isIdentifier(t.tagName))return e.Debug.fail();var i=Zc(n,t.tagName.escapedText);return i?(r.jsxFlags|=1,r.resolvedSymbol=i):sl(n,Ye)?(r.jsxFlags|=2,r.resolvedSymbol=n.symbol):(Jn(t,e.Diagnostics.Property_0_does_not_exist_on_type_1,e.idText(t.tagName),"JSX."+A.IntrinsicElements),r.resolvedSymbol=we)}return r.resolvedSymbol}function av(t){var r=t&&e.getSourceFileOfNode(t),n=r&&ni(r);if(!n||!1!==n.jsxImplicitImportContainer){if(n&&n.jsxImplicitImportContainer)return n.jsxImplicitImportContainer;var i=e.getJSXRuntimeImport(e.getJSXImplicitImportBase(V,r),V);if(i){var a=Qi(t,i,e.getEmitModuleResolutionKind(V)===e.ModuleResolutionKind.Classic?e.Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option:e.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations,t),o=a&&a!==we?ca(Li(a)):void 0;return n&&(n.jsxImplicitImportContainer=o||!1),o}}}function ov(e){var t=e&&ni(e);if(t&&t.jsxNamespace)return t.jsxNamespace;if(!t||!1!==t.jsxNamespace){var r=av(e);if(!r||r===we){var n=Mn(e);r=li(e,n,1920,void 0,n,!1);}if(r){var i=Li(ai(ia(Li(r)),A.JSX,1920));if(i&&i!==we)return t&&(t.jsxNamespace=i),i}t&&(t.jsxNamespace=!1);}var a=Li(Su(A.JSX,1920,void 0));return a!==we?a:void 0}function sv(t,r){var n=r&&ai(r.exports,t,788968),i=n&&Es(n),a=i&&Nc(i);if(a){if(0===a.length)return "";if(1===a.length)return a[0].escapedName;a.length>1&&n.declarations&&Jn(n.declarations[0],e.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property,e.unescapeLeadingUnderscores(t));}}function cv(e){return sv(A.ElementChildrenAttributeNameContainer,e)}function lv(t,r){if(4&t.flags)return [Ir];if(128&t.flags){var n=uv(t,r);return n?[Vh(r,n)]:(Jn(r,e.Diagnostics.Property_0_does_not_exist_on_type_1,t.value,"JSX."+A.IntrinsicElements),e.emptyArray)}var i=Kc(t),a=el(i,1);return 0===a.length&&(a=el(i,0)),0===a.length&&1048576&i.flags&&(a=rc(e.map(i.types,(function(e){return lv(e,r)})))),a}function uv(t,r){var n=nv(A.IntrinsicElements,r);if(!po(n)){var i=t.value,a=Zc(n,e.escapeLeadingUnderscores(i));return a?$o(a):sl(n,Ye)||void 0}return Le}function _v(t){e.Debug.assert($y(t.tagName));var r=ni(t);if(!r.resolvedJsxElementAttributesType){var n=iv(t);return 1&r.jsxFlags?r.resolvedJsxElementAttributesType=$o(n)||je:2&r.jsxFlags?r.resolvedJsxElementAttributesType=sl(nv(A.IntrinsicElements,t),Ye)||je:r.resolvedJsxElementAttributesType=je}return r.resolvedJsxElementAttributesType}function dv(e){var t=nv(A.ElementClass,e);if(!po(t))return t}function pv(e){return nv(A.Element,e)}function fv(e){var t=pv(e);if(t)return a_([t,Qe])}function gv(t){var r,n=e.isJsxOpeningLikeElement(t);if(n&&function(t){(function(t){if(e.isPropertyAccessExpression(t)){var r=t;do{var n=a(r.name);if(n)return n;r=r.expression;}while(e.isPropertyAccessExpression(r));var i=a(r);if(i)return i}function a(t){if(e.isIdentifier(t)&&-1!==e.idText(t).indexOf(":"))return DC(t,e.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names)}})(t.tagName),rC(t,t.typeArguments);for(var r=new e.Map,n=0,i=t.attributes.properties;n<i.length;n++){var a=i[n];if(287!==a.kind){var o=a.name,s=a.initializer;if(r.get(o.escapedText))return DC(o,e.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);if(r.set(o.escapedText,!0),s&&288===s.kind&&!s.expression)return DC(s,e.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression)}}}(t),r=t,0===(V.jsx||0)&&Jn(r,e.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided),void 0===pv(r)&&$&&Jn(r,e.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist),!av(t)){var i=Sn&&2===V.jsx?e.Diagnostics.Cannot_find_name_0:void 0,a=Mn(t),o=n?t.tagName:t,s=void 0;if(e.isJsxOpeningFragment(t)&&"null"===a||(s=li(o,a,111551,i,a,!0)),s&&(s.isReferenced=67108863,2097152&s.flags&&!Ji(s)&&Ki(s)),e.isJsxOpeningFragment(t)){var c=Ln(e.getSourceFileOfNode(t));c&&li(o,c,111551,i,c,!0);}}if(n){var l=t,u=Hh(l);Yh(u,t),function(t,r,n){if(1===t)(i=fv(n))&&Lp(r,i,Fn,n.tagName,e.Diagnostics.Its_return_type_0_is_not_a_valid_JSX_element,o);else if(0===t)(a=dv(n))&&Lp(r,a,Fn,n.tagName,e.Diagnostics.Its_instance_type_0_is_not_a_valid_JSX_element,o);else {var i=fv(n),a=dv(n);if(!i||!a)return;Lp(r,a_([i,a]),Fn,n.tagName,e.Diagnostics.Its_element_type_0_is_not_a_valid_JSX_element,o);}function o(){var t=e.getTextOfNode(n.tagName);return e.chainDiagnosticMessages(void 0,e.Diagnostics._0_cannot_be_used_as_a_JSX_component,t)}}(Sh(l),Nl(u),l);}}function mv(e,t,r){if(524288&e.flags){if(kc(e,t)||ul(e,t)||js(t)&&ol(e,Ye)||r&&Zy(t))return !0}else if(3145728&e.flags&&yv(e))for(var n=0,i=e.types;n<i.length;n++)if(mv(i[n],t,r))return !0;return !1}function yv(t){return !!(524288&t.flags&&!(512&e.getObjectFlags(t))||67108864&t.flags||1048576&t.flags&&e.some(t.types,yv)||2097152&t.flags&&e.every(t.types,yv))}function vv(t){return t.valueDeclaration?e.getCombinedNodeFlags(t.valueDeclaration):0}function hv(t){if(8192&t.flags||4&e.getCheckFlags(t))return !0;if(e.isInJSFile(t.valueDeclaration)){var r=t.valueDeclaration.parent;return r&&e.isBinaryExpression(r)&&3===e.getAssignmentDeclarationKind(r)}}function bv(e,t,r,n,i,a){return void 0===a&&(a=!0),xv(e,t,r,n,i,a?161===e.kind?e.right:200===e.kind?e:203===e.kind&&e.propertyName?e.propertyName:e.name:void 0)}function xv(t,r,n,i,a,o){var s,c,l=e.getDeclarationModifierFlagsFromSymbol(a,n);if(r){if(q<2&&Dv(a))return o&&Jn(o,e.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword),!1;if(128&l)return o&&Jn(o,e.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,Ua(a),qa($p(a))),!1}if(128&l&&Dv(a)&&(e.isThisProperty(t)||e.isThisInitializedObjectBindingExpression(t)||e.isObjectBindingPattern(t.parent)&&e.isThisInitializedDeclaration(t.parent.parent))&&(c=e.getClassLikeDeclarationOfSymbol(ua(a)))&&(s=t,e.findAncestor(s,(function(t){return !!(e.isConstructorDeclaration(t)&&e.nodeIsPresent(t.body)||e.isPropertyDeclaration(t))||!(!e.isClassLike(t)&&!e.isFunctionLikeDeclaration(t))&&"quit"}))))return o&&Jn(o,e.Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,Ua(a),e.getTextOfIdentifierOrLiteral(c.name)),!1;if(!(24&l))return !0;if(8&l)return !!rT(t,c=e.getClassLikeDeclarationOfSymbol(ua(a)))||(o&&Jn(o,e.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,Ua(a),qa($p(a))),!1);if(r)return !0;var u=tT(t,(function(e){return tf(Es(la(e)),a,n)}));return !u&&(u=(u=function(t){var r=function(t){var r=e.getThisContainer(t,!1);return r&&e.isFunctionLike(r)?e.getThisParameter(r):void 0}(t),n=(null==r?void 0:r.type)&&kd(r.type);if(n&&262144&n.flags&&(n=Ac(n)),n&&7&e.getObjectFlags(n))return rs(n)}(t))&&tf(u,a,n),32&l||!u)?(o&&Jn(o,e.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,Ua(a),qa($p(a)||i)),!1):!!(32&l)||(262144&i.flags&&(i=i.isThisType?Ac(i):Mc(i)),!(!i||!ns(i,u))||(o&&Jn(o,e.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,Ua(a),qa(u),qa(i)),!1))}function Dv(e){return !!Zp(e,(function(e){return !(8192&e.flags)}))}function Sv(e){return Fv(kx(e),e)}function Tv(e){return !!(98304&(Q?Mf(e):e.flags))}function Cv(e){return Tv(e)?Jf(e):e}function kv(t,r){Jn(t,32768&r?65536&r?e.Diagnostics.Object_is_possibly_null_or_undefined:e.Diagnostics.Object_is_possibly_undefined:e.Diagnostics.Object_is_possibly_null);}function Ev(t,r){Jn(t,32768&r?65536&r?e.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined:e.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined:e.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);}function Nv(t,r,n){if(Q&&2&t.flags)return Jn(r,e.Diagnostics.Object_is_of_type_unknown),je;var i=98304&(Q?Mf(t):t.flags);if(i){n(r,i);var a=Jf(t);return 229376&a.flags?je:a}return t}function Fv(e,t){return Nv(e,t,kv)}function Av(t,r){var n=Fv(t,r);return 16384&n.flags&&Jn(r,e.Diagnostics.Object_is_possibly_undefined),n}function Pv(e,t){return 32&e.flags?function(e,t){var r=kx(e.expression),n=Vf(r,e.expression);return Uf(Bv(e,e.expression,Fv(n,e.expression),e.name,t),e,n!==r)}(e,t):Bv(e,e.expression,Sv(e.expression),e.name,t)}function wv(t,r){var n=e.isPartOfTypeQuery(t)&&e.isThisIdentifier(t.left)?Fv(_y(t.left),t.left):Sv(t.left);return Bv(t,t.left,n,t.right,r)}function Iv(t){for(;212===t.parent.kind;)t=t.parent;return e.isCallOrNewExpression(t.parent)&&t.parent.expression===t}function Ov(t,r){for(var n=e.getContainingClass(r);n;n=e.getContainingClass(n)){var i=n.symbol,a=e.getSymbolNameForPrivateIdentifier(i,t),o=i.members&&i.members.get(a)||i.exports&&i.exports.get(a);if(o)return o}}function Mv(t){if(e.isExpressionNode(t)){var r=ni(t);return void 0===r.resolvedSymbol&&(r.resolvedSymbol=Ov(t.escapedText,t)),r.resolvedSymbol}}function Lv(e,t){return Zc(e,t.escapedName)}function Rv(t,r){return (Eo(r)||e.isThisProperty(t)&&No(r))&&e.getThisContainer(t,!0)===Fo(r)}function Bv(t,r,n,i,a){var o,s,c=ni(r).resolvedSymbol,u=e.getAssignmentTargetKind(t),_=Kc(0!==u||Iv(t)?rg(n):n),d=_o(_)||_===ct;if(e.isPrivateIdentifier(i)){q<99&&(0!==u&&GT(t,1048576),1!==u&&GT(t,524288));var p=Ov(i.escapedText,i);if(u&&p&&p.valueDeclaration&&e.isMethodDeclaration(p.valueDeclaration)&&DC(i,e.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable,e.idText(i)),d){if(p)return po(_)?je:_;if(!e.getContainingClass(i))return DC(i,e.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies),Le}if(!(o=p?Lv(n,p):void 0)&&function(t,r,n){var i,a=Nc(t);a&&e.forEach(a,(function(t){var n=t.valueDeclaration;if(n&&e.isNamedDeclaration(n)&&e.isPrivateIdentifier(n.name)&&n.name.escapedText===r.escapedText)return i=t,!0}));var o=fi(r);if(i){var s=e.Debug.checkDefined(i.valueDeclaration),c=e.Debug.checkDefined(e.getContainingClass(s));if(null==n?void 0:n.valueDeclaration){var u=n.valueDeclaration,_=e.getContainingClass(u);if(e.Debug.assert(!!_),e.findAncestor(_,(function(e){return c===e}))){var d=Jn(r,e.Diagnostics.The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling,o,qa(t));return e.addRelatedInfo(d,e.createDiagnosticForNode(u,e.Diagnostics.The_shadowing_declaration_of_0_is_defined_here,o),e.createDiagnosticForNode(s,e.Diagnostics.The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here,o)),!0}}return Jn(r,e.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier,o,fi(c.name||l)),!0}return !1}(n,i,p))return je;o&&65536&o.flags&&!(32768&o.flags)&&1!==u&&Jn(t,e.Diagnostics.Private_accessor_was_defined_without_a_getter);}else {if(d)return e.isIdentifier(r)&&c&&ay(c,t),po(_)?je:_;o=Zc(_,i.escapedText);}if(e.isIdentifier(r)&&c&&(V.isolatedModules||!o||!(TT(o)||8&o.flags&&299===t.parent.kind)||e.shouldPreserveConstEnums(V)&&iy(t))&&ay(c,t),o){qn(o)&&F_(t,o)&&o.declarations&&Wn(i,o.declarations,i.escapedText),function(t,r,n){var i,a=t.valueDeclaration;if(a&&!e.getSourceFileOfNode(r).isDeclarationFile){var o=e.idText(n);!zv(r)||function(t){return e.isPropertyDeclaration(t)&&t.questionToken}(a)||e.isAccessExpression(r)&&e.isAccessExpression(r.expression)||oi(a,n)||e.isMethodDeclaration(a)&&32&e.getCombinedModifierFlags(a)||!V.useDefineForClassFields&&function(e){if(!(32&e.parent.flags))return !1;for(var t=$o(e.parent);;){if(!(t=t.symbol&&Kv(t)))return !1;var r=Zc(t,e.escapedName);if(r&&r.valueDeclaration)return !0}}(t)?257!==a.kind||178===r.parent.kind||16777216&a.flags||oi(a,n)||(i=Jn(n,e.Diagnostics.Class_0_used_before_its_declaration,o)):i=Jn(n,e.Diagnostics.Property_0_is_used_before_its_initialization,o),i&&e.addRelatedInfo(i,e.createDiagnosticForNode(a,e.Diagnostics._0_is_declared_here,o));}}(o,t,i),Zv(o,t,$v(r,c)),ni(t).resolvedSymbol=o;var f=e.isWriteAccess(t);if(bv(t,106===r.kind,f,_,o),Ub(t,o,u))return Jn(i,e.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property,e.idText(i)),je;s=Rv(t,o)?Re:f?Zo(o):$o(o);}else {var g=e.isPrivateIdentifier(i)||0!==u&&M_(n)&&!e.isThisTypeParameter(n)?void 0:ul(_,i.escapedText);if(!g||!g.type){var m=jv(t,n.symbol,!0);return !m&&E_(n)?Le:n.symbol===ue?(ue.exports.has(i.escapedText)&&418&ue.exports.get(i.escapedText).flags?Jn(i,e.Diagnostics.Property_0_does_not_exist_on_type_1,e.unescapeLeadingUnderscores(i.escapedText),qa(n)):$&&Jn(i,e.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature,qa(n)),Le):(i.escapedText&&!mi(t)&&Uv(i,e.isThisTypeParameter(n)?_:n,m),je)}g.isReadonly&&(e.isAssignmentTarget(t)||e.isDeleteTarget(t))&&Jn(t,e.Diagnostics.Index_signature_in_type_0_only_permits_reading,qa(_)),s=V.noUncheckedIndexedAccess&&!e.isAssignmentTarget(t)?a_([g.type,qe]):g.type,V.noPropertyAccessFromIndexSignature&&e.isPropertyAccessExpression(t)&&Jn(i,e.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0,e.unescapeLeadingUnderscores(i.escapedText)),g.declaration&&268435456&e.getCombinedNodeFlags(g.declaration)&&Wn(i,[g.declaration],i.escapedText);}return Jv(t,o,s,i,a)}function jv(t,r,n){var i=e.getSourceFileOfNode(t);if(i&&void 0===V.checkJs&&void 0===i.checkJsDirective&&(1===i.scriptKind||2===i.scriptKind)){var a=e.forEach(null==r?void 0:r.declarations,e.getSourceFileOfNode);return !(i!==a&&a&&ii(a)||n&&r&&32&r.flags||t&&n&&e.isPropertyAccessExpression(t)&&108===t.expression.kind)}return !1}function Jv(t,r,n,i,a){var o=e.getAssignmentTargetKind(t);if(1===o)return qf(n,!!(r&&16777216&r.flags));if(r&&!(98311&r.flags)&&!(8192&r.flags&&1048576&n.flags)&&!US(r.declarations))return n;if(n===Re)return Po(t,r);n=ny(n,t,a);var s=!1;if(Q&&Z&&e.isAccessExpression(t)&&108===t.expression.kind){var c=r&&r.valueDeclaration;if(c&&CS(c)&&!e.isStatic(c)){var l=Ym(t);171!==l.kind||l.parent!==c.parent||16777216&c.flags||(s=!0);}}else Q&&r&&r.valueDeclaration&&e.isPropertyAccessExpression(r.valueDeclaration)&&e.getAssignmentDeclarationPropertyAccessKind(r.valueDeclaration)&&Ym(t)===Ym(r.valueDeclaration)&&(s=!0);var u=Xm(t,n,s?jf(n):n);return s&&!(32768&Mf(n))&&32768&Mf(u)?(Jn(i,e.Diagnostics.Property_0_is_used_before_being_assigned,Ua(r)),n):o?Sf(u):u}function zv(t){return !!e.findAncestor(t,(function(t){switch(t.kind){case 167:return !0;case 296:case 169:case 172:case 173:case 298:case 162:case 233:case 288:case 285:case 286:case 287:case 280:case 228:case 291:return !1;case 214:case 238:return !(!e.isBlock(t.parent)||!e.isClassStaticBlockDeclaration(t.parent.parent))||"quit";default:return !e.isExpressionNode(t)&&"quit"}}))}function Kv(e){var t=gs(e);if(0!==t.length)return p_(t)}function Uv(t,r,n){var i,a;if(!e.isPrivateIdentifier(t)&&1048576&r.flags&&!(131068&r.flags))for(var o=0,s=r.types;o<s.length;o++){var c=s[o];if(!Zc(c,t.escapedText)&&!ul(c,t.escapedText)){i=e.chainDiagnosticMessages(i,e.Diagnostics.Property_0_does_not_exist_on_type_1,e.declarationNameToString(t),qa(c));break}}if(Vv(t.escapedText,r)){var l=e.declarationNameToString(t),u=qa(r);i=e.chainDiagnosticMessages(i,e.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead,l,u,u+"."+l);}else {var _=Hx(r);if(_&&Zc(_,t.escapedText))i=e.chainDiagnosticMessages(i,e.Diagnostics.Property_0_does_not_exist_on_type_1,e.declarationNameToString(t),qa(r)),a=e.createDiagnosticForNode(t,e.Diagnostics.Did_you_forget_to_use_await);else {var d=e.declarationNameToString(t),p=qa(r),f=function(t,r){var n=Kc(r).symbol;if(n)for(var i=e.getScriptTargetFeatures(),a=0,o=e.getOwnKeys(i);a<o.length;a++){var s=o[a],c=i[s][e.symbolName(n)];if(void 0!==c&&e.contains(c,t))return s}}(d,r);if(void 0!==f)i=e.chainDiagnosticMessages(i,e.Diagnostics.Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later,d,p,f);else {var g=Wv(t,r);if(void 0!==g){var m=e.symbolName(g),y=n?e.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2:e.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2;i=e.chainDiagnosticMessages(i,y,d,p,m),a=g.valueDeclaration&&e.createDiagnosticForNode(g.valueDeclaration,e.Diagnostics._0_is_declared_here,m);}else {var v=function(t){return V.lib&&!V.lib.includes("dom")&&(n=function(t){return t.symbol&&/^(EventTarget|Node|((HTML[a-zA-Z]*)?Element))$/.test(e.unescapeLeadingUnderscores(t.symbol.escapedName))},3145728&(r=t).flags?e.every(r.types,n):n(r))&&Np(t);var r,n;}(r)?e.Diagnostics.Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom:e.Diagnostics.Property_0_does_not_exist_on_type_1;i=e.chainDiagnosticMessages(Yc(i,r),v,d,p);}}}}var h=e.createDiagnosticForNodeFromMessageChain(t,i);a&&e.addRelatedInfo(h,a),zn(!n||i.code!==e.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,h);}function Vv(t,r){var n=r.symbol&&Zc($o(r.symbol),t);return void 0!==n&&!!n.valueDeclaration&&e.isStatic(n.valueDeclaration)}function qv(e,t){return Yv(e,Nc(t),106500)}function Wv(t,r){var n=Nc(r);if("string"!=typeof t){var i=t.parent;e.isPropertyAccessExpression(i)&&(n=e.filter(n,(function(e){return eh(i,r,e)}))),t=e.idText(t);}return Yv(t,n,111551)}function Hv(t,r){var n=e.isString(t)?t:e.idText(t),i=Nc(r),a="for"===n?e.find(i,(function(t){return "htmlFor"===e.symbolName(t)})):"class"===n?e.find(i,(function(t){return "className"===e.symbolName(t)})):void 0;return null!=a?a:Yv(n,i,111551)}function Gv(t,r){var n=Wv(t,r);return n&&e.symbolName(n)}function Qv(t,r,n){return e.Debug.assert(void 0!==r,"outername should always be defined"),ui(t,r,n,void 0,r,!1,!1,!0,(function(t,n,i){e.Debug.assertEqual(r,n,"name should equal outerName");var a,o=ai(t,n,i);return o||(a=t===ce?e.mapDefined(["string","number","boolean","object","bigint","symbol"],(function(e){return t.has(e.charAt(0).toUpperCase()+e.slice(1))?Hn(524288,e):void 0})).concat(e.arrayFrom(t.values())):e.arrayFrom(t.values()),Yv(e.unescapeLeadingUnderscores(n),a,i))}))}function Xv(t,r){return r.exports&&Yv(e.idText(t),ta(r),2623475)}function Yv(t,r,n){return e.getSpellingSuggestion(t,r,(function(t){var r=e.symbolName(t);if(!e.startsWith(r,'"')){if(t.flags&n)return r;if(2097152&t.flags){var i=function(e){if(ri(e).aliasTarget!==Ie)return Ri(e)}(t);if(i&&i.flags&n)return r}}}))}function Zv(t,r,n){var i=t&&106500&t.flags&&t.valueDeclaration;if(i){var a=e.hasEffectiveModifier(i,8),o=t.valueDeclaration&&e.isNamedDeclaration(t.valueDeclaration)&&e.isPrivateIdentifier(t.valueDeclaration.name);if((a||o)&&(!r||!e.isWriteOnlyAccess(r)||65536&t.flags)){if(n){var s=e.findAncestor(r,e.isFunctionLikeDeclaration);if(s&&s.symbol===t)return}(1&e.getCheckFlags(t)?ri(t).target:t).isReferenced=67108863;}}}function $v(t,r){return 108===t.kind||!!r&&e.isEntityNameExpression(t)&&r===Kg(e.getFirstIdentifier(t))}function eh(e,t,r){return rh(e,206===e.kind&&106===e.expression.kind,!1,t,r)}function th(e,t,r,n){if(_o(n))return !0;var i=Zc(n,r);return !!i&&rh(e,t,!1,n,i)}function rh(t,r,n,i,a){if(_o(i))return !0;if(a.valueDeclaration&&e.isPrivateIdentifierClassElementDeclaration(a.valueDeclaration)){var o=e.getContainingClass(a.valueDeclaration);return !e.isOptionalChain(t)&&!!e.findAncestor(t,(function(e){return e===o}))}return xv(t,r,n,i,a)}function nh(t){var r=t.initializer;if(255===r.kind){var n=r.declarations[0];if(n&&!e.isBindingPattern(n.name))return la(n)}else if(79===r.kind)return Kg(r)}function ih(t,r,n){var i=0!==e.getAssignmentTargetKind(t)||Iv(t)?rg(r):r,a=t.argumentExpression,o=kx(a);if(po(i)||i===ct)return i;if(Xb(i)&&!e.isStringLiteralLike(a))return Jn(a,e.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal),je;var s=V_(i,function(t){var r,n=e.skipParentheses(t);if(79===n.kind){var i=Kg(n);if(3&i.flags)for(var a=t,o=t.parent;o;){if(243===o.kind&&a===o.statement&&nh(o)===i&&1===al(r=Sx(o.expression)).length&&ol(r,Ze))return !0;a=o,o=o.parent;}}return !1}(a)?Ze:o,e.isAssignmentTarget(t)?4|(M_(i)&&!e.isThisTypeParameter(i)?2:0):32,t)||je;return zx(Jv(t,ni(t).resolvedSymbol,s,a,n),t)}function ah(t){return e.isCallOrNewExpression(t)||e.isTaggedTemplateExpression(t)||e.isJsxOpeningLikeElement(t)}function oh(t){return ah(t)&&e.forEach(t.typeArguments,VS),210===t.kind?kx(t.template):e.isJsxOpeningLikeElement(t)?kx(t.attributes):165!==t.kind&&e.forEach(t.arguments,(function(e){kx(e);})),Ir}function sh(e){return oh(e),Or}function ch(e){return !!e&&(225===e.kind||232===e.kind&&e.isSpread)}function lh(t){return e.findIndex(t,ch)}function uh(e){return !!(16384&e.flags)}function _h(e){return !!(49155&e.flags)}function dh(t,r,n,i){var a;void 0===i&&(i=!1);var o=!1,s=vb(n),c=hb(n);if(210===t.kind)if(a=r.length,223===t.template.kind){var l=e.last(t.template.templateSpans);o=e.nodeIsMissing(l.literal)||!!l.literal.isUnterminated;}else {var u=t.template;e.Debug.assert(14===u.kind),o=!!u.isUnterminated;}else if(165===t.kind)a=Nh(t,n);else if(e.isJsxOpeningLikeElement(t)){if(o=t.attributes.end===t.end)return !0;a=0===c?r.length:1,s=0===r.length?s:1,c=Math.min(c,1);}else {if(!t.arguments)return e.Debug.assert(209===t.kind),0===hb(n);a=i?r.length+1:r.length,o=t.arguments.end===t.end;var _=lh(r);if(_>=0)return _>=hb(n)&&(bb(n)||_<vb(n))}if(!bb(n)&&a>s)return !1;if(o||a>=c)return !0;for(var d=a;d<c;d++)if(131072&km(gb(n,d),e.isInJSFile(t)&&!Q?_h:uh).flags)return !1;return !0}function ph(t,r){var n=e.length(t.typeParameters),i=vl(t.typeParameters);return !e.some(r)||r.length>=i&&r.length<=n}function fh(e){return mh(e,0,!1)}function gh(e){return mh(e,0,!1)||mh(e,1,!1)}function mh(e,t,r){if(524288&e.flags){var n=Tc(e);if(r||0===n.properties.length&&0===n.indexInfos.length){if(0===t&&1===n.callSignatures.length&&0===n.constructSignatures.length)return n.callSignatures[0];if(1===t&&1===n.constructSignatures.length&&0===n.callSignatures.length)return n.constructSignatures[0]}}}function yh(t,r,n,i){var a=lg(t.typeParameters,t,0,i),o=xb(r),s=n&&(o&&262144&o.flags?n.nonFixingMapper:n.mapper);return sg(s?Kd(r,s):r,t,(function(e,t){Ig(a.inferences,e,t);})),n||cg(r,t,(function(e,t){Ig(a.inferences,e,t,128);})),wl(t,Jg(a),e.isInJSFile(r.declaration))}function vh(t){if(!t)return ot;var r=kx(t);return e.isOptionalChainRoot(t.parent)?Jf(r):e.isOptionalChain(t.parent)?Kf(r):r}function hh(t,r,n,i,a){if(e.isJsxOpeningLikeElement(t))return function(e,t,r,n){var i=By(t,e),a=sx(e.attributes,i,n,r);return Ig(n.inferences,a,i),Jg(n)}(t,r,i,a);if(165!==t.kind){var o=Ly(t,e.every(r.typeParameters,(function(e){return !!Jc(e)}))?8:0);if(o){var s=Nl(r);if(vg(s)){var c=Ry(t),l=Yd(o,yg(function(t,r){return void 0===r&&(r=0),t&&ug(e.map(t.inferences,mg),t.signature,t.flags|r,t.compareTypes)}(c,1))),u=fh(l),_=u&&u.typeParameters?Rl(Il(u,u.typeParameters)):l;Ig(a.inferences,_,s,128);var d=lg(r.typeParameters,r,a.flags),p=Yd(o,c&&c.returnMapper);Ig(d.inferences,p,s),a.returnMapper=e.some(d.inferences,hx)?yg(function(t){var r=e.filter(t.inferences,hx);return r.length?ug(e.map(r,mg),t.signature,t.flags,t.compareTypes):void 0}(d)):void 0;}}}var f=Db(r),g=f?Math.min(vb(r)-1,n.length):n.length;if(f&&262144&f.flags){var m=e.find(a.inferences,(function(e){return e.typeParameter===f}));m&&(m.impliedArity=e.findIndex(n,ch,g)<0?n.length-g:void 0);}var y=Cl(r);if(y&&vg(y)){var v=Ch(t);Ig(a.inferences,vh(v),y);}for(var h=0;h<g;h++){var b=n[h];if(227!==b.kind&&!(32&i&&Eg(b))){var x=gb(r,h);if(vg(x)){var D=sx(b,x,a,i);Ig(a.inferences,D,x);}}}if(f&&vg(f)){var S=xh(n,g,n.length,f,a,i);Ig(a.inferences,S,f);}return Jg(a)}function bh(e){return 1048576&e.flags?Fm(e,bh):1&e.flags||_f(Mc(e)||e)?e:Nf(e)?Vu(eu(e),e.target.elementFlags,!1,e.target.labeledElementDeclarations):Vu([e],[8])}function xh(t,r,n,i,a,o){if(r>=n-1&&ch(_=t[n-1]))return bh(232===_.kind?_.type:sx(_.expression,i,a,o));for(var s=[],c=[],l=[],u=r;u<n;u++){var _;if(ch(_=t[u])){var d=232===_.kind?_.type:kx(_.expression);pf(d)?(s.push(d),c.push(8)):(s.push(zD(33,d,qe,225===_.kind?_.expression:_)),c.push(4));}else {var p=K_(i,hd(u-r),256),f=sx(_,p,a,o),g=Hb(p,406978556);s.push(g?md(f):Tf(f)),c.push(1);}232===_.kind&&_.tupleNameSource&&l.push(_.tupleNameSource);}return Vu(s,c,!1,e.length(l)===e.length(s)?l:void 0)}function Dh(t,r,n,i){for(var a,o=e.isInJSFile(t.declaration),s=t.typeParameters,c=hl(e.map(r,kd),s,vl(s),o),l=0;l<r.length;l++){e.Debug.assert(void 0!==s[l],"Should not call checkTypeArguments with too many type arguments");var u=Ac(s[l]);if(u){var _=n&&i?function(){return e.chainDiagnosticMessages(void 0,e.Diagnostics.Type_0_does_not_satisfy_the_constraint_1)}:void 0,d=i||e.Diagnostics.Type_0_does_not_satisfy_the_constraint_1;a||(a=wd(s,c));var p=c[l];if(!gp(p,Hs(Yd(u,a),p),n?r[l]:void 0,d,_))return}}return c}function Sh(t){if($y(t.tagName))return 2;var r=Kc(kx(t.tagName));return e.length(el(r,1))?0:e.length(el(r,0))?1:2}function Th(t,r,n,i,a,o,s){var c={errors:void 0,skipLogging:!0};if(e.isJsxOpeningLikeElement(t))return function(t,r,n,i,a,o,s){var c=By(r,t),l=sx(t.attributes,c,void 0,i);return function(){var r;if(av(t))return !0;var n=e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)&&!$y(t.tagName)?kx(t.tagName):void 0;if(!n)return !0;var i=el(n,0);if(!e.length(i))return !0;var o=qT(t);if(!o)return !0;var c=qi(o,111551,!0,!1,t);if(!c)return !0;var l=el($o(c),0);if(!e.length(l))return !0;for(var u=!1,_=0,d=0,p=l;d<p.length;d++){var f=el(gb(p[d],0),0);if(e.length(f))for(var g=0,m=f;g<m.length;g++){var y=m[g];if(u=!0,bb(y))return !0;var v=vb(y);v>_&&(_=v);}}if(!u)return !0;for(var h=1/0,b=0,x=i;b<x.length;b++){var D=hb(x[b]);D<h&&(h=D);}if(h<=_)return !0;if(a){var S=e.createDiagnosticForNode(t.tagName,e.Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3,e.entityNameToString(t.tagName),h,e.entityNameToString(o),_),T=null===(r=oT(t.tagName))||void 0===r?void 0:r.valueDeclaration;T&&e.addRelatedInfo(S,e.createDiagnosticForNode(T,e.Diagnostics._0_is_declared_here,e.entityNameToString(t.tagName))),s&&s.skipLogging&&(s.errors||(s.errors=[])).push(S),s.skipLogging||Sn.add(S);}return !1}()&&yp(l,c,n,a?t.tagName:void 0,t.attributes,void 0,o,s)}(t,n,i,a,o,s,c)?void 0:(e.Debug.assert(!o||!!c.errors,"jsx should have errors when reporting errors"),c.errors||e.emptyArray);var l=Cl(n);if(l&&l!==ot&&209!==t.kind){var u=Ch(t),_=vh(u),d=o?u||t:void 0,p=e.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;if(!Lp(_,l,i,d,p,s,c))return e.Debug.assert(!o||!!c.errors,"this parameter should have errors when reporting errors"),c.errors||e.emptyArray}for(var f=e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1,g=Db(n),m=g?Math.min(vb(n)-1,r.length):r.length,y=0;y<m;y++){var v=r[y];if(227!==v.kind){var h=gb(n,y),b=sx(v,h,void 0,a),x=4&a?Xf(b):b;if(!yp(x,h,i,o?v:void 0,v,f,s,c))return e.Debug.assert(!o||!!c.errors,"parameter should have errors when reporting errors"),T(v,x,h),c.errors||e.emptyArray}}if(g){var D=xh(r,m,r.length,g,void 0,a),S=r.length-m;if(d=o?0===S?t:1===S?r[m]:e.setTextRangePosEnd(kh(t,D),r[m].pos,r[r.length-1].end):void 0,!Lp(D,g,i,d,f,void 0,c))return e.Debug.assert(!o||!!c.errors,"rest parameter should have errors when reporting errors"),T(d,D,g),c.errors||e.emptyArray}return;function T(t,r,n){if(t&&o&&c.errors&&c.errors.length){if(Wx(n))return;var a=Wx(r);a&&Ip(a,n,i)&&e.addRelatedInfo(c.errors[0],e.createDiagnosticForNode(t,e.Diagnostics.Did_you_forget_to_use_await));}}}function Ch(t){var r=208===t.kind?t.expression:210===t.kind?t.tag:void 0;if(r){var n=e.skipOuterExpressions(r);if(e.isAccessExpression(n))return n.expression}}function kh(t,r,n,i){var a=e.parseNodeFactory.createSyntheticExpression(r,n,i);return e.setTextRange(a,t),e.setParent(a,t),a}function Eh(t){if(210===t.kind){var r=t.template,n=[kh(r,yr||(yr=Tu("TemplateStringsArray",0,!0)||St))];return 223===r.kind&&e.forEach(r.templateSpans,(function(e){n.push(e.expression);})),n}if(165===t.kind)return function(t){var r=t.parent,n=t.expression;switch(r.kind){case 257:case 226:return [kh(n,$o(la(r)))];case 164:var i=r.parent;return [kh(n,171===r.parent.kind?$o(la(i)):je),kh(n,Le),kh(n,Ze)];case 167:case 169:case 172:case 173:var a=167!==r.kind&&0!==q;return [kh(n,uT(r)),kh(n,_T(r)),kh(n,a?Ru(sT(r)):Le)]}return e.Debug.fail()}(t);if(e.isJsxOpeningLikeElement(t))return t.attributes.properties.length>0||e.isJsxOpeningElement(t)&&t.parent.children.length>0?[t.attributes]:e.emptyArray;var i=t.arguments||e.emptyArray,a=lh(i);if(a>=0){for(var o=i.slice(0,a),s=function(t){var r=i[t],n=225===r.kind&&(Qr?kx(r.expression):cx(r.expression));n&&Nf(n)?e.forEach(eu(n),(function(e,t){var i,a=n.target.elementFlags[t],s=kh(r,4&a?Bu(e):e,!!(12&a),null===(i=n.target.labeledElementDeclarations)||void 0===i?void 0:i[t]);o.push(s);})):o.push(r);},c=a;c<i.length;c++)s(c);return o}return i}function Nh(t,r){switch(t.parent.kind){case 257:case 226:return 1;case 167:return 2;case 169:case 172:case 173:return 0===q||r.parameters.length<=2?2:3;case 164:return 3;default:return e.Debug.fail()}}function Fh(t,r){var n,i,a=e.getSourceFileOfNode(t);if(e.isPropertyAccessExpression(t.expression)){var o=e.getErrorSpanForNode(a,t.expression.name);n=o.start,i=r?o.length:t.end-n;}else {var s=e.getErrorSpanForNode(a,t.expression);n=s.start,i=r?s.length:t.end-n;}return {start:n,length:i,sourceFile:a}}function Ah(t,r,n,i,a,o){if(e.isCallExpression(t)){var s=Fh(t),c=s.sourceFile,l=s.start,u=s.length;return e.createFileDiagnostic(c,l,u,r,n,i,a,o)}return e.createDiagnosticForNode(t,r,n,i,a,o)}function Ph(t,r,n){var i,a=lh(n);if(a>-1)return e.createDiagnosticForNode(n[a],e.Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter);for(var o,s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,_=0,d=r;_<d.length;_++){var p=d[_],f=hb(p),g=vb(p);f<s&&(s=f,o=p),c=Math.max(c,g),f<n.length&&f>l&&(l=f),n.length<g&&g<u&&(u=g);}var m=e.some(r,bb),y=m?s:s<c?s+"-"+c:s,v=!m&&1===y&&0===n.length&&function(t){if(!e.isCallExpression(t)||!e.isIdentifier(t.expression))return !1;var r=li(t.expression,t.expression.escapedText,111551,void 0,void 0,!1),n=null==r?void 0:r.valueDeclaration;if(!(n&&e.isParameter(n)&&e.isFunctionExpressionOrArrowFunction(n.parent)&&e.isNewExpression(n.parent.parent)&&e.isIdentifier(n.parent.parent.expression)))return !1;var i=wu(!1);return !!i&&oT(n.parent.parent.expression,!0)===i}(t);if(v&&e.isInJSFile(t))return Ah(t,e.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments);var h=m?e.Diagnostics.Expected_at_least_0_arguments_but_got_1:v?e.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise:e.Diagnostics.Expected_0_arguments_but_got_1;if(s<n.length&&n.length<c)return Ah(t,e.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments,n.length,l,u);if(n.length<s){var b=Ah(t,h,y,n.length),x=null===(i=null==o?void 0:o.declaration)||void 0===i?void 0:i.parameters[o.thisParameter?n.length+1:n.length];if(x){var D=e.createDiagnosticForNode(x,e.isBindingPattern(x.name)?e.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided:e.isRestParameter(x)?e.Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided:e.Diagnostics.An_argument_for_0_was_not_provided,x.name?e.isBindingPattern(x.name)?void 0:e.idText(e.getFirstIdentifier(x.name)):n.length);return e.addRelatedInfo(b,D)}return b}var S=e.factory.createNodeArray(n.slice(c)),T=e.first(S).pos,C=e.last(S).end;return C===T&&C++,e.setTextRangePosEnd(S,T,C),e.createDiagnosticForNodeArray(e.getSourceFileOfNode(t),S,h,y,n.length)}function wh(t,r,i,a,o,s){var c,l=210===t.kind,u=165===t.kind,_=e.isJsxOpeningLikeElement(t),d=!i;u||(c=t.typeArguments,(l||_||106!==t.expression.kind)&&e.forEach(c,VS));var p=i||[];if(function(t,r,n){var i,a,o,s,c=0,l=-1;e.Debug.assert(!r.length);for(var u=0,_=t;u<_.length;u++){var d=_[u],p=d.declaration&&la(d.declaration),f=d.declaration&&d.declaration.parent;a&&p!==a?(o=c=r.length,i=f):i&&f===i?o+=1:(i=f,o=c),a=p,z(d)?(s=++l,c++):s=o,r.splice(s,0,n?Zs(d,n):d);}}(r,p,o),!p.length)return d&&Sn.add(Ah(t,e.Diagnostics.Call_target_does_not_contain_any_signatures)),sh(t);var f,g,m,y,v=Eh(t),h=1===p.length&&!p[0].typeParameters,b=u||h||!e.some(v,rp)?0:4;b|=32&a;var x=!!(16&a)&&208===t.kind&&t.arguments.hasTrailingComma;if(p.length>1&&(y=q(p,En,h,x)),y||(y=q(p,Fn,h,x)),y)return y;if(d)if(f)if(1===f.length||f.length>3){var D,S=f[f.length-1];f.length>3&&(D=e.chainDiagnosticMessages(D,e.Diagnostics.The_last_overload_gave_the_following_error),D=e.chainDiagnosticMessages(D,e.Diagnostics.No_overload_matches_this_call));var T=Th(t,v,S,Fn,0,!0,(function(){return D}));if(T)for(var C=0,k=T;C<k.length;C++){var E=k[C];S.declaration&&f.length>3&&e.addRelatedInfo(E,e.createDiagnosticForNode(S.declaration,e.Diagnostics.The_last_overload_is_declared_here)),V(S,E),Sn.add(E);}else e.Debug.fail("No error for last overload signature");}else {for(var N=[],F=0,A=Number.MAX_VALUE,P=0,w=0,I=function(r){var n=Th(t,v,r,Fn,0,!0,(function(){return e.chainDiagnosticMessages(void 0,e.Diagnostics.Overload_0_of_1_2_gave_the_following_error,w+1,p.length,Va(r))}));n?(n.length<=A&&(A=n.length,P=w),F=Math.max(F,n.length),N.push(n)):e.Debug.fail("No error for 3 or fewer overload signatures"),w++;},O=0,M=f;O<M.length;O++)I(M[O]);var L=F>1?N[P]:e.flatten(N);e.Debug.assert(L.length>0,"No errors reported for 3 or fewer overload signatures");var R=e.chainDiagnosticMessages(e.map(L,e.createDiagnosticMessageChainFromDiagnostic),e.Diagnostics.No_overload_matches_this_call),B=n$4([],e.flatMap(L,(function(e){return e.relatedInformation})),!0),j=void 0;if(e.every(L,(function(e){return e.start===L[0].start&&e.length===L[0].length&&e.file===L[0].file}))){var K=L[0];j={file:K.file,start:K.start,length:K.length,code:R.code,category:R.category,messageText:R,relatedInformation:B};}else j=e.createDiagnosticForNodeFromMessageChain(t,R,B);V(f[0],j),Sn.add(j);}else if(g)Sn.add(Ph(t,[g],v));else if(m)Dh(m,t.typeArguments,!0,s);else {var U=e.filter(r,(function(e){return ph(e,c)}));0===U.length?Sn.add(function(t,r,n){var i=n.length;if(1===r.length){var a=vl((_=r[0]).typeParameters),o=e.length(_.typeParameters);return e.createDiagnosticForNodeArray(e.getSourceFileOfNode(t),n,e.Diagnostics.Expected_0_type_arguments_but_got_1,a<o?a+"-"+o:a,i)}for(var s=-1/0,c=1/0,l=0,u=r;l<u.length;l++){var _,d=vl((_=u[l]).typeParameters);o=e.length(_.typeParameters),d>i?c=Math.min(c,d):o<i&&(s=Math.max(s,o));}return s!==-1/0&&c!==1/0?e.createDiagnosticForNodeArray(e.getSourceFileOfNode(t),n,e.Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments,i,s,c):e.createDiagnosticForNodeArray(e.getSourceFileOfNode(t),n,e.Diagnostics.Expected_0_type_arguments_but_got_1,s===-1/0?c:s,i)}(t,r,c)):u?s&&Sn.add(Ah(t,s)):Sn.add(Ph(t,U,v));}return function(t,r,n,i,a){return e.Debug.assert(r.length>0),WS(t),i||1===r.length||r.some((function(e){return !!e.typeParameters}))?function(t,r,n,i){var a=function(e,t){for(var r=-1,n=-1,i=0;i<e.length;i++){var a=e[i],o=vb(a);if(bb(a)||o>=t)return i;o>n&&(n=o,r=i);}return r}(r,void 0===_e?n.length:_e),o=r[a],s=o.typeParameters;if(!s)return o;var c=ah(t)?t.typeArguments:void 0,l=c?Ol(o,function(e,t,r){for(var n=e.map(sT);n.length>t.length;)n.pop();for(;n.length<t.length;)n.push(Jc(t[n.length])||Ac(t[n.length])||jg(r));return n}(c,s,e.isInJSFile(t))):function(t,r,n,i,a){return Ol(n,hh(t,n,i,12|a,lg(r,n,e.isInJSFile(t)?2:0)))}(t,s,o,n,i);return r[a]=l,l}(t,r,n,a):function(t){var r,n=e.mapDefined(t,(function(e){return e.thisParameter}));n.length&&(r=Oh(n,n.map(lb)));for(var i=e.minAndMax(t,Ih),a=i.min,o=i.max,s=[],c=function(r){var n=e.mapDefined(t,(function(t){return J(t)?r<t.parameters.length-1?t.parameters[r]:e.last(t.parameters):r<t.parameters.length?t.parameters[r]:void 0}));e.Debug.assert(0!==n.length),s.push(Oh(n,e.mapDefined(t,(function(e){return mb(e,r)}))));},l=0;l<o;l++)c(l);var u=e.mapDefined(t,(function(t){return J(t)?e.last(t.parameters):void 0})),_=0;if(0!==u.length){var d=Bu(a_(e.mapDefined(t,Pl),2));s.push(Mh(u,d)),_|=1;}return t.some(z)&&(_|=2),Qs(t[0].declaration,void 0,r,s,p_(t.map(Nl)),void 0,a,_)}(r)}(t,p,v,!!i,a);function V(t,r){var n,i,a=f,o=g,s=m,c=(null===(i=null===(n=t.declaration)||void 0===n?void 0:n.symbol)||void 0===i?void 0:i.declarations)||e.emptyArray,l=c.length>1?e.find(c,(function(t){return e.isFunctionLikeDeclaration(t)&&e.nodeIsPresent(t.body)})):void 0;if(l){var u=bl(l),_=!u.typeParameters;q([u],Fn,_)&&e.addRelatedInfo(r,e.createDiagnosticForNode(l,e.Diagnostics.The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible));}f=a,g=o,m=s;}function q(r,n,i,o){if(void 0===o&&(o=!1),f=void 0,g=void 0,m=void 0,i){var s=r[0];if(e.some(c)||!dh(t,v,s,o))return;return Th(t,v,s,n,0,!1,void 0)?void(f=[s]):s}for(var l=0;l<r.length;l++)if(ph(s=r[l],c)&&dh(t,v,s,o)){var u=void 0,_=void 0;if(s.typeParameters){var d=void 0;if(e.some(c)){if(!(d=Dh(s,c,!1))){m=s;continue}}else _=lg(s.typeParameters,s,e.isInJSFile(t)?2:0),d=hh(t,s,v,8|b,_),b|=4&_.flags?8:0;if(u=wl(s,d,e.isInJSFile(s.declaration),_&&_.inferredTypeParameters),Db(s)&&!dh(t,v,u,o)){g=u;continue}}else u=s;if(!Th(t,v,u,n,b,!1,void 0)){if(b){if(b=32&a,_&&(u=wl(s,d=hh(t,s,v,b,_),e.isInJSFile(s.declaration),_&&_.inferredTypeParameters),Db(s)&&!dh(t,v,u,o))){g=u;continue}if(Th(t,v,u,n,b,!1,void 0)){(f||(f=[])).push(u);continue}}return r[l]=u,u}(f||(f=[])).push(u);}}}function Ih(e){var t=e.parameters.length;return J(e)?t-1:t}function Oh(e,t){return Mh(e,a_(t,2))}function Mh(t,r){return Qf(e.first(t),r)}function Lh(e){return !(!e.typeParameters||!MT(Nl(e)))}function Rh(e,t,r,n){return _o(e)||_o(t)&&!!(262144&e.flags)||!r&&!n&&!(1048576&t.flags)&&!(131072&Hc(t).flags)&&_p(e,jt)}function Bh(t,r,n){if(t.arguments&&q<1){var i=lh(t.arguments);i>=0&&Jn(t.arguments[i],e.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);}var a=Sv(t.expression);if(a===ct)return Lr;if(po(a=Kc(a)))return sh(t);if(_o(a))return t.typeArguments&&Jn(t,e.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments),oh(t);var o=el(a,1);if(o.length){if(!function(t,r){if(!r||!r.declaration)return !0;var n=r.declaration,i=e.getSelectedEffectiveModifierFlags(n,24);if(!i||171!==n.kind)return !0;var a=e.getClassLikeDeclarationOfSymbol(n.parent.symbol),o=Es(n.parent.symbol);if(!rT(t,a)){var s=e.getContainingClass(t);if(s&&16&i){var c=sT(s);if(Jh(n.parent.symbol,c))return !0}return 8&i&&Jn(t,e.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration,qa(o)),16&i&&Jn(t,e.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration,qa(o)),!1}return !0}(t,o[0]))return sh(t);if(jh(o,(function(e){return !!(4&e.flags)})))return Jn(t,e.Diagnostics.Cannot_create_an_instance_of_an_abstract_class),sh(t);var s=a.symbol&&e.getClassLikeDeclarationOfSymbol(a.symbol);return s&&e.hasSyntacticModifier(s,128)?(Jn(t,e.Diagnostics.Cannot_create_an_instance_of_an_abstract_class),sh(t)):wh(t,o,r,n,0)}var c=el(a,0);if(c.length){var l=wh(t,c,r,n,0);return $||(l.declaration&&!Gh(l.declaration)&&Nl(l)!==ot&&Jn(t,e.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword),Cl(l)===ot&&Jn(t,e.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void)),l}return Kh(t.expression,a,1),sh(t)}function jh(t,r){return e.isArray(t)?e.some(t,(function(e){return jh(e,r)})):1048576===t.compositeKind?e.some(t.compositeSignatures,r):r(t)}function Jh(t,r){var n=gs(r);if(!e.length(n))return !1;var i=n[0];if(2097152&i.flags){for(var a=oc(i.types),o=0,s=0,c=i.types;s<c.length;s++){var l=c[s];if(!a[o]&&3&e.getObjectFlags(l)){if(l.symbol===t)return !0;if(Jh(t,l))return !0}o++;}return !1}return i.symbol===t||Jh(t,i)}function zh(t,r,n){var i,a=0===n,o=Zx(r),s=o&&el(o,n).length>0;if(1048576&r.flags){for(var c=!1,l=0,u=r.types;l<u.length;l++){var _=u[l];if(0!==el(_,n).length){if(c=!0,i)break}else if(i||(i=e.chainDiagnosticMessages(i,a?e.Diagnostics.Type_0_has_no_call_signatures:e.Diagnostics.Type_0_has_no_construct_signatures,qa(_)),i=e.chainDiagnosticMessages(i,a?e.Diagnostics.Not_all_constituents_of_type_0_are_callable:e.Diagnostics.Not_all_constituents_of_type_0_are_constructable,qa(r))),c)break}c||(i=e.chainDiagnosticMessages(void 0,a?e.Diagnostics.No_constituent_of_type_0_is_callable:e.Diagnostics.No_constituent_of_type_0_is_constructable,qa(r))),i||(i=e.chainDiagnosticMessages(i,a?e.Diagnostics.Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other:e.Diagnostics.Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other,qa(r)));}else i=e.chainDiagnosticMessages(i,a?e.Diagnostics.Type_0_has_no_call_signatures:e.Diagnostics.Type_0_has_no_construct_signatures,qa(r));var d=a?e.Diagnostics.This_expression_is_not_callable:e.Diagnostics.This_expression_is_not_constructable;if(e.isCallExpression(t.parent)&&0===t.parent.arguments.length){var p=ni(t).resolvedSymbol;p&&32768&p.flags&&(d=e.Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without);}return {messageChain:e.chainDiagnosticMessages(i,d),relatedMessage:s?e.Diagnostics.Did_you_forget_to_use_await:void 0}}function Kh(t,r,n,i){var a=zh(t,r,n),o=a.messageChain,s=a.relatedMessage,c=e.createDiagnosticForNodeFromMessageChain(t,o);if(s&&e.addRelatedInfo(c,e.createDiagnosticForNode(t,s)),e.isCallExpression(t.parent)){var l=Fh(t.parent,!0),u=l.start,_=l.length;c.start=u,c.length=_;}Sn.add(c),Uh(r,n,i?e.addRelatedInfo(c,i):c);}function Uh(t,r,n){if(t.symbol){var i=ri(t.symbol).originatingImport;if(i&&!e.isImportCall(i)){var a=el($o(ri(t.symbol).target),r);if(!a||!a.length)return;e.addRelatedInfo(n,e.createDiagnosticForNode(i,e.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));}}}function Vh(t,r){var n=ov(t),i=n&&ia(n),a=i&&ai(i,A.Element,788968),o=a&&se.symbolToEntityName(a,788968,t),s=e.factory.createFunctionTypeNode(void 0,[e.factory.createParameterDeclaration(void 0,void 0,void 0,"props",void 0,se.typeToTypeNode(r,t))],o?e.factory.createTypeReferenceNode(o,void 0):e.factory.createKeywordTypeNode(130)),c=Hn(1,"props");return c.type=r,Qs(s,void 0,void 0,[c],a?Es(a):je,void 0,1,0)}function qh(t,r,n){if($y(t.tagName)){var i=_v(t),a=Vh(t,i);return mp(sx(t.attributes,By(a,t),void 0,0),i,t.tagName,t.attributes),e.length(t.typeArguments)&&(e.forEach(t.typeArguments,VS),Sn.add(e.createDiagnosticForNodeArray(e.getSourceFileOfNode(t),t.typeArguments,e.Diagnostics.Expected_0_type_arguments_but_got_1,0,e.length(t.typeArguments)))),a}var o=kx(t.tagName),s=Kc(o);if(po(s))return sh(t);var c=lv(o,t);return Rh(o,s,c.length,0)?oh(t):0===c.length?(Jn(t.tagName,e.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures,e.getTextOfNode(t.tagName)),sh(t)):wh(t,c,r,n,0)}function Wh(t,r,n){switch(t.kind){case 208:return function(t,r,n){if(106===t.expression.kind){var i=fy(t.expression);if(_o(i)){for(var a=0,o=t.arguments;a<o.length;a++)kx(o[a]);return Ir}if(!po(i)){var s=e.getEffectiveBaseTypeNode(e.getContainingClass(t));if(s)return wh(t,ds(i,s.typeArguments,s),r,n,0)}return oh(t)}var c,l=kx(t.expression);if(e.isCallChain(t)){var u=Vf(l,t.expression);c=u===l?0:e.isOutermostOptionalChain(t)?16:8,l=u;}else c=0;if((l=Nv(l,t.expression,Ev))===ct)return Lr;var _=Kc(l);if(po(_))return sh(t);var d=el(_,0),p=el(_,1).length;if(Rh(l,_,d.length,p))return !po(l)&&t.typeArguments&&Jn(t,e.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments),oh(t);if(!d.length){if(p)Jn(t,e.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new,qa(l));else {var f=void 0;if(1===t.arguments.length){var g=e.getSourceFileOfNode(t).text;e.isLineBreak(g.charCodeAt(e.skipTrivia(g,t.expression.end,!0)-1))&&(f=e.createDiagnosticForNode(t.expression,e.Diagnostics.Are_you_missing_a_semicolon));}Kh(t.expression,_,0,f);}return sh(t)}return 8&n&&!t.typeArguments&&d.some(Lh)?(vx(t,n),Mr):d.some((function(t){return e.isInJSFile(t.declaration)&&!!e.getJSDocClassTag(t.declaration)}))?(Jn(t,e.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new,qa(l)),sh(t)):wh(t,d,r,n,c)}(t,r,n);case 209:return Bh(t,r,n);case 210:return function(t,r,n){var i=kx(t.tag),a=Kc(i);if(po(a))return sh(t);var o=el(a,0),s=el(a,1).length;if(Rh(i,a,o.length,s))return oh(t);if(!o.length){if(e.isArrayLiteralExpression(t.parent)){var c=e.createDiagnosticForNode(t.tag,e.Diagnostics.It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked);return Sn.add(c),sh(t)}return Kh(t.tag,a,0),sh(t)}return wh(t,o,r,n,0)}(t,r,n);case 165:return function(t,r,n){var i=kx(t.expression),a=Kc(i);if(po(a))return sh(t);var o,s,c=el(a,0),l=el(a,1).length;if(Rh(i,a,c.length,l))return oh(t);if(o=t,(s=c).length&&e.every(s,(function(e){return 0===e.minArgumentCount&&!J(e)&&e.parameters.length<Nh(o,e)}))){var u=e.getTextOfNode(t.expression,!1);return Jn(t,e.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0,u),sh(t)}var _=function(t){switch(t.parent.kind){case 257:case 226:return e.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;case 164:return e.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;case 167:return e.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;case 169:case 172:case 173:return e.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;default:return e.Debug.fail()}}(t);if(!c.length){var d=zh(t.expression,a,0),p=e.chainDiagnosticMessages(d.messageChain,_),f=e.createDiagnosticForNodeFromMessageChain(t.expression,p);return d.relatedMessage&&e.addRelatedInfo(f,e.createDiagnosticForNode(t.expression,d.relatedMessage)),Sn.add(f),Uh(a,0,f),sh(t)}return wh(t,c,r,n,0,_)}(t,r,n);case 280:case 279:return qh(t,r,n)}throw e.Debug.assertNever(t,"Branch in 'resolveSignature' should be unreachable.")}function Hh(e,t,r){var n=ni(e),i=n.resolvedSignature;if(i&&i!==Mr&&!t)return i;n.resolvedSignature=Mr;var a=Wh(e,t,r||0);return a!==Mr&&(n.resolvedSignature=Gr===Qr?a:i),a}function Gh(t){var r;if(!t||!e.isInJSFile(t))return !1;var n=e.isFunctionDeclaration(t)||e.isFunctionExpression(t)?t:e.isVariableDeclaration(t)&&t.initializer&&e.isFunctionExpression(t.initializer)?t.initializer:void 0;if(n){if(e.getJSDocClassTag(t))return !0;var i=la(n);return !!(null===(r=null==i?void 0:i.members)||void 0===r?void 0:r.size)}return !1}function Qh(t,r){var n,i;if(r){var a=ri(r);if(!a.inferredClassSymbol||!a.inferredClassSymbol.has(M(t))){var o=e.isTransientSymbol(t)?t:Xn(t);return o.exports=o.exports||e.createSymbolTable(),o.members=o.members||e.createSymbolTable(),o.flags|=32&r.flags,(null===(n=r.exports)||void 0===n?void 0:n.size)&&ei(o.exports,r.exports),(null===(i=r.members)||void 0===i?void 0:i.size)&&ei(o.members,r.members),(a.inferredClassSymbol||(a.inferredClassSymbol=new e.Map)).set(M(o),o),o}return a.inferredClassSymbol.get(M(t))}}function Xh(t,r){if(t.parent){var n,i;if(e.isVariableDeclaration(t.parent)&&t.parent.initializer===t){if(!(e.isInJSFile(t)||e.isVarConst(t.parent)&&e.isFunctionLikeDeclaration(t)))return;n=t.parent.name,i=t.parent;}else if(e.isBinaryExpression(t.parent)){var a=t.parent,o=t.parent.operatorToken.kind;if(63!==o||!r&&a.right!==t){if(!(56!==o&&60!==o||(e.isVariableDeclaration(a.parent)&&a.parent.initializer===a?(n=a.parent.name,i=a.parent):e.isBinaryExpression(a.parent)&&63===a.parent.operatorToken.kind&&(r||a.parent.right===a)&&(i=n=a.parent.left),n&&e.isBindableStaticNameExpression(n)&&e.isSameEntityName(n,a.left))))return}else i=n=a.left;}else r&&e.isFunctionDeclaration(t)&&(n=t.name,i=t);if(i&&n&&(r||e.getExpandoInitializer(t,e.isPrototypeAccess(n))))return la(i)}}function Yh(t,r){if(t.declaration&&268435456&t.declaration.flags){var n=Zh(r),i=e.tryGetPropertyAccessOrIdentifierToString(e.getInvokedExpression(r));a=n,o=t.declaration,s=i,c=Va(t),Vn(o,s?e.createDiagnosticForNode(a,e.Diagnostics.The_signature_0_of_1_is_deprecated,c,s):e.createDiagnosticForNode(a,e.Diagnostics._0_is_deprecated,c));}var a,o,s,c;}function Zh(t){switch((t=e.skipParentheses(t)).kind){case 208:case 165:case 209:return Zh(t.expression);case 210:return Zh(t.tag);case 280:case 279:return Zh(t.tagName);case 207:return t.argumentExpression;case 206:return t.name;case 178:var r=t;return e.isQualifiedName(r.typeName)?r.typeName.right:r;default:return t}}function $h(t){if(!e.isCallExpression(t))return !1;var r=t.expression;if(e.isPropertyAccessExpression(r)&&"for"===r.name.escapedText&&(r=r.expression),!e.isIdentifier(r)||"Symbol"!==r.escapedText)return !1;var n=Nu(!1);return !!n&&n===li(r,"Symbol",111551,void 0,void 0,!1)}function eb(t,r,n){var i=e.createSymbolTable(),a=Hn(2097152,"default");return a.parent=r,a.nameType=vd("default"),a.aliasTarget=Li(t),i.set("default",a),Ea(n,i,e.emptyArray,e.emptyArray,e.emptyArray)}function tb(e,t,r,n){if(Ni(n)&&e&&!po(e)){var i=e;if(!i.defaultOnlyType){var a=eb(t,r);i.defaultOnlyType=a;}return i.defaultOnlyType}}function rb(t,r,n,i){var a;if(G&&t&&!po(t)){var o=t;if(!o.syntheticType)if(Fi(null===(a=n.declarations)||void 0===a?void 0:a.find(e.isSourceFile),n,!1,i)){var s=Hn(2048,"__type"),c=eb(r,n,s);s.type=c,o.syntheticType=Yy(t)?_d(t,c,s,0,!1):c;}else o.syntheticType=t;return o.syntheticType}return t}function nb(t){if(!e.isRequireCall(t,!0))return !1;if(!e.isIdentifier(t.expression))return e.Debug.fail();var r=li(t.expression,t.expression.escapedText,111551,void 0,void 0,!0);if(r===pe)return !0;if(2097152&r.flags)return !1;var n=16&r.flags?256:3&r.flags?254:0;if(0!==n){var i=e.getDeclarationOfKind(r,n);return !!i&&!!(16777216&i.flags)}return !1}function ib(e){switch(e.kind){case 10:case 14:case 8:case 9:case 110:case 95:case 204:case 205:case 223:return !0;case 212:return ib(e.expression);case 219:var t=e.operator,r=e.operand;return 40===t&&(8===r.kind||9===r.kind)||39===t&&8===r.kind;case 206:case 207:var n=sT(e.expression).symbol;return n&&2097152&n.flags&&(n=Ri(n)),!!(n&&384&n.flags&&1===Ds(n))}return !1}function ab(t,r,n,i){var a=kx(n,i);if(e.isConstTypeReference(r))return ib(n)||Jn(n,e.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals),md(a);VS(r),a=Xf(Sf(a));var o=kd(r);return po(o)||m((function(){var r=rg(a);pp(o,r)||Cp(a,o,t,e.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);})),o}function ob(t){iC(t);var r=228===t.kind?kx(t.expression):e.isThisIdentifier(t.exprName)?_y(t.exprName):kx(t.exprName),n=t.typeArguments;if(r===ct||po(r)||!e.some(n))return r;var i,a=!1,o=function r(n){var o=!1,s=!1,l=function n(i){if(524288&i.flags){var a=Tc(i),l=c(a.callSignatures),u=c(a.constructSignatures);if(o||(o=0!==a.callSignatures.length||0!==a.constructSignatures.length),s||(s=0!==l.length||0!==u.length),l!==a.callSignatures||u!==a.constructSignatures){var _=Ea(void 0,a.members,l,u,a.indexInfos);return _.objectFlags|=8388608,_.node=t,_}}else if(58982400&i.flags){var d=Mc(i);if(d){var p=n(d);if(p!==d)return p}}else {if(1048576&i.flags)return Fm(i,r);if(2097152&i.flags)return p_(e.sameMap(i.types,n))}return i}(n);return a||(a=s),o&&!s&&(null!=i||(i=n)),l}(r),s=a?i:r;return s&&Sn.add(e.createDiagnosticForNodeArray(e.getSourceFileOfNode(t),n,e.Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable,qa(s))),o;function c(t){var r=e.filter(t,(function(e){return !!e.typeParameters&&ph(e,n)}));return e.sameMap(r,(function(t){var r=Dh(t,n,!0);return r?wl(t,r,e.isInJSFile(t.declaration)):t}))}}function sb(t){switch(t.keywordToken){case 100:return ku();case 103:var r=cb(t);return po(r)?je:function(t){var r=Hn(0,"NewTargetExpression"),n=Hn(4,"target",8);n.parent=r,n.type=t;var i=e.createSymbolTable([n]);return r.members=i,Ea(r,i,e.emptyArray,e.emptyArray,e.emptyArray)}(r);default:e.Debug.assertNever(t.keywordToken);}}function cb(t){var r=e.getNewTargetContainer(t);return r?171===r.kind?$o(la(r.parent)):$o(la(r)):(Jn(t,e.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor,"new.target"),je)}function lb(t){var r=$o(t);if(Q){var n=t.valueDeclaration;if(n&&e.hasInitializer(n))return jf(r)}return r}function ub(t){return e.Debug.assert(e.isIdentifier(t.name)),t.name.escapedText}function _b(e,t,r){var n=e.parameters.length-(J(e)?1:0);if(t<n)return e.parameters[t].escapedName;var i=e.parameters[n]||we,a=r||$o(i);if(Nf(a)){var o=a.target.labeledElementDeclarations,s=t-n;return o&&ub(o[s])||i.escapedName+"_"+s}return i.escapedName}function db(t){return t.valueDeclaration&&e.isParameter(t.valueDeclaration)&&e.isIdentifier(t.valueDeclaration.name)}function pb(t){return 197===t.kind||e.isParameter(t)&&t.name&&e.isIdentifier(t.name)}function fb(e,t){var r=e.parameters.length-(J(e)?1:0);if(t<r){var n=e.parameters[t].valueDeclaration;return n&&pb(n)?n:void 0}var i=e.parameters[r]||we,a=$o(i);if(Nf(a)){var o=a.target.labeledElementDeclarations;return o&&o[t-r]}return i.valueDeclaration&&pb(i.valueDeclaration)?i.valueDeclaration:void 0}function gb(e,t){return mb(e,t)||Le}function mb(e,t){var r=e.parameters.length-(J(e)?1:0);if(t<r)return lb(e.parameters[t]);if(J(e)){var n=$o(e.parameters[r]),i=t-r;if(!Nf(n)||n.target.hasRestElement||i<n.target.fixedLength)return K_(n,hd(i))}}function yb(t,r){var n=vb(t),i=hb(t),a=xb(t);if(a&&r>=n-1)return r===n-1?a:Bu(K_(a,Ze));for(var o=[],s=[],c=[],l=r;l<n;l++){!a||l<n-1?(o.push(gb(t,l)),s.push(l<i?1:2)):(o.push(a),s.push(8));var u=fb(t,l);u&&c.push(u);}return Vu(o,s,!1,e.length(c)===e.length(o)?c:void 0)}function vb(e){var t=e.parameters.length;if(J(e)){var r=$o(e.parameters[t-1]);if(Nf(r))return t+r.target.fixedLength-(r.target.hasRestElement?0:1)}return t}function hb(t,r){var n=1&r,i=2&r;if(i||void 0===t.resolvedMinArgumentCount){var a=void 0;if(J(t)){var o=$o(t.parameters[t.parameters.length-1]);if(Nf(o)){var s=e.findIndex(o.target.elementFlags,(function(e){return !(1&e)})),c=s<0?o.target.fixedLength:s;c>0&&(a=t.parameters.length-1+c);}}if(void 0===a){if(!n&&32&t.flags)return 0;a=t.minArgumentCount;}if(i)return a;for(var l=a-1;l>=0&&!(131072&km(gb(t,l),uh).flags);l--)a=l;t.resolvedMinArgumentCount=a;}return t.resolvedMinArgumentCount}function bb(e){if(J(e)){var t=$o(e.parameters[e.parameters.length-1]);return !Nf(t)||t.target.hasRestElement}return !1}function xb(e){if(J(e)){var t=$o(e.parameters[e.parameters.length-1]);if(!Nf(t))return t;if(t.target.hasRestElement)return Gu(t,t.target.fixedLength)}}function Db(e){var t=xb(e);return !t||cf(t)||_o(t)||0!=(131072&Hc(t).flags)?void 0:t}function Sb(e){return Tb(e,st)}function Tb(e,t){return e.parameters.length>0?gb(e,0):t}function Cb(t,r){if(r.typeParameters){if(t.typeParameters)return;t.typeParameters=r.typeParameters;}r.thisParameter&&(!(a=t.thisParameter)||a.valueDeclaration&&!a.valueDeclaration.type)&&(a||(t.thisParameter=Qf(r.thisParameter,void 0)),kb(t.thisParameter,$o(r.thisParameter)));for(var n=t.parameters.length-(J(t)?1:0),i=0;i<n;i++){var a=t.parameters[i];e.getEffectiveTypeAnnotationNode(a.valueDeclaration)||kb(a,mb(r,i));}J(t)&&((a=e.last(t.parameters)).valueDeclaration?!e.getEffectiveTypeAnnotationNode(a.valueDeclaration):65536&e.getCheckFlags(a))&&kb(a,yb(r,n));}function kb(t,r){var n=ri(t);if(n.type)r&&e.Debug.assertEqual(n.type,r,"Parameter symbol already has a cached type which differs from newly assigned type");else {var i=t.valueDeclaration;n.type=r||(i?jo(i,!0):$o(t)),i&&79!==i.name.kind&&(n.type===Ue&&(n.type=Bo(i.name)),Eb(i.name,n.type));}}function Eb(t,r){for(var n=0,i=t.elements;n<i.length;n++){var a=i[n];if(!e.isOmittedExpression(a)){var o=Do(a,r);79===a.name.kind?ri(la(a)).type=o:Eb(a.name,o);}}}function Nb(e){var t=Au(!0);return t!==Et?Yl(t,[e=$x(Yx(e))||Ue]):Ue}function Fb(e){var t=Pu(!0);return t!==Et?Yl(t,[e=$x(Yx(e))||Ue]):Ue}function Ab(t,r){var n=Nb(r);return n===Ue?(Jn(t,e.isImportCall(t)?e.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option:e.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option),je):(wu(!0)||Jn(t,e.isImportCall(t)?e.Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option:e.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option),n)}function Pb(t,r){if(!t.body)return je;var n,i,a,o=e.getFunctionFlags(t),s=0!=(2&o),c=0!=(1&o),l=ot;if(235!==t.body.kind)n=cx(t.body,r&&-9&r),s&&(n=Yx(Gx(n,!1,t,e.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)));else if(c){var u=Rb(t,r);u?u.length>0&&(n=a_(u,2)):l=st;var _=function(t,r){var n=[],i=[],a=0!=(2&e.getFunctionFlags(t));return e.forEachYieldExpression(t.body,(function(t){var o,s=t.expression?kx(t.expression,r):We;if(e.pushIfUnique(n,Ib(t,s,Le,a)),t.asteriskToken){var c=GD(s,a?19:17,t.expression);o=c&&c.nextType;}else o=Ly(t);o&&e.pushIfUnique(i,o);})),{yieldTypes:n,nextTypes:i}}(t,r),d=_.yieldTypes,p=_.nextTypes;i=e.some(d)?a_(d,2):void 0,a=e.some(p)?p_(p):void 0;}else {var f=Rb(t,r);if(!f)return 2&o?Ab(t,st):st;if(0===f.length)return 2&o?Ab(t,ot):ot;n=a_(f,2);}if(n||i||a){if(i&&og(t,i,3),n&&og(t,n,1),a&&og(t,a,2),n&&bf(n)||i&&bf(i)||a&&bf(a)){var g=zy(t),m=g?g===bl(t)?c?void 0:n:Oy(Nl(g),t):void 0;c?(i=Ef(i,m,0,s),n=Ef(n,m,1,s),a=Ef(a,m,2,s)):n=function(e,t,r){return e&&bf(e)&&(e=kf(e,t?r?Hx(t):t:void 0)),e}(n,m,s);}i&&(i=rg(i)),n&&(n=rg(n)),a&&(a=rg(a));}return c?wb(i||st,n||l,a||xy(2,t)||Ue,s):s?Nb(n||l):n||l}function wb(e,t,r,n){var i=n?Ur:Vr,a=i.getGlobalGeneratorType(!1);if(e=i.resolveIterationType(e,void 0)||Ue,t=i.resolveIterationType(t,void 0)||Ue,r=i.resolveIterationType(r,void 0)||Ue,a===Et){var o=i.getGlobalIterableIteratorType(!1),s=o!==Et?ZD(o,i):void 0,c=s?s.returnType:Le,l=s?s.nextType:qe;return _p(t,c)&&_p(l,r)?o!==Et?Lu(o,[e]):(i.getGlobalIterableIteratorType(!0),St):(i.getGlobalGeneratorType(!0),St)}return Lu(a,[e,t,r])}function Ib(t,r,n,i){var a=t.expression||t,o=t.asteriskToken?zD(i?19:17,r,n,a):r;return i?Zx(o,a,t.asteriskToken?e.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member:e.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member):o}function Ob(e,t,r,n){var i=0;if(n){for(var a=t;a<r.length;a++)i|=T.get(r[a])||32768;for(a=e;a<t;a++)i&=~(T.get(r[a])||0);for(a=0;a<e;a++)i|=T.get(r[a])||32768;}else {for(a=e;a<t;a++)i|=S.get(r[a])||128;for(a=0;a<e;a++)i&=~(S.get(r[a])||0);}return i}function Mb(t){var r=ni(t);return void 0!==r.isExhaustive?r.isExhaustive:r.isExhaustive=function(t){if(216===t.expression.kind){var r=Sx(t.expression.expression),n=Ob(0,0,xm(t,!1),!0),i=Mc(r)||r;return 3&i.flags?556800==(556800&n):!!(131072&km(i,(function(e){return (am(e)&n)===n})).flags)}var a=Sx(t.expression);if(!Df(a))return !1;var o,s,c=bm(t);return !(!c.length||e.some(c,hf))&&(o=Fm(a,md),s=c,1048576&o.flags?!e.forEach(o.types,(function(t){return !e.contains(s,t)})):e.contains(s,o))}(t)}function Lb(e){return e.endFlowNode&&qm(e.endFlowNode)}function Rb(t,r){var n=e.getFunctionFlags(t),i=[],a=Lb(t),o=!1;if(e.forEachReturnStatement(t.body,(function(s){var c=s.expression;if(c){var l=cx(c,r&&-9&r);2&n&&(l=Yx(Gx(l,!1,t,e.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member))),131072&l.flags&&(o=!0),e.pushIfUnique(i,l);}else a=!0;})),0!==i.length||a||!o&&!function(e){switch(e.kind){case 213:case 214:return !0;case 169:return 205===e.parent.kind;default:return !1}}(t))return !(Q&&i.length&&a)||Gh(t)&&i.some((function(e){return e.symbol===t.symbol}))||e.pushIfUnique(i,qe),i}function Bb(t,r){m((function(){var n=e.getFunctionFlags(t),i=r&&_S(r,n);if((!i||!Hb(i,16385))&&168!==t.kind&&!e.nodeIsMissing(t.body)&&235===t.body.kind&&Lb(t)){var a=512&t.flags,o=e.getEffectiveReturnTypeNode(t)||t;if(i&&131072&i.flags)Jn(o,e.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);else if(i&&!a)Jn(o,e.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);else if(i&&Q&&!_p(qe,i))Jn(o,e.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);else if(V.noImplicitReturns){if(!i){if(!a)return;var s=Nl(bl(t));if(dS(t,s))return}Jn(o,e.Diagnostics.Not_all_code_paths_return_a_value);}}}));}function jb(t,r){if(e.Debug.assert(169!==t.kind||e.isObjectLiteralMethod(t)),WS(t),e.isFunctionExpression(t)&&FD(t,t.name),r&&4&r&&rp(t)){if(!e.getEffectiveReturnTypeNode(t)&&!e.hasContextSensitiveParameters(t)){var n=Ky(t);if(n&&vg(Nl(n))){var i=ni(t);if(i.contextFreeType)return i.contextFreeType;var a=Pb(t,r),o=Qs(void 0,void 0,void 0,e.emptyArray,a,void 0,0,0),s=Ea(t.symbol,K,[o],e.emptyArray,e.emptyArray);return s.objectFlags|=262144,i.contextFreeType=s}}return Nt}return tC(t)||213!==t.kind||oC(t),function(t,r){var n=ni(t);if(!(1024&n.flags)){var i=Ky(t);if(!(1024&n.flags)){n.flags|=1024;var a=e.firstOrUndefined(el($o(la(t)),0));if(!a)return;if(rp(t))if(i){var o=Ry(t);r&&2&r&&function(t,r,n){for(var i=t.parameters.length-(J(t)?1:0),a=0;a<i;a++){var o=t.parameters[a].valueDeclaration;if(o.type){var s=e.getEffectiveTypeAnnotationNode(o);s&&Ig(n.inferences,kd(s),gb(r,a));}}var c=xb(r);if(c&&262144&c.flags){Cb(t,Kd(r,n.nonFixingMapper));var l=vb(r)-1;Ig(n.inferences,yb(t,l),c);}}(a,i,o),Cb(a,o?Kd(i,o.mapper):i);}else !function(e){e.thisParameter&&kb(e.thisParameter);for(var t=0,r=e.parameters;t<r.length;t++)kb(r[t]);}(a);if(i&&!Fl(t)&&!a.resolvedReturnType){var s=Pb(t,r);a.resolvedReturnType||(a.resolvedReturnType=s);}Ax(t);}}}(t,r),$o(la(t))}function Jb(e,t,r,n){if(void 0===n&&(n=!1),!_p(t,mt)){var i=n&&Wx(t);return Un(e,!!i&&_p(i,mt),r),!1}return !0}function zb(t){if(!e.isCallExpression(t))return !1;if(!e.isBindableObjectDefinePropertyCall(t))return !1;var r=cx(t.arguments[2]);if(uo(r,"value")){var n=Zc(r,"writable"),i=n&&$o(n);if(!i||i===et||i===tt)return !0;if(n&&n.valueDeclaration&&e.isPropertyAssignment(n.valueDeclaration)){var a=kx(n.valueDeclaration.initializer);if(a===et||a===tt)return !0}return !1}return !Zc(r,"set")}function Kb(t){return !!(8&e.getCheckFlags(t)||4&t.flags&&64&e.getDeclarationModifierFlagsFromSymbol(t)||3&t.flags&&2&vv(t)||98304&t.flags&&!(65536&t.flags)||8&t.flags||e.some(t.declarations,zb))}function Ub(t,r,n){var i,a;if(0===n)return !1;if(Kb(r)){if(4&r.flags&&e.isAccessExpression(t)&&108===t.expression.kind){var o=e.getContainingFunction(t);if(!o||171!==o.kind&&!Gh(o))return !0;if(r.valueDeclaration){var s=e.isBinaryExpression(r.valueDeclaration),c=o.parent===r.valueDeclaration.parent,l=o===r.valueDeclaration.parent,u=s&&(null===(i=r.parent)||void 0===i?void 0:i.valueDeclaration)===o.parent,_=s&&(null===(a=r.parent)||void 0===a?void 0:a.valueDeclaration)===o;return !(c||l||u||_)}}return !0}if(e.isAccessExpression(t)){var d=e.skipParentheses(t.expression);if(79===d.kind){var p=ni(d).resolvedSymbol;if(2097152&p.flags){var f=xi(p);return !!f&&268===f.kind}}}return !1}function Vb(t,r,n){var i=e.skipOuterExpressions(t,7);return 79===i.kind||e.isAccessExpression(i)?!(32&i.flags&&(Jn(t,n),1)):(Jn(t,r),!1)}function qb(e){return Hb(e,2112)?Gb(e,3)||Hb(e,296)?mt:$e:Ze}function Wb(e,t){if(Hb(e,t))return !0;var r=Lc(e);return !!r&&Hb(r,t)}function Hb(e,t){if(e.flags&t)return !0;if(3145728&e.flags)for(var r=0,n=e.types;r<n.length;r++)if(Hb(n[r],t))return !0;return !1}function Gb(e,t,r){return !!(e.flags&t)||!(r&&114691&e.flags)&&(!!(296&t)&&_p(e,Ze)||!!(2112&t)&&_p(e,$e)||!!(402653316&t)&&_p(e,Ye)||!!(528&t)&&_p(e,it)||!!(16384&t)&&_p(e,ot)||!!(131072&t)&&_p(e,st)||!!(65536&t)&&_p(e,Qe)||!!(32768&t)&&_p(e,qe)||!!(4096&t)&&_p(e,at)||!!(67108864&t)&&_p(e,dt))}function Qb(t,r,n){return 1048576&t.flags?e.every(t.types,(function(e){return Qb(e,r,n)})):Gb(t,r,n)}function Xb(t){return !!(16&e.getObjectFlags(t))&&!!t.symbol&&Yb(t.symbol)}function Yb(e){return 0!=(128&e.flags)}function Zb(t,r,n,i,a){void 0===a&&(a=!1);var o=t.properties,s=o[n];if(296===s.kind||297===s.kind){var c=s.name,l=v_(c);if(Rs(l)){var u=Zc(r,Ks(l));u&&(Zv(u,s,a),bv(s,!1,!0,r,u));}var _=vo(s,K_(r,l,32,c));return ex(297===s.kind?s:s.initializer,_)}if(298===s.kind){if(!(n<o.length-1)){q<99&&GT(s,4);var d=[];if(i)for(var p=0,f=i;p<f.length;p++){var g=f[p];e.isSpreadAssignment(g)||d.push(g.name);}return _=go(r,d,r.symbol),$T(i,e.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma),ex(s.expression,_)}Jn(s,e.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);}else Jn(s,e.Diagnostics.Property_assignment_expected);}function $b(t,r,n,i,a){var o=t.elements,s=o[n];if(227!==s.kind){if(225!==s.kind){var c=hd(n);if(pf(r)){var l=V_(r,c,32|(Uy(s)?16:0),kh(s,c))||je;return ex(s,vo(s,Uy(s)?om(l,524288):l),a)}return ex(s,i,a)}if(n<o.length-1)Jn(s,e.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);else {var u=s.expression;if(221!==u.kind||63!==u.operatorToken.kind)return $T(t.elements,e.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma),ex(u,Cm(r,Nf)?Fm(r,(function(e){return Gu(e,n)})):Bu(i),a);Jn(u.operatorToken,e.Diagnostics.A_rest_element_cannot_have_an_initializer);}}}function ex(t,r,n,i){var a;if(297===t.kind){var o=t;o.objectAssignmentInitializer&&(!Q||32768&Mf(kx(o.objectAssignmentInitializer))||(r=om(r,524288)),function(e,t,r,n,i){var a=t.kind;if(63===a&&(205===e.kind||204===e.kind))return ex(e,kx(r,n),n,108===r.kind);nx(e,t,r,55===a||56===a||60===a?BD(e,n):kx(e,n),kx(r,n),void 0);}(o.name,o.equalsToken,o.objectAssignmentInitializer,n)),a=t.name;}else a=t;return 221===a.kind&&63===a.operatorToken.kind&&(ae(a,n),a=a.left),205===a.kind?function(e,t,r){var n=e.properties;if(Q&&0===n.length)return Fv(t,e);for(var i=0;i<n.length;i++)Zb(e,t,i,n,r);return t}(a,r,i):204===a.kind?function(e,t,r){var n=e.elements;q<2&&V.downlevelIteration&&GT(e,512);for(var i=zD(193,t,qe,e)||je,a=V.noUncheckedIndexedAccess?void 0:i,o=0;o<n.length;o++){var s=i;225===e.elements[o].kind&&(s=a=null!=a?a:zD(65,t,qe,e)||je),$b(e,t,o,s,r);}return t}(a,r,n):function(t,r,n){var i=kx(t,n);return Vb(t,298===t.parent.kind?e.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access:e.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,298===t.parent.kind?e.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access:e.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)&&mp(r,i,t,t),e.isPrivateIdentifierPropertyAccessExpression(t)&&GT(t.parent,1048576),r}(a,r,n)}function tx(t){switch((t=e.skipParentheses(t)).kind){case 79:case 10:case 13:case 210:case 223:case 14:case 8:case 9:case 110:case 95:case 104:case 153:case 213:case 226:case 214:case 204:case 205:case 216:case 230:case 279:case 278:return !0;case 222:return tx(t.whenTrue)&&tx(t.whenFalse);case 221:return !e.isAssignmentOperator(t.operatorToken.kind)&&tx(t.left)&&tx(t.right);case 219:case 220:switch(t.operator){case 53:case 39:case 40:case 54:return !0}return !1;case 217:case 211:case 229:default:return !1}}function rx(e,t){return 0!=(98304&t.flags)||pp(e,t)}function nx(t,r,n,i,a,o){var s,c,l=r.kind;switch(l){case 41:case 42:case 66:case 67:case 43:case 68:case 44:case 69:case 40:case 65:case 47:case 70:case 48:case 71:case 49:case 72:case 51:case 74:case 52:case 78:case 50:case 73:if(i===ct||a===ct)return ct;i=Fv(i,t),a=Fv(a,n);var u=void 0;if(528&i.flags&&528&a.flags&&void 0!==(u=function(e){switch(e){case 51:case 74:return 56;case 52:case 78:return 37;case 50:case 73:return 55;default:return}}(r.kind)))return Jn(o||r,e.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead,e.tokenToString(r.kind),e.tokenToString(u)),Ze;var _,d=Jb(t,i,e.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type,!0),p=Jb(n,a,e.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type,!0);if(Gb(i,3)&&Gb(a,3)||!Hb(i,2112)&&!Hb(a,2112))_=Ze;else if(T(i,a)){switch(l){case 49:case 72:N();break;case 42:case 67:q<3&&Jn(o,e.Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);}_=$e;}else N(T),_=je;return d&&p&&k(_),_;case 39:case 64:if(i===ct||a===ct)return ct;Gb(i,402653316)||Gb(a,402653316)||(i=Fv(i,t),a=Fv(a,n));var f=void 0;if(Gb(i,296,!0)&&Gb(a,296,!0)?f=Ze:Gb(i,2112,!0)&&Gb(a,2112,!0)?f=$e:Gb(i,402653316,!0)||Gb(a,402653316,!0)?f=Ye:(_o(i)||_o(a))&&(f=po(i)||po(a)?je:Le),f&&!C(l))return f;if(!f){var g=402655727;return N((function(e,t){return Gb(e,g)&&Gb(t,g)})),Le}return 64===l&&k(f),f;case 29:case 31:case 32:case 33:return C(l)&&(i=Sf(Fv(i,t)),a=Sf(Fv(a,n)),E((function(e,t){return pp(e,t)||pp(t,e)||_p(e,mt)&&_p(t,mt)}))),it;case 34:case 35:case 36:case 37:return E((function(e,t){return rx(e,t)||rx(t,e)})),it;case 102:return function(t,r,n,i){return n===ct||i===ct?ct:(!_o(n)&&Qb(n,131068)&&Jn(t,e.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter),_o(i)||pT(i)||up(i,jt)||Jn(r,e.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type),it)}(t,n,i,a);case 101:return function(t,r,n,i){if(n===ct||i===ct)return ct;e.isPrivateIdentifier(t)?(q<99&&GT(t,2097152),!ni(t).resolvedSymbol&&e.getContainingClass(t)&&Uv(t,i,jv(t,i.symbol,!0))):Qb(n=Fv(n,t),402665900)||Gb(n,407109632)||Jn(t,e.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);var a=Fc(i=Fv(i,r));return (!Qb(i,126091264)||a&&(Gb(i,3145728)&&!Qb(a,126091264)||!Hb(a,126615552)))&&Jn(r,e.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive),it}(t,n,i,a);case 55:case 76:var y=4194304&am(i)?a_([(c=Q?i:Sf(a),Fm(c,Rf)),a]):i;return 76===l&&k(a),y;case 56:case 75:var v=8388608&am(i)?a_([Lf(i),a],2):i;return 75===l&&k(a),v;case 60:case 77:var h=262144&am(i)?a_([Jf(i),a],2):i;return 77===l&&k(a),h;case 63:var b=e.isBinaryExpression(t.parent)?e.getAssignmentDeclarationKind(t.parent):0;return function(t,r){if(2===t)for(var n=0,i=Cc(r);n<i.length;n++){var a=i[n],o=$o(a);if(o.symbol&&32&o.symbol.flags){var s=a.escapedName,c=li(a.valueDeclaration,s,788968,void 0,s,!1);(null==c?void 0:c.declarations)&&c.declarations.some(e.isJSDocTypedefTag)&&(Zn(c,e.Diagnostics.Duplicate_identifier_0,e.unescapeLeadingUnderscores(s),a),Zn(a,e.Diagnostics.Duplicate_identifier_0,e.unescapeLeadingUnderscores(s),c));}}}(b,a),function(r){var i;switch(r){case 2:return !0;case 1:case 5:case 6:case 3:case 4:var a=la(t),o=e.getAssignedExpandoInitializer(n);return !!o&&e.isObjectLiteralExpression(o)&&!!(null===(i=null==a?void 0:a.exports)||void 0===i?void 0:i.size);default:return !1}}(b)?(524288&a.flags&&(2===b||6===b||Np(a)||im(a)||1&e.getObjectFlags(a))||k(a),i):(k(a),Xf(a));case 27:if(!V.allowUnreachableCode&&tx(t)&&(79!==(s=n).kind||"eval"!==s.escapedText)){var x=e.getSourceFileOfNode(t),D=x.text,S=e.skipTrivia(D,t.pos);x.parseDiagnostics.some((function(t){return t.code===e.Diagnostics.JSX_expressions_must_have_one_parent_element.code&&e.textSpanContainsPosition(t,S)}))||Jn(t,e.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);}return a;default:return e.Debug.fail()}function T(e,t){return Gb(e,2112)&&Gb(t,2112)}function C(r){var o=Wb(i,12288)?t:Wb(a,12288)?n:void 0;return !o||(Jn(o,e.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol,e.tokenToString(r)),!1)}function k(r){e.isAssignmentOperator(l)&&m((function(){if(Vb(t,e.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,e.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)&&(!e.isIdentifier(t)||"exports"!==e.unescapeLeadingUnderscores(t.escapedText))){var a=void 0;if(ie&&e.isPropertyAccessExpression(t)&&Hb(r,32768)){var o=uo(Sx(t.expression),t.name.escapedText);jp(r,o)&&(a=e.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target);}mp(r,i,t,n,a);}}));}function E(e){return !e(i,a)&&(N(e),!0)}function N(t){var n,s=!1,c=o||r;if(t){var l=$x(i),u=$x(a);s=!(l===i&&u===a)&&!(!l||!u)&&t(l,u);}var _=i,d=a;!s&&t&&(n=function(e,t,r){var n=e,i=t,a=Sf(e),o=Sf(t);return r(a,o)||(n=a,i=o),[n,i]}(i,a,t),_=n[0],d=n[1]);var p=Wa(_,d),f=p[0],g=p[1];(function(t,n,i,a){var o;switch(r.kind){case 36:case 34:o="false";break;case 37:case 35:o="true";}if(o)return Un(t,n,e.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap,o,i,a)})(c,s,f,g)||Un(c,s,e.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2,e.tokenToString(r.kind),f,g);}}function ix(t){var r=t.parent;return e.isParenthesizedExpression(r)&&ix(r)||e.isElementAccessExpression(r)&&r.argumentExpression===t}function ax(t){for(var r=[t.head.text],n=[],i=0,a=t.templateSpans;i<a.length;i++){var o=a[i],s=kx(o.expression);Wb(s,12288)&&Jn(o.expression,e.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String),r.push(o.literal.text),n.push(_p(s,yt)?s:Ye);}return px(t)||ix(t)||Tm(Ly(t)||Ue,ox)?T_(r,n):Ye}function ox(e){return !!(134217856&e.flags||58982400&e.flags&&Hb(Mc(e)||Ue,402653316))}function sx(t,r,n,i){var a=function(t){return 286!==t.kind||e.isJsxSelfClosingElement(t.parent)?t:t.parent.parent}(t),o=a.contextualType,s=a.inferenceContext;try{a.contextualType=r,a.inferenceContext=n;var c=kx(t,1|i|(n?2:0));return n&&n.intraExpressionInferenceSites&&(n.intraExpressionInferenceSites=void 0),Hb(c,2944)&&dx(c,Oy(r,t))?md(c):c}finally{a.contextualType=o,a.inferenceContext=s;}}function cx(e,t){if(t&&0!==t)return kx(e,t);var r=ni(e);if(!r.resolvedType){var n=Gr,i=Er;Gr=Qr,Er=void 0,r.resolvedType=kx(e,t),Er=i,Gr=n;}return r.resolvedType}function lx(t){return 211===(t=e.skipParentheses(t,!0)).kind||229===t.kind||e.isJSDocTypeAssertion(t)}function ux(t,r,n){var i=e.getEffectiveInitializer(t),a=Tx(i)||(n?sx(i,n,void 0,r||0):cx(i,r));return e.isParameter(t)&&202===t.name.kind&&Nf(a)&&!a.target.hasRestElement&&tu(a)<t.name.elements.length?function(t,r){for(var n=r.elements,i=eu(t).slice(),a=t.target.elementFlags.slice(),o=tu(t);o<n.length;o++){var s=n[o];(o<n.length-1||203!==s.kind||!s.dotDotDotToken)&&(i.push(!e.isOmittedExpression(s)&&Uy(s)?Ro(s,!1,!1):Le),a.push(2),e.isOmittedExpression(s)||Uy(s)||ag(s,Le));}return Vu(i,a,t.target.readonly)}(a,t.name):a}function _x(t,r){var n=2&e.getCombinedNodeFlags(t)||e.isDeclarationReadonly(t)?r:Tf(r);if(e.isInJSFile(t)){if(gf(n))return ag(t,Le),Le;if(mf(n))return ag(t,Qt),Qt}return n}function dx(t,r){if(r){if(3145728&r.flags){var n=r.types;return e.some(n,(function(e){return dx(t,e)}))}if(58982400&r.flags){var i=Mc(r)||Ue;return Hb(i,4)&&Hb(t,128)||Hb(i,8)&&Hb(t,256)||Hb(i,64)&&Hb(t,2048)||Hb(i,4096)&&Hb(t,8192)||dx(t,i)}return !!(406847616&r.flags&&Hb(t,128)||256&r.flags&&Hb(t,256)||2048&r.flags&&Hb(t,2048)||512&r.flags&&Hb(t,512)||8192&r.flags&&Hb(t,8192))}return !1}function px(t){var r=t.parent;return e.isAssertionExpression(r)&&e.isConstTypeReference(r.type)||e.isJSDocTypeAssertion(r)&&e.isConstTypeReference(e.getJSDocTypeAssertionType(r))||(e.isParenthesizedExpression(r)||e.isArrayLiteralExpression(r)||e.isSpreadElement(r))&&px(r)||(e.isPropertyAssignment(r)||e.isShorthandPropertyAssignment(r)||e.isTemplateSpan(r))&&px(r.parent)}function fx(t,r,n,i){var a=kx(t,r,i);return px(t)||e.isCommonJsExportedExpression(t)?md(a):lx(t)?a:kf(a,Oy(2===arguments.length?Ly(t):n,t))}function gx(e,t){return 162===e.name.kind&&Hy(e.name),fx(e.initializer,t)}function mx(e,t){return dC(e),162===e.name.kind&&Hy(e.name),yx(e,jb(e,t),t)}function yx(t,r,n){if(n&&10&n){var i=mh(r,0,!0),a=mh(r,1,!0),o=i||a;if(o&&o.typeParameters){var s=Iy(t,2);if(s){var c=mh(Jf(s),i?0:1,!1);if(c&&!c.typeParameters){if(8&n)return vx(t,n),Nt;var l=Ry(t),u=l.signature&&Nl(l.signature),_=u&&gh(u);if(_&&!_.typeParameters&&!e.every(l.inferences,hx)){var d=function(t,r){for(var n,i,a=[],o=0,s=r;o<s.length;o++){var c=(p=s[o]).symbol.escapedName;if(bx(t.inferredTypeParameters,c)||bx(a,c)){var l=Da(Hn(262144,xx(e.concatenate(t.inferredTypeParameters,a),c)));l.target=p,n=e.append(n,p),i=e.append(i,l),a.push(l);}else a.push(p);}if(i)for(var u=wd(n,i),_=0,d=i;_<d.length;_++){var p;(p=d[_]).mapper=u;}return a}(l,o.typeParameters),p=Il(o,d),f=e.map(l.inferences,(function(e){return gg(e.typeParameter)}));if(sg(p,c,(function(e,t){Ig(f,e,t,0,!0);})),e.some(f,hx)&&(cg(p,c,(function(e,t){Ig(f,e,t);})),!function(e,t){for(var r=0;r<e.length;r++)if(hx(e[r])&&hx(t[r]))return !0;return !1}(l.inferences,f)))return function(e,t){for(var r=0;r<e.length;r++)!hx(e[r])&&hx(t[r])&&(e[r]=t[r]);}(l.inferences,f),l.inferredTypeParameters=e.concatenate(l.inferredTypeParameters,d),Rl(p)}return Rl(yh(o,c,l))}}}}return r}function vx(e,t){2&t&&(Ry(e).flags|=4);}function hx(e){return !(!e.candidates&&!e.contraCandidates)}function bx(t,r){return e.some(t,(function(e){return e.symbol.escapedName===r}))}function xx(e,t){for(var r=t.length;r>1&&t.charCodeAt(r-1)>=48&&t.charCodeAt(r-1)<=57;)r--;for(var n=t.slice(0,r),i=1;;i++){var a=n+i;if(!bx(e,a))return a}}function Dx(e){var t=fh(e);if(t&&!t.typeParameters)return Nl(t)}function Sx(t){var r=Tx(t);if(r)return r;if(134217728&t.flags&&Er){var n=Er[O(t)];if(n)return n}var i=Zr,a=kx(t);return Zr!==i&&((Er||(Er=[]))[O(t)]=a,e.setNodeFlags(t,134217728|t.flags)),a}function Tx(t){var r=e.skipParentheses(t,!0);if(e.isJSDocTypeAssertion(r)){var n=e.getJSDocTypeAssertionType(r);if(!e.isConstTypeReference(n))return kd(n)}if(r=e.skipParentheses(t),!e.isCallExpression(r)||106===r.expression.kind||e.isRequireCall(r,!0)||$h(r)){if(e.isAssertionExpression(r)&&!e.isConstTypeReference(r.type))return kd(r.type);if(8===t.kind||10===t.kind||110===t.kind||95===t.kind)return kx(t)}else if(n=e.isCallChain(r)?function(e){var t=kx(e.expression),r=Vf(t,e.expression),n=Dx(t);return n&&Uf(n,e,r!==t)}(r):Dx(Sv(r.expression)))return n}function Cx(e){var t=ni(e);if(t.contextFreeType)return t.contextFreeType;var r=e.contextualType;e.contextualType=Le;try{return t.contextFreeType=kx(e,4)}finally{e.contextualType=r;}}function kx(t,n,i){null===e.tracing||void 0===e.tracing||e.tracing.push("check","checkExpression",{kind:t.kind,pos:t.pos,end:t.end,path:t.tracingPath});var a=u;u=t,k=0;var o=yx(t,function(t,n,i){var a=t.kind;if(r)switch(a){case 226:case 213:case 214:r.throwIfCancellationRequested();}switch(a){case 79:return function(t,r){if(e.isThisInTypeQuery(t))return _y(t);var n=Kg(t);if(n===we)return je;if(n===de){if(zv(t))return Jn(t,e.Diagnostics.arguments_cannot_be_referenced_in_property_initializers),je;var i=e.getContainingFunction(t);return q<2&&(214===i.kind?Jn(t,e.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression):e.hasSyntacticModifier(i,256)&&Jn(t,e.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method)),ni(i).flags|=8192,$o(n)}t.parent&&e.isPropertyAccessExpression(t.parent)&&t.parent.expression===t||ay(n,t);var a=ga(n),o=MS(a,t);qn(o)&&F_(t,o)&&o.declarations&&Wn(t,o.declarations,t.escapedText);var s=a.valueDeclaration;if(s&&32&a.flags)if(257===s.kind&&e.nodeIsDecorated(s))for(i=e.getContainingClass(t);void 0!==i;){if(i===s&&i.name!==t){ni(s).flags|=16777216,ni(t).flags|=33554432;break}i=e.getContainingClass(i);}else if(226===s.kind)for(i=e.getThisContainer(t,!1);305!==i.kind;){if(i.parent===s){(e.isPropertyDeclaration(i)&&e.isStatic(i)||e.isClassStaticBlockDeclaration(i))&&(ni(s).flags|=16777216,ni(t).flags|=33554432);break}i=e.getThisContainer(i,!1);}!function(t,r){if(!(q>=2||0==(34&r.flags)||!r.valueDeclaration||e.isSourceFile(r.valueDeclaration)||292===r.valueDeclaration.parent.kind)){var n=e.getEnclosingBlockScopeContainer(r.valueDeclaration),i=function(t,r){return !!e.findAncestor(t,(function(t){return t===r?"quit":e.isFunctionLike(t)||t.parent&&e.isPropertyDeclaration(t.parent)&&!e.hasStaticModifier(t.parent)&&t.parent.initializer===t}))}(t,n),a=oy(n);if(a){if(i){var o=!0;if(e.isForStatement(n)&&(u=e.getAncestor(r.valueDeclaration,255))&&u.parent===n){var s=function(t,r){return e.findAncestor(t,(function(e){return e===r?"quit":e===r.initializer||e===r.condition||e===r.incrementor||e===r.statement}))}(t.parent,n);if(s){var c=ni(s);c.flags|=131072;var l=c.capturedBlockScopeBindings||(c.capturedBlockScopeBindings=[]);e.pushIfUnique(l,r),s===n.initializer&&(o=!1);}}o&&(ni(a).flags|=65536);}var u;e.isForStatement(n)&&(u=e.getAncestor(r.valueDeclaration,255))&&u.parent===n&&function(t,r){for(var n=t;212===n.parent.kind;)n=n.parent;var i=!1;if(e.isAssignmentTarget(n))i=!0;else if(219===n.parent.kind||220===n.parent.kind){var a=n.parent;i=45===a.operator||46===a.operator;}return !!i&&!!e.findAncestor(n,(function(e){return e===r?"quit":e===r.statement}))}(t,n)&&(ni(r.valueDeclaration).flags|=4194304),ni(r.valueDeclaration).flags|=524288;}i&&(ni(r.valueDeclaration).flags|=262144);}}(t,n);var c=function(t,r){var n=t.valueDeclaration;if(n){if(e.isBindingElement(n)&&!n.initializer&&!n.dotDotDotToken&&n.parent.elements.length>=2){var i=n.parent.parent;if(254===i.kind&&2&e.getCombinedNodeFlags(n)||164===i.kind){var a=ni(i);if(!(268435456&a.flags)){a.flags|=268435456;var o=fo(i,0);if(a.flags&=-268435457,o&&1048576&o.flags&&(164!==i.kind||!Zm(t)))return 131072&(l=Xm(n.parent,o,o,void 0,r.flowNode)).flags?st:Do(n,l)}}}if(e.isParameter(n)&&!n.type&&!n.initializer&&!n.dotDotDotToken){var s=n.parent;if(s.parameters.length>=2&&ip(s)){var c=Ky(s);if(c&&1===c.parameters.length&&J(c)){var l,u=Uc($o(c.parameters[0]));if(1048576&u.flags&&Cm(u,Nf)&&!Zm(t))return K_(l=Xm(s,u,u,void 0,r.flowNode),hd(s.parameters.indexOf(n)-(e.getThisParameter(s)?1:0)))}}}}return $o(t)}(a,t),l=e.getAssignmentTargetKind(t);if(l){if(!(3&a.flags||e.isInJSFile(t)&&512&a.flags))return Jn(t,384&a.flags?e.Diagnostics.Cannot_assign_to_0_because_it_is_an_enum:32&a.flags?e.Diagnostics.Cannot_assign_to_0_because_it_is_a_class:1536&a.flags?e.Diagnostics.Cannot_assign_to_0_because_it_is_a_namespace:16&a.flags?e.Diagnostics.Cannot_assign_to_0_because_it_is_a_function:2097152&a.flags?e.Diagnostics.Cannot_assign_to_0_because_it_is_an_import:e.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable,Ua(n)),je;if(Kb(a))return 3&a.flags?Jn(t,e.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant,Ua(n)):Jn(t,e.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property,Ua(n)),je}var u=2097152&a.flags;if(3&a.flags){if(1===l)return c}else {if(!u)return c;s=xi(n);}if(!s)return c;c=ny(c,t,r);for(var _=164===e.getRootDeclaration(s).kind,d=Ym(s),p=Ym(t),f=p!==d,g=t.parent&&t.parent.parent&&e.isSpreadAssignment(t.parent)&&dm(t.parent.parent),m=134217728&n.flags;p!==d&&(213===p.kind||214===p.kind||e.isObjectLiteralOrClassExpressionMethodOrAccessor(p))&&(ey(a)&&c!==Xt||_&&!Zm(a));)p=Ym(p);var y=_||u||f||g||m||e.isBindingElement(s)||c!==Re&&c!==Xt&&(!Q||0!=(16387&c.flags)||Ug(t)||275===t.parent.kind)||230===t.parent.kind||254===s.kind&&s.exclamationToken||16777216&s.flags,v=Xm(t,c,y?_?function(e,t){if(ao(t.symbol,2)){var r=Q&&164===t.kind&&t.initializer&&32768&Mf(e)&&!(32768&Mf(kx(t.initializer)));return co(),r?om(e,524288):e}return Xo(t.symbol),e}(c,s):c:c===Re||c===Xt?qe:jf(c),p);if(Jm(t)||c!==Re&&c!==Xt){if(!y&&!(32768&Mf(c))&&32768&Mf(v))return Jn(t,e.Diagnostics.Variable_0_is_used_before_being_assigned,Ua(n)),c}else if(v===Re||v===Xt)return $&&(Jn(e.getNameOfDeclaration(s),e.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined,Ua(n),qa(v)),Jn(t,e.Diagnostics.Variable_0_implicitly_has_an_1_type,Ua(n),qa(v))),AD(v);return l?Sf(v):v}(t,n);case 80:return function(t){!function(t){if(!e.getContainingClass(t))return DC(t,e.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);if(!e.isForInStatement(t.parent)){if(!e.isExpressionNode(t))return DC(t,e.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);var r=e.isBinaryExpression(t.parent)&&101===t.parent.operatorToken.kind;Mv(t)||r||DC(t,e.Diagnostics.Cannot_find_name_0,e.idText(t));}}(t);var r=Mv(t);return r&&Zv(r,void 0,!1),Le}(t);case 108:return _y(t);case 106:return fy(t);case 104:return Xe;case 14:case 10:return gd(vd(t.text));case 8:return CC(t),gd(hd(+t.text));case 9:return function(t){if(!(e.isLiteralTypeNode(t.parent)||e.isPrefixUnaryExpression(t.parent)&&e.isLiteralTypeNode(t.parent.parent))&&q<7&&DC(t,e.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020));}(t),gd(bd({negative:!1,base10Value:e.parsePseudoBigInt(t.text)}));case 110:return rt;case 95:return et;case 223:return ax(t);case 13:return Ht;case 204:return Vy(t,n,i);case 205:return function(t,r){var n=e.isAssignmentTarget(t);!function(t,r){for(var n=new e.Map,i=0,a=t.properties;i<a.length;i++){var o=a[i];if(298!==o.kind){var s=o.name;if(162===s.kind&&aC(s),297===o.kind&&!r&&o.objectAssignmentInitializer&&DC(o.equalsToken,e.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern),80===s.kind&&DC(s,e.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies),o.modifiers)for(var c=0,l=o.modifiers;c<l.length;c++){var u=l[c];131===u.kind&&169===o.kind||DC(u,e.Diagnostics._0_modifier_cannot_be_used_here,e.getTextOfNode(u));}var _=void 0;switch(o.kind){case 297:cC(o.exclamationToken,e.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);case 296:sC(o.questionToken,e.Diagnostics.An_object_member_cannot_be_declared_optional),8===s.kind&&CC(s),_=4;break;case 169:_=8;break;case 172:_=1;break;case 173:_=2;break;default:throw e.Debug.assertNever(o,"Unexpected syntax kind:"+o.kind)}if(!r){var d=e.getPropertyNameForPropertyNameNode(s);if(void 0===d)continue;var p=n.get(d);if(p)if(8&_&&8&p)DC(s,e.Diagnostics.Duplicate_identifier_0,e.getTextOfNode(s));else if(4&_&&4&p)DC(s,e.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name,e.getTextOfNode(s));else {if(!(3&_&&3&p))return DC(s,e.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);if(3===p||_===p)return DC(s,e.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);n.set(d,_|p);}else n.set(d,_);}}else if(r){var f=e.skipParentheses(o.expression);if(e.isArrayLiteralExpression(f)||e.isObjectLiteralExpression(f))return DC(o.expression,e.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern)}}}(t,n);for(var i=Q?e.createSymbolTable():void 0,a=e.createSymbolTable(),o=[],s=St,c=Iy(t),l=c&&c.pattern&&(201===c.pattern.kind||205===c.pattern.kind),u=px(t),_=u?8:0,d=e.isInJSFile(t)&&!e.isInJsonFile(t),p=e.getJSDocEnumTag(t),f=!c&&d&&!p,g=ne,m=!1,y=!1,v=!1,h=!1,b=0,x=t.properties;b<x.length;b++){var D=x[b];D.name&&e.isComputedPropertyName(D.name)&&Hy(D.name);}for(var S=0,T=0,C=t.properties;T<C.length;T++){var k=C[T],E=la(k),N=k.name&&162===k.name.kind?Hy(k.name):void 0;if(296===k.kind||297===k.kind||e.isObjectLiteralMethod(k)){var F=296===k.kind?gx(k,r):297===k.kind?fx(!n&&k.objectAssignmentInitializer?k.objectAssignmentInitializer:k.name,r):mx(k,r);if(d){var A=So(k);A?(gp(F,A,k),F=A):p&&p.typeExpression&&gp(F,kd(p.typeExpression),k);}g|=458752&e.getObjectFlags(F);var P=N&&Rs(N)?N:void 0,w=P?Hn(4|E.flags,Ks(P),4096|_):Hn(4|E.flags,E.escapedName,_);if(P&&(w.nameType=P),n)(296===k.kind&&Uy(k.initializer)||297===k.kind&&k.objectAssignmentInitializer)&&(w.flags|=16777216);else if(l&&!(512&e.getObjectFlags(c))){var I=Zc(c,E.escapedName);I?w.flags|=16777216&I.flags:V.suppressExcessPropertyErrors||ol(c,Ye)||Jn(k.name,e.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,Ua(E),qa(c));}if(w.declarations=E.declarations,w.parent=E.parent,E.valueDeclaration&&(w.valueDeclaration=E.valueDeclaration),w.type=F,w.target=E,E=w,null==i||i.set(w.escapedName,w),c&&r&&2&r&&!(4&r)&&(296===k.kind||169===k.kind)&&rp(k)){var O=Ry(t);e.Debug.assert(O),pg(O,296===k.kind?k.initializer:k,F);}}else {if(298===k.kind){if(q<2&&GT(k,2),o.length>0&&(s=_d(s,B(),t.symbol,g,u),o=[],a=e.createSymbolTable(),y=!1,v=!1,h=!1),Yy(F=Hc(kx(k.expression)))){var M=ud(F,u);if(i&&rv(M,i,k),S=o.length,po(s))continue;s=_d(s,M,t.symbol,g,u);}else Jn(k,e.Diagnostics.Spread_types_may_only_be_created_from_object_types),s=je;continue}e.Debug.assert(172===k.kind||173===k.kind),WS(k);}!N||8576&N.flags?a.set(E.escapedName,E):_p(N,ft)&&(_p(N,Ze)?v=!0:_p(N,at)?h=!0:y=!0,n&&(m=!0)),o.push(E);}if(l&&298!==t.parent.kind)for(var L=0,R=Nc(c);L<R.length;L++)w=R[L],a.get(w.escapedName)||Zc(s,w.escapedName)||(16777216&w.flags||Jn(w.valueDeclaration||w.bindingElement,e.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value),a.set(w.escapedName,w),o.push(w));return po(s)?je:s!==St?(o.length>0&&(s=_d(s,B(),t.symbol,g,u),o=[],a=e.createSymbolTable(),y=!1,v=!1),Fm(s,(function(e){return e===St?B():e}))):B();function B(){var r=[];y&&r.push(Qy(t,S,o,Ye)),v&&r.push(Qy(t,S,o,Ze)),h&&r.push(Qy(t,S,o,at));var i=Ea(t.symbol,a,e.emptyArray,e.emptyArray,r);return i.objectFlags|=131200|g,f&&(i.objectFlags|=4096),m&&(i.objectFlags|=512),n&&(i.pattern=t),i}}(t,n);case 206:return Pv(t,n);case 161:return wv(t,n);case 207:return function(e,t){return 32&e.flags?function(e,t){var r=kx(e.expression),n=Vf(r,e.expression);return Uf(ih(e,Fv(n,e.expression),t),e,n!==r)}(e,t):ih(e,Sv(e.expression),t)}(t,n);case 208:if(100===t.expression.kind)return function(t){if(function(t){if(W===e.ModuleKind.ES2015)return DC(t,e.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext);if(t.typeArguments)return DC(t,e.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);var r=t.arguments;if(W!==e.ModuleKind.ESNext&&W!==e.ModuleKind.NodeNext&&($T(r),r.length>1))return DC(r[1],e.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);if(0===r.length||r.length>2)return DC(t,e.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments);var n=e.find(r,e.isSpreadElement);n&&DC(n,e.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element);}(t),0===t.arguments.length)return Ab(t,Le);for(var r=t.arguments[0],n=cx(r),i=t.arguments.length>1?cx(t.arguments[1]):void 0,a=2;a<t.arguments.length;++a)cx(t.arguments[a]);if((32768&n.flags||65536&n.flags||!_p(n,Ye))&&Jn(r,e.Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0,qa(n)),i){var o=Eu(!0);o!==St&&gp(i,Bf(o,32768),t.arguments[1]);}var s=Hi(t,r);if(s){var c=Zi(s,r,!0,!1);if(c)return Ab(t,tb($o(c),c,s,r)||rb($o(c),c,s,r))}return Ab(t,Le)}(t);case 209:return function(t,r){var n;rC(t,t.typeArguments);var i=Hh(t,void 0,r);if(i===Mr)return lt;if(Yh(i,t),106===t.expression.kind)return ot;if(209===t.kind){var a=i.declaration;if(a&&171!==a.kind&&175!==a.kind&&180!==a.kind&&!e.isJSDocConstructSignature(a)&&!Gh(a))return $&&Jn(t,e.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type),Le}if(e.isInJSFile(t)&&nb(t))return Tl(t.arguments[0]);var o=Nl(i);if(12288&o.flags&&$h(t))return Dd(e.walkUpParenthesizedExpressions(t.parent));if(208===t.kind&&!t.questionDotToken&&238===t.parent.kind&&16384&o.flags&&kl(i))if(e.isDottedName(t.expression)){if(!Um(t)){var s=Jn(t.expression,e.Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation);Km(t.expression,s);}}else Jn(t.expression,e.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);if(e.isInJSFile(t)){var c=Xh(t,!1);if(null===(n=null==c?void 0:c.exports)||void 0===n?void 0:n.size){var l=Ea(c,c.exports,e.emptyArray,e.emptyArray,e.emptyArray);return l.objectFlags|=4096,p_([o,l])}}return o}(t,n);case 210:return function(t){(function(t){return !!(t.questionDotToken||32&t.flags)&&DC(t.template,e.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain)})(t)||rC(t,t.typeArguments),q<2&&GT(t,262144);var r=Hh(t);return Yh(r,t),Nl(r)}(t);case 212:return function(t,r){if(e.hasJSDocNodes(t)&&e.isJSDocTypeAssertion(t)){var n=e.getJSDocTypeAssertionType(t);return ab(n,n,t.expression,r)}return kx(t.expression,r)}(t,n);case 226:return function(e){return bS(e),WS(e),$o(la(e))}(t);case 213:case 214:return jb(t,n);case 216:return function(e){return kx(e.expression),kn}(t);case 211:case 229:return function(t){if(211===t.kind){var r=e.getSourceFileOfNode(t);r&&e.fileExtensionIsOneOf(r.fileName,[".cts",".mts"])&&DC(t,e.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);}return ab(t,t.type,t.expression)}(t);case 230:return function(e){return 32&e.flags?function(e){var t=kx(e.expression),r=Vf(t,e.expression);return Uf(Jf(r),e,r!==t)}(e):Jf(kx(e.expression))}(t);case 228:return ob(t);case 231:return function(t){return function(t){var r=t.name.escapedText;switch(t.keywordToken){case 103:if("target"!==r)return DC(t.name,e.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2,t.name.escapedText,e.tokenToString(t.keywordToken),"target");break;case 100:"meta"!==r&&DC(t.name,e.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2,t.name.escapedText,e.tokenToString(t.keywordToken),"meta");}}(t),103===t.keywordToken?cb(t):100===t.keywordToken?function(t){W===e.ModuleKind.Node16||W===e.ModuleKind.NodeNext?e.getSourceFileOfNode(t).impliedNodeFormat!==e.ModuleKind.ESNext&&Jn(t,e.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output):W<e.ModuleKind.ES2020&&W!==e.ModuleKind.System&&Jn(t,e.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);var r=e.getSourceFileOfNode(t);return e.Debug.assert(!!(4194304&r.flags),"Containing file is missing import meta node flag."),"meta"===t.name.escapedText?Cu():je}(t):e.Debug.assertNever(t.keywordToken)}(t);case 215:return function(t){kx(t.expression);var r=e.skipParentheses(t.expression);if(!e.isAccessExpression(r))return Jn(r,e.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference),it;e.isPropertyAccessExpression(r)&&e.isPrivateIdentifier(r.name)&&Jn(r,e.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);var n=ga(ni(r).resolvedSymbol);return n&&(Kb(n)&&Jn(r,e.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property),function(t,r){var n=$o(r);!Q||131075&n.flags||(ie?16777216&r.flags:32768&Mf(n))||Jn(t,e.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);}(r,n)),it}(t);case 217:return function(e){return kx(e.expression),We}(t);case 218:return function(t){m((function(){return function(t){var r=e.getContainingFunctionOrClassStaticBlock(t);if(r&&e.isClassStaticBlockDeclaration(r))Jn(t,e.Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);else if(!(32768&t.flags)){var n;if(e.isInTopLevelContext(t)){if(!hC(n=e.getSourceFileOfNode(t))){var i=void 0;if(!e.isEffectiveExternalModule(n,V)){null!=i||(i=e.getSpanOfTokenAtPosition(n,t.pos));var a=e.createFileDiagnostic(n,i.start,i.length,e.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);Sn.add(a);}switch(W){case e.ModuleKind.Node16:case e.ModuleKind.NodeNext:if(n.impliedNodeFormat===e.ModuleKind.CommonJS){null!=i||(i=e.getSpanOfTokenAtPosition(n,t.pos)),Sn.add(e.createFileDiagnostic(n,i.start,i.length,e.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));break}case e.ModuleKind.ES2022:case e.ModuleKind.ESNext:case e.ModuleKind.System:if(q>=4)break;default:null!=i||(i=e.getSpanOfTokenAtPosition(n,t.pos)),Sn.add(e.createFileDiagnostic(n,i.start,i.length,e.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));}}}else if(!hC(n=e.getSourceFileOfNode(t))){if(i=e.getSpanOfTokenAtPosition(n,t.pos),a=e.createFileDiagnostic(n,i.start,i.length,e.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules),r&&171!==r.kind&&0==(2&e.getFunctionFlags(r))){var o=e.createDiagnosticForNode(r,e.Diagnostics.Did_you_mean_to_mark_this_function_as_async);e.addRelatedInfo(a,o);}Sn.add(a);}}by(t)&&Jn(t,e.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);}(t)}));var r=kx(t.expression),n=Gx(r,!0,t,e.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);return n!==r||po(n)||3&r.flags||zn(!1,e.createDiagnosticForNode(t,e.Diagnostics.await_has_no_effect_on_the_type_of_this_expression)),n}(t);case 219:return function(t){var r=kx(t.operand);if(r===ct)return ct;switch(t.operand.kind){case 8:switch(t.operator){case 40:return gd(hd(-t.operand.text));case 39:return gd(hd(+t.operand.text))}break;case 9:if(40===t.operator)return gd(bd({negative:!0,base10Value:e.parsePseudoBigInt(t.operand.text)}))}switch(t.operator){case 39:case 40:case 54:return Fv(r,t.operand),Wb(r,12288)&&Jn(t.operand,e.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol,e.tokenToString(t.operator)),39===t.operator?(Hb(r,2112)&&Jn(t.operand,e.Diagnostics.Operator_0_cannot_be_applied_to_type_1,e.tokenToString(t.operator),qa(Sf(r))),Ze):qb(r);case 53:BD(t.operand);var n=12582912&am(r);return 4194304===n?et:8388608===n?rt:it;case 45:case 46:return Jb(t.operand,Fv(r,t.operand),e.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type)&&Vb(t.operand,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access),qb(r)}return je}(t);case 220:return function(t){var r=kx(t.operand);return r===ct?ct:(Jb(t.operand,Fv(r,t.operand),e.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type)&&Vb(t.operand,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access),qb(r))}(t);case 221:return ae(t,n);case 222:return function(e,t){return BD(e.condition),LD(e.condition,e.whenTrue),a_([kx(e.whenTrue,t),kx(e.whenFalse,t)],2)}(t,n);case 225:return function(e,t){return q<2&&GT(e,V.downlevelIteration?1536:1024),zD(33,kx(e.expression,t),qe,e.expression)}(t,n);case 227:return We;case 224:return function(t){m((function(){8192&t.flags||bC(t,e.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body),by(t)&&Jn(t,e.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);}));var r=e.getContainingFunction(t);if(!r)return Le;var n=e.getFunctionFlags(r);if(!(1&n))return Le;var i=0!=(2&n);t.asteriskToken&&(i&&q<99&&GT(t,26624),!i&&q<2&&V.downlevelIteration&&GT(t,256));var a=Fl(r),o=a&&uS(a,i),s=o&&o.yieldType||Le,c=o&&o.nextType||Le,l=i?Zx(c)||Le:c,u=t.expression?kx(t.expression):We,_=Ib(t,u,l,i);if(a&&_&&mp(_,s,t.expression||t,t.expression),t.asteriskToken)return UD(i?19:17,1,u,t.expression)||Le;if(a)return lS(2,a,i)||Le;var d=xy(2,r);return d||(d=Le,m((function(){if($&&!e.expressionResultIsUnused(t)){var r=Ly(t);r&&!_o(r)||Jn(t,e.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);}}))),d}(t);case 232:return function(e){return e.isSpread?K_(e.type,Ze):e.type}(t);case 288:return function(t,r){if(function(t){t.expression&&e.isCommaSequence(t.expression)&&DC(t.expression,e.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array);}(t),t.expression){var n=kx(t.expression,r);return t.dotDotDotToken&&n!==Le&&!cf(n)&&Jn(t,e.Diagnostics.JSX_spread_child_must_be_an_array_type),n}return je}(t,n);case 278:case 279:return function(e,t){return WS(e),pv(e)||Le}(t);case 282:return function(t){gv(t.openingFragment);var r=e.getSourceFileOfNode(t);return !e.getJSXTransformEnabled(V)||!V.jsxFactory&&!r.pragmas.has("jsx")||V.jsxFragmentFactory||r.pragmas.has("jsxfrag")||Jn(t,V.jsxFactory?e.Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option:e.Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments),tv(t),pv(t)||Le}(t);case 286:return function(t,r){return function(t,r){for(var n,i=t.attributes,a=Q?e.createSymbolTable():void 0,o=e.createSymbolTable(),s=Tt,c=!1,l=!1,u=2048,_=cv(ov(t)),d=0,p=i.properties;d<p.length;d++){var f=p[d],g=f.symbol;if(e.isJsxAttribute(f)){var m=ev(f,r);u|=458752&e.getObjectFlags(m);var y=Hn(4|g.flags,g.escapedName);y.declarations=g.declarations,y.parent=g.parent,g.valueDeclaration&&(y.valueDeclaration=g.valueDeclaration),y.type=m,y.target=g,o.set(y.escapedName,y),null==a||a.set(y.escapedName,y),f.name.escapedText===_&&(l=!0);}else e.Debug.assert(287===f.kind),o.size>0&&(s=_d(s,T(),i.symbol,u,!1),o=e.createSymbolTable()),_o(m=Hc(cx(f.expression,r)))&&(c=!0),Yy(m)?(s=_d(s,m,i.symbol,u,!1),a&&rv(m,a,f)):(Jn(f.expression,e.Diagnostics.Spread_types_may_only_be_created_from_object_types),n=n?p_([n,m]):m);}c||o.size>0&&(s=_d(s,T(),i.symbol,u,!1));var v=278===t.parent.kind?t.parent:void 0;if(v&&v.openingElement===t&&v.children.length>0){var h=tv(v,r);if(!c&&_&&""!==_){l&&Jn(i,e.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten,e.unescapeLeadingUnderscores(_));var b=Iy(t.attributes),x=b&&Ey(b,_),D=Hn(4,_);D.type=1===h.length?h[0]:x&&Tm(x,yf)?Vu(h):Bu(a_(h)),D.valueDeclaration=e.factory.createPropertySignature(void 0,e.unescapeLeadingUnderscores(_),void 0,void 0),e.setParent(D.valueDeclaration,i),D.valueDeclaration.symbol=D;var S=e.createSymbolTable();S.set(_,D),s=_d(s,Ea(i.symbol,S,e.emptyArray,e.emptyArray,e.emptyArray),i.symbol,u,!1);}}return c?Le:n&&s!==Tt?p_([n,s]):n||(s===Tt?T():s);function T(){u|=ne;var t=Ea(i.symbol,o,e.emptyArray,e.emptyArray,e.emptyArray);return t.objectFlags|=131200|u,t}}(t.parent,r)}(t,n);case 280:e.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");}return je}(t,n,i),n);return Xb(o)&&function(t,r){206===t.parent.kind&&t.parent.expression===t||207===t.parent.kind&&t.parent.expression===t||(79===t.kind||161===t.kind)&&nT(t)||181===t.parent.kind&&t.parent.exprName===t||275===t.parent.kind||Jn(t,e.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query),V.isolatedModules&&(e.Debug.assert(!!(128&r.symbol.flags)),16777216&r.symbol.valueDeclaration.flags&&Jn(t,e.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided));}(t,o),u=a,null===e.tracing||void 0===e.tracing||e.tracing.pop(),o}function Ex(t){YT(t),t.expression&&bC(t.expression,e.Diagnostics.Type_expected),VS(t.constraint),VS(t.default);var r=ks(la(t));Mc(r),function(e){return jc(e)!==At}(r)||Jn(t.default,e.Diagnostics.Type_parameter_0_has_a_circular_default,qa(r));var n=Ac(r),i=Jc(r);n&&i&&gp(i,Hs(Yd(n,Od(r,i)),i),t.default,e.Diagnostics.Type_0_does_not_satisfy_the_constraint_1),WS(t),m((function(){return mS(t.name,e.Diagnostics.Type_parameter_name_cannot_be_0)}));}function Nx(t){XT(t),PD(t);var r=e.getContainingFunction(t);e.hasSyntacticModifier(t,16476)&&(171===r.kind&&e.nodeIsPresent(r.body)||Jn(t,e.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation),171===r.kind&&e.isIdentifier(t.name)&&"constructor"===t.name.escapedText&&Jn(t.name,e.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name)),t.questionToken&&e.isBindingPattern(t.name)&&r.body&&Jn(t,e.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature),t.name&&e.isIdentifier(t.name)&&("this"===t.name.escapedText||"new"===t.name.escapedText)&&(0!==r.parameters.indexOf(t)&&Jn(t,e.Diagnostics.A_0_parameter_must_be_the_first_parameter,t.name.escapedText),171!==r.kind&&175!==r.kind&&180!==r.kind||Jn(t,e.Diagnostics.A_constructor_cannot_have_a_this_parameter),214===r.kind&&Jn(t,e.Diagnostics.An_arrow_function_cannot_have_a_this_parameter),172!==r.kind&&173!==r.kind||Jn(t,e.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters)),!t.dotDotDotToken||e.isBindingPattern(t.name)||_p(Hc($o(t.symbol)),Yt)||Jn(t,e.Diagnostics.A_rest_parameter_must_be_of_an_array_type);}function Fx(t,r,n){for(var i=0,a=t.elements;i<a.length;i++){var o=a[i];if(!e.isOmittedExpression(o)){var s=o.name;if(79===s.kind&&s.escapedText===n)return Jn(r,e.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,n),!0;if((202===s.kind||201===s.kind)&&Fx(s,r,n))return !0}}}function Ax(t){176===t.kind?function(t){XT(t)||function(t){var r=t.parameters[0];if(1!==t.parameters.length)return DC(r?r.name:t,e.Diagnostics.An_index_signature_must_have_exactly_one_parameter);if($T(t.parameters,e.Diagnostics.An_index_signature_cannot_have_a_trailing_comma),r.dotDotDotToken)return DC(r.dotDotDotToken,e.Diagnostics.An_index_signature_cannot_have_a_rest_parameter);if(e.hasEffectiveModifiers(r))return DC(r.name,e.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);if(r.questionToken)return DC(r.questionToken,e.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);if(r.initializer)return DC(r.name,e.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);if(!r.type)return DC(r.name,e.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);var n=kd(r.type);Tm(n,(function(e){return !!(8576&e.flags)}))||O_(n)?DC(r.name,e.Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead):Cm(n,Ul)?t.type||DC(t,e.Diagnostics.An_index_signature_must_have_a_type_annotation):DC(r.name,e.Diagnostics.An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type);}(t);}(t):179!==t.kind&&256!==t.kind&&180!==t.kind&&174!==t.kind&&171!==t.kind&&175!==t.kind||tC(t);var r=e.getFunctionFlags(t);4&r||(3==(3&r)&&q<99&&GT(t,6144),2==(3&r)&&q<4&&GT(t,64),0!=(3&r)&&q<2&&GT(t,128)),yS(e.getEffectiveTypeParameterDeclarations(t)),function(t){var r=e.filter(e.getJSDocTags(t),e.isJSDocParameterTag);if(e.length(r)){var n=e.isInJSFile(t),i=new e.Set,a=new e.Set;if(e.forEach(t.parameters,(function(t,r){var n=t.name;e.isIdentifier(n)&&i.add(n.escapedText),e.isBindingPattern(n)&&a.add(r);})),Dl(t)){var o=e.lastOrUndefined(r);n&&o&&e.isIdentifier(o.name)&&o.typeExpression&&o.typeExpression.type&&!i.has(o.name.escapedText)&&!cf(kd(o.typeExpression.type))&&Jn(o.name,e.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type,e.idText(o.name));}else e.forEach(r,(function(t,r){var o=t.name;a.has(r)||e.isIdentifier(o)&&i.has(o.escapedText)||(e.isQualifiedName(o)?n&&Jn(o,e.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1,e.entityNameToString(o),e.entityNameToString(o.left)):Kn(n,o,e.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name,e.idText(o)));}));}}(t),e.forEach(t.parameters,Nx),t.type&&VS(t.type),m((function(){!function(t){q>=2||!e.hasRestParameter(t)||16777216&t.flags||e.nodeIsMissing(t.body)||e.forEach(t.parameters,(function(t){t.name&&!e.isBindingPattern(t.name)&&t.name.escapedText===de.escapedName&&Bn("noEmit",t,e.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters);}));}(t);var r=e.getEffectiveReturnTypeNode(t);if($&&!r)switch(t.kind){case 175:Jn(t,e.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);break;case 174:Jn(t,e.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);}if(r){var n=e.getFunctionFlags(t);if(1==(5&n)){var i=kd(r);if(i===ot)Jn(r,e.Diagnostics.A_generator_cannot_have_a_void_type_annotation);else {var a=lS(0,i,0!=(2&n))||Le;gp(wb(a,lS(1,i,0!=(2&n))||a,lS(2,i,0!=(2&n))||Ue,!!(2&n)),i,r);}}else 2==(3&n)&&function(t,r){var n=kd(r);if(q>=2){if(po(n))return;var i=Au(!0);if(i!==Et&&!ts(n,i))return void Jn(r,e.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0,qa($x(n)||ot))}else {if(function(t){tD(t&&e.getEntityNameFromTypeNode(t),!1);}(r),po(n))return;var a=e.getEntityNameFromTypeNode(r);if(void 0===a)return void Jn(r,e.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value,qa(n));var o=qi(a,111551,!0),s=o?$o(o):je;if(po(s))return void(79===a.kind&&"Promise"===a.escapedText&&rs(n)===Au(!1)?Jn(r,e.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option):Jn(r,e.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value,e.entityNameToString(a)));var c=(or||(or=Tu("PromiseConstructorLike",0,true))||St);if(c===St)return void Jn(r,e.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value,e.entityNameToString(a));if(!gp(s,c,r,e.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value))return;var l=a&&e.getFirstIdentifier(a),u=ai(t.locals,l.escapedText,111551);if(u)return void Jn(u.valueDeclaration,e.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,e.idText(l),e.entityNameToString(a))}Gx(n,!1,t,e.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);}(t,r);}176!==t.kind&&317!==t.kind&&lD(t);}));}function Px(t){for(var r=new e.Map,n=0,i=t.members;n<i.length;n++){var a=i[n];if(166===a.kind){var o=void 0,s=a.name;switch(s.kind){case 10:case 8:o=s.text;break;case 79:o=e.idText(s);break;default:continue}r.get(o)?(Jn(e.getNameOfDeclaration(a.symbol.valueDeclaration),e.Diagnostics.Duplicate_identifier_0,o),Jn(a.name,e.Diagnostics.Duplicate_identifier_0,o)):r.set(o,!0);}}}function wx(t){if(258===t.kind){var r=la(t);if(r.declarations&&r.declarations.length>0&&r.declarations[0]!==t)return}var n=Bl(la(t));if(null==n?void 0:n.declarations){for(var i=new e.Map,a=function(e){1===e.parameters.length&&e.parameters[0].type&&Sm(kd(e.parameters[0].type),(function(t){var r=i.get(Zu(t));r?r.declarations.push(e):i.set(Zu(t),{type:t,declarations:[e]});}));},o=0,s=n.declarations;o<s.length;o++)a(s[o]);i.forEach((function(t){if(t.declarations.length>1)for(var r=0,n=t.declarations;r<n.length;r++)Jn(n[r],e.Diagnostics.Duplicate_index_signature_for_type_0,qa(t.type));}));}}function Ix(t){XT(t)||function(t){if(e.isComputedPropertyName(t.name)&&e.isBinaryExpression(t.name.expression)&&101===t.name.expression.operatorToken.kind)return DC(t.parent.members[0],e.Diagnostics.A_mapped_type_may_not_declare_properties_or_methods);if(e.isClassLike(t.parent)){if(e.isStringLiteral(t.name)&&"constructor"===t.name.text)return DC(t.name,e.Diagnostics.Classes_may_not_have_a_field_named_constructor);if(_C(t.name,e.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type))return !0;if(q<2&&e.isPrivateIdentifier(t.name))return DC(t.name,e.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher)}else if(258===t.parent.kind){if(_C(t.name,e.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type))return !0;if(t.initializer)return DC(t.initializer,e.Diagnostics.An_interface_property_cannot_have_an_initializer)}else if(e.isTypeLiteralNode(t.parent)){if(_C(t.name,e.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type))return !0;if(t.initializer)return DC(t.initializer,e.Diagnostics.A_type_literal_property_cannot_have_an_initializer)}if(16777216&t.flags&&fC(t),e.isPropertyDeclaration(t)&&t.exclamationToken&&(!e.isClassLike(t.parent)||!t.type||t.initializer||16777216&t.flags||e.isStatic(t)||e.hasAbstractModifier(t))){var r=t.initializer?e.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions:t.type?e.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context:e.Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations;return DC(t.exclamationToken,r)}}(t)||aC(t.name),PD(t),Ox(t),e.hasSyntacticModifier(t,128)&&167===t.kind&&t.initializer&&Jn(t,e.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract,e.declarationNameToString(t.name));}function Ox(t){if(e.isPrivateIdentifier(t.name)&&q<99){for(var r=e.getEnclosingBlockScopeContainer(t);r;r=e.getEnclosingBlockScopeContainer(r))ni(r).flags|=67108864;if(e.isClassExpression(t.parent)){var n=oy(t.parent);n&&(ni(t.name).flags|=524288,ni(n).flags|=65536);}}}function Mx(t){return 106===t.kind||108===t.kind||!e.isThisContainerOrFunctionBlock(t)&&!!e.forEachChild(t,Mx)}function Lx(t){m((function(){if(tC(t)||function(t){if(!(16777216&t.flags)&&182!==t.parent.kind&&258!==t.parent.kind){if(q<1)return DC(t.name,e.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);if(q<2&&e.isPrivateIdentifier(t.name))return DC(t.name,e.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);if(void 0===t.body&&!e.hasSyntacticModifier(t,128))return xC(t,t.end-1,";".length,e.Diagnostics._0_expected,"{")}if(t.body){if(e.hasSyntacticModifier(t,128))return DC(t,e.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);if(182===t.parent.kind||258===t.parent.kind)return DC(t.body,e.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts)}if(t.typeParameters)return DC(t.name,e.Diagnostics.An_accessor_cannot_have_type_parameters);if(!function(e){return uC(e)||e.parameters.length===(172===e.kind?0:1)}(t))return DC(t.name,172===t.kind?e.Diagnostics.A_get_accessor_cannot_have_parameters:e.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);if(173===t.kind){if(t.type)return DC(t.name,e.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);var r=e.Debug.checkDefined(e.getSetAccessorValueParameter(t),"Return value does not match parameter count assertion.");if(r.dotDotDotToken)return DC(r.dotDotDotToken,e.Diagnostics.A_set_accessor_cannot_have_rest_parameter);if(r.questionToken)return DC(r.questionToken,e.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);if(r.initializer)return DC(t.name,e.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer)}return !1}(t)||aC(t.name),oD(t),Ax(t),172===t.kind&&!(16777216&t.flags)&&e.nodeIsPresent(t.body)&&256&t.flags&&(512&t.flags||Jn(t.name,e.Diagnostics.A_get_accessor_must_return_a_value)),162===t.name.kind&&Hy(t.name),zs(t)){var r=la(t),n=e.getDeclarationOfKind(r,172),i=e.getDeclarationOfKind(r,173);if(n&&i&&!(1&PT(n))){ni(n).flags|=1;var a=e.getEffectiveModifierFlags(n),o=e.getEffectiveModifierFlags(i);(128&a)!=(128&o)&&(Jn(n.name,e.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract),Jn(i.name,e.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract)),(16&a&&!(24&o)||8&a&&!(8&o))&&(Jn(n.name,e.Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter),Jn(i.name,e.Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter));var s=Vo(n),c=Vo(i);s&&c&&gp(s,c,n,e.Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);}}var l=qo(la(t));172===t.kind&&Bb(t,l);})),VS(t.body),Ox(t);}function Rx(t,r){return hl(e.map(t.typeArguments,kd),r,vl(r),e.isInJSFile(t))}function Bx(t,r){for(var n,i,a=!0,o=0;o<r.length;o++){var s=Ac(r[o]);s&&(n||(i=wd(r,n=Rx(t,r))),a=a&&gp(n[o],Yd(s,i),t.typeArguments[o],e.Diagnostics.Type_0_does_not_satisfy_the_constraint_1));}return a}function jx(t){var r=mu(t);if(!po(r)){var n=ni(t).resolvedSymbol;if(n)return 524288&n.flags&&ri(n).typeParameters||(4&e.getObjectFlags(r)?r.target.localTypeParameters:void 0)}}function Jx(t){rC(t,t.typeArguments),178!==t.kind||void 0===t.typeName.jsdocDotPos||e.isInJSFile(t)||e.isInJSDoc(t)||xC(t,t.typeName.jsdocDotPos,1,e.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments),e.forEach(t.typeArguments,VS);var r=mu(t);if(!po(r)){t.typeArguments&&m((function(){var e=jx(t);e&&Bx(t,e);}));var n=ni(t).resolvedSymbol;n&&(e.some(n.declarations,(function(e){return $S(e)&&!!(268435456&e.flags)}))&&Wn(Zh(t),n.declarations,n.escapedName),32&r.flags&&8&n.flags&&Jn(t,e.Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals,qa(r)));}}function zx(t,r){if(!(8388608&t.flags))return t;var n=t.objectType,i=t.indexType;if(_p(i,D_(n,!1)))return 207===r.kind&&e.isAssignmentTarget(r)&&32&e.getObjectFlags(n)&&1&bc(n)&&Jn(r,e.Diagnostics.Index_signature_in_type_0_only_permits_reading,qa(n)),t;var a=Kc(n);if(ol(a,Ze)&&Gb(i,296))return t;if(M_(n)){var o=N_(i,r);if(o){var s=Sm(a,(function(e){return Zc(e,o)}));if(s&&24&e.getDeclarationModifierFlagsFromSymbol(s))return Jn(r,e.Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter,e.unescapeLeadingUnderscores(o)),je}}return Jn(r,e.Diagnostics.Type_0_cannot_be_used_to_index_type_1,qa(i),qa(n)),je}function Kx(t){return (e.hasEffectiveModifier(t,8)||e.isPrivateIdentifierClassElementDeclaration(t))&&!!(16777216&t.flags)}function Ux(t,r){var n=e.getCombinedModifierFlags(t);return 258!==t.parent.kind&&257!==t.parent.kind&&226!==t.parent.kind&&16777216&t.flags&&(2&n||e.isModuleBlock(t.parent)&&e.isModuleDeclaration(t.parent.parent)&&e.isGlobalScopeAugmentation(t.parent.parent)||(n|=1),n|=2),n&r}function Vx(t){m((function(){return function(t){function r(e,t){return void 0!==t&&t.parent===e[0].parent?t:e[0]}var i,a,o,s=0,c=155,l=!1,u=!0,_=!1,d=t.declarations,p=0!=(16384&t.flags);function f(t){if(!t.name||!e.nodeIsMissing(t.name)){var r=!1,n=e.forEachChild(t.parent,(function(e){if(r)return e;r=e===t;}));if(n&&n.pos===t.end&&n.kind===t.kind){var i=n.name||n,a=n.name;if(t.name&&a&&(e.isPrivateIdentifier(t.name)&&e.isPrivateIdentifier(a)&&t.name.escapedText===a.escapedText||e.isComputedPropertyName(t.name)&&e.isComputedPropertyName(a)||e.isPropertyNameLiteral(t.name)&&e.isPropertyNameLiteral(a)&&e.getEscapedTextOfIdentifierOrLiteral(t.name)===e.getEscapedTextOfIdentifierOrLiteral(a)))return void(169!==t.kind&&168!==t.kind||e.isStatic(t)===e.isStatic(n)||Jn(i,e.isStatic(t)?e.Diagnostics.Function_overload_must_be_static:e.Diagnostics.Function_overload_must_not_be_static));if(e.nodeIsPresent(n.body))return void Jn(i,e.Diagnostics.Function_implementation_name_must_be_0,e.declarationNameToString(t.name))}var o=t.name||t;p?Jn(o,e.Diagnostics.Constructor_implementation_is_missing):e.hasSyntacticModifier(t,128)?Jn(o,e.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive):Jn(o,e.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);}}var g,m,y,v,h,b=!1,x=!1,D=!1,S=[];if(d)for(var T=0,C=d;T<C.length;T++){var k=C[T],E=16777216&k.flags,N=k.parent&&(258===k.parent.kind||182===k.parent.kind)||E;if(N&&(o=void 0),257!==k.kind&&226!==k.kind||E||(D=!0),256===k.kind||169===k.kind||168===k.kind||171===k.kind){S.push(k);var F=Ux(k,155);s|=F,c&=F,l=l||e.hasQuestionToken(k),u=u&&e.hasQuestionToken(k);var A=e.nodeIsPresent(k.body);A&&i?p?x=!0:b=!0:(null==o?void 0:o.parent)===k.parent&&o.end!==k.pos&&f(o),A?i||(i=k):_=!0,o=k,N||(a=k);}}if(x&&e.forEach(S,(function(t){Jn(t,e.Diagnostics.Multiple_constructor_implementations_are_not_allowed);})),b&&e.forEach(S,(function(t){Jn(e.getNameOfDeclaration(t)||t,e.Diagnostics.Duplicate_function_implementation);})),D&&!p&&16&t.flags&&d){var P=e.filter(d,(function(e){return 257===e.kind})).map((function(t){return e.createDiagnosticForNode(t,e.Diagnostics.Consider_adding_a_declare_modifier_to_this_class)}));e.forEach(d,(function(r){var i=257===r.kind?e.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0:256===r.kind?e.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient:void 0;i&&e.addRelatedInfo.apply(void 0,n$4([Jn(e.getNameOfDeclaration(r)||r,i,e.symbolName(t))],P,!1));}));}if(!a||a.body||e.hasSyntacticModifier(a,128)||a.questionToken||f(a),_&&(d&&(function(t,n,i,a,o){if(0!=(a^o)){var s=Ux(r(t,n),i);e.forEach(t,(function(t){var r=Ux(t,i)^s;1&r?Jn(e.getNameOfDeclaration(t),e.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported):2&r?Jn(e.getNameOfDeclaration(t),e.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient):24&r?Jn(e.getNameOfDeclaration(t)||t,e.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected):128&r&&Jn(e.getNameOfDeclaration(t),e.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);}));}}(d,i,155,s,c),function(t,n,i,a){if(i!==a){var o=e.hasQuestionToken(r(t,n));e.forEach(t,(function(t){e.hasQuestionToken(t)!==o&&Jn(e.getNameOfDeclaration(t),e.Diagnostics.Overload_signatures_must_all_be_optional_or_required);}));}}(d,i,l,u)),i))for(var w=Sl(t),I=bl(i),O=0,M=w;O<M.length;O++){var L=M[O];if(g=L,m=void 0,y=void 0,v=void 0,h=void 0,m=Ml(I),y=Ml(g),v=Nl(m),(h=Nl(y))!==ot&&!Ip(h,v,Fn)&&!Ip(v,h,Fn)||0===kp(m,y,4,!1,void 0,void 0,cp,void 0)){e.addRelatedInfo(Jn(L.declaration,e.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),e.createDiagnosticForNode(i,e.Diagnostics.The_implementation_signature_is_declared_here));break}}}(t)}));}function qx(t){m((function(){return function(t){var r=t.localSymbol;if((r||(r=la(t)).exportSymbol)&&e.getDeclarationOfKind(r,t.kind)===t){for(var n=0,i=0,a=0,o=0,s=r.declarations;o<s.length;o++){var c=m(f=s[o]),l=Ux(f,513);1&l?512&l?a|=c:n|=c:i|=c;}var u=n&i,_=a&(n|i);if(u||_)for(var d=0,p=r.declarations;d<p.length;d++){c=m(f=p[d]);var f,g=e.getNameOfDeclaration(f);c&_?Jn(g,e.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead,e.declarationNameToString(g)):c&u&&Jn(g,e.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local,e.declarationNameToString(g));}}function m(t){var r=t;switch(r.kind){case 258:case 259:case 345:case 338:case 339:return 2;case 261:return e.isAmbientModule(r)||0!==e.getModuleInstanceState(r)?5:4;case 257:case 260:case 299:return 3;case 305:return 7;case 271:case 221:var n=r,i=e.isExportAssignment(n)?n.expression:n.right;if(!e.isEntityNameExpression(i))return 1;r=i;case 265:case 268:case 267:var a=0,o=Ri(la(r));return e.forEach(o.declarations,(function(e){a|=m(e);})),a;case 254:case 203:case 256:case 270:case 79:return 1;default:return e.Debug.failBadSyntaxKind(r)}}}(t)}));}function Wx(e,t,r,n){var i=Hx(e,t);return i&&Zx(i,t,r,n)}function Hx(t,r){if(!_o(t)){var n=t;if(n.promisedTypeOfPromise)return n.promisedTypeOfPromise;if(ts(t,Au(!1)))return n.promisedTypeOfPromise=eu(t)[0];if(!Qb(t,262140)){var i=uo(t,"then");if(!_o(i)){var a=i?el(i,0):e.emptyArray;if(0!==a.length){var o=om(a_(e.map(a,Sb)),2097152);if(!_o(o)){var s=el(o,0);if(0!==s.length)return n.promisedTypeOfPromise=a_(e.map(s,Sb),2);r&&Jn(r,e.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback);}}else r&&Jn(r,e.Diagnostics.A_promise_must_have_a_then_method);}}}}function Gx(e,t,r,n,i){return (t?Zx(e,r,n,i):$x(e,r,n,i))||je}function Qx(e){if(Qb(e,262140))return !1;var t=uo(e,"then");return !!t&&el(om(t,2097152),0).length>0}function Xx(e){var t;if(16777216&e.flags){var r=Mu(!1);return !!r&&e.aliasSymbol===r&&1===(null===(t=e.aliasTypeArguments)||void 0===t?void 0:t.length)}return !1}function Yx(e){return 1048576&e.flags?Fm(e,Yx):Xx(e)?e.aliasTypeArguments[0]:e}function Zx(t,r,n,i){var a=$x(t,r,n,i);return a&&function(t){if(_o(t))return t;if(Xx(t))return t;if(M_(t)){var r=Mc(t);if(!r||3&r.flags||Np(r)||Qx(r)){var n=Mu(!0);if(n)return nu(n,[Yx(t)])}}return e.Debug.assert(void 0===Hx(t),"type provided should not be a non-generic 'promise'-like."),t}(a)}function $x(t,r,n,i){if(_o(t))return t;if(Xx(t))return t;var a=t;if(a.awaitedTypeOfType)return a.awaitedTypeOfType;if(1048576&t.flags){var o=r?function(e){return $x(e,r,n,i)}:$x;return a.awaitedTypeOfType=Fm(t,o)}var s=Hx(t);if(s){if(t.id===s.id||Dn.lastIndexOf(s.id)>=0)return void(r&&Jn(r,e.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method));Dn.push(t.id);var c=$x(s,r,n,i);if(Dn.pop(),!c)return;return a.awaitedTypeOfType=c}if(!Qx(t))return a.awaitedTypeOfType=t;r&&(e.Debug.assertIsDefined(n),Jn(r,n,i));}function eD(t){var r=Hh(t);Yh(r,t);var n=Nl(r);if(!(1&n.flags)){var i,a;switch(t.parent.kind){case 257:i=e.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1,a=a_([$o(la(t.parent)),ot]);break;case 167:case 164:i=e.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any,a=ot;break;case 169:case 172:case 173:i=e.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1,a=a_([Ru(sT(t.parent)),ot]);break;default:return e.Debug.fail()}gp(n,a,t,i);}}function tD(t,r){if(t){var n=e.getFirstIdentifier(t),i=2097152|(79===t.kind?788968:1920),a=li(n,n.escapedText,i,void 0,void 0,!0);if(a&&2097152&a.flags)if(!ma(a)||TT(Ri(a))||Ji(a)){if(r&&V.isolatedModules&&e.getEmitModuleKind(V)>=e.ModuleKind.ES2015&&!ma(a)&&!e.some(a.declarations,e.isTypeOnlyImportOrExportDeclaration)){var o=Jn(t,e.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled),s=e.find(a.declarations||e.emptyArray,Di);s&&e.addRelatedInfo(o,e.createDiagnosticForNode(s,e.Diagnostics._0_was_imported_here,e.idText(n)));}}else Ki(a);}}function rD(t){var r=nD(t);r&&e.isEntityName(r)&&tD(r,!0);}function nD(e){if(e)switch(e.kind){case 188:case 187:return iD(e.types);case 189:return iD([e.trueType,e.falseType]);case 191:case 197:return nD(e.type);case 178:return e.typeName}}function iD(t){for(var r,n=0,i=t;n<i.length;n++){for(var a=i[n];191===a.kind||197===a.kind;)a=a.type;if(143!==a.kind&&(Q||(196!==a.kind||104!==a.literal.kind)&&153!==a.kind)){var o=nD(a);if(!o)return;if(r){if(!e.isIdentifier(r)||!e.isIdentifier(o)||r.escapedText!==o.escapedText)return}else r=o;}}return r}function aD(t){var r=e.getEffectiveTypeAnnotationNode(t);return e.isRestParameter(t)?e.getRestParameterElementType(r):r}function oD(t){if(t.decorators&&e.nodeCanBeDecorated(t,t.parent,t.parent.parent)){V.experimentalDecorators||Jn(t,e.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);var r=t.decorators[0];if(GT(r,8),164===t.kind&&GT(r,32),V.emitDecoratorMetadata)switch(GT(r,16),t.kind){case 257:var n=e.getFirstConstructorWithBody(t);if(n)for(var i=0,a=n.parameters;i<a.length;i++)rD(aD(a[i]));break;case 172:case 173:var o=172===t.kind?173:172,s=e.getDeclarationOfKind(la(t),o);rD(Uo(t)||s&&Uo(s));break;case 169:for(var c=0,l=t.parameters;c<l.length;c++)rD(aD(l[c]));rD(e.getEffectiveReturnTypeNode(t));break;case 167:rD(e.getEffectiveTypeAnnotationNode(t));break;case 164:rD(aD(t));for(var u=0,_=t.parent.parameters;u<_.length;u++)rD(aD(_[u]));}e.forEach(t.decorators,eD);}}function sD(e){switch(e.kind){case 79:return e;case 206:return e.name;default:return}}function cD(t){var r;oD(t),Ax(t);var n=e.getFunctionFlags(t);if(t.name&&162===t.name.kind&&Hy(t.name),zs(t)){var i=la(t),a=t.localSymbol||i,o=null===(r=a.declarations)||void 0===r?void 0:r.find((function(e){return e.kind===t.kind&&!(262144&e.flags)}));t===o&&Vx(a),i.parent&&Vx(i);}var s=168===t.kind?void 0:t.body;if(VS(s),Bb(t,Fl(t)),m((function(){e.getEffectiveReturnTypeNode(t)||(e.nodeIsMissing(s)&&!Kx(t)&&ag(t,Le),1&n&&e.nodeIsPresent(s)&&Nl(bl(t)));})),e.isInJSFile(t)){var c=e.getJSDocTypeTag(t);c&&c.typeExpression&&!Jy(kd(c.typeExpression),t)&&Jn(c.typeExpression.type,e.Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);}}function lD(t){m((function(){var r=e.getSourceFileOfNode(t),n=Hr.get(r.path);n||(n=[],Hr.set(r.path,n)),n.push(t);}));}function uD(t,r){for(var n=0,i=t;n<i.length;n++){var a=i[n];switch(a.kind){case 257:case 226:pD(a,r),gD(a,r);break;case 305:case 261:case 235:case 263:case 242:case 243:case 244:bD(a,r);break;case 171:case 213:case 256:case 214:case 169:case 172:case 173:a.body&&bD(a,r),gD(a,r);break;case 168:case 174:case 175:case 179:case 180:case 259:case 258:gD(a,r);break;case 190:fD(a,r);break;default:e.Debug.assertNever(a,"Node should not have been registered for unused identifiers check");}}}function _D(t,r,n){var i=e.getNameOfDeclaration(t)||t,a=$S(t)?e.Diagnostics._0_is_declared_but_never_used:e.Diagnostics._0_is_declared_but_its_value_is_never_read;n(t,0,e.createDiagnosticForNode(i,a,r));}function dD(t){return e.isIdentifier(t)&&95===e.idText(t).charCodeAt(0)}function pD(t,r){for(var n=0,i=t.members;n<i.length;n++){var a=i[n];switch(a.kind){case 169:case 167:case 172:case 173:if(173===a.kind&&32768&a.symbol.flags)break;var o=la(a);o.isReferenced||!(e.hasEffectiveModifier(a,8)||e.isNamedDeclaration(a)&&e.isPrivateIdentifier(a.name))||16777216&a.flags||r(a,0,e.createDiagnosticForNode(a.name,e.Diagnostics._0_is_declared_but_its_value_is_never_read,Ua(o)));break;case 171:for(var s=0,c=a.parameters;s<c.length;s++){var l=c[s];!l.symbol.isReferenced&&e.hasSyntacticModifier(l,8)&&r(l,0,e.createDiagnosticForNode(l.name,e.Diagnostics.Property_0_is_declared_but_its_value_is_never_read,e.symbolName(l.symbol)));}break;case 176:case 234:case 170:break;default:e.Debug.fail("Unexpected class member");}}}function fD(t,r){var n=t.typeParameter;mD(n)&&r(t,1,e.createDiagnosticForNode(t,e.Diagnostics._0_is_declared_but_its_value_is_never_read,e.idText(n.name)));}function gD(t,r){var n=la(t).declarations;if(n&&e.last(n)===t)for(var i=e.getEffectiveTypeParameterDeclarations(t),a=new e.Set,o=0,s=i;o<s.length;o++){var c=s[o];if(mD(c)){var l=e.idText(c.name),u=c.parent;if(190!==u.kind&&u.typeParameters.every(mD)){if(e.tryAddToSet(a,u)){var _=e.getSourceFileOfNode(u),d=e.isJSDocTemplateTag(u)?e.rangeOfNode(u):e.rangeOfTypeParameters(_,u.typeParameters),p=1===u.typeParameters.length,f=p?e.Diagnostics._0_is_declared_but_its_value_is_never_read:e.Diagnostics.All_type_parameters_are_unused,g=p?l:void 0;r(c,1,e.createFileDiagnostic(_,d.pos,d.end-d.pos,f,g));}}else r(c,1,e.createDiagnosticForNode(c,e.Diagnostics._0_is_declared_but_its_value_is_never_read,l));}}}function mD(e){return !(262144&ca(e.symbol).isReferenced||dD(e.name))}function yD(e,t,r,n){var i=String(n(t)),a=e.get(i);a?a[1].push(r):e.set(i,[t,[r]]);}function vD(t){return e.tryCast(e.getRootDeclaration(t),e.isParameter)}function hD(t){return e.isBindingElement(t)?e.isObjectBindingPattern(t.parent)?!(!t.propertyName||!dD(t.name)):dD(t.name):e.isAmbientModule(t)||(e.isVariableDeclaration(t)&&e.isForInOrOfStatement(t.parent.parent)||DD(t))&&dD(t.name)}function bD(t,r){var n=new e.Map,i=new e.Map,a=new e.Map;t.locals.forEach((function(t){var o;if(!(262144&t.flags?!(3&t.flags)||3&t.isReferenced:t.isReferenced||t.exportSymbol)&&t.declarations)for(var s=0,c=t.declarations;s<c.length;s++){var l=c[s];if(!hD(l))if(DD(l))yD(n,267===(o=l).kind?o:268===o.kind?o.parent:o.parent.parent,l,O);else if(e.isBindingElement(l)&&e.isObjectBindingPattern(l.parent))l!==e.last(l.parent.elements)&&e.last(l.parent.elements).dotDotDotToken||yD(i,l.parent,l,O);else if(e.isVariableDeclaration(l))yD(a,l.parent,l,O);else {var u=t.valueDeclaration&&vD(t.valueDeclaration),_=t.valueDeclaration&&e.getNameOfDeclaration(t.valueDeclaration);u&&_?e.isParameterPropertyDeclaration(u,u.parent)||e.parameterIsThisKeyword(u)||dD(_)||(e.isBindingElement(l)&&e.isArrayBindingPattern(l.parent)?yD(i,l.parent,l,O):r(u,1,e.createDiagnosticForNode(_,e.Diagnostics._0_is_declared_but_its_value_is_never_read,e.symbolName(t)))):_D(l,e.symbolName(t),r);}}})),n.forEach((function(t){var n=t[0],i=t[1],a=n.parent;if((n.name?1:0)+(n.namedBindings?268===n.namedBindings.kind?1:n.namedBindings.elements.length:0)===i.length)r(a,0,1===i.length?e.createDiagnosticForNode(a,e.Diagnostics._0_is_declared_but_its_value_is_never_read,e.idText(e.first(i).name)):e.createDiagnosticForNode(a,e.Diagnostics.All_imports_in_import_declaration_are_unused));else for(var o=0,s=i;o<s.length;o++){var c=s[o];_D(c,e.idText(c.name),r);}})),i.forEach((function(t){var n=t[0],i=t[1],o=vD(n.parent)?1:0;if(n.elements.length===i.length)1===i.length&&254===n.parent.kind&&255===n.parent.parent.kind?yD(a,n.parent.parent,n.parent,O):r(n,o,1===i.length?e.createDiagnosticForNode(n,e.Diagnostics._0_is_declared_but_its_value_is_never_read,xD(e.first(i).name)):e.createDiagnosticForNode(n,e.Diagnostics.All_destructured_elements_are_unused));else for(var s=0,c=i;s<c.length;s++){var l=c[s];r(l,o,e.createDiagnosticForNode(l,e.Diagnostics._0_is_declared_but_its_value_is_never_read,xD(l.name)));}})),a.forEach((function(t){var n=t[0],i=t[1];if(n.declarations.length===i.length)r(n,0,1===i.length?e.createDiagnosticForNode(e.first(i).name,e.Diagnostics._0_is_declared_but_its_value_is_never_read,xD(e.first(i).name)):e.createDiagnosticForNode(237===n.parent.kind?n.parent:n,e.Diagnostics.All_variables_are_unused));else for(var a=0,o=i;a<o.length;a++){var s=o[a];r(s,0,e.createDiagnosticForNode(s,e.Diagnostics._0_is_declared_but_its_value_is_never_read,xD(s.name)));}}));}function xD(t){switch(t.kind){case 79:return e.idText(t);case 202:case 201:return xD(e.cast(e.first(t.elements),e.isBindingElement).name);default:return e.Debug.assertNever(t)}}function DD(e){return 267===e.kind||270===e.kind||268===e.kind}function SD(t){if(235===t.kind&&TC(t),e.isFunctionOrModuleBlock(t)){var r=Yr;e.forEach(t.statements,VS),Yr=r;}else e.forEach(t.statements,VS);t.locals&&lD(t);}function TD(t,r,n){if((null==r?void 0:r.escapedText)!==n)return !1;if(167===t.kind||166===t.kind||169===t.kind||168===t.kind||172===t.kind||173===t.kind||296===t.kind)return !1;if(16777216&t.flags)return !1;if((e.isImportClause(t)||e.isImportEqualsDeclaration(t)||e.isImportSpecifier(t))&&e.isTypeOnlyImportOrExportDeclaration(t))return !1;var i=e.getRootDeclaration(t);return !e.isParameter(i)||!e.nodeIsMissing(i.parent.body)}function CD(t){e.findAncestor(t,(function(r){return !!(4&PT(r))&&(79!==t.kind?Jn(e.getNameOfDeclaration(t),e.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference):Jn(t,e.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference),!0)}));}function kD(t){e.findAncestor(t,(function(r){return !!(8&PT(r))&&(79!==t.kind?Jn(e.getNameOfDeclaration(t),e.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference):Jn(t,e.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference),!0)}));}function ED(t){67108864&PT(e.getEnclosingBlockScopeContainer(t))&&(e.Debug.assert(e.isNamedDeclaration(t)&&e.isIdentifier(t.name)&&"string"==typeof t.name.escapedText,"The target of a WeakMap/WeakSet collision check should be an identifier"),Bn("noEmit",t,e.Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel,t.name.escapedText));}function ND(t){var r=!1;if(e.isClassExpression(t)){for(var n=0,i=t.members;n<i.length;n++)if(134217728&PT(i[n])){r=!0;break}}else if(e.isFunctionExpression(t))134217728&PT(t)&&(r=!0);else {var a=e.getEnclosingBlockScopeContainer(t);a&&134217728&PT(a)&&(r=!0);}r&&(e.Debug.assert(e.isNamedDeclaration(t)&&e.isIdentifier(t.name),"The target of a Reflect collision check should be an identifier"),Bn("noEmit",t,e.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers,e.declarationNameToString(t.name),"Reflect"));}function FD(t,r){r&&(function(t,r){if((!(W>=e.ModuleKind.ES2015)||W>=e.ModuleKind.Node16&&e.getSourceFileOfNode(t).impliedNodeFormat===e.ModuleKind.CommonJS)&&r&&(TD(t,r,"require")||TD(t,r,"exports"))&&(!e.isModuleDeclaration(t)||1===e.getModuleInstanceState(t))){var n=lo(t);305===n.kind&&e.isExternalOrCommonJsModule(n)&&Bn("noEmit",r,e.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module,e.declarationNameToString(r),e.declarationNameToString(r));}}(t,r),function(t,r){if(r&&!(q>=4)&&TD(t,r,"Promise")&&(!e.isModuleDeclaration(t)||1===e.getModuleInstanceState(t))){var n=lo(t);305===n.kind&&e.isExternalOrCommonJsModule(n)&&2048&n.flags&&Bn("noEmit",r,e.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions,e.declarationNameToString(r),e.declarationNameToString(r));}}(t,r),function(e,t){q<=8&&(TD(e,t,"WeakMap")||TD(e,t,"WeakSet"))&&bn.push(e);}(t,r),function(e,t){t&&q>=2&&q<=8&&TD(e,t,"Reflect")&&xn.push(e);}(t,r),e.isClassLike(t)?(mS(r,e.Diagnostics.Class_name_cannot_be_0),16777216&t.flags||function(t){q>=1&&"Object"===t.escapedText&&(W<e.ModuleKind.ES2015||e.getSourceFileOfNode(t).impliedNodeFormat===e.ModuleKind.CommonJS)&&Jn(t,e.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0,e.ModuleKind[W]);}(r)):e.isEnumDeclaration(t)&&mS(r,e.Diagnostics.Enum_name_cannot_be_0));}function AD(e){return e===Re?Le:e===Xt?Qt:e}function PD(t){var r;if(oD(t),e.isBindingElement(t)||VS(t.type),t.name){if(162===t.name.kind&&(Hy(t.name),t.initializer&&cx(t.initializer)),e.isBindingElement(t)){e.isObjectBindingPattern(t.parent)&&t.dotDotDotToken&&q<5&&GT(t,4),t.propertyName&&162===t.propertyName.kind&&Hy(t.propertyName);var n=t.parent.parent,i=fo(n,t.dotDotDotToken?64:0),a=t.propertyName||t.name;if(i&&!e.isBindingPattern(a)){var o=v_(a);if(Rs(o)){var s=Zc(i,Ks(o));s&&(Zv(s,void 0,!1),bv(t,!!n.initializer&&106===n.initializer.kind,!1,i,s));}}}if(e.isBindingPattern(t.name)&&(202===t.name.kind&&q<2&&V.downlevelIteration&&GT(t,512),e.forEach(t.name.elements,VS)),t.initializer&&e.isParameterDeclaration(t)&&e.nodeIsMissing(e.getContainingFunction(t).body))Jn(t,e.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);else if(e.isBindingPattern(t.name)){var c=t.initializer&&243!==t.parent.parent.kind,l=0===t.name.elements.length;if(c||l){var u=jo(t);if(c){var _=cx(t.initializer);Q&&l?Av(_,t):mp(_,jo(t),t,t.initializer);}l&&(e.isArrayBindingPattern(t.name)?zD(65,u,qe,t):Q&&Av(u,t));}}else {var d=la(t);if(2097152&d.flags&&e.isVariableDeclarationInitializedToBareOrAccessedRequire(203===t.kind?t.parent.parent:t))IS(t);else {var p=AD($o(d));if(t===d.valueDeclaration){var f=e.getEffectiveInitializer(t);f&&(e.isInJSFile(t)&&e.isObjectLiteralExpression(f)&&(0===f.properties.length||e.isPrototypeAccess(t.name))&&(null===(r=d.exports)||void 0===r?void 0:r.size)||243===t.parent.parent.kind||mp(cx(f),p,t,f,void 0)),d.declarations&&d.declarations.length>1&&e.some(d.declarations,(function(r){return r!==t&&e.isVariableLike(r)&&!ID(r,t)}))&&Jn(t.name,e.Diagnostics.All_declarations_of_0_must_have_identical_modifiers,e.declarationNameToString(t.name));}else {var g=AD(jo(t));po(p)||po(g)||op(p,g)||67108864&d.flags||wD(d.valueDeclaration,p,t,g),t.initializer&&mp(cx(t.initializer),g,t,t.initializer,void 0),d.valueDeclaration&&!ID(t,d.valueDeclaration)&&Jn(t.name,e.Diagnostics.All_declarations_of_0_must_have_identical_modifiers,e.declarationNameToString(t.name));}167!==t.kind&&166!==t.kind&&(qx(t),254!==t.kind&&203!==t.kind||function(t){if(0==(3&e.getCombinedNodeFlags(t))&&!e.isParameterDeclaration(t)&&(254!==t.kind||t.initializer)){var r=la(t);if(1&r.flags){if(!e.isIdentifier(t.name))return e.Debug.fail();var n=li(t,t.name.escapedText,3,void 0,void 0,!1);if(n&&n!==r&&2&n.flags&&3&vv(n)){var i=e.getAncestor(n.valueDeclaration,255),a=237===i.parent.kind&&i.parent.parent?i.parent.parent:void 0;if(!a||!(235===a.kind&&e.isFunctionLike(a.parent)||262===a.kind||261===a.kind||305===a.kind)){var o=Ua(n);Jn(t,e.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1,o,o);}}}}}(t),FD(t,t.name));}}}}function wD(t,r,n,i){var a=e.getNameOfDeclaration(n),o=167===n.kind||166===n.kind?e.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2:e.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2,s=e.declarationNameToString(a),c=Jn(a,o,s,qa(r),qa(i));t&&e.addRelatedInfo(c,e.createDiagnosticForNode(t,e.Diagnostics._0_was_also_declared_here,s));}function ID(t,r){return 164===t.kind&&254===r.kind||254===t.kind&&164===r.kind||e.hasQuestionToken(t)===e.hasQuestionToken(r)&&e.getSelectedEffectiveModifierFlags(t,504)===e.getSelectedEffectiveModifierFlags(r,504)}function OD(t){null===e.tracing||void 0===e.tracing||e.tracing.push("check","checkVariableDeclaration",{kind:t.kind,pos:t.pos,end:t.end,path:t.tracingPath}),function(t){if(243!==t.parent.parent.kind&&244!==t.parent.parent.kind)if(16777216&t.flags)fC(t);else if(!t.initializer){if(e.isBindingPattern(t.name)&&!e.isBindingPattern(t.parent))return DC(t,e.Diagnostics.A_destructuring_declaration_must_have_an_initializer);if(e.isVarConst(t))return DC(t,e.Diagnostics.const_declarations_must_be_initialized)}if(t.exclamationToken&&(237!==t.parent.parent.kind||!t.type||t.initializer||16777216&t.flags)){var r=t.initializer?e.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions:t.type?e.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context:e.Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations;return DC(t.exclamationToken,r)}!(W<e.ModuleKind.ES2015||e.getSourceFileOfNode(t).impliedNodeFormat===e.ModuleKind.CommonJS)||W===e.ModuleKind.System||16777216&t.parent.parent.flags||!e.hasSyntacticModifier(t.parent.parent,1)||gC(t.name),(e.isLet(t)||e.isVarConst(t))&&mC(t.name);}(t),PD(t),null===e.tracing||void 0===e.tracing||e.tracing.pop();}function MD(t){XT(t)||yC(t.declarationList)||function(t){if(!vC(t.parent)){if(e.isLet(t.declarationList))return DC(t,e.Diagnostics.let_declarations_can_only_be_declared_inside_a_block);e.isVarConst(t.declarationList)&&DC(t,e.Diagnostics.const_declarations_can_only_be_declared_inside_a_block);}}(t),e.forEach(t.declarationList.declarations,VS);}function LD(t,r){if(Q)for(n(t,r);e.isBinaryExpression(t)&&56===t.operatorToken.kind;)n(t=t.left,r);function n(t,r){var n=!e.isBinaryExpression(t)||56!==t.operatorToken.kind&&55!==t.operatorToken.kind?t:t.right;if(!e.isModuleExportsAccessExpression(n)){var i=BD(n),a=e.isPropertyAccessExpression(n)&&lx(n.expression);if(!Mf(i)&&!a){var o=el(i,0),s=!!Wx(i);if(0!==o.length||s){var c=e.isIdentifier(n)?n:e.isPropertyAccessExpression(n)?n.name:e.isBinaryExpression(n)&&e.isIdentifier(n.right)?n.right:void 0,l=c&&oT(c);(l||s)&&(l&&e.isBinaryExpression(t.parent)&&function(t,r){for(;e.isBinaryExpression(t)&&55===t.operatorToken.kind;){if(e.forEachChild(t.right,(function t(n){if(e.isIdentifier(n)){var i=oT(n);if(i&&i===r)return !0}return e.forEachChild(n,t)})))return !0;t=t.parent;}return !1}(t.parent,l)||l&&r&&function(t,r,n,i){return !!e.forEachChild(r,(function r(a){if(e.isIdentifier(a)){var o=oT(a);if(o&&o===i){if(e.isIdentifier(t)||e.isIdentifier(n)&&e.isBinaryExpression(n.parent))return !0;for(var s=n.parent,c=a.parent;s&&c;){if(e.isIdentifier(s)&&e.isIdentifier(c)||108===s.kind&&108===c.kind)return oT(s)===oT(c);if(e.isPropertyAccessExpression(s)&&e.isPropertyAccessExpression(c)){if(oT(s.name)!==oT(c.name))return !1;c=c.expression,s=s.expression;}else {if(!e.isCallExpression(s)||!e.isCallExpression(c))return !1;c=c.expression,s=s.expression;}}}}return e.forEachChild(a,r)}))}(t,r,c,l)||(s?Un(n,!0,e.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined,Ha(i)):Jn(n,e.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead)));}}}}}function RD(t,r){return 16384&t.flags&&Jn(r,e.Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness),t}function BD(e,t){return RD(kx(e,t),e)}function jD(e){var t=e.initializer;t.declarations.length>=1&&OD(t.declarations[0]);}function JD(e){return zD(e.awaitModifier?15:13,Sv(e.expression),qe,e.expression)}function zD(e,t,r,n){return _o(t)?t:KD(e,t,r,n,!0)||Le}function KD(t,r,n,i,a){var o=0!=(2&t);if(r!==st){var s=q>=2,c=!s&&V.downlevelIteration,l=V.noUncheckedIndexedAccess&&!!(128&t);if(s||c||o){var u=GD(r,t,s?i:void 0);if(a&&u){var _=8&t?e.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0:32&t?e.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0:64&t?e.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0:16&t?e.Diagnostics.Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0:void 0;_&&gp(n,u.nextType,i,_);}if(u||s)return l?um(u&&u.yieldType):u&&u.yieldType}var d=r,p=!1,f=!1;if(4&t){if(1048576&d.flags){var g=r.types,m=e.filter(g,(function(e){return !(402653316&e.flags)}));m!==g&&(d=a_(m,2));}else 402653316&d.flags&&(d=st);if((f=d!==r)&&(q<1&&i&&(Jn(i,e.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher),p=!0),131072&d.flags))return l?um(Ye):Ye}if(!pf(d)){if(i&&!p){var y=function(n,i){var a;return i?n?[e.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator,!0]:[e.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator,!0]:UD(t,0,r,void 0)?[e.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher,!1]:function(e){switch(e){case"Float32Array":case"Float64Array":case"Int16Array":case"Int32Array":case"Int8Array":case"NodeList":case"Uint16Array":case"Uint32Array":case"Uint8Array":case"Uint8ClampedArray":return !0}return !1}(null===(a=r.symbol)||void 0===a?void 0:a.escapedName)?[e.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher,!0]:n?[e.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type,!0]:[e.Diagnostics.Type_0_is_not_an_array_type,!0]}(!!(4&t)&&!f,c),v=y[0];Un(i,y[1]&&!!Wx(d),v,qa(d));}return f?l?um(Ye):Ye:void 0}var h=sl(d,Ze);return f&&h?402653316&h.flags&&!V.noUncheckedIndexedAccess?Ye:a_(l?[h,Ye,qe]:[h,Ye],2):128&t?um(h):h}tS(i,r,o);}function UD(e,t,r,n){if(!_o(r)){var i=GD(r,e,n);return i&&i[j(t)]}}function VD(e,t,r){if(void 0===e&&(e=st),void 0===t&&(t=st),void 0===r&&(r=Ue),67359327&e.flags&&180227&t.flags&&180227&r.flags){var n=Gl([e,t,r]),i=Br.get(n);return i||(i={yieldType:e,returnType:t,nextType:r},Br.set(n,i)),i}return {yieldType:e,returnType:t,nextType:r}}function qD(t){for(var r,n,i,a=0,o=t;a<o.length;a++){var s=o[a];if(void 0!==s&&s!==jr){if(s===Jr)return Jr;r=e.append(r,s.yieldType),n=e.append(n,s.returnType),i=e.append(i,s.nextType);}}return r||n||i?VD(r&&a_(r),n&&a_(n),i&&p_(i)):jr}function WD(e,t){return e[t]}function HD(e,t,r){return e[t]=r}function GD(t,r,n){if(_o(t))return Jr;if(!(1048576&t.flags)){var i=XD(t,r,n);return i===jr?void(n&&tS(n,t,!!(2&r))):i}var a,o=2&r?"iterationTypesOfAsyncIterable":"iterationTypesOfIterable",s=WD(t,o);if(s)return s===jr?void 0:s;for(var c=0,l=t.types;c<l.length;c++){var u=XD(l[c],r,n);if(u===jr)return n&&tS(n,t,!!(2&r)),void HD(t,o,jr);a=e.append(a,u);}var _=a?qD(a):jr;return HD(t,o,_),_===jr?void 0:_}function QD(e,t){if(e===jr)return jr;if(e===Jr)return Jr;var r=e.yieldType,n=e.returnType,i=e.nextType;return t&&Mu(!0),VD(Zx(r,t)||Le,Zx(n,t)||Le,i)}function XD(e,t,r){if(_o(e))return Jr;var n;if(2&t&&(n=YD(e,Ur)||$D(e,Ur)))return 8&t?QD(n,r):n;if(1&t&&(n=YD(e,Vr)||$D(e,Vr))){if(!(2&t))return n;if(n!==jr)return HD(e,"iterationTypesOfAsyncIterable",QD(n,r))}return 2&t&&(n=eS(e,Ur,r))!==jr?n:1&t&&(n=eS(e,Vr,r))!==jr?2&t?HD(e,"iterationTypesOfAsyncIterable",n?QD(n,r):jr):n:jr}function YD(e,t){return WD(e,t.iterableCacheKey)}function ZD(e,t){var r=YD(e,t)||eS(e,t,void 0);return r===jr?Kr:r}function $D(e,t){var r;if(ts(e,r=t.getGlobalIterableType(!1))||ts(e,r=t.getGlobalIterableIteratorType(!1))){var n=eu(e)[0],i=ZD(r,t),a=i.returnType,o=i.nextType;return HD(e,t.iterableCacheKey,VD(t.resolveIterationType(n,void 0)||n,t.resolveIterationType(a,void 0)||a,o))}if(ts(e,t.getGlobalGeneratorType(!1))){var s=eu(e);return n=s[0],a=s[1],o=s[2],HD(e,t.iterableCacheKey,VD(t.resolveIterationType(n,void 0)||n,t.resolveIterationType(a,void 0)||a,o))}}function eS(t,r,n){var i,a,o,s,c=Zc(t,(a=r.iteratorSymbolName,(s=(o=Nu(!1))&&uo($o(o),e.escapeLeadingUnderscores(a)))&&Rs(s)?Ks(s):"__@".concat(a))),l=!c||16777216&c.flags?void 0:$o(c);if(_o(l))return HD(t,r.iterableCacheKey,Jr);var u=l?el(l,0):void 0;if(!e.some(u))return HD(t,r.iterableCacheKey,jr);var _=null!==(i=rS(p_(e.map(u,Nl)),r,n))&&void 0!==i?i:jr;return HD(t,r.iterableCacheKey,_)}function tS(t,r,n){var i=n?e.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator:e.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;Un(t,!!Wx(r),i,qa(r));}function rS(e,t,r){if(_o(e))return Jr;var n=nS(e,t)||function(e,t){var r=t.getGlobalIterableIteratorType(!1);if(ts(e,r)){var n=eu(e)[0],i=nS(r,t)||cS(r,t,void 0),a=i===jr?Kr:i,o=a.returnType,s=a.nextType;return HD(e,t.iteratorCacheKey,VD(n,o,s))}if(ts(e,t.getGlobalIteratorType(!1))||ts(e,t.getGlobalGeneratorType(!1))){var c=eu(e);return n=c[0],o=c[1],s=c[2],HD(e,t.iteratorCacheKey,VD(n,o,s))}}(e,t)||cS(e,t,r);return n===jr?void 0:n}function nS(e,t){return WD(e,t.iteratorCacheKey)}function iS(e,t){var r=uo(e,"done")||et;return _p(0===t?et:rt,r)}function aS(e){return iS(e,0)}function oS(e){return iS(e,1)}function sS(t,r,n,i){var a,o,s,c,l=Zc(t,n);if(l||"next"===n){var u=!l||"next"===n&&16777216&l.flags?void 0:"next"===n?$o(l):om($o(l),2097152);if(_o(u))return "next"===n?Jr:zr;var _,d,p,f,g,m=u?el(u,0):e.emptyArray;if(0===m.length)return i&&Jn(i,"next"===n?r.mustHaveANextMethodDiagnostic:r.mustBeAMethodDiagnostic,n),"next"===n?Jr:void 0;if((null==u?void 0:u.symbol)&&1===m.length){var y=r.getGlobalGeneratorType(!1),v=r.getGlobalIteratorType(!1),h=(null===(o=null===(a=y.symbol)||void 0===a?void 0:a.members)||void 0===o?void 0:o.get(n))===u.symbol,b=!h&&(null===(c=null===(s=v.symbol)||void 0===s?void 0:s.members)||void 0===c?void 0:c.get(n))===u.symbol;if(h||b){var x=h?y:v,D=u.mapper;return VD(Id(x.typeParameters[0],D),Id(x.typeParameters[1],D),"next"===n?Id(x.typeParameters[2],D):void 0)}}for(var S=0,T=m;S<T.length;S++){var C=T[S];"throw"!==n&&e.some(C.parameters)&&(_=e.append(_,gb(C,0))),d=e.append(d,Nl(C));}if("throw"!==n){var k=_?a_(_):Ue;if("next"===n)f=k;else if("return"===n){var E=r.resolveIterationType(k,i)||Le;p=e.append(p,E);}}var N=d?p_(d):st,F=function(e){if(_o(e))return Jr;var t=WD(e,"iterationTypesOfIteratorResult");if(t)return t;if(ts(e,_r||(_r=Tu("IteratorYieldResult",1,!1))||Et))return HD(e,"iterationTypesOfIteratorResult",VD(eu(e)[0],void 0,void 0));if(ts(e,dr||(dr=Tu("IteratorReturnResult",1,!1))||Et))return HD(e,"iterationTypesOfIteratorResult",VD(void 0,eu(e)[0],void 0));var r=km(e,aS),n=r!==st?uo(r,"value"):void 0,i=km(e,oS),a=i!==st?uo(i,"value"):void 0;return HD(e,"iterationTypesOfIteratorResult",n||a?VD(n,a||ot,void 0):jr)}(r.resolveIterationType(N,i)||Le);return F===jr?(i&&Jn(i,r.mustHaveAValueDiagnostic,n),g=Le,p=e.append(p,Le)):(g=F.yieldType,p=e.append(p,F.returnType)),VD(g,a_(p),f)}}function cS(e,t,r){var n=qD([sS(e,t,"next",r),sS(e,t,"return",r),sS(e,t,"throw",r)]);return HD(e,t.iteratorCacheKey,n)}function lS(e,t,r){if(!_o(t)){var n=uS(t,r);return n&&n[j(e)]}}function uS(e,t){if(_o(e))return Jr;var r=t?Ur:Vr;return GD(e,t?2:1,void 0)||rS(e,r,void 0)}function _S(e,t){var r=!!(2&t);return 1&t?lS(1,e,r)||je:r?$x(e)||je:e}function dS(t,r){var n=_S(r,e.getFunctionFlags(t));return !!n&&Hb(n,16387)}function pS(t,r,n){var i=al(t);if(0!==i.length){for(var a=0,o=Cc(t);a<o.length;a++){var s=o[a];n&&4194304&s.flags||fS(t,s,h_(s,8576,!0),es(s));}var c=r.valueDeclaration;if(c&&e.isClassLike(c))for(var l=0,u=c.members;l<u.length;l++){var _=u[l];if(!e.isStatic(_)&&!zs(_)){var d=la(_);fS(t,d,Sx(_.name.expression),es(d));}}if(i.length>1)for(var p=0,f=i;p<f.length;p++)gS(t,f[p]);}}function fS(t,r,n,i){var a=r.valueDeclaration,o=e.getNameOfDeclaration(a);if(!o||!e.isPrivateIdentifier(o))for(var s=cl(t,n),c=2&e.getObjectFlags(t)?e.getDeclarationOfKind(t.symbol,258):void 0,l=a&&221===a.kind||o&&162===o.kind||ua(r)===t.symbol?a:void 0,u=function(n){var a=n.declaration&&ua(la(n.declaration))===t.symbol?n.declaration:void 0,o=l||a||(c&&!e.some(gs(t),(function(e){return !!kc(e,r.escapedName)&&!!sl(e,n.keyType)}))?c:void 0);o&&!_p(i,n.type)&&Jn(o,e.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3,Ua(r),qa(i),qa(n.keyType),qa(n.type));},_=0,d=s;_<d.length;_++)u(d[_]);}function gS(t,r){for(var n=r.declaration,i=cl(t,r.keyType),a=2&e.getObjectFlags(t)?e.getDeclarationOfKind(t.symbol,258):void 0,o=n&&ua(la(n))===t.symbol?n:void 0,s=function(n){if(n===r)return "continue";var i=n.declaration&&ua(la(n.declaration))===t.symbol?n.declaration:void 0,s=o||i||(a&&!e.some(gs(t),(function(e){return !!ol(e,r.keyType)&&!!sl(e,n.keyType)}))?a:void 0);s&&!_p(r.type,n.type)&&Jn(s,e.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,qa(r.keyType),qa(r.type),qa(n.keyType),qa(n.type));},c=0,l=i;c<l.length;c++)s(l[c]);}function mS(e,t){switch(e.escapedText){case"any":case"unknown":case"never":case"number":case"bigint":case"boolean":case"string":case"symbol":case"void":case"object":Jn(e,t,e.escapedText);}}function yS(t){var r=!1;if(t)for(var n=0;n<t.length;n++){var i=t[n];Ex(i),m(a(i,n));}function a(n,i){return function(){var a,o,s;n.default?(r=!0,a=n.default,o=t,s=i,function t(r){if(178===r.kind){var n=mu(r);if(262144&n.flags)for(var i=s;i<o.length;i++)n.symbol===la(o[i])&&Jn(r,e.Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);}e.forEachChild(r,t);}(a)):r&&Jn(n,e.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);for(var c=0;c<i;c++)t[c].symbol===n.symbol&&Jn(n.name,e.Diagnostics.Duplicate_identifier_0,e.declarationNameToString(n.name));}}}function vS(t){if(!t.declarations||1!==t.declarations.length){var r=ri(t);if(!r.typeParametersChecked){r.typeParametersChecked=!0;var n=function(t){return e.filter(t.declarations,(function(e){return 257===e.kind||258===e.kind}))}(t);if(!n||n.length<=1)return;if(!hS(n,Es(t).localTypeParameters,e.getEffectiveTypeParameterDeclarations))for(var i=Ua(t),a=0,o=n;a<o.length;a++)Jn(o[a].name,e.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters,i);}}}function hS(t,r,n){for(var i=e.length(r),a=vl(r),o=0,s=t;o<s.length;o++){var c=n(s[o]),l=c.length;if(l<a||l>i)return !1;for(var u=0;u<l;u++){var _=c[u],d=r[u];if(_.name.escapedText!==d.symbol.escapedName)return !1;var p=e.getEffectiveConstraintOfTypeParameter(_),f=p&&kd(p),g=Ac(d);if(f&&g&&!op(f,g))return !1;var m=_.default&&kd(_.default),y=Jc(d);if(m&&y&&!op(m,y))return !1}}return !0}function bS(t){!function(t){var r=e.getSourceFileOfNode(t);(function(t){var r=!1,n=!1;if(!XT(t)&&t.heritageClauses)for(var i=0,a=t.heritageClauses;i<a.length;i++){var o=a[i];if(94===o.token){if(r)return bC(o,e.Diagnostics.extends_clause_already_seen);if(n)return bC(o,e.Diagnostics.extends_clause_must_precede_implements_clause);if(o.types.length>1)return bC(o.types[1],e.Diagnostics.Classes_can_only_extend_a_single_class);r=!0;}else {if(e.Debug.assert(117===o.token),n)return bC(o,e.Diagnostics.implements_clause_already_seen);n=!0;}nC(o);}})(t)||eC(t.typeParameters,r);}(t),oD(t),FD(t,t.name),yS(e.getEffectiveTypeParameterDeclarations(t)),qx(t);var r=la(t),n=Es(r),i=Hs(n),a=$o(r);vS(r),Vx(r),function(t){for(var r=new e.Map,n=new e.Map,i=new e.Map,a=0,o=t.members;a<o.length;a++){var s=o[a];if(171===s.kind)for(var c=0,l=s.parameters;c<l.length;c++){var u=l[c];e.isParameterPropertyDeclaration(u,s)&&!e.isBindingPattern(u.name)&&y(r,u.name,u.name.escapedText,3);}else {var _=e.isStatic(s),d=s.name;if(!d)continue;var p=e.isPrivateIdentifier(d),f=p&&_?16:0,g=p?i:_?n:r,m=d&&e.getPropertyNameForPropertyNameNode(d);if(m)switch(s.kind){case 172:y(g,d,m,1|f);break;case 173:y(g,d,m,2|f);break;case 167:y(g,d,m,3|f);break;case 169:y(g,d,m,8|f);}}}function y(t,r,n,i){var a=t.get(n);if(a)if((16&a)!=(16&i))Jn(r,e.Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name,e.getTextOfNode(r));else {var o=!!(8&a),s=!!(8&i);o||s?o!==s&&Jn(r,e.Diagnostics.Duplicate_identifier_0,e.getTextOfNode(r)):a&i&-17?Jn(r,e.Diagnostics.Duplicate_identifier_0,e.getTextOfNode(r)):t.set(n,a|i);}else t.set(n,i);}}(t),16777216&t.flags||function(t){for(var r=0,n=t.members;r<n.length;r++){var i=n[r],a=i.name;if(e.isStatic(i)&&a){var o=e.getPropertyNameForPropertyNameNode(a);switch(o){case"name":case"length":case"caller":case"arguments":case"prototype":Jn(a,e.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1,o,ro(la(t)));}}}}(t);var o=e.getEffectiveBaseTypeNode(t);if(o){e.forEach(o.typeArguments,VS),q<2&&GT(o.parent,1);var s=e.getClassExtendsHeritageElement(t);s&&s!==o&&kx(s.expression);var c=gs(n);c.length&&m((function(){var r=c[0],s=ps(n),l=Kc(s);if(function(t,r){var n=el(t,1);if(n.length){var i=n[0].declaration;i&&e.hasEffectiveModifier(i,8)&&(rT(r,e.getClassLikeDeclarationOfSymbol(t.symbol))||Jn(r,e.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private,Vi(t.symbol)));}}(l,o),VS(o.expression),e.some(o.typeArguments)){e.forEach(o.typeArguments,VS);for(var u=0,_=_s(l,o.typeArguments,o);u<_.length;u++){var d=_[u];if(!Bx(o,d.typeParameters))break}}var p=Hs(r,n.thisType);if(gp(i,p,void 0)?gp(a,ap(l),t.name||t,e.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1):SS(t,i,p,e.Diagnostics.Class_0_incorrectly_extends_base_class_1),8650752&s.flags&&(cs(a)?el(s,1).some((function(e){return 4&e.flags}))&&!e.hasSyntacticModifier(t,128)&&Jn(t.name||t,e.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract):Jn(t.name||t,e.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any)),!(l.symbol&&32&l.symbol.flags||8650752&s.flags)){var f=ds(l,o.typeArguments,o);e.forEach(f,(function(e){return !Gh(e.declaration)&&!op(Nl(e),r)}))&&Jn(o.expression,e.Diagnostics.Base_constructors_must_all_have_the_same_return_type);}!function(t,r){var n,i;e:for(var a=0,o=Nc(r);a<o.length;a++){var s=o[a],c=TS(s);if(!(4194304&c.flags)){var l=kc(t,c.escapedName);if(l){var u=TS(l),_=e.getDeclarationModifierFlagsFromSymbol(c);if(e.Debug.assert(!!u,"derived should point to something, even if it is the base class' declaration."),u===c){var d=e.getClassLikeDeclarationOfSymbol(t.symbol);if(128&_&&(!d||!e.hasSyntacticModifier(d,128))){for(var p=0,f=gs(t);p<f.length;p++){var g=f[p];if(g!==r){var m=kc(g,c.escapedName),y=m&&TS(m);if(y&&y!==c)continue e}}226===d.kind?Jn(d,e.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,Ua(s),qa(r)):Jn(d,e.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,qa(t),Ua(s),qa(r));}}else {var v=e.getDeclarationModifierFlagsFromSymbol(u);if(8&_||8&v)continue;var h=void 0,b=98308&c.flags,x=98308&u.flags;if(b&&x){if(128&_&&!(c.valueDeclaration&&e.isPropertyDeclaration(c.valueDeclaration)&&c.valueDeclaration.initializer)||c.valueDeclaration&&258===c.valueDeclaration.parent.kind||u.valueDeclaration&&e.isBinaryExpression(u.valueDeclaration))continue;var D=4!==b&&4===x;if(D||4===b&&4!==x){var S=D?e.Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property:e.Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor;Jn(e.getNameOfDeclaration(u.valueDeclaration)||u.valueDeclaration,S,Ua(c),qa(r),qa(t));}else if(H){var T=null===(n=u.declarations)||void 0===n?void 0:n.find((function(e){return 167===e.kind&&!e.initializer}));if(T&&!(33554432&u.flags)&&!(128&_)&&!(128&v)&&!(null===(i=u.declarations)||void 0===i?void 0:i.some((function(e){return !!(16777216&e.flags)})))){var C=ya(e.getClassLikeDeclarationOfSymbol(t.symbol)),k=T.name;if(T.exclamationToken||!C||!e.isIdentifier(k)||!Q||!kS(k,t,C)){var E=e.Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration;Jn(e.getNameOfDeclaration(u.valueDeclaration)||u.valueDeclaration,E,Ua(c),qa(r));}}}continue}if(hv(c)){if(hv(u)||4&u.flags)continue;e.Debug.assert(!!(98304&u.flags)),h=e.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;}else h=98304&c.flags?e.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function:e.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;Jn(e.getNameOfDeclaration(u.valueDeclaration)||u.valueDeclaration,h,qa(r),Ua(c),qa(t));}}}}}(n,r);}));}!function(t,r,n,i){for(var a=e.getEffectiveBaseTypeNode(t)&&gs(r),o=(null==a?void 0:a.length)?Hs(e.first(a),r.thisType):void 0,s=ps(r),c=function(a){if(e.hasAmbientModifier(a))return "continue";e.isConstructorDeclaration(a)&&e.forEach(a.parameters,(function(c){e.isParameterPropertyDeclaration(c,a)&&xS(t,i,s,o,r,n,c,!0);})),xS(t,i,s,o,r,n,a,!1);},l=0,u=t.members;l<u.length;l++)c(u[l]);}(t,n,i,a);var l=e.getEffectiveImplementsTypeNodes(t);if(l)for(var u=0,_=l;u<_.length;u++){var d=_[u];e.isEntityNameExpression(d.expression)&&!e.isOptionalChain(d.expression)||Jn(d.expression,e.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments),Jx(d),m(p(d));}function p(r){return function(){var a=Hc(kd(r));if(!po(a))if(ys(a)){var o=a.symbol&&32&a.symbol.flags?e.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass:e.Diagnostics.Class_0_incorrectly_implements_interface_1,s=Hs(a,n.thisType);gp(i,s,void 0)||SS(t,i,s,o);}else Jn(r,e.Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);}}m((function(){pS(n,r),pS(a,r,!0),wx(t),function(t){if(Q&&Z&&!(16777216&t.flags))for(var r=ya(t),n=0,i=t.members;n<i.length;n++){var a=i[n];if(!(2&e.getEffectiveModifierFlags(a))&&!e.isStatic(a)&&CS(a)){var o=a.name;if(e.isIdentifier(o)||e.isPrivateIdentifier(o)||e.isComputedPropertyName(o)){var s=$o(la(a));3&s.flags||32768&Mf(s)||r&&kS(o,s,r)||Jn(a.name,e.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor,e.declarationNameToString(o));}}}}(t);}));}function xS(t,r,n,i,a,o,s,c,l){void 0===l&&(l=!0);var u=s.name&&oT(s.name)||oT(s);return u?DS(t,r,n,i,a,o,e.hasOverrideModifier(s),e.hasAbstractModifier(s),e.isStatic(s),c,e.symbolName(u),l?s:void 0):0}function DS(t,r,n,i,a,o,s,c,l,u,_,d){var p=e.isInJSFile(t),f=!!(16777216&t.flags);if(i&&(s||V.noImplicitOverride)){var g=e.escapeLeadingUnderscores(_),m=l?n:i,y=Zc(l?r:o,g),v=Zc(m,g),h=qa(i);if(y&&!v&&s){if(d){var b=qv(_,m);b?Jn(d,p?e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1:e.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1,h,Ua(b)):Jn(d,p?e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0:e.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0,h);}return 2}if(y&&(null==v?void 0:v.declarations)&&V.noImplicitOverride&&!f){var x=e.some(v.declarations,e.hasAbstractModifier);if(s)return 0;if(!x)return d&&Jn(d,u?p?e.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0:e.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0:p?e.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0:e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0,h),1;if(c&&x)return d&&Jn(d,e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0,h),1}}else if(s){if(d){var D=qa(a);Jn(d,p?e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class:e.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class,D);}return 2}return 0}function SS(t,r,n,i){for(var a=!1,o=function(t){if(e.isStatic(t))return "continue";var i=t.name&&oT(t.name)||oT(t);if(i){var o=Zc(r,i.escapedName),s=Zc(n,i.escapedName);o&&s&&(gp($o(o),$o(s),t.name||t,void 0,(function(){return e.chainDiagnosticMessages(void 0,e.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2,Ua(i),qa(r),qa(n))}))||(a=!0));}},s=0,c=t.members;s<c.length;s++)o(c[s]);a||gp(r,n,t.name||t,i);}function TS(t){return 1&e.getCheckFlags(t)?t.target:t}function CS(t){return 167===t.kind&&!e.hasAbstractModifier(t)&&!t.exclamationToken&&!t.initializer}function kS(t,r,n){var i=e.isComputedPropertyName(t)?e.factory.createElementAccessExpression(e.factory.createThis(),t.expression):e.factory.createPropertyAccessExpression(e.factory.createThis(),t);return e.setParent(i.expression,i),e.setParent(i,n),i.flowNode=n.returnFlowNode,!(32768&Mf(Xm(i,r,jf(r))))}function ES(e){var t=ni(e);if(!(16384&t.flags)){t.flags|=16384;for(var r=0,n=0,i=e.members;n<i.length;n++){var a=i[n],o=NS(a,r);ni(a).enumMemberValue=o,r="number"==typeof o?o+1:void 0;}}}function NS(t,r){if(e.isComputedNonLiteralName(t.name))Jn(t.name,e.Diagnostics.Computed_property_names_are_not_allowed_in_enums);else {var n=e.getTextOfPropertyName(t.name);e.isNumericLiteralName(n)&&!e.isInfinityOrNaNString(n)&&Jn(t.name,e.Diagnostics.An_enum_member_cannot_have_a_numeric_name);}return t.initializer?function(t){var r=Ds(la(t.parent)),n=e.isEnumConst(t.parent),i=t.initializer,a=1!==r||xs(t)?function r(n){switch(n.kind){case 219:var i=r(n.operand);if("number"==typeof i)switch(n.operator){case 39:return i;case 40:return -i;case 54:return ~i}break;case 221:var a=r(n.left),o=r(n.right);if("number"==typeof a&&"number"==typeof o)switch(n.operatorToken.kind){case 51:return a|o;case 50:return a&o;case 48:return a>>o;case 49:return a>>>o;case 47:return a<<o;case 52:return a^o;case 41:return a*o;case 43:return a/o;case 39:return a+o;case 40:return a-o;case 44:return a%o;case 42:return Math.pow(a,o)}else if("string"==typeof a&&"string"==typeof o&&39===n.operatorToken.kind)return a+o;break;case 10:case 14:return n.text;case 8:return CC(n),+n.text;case 212:return r(n.expression);case 79:var c=n;return e.isInfinityOrNaNString(c.escapedText)?+c.escapedText:e.nodeIsMissing(n)?0:s(n,la(t.parent),c.escapedText);case 207:case 206:if(FS(n)){var l=Sx(n.expression);if(l.symbol&&384&l.symbol.flags){var u;return u=206===n.kind?n.name.escapedText:e.escapeLeadingUnderscores(e.cast(n.argumentExpression,e.isLiteralExpression).text),s(n,l.symbol,u)}}}}(i):void 0;if(void 0!==a)n&&"number"==typeof a&&!isFinite(a)&&Jn(i,isNaN(a)?e.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN:e.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);else {if(1===r)return Jn(i,e.Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members),0;if(n)Jn(i,e.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);else if(16777216&t.parent.flags)Jn(i,e.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);else {var o=kx(i);Gb(o,296)?gp(o,Es(la(t.parent)),i,void 0):Jn(i,e.Diagnostics.Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead,qa(o));}}return a;function s(r,n,i){var a=n.exports.get(i);if(a){var o=a.valueDeclaration;if(o!==t)return o&&oi(o,t)&&e.isEnumDeclaration(o.parent)?wT(o):(Jn(r,e.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums),0);Jn(r,e.Diagnostics.Property_0_is_used_before_being_assigned,Ua(a));}}}(t):16777216&t.parent.flags&&!e.isEnumConst(t.parent)&&0===Ds(la(t.parent))?void 0:void 0!==r?r:void Jn(t.name,e.Diagnostics.Enum_member_must_have_initializer)}function FS(t){return Sx(t)!==je&&(79===t.kind||206===t.kind&&FS(t.expression)||207===t.kind&&FS(t.expression)&&e.isStringLiteralLike(t.argumentExpression))}function AS(t){e.isPrivateIdentifier(t.name)&&Jn(t,e.Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);}function PS(t,r){var n;switch(t.kind){case 237:for(var i=0,a=t.declarationList.declarations;i<a.length;i++)PS(a[i],r);break;case 271:case 272:bC(t,e.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);break;case 265:case 266:bC(t,e.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);break;case 203:case 254:var o=t.name;if(e.isBindingPattern(o)){for(var s=0,c=o.elements;s<c.length;s++)PS(c[s],r);break}case 257:case 260:case 256:case 258:case 261:case 259:if(r)return;var l=la(t);if(l){var u=!(33554432&l.flags);u||(u=!!(null===(n=l.parent)||void 0===n?void 0:n.declarations)&&e.isExternalModuleAugmentation(l.parent.declarations[0]));}}}function wS(t){var r=e.getExternalModuleName(t);if(!r||e.nodeIsMissing(r))return !1;if(!e.isStringLiteral(r))return Jn(r,e.Diagnostics.String_literal_expected),!1;var n=262===t.parent.kind&&e.isAmbientModule(t.parent.parent);if(305!==t.parent.kind&&!n)return Jn(r,272===t.kind?e.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace:e.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module),!1;if(n&&e.isExternalModuleNameRelative(r.text)&&!$a(t))return Jn(t,e.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name),!1;if(!e.isImportEqualsDeclaration(t)&&t.assertClause){for(var i=!1,a=0,o=t.assertClause.elements;a<o.length;a++){var s=o[a];e.isStringLiteral(s.value)||(i=!0,Jn(s.value,e.Diagnostics.Import_assertion_values_must_be_string_literal_expressions));}return !i}return !0}function IS(t){var r=la(t),n=Ri(r);if(n!==we){var i=(1160127&(r=ca(r.exportSymbol||r)).flags?111551:0)|(788968&r.flags?788968:0)|(1920&r.flags?1920:0);if(n.flags&i&&Jn(t,275===t.kind?e.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0:e.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0,Ua(r)),V.isolatedModules&&!e.isTypeOnlyImportOrExportDeclaration(t)&&!(16777216&t.flags)){var a=Ji(r),o=!(111551&n.flags);if(o||a)switch(t.kind){case 267:case 270:case 265:V.preserveValueImports&&(e.Debug.assertIsDefined(t.name,"An ImportClause with a symbol should have a name"),_i(Jn(t,o?e.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled:e.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled,s=e.idText(270===t.kind&&t.propertyName||t.name)),o?void 0:a,s)),o&&265===t.kind&&e.hasEffectiveModifier(t,1)&&Jn(t,e.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided);break;case 275:var s;if(e.getSourceFileOfNode(a)!==e.getSourceFileOfNode(t))return void _i(Jn(t,o?e.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type:e.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled,s=e.idText(t.propertyName||t.name)),o?void 0:a,s)}}if(e.isImportSpecifier(t)){var c=MS(r,t);OS(c)&&c.declarations&&Wn(t,c.declarations,c.escapedName);}}}function OS(t){return !!t.declarations&&e.every(t.declarations,(function(t){return !!(268435456&e.getCombinedNodeFlags(t))}))}function MS(t,r){if(!(2097152&t.flags))return t;var n=Ri(t);if(n===we)return n;for(;2097152&t.flags;){var i=Xy(t);if(!i)break;if(i===n)break;if(i.declarations&&e.length(i.declarations)){if(OS(i)){Wn(r,i.declarations,i.escapedName);break}if(t===n)break;t=i;}}return n}function LS(t){FD(t,t.name),IS(t),270===t.kind&&"default"===e.idText(t.propertyName||t.name)&&e.getESModuleInterop(V)&&W!==e.ModuleKind.System&&(W<e.ModuleKind.ES2015||e.getSourceFileOfNode(t).impliedNodeFormat===e.ModuleKind.CommonJS)&&GT(t,131072);}function RS(t){var r;if(t.assertClause){var n=e.isExclusivelyTypeOnlyImportOrExport(t),i=e.getResolutionModeOverrideForClause(t.assertClause,n?DC:void 0);if(n&&i)return e.isNightly()||DC(t.assertClause,e.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next),e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.Node16&&e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.NodeNext?DC(t.assertClause,e.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext):void 0;if((W===e.ModuleKind.NodeNext&&t.moduleSpecifier&&ki(t.moduleSpecifier))!==e.ModuleKind.ESNext&&W!==e.ModuleKind.ESNext)return DC(t.assertClause,W===e.ModuleKind.NodeNext?e.Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls:e.Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext);if(e.isImportDeclaration(t)?null===(r=t.importClause)||void 0===r?void 0:r.isTypeOnly:t.isTypeOnly)return DC(t.assertClause,e.Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);if(i)return DC(t.assertClause,e.Diagnostics.resolution_mode_can_only_be_set_for_type_only_imports)}}function BS(e,t){var r=305===e.parent.kind||262===e.parent.kind||261===e.parent.kind;return r||bC(e,t),!r}function jS(t){return e.isImportDeclaration(t)&&t.importClause&&!t.importClause.isTypeOnly&&(r=t.importClause,e.forEachImportClauseDeclaration(r,(function(e){return !!la(e).isReferenced})))&&!CT(t.importClause,!0)&&!function(t){return e.forEachImportClauseDeclaration(t,(function(e){return !!ri(la(e)).constEnumReferenced}))}(t.importClause);var r;}function JS(t){return e.isImportEqualsDeclaration(t)&&e.isExternalModuleReference(t.moduleReference)&&!t.isTypeOnly&&la(t).isReferenced&&!CT(t,!1)&&!ri(la(t)).constEnumReferenced}function zS(t){if(IS(t),e.getEmitDeclarations(V)&&io(t.propertyName||t.name,!0),t.parent.parent.moduleSpecifier)e.getESModuleInterop(V)&&W!==e.ModuleKind.System&&(W<e.ModuleKind.ES2015||e.getSourceFileOfNode(t).impliedNodeFormat===e.ModuleKind.CommonJS)&&"default"===e.idText(t.propertyName||t.name)&&GT(t,131072);else {var r=t.propertyName||t.name,n=li(r,r.escapedText,2998271,void 0,void 0,!0);if(n&&(n===le||n===ue||n.declarations&&ii(lo(n.declarations[0]))))Jn(r,e.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module,e.idText(r));else {zi(t);var i=n&&(2097152&n.flags?Ri(n):n);(!i||i===we||111551&i.flags)&&cx(t.propertyName||t.name);}}}function KS(t){var r=la(t),n=ri(r);if(!n.exportsChecked){var i=r.exports.get("export=");if(i&&function(t){return e.forEachEntry(t.exports,(function(e,t){return "export="!==t}))}(r)){var a=xi(i)||i.valueDeclaration;!a||$a(a)||e.isInJSFile(a)||Jn(a,e.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);}var o=aa(r);o&&o.forEach((function(t,r){var n=t.declarations,i=t.flags;if("__export"!==r&&!(1920&i)){var a=e.countWhere(n,e.and(F,e.not(e.isInterfaceDeclaration)));if(!(524288&i&&a<=2)&&a>1&&!US(n))for(var o=0,s=n;o<s.length;o++){var c=s[o];R(c)&&Sn.add(e.createDiagnosticForNode(c,e.Diagnostics.Cannot_redeclare_exported_variable_0,e.unescapeLeadingUnderscores(r)));}}})),n.exportsChecked=!0;}}function US(t){return t&&t.length>1&&t.every((function(t){return e.isInJSFile(t)&&e.isAccessExpression(t)&&(e.isExportsIdentifier(t.expression)||e.isModuleExportsAccessExpression(t.expression))}))}function VS(t){if(t){var n=u;u=t,k=0,function(t){e.isInJSFile(t)&&e.forEach(t.jsDoc,(function(t){var r=t.tags;return e.forEach(r,VS)}));var n=t.kind;if(r)switch(n){case 261:case 257:case 258:case 256:r.throwIfCancellationRequested();}switch(n>=237&&n<=253&&t.flowNode&&!qm(t.flowNode)&&Kn(!1===V.allowUnreachableCode,t,e.Diagnostics.Unreachable_code_detected),n){case 163:return Ex(t);case 164:return Nx(t);case 167:return Ix(t);case 166:return function(t){return e.isPrivateIdentifier(t.name)&&Jn(t,e.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies),Ix(t)}(t);case 180:case 179:case 174:case 175:case 176:return Ax(t);case 169:case 168:return function(t){dC(t)||aC(t.name),cD(t),e.hasSyntacticModifier(t,128)&&169===t.kind&&t.body&&Jn(t,e.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract,e.declarationNameToString(t.name)),e.isPrivateIdentifier(t.name)&&!e.getContainingClass(t)&&Jn(t,e.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies),Ox(t);}(t);case 170:return function(t){XT(t),e.forEachChild(t,VS);}(t);case 171:return function(t){Ax(t),function(t){var r=e.isInJSFile(t)?e.getJSDocTypeParameterDeclarations(t):void 0,n=t.typeParameters||r&&e.firstOrUndefined(r);if(n){var i=n.pos===n.end?n.pos:e.skipTrivia(e.getSourceFileOfNode(t).text,n.pos);return xC(t,i,n.end-i,e.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration)}}(t)||function(t){var r=e.getEffectiveReturnTypeNode(t);r&&DC(r,e.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration);}(t),VS(t.body);var r=la(t),n=e.getDeclarationOfKind(r,t.kind);function i(t){return !!e.isPrivateIdentifierClassElementDeclaration(t)||167===t.kind&&!e.isStatic(t)&&!!t.initializer}t===n&&Vx(r),e.nodeIsMissing(t.body)||m((function(){var r=t.parent;if(e.getClassExtendsHeritageElement(r)){sy(t.parent,r);var n=ly(r),a=cy(t.body);if(a){if(n&&Jn(a,e.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null),(99!==e.getEmitScriptTarget(V)||!H)&&(e.some(t.parent.members,i)||e.some(t.parameters,(function(t){return e.hasSyntacticModifier(t,16476)}))))if(function(t,r){var n=e.walkUpParenthesizedExpressions(t.parent);return e.isExpressionStatement(n)&&n.parent===r}(a,t.body)){for(var o=void 0,s=0,c=t.body.statements;s<c.length;s++){var l=c[s];if(e.isExpressionStatement(l)&&e.isSuperCall(e.skipOuterExpressions(l.expression))){o=l;break}if(Mx(l))break}void 0===o&&Jn(t,e.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers);}else Jn(a,e.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);}else n||Jn(t,e.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);}}));}(t);case 172:case 173:return Lx(t);case 178:return Jx(t);case 177:return function(t){var r=function(e){switch(e.parent.kind){case 214:case 174:case 256:case 213:case 179:case 169:case 168:var t=e.parent;if(e===t.type)return t}}(t);if(r){var n=bl(r),i=kl(n);if(i){VS(t.type);var a=t.parameterName;if(0===i.kind||2===i.kind)Sd(a);else if(i.parameterIndex>=0)J(n)&&i.parameterIndex===n.parameters.length-1?Jn(a,e.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter):i.type&&gp(i.type,$o(n.parameters[i.parameterIndex]),t.type,void 0,(function(){return e.chainDiagnosticMessages(void 0,e.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type)}));else if(a){for(var o=!1,s=0,c=r.parameters;s<c.length;s++){var l=c[s].name;if(e.isBindingPattern(l)&&Fx(l,a,i.parameterName)){o=!0;break}}o||Jn(t.parameterName,e.Diagnostics.Cannot_find_parameter_0,i.parameterName);}}}else Jn(t,e.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);}(t);case 181:return function(e){vu(e);}(t);case 182:return function(t){e.forEach(t.members,VS),m((function(){var e=ad(t);pS(e,e.symbol),wx(t),Px(t);}));}(t);case 183:return function(e){VS(e.elementType);}(t);case 184:return function(t){for(var r=t.elements,n=!1,i=!1,a=e.some(r,e.isNamedTupleMember),o=0,s=r;o<s.length;o++){var c=s[o];if(197!==c.kind&&a){DC(c,e.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);break}var l=ju(c);if(8&l){var u=kd(c.type);if(!pf(u)){Jn(c,e.Diagnostics.A_rest_element_type_must_be_an_array_type);break}(cf(u)||Nf(u)&&4&u.target.combinedFlags)&&(i=!0);}else if(4&l){if(i){DC(c,e.Diagnostics.A_rest_element_cannot_follow_another_rest_element);break}i=!0;}else if(2&l){if(i){DC(c,e.Diagnostics.An_optional_element_cannot_follow_a_rest_element);break}n=!0;}else if(n){DC(c,e.Diagnostics.A_required_element_cannot_follow_an_optional_element);break}}e.forEach(t.elements,VS),kd(t);}(t);case 187:case 188:return function(t){e.forEach(t.types,VS),kd(t);}(t);case 191:case 185:case 186:return VS(t.type);case 192:return function(e){Sd(e);}(t);case 193:return function(t){!function(t){if(154===t.operator){if(151!==t.type.kind)return DC(t.type,e.Diagnostics._0_expected,e.tokenToString(151));var r=e.walkUpParenthesizedTypes(t.parent);if(e.isInJSFile(r)&&e.isJSDocTypeExpression(r)){var n=e.getJSDocHost(r);n&&(r=e.getSingleVariableOfVariableStatement(n)||n);}switch(r.kind){case 254:var i=r;if(79!==i.name.kind)return DC(t,e.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);if(!e.isVariableDeclarationInVariableStatement(i))return DC(t,e.Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement);if(!(2&i.parent.flags))return DC(r.name,e.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);break;case 167:if(!e.isStatic(r)||!e.hasEffectiveReadonlyModifier(r))return DC(r.name,e.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);break;case 166:if(!e.hasSyntacticModifier(r,64))return DC(r.name,e.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);break;default:DC(t,e.Diagnostics.unique_symbol_types_are_not_allowed_here);}}else 145===t.operator&&183!==t.type.kind&&184!==t.type.kind&&bC(t,e.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types,e.tokenToString(151));}(t),VS(t.type);}(t);case 189:return function(t){e.forEachChild(t,VS);}(t);case 190:return function(t){e.findAncestor(t,(function(e){return e.parent&&189===e.parent.kind&&e.parent.extendsType===e}))||DC(t,e.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type),VS(t.typeParameter);var r=la(t.typeParameter);if(r.declarations&&r.declarations.length>1){var n=ri(r);if(!n.typeParametersChecked){n.typeParametersChecked=!0;var i=ks(r),a=e.getDeclarationsOfKind(r,163);if(!hS(a,[i],(function(e){return [e]})))for(var o=Ua(r),s=0,c=a;s<c.length;s++)Jn(c[s].name,e.Diagnostics.All_declarations_of_0_must_have_identical_constraints,o);}}lD(t);}(t);case 198:return function(e){for(var t=0,r=e.templateSpans;t<r.length;t++){var n=r[t];VS(n.type),gp(kd(n.type),yt,n.type);}kd(e);}(t);case 200:return function(t){VS(t.argument),t.assertions&&e.getResolutionModeOverrideForClause(t.assertions.assertClause,DC)&&(e.isNightly()||DC(t.assertions.assertClause,e.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next),e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.Node16&&e.getEmitModuleResolutionKind(V)!==e.ModuleResolutionKind.NodeNext&&DC(t.assertions.assertClause,e.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)),kd(t);}(t);case 197:return function(t){t.dotDotDotToken&&t.questionToken&&DC(t,e.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest),185===t.type.kind&&DC(t.type,e.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type),186===t.type.kind&&DC(t.type,e.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type),VS(t.type),kd(t);}(t);case 328:return function(t){var r=e.getEffectiveJSDocHost(t);if(r&&(e.isClassDeclaration(r)||e.isClassExpression(r))){var n=e.getJSDocTags(r).filter(e.isJSDocAugmentsTag);e.Debug.assert(n.length>0),n.length>1&&Jn(n[1],e.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);var i=sD(t.class.expression),a=e.getClassExtendsHeritageElement(r);if(a){var o=sD(a.expression);o&&i.escapedText!==o.escapedText&&Jn(i,e.Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause,e.idText(t.tagName),e.idText(i),e.idText(o));}}else Jn(r,e.Diagnostics.JSDoc_0_is_not_attached_to_a_class,e.idText(t.tagName));}(t);case 329:return function(t){var r=e.getEffectiveJSDocHost(t);r&&(e.isClassDeclaration(r)||e.isClassExpression(r))||Jn(r,e.Diagnostics.JSDoc_0_is_not_attached_to_a_class,e.idText(t.tagName));}(t);case 345:case 338:case 339:return function(t){t.typeExpression||Jn(t.name,e.Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags),t.name&&mS(t.name,e.Diagnostics.Type_alias_name_cannot_be_0),VS(t.typeExpression),yS(e.getEffectiveTypeParameterDeclarations(t));}(t);case 344:return function(e){VS(e.constraint);for(var t=0,r=e.typeParameters;t<r.length;t++)VS(r[t]);}(t);case 343:case 340:case 347:return function(e){VS(e.typeExpression);}(t);case 317:!function(t){m((function(){t.type||e.isJSDocConstructSignature(t)||ag(t,Le);})),Ax(t);}(t);case 315:case 314:case 312:case 313:case 322:return qS(t),void e.forEachChild(t,VS);case 318:return void function(t){qS(t),VS(t.type);var r=t.parent;if(e.isParameter(r)&&e.isJSDocFunctionType(r.parent))e.last(r.parent.parameters)!==r&&Jn(t,e.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);else {e.isJSDocTypeExpression(r)||Jn(t,e.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);var n=t.parent.parent;if(e.isJSDocParameterTag(n)){var i=e.getParameterSymbolFromJSDoc(n);if(i){var a=e.getHostSignatureFromJSDoc(n);a&&e.last(a.parameters).symbol===i||Jn(t,e.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);}}else Jn(t,e.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);}}(t);case 309:return VS(t.type);case 333:case 335:case 334:return function(t){var r=e.getJSDocHost(t);r&&e.isPrivateIdentifierClassElementDeclaration(r)&&Jn(t,e.Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);}(t);case 194:return function(e){VS(e.objectType),VS(e.indexType),zx(q_(e),e);}(t);case 195:return function(t){!function(t){var r;(null===(r=t.members)||void 0===r?void 0:r.length)&&DC(t.members[0],e.Diagnostics.A_mapped_type_may_not_declare_properties_or_methods);}(t),VS(t.typeParameter),VS(t.nameType),VS(t.type),t.type||ag(t,Le);var r=W_(t),n=gc(r);n?gp(n,gt,t.nameType):gp(fc(r),gt,e.getEffectiveConstraintOfTypeParameter(t.typeParameter));}(t);case 256:return function(e){m((function(){cD(e),oC(e),FD(e,e.name);}));}(t);case 235:case 262:return SD(t);case 237:return MD(t);case 238:return function(e){TC(e),kx(e.expression);}(t);case 239:return function(t){TC(t),BD(t.expression),LD(t.expression,t.thenStatement),VS(t.thenStatement),236===t.thenStatement.kind&&Jn(t.thenStatement,e.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement),VS(t.elseStatement);}(t);case 240:return function(e){TC(e),VS(e.statement),BD(e.expression);}(t);case 241:return function(e){TC(e),BD(e.expression),VS(e.statement);}(t);case 242:return function(t){TC(t)||t.initializer&&255===t.initializer.kind&&yC(t.initializer),t.initializer&&(255===t.initializer.kind?e.forEach(t.initializer.declarations,OD):kx(t.initializer)),t.condition&&BD(t.condition),t.incrementor&&kx(t.incrementor),VS(t.statement),t.locals&&lD(t);}(t);case 243:return function(t){lC(t);var r,n=Cv(kx(t.expression));if(255===t.initializer.kind){var i=t.initializer.declarations[0];i&&e.isBindingPattern(i.name)&&Jn(i.name,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern),jD(t);}else {var a=t.initializer,o=kx(a);204===a.kind||205===a.kind?Jn(a,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern):_p(131072&(r=S_(D_(n))).flags?Ye:r,o)?Vb(a,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access):Jn(a,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);}n!==st&&Gb(n,126091264)||Jn(t.expression,e.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0,qa(n)),VS(t.statement),t.locals&&lD(t);}(t);case 244:return function(t){lC(t);var r=e.getContainingFunctionOrClassStaticBlock(t);if(t.awaitModifier?r&&e.isClassStaticBlockDeclaration(r)?DC(t.awaitModifier,e.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block):2==(6&e.getFunctionFlags(r))&&q<99&&GT(t,16384):V.downlevelIteration&&q<2&&GT(t,256),255===t.initializer.kind)jD(t);else {var n=t.initializer,i=JD(t);if(204===n.kind||205===n.kind)ex(n,i||je);else {var a=kx(n);Vb(n,e.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access,e.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access),i&&mp(i,a,n,t.expression);}}VS(t.statement),t.locals&&lD(t);}(t);case 245:case 246:return function(t){TC(t)||function(t){for(var r=t;r;){if(e.isFunctionLikeOrClassStaticBlockDeclaration(r))return DC(t,e.Diagnostics.Jump_target_cannot_cross_function_boundary);switch(r.kind){case 250:if(t.label&&r.label.escapedText===t.label.escapedText)return !(245!==t.kind||e.isIterationStatement(r.statement,!0))&&DC(t,e.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);break;case 249:if(246===t.kind&&!t.label)return !1;break;default:if(e.isIterationStatement(r,!1)&&!t.label)return !1}r=r.parent;}t.label?DC(t,246===t.kind?e.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement:e.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement):DC(t,246===t.kind?e.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement:e.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement);}(t);}(t);case 247:return function(t){var r;if(!TC(t)){var n=e.getContainingFunctionOrClassStaticBlock(t);if(n&&e.isClassStaticBlockDeclaration(n))bC(t,e.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block);else if(n){var i=Nl(bl(n)),a=e.getFunctionFlags(n);if(Q||t.expression||131072&i.flags){var o=t.expression?cx(t.expression):qe;if(173===n.kind)t.expression&&Jn(t,e.Diagnostics.Setters_cannot_return_a_value);else if(171===n.kind)t.expression&&!mp(o,i,t,t.expression)&&Jn(t,e.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);else if(Fl(n)){var s=null!==(r=_S(i,a))&&void 0!==r?r:i,c=2&a?Gx(o,!1,t,e.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member):o;s&&mp(c,s,t,t.expression);}}else 171!==n.kind&&V.noImplicitReturns&&!dS(n,i)&&Jn(t,e.Diagnostics.Not_all_code_paths_return_a_value);}else bC(t,e.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body);}}(t);case 248:return function(t){TC(t)||32768&t.flags&&bC(t,e.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block),kx(t.expression);var r=e.getSourceFileOfNode(t);if(!hC(r)){var n=e.getSpanOfTokenAtPosition(r,t.pos).start;xC(r,n,t.statement.pos-n,e.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any);}}(t);case 249:return function(t){var r;TC(t);var n=!1,i=kx(t.expression),a=Df(i);e.forEach(t.caseBlock.clauses,(function(t){290!==t.kind||n||(void 0===r?r=t:(DC(t,e.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement),n=!0)),289===t.kind&&m(function(e){return function(){var t=kx(e.expression),r=Df(t),n=i;r&&a||(t=r?Sf(t):t,n=Sf(i)),rx(n,t)||Cp(t,n,e.expression,void 0);}}(t)),e.forEach(t.statements,VS),V.noFallthroughCasesInSwitch&&t.fallthroughFlowNode&&qm(t.fallthroughFlowNode)&&Jn(t,e.Diagnostics.Fallthrough_case_in_switch);})),t.caseBlock.locals&&lD(t.caseBlock);}(t);case 250:return function(t){TC(t)||e.findAncestor(t.parent,(function(r){return e.isFunctionLike(r)?"quit":250===r.kind&&r.label.escapedText===t.label.escapedText&&(DC(t.label,e.Diagnostics.Duplicate_label_0,e.getTextOfNode(t.label)),!0)})),VS(t.statement);}(t);case 251:return function(t){TC(t)||e.isIdentifier(t.expression)&&!t.expression.escapedText&&function(t,r,n,i,a){var o=e.getSourceFileOfNode(t);if(!hC(o)){var s=e.getSpanOfTokenAtPosition(o,t.pos);Sn.add(e.createFileDiagnostic(o,e.textSpanEnd(s),0,r,void 0,void 0,void 0));}}(t,e.Diagnostics.Line_break_not_permitted_here),t.expression&&kx(t.expression);}(t);case 252:return function(t){TC(t),SD(t.tryBlock);var r=t.catchClause;if(r){if(r.variableDeclaration){var n=r.variableDeclaration,i=e.getEffectiveTypeAnnotationNode(e.getRootDeclaration(n));if(i){var a=ko(n,!1,0);!a||3&a.flags||bC(i,e.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);}else if(n.initializer)bC(n.initializer,e.Diagnostics.Catch_clause_variable_cannot_have_an_initializer);else {var o=r.block.locals;o&&e.forEachKey(r.locals,(function(t){var r=o.get(t);(null==r?void 0:r.valueDeclaration)&&0!=(2&r.flags)&&DC(r.valueDeclaration,e.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause,t);}));}}SD(r.block);}t.finallyBlock&&SD(t.finallyBlock);}(t);case 254:return OD(t);case 203:return function(t){return function(t){if(t.dotDotDotToken){var r=t.parent.elements;if(t!==e.last(r))return DC(t,e.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);if($T(r,e.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma),t.propertyName)return DC(t.name,e.Diagnostics.A_rest_element_cannot_have_a_property_name)}t.dotDotDotToken&&t.initializer&&xC(t,t.initializer.pos-1,1,e.Diagnostics.A_rest_element_cannot_have_an_initializer);}(t),PD(t)}(t);case 257:return function(t){e.some(t.decorators)&&e.some(t.members,(function(t){return e.hasStaticModifier(t)&&e.isPrivateIdentifierClassElementDeclaration(t)}))&&DC(t.decorators[0],e.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator),t.name||e.hasSyntacticModifier(t,512)||bC(t,e.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name),bS(t),e.forEach(t.members,VS),lD(t);}(t);case 258:return function(t){XT(t)||function(t){var r=!1;if(t.heritageClauses)for(var n=0,i=t.heritageClauses;n<i.length;n++){var a=i[n];if(94!==a.token)return e.Debug.assert(117===a.token),bC(a,e.Diagnostics.Interface_declaration_cannot_have_implements_clause);if(r)return bC(a,e.Diagnostics.extends_clause_already_seen);r=!0,nC(a);}}(t),yS(t.typeParameters),m((function(){mS(t.name,e.Diagnostics.Interface_name_cannot_be_0),qx(t);var r=la(t);vS(r);var n=e.getDeclarationOfKind(r,258);if(t===n){var i=Es(r),a=Hs(i);if(function(t,r){var n=gs(t);if(n.length<2)return !0;var i=new e.Map;e.forEach(Ls(t).declaredProperties,(function(e){i.set(e.escapedName,{prop:e,containingType:t});}));for(var a=!0,o=0,s=n;o<s.length;o++)for(var c=s[o],l=0,u=Nc(Hs(c,t.thisType));l<u.length;l++){var _=u[l],d=i.get(_.escapedName);if(d){if(d.containingType!==t&&0===af(d.prop,_,sp)){a=!1;var p=qa(d.containingType),f=qa(c),g=e.chainDiagnosticMessages(void 0,e.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical,Ua(_),p,f);g=e.chainDiagnosticMessages(g,e.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2,qa(t),p,f),Sn.add(e.createDiagnosticForNodeFromMessageChain(r,g));}}else i.set(_.escapedName,{prop:_,containingType:c});}return a}(i,t.name)){for(var o=0,s=gs(i);o<s.length;o++)gp(a,Hs(s[o],i.thisType),t.name,e.Diagnostics.Interface_0_incorrectly_extends_interface_1);pS(i,r);}}Px(t);})),e.forEach(e.getInterfaceBaseTypeNodes(t),(function(t){e.isEntityNameExpression(t.expression)&&!e.isOptionalChain(t.expression)||Jn(t.expression,e.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments),Jx(t);})),e.forEach(t.members,VS),m((function(){wx(t),lD(t);}));}(t);case 259:return function(t){XT(t),mS(t.name,e.Diagnostics.Type_alias_name_cannot_be_0),qx(t),yS(t.typeParameters),138===t.type.kind?P.has(t.name.escapedText)&&1===e.length(t.typeParameters)||Jn(t.type,e.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types):(VS(t.type),lD(t));}(t);case 260:return function(t){m((function(){return function(t){XT(t),FD(t,t.name),qx(t),t.members.forEach(AS),ES(t);var r=la(t);if(t===e.getDeclarationOfKind(r,t.kind)){if(r.declarations&&r.declarations.length>1){var n=e.isEnumConst(t);e.forEach(r.declarations,(function(t){e.isEnumDeclaration(t)&&e.isEnumConst(t)!==n&&Jn(e.getNameOfDeclaration(t),e.Diagnostics.Enum_declarations_must_all_be_const_or_non_const);}));}var i=!1;e.forEach(r.declarations,(function(t){if(260!==t.kind)return !1;var r=t;if(!r.members.length)return !1;var n=r.members[0];n.initializer||(i?Jn(n.name,e.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element):i=!0);}));}}(t)}));}(t);case 261:return function(t){t.body&&(VS(t.body),e.isGlobalScopeAugmentation(t)||lD(t)),m((function(){var r=e.isGlobalScopeAugmentation(t),n=16777216&t.flags;r&&!n&&Jn(t.name,e.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);var i=e.isAmbientModule(t),a=i?e.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file:e.Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module;if(!BS(t,a)){XT(t)||n||10!==t.name.kind||DC(t.name,e.Diagnostics.Only_ambient_modules_can_use_quoted_names),e.isIdentifier(t.name)&&FD(t,t.name),qx(t);var o,s,c,l,u=la(t);if(512&u.flags&&!n&&u.declarations&&u.declarations.length>1&&L(t,e.shouldPreserveConstEnums(V))){var _=function(t){var r=t.declarations;if(r)for(var n=0,i=r;n<i.length;n++){var a=i[n];if((257===a.kind||256===a.kind&&e.nodeIsPresent(a.body))&&!(16777216&a.flags))return a}}(u);_&&(e.getSourceFileOfNode(t)!==e.getSourceFileOfNode(_)?Jn(t.name,e.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged):t.pos<_.pos&&Jn(t.name,e.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged));var d=e.getDeclarationOfKind(u,257);d&&(o=t,s=d,c=e.getEnclosingBlockScopeContainer(o),l=e.getEnclosingBlockScopeContainer(s),ii(c)?ii(l):!ii(l)&&c===l)&&(ni(t).flags|=32768);}if(i)if(e.isExternalModuleAugmentation(t)){if((r||33554432&la(t).flags)&&t.body)for(var p=0,f=t.body.statements;p<f.length;p++)PS(f[p],r);}else ii(t.parent)?r?Jn(t.name,e.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations):e.isExternalModuleNameRelative(e.getTextOfIdentifierOrLiteral(t.name))&&Jn(t.name,e.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name):Jn(t.name,r?e.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations:e.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);}}));}(t);case 266:return function(t){if(!BS(t,e.isInJSFile(t)?e.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module:e.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)){if(!XT(t)&&e.hasEffectiveModifiers(t)&&bC(t,e.Diagnostics.An_import_declaration_cannot_have_modifiers),wS(t)){var r=t.importClause;r&&!function(t){var r;return t.isTypeOnly&&t.name&&t.namedBindings?DC(t,e.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both):!(!t.isTypeOnly||269!==(null===(r=t.namedBindings)||void 0===r?void 0:r.kind))&&kC(t.namedBindings)}(r)&&(r.name&&LS(r),r.namedBindings&&(268===r.namedBindings.kind?(LS(r.namedBindings),W!==e.ModuleKind.System&&(W<e.ModuleKind.ES2015||e.getSourceFileOfNode(t).impliedNodeFormat===e.ModuleKind.CommonJS)&&e.getESModuleInterop(V)&&GT(t,65536)):Hi(t,t.moduleSpecifier)&&e.forEach(r.namedBindings.elements,LS)));}RS(t);}}(t);case 265:return function(t){if(!BS(t,e.isInJSFile(t)?e.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module:e.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)&&(XT(t),e.isInternalModuleImportEqualsDeclaration(t)||wS(t)))if(LS(t),e.hasSyntacticModifier(t,1)&&zi(t),277!==t.moduleReference.kind){var r=Ri(la(t));if(r!==we){if(111551&r.flags){var n=e.getFirstIdentifier(t.moduleReference);1920&qi(n,112575).flags||Jn(n,e.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name,e.declarationNameToString(n));}788968&r.flags&&mS(t.name,e.Diagnostics.Import_name_cannot_be_0);}t.isTypeOnly&&DC(t,e.Diagnostics.An_import_alias_cannot_use_import_type);}else !(W>=e.ModuleKind.ES2015&&void 0===e.getSourceFileOfNode(t).impliedNodeFormat)||t.isTypeOnly||16777216&t.flags||DC(t,e.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);}(t);case 272:return function(t){if(!BS(t,e.isInJSFile(t)?e.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module:e.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)){if(!XT(t)&&e.hasSyntacticModifiers(t)&&bC(t,e.Diagnostics.An_export_declaration_cannot_have_modifiers),t.moduleSpecifier&&t.exportClause&&e.isNamedExports(t.exportClause)&&e.length(t.exportClause.elements)&&0===q&&GT(t,4194304),function(t){var r;t.isTypeOnly&&(273===(null===(r=t.exportClause)||void 0===r?void 0:r.kind)?kC(t.exportClause):DC(t,e.Diagnostics.Only_named_exports_may_use_export_type));}(t),!t.moduleSpecifier||wS(t))if(t.exportClause&&!e.isNamespaceExport(t.exportClause)){e.forEach(t.exportClause.elements,zS);var r=262===t.parent.kind&&e.isAmbientModule(t.parent.parent),n=!r&&262===t.parent.kind&&!t.moduleSpecifier&&16777216&t.flags;305===t.parent.kind||r||n||Jn(t,e.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);}else {var i=Hi(t,t.moduleSpecifier);i&&ea(i)?Jn(t.moduleSpecifier,e.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk,Ua(i)):t.exportClause&&IS(t.exportClause),W!==e.ModuleKind.System&&(W<e.ModuleKind.ES2015||e.getSourceFileOfNode(t).impliedNodeFormat===e.ModuleKind.CommonJS)&&(t.exportClause?e.getESModuleInterop(V)&&GT(t,65536):GT(t,32768));}RS(t);}}(t);case 271:return function(t){if(!BS(t,t.isExportEquals?e.Diagnostics.An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration:e.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration)){var r=305===t.parent.kind?t.parent:t.parent.parent;if(261!==r.kind||e.isAmbientModule(r)){!XT(t)&&e.hasEffectiveModifiers(t)&&bC(t,e.Diagnostics.An_export_assignment_cannot_have_modifiers);var n=e.getEffectiveTypeAnnotationNode(t);if(n&&gp(cx(t.expression),kd(n),t.expression),79===t.expression.kind){var i=t.expression,a=qi(i,67108863,!0,!0,t);if(a){ay(a,i);var o=2097152&a.flags?Ri(a):a;(o===we||111551&o.flags)&&cx(t.expression);}else cx(t.expression);e.getEmitDeclarations(V)&&io(t.expression,!0);}else cx(t.expression);KS(r),16777216&t.flags&&!e.isEntityNameExpression(t.expression)&&DC(t.expression,e.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context),!t.isExportEquals||16777216&t.flags||(W>=e.ModuleKind.ES2015&&e.getSourceFileOfNode(t).impliedNodeFormat!==e.ModuleKind.CommonJS?DC(t,e.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead):W===e.ModuleKind.System&&DC(t,e.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system));}else t.isExportEquals?Jn(t,e.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace):Jn(t,e.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);}}(t);case 236:case 253:return void TC(t);case 276:!function(e){oD(e);}(t);}}(t),u=n;}}function qS(t){e.isInJSFile(t)||DC(t,e.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);}function WS(t){var r=ni(e.getSourceFileOfNode(t));1&r.flags||(r.deferredNodes||(r.deferredNodes=new e.Set),r.deferredNodes.add(t));}function HS(t){null===e.tracing||void 0===e.tracing||e.tracing.push("check","checkDeferredNode",{kind:t.kind,pos:t.pos,end:t.end,path:t.tracingPath});var r=u;switch(u=t,k=0,t.kind){case 208:case 209:case 210:case 165:case 280:oh(t);break;case 213:case 214:case 169:case 168:!function(t){e.Debug.assert(169!==t.kind||e.isObjectLiteralMethod(t));var r=e.getFunctionFlags(t),n=Fl(t);if(Bb(t,n),t.body)if(e.getEffectiveReturnTypeNode(t)||Nl(bl(t)),235===t.body.kind)VS(t.body);else {var i=kx(t.body),a=n&&_S(n,r);a&&mp(2==(3&r)?Gx(i,!1,t.body,e.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member):i,a,t.body,t.body);}}(t);break;case 172:case 173:Lx(t);break;case 226:!function(t){e.forEach(t.members,VS),lD(t);}(t);break;case 163:!function(t){if(e.isInterfaceDeclaration(t.parent)||e.isClassLike(t.parent)||e.isTypeAliasDeclaration(t.parent)){var r=ks(la(t)),n=Gp(r);if(n){var i=la(t.parent);if(!e.isTypeAliasDeclaration(t.parent)||48&e.getObjectFlags(Es(i))){if(32768===n||65536===n){var a=Wp(i,r,65536===n?It:wt),o=Wp(i,r,65536===n?wt:It),s=r;_=r,gp(a,o,t,e.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation),_=s;}}else Jn(t,e.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);}}}(t);break;case 279:!function(e){gv(e);}(t);break;case 278:!function(e){gv(e.openingElement),$y(e.closingElement.tagName)?iv(e.closingElement):kx(e.closingElement.tagName),tv(e);}(t);}u=r,null===e.tracing||void 0===e.tracing||e.tracing.pop();}function GS(t,r){if(r)return !1;switch(t){case 0:return !!V.noUnusedLocals;case 1:return !!V.noUnusedParameters;default:return e.Debug.assertNever(t)}}function QS(t){return Hr.get(t.path)||e.emptyArray}function XS(n,i){try{return r=i,function(r){if(r){YS();var n=Sn.getGlobalDiagnostics(),i=n.length;ZS(r);var a=Sn.getDiagnostics(r.fileName),o=Sn.getGlobalDiagnostics();if(o!==n){var s=e.relativeComplement(n,o,e.compareDiagnostics);return e.concatenate(s,a)}return 0===i&&o.length>0?e.concatenate(o,a):a}return e.forEach(t.getSourceFiles(),ZS),Sn.getDiagnostics()}(n)}finally{r=void 0;}}function YS(){for(var e=0,t=g;e<t.length;e++)(0, t[e])();g=[];}function ZS(r){YS();var n,i=m;m=function(e){return e()},n=r,null===e.tracing||void 0===e.tracing||e.tracing.push("check","checkSourceFile",{path:n.path},!0),e.performance.mark("beforeCheck"),function(r){var n=ni(r);if(!(1&n.flags)){if(e.skipTypeChecking(r,V,t))return;!function(t){16777216&t.flags&&function(t){for(var r=0,n=t.statements;r<n.length;r++){var i=n[r];if((e.isDeclaration(i)||237===i.kind)&&SC(i))return !0}}(t);}(r),e.clear(vn),e.clear(hn),e.clear(bn),e.clear(xn),e.forEach(r.statements,VS),VS(r.endOfFileToken),function(e){var t=ni(e);t.deferredNodes&&t.deferredNodes.forEach(HS);}(r),e.isExternalOrCommonJsModule(r)&&lD(r),m((function(){r.isDeclarationFile||!V.noUnusedLocals&&!V.noUnusedParameters||uD(QS(r),(function(t,r,n){!e.containsParseError(t)&&GS(r,!!(16777216&t.flags))&&Sn.add(n);}));})),2===V.importsNotUsedAsValues&&!r.isDeclarationFile&&e.isExternalModule(r)&&function(t){for(var r=0,n=t.statements;r<n.length;r++){var i=n[r];(jS(i)||JS(i))&&Jn(i,e.Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error);}}(r),e.isExternalOrCommonJsModule(r)&&KS(r),vn.length&&(e.forEach(vn,CD),e.clear(vn)),hn.length&&(e.forEach(hn,kD),e.clear(hn)),bn.length&&(e.forEach(bn,ED),e.clear(bn)),xn.length&&(e.forEach(xn,ND),e.clear(xn)),n.flags|=1;}}(n),e.performance.mark("afterCheck"),e.performance.measure("Check","beforeCheck","afterCheck"),null===e.tracing||void 0===e.tracing||e.tracing.pop(),m=i;}function $S(e){switch(e.kind){case 163:case 257:case 258:case 259:case 260:case 345:case 338:case 339:return !0;case 267:return e.isTypeOnly;case 270:case 275:return e.parent.parent.isTypeOnly;default:return !1}}function eT(e){for(;161===e.parent.kind;)e=e.parent;return 178===e.parent.kind}function tT(t,r){for(var n;(t=e.getContainingClass(t))&&!(n=r(t)););return n}function rT(e,t){return !!tT(e,(function(e){return e===t}))}function nT(e){return void 0!==function(e){for(;161===e.parent.kind;)e=e.parent;return 265===e.parent.kind?e.parent.moduleReference===e?e.parent:void 0:271===e.parent.kind&&e.parent.expression===e?e.parent:void 0}(e)}function iT(t){if(e.isDeclarationName(t))return la(t.parent);if(e.isInJSFile(t)&&206===t.parent.kind&&t.parent===t.parent.parent.left&&!e.isPrivateIdentifier(t)&&!e.isJSDocMemberName(t)){var r=function(t){switch(e.getAssignmentDeclarationKind(t.parent.parent)){case 1:case 3:return la(t.parent);case 4:case 2:case 5:return la(t.parent.parent)}}(t);if(r)return r}if(271===t.parent.kind&&e.isEntityNameExpression(t)){var n=qi(t,2998271,!0);if(n&&n!==we)return n}else if(e.isEntityName(t)&&nT(t)){var i=e.getAncestor(t,265);return e.Debug.assert(void 0!==i),Ui(t,!0)}if(e.isEntityName(t)){var a=function(t){for(var r=t.parent;e.isQualifiedName(r);)t=r,r=r.parent;if(r&&200===r.kind&&r.qualifier===t)return r}(t);if(a){kd(a);var o=ni(t).resolvedSymbol;return o===we?void 0:o}}for(;e.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(t);)t=t.parent;if(function(e){for(;206===e.parent.kind;)e=e.parent;return 228===e.parent.kind}(t)){var s=0;228===t.parent.kind?(s=788968,e.isExpressionWithTypeArgumentsInClassExtendsClause(t.parent)&&(s|=111551)):s=1920,s|=2097152;var c=e.isEntityNameExpression(t)?qi(t,s):void 0;if(c)return c}if(340===t.parent.kind)return e.getParameterSymbolFromJSDoc(t.parent);if(163===t.parent.kind&&344===t.parent.parent.kind){e.Debug.assert(!e.isInJSFile(t));var l=e.getTypeParameterFromJsDoc(t.parent);return l&&l.symbol}if(e.isExpressionNode(t)){if(e.nodeIsMissing(t))return;var u=e.findAncestor(t,e.or(e.isJSDocLinkLike,e.isJSDocNameReference,e.isJSDocMemberName));if(s=u?901119:111551,79===t.kind){if(e.isJSXTagName(t)&&$y(t))return (f=iv(t.parent))===we?void 0:f;var _=qi(t,s,!1,!0,e.getHostSignatureFromJSDoc(t));if(!_&&u){var d=e.findAncestor(t,e.or(e.isClassLike,e.isInterfaceDeclaration));if(d)return aT(t,la(d))}return _}if(e.isPrivateIdentifier(t))return Mv(t);if(206===t.kind||161===t.kind){var p=ni(t);return p.resolvedSymbol?p.resolvedSymbol:(206===t.kind?Pv(t,0):wv(t,0),!p.resolvedSymbol&&u&&e.isQualifiedName(t)?aT(t):p.resolvedSymbol)}if(e.isJSDocMemberName(t))return aT(t)}else if(eT(t)){var f;return (f=qi(t,s=178===t.parent.kind?788968:1920,!1,!0))&&f!==we?f:ou(t)}return 177===t.parent.kind?qi(t,1):void 0}function aT(t,r){if(e.isEntityName(t)){var n=901119,i=qi(t,n,!1,!0,e.getHostSignatureFromJSDoc(t));if(!i&&e.isIdentifier(t)&&r&&(i=ca(ai(ia(r),t.escapedText,n))),i)return i}var a=e.isIdentifier(t)?r:aT(t.left),o=e.isIdentifier(t)?t.escapedText:t.right.escapedText;if(a){var s=111551&a.flags&&Zc($o(a),"prototype");return Zc(s?$o(s):Es(a),o)}}function oT(t,r){if(305===t.kind)return e.isExternalModule(t)?ca(t.symbol):void 0;var n=t.parent,i=n.parent;if(!(33554432&t.flags)){if(B(t)){var a=la(n);return e.isImportOrExportSpecifier(t.parent)&&t.parent.propertyName===t?Xy(a):a}if(e.isLiteralComputedPropertyDeclarationName(t))return la(n.parent);if(79===t.kind){if(nT(t))return iT(t);if(203===n.kind&&201===i.kind&&t===n.propertyName){var o=Zc(sT(i),t.escapedText);if(o)return o}else if(e.isMetaProperty(n)&&n.name===t)return 103===n.keywordToken&&"target"===e.idText(t)?cb(n).symbol:100===n.keywordToken&&"meta"===e.idText(t)?ku().members.get("meta"):void 0}switch(t.kind){case 79:case 80:case 206:case 161:if(!e.isThisInTypeQuery(t))return iT(t);case 108:var s=e.getThisContainer(t,!1);if(e.isFunctionLike(s)){var c=bl(s);if(c.thisParameter)return c.thisParameter}if(e.isInExpressionContext(t))return kx(t).symbol;case 192:return Sd(t).symbol;case 106:return kx(t).symbol;case 134:var l=t.parent;return l&&171===l.kind?l.parent.symbol:void 0;case 10:case 14:if(e.isExternalModuleImportEqualsDeclaration(t.parent.parent)&&e.getExternalModuleImportEqualsDeclarationExpression(t.parent.parent)===t||(266===t.parent.kind||272===t.parent.kind)&&t.parent.moduleSpecifier===t||e.isInJSFile(t)&&e.isRequireCall(t.parent,!1)||e.isImportCall(t.parent)||e.isLiteralTypeNode(t.parent)&&e.isLiteralImportTypeNode(t.parent.parent)&&t.parent.parent.argument===t.parent)return Hi(t,t,r);if(e.isCallExpression(n)&&e.isBindableObjectDefinePropertyCall(n)&&n.arguments[1]===t)return la(n);case 8:var u=e.isElementAccessExpression(n)?n.argumentExpression===t?Sx(n.expression):void 0:e.isLiteralTypeNode(n)&&e.isIndexedAccessTypeNode(i)?kd(i.objectType):void 0;return u&&Zc(u,e.escapeLeadingUnderscores(t.text));case 88:case 98:case 38:case 84:return la(t.parent);case 200:return e.isLiteralImportTypeNode(t)?oT(t.argument.literal,r):void 0;case 93:return e.isExportAssignment(t.parent)?e.Debug.checkDefined(t.parent.symbol):void 0;case 100:case 103:return e.isMetaProperty(t.parent)?sb(t.parent).symbol:void 0;case 231:return kx(t).symbol;default:return}}}function sT(t){if(e.isSourceFile(t)&&!e.isExternalModule(t))return je;if(33554432&t.flags)return je;var r,n,i=e.tryGetClassImplementingOrExtendingExpressionWithTypeArguments(t),a=i&&vs(la(i.class));if(e.isPartOfTypeNode(t)){var o=kd(t);return a?Hs(o,a.thisType):o}if(e.isExpressionNode(t))return lT(t);if(a&&!i.isImplements){var s=e.firstOrUndefined(gs(a));return s?Hs(s,a.thisType):je}if($S(t))return Es(n=la(t));if(79===(r=t).kind&&$S(r.parent)&&e.getNameOfDeclaration(r.parent)===r)return (n=oT(t))?Es(n):je;if(e.isDeclaration(t))return (n=la(t))?$o(n):je;if(B(t))return (n=oT(t))?$o(n):je;if(e.isBindingPattern(t))return ko(t.parent,!0,0)||je;if(nT(t)&&(n=oT(t))){var c=Es(n);return po(c)?$o(n):c}return e.isMetaProperty(t.parent)&&t.parent.keywordToken===t.kind?sb(t.parent):je}function cT(t){if(e.Debug.assert(205===t.kind||204===t.kind),244===t.parent.kind)return ex(t,JD(t.parent)||je);if(221===t.parent.kind)return ex(t,Sx(t.parent.right)||je);if(296===t.parent.kind){var r=e.cast(t.parent.parent,e.isObjectLiteralExpression);return Zb(r,cT(r)||je,e.indexOfNode(r.properties,t.parent))}var n=e.cast(t.parent,e.isArrayLiteralExpression),i=cT(n)||je,a=zD(65,i,qe,t.parent)||je;return $b(n,i,n.elements.indexOf(t),a)}function lT(t){return e.isRightSideOfQualifiedNameOrPropertyAccess(t)&&(t=t.parent),md(Sx(t))}function uT(t){var r=la(t.parent);return e.isStatic(t)?$o(r):Es(r)}function _T(t){var r=t.name;switch(r.kind){case 79:return vd(e.idText(r));case 8:case 10:return vd(r.text);case 162:var n=Hy(r);return Gb(n,12288)?n:Ye;default:return e.Debug.fail("Unsupported property name.")}}function dT(t){t=Kc(t);var r=e.createSymbolTable(Nc(t)),n=el(t,0).length?Jt:el(t,1).length?zt:void 0;return n&&e.forEach(Nc(n),(function(e){r.has(e.escapedName)||r.set(e.escapedName,e);})),Ta(r)}function pT(t){return e.typeHasCallOrConstructSignatures(t,fe)}function fT(t){if(e.isGeneratedIdentifier(t))return !1;var r=e.getParseTreeNode(t,e.isIdentifier);if(!r)return !1;var n=r.parent;return !(!n||(e.isPropertyAccessExpression(n)||e.isPropertyAssignment(n))&&n.name===r||zT(r)!==de)}function gT(t){var r=Hi(t.parent,t);if(!r||e.isShorthandAmbientModuleSymbol(r))return !0;var n=ea(r),i=ri(r=Yi(r));return void 0===i.exportsSomeValue&&(i.exportsSomeValue=n?!!(111551&r.flags):e.forEachEntry(aa(r),(function(e){return (e=Li(e))&&!!(111551&e.flags)}))),i.exportsSomeValue}function mT(t,r){var n,i=e.getParseTreeNode(t,e.isIdentifier);if(i){var a=zT(i,function(t){return e.isModuleOrEnumDeclaration(t.parent)&&t===t.parent.name}(i));if(a){if(1048576&a.flags){var o=ca(a.exportSymbol);if(!r&&944&o.flags&&!(3&o.flags))return;a=o;}var s=ua(a);if(s){if(512&s.flags&&305===(null===(n=s.valueDeclaration)||void 0===n?void 0:n.kind)){var c=s.valueDeclaration;return c!==e.getSourceFileOfNode(i)?void 0:c}return e.findAncestor(i.parent,(function(t){return e.isModuleOrEnumDeclaration(t)&&la(t)===s}))}}}}function yT(t){if(t.generatedImportReference)return t.generatedImportReference;var r=e.getParseTreeNode(t,e.isIdentifier);if(r){var n=zT(r);if(Mi(n,111551)&&!Ji(n))return xi(n)}}function vT(t){if(418&t.flags&&t.valueDeclaration&&!e.isSourceFile(t.valueDeclaration)){var r=ri(t);if(void 0===r.isDeclarationWithCollidingName){var n=e.getEnclosingBlockScopeContainer(t.valueDeclaration);if(e.isStatementWithLocals(n)||function(t){return t.valueDeclaration&&e.isBindingElement(t.valueDeclaration)&&292===e.walkUpBindingElementsAndPatterns(t.valueDeclaration).parent.kind}(t)){var i=ni(t.valueDeclaration);if(li(n.parent,t.escapedName,111551,void 0,void 0,!1))r.isDeclarationWithCollidingName=!0;else if(262144&i.flags){var a=524288&i.flags,o=e.isIterationStatement(n,!1),s=235===n.kind&&e.isIterationStatement(n.parent,!1);r.isDeclarationWithCollidingName=!(e.isBlockScopedContainerTopLevel(n)||a&&(o||s));}else r.isDeclarationWithCollidingName=!1;}}return r.isDeclarationWithCollidingName}return !1}function hT(t){if(!e.isGeneratedIdentifier(t)){var r=e.getParseTreeNode(t,e.isIdentifier);if(r){var n=zT(r);if(n&&vT(n))return n.valueDeclaration}}}function bT(t){var r=e.getParseTreeNode(t,e.isDeclaration);if(r){var n=la(r);if(n)return vT(n)}return !1}function xT(t){switch(t.kind){case 265:return ST(la(t));case 267:case 268:case 270:case 275:var r=la(t);return !!r&&ST(r)&&!Ji(r);case 272:var n=t.exportClause;return !!n&&(e.isNamespaceExport(n)||e.some(n.elements,xT));case 271:return !t.expression||79!==t.expression.kind||ST(la(t))}return !1}function DT(t){var r=e.getParseTreeNode(t,e.isImportEqualsDeclaration);return !(void 0===r||305!==r.parent.kind||!e.isInternalModuleImportEqualsDeclaration(r))&&ST(la(r))&&r.moduleReference&&!e.nodeIsMissing(r.moduleReference)}function ST(t){if(!t)return !1;var r=ga(Ri(t));return r===we||!!(111551&r.flags)&&(e.shouldPreserveConstEnums(V)||!TT(r))}function TT(e){return Yb(e)||!!e.constEnumOnlyModule}function CT(t,r){if(Di(t)){var n=la(t),i=n&&ri(n);if(null==i?void 0:i.referenced)return !0;var a=ri(n).aliasTarget;if(a&&1&e.getEffectiveModifierFlags(t)&&111551&a.flags&&(e.shouldPreserveConstEnums(V)||!TT(a)))return !0}return !!r&&!!e.forEachChild(t,(function(e){return CT(e,r)}))}function kT(t){if(e.nodeIsPresent(t.body)){if(e.isGetAccessor(t)||e.isSetAccessor(t))return !1;var r=Sl(la(t));return r.length>1||1===r.length&&r[0].declaration!==t}return !1}function ET(t){return !(!Q||gl(t)||e.isJSDocParameterTag(t)||!t.initializer||e.hasSyntacticModifier(t,16476))}function NT(t){return Q&&gl(t)&&!t.initializer&&e.hasSyntacticModifier(t,16476)}function FT(t){var r=e.getParseTreeNode(t,e.isFunctionDeclaration);if(!r)return !1;var n=la(r);return !!(n&&16&n.flags)&&!!e.forEachEntry(ia(n),(function(t){return 111551&t.flags&&t.valueDeclaration&&e.isPropertyAccessExpression(t.valueDeclaration)}))}function AT(t){var r=e.getParseTreeNode(t,e.isFunctionDeclaration);if(!r)return e.emptyArray;var n=la(r);return n&&Nc($o(n))||e.emptyArray}function PT(e){var t,r=e.id||0;return r<0||r>=ln.length?0:(null===(t=ln[r])||void 0===t?void 0:t.flags)||0}function wT(e){return ES(e.parent),ni(e).enumMemberValue}function IT(e){switch(e.kind){case 299:case 206:case 207:return !0}return !1}function OT(t){if(299===t.kind)return wT(t);var r=ni(t).resolvedSymbol;if(r&&8&r.flags){var n=r.valueDeclaration;if(e.isEnumConst(n.parent))return wT(n)}}function MT(e){return !!(524288&e.flags)&&el(e,0).length>0}function LT(t,r){var n,i,a=e.getParseTreeNode(t,e.isEntityName);if(!a)return e.TypeReferenceSerializationKind.Unknown;if(r&&!(r=e.getParseTreeNode(r)))return e.TypeReferenceSerializationKind.Unknown;var o=!1;if(e.isQualifiedName(a)){var s=qi(e.getFirstIdentifier(a),111551,!0,!0,r);o=!!(null===(n=null==s?void 0:s.declarations)||void 0===n?void 0:n.every(e.isTypeOnlyImportOrExportDeclaration));}var c=qi(a,111551,!0,!0,r),l=c&&2097152&c.flags?Ri(c):c;o||(o=!!(null===(i=null==c?void 0:c.declarations)||void 0===i?void 0:i.every(e.isTypeOnlyImportOrExportDeclaration)));var u=qi(a,788968,!0,!1,r);if(l&&l===u){var _=wu(!1);if(_&&l===_)return e.TypeReferenceSerializationKind.Promise;var d=$o(l);if(d&&ls(d))return o?e.TypeReferenceSerializationKind.TypeWithCallSignature:e.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue}if(!u)return o?e.TypeReferenceSerializationKind.ObjectType:e.TypeReferenceSerializationKind.Unknown;var p=Es(u);return po(p)?o?e.TypeReferenceSerializationKind.ObjectType:e.TypeReferenceSerializationKind.Unknown:3&p.flags?e.TypeReferenceSerializationKind.ObjectType:Gb(p,245760)?e.TypeReferenceSerializationKind.VoidNullableOrNeverType:Gb(p,528)?e.TypeReferenceSerializationKind.BooleanType:Gb(p,296)?e.TypeReferenceSerializationKind.NumberLikeType:Gb(p,2112)?e.TypeReferenceSerializationKind.BigIntLikeType:Gb(p,402653316)?e.TypeReferenceSerializationKind.StringLikeType:Nf(p)?e.TypeReferenceSerializationKind.ArrayLikeType:Gb(p,12288)?e.TypeReferenceSerializationKind.ESSymbolType:MT(p)?e.TypeReferenceSerializationKind.TypeWithCallSignature:cf(p)?e.TypeReferenceSerializationKind.ArrayLikeType:e.TypeReferenceSerializationKind.ObjectType}function RT(t,r,n,i,a){var o=e.getParseTreeNode(t,e.isVariableLikeOrAccessor);if(!o)return e.factory.createToken(130);var s=la(o),c=!s||133120&s.flags?je:Tf($o(s));return 8192&c.flags&&c.symbol===s&&(n|=1048576),a&&(c=jf(c)),se.typeToTypeNode(c,r,1024|n,i)}function BT(t,r,n,i){var a=e.getParseTreeNode(t,e.isFunctionLike);if(!a)return e.factory.createToken(130);var o=bl(a);return se.typeToTypeNode(Nl(o),r,1024|n,i)}function jT(t,r,n,i){var a=e.getParseTreeNode(t,e.isExpression);if(!a)return e.factory.createToken(130);var o=rg(lT(a));return se.typeToTypeNode(o,r,1024|n,i)}function JT(t){return ce.has(e.escapeLeadingUnderscores(t))}function zT(t,r){var n=ni(t).resolvedSymbol;if(n)return n;var i=t;if(r){var a=t.parent;e.isDeclaration(a)&&t===a.name&&(i=lo(a));}return li(i,t.escapedText,3257279,void 0,void 0,!0)}function KT(t){if(!e.isGeneratedIdentifier(t)){var r=e.getParseTreeNode(t,e.isIdentifier);if(r){var n=zT(r);if(n)return ga(n).valueDeclaration}}}function UT(t){return !!(e.isDeclarationReadonly(t)||e.isVariableDeclaration(t)&&e.isVarConst(t))&&yd($o(la(t)))}function VT(t,r){return function(t,r,n){var i=1024&t.flags?se.symbolToExpression(t.symbol,111551,r,void 0,n):t===rt?e.factory.createTrue():t===et&&e.factory.createFalse();if(i)return i;var a=t.value;return "object"==typeof a?e.factory.createBigIntLiteral(a):"number"==typeof a?e.factory.createNumericLiteral(a):e.factory.createStringLiteral(a)}($o(la(t)),t,r)}function qT(t){return t?(Mn(t),e.getSourceFileOfNode(t).localJsxFactory||Fr):Fr}function WT(t){if(t){var r=e.getSourceFileOfNode(t);if(r){if(r.localJsxFragmentFactory)return r.localJsxFragmentFactory;var n=r.pragmas.get("jsxfrag"),i=e.isArray(n)?n[0]:n;if(i)return r.localJsxFragmentFactory=e.parseIsolatedEntityName(i.arguments.factory,q),r.localJsxFragmentFactory}}if(V.jsxFragmentFactory)return e.parseIsolatedEntityName(V.jsxFragmentFactory,q)}function HT(t){var r=261===t.kind?e.tryCast(t.name,e.isStringLiteral):e.getExternalModuleName(t),n=Gi(r,r,void 0);if(n)return e.getDeclarationOfKind(n,305)}function GT(t,r){if((a&r)!==r&&V.importHelpers){var n=e.getSourceFileOfNode(t);if(e.isEffectiveExternalModule(n,V)&&!(16777216&t.flags)){var i=(_=n,d=t,s||(s=Qi(_,e.externalHelpersModuleNameText,e.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found,d)||we),s);if(i!==we)for(var o=r&~a,c=1;c<=4194304;c<<=1)if(o&c){var l=QT(c),u=ai(i.exports,e.escapeLeadingUnderscores(l),111551);u?524288&c?e.some(Sl(u),(function(e){return vb(e)>3}))||Jn(t,e.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0,e.externalHelpersModuleNameText,l,4):1048576&c?e.some(Sl(u),(function(e){return vb(e)>4}))||Jn(t,e.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0,e.externalHelpersModuleNameText,l,5):1024&c&&(e.some(Sl(u),(function(e){return vb(e)>2}))||Jn(t,e.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0,e.externalHelpersModuleNameText,l,3)):Jn(t,e.Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0,e.externalHelpersModuleNameText,l);}a|=r;}}var _,d;}function QT(t){switch(t){case 1:return "__extends";case 2:return "__assign";case 4:return "__rest";case 8:return "__decorate";case 16:return "__metadata";case 32:return "__param";case 64:return "__awaiter";case 128:return "__generator";case 256:return "__values";case 512:return "__read";case 1024:return "__spreadArray";case 2048:return "__await";case 4096:return "__asyncGenerator";case 8192:return "__asyncDelegator";case 16384:return "__asyncValues";case 32768:return "__exportStar";case 65536:return "__importStar";case 131072:return "__importDefault";case 262144:return "__makeTemplateObject";case 524288:return "__classPrivateFieldGet";case 1048576:return "__classPrivateFieldSet";case 2097152:return "__classPrivateFieldIn";case 4194304:return "__createBinding";default:return e.Debug.fail("Unrecognized helper")}}function XT(t){return function(t){if(!t.decorators)return !1;if(!e.nodeCanBeDecorated(t,t.parent,t.parent.parent))return 169!==t.kind||e.nodeIsPresent(t.body)?bC(t,e.Diagnostics.Decorators_are_not_valid_here):bC(t,e.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);if(172===t.kind||173===t.kind){var r=e.getAllAccessorDeclarations(t.parent.members,t);if(r.firstAccessor.decorators&&t===r.secondAccessor)return bC(t,e.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name)}return !1}(t)||YT(t)}function YT(t){var r,n,i,a,o=function(t){return !!t.modifiers&&(function(t){switch(t.kind){case 172:case 173:case 171:case 167:case 166:case 169:case 168:case 176:case 261:case 266:case 265:case 272:case 271:case 213:case 214:case 164:case 163:return !1;default:if(262===t.parent.kind||305===t.parent.kind)return !1;switch(t.kind){case 256:return ZT(t,131);case 257:case 180:return ZT(t,126);case 258:case 237:case 259:case 170:return !0;case 260:return ZT(t,85);default:e.Debug.fail();}}}(t)?bC(t,e.Diagnostics.Modifiers_cannot_appear_here):void 0)}(t);if(void 0!==o)return o;for(var s=0,c=0,l=t.modifiers;c<l.length;c++){var u=l[c];if(145!==u.kind){if(166===t.kind||168===t.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_type_member,e.tokenToString(u.kind));if(176===t.kind&&(124!==u.kind||!e.isClassLike(t.parent)))return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_an_index_signature,e.tokenToString(u.kind))}if(101!==u.kind&&144!==u.kind&&163===t.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter,e.tokenToString(u.kind));switch(u.kind){case 85:if(260!==t.kind)return DC(t,e.Diagnostics.A_class_member_cannot_have_the_0_keyword,e.tokenToString(85));break;case 159:if(16384&s)return DC(u,e.Diagnostics._0_modifier_already_seen,"override");if(2&s)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"override","declare");if(64&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"override","readonly");if(256&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"override","async");s|=16384,a=u;break;case 123:case 122:case 121:var _=Za(e.modifierToFlag(u.kind));if(28&s)return DC(u,e.Diagnostics.Accessibility_modifier_already_seen);if(16384&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,_,"override");if(32&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,_,"static");if(64&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,_,"readonly");if(256&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,_,"async");if(262===t.parent.kind||305===t.parent.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element,_);if(128&s)return 121===u.kind?DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,_,"abstract"):DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,_,"abstract");if(e.isPrivateIdentifierClassElementDeclaration(t))return DC(u,e.Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);s|=e.modifierToFlag(u.kind);break;case 124:if(32&s)return DC(u,e.Diagnostics._0_modifier_already_seen,"static");if(64&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"static","readonly");if(256&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"static","async");if(262===t.parent.kind||305===t.parent.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element,"static");if(164===t.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"static");if(128&s)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"static","abstract");if(16384&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"static","override");s|=32,r=u;break;case 145:if(64&s)return DC(u,e.Diagnostics._0_modifier_already_seen,"readonly");if(167!==t.kind&&166!==t.kind&&176!==t.kind&&164!==t.kind)return DC(u,e.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);s|=64;break;case 93:if(1&s)return DC(u,e.Diagnostics._0_modifier_already_seen,"export");if(2&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"export","declare");if(128&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"export","abstract");if(256&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"export","async");if(e.isClassLike(t.parent))return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind,"export");if(164===t.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"export");s|=1;break;case 88:var d=305===t.parent.kind?t.parent:t.parent.parent;if(261===d.kind&&!e.isAmbientModule(d))return DC(u,e.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);if(!(1&s))return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"export","default");s|=512;break;case 135:if(2&s)return DC(u,e.Diagnostics._0_modifier_already_seen,"declare");if(256&s)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context,"async");if(16384&s)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context,"override");if(e.isClassLike(t.parent)&&!e.isPropertyDeclaration(t))return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind,"declare");if(164===t.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"declare");if(16777216&t.parent.flags&&262===t.parent.kind)return DC(u,e.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);if(e.isPrivateIdentifierClassElementDeclaration(t))return DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier,"declare");s|=2,n=u;break;case 126:if(128&s)return DC(u,e.Diagnostics._0_modifier_already_seen,"abstract");if(257!==t.kind&&180!==t.kind){if(169!==t.kind&&167!==t.kind&&172!==t.kind&&173!==t.kind)return DC(u,e.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);if(257!==t.parent.kind||!e.hasSyntacticModifier(t.parent,128))return DC(u,e.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);if(32&s)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"static","abstract");if(8&s)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"private","abstract");if(256&s&&i)return DC(i,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"async","abstract");if(16384&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"abstract","override")}if(e.isNamedDeclaration(t)&&80===t.name.kind)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier,"abstract");s|=128;break;case 131:if(256&s)return DC(u,e.Diagnostics._0_modifier_already_seen,"async");if(2&s||16777216&t.parent.flags)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context,"async");if(164===t.kind)return DC(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"async");if(128&s)return DC(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"async","abstract");s|=256,i=u;break;case 101:case 144:var p=101===u.kind?32768:65536,f=101===u.kind?"in":"out";if(163!==t.kind||!(e.isInterfaceDeclaration(t.parent)||e.isClassLike(t.parent)||e.isTypeAliasDeclaration(t.parent)))return DC(u,e.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias,f);if(s&p)return DC(u,e.Diagnostics._0_modifier_already_seen,f);if(32768&p&&65536&s)return DC(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"in","out");s|=p;}}return 171===t.kind?32&s?DC(r,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"static"):16384&s?DC(a,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"override"):!!(256&s)&&DC(i,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"async"):(266===t.kind||265===t.kind)&&2&s?DC(n,e.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration,"declare"):164===t.kind&&16476&s&&e.isBindingPattern(t.name)?DC(t,e.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern):164===t.kind&&16476&s&&t.dotDotDotToken?DC(t,e.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter):!!(256&s)&&function(t,r){switch(t.kind){case 169:case 256:case 213:case 214:return !1}return DC(r,e.Diagnostics._0_modifier_cannot_be_used_here,"async")}(t,i)}function ZT(e,t){return e.modifiers.length>1||e.modifiers[0].kind!==t}function $T(t,r){return void 0===r&&(r=e.Diagnostics.Trailing_comma_not_allowed),!(!t||!t.hasTrailingComma)&&xC(t[0],t.end-",".length,",".length,r)}function eC(t,r){if(t&&0===t.length){var n=t.pos-"<".length;return xC(r,n,e.skipTrivia(r.text,t.end)+">".length-n,e.Diagnostics.Type_parameter_list_cannot_be_empty)}return !1}function tC(t){var r=e.getSourceFileOfNode(t);return XT(t)||eC(t.typeParameters,r)||function(t){for(var r=!1,n=t.length,i=0;i<n;i++){var a=t[i];if(a.dotDotDotToken){if(i!==n-1)return DC(a.dotDotDotToken,e.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);if(16777216&a.flags||$T(t,e.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma),a.questionToken)return DC(a.questionToken,e.Diagnostics.A_rest_parameter_cannot_be_optional);if(a.initializer)return DC(a.name,e.Diagnostics.A_rest_parameter_cannot_have_an_initializer)}else if(gl(a)){if(r=!0,a.questionToken&&a.initializer)return DC(a.name,e.Diagnostics.Parameter_cannot_have_question_mark_and_initializer)}else if(r&&!a.initializer)return DC(a.name,e.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter)}}(t.parameters)||function(t,r){if(!e.isArrowFunction(t))return !1;t.typeParameters&&!(e.length(t.typeParameters)>1||t.typeParameters.hasTrailingComma||t.typeParameters[0].constraint)&&r&&e.fileExtensionIsOneOf(r.fileName,[".mts",".cts"])&&DC(t.typeParameters[0],e.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint);var n=t.equalsGreaterThanToken;return e.getLineAndCharacterOfPosition(r,n.pos).line!==e.getLineAndCharacterOfPosition(r,n.end).line&&DC(n,e.Diagnostics.Line_terminator_not_permitted_before_arrow)}(t,r)||e.isFunctionLikeDeclaration(t)&&function(t){if(q>=3){var r=t.body&&e.isBlock(t.body)&&e.findUseStrictPrologue(t.body.statements);if(r){var i=(o=t.parameters,e.filter(o,(function(t){return !!t.initializer||e.isBindingPattern(t.name)||e.isRestParameter(t)})));if(e.length(i)){e.forEach(i,(function(t){e.addRelatedInfo(Jn(t,e.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive),e.createDiagnosticForNode(r,e.Diagnostics.use_strict_directive_used_here));}));var a=i.map((function(t,r){return 0===r?e.createDiagnosticForNode(t,e.Diagnostics.Non_simple_parameter_declared_here):e.createDiagnosticForNode(t,e.Diagnostics.and_here)}));return e.addRelatedInfo.apply(void 0,n$4([Jn(r,e.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)],a,!1)),!0}}}var o;return !1}(t)}function rC(t,r){return $T(r)||function(t,r){if(r&&0===r.length){var n=e.getSourceFileOfNode(t),i=r.pos-"<".length;return xC(n,i,e.skipTrivia(n.text,r.end)+">".length-i,e.Diagnostics.Type_argument_list_cannot_be_empty)}return !1}(t,r)}function nC(t){var r=t.types;if($T(r))return !0;if(r&&0===r.length){var n=e.tokenToString(t.token);return xC(t,r.pos,0,e.Diagnostics._0_list_cannot_be_empty,n)}return e.some(r,iC)}function iC(t){return e.isExpressionWithTypeArguments(t)&&e.isImportKeyword(t.expression)&&t.typeArguments?DC(t,e.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments):rC(t,t.typeArguments)}function aC(t){if(162!==t.kind)return !1;var r=t;return 221===r.expression.kind&&27===r.expression.operatorToken.kind&&DC(r.expression,e.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name)}function oC(t){if(t.asteriskToken){if(e.Debug.assert(256===t.kind||213===t.kind||169===t.kind),16777216&t.flags)return DC(t.asteriskToken,e.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);if(!t.body)return DC(t.asteriskToken,e.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator)}}function sC(e,t){return !!e&&DC(e,t)}function cC(e,t){return !!e&&DC(e,t)}function lC(t){if(TC(t))return !0;if(244===t.kind&&t.awaitModifier&&!(32768&t.flags)){var r=e.getSourceFileOfNode(t);if(e.isInTopLevelContext(t)){if(!hC(r))switch(e.isEffectiveExternalModule(r,V)||Sn.add(e.createDiagnosticForNode(t.awaitModifier,e.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module)),W){case e.ModuleKind.Node16:case e.ModuleKind.NodeNext:if(r.impliedNodeFormat===e.ModuleKind.CommonJS){Sn.add(e.createDiagnosticForNode(t.awaitModifier,e.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));break}case e.ModuleKind.ES2022:case e.ModuleKind.ESNext:case e.ModuleKind.System:if(q>=4)break;default:Sn.add(e.createDiagnosticForNode(t.awaitModifier,e.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));}}else if(!hC(r)){var n=e.createDiagnosticForNode(t.awaitModifier,e.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules),i=e.getContainingFunction(t);if(i&&171!==i.kind){e.Debug.assert(0==(2&e.getFunctionFlags(i)),"Enclosing function should never be an async function.");var a=e.createDiagnosticForNode(i,e.Diagnostics.Did_you_mean_to_mark_this_function_as_async);e.addRelatedInfo(n,a);}return Sn.add(n),!0}return !1}if(e.isForOfStatement(t)&&!(32768&t.flags)&&e.isIdentifier(t.initializer)&&"async"===t.initializer.escapedText)return DC(t.initializer,e.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async),!1;if(255===t.initializer.kind){var o=t.initializer;if(!yC(o)){var s=o.declarations;if(!s.length)return !1;if(s.length>1)return n=243===t.kind?e.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement:e.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement,bC(o.declarations[1],n);var c=s[0];if(c.initializer){n=243===t.kind?e.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer:e.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;return DC(c.name,n)}if(c.type)return DC(c,n=243===t.kind?e.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation:e.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation)}}return !1}function uC(t){if(t.parameters.length===(172===t.kind?1:2))return e.getThisParameter(t)}function _C(t,r){if(function(t){return e.isDynamicName(t)&&!Bs(t)}(t))return DC(t,r)}function dC(t){if(tC(t))return !0;if(169===t.kind){if(205===t.parent.kind){if(t.modifiers&&(1!==t.modifiers.length||131!==e.first(t.modifiers).kind))return bC(t,e.Diagnostics.Modifiers_cannot_appear_here);if(sC(t.questionToken,e.Diagnostics.An_object_member_cannot_be_declared_optional))return !0;if(cC(t.exclamationToken,e.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context))return !0;if(void 0===t.body)return xC(t,t.end-1,";".length,e.Diagnostics._0_expected,"{")}if(oC(t))return !0}if(e.isClassLike(t.parent)){if(q<2&&e.isPrivateIdentifier(t.name))return DC(t.name,e.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);if(16777216&t.flags)return _C(t.name,e.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);if(169===t.kind&&!t.body)return _C(t.name,e.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)}else {if(258===t.parent.kind)return _C(t.name,e.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);if(182===t.parent.kind)return _C(t.name,e.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)}}function pC(t){return e.isStringOrNumericLiteralLike(t)||219===t.kind&&40===t.operator&&8===t.operand.kind}function fC(t){var r,n=t.initializer;if(n){var i=!(pC(n)||function(t){if((e.isPropertyAccessExpression(t)||e.isElementAccessExpression(t)&&pC(t.argumentExpression))&&e.isEntityNameExpression(t.expression))return !!(1024&cx(t).flags)}(n)||110===n.kind||95===n.kind||(r=n,9===r.kind||219===r.kind&&40===r.operator&&9===r.operand.kind)),a=e.isDeclarationReadonly(t)||e.isVariableDeclaration(t)&&e.isVarConst(t);if(!a||t.type)return DC(n,e.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);if(i)return DC(n,e.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference);if(!a||i)return DC(n,e.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts)}}function gC(t){if(79===t.kind){if("__esModule"===e.idText(t))return a=t,o=e.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules,!hC(e.getSourceFileOfNode(a))&&(Bn("noEmit",a,o,void 0,void 0,void 0),!0)}else for(var r=0,n=t.elements;r<n.length;r++){var i=n[r];if(!e.isOmittedExpression(i))return gC(i.name)}var a,o;return !1}function mC(t){if(79===t.kind){if(119===t.originalKeywordKind)return DC(t,e.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations)}else for(var r=0,n=t.elements;r<n.length;r++){var i=n[r];e.isOmittedExpression(i)||mC(i.name);}return !1}function yC(t){var r=t.declarations;return !!$T(t.declarations)||!t.declarations.length&&xC(t,r.pos,r.end-r.pos,e.Diagnostics.Variable_declaration_list_cannot_be_empty)}function vC(e){switch(e.kind){case 239:case 240:case 241:case 248:case 242:case 243:case 244:return !1;case 250:return vC(e.parent)}return !0}function hC(e){return e.parseDiagnostics.length>0}function bC(t,r,n,i,a){var o=e.getSourceFileOfNode(t);if(!hC(o)){var s=e.getSpanOfTokenAtPosition(o,t.pos);return Sn.add(e.createFileDiagnostic(o,s.start,s.length,r,n,i,a)),!0}return !1}function xC(t,r,n,i,a,o,s){var c=e.getSourceFileOfNode(t);return !hC(c)&&(Sn.add(e.createFileDiagnostic(c,r,n,i,a,o,s)),!0)}function DC(t,r,n,i,a){return !hC(e.getSourceFileOfNode(t))&&(Sn.add(e.createDiagnosticForNode(t,r,n,i,a)),!0)}function SC(t){return 258!==t.kind&&259!==t.kind&&266!==t.kind&&265!==t.kind&&272!==t.kind&&271!==t.kind&&264!==t.kind&&!e.hasSyntacticModifier(t,515)&&bC(t,e.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier)}function TC(t){if(16777216&t.flags){if(!ni(t).hasReportedStatementInAmbientContext&&(e.isFunctionLike(t.parent)||e.isAccessor(t.parent)))return ni(t).hasReportedStatementInAmbientContext=bC(t,e.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);if(235===t.parent.kind||262===t.parent.kind||305===t.parent.kind){var r=ni(t.parent);if(!r.hasReportedStatementInAmbientContext)return r.hasReportedStatementInAmbientContext=bC(t,e.Diagnostics.Statements_are_not_allowed_in_ambient_contexts)}}return !1}function CC(t){if(32&t.numericLiteralFlags){var r=void 0;if(q>=1?r=e.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0:e.isChildOfNodeWithKind(t,196)?r=e.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0:e.isChildOfNodeWithKind(t,299)&&(r=e.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0),r){var n=e.isPrefixUnaryExpression(t.parent)&&40===t.parent.operator,i=(n?"-":"")+"0o"+t.text;return DC(n?t.parent:t,r,i)}}return function(t){var r=-1!==e.getTextOfNode(t).indexOf("."),n=16&t.numericLiteralFlags;r||n||+t.text<=Math.pow(2,53)-1||zn(!1,e.createDiagnosticForNode(t,e.Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers));}(t),!1}function kC(t){return !!e.forEach(t.elements,(function(t){if(t.isTypeOnly)return bC(t,270===t.kind?e.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement:e.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement)}))}function EC(t,r,n,i){if(1048576&r.flags&&2621440&t.flags){var a=em(r,t);if(a)return a;var o=Nc(t);if(o){var s=Yg(o,r);if(s)return zp(r,e.map(s,(function(e){return [function(){return $o(e)},e.escapedName]})),n,void 0,i)}}}},function(e){e.JSX="JSX",e.IntrinsicElements="IntrinsicElements",e.ElementClass="ElementClass",e.ElementAttributesPropertyNameContainer="ElementAttributesProperty",e.ElementChildrenAttributeNameContainer="ElementChildrenAttribute",e.Element="Element",e.IntrinsicAttributes="IntrinsicAttributes",e.IntrinsicClassAttributes="IntrinsicClassAttributes",e.LibraryManagedAttributes="LibraryManagedAttributes";}(A||(A={})),e.signatureHasRestParameter=J,e.signatureHasLiteralTypes=z;}(t),function(e){function t(t,r,n,i){if(void 0===t||void 0===r)return t;var a,o=r(t);return o===t?t:void 0!==o?(a=e.isArray(o)?(i||c)(o):o,e.Debug.assertNode(a,n),a):void 0}function r(t,r,n,i,a){if(void 0===t||void 0===r)return t;var o,s,c=t.length;(void 0===i||i<0)&&(i=0),(void 0===a||a>c-i)&&(a=c-i);var l=-1,u=-1;(i>0||a<c)&&(o=[],s=t.hasTrailingComma&&i+a===c);for(var _=0;_<a;_++){var d=t[_+i],p=void 0!==d?r(d):void 0;if((void 0!==o||void 0===p||p!==d)&&(void 0===o&&(o=t.slice(0,_),s=t.hasTrailingComma,l=t.pos,u=t.end),p))if(e.isArray(p))for(var f=0,g=p;f<g.length;f++){var m=g[f];e.Debug.assertNode(m,n),o.push(m);}else e.Debug.assertNode(p,n),o.push(p);}if(o){var y=e.factory.createNodeArray(o,s);return e.setTextRangePosEnd(y,l,u),y}return t}function n(t,n,i,a,o,s){return void 0===s&&(s=r),i.startLexicalEnvironment(),t=s(t,n,e.isStatement,a),o&&(t=i.factory.ensureUseStrict(t)),e.factory.mergeLexicalEnvironment(t,i.endLexicalEnvironment())}function i(t,n,i,o){var s;return void 0===o&&(o=r),i.startLexicalEnvironment(),t&&(i.setLexicalEnvironmentFlags(1,!0),s=o(t,n,e.isParameterDeclaration),2&i.getLexicalEnvironmentFlags()&&e.getEmitScriptTarget(i.getCompilerOptions())>=2&&(s=function(t,r){for(var n,i=0;i<t.length;i++){var o=t[i],s=a(o,r);(n||s!==o)&&(n||(n=t.slice(0,i)),n[i]=s);}return n?e.setTextRange(r.factory.createNodeArray(n,t.hasTrailingComma),t):t}(s,i)),i.setLexicalEnvironmentFlags(1,!1)),i.suspendLexicalEnvironment(),s}function a(t,r){return t.dotDotDotToken?t:e.isBindingPattern(t.name)?function(e,t){var r=t.factory;return t.addInitializationStatement(r.createVariableStatement(void 0,r.createVariableDeclarationList([r.createVariableDeclaration(e.name,void 0,e.type,e.initializer?r.createConditionalExpression(r.createStrictEquality(r.getGeneratedNameForNode(e),r.createVoidZero()),void 0,e.initializer,void 0,r.getGeneratedNameForNode(e)):r.getGeneratedNameForNode(e))]))),r.updateParameterDeclaration(e,e.decorators,e.modifiers,e.dotDotDotToken,r.getGeneratedNameForNode(e),e.questionToken,e.type,void 0)}(t,r):t.initializer?function(t,r,n,i){var a=i.factory;return i.addInitializationStatement(a.createIfStatement(a.createTypeCheck(a.cloneNode(r),"undefined"),e.setEmitFlags(e.setTextRange(a.createBlock([a.createExpressionStatement(e.setEmitFlags(e.setTextRange(a.createAssignment(e.setEmitFlags(a.cloneNode(r),48),e.setEmitFlags(n,1584|e.getEmitFlags(n))),t),1536))]),t),1953))),a.updateParameterDeclaration(t,t.decorators,t.modifiers,t.dotDotDotToken,t.name,t.questionToken,t.type,void 0)}(t,t.name,t.initializer,r):t}function o(r,n,i,a){void 0===a&&(a=t),i.resumeLexicalEnvironment();var o=a(r,n,e.isConciseBody),s=i.endLexicalEnvironment();if(e.some(s)){if(!o)return i.factory.createBlock(s);var c=i.factory.converters.convertToFunctionBlock(o),l=e.factory.mergeLexicalEnvironment(c.statements,s);return i.factory.updateBlock(c,l)}return o}function s(r,n,i){i.startBlockScope();var a=t(r,n,e.isStatement,i.factory.liftToBlock),o=i.endBlockScope();return e.some(o)?e.isBlock(a)?(o.push.apply(o,a.statements),i.factory.updateBlock(a,o)):(o.push(a),i.factory.createBlock(o)):a}function c(t){return e.Debug.assert(t.length<=1,"Too many nodes written to output."),e.singleOrUndefined(t)}e.visitNode=t,e.visitNodes=r,e.visitLexicalEnvironment=n,e.visitParameterList=i,e.visitFunctionBody=o,e.visitIterationBody=s,e.visitEachChild=function(a,c,l,u,_,d){if(void 0===u&&(u=r),void 0===d&&(d=t),void 0!==a){var p=a.kind;if(p>0&&p<=160||192===p)return a;var f=l.factory;switch(p){case 79:return e.Debug.type(a),f.updateIdentifier(a,u(a.typeArguments,c,e.isTypeNodeOrTypeParameterDeclaration));case 161:return e.Debug.type(a),f.updateQualifiedName(a,d(a.left,c,e.isEntityName),d(a.right,c,e.isIdentifier));case 162:return e.Debug.type(a),f.updateComputedPropertyName(a,d(a.expression,c,e.isExpression));case 163:return e.Debug.type(a),f.updateTypeParameterDeclaration(a,u(a.modifiers,c,e.isModifier),d(a.name,c,e.isIdentifier),d(a.constraint,c,e.isTypeNode),d(a.default,c,e.isTypeNode));case 164:return e.Debug.type(a),f.updateParameterDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.dotDotDotToken,_,e.isDotDotDotToken),d(a.name,c,e.isBindingName),d(a.questionToken,_,e.isQuestionToken),d(a.type,c,e.isTypeNode),d(a.initializer,c,e.isExpression));case 165:return e.Debug.type(a),f.updateDecorator(a,d(a.expression,c,e.isExpression));case 166:return e.Debug.type(a),f.updatePropertySignature(a,u(a.modifiers,c,e.isModifier),d(a.name,c,e.isPropertyName),d(a.questionToken,_,e.isToken),d(a.type,c,e.isTypeNode));case 167:return e.Debug.type(a),f.updatePropertyDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isPropertyName),d(a.questionToken||a.exclamationToken,_,e.isQuestionOrExclamationToken),d(a.type,c,e.isTypeNode),d(a.initializer,c,e.isExpression));case 168:return e.Debug.type(a),f.updateMethodSignature(a,u(a.modifiers,c,e.isModifier),d(a.name,c,e.isPropertyName),d(a.questionToken,_,e.isQuestionToken),u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.parameters,c,e.isParameterDeclaration),d(a.type,c,e.isTypeNode));case 169:return e.Debug.type(a),f.updateMethodDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.asteriskToken,_,e.isAsteriskToken),d(a.name,c,e.isPropertyName),d(a.questionToken,_,e.isQuestionToken),u(a.typeParameters,c,e.isTypeParameterDeclaration),i(a.parameters,c,l,u),d(a.type,c,e.isTypeNode),o(a.body,c,l,d));case 171:return e.Debug.type(a),f.updateConstructorDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),i(a.parameters,c,l,u),o(a.body,c,l,d));case 172:return e.Debug.type(a),f.updateGetAccessorDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isPropertyName),i(a.parameters,c,l,u),d(a.type,c,e.isTypeNode),o(a.body,c,l,d));case 173:return e.Debug.type(a),f.updateSetAccessorDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isPropertyName),i(a.parameters,c,l,u),o(a.body,c,l,d));case 170:return e.Debug.type(a),l.startLexicalEnvironment(),l.suspendLexicalEnvironment(),f.updateClassStaticBlockDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),o(a.body,c,l,d));case 174:return e.Debug.type(a),f.updateCallSignature(a,u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.parameters,c,e.isParameterDeclaration),d(a.type,c,e.isTypeNode));case 175:return e.Debug.type(a),f.updateConstructSignature(a,u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.parameters,c,e.isParameterDeclaration),d(a.type,c,e.isTypeNode));case 176:return e.Debug.type(a),f.updateIndexSignature(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),u(a.parameters,c,e.isParameterDeclaration),d(a.type,c,e.isTypeNode));case 177:return e.Debug.type(a),f.updateTypePredicateNode(a,d(a.assertsModifier,c,e.isAssertsKeyword),d(a.parameterName,c,e.isIdentifierOrThisTypeNode),d(a.type,c,e.isTypeNode));case 178:return e.Debug.type(a),f.updateTypeReferenceNode(a,d(a.typeName,c,e.isEntityName),u(a.typeArguments,c,e.isTypeNode));case 179:return e.Debug.type(a),f.updateFunctionTypeNode(a,u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.parameters,c,e.isParameterDeclaration),d(a.type,c,e.isTypeNode));case 180:return e.Debug.type(a),f.updateConstructorTypeNode(a,u(a.modifiers,c,e.isModifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.parameters,c,e.isParameterDeclaration),d(a.type,c,e.isTypeNode));case 181:return e.Debug.type(a),f.updateTypeQueryNode(a,d(a.exprName,c,e.isEntityName),u(a.typeArguments,c,e.isTypeNode));case 182:return e.Debug.type(a),f.updateTypeLiteralNode(a,u(a.members,c,e.isTypeElement));case 183:return e.Debug.type(a),f.updateArrayTypeNode(a,d(a.elementType,c,e.isTypeNode));case 184:return e.Debug.type(a),f.updateTupleTypeNode(a,u(a.elements,c,e.isTypeNode));case 185:return e.Debug.type(a),f.updateOptionalTypeNode(a,d(a.type,c,e.isTypeNode));case 186:return e.Debug.type(a),f.updateRestTypeNode(a,d(a.type,c,e.isTypeNode));case 187:return e.Debug.type(a),f.updateUnionTypeNode(a,u(a.types,c,e.isTypeNode));case 188:return e.Debug.type(a),f.updateIntersectionTypeNode(a,u(a.types,c,e.isTypeNode));case 189:return e.Debug.type(a),f.updateConditionalTypeNode(a,d(a.checkType,c,e.isTypeNode),d(a.extendsType,c,e.isTypeNode),d(a.trueType,c,e.isTypeNode),d(a.falseType,c,e.isTypeNode));case 190:return e.Debug.type(a),f.updateInferTypeNode(a,d(a.typeParameter,c,e.isTypeParameterDeclaration));case 200:return e.Debug.type(a),f.updateImportTypeNode(a,d(a.argument,c,e.isTypeNode),d(a.assertions,c,e.isNode),d(a.qualifier,c,e.isEntityName),r(a.typeArguments,c,e.isTypeNode),a.isTypeOf);case 295:return e.Debug.type(a),f.updateImportTypeAssertionContainer(a,d(a.assertClause,c,e.isNode),a.multiLine);case 197:return e.Debug.type(a),f.updateNamedTupleMember(a,t(a.dotDotDotToken,c,e.isDotDotDotToken),t(a.name,c,e.isIdentifier),t(a.questionToken,c,e.isQuestionToken),t(a.type,c,e.isTypeNode));case 191:return e.Debug.type(a),f.updateParenthesizedType(a,d(a.type,c,e.isTypeNode));case 193:return e.Debug.type(a),f.updateTypeOperatorNode(a,d(a.type,c,e.isTypeNode));case 194:return e.Debug.type(a),f.updateIndexedAccessTypeNode(a,d(a.objectType,c,e.isTypeNode),d(a.indexType,c,e.isTypeNode));case 195:return e.Debug.type(a),f.updateMappedTypeNode(a,d(a.readonlyToken,_,e.isReadonlyKeywordOrPlusOrMinusToken),d(a.typeParameter,c,e.isTypeParameterDeclaration),d(a.nameType,c,e.isTypeNode),d(a.questionToken,_,e.isQuestionOrPlusOrMinusToken),d(a.type,c,e.isTypeNode),u(a.members,c,e.isTypeElement));case 196:return e.Debug.type(a),f.updateLiteralTypeNode(a,d(a.literal,c,e.isExpression));case 198:return e.Debug.type(a),f.updateTemplateLiteralType(a,d(a.head,c,e.isTemplateHead),u(a.templateSpans,c,e.isTemplateLiteralTypeSpan));case 199:return e.Debug.type(a),f.updateTemplateLiteralTypeSpan(a,d(a.type,c,e.isTypeNode),d(a.literal,c,e.isTemplateMiddleOrTemplateTail));case 201:return e.Debug.type(a),f.updateObjectBindingPattern(a,u(a.elements,c,e.isBindingElement));case 202:return e.Debug.type(a),f.updateArrayBindingPattern(a,u(a.elements,c,e.isArrayBindingElement));case 203:return e.Debug.type(a),f.updateBindingElement(a,d(a.dotDotDotToken,_,e.isDotDotDotToken),d(a.propertyName,c,e.isPropertyName),d(a.name,c,e.isBindingName),d(a.initializer,c,e.isExpression));case 204:return e.Debug.type(a),f.updateArrayLiteralExpression(a,u(a.elements,c,e.isExpression));case 205:return e.Debug.type(a),f.updateObjectLiteralExpression(a,u(a.properties,c,e.isObjectLiteralElementLike));case 206:return 32&a.flags?(e.Debug.type(a),f.updatePropertyAccessChain(a,d(a.expression,c,e.isExpression),d(a.questionDotToken,_,e.isQuestionDotToken),d(a.name,c,e.isMemberName))):(e.Debug.type(a),f.updatePropertyAccessExpression(a,d(a.expression,c,e.isExpression),d(a.name,c,e.isMemberName)));case 207:return 32&a.flags?(e.Debug.type(a),f.updateElementAccessChain(a,d(a.expression,c,e.isExpression),d(a.questionDotToken,_,e.isQuestionDotToken),d(a.argumentExpression,c,e.isExpression))):(e.Debug.type(a),f.updateElementAccessExpression(a,d(a.expression,c,e.isExpression),d(a.argumentExpression,c,e.isExpression)));case 208:return 32&a.flags?(e.Debug.type(a),f.updateCallChain(a,d(a.expression,c,e.isExpression),d(a.questionDotToken,_,e.isQuestionDotToken),u(a.typeArguments,c,e.isTypeNode),u(a.arguments,c,e.isExpression))):(e.Debug.type(a),f.updateCallExpression(a,d(a.expression,c,e.isExpression),u(a.typeArguments,c,e.isTypeNode),u(a.arguments,c,e.isExpression)));case 209:return e.Debug.type(a),f.updateNewExpression(a,d(a.expression,c,e.isExpression),u(a.typeArguments,c,e.isTypeNode),u(a.arguments,c,e.isExpression));case 210:return e.Debug.type(a),f.updateTaggedTemplateExpression(a,d(a.tag,c,e.isExpression),r(a.typeArguments,c,e.isTypeNode),d(a.template,c,e.isTemplateLiteral));case 211:return e.Debug.type(a),f.updateTypeAssertion(a,d(a.type,c,e.isTypeNode),d(a.expression,c,e.isExpression));case 212:return e.Debug.type(a),f.updateParenthesizedExpression(a,d(a.expression,c,e.isExpression));case 213:return e.Debug.type(a),f.updateFunctionExpression(a,u(a.modifiers,c,e.isModifier),d(a.asteriskToken,_,e.isAsteriskToken),d(a.name,c,e.isIdentifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),i(a.parameters,c,l,u),d(a.type,c,e.isTypeNode),o(a.body,c,l,d));case 214:return e.Debug.type(a),f.updateArrowFunction(a,u(a.modifiers,c,e.isModifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),i(a.parameters,c,l,u),d(a.type,c,e.isTypeNode),d(a.equalsGreaterThanToken,_,e.isEqualsGreaterThanToken),o(a.body,c,l,d));case 215:return e.Debug.type(a),f.updateDeleteExpression(a,d(a.expression,c,e.isExpression));case 216:return e.Debug.type(a),f.updateTypeOfExpression(a,d(a.expression,c,e.isExpression));case 217:return e.Debug.type(a),f.updateVoidExpression(a,d(a.expression,c,e.isExpression));case 218:return e.Debug.type(a),f.updateAwaitExpression(a,d(a.expression,c,e.isExpression));case 219:return e.Debug.type(a),f.updatePrefixUnaryExpression(a,d(a.operand,c,e.isExpression));case 220:return e.Debug.type(a),f.updatePostfixUnaryExpression(a,d(a.operand,c,e.isExpression));case 221:return e.Debug.type(a),f.updateBinaryExpression(a,d(a.left,c,e.isExpression),d(a.operatorToken,_,e.isBinaryOperatorToken),d(a.right,c,e.isExpression));case 222:return e.Debug.type(a),f.updateConditionalExpression(a,d(a.condition,c,e.isExpression),d(a.questionToken,_,e.isQuestionToken),d(a.whenTrue,c,e.isExpression),d(a.colonToken,_,e.isColonToken),d(a.whenFalse,c,e.isExpression));case 223:return e.Debug.type(a),f.updateTemplateExpression(a,d(a.head,c,e.isTemplateHead),u(a.templateSpans,c,e.isTemplateSpan));case 224:return e.Debug.type(a),f.updateYieldExpression(a,d(a.asteriskToken,_,e.isAsteriskToken),d(a.expression,c,e.isExpression));case 225:return e.Debug.type(a),f.updateSpreadElement(a,d(a.expression,c,e.isExpression));case 226:return e.Debug.type(a),f.updateClassExpression(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isIdentifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.heritageClauses,c,e.isHeritageClause),u(a.members,c,e.isClassElement));case 228:return e.Debug.type(a),f.updateExpressionWithTypeArguments(a,d(a.expression,c,e.isExpression),u(a.typeArguments,c,e.isTypeNode));case 229:return e.Debug.type(a),f.updateAsExpression(a,d(a.expression,c,e.isExpression),d(a.type,c,e.isTypeNode));case 230:return 32&a.flags?(e.Debug.type(a),f.updateNonNullChain(a,d(a.expression,c,e.isExpression))):(e.Debug.type(a),f.updateNonNullExpression(a,d(a.expression,c,e.isExpression)));case 231:return e.Debug.type(a),f.updateMetaProperty(a,d(a.name,c,e.isIdentifier));case 233:return e.Debug.type(a),f.updateTemplateSpan(a,d(a.expression,c,e.isExpression),d(a.literal,c,e.isTemplateMiddleOrTemplateTail));case 235:return e.Debug.type(a),f.updateBlock(a,u(a.statements,c,e.isStatement));case 237:return e.Debug.type(a),f.updateVariableStatement(a,u(a.modifiers,c,e.isModifier),d(a.declarationList,c,e.isVariableDeclarationList));case 238:return e.Debug.type(a),f.updateExpressionStatement(a,d(a.expression,c,e.isExpression));case 239:return e.Debug.type(a),f.updateIfStatement(a,d(a.expression,c,e.isExpression),d(a.thenStatement,c,e.isStatement,f.liftToBlock),d(a.elseStatement,c,e.isStatement,f.liftToBlock));case 240:return e.Debug.type(a),f.updateDoStatement(a,s(a.statement,c,l),d(a.expression,c,e.isExpression));case 241:return e.Debug.type(a),f.updateWhileStatement(a,d(a.expression,c,e.isExpression),s(a.statement,c,l));case 242:return e.Debug.type(a),f.updateForStatement(a,d(a.initializer,c,e.isForInitializer),d(a.condition,c,e.isExpression),d(a.incrementor,c,e.isExpression),s(a.statement,c,l));case 243:return e.Debug.type(a),f.updateForInStatement(a,d(a.initializer,c,e.isForInitializer),d(a.expression,c,e.isExpression),s(a.statement,c,l));case 244:return e.Debug.type(a),f.updateForOfStatement(a,d(a.awaitModifier,_,e.isAwaitKeyword),d(a.initializer,c,e.isForInitializer),d(a.expression,c,e.isExpression),s(a.statement,c,l));case 245:return e.Debug.type(a),f.updateContinueStatement(a,d(a.label,c,e.isIdentifier));case 246:return e.Debug.type(a),f.updateBreakStatement(a,d(a.label,c,e.isIdentifier));case 247:return e.Debug.type(a),f.updateReturnStatement(a,d(a.expression,c,e.isExpression));case 248:return e.Debug.type(a),f.updateWithStatement(a,d(a.expression,c,e.isExpression),d(a.statement,c,e.isStatement,f.liftToBlock));case 249:return e.Debug.type(a),f.updateSwitchStatement(a,d(a.expression,c,e.isExpression),d(a.caseBlock,c,e.isCaseBlock));case 250:return e.Debug.type(a),f.updateLabeledStatement(a,d(a.label,c,e.isIdentifier),d(a.statement,c,e.isStatement,f.liftToBlock));case 251:return e.Debug.type(a),f.updateThrowStatement(a,d(a.expression,c,e.isExpression));case 252:return e.Debug.type(a),f.updateTryStatement(a,d(a.tryBlock,c,e.isBlock),d(a.catchClause,c,e.isCatchClause),d(a.finallyBlock,c,e.isBlock));case 254:return e.Debug.type(a),f.updateVariableDeclaration(a,d(a.name,c,e.isBindingName),d(a.exclamationToken,_,e.isExclamationToken),d(a.type,c,e.isTypeNode),d(a.initializer,c,e.isExpression));case 255:return e.Debug.type(a),f.updateVariableDeclarationList(a,u(a.declarations,c,e.isVariableDeclaration));case 256:return e.Debug.type(a),f.updateFunctionDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.asteriskToken,_,e.isAsteriskToken),d(a.name,c,e.isIdentifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),i(a.parameters,c,l,u),d(a.type,c,e.isTypeNode),o(a.body,c,l,d));case 257:return e.Debug.type(a),f.updateClassDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isIdentifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.heritageClauses,c,e.isHeritageClause),u(a.members,c,e.isClassElement));case 258:return e.Debug.type(a),f.updateInterfaceDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isIdentifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),u(a.heritageClauses,c,e.isHeritageClause),u(a.members,c,e.isTypeElement));case 259:return e.Debug.type(a),f.updateTypeAliasDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isIdentifier),u(a.typeParameters,c,e.isTypeParameterDeclaration),d(a.type,c,e.isTypeNode));case 260:return e.Debug.type(a),f.updateEnumDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isIdentifier),u(a.members,c,e.isEnumMember));case 261:return e.Debug.type(a),f.updateModuleDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.name,c,e.isModuleName),d(a.body,c,e.isModuleBody));case 262:return e.Debug.type(a),f.updateModuleBlock(a,u(a.statements,c,e.isStatement));case 263:return e.Debug.type(a),f.updateCaseBlock(a,u(a.clauses,c,e.isCaseOrDefaultClause));case 264:return e.Debug.type(a),f.updateNamespaceExportDeclaration(a,d(a.name,c,e.isIdentifier));case 265:return e.Debug.type(a),f.updateImportEqualsDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),a.isTypeOnly,d(a.name,c,e.isIdentifier),d(a.moduleReference,c,e.isModuleReference));case 266:return e.Debug.type(a),f.updateImportDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.importClause,c,e.isImportClause),d(a.moduleSpecifier,c,e.isExpression),d(a.assertClause,c,e.isAssertClause));case 293:return e.Debug.type(a),f.updateAssertClause(a,u(a.elements,c,e.isAssertEntry),a.multiLine);case 294:return e.Debug.type(a),f.updateAssertEntry(a,d(a.name,c,e.isAssertionKey),d(a.value,c,e.isExpressionNode));case 267:return e.Debug.type(a),f.updateImportClause(a,a.isTypeOnly,d(a.name,c,e.isIdentifier),d(a.namedBindings,c,e.isNamedImportBindings));case 268:return e.Debug.type(a),f.updateNamespaceImport(a,d(a.name,c,e.isIdentifier));case 274:return e.Debug.type(a),f.updateNamespaceExport(a,d(a.name,c,e.isIdentifier));case 269:return e.Debug.type(a),f.updateNamedImports(a,u(a.elements,c,e.isImportSpecifier));case 270:return e.Debug.type(a),f.updateImportSpecifier(a,a.isTypeOnly,d(a.propertyName,c,e.isIdentifier),d(a.name,c,e.isIdentifier));case 271:return e.Debug.type(a),f.updateExportAssignment(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),d(a.expression,c,e.isExpression));case 272:return e.Debug.type(a),f.updateExportDeclaration(a,u(a.decorators,c,e.isDecorator),u(a.modifiers,c,e.isModifier),a.isTypeOnly,d(a.exportClause,c,e.isNamedExportBindings),d(a.moduleSpecifier,c,e.isExpression),d(a.assertClause,c,e.isAssertClause));case 273:return e.Debug.type(a),f.updateNamedExports(a,u(a.elements,c,e.isExportSpecifier));case 275:return e.Debug.type(a),f.updateExportSpecifier(a,a.isTypeOnly,d(a.propertyName,c,e.isIdentifier),d(a.name,c,e.isIdentifier));case 277:return e.Debug.type(a),f.updateExternalModuleReference(a,d(a.expression,c,e.isExpression));case 278:return e.Debug.type(a),f.updateJsxElement(a,d(a.openingElement,c,e.isJsxOpeningElement),u(a.children,c,e.isJsxChild),d(a.closingElement,c,e.isJsxClosingElement));case 279:return e.Debug.type(a),f.updateJsxSelfClosingElement(a,d(a.tagName,c,e.isJsxTagNameExpression),u(a.typeArguments,c,e.isTypeNode),d(a.attributes,c,e.isJsxAttributes));case 280:return e.Debug.type(a),f.updateJsxOpeningElement(a,d(a.tagName,c,e.isJsxTagNameExpression),u(a.typeArguments,c,e.isTypeNode),d(a.attributes,c,e.isJsxAttributes));case 281:return e.Debug.type(a),f.updateJsxClosingElement(a,d(a.tagName,c,e.isJsxTagNameExpression));case 282:return e.Debug.type(a),f.updateJsxFragment(a,d(a.openingFragment,c,e.isJsxOpeningFragment),u(a.children,c,e.isJsxChild),d(a.closingFragment,c,e.isJsxClosingFragment));case 285:return e.Debug.type(a),f.updateJsxAttribute(a,d(a.name,c,e.isIdentifier),d(a.initializer,c,e.isStringLiteralOrJsxExpression));case 286:return e.Debug.type(a),f.updateJsxAttributes(a,u(a.properties,c,e.isJsxAttributeLike));case 287:return e.Debug.type(a),f.updateJsxSpreadAttribute(a,d(a.expression,c,e.isExpression));case 288:return e.Debug.type(a),f.updateJsxExpression(a,d(a.expression,c,e.isExpression));case 289:return e.Debug.type(a),f.updateCaseClause(a,d(a.expression,c,e.isExpression),u(a.statements,c,e.isStatement));case 290:return e.Debug.type(a),f.updateDefaultClause(a,u(a.statements,c,e.isStatement));case 291:return e.Debug.type(a),f.updateHeritageClause(a,u(a.types,c,e.isExpressionWithTypeArguments));case 292:return e.Debug.type(a),f.updateCatchClause(a,d(a.variableDeclaration,c,e.isVariableDeclaration),d(a.block,c,e.isBlock));case 296:return e.Debug.type(a),f.updatePropertyAssignment(a,d(a.name,c,e.isPropertyName),d(a.initializer,c,e.isExpression));case 297:return e.Debug.type(a),f.updateShorthandPropertyAssignment(a,d(a.name,c,e.isIdentifier),d(a.objectAssignmentInitializer,c,e.isExpression));case 298:return e.Debug.type(a),f.updateSpreadAssignment(a,d(a.expression,c,e.isExpression));case 299:return e.Debug.type(a),f.updateEnumMember(a,d(a.name,c,e.isPropertyName),d(a.initializer,c,e.isExpression));case 305:return e.Debug.type(a),f.updateSourceFile(a,n(a.statements,c,l));case 350:return e.Debug.type(a),f.updatePartiallyEmittedExpression(a,d(a.expression,c,e.isExpression));case 351:return e.Debug.type(a),f.updateCommaListExpression(a,u(a.elements,c,e.isExpression));default:return a}}};}(t),function(e){e.createSourceMapGenerator=function(t,r,n,i,o){var s,c,l=o.extendedDiagnostics?e.performance.createTimer("Source Map","beforeSourcemap","afterSourcemap"):e.performance.nullTimer,u=l.enter,_=l.exit,d=[],p=[],f=new e.Map,g=[],m=[],y="",v=0,h=0,b=0,x=0,D=0,S=0,T=!1,C=0,k=0,E=0,N=0,F=0,A=0,P=!1,w=!1,I=!1;return {getSources:function(){return d},addSource:O,setSourceContent:M,addName:L,addMapping:R,appendSourceMap:function(t,r,n,i,o,s){e.Debug.assert(t>=C,"generatedLine cannot backtrack"),e.Debug.assert(r>=0,"generatedCharacter cannot be negative"),u();for(var c,l=[],d=a(n.mappings),p=d.next();!p.done;p=d.next()){var f=p.value;if(s&&(f.generatedLine>s.line||f.generatedLine===s.line&&f.generatedCharacter>s.character))break;if(!o||!(f.generatedLine<o.line||o.line===f.generatedLine&&f.generatedCharacter<o.character)){var g=void 0,m=void 0,y=void 0,v=void 0;if(void 0!==f.sourceIndex){if(void 0===(g=l[f.sourceIndex])){var h=n.sources[f.sourceIndex],b=n.sourceRoot?e.combinePaths(n.sourceRoot,h):h,x=e.combinePaths(e.getDirectoryPath(i),b);l[f.sourceIndex]=g=O(x),n.sourcesContent&&"string"==typeof n.sourcesContent[f.sourceIndex]&&M(g,n.sourcesContent[f.sourceIndex]);}m=f.sourceLine,y=f.sourceCharacter,n.names&&void 0!==f.nameIndex&&(c||(c=[]),void 0===(v=c[f.nameIndex])&&(c[f.nameIndex]=v=L(n.names[f.nameIndex])));}var D=f.generatedLine-(o?o.line:0),S=D+t,T=o&&o.line===f.generatedLine?f.generatedCharacter-o.character:f.generatedCharacter;R(S,0===D?T+r:T,g,m,y,v);}}_();},toJSON:z,toString:function(){return JSON.stringify(z())}};function O(r){u();var n=e.getRelativePathToDirectoryOrUrl(i,r,t.getCurrentDirectory(),t.getCanonicalFileName,!0),a=f.get(n);return void 0===a&&(a=p.length,p.push(n),d.push(r),f.set(n,a)),_(),a}function M(e,t){if(u(),null!==t){for(s||(s=[]);s.length<e;)s.push(null);s[e]=t;}_();}function L(t){u(),c||(c=new e.Map);var r=c.get(t);return void 0===r&&(r=g.length,g.push(t),c.set(t,r)),_(),r}function R(t,r,n,i,a,o){e.Debug.assert(t>=C,"generatedLine cannot backtrack"),e.Debug.assert(r>=0,"generatedCharacter cannot be negative"),e.Debug.assert(void 0===n||n>=0,"sourceIndex cannot be negative"),e.Debug.assert(void 0===i||i>=0,"sourceLine cannot be negative"),e.Debug.assert(void 0===a||a>=0,"sourceCharacter cannot be negative"),u(),(function(e,t){return !P||C!==e||k!==t}(t,r)||function(e,t,r){return void 0!==e&&void 0!==t&&void 0!==r&&E===e&&(N>t||N===t&&F>r)}(n,i,a))&&(j(),C=t,k=r,w=!1,I=!1,P=!0),void 0!==n&&void 0!==i&&void 0!==a&&(E=n,N=i,F=a,w=!0,void 0!==o&&(A=o,I=!0)),_();}function B(e){m.push(e),m.length>=1024&&J();}function j(){if(P&&(!T||v!==C||h!==k||b!==E||x!==N||D!==F||S!==A)){if(u(),v<C){do{B(59),v++;}while(v<C);h=0;}else e.Debug.assertEqual(v,C,"generatedLine cannot backtrack"),T&&B(44);K(k-h),h=k,w&&(K(E-b),b=E,K(N-x),x=N,K(F-D),D=F,I&&(K(A-S),S=A)),T=!0,_();}}function J(){m.length>0&&(y+=String.fromCharCode.apply(void 0,m),m.length=0);}function z(){return j(),J(),{version:3,file:r,sourceRoot:n,sources:p,names:g,mappings:y,sourcesContent:s}}function K(t){t<0?t=1+(-t<<1):t<<=1;do{var r=31&t;(t>>=5)>0&&(r|=32),B((n=r)>=0&&n<26?65+n:n>=26&&n<52?97+n-26:n>=52&&n<62?48+n-52:62===n?43:63===n?47:e.Debug.fail("".concat(n,": not a base64 value")));}while(t>0);var n;}};var t=/^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/,r=/^\s*(\/\/[@#] .*)?$/;function n(e){return "string"==typeof e||null===e}function i(t){return null!==t&&"object"==typeof t&&3===t.version&&"string"==typeof t.file&&"string"==typeof t.mappings&&e.isArray(t.sources)&&e.every(t.sources,e.isString)&&(void 0===t.sourceRoot||null===t.sourceRoot||"string"==typeof t.sourceRoot)&&(void 0===t.sourcesContent||null===t.sourcesContent||e.isArray(t.sourcesContent)&&e.every(t.sourcesContent,n))&&(void 0===t.names||null===t.names||e.isArray(t.names)&&e.every(t.names,e.isString))}function a(e){var t,r=!1,n=0,i=0,a=0,o=0,s=0,c=0,l=0;return {get pos(){return n},get error(){return t},get state(){return u(!0,!0)},next:function(){for(;!r&&n<e.length;){var t=e.charCodeAt(n);if(59!==t){if(44!==t){var d=!1,y=!1;if(a+=m(),f())return _();if(a<0)return p("Invalid generatedCharacter found");if(!g()){if(d=!0,o+=m(),f())return _();if(o<0)return p("Invalid sourceIndex found");if(g())return p("Unsupported Format: No entries after sourceIndex");if(s+=m(),f())return _();if(s<0)return p("Invalid sourceLine found");if(g())return p("Unsupported Format: No entries after sourceLine");if(c+=m(),f())return _();if(c<0)return p("Invalid sourceCharacter found");if(!g()){if(y=!0,l+=m(),f())return _();if(l<0)return p("Invalid nameIndex found");if(!g())return p("Unsupported Error Format: Entries after nameIndex")}}return {value:u(d,y),done:r}}n++;}else i++,a=0,n++;}return _()}};function u(e,t){return {generatedLine:i,generatedCharacter:a,sourceIndex:e?o:void 0,sourceLine:e?s:void 0,sourceCharacter:e?c:void 0,nameIndex:t?l:void 0}}function _(){return r=!0,{value:void 0,done:!0}}function d(e){void 0===t&&(t=e);}function p(e){return d(e),_()}function f(){return void 0!==t}function g(){return n===e.length||44===e.charCodeAt(n)||59===e.charCodeAt(n)}function m(){for(var t,r=!0,i=0,a=0;r;n++){if(n>=e.length)return d("Error in decoding base64VLQFormatDecode, past the mapping string"),-1;var o=(t=e.charCodeAt(n))>=65&&t<=90?t-65:t>=97&&t<=122?t-97+26:t>=48&&t<=57?t-48+52:43===t?62:47===t?63:-1;if(-1===o)return d("Invalid character in VLQ"),-1;r=0!=(32&o),a|=(31&o)<<i,i+=5;}return 0==(1&a)?a>>=1:a=-(a>>=1),a}}function o(e){return void 0!==e.sourceIndex&&void 0!==e.sourceLine&&void 0!==e.sourceCharacter}function s(e){return void 0!==e.sourceIndex&&void 0!==e.sourcePosition}function c(e,t){return e.generatedPosition===t.generatedPosition&&e.sourceIndex===t.sourceIndex&&e.sourcePosition===t.sourcePosition}function l(t,r){return e.Debug.assert(t.sourceIndex===r.sourceIndex),e.compareValues(t.sourcePosition,r.sourcePosition)}function u(t,r){return e.compareValues(t.generatedPosition,r.generatedPosition)}function _(e){return e.sourcePosition}function d(e){return e.generatedPosition}e.getLineInfo=function(e,t){return {getLineCount:function(){return t.length},getLineText:function(r){return e.substring(t[r],t[r+1])}}},e.tryGetSourceMappingURL=function(n){for(var i=n.getLineCount()-1;i>=0;i--){var a=n.getLineText(i),o=t.exec(a);if(o)return e.trimStringEnd(o[1]);if(!a.match(r))break}},e.isRawSourceMap=i,e.tryParseRawSourceMap=function(e){try{var t=JSON.parse(e);if(i(t))return t}catch(e){}},e.decodeMappings=a,e.sameMapping=function(e,t){return e===t||e.generatedLine===t.generatedLine&&e.generatedCharacter===t.generatedCharacter&&e.sourceIndex===t.sourceIndex&&e.sourceLine===t.sourceLine&&e.sourceCharacter===t.sourceCharacter&&e.nameIndex===t.nameIndex},e.isSourceMapping=o,e.createDocumentPositionMapper=function(t,r,n){var i,p,f,g=e.getDirectoryPath(n),m=r.sourceRoot?e.getNormalizedAbsolutePath(r.sourceRoot,g):g,y=e.getNormalizedAbsolutePath(r.file,g),v=t.getSourceFileLike(y),h=r.sources.map((function(t){return e.getNormalizedAbsolutePath(t,m)})),b=new e.Map(h.map((function(e,r){return [t.getCanonicalFileName(e),r]})));return {getSourcePosition:function(t){var r=T();if(!e.some(r))return t;var n=e.binarySearchKey(r,t.pos,d,e.compareValues);n<0&&(n=~n);var i=r[n];return void 0!==i&&s(i)?{fileName:h[i.sourceIndex],pos:i.sourcePosition}:t},getGeneratedPosition:function(r){var n=b.get(t.getCanonicalFileName(r.fileName));if(void 0===n)return r;var i=S(n);if(!e.some(i))return r;var a=e.binarySearchKey(i,r.pos,_,e.compareValues);a<0&&(a=~a);var o=i[a];return void 0===o||o.sourceIndex!==n?r:{fileName:y,pos:o.generatedPosition}}};function x(n){var i,a,s=void 0!==v?e.getPositionOfLineAndCharacter(v,n.generatedLine,n.generatedCharacter,!0):-1;if(o(n)){var c=t.getSourceFileLike(h[n.sourceIndex]);i=r.sources[n.sourceIndex],a=void 0!==c?e.getPositionOfLineAndCharacter(c,n.sourceLine,n.sourceCharacter,!0):-1;}return {generatedPosition:s,source:i,sourceIndex:n.sourceIndex,sourcePosition:a,nameIndex:n.nameIndex}}function D(){if(void 0===i){var n=a(r.mappings),o=e.arrayFrom(n,x);void 0!==n.error?(t.log&&t.log("Encountered error while decoding sourcemap: ".concat(n.error)),i=e.emptyArray):i=o;}return i}function S(t){if(void 0===f){for(var r=[],n=0,i=D();n<i.length;n++){var a=i[n];if(s(a)){var o=r[a.sourceIndex];o||(r[a.sourceIndex]=o=[]),o.push(a);}}f=r.map((function(t){return e.sortAndDeduplicate(t,l,c)}));}return f[t]}function T(){if(void 0===p){for(var t=[],r=0,n=D();r<n.length;r++){var i=n[r];t.push(i);}p=e.sortAndDeduplicate(t,u,c);}return p}},e.identitySourceMapConsumer={getSourcePosition:e.identity,getGeneratedPosition:e.identity};}(t),function(e){function t(t){return (t=e.getOriginalNode(t))?e.getNodeId(t):0}function r(e){return void 0!==e.propertyName&&"default"===e.propertyName.escapedText}function n(t){if(e.getNamespaceDeclarationNode(t))return !0;var n=t.importClause&&t.importClause.namedBindings;if(!n)return !1;if(!e.isNamedImports(n))return !1;for(var i=0,a=0,o=n.elements;a<o.length;a++)r(o[a])&&i++;return i>0&&i!==n.elements.length||!!(n.elements.length-i)&&e.isDefaultImport(t)}function i(t){return !n(t)&&(e.isDefaultImport(t)||!!t.importClause&&e.isNamedImports(t.importClause.namedBindings)&&function(t){return !!t&&!!e.isNamedImports(t)&&e.some(t.elements,r)}(t.importClause.namedBindings))}function a(t,r,n){if(e.isBindingPattern(t.name))for(var i=0,o=t.name.elements;i<o.length;i++){var s=o[i];e.isOmittedExpression(s)||(n=a(s,r,n));}else if(!e.isGeneratedIdentifier(t.name)){var c=e.idText(t.name);r.get(c)||(r.set(c,!0),n=e.append(n,t.name));}return n}function o(e,t,r){var n=e[t];return n?n.push(r):e[t]=n=[r],n}function s(t){return e.isStringLiteralLike(t)||8===t.kind||e.isKeyword(t.kind)||e.isIdentifier(t)}function c(t){if(e.isExpressionStatement(t)){var r=e.skipParentheses(t.expression);return e.isSuperCall(r)?r:void 0}}function l(t){return r=t,e.isPropertyDeclaration(r)&&e.hasStaticModifier(r)||e.isClassStaticBlockDeclaration(t);var r;}e.getOriginalNodeId=t,e.chainBundle=function(t,r){return function(n){return 305===n.kind?r(n):function(n){return t.factory.createBundle(e.map(n.sourceFiles,r),n.prepends)}(n)}},e.getExportNeedsImportStarHelper=function(t){return !!e.getNamespaceDeclarationNode(t)},e.getImportNeedsImportStarHelper=n,e.getImportNeedsImportDefaultHelper=i,e.collectExternalModuleInfo=function(r,s,c,l){for(var u,_,d=[],p=e.createMultiMap(),f=[],g=new e.Map,m=!1,y=!1,v=!1,h=!1,b=0,x=s.statements;b<x.length;b++){var D=x[b];switch(D.kind){case 266:d.push(D),!v&&n(D)&&(v=!0),!h&&i(D)&&(h=!0);break;case 265:277===D.moduleReference.kind&&d.push(D);break;case 272:if(D.moduleSpecifier)if(D.exportClause)if(d.push(D),e.isNamedExports(D.exportClause))N(D);else {var S=D.exportClause.name;g.get(e.idText(S))||(o(f,t(D),S),g.set(e.idText(S),!0),u=e.append(u,S)),v=!0;}else d.push(D),y=!0;else N(D);break;case 271:D.isExportEquals&&!_&&(_=D);break;case 237:if(e.hasSyntacticModifier(D,1))for(var T=0,C=D.declarationList.declarations;T<C.length;T++){var k=C[T];u=a(k,g,u);}break;case 256:e.hasSyntacticModifier(D,1)&&(e.hasSyntacticModifier(D,512)?m||(o(f,t(D),r.factory.getDeclarationName(D)),m=!0):(S=D.name,g.get(e.idText(S))||(o(f,t(D),S),g.set(e.idText(S),!0),u=e.append(u,S))));break;case 257:e.hasSyntacticModifier(D,1)&&(e.hasSyntacticModifier(D,512)?m||(o(f,t(D),r.factory.getDeclarationName(D)),m=!0):(S=D.name)&&!g.get(e.idText(S))&&(o(f,t(D),S),g.set(e.idText(S),!0),u=e.append(u,S)));}}var E=e.createExternalHelpersImportDeclarationIfNeeded(r.factory,r.getEmitHelperFactory(),s,l,y,v,h);return E&&d.unshift(E),{externalImports:d,exportSpecifiers:p,exportEquals:_,hasExportStarsToExportValues:y,exportedBindings:f,exportedNames:u,externalHelpersImportDeclaration:E};function N(r){for(var n=0,i=e.cast(r.exportClause,e.isNamedExports).elements;n<i.length;n++){var a=i[n];if(!g.get(e.idText(a.name))){var s=a.propertyName||a.name;r.moduleSpecifier||p.add(e.idText(s),a);var l=c.getReferencedImportDeclaration(s)||c.getReferencedValueDeclaration(s);l&&o(f,t(l),a.name),g.set(e.idText(a.name),!0),u=e.append(u,a.name);}}}},e.isSimpleCopiableExpression=s,e.isSimpleInlineableExpression=function(t){return !e.isIdentifier(t)&&s(t)},e.isCompoundAssignment=function(e){return e>=64&&e<=78},e.getNonAssignmentOperatorForCompoundAssignment=function(e){switch(e){case 64:return 39;case 65:return 40;case 66:return 41;case 67:return 42;case 68:return 43;case 69:return 44;case 70:return 47;case 71:return 48;case 72:return 49;case 73:return 50;case 74:return 51;case 78:return 52;case 75:return 56;case 76:return 55;case 77:return 60}},e.getSuperCallFromStatement=c,e.findSuperStatementIndex=function(e,t){for(var r=t;r<e.length;r+=1)if(c(e[r]))return r;return -1},e.getProperties=function(t,r,n){return e.filter(t.members,(function(t){return function(t,r,n){return e.isPropertyDeclaration(t)&&(!!t.initializer||!r)&&e.hasStaticModifier(t)===n}(t,r,n)}))},e.getStaticPropertiesAndClassStaticBlock=function(t){return e.filter(t.members,l)},e.isInitializedProperty=function(e){return 167===e.kind&&void 0!==e.initializer},e.isNonStaticMethodOrAccessorWithPrivateName=function(t){return !e.isStatic(t)&&e.isMethodOrAccessor(t)&&e.isPrivateIdentifier(t.name)};}(t),function(e){function t(r,n){var i=e.getTargetOfBindingOrAssignmentElement(r);return e.isBindingOrAssignmentPattern(i)?function(r,n){for(var i=0,a=e.getElementsOfBindingOrAssignmentPattern(r);i<a.length;i++)if(t(a[i],n))return !0;return !1}(i,n):!!e.isIdentifier(i)&&i.escapedText===n}function r(t){var n=e.tryGetPropertyNameOfBindingOrAssignmentElement(t);if(n&&e.isComputedPropertyName(n)&&!e.isLiteralExpression(n.expression))return !0;var i,a=e.getTargetOfBindingOrAssignmentElement(t);return !!a&&e.isBindingOrAssignmentPattern(a)&&(i=a,!!e.forEach(e.getElementsOfBindingOrAssignmentPattern(i),r))}function n(t,r,s,c,l){var u=e.getTargetOfBindingOrAssignmentElement(r);if(!l){var _=e.visitNode(e.getInitializerOfBindingOrAssignmentElement(r),t.visitor,e.isExpression);_?s?(s=function(e,t,r,n){return t=o(e,t,!0,n),e.context.factory.createConditionalExpression(e.context.factory.createTypeCheck(t,"undefined"),void 0,r,void 0,t)}(t,s,_,c),!e.isSimpleInlineableExpression(_)&&e.isBindingOrAssignmentPattern(u)&&(s=o(t,s,!0,c))):s=_:s||(s=t.context.factory.createVoidZero());}e.isObjectBindingOrAssignmentPattern(u)?function(t,r,i,s,c){var l,u,_=e.getElementsOfBindingOrAssignmentPattern(i),d=_.length;1!==d&&(s=o(t,s,!e.isDeclarationBindingElement(r)||0!==d,c));for(var p=0;p<d;p++){var f=_[p];if(e.getRestIndicatorOfBindingOrAssignmentElement(f))p===d-1&&(l&&(t.emitBindingOrAssignment(t.createObjectBindingOrAssignmentPattern(l),s,c,i),l=void 0),m=t.context.getEmitHelperFactory().createRestHelper(s,_,u,i),n(t,f,m,f));else {var g=e.getPropertyNameOfBindingOrAssignmentElement(f);if(!(t.level>=1)||49152&f.transformFlags||49152&e.getTargetOfBindingOrAssignmentElement(f).transformFlags||e.isComputedPropertyName(g)){l&&(t.emitBindingOrAssignment(t.createObjectBindingOrAssignmentPattern(l),s,c,i),l=void 0);var m=a(t,s,g);e.isComputedPropertyName(g)&&(u=e.append(u,m.argumentExpression)),n(t,f,m,f);}else l=e.append(l,e.visitNode(f,t.visitor));}}l&&t.emitBindingOrAssignment(t.createObjectBindingOrAssignmentPattern(l),s,c,i);}(t,r,u,s,c):e.isArrayBindingOrAssignmentPattern(u)?function(t,r,a,s,c){var l,u,_=e.getElementsOfBindingOrAssignmentPattern(a),d=_.length;t.level<1&&t.downlevelIteration?s=o(t,e.setTextRange(t.context.getEmitHelperFactory().createReadHelper(s,d>0&&e.getRestIndicatorOfBindingOrAssignmentElement(_[d-1])?void 0:d),c),!1,c):(1!==d&&(t.level<1||0===d)||e.every(_,e.isOmittedExpression))&&(s=o(t,s,!e.isDeclarationBindingElement(r)||0!==d,c));for(var p=0;p<d;p++){var f=_[p];if(t.level>=1)if(32768&f.transformFlags||t.hasTransformedPriorElement&&!i(f)){t.hasTransformedPriorElement=!0;var g=t.context.factory.createTempVariable(void 0);t.hoistTempVariables&&t.context.hoistVariableDeclaration(g),u=e.append(u,[g,f]),l=e.append(l,t.createArrayBindingOrAssignmentElement(g));}else l=e.append(l,f);else {if(e.isOmittedExpression(f))continue;if(e.getRestIndicatorOfBindingOrAssignmentElement(f))p===d-1&&(m=t.context.factory.createArraySliceCall(s,p),n(t,f,m,f));else {var m=t.context.factory.createElementAccessExpression(s,p);n(t,f,m,f);}}}if(l&&t.emitBindingOrAssignment(t.createArrayBindingOrAssignmentPattern(l),s,c,a),u)for(var y=0,v=u;y<v.length;y++){var h=v[y],b=h[0];n(t,f=h[1],b,f);}}(t,r,u,s,c):t.emitBindingOrAssignment(u,s,c,r);}function i(t){var r=e.getTargetOfBindingOrAssignmentElement(t);if(!r||e.isOmittedExpression(r))return !0;var n=e.tryGetPropertyNameOfBindingOrAssignmentElement(t);if(n&&!e.isPropertyNameLiteral(n))return !1;var a=e.getInitializerOfBindingOrAssignmentElement(t);return !(a&&!e.isSimpleInlineableExpression(a))&&(e.isBindingOrAssignmentPattern(r)?e.every(e.getElementsOfBindingOrAssignmentPattern(r),i):e.isIdentifier(r))}function a(t,r,n){if(e.isComputedPropertyName(n)){var i=o(t,e.visitNode(n.expression,t.visitor),!1,n);return t.context.factory.createElementAccessExpression(r,i)}if(e.isStringOrNumericLiteralLike(n))return i=e.factory.cloneNode(n),t.context.factory.createElementAccessExpression(r,i);var a=t.context.factory.createIdentifier(e.idText(n));return t.context.factory.createPropertyAccessExpression(r,a)}function o(t,r,n,i){if(e.isIdentifier(r)&&n)return r;var a=t.context.factory.createTempVariable(void 0);return t.hoistTempVariables?(t.context.hoistVariableDeclaration(a),t.emitExpression(e.setTextRange(t.context.factory.createAssignment(a,r),i))):t.emitBindingOrAssignment(a,r,i,void 0),a}function s(e){return e}var c;(c=e.FlattenLevel||(e.FlattenLevel={}))[c.All=0]="All",c[c.ObjectRest=1]="ObjectRest",e.flattenDestructuringAssignment=function(i,a,c,l,u,_){var d,p,f=i;if(e.isDestructuringAssignment(i))for(d=i.right;e.isEmptyArrayLiteral(i.left)||e.isEmptyObjectLiteral(i.left);){if(!e.isDestructuringAssignment(d))return e.visitNode(d,a,e.isExpression);f=i=d,d=i.right;}var g={context:c,level:l,downlevelIteration:!!c.getCompilerOptions().downlevelIteration,hoistTempVariables:!0,emitExpression:m,emitBindingOrAssignment:function(t,r,n,i){e.Debug.assertNode(t,_?e.isIdentifier:e.isExpression);var o=_?_(t,r,n):e.setTextRange(c.factory.createAssignment(e.visitNode(t,a,e.isExpression),r),n);o.original=i,m(o);},createArrayBindingOrAssignmentPattern:function(t){return function(t,r){return t.createArrayLiteralExpression(e.map(r,t.converters.convertToArrayAssignmentElement))}(c.factory,t)},createObjectBindingOrAssignmentPattern:function(t){return function(t,r){return t.createObjectLiteralExpression(e.map(r,t.converters.convertToObjectAssignmentElement))}(c.factory,t)},createArrayBindingOrAssignmentElement:s,visitor:a};if(d&&(d=e.visitNode(d,a,e.isExpression),e.isIdentifier(d)&&t(i,d.escapedText)||r(i)?d=o(g,d,!1,f):u?d=o(g,d,!0,f):e.nodeIsSynthesized(i)&&(f=d)),n(g,i,d,f,e.isDestructuringAssignment(i)),d&&u){if(!e.some(p))return d;p.push(d);}return c.factory.inlineExpressions(p)||c.factory.createOmittedExpression();function m(t){p=e.append(p,t);}},e.flattenDestructuringBinding=function(i,a,s,c,l,u,_){var d;void 0===u&&(u=!1);var p=[],f=[],g={context:s,level:c,downlevelIteration:!!s.getCompilerOptions().downlevelIteration,hoistTempVariables:u,emitExpression:function(t){d=e.append(d,t);},emitBindingOrAssignment:N,createArrayBindingOrAssignmentPattern:function(t){return function(t,r){return e.Debug.assertEachNode(r,e.isArrayBindingElement),t.createArrayBindingPattern(r)}(s.factory,t)},createObjectBindingOrAssignmentPattern:function(t){return function(t,r){return e.Debug.assertEachNode(r,e.isBindingElement),t.createObjectBindingPattern(r)}(s.factory,t)},createArrayBindingOrAssignmentElement:function(e){return function(e,t){return e.createBindingElement(void 0,void 0,t)}(s.factory,e)},visitor:a};if(e.isVariableDeclaration(i)){var m=e.getInitializerOfBindingOrAssignmentElement(i);m&&(e.isIdentifier(m)&&t(i,m.escapedText)||r(i))&&(m=o(g,e.visitNode(m,g.visitor),!1,m),i=s.factory.updateVariableDeclaration(i,i.name,void 0,void 0,m));}if(n(g,i,l,i,_),d){var y=s.factory.createTempVariable(void 0);if(u){var v=s.factory.inlineExpressions(d);d=void 0,N(y,v,void 0,void 0);}else {s.hoistVariableDeclaration(y);var h=e.last(p);h.pendingExpressions=e.append(h.pendingExpressions,s.factory.createAssignment(y,h.value)),e.addRange(h.pendingExpressions,d),h.value=y;}}for(var b=0,x=p;b<x.length;b++){var D=x[b],S=D.pendingExpressions,T=D.name,C=(v=D.value,D.location),k=D.original,E=s.factory.createVariableDeclaration(T,void 0,void 0,S?s.factory.inlineExpressions(e.append(S,v)):v);E.original=k,e.setTextRange(E,C),f.push(E);}return f;function N(t,r,n,i){e.Debug.assertNode(t,e.isBindingName),d&&(r=s.factory.inlineExpressions(e.append(d,r)),d=void 0),p.push({pendingExpressions:d,name:t,value:r,location:n,original:i});}};}(t),function(e){var t;function r(t){return t.templateFlags?e.factory.createVoidZero():e.factory.createStringLiteral(t.text)}function n(t,r){var n=t.rawText;if(void 0===n){e.Debug.assertIsDefined(r,"Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform."),n=e.getSourceTextOfNodeFromSourceFile(r,t);var i=14===t.kind||17===t.kind;n=n.substring(1,n.length-(i?1:2));}return n=n.replace(/\r\n?/g,"\n"),e.setTextRange(e.factory.createStringLiteral(n),t)}!function(e){e[e.LiftRestriction=0]="LiftRestriction",e[e.All=1]="All";}(t=e.ProcessLevel||(e.ProcessLevel={})),e.processTaggedTemplateExpression=function(i,a,o,s,c,l){var u=e.visitNode(a.tag,o,e.isExpression),_=[void 0],d=[],p=[],f=a.template;if(l===t.LiftRestriction&&!e.hasInvalidEscape(f))return e.visitEachChild(a,o,i);if(e.isNoSubstitutionTemplateLiteral(f))d.push(r(f)),p.push(n(f,s));else {d.push(r(f.head)),p.push(n(f.head,s));for(var g=0,m=f.templateSpans;g<m.length;g++){var y=m[g];d.push(r(y.literal)),p.push(n(y.literal,s)),_.push(e.visitNode(y.expression,o,e.isExpression));}}var v=i.getEmitHelperFactory().createTemplateObjectHelper(e.factory.createArrayLiteralExpression(d),e.factory.createArrayLiteralExpression(p));if(e.isExternalModule(s)){var h=e.factory.createUniqueName("templateObject");c(h),_[0]=e.factory.createLogicalOr(h,e.factory.createAssignment(h,v));}else _[0]=v;return e.factory.createCallExpression(u,void 0,_)};}(t),function(e){var t,r;!function(e){e[e.ClassAliases=1]="ClassAliases",e[e.NamespaceExports=2]="NamespaceExports",e[e.NonQualifiedEnumMembers=8]="NonQualifiedEnumMembers";}(t||(t={})),function(e){e[e.None=0]="None",e[e.HasStaticInitializedProperties=1]="HasStaticInitializedProperties",e[e.HasConstructorDecorators=2]="HasConstructorDecorators",e[e.HasMemberDecorators=4]="HasMemberDecorators",e[e.IsExportOfNamespace=8]="IsExportOfNamespace",e[e.IsNamedExternalExport=16]="IsNamedExternalExport",e[e.IsDefaultExternalExport=32]="IsDefaultExternalExport",e[e.IsDerivedClass=64]="IsDerivedClass",e[e.UseImmediatelyInvokedFunctionExpression=128]="UseImmediatelyInvokedFunctionExpression",e[e.HasAnyDecorators=6]="HasAnyDecorators",e[e.NeedsName=5]="NeedsName",e[e.MayNeedImmediatelyInvokedFunctionExpression=7]="MayNeedImmediatelyInvokedFunctionExpression",e[e.IsExported=56]="IsExported";}(r||(r={})),e.transformTypeScript=function(t){var r,i,a,o,s,c,l,u,_,d,p=t.factory,f=t.getEmitHelperFactory,g=t.startLexicalEnvironment,m=t.resumeLexicalEnvironment,y=t.endLexicalEnvironment,v=t.hoistVariableDeclaration,h=t.getEmitResolver(),b=t.getCompilerOptions(),x=e.getStrictOptionValue(b,"strictNullChecks"),D=e.getEmitScriptTarget(b),S=e.getEmitModuleKind(b),T=t.onEmitNode,C=t.onSubstituteNode;return t.onEmitNode=function(t,n,i){var a=d,o=r;e.isSourceFile(n)&&(r=n),2&u&&function(t){return 261===e.getOriginalNode(t).kind}(n)&&(d|=2),8&u&&function(t){return 260===e.getOriginalNode(t).kind}(n)&&(d|=8),T(t,n,i),d=a,r=o;},t.onSubstituteNode=function(t,r){return r=C(t,r),1===t?function(t){switch(t.kind){case 79:return function(t){return function(t){if(1&u&&33554432&h.getNodeCheckFlags(t)){var r=h.getReferencedValueDeclaration(t);if(r){var n=_[r.id];if(n){var i=p.cloneNode(n);return e.setSourceMapRange(i,t),e.setCommentRange(i,t),i}}}}(t)||we(t)||t}(t);case 206:case 207:return function(t){return function(t){var r=function(t){if(!b.isolatedModules)return e.isPropertyAccessExpression(t)||e.isElementAccessExpression(t)?h.getConstantValue(t):void 0}(t);if(void 0!==r){e.setConstantValue(t,r);var n="string"==typeof r?p.createStringLiteral(r):p.createNumericLiteral(r);if(!b.removeComments){var i=e.getOriginalNode(t,e.isAccessExpression);e.addSyntheticTrailingComment(n,3," ".concat(e.getTextOfNode(i).replace(/\*\//g,"*_/")," "));}return n}return t}(t)}(t)}return t}(r):e.isShorthandPropertyAssignment(r)?function(t){if(2&u){var r=t.name,n=we(r);if(n){if(t.objectAssignmentInitializer){var i=p.createAssignment(n,t.objectAssignmentInitializer);return e.setTextRange(p.createPropertyAssignment(r,i),t)}return e.setTextRange(p.createPropertyAssignment(r,n),t)}}return t}(r):r},t.enableSubstitution(206),t.enableSubstitution(207),function(t){return 306===t.kind?function(t){return p.createBundle(t.sourceFiles.map(k),e.mapDefined(t.prepends,(function(t){return 308===t.kind?e.createUnparsedSourceFile(t,"js"):t})))}(t):k(t)};function k(n){if(n.isDeclarationFile)return n;r=n;var i=E(n,B);return e.addEmitHelpers(i,t.readEmitHelpers()),r=void 0,i}function E(t,r){var n=o,i=s,a=c,u=l;!function(t){switch(t.kind){case 305:case 263:case 262:case 235:o=t,s=void 0,c=void 0;break;case 257:case 256:if(e.hasSyntacticModifier(t,2))break;t.name?pe(t):e.Debug.assert(257===t.kind||e.hasSyntacticModifier(t,512)),e.isClassDeclaration(t)&&(s=t);}}(t);var _=r(t);return o!==n&&(c=a),o=n,s=i,l=u,_}function N(e){return E(e,F)}function F(e){return 1&e.transformFlags?R(e):e}function A(e){return E(e,P)}function P(r){switch(r.kind){case 266:case 265:case 271:case 272:return function(r){if(e.getParseTreeNode(r)!==r)return 1&r.transformFlags?e.visitEachChild(r,N,t):r;switch(r.kind){case 266:return function(t){if(!t.importClause)return t;if(!t.importClause.isTypeOnly){var r=e.visitNode(t.importClause,ve,e.isImportClause);return r||1===b.importsNotUsedAsValues||2===b.importsNotUsedAsValues?p.updateImportDeclaration(t,void 0,void 0,r,t.moduleSpecifier,t.assertClause):void 0}}(r);case 265:return De(r);case 271:return function(r){return h.isValueAliasDeclaration(r)?e.visitEachChild(r,N,t):void 0}(r);case 272:return function(t){if(!t.isTypeOnly){if(!t.exportClause||e.isNamespaceExport(t.exportClause))return t;var r=!!t.moduleSpecifier&&(1===b.importsNotUsedAsValues||2===b.importsNotUsedAsValues),n=e.visitNode(t.exportClause,(function(t){return function(t,r){return e.isNamespaceExport(t)?function(t){return p.updateNamespaceExport(t,e.visitNode(t.name,N,e.isIdentifier))}(t):function(t,r){var n=e.visitNodes(t.elements,xe,e.isExportSpecifier);return r||e.some(n)?p.updateNamedExports(t,n):void 0}(t,r)}(t,r)}),e.isNamedExportBindings);return n?p.updateExportDeclaration(t,void 0,void 0,t.isTypeOnly,n,t.moduleSpecifier,t.assertClause):void 0}}(r);default:e.Debug.fail("Unhandled ellided statement");}}(r);default:return F(r)}}function w(e){return E(e,I)}function I(t){if(272!==t.kind&&266!==t.kind&&267!==t.kind&&(265!==t.kind||277!==t.moduleReference.kind))return 1&t.transformFlags||e.hasSyntacticModifier(t,1)?R(t):t}function O(e){return E(e,M)}function M(t){switch(t.kind){case 171:return se(t);case 167:return oe(t);case 176:case 172:case 173:case 169:case 170:return F(t);case 234:return t;default:return e.Debug.failBadSyntaxKind(t)}}function L(t){if(!(116958&e.modifierToFlag(t.kind)||i&&93===t.kind))return t}function R(n){if(e.isStatement(n)&&e.hasSyntacticModifier(n,2))return p.createNotEmittedStatement(n);switch(n.kind){case 93:case 88:return i?void 0:n;case 123:case 121:case 122:case 126:case 159:case 85:case 135:case 145:case 101:case 144:case 183:case 184:case 185:case 186:case 182:case 177:case 163:case 130:case 155:case 133:case 150:case 147:case 143:case 114:case 151:case 180:case 179:case 181:case 178:case 187:case 188:case 189:case 191:case 192:case 193:case 194:case 195:case 196:case 176:case 165:return;case 259:return p.createNotEmittedStatement(n);case 167:return oe(n);case 264:return;case 171:return se(n);case 258:return p.createNotEmittedStatement(n);case 257:return function(n){if(!(J(n)||i&&e.hasSyntacticModifier(n,1)))return e.visitEachChild(n,N,t);var a=function(t,r){var n=0;e.some(r)&&(n|=1);var i=e.getEffectiveBaseTypeNode(t);return i&&104!==e.skipOuterExpressions(i.expression).kind&&(n|=64),e.classOrConstructorParameterIsDecorated(t)&&(n|=2),e.childIsDecorated(t)&&(n|=4),Se(t)?n|=8:function(t){return Te(t)&&e.hasSyntacticModifier(t,512)}(t)?n|=32:Ce(t)&&(n|=16),D<=1&&7&n&&(n|=128),n}(n,e.getProperties(n,!0,!0));128&a&&t.startLexicalEnvironment();var o=n.name||(5&a?p.getGeneratedNameForNode(n):void 0),s=2&a?function(r,n){var i=e.moveRangePastDecorators(r),a=function(r){if(16777216&h.getNodeCheckFlags(r)){0==(1&u)&&(u|=1,t.enableSubstitution(79),_=[]);var n=p.createUniqueName(r.name&&!e.isGeneratedIdentifier(r.name)?e.idText(r.name):"default");return _[e.getOriginalNodeId(r)]=n,v(n),n}}(r),o=D<=2?p.getInternalName(r,!1,!0):p.getLocalName(r,!1,!0),s=e.visitNodes(r.heritageClauses,N,e.isHeritageClause),c=z(r),l=p.createClassExpression(void 0,void 0,n,void 0,s,c);e.setOriginalNode(l,r),e.setTextRange(l,i);var d=p.createVariableStatement(void 0,p.createVariableDeclarationList([p.createVariableDeclaration(o,void 0,void 0,a?p.createAssignment(a,l):l)],1));return e.setOriginalNode(d,r),e.setTextRange(d,i),e.setCommentRange(d,r),d}(n,o):function(t,r,n){var i=128&n?void 0:e.visitNodes(t.modifiers,L,e.isModifier),a=p.createClassDeclaration(void 0,i,r,void 0,e.visitNodes(t.heritageClauses,N,e.isHeritageClause),z(t)),o=e.getEmitFlags(t);return 1&n&&(o|=32),e.setTextRange(a,t),e.setOriginalNode(a,t),e.setEmitFlags(a,o),a}(n,o,a),c=[s];if(q(c,n,!1),q(c,n,!0),function(t,r){var n=function(t){var r=V(t,t,function(t){var r=t.decorators,n=U(e.getFirstConstructorWithBody(t));if(r||n)return {decorators:r,parameters:n}}(t));if(r){var n=_&&_[e.getOriginalNodeId(t)],i=D<=2?p.getInternalName(t,!1,!0):p.getLocalName(t,!1,!0),a=f().createDecorateHelper(r,i),o=p.createAssignment(i,n?p.createAssignment(n,a):a);return e.setEmitFlags(o,1536),e.setSourceMapRange(o,e.moveRangePastDecorators(t)),o}}(r);n&&t.push(e.setOriginalNode(p.createExpressionStatement(n),r));}(c,n),128&a){var l=e.createTokenRange(e.skipTrivia(r.text,n.members.end),19),d=p.getInternalName(n),g=p.createPartiallyEmittedExpression(d);e.setTextRangeEnd(g,l.end),e.setEmitFlags(g,1536);var m=p.createReturnStatement(g);e.setTextRangePos(m,l.pos),e.setEmitFlags(m,1920),c.push(m),e.insertStatementsAfterStandardPrologue(c,t.endLexicalEnvironment());var y=p.createImmediatelyInvokedArrowFunction(c);e.setEmitFlags(y,33554432);var b=p.createVariableStatement(void 0,p.createVariableDeclarationList([p.createVariableDeclaration(p.getLocalName(n,!1,!1),void 0,void 0,y)]));e.setOriginalNode(b,n),e.setCommentRange(b,n),e.setSourceMapRange(b,e.moveRangePastDecorators(n)),e.startOnNewLine(b),c=[b];}return 8&a?Ee(c,n):(128&a||2&a)&&(32&a?c.push(p.createExportDefault(p.getLocalName(n,!1,!0))):16&a&&c.push(p.createExternalModuleExport(p.getLocalName(n,!1,!0)))),c.length>1&&(c.push(p.createEndOfDeclarationMarker(n)),e.setEmitFlags(s,4194304|e.getEmitFlags(s))),e.singleOrMany(c)}(n);case 226:return function(r){if(!J(r))return e.visitEachChild(r,N,t);var n=p.createClassExpression(void 0,void 0,r.name,void 0,e.visitNodes(r.heritageClauses,N,e.isHeritageClause),z(r));return e.setOriginalNode(n,r),e.setTextRange(n,r),n}(n);case 291:return function(r){if(117!==r.token)return e.visitEachChild(r,N,t)}(n);case 228:return function(t){return p.updateExpressionWithTypeArguments(t,e.visitNode(t.expression,N,e.isLeftHandSideExpression),void 0)}(n);case 169:return function(r){if(ae(r)){var n=p.updateMethodDeclaration(r,void 0,e.visitNodes(r.modifiers,L,e.isModifier),r.asteriskToken,ie(r),void 0,void 0,e.visitParameterList(r.parameters,N,t),void 0,e.visitFunctionBody(r.body,N,t));return n!==r&&(e.setCommentRange(n,r),e.setSourceMapRange(n,e.moveRangePastDecorators(r))),n}}(n);case 172:return function(r){if(le(r)){var n=p.updateGetAccessorDeclaration(r,void 0,e.visitNodes(r.modifiers,L,e.isModifier),ie(r),e.visitParameterList(r.parameters,N,t),void 0,e.visitFunctionBody(r.body,N,t)||p.createBlock([]));return n!==r&&(e.setCommentRange(n,r),e.setSourceMapRange(n,e.moveRangePastDecorators(r))),n}}(n);case 173:return function(r){if(le(r)){var n=p.updateSetAccessorDeclaration(r,void 0,e.visitNodes(r.modifiers,L,e.isModifier),ie(r),e.visitParameterList(r.parameters,N,t),e.visitFunctionBody(r.body,N,t)||p.createBlock([]));return n!==r&&(e.setCommentRange(n,r),e.setSourceMapRange(n,e.moveRangePastDecorators(r))),n}}(n);case 256:return function(r){if(!ae(r))return p.createNotEmittedStatement(r);var n=p.updateFunctionDeclaration(r,void 0,e.visitNodes(r.modifiers,L,e.isModifier),r.asteriskToken,r.name,void 0,e.visitParameterList(r.parameters,N,t),void 0,e.visitFunctionBody(r.body,N,t)||p.createBlock([]));if(Se(r)){var i=[n];return Ee(i,r),i}return n}(n);case 213:return function(r){return ae(r)?p.updateFunctionExpression(r,e.visitNodes(r.modifiers,L,e.isModifier),r.asteriskToken,r.name,void 0,e.visitParameterList(r.parameters,N,t),void 0,e.visitFunctionBody(r.body,N,t)||p.createBlock([])):p.createOmittedExpression()}(n);case 214:return function(r){return p.updateArrowFunction(r,e.visitNodes(r.modifiers,L,e.isModifier),void 0,e.visitParameterList(r.parameters,N,t),void 0,r.equalsGreaterThanToken,e.visitFunctionBody(r.body,N,t))}(n);case 164:return function(t){if(!e.parameterIsThisKeyword(t)){var r=p.updateParameterDeclaration(t,void 0,void 0,t.dotDotDotToken,e.visitNode(t.name,N,e.isBindingName),void 0,void 0,e.visitNode(t.initializer,N,e.isExpression));return r!==t&&(e.setCommentRange(r,t),e.setTextRange(r,e.moveRangePastModifiers(t)),e.setSourceMapRange(r,e.moveRangePastModifiers(t)),e.setEmitFlags(r.name,32)),r}}(n);case 212:return function(r){var n=e.skipOuterExpressions(r.expression,-7);if(e.isAssertionExpression(n)){var i=e.visitNode(r.expression,N,e.isExpression);return p.createPartiallyEmittedExpression(i,r)}return e.visitEachChild(r,N,t)}(n);case 211:case 229:return function(t){var r=e.visitNode(t.expression,N,e.isExpression);return p.createPartiallyEmittedExpression(r,t)}(n);case 208:return function(t){return p.updateCallExpression(t,e.visitNode(t.expression,N,e.isExpression),void 0,e.visitNodes(t.arguments,N,e.isExpression))}(n);case 209:return function(t){return p.updateNewExpression(t,e.visitNode(t.expression,N,e.isExpression),void 0,e.visitNodes(t.arguments,N,e.isExpression))}(n);case 210:return function(t){return p.updateTaggedTemplateExpression(t,e.visitNode(t.tag,N,e.isExpression),void 0,e.visitNode(t.template,N,e.isExpression))}(n);case 230:return function(t){var r=e.visitNode(t.expression,N,e.isLeftHandSideExpression);return p.createPartiallyEmittedExpression(r,t)}(n);case 260:return function(t){if(!function(t){return !e.isEnumConst(t)||e.shouldPreserveConstEnums(b)}(t))return p.createNotEmittedStatement(t);var n=[],i=2,s=ge(n,t);s&&(S===e.ModuleKind.System&&o===r||(i|=512));var c=Ae(t),l=Pe(t),u=e.hasSyntacticModifier(t,1)?p.getExternalModuleOrNamespaceExportName(a,t,!1,!0):p.getLocalName(t,!1,!0),_=p.createLogicalOr(u,p.createAssignment(u,p.createObjectLiteralExpression()));if(de(t)){var d=p.getLocalName(t,!1,!0);_=p.createAssignment(d,_);}var f=p.createExpressionStatement(p.createCallExpression(p.createFunctionExpression(void 0,void 0,void 0,void 0,[p.createParameterDeclaration(void 0,void 0,void 0,c)],void 0,function(t,r){var n=a;a=r;var i=[];g();var o=e.map(t.members,_e);return e.insertStatementsAfterStandardPrologue(i,y()),e.addRange(i,o),a=n,p.createBlock(e.setTextRange(p.createNodeArray(i),t.members),!0)}(t,l)),void 0,[_]));return e.setOriginalNode(f,t),s&&(e.setSyntheticLeadingComments(f,void 0),e.setSyntheticTrailingComments(f,void 0)),e.setTextRange(f,t),e.addEmitFlags(f,i),n.push(f),n.push(p.createEndOfDeclarationMarker(t)),n}(n);case 237:return function(r){if(Se(r)){var n=e.getInitializedVariables(r.declarationList);if(0===n.length)return;return e.setTextRange(p.createExpressionStatement(p.inlineExpressions(e.map(n,ue))),r)}return e.visitEachChild(r,N,t)}(n);case 254:return function(t){var r=p.updateVariableDeclaration(t,e.visitNode(t.name,N,e.isBindingName),void 0,void 0,e.visitNode(t.initializer,N,e.isExpression));return t.type&&e.setTypeNode(r.name,t.type),r}(n);case 261:return me(n);case 265:return De(n);case 279:return function(t){return p.updateJsxSelfClosingElement(t,e.visitNode(t.tagName,N,e.isJsxTagNameExpression),void 0,e.visitNode(t.attributes,N,e.isJsxAttributes))}(n);case 280:return function(t){return p.updateJsxOpeningElement(t,e.visitNode(t.tagName,N,e.isJsxTagNameExpression),void 0,e.visitNode(t.attributes,N,e.isJsxAttributes))}(n);default:return e.visitEachChild(n,N,t)}}function B(r){var n=e.getStrictOptionValue(b,"alwaysStrict")&&!(e.isExternalModule(r)&&S>=e.ModuleKind.ES2015)&&!e.isJsonSourceFile(r);return p.updateSourceFile(r,e.visitLexicalEnvironment(r.statements,A,t,0,n))}function j(e){return !!(4096&e.transformFlags)}function J(t){return e.some(t.decorators)||e.some(t.typeParameters)||e.some(t.heritageClauses,j)||e.some(t.members,j)}function z(t){var r=[],n=e.getFirstConstructorWithBody(t),i=n&&e.filter(n.parameters,(function(t){return e.isParameterPropertyDeclaration(t,n)}));if(i)for(var a=0,o=i;a<o.length;a++){var s=o[a];e.isIdentifier(s.name)&&r.push(e.setOriginalNode(p.createPropertyDeclaration(void 0,void 0,s.name,void 0,void 0,void 0),s));}return e.addRange(r,e.visitNodes(t.members,O,e.isClassElement)),e.setTextRange(p.createNodeArray(r),t.members)}function K(t,r,n){return e.nodeOrChildIsDecorated(t,n)&&r===e.isStatic(t)}function U(t){var r;if(t)for(var n=t.parameters,i=n.length>0&&e.parameterIsThisKeyword(n[0]),a=i?1:0,o=i?n.length-1:n.length,s=0;s<o;s++){var c=n[s+a];(r||c.decorators)&&(r||(r=new Array(o)),r[s]=c.decorators);}return r}function V(t,r,n){if(n){var i=[];return e.addRange(i,e.map(n.decorators,H)),e.addRange(i,e.flatMap(n.parameters,G)),function(t,r,n){!function(t,r,n){b.emitDecoratorMetadata&&(function(e){var t=e.kind;return 169===t||172===t||173===t||167===t}(t)&&n.push(f().createMetadataHelper("design:type",Q(t))),function(t){switch(t.kind){case 257:case 226:return void 0!==e.getFirstConstructorWithBody(t);case 169:case 172:case 173:return !0}return !1}(t)&&n.push(f().createMetadataHelper("design:paramtypes",function(t,r){var n=e.isClassLike(t)?e.getFirstConstructorWithBody(t):e.isFunctionLike(t)&&e.nodeIsPresent(t.body)?t:void 0,i=[];if(n)for(var a=function(t,r){if(r&&172===t.kind){var n=e.getAllAccessorDeclarations(r.members,t).setAccessor;if(n)return n.parameters}return t.parameters}(n,r),o=a.length,s=0;s<o;s++){var c=a[s];0===s&&e.isIdentifier(c.name)&&"this"===c.name.escapedText||(c.dotDotDotToken?i.push(X(e.getRestParameterElementType(c.type))):i.push(Q(c)));}return p.createArrayLiteralExpression(i)}(t,r))),function(e){return 169===e.kind}(t)&&n.push(f().createMetadataHelper("design:returntype",function(t){return e.isFunctionLike(t)&&t.type?X(t.type):e.isAsyncFunction(t)?p.createIdentifier("Promise"):p.createVoidZero()}(t))));}(t,r,n);}(t,r,i),i}}function q(t,r,n){e.addRange(t,e.map(function(t,r){for(var n,i=0,a=function(t,r){return e.filter(t.members,r?function(e){return K(e,!0,t)}:function(e){return K(e,!1,t)})}(t,r);i<a.length;i++){var o=W(t,a[i]);o&&(n?n.push(o):n=[o]);}return n}(r,n),ke));}function W(t,r){var n=V(r,t,function(t,r){switch(r.kind){case 172:case 173:return function(t,r){if(r.body){var n=e.getAllAccessorDeclarations(t.members,r),i=n.firstAccessor,a=n.secondAccessor,o=n.setAccessor,s=i.decorators?i:a&&a.decorators?a:void 0;if(s&&r===s){var c=s.decorators,l=U(o);if(c||l)return {decorators:c,parameters:l}}}}(t,r);case 169:return function(e){if(e.body){var t=e.decorators,r=U(e);if(t||r)return {decorators:t,parameters:r}}}(r);case 167:return function(e){var t=e.decorators;if(t)return {decorators:t}}(r);default:return}}(t,r));if(n){var i=function(t,r){return e.isStatic(r)?p.getDeclarationName(t):function(e){return p.createPropertyAccessExpression(p.getDeclarationName(e),"prototype")}(t)}(t,r),a=ne(r,!e.hasSyntacticModifier(r,2)),o=D>0?167===r.kind?p.createVoidZero():p.createNull():void 0,s=f().createDecorateHelper(n,i,a,o);return e.setTextRange(s,e.moveRangePastDecorators(r)),e.setEmitFlags(s,1536),s}}function H(t){return e.visitNode(t.expression,N,e.isExpression)}function G(t,r){var n;if(t){n=[];for(var i=0,a=t;i<a.length;i++){var o=a[i],s=f().createParamHelper(H(o),r);e.setTextRange(s,o.expression),e.setEmitFlags(s,1536),n.push(s);}}return n}function Q(t){switch(t.kind){case 167:case 164:return X(t.type);case 173:case 172:return X(function(t){var r=h.getAllAccessorDeclarations(t);return r.setAccessor&&e.getSetAccessorTypeAnnotationNode(r.setAccessor)||r.getAccessor&&e.getEffectiveReturnTypeNode(r.getAccessor)}(t));case 257:case 226:case 169:return p.createIdentifier("Function");default:return p.createVoidZero()}}function X(t){if(void 0===t)return p.createIdentifier("Object");switch(t.kind){case 114:case 153:case 143:return p.createVoidZero();case 191:return X(t.type);case 179:case 180:return p.createIdentifier("Function");case 183:case 184:return p.createIdentifier("Array");case 177:case 133:return p.createIdentifier("Boolean");case 198:case 150:return p.createIdentifier("String");case 148:return p.createIdentifier("Object");case 196:switch(t.literal.kind){case 10:case 14:return p.createIdentifier("String");case 219:case 8:return p.createIdentifier("Number");case 9:return re();case 110:case 95:return p.createIdentifier("Boolean");case 104:return p.createVoidZero();default:return e.Debug.failBadSyntaxKind(t.literal)}case 147:return p.createIdentifier("Number");case 158:return re();case 151:return D<2?te():p.createIdentifier("Symbol");case 178:return function(t){var r=h.getTypeReferenceSerializationKind(t.typeName,s||o);switch(r){case e.TypeReferenceSerializationKind.Unknown:if(e.findAncestor(t,(function(t){return t.parent&&e.isConditionalTypeNode(t.parent)&&(t.parent.trueType===t||t.parent.falseType===t)})))return p.createIdentifier("Object");var n=$(t.typeName),i=p.createTempVariable(v);return p.createConditionalExpression(p.createTypeCheck(p.createAssignment(i,n),"function"),void 0,i,void 0,p.createIdentifier("Object"));case e.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:return ee(t.typeName);case e.TypeReferenceSerializationKind.VoidNullableOrNeverType:return p.createVoidZero();case e.TypeReferenceSerializationKind.BigIntLikeType:return re();case e.TypeReferenceSerializationKind.BooleanType:return p.createIdentifier("Boolean");case e.TypeReferenceSerializationKind.NumberLikeType:return p.createIdentifier("Number");case e.TypeReferenceSerializationKind.StringLikeType:return p.createIdentifier("String");case e.TypeReferenceSerializationKind.ArrayLikeType:return p.createIdentifier("Array");case e.TypeReferenceSerializationKind.ESSymbolType:return D<2?te():p.createIdentifier("Symbol");case e.TypeReferenceSerializationKind.TypeWithCallSignature:return p.createIdentifier("Function");case e.TypeReferenceSerializationKind.Promise:return p.createIdentifier("Promise");case e.TypeReferenceSerializationKind.ObjectType:return p.createIdentifier("Object");default:return e.Debug.assertNever(r)}}(t);case 188:case 187:return Y(t.types);case 189:return Y([t.trueType,t.falseType]);case 193:if(145===t.operator)return X(t.type);break;case 181:case 194:case 195:case 182:case 130:case 155:case 192:case 200:break;case 312:case 313:case 317:case 318:case 319:break;case 314:case 315:case 316:return X(t.type);default:return e.Debug.failBadSyntaxKind(t)}return p.createIdentifier("Object")}function Y(t){for(var r,n=0,i=t;n<i.length;n++){for(var a=i[n];191===a.kind;)a=a.type;if(143!==a.kind&&(x||(196!==a.kind||104!==a.literal.kind)&&153!==a.kind)){var o=X(a);if(e.isIdentifier(o)&&"Object"===o.escapedText)return o;if(r){if(!e.isIdentifier(r)||!e.isIdentifier(o)||r.escapedText!==o.escapedText)return p.createIdentifier("Object")}else r=o;}}return r||p.createVoidZero()}function Z(e,t){return p.createLogicalAnd(p.createStrictInequality(p.createTypeOfExpression(e),p.createStringLiteral("undefined")),t)}function $(e){if(79===e.kind){var t=ee(e);return Z(t,t)}if(79===e.left.kind)return Z(ee(e.left),ee(e));var r=$(e.left),n=p.createTempVariable(v);return p.createLogicalAnd(p.createLogicalAnd(r.left,p.createStrictInequality(p.createAssignment(n,r.right),p.createVoidZero())),p.createPropertyAccessExpression(n,e.right))}function ee(t){switch(t.kind){case 79:var r=e.setParent(e.setTextRange(e.parseNodeFactory.cloneNode(t),t),t.parent);return r.original=void 0,e.setParent(r,e.getParseTreeNode(o)),r;case 161:return function(e){return p.createPropertyAccessExpression(ee(e.left),e.right)}(t)}}function te(){return p.createConditionalExpression(p.createTypeCheck(p.createIdentifier("Symbol"),"function"),void 0,p.createIdentifier("Symbol"),void 0,p.createIdentifier("Object"))}function re(){return D<99?p.createConditionalExpression(p.createTypeCheck(p.createIdentifier("BigInt"),"function"),void 0,p.createIdentifier("BigInt"),void 0,p.createIdentifier("Object")):p.createIdentifier("BigInt")}function ne(t,r){var n=t.name;return e.isPrivateIdentifier(n)?p.createIdentifier(""):e.isComputedPropertyName(n)?r&&!e.isSimpleInlineableExpression(n.expression)?p.getGeneratedNameForNode(n):n.expression:e.isIdentifier(n)?p.createStringLiteral(e.idText(n)):p.cloneNode(n)}function ie(t){var r=t.name;if(e.isComputedPropertyName(r)&&(!e.hasStaticModifier(t)&&l||e.some(t.decorators))){var n=e.visitNode(r.expression,N,e.isExpression),i=e.skipPartiallyEmittedExpressions(n);if(!e.isSimpleInlineableExpression(i)){var a=p.getGeneratedNameForNode(r);return v(a),p.updateComputedPropertyName(r,p.createAssignment(a,n))}}return e.visitNode(r,N,e.isPropertyName)}function ae(t){return !e.nodeIsMissing(t.body)}function oe(t){if(!(16777216&t.flags||e.hasSyntacticModifier(t,128))){var r=p.updatePropertyDeclaration(t,void 0,e.visitNodes(t.modifiers,N,e.isModifier),ie(t),void 0,void 0,e.visitNode(t.initializer,N));return r!==t&&(e.setCommentRange(r,t),e.setSourceMapRange(r,e.moveRangePastDecorators(t))),r}}function se(r){if(ae(r))return p.updateConstructorDeclaration(r,void 0,void 0,e.visitParameterList(r.parameters,N,t),function(r,i){var a=i&&e.filter(i.parameters,(function(t){return e.isParameterPropertyDeclaration(t,i)}));if(!e.some(a))return e.visitFunctionBody(r,N,t);var o=[];m();var s=p.copyPrologue(r.statements,o,!1,N),c=e.findSuperStatementIndex(r.statements,s);c>=0&&e.addRange(o,e.visitNodes(r.statements,N,e.isStatement,s,c+1-s));var l=e.mapDefined(a,ce);c>=0?e.addRange(o,l):o=n$4(n$4(n$4([],o.slice(0,s),!0),l,!0),o.slice(s),!0),e.addRange(o,e.visitNodes(r.statements,N,e.isStatement,c+1+s)),o=p.mergeLexicalEnvironment(o,y());var u=p.createBlock(e.setTextRange(p.createNodeArray(o),r.statements),!0);return e.setTextRange(u,r),e.setOriginalNode(u,r),u}(r.body,r))}function ce(t){var r=t.name;if(e.isIdentifier(r)){var n=e.setParent(e.setTextRange(p.cloneNode(r),r),r.parent);e.setEmitFlags(n,1584);var i=e.setParent(e.setTextRange(p.cloneNode(r),r),r.parent);return e.setEmitFlags(i,1536),e.startOnNewLine(e.removeAllComments(e.setTextRange(e.setOriginalNode(p.createExpressionStatement(p.createAssignment(e.setTextRange(p.createPropertyAccessExpression(p.createThis(),n),t.name),i)),t),e.moveRangePos(t,-1))))}}function le(t){return !(e.nodeIsMissing(t.body)&&e.hasSyntacticModifier(t,128))}function ue(r){var n=r.name;return e.isBindingPattern(n)?e.flattenDestructuringAssignment(r,N,t,0,!1,Ne):e.setTextRange(p.createAssignment(Fe(n),e.visitNode(r.initializer,N,e.isExpression)),r)}function _e(r){var n=ne(r,!1),i=function(r){var n=h.getConstantValue(r);return void 0!==n?"string"==typeof n?p.createStringLiteral(n):p.createNumericLiteral(n):(0==(8&u)&&(u|=8,t.enableSubstitution(79)),r.initializer?e.visitNode(r.initializer,N,e.isExpression):p.createVoidZero())}(r),o=p.createAssignment(p.createElementAccessExpression(a,n),i),s=10===i.kind?o:p.createAssignment(p.createElementAccessExpression(a,o),n);return e.setTextRange(p.createExpressionStatement(e.setTextRange(s,r)),r)}function de(t){return Se(t)||Te(t)&&S!==e.ModuleKind.ES2015&&S!==e.ModuleKind.ES2020&&S!==e.ModuleKind.ES2022&&S!==e.ModuleKind.ESNext&&S!==e.ModuleKind.System}function pe(t){c||(c=new e.Map);var r=fe(t);c.has(r)||c.set(r,t);}function fe(t){return e.Debug.assertNode(t.name,e.isIdentifier),t.name.escapedText}function ge(t,r){var n=p.createVariableStatement(e.visitNodes(r.modifiers,L,e.isModifier),p.createVariableDeclarationList([p.createVariableDeclaration(p.getLocalName(r,!1,!0))],305===o.kind?0:1));if(e.setOriginalNode(n,r),pe(r),function(e){if(c){var t=fe(e);return c.get(t)===e}return !0}(r))return 260===r.kind?e.setSourceMapRange(n.declarationList,r):e.setSourceMapRange(n,r),e.setCommentRange(n,r),e.addEmitFlags(n,4195328),t.push(n),!0;var i=p.createMergeDeclarationMarker(n);return e.setEmitFlags(i,4195840),t.push(i),!1}function me(n){if(!function(t){var r=e.getParseTreeNode(t,e.isModuleDeclaration);return !r||e.isInstantiatedModule(r,e.shouldPreserveConstEnums(b))}(n))return p.createNotEmittedStatement(n);e.Debug.assertNode(n.name,e.isIdentifier,"A TypeScript namespace should have an Identifier name."),0==(2&u)&&(u|=2,t.enableSubstitution(79),t.enableSubstitution(297),t.enableEmitNotification(261));var s=[],l=2,_=ge(s,n);_&&(S===e.ModuleKind.System&&o===r||(l|=512));var d=Ae(n),f=Pe(n),m=e.hasSyntacticModifier(n,1)?p.getExternalModuleOrNamespaceExportName(a,n,!1,!0):p.getLocalName(n,!1,!0),v=p.createLogicalOr(m,p.createAssignment(m,p.createObjectLiteralExpression()));if(de(n)){var h=p.getLocalName(n,!1,!0);v=p.createAssignment(h,v);}var x=p.createExpressionStatement(p.createCallExpression(p.createFunctionExpression(void 0,void 0,void 0,void 0,[p.createParameterDeclaration(void 0,void 0,void 0,d)],void 0,function(t,r){var n=a,o=i,s=c;a=r,i=t,c=void 0;var l,u,_=[];if(g(),t.body)if(262===t.body.kind)E(t.body,(function(t){return e.addRange(_,e.visitNodes(t.statements,w,e.isStatement))})),l=t.body.statements,u=t.body;else {var d=me(t.body);d&&(e.isArray(d)?e.addRange(_,d):_.push(d));var f=ye(t).body;l=e.moveRangePos(f.statements,-1);}e.insertStatementsAfterStandardPrologue(_,y()),a=n,i=o,c=s;var m=p.createBlock(e.setTextRange(p.createNodeArray(_),l),!0);return e.setTextRange(m,u),t.body&&262===t.body.kind||e.setEmitFlags(m,1536|e.getEmitFlags(m)),m}(n,f)),void 0,[v]));return e.setOriginalNode(x,n),_&&(e.setSyntheticLeadingComments(x,void 0),e.setSyntheticTrailingComments(x,void 0)),e.setTextRange(x,n),e.addEmitFlags(x,l),s.push(x),s.push(p.createEndOfDeclarationMarker(n)),s}function ye(e){if(261===e.body.kind)return ye(e.body)||e.body}function ve(t){e.Debug.assert(!t.isTypeOnly);var r=Ie(t)?t.name:void 0,n=e.visitNode(t.namedBindings,he,e.isNamedImportBindings);return r||n?p.updateImportClause(t,!1,r,n):void 0}function he(t){if(268===t.kind)return Ie(t)?t:void 0;var r=b.preserveValueImports&&(1===b.importsNotUsedAsValues||2===b.importsNotUsedAsValues),n=e.visitNodes(t.elements,be,e.isImportSpecifier);return r||e.some(n)?p.updateNamedImports(t,n):void 0}function be(e){return !e.isTypeOnly&&Ie(e)?e:void 0}function xe(e){return !e.isTypeOnly&&h.isValueAliasDeclaration(e)?e:void 0}function De(n){if(!n.isTypeOnly){if(e.isExternalModuleImportEqualsDeclaration(n)){var i=Ie(n);return i||1!==b.importsNotUsedAsValues?i?e.visitEachChild(n,N,t):void 0:e.setOriginalNode(e.setTextRange(p.createImportDeclaration(void 0,void 0,void 0,n.moduleReference.expression,void 0),n),n)}if(function(t){return Ie(t)||!e.isExternalModule(r)&&h.isTopLevelValueImportEqualsWithEntityName(t)}(n)){var o,s,c,l=e.createExpressionFromEntityName(p,n.moduleReference);return e.setEmitFlags(l,3584),Ce(n)||!Se(n)?e.setOriginalNode(e.setTextRange(p.createVariableStatement(e.visitNodes(n.modifiers,L,e.isModifier),p.createVariableDeclarationList([e.setOriginalNode(p.createVariableDeclaration(n.name,void 0,void 0,l),n)])),n),n):e.setOriginalNode((o=n.name,s=l,c=n,e.setTextRange(p.createExpressionStatement(p.createAssignment(p.getNamespaceMemberName(a,o,!1,!0),s)),c)),n)}}}function Se(t){return void 0!==i&&e.hasSyntacticModifier(t,1)}function Te(t){return void 0===i&&e.hasSyntacticModifier(t,1)}function Ce(t){return Te(t)&&!e.hasSyntacticModifier(t,512)}function ke(e){return p.createExpressionStatement(e)}function Ee(t,r){var n=p.createAssignment(p.getExternalModuleOrNamespaceExportName(a,r,!1,!0),p.getLocalName(r));e.setSourceMapRange(n,e.createRange(r.name?r.name.pos:r.pos,r.end));var i=p.createExpressionStatement(n);e.setSourceMapRange(i,e.createRange(-1,r.end)),t.push(i);}function Ne(t,r,n){return e.setTextRange(p.createAssignment(Fe(t),r),n)}function Fe(e){return p.getNamespaceMemberName(a,e,!1,!0)}function Ae(t){var r=p.getGeneratedNameForNode(t);return e.setSourceMapRange(r,t.name),r}function Pe(e){return p.getGeneratedNameForNode(e)}function we(t){if(u&d&&!e.isGeneratedIdentifier(t)&&!e.isLocalName(t)){var r=h.getReferencedExportContainer(t,!1);if(r&&305!==r.kind&&(2&d&&261===r.kind||8&d&&260===r.kind))return e.setTextRange(p.createPropertyAccessExpression(p.getGeneratedNameForNode(r),t),t)}}function Ie(e){return b.preserveValueImports?h.isValueAliasDeclaration(e):h.isReferencedAliasDeclaration(e)}};}(t),function(e){var t,r,i;!function(e){e[e.ClassAliases=1]="ClassAliases",e[e.ClassStaticThisOrSuperReference=2]="ClassStaticThisOrSuperReference";}(t||(t={})),(i=e.PrivateIdentifierKind||(e.PrivateIdentifierKind={})).Field="f",i.Method="m",i.Accessor="a",function(e){e[e.None=0]="None",e[e.ClassWasDecorated=1]="ClassWasDecorated",e[e.NeedsClassConstructorReference=2]="NeedsClassConstructorReference",e[e.NeedsClassSuperReference=4]="NeedsClassSuperReference",e[e.NeedsSubstitutionForThisInClassStaticField=8]="NeedsSubstitutionForThisInClassStaticField";}(r||(r={})),e.transformClassFields=function(t){var r=t.factory,i=t.hoistVariableDeclaration,a=t.endLexicalEnvironment,o=t.startLexicalEnvironment,s=t.resumeLexicalEnvironment,c=t.addBlockScopedVariable,l=t.getEmitResolver(),u=t.getCompilerOptions(),_=e.getEmitScriptTarget(u),d=e.getUseDefineForClassFields(u),p=_<9,f=_<9,g=f&&_>=2,m=t.onSubstituteNode;t.onSubstituteNode=function(t,n){return n=m(t,n),1===t?function(t){switch(t.kind){case 79:return function(t){return function(t){if(1&y&&33554432&l.getNodeCheckFlags(t)){var n=l.getReferencedValueDeclaration(t);if(n){var i=v[n.id];if(i){var a=r.cloneNode(i);return e.setSourceMapRange(a,t),e.setCommentRange(a,t),a}}}}(t)||t}(t);case 108:return function(t){if(2&y&&D){var n=D.facts,i=D.classConstructor;if(1&n)return r.createParenthesizedExpression(r.createVoidZero());if(i)return e.setTextRange(e.setOriginalNode(r.cloneNode(i),t),t)}return t}(t)}return t}(n):n};var y,v,h,b,x=t.onEmitNode;t.onEmitNode=function(t,r,n){var i=e.getOriginalNode(r);if(i.id){var a=k.get(i.id);if(a){var o=D,s=S;return D=a,S=a,x(t,r,n),D=o,void(S=s)}}switch(r.kind){case 213:if(e.isArrowFunction(i)||262144&e.getEmitFlags(r))break;case 256:case 171:return o=D,s=S,D=void 0,S=void 0,x(t,r,n),D=o,void(S=s);case 172:case 173:case 169:case 167:return o=D,s=S,S=D,D=void 0,x(t,r,n),D=o,void(S=s);case 162:return o=D,s=S,D=S,S=void 0,x(t,r,n),D=o,void(S=s)}x(t,r,n);};var D,S,T,C=[],k=new e.Map;return e.chainBundle(t,(function(r){var n=t.getCompilerOptions();if(r.isDeclarationFile||d&&e.getEmitScriptTarget(n)>=9)return r;var i=e.visitEachChild(r,F,t);return e.addEmitHelpers(i,t.readEmitHelpers()),i}));function E(a,o){if(8388608&a.transformFlags)switch(a.kind){case 226:case 257:return function(n){if(!e.forEach(n.members,j))return e.visitEachChild(n,F,t);var a=h;if(h=void 0,C.push(D),D=void 0,p){var o=e.getNameOfDeclaration(n);o&&e.isIdentifier(o)&&(X().className=e.idText(o));var s=J(n);e.some(s)&&(X().weakSetName=$("instances",s[0].name));}var u=e.isClassDeclaration(n)?function(t){var n,a=z(t);if(a&&(Q().facts=a),8&a&&H(),2&a){var o=r.createTempVariable(i,!0);Q().classConstructor=r.cloneNode(o),n=r.createAssignment(o,r.getInternalName(t));}var s=e.getEffectiveBaseTypeNode(t),c=!(!s||104===e.skipOuterExpressions(s.expression).kind),l=[r.updateClassDeclaration(t,void 0,t.modifiers,t.name,void 0,e.visitNodes(t.heritageClauses,A,e.isHeritageClause),K(t,c))];n&&Y().unshift(n),e.some(h)&&l.push(r.createExpressionStatement(r.inlineExpressions(h)));var u=e.getStaticPropertiesAndClassStaticBlock(t);return e.some(u)&&V(l,u,r.getInternalName(t)),l}(n):function(n){var a=z(n);a&&(Q().facts=a),8&a&&H();var o,s=!!(1&a),u=e.getStaticPropertiesAndClassStaticBlock(n),_=e.getEffectiveBaseTypeNode(n),d=!(!_||104===e.skipOuterExpressions(_.expression).kind),f=16777216&l.getNodeCheckFlags(n);function g(){var e=l.getNodeCheckFlags(n),t=16777216&e,a=524288&e;return r.createTempVariable(a?c:i,!!t)}2&a&&(o=g(),Q().classConstructor=r.cloneNode(o));var m=r.updateClassExpression(n,e.visitNodes(n.decorators,F,e.isDecorator),n.modifiers,n.name,void 0,e.visitNodes(n.heritageClauses,A,e.isHeritageClause),K(n,d));if(p&&e.some(u,(function(t){return e.isClassStaticBlockDeclaration(t)||!!t.initializer||e.isPrivateIdentifier(t.name)}))||e.some(h)){if(s)return e.Debug.assertIsDefined(b,"Decorated classes transformed by TypeScript are expected to be within a variable declaration."),b&&h&&e.some(h)&&b.push(r.createExpressionStatement(r.inlineExpressions(h))),b&&e.some(u)&&V(b,u,r.getInternalName(n)),o?r.inlineExpressions([r.createAssignment(o,m),o]):m;var x=[];if(o||(o=g()),f){0==(1&y)&&(y|=1,t.enableSubstitution(79),v=[]);var D=r.cloneNode(o);D.autoGenerateFlags&=-9,v[e.getOriginalNodeId(n)]=D;}return e.setEmitFlags(m,65536|e.getEmitFlags(m)),x.push(e.startOnNewLine(r.createAssignment(o,m))),e.addRange(x,e.map(h,e.startOnNewLine)),e.addRange(x,function(t,r){for(var n=[],i=0,a=t;i<a.length;i++){var o=a[i],s=e.isClassStaticBlockDeclaration(o)?R(o):W(o,r);s&&(e.startOnNewLine(s),e.setSourceMapRange(s,e.moveRangePastModifiers(o)),e.setCommentRange(s,o),e.setOriginalNode(s,o),n.push(s));}return n}(u,o)),x.push(e.startOnNewLine(o)),r.inlineExpressions(x)}return m}(n);return D=C.pop(),h=a,u}(a);case 167:return I(a);case 237:return function(r){var i=b;b=[];var a=e.visitEachChild(r,F,t),o=e.some(b)?n$4([a],b,!0):a;return b=i,o}(a);case 80:return function(t){return p?e.isStatement(t.parent)?t:e.setOriginalNode(r.createIdentifier(""),t):t}(a);case 170:return function(r){if(!p)return e.visitEachChild(r,w,t)}(a)}if(8388608&a.transformFlags||33554432&a.transformFlags&&g&&T&&D)switch(a.kind){case 219:case 220:return function(n,a){if(45===n.operator||46===n.operator)if(p&&e.isPrivateIdentifierPropertyAccessExpression(n.operand)){var o;if(o=te(n.operand.name)){var s=L(e.visitNode(n.operand.expression,F,e.isExpression)),c=s.readExpression,l=s.initializeExpression,u=O(o,c),_=e.isPrefixUnaryExpression(n)||a?void 0:r.createTempVariable(i);return u=B(o,l||c,u=e.expandPreOrPostfixIncrementOrDecrementExpression(r,n,u,i,_),63),e.setOriginalNode(u,n),e.setTextRange(u,n),_&&(u=r.createComma(u,_),e.setTextRange(u,n)),u}}else if(g&&e.isSuperProperty(n.operand)&&T&&D){var d=D.classConstructor,f=D.superClassReference;if(1&D.facts){var m=G(n.operand);return e.isPrefixUnaryExpression(n)?r.updatePrefixUnaryExpression(n,m):r.updatePostfixUnaryExpression(n,m)}if(d&&f){var y=void 0,v=void 0;if(e.isPropertyAccessExpression(n.operand)?e.isIdentifier(n.operand.name)&&(v=y=r.createStringLiteralFromNode(n.operand.name)):e.isSimpleInlineableExpression(n.operand.argumentExpression)?v=y=n.operand.argumentExpression:(v=r.createTempVariable(i),y=r.createAssignment(v,e.visitNode(n.operand.argumentExpression,F,e.isExpression))),y&&v)return u=r.createReflectGetCall(f,v,d),e.setTextRange(u,n.operand),_=a?void 0:r.createTempVariable(i),u=e.expandPreOrPostfixIncrementOrDecrementExpression(r,n,u,i,_),u=r.createReflectSetCall(f,y,u,d),e.setOriginalNode(u,n),e.setTextRange(u,n),_&&(u=r.createComma(u,_),e.setTextRange(u,n)),u}}return e.visitEachChild(n,F,t)}(a,o);case 221:return function(a,o){if(e.isDestructuringAssignment(a)){var s=h;h=void 0,a=r.updateBinaryExpression(a,e.visitNode(a.left,P),a.operatorToken,e.visitNode(a.right,F));var c=e.some(h)?r.inlineExpressions(e.compact(n$4(n$4([],h,!0),[a],!1))):a;return h=s,c}if(e.isAssignmentExpression(a))if(p&&e.isPrivateIdentifierPropertyAccessExpression(a.left)){var l=te(a.left.name);if(l)return e.setTextRange(e.setOriginalNode(B(l,a.left.expression,a.right,a.operatorToken.kind),a),a)}else if(g&&e.isSuperProperty(a.left)&&T&&D){var u=D.classConstructor,_=D.superClassReference;if(1&D.facts)return r.updateBinaryExpression(a,G(a.left),a.operatorToken,e.visitNode(a.right,F,e.isExpression));if(u&&_){var d=e.isElementAccessExpression(a.left)?e.visitNode(a.left.argumentExpression,F,e.isExpression):e.isIdentifier(a.left.name)?r.createStringLiteralFromNode(a.left.name):void 0;if(d){var f=e.visitNode(a.right,F,e.isExpression);if(e.isCompoundAssignment(a.operatorToken.kind)){var m=d;e.isSimpleInlineableExpression(d)||(m=r.createTempVariable(i),d=r.createAssignment(m,d));var y=r.createReflectGetCall(_,m,u);e.setOriginalNode(y,a.left),e.setTextRange(y,a.left),f=r.createBinaryExpression(y,e.getNonAssignmentOperatorForCompoundAssignment(a.operatorToken.kind),f),e.setTextRange(f,a);}var v=o?void 0:r.createTempVariable(i);return v&&(f=r.createAssignment(v,f),e.setTextRange(v,a)),f=r.createReflectSetCall(_,d,f,u),e.setOriginalNode(f,a),e.setTextRange(f,a),v&&(f=r.createComma(f,v),e.setTextRange(f,a)),f}}}return 101===a.operatorToken.kind&&e.isPrivateIdentifier(a.left)?function(r){if(!p)return r;var n=r.left;e.Debug.assertNode(n,e.isPrivateIdentifier),e.Debug.assert(101===r.operatorToken.kind);var i=te(n);if(i){var a=e.visitNode(r.right,F,e.isExpression);return e.setOriginalNode(t.getEmitHelperFactory().createClassPrivateFieldInHelper(i.brandCheckIdentifier,a),r)}return e.visitEachChild(r,F,t)}(a):e.visitEachChild(a,F,t)}(a,o);case 208:return function(a){if(p&&e.isPrivateIdentifierPropertyAccessExpression(a.expression)){var o=r.createCallBinding(a.expression,i,_),s=o.thisArg,c=o.target;return e.isCallChain(a)?r.updateCallChain(a,r.createPropertyAccessChain(e.visitNode(c,F),a.questionDotToken,"call"),void 0,void 0,n$4([e.visitNode(s,F,e.isExpression)],e.visitNodes(a.arguments,F,e.isExpression),!0)):r.updateCallExpression(a,r.createPropertyAccessExpression(e.visitNode(c,F),"call"),void 0,n$4([e.visitNode(s,F,e.isExpression)],e.visitNodes(a.arguments,F,e.isExpression),!0))}if(g&&e.isSuperProperty(a.expression)&&T&&(null==D?void 0:D.classConstructor)){var l=r.createFunctionCallCall(e.visitNode(a.expression,F,e.isExpression),D.classConstructor,e.visitNodes(a.arguments,F,e.isExpression));return e.setOriginalNode(l,a),e.setTextRange(l,a),l}return e.visitEachChild(a,F,t)}(a);case 210:return function(n){if(p&&e.isPrivateIdentifierPropertyAccessExpression(n.tag)){var a=r.createCallBinding(n.tag,i,_),o=a.thisArg,s=a.target;return r.updateTaggedTemplateExpression(n,r.createCallExpression(r.createPropertyAccessExpression(e.visitNode(s,F),"bind"),void 0,[e.visitNode(o,F,e.isExpression)]),void 0,e.visitNode(n.template,F,e.isTemplateLiteral))}if(g&&e.isSuperProperty(n.tag)&&T&&(null==D?void 0:D.classConstructor)){var c=r.createFunctionBindCall(e.visitNode(n.tag,F,e.isExpression),D.classConstructor,[]);return e.setOriginalNode(c,n),e.setTextRange(c,n),r.updateTaggedTemplateExpression(n,c,void 0,e.visitNode(n.template,F,e.isTemplateLiteral))}return e.visitEachChild(n,F,t)}(a);case 206:return function(n){if(p&&e.isPrivateIdentifier(n.name)){var i=te(n.name);if(i)return e.setTextRange(e.setOriginalNode(O(i,n.expression),n),n)}if(g&&e.isSuperProperty(n)&&e.isIdentifier(n.name)&&T&&D){var a=D.classConstructor,o=D.superClassReference;if(1&D.facts)return G(n);if(a&&o){var s=r.createReflectGetCall(o,r.createStringLiteralFromNode(n.name),a);return e.setOriginalNode(s,n.expression),e.setTextRange(s,n.expression),s}}return e.visitEachChild(n,F,t)}(a);case 207:return function(n){if(g&&e.isSuperProperty(n)&&T&&D){var i=D.classConstructor,a=D.superClassReference;if(1&D.facts)return G(n);if(i&&a){var o=r.createReflectGetCall(a,e.visitNode(n.argumentExpression,F,e.isExpression),i);return e.setOriginalNode(o,n.expression),e.setTextRange(o,n.expression),o}}return e.visitEachChild(n,F,t)}(a);case 238:return function(t){return r.updateExpressionStatement(t,e.visitNode(t.expression,N,e.isExpression))}(a);case 242:return function(n){return r.updateForStatement(n,e.visitNode(n.initializer,N,e.isForInitializer),e.visitNode(n.condition,F,e.isExpression),e.visitNode(n.incrementor,N,e.isExpression),e.visitIterationBody(n.statement,F,t))}(a);case 256:case 213:case 171:case 169:case 172:case 173:var s=T;T=void 0;var u=e.visitEachChild(a,F,t);return T=s,u}return e.visitEachChild(a,F,t)}function N(e){return E(e,!0)}function F(e){return E(e,!1)}function A(n){switch(n.kind){case 291:return e.visitEachChild(n,A,t);case 228:return function(n){if(4&((null==D?void 0:D.facts)||0)){var a=r.createTempVariable(i,!0);return Q().superClassReference=a,r.updateExpressionWithTypeArguments(n,r.createAssignment(a,e.visitNode(n.expression,F,e.isExpression)),void 0)}return e.visitEachChild(n,F,t)}(n)}return F(n)}function P(t){switch(t.kind){case 205:case 204:return function(t){return e.isArrayLiteralExpression(t)?r.updateArrayLiteralExpression(t,e.visitNodes(t.elements,ne,e.isExpression)):r.updateObjectLiteralExpression(t,e.visitNodes(t.properties,ie,e.isObjectLiteralElementLike))}(t);default:return F(t)}}function w(n){switch(n.kind){case 171:return;case 172:case 173:case 169:return function(n){if(e.Debug.assert(!e.some(n.decorators)),!p||!e.isPrivateIdentifier(n.name))return e.visitEachChild(n,w,t);var i=te(n.name);if(e.Debug.assert(i,"Undeclared private name for property declaration."),!i.isValid)return n;var a=function(t){e.Debug.assert(e.isPrivateIdentifier(t.name));var r=te(t.name);if(e.Debug.assert(r,"Undeclared private name for property declaration."),"m"===r.kind)return r.methodName;if("a"===r.kind){if(e.isGetAccessor(t))return r.getterName;if(e.isSetAccessor(t))return r.setterName}}(n);a&&Y().push(r.createAssignment(a,r.createFunctionExpression(e.filter(n.modifiers,(function(t){return !e.isStaticModifier(t)})),n.asteriskToken,a,void 0,e.visitParameterList(n.parameters,w,t),void 0,e.visitFunctionBody(n.body,w,t))));}(n);case 167:return I(n);case 162:return function(n){var i=e.visitEachChild(n,F,t);if(e.some(h)){var a=h;a.push(i.expression),h=[],i=r.updateComputedPropertyName(i,r.inlineExpressions(a));}return i}(n);case 234:return n;default:return F(n)}}function I(n){if(e.Debug.assert(!e.some(n.decorators)),e.isPrivateIdentifier(n.name)){if(!p)return e.isStatic(n)?e.visitEachChild(n,F,t):r.updatePropertyDeclaration(n,void 0,e.visitNodes(n.modifiers,F,e.isModifier),n.name,void 0,void 0,void 0);var a=te(n.name);if(e.Debug.assert(a,"Undeclared private name for property declaration."),!a.isValid)return n}var o=function(t,n){if(e.isComputedPropertyName(t)){var a=e.visitNode(t.expression,F,e.isExpression),o=e.skipPartiallyEmittedExpressions(a),s=e.isSimpleInlineableExpression(o);if((!e.isAssignmentExpression(o)||!e.isGeneratedIdentifier(o.left))&&!s&&n){var u=r.getGeneratedNameForNode(t);return 524288&l.getNodeCheckFlags(t)?c(u):i(u),r.createAssignment(u,a)}return s||e.isIdentifier(o)?void 0:a}}(n.name,!!n.initializer||d);if(o&&!e.isSimpleInlineableExpression(o)&&Y().push(o),e.isStatic(n)&&!p&&!d){var s=q(n,r.createThis());if(s){var u=r.createClassStaticBlockDeclaration(void 0,void 0,r.createBlock([s]));return e.setOriginalNode(u,n),e.setCommentRange(u,n),e.setCommentRange(s,{pos:-1,end:-1}),e.setSyntheticLeadingComments(s,void 0),e.setSyntheticTrailingComments(s,void 0),u}}}function O(t,r){return M(t,e.visitNode(r,F,e.isExpression))}function M(r,n){switch(e.setCommentRange(n,e.moveRangePos(n,-1)),r.kind){case"a":return t.getEmitHelperFactory().createClassPrivateFieldGetHelper(n,r.brandCheckIdentifier,r.kind,r.getterName);case"m":return t.getEmitHelperFactory().createClassPrivateFieldGetHelper(n,r.brandCheckIdentifier,r.kind,r.methodName);case"f":return t.getEmitHelperFactory().createClassPrivateFieldGetHelper(n,r.brandCheckIdentifier,r.kind,r.variableName);default:e.Debug.assertNever(r,"Unknown private element type");}}function L(t){var n=e.nodeIsSynthesized(t)?t:r.cloneNode(t);if(e.isSimpleInlineableExpression(t))return {readExpression:n,initializeExpression:void 0};var a=r.createTempVariable(i);return {readExpression:a,initializeExpression:r.createAssignment(a,n)}}function R(t){if(p){D&&k.set(e.getOriginalNodeId(t),D),o();var n=T;T=t;var i=e.visitNodes(t.body.statements,F,e.isStatement);i=r.mergeLexicalEnvironment(i,a()),T=n;var s=r.createImmediatelyInvokedArrowFunction(i);return e.setOriginalNode(s,t),e.setTextRange(s,t),e.addEmitFlags(s,2),s}}function B(n,i,a,o){if(i=e.visitNode(i,F,e.isExpression),a=e.visitNode(a,F,e.isExpression),e.isCompoundAssignment(o)){var s=L(i),c=s.readExpression;i=s.initializeExpression||c,a=r.createBinaryExpression(M(n,c),e.getNonAssignmentOperatorForCompoundAssignment(o),a);}switch(e.setCommentRange(i,e.moveRangePos(i,-1)),n.kind){case"a":return t.getEmitHelperFactory().createClassPrivateFieldSetHelper(i,n.brandCheckIdentifier,a,n.kind,n.setterName);case"m":return t.getEmitHelperFactory().createClassPrivateFieldSetHelper(i,n.brandCheckIdentifier,a,n.kind,void 0);case"f":return t.getEmitHelperFactory().createClassPrivateFieldSetHelper(i,n.brandCheckIdentifier,a,n.kind,n.variableName);default:e.Debug.assertNever(n,"Unknown private element type");}}function j(t){return e.isPropertyDeclaration(t)||e.isClassStaticBlockDeclaration(t)||p&&t.name&&e.isPrivateIdentifier(t.name)}function J(t){return e.filter(t.members,e.isNonStaticMethodOrAccessorWithPrivateName)}function z(t){var r=0,n=e.getOriginalNode(t);e.isClassDeclaration(n)&&e.classOrConstructorParameterIsDecorated(n)&&(r|=1);for(var i=0,a=t.members;i<a.length;i++){var o=a[i];e.isStatic(o)&&(o.name&&e.isPrivateIdentifier(o.name)&&p&&(r|=2),(e.isPropertyDeclaration(o)||e.isClassStaticBlockDeclaration(o))&&(f&&8192&o.transformFlags&&(1&(r|=8)||(r|=2)),g&&33554432&o.transformFlags&&(1&r||(r|=6))));}return r}function K(i,o){var c,l=[];if(p){for(var u=0,_=i.members;u<_.length;u++){var f=_[u];e.isPrivateIdentifierClassElementDeclaration(f)&&Z(f);}e.some(J(i))&&(c=X().weakSetName,e.Debug.assert(c,"weakSetName should be set in private identifier environment"),Y().push(r.createAssignment(c,r.createNewExpression(r.createIdentifier("WeakSet"),void 0,[]))));}var g=function(i,o){var c=e.visitNode(e.getFirstConstructorWithBody(i),F,e.isConstructorDeclaration),l=i.members.filter(U);if(!e.some(l))return c;var u=e.visitParameterList(c?c.parameters:void 0,F,t),_=function(i,o,c){var l,u=e.getProperties(i,!1,!1);d||(u=e.filter(u,(function(t){return !!t.initializer||e.isPrivateIdentifier(t.name)})));var _=J(i),f=e.some(u)||e.some(_);if(!o&&!f)return e.visitFunctionBody(void 0,F,t);s();var g=!o&&c,m=0,y=0,v=-1,h=[];(null===(l=null==o?void 0:o.body)||void 0===l?void 0:l.statements)&&(y=r.copyPrologue(o.body.statements,h,!1,F),(v=e.findSuperStatementIndex(o.body.statements,y))>=0?(m=v+1,h=n$4(n$4(n$4([],h.slice(0,y),!0),e.visitNodes(o.body.statements,F,e.isStatement,y,m-y),!0),h.slice(y),!0)):y>=0&&(m=y)),g&&h.push(r.createExpressionStatement(r.createCallExpression(r.createSuper(),void 0,[r.createSpreadElement(r.createIdentifier("arguments"))])));var b=0;if(null==o?void 0:o.body)if(d)h=h.filter((function(t){return !e.isParameterPropertyDeclaration(e.getOriginalNode(t),o)}));else {for(var x=0,D=o.body.statements;x<D.length;x++){var S=D[x];e.isParameterPropertyDeclaration(e.getOriginalNode(S),o)&&b++;}if(b>0){var T=e.visitNodes(o.body.statements,F,e.isStatement,m,b);if(v>=0)e.addRange(h,T);else {var C=y;g&&C++,h=n$4(n$4(n$4([],h.slice(0,C),!0),T,!0),h.slice(C),!0);}m+=b;}}var k=r.createThis();return function(t,n,i){if(p&&e.some(n)){var a=X().weakSetName;e.Debug.assert(a,"weakSetName should be set in private identifier environment"),t.push(r.createExpressionStatement(function(t,r){return e.factory.createCallExpression(e.factory.createPropertyAccessExpression(r,"add"),void 0,[t])}(i,a)));}}(h,_,k),V(h,u,k),o&&e.addRange(h,e.visitNodes(o.body.statements,(function(t){if(!d||!e.isParameterPropertyDeclaration(e.getOriginalNode(t),o))return F(t)}),e.isStatement,m)),h=r.mergeLexicalEnvironment(h,a()),e.setTextRange(r.createBlock(e.setTextRange(r.createNodeArray(h),o?o.body.statements:i.members),!0),o?o.body:void 0)}(i,c,o);return _?e.startOnNewLine(e.setOriginalNode(e.setTextRange(r.createConstructorDeclaration(void 0,void 0,null!=u?u:[],_),c||i),c)):void 0}(i,o),m=e.visitNodes(i.members,w,e.isClassElement);return g&&l.push(g),!p&&e.some(h)&&(l.push(r.createClassStaticBlockDeclaration(void 0,void 0,r.createBlock([r.createExpressionStatement(r.inlineExpressions(h))]))),h=void 0),e.addRange(l,m),e.setTextRange(r.createNodeArray(l),i.members)}function U(t){return !e.isStatic(t)&&!e.hasSyntacticModifier(e.getOriginalNode(t),128)&&(d?_<9:e.isInitializedProperty(t)||p&&e.isPrivateIdentifierClassElementDeclaration(t))}function V(t,r,n){for(var i=0,a=r;i<a.length;i++){var o=a[i];if(!e.isStatic(o)||p||d){var s=q(o,n);s&&t.push(s);}}}function q(t,n){var i=e.isClassStaticBlockDeclaration(t)?R(t):W(t,n);if(i){var a=r.createExpressionStatement(i);return e.setSourceMapRange(a,e.moveRangePastModifiers(t)),e.setCommentRange(a,t),e.setOriginalNode(a,t),e.setSyntheticLeadingComments(i,void 0),e.setSyntheticTrailingComments(i,void 0),a}}function W(t,n){var i=T,a=function(t,n){var i,a=!d,o=e.isComputedPropertyName(t.name)&&!e.isSimpleInlineableExpression(t.name.expression)?r.updateComputedPropertyName(t.name,r.getGeneratedNameForNode(t.name)):t.name;if(e.hasStaticModifier(t)&&(T=t),p&&e.isPrivateIdentifier(o)){var s=te(o);if(s)return "f"===s.kind?s.isStatic?function(t,r){return e.factory.createAssignment(t,e.factory.createObjectLiteralExpression([e.factory.createPropertyAssignment("value",r||e.factory.createVoidZero())]))}(s.variableName,e.visitNode(t.initializer,F,e.isExpression)):function(t,r,n){return e.factory.createCallExpression(e.factory.createPropertyAccessExpression(n,"set"),void 0,[t,r||e.factory.createVoidZero()])}(n,e.visitNode(t.initializer,F,e.isExpression),s.brandCheckIdentifier):void 0;e.Debug.fail("Undeclared private name for property declaration.");}if(!e.isPrivateIdentifier(o)&&!e.hasStaticModifier(t)||t.initializer){var c=e.getOriginalNode(t);if(!e.hasSyntacticModifier(c,128)){var l=t.initializer||a?null!==(i=e.visitNode(t.initializer,F,e.isExpression))&&void 0!==i?i:r.createVoidZero():e.isParameterPropertyDeclaration(c,c.parent)&&e.isIdentifier(o)?o:r.createVoidZero();if(a||e.isPrivateIdentifier(o)){var u=e.createMemberAccessForPropertyName(r,n,o,o);return r.createAssignment(u,l)}var _=e.isComputedPropertyName(o)?o.expression:e.isIdentifier(o)?r.createStringLiteral(e.unescapeLeadingUnderscores(o.escapedText)):o,f=r.createPropertyDescriptor({value:l,configurable:!0,writable:!0,enumerable:!0});return r.createObjectDefinePropertyCall(n,_,f)}}}(t,n);return a&&e.hasStaticModifier(t)&&(null==D?void 0:D.facts)&&(e.setOriginalNode(a,t),e.addEmitFlags(a,2),k.set(e.getOriginalNodeId(a),D)),T=i,a}function H(){0==(2&y)&&(y|=2,t.enableSubstitution(108),t.enableEmitNotification(256),t.enableEmitNotification(213),t.enableEmitNotification(171),t.enableEmitNotification(172),t.enableEmitNotification(173),t.enableEmitNotification(169),t.enableEmitNotification(167),t.enableEmitNotification(162));}function G(t){return e.isPropertyAccessExpression(t)?r.updatePropertyAccessExpression(t,r.createVoidZero(),t.name):r.updateElementAccessExpression(t,r.createVoidZero(),e.visitNode(t.argumentExpression,F,e.isExpression))}function Q(){return D||(D={facts:0,classConstructor:void 0,superClassReference:void 0,privateIdentifierEnvironment:void 0})}function X(){var t=Q();return t.privateIdentifierEnvironment||(t.privateIdentifierEnvironment={className:"",identifiers:new e.Map}),t.privateIdentifierEnvironment}function Y(){return h||(h=[])}function Z(t){var n,i=e.getTextOfPropertyName(t.name),a=Q().classConstructor,o=X(),s=o.weakSetName,c=[],l=t.name.escapedText,u=o.identifiers.get(l),_=!function(e){return "#constructor"===e.escapedText}(t.name)&&void 0===u;if(e.hasStaticModifier(t))if(e.Debug.assert(a,"weakSetName should be set in private identifier environment"),e.isPropertyDeclaration(t)){var d=ee(i,t);o.identifiers.set(l,{kind:"f",variableName:d,brandCheckIdentifier:a,isStatic:!0,isValid:_});}else if(e.isMethodDeclaration(t)){var p=ee(i,t);o.identifiers.set(l,{kind:"m",methodName:p,brandCheckIdentifier:a,isStatic:!0,isValid:_});}else if(e.isGetAccessorDeclaration(t)){var f=ee(i+"_get",t);"a"===(null==u?void 0:u.kind)&&u.isStatic&&!u.getterName?u.getterName=f:o.identifiers.set(l,{kind:"a",getterName:f,setterName:void 0,brandCheckIdentifier:a,isStatic:!0,isValid:_});}else if(e.isSetAccessorDeclaration(t)){var g=ee(i+"_set",t);"a"===(null==u?void 0:u.kind)&&u.isStatic&&!u.setterName?u.setterName=g:o.identifiers.set(l,{kind:"a",getterName:void 0,setterName:g,brandCheckIdentifier:a,isStatic:!0,isValid:_});}else e.Debug.assertNever(t,"Unknown class element type.");else if(e.isPropertyDeclaration(t)){var m=ee(i,t);o.identifiers.set(l,{kind:"f",brandCheckIdentifier:m,isStatic:!1,variableName:void 0,isValid:_}),c.push(r.createAssignment(m,r.createNewExpression(r.createIdentifier("WeakMap"),void 0,[])));}else e.isMethodDeclaration(t)?(e.Debug.assert(s,"weakSetName should be set in private identifier environment"),o.identifiers.set(l,{kind:"m",methodName:ee(i,t),brandCheckIdentifier:s,isStatic:!1,isValid:_})):e.isAccessor(t)?(e.Debug.assert(s,"weakSetName should be set in private identifier environment"),e.isGetAccessor(t)?(f=ee(i+"_get",t),"a"!==(null==u?void 0:u.kind)||u.isStatic||u.getterName?o.identifiers.set(l,{kind:"a",getterName:f,setterName:void 0,brandCheckIdentifier:s,isStatic:!1,isValid:_}):u.getterName=f):(g=ee(i+"_set",t),"a"!==(null==u?void 0:u.kind)||u.isStatic||u.setterName?o.identifiers.set(l,{kind:"a",getterName:void 0,setterName:g,brandCheckIdentifier:s,isStatic:!1,isValid:_}):u.setterName=g)):e.Debug.assertNever(t,"Unknown class element type.");(n=Y()).push.apply(n,c);}function $(e,t){var n=X().className,a=n?"_".concat(n):"",o=r.createUniqueName("".concat(a,"_").concat(e),16);return 524288&l.getNodeCheckFlags(t)?c(o):i(o),o}function ee(e,t){return $(e.substring(1),t.name)}function te(e){var t;if((null==D?void 0:D.privateIdentifierEnvironment)&&(n=D.privateIdentifierEnvironment.identifiers.get(e.escapedText)))return n;for(var r=C.length-1;r>=0;--r){var n,i=C[r];if(i&&(n=null===(t=i.privateIdentifierEnvironment)||void 0===t?void 0:t.identifiers.get(e.escapedText)))return n}}function re(n){var a=r.getGeneratedNameForNode(n),o=te(n.name);if(!o)return e.visitEachChild(n,F,t);var s=n.expression;return (e.isThisProperty(n)||e.isSuperProperty(n)||!e.isSimpleCopiableExpression(n.expression))&&(s=r.createTempVariable(i,!0),Y().push(r.createBinaryExpression(s,63,e.visitNode(n.expression,F,e.isExpression)))),r.createAssignmentTargetWrapper(a,B(o,s,a,63))}function ne(t){var n=e.getTargetOfBindingOrAssignmentElement(t);if(n){var i=void 0;if(e.isPrivateIdentifierPropertyAccessExpression(n))i=re(n);else if(g&&e.isSuperProperty(n)&&T&&D){var a=D.classConstructor,o=D.superClassReference;if(1&D.facts)i=G(n);else if(a&&o){var s=e.isElementAccessExpression(n)?e.visitNode(n.argumentExpression,F,e.isExpression):e.isIdentifier(n.name)?r.createStringLiteralFromNode(n.name):void 0;if(s){var c=r.createTempVariable(void 0);i=r.createAssignmentTargetWrapper(c,r.createReflectSetCall(o,s,c,a));}}}if(i)return e.isAssignmentExpression(t)?r.updateBinaryExpression(t,i,t.operatorToken,e.visitNode(t.right,F,e.isExpression)):e.isSpreadElement(t)?r.updateSpreadElement(t,i):i}return e.visitNode(t,P)}function ie(t){if(e.isObjectBindingOrAssignmentElement(t)&&!e.isShorthandPropertyAssignment(t)){var n=e.getTargetOfBindingOrAssignmentElement(t),i=void 0;if(n)if(e.isPrivateIdentifierPropertyAccessExpression(n))i=re(n);else if(g&&e.isSuperProperty(n)&&T&&D){var a=D.classConstructor,o=D.superClassReference;if(1&D.facts)i=G(n);else if(a&&o){var s=e.isElementAccessExpression(n)?e.visitNode(n.argumentExpression,F,e.isExpression):e.isIdentifier(n.name)?r.createStringLiteralFromNode(n.name):void 0;if(s){var c=r.createTempVariable(void 0);i=r.createAssignmentTargetWrapper(c,r.createReflectSetCall(o,s,c,a));}}}if(e.isPropertyAssignment(t)){var l=e.getInitializerOfBindingOrAssignmentElement(t);return r.updatePropertyAssignment(t,e.visitNode(t.name,F,e.isPropertyName),i?l?r.createAssignment(i,e.visitNode(l,F)):i:e.visitNode(t.initializer,P,e.isExpression))}if(e.isSpreadAssignment(t))return r.updateSpreadAssignment(t,i||e.visitNode(t.expression,P,e.isExpression));e.Debug.assert(void 0===i,"Should not have generated a wrapped target");}return e.visitNode(t,F)}};}(t),function(e){var t,r;function i(t,r,n,i){var a=0!=(4096&r.getNodeCheckFlags(n)),o=[];return i.forEach((function(r,n){var i=e.unescapeLeadingUnderscores(n),s=[];s.push(t.createPropertyAssignment("get",t.createArrowFunction(void 0,void 0,[],void 0,void 0,e.setEmitFlags(t.createPropertyAccessExpression(e.setEmitFlags(t.createSuper(),4),i),4)))),a&&s.push(t.createPropertyAssignment("set",t.createArrowFunction(void 0,void 0,[t.createParameterDeclaration(void 0,void 0,void 0,"v",void 0,void 0,void 0)],void 0,void 0,t.createAssignment(e.setEmitFlags(t.createPropertyAccessExpression(e.setEmitFlags(t.createSuper(),4),i),4),t.createIdentifier("v"))))),o.push(t.createPropertyAssignment(i,t.createObjectLiteralExpression(s)));})),t.createVariableStatement(void 0,t.createVariableDeclarationList([t.createVariableDeclaration(t.createUniqueName("_super",48),void 0,void 0,t.createCallExpression(t.createPropertyAccessExpression(t.createIdentifier("Object"),"create"),void 0,[t.createNull(),t.createObjectLiteralExpression(o,!0)]))],2))}!function(e){e[e.AsyncMethodsWithSuper=1]="AsyncMethodsWithSuper";}(t||(t={})),function(e){e[e.NonTopLevel=1]="NonTopLevel",e[e.HasLexicalThis=2]="HasLexicalThis";}(r||(r={})),e.transformES2017=function(t){var r,a,o,s,c=t.factory,l=t.getEmitHelperFactory,u=t.resumeLexicalEnvironment,_=t.endLexicalEnvironment,d=t.hoistVariableDeclaration,p=t.getEmitResolver(),f=t.getCompilerOptions(),g=e.getEmitScriptTarget(f),m=0,y=[],v=0,h=t.onEmitNode,b=t.onSubstituteNode;return t.onEmitNode=function(t,n,i){if(1&r&&function(e){var t=e.kind;return 257===t||171===t||169===t||172===t||173===t}(n)){var a=6144&p.getNodeCheckFlags(n);if(a!==m){var o=m;return m=a,h(t,n,i),void(m=o)}}else if(r&&y[e.getNodeId(n)])return o=m,m=0,h(t,n,i),void(m=o);h(t,n,i);},t.onSubstituteNode=function(t,r){return r=b(t,r),1===t&&m?function(t){switch(t.kind){case 206:return J(t);case 207:return z(t);case 208:return function(t){var r=t.expression;if(e.isSuperProperty(r)){var i=e.isPropertyAccessExpression(r)?J(r):z(r);return c.createCallExpression(c.createPropertyAccessExpression(i,"call"),void 0,n$4([c.createThis()],t.arguments,!0))}return t}(t)}return t}(r):r},e.chainBundle(t,(function(r){if(r.isDeclarationFile)return r;x(1,!1),x(2,!e.isEffectiveStrictModeSourceFile(r,f));var n=e.visitEachChild(r,k,t);return e.addEmitHelpers(n,t.readEmitHelpers()),n}));function x(e,t){v=t?v|e:v&~e;}function D(e){return 0!=(v&e)}function S(){return D(2)}function T(e,t,r){var n=e&~v;if(n){x(n,!0);var i=t(r);return x(n,!1),i}return t(r)}function C(r){return e.visitEachChild(r,k,t)}function k(r){if(0==(256&r.transformFlags))return r;switch(r.kind){case 131:return;case 218:return function(r){return D(1)?e.setOriginalNode(e.setTextRange(c.createYieldExpression(void 0,e.visitNode(r.expression,k,e.isExpression)),r),r):e.visitEachChild(r,k,t)}(r);case 169:return T(3,N,r);case 256:return T(3,F,r);case 213:return T(3,A,r);case 214:return T(1,P,r);case 206:return o&&e.isPropertyAccessExpression(r)&&106===r.expression.kind&&o.add(r.name.escapedText),e.visitEachChild(r,k,t);case 207:return o&&106===r.expression.kind&&(s=!0),e.visitEachChild(r,k,t);case 172:case 173:case 171:case 257:case 226:return T(3,C,r);default:return e.visitEachChild(r,k,t)}}function E(r){if(e.isNodeWithPossibleHoistedDeclaration(r))switch(r.kind){case 237:return function(r){if(I(r.declarationList)){var n=O(r.declarationList,!1);return n?c.createExpressionStatement(n):void 0}return e.visitEachChild(r,k,t)}(r);case 242:return function(r){var n=r.initializer;return c.updateForStatement(r,I(n)?O(n,!1):e.visitNode(r.initializer,k,e.isForInitializer),e.visitNode(r.condition,k,e.isExpression),e.visitNode(r.incrementor,k,e.isExpression),e.visitIterationBody(r.statement,E,t))}(r);case 243:return function(r){return c.updateForInStatement(r,I(r.initializer)?O(r.initializer,!0):e.visitNode(r.initializer,k,e.isForInitializer),e.visitNode(r.expression,k,e.isExpression),e.visitIterationBody(r.statement,E,t))}(r);case 244:return function(r){return c.updateForOfStatement(r,e.visitNode(r.awaitModifier,k,e.isToken),I(r.initializer)?O(r.initializer,!0):e.visitNode(r.initializer,k,e.isForInitializer),e.visitNode(r.expression,k,e.isExpression),e.visitIterationBody(r.statement,E,t))}(r);case 292:return function(r){var n,i=new e.Set;if(w(r.variableDeclaration,i),i.forEach((function(t,r){a.has(r)&&(n||(n=new e.Set(a)),n.delete(r));})),n){var o=a;a=n;var s=e.visitEachChild(r,E,t);return a=o,s}return e.visitEachChild(r,E,t)}(r);case 235:case 249:case 263:case 289:case 290:case 252:case 240:case 241:case 239:case 248:case 250:return e.visitEachChild(r,E,t);default:return e.Debug.assertNever(r,"Unhandled node.")}return k(r)}function N(r){return c.updateMethodDeclaration(r,void 0,e.visitNodes(r.modifiers,k,e.isModifier),r.asteriskToken,r.name,void 0,void 0,e.visitParameterList(r.parameters,k,t),void 0,2&e.getFunctionFlags(r)?B(r):e.visitFunctionBody(r.body,k,t))}function F(r){return c.updateFunctionDeclaration(r,void 0,e.visitNodes(r.modifiers,k,e.isModifier),r.asteriskToken,r.name,void 0,e.visitParameterList(r.parameters,k,t),void 0,2&e.getFunctionFlags(r)?B(r):e.visitFunctionBody(r.body,k,t))}function A(r){return c.updateFunctionExpression(r,e.visitNodes(r.modifiers,k,e.isModifier),r.asteriskToken,r.name,void 0,e.visitParameterList(r.parameters,k,t),void 0,2&e.getFunctionFlags(r)?B(r):e.visitFunctionBody(r.body,k,t))}function P(r){return c.updateArrowFunction(r,e.visitNodes(r.modifiers,k,e.isModifier),void 0,e.visitParameterList(r.parameters,k,t),void 0,r.equalsGreaterThanToken,2&e.getFunctionFlags(r)?B(r):e.visitFunctionBody(r.body,k,t))}function w(t,r){var n=t.name;if(e.isIdentifier(n))r.add(n.escapedText);else for(var i=0,a=n.elements;i<a.length;i++){var o=a[i];e.isOmittedExpression(o)||w(o,r);}}function I(t){return !!t&&e.isVariableDeclarationList(t)&&!(3&t.flags)&&t.declarations.some(R)}function O(t,r){!function(t){e.forEach(t.declarations,M);}(t);var n=e.getInitializedVariables(t);return 0===n.length?r?e.visitNode(c.converters.convertToAssignmentElementTarget(t.declarations[0].name),k,e.isExpression):void 0:c.inlineExpressions(e.map(n,L))}function M(t){var r=t.name;if(e.isIdentifier(r))d(r);else for(var n=0,i=r.elements;n<i.length;n++){var a=i[n];e.isOmittedExpression(a)||M(a);}}function L(t){var r=e.setSourceMapRange(c.createAssignment(c.converters.convertToAssignmentElementTarget(t.name),t.initializer),t);return e.visitNode(r,k,e.isExpression)}function R(t){var r=t.name;if(e.isIdentifier(r))return a.has(r.escapedText);for(var n=0,i=r.elements;n<i.length;n++){var o=i[n];if(!e.isOmittedExpression(o)&&R(o))return !0}return !1}function B(n){u();var d=e.getOriginalNode(n,e.isFunctionLike).type,f=g<2?function(t){var r=t&&e.getEntityNameFromTypeNode(t);if(r&&e.isEntityName(r)){var n=p.getTypeReferenceSerializationKind(r);if(n===e.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue||n===e.TypeReferenceSerializationKind.Unknown)return r}}(d):void 0,m=214===n.kind,v=0!=(8192&p.getNodeCheckFlags(n)),h=a;a=new e.Set;for(var b=0,x=n.parameters;b<x.length;b++)w(x[b],a);var D,T=o,C=s;if(m||(o=new e.Set,s=!1),m){var E=l().createAwaiterHelper(S(),v,f,j(n.body)),N=_();e.some(N)?(O=c.converters.convertToFunctionBlock(E),D=c.updateBlock(O,e.setTextRange(c.createNodeArray(e.concatenate(N,O.statements)),O.statements))):D=E;}else {var F=[],A=c.copyPrologue(n.body.statements,F,!1,k);F.push(c.createReturnStatement(l().createAwaiterHelper(S(),v,f,j(n.body,A)))),e.insertStatementsAfterStandardPrologue(F,_());var P=g>=2&&6144&p.getNodeCheckFlags(n);if(P&&(0==(1&r)&&(r|=1,t.enableSubstitution(208),t.enableSubstitution(206),t.enableSubstitution(207),t.enableEmitNotification(257),t.enableEmitNotification(169),t.enableEmitNotification(172),t.enableEmitNotification(173),t.enableEmitNotification(171),t.enableEmitNotification(237)),o.size)){var I=i(c,p,n,o);y[e.getNodeId(I)]=!0,e.insertStatementsAfterStandardPrologue(F,[I]);}var O=c.createBlock(F,!0);e.setTextRange(O,n.body),P&&s&&(4096&p.getNodeCheckFlags(n)?e.addEmitHelper(O,e.advancedAsyncSuperHelper):2048&p.getNodeCheckFlags(n)&&e.addEmitHelper(O,e.asyncSuperHelper)),D=O;}return a=h,m||(o=T,s=C),D}function j(t,r){return e.isBlock(t)?c.updateBlock(t,e.visitNodes(t.statements,E,e.isStatement,r)):c.converters.convertToFunctionBlock(e.visitNode(t,E,e.isConciseBody))}function J(t){return 106===t.expression.kind?e.setTextRange(c.createPropertyAccessExpression(c.createUniqueName("_super",48),t.name),t):t}function z(t){return 106===t.expression.kind?(r=t.argumentExpression,n=t,4096&m?e.setTextRange(c.createPropertyAccessExpression(c.createCallExpression(c.createUniqueName("_superIndex",48),void 0,[r]),"value"),n):e.setTextRange(c.createCallExpression(c.createUniqueName("_superIndex",48),void 0,[r]),n)):t;var r,n;}},e.createSuperAccessVariableStatement=i;}(t),function(e){var t,r;!function(e){e[e.AsyncMethodsWithSuper=1]="AsyncMethodsWithSuper";}(t||(t={})),function(e){e[e.None=0]="None",e[e.HasLexicalThis=1]="HasLexicalThis",e[e.IterationContainer=2]="IterationContainer",e[e.AncestorFactsMask=3]="AncestorFactsMask",e[e.SourceFileIncludes=1]="SourceFileIncludes",e[e.SourceFileExcludes=2]="SourceFileExcludes",e[e.StrictModeSourceFileIncludes=0]="StrictModeSourceFileIncludes",e[e.ClassOrFunctionIncludes=1]="ClassOrFunctionIncludes",e[e.ClassOrFunctionExcludes=2]="ClassOrFunctionExcludes",e[e.ArrowFunctionIncludes=0]="ArrowFunctionIncludes",e[e.ArrowFunctionExcludes=2]="ArrowFunctionExcludes",e[e.IterationStatementIncludes=2]="IterationStatementIncludes",e[e.IterationStatementExcludes=0]="IterationStatementExcludes";}(r||(r={})),e.transformES2018=function(t){var r=t.factory,i=t.getEmitHelperFactory,a=t.resumeLexicalEnvironment,o=t.endLexicalEnvironment,s=t.hoistVariableDeclaration,c=t.getEmitResolver(),l=t.getCompilerOptions(),u=e.getEmitScriptTarget(l),_=t.onEmitNode;t.onEmitNode=function(t,r,n){if(1&p&&function(e){var t=e.kind;return 257===t||171===t||169===t||172===t||173===t}(r)){var i=6144&c.getNodeCheckFlags(r);if(i!==x){var a=x;return x=i,_(t,r,n),void(x=a)}}else if(p&&S[e.getNodeId(r)])return a=x,x=0,_(t,r,n),void(x=a);_(t,r,n);};var d=t.onSubstituteNode;t.onSubstituteNode=function(t,i){return i=d(t,i),1===t&&x?function(t){switch(t.kind){case 206:return X(t);case 207:return Y(t);case 208:return function(t){var i=t.expression;if(e.isSuperProperty(i)){var a=e.isPropertyAccessExpression(i)?X(i):Y(i);return r.createCallExpression(r.createPropertyAccessExpression(a,"call"),void 0,n$4([r.createThis()],t.arguments,!0))}return t}(t)}return t}(i):i};var p,f,g,m,y,v,h,b=!1,x=0,D=0,S=[];return e.chainBundle(t,(function(n){if(n.isDeclarationFile)return n;m=n;var i=function(n){var i=T(2,e.isEffectiveStrictModeSourceFile(n,l)?0:1);b=!1;var a=e.visitEachChild(n,E,t),o=e.concatenate(a.statements,y&&[r.createVariableStatement(void 0,r.createVariableDeclarationList(y))]),s=r.updateSourceFile(a,e.setTextRange(r.createNodeArray(o),n.statements));return C(i),s}(n);return e.addEmitHelpers(i,t.readEmitHelpers()),m=void 0,y=void 0,i}));function T(e,t){var r=D;return D=3&(D&~e|t),r}function C(e){D=e;}function k(t){y=e.append(y,r.createVariableDeclaration(t));}function E(e){return w(e,!1)}function N(e){return w(e,!0)}function F(e){if(131!==e.kind)return e}function A(e,t,r,n){if(function(e,t){return D!==(D&~e|t)}(r,n)){var i=T(r,n),a=e(t);return C(i),a}return e(t)}function P(r){return e.visitEachChild(r,E,t)}function w(a,o){if(0==(128&a.transformFlags))return a;switch(a.kind){case 218:return function(n){return 2&f&&1&f?e.setOriginalNode(e.setTextRange(r.createYieldExpression(void 0,i().createAwaitHelper(e.visitNode(n.expression,E,e.isExpression))),n),n):e.visitEachChild(n,E,t)}(a);case 224:return function(n){if(2&f&&1&f){if(n.asteriskToken){var a=e.visitNode(e.Debug.checkDefined(n.expression),E,e.isExpression);return e.setOriginalNode(e.setTextRange(r.createYieldExpression(void 0,i().createAwaitHelper(r.updateYieldExpression(n,n.asteriskToken,e.setTextRange(i().createAsyncDelegatorHelper(e.setTextRange(i().createAsyncValuesHelper(a),a)),a)))),n),n)}return e.setOriginalNode(e.setTextRange(r.createYieldExpression(void 0,L(n.expression?e.visitNode(n.expression,E,e.isExpression):r.createVoidZero())),n),n)}return e.visitEachChild(n,E,t)}(a);case 247:return function(n){return 2&f&&1&f?r.updateReturnStatement(n,L(n.expression?e.visitNode(n.expression,E,e.isExpression):r.createVoidZero())):e.visitEachChild(n,E,t)}(a);case 250:return function(n){if(2&f){var i=e.unwrapInnermostStatementOfLabel(n);return 244===i.kind&&i.awaitModifier?M(i,n):r.restoreEnclosingLabel(e.visitNode(i,E,e.isStatement,r.liftToBlock),n)}return e.visitEachChild(n,E,t)}(a);case 205:return function(n){if(32768&n.transformFlags){var a=function(t){for(var n,i=[],a=0,o=t;a<o.length;a++){var s=o[a];if(298===s.kind){n&&(i.push(r.createObjectLiteralExpression(n)),n=void 0);var c=s.expression;i.push(e.visitNode(c,E,e.isExpression));}else n=e.append(n,296===s.kind?r.createPropertyAssignment(s.name,e.visitNode(s.initializer,E,e.isExpression)):e.visitNode(s,E,e.isObjectLiteralElementLike));}return n&&i.push(r.createObjectLiteralExpression(n)),i}(n.properties);a.length&&205!==a[0].kind&&a.unshift(r.createObjectLiteralExpression());var o=a[0];if(a.length>1){for(var s=1;s<a.length;s++)o=i().createAssignHelper([o,a[s]]);return o}return i().createAssignHelper(a)}return e.visitEachChild(n,E,t)}(a);case 221:return function(n,i){return e.isDestructuringAssignment(n)&&32768&n.left.transformFlags?e.flattenDestructuringAssignment(n,E,t,1,!i):27===n.operatorToken.kind?r.updateBinaryExpression(n,e.visitNode(n.left,N,e.isExpression),n.operatorToken,e.visitNode(n.right,i?N:E,e.isExpression)):e.visitEachChild(n,E,t)}(a,o);case 351:return function(n,i){if(i)return e.visitEachChild(n,N,t);for(var a,o=0;o<n.elements.length;o++){var s=n.elements[o],c=e.visitNode(s,o<n.elements.length-1?N:E,e.isExpression);(a||c!==s)&&(a||(a=n.elements.slice(0,o)),a.push(c));}var l=a?e.setTextRange(r.createNodeArray(a),n.elements):n.elements;return r.updateCommaListExpression(n,l)}(a,o);case 292:return function(i){if(i.variableDeclaration&&e.isBindingPattern(i.variableDeclaration.name)&&32768&i.variableDeclaration.name.transformFlags){var a=r.getGeneratedNameForNode(i.variableDeclaration.name),o=r.updateVariableDeclaration(i.variableDeclaration,i.variableDeclaration.name,void 0,void 0,a),s=e.flattenDestructuringBinding(o,E,t,1),c=e.visitNode(i.block,E,e.isBlock);return e.some(s)&&(c=r.updateBlock(c,n$4([r.createVariableStatement(void 0,s)],c.statements,!0))),r.updateCatchClause(i,r.updateVariableDeclaration(i.variableDeclaration,a,void 0,void 0,void 0),c)}return e.visitEachChild(i,E,t)}(a);case 237:return function(r){if(e.hasSyntacticModifier(r,1)){var n=b;b=!0;var i=e.visitEachChild(r,E,t);return b=n,i}return e.visitEachChild(r,E,t)}(a);case 254:return function(e){if(b){var t=b;b=!1;var r=I(e,!0);return b=t,r}return I(e,!1)}(a);case 240:case 241:case 243:return A(P,a,0,2);case 244:return M(a,void 0);case 242:return A(O,a,0,2);case 217:return function(r){return e.visitEachChild(r,N,t)}(a);case 171:return A(J,a,2,1);case 169:return A(U,a,2,1);case 172:return A(z,a,2,1);case 173:return A(K,a,2,1);case 256:return A(V,a,2,1);case 213:return A(W,a,2,1);case 214:return A(q,a,2,0);case 164:return B(a);case 238:return function(r){return e.visitEachChild(r,N,t)}(a);case 212:return function(r,n){return e.visitEachChild(r,n?N:E,t)}(a,o);case 210:return function(r){return e.processTaggedTemplateExpression(t,r,E,m,k,e.ProcessLevel.LiftRestriction)}(a);case 206:return v&&e.isPropertyAccessExpression(a)&&106===a.expression.kind&&v.add(a.name.escapedText),e.visitEachChild(a,E,t);case 207:return v&&106===a.expression.kind&&(h=!0),e.visitEachChild(a,E,t);case 257:case 226:return A(P,a,2,1);default:return e.visitEachChild(a,E,t)}}function I(r,n){return e.isBindingPattern(r.name)&&32768&r.name.transformFlags?e.flattenDestructuringBinding(r,E,t,1,void 0,n):e.visitEachChild(r,E,t)}function O(n){return r.updateForStatement(n,e.visitNode(n.initializer,N,e.isForInitializer),e.visitNode(n.condition,E,e.isExpression),e.visitNode(n.incrementor,N,e.isExpression),e.visitIterationBody(n.statement,E,t))}function M(n,a){var o=T(0,2);32768&n.initializer.transformFlags&&(n=function(t){var n=e.skipParentheses(t.initializer);if(e.isVariableDeclarationList(n)||e.isAssignmentPattern(n)){var i=void 0,a=void 0,o=r.createTempVariable(void 0),s=[e.createForOfBindingStatement(r,n,o)];return e.isBlock(t.statement)?(e.addRange(s,t.statement.statements),i=t.statement,a=t.statement.statements):t.statement&&(e.append(s,t.statement),i=t.statement,a=t.statement),r.updateForOfStatement(t,t.awaitModifier,e.setTextRange(r.createVariableDeclarationList([e.setTextRange(r.createVariableDeclaration(o),t.initializer)],1),t.initializer),t.expression,e.setTextRange(r.createBlock(e.setTextRange(r.createNodeArray(s),a),!0),i))}return t}(n));var c=n.awaitModifier?function(n,a,o){var c=e.visitNode(n.expression,E,e.isExpression),l=e.isIdentifier(c)?r.getGeneratedNameForNode(c):r.createTempVariable(void 0),u=e.isIdentifier(c)?r.getGeneratedNameForNode(l):r.createTempVariable(void 0),_=r.createUniqueName("e"),d=r.getGeneratedNameForNode(_),p=r.createTempVariable(void 0),f=e.setTextRange(i().createAsyncValuesHelper(c),n.expression),g=r.createCallExpression(r.createPropertyAccessExpression(l,"next"),void 0,[]),m=r.createPropertyAccessExpression(u,"done"),y=r.createPropertyAccessExpression(u,"value"),v=r.createFunctionCallCall(p,l,[]);s(_),s(p);var h=2&o?r.inlineExpressions([r.createAssignment(_,r.createVoidZero()),f]):f,b=e.setEmitFlags(e.setTextRange(r.createForStatement(e.setEmitFlags(e.setTextRange(r.createVariableDeclarationList([e.setTextRange(r.createVariableDeclaration(l,void 0,void 0,h),n.expression),r.createVariableDeclaration(u)]),n.expression),2097152),r.createComma(r.createAssignment(u,L(g)),r.createLogicalNot(m)),void 0,function(n,i){var a,o,s=e.createForOfBindingStatement(r,n.initializer,i),c=[e.visitNode(s,E,e.isStatement)],l=e.visitIterationBody(n.statement,E,t);return e.isBlock(l)?(e.addRange(c,l.statements),a=l,o=l.statements):c.push(l),e.setEmitFlags(e.setTextRange(r.createBlock(e.setTextRange(r.createNodeArray(c),o),!0),a),432)}(n,y)),n),256);return e.setOriginalNode(b,n),r.createTryStatement(r.createBlock([r.restoreEnclosingLabel(b,a)]),r.createCatchClause(r.createVariableDeclaration(d),e.setEmitFlags(r.createBlock([r.createExpressionStatement(r.createAssignment(_,r.createObjectLiteralExpression([r.createPropertyAssignment("error",d)])))]),1)),r.createBlock([r.createTryStatement(r.createBlock([e.setEmitFlags(r.createIfStatement(r.createLogicalAnd(r.createLogicalAnd(u,r.createLogicalNot(m)),r.createAssignment(p,r.createPropertyAccessExpression(l,"return"))),r.createExpressionStatement(L(v))),1)]),void 0,e.setEmitFlags(r.createBlock([e.setEmitFlags(r.createIfStatement(_,r.createThrowStatement(r.createPropertyAccessExpression(_,"error"))),1)]),1))]))}(n,a,o):r.restoreEnclosingLabel(e.visitEachChild(n,E,t),a);return C(o),c}function L(e){return 1&f?r.createYieldExpression(void 0,i().createAwaitHelper(e)):r.createAwaitExpression(e)}function R(t){return e.Debug.assertNode(t,e.isParameter),B(t)}function B(n){return (null==g?void 0:g.has(n))?r.updateParameterDeclaration(n,void 0,void 0,n.dotDotDotToken,e.isBindingPattern(n.name)?r.getGeneratedNameForNode(n):n.name,void 0,void 0,void 0):32768&n.transformFlags?r.updateParameterDeclaration(n,void 0,void 0,n.dotDotDotToken,r.getGeneratedNameForNode(n),void 0,void 0,e.visitNode(n.initializer,E,e.isExpression)):e.visitEachChild(n,E,t)}function j(t){for(var r,n=0,i=t.parameters;n<i.length;n++){var a=i[n];r?r.add(a):32768&a.transformFlags&&(r=new e.Set);}return r}function J(n){var i=f,a=g;f=e.getFunctionFlags(n),g=j(n);var o=r.updateConstructorDeclaration(n,void 0,n.modifiers,e.visitParameterList(n.parameters,R,t),G(n));return f=i,g=a,o}function z(n){var i=f,a=g;f=e.getFunctionFlags(n),g=j(n);var o=r.updateGetAccessorDeclaration(n,void 0,n.modifiers,e.visitNode(n.name,E,e.isPropertyName),e.visitParameterList(n.parameters,R,t),void 0,G(n));return f=i,g=a,o}function K(n){var i=f,a=g;f=e.getFunctionFlags(n),g=j(n);var o=r.updateSetAccessorDeclaration(n,void 0,n.modifiers,e.visitNode(n.name,E,e.isPropertyName),e.visitParameterList(n.parameters,R,t),G(n));return f=i,g=a,o}function U(n){var i=f,a=g;f=e.getFunctionFlags(n),g=j(n);var o=r.updateMethodDeclaration(n,void 0,1&f?e.visitNodes(n.modifiers,F,e.isModifier):n.modifiers,2&f?void 0:n.asteriskToken,e.visitNode(n.name,E,e.isPropertyName),e.visitNode(void 0,E,e.isToken),void 0,e.visitParameterList(n.parameters,R,t),void 0,2&f&&1&f?H(n):G(n));return f=i,g=a,o}function V(n){var i=f,a=g;f=e.getFunctionFlags(n),g=j(n);var o=r.updateFunctionDeclaration(n,void 0,1&f?e.visitNodes(n.modifiers,F,e.isModifier):n.modifiers,2&f?void 0:n.asteriskToken,n.name,void 0,e.visitParameterList(n.parameters,R,t),void 0,2&f&&1&f?H(n):G(n));return f=i,g=a,o}function q(n){var i=f,a=g;f=e.getFunctionFlags(n),g=j(n);var o=r.updateArrowFunction(n,n.modifiers,void 0,e.visitParameterList(n.parameters,R,t),void 0,n.equalsGreaterThanToken,G(n));return f=i,g=a,o}function W(n){var i=f,a=g;f=e.getFunctionFlags(n),g=j(n);var o=r.updateFunctionExpression(n,1&f?e.visitNodes(n.modifiers,F,e.isModifier):n.modifiers,2&f?void 0:n.asteriskToken,n.name,void 0,e.visitParameterList(n.parameters,R,t),void 0,2&f&&1&f?H(n):G(n));return f=i,g=a,o}function H(n){a();var s=[],l=r.copyPrologue(n.body.statements,s,!1,E);Q(s,n);var _=v,d=h;v=new e.Set,h=!1;var f=r.createReturnStatement(i().createAsyncGeneratorHelper(r.createFunctionExpression(void 0,r.createToken(41),n.name&&r.getGeneratedNameForNode(n.name),void 0,[],void 0,r.updateBlock(n.body,e.visitLexicalEnvironment(n.body.statements,E,t,l))),!!(1&D))),g=u>=2&&6144&c.getNodeCheckFlags(n);if(g){0==(1&p)&&(p|=1,t.enableSubstitution(208),t.enableSubstitution(206),t.enableSubstitution(207),t.enableEmitNotification(257),t.enableEmitNotification(169),t.enableEmitNotification(172),t.enableEmitNotification(173),t.enableEmitNotification(171),t.enableEmitNotification(237));var m=e.createSuperAccessVariableStatement(r,c,n,v);S[e.getNodeId(m)]=!0,e.insertStatementsAfterStandardPrologue(s,[m]);}s.push(f),e.insertStatementsAfterStandardPrologue(s,o());var y=r.updateBlock(n.body,s);return g&&h&&(4096&c.getNodeCheckFlags(n)?e.addEmitHelper(y,e.advancedAsyncSuperHelper):2048&c.getNodeCheckFlags(n)&&e.addEmitHelper(y,e.asyncSuperHelper)),v=_,h=d,y}function G(t){var n;a();var i=0,s=[],c=null!==(n=e.visitNode(t.body,E,e.isConciseBody))&&void 0!==n?n:r.createBlock([]);e.isBlock(c)&&(i=r.copyPrologue(c.statements,s,!1,E)),e.addRange(s,Q(void 0,t));var l=o();if(i>0||e.some(s)||e.some(l)){var u=r.converters.convertToFunctionBlock(c,!0);return e.insertStatementsAfterStandardPrologue(s,l),e.addRange(s,u.statements.slice(i)),r.updateBlock(u,e.setTextRange(r.createNodeArray(s),u.statements))}return c}function Q(n,i){for(var a=!1,o=0,s=i.parameters;o<s.length;o++){var c=s[o];if(a){if(e.isBindingPattern(c.name)){if(c.name.elements.length>0){var l=e.flattenDestructuringBinding(c,E,t,0,r.getGeneratedNameForNode(c));if(e.some(l)){var u=r.createVariableDeclarationList(l),_=r.createVariableStatement(void 0,u);e.setEmitFlags(_,1048576),n=e.append(n,_);}}else if(c.initializer){var d=r.getGeneratedNameForNode(c),p=e.visitNode(c.initializer,E,e.isExpression),f=r.createAssignment(d,p);_=r.createExpressionStatement(f),e.setEmitFlags(_,1048576),n=e.append(n,_);}}else if(c.initializer){d=r.cloneNode(c.name),e.setTextRange(d,c.name),e.setEmitFlags(d,48),p=e.visitNode(c.initializer,E,e.isExpression),e.addEmitFlags(p,1584),f=r.createAssignment(d,p),e.setTextRange(f,c),e.setEmitFlags(f,1536);var g=r.createBlock([r.createExpressionStatement(f)]);e.setTextRange(g,c),e.setEmitFlags(g,1953);var m=r.createTypeCheck(r.cloneNode(c.name),"undefined");_=r.createIfStatement(m,g),e.startOnNewLine(_),e.setTextRange(_,c),e.setEmitFlags(_,1050528),n=e.append(n,_);}}else 32768&c.transformFlags&&(a=!0,l=e.flattenDestructuringBinding(c,E,t,1,r.getGeneratedNameForNode(c),!1,!0),e.some(l)&&(u=r.createVariableDeclarationList(l),_=r.createVariableStatement(void 0,u),e.setEmitFlags(_,1048576),n=e.append(n,_)));}return n}function X(t){return 106===t.expression.kind?e.setTextRange(r.createPropertyAccessExpression(r.createUniqueName("_super",48),t.name),t):t}function Y(t){return 106===t.expression.kind?(n=t.argumentExpression,i=t,4096&x?e.setTextRange(r.createPropertyAccessExpression(r.createCallExpression(r.createIdentifier("_superIndex"),void 0,[n]),"value"),i):e.setTextRange(r.createCallExpression(r.createIdentifier("_superIndex"),void 0,[n]),i)):t;var n,i;}};}(t),function(e){e.transformES2019=function(t){var r=t.factory;return e.chainBundle(t,(function(r){return r.isDeclarationFile?r:e.visitEachChild(r,n,t)}));function n(i){if(0==(64&i.transformFlags))return i;switch(i.kind){case 292:return function(i){return i.variableDeclaration?e.visitEachChild(i,n,t):r.updateCatchClause(i,r.createVariableDeclaration(r.createTempVariable(void 0)),e.visitNode(i.block,n,e.isBlock))}(i);default:return e.visitEachChild(i,n,t)}}};}(t),function(e){e.transformES2020=function(t){var r=t.factory,n=t.hoistVariableDeclaration;return e.chainBundle(t,(function(r){return r.isDeclarationFile?r:e.visitEachChild(r,i,t)}));function i(a){if(0==(32&a.transformFlags))return a;switch(a.kind){case 208:var u=o(a,!1);return e.Debug.assertNotNode(u,e.isSyntheticReference),u;case 206:case 207:return e.isOptionalChain(a)?(u=c(a,!1,!1),e.Debug.assertNotNode(u,e.isSyntheticReference),u):e.visitEachChild(a,i,t);case 221:return 60===a.operatorToken.kind?function(t){var a=e.visitNode(t.left,i,e.isExpression),o=a;return e.isSimpleCopiableExpression(a)||(o=r.createTempVariable(n),a=r.createAssignment(o,a)),e.setTextRange(r.createConditionalExpression(l(a,o),void 0,o,void 0,e.visitNode(t.right,i,e.isExpression)),t)}(a):e.visitEachChild(a,i,t);case 215:return function(t){return e.isOptionalChain(e.skipParentheses(t.expression))?e.setOriginalNode(s(t.expression,!1,!0),t):r.updateDeleteExpression(t,e.visitNode(t.expression,i,e.isExpression))}(a);default:return e.visitEachChild(a,i,t)}}function a(t,n,i){var a=s(t.expression,n,i);return e.isSyntheticReference(a)?r.createSyntheticReferenceExpression(r.updateParenthesizedExpression(t,a.expression),a.thisArg):r.updateParenthesizedExpression(t,a)}function o(n,o){if(e.isOptionalChain(n))return c(n,o,!1);if(e.isParenthesizedExpression(n.expression)&&e.isOptionalChain(e.skipParentheses(n.expression))){var s=a(n.expression,!0,!1),l=e.visitNodes(n.arguments,i,e.isExpression);return e.isSyntheticReference(s)?e.setTextRange(r.createFunctionCallCall(s.expression,s.thisArg,l),n):r.updateCallExpression(n,s,void 0,l)}return e.visitEachChild(n,i,t)}function s(t,s,l){switch(t.kind){case 212:return a(t,s,l);case 206:case 207:return function(t,a,o){if(e.isOptionalChain(t))return c(t,a,o);var s,l=e.visitNode(t.expression,i,e.isExpression);return e.Debug.assertNotNode(l,e.isSyntheticReference),a&&(e.isSimpleCopiableExpression(l)?s=l:(s=r.createTempVariable(n),l=r.createAssignment(s,l))),l=206===t.kind?r.updatePropertyAccessExpression(t,l,e.visitNode(t.name,i,e.isIdentifier)):r.updateElementAccessExpression(t,l,e.visitNode(t.argumentExpression,i,e.isExpression)),s?r.createSyntheticReferenceExpression(l,s):l}(t,s,l);case 208:return o(t,s);default:return e.visitNode(t,i,e.isExpression)}}function c(t,a,o){var c=function(t){e.Debug.assertNotNode(t,e.isNonNullChain);for(var r=[t];!t.questionDotToken&&!e.isTaggedTemplateExpression(t);)t=e.cast(e.skipPartiallyEmittedExpressions(t.expression),e.isOptionalChain),e.Debug.assertNotNode(t,e.isNonNullChain),r.unshift(t);return {expression:t.expression,chain:r}}(t),u=c.expression,_=c.chain,d=s(e.skipPartiallyEmittedExpressions(u),e.isCallChain(_[0]),!1),p=e.isSyntheticReference(d)?d.thisArg:void 0,f=e.isSyntheticReference(d)?d.expression:d,g=r.restoreOuterExpressions(u,f,8);e.isSimpleCopiableExpression(f)||(f=r.createTempVariable(n),g=r.createAssignment(f,g));for(var m,y=f,v=0;v<_.length;v++){var h=_[v];switch(h.kind){case 206:case 207:v===_.length-1&&a&&(e.isSimpleCopiableExpression(y)?m=y:(m=r.createTempVariable(n),y=r.createAssignment(m,y))),y=206===h.kind?r.createPropertyAccessExpression(y,e.visitNode(h.name,i,e.isIdentifier)):r.createElementAccessExpression(y,e.visitNode(h.argumentExpression,i,e.isExpression));break;case 208:0===v&&p?(e.isGeneratedIdentifier(p)||(p=r.cloneNode(p),e.addEmitFlags(p,1536)),y=r.createFunctionCallCall(y,106===p.kind?r.createThis():p,e.visitNodes(h.arguments,i,e.isExpression))):y=r.createCallExpression(y,void 0,e.visitNodes(h.arguments,i,e.isExpression));}e.setOriginalNode(y,h);}var b=o?r.createConditionalExpression(l(g,f,!0),void 0,r.createTrue(),void 0,r.createDeleteExpression(y)):r.createConditionalExpression(l(g,f,!0),void 0,r.createVoidZero(),void 0,y);return e.setTextRange(b,t),m?r.createSyntheticReferenceExpression(b,m):b}function l(e,t,n){return r.createBinaryExpression(r.createBinaryExpression(e,r.createToken(n?36:37),r.createNull()),r.createToken(n?56:55),r.createBinaryExpression(t,r.createToken(n?36:37),r.createVoidZero()))}};}(t),function(e){e.transformES2021=function(t){var r=t.hoistVariableDeclaration,n=t.factory;return e.chainBundle(t,(function(r){return r.isDeclarationFile?r:e.visitEachChild(r,i,t)}));function i(a){if(0==(16&a.transformFlags))return a;switch(a.kind){case 221:var o=a;if(e.isLogicalOrCoalescingAssignmentExpression(o))return function(t){var a=t.operatorToken,o=e.getNonAssignmentOperatorForCompoundAssignment(a.kind),s=e.skipParentheses(e.visitNode(t.left,i,e.isLeftHandSideExpression)),c=s,l=e.skipParentheses(e.visitNode(t.right,i,e.isExpression));if(e.isAccessExpression(s)){var u=e.isSimpleCopiableExpression(s.expression),_=u?s.expression:n.createTempVariable(r),d=u?s.expression:n.createAssignment(_,s.expression);if(e.isPropertyAccessExpression(s))c=n.createPropertyAccessExpression(_,s.name),s=n.createPropertyAccessExpression(d,s.name);else {var p=e.isSimpleCopiableExpression(s.argumentExpression),f=p?s.argumentExpression:n.createTempVariable(r);c=n.createElementAccessExpression(_,f),s=n.createElementAccessExpression(d,p?s.argumentExpression:n.createAssignment(f,s.argumentExpression));}}return n.createBinaryExpression(s,o,n.createParenthesizedExpression(n.createAssignment(c,l)))}(o);default:return e.visitEachChild(a,i,t)}}};}(t),function(e){e.transformESNext=function(t){return e.chainBundle(t,(function(n){return n.isDeclarationFile?n:e.visitEachChild(n,r,t)}));function r(n){return 0==(4&n.transformFlags)?n:(e.visitEachChild(n,r,t))}};}(t),function(e){e.transformJsx=function(r){var n,i,a=r.factory,o=r.getEmitHelperFactory,s=r.getCompilerOptions();return e.chainBundle(r,(function(t){if(t.isDeclarationFile)return t;n=t,(i={}).importSpecifier=e.getJSXImplicitImportBase(s,t);var o=e.visitEachChild(t,u,r);e.addEmitHelpers(o,r.readEmitHelpers());var c=o.statements;if(i.filenameDeclaration&&(c=e.insertStatementAfterCustomPrologue(c.slice(),a.createVariableStatement(void 0,a.createVariableDeclarationList([i.filenameDeclaration],2)))),i.utilizedImplicitRuntimeImports)for(var l=0,_=e.arrayFrom(i.utilizedImplicitRuntimeImports.entries());l<_.length;l++){var d=_[l],p=d[0],f=d[1];if(e.isExternalModule(t)){var g=a.createImportDeclaration(void 0,void 0,a.createImportClause(!1,void 0,a.createNamedImports(e.arrayFrom(f.values()))),a.createStringLiteral(p),void 0);e.setParentRecursive(g,!1),c=e.insertStatementAfterCustomPrologue(c.slice(),g);}else if(e.isExternalOrCommonJsModule(t)){var m=a.createVariableStatement(void 0,a.createVariableDeclarationList([a.createVariableDeclaration(a.createObjectBindingPattern(e.map(e.arrayFrom(f.values()),(function(e){return a.createBindingElement(void 0,e.propertyName,e.name)}))),void 0,void 0,a.createCallExpression(a.createIdentifier("require"),void 0,[a.createStringLiteral(p)]))],2));e.setParentRecursive(m,!1),c=e.insertStatementAfterCustomPrologue(c.slice(),m);}}return c!==o.statements&&(o=a.updateSourceFile(o,c)),i=void 0,o}));function c(){if(i.filenameDeclaration)return i.filenameDeclaration.name;var e=a.createVariableDeclaration(a.createUniqueName("_jsxFileName",48),void 0,void 0,a.createStringLiteral(n.fileName));return i.filenameDeclaration=e,i.filenameDeclaration.name}function l(t){var r,n,o="createElement"===t?i.importSpecifier:e.getJSXRuntimeImport(i.importSpecifier,s),c=null===(n=null===(r=i.utilizedImplicitRuntimeImports)||void 0===r?void 0:r.get(o))||void 0===n?void 0:n.get(t);if(c)return c.name;i.utilizedImplicitRuntimeImports||(i.utilizedImplicitRuntimeImports=new e.Map);var l=i.utilizedImplicitRuntimeImports.get(o);l||(l=new e.Map,i.utilizedImplicitRuntimeImports.set(o,l));var u=a.createUniqueName("_".concat(t),112),_=a.createImportSpecifier(!1,a.createIdentifier(t),u);return u.generatedImportReference=_,l.set(t,_),u}function u(t){return 2&t.transformFlags?function(t){switch(t.kind){case 278:return p(t,!1);case 279:return f(t,!1);case 282:return g(t,!1);case 288:return F(t);default:return e.visitEachChild(t,u,r)}}(t):t}function _(t){switch(t.kind){case 11:return function(t){var r=function(t){for(var r,n=0,i=-1,a=0;a<t.length;a++){var o=t.charCodeAt(a);e.isLineBreak(o)?(-1!==n&&-1!==i&&(r=k(r,t.substr(n,i-n+1))),n=-1):e.isWhiteSpaceSingleLine(o)||(i=a,-1===n&&(n=a));}return -1!==n?k(r,t.substr(n)):r}(t.text);return void 0===r?void 0:a.createStringLiteral(r)}(t);case 288:return F(t);case 278:return p(t,!0);case 279:return f(t,!0);case 282:return g(t,!0);default:return e.Debug.failBadSyntaxKind(t)}}function d(t){return void 0===i.importSpecifier||function(t){for(var r=!1,n=0,i=t.attributes.properties;n<i.length;n++){var a=i[n];if(e.isJsxSpreadAttribute(a))r=!0;else if(r&&e.isJsxAttribute(a)&&"key"===a.name.escapedText)return !0}return !1}(t)}function p(e,t){return (d(e.openingElement)?h:y)(e.openingElement,e.children,t,e)}function f(e,t){return (d(e)?h:y)(e,void 0,t,e)}function g(e,t){return (void 0===i.importSpecifier?x:b)(e.openingFragment,e.children,t,e)}function m(t){var r=e.getSemanticJsxChildren(t);if(1===e.length(r)&&!r[0].dotDotDotToken){var n=_(r[0]);return n&&a.createPropertyAssignment("children",n)}var i=e.mapDefined(t,_);return e.length(i)?a.createPropertyAssignment("children",a.createArrayLiteralExpression(i)):void 0}function y(t,r,n,i){var o=N(t),s=r&&r.length?m(r):void 0,c=e.find(t.attributes.properties,(function(t){return !!t.name&&e.isIdentifier(t.name)&&"key"===t.name.escapedText})),l=c?e.filter(t.attributes.properties,(function(e){return e!==c})):t.attributes.properties;return v(o,e.length(l)?D(l,s):a.createObjectLiteralExpression(s?[s]:e.emptyArray),c,r||e.emptyArray,n,i)}function v(t,r,i,o,u,_){var d,p=e.getSemanticJsxChildren(o),f=e.length(p)>1||!!(null===(d=p[0])||void 0===d?void 0:d.dotDotDotToken),g=[t,r];if(i&&g.push(C(i.initializer)),5===s.jsx){var m=e.getOriginalNode(n);if(m&&e.isSourceFile(m)){void 0===i&&g.push(a.createVoidZero()),g.push(f?a.createTrue():a.createFalse());var y=e.getLineAndCharacterOfPosition(m,_.pos);g.push(a.createObjectLiteralExpression([a.createPropertyAssignment("fileName",c()),a.createPropertyAssignment("lineNumber",a.createNumericLiteral(y.line+1)),a.createPropertyAssignment("columnNumber",a.createNumericLiteral(y.character+1))])),g.push(a.createThis());}}var v=e.setTextRange(a.createCallExpression(function(e){return l(function(e){return 5===s.jsx?"jsxDEV":e?"jsxs":"jsx"}(e))}(f),void 0,g),_);return u&&e.startOnNewLine(v),v}function h(t,o,c,u){var d=N(t),p=t.attributes.properties,f=e.length(p)?D(p):a.createNull(),g=void 0===i.importSpecifier?e.createJsxFactoryExpression(a,r.getEmitResolver().getJsxFactoryEntity(n),s.reactNamespace,t):l("createElement"),m=e.createExpressionForJsxElement(a,g,d,f,e.mapDefined(o,_),u);return c&&e.startOnNewLine(m),m}function b(e,t,r,n){var i;if(t&&t.length){var o=function(e){var t=m(e);return t&&a.createObjectLiteralExpression([t])}(t);o&&(i=o);}return v(l("Fragment"),i||a.createObjectLiteralExpression([]),void 0,t,r,n)}function x(t,i,o,c){var l=e.createExpressionForJsxFragment(a,r.getEmitResolver().getJsxFactoryEntity(n),r.getEmitResolver().getJsxFragmentFactoryEntity(n),s.reactNamespace,e.mapDefined(i,_),t,c);return o&&e.startOnNewLine(l),l}function D(t,r){var n=e.getEmitScriptTarget(s);return n&&n>=5?a.createObjectLiteralExpression(function(t,r){var n=e.flatten(e.spanMap(t,e.isJsxSpreadAttribute,(function(t,r){return e.map(t,(function(t){return r?(n=t,a.createSpreadAssignment(e.visitNode(n.expression,u,e.isExpression))):T(t);var n;}))})));return r&&n.push(r),n}(t,r)):function(t,r){var n=e.flatten(e.spanMap(t,e.isJsxSpreadAttribute,(function(t,r){return r?e.map(t,S):a.createObjectLiteralExpression(e.map(t,T))})));return e.isJsxSpreadAttribute(t[0])&&n.unshift(a.createObjectLiteralExpression()),r&&n.push(a.createObjectLiteralExpression([r])),e.singleOrUndefined(n)||o().createAssignHelper(n)}(t,r)}function S(t){return e.visitNode(t.expression,u,e.isExpression)}function T(t){var r=function(t){var r=t.name,n=e.idText(r);return /^[A-Za-z_]\w*$/.test(n)?r:a.createStringLiteral(n)}(t),n=C(t.initializer);return a.createPropertyAssignment(r,n)}function C(t){if(void 0===t)return a.createTrue();if(10===t.kind){var r=void 0!==t.singleQuote?t.singleQuote:!e.isStringDoubleQuoted(t,n),i=a.createStringLiteral(((s=E(o=t.text))===o?void 0:s)||t.text,r);return e.setTextRange(i,t)}return 288===t.kind?void 0===t.expression?a.createTrue():e.visitNode(t.expression,u,e.isExpression):e.Debug.failBadSyntaxKind(t);var o,s;}function k(e,t){var r=E(t);return void 0===e?r:e+" "+r}function E(r){return r.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g,(function(r,n,i,a,o,s,c){if(o)return e.utf16EncodeAsString(parseInt(o,10));if(s)return e.utf16EncodeAsString(parseInt(s,16));var l=t.get(c);return l?e.utf16EncodeAsString(l):r}))}function N(t){if(278===t.kind)return N(t.openingElement);var r=t.tagName;return e.isIdentifier(r)&&e.isIntrinsicJsxName(r.escapedText)?a.createStringLiteral(e.idText(r)):e.createExpressionFromEntityName(a,r)}function F(t){var r=e.visitNode(t.expression,u,e.isExpression);return t.dotDotDotToken?a.createSpreadElement(r):r}};var t=new e.Map(e.getEntries({quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830}));}(t),function(e){e.transformES2016=function(t){var r=t.factory,n=t.hoistVariableDeclaration;return e.chainBundle(t,(function(r){return r.isDeclarationFile?r:e.visitEachChild(r,i,t)}));function i(a){if(0==(512&a.transformFlags))return a;switch(a.kind){case 221:return function(a){switch(a.operatorToken.kind){case 67:return function(t){var a,o,s=e.visitNode(t.left,i,e.isExpression),c=e.visitNode(t.right,i,e.isExpression);if(e.isElementAccessExpression(s)){var l=r.createTempVariable(n),u=r.createTempVariable(n);a=e.setTextRange(r.createElementAccessExpression(e.setTextRange(r.createAssignment(l,s.expression),s.expression),e.setTextRange(r.createAssignment(u,s.argumentExpression),s.argumentExpression)),s),o=e.setTextRange(r.createElementAccessExpression(l,u),s);}else e.isPropertyAccessExpression(s)?(l=r.createTempVariable(n),a=e.setTextRange(r.createPropertyAccessExpression(e.setTextRange(r.createAssignment(l,s.expression),s.expression),s.name),s),o=e.setTextRange(r.createPropertyAccessExpression(l,s.name),s)):(a=s,o=s);return e.setTextRange(r.createAssignment(a,e.setTextRange(r.createGlobalMethodCall("Math","pow",[o,c]),t)),t)}(a);case 42:return function(t){var n=e.visitNode(t.left,i,e.isExpression),a=e.visitNode(t.right,i,e.isExpression);return e.setTextRange(r.createGlobalMethodCall("Math","pow",[n,a]),t)}(a);default:return e.visitEachChild(a,i,t)}}(a);default:return e.visitEachChild(a,i,t)}}};}(t),function(e){var t,r,i,a,o,s;function c(e,t){return {kind:e,expression:t}}!function(e){e[e.CapturedThis=1]="CapturedThis",e[e.BlockScopedBindings=2]="BlockScopedBindings";}(t||(t={})),function(e){e[e.Body=1]="Body",e[e.Initializer=2]="Initializer";}(r||(r={})),function(e){e[e.ToOriginal=0]="ToOriginal",e[e.ToOutParameter=1]="ToOutParameter";}(i||(i={})),function(e){e[e.Break=2]="Break",e[e.Continue=4]="Continue",e[e.Return=8]="Return";}(a||(a={})),function(e){e[e.None=0]="None",e[e.Function=1]="Function",e[e.ArrowFunction=2]="ArrowFunction",e[e.AsyncFunctionBody=4]="AsyncFunctionBody",e[e.NonStaticClassElement=8]="NonStaticClassElement",e[e.CapturesThis=16]="CapturesThis",e[e.ExportedVariableStatement=32]="ExportedVariableStatement",e[e.TopLevel=64]="TopLevel",e[e.Block=128]="Block",e[e.IterationStatement=256]="IterationStatement",e[e.IterationStatementBlock=512]="IterationStatementBlock",e[e.IterationContainer=1024]="IterationContainer",e[e.ForStatement=2048]="ForStatement",e[e.ForInOrForOfStatement=4096]="ForInOrForOfStatement",e[e.ConstructorWithCapturedSuper=8192]="ConstructorWithCapturedSuper",e[e.StaticInitializer=16384]="StaticInitializer",e[e.AncestorFactsMask=32767]="AncestorFactsMask",e[e.BlockScopeIncludes=0]="BlockScopeIncludes",e[e.BlockScopeExcludes=7104]="BlockScopeExcludes",e[e.SourceFileIncludes=64]="SourceFileIncludes",e[e.SourceFileExcludes=8064]="SourceFileExcludes",e[e.FunctionIncludes=65]="FunctionIncludes",e[e.FunctionExcludes=32670]="FunctionExcludes",e[e.AsyncFunctionBodyIncludes=69]="AsyncFunctionBodyIncludes",e[e.AsyncFunctionBodyExcludes=32662]="AsyncFunctionBodyExcludes",e[e.ArrowFunctionIncludes=66]="ArrowFunctionIncludes",e[e.ArrowFunctionExcludes=15232]="ArrowFunctionExcludes",e[e.ConstructorIncludes=73]="ConstructorIncludes",e[e.ConstructorExcludes=32662]="ConstructorExcludes",e[e.DoOrWhileStatementIncludes=1280]="DoOrWhileStatementIncludes",e[e.DoOrWhileStatementExcludes=0]="DoOrWhileStatementExcludes",e[e.ForStatementIncludes=3328]="ForStatementIncludes",e[e.ForStatementExcludes=5056]="ForStatementExcludes",e[e.ForInOrForOfStatementIncludes=5376]="ForInOrForOfStatementIncludes",e[e.ForInOrForOfStatementExcludes=3008]="ForInOrForOfStatementExcludes",e[e.BlockIncludes=128]="BlockIncludes",e[e.BlockExcludes=6976]="BlockExcludes",e[e.IterationStatementBlockIncludes=512]="IterationStatementBlockIncludes",e[e.IterationStatementBlockExcludes=7104]="IterationStatementBlockExcludes",e[e.StaticInitializerIncludes=16449]="StaticInitializerIncludes",e[e.StaticInitializerExcludes=32670]="StaticInitializerExcludes",e[e.NewTarget=32768]="NewTarget",e[e.CapturedLexicalThis=65536]="CapturedLexicalThis",e[e.SubtreeFactsMask=-32768]="SubtreeFactsMask",e[e.ArrowFunctionSubtreeExcludes=0]="ArrowFunctionSubtreeExcludes",e[e.FunctionSubtreeExcludes=98304]="FunctionSubtreeExcludes";}(o||(o={})),function(e){e[e.None=0]="None",e[e.UnpackedSpread=1]="UnpackedSpread",e[e.PackedSpread=2]="PackedSpread";}(s||(s={})),e.transformES2015=function(t){var r,i,a,o,s,l,u=t.factory,_=t.getEmitHelperFactory,d=t.startLexicalEnvironment,p=t.resumeLexicalEnvironment,f=t.endLexicalEnvironment,g=t.hoistVariableDeclaration,m=t.getCompilerOptions(),y=t.getEmitResolver(),v=t.onSubstituteNode,h=t.onEmitNode;function b(t){o=e.append(o,u.createVariableDeclaration(t));}return t.onEmitNode=function(t,r,n){if(1&l&&e.isFunctionLike(r)){var i=x(32670,8&e.getEmitFlags(r)?81:65);return h(t,r,n),void D(i,0,0)}h(t,r,n);},t.onSubstituteNode=function(t,r){return r=v(t,r),1===t?function(t){switch(t.kind){case 79:return function(t){if(2&l&&!e.isInternalName(t)){var r=y.getReferencedDeclarationWithCollidingName(t);if(r&&(!e.isClassLike(r)||!function(t,r){var n=e.getParseTreeNode(r);if(!n||n===t||n.end<=t.pos||n.pos>=t.end)return !1;for(var i=e.getEnclosingBlockScopeContainer(t);n;){if(n===i||n===t)return !1;if(e.isClassElement(n)&&n.parent===t)return !0;n=n.parent;}return !1}(r,t)))return e.setTextRange(u.getGeneratedNameForNode(e.getNameOfDeclaration(r)),t)}return t}(t);case 108:return function(t){return 1&l&&16&a?e.setTextRange(u.createUniqueName("_this",48),t):t}(t)}return t}(r):e.isIdentifier(r)?function(t){if(2&l&&!e.isInternalName(t)){var r=e.getParseTreeNode(t,e.isIdentifier);if(r&&function(e){switch(e.parent.kind){case 203:case 257:case 260:case 254:return e.parent.name===e&&y.isDeclarationWithCollidingName(e.parent)}return !1}(r))return e.setTextRange(u.getGeneratedNameForNode(r),t)}return t}(r):r},e.chainBundle(t,(function(n){if(n.isDeclarationFile)return n;r=n,i=n.text;var s=function(t){var r=x(8064,64),n=[],i=[];d();var a=u.copyPrologue(t.statements,n,!1,C);return e.addRange(i,e.visitNodes(t.statements,C,e.isStatement,a)),o&&i.push(u.createVariableStatement(void 0,u.createVariableDeclarationList(o))),u.mergeLexicalEnvironment(n,f()),z(n,t),D(r,0,0),u.updateSourceFile(t,e.setTextRange(u.createNodeArray(e.concatenate(n,i)),t.statements))}(n);return e.addEmitHelpers(s,t.readEmitHelpers()),r=void 0,i=void 0,o=void 0,a=0,s}));function x(e,t){var r=a;return a=32767&(a&~e|t),r}function D(e,t,r){a=-32768&(a&~t|r)|e;}function S(e){return 0!=(8192&a)&&247===e.kind&&!e.expression}function T(t){return 0!=(1024&t.transformFlags)||void 0!==s||8192&a&&function(t){return 2097152&t.transformFlags&&(e.isReturnStatement(t)||e.isIfStatement(t)||e.isWithStatement(t)||e.isSwitchStatement(t)||e.isCaseBlock(t)||e.isCaseClause(t)||e.isDefaultClause(t)||e.isTryStatement(t)||e.isCatchClause(t)||e.isLabeledStatement(t)||e.isIterationStatement(t,!1)||e.isBlock(t))}(t)||e.isIterationStatement(t,!1)&&fe(t)||0!=(33554432&e.getEmitFlags(t))}function C(e){return T(e)?F(e,!1):e}function k(e){return T(e)?F(e,!0):e}function E(t){if(T(t)){var r=e.getOriginalNode(t);if(e.isPropertyDeclaration(r)&&e.hasStaticModifier(r)){var n=x(32670,16449),i=F(t,!1);return D(n,98304,0),i}return F(t,!1)}return t}function N(e){return 106===e.kind?Ie(!0):C(e)}function F(i,o){switch(i.kind){case 124:return;case 257:return function(t){var r=u.createVariableDeclaration(u.getLocalName(t,!0),void 0,void 0,w(t));e.setOriginalNode(r,t);var n=[],i=u.createVariableStatement(void 0,u.createVariableDeclarationList([r]));if(e.setOriginalNode(i,t),e.setTextRange(i,t),e.startOnNewLine(i),n.push(i),e.hasSyntacticModifier(t,1)){var a=e.hasSyntacticModifier(t,512)?u.createExportDefault(u.getLocalName(t)):u.createExternalModuleExport(u.getLocalName(t));e.setOriginalNode(a,i),n.push(a);}var o=e.getEmitFlags(t);return 0==(4194304&o)&&(n.push(u.createEndOfDeclarationMarker(t)),e.setEmitFlags(i,4194304|o)),e.singleOrMany(n)}(i);case 226:return function(e){return w(e)}(i);case 164:return function(t){return t.dotDotDotToken?void 0:e.isBindingPattern(t.name)?e.setOriginalNode(e.setTextRange(u.createParameterDeclaration(void 0,void 0,void 0,u.getGeneratedNameForNode(t),void 0,void 0,void 0),t),t):t.initializer?e.setOriginalNode(e.setTextRange(u.createParameterDeclaration(void 0,void 0,void 0,t.name,void 0,void 0,void 0),t),t):t}(i);case 256:return function(r){var n=s;s=void 0;var i=x(32670,65),o=e.visitParameterList(r.parameters,C,t),c=Q(r),l=32768&a?u.getLocalName(r):r.name;return D(i,98304,0),s=n,u.updateFunctionDeclaration(r,void 0,e.visitNodes(r.modifiers,C,e.isModifier),r.asteriskToken,l,void 0,o,void 0,c)}(i);case 214:return function(r){8192&r.transformFlags&&!(16384&a)&&(a|=65536);var n=s;s=void 0;var i=x(15232,66),o=u.createFunctionExpression(void 0,void 0,void 0,void 0,e.visitParameterList(r.parameters,C,t),void 0,Q(r));return e.setTextRange(o,r),e.setOriginalNode(o,r),e.setEmitFlags(o,8),D(i,0,0),s=n,o}(i);case 213:return function(r){var n=262144&e.getEmitFlags(r)?x(32662,69):x(32670,65),i=s;s=void 0;var o=e.visitParameterList(r.parameters,C,t),c=Q(r),l=32768&a?u.getLocalName(r):r.name;return D(n,98304,0),s=i,u.updateFunctionExpression(r,void 0,r.asteriskToken,l,void 0,o,void 0,c)}(i);case 254:return Z(i);case 79:return P(i);case 255:return function(r){if(3&r.flags||262144&r.transformFlags){3&r.flags&&Oe();var n=e.flatMap(r.declarations,1&r.flags?Y:Z),i=u.createVariableDeclarationList(n);return e.setOriginalNode(i,r),e.setTextRange(i,r),e.setCommentRange(i,r),262144&r.transformFlags&&(e.isBindingPattern(r.declarations[0].name)||e.isBindingPattern(e.last(r.declarations).name))&&e.setSourceMapRange(i,function(t){for(var r=-1,n=-1,i=0,a=t;i<a.length;i++){var o=a[i];r=-1===r?o.pos:-1===o.pos?r:Math.min(r,o.pos),n=Math.max(n,o.end);}return e.createRange(r,n)}(n)),i}return e.visitEachChild(r,C,t)}(i);case 249:return function(r){if(void 0!==s){var n=s.allowedNonLabeledJumps;s.allowedNonLabeledJumps|=2;var i=e.visitEachChild(r,C,t);return s.allowedNonLabeledJumps=n,i}return e.visitEachChild(r,C,t)}(i);case 263:return function(r){var n=x(7104,0),i=e.visitEachChild(r,C,t);return D(n,0,0),i}(i);case 235:return function(r,n){var i=256&a?x(7104,512):x(6976,128),o=e.visitEachChild(r,C,t);return D(i,0,0),o}(i);case 246:case 245:return function(r){if(s){var n=246===r.kind?2:4;if(!(r.label&&s.labels&&s.labels.get(e.idText(r.label))||!r.label&&s.allowedNonLabeledJumps&n)){var i=void 0,a=r.label;a?246===r.kind?(i="break-".concat(a.escapedText),xe(s,!0,e.idText(a),i)):(i="continue-".concat(a.escapedText),xe(s,!1,e.idText(a),i)):246===r.kind?(s.nonLocalJumps|=2,i="break"):(s.nonLocalJumps|=4,i="continue");var o=u.createStringLiteral(i);if(s.loopOutParameters.length){for(var c=s.loopOutParameters,l=void 0,_=0;_<c.length;_++){var d=he(c[_],1);l=0===_?d:u.createBinaryExpression(l,27,d);}o=u.createBinaryExpression(l,27,o);}return u.createReturnStatement(o)}}return e.visitEachChild(r,C,t)}(i);case 250:return function(t){s&&!s.labels&&(s.labels=new e.Map);var r=e.unwrapInnermostStatementOfLabel(t,s&&$);return e.isIterationStatement(r,!1)?function(e,t){switch(e.kind){case 240:case 241:return re(e,t);case 242:return ne(e,t);case 243:return ie(e,t);case 244:return ae(e,t)}}(r,t):u.restoreEnclosingLabel(e.visitNode(r,C,e.isStatement,u.liftToBlock),t,s&&ee)}(i);case 240:case 241:return re(i,void 0);case 242:return ne(i,void 0);case 243:return ie(i,void 0);case 244:return ae(i,void 0);case 238:return function(r){return e.visitEachChild(r,k,t)}(i);case 205:return function(r){for(var n=r.properties,i=-1,o=!1,s=0;s<n.length;s++){var c=n[s];if(524288&c.transformFlags&&4&a||(o=162===e.Debug.checkDefined(c.name).kind)){i=s;break}}if(i<0)return e.visitEachChild(r,C,t);var l=u.createTempVariable(g),_=[],d=u.createAssignment(l,e.setEmitFlags(u.createObjectLiteralExpression(e.visitNodes(n,C,e.isObjectLiteralElementLike,0,i),r.multiLine),o?65536:0));return r.multiLine&&e.startOnNewLine(d),_.push(d),function(t,r,n,i){for(var a=r.properties,o=a.length,s=i;s<o;s++){var c=a[s];switch(c.kind){case 172:case 173:var l=e.getAllAccessorDeclarations(r.properties,c);c===l.firstAccessor&&t.push(H(n,l,r,!!r.multiLine));break;case 169:t.push(ke(c,n,r,r.multiLine));break;case 296:t.push(Te(c,n,r.multiLine));break;case 297:t.push(Ce(c,n,r.multiLine));break;default:e.Debug.failBadSyntaxKind(r);}}}(_,r,l,i),_.push(r.multiLine?e.startOnNewLine(e.setParent(e.setTextRange(u.cloneNode(l),l),l.parent)):l),u.inlineExpressions(_)}(i);case 292:return function(r){var i,a,o,s,c=x(7104,0);if(e.Debug.assert(!!r.variableDeclaration,"Catch clause variable should always be present when downleveling ES2015."),e.isBindingPattern(r.variableDeclaration.name)){var l=u.createTempVariable(void 0),_=u.createVariableDeclaration(l);e.setTextRange(_,r.variableDeclaration);var d=e.flattenDestructuringBinding(r.variableDeclaration,C,t,0,l),p=u.createVariableDeclarationList(d);e.setTextRange(p,r.variableDeclaration);var f=u.createVariableStatement(void 0,p);i=u.updateCatchClause(r,_,(a=r.block,o=f,s=e.visitNodes(a.statements,C,e.isStatement),u.updateBlock(a,n$4([o],s,!0))));}else i=e.visitEachChild(r,C,t);return D(c,0,0),i}(i);case 297:return function(t){return e.setTextRange(u.createPropertyAssignment(t.name,P(u.cloneNode(t.name))),t)}(i);case 162:return function(r){return e.visitEachChild(r,C,t)}(i);case 204:return function(r){return e.some(r.elements,e.isSpreadElement)?Ne(r.elements,!1,!!r.multiLine,!!r.elements.hasTrailingComma):e.visitEachChild(r,C,t)}(i);case 208:return function(t){if(33554432&e.getEmitFlags(t))return function(t){var r=e.cast(e.cast(e.skipOuterExpressions(t.expression),e.isArrowFunction).body,e.isBlock),n=function(t){return e.isVariableStatement(t)&&!!e.first(t.declarationList.declarations).initializer},i=s;s=void 0;var a=e.visitNodes(r.statements,E,e.isStatement);s=i;var o=e.filter(a,n),c=e.filter(a,(function(e){return !n(e)})),l=e.cast(e.first(o),e.isVariableStatement).declarationList.declarations[0],_=e.skipOuterExpressions(l.initializer),d=e.tryCast(_,e.isAssignmentExpression);!d&&e.isBinaryExpression(_)&&27===_.operatorToken.kind&&(d=e.tryCast(_.left,e.isAssignmentExpression));var p=e.cast(d?e.skipOuterExpressions(d.right):_,e.isCallExpression),f=e.cast(e.skipOuterExpressions(p.expression),e.isFunctionExpression),g=f.body.statements,m=0,y=-1,v=[];if(d){var h=e.tryCast(g[m],e.isExpressionStatement);h&&(v.push(h),m++),v.push(g[m]),m++,v.push(u.createExpressionStatement(u.createAssignment(d.left,e.cast(l.name,e.isIdentifier))));}for(;!e.isReturnStatement(e.elementAt(g,y));)y--;return e.addRange(v,g,m,y),y<-1&&e.addRange(v,g,y+1),e.addRange(v,c),e.addRange(v,o,1),u.restoreOuterExpressions(t.expression,u.restoreOuterExpressions(l.initializer,u.restoreOuterExpressions(d&&d.right,u.updateCallExpression(p,u.restoreOuterExpressions(p.expression,u.updateFunctionExpression(f,void 0,void 0,void 0,void 0,f.parameters,void 0,u.updateBlock(f.body,v))),void 0,p.arguments))))}(t);var r=e.skipOuterExpressions(t.expression);return 106===r.kind||e.isSuperProperty(r)||e.some(t.arguments,e.isSpreadElement)?Ee(t,!0):u.updateCallExpression(t,e.visitNode(t.expression,N,e.isExpression),void 0,e.visitNodes(t.arguments,C,e.isExpression))}(i);case 209:return function(r){if(e.some(r.arguments,e.isSpreadElement)){var i=u.createCallBinding(u.createPropertyAccessExpression(r.expression,"bind"),g),a=i.target,o=i.thisArg;return u.createNewExpression(u.createFunctionApplyCall(e.visitNode(a,C,e.isExpression),o,Ne(u.createNodeArray(n$4([u.createVoidZero()],r.arguments,!0)),!0,!1,!1)),void 0,[])}return e.visitEachChild(r,C,t)}(i);case 212:return function(r,n){return e.visitEachChild(r,n?k:C,t)}(i,o);case 221:return X(i,o);case 351:return function(r,n){if(n)return e.visitEachChild(r,k,t);for(var i,a=0;a<r.elements.length;a++){var o=r.elements[a],s=e.visitNode(o,a<r.elements.length-1?k:C,e.isExpression);(i||s!==o)&&(i||(i=r.elements.slice(0,a)),i.push(s));}var c=i?e.setTextRange(u.createNodeArray(i),r.elements):r.elements;return u.updateCommaListExpression(r,c)}(i,o);case 14:case 15:case 16:case 17:return function(t){return e.setTextRange(u.createStringLiteral(t.text),t)}(i);case 10:return function(t){return t.hasExtendedUnicodeEscape?e.setTextRange(u.createStringLiteral(t.text),t):t}(i);case 8:return function(t){return 384&t.numericLiteralFlags?e.setTextRange(u.createNumericLiteral(t.text),t):t}(i);case 210:return function(n){return e.processTaggedTemplateExpression(t,n,C,r,b,e.ProcessLevel.All)}(i);case 223:return function(t){for(var r=u.createStringLiteral(t.head.text),n=0,i=t.templateSpans;n<i.length;n++){var a=i[n],o=[e.visitNode(a.expression,C,e.isExpression)];a.literal.text.length>0&&o.push(u.createStringLiteral(a.literal.text)),r=u.createCallExpression(u.createPropertyAccessExpression(r,"concat"),void 0,o);}return e.setTextRange(r,t)}(i);case 224:return function(r){return e.visitEachChild(r,C,t)}(i);case 225:return function(t){return e.visitNode(t.expression,C,e.isExpression)}(i);case 106:return Ie(!1);case 108:return function(e){return 2&a&&!(16384&a)&&(a|=65536),s?2&a?(s.containsLexicalThis=!0,e):s.thisName||(s.thisName=u.createUniqueName("this")):e}(i);case 231:return function(e){return 103===e.keywordToken&&"target"===e.name.escapedText?(a|=32768,u.createUniqueName("_newTarget",48)):e}(i);case 169:return function(t){e.Debug.assert(!e.isComputedPropertyName(t.name));var r=G(t,e.moveRangePos(t,-1),void 0,void 0);return e.setEmitFlags(r,512|e.getEmitFlags(r)),e.setTextRange(u.createPropertyAssignment(t.name,r),t)}(i);case 172:case 173:return function(r){e.Debug.assert(!e.isComputedPropertyName(r.name));var n=s;s=void 0;var i,a=x(32670,65),o=e.visitParameterList(r.parameters,C,t),c=Q(r);return i=172===r.kind?u.updateGetAccessorDeclaration(r,r.decorators,r.modifiers,r.name,o,r.type,c):u.updateSetAccessorDeclaration(r,r.decorators,r.modifiers,r.name,o,c),D(a,98304,0),s=n,i}(i);case 237:return function(r){var n,i=x(0,e.hasSyntacticModifier(r,1)?32:0);if(s&&0==(3&r.declarationList.flags)&&!function(t){return 1===t.declarationList.declarations.length&&!!t.declarationList.declarations[0].initializer&&!!(33554432&e.getEmitFlags(t.declarationList.declarations[0].initializer))}(r)){for(var a=void 0,o=0,c=r.declarationList.declarations;o<c.length;o++){var l=c[o];if(me(s,l),l.initializer){var _=void 0;e.isBindingPattern(l.name)?_=e.flattenDestructuringAssignment(l,C,t,0):(_=u.createBinaryExpression(l.name,63,e.visitNode(l.initializer,C,e.isExpression)),e.setTextRange(_,l)),a=e.append(a,_);}}n=a?e.setTextRange(u.createExpressionStatement(u.inlineExpressions(a)),r):void 0;}else n=e.visitEachChild(r,C,t);return D(i,0,0),n}(i);case 247:return function(r){return s?(s.nonLocalJumps|=8,S(r)&&(r=A(r)),u.createReturnStatement(u.createObjectLiteralExpression([u.createPropertyAssignment(u.createIdentifier("value"),r.expression?e.visitNode(r.expression,C,e.isExpression):u.createVoidZero())]))):S(r)?A(r):e.visitEachChild(r,C,t)}(i);case 217:return function(r){return e.visitEachChild(r,k,t)}(i);default:return e.visitEachChild(i,C,t)}}function A(t){return e.setOriginalNode(u.createReturnStatement(u.createUniqueName("_this",48)),t)}function P(e){return s&&y.isArgumentsLocalBinding(e)?s.argumentsName||(s.argumentsName=u.createUniqueName("arguments")):e}function w(o){o.name&&Oe();var c=e.getClassExtendsHeritageElement(o),l=u.createFunctionExpression(void 0,void 0,void 0,void 0,c?[u.createParameterDeclaration(void 0,void 0,void 0,u.createUniqueName("_super",48))]:[],void 0,function(o,c){var l=[],g=u.getInternalName(o),m=e.isIdentifierANonContextualKeyword(g)?u.getGeneratedNameForNode(g):g;d(),function(t,r,n){n&&t.push(e.setTextRange(u.createExpressionStatement(_().createExtendsHelper(u.getInternalName(r))),n));}(l,o,c),function(r,i,o,c){var l=s;s=void 0;var _=x(32662,73),d=e.getFirstConstructorWithBody(i),g=function(t,r){if(!t||!r)return !1;if(e.some(t.parameters))return !1;var n=e.firstOrUndefined(t.body.statements);if(!n||!e.nodeIsSynthesized(n)||238!==n.kind)return !1;var i=n.expression;if(!e.nodeIsSynthesized(i)||208!==i.kind)return !1;var a=i.expression;if(!e.nodeIsSynthesized(a)||106!==a.kind)return !1;var o=e.singleOrUndefined(i.arguments);if(!o||!e.nodeIsSynthesized(o)||225!==o.kind)return !1;var s=o.expression;return e.isIdentifier(s)&&"arguments"===s.escapedText}(d,void 0!==c),m=u.createFunctionDeclaration(void 0,void 0,void 0,o,void 0,function(r,n){return e.visitParameterList(r&&!n?r.parameters:void 0,C,t)||[]}(d,g),void 0,function(t,r,i,o){var s=!!i&&104!==e.skipOuterExpressions(i.expression).kind;if(!t)return function(t,r){var n=[];p(),u.mergeLexicalEnvironment(n,f()),r&&n.push(u.createReturnStatement(M()));var i=u.createNodeArray(n);e.setTextRange(i,t.members);var a=u.createBlock(i,!0);return e.setTextRange(a,t),e.setEmitFlags(a,1536),a}(r,s);var c=[],l=[];p();var _,d=e.takeWhile(t.body.statements,e.isPrologueDirective),g=function(t,r){for(var n=r.length;n<t.length;n+=1){var i=e.getSuperCallFromStatement(t[n]);if(i)return {superCall:i,superStatementIndex:n}}return {superStatementIndex:-1}}(t.body.statements,d),m=g.superCall,y=g.superStatementIndex,v=-1===y?d.length:y+1,h=v;if(o||(h=u.copyStandardPrologue(t.body.statements,c,h,!1)),o||(h=u.copyCustomPrologue(t.body.statements,l,h,C,void 0)),o?_=M():m&&(_=function(e){return Ee(e,!1)}(m)),_&&(a|=8192),R(c,t),J(c,t,o),e.addRange(l,e.visitNodes(t.body.statements,C,e.isStatement,h)),u.mergeLexicalEnvironment(c,f()),U(c,t,!1),s||_)if(!_||v!==t.body.statements.length||8192&t.body.transformFlags)y<=d.length?K(l,t,_||O()):(K(c,t,O()),_&&function(t,r){Me();var n=u.createExpressionStatement(u.createBinaryExpression(u.createThis(),63,r));e.insertStatementAfterCustomPrologue(t,n),e.setCommentRange(n,e.getOriginalNode(r).parent);}(l,_)),I(t.body)||l.push(u.createReturnStatement(u.createUniqueName("_this",48)));else {var b=e.cast(e.cast(_,e.isBinaryExpression).left,e.isCallExpression),x=u.createReturnStatement(_);e.setCommentRange(x,e.getCommentRange(b)),e.setEmitFlags(b,1536),l.push(x);}else z(c,t);var D=u.createBlock(e.setTextRange(u.createNodeArray(n$4(n$4(n$4(n$4([],d,!0),c,!0),y<=d.length?e.emptyArray:e.visitNodes(t.body.statements,C,e.isStatement,d.length,y-d.length),!0),l,!0)),t.body.statements),!0);return e.setTextRange(D,t.body),D}(d,i,c,g));e.setTextRange(m,d||i),c&&e.setEmitFlags(m,8),r.push(m),D(_,98304,0),s=l;}(l,o,m,c),function(t,n){for(var i=0,a=n.members;i<a.length;i++){var o=a[i];switch(o.kind){case 234:t.push(V(o));break;case 169:t.push(q(Le(n,o),o,n));break;case 172:case 173:var s=e.getAllAccessorDeclarations(n.members,o);o===s.firstAccessor&&t.push(W(Le(n,o),s,n));break;case 171:case 170:break;default:e.Debug.failBadSyntaxKind(o,r&&r.fileName);}}}(l,o);var y=e.createTokenRange(e.skipTrivia(i,o.members.end),19),v=u.createPartiallyEmittedExpression(m);e.setTextRangeEnd(v,y.end),e.setEmitFlags(v,1536);var h=u.createReturnStatement(v);e.setTextRangePos(h,y.pos),e.setEmitFlags(h,1920),l.push(h),e.insertStatementsAfterStandardPrologue(l,f());var b=u.createBlock(e.setTextRange(u.createNodeArray(l),o.members),!0);return e.setEmitFlags(b,1536),b}(o,c));e.setEmitFlags(l,65536&e.getEmitFlags(o)|524288);var g=u.createPartiallyEmittedExpression(l);e.setTextRangeEnd(g,o.end),e.setEmitFlags(g,1536);var m=u.createPartiallyEmittedExpression(g);e.setTextRangeEnd(m,e.skipTrivia(i,o.pos)),e.setEmitFlags(m,1536);var y=u.createParenthesizedExpression(u.createCallExpression(m,void 0,c?[e.visitNode(c.expression,C,e.isExpression)]:[]));return e.addSyntheticLeadingComment(y,3,"* @class "),y}function I(t){if(247===t.kind)return !0;if(239===t.kind){var r=t;if(r.elseStatement)return I(r.thenStatement)&&I(r.elseStatement)}else if(235===t.kind){var n=e.lastOrUndefined(t.statements);if(n&&I(n))return !0}return !1}function O(){return e.setEmitFlags(u.createThis(),4)}function M(){return u.createLogicalOr(u.createLogicalAnd(u.createStrictInequality(u.createUniqueName("_super",48),u.createNull()),u.createFunctionApplyCall(u.createUniqueName("_super",48),O(),u.createIdentifier("arguments"))),O())}function L(t){return void 0!==t.initializer||e.isBindingPattern(t.name)}function R(t,r){if(!e.some(r.parameters,L))return !1;for(var n=!1,i=0,a=r.parameters;i<a.length;i++){var o=a[i],s=o.name,c=o.initializer;o.dotDotDotToken||(e.isBindingPattern(s)?n=B(t,o,s,c)||n:c&&(j(t,o,s,c),n=!0));}return n}function B(r,n,i,a){return i.elements.length>0?(e.insertStatementAfterCustomPrologue(r,e.setEmitFlags(u.createVariableStatement(void 0,u.createVariableDeclarationList(e.flattenDestructuringBinding(n,C,t,0,u.getGeneratedNameForNode(n)))),1048576)),!0):!!a&&(e.insertStatementAfterCustomPrologue(r,e.setEmitFlags(u.createExpressionStatement(u.createAssignment(u.getGeneratedNameForNode(n),e.visitNode(a,C,e.isExpression))),1048576)),!0)}function j(t,r,n,i){i=e.visitNode(i,C,e.isExpression);var a=u.createIfStatement(u.createTypeCheck(u.cloneNode(n),"undefined"),e.setEmitFlags(e.setTextRange(u.createBlock([u.createExpressionStatement(e.setEmitFlags(e.setTextRange(u.createAssignment(e.setEmitFlags(e.setParent(e.setTextRange(u.cloneNode(n),n),n.parent),48),e.setEmitFlags(i,1584|e.getEmitFlags(i))),r),1536))]),r),1953));e.startOnNewLine(a),e.setTextRange(a,r),e.setEmitFlags(a,1050528),e.insertStatementAfterCustomPrologue(t,a);}function J(r,n,i){var a=[],o=e.lastOrUndefined(n.parameters);if(!function(e,t){return !(!e||!e.dotDotDotToken||t)}(o,i))return !1;var s=79===o.name.kind?e.setParent(e.setTextRange(u.cloneNode(o.name),o.name),o.name.parent):u.createTempVariable(void 0);e.setEmitFlags(s,48);var c=79===o.name.kind?u.cloneNode(o.name):s,l=n.parameters.length-1,_=u.createLoopVariable();a.push(e.setEmitFlags(e.setTextRange(u.createVariableStatement(void 0,u.createVariableDeclarationList([u.createVariableDeclaration(s,void 0,void 0,u.createArrayLiteralExpression([]))])),o),1048576));var d=u.createForStatement(e.setTextRange(u.createVariableDeclarationList([u.createVariableDeclaration(_,void 0,void 0,u.createNumericLiteral(l))]),o),e.setTextRange(u.createLessThan(_,u.createPropertyAccessExpression(u.createIdentifier("arguments"),"length")),o),e.setTextRange(u.createPostfixIncrement(_),o),u.createBlock([e.startOnNewLine(e.setTextRange(u.createExpressionStatement(u.createAssignment(u.createElementAccessExpression(c,0===l?_:u.createSubtract(_,u.createNumericLiteral(l))),u.createElementAccessExpression(u.createIdentifier("arguments"),_))),o))]));return e.setEmitFlags(d,1048576),e.startOnNewLine(d),a.push(d),79!==o.name.kind&&a.push(e.setEmitFlags(e.setTextRange(u.createVariableStatement(void 0,u.createVariableDeclarationList(e.flattenDestructuringBinding(o,C,t,0,c))),o),1048576)),e.insertStatementsAfterCustomPrologue(r,a),!0}function z(e,t){return !!(65536&a&&214!==t.kind)&&(K(e,t,u.createThis()),!0)}function K(t,r,n){Me();var i=u.createVariableStatement(void 0,u.createVariableDeclarationList([u.createVariableDeclaration(u.createUniqueName("_this",48),void 0,void 0,n)]));e.setEmitFlags(i,1050112),e.setSourceMapRange(i,r),e.insertStatementAfterCustomPrologue(t,i);}function U(t,r,n){if(32768&a){var i=void 0;switch(r.kind){case 214:return t;case 169:case 172:case 173:i=u.createVoidZero();break;case 171:i=u.createPropertyAccessExpression(e.setEmitFlags(u.createThis(),4),"constructor");break;case 256:case 213:i=u.createConditionalExpression(u.createLogicalAnd(e.setEmitFlags(u.createThis(),4),u.createBinaryExpression(e.setEmitFlags(u.createThis(),4),102,u.getLocalName(r))),void 0,u.createPropertyAccessExpression(e.setEmitFlags(u.createThis(),4),"constructor"),void 0,u.createVoidZero());break;default:return e.Debug.failBadSyntaxKind(r)}var o=u.createVariableStatement(void 0,u.createVariableDeclarationList([u.createVariableDeclaration(u.createUniqueName("_newTarget",48),void 0,void 0,i)]));e.setEmitFlags(o,1050112),n&&(t=t.slice()),e.insertStatementAfterCustomPrologue(t,o);}return t}function V(t){return e.setTextRange(u.createEmptyStatement(),t)}function q(r,n,i){var a,o=e.getCommentRange(n),s=e.getSourceMapRange(n),c=G(n,n,void 0,i),l=e.visitNode(n.name,C,e.isPropertyName);if(!e.isPrivateIdentifier(l)&&e.getUseDefineForClassFields(t.getCompilerOptions())){var _=e.isComputedPropertyName(l)?l.expression:e.isIdentifier(l)?u.createStringLiteral(e.unescapeLeadingUnderscores(l.escapedText)):l;a=u.createObjectDefinePropertyCall(r,_,u.createPropertyDescriptor({value:c,enumerable:!1,writable:!0,configurable:!0}));}else {var d=e.createMemberAccessForPropertyName(u,r,l,n.name);a=u.createAssignment(d,c);}e.setEmitFlags(c,1536),e.setSourceMapRange(c,s);var p=e.setTextRange(u.createExpressionStatement(a),n);return e.setOriginalNode(p,n),e.setCommentRange(p,o),e.setEmitFlags(p,48),p}function W(t,r,n){var i=u.createExpressionStatement(H(t,r,n,!1));return e.setEmitFlags(i,1536),e.setSourceMapRange(i,e.getSourceMapRange(r.firstAccessor)),i}function H(t,r,n,i){var a=r.firstAccessor,o=r.getAccessor,s=r.setAccessor,c=e.setParent(e.setTextRange(u.cloneNode(t),t),t.parent);e.setEmitFlags(c,1568),e.setSourceMapRange(c,a.name);var l=e.visitNode(a.name,C,e.isPropertyName);if(e.isPrivateIdentifier(l))return e.Debug.failBadSyntaxKind(l,"Encountered unhandled private identifier while transforming ES2015.");var _=e.createExpressionForPropertyName(u,l);e.setEmitFlags(_,1552),e.setSourceMapRange(_,a.name);var d=[];if(o){var p=G(o,void 0,void 0,n);e.setSourceMapRange(p,e.getSourceMapRange(o)),e.setEmitFlags(p,512);var f=u.createPropertyAssignment("get",p);e.setCommentRange(f,e.getCommentRange(o)),d.push(f);}if(s){var g=G(s,void 0,void 0,n);e.setSourceMapRange(g,e.getSourceMapRange(s)),e.setEmitFlags(g,512);var m=u.createPropertyAssignment("set",g);e.setCommentRange(m,e.getCommentRange(s)),d.push(m);}d.push(u.createPropertyAssignment("enumerable",o||s?u.createFalse():u.createTrue()),u.createPropertyAssignment("configurable",u.createTrue()));var y=u.createCallExpression(u.createPropertyAccessExpression(u.createIdentifier("Object"),"defineProperty"),void 0,[c,_,u.createObjectLiteralExpression(d,!0)]);return i&&e.startOnNewLine(y),y}function G(r,n,i,o){var c=s;s=void 0;var l=o&&e.isClassLike(o)&&!e.isStatic(r)?x(32670,73):x(32670,65),_=e.visitParameterList(r.parameters,C,t),d=Q(r);return 32768&a&&!i&&(256===r.kind||213===r.kind)&&(i=u.getGeneratedNameForNode(r)),D(l,98304,0),s=c,e.setOriginalNode(e.setTextRange(u.createFunctionExpression(void 0,r.asteriskToken,i,void 0,_,void 0,d),n),r)}function Q(t){var n,i,a,o=!1,s=!1,c=[],l=[],_=t.body;if(p(),e.isBlock(_)&&(a=u.copyStandardPrologue(_.statements,c,0,!1),a=u.copyCustomPrologue(_.statements,l,a,C,e.isHoistedFunction),a=u.copyCustomPrologue(_.statements,l,a,C,e.isHoistedVariableStatement)),o=R(l,t)||o,o=J(l,t,!1)||o,e.isBlock(_))a=u.copyCustomPrologue(_.statements,l,a,C),n=_.statements,e.addRange(l,e.visitNodes(_.statements,C,e.isStatement,a)),!o&&_.multiLine&&(o=!0);else {e.Debug.assert(214===t.kind),n=e.moveRangeEnd(_,-1);var d=t.equalsGreaterThanToken;e.nodeIsSynthesized(d)||e.nodeIsSynthesized(_)||(e.rangeEndIsOnSameLineAsRangeStart(d,_,r)?s=!0:o=!0);var g=e.visitNode(_,C,e.isExpression),m=u.createReturnStatement(g);e.setTextRange(m,_),e.moveSyntheticComments(m,_),e.setEmitFlags(m,1440),l.push(m),i=_;}if(u.mergeLexicalEnvironment(c,f()),U(c,t,!1),z(c,t),e.some(c)&&(o=!0),l.unshift.apply(l,c),e.isBlock(_)&&e.arrayIsEqualTo(l,_.statements))return _;var y=u.createBlock(e.setTextRange(u.createNodeArray(l),n),o);return e.setTextRange(y,t.body),!o&&s&&e.setEmitFlags(y,1),i&&e.setTokenSourceMapRange(y,19,i),e.setOriginalNode(y,t.body),y}function X(r,n){return e.isDestructuringAssignment(r)?e.flattenDestructuringAssignment(r,C,t,0,!n):27===r.operatorToken.kind?u.updateBinaryExpression(r,e.visitNode(r.left,k,e.isExpression),r.operatorToken,e.visitNode(r.right,n?k:C,e.isExpression)):e.visitEachChild(r,C,t)}function Y(r){var n=r.name;return e.isBindingPattern(n)?Z(r):!r.initializer&&function(e){var t=y.getNodeCheckFlags(e),r=262144&t,n=524288&t;return !(0!=(64&a)||r&&n&&0!=(512&a))&&0==(4096&a)&&(!y.isDeclarationWithCollidingName(e)||n&&!r&&0==(6144&a))}(r)?u.updateVariableDeclaration(r,r.name,void 0,void 0,u.createVoidZero()):e.visitEachChild(r,C,t)}function Z(r){var n,i=x(32,0);return n=e.isBindingPattern(r.name)?e.flattenDestructuringBinding(r,C,t,0,void 0,0!=(32&i)):e.visitEachChild(r,C,t),D(i,0,0),n}function $(t){s.labels.set(e.idText(t.label),!0);}function ee(t){s.labels.set(e.idText(t.label),!1);}function te(r,n,i,o,c){var l=x(r,n),_=function(r,n,i,o){if(!fe(r)){var c=void 0;s&&(c=s.allowedNonLabeledJumps,s.allowedNonLabeledJumps=6);var l=o?o(r,n,void 0,i):u.restoreEnclosingLabel(e.isForStatement(r)?function(t){return u.updateForStatement(t,e.visitNode(t.initializer,k,e.isForInitializer),e.visitNode(t.condition,C,e.isExpression),e.visitNode(t.incrementor,k,e.isExpression),e.visitNode(t.statement,C,e.isStatement,u.liftToBlock))}(r):e.visitEachChild(r,C,t),n,s&&ee);return s&&(s.allowedNonLabeledJumps=c),l}var _=function(t){var r;switch(t.kind){case 242:case 243:case 244:var n=t.initializer;n&&255===n.kind&&(r=n);}var i=[],a=[];if(r&&3&e.getCombinedNodeFlags(r))for(var o=_e(t)||de(t)||pe(t),c=0,l=r.declarations;c<l.length;c++)Se(t,l[c],i,a,o);var u={loopParameters:i,loopOutParameters:a};return s&&(s.argumentsName&&(u.argumentsName=s.argumentsName),s.thisName&&(u.thisName=s.thisName),s.hoistedLocalVariables&&(u.hoistedLocalVariables=s.hoistedLocalVariables)),u}(r),p=[],g=s;s=_;var m,y,v,h,b,x=_e(r)?function(t,r){var n=u.createUniqueName("_loop_init"),i=0!=(524288&t.initializer.transformFlags),o=0;r.containsLexicalThis&&(o|=8),i&&4&a&&(o|=262144);var s=[];return s.push(u.createVariableStatement(void 0,t.initializer)),be(r.loopOutParameters,2,1,s),{functionName:n,containsYield:i,functionDeclaration:u.createVariableStatement(void 0,e.setEmitFlags(u.createVariableDeclarationList([u.createVariableDeclaration(n,void 0,void 0,e.setEmitFlags(u.createFunctionExpression(void 0,i?u.createToken(41):void 0,void 0,void 0,void 0,void 0,e.visitNode(u.createBlock(s,!0),C,e.isBlock)),o))]),2097152)),part:u.createVariableDeclarationList(e.map(r.loopOutParameters,ve))}}(r,_):void 0,D=ge(r)?function(t,r,n){var i=u.createUniqueName("_loop");d();var o=e.visitNode(t.statement,C,e.isStatement,u.liftToBlock),s=f(),c=[];(de(t)||pe(t))&&(r.conditionVariable=u.createUniqueName("inc"),t.incrementor?c.push(u.createIfStatement(r.conditionVariable,u.createExpressionStatement(e.visitNode(t.incrementor,C,e.isExpression)),u.createExpressionStatement(u.createAssignment(r.conditionVariable,u.createTrue())))):c.push(u.createIfStatement(u.createLogicalNot(r.conditionVariable),u.createExpressionStatement(u.createAssignment(r.conditionVariable,u.createTrue())))),de(t)&&c.push(u.createIfStatement(u.createPrefixUnaryExpression(53,e.visitNode(t.condition,C,e.isExpression)),e.visitNode(u.createBreakStatement(),C,e.isStatement)))),e.isBlock(o)?e.addRange(c,o.statements):c.push(o),be(r.loopOutParameters,1,1,c),e.insertStatementsAfterStandardPrologue(c,s);var l=u.createBlock(c,!0);e.isBlock(o)&&e.setOriginalNode(l,o);var _=0!=(524288&t.statement.transformFlags),p=524288;return r.containsLexicalThis&&(p|=8),_&&0!=(4&a)&&(p|=262144),{functionName:i,containsYield:_,functionDeclaration:u.createVariableStatement(void 0,e.setEmitFlags(u.createVariableDeclarationList([u.createVariableDeclaration(i,void 0,void 0,e.setEmitFlags(u.createFunctionExpression(void 0,_?u.createToken(41):void 0,void 0,void 0,r.loopParameters,void 0,l),p))]),2097152)),part:function(t,r,n,i){var a=[],o=!(-5&r.nonLocalJumps||r.labeledNonLocalBreaks||r.labeledNonLocalContinues),s=u.createCallExpression(t,void 0,e.map(r.loopParameters,(function(e){return e.name}))),c=i?u.createYieldExpression(u.createToken(41),e.setEmitFlags(s,8388608)):s;if(o)a.push(u.createExpressionStatement(c)),be(r.loopOutParameters,1,0,a);else {var l=u.createUniqueName("state"),_=u.createVariableStatement(void 0,u.createVariableDeclarationList([u.createVariableDeclaration(l,void 0,void 0,c)]));if(a.push(_),be(r.loopOutParameters,1,0,a),8&r.nonLocalJumps){var d=void 0;n?(n.nonLocalJumps|=8,d=u.createReturnStatement(l)):d=u.createReturnStatement(u.createPropertyAccessExpression(l,"value")),a.push(u.createIfStatement(u.createTypeCheck(l,"object"),d));}if(2&r.nonLocalJumps&&a.push(u.createIfStatement(u.createStrictEquality(l,u.createStringLiteral("break")),u.createBreakStatement())),r.labeledNonLocalBreaks||r.labeledNonLocalContinues){var p=[];De(r.labeledNonLocalBreaks,!0,l,n,p),De(r.labeledNonLocalContinues,!1,l,n,p),a.push(u.createSwitchStatement(l,u.createCaseBlock(p)));}}return a}(i,r,n,_)}}(r,_,g):void 0;if(s=g,x&&p.push(x.functionDeclaration),D&&p.push(D.functionDeclaration),function(e,t,r){var n;if(t.argumentsName&&(r?r.argumentsName=t.argumentsName:(n||(n=[])).push(u.createVariableDeclaration(t.argumentsName,void 0,void 0,u.createIdentifier("arguments")))),t.thisName&&(r?r.thisName=t.thisName:(n||(n=[])).push(u.createVariableDeclaration(t.thisName,void 0,void 0,u.createIdentifier("this")))),t.hoistedLocalVariables)if(r)r.hoistedLocalVariables=t.hoistedLocalVariables;else {n||(n=[]);for(var i=0,a=t.hoistedLocalVariables;i<a.length;i++){var o=a[i];n.push(u.createVariableDeclaration(o));}}if(t.loopOutParameters.length){n||(n=[]);for(var s=0,c=t.loopOutParameters;s<c.length;s++){var l=c[s];n.push(u.createVariableDeclaration(l.outParamName));}}t.conditionVariable&&(n||(n=[]),n.push(u.createVariableDeclaration(t.conditionVariable,void 0,void 0,u.createFalse()))),n&&e.push(u.createVariableStatement(void 0,u.createVariableDeclarationList(n)));}(p,_,g),x&&p.push((y=x.functionName,v=x.containsYield,h=u.createCallExpression(y,void 0,[]),b=v?u.createYieldExpression(u.createToken(41),e.setEmitFlags(h,8388608)):h,u.createExpressionStatement(b))),D)if(o)m=o(r,n,D.part,i);else {var S=ye(r,x,u.createBlock(D.part,!0));m=u.restoreEnclosingLabel(S,n,s&&ee);}else {var T=ye(r,x,e.visitNode(r.statement,C,e.isStatement,u.liftToBlock));m=u.restoreEnclosingLabel(T,n,s&&ee);}return p.push(m),p}(i,o,l,c);return D(l,0,0),_}function re(e,t){return te(0,1280,e,t)}function ne(e,t){return te(5056,3328,e,t)}function ie(e,t){return te(3008,5376,e,t)}function ae(e,t){return te(3008,5376,e,t,m.downlevelIteration?le:ce)}function oe(r,n,i){var a=[],o=r.initializer;if(e.isVariableDeclarationList(o)){3&r.initializer.flags&&Oe();var s=e.firstOrUndefined(o.declarations);if(s&&e.isBindingPattern(s.name)){var c=e.flattenDestructuringBinding(s,C,t,0,n),l=e.setTextRange(u.createVariableDeclarationList(c),r.initializer);e.setOriginalNode(l,r.initializer),e.setSourceMapRange(l,e.createRange(c[0].pos,e.last(c).end)),a.push(u.createVariableStatement(void 0,l));}else a.push(e.setTextRange(u.createVariableStatement(void 0,e.setOriginalNode(e.setTextRange(u.createVariableDeclarationList([u.createVariableDeclaration(s?s.name:u.createTempVariable(void 0),void 0,void 0,n)]),e.moveRangePos(o,-1)),o)),e.moveRangeEnd(o,-1)));}else {var _=u.createAssignment(o,n);e.isDestructuringAssignment(_)?a.push(u.createExpressionStatement(X(_,!0))):(e.setTextRangeEnd(_,o.end),a.push(e.setTextRange(u.createExpressionStatement(e.visitNode(_,C,e.isExpression)),e.moveRangeEnd(o,-1))));}if(i)return se(e.addRange(a,i));var d=e.visitNode(r.statement,C,e.isStatement,u.liftToBlock);return e.isBlock(d)?u.updateBlock(d,e.setTextRange(u.createNodeArray(e.concatenate(a,d.statements)),d.statements)):(a.push(d),se(a))}function se(t){return e.setEmitFlags(u.createBlock(u.createNodeArray(t),!0),432)}function ce(t,r,n){var i=e.visitNode(t.expression,C,e.isExpression),a=u.createLoopVariable(),o=e.isIdentifier(i)?u.getGeneratedNameForNode(i):u.createTempVariable(void 0);e.setEmitFlags(i,48|e.getEmitFlags(i));var c=e.setTextRange(u.createForStatement(e.setEmitFlags(e.setTextRange(u.createVariableDeclarationList([e.setTextRange(u.createVariableDeclaration(a,void 0,void 0,u.createNumericLiteral(0)),e.moveRangePos(t.expression,-1)),e.setTextRange(u.createVariableDeclaration(o,void 0,void 0,i),t.expression)]),t.expression),2097152),e.setTextRange(u.createLessThan(a,u.createPropertyAccessExpression(o,"length")),t.expression),e.setTextRange(u.createPostfixIncrement(a),t.expression),oe(t,u.createElementAccessExpression(o,a),n)),t);return e.setEmitFlags(c,256),e.setTextRange(c,t),u.restoreEnclosingLabel(c,r,s&&ee)}function le(t,r,n,i){var a=e.visitNode(t.expression,C,e.isExpression),o=e.isIdentifier(a)?u.getGeneratedNameForNode(a):u.createTempVariable(void 0),c=e.isIdentifier(a)?u.getGeneratedNameForNode(o):u.createTempVariable(void 0),l=u.createUniqueName("e"),d=u.getGeneratedNameForNode(l),p=u.createTempVariable(void 0),f=e.setTextRange(_().createValuesHelper(a),t.expression),m=u.createCallExpression(u.createPropertyAccessExpression(o,"next"),void 0,[]);g(l),g(p);var y=1024&i?u.inlineExpressions([u.createAssignment(l,u.createVoidZero()),f]):f,v=e.setEmitFlags(e.setTextRange(u.createForStatement(e.setEmitFlags(e.setTextRange(u.createVariableDeclarationList([e.setTextRange(u.createVariableDeclaration(o,void 0,void 0,y),t.expression),u.createVariableDeclaration(c,void 0,void 0,m)]),t.expression),2097152),u.createLogicalNot(u.createPropertyAccessExpression(c,"done")),u.createAssignment(c,m),oe(t,u.createPropertyAccessExpression(c,"value"),n)),t),256);return u.createTryStatement(u.createBlock([u.restoreEnclosingLabel(v,r,s&&ee)]),u.createCatchClause(u.createVariableDeclaration(d),e.setEmitFlags(u.createBlock([u.createExpressionStatement(u.createAssignment(l,u.createObjectLiteralExpression([u.createPropertyAssignment("error",d)])))]),1)),u.createBlock([u.createTryStatement(u.createBlock([e.setEmitFlags(u.createIfStatement(u.createLogicalAnd(u.createLogicalAnd(c,u.createLogicalNot(u.createPropertyAccessExpression(c,"done"))),u.createAssignment(p,u.createPropertyAccessExpression(o,"return"))),u.createExpressionStatement(u.createFunctionCallCall(p,o,[]))),1)]),void 0,e.setEmitFlags(u.createBlock([e.setEmitFlags(u.createIfStatement(l,u.createThrowStatement(u.createPropertyAccessExpression(l,"error"))),1)]),1))]))}function ue(e){return 0!=(131072&y.getNodeCheckFlags(e))}function _e(t){return e.isForStatement(t)&&!!t.initializer&&ue(t.initializer)}function de(t){return e.isForStatement(t)&&!!t.condition&&ue(t.condition)}function pe(t){return e.isForStatement(t)&&!!t.incrementor&&ue(t.incrementor)}function fe(e){return ge(e)||_e(e)}function ge(e){return 0!=(65536&y.getNodeCheckFlags(e))}function me(t,r){t.hoistedLocalVariables||(t.hoistedLocalVariables=[]),function r(n){if(79===n.kind)t.hoistedLocalVariables.push(n);else for(var i=0,a=n.elements;i<a.length;i++){var o=a[i];e.isOmittedExpression(o)||r(o.name);}}(r.name);}function ye(t,r,n){switch(t.kind){case 242:return function(t,r,n){var i=t.condition&&ue(t.condition),a=i||t.incrementor&&ue(t.incrementor);return u.updateForStatement(t,e.visitNode(r?r.part:t.initializer,k,e.isForInitializer),e.visitNode(i?void 0:t.condition,C,e.isExpression),e.visitNode(a?void 0:t.incrementor,k,e.isExpression),n)}(t,r,n);case 243:return function(t,r){return u.updateForInStatement(t,e.visitNode(t.initializer,C,e.isForInitializer),e.visitNode(t.expression,C,e.isExpression),r)}(t,n);case 244:return function(t,r){return u.updateForOfStatement(t,void 0,e.visitNode(t.initializer,C,e.isForInitializer),e.visitNode(t.expression,C,e.isExpression),r)}(t,n);case 240:return function(t,r){return u.updateDoStatement(t,r,e.visitNode(t.expression,C,e.isExpression))}(t,n);case 241:return function(t,r){return u.updateWhileStatement(t,e.visitNode(t.expression,C,e.isExpression),r)}(t,n);default:return e.Debug.failBadSyntaxKind(t,"IterationStatement expected")}}function ve(e){return u.createVariableDeclaration(e.originalName,void 0,void 0,e.outParamName)}function he(e,t){var r=0===t?e.outParamName:e.originalName,n=0===t?e.originalName:e.outParamName;return u.createBinaryExpression(n,63,r)}function be(e,t,r,n){for(var i=0,a=e;i<a.length;i++){var o=a[i];o.flags&t&&n.push(u.createExpressionStatement(he(o,r)));}}function xe(t,r,n,i){r?(t.labeledNonLocalBreaks||(t.labeledNonLocalBreaks=new e.Map),t.labeledNonLocalBreaks.set(n,i)):(t.labeledNonLocalContinues||(t.labeledNonLocalContinues=new e.Map),t.labeledNonLocalContinues.set(n,i));}function De(e,t,r,n,i){e&&e.forEach((function(e,a){var o=[];if(!n||n.labels&&n.labels.get(a)){var s=u.createIdentifier(a);o.push(t?u.createBreakStatement(s):u.createContinueStatement(s));}else xe(n,t,a,e),o.push(u.createReturnStatement(r));i.push(u.createCaseClause(u.createStringLiteral(e),o));}));}function Se(t,r,n,i,a){var o=r.name;if(e.isBindingPattern(o))for(var s=0,c=o.elements;s<c.length;s++){var l=c[s];e.isOmittedExpression(l)||Se(t,l,n,i,a);}else {n.push(u.createParameterDeclaration(void 0,void 0,void 0,o));var _=y.getNodeCheckFlags(r);if(4194304&_||a){var d=u.createUniqueName("out_"+e.idText(o)),p=0;4194304&_&&(p|=1),e.isForStatement(t)&&(t.initializer&&y.isBindingCapturedByNode(t.initializer,r)&&(p|=2),(t.condition&&y.isBindingCapturedByNode(t.condition,r)||t.incrementor&&y.isBindingCapturedByNode(t.incrementor,r))&&(p|=1)),i.push({flags:p,originalName:o,outParamName:d});}}}function Te(t,r,n){var i=u.createAssignment(e.createMemberAccessForPropertyName(u,r,e.visitNode(t.name,C,e.isPropertyName)),e.visitNode(t.initializer,C,e.isExpression));return e.setTextRange(i,t),n&&e.startOnNewLine(i),i}function Ce(t,r,n){var i=u.createAssignment(e.createMemberAccessForPropertyName(u,r,e.visitNode(t.name,C,e.isPropertyName)),u.cloneNode(t.name));return e.setTextRange(i,t),n&&e.startOnNewLine(i),i}function ke(t,r,n,i){var a=u.createAssignment(e.createMemberAccessForPropertyName(u,r,e.visitNode(t.name,C,e.isPropertyName)),G(t,t,void 0,n));return e.setTextRange(a,t),i&&e.startOnNewLine(a),a}function Ee(r,n){if(16384&r.transformFlags||106===r.expression.kind||e.isSuperProperty(e.skipOuterExpressions(r.expression))){var i=u.createCallBinding(r.expression,g),a=i.target,o=i.thisArg;106===r.expression.kind&&e.setEmitFlags(o,4);var s=void 0;if(s=16384&r.transformFlags?u.createFunctionApplyCall(e.visitNode(a,N,e.isExpression),106===r.expression.kind?o:e.visitNode(o,C,e.isExpression),Ne(r.arguments,!0,!1,!1)):e.setTextRange(u.createFunctionCallCall(e.visitNode(a,N,e.isExpression),106===r.expression.kind?o:e.visitNode(o,C,e.isExpression),e.visitNodes(r.arguments,C,e.isExpression)),r),106===r.expression.kind){var c=u.createLogicalOr(s,O());s=n?u.createAssignment(u.createUniqueName("_this",48),c):c;}return e.setOriginalNode(s,r)}return e.visitEachChild(r,C,t)}function Ne(t,r,n,i){var a=t.length,o=e.flatten(e.spanMap(t,Fe,(function(e,t,r,o){return t(e,n,i&&o===a)})));if(1===o.length){var s=o[0];if(r&&!m.downlevelIteration||e.isPackedArrayLiteral(s.expression)||e.isCallToHelper(s.expression,"___spreadArray"))return s.expression}for(var c=_(),l=0!==o[0].kind,d=l?u.createArrayLiteralExpression():o[0].expression,p=l?0:1;p<o.length;p++){var f=o[p];d=c.createSpreadArrayHelper(d,f.expression,1===f.kind&&!r);}return d}function Fe(t){return e.isSpreadElement(t)?Ae:we}function Ae(t){return e.map(t,Pe)}function Pe(t){var r=e.visitNode(t.expression,C,e.isExpression),n=e.isCallToHelper(r,"___read"),i=n||e.isPackedArrayLiteral(r)?2:1;return !m.downlevelIteration||1!==i||e.isArrayLiteralExpression(r)||n||(r=_().createReadHelper(r,void 0),i=2),c(i,r)}function we(t,r,n){return c(0,u.createArrayLiteralExpression(e.visitNodes(u.createNodeArray(t,n),C,e.isExpression),r))}function Ie(e){return 8&a&&!e?u.createPropertyAccessExpression(u.createUniqueName("_super",48),"prototype"):u.createUniqueName("_super",48)}function Oe(){0==(2&l)&&(l|=2,t.enableSubstitution(79));}function Me(){0==(1&l)&&(l|=1,t.enableSubstitution(108),t.enableEmitNotification(171),t.enableEmitNotification(169),t.enableEmitNotification(172),t.enableEmitNotification(173),t.enableEmitNotification(214),t.enableEmitNotification(213),t.enableEmitNotification(256));}function Le(t,r){return e.isStatic(r)?u.getInternalName(t):u.createPropertyAccessExpression(u.getInternalName(t),"prototype")}};}(t),function(e){e.transformES5=function(t){var r,n,i=t.factory,a=t.getCompilerOptions();1!==a.jsx&&3!==a.jsx||(r=t.onEmitNode,t.onEmitNode=function(t,i,a){switch(i.kind){case 280:case 281:case 279:var o=i.tagName;n[e.getOriginalNodeId(o)]=!0;}r(t,i,a);},t.enableEmitNotification(280),t.enableEmitNotification(281),t.enableEmitNotification(279),n=[]);var o=t.onSubstituteNode;return t.onSubstituteNode=function(t,r){return r.id&&n&&n[r.id]?o(t,r):(r=o(t,r),e.isPropertyAccessExpression(r)?function(t){if(e.isPrivateIdentifier(t.name))return t;var r=s(t.name);return r?e.setTextRange(i.createElementAccessExpression(t.expression,r),t):t}(r):e.isPropertyAssignment(r)?function(t){var r=e.isIdentifier(t.name)&&s(t.name);return r?i.updatePropertyAssignment(t,r,t.initializer):t}(r):r)},t.enableSubstitution(206),t.enableSubstitution(296),e.chainBundle(t,(function(e){return e}));function s(t){var r=t.originalKeywordKind||(e.nodeIsSynthesized(t)?e.stringToToken(e.idText(t)):void 0);if(void 0!==r&&r>=81&&r<=116)return e.setTextRange(i.createStringLiteralFromNode(t),t)}};}(t),function(e){var t,r,i,a,o;!function(e){e[e.Nop=0]="Nop",e[e.Statement=1]="Statement",e[e.Assign=2]="Assign",e[e.Break=3]="Break",e[e.BreakWhenTrue=4]="BreakWhenTrue",e[e.BreakWhenFalse=5]="BreakWhenFalse",e[e.Yield=6]="Yield",e[e.YieldStar=7]="YieldStar",e[e.Return=8]="Return",e[e.Throw=9]="Throw",e[e.Endfinally=10]="Endfinally";}(t||(t={})),function(e){e[e.Open=0]="Open",e[e.Close=1]="Close";}(r||(r={})),function(e){e[e.Exception=0]="Exception",e[e.With=1]="With",e[e.Switch=2]="Switch",e[e.Loop=3]="Loop",e[e.Labeled=4]="Labeled";}(i||(i={})),function(e){e[e.Try=0]="Try",e[e.Catch=1]="Catch",e[e.Finally=2]="Finally",e[e.Done=3]="Done";}(a||(a={})),function(e){e[e.Next=0]="Next",e[e.Throw=1]="Throw",e[e.Return=2]="Return",e[e.Break=3]="Break",e[e.Yield=4]="Yield",e[e.YieldStar=5]="YieldStar",e[e.Catch=6]="Catch",e[e.Endfinally=7]="Endfinally";}(o||(o={})),e.transformGenerators=function(t){var r,i,a,o,s,c,l,u,_,d,p=t.factory,f=t.getEmitHelperFactory,g=t.resumeLexicalEnvironment,m=t.endLexicalEnvironment,y=t.hoistFunctionDeclaration,v=t.hoistVariableDeclaration,h=t.getCompilerOptions(),b=e.getEmitScriptTarget(h),x=t.getEmitResolver(),D=t.onSubstituteNode;t.onSubstituteNode=function(t,n){return n=D(t,n),1===t?function(t){return e.isIdentifier(t)?function(t){if(!e.isGeneratedIdentifier(t)&&r&&r.has(e.idText(t))){var n=e.getOriginalNode(t);if(e.isIdentifier(n)&&n.parent){var a=x.getReferencedValueDeclaration(n);if(a){var o=i[e.getOriginalNodeId(a)];if(o){var s=e.setParent(e.setTextRange(p.cloneNode(o),o),o.parent);return e.setSourceMapRange(s,t),e.setCommentRange(s,t),s}}}}return t}(t):t}(n):n};var S,T,C,k,E,N,F,A,P,w,I,O,M=1,L=0,R=0;return e.chainBundle(t,(function(r){if(r.isDeclarationFile||0==(2048&r.transformFlags))return r;var n=e.visitEachChild(r,B,t);return e.addEmitHelpers(n,t.readEmitHelpers()),n}));function B(r){var n=r.transformFlags;return o?function(r){switch(r.kind){case 240:case 241:return function(r){return o?(oe(),r=e.visitEachChild(r,B,t),ce(),r):e.visitEachChild(r,B,t)}(r);case 249:return function(r){return o&&re({kind:2,isScript:!0,breakLabel:-1}),r=e.visitEachChild(r,B,t),o&&le(),r}(r);case 250:return function(r){return o&&re({kind:4,isScript:!0,labelText:e.idText(r.label),breakLabel:-1}),r=e.visitEachChild(r,B,t),o&&ue(),r}(r);default:return j(r)}}(r):a?j(r):e.isFunctionLikeDeclaration(r)&&r.asteriskToken?function(t){switch(t.kind){case 256:return J(t);case 213:return z(t);default:return e.Debug.failBadSyntaxKind(t)}}(r):2048&n?e.visitEachChild(r,B,t):r}function j(r){switch(r.kind){case 256:return J(r);case 213:return z(r);case 172:case 173:return function(r){var n=a,i=o;return a=!1,o=!1,r=e.visitEachChild(r,B,t),a=n,o=i,r}(r);case 237:return function(t){if(524288&t.transformFlags)G(t.declarationList);else {if(1048576&e.getEmitFlags(t))return t;for(var r=0,n=t.declarationList.declarations;r<n.length;r++){var i=n[r];v(i.name);}var a=e.getInitializedVariables(t.declarationList);if(0!==a.length)return e.setSourceMapRange(p.createExpressionStatement(p.inlineExpressions(e.map(a,Q))),t)}}(r);case 242:return function(r){o&&oe();var n=r.initializer;if(n&&e.isVariableDeclarationList(n)){for(var i=0,a=n.declarations;i<a.length;i++){var s=a[i];v(s.name);}var c=e.getInitializedVariables(n);r=p.updateForStatement(r,c.length>0?p.inlineExpressions(e.map(c,Q)):void 0,e.visitNode(r.condition,B,e.isExpression),e.visitNode(r.incrementor,B,e.isExpression),e.visitIterationBody(r.statement,B,t));}else r=e.visitEachChild(r,B,t);return o&&ce(),r}(r);case 243:return function(r){o&&oe();var n=r.initializer;if(e.isVariableDeclarationList(n)){for(var i=0,a=n.declarations;i<a.length;i++){var s=a[i];v(s.name);}r=p.updateForInStatement(r,n.declarations[0].name,e.visitNode(r.expression,B,e.isExpression),e.visitNode(r.statement,B,e.isStatement,p.liftToBlock));}else r=e.visitEachChild(r,B,t);return o&&ce(),r}(r);case 246:return function(r){if(o){var n=ge(r.label&&e.idText(r.label));if(n>0)return he(n,r)}return e.visitEachChild(r,B,t)}(r);case 245:return function(r){if(o){var n=me(r.label&&e.idText(r.label));if(n>0)return he(n,r)}return e.visitEachChild(r,B,t)}(r);case 247:return function(t){return r=e.visitNode(t.expression,B,e.isExpression),n=t,e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression(r?[ve(2),r]:[ve(2)])),n);var r,n;}(r);default:return 524288&r.transformFlags?function(r){switch(r.kind){case 221:return function(r){var n=e.getExpressionAssociativity(r);switch(n){case 0:return function(r){return X(r.right)?e.isLogicalOperator(r.operatorToken.kind)?function(t){var r=ee(),n=$();return De(n,e.visitNode(t.left,B,e.isExpression),t.left),55===t.operatorToken.kind?Ce(r,n,t.left):Te(r,n,t.left),De(n,e.visitNode(t.right,B,e.isExpression),t.right),te(r),n}(r):27===r.operatorToken.kind?U(r):p.updateBinaryExpression(r,Z(e.visitNode(r.left,B,e.isExpression)),r.operatorToken,e.visitNode(r.right,B,e.isExpression)):e.visitEachChild(r,B,t)}(r);case 1:return function(r){var n=r.left,i=r.right;if(X(i)){var a=void 0;switch(n.kind){case 206:a=p.updatePropertyAccessExpression(n,Z(e.visitNode(n.expression,B,e.isLeftHandSideExpression)),n.name);break;case 207:a=p.updateElementAccessExpression(n,Z(e.visitNode(n.expression,B,e.isLeftHandSideExpression)),Z(e.visitNode(n.argumentExpression,B,e.isExpression)));break;default:a=e.visitNode(n,B,e.isExpression);}var o=r.operatorToken.kind;return e.isCompoundAssignment(o)?e.setTextRange(p.createAssignment(a,e.setTextRange(p.createBinaryExpression(Z(a),e.getNonAssignmentOperatorForCompoundAssignment(o),e.visitNode(i,B,e.isExpression)),r)),r):p.updateBinaryExpression(r,a,r.operatorToken,e.visitNode(i,B,e.isExpression))}return e.visitEachChild(r,B,t)}(r);default:return e.Debug.assertNever(n)}}(r);case 351:return function(t){for(var r=[],n=0,i=t.elements;n<i.length;n++){var a=i[n];e.isBinaryExpression(a)&&27===a.operatorToken.kind?r.push(U(a)):(X(a)&&r.length>0&&(ke(1,[p.createExpressionStatement(p.inlineExpressions(r))]),r=[]),r.push(e.visitNode(a,B,e.isExpression)));}return p.inlineExpressions(r)}(r);case 222:return function(r){if(X(r.whenTrue)||X(r.whenFalse)){var n=ee(),i=ee(),a=$();return Ce(n,e.visitNode(r.condition,B,e.isExpression),r.condition),De(a,e.visitNode(r.whenTrue,B,e.isExpression),r.whenTrue),Se(i),te(n),De(a,e.visitNode(r.whenFalse,B,e.isExpression),r.whenFalse),te(i),a}return e.visitEachChild(r,B,t)}(r);case 224:return function(t){var r,n=ee(),i=e.visitNode(t.expression,B,e.isExpression);return t.asteriskToken?function(e,t){ke(7,[e],t);}(0==(8388608&e.getEmitFlags(t.expression))?e.setTextRange(f().createValuesHelper(i),t):i,t):function(e,t){ke(6,[e],t);}(i,t),te(n),r=t,e.setTextRange(p.createCallExpression(p.createPropertyAccessExpression(k,"sent"),void 0,[]),r)}(r);case 204:return function(e){return V(e.elements,void 0,void 0,e.multiLine)}(r);case 205:return function(t){var r=t.properties,n=t.multiLine,i=Y(r),a=$();De(a,p.createObjectLiteralExpression(e.visitNodes(r,B,e.isObjectLiteralElementLike,0,i),n));var o=e.reduceLeft(r,(function(r,i){X(i)&&r.length>0&&(xe(p.createExpressionStatement(p.inlineExpressions(r))),r=[]);var o=e.createExpressionForObjectLiteralElementLike(p,t,i,a),s=e.visitNode(o,B,e.isExpression);return s&&(n&&e.startOnNewLine(s),r.push(s)),r}),[],i);return o.push(n?e.startOnNewLine(e.setParent(e.setTextRange(p.cloneNode(a),a),a.parent)):a),p.inlineExpressions(o)}(r);case 207:return function(r){return X(r.argumentExpression)?p.updateElementAccessExpression(r,Z(e.visitNode(r.expression,B,e.isLeftHandSideExpression)),e.visitNode(r.argumentExpression,B,e.isExpression)):e.visitEachChild(r,B,t)}(r);case 208:return function(r){if(!e.isImportCall(r)&&e.forEach(r.arguments,X)){var n=p.createCallBinding(r.expression,v,b,!0),i=n.target,a=n.thisArg;return e.setOriginalNode(e.setTextRange(p.createFunctionApplyCall(Z(e.visitNode(i,B,e.isLeftHandSideExpression)),a,V(r.arguments)),r),r)}return e.visitEachChild(r,B,t)}(r);case 209:return function(r){if(e.forEach(r.arguments,X)){var n=p.createCallBinding(p.createPropertyAccessExpression(r.expression,"bind"),v),i=n.target,a=n.thisArg;return e.setOriginalNode(e.setTextRange(p.createNewExpression(p.createFunctionApplyCall(Z(e.visitNode(i,B,e.isExpression)),a,V(r.arguments,p.createVoidZero())),void 0,[]),r),r)}return e.visitEachChild(r,B,t)}(r);default:return e.visitEachChild(r,B,t)}}(r):2099200&r.transformFlags?e.visitEachChild(r,B,t):r}}function J(r){if(r.asteriskToken)r=e.setOriginalNode(e.setTextRange(p.createFunctionDeclaration(void 0,r.modifiers,void 0,r.name,void 0,e.visitParameterList(r.parameters,B,t),void 0,K(r.body)),r),r);else {var n=a,i=o;a=!1,o=!1,r=e.visitEachChild(r,B,t),a=n,o=i;}return a?void y(r):r}function z(r){if(r.asteriskToken)r=e.setOriginalNode(e.setTextRange(p.createFunctionExpression(void 0,void 0,r.name,void 0,e.visitParameterList(r.parameters,B,t),void 0,K(r.body)),r),r);else {var n=a,i=o;a=!1,o=!1,r=e.visitEachChild(r,B,t),a=n,o=i;}return r}function K(t){var r=[],n=a,i=o,f=s,y=c,v=l,h=u,b=_,x=d,D=M,E=S,N=T,F=C,A=k;a=!0,o=!1,s=void 0,c=void 0,l=void 0,u=void 0,_=void 0,d=void 0,M=1,S=void 0,T=void 0,C=void 0,k=p.createTempVariable(void 0),g();var P=p.copyPrologue(t.statements,r,!1,B);q(t.statements,P);var w=Ee();return e.insertStatementsAfterStandardPrologue(r,m()),r.push(p.createReturnStatement(w)),a=n,o=i,s=f,c=y,l=v,u=h,_=b,d=x,M=D,S=E,T=N,C=F,k=A,e.setTextRange(p.createBlock(r,t.multiLine),t)}function U(t){var r=[];return n(t.left),n(t.right),p.inlineExpressions(r);function n(t){e.isBinaryExpression(t)&&27===t.operatorToken.kind?(n(t.left),n(t.right)):(X(t)&&r.length>0&&(ke(1,[p.createExpressionStatement(p.inlineExpressions(r))]),r=[]),r.push(e.visitNode(t,B,e.isExpression)));}}function V(t,r,i,a){var o,s=Y(t);if(s>0){o=$();var c=e.visitNodes(t,B,e.isExpression,0,s);De(o,p.createArrayLiteralExpression(r?n$4([r],c,!0):c)),r=void 0;}var l=e.reduceLeft(t,(function(t,i){if(X(i)&&t.length>0){var s=void 0!==o;o||(o=$()),De(o,s?p.createArrayConcatCall(o,[p.createArrayLiteralExpression(t,a)]):p.createArrayLiteralExpression(r?n$4([r],t,!0):t,a)),r=void 0,t=[];}return t.push(e.visitNode(i,B,e.isExpression)),t}),[],s);return o?p.createArrayConcatCall(o,[p.createArrayLiteralExpression(l,a)]):e.setTextRange(p.createArrayLiteralExpression(r?n$4([r],l,!0):l,a),i)}function q(e,t){void 0===t&&(t=0);for(var r=e.length,n=t;n<r;n++)H(e[n]);}function W(t){e.isBlock(t)?q(t.statements):H(t);}function H(n){var a=o;o||(o=X(n)),function(n){switch(n.kind){case 235:return function(t){X(t)?q(t.statements):xe(e.visitNode(t,B,e.isStatement));}(n);case 238:return function(t){xe(e.visitNode(t,B,e.isStatement));}(n);case 239:return function(t){if(X(t))if(X(t.thenStatement)||X(t.elseStatement)){var r=ee(),n=t.elseStatement?ee():void 0;Ce(t.elseStatement?n:r,e.visitNode(t.expression,B,e.isExpression),t.expression),W(t.thenStatement),t.elseStatement&&(Se(r),te(n),W(t.elseStatement)),te(r);}else xe(e.visitNode(t,B,e.isStatement));else xe(e.visitNode(t,B,e.isStatement));}(n);case 240:return function(t){if(X(t)){var r=ee(),n=ee();se(r),te(n),W(t.statement),te(r),Te(n,e.visitNode(t.expression,B,e.isExpression)),ce();}else xe(e.visitNode(t,B,e.isStatement));}(n);case 241:return function(t){if(X(t)){var r=ee(),n=se(r);te(r),Ce(n,e.visitNode(t.expression,B,e.isExpression)),W(t.statement),Se(r),ce();}else xe(e.visitNode(t,B,e.isStatement));}(n);case 242:return function(t){if(X(t)){var r=ee(),n=ee(),i=se(n);if(t.initializer){var a=t.initializer;e.isVariableDeclarationList(a)?G(a):xe(e.setTextRange(p.createExpressionStatement(e.visitNode(a,B,e.isExpression)),a));}te(r),t.condition&&Ce(i,e.visitNode(t.condition,B,e.isExpression)),W(t.statement),te(n),t.incrementor&&xe(e.setTextRange(p.createExpressionStatement(e.visitNode(t.incrementor,B,e.isExpression)),t.incrementor)),Se(r),ce();}else xe(e.visitNode(t,B,e.isStatement));}(n);case 243:return function(t){if(X(t)){var r=$(),n=$(),i=p.createLoopVariable(),a=t.initializer;v(i),De(r,p.createArrayLiteralExpression()),xe(p.createForInStatement(n,e.visitNode(t.expression,B,e.isExpression),p.createExpressionStatement(p.createCallExpression(p.createPropertyAccessExpression(r,"push"),void 0,[n])))),De(i,p.createNumericLiteral(0));var o=ee(),s=ee(),c=se(s);te(o),Ce(c,p.createLessThan(i,p.createPropertyAccessExpression(r,"length")));var l=void 0;if(e.isVariableDeclarationList(a)){for(var u=0,_=a.declarations;u<_.length;u++){var d=_[u];v(d.name);}l=p.cloneNode(a.declarations[0].name);}else l=e.visitNode(a,B,e.isExpression),e.Debug.assert(e.isLeftHandSideExpression(l));De(l,p.createElementAccessExpression(r,i)),W(t.statement),te(s),xe(p.createExpressionStatement(p.createPostfixIncrement(i))),Se(o),ce();}else xe(e.visitNode(t,B,e.isStatement));}(n);case 245:return function(t){var r=me(t.label?e.idText(t.label):void 0);r>0?Se(r,t):xe(t);}(n);case 246:return function(t){var r=ge(t.label?e.idText(t.label):void 0);r>0?Se(r,t):xe(t);}(n);case 247:return function(t){ke(8,[e.visitNode(t.expression,B,e.isExpression)],t);}(n);case 248:return function(t){var r,n,i;X(t)?(r=Z(e.visitNode(t.expression,B,e.isExpression)),n=ee(),i=ee(),te(n),re({kind:1,expression:r,startLabel:n,endLabel:i}),W(t.statement),e.Debug.assert(1===ae()),te(ne().endLabel)):xe(e.visitNode(t,B,e.isStatement));}(n);case 249:return function(t){if(X(t.caseBlock)){for(var r=t.caseBlock,n=r.clauses.length,i=(re({kind:2,isScript:!1,breakLabel:f=ee()}),f),a=Z(e.visitNode(t.expression,B,e.isExpression)),o=[],s=-1,c=0;c<n;c++){var l=r.clauses[c];o.push(ee()),290===l.kind&&-1===s&&(s=c);}for(var u=0,_=[];u<n;){var d=0;for(c=u;c<n;c++)if(289===(l=r.clauses[c]).kind){if(X(l.expression)&&_.length>0)break;_.push(p.createCaseClause(e.visitNode(l.expression,B,e.isExpression),[he(o[c],l.expression)]));}else d++;_.length&&(xe(p.createSwitchStatement(a,p.createCaseBlock(_))),u+=_.length,_=[]),d>0&&(u+=d,d=0);}for(Se(s>=0?o[s]:i),c=0;c<n;c++)te(o[c]),q(r.clauses[c].statements);le();}else xe(e.visitNode(t,B,e.isStatement));var f;}(n);case 250:return function(t){X(t)?(re({kind:4,isScript:!1,labelText:e.idText(t.label),breakLabel:ee()}),W(t.statement),ue()):xe(e.visitNode(t,B,e.isStatement));}(n);case 251:return function(t){var r;ke(9,[e.visitNode(null!==(r=t.expression)&&void 0!==r?r:p.createVoidZero(),B,e.isExpression)],t);}(n);case 252:return function(n){var a,o;X(n)?(a=ee(),o=ee(),te(a),re({kind:0,state:0,startLabel:a,endLabel:o}),be(),W(n.tryBlock),n.catchClause&&(function(n){var a;if(e.Debug.assert(0===ae()),e.isGeneratedIdentifier(n.name))a=n.name,v(n.name);else {var o=e.idText(n.name);a=$(o),r||(r=new e.Map,i=[],t.enableSubstitution(79)),r.set(o,!0),i[e.getOriginalNodeId(n)]=a;}var s=ie();e.Debug.assert(s.state<1),Se(s.endLabel);var c=ee();te(c),s.state=1,s.catchVariable=a,s.catchLabel=c,De(a,p.createCallExpression(p.createPropertyAccessExpression(k,"sent"),void 0,[])),be();}(n.catchClause.variableDeclaration),W(n.catchClause.block)),n.finallyBlock&&(function(){e.Debug.assert(0===ae());var t=ie();e.Debug.assert(t.state<2),Se(t.endLabel);var r=ee();te(r),t.state=2,t.finallyLabel=r;}(),W(n.finallyBlock)),function(){e.Debug.assert(0===ae());var t=ne();t.state<2?Se(t.endLabel):ke(10),te(t.endLabel),be(),t.state=3;}()):xe(e.visitEachChild(n,B,t));}(n);default:xe(e.visitNode(n,B,e.isStatement));}}(n),o=a;}function G(t){for(var r=0,n=t.declarations;r<n.length;r++){var i=n[r],a=p.cloneNode(i.name);e.setCommentRange(a,i.name),v(a);}for(var o=e.getInitializedVariables(t),s=o.length,c=0,l=[];c<s;){for(var u=c;u<s&&!(X((i=o[u]).initializer)&&l.length>0);u++)l.push(Q(i));l.length&&(xe(p.createExpressionStatement(p.inlineExpressions(l))),c+=l.length,l=[]);}}function Q(t){return e.setSourceMapRange(p.createAssignment(e.setSourceMapRange(p.cloneNode(t.name),t.name),e.visitNode(t.initializer,B,e.isExpression)),t)}function X(e){return !!e&&0!=(524288&e.transformFlags)}function Y(e){for(var t=e.length,r=0;r<t;r++)if(X(e[r]))return r;return -1}function Z(t){if(e.isGeneratedIdentifier(t)||4096&e.getEmitFlags(t))return t;var r=p.createTempVariable(v);return De(r,t,t),r}function $(e){var t=e?p.createUniqueName(e):p.createTempVariable(void 0);return v(t),t}function ee(){_||(_=[]);var e=M;return M++,_[e]=-1,e}function te(t){e.Debug.assert(void 0!==_,"No labels were defined."),_[t]=S?S.length:0;}function re(e){s||(s=[],l=[],c=[],u=[]);var t=l.length;return l[t]=0,c[t]=S?S.length:0,s[t]=e,u.push(e),t}function ne(){var t=ie();if(void 0===t)return e.Debug.fail("beginBlock was never called.");var r=l.length;return l[r]=1,c[r]=S?S.length:0,s[r]=t,u.pop(),t}function ie(){return e.lastOrUndefined(u)}function ae(){var e=ie();return e&&e.kind}function oe(){re({kind:3,isScript:!0,breakLabel:-1,continueLabel:-1});}function se(e){var t=ee();return re({kind:3,isScript:!1,breakLabel:t,continueLabel:e}),t}function ce(){e.Debug.assert(3===ae());var t=ne(),r=t.breakLabel;t.isScript||te(r);}function le(){e.Debug.assert(2===ae());var t=ne(),r=t.breakLabel;t.isScript||te(r);}function ue(){e.Debug.assert(4===ae());var t=ne();t.isScript||te(t.breakLabel);}function _e(e){return 2===e.kind||3===e.kind}function de(e){return 4===e.kind}function pe(e){return 3===e.kind}function fe(e,t){for(var r=t;r>=0;r--){var n=u[r];if(!de(n))break;if(n.labelText===e)return !0}return !1}function ge(e){if(u)if(e)for(var t=u.length-1;t>=0;t--){if(de(r=u[t])&&r.labelText===e)return r.breakLabel;if(_e(r)&&fe(e,t-1))return r.breakLabel}else for(t=u.length-1;t>=0;t--){var r;if(_e(r=u[t]))return r.breakLabel}return 0}function me(e){if(u)if(e){for(var t=u.length-1;t>=0;t--)if(pe(r=u[t])&&fe(e,t-1))return r.continueLabel}else for(t=u.length-1;t>=0;t--){var r;if(pe(r=u[t]))return r.continueLabel}return 0}function ye(e){if(void 0!==e&&e>0){void 0===d&&(d=[]);var t=p.createNumericLiteral(-1);return void 0===d[e]?d[e]=[t]:d[e].push(t),t}return p.createOmittedExpression()}function ve(t){var r=p.createNumericLiteral(t);return e.addSyntheticTrailingComment(r,3,function(e){switch(e){case 2:return "return";case 3:return "break";case 4:return "yield";case 5:return "yield*";case 7:return "endfinally";default:return}}(t)),r}function he(t,r){return e.Debug.assertLessThan(0,t,"Invalid label"),e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression([ve(3),ye(t)])),r)}function be(){ke(0);}function xe(e){e?ke(1,[e]):be();}function De(e,t,r){ke(2,[e,t],r);}function Se(e,t){ke(3,[e],t);}function Te(e,t,r){ke(4,[e,t],r);}function Ce(e,t,r){ke(5,[e,t],r);}function ke(e,t,r){void 0===S&&(S=[],T=[],C=[]),void 0===_&&te(ee());var n=S.length;S[n]=e,T[n]=t,C[n]=r;}function Ee(){L=0,R=0,E=void 0,N=!1,F=!1,A=void 0,P=void 0,w=void 0,I=void 0,O=void 0;var t=function(){if(S){for(var t=0;t<S.length;t++)Pe(t);Ne(S.length);}else Ne(0);if(A){var r=p.createPropertyAccessExpression(k,"label"),n=p.createSwitchStatement(r,p.createCaseBlock(A));return [e.startOnNewLine(n)]}return P||[]}();return f().createGeneratorHelper(e.setEmitFlags(p.createFunctionExpression(void 0,void 0,void 0,void 0,[p.createParameterDeclaration(void 0,void 0,void 0,k)],void 0,p.createBlock(t,t.length>0)),524288))}function Ne(e){(function(e){if(!F)return !0;if(!_||!d)return !1;for(var t=0;t<_.length;t++)if(_[t]===e&&d[t])return !0;return !1})(e)&&(Ae(e),O=void 0,Ie(void 0,void 0)),P&&A&&Fe(!1),function(){if(void 0!==d&&void 0!==E)for(var e=0;e<E.length;e++){var t=E[e];if(void 0!==t)for(var r=0,n=t;r<n.length;r++){var i=n[r],a=d[i];if(void 0!==a)for(var o=0,s=a;o<s.length;o++)s[o].text=String(e);}}}();}function Fe(e){if(A||(A=[]),P){if(O)for(var t=O.length-1;t>=0;t--){var r=O[t];P=[p.createWithStatement(r.expression,p.createBlock(P))];}if(I){var n=I.startLabel,i=I.catchLabel,a=I.finallyLabel,o=I.endLabel;P.unshift(p.createExpressionStatement(p.createCallExpression(p.createPropertyAccessExpression(p.createPropertyAccessExpression(k,"trys"),"push"),void 0,[p.createArrayLiteralExpression([ye(n),ye(i),ye(a),ye(o)])]))),I=void 0;}e&&P.push(p.createExpressionStatement(p.createAssignment(p.createPropertyAccessExpression(k,"label"),p.createNumericLiteral(R+1))));}A.push(p.createCaseClause(p.createNumericLiteral(R),P||[])),P=void 0;}function Ae(e){if(_)for(var t=0;t<_.length;t++)_[t]===e&&(P&&(Fe(!N),N=!1,F=!1,R++),void 0===E&&(E=[]),void 0===E[R]?E[R]=[t]:E[R].push(t));}function Pe(t){if(Ae(t),function(e){if(s)for(;L<l.length&&c[L]<=e;L++){var t=s[L],r=l[L];switch(t.kind){case 0:0===r?(w||(w=[]),P||(P=[]),w.push(I),I=t):1===r&&(I=w.pop());break;case 1:0===r?(O||(O=[]),O.push(t)):1===r&&O.pop();}}}(t),!N){N=!1,F=!1;var r=S[t];if(0!==r){if(10===r)return N=!0,void we(p.createReturnStatement(p.createArrayLiteralExpression([ve(7)])));var n=T[t];if(1===r)return we(n[0]);var i,a,o,u=C[t];switch(r){case 2:return i=n[0],a=n[1],o=u,void we(e.setTextRange(p.createExpressionStatement(p.createAssignment(i,a)),o));case 3:return function(t,r){N=!0,we(e.setEmitFlags(e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression([ve(3),ye(t)])),r),384));}(n[0],u);case 4:return function(t,r,n){we(e.setEmitFlags(p.createIfStatement(r,e.setEmitFlags(e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression([ve(3),ye(t)])),n),384)),1));}(n[0],n[1],u);case 5:return function(t,r,n){we(e.setEmitFlags(p.createIfStatement(p.createLogicalNot(r),e.setEmitFlags(e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression([ve(3),ye(t)])),n),384)),1));}(n[0],n[1],u);case 6:return function(t,r){N=!0,we(e.setEmitFlags(e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression(t?[ve(4),t]:[ve(4)])),r),384));}(n[0],u);case 7:return function(t,r){N=!0,we(e.setEmitFlags(e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression([ve(5),t])),r),384));}(n[0],u);case 8:return Ie(n[0],u);case 9:return function(t,r){N=!0,F=!0,we(e.setTextRange(p.createThrowStatement(t),r));}(n[0],u)}}}}function we(e){e&&(P?P.push(e):P=[e]);}function Ie(t,r){N=!0,F=!0,we(e.setEmitFlags(e.setTextRange(p.createReturnStatement(p.createArrayLiteralExpression(t?[ve(2),t]:[ve(2)])),r),384));}};}(t),function(e){e.transformModule=function(r){var i=r.factory,a=r.getEmitHelperFactory,o=r.startLexicalEnvironment,s=r.endLexicalEnvironment,c=r.hoistVariableDeclaration,l=r.getCompilerOptions(),u=r.getEmitResolver(),_=r.getEmitHost(),d=e.getEmitScriptTarget(l),p=e.getEmitModuleKind(l),f=r.onSubstituteNode,g=r.onEmitNode;r.onSubstituteNode=function(t,r){return (r=f(t,r)).id&&x[r.id]?r:1===t?function(t){switch(t.kind){case 79:return Z(t);case 208:return function(t){if(e.isIdentifier(t.expression)){var r=Z(t.expression);if(x[e.getNodeId(r)]=!0,!(e.isIdentifier(r)||4096&e.getEmitFlags(t.expression)))return e.addEmitFlags(i.updateCallExpression(t,r,void 0,t.arguments),536870912)}return t}(t);case 210:return function(t){if(e.isIdentifier(t.tag)){var r=Z(t.tag);if(x[e.getNodeId(r)]=!0,!(e.isIdentifier(r)||4096&e.getEmitFlags(t.tag)))return e.addEmitFlags(i.updateTaggedTemplateExpression(t,r,void 0,t.template),536870912)}return t}(t);case 221:return function(t){if(e.isAssignmentOperator(t.operatorToken.kind)&&e.isIdentifier(t.left)&&!e.isGeneratedIdentifier(t.left)&&!e.isLocalName(t.left)&&!e.isDeclarationNameOfEnumOrNamespace(t.left)){var r=$(t.left);if(r){for(var n=t,i=0,a=r;i<a.length;i++){var o=a[i];x[e.getNodeId(n)]=!0,n=X(o,n,t);}return n}}return t}(t)}return t}(r):e.isShorthandPropertyAssignment(r)?function(t){var r=t.name,n=Z(r);if(n!==r){if(t.objectAssignmentInitializer){var a=i.createAssignment(n,t.objectAssignmentInitializer);return e.setTextRange(i.createPropertyAssignment(r,a),t)}return e.setTextRange(i.createPropertyAssignment(r,n),t)}return t}(r):r},r.onEmitNode=function(t,r,n){305===r.kind?(m=r,y=h[e.getOriginalNodeId(m)],g(t,r,n),m=void 0,y=void 0):g(t,r,n);},r.enableSubstitution(208),r.enableSubstitution(210),r.enableSubstitution(79),r.enableSubstitution(221),r.enableSubstitution(297),r.enableEmitNotification(305);var m,y,v,h=[],b=[],x=[];return e.chainBundle(r,(function(t){if(t.isDeclarationFile||!(e.isEffectiveExternalModule(t,l)||4194304&t.transformFlags||e.isJsonSourceFile(t)&&e.hasJsonModuleEmitEnabled(l)&&e.outFile(l)))return t;m=t,y=e.collectExternalModuleInfo(r,t,u,l),h[e.getOriginalNodeId(t)]=y;var n=function(t){switch(t){case e.ModuleKind.AMD:return T;case e.ModuleKind.UMD:return C;default:return S}}(p)(t);return m=void 0,y=void 0,v=!1,n}));function D(){return !(y.exportEquals||!e.isExternalModule(m))}function S(t){o();var n=[],a=e.getStrictOptionValue(l,"alwaysStrict")||!l.noImplicitUseStrict&&e.isExternalModule(m),c=i.copyPrologue(t.statements,n,a&&!e.isJsonSourceFile(t),A);if(D()&&e.append(n,Q()),e.length(y.exportedNames))for(var u=0;u<y.exportedNames.length;u+=50)e.append(n,i.createExpressionStatement(e.reduceLeft(y.exportedNames.slice(u,u+50),(function(t,r){return i.createAssignment(i.createPropertyAccessExpression(i.createIdentifier("exports"),i.createIdentifier(e.idText(r))),t)}),i.createVoidZero())));e.append(n,e.visitNode(y.externalHelpersImportDeclaration,A,e.isStatement)),e.addRange(n,e.visitNodes(t.statements,A,e.isStatement,c)),F(n,!1),e.insertStatementsAfterStandardPrologue(n,s());var _=i.updateSourceFile(t,e.setTextRange(i.createNodeArray(n),t.statements));return e.addEmitHelpers(_,r.readEmitHelpers()),_}function T(t){var a=i.createIdentifier("define"),o=e.tryGetModuleNameFromFile(i,t,_,l),s=e.isJsonSourceFile(t)&&t,c=k(t,!0),u=c.aliasedModuleNames,d=c.unaliasedModuleNames,p=c.importAliasNames,f=i.updateSourceFile(t,e.setTextRange(i.createNodeArray([i.createExpressionStatement(i.createCallExpression(a,void 0,n$4(n$4([],o?[o]:[],!0),[i.createArrayLiteralExpression(s?e.emptyArray:n$4(n$4([i.createStringLiteral("require"),i.createStringLiteral("exports")],u,!0),d,!0)),s?s.statements.length?s.statements[0].expression:i.createObjectLiteralExpression():i.createFunctionExpression(void 0,void 0,void 0,void 0,n$4([i.createParameterDeclaration(void 0,void 0,void 0,"require"),i.createParameterDeclaration(void 0,void 0,void 0,"exports")],p,!0),void 0,N(t))],!1)))]),t.statements));return e.addEmitHelpers(f,r.readEmitHelpers()),f}function C(t){var a=k(t,!1),o=a.aliasedModuleNames,s=a.unaliasedModuleNames,c=a.importAliasNames,u=e.tryGetModuleNameFromFile(i,t,_,l),d=i.createFunctionExpression(void 0,void 0,void 0,void 0,[i.createParameterDeclaration(void 0,void 0,void 0,"factory")],void 0,e.setTextRange(i.createBlock([i.createIfStatement(i.createLogicalAnd(i.createTypeCheck(i.createIdentifier("module"),"object"),i.createTypeCheck(i.createPropertyAccessExpression(i.createIdentifier("module"),"exports"),"object")),i.createBlock([i.createVariableStatement(void 0,[i.createVariableDeclaration("v",void 0,void 0,i.createCallExpression(i.createIdentifier("factory"),void 0,[i.createIdentifier("require"),i.createIdentifier("exports")]))]),e.setEmitFlags(i.createIfStatement(i.createStrictInequality(i.createIdentifier("v"),i.createIdentifier("undefined")),i.createExpressionStatement(i.createAssignment(i.createPropertyAccessExpression(i.createIdentifier("module"),"exports"),i.createIdentifier("v")))),1)]),i.createIfStatement(i.createLogicalAnd(i.createTypeCheck(i.createIdentifier("define"),"function"),i.createPropertyAccessExpression(i.createIdentifier("define"),"amd")),i.createBlock([i.createExpressionStatement(i.createCallExpression(i.createIdentifier("define"),void 0,n$4(n$4([],u?[u]:[],!0),[i.createArrayLiteralExpression(n$4(n$4([i.createStringLiteral("require"),i.createStringLiteral("exports")],o,!0),s,!0)),i.createIdentifier("factory")],!1)))])))],!0),void 0)),p=i.updateSourceFile(t,e.setTextRange(i.createNodeArray([i.createExpressionStatement(i.createCallExpression(d,void 0,[i.createFunctionExpression(void 0,void 0,void 0,void 0,n$4([i.createParameterDeclaration(void 0,void 0,void 0,"require"),i.createParameterDeclaration(void 0,void 0,void 0,"exports")],c,!0),void 0,N(t))]))]),t.statements));return e.addEmitHelpers(p,r.readEmitHelpers()),p}function k(t,r){for(var n=[],a=[],o=[],s=0,c=t.amdDependencies;s<c.length;s++){var d=c[s];d.name?(n.push(i.createStringLiteral(d.path)),o.push(i.createParameterDeclaration(void 0,void 0,void 0,d.name))):a.push(i.createStringLiteral(d.path));}for(var p=0,f=y.externalImports;p<f.length;p++){var g=f[p],v=e.getExternalModuleNameLiteral(i,g,m,_,u,l),h=e.getLocalNameForExternalImport(i,g,m);v&&(r&&h?(e.setEmitFlags(h,4),n.push(v),o.push(i.createParameterDeclaration(void 0,void 0,void 0,h))):a.push(v));}return {aliasedModuleNames:n,unaliasedModuleNames:a,importAliasNames:o}}function E(t){if(!e.isImportEqualsDeclaration(t)&&!e.isExportDeclaration(t)&&e.getExternalModuleNameLiteral(i,t,m,_,u,l)){var r=e.getLocalNameForExternalImport(i,t,m),n=R(t,r);if(n!==r)return i.createExpressionStatement(i.createAssignment(r,n))}}function N(r){o();var n=[],a=i.copyPrologue(r.statements,n,!l.noImplicitUseStrict,A);D()&&e.append(n,Q()),e.length(y.exportedNames)&&e.append(n,i.createExpressionStatement(e.reduceLeft(y.exportedNames,(function(t,r){return i.createAssignment(i.createPropertyAccessExpression(i.createIdentifier("exports"),i.createIdentifier(e.idText(r))),t)}),i.createVoidZero()))),e.append(n,e.visitNode(y.externalHelpersImportDeclaration,A,e.isStatement)),p===e.ModuleKind.AMD&&e.addRange(n,e.mapDefined(y.externalImports,E)),e.addRange(n,e.visitNodes(r.statements,A,e.isStatement,a)),F(n,!0),e.insertStatementsAfterStandardPrologue(n,s());var c=i.createBlock(n,!0);return v&&e.addEmitHelper(c,t),c}function F(t,r){if(y.exportEquals){var n=e.visitNode(y.exportEquals.expression,w);if(n)if(r){var a=i.createReturnStatement(n);e.setTextRange(a,y.exportEquals),e.setEmitFlags(a,1920),t.push(a);}else a=i.createExpressionStatement(i.createAssignment(i.createPropertyAccessExpression(i.createIdentifier("module"),"exports"),n)),e.setTextRange(a,y.exportEquals),e.setEmitFlags(a,1536),t.push(a);}}function A(t){switch(t.kind){case 266:return function(t){var r,n=e.getNamespaceDeclarationNode(t);if(p!==e.ModuleKind.AMD){if(!t.importClause)return e.setOriginalNode(e.setTextRange(i.createExpressionStatement(B(t)),t),t);var a=[];n&&!e.isDefaultImport(t)?a.push(i.createVariableDeclaration(i.cloneNode(n.name),void 0,void 0,R(t,B(t)))):(a.push(i.createVariableDeclaration(i.getGeneratedNameForNode(t),void 0,void 0,R(t,B(t)))),n&&e.isDefaultImport(t)&&a.push(i.createVariableDeclaration(i.cloneNode(n.name),void 0,void 0,i.getGeneratedNameForNode(t)))),r=e.append(r,e.setOriginalNode(e.setTextRange(i.createVariableStatement(void 0,i.createVariableDeclarationList(a,d>=2?2:0)),t),t));}else n&&e.isDefaultImport(t)&&(r=e.append(r,i.createVariableStatement(void 0,i.createVariableDeclarationList([e.setOriginalNode(e.setTextRange(i.createVariableDeclaration(i.cloneNode(n.name),void 0,void 0,i.getGeneratedNameForNode(t)),t),t)],d>=2?2:0))));if(z(t)){var o=e.getOriginalNodeId(t);b[o]=K(b[o],t);}else r=K(r,t);return e.singleOrMany(r)}(t);case 265:return function(t){var r;if(e.Debug.assert(e.isExternalModuleImportEqualsDeclaration(t),"import= for internal module references should be handled in an earlier transformer."),p!==e.ModuleKind.AMD?r=e.hasSyntacticModifier(t,1)?e.append(r,e.setOriginalNode(e.setTextRange(i.createExpressionStatement(X(t.name,B(t))),t),t)):e.append(r,e.setOriginalNode(e.setTextRange(i.createVariableStatement(void 0,i.createVariableDeclarationList([i.createVariableDeclaration(i.cloneNode(t.name),void 0,void 0,B(t))],d>=2?2:0)),t),t)):e.hasSyntacticModifier(t,1)&&(r=e.append(r,e.setOriginalNode(e.setTextRange(i.createExpressionStatement(X(i.getExportName(t),i.getLocalName(t))),t),t))),z(t)){var n=e.getOriginalNodeId(t);b[n]=U(b[n],t);}else r=U(r,t);return e.singleOrMany(r)}(t);case 272:return function(t){if(t.moduleSpecifier){var r=i.getGeneratedNameForNode(t);if(t.exportClause&&e.isNamedExports(t.exportClause)){var n=[];p!==e.ModuleKind.AMD&&n.push(e.setOriginalNode(e.setTextRange(i.createVariableStatement(void 0,i.createVariableDeclarationList([i.createVariableDeclaration(r,void 0,void 0,B(t))])),t),t));for(var o=0,s=t.exportClause.elements;o<s.length;o++){var c=s[o];if(0===d)n.push(e.setOriginalNode(e.setTextRange(i.createExpressionStatement(a().createCreateBindingHelper(r,i.createStringLiteralFromNode(c.propertyName||c.name),c.propertyName?i.createStringLiteralFromNode(c.name):void 0)),c),c));else {var u=!(!e.getESModuleInterop(l)||67108864&e.getEmitFlags(t)||"default"!==e.idText(c.propertyName||c.name)),_=i.createPropertyAccessExpression(u?a().createImportDefaultHelper(r):r,c.propertyName||c.name);n.push(e.setOriginalNode(e.setTextRange(i.createExpressionStatement(X(i.getExportName(c),_,void 0,!0)),c),c));}}return e.singleOrMany(n)}return t.exportClause?((n=[]).push(e.setOriginalNode(e.setTextRange(i.createExpressionStatement(X(i.cloneNode(t.exportClause.name),function(t,r){return !e.getESModuleInterop(l)||67108864&e.getEmitFlags(t)?r:e.getExportNeedsImportStarHelper(t)?a().createImportStarHelper(r):r}(t,p!==e.ModuleKind.AMD?B(t):e.isExportNamespaceAsDefaultDeclaration(t)?r:i.createIdentifier(e.idText(t.exportClause.name))))),t),t)),e.singleOrMany(n)):e.setOriginalNode(e.setTextRange(i.createExpressionStatement(a().createExportStarHelper(p!==e.ModuleKind.AMD?B(t):r)),t),t)}}(t);case 271:return function(t){if(!t.isExportEquals){var r,n=t.original;if(n&&z(n)){var a=e.getOriginalNodeId(t);b[a]=G(b[a],i.createIdentifier("default"),e.visitNode(t.expression,w),t,!0);}else r=G(r,i.createIdentifier("default"),e.visitNode(t.expression,w),t,!0);return e.singleOrMany(r)}}(t);case 237:return function(t){var n,a,o;if(e.hasSyntacticModifier(t,1)){for(var s=void 0,c=!1,l=0,u=t.declarationList.declarations;l<u.length;l++){var _=u[l];if(e.isIdentifier(_.name)&&e.isLocalName(_.name))s||(s=e.visitNodes(t.modifiers,Y,e.isModifier)),a=e.append(a,_);else if(_.initializer)if(!e.isBindingPattern(_.name)&&(e.isArrowFunction(_.initializer)||e.isFunctionExpression(_.initializer)||e.isClassExpression(_.initializer))){var d=i.createAssignment(e.setTextRange(i.createPropertyAccessExpression(i.createIdentifier("exports"),_.name),_.name),i.createIdentifier(e.getTextOfIdentifierOrLiteral(_.name))),p=i.createVariableDeclaration(_.name,_.exclamationToken,_.type,e.visitNode(_.initializer,w));a=e.append(a,p),o=e.append(o,d),c=!0;}else o=e.append(o,J(_));}if(a&&(n=e.append(n,i.updateVariableStatement(t,s,i.updateVariableDeclarationList(t.declarationList,a)))),o){var f=e.setOriginalNode(e.setTextRange(i.createExpressionStatement(i.inlineExpressions(o)),t),t);c&&e.removeAllComments(f),n=e.append(n,f);}}else n=e.append(n,e.visitEachChild(t,w,r));if(z(t)){var g=e.getOriginalNodeId(t);b[g]=V(b[g],t);}else n=V(n,t);return e.singleOrMany(n)}(t);case 256:return function(t){var n;if(n=e.hasSyntacticModifier(t,1)?e.append(n,e.setOriginalNode(e.setTextRange(i.createFunctionDeclaration(void 0,e.visitNodes(t.modifiers,Y,e.isModifier),t.asteriskToken,i.getDeclarationName(t,!0,!0),void 0,e.visitNodes(t.parameters,w),void 0,e.visitEachChild(t.body,w,r)),t),t)):e.append(n,e.visitEachChild(t,w,r)),z(t)){var a=e.getOriginalNodeId(t);b[a]=W(b[a],t);}else n=W(n,t);return e.singleOrMany(n)}(t);case 257:return function(t){var n;if(n=e.hasSyntacticModifier(t,1)?e.append(n,e.setOriginalNode(e.setTextRange(i.createClassDeclaration(void 0,e.visitNodes(t.modifiers,Y,e.isModifier),i.getDeclarationName(t,!0,!0),void 0,e.visitNodes(t.heritageClauses,w),e.visitNodes(t.members,w)),t),t)):e.append(n,e.visitEachChild(t,w,r)),z(t)){var a=e.getOriginalNodeId(t);b[a]=W(b[a],t);}else n=W(n,t);return e.singleOrMany(n)}(t);case 352:return function(t){if(z(t)&&237===t.original.kind){var r=e.getOriginalNodeId(t);b[r]=V(b[r],t.original);}return t}(t);case 353:return function(t){var r=e.getOriginalNodeId(t),n=b[r];return n?(delete b[r],e.append(n,t)):t}(t);default:return w(t)}}function P(t,n){if(!(71307264&t.transformFlags))return t;switch(t.kind){case 242:return function(t){return i.updateForStatement(t,e.visitNode(t.initializer,I,e.isForInitializer),e.visitNode(t.condition,w,e.isExpression),e.visitNode(t.incrementor,I,e.isExpression),e.visitIterationBody(t.statement,w,r))}(t);case 238:return function(t){return i.updateExpressionStatement(t,e.visitNode(t.expression,I,e.isExpression))}(t);case 212:return function(t,r){return i.updateParenthesizedExpression(t,e.visitNode(t.expression,r?I:w,e.isExpression))}(t,n);case 350:return function(t,r){return i.updatePartiallyEmittedExpression(t,e.visitNode(t.expression,r?I:w,e.isExpression))}(t,n);case 208:if(e.isImportCall(t)&&void 0===m.impliedNodeFormat)return function(t){var r=e.getExternalModuleNameLiteral(i,t,m,_,u,l),n=e.visitNode(e.firstOrUndefined(t.arguments),w),a=!r||n&&e.isStringLiteral(n)&&n.text===r.text?n:r,o=!!(8192&t.transformFlags);switch(l.module){case e.ModuleKind.AMD:return M(a,o);case e.ModuleKind.UMD:return function(t,r){if(v=!0,e.isSimpleCopiableExpression(t)){var n=e.isGeneratedIdentifier(t)?t:e.isStringLiteral(t)?i.createStringLiteralFromNode(t):e.setEmitFlags(e.setTextRange(i.cloneNode(t),t),1536);return i.createConditionalExpression(i.createIdentifier("__syncRequire"),void 0,L(t,r),void 0,M(n,r))}var a=i.createTempVariable(c);return i.createComma(i.createAssignment(a,t),i.createConditionalExpression(i.createIdentifier("__syncRequire"),void 0,L(a,r),void 0,M(a,r)))}(null!=a?a:i.createVoidZero(),o);case e.ModuleKind.CommonJS:default:return L(a,o)}}(t);break;case 221:if(e.isDestructuringAssignment(t))return function(t,n){return O(t.left)?e.flattenDestructuringAssignment(t,w,r,0,!n,j):e.visitEachChild(t,w,r)}(t,n);break;case 219:case 220:return function(t,n){if((45===t.operator||46===t.operator)&&e.isIdentifier(t.operand)&&!e.isGeneratedIdentifier(t.operand)&&!e.isLocalName(t.operand)&&!e.isDeclarationNameOfEnumOrNamespace(t.operand)){var a=$(t.operand);if(a){var o=void 0,s=e.visitNode(t.operand,w,e.isExpression);e.isPrefixUnaryExpression(t)?s=i.updatePrefixUnaryExpression(t,s):(s=i.updatePostfixUnaryExpression(t,s),n||(o=i.createTempVariable(c),s=i.createAssignment(o,s),e.setTextRange(s,t)),s=i.createComma(s,i.cloneNode(t.operand)),e.setTextRange(s,t));for(var l=0,u=a;l<u.length;l++){var _=u[l];x[e.getNodeId(s)]=!0,s=X(_,s),e.setTextRange(s,t);}return o&&(x[e.getNodeId(s)]=!0,s=i.createComma(s,o),e.setTextRange(s,t)),s}}return e.visitEachChild(t,w,r)}(t,n)}return e.visitEachChild(t,w,r)}function w(e){return P(e,!1)}function I(e){return P(e,!0)}function O(t){if(e.isObjectLiteralExpression(t))for(var r=0,n=t.properties;r<n.length;r++)switch((o=n[r]).kind){case 296:if(O(o.initializer))return !0;break;case 297:if(O(o.name))return !0;break;case 298:if(O(o.expression))return !0;break;case 169:case 172:case 173:return !1;default:e.Debug.assertNever(o,"Unhandled object member kind");}else if(e.isArrayLiteralExpression(t))for(var i=0,a=t.elements;i<a.length;i++){var o=a[i];if(e.isSpreadElement(o)){if(O(o.expression))return !0}else if(O(o))return !0}else if(e.isIdentifier(t))return e.length($(t))>(e.isExportName(t)?1:0);return !1}function M(t,r){var n,o=i.createUniqueName("resolve"),s=i.createUniqueName("reject"),c=[i.createParameterDeclaration(void 0,void 0,void 0,o),i.createParameterDeclaration(void 0,void 0,void 0,s)],u=i.createBlock([i.createExpressionStatement(i.createCallExpression(i.createIdentifier("require"),void 0,[i.createArrayLiteralExpression([t||i.createOmittedExpression()]),o,s]))]);d>=2?n=i.createArrowFunction(void 0,void 0,c,void 0,void 0,u):(n=i.createFunctionExpression(void 0,void 0,void 0,void 0,c,void 0,u),r&&e.setEmitFlags(n,8));var _=i.createNewExpression(i.createIdentifier("Promise"),void 0,[n]);return e.getESModuleInterop(l)?i.createCallExpression(i.createPropertyAccessExpression(_,i.createIdentifier("then")),void 0,[a().createImportStarCallbackHelper()]):_}function L(t,r){var n,o=i.createCallExpression(i.createPropertyAccessExpression(i.createIdentifier("Promise"),"resolve"),void 0,[]),s=i.createCallExpression(i.createIdentifier("require"),void 0,t?[t]:[]);return e.getESModuleInterop(l)&&(s=a().createImportStarHelper(s)),d>=2?n=i.createArrowFunction(void 0,void 0,[],void 0,void 0,s):(n=i.createFunctionExpression(void 0,void 0,void 0,void 0,[],void 0,i.createBlock([i.createReturnStatement(s)])),r&&e.setEmitFlags(n,8)),i.createCallExpression(i.createPropertyAccessExpression(o,"then"),void 0,[n])}function R(t,r){return !e.getESModuleInterop(l)||67108864&e.getEmitFlags(t)?r:e.getImportNeedsImportStarHelper(t)?a().createImportStarHelper(r):e.getImportNeedsImportDefaultHelper(t)?a().createImportDefaultHelper(r):r}function B(t){var r=e.getExternalModuleNameLiteral(i,t,m,_,u,l),n=[];return r&&n.push(r),i.createCallExpression(i.createIdentifier("require"),void 0,n)}function j(t,r,n){var a=$(t);if(a){for(var o=e.isExportName(t)?r:i.createAssignment(t,r),s=0,c=a;s<c.length;s++){var l=c[s];e.setEmitFlags(o,4),o=X(l,o,n);}return o}return i.createAssignment(t,r)}function J(t){return e.isBindingPattern(t.name)?e.flattenDestructuringAssignment(e.visitNode(t,w),void 0,r,0,!1,j):i.createAssignment(e.setTextRange(i.createPropertyAccessExpression(i.createIdentifier("exports"),t.name),t.name),t.initializer?e.visitNode(t.initializer,w):i.createVoidZero())}function z(t){return 0!=(4194304&e.getEmitFlags(t))}function K(e,t){if(y.exportEquals)return e;var r=t.importClause;if(!r)return e;r.name&&(e=H(e,r));var n=r.namedBindings;if(n)switch(n.kind){case 268:e=H(e,n);break;case 269:for(var i=0,a=n.elements;i<a.length;i++)e=H(e,a[i],!0);}return e}function U(e,t){return y.exportEquals?e:H(e,t)}function V(e,t){if(y.exportEquals)return e;for(var r=0,n=t.declarationList.declarations;r<n.length;r++)e=q(e,n[r]);return e}function q(t,r){if(y.exportEquals)return t;if(e.isBindingPattern(r.name))for(var n=0,i=r.name.elements;n<i.length;n++){var a=i[n];e.isOmittedExpression(a)||(t=q(t,a));}else e.isGeneratedIdentifier(r.name)||(t=H(t,r));return t}function W(t,r){return y.exportEquals||(e.hasSyntacticModifier(r,1)&&(t=G(t,e.hasSyntacticModifier(r,512)?i.createIdentifier("default"):i.getDeclarationName(r),i.getLocalName(r),r)),r.name&&(t=H(t,r))),t}function H(t,r,n){var a=i.getDeclarationName(r),o=y.exportSpecifiers.get(e.idText(a));if(o)for(var s=0,c=o;s<c.length;s++){var l=c[s];t=G(t,l.name,a,l.name,void 0,n);}return t}function G(t,r,n,a,o,s){return e.append(t,function(t,r,n,a,o){var s=e.setTextRange(i.createExpressionStatement(X(t,r,void 0,o)),n);return e.startOnNewLine(s),a||e.setEmitFlags(s,1536),s}(r,n,a,o,s))}function Q(){var t;return t=0===d?i.createExpressionStatement(X(i.createIdentifier("__esModule"),i.createTrue())):i.createExpressionStatement(i.createCallExpression(i.createPropertyAccessExpression(i.createIdentifier("Object"),"defineProperty"),void 0,[i.createIdentifier("exports"),i.createStringLiteral("__esModule"),i.createObjectLiteralExpression([i.createPropertyAssignment("value",i.createTrue())])])),e.setEmitFlags(t,1048576),t}function X(t,r,n,a){return e.setTextRange(a&&0!==d?i.createCallExpression(i.createPropertyAccessExpression(i.createIdentifier("Object"),"defineProperty"),void 0,[i.createIdentifier("exports"),i.createStringLiteralFromNode(t),i.createObjectLiteralExpression([i.createPropertyAssignment("enumerable",i.createTrue()),i.createPropertyAssignment("get",i.createFunctionExpression(void 0,void 0,void 0,void 0,[],void 0,i.createBlock([i.createReturnStatement(r)])))])]):i.createAssignment(i.createPropertyAccessExpression(i.createIdentifier("exports"),i.cloneNode(t)),r),n)}function Y(e){switch(e.kind){case 93:case 88:return}return e}function Z(t){var r,n;if(4096&e.getEmitFlags(t)){var a=e.getExternalHelpersModuleName(m);return a?i.createPropertyAccessExpression(a,t):t}if((!e.isGeneratedIdentifier(t)||64&t.autoGenerateFlags)&&!e.isLocalName(t)){var o=u.getReferencedExportContainer(t,e.isExportName(t));if(o&&305===o.kind)return e.setTextRange(i.createPropertyAccessExpression(i.createIdentifier("exports"),i.cloneNode(t)),t);var s=u.getReferencedImportDeclaration(t);if(s){if(e.isImportClause(s))return e.setTextRange(i.createPropertyAccessExpression(i.getGeneratedNameForNode(s.parent),i.createIdentifier("default")),t);if(e.isImportSpecifier(s)){var c=s.propertyName||s.name;return e.setTextRange(i.createPropertyAccessExpression(i.getGeneratedNameForNode((null===(n=null===(r=s.parent)||void 0===r?void 0:r.parent)||void 0===n?void 0:n.parent)||s),i.cloneNode(c)),t)}}}return t}function $(t){if(!e.isGeneratedIdentifier(t)){var r=u.getReferencedImportDeclaration(t)||u.getReferencedValueDeclaration(t);if(r)return y&&y.exportedBindings[e.getOriginalNodeId(r)]}}};var t={name:"typescript:dynamicimport-sync-require",scoped:!0,text:'\n var __syncRequire = typeof module === "object" && typeof module.exports === "object";'};}(t),function(e){e.transformSystemModule=function(t){var r=t.factory,n=t.startLexicalEnvironment,i=t.endLexicalEnvironment,a=t.hoistVariableDeclaration,o=t.getCompilerOptions(),s=t.getEmitResolver(),c=t.getEmitHost(),l=t.onSubstituteNode,u=t.onEmitNode;t.onSubstituteNode=function(t,n){return function(e){return y&&e.id&&y[e.id]}(n=l(t,n))?n:1===t?function(t){switch(t.kind){case 79:return function(t){var n,i;if(4096&e.getEmitFlags(t)){var a=e.getExternalHelpersModuleName(_);return a?r.createPropertyAccessExpression(a,t):t}if(!e.isGeneratedIdentifier(t)&&!e.isLocalName(t)){var o=s.getReferencedImportDeclaration(t);if(o){if(e.isImportClause(o))return e.setTextRange(r.createPropertyAccessExpression(r.getGeneratedNameForNode(o.parent),r.createIdentifier("default")),t);if(e.isImportSpecifier(o))return e.setTextRange(r.createPropertyAccessExpression(r.getGeneratedNameForNode((null===(i=null===(n=o.parent)||void 0===n?void 0:n.parent)||void 0===i?void 0:i.parent)||o),r.cloneNode(o.propertyName||o.name)),t)}}return t}(t);case 221:return function(t){if(e.isAssignmentOperator(t.operatorToken.kind)&&e.isIdentifier(t.left)&&!e.isGeneratedIdentifier(t.left)&&!e.isLocalName(t.left)&&!e.isDeclarationNameOfEnumOrNamespace(t.left)){var r=X(t.left);if(r){for(var n=t,i=0,a=r;i<a.length;i++)n=z(a[i],Y(n));return n}}return t}(t);case 231:return function(t){return e.isImportMeta(t)?r.createPropertyAccessExpression(f,r.createIdentifier("meta")):t}(t)}return t}(n):4===t?function(t){switch(t.kind){case 297:return function(t){var n,i,a=t.name;if(!e.isGeneratedIdentifier(a)&&!e.isLocalName(a)){var o=s.getReferencedImportDeclaration(a);if(o){if(e.isImportClause(o))return e.setTextRange(r.createPropertyAssignment(r.cloneNode(a),r.createPropertyAccessExpression(r.getGeneratedNameForNode(o.parent),r.createIdentifier("default"))),t);if(e.isImportSpecifier(o))return e.setTextRange(r.createPropertyAssignment(r.cloneNode(a),r.createPropertyAccessExpression(r.getGeneratedNameForNode((null===(i=null===(n=o.parent)||void 0===n?void 0:n.parent)||void 0===i?void 0:i.parent)||o),r.cloneNode(o.propertyName||o.name))),t)}}return t}(t)}return t}(n):n},t.onEmitNode=function(t,r,n){if(305===r.kind){var i=e.getOriginalNodeId(r);_=r,d=v[i],p=b[i],y=x[i],f=D[i],y&&delete x[i],u(t,r,n),_=void 0,d=void 0,p=void 0,f=void 0,y=void 0;}else u(t,r,n);},t.enableSubstitution(79),t.enableSubstitution(297),t.enableSubstitution(221),t.enableSubstitution(231),t.enableEmitNotification(305);var _,d,p,f,g,m,y,v=[],h=[],b=[],x=[],D=[];return e.chainBundle(t,(function(a){if(a.isDeclarationFile||!(e.isEffectiveExternalModule(a,o)||4194304&a.transformFlags))return a;var l=e.getOriginalNodeId(a);_=a,m=a,d=v[l]=e.collectExternalModuleInfo(t,a,s,o),p=r.createUniqueName("exports"),b[l]=p,f=D[l]=r.createUniqueName("context");var u=function(t){for(var n=new e.Map,i=[],a=0,l=t;a<l.length;a++){var u=l[a],d=e.getExternalModuleNameLiteral(r,u,_,c,s,o);if(d){var p=d.text,f=n.get(p);void 0!==f?i[f].externalImports.push(u):(n.set(p,i.length),i.push({name:d,externalImports:[u]}));}}return i}(d.externalImports),h=function(t,a){var s=[];n();var c=e.getStrictOptionValue(o,"alwaysStrict")||!o.noImplicitUseStrict&&e.isExternalModule(_),l=r.copyPrologue(t.statements,s,c,C);s.push(r.createVariableStatement(void 0,r.createVariableDeclarationList([r.createVariableDeclaration("__moduleName",void 0,void 0,r.createLogicalAnd(f,r.createPropertyAccessExpression(f,"id")))]))),e.visitNode(d.externalHelpersImportDeclaration,C,e.isStatement);var u=e.visitNodes(t.statements,C,e.isStatement,l);e.addRange(s,g),e.insertStatementsAfterStandardPrologue(s,i());var p=function(e){if(d.hasExportStarsToExportValues){if(!d.exportedNames&&0===d.exportSpecifiers.size){for(var t=!1,n=0,i=d.externalImports;n<i.length;n++){var a=i[n];if(272===a.kind&&a.exportClause){t=!0;break}}if(!t){var o=S(void 0);return e.push(o),o.name}}var s=[];if(d.exportedNames)for(var c=0,l=d.exportedNames;c<l.length;c++){var u=l[c];"default"!==u.escapedText&&s.push(r.createPropertyAssignment(r.createStringLiteralFromNode(u),r.createTrue()));}var _=r.createUniqueName("exportedNames");e.push(r.createVariableStatement(void 0,r.createVariableDeclarationList([r.createVariableDeclaration(_,void 0,void 0,r.createObjectLiteralExpression(s,!0))])));var p=S(_);return e.push(p),p.name}}(s),m=1048576&t.transformFlags?r.createModifiersFromModifierFlags(256):void 0,y=r.createObjectLiteralExpression([r.createPropertyAssignment("setters",T(p,a)),r.createPropertyAssignment("execute",r.createFunctionExpression(m,void 0,void 0,void 0,[],void 0,r.createBlock(u,!0)))],!0);return s.push(r.createReturnStatement(y)),r.createBlock(s,!0)}(a,u),k=r.createFunctionExpression(void 0,void 0,void 0,void 0,[r.createParameterDeclaration(void 0,void 0,void 0,p),r.createParameterDeclaration(void 0,void 0,void 0,f)],void 0,h),E=e.tryGetModuleNameFromFile(r,a,c,o),N=r.createArrayLiteralExpression(e.map(u,(function(e){return e.name}))),F=e.setEmitFlags(r.updateSourceFile(a,e.setTextRange(r.createNodeArray([r.createExpressionStatement(r.createCallExpression(r.createPropertyAccessExpression(r.createIdentifier("System"),"register"),void 0,E?[E,N,k]:[N,k]))]),a.statements)),1024);return e.outFile(o)||e.moveEmitHelpers(F,h,(function(e){return !e.scoped})),y&&(x[l]=y,y=void 0),_=void 0,d=void 0,p=void 0,f=void 0,g=void 0,m=void 0,F}));function S(t){var n=r.createUniqueName("exportStar"),i=r.createIdentifier("m"),a=r.createIdentifier("n"),o=r.createIdentifier("exports"),s=r.createStrictInequality(a,r.createStringLiteral("default"));return t&&(s=r.createLogicalAnd(s,r.createLogicalNot(r.createCallExpression(r.createPropertyAccessExpression(t,"hasOwnProperty"),void 0,[a])))),r.createFunctionDeclaration(void 0,void 0,void 0,n,void 0,[r.createParameterDeclaration(void 0,void 0,void 0,i)],void 0,r.createBlock([r.createVariableStatement(void 0,r.createVariableDeclarationList([r.createVariableDeclaration(o,void 0,void 0,r.createObjectLiteralExpression([]))])),r.createForInStatement(r.createVariableDeclarationList([r.createVariableDeclaration(a)]),i,r.createBlock([e.setEmitFlags(r.createIfStatement(s,r.createExpressionStatement(r.createAssignment(r.createElementAccessExpression(o,a),r.createElementAccessExpression(i,a)))),1)])),r.createExpressionStatement(r.createCallExpression(p,void 0,[o]))],!0))}function T(t,n){for(var i=[],a=0,o=n;a<o.length;a++){for(var s=o[a],c=e.forEach(s.externalImports,(function(t){return e.getLocalNameForExternalImport(r,t,_)})),l=c?r.getGeneratedNameForNode(c):r.createUniqueName(""),u=[],d=0,f=s.externalImports;d<f.length;d++){var g=f[d],m=e.getLocalNameForExternalImport(r,g,_);switch(g.kind){case 266:if(!g.importClause)break;case 265:e.Debug.assert(void 0!==m),u.push(r.createExpressionStatement(r.createAssignment(m,l)));break;case 272:if(e.Debug.assert(void 0!==m),g.exportClause)if(e.isNamedExports(g.exportClause)){for(var y=[],v=0,h=g.exportClause.elements;v<h.length;v++){var b=h[v];y.push(r.createPropertyAssignment(r.createStringLiteral(e.idText(b.name)),r.createElementAccessExpression(l,r.createStringLiteral(e.idText(b.propertyName||b.name)))));}u.push(r.createExpressionStatement(r.createCallExpression(p,void 0,[r.createObjectLiteralExpression(y,!0)])));}else u.push(r.createExpressionStatement(r.createCallExpression(p,void 0,[r.createStringLiteral(e.idText(g.exportClause.name)),l])));else u.push(r.createExpressionStatement(r.createCallExpression(t,void 0,[l])));}}i.push(r.createFunctionExpression(void 0,void 0,void 0,void 0,[r.createParameterDeclaration(void 0,void 0,void 0,l)],void 0,r.createBlock(u,!0)));}return r.createArrayLiteralExpression(i,!0)}function C(t){switch(t.kind){case 266:return function(t){var n;if(t.importClause&&a(e.getLocalNameForExternalImport(r,t,_)),w(t)){var i=e.getOriginalNodeId(t);h[i]=I(h[i],t);}else n=I(n,t);return e.singleOrMany(n)}(t);case 265:return function(t){var n;if(e.Debug.assert(e.isExternalModuleImportEqualsDeclaration(t),"import= for internal module references should be handled in an earlier transformer."),a(e.getLocalNameForExternalImport(r,t,_)),w(t)){var i=e.getOriginalNodeId(t);h[i]=O(h[i],t);}else n=O(n,t);return e.singleOrMany(n)}(t);case 272:return function(t){e.Debug.assertIsDefined(t);}(t);case 271:return function(t){if(!t.isExportEquals){var n=e.visitNode(t.expression,W,e.isExpression),i=t.original;if(!i||!w(i))return J(r.createIdentifier("default"),n,!0);var a=e.getOriginalNodeId(t);h[a]=j(h[a],r.createIdentifier("default"),n,!0);}}(t);default:return K(t)}}function k(t){if(e.isBindingPattern(t.name))for(var n=0,i=t.name.elements;n<i.length;n++){var o=i[n];e.isOmittedExpression(o)||k(o);}else a(r.cloneNode(t.name));}function E(t){return 0==(2097152&e.getEmitFlags(t))&&(305===m.kind||0==(3&e.getOriginalNode(t).flags))}function N(r,n){var i=n?F:A;return e.isBindingPattern(r.name)?e.flattenDestructuringAssignment(r,W,t,0,!1,i):r.initializer?i(r.name,e.visitNode(r.initializer,W,e.isExpression)):r.name}function F(e,t,r){return P(e,t,r,!0)}function A(e,t,r){return P(e,t,r,!1)}function P(t,n,i,o){return a(r.cloneNode(t)),o?z(t,Y(e.setTextRange(r.createAssignment(t,n),i))):Y(e.setTextRange(r.createAssignment(t,n),i))}function w(t){return 0!=(4194304&e.getEmitFlags(t))}function I(e,t){if(d.exportEquals)return e;var r=t.importClause;if(!r)return e;r.name&&(e=B(e,r));var n=r.namedBindings;if(n)switch(n.kind){case 268:e=B(e,n);break;case 269:for(var i=0,a=n.elements;i<a.length;i++)e=B(e,a[i]);}return e}function O(e,t){return d.exportEquals?e:B(e,t)}function M(e,t,r){if(d.exportEquals)return e;for(var n=0,i=t.declarationList.declarations;n<i.length;n++){var a=i[n];(a.initializer||r)&&(e=L(e,a,r));}return e}function L(t,n,i){if(d.exportEquals)return t;if(e.isBindingPattern(n.name))for(var a=0,o=n.name.elements;a<o.length;a++){var s=o[a];e.isOmittedExpression(s)||(t=L(t,s,i));}else if(!e.isGeneratedIdentifier(n.name)){var c=void 0;i&&(t=j(t,n.name,r.getLocalName(n)),c=e.idText(n.name)),t=B(t,n,c);}return t}function R(t,n){if(d.exportEquals)return t;var i;if(e.hasSyntacticModifier(n,1)){var a=e.hasSyntacticModifier(n,512)?r.createStringLiteral("default"):n.name;t=j(t,a,r.getLocalName(n)),i=e.getTextOfIdentifierOrLiteral(a);}return n.name&&(t=B(t,n,i)),t}function B(t,n,i){if(d.exportEquals)return t;var a=r.getDeclarationName(n),o=d.exportSpecifiers.get(e.idText(a));if(o)for(var s=0,c=o;s<c.length;s++){var l=c[s];l.name.escapedText!==i&&(t=j(t,l.name,a));}return t}function j(t,r,n,i){return e.append(t,J(r,n,i))}function J(t,n,i){var a=r.createExpressionStatement(z(t,n));return e.startOnNewLine(a),i||e.setEmitFlags(a,1536),a}function z(t,n){var i=e.isIdentifier(t)?r.createStringLiteralFromNode(t):t;return e.setEmitFlags(n,1536|e.getEmitFlags(n)),e.setCommentRange(r.createCallExpression(p,void 0,[i,n]),n)}function K(n){switch(n.kind){case 237:return function(t){if(!E(t.declarationList))return e.visitNode(t,W,e.isStatement);for(var n,i,a=e.hasSyntacticModifier(t,1),o=w(t),s=0,c=t.declarationList.declarations;s<c.length;s++){var l=c[s];l.initializer?n=e.append(n,N(l,a&&!o)):k(l);}if(n&&(i=e.append(i,e.setTextRange(r.createExpressionStatement(r.inlineExpressions(n)),t))),o){var u=e.getOriginalNodeId(t);h[u]=M(h[u],t,a);}else i=M(i,t,!1);return e.singleOrMany(i)}(n);case 256:return function(n){if(g=e.hasSyntacticModifier(n,1)?e.append(g,r.updateFunctionDeclaration(n,n.decorators,e.visitNodes(n.modifiers,Q,e.isModifier),n.asteriskToken,r.getDeclarationName(n,!0,!0),void 0,e.visitNodes(n.parameters,W,e.isParameterDeclaration),void 0,e.visitNode(n.body,W,e.isBlock))):e.append(g,e.visitEachChild(n,W,t)),w(n)){var i=e.getOriginalNodeId(n);h[i]=R(h[i],n);}else g=R(g,n);}(n);case 257:return function(t){var n,i=r.getLocalName(t);if(a(i),n=e.append(n,e.setTextRange(r.createExpressionStatement(r.createAssignment(i,e.setTextRange(r.createClassExpression(e.visitNodes(t.decorators,W,e.isDecorator),void 0,t.name,void 0,e.visitNodes(t.heritageClauses,W,e.isHeritageClause),e.visitNodes(t.members,W,e.isClassElement)),t))),t)),w(t)){var o=e.getOriginalNodeId(t);h[o]=R(h[o],t);}else n=R(n,t);return e.singleOrMany(n)}(n);case 242:return U(n,!0);case 243:return function(n){var i=m;return m=n,n=r.updateForInStatement(n,V(n.initializer),e.visitNode(n.expression,W,e.isExpression),e.visitIterationBody(n.statement,K,t)),m=i,n}(n);case 244:return function(n){var i=m;return m=n,n=r.updateForOfStatement(n,n.awaitModifier,V(n.initializer),e.visitNode(n.expression,W,e.isExpression),e.visitIterationBody(n.statement,K,t)),m=i,n}(n);case 240:return function(n){return r.updateDoStatement(n,e.visitIterationBody(n.statement,K,t),e.visitNode(n.expression,W,e.isExpression))}(n);case 241:return function(n){return r.updateWhileStatement(n,e.visitNode(n.expression,W,e.isExpression),e.visitIterationBody(n.statement,K,t))}(n);case 250:return function(t){return r.updateLabeledStatement(t,t.label,e.visitNode(t.statement,K,e.isStatement,r.liftToBlock))}(n);case 248:return function(t){return r.updateWithStatement(t,e.visitNode(t.expression,W,e.isExpression),e.visitNode(t.statement,K,e.isStatement,r.liftToBlock))}(n);case 249:return function(t){return r.updateSwitchStatement(t,e.visitNode(t.expression,W,e.isExpression),e.visitNode(t.caseBlock,K,e.isCaseBlock))}(n);case 263:return function(t){var n=m;return m=t,t=r.updateCaseBlock(t,e.visitNodes(t.clauses,K,e.isCaseOrDefaultClause)),m=n,t}(n);case 289:return function(t){return r.updateCaseClause(t,e.visitNode(t.expression,W,e.isExpression),e.visitNodes(t.statements,K,e.isStatement))}(n);case 290:case 252:return function(r){return e.visitEachChild(r,K,t)}(n);case 292:return function(t){var n=m;return m=t,t=r.updateCatchClause(t,t.variableDeclaration,e.visitNode(t.block,K,e.isBlock)),m=n,t}(n);case 235:return function(r){var n=m;return m=r,r=e.visitEachChild(r,K,t),m=n,r}(n);case 352:return function(t){if(w(t)&&237===t.original.kind){var r=e.getOriginalNodeId(t),n=e.hasSyntacticModifier(t.original,1);h[r]=M(h[r],t.original,n);}return t}(n);case 353:return function(t){var r=e.getOriginalNodeId(t),n=h[r];if(n)return delete h[r],e.append(n,t);var i=e.getOriginalNode(t);return e.isModuleOrEnumDeclaration(i)?e.append(B(n,i),t):t}(n);default:return W(n)}}function U(n,i){var a=m;return m=n,n=r.updateForStatement(n,e.visitNode(n.initializer,i?V:H,e.isForInitializer),e.visitNode(n.condition,W,e.isExpression),e.visitNode(n.incrementor,H,e.isExpression),e.visitIterationBody(n.statement,i?K:W,t)),m=a,n}function V(t){if(function(t){return e.isVariableDeclarationList(t)&&E(t)}(t)){for(var n=void 0,i=0,a=t.declarations;i<a.length;i++){var o=a[i];n=e.append(n,N(o,!1)),o.initializer||k(o);}return n?r.inlineExpressions(n):r.createOmittedExpression()}return e.visitNode(t,H,e.isExpression)}function q(n,i){if(!(71307264&n.transformFlags))return n;switch(n.kind){case 242:return U(n,!1);case 238:return function(t){return r.updateExpressionStatement(t,e.visitNode(t.expression,H,e.isExpression))}(n);case 212:return function(t,n){return r.updateParenthesizedExpression(t,e.visitNode(t.expression,n?H:W,e.isExpression))}(n,i);case 350:return function(t,n){return r.updatePartiallyEmittedExpression(t,e.visitNode(t.expression,n?H:W,e.isExpression))}(n,i);case 221:if(e.isDestructuringAssignment(n))return function(r,n){return G(r.left)?e.flattenDestructuringAssignment(r,W,t,0,!n):e.visitEachChild(r,W,t)}(n,i);break;case 208:if(e.isImportCall(n))return function(t){var n=e.getExternalModuleNameLiteral(r,t,_,c,s,o),i=e.visitNode(e.firstOrUndefined(t.arguments),W),a=!n||i&&e.isStringLiteral(i)&&i.text===n.text?i:n;return r.createCallExpression(r.createPropertyAccessExpression(f,r.createIdentifier("import")),void 0,a?[a]:[])}(n);break;case 219:case 220:return function(n,i){if((45===n.operator||46===n.operator)&&e.isIdentifier(n.operand)&&!e.isGeneratedIdentifier(n.operand)&&!e.isLocalName(n.operand)&&!e.isDeclarationNameOfEnumOrNamespace(n.operand)){var o=X(n.operand);if(o){var s=void 0,c=e.visitNode(n.operand,W,e.isExpression);e.isPrefixUnaryExpression(n)?c=r.updatePrefixUnaryExpression(n,c):(c=r.updatePostfixUnaryExpression(n,c),i||(s=r.createTempVariable(a),c=r.createAssignment(s,c),e.setTextRange(c,n)),c=r.createComma(c,r.cloneNode(n.operand)),e.setTextRange(c,n));for(var l=0,u=o;l<u.length;l++)c=z(u[l],Y(c));return s&&(c=r.createComma(c,s),e.setTextRange(c,n)),c}}return e.visitEachChild(n,W,t)}(n,i)}return e.visitEachChild(n,W,t)}function W(e){return q(e,!1)}function H(e){return q(e,!0)}function G(t){if(e.isAssignmentExpression(t,!0))return G(t.left);if(e.isSpreadElement(t))return G(t.expression);if(e.isObjectLiteralExpression(t))return e.some(t.properties,G);if(e.isArrayLiteralExpression(t))return e.some(t.elements,G);if(e.isShorthandPropertyAssignment(t))return G(t.name);if(e.isPropertyAssignment(t))return G(t.initializer);if(e.isIdentifier(t)){var r=s.getReferencedExportContainer(t);return void 0!==r&&305===r.kind}return !1}function Q(e){switch(e.kind){case 93:case 88:return}return e}function X(t){var n;if(!e.isGeneratedIdentifier(t)){var i=s.getReferencedImportDeclaration(t)||s.getReferencedValueDeclaration(t);if(i){var a=s.getReferencedExportContainer(t,!1);a&&305===a.kind&&(n=e.append(n,r.getDeclarationName(i))),n=e.addRange(n,d&&d.exportedBindings[e.getOriginalNodeId(i)]);}}return n}function Y(t){return void 0===y&&(y=[]),y[e.getNodeId(t)]=!0,t}};}(t),function(e){e.transformECMAScriptModule=function(t){var r,i,a,o=t.factory,s=t.getEmitHelperFactory,c=t.getEmitHost(),l=t.getEmitResolver(),u=t.getCompilerOptions(),_=e.getEmitScriptTarget(u),d=t.onEmitNode,p=t.onSubstituteNode;return t.onEmitNode=function(t,n,i){e.isSourceFile(n)?((e.isExternalModule(n)||u.isolatedModules)&&u.importHelpers&&(r=new e.Map),d(t,n,i),r=void 0):d(t,n,i);},t.onSubstituteNode=function(t,n){return n=p(t,n),r&&e.isIdentifier(n)&&4096&e.getEmitFlags(n)?function(t){var n=e.idText(t),i=r.get(n);return i||r.set(n,i=o.createUniqueName(n,48)),i}(n):n},t.enableEmitNotification(305),t.enableSubstitution(79),e.chainBundle(t,(function(r){if(r.isDeclarationFile)return r;if(e.isExternalModule(r)||u.isolatedModules){i=r,a=void 0;var c=function(r){var n=e.createExternalHelpersImportDeclarationIfNeeded(o,s(),r,u);if(n){var i=[],a=o.copyPrologue(r.statements,i);return e.append(i,n),e.addRange(i,e.visitNodes(r.statements,f,e.isStatement,a)),o.updateSourceFile(r,e.setTextRange(o.createNodeArray(i),r.statements))}return e.visitEachChild(r,f,t)}(r);return i=void 0,a&&(c=o.updateSourceFile(c,e.setTextRange(o.createNodeArray(e.insertStatementsAfterCustomPrologue(c.statements.slice(),a)),c.statements))),!e.isExternalModule(r)||e.some(c.statements,e.isExternalModuleIndicator)?c:o.updateSourceFile(c,e.setTextRange(o.createNodeArray(n$4(n$4([],c.statements,!0),[e.createEmptyExports(o)],!1)),c.statements))}return r}));function f(t){switch(t.kind){case 265:return e.getEmitScriptTarget(u)>=e.ModuleKind.ES2020?function(t){var r;return e.Debug.assert(e.isExternalModuleImportEqualsDeclaration(t),"import= for internal module references should be handled in an earlier transformer."),r=function(t,r){return e.hasSyntacticModifier(r,1)&&(t=e.append(t,o.createExportDeclaration(void 0,void 0,r.isTypeOnly,o.createNamedExports([o.createExportSpecifier(!1,void 0,e.idText(r.name))])))),t}(r=e.append(r,e.setOriginalNode(e.setTextRange(o.createVariableStatement(void 0,o.createVariableDeclarationList([o.createVariableDeclaration(o.cloneNode(t.name),void 0,void 0,g(t))],_>=2?2:0)),t),t)),t),e.singleOrMany(r)}(t):void 0;case 271:return function(e){return e.isExportEquals?void 0:e}(t);case 272:return function(t){if(void 0!==u.module&&u.module>e.ModuleKind.ES2015)return t;if(!t.exportClause||!e.isNamespaceExport(t.exportClause)||!t.moduleSpecifier)return t;var r=t.exportClause.name,n=o.getGeneratedNameForNode(r),i=o.createImportDeclaration(void 0,void 0,o.createImportClause(!1,void 0,o.createNamespaceImport(n)),t.moduleSpecifier,t.assertClause);e.setOriginalNode(i,t.exportClause);var a=e.isExportNamespaceAsDefaultDeclaration(t)?o.createExportDefault(n):o.createExportDeclaration(void 0,void 0,!1,o.createNamedExports([o.createExportSpecifier(!1,n,r)]));return e.setOriginalNode(a,t),[i,a]}(t)}return t}function g(t){var r=e.getExternalModuleNameLiteral(o,t,e.Debug.checkDefined(i),c,l,u),n=[];if(r&&n.push(r),!a){var s=o.createUniqueName("_createRequire",48),d=o.createImportDeclaration(void 0,void 0,o.createImportClause(!1,void 0,o.createNamedImports([o.createImportSpecifier(!1,o.createIdentifier("createRequire"),s)])),o.createStringLiteral("module")),p=o.createUniqueName("__require",48),f=o.createVariableStatement(void 0,o.createVariableDeclarationList([o.createVariableDeclaration(p,void 0,void 0,o.createCallExpression(o.cloneNode(s),void 0,[o.createPropertyAccessExpression(o.createMetaProperty(100,o.createIdentifier("meta")),o.createIdentifier("url"))]))],_>=2?2:0));a=[d,f];}var g=a[1].declarationList.declarations[0].name;return e.Debug.assertNode(g,e.isIdentifier),o.createCallExpression(o.cloneNode(g),void 0,n)}};}(t),function(e){e.transformNodeModule=function(t){var r=t.onSubstituteNode,n=t.onEmitNode,i=e.transformECMAScriptModule(t),a=t.onSubstituteNode,o=t.onEmitNode;t.onSubstituteNode=r,t.onEmitNode=n;var s,c=e.transformModule(t),l=t.onSubstituteNode,u=t.onEmitNode;return t.onSubstituteNode=function(t,n){return e.isSourceFile(n)?(s=n,r(t,n)):s?s.impliedNodeFormat===e.ModuleKind.ESNext?a(t,n):l(t,n):r(t,n)},t.onEmitNode=function(t,r,i){return e.isSourceFile(r)&&(s=r),s?s.impliedNodeFormat===e.ModuleKind.ESNext?o(t,r,i):u(t,r,i):n(t,r,i)},t.enableSubstitution(305),t.enableEmitNotification(305),function(r){return 305===r.kind?_(r):function(r){return t.factory.createBundle(e.map(r.sourceFiles,_),r.prepends)}(r)};function _(t){if(t.isDeclarationFile)return t;s=t;var r=(t.impliedNodeFormat===e.ModuleKind.ESNext?i:c)(t);return s=void 0,e.Debug.assert(e.isSourceFile(r)),r}};}(t),function(e){function t(t){return e.isVariableDeclaration(t)||e.isPropertyDeclaration(t)||e.isPropertySignature(t)||e.isPropertyAccessExpression(t)||e.isBindingElement(t)||e.isConstructorDeclaration(t)?r:e.isSetAccessor(t)||e.isGetAccessor(t)?function(r){return {diagnosticMessage:173===t.kind?e.isStatic(t)?r.errorModuleName?e.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1:r.errorModuleName?e.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1:e.isStatic(t)?r.errorModuleName?2===r.accessibility?e.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1:r.errorModuleName?2===r.accessibility?e.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1,errorNode:t.name,typeName:t.name}}:e.isConstructSignatureDeclaration(t)||e.isCallSignatureDeclaration(t)||e.isMethodDeclaration(t)||e.isMethodSignature(t)||e.isFunctionDeclaration(t)||e.isIndexSignatureDeclaration(t)?function(r){var n;switch(t.kind){case 175:n=r.errorModuleName?e.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;break;case 174:n=r.errorModuleName?e.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;break;case 176:n=r.errorModuleName?e.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;break;case 169:case 168:n=e.isStatic(t)?r.errorModuleName?2===r.accessibility?e.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0:257===t.parent.kind?r.errorModuleName?2===r.accessibility?e.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0:r.errorModuleName?e.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;break;case 256:n=r.errorModuleName?2===r.accessibility?e.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;break;default:return e.Debug.fail("This is unknown kind for signature: "+t.kind)}return {diagnosticMessage:n,errorNode:t.name||t}}:e.isParameter(t)?e.isParameterPropertyDeclaration(t,t.parent)&&e.hasSyntacticModifier(t.parent,8)?r:function(r){var n=function(r){switch(t.parent.kind){case 171:return r.errorModuleName?2===r.accessibility?e.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;case 175:case 180:return r.errorModuleName?e.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;case 174:return r.errorModuleName?e.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;case 176:return r.errorModuleName?e.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;case 169:case 168:return e.isStatic(t.parent)?r.errorModuleName?2===r.accessibility?e.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:257===t.parent.parent.kind?r.errorModuleName?2===r.accessibility?e.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:r.errorModuleName?e.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;case 256:case 179:return r.errorModuleName?2===r.accessibility?e.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;case 173:case 172:return r.errorModuleName?2===r.accessibility?e.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;default:return e.Debug.fail("Unknown parent for parameter: ".concat(e.SyntaxKind[t.parent.kind]))}}(r);return void 0!==n?{diagnosticMessage:n,errorNode:t,typeName:t.name}:void 0}:e.isTypeParameterDeclaration(t)?function(){var r;switch(t.parent.kind){case 257:r=e.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;break;case 258:r=e.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;break;case 195:r=e.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;break;case 180:case 175:r=e.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;break;case 174:r=e.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;break;case 169:case 168:r=e.isStatic(t.parent)?e.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:257===t.parent.parent.kind?e.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:e.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;break;case 179:case 256:r=e.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;break;case 259:r=e.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;break;default:return e.Debug.fail("This is unknown parent for type parameter: "+t.parent.kind)}return {diagnosticMessage:r,errorNode:t,typeName:t.name}}:e.isExpressionWithTypeArguments(t)?function(){return {diagnosticMessage:e.isClassDeclaration(t.parent.parent)?e.isHeritageClause(t.parent)&&117===t.parent.token?e.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1:t.parent.parent.name?e.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1:e.Diagnostics.extends_clause_of_exported_class_has_or_is_using_private_name_0:e.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1,errorNode:t,typeName:e.getNameOfDeclaration(t.parent.parent)}}:e.isImportEqualsDeclaration(t)?function(){return {diagnosticMessage:e.Diagnostics.Import_declaration_0_is_using_private_name_1,errorNode:t,typeName:t.name}}:e.isTypeAliasDeclaration(t)||e.isJSDocTypeAlias(t)?function(r){return {diagnosticMessage:r.errorModuleName?e.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2:e.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,errorNode:e.isJSDocTypeAlias(t)?e.Debug.checkDefined(t.typeExpression):t.type,typeName:e.isJSDocTypeAlias(t)?e.getNameOfDeclaration(t):t.name}}:e.Debug.assertNever(t,"Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(e.SyntaxKind[t.kind]));function r(r){var n=function(r){return 254===t.kind||203===t.kind?r.errorModuleName?2===r.accessibility?e.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1:167===t.kind||206===t.kind||166===t.kind||164===t.kind&&e.hasSyntacticModifier(t.parent,8)?e.isStatic(t)?r.errorModuleName?2===r.accessibility?e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1:257===t.parent.kind||164===t.kind?r.errorModuleName?2===r.accessibility?e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1:r.errorModuleName?e.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1:void 0}(r);return void 0!==n?{diagnosticMessage:n,errorNode:t,typeName:t.name}:void 0}}e.canProduceDiagnostics=function(t){return e.isVariableDeclaration(t)||e.isPropertyDeclaration(t)||e.isPropertySignature(t)||e.isBindingElement(t)||e.isSetAccessor(t)||e.isGetAccessor(t)||e.isConstructSignatureDeclaration(t)||e.isCallSignatureDeclaration(t)||e.isMethodDeclaration(t)||e.isMethodSignature(t)||e.isFunctionDeclaration(t)||e.isParameter(t)||e.isTypeParameterDeclaration(t)||e.isExpressionWithTypeArguments(t)||e.isImportEqualsDeclaration(t)||e.isTypeAliasDeclaration(t)||e.isConstructorDeclaration(t)||e.isIndexSignatureDeclaration(t)||e.isPropertyAccessExpression(t)||e.isJSDocTypeAlias(t)},e.createGetSymbolAccessibilityDiagnosticForNodeName=function(r){return e.isSetAccessor(r)||e.isGetAccessor(r)?function(t){var n=function(t){return e.isStatic(r)?t.errorModuleName?2===t.accessibility?e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1:257===r.parent.kind?t.errorModuleName?2===t.accessibility?e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1:t.errorModuleName?e.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1}(t);return void 0!==n?{diagnosticMessage:n,errorNode:r,typeName:r.name}:void 0}:e.isMethodSignature(r)||e.isMethodDeclaration(r)?function(t){var n=function(t){return e.isStatic(r)?t.errorModuleName?2===t.accessibility?e.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1:257===r.parent.kind?t.errorModuleName?2===t.accessibility?e.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1:t.errorModuleName?e.Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1}(t);return void 0!==n?{diagnosticMessage:n,errorNode:r,typeName:r.name}:void 0}:t(r)},e.createGetSymbolAccessibilityDiagnosticForNode=t;}(t),function(e){function t(t,r){var n=r.text.substring(t.pos,t.end);return e.stringContains(n,"@internal")}function r(r,n){var i=e.getParseTreeNode(r);if(i&&164===i.kind){var a=i.parent.parameters.indexOf(i),o=a>0?i.parent.parameters[a-1]:void 0,s=n.text,c=o?e.concatenate(e.getTrailingCommentRanges(s,e.skipTrivia(s,o.end+1,!1,!0)),e.getLeadingCommentRanges(s,r.pos)):e.getTrailingCommentRanges(s,e.skipTrivia(s,r.pos,!1,!0));return c&&c.length&&t(e.last(c),n)}var l=i&&e.getLeadingCommentRangesOfNode(i,n);return !!e.forEach(l,(function(e){return t(e,n)}))}e.getDeclarationDiagnostics=function(t,r,n){var i=t.getCompilerOptions();return e.transformNodes(r,t,e.factory,i,n?[n]:e.filter(t.getSourceFiles(),e.isSourceFileNotJson),[o],!1).diagnostics},e.isInternalDeclaration=r;var a=531469;function o(t){var o,l,u,_,d,p,f,g,m,y,v,h,b=function(){return e.Debug.fail("Diagnostic emitted without context")},x=b,D=!0,S=!1,T=!1,C=!1,k=!1,E=t.factory,N=t.getEmitHost(),F={trackSymbol:function(e,t,r){if(262144&e.flags)return !1;var n=M(A.isSymbolAccessible(e,t,r,!0));return O(A.getTypeReferenceDirectivesForSymbol(e,r)),n},reportInaccessibleThisError:function(){(f||g)&&t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,L(),"this"));},reportInaccessibleUniqueSymbolError:function(){(f||g)&&t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,L(),"unique symbol"));},reportCyclicStructureError:function(){(f||g)&&t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary,L()));},reportPrivateInBaseOfClassExpression:function(r){(f||g)&&t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected,r));},reportLikelyUnsafeImportRequiredError:function(r){(f||g)&&t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary,L(),r));},reportTruncationError:function(){(f||g)&&t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed));},moduleResolverHost:N,trackReferencedAmbientModule:function(t,r){var n=A.getTypeReferenceDirectivesForSymbol(r,67108863);if(e.length(n))return O(n);var i=e.getSourceFileOfNode(t);y.set(e.getOriginalNodeId(i),i);},trackExternalModuleSymbolOfImportTypeNode:function(e){S||(p||(p=[])).push(e);},reportNonlocalAugmentation:function(r,n,i){var a,o=null===(a=n.declarations)||void 0===a?void 0:a.find((function(t){return e.getSourceFileOfNode(t)===r})),s=e.filter(i.declarations,(function(t){return e.getSourceFileOfNode(t)!==r}));if(s)for(var c=0,l=s;c<l.length;c++){var u=l[c];t.addDiagnostic(e.addRelatedInfo(e.createDiagnosticForNode(u,e.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized),e.createDiagnosticForNode(o,e.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file)));}},reportNonSerializableProperty:function(r){(f||g)&&t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized,r));},reportImportTypeNodeResolutionModeOverride:function(){e.isNightly()||!f&&!g||t.addDiagnostic(e.createDiagnosticForNode(f||g,e.Diagnostics.The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));}},A=t.getEmitResolver(),P=t.getCompilerOptions(),w=P.noResolve,I=P.stripInternal;return function(r){if(305===r.kind&&r.isDeclarationFile)return r;if(306===r.kind){S=!0,y=new e.Map,v=new e.Map;var a=!1,s=E.createBundle(e.map(r.sourceFiles,(function(r){if(!r.isDeclarationFile){if(a=a||r.hasNoDefaultLib,m=r,o=r,u=void 0,d=!1,_=new e.Map,x=b,C=!1,k=!1,B(r,y),j(r,v),e.isExternalOrCommonJsModule(r)||e.isJsonSourceFile(r)){T=!1,D=!1;var n=e.isSourceFileJS(r)?E.createNodeArray(R(r,!0)):e.visitNodes(r.statements,ne);return E.updateSourceFile(r,[E.createModuleDeclaration([],[E.createModifier(135)],E.createStringLiteral(e.getResolvedExternalModuleName(t.getEmitHost(),r)),E.createModuleBlock(e.setTextRange(E.createNodeArray(te(n)),r.statements)))],!0,[],[],!1,[])}D=!0;var i=e.isSourceFileJS(r)?E.createNodeArray(R(r)):e.visitNodes(r.statements,ne);return E.updateSourceFile(r,te(i),!0,[],[],!1,[])}})),e.mapDefined(r.prepends,(function(t){if(308===t.kind){var r=e.createUnparsedSourceFile(t,"dts",I);return a=a||!!r.hasNoDefaultLib,B(r,y),O(e.map(r.typeReferenceDirectives,(function(e){return [e.fileName,e.resolutionMode]}))),j(r,v),r}return t})));s.syntheticFileReferences=[],s.syntheticTypeReferences=J(),s.syntheticLibReferences=L(),s.hasNoDefaultLib=a;var c=e.getDirectoryPath(e.normalizeSlashes(e.getOutputPathsFor(r,N,!0).declarationFilePath)),f=K(s.syntheticFileReferences,c);return y.forEach(f),s}D=!0,C=!1,k=!1,o=r,m=r,x=b,S=!1,T=!1,d=!1,u=void 0,_=new e.Map,l=void 0,y=B(m,new e.Map),v=j(m,new e.Map);var g,F=[],A=K(F,e.getDirectoryPath(e.normalizeSlashes(e.getOutputPathsFor(r,N,!0).declarationFilePath)));if(e.isSourceFileJS(m))g=E.createNodeArray(R(r)),y.forEach(A),h=e.filter(g,e.isAnyImportSyntax);else {var w=e.visitNodes(r.statements,ne);g=e.setTextRange(E.createNodeArray(te(w)),r.statements),y.forEach(A),h=e.filter(g,e.isAnyImportSyntax),e.isExternalModule(r)&&(!T||C&&!k)&&(g=e.setTextRange(E.createNodeArray(n$4(n$4([],g,!0),[e.createEmptyExports(E)],!1)),g));}var M=E.updateSourceFile(r,g,!0,F,J(),r.hasNoDefaultLib,L());return M.exportedModulesFromDeclarationEmit=p,M;function L(){return e.map(e.arrayFrom(v.keys()),(function(e){return {fileName:e,pos:-1,end:-1}}))}function J(){return l?e.mapDefined(e.arrayFrom(l.keys()),z):[]}function z(t){var r=t[0],n=t[1];if(h)for(var a=0,o=h;a<o.length;a++){var s=o[a];if(e.isImportEqualsDeclaration(s)&&e.isExternalModuleReference(s.moduleReference)){var c=s.moduleReference.expression;if(e.isStringLiteralLike(c)&&c.text===r)return}else if(e.isImportDeclaration(s)&&e.isStringLiteral(s.moduleSpecifier)&&s.moduleSpecifier.text===r)return}return i$1({fileName:r,pos:-1,end:-1},n?{resolutionMode:n}:void 0)}function K(t,n){return function(i){var a;if(i.isDeclarationFile)a=i.fileName;else {if(S&&e.contains(r.sourceFiles,i))return;var o=e.getOutputPathsFor(i,N,!0);a=o.declarationFilePath||o.jsFilePath||i.fileName;}if(a){var s=e.moduleSpecifiers.getModuleSpecifier(P,m,e.toPath(n,N.getCurrentDirectory(),N.getCanonicalFileName),e.toPath(a,N.getCurrentDirectory(),N.getCanonicalFileName),N);if(!e.pathIsRelative(s))return void O([[s,void 0]]);var c=e.getRelativePathToDirectoryOrUrl(n,a,N.getCurrentDirectory(),N.getCanonicalFileName,!1);if(e.startsWith(c,"./")&&e.hasExtension(c)&&(c=c.substring(2)),e.startsWith(c,"node_modules/")||e.pathContainsNodeModules(c))return;t.push({pos:-1,end:-1,fileName:c});}}}};function O(t){if(t){l=l||new e.Set;for(var r=0,n=t;r<n.length;r++){var i=n[r];l.add(i);}}}function M(r){if(0===r.accessibility){if(r&&r.aliasesToMakeVisible)if(u)for(var n=0,i=r.aliasesToMakeVisible;n<i.length;n++){var a=i[n];e.pushIfUnique(u,a);}else u=r.aliasesToMakeVisible;}else {var o=x(r);if(o)return o.typeName?t.addDiagnostic(e.createDiagnosticForNode(r.errorNode||o.errorNode,o.diagnosticMessage,e.getTextOfNode(o.typeName),r.errorSymbolName,r.errorModuleName)):t.addDiagnostic(e.createDiagnosticForNode(r.errorNode||o.errorNode,o.diagnosticMessage,r.errorSymbolName,r.errorModuleName)),!0}return !1}function L(){return f?e.declarationNameToString(f):g&&e.getNameOfDeclaration(g)?e.declarationNameToString(e.getNameOfDeclaration(g)):g&&e.isExportAssignment(g)?g.isExportEquals?"export=":"default":"(Missing)"}function R(t,r){var n=x;x=function(r){return r.errorNode&&e.canProduceDiagnostics(r.errorNode)?e.createGetSymbolAccessibilityDiagnosticForNode(r.errorNode)(r):{diagnosticMessage:r.errorModuleName?e.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit:e.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit,errorNode:r.errorNode||t}};var i=A.getDeclarationStatementsForSourceFile(t,a,F,r);return x=n,i}function B(t,r){return w||!e.isUnparsedSource(t)&&e.isSourceFileJS(t)||e.forEach(t.referencedFiles,(function(n){var i=N.getSourceFileFromReference(t,n);i&&r.set(e.getOriginalNodeId(i),i);})),r}function j(t,r){return e.forEach(t.libReferenceDirectives,(function(t){N.getLibFileFromReference(t)&&r.set(e.toFileNameLowerCase(t.fileName),!0);})),r}function J(t){return 79===t.kind?t:202===t.kind?E.updateArrayBindingPattern(t,e.visitNodes(t.elements,r)):E.updateObjectBindingPattern(t,e.visitNodes(t.elements,r));function r(e){return 227===e.kind?e:E.updateBindingElement(e,e.dotDotDotToken,e.propertyName,J(e.name),K(e)?e.initializer:void 0)}}function z(t,r,n){var i;d||(i=x,x=e.createGetSymbolAccessibilityDiagnosticForNode(t));var a=E.updateParameterDeclaration(t,void 0,function(t,r,n){return e.factory.createModifiersFromModifierFlags(s(t,r,void 0))}(t,r),t.dotDotDotToken,J(t.name),A.isOptionalParameter(t)?t.questionToken||E.createToken(57):void 0,V(t,n||t.type,!0),U(t));return d||(x=i),a}function K(t){return function(t){switch(t.kind){case 167:case 166:return !e.hasEffectiveModifier(t,8);case 164:case 254:return !0}return !1}(t)&&A.isLiteralConstDeclaration(e.getParseTreeNode(t))}function U(t){if(K(t))return A.createLiteralConstValue(e.getParseTreeNode(t),F)}function V(t,r,n){if((n||!e.hasEffectiveModifier(t,8))&&!K(t)){var i,s=164===t.kind&&(A.isRequiredInitializedParameter(t)||A.isOptionalUninitializedParameterProperty(t));return r&&!s?e.visitNode(r,re):e.getParseTreeNode(t)?173===t.kind?E.createKeywordTypeNode(130):(f=t.name,d||(i=x,x=e.createGetSymbolAccessibilityDiagnosticForNode(t)),254===t.kind||203===t.kind?c(A.createTypeOfDeclaration(t,o,a,F)):164===t.kind||167===t.kind||166===t.kind?t.initializer?c(A.createTypeOfDeclaration(t,o,a,F,s)||A.createTypeOfExpression(t.initializer,o,a,F)):c(A.createTypeOfDeclaration(t,o,a,F,s)):c(A.createReturnTypeOfSignatureDeclaration(t,o,a,F))):r?e.visitNode(r,re):E.createKeywordTypeNode(130)}function c(e){return f=void 0,d||(x=i),e||E.createKeywordTypeNode(130)}}function q(t){switch((t=e.getParseTreeNode(t)).kind){case 256:case 261:case 258:case 257:case 259:case 260:return !A.isDeclarationVisible(t);case 254:return !W(t);case 265:case 266:case 272:case 271:return !1;case 170:return !0}return !1}function W(t){return !e.isOmittedExpression(t)&&(e.isBindingPattern(t.name)?e.some(t.name.elements,W):A.isDeclarationVisible(t))}function H(t,r,n){if(!e.hasEffectiveModifier(t,8)){var i=e.map(r,(function(e){return z(e,n)}));if(i)return E.createNodeArray(i,r.hasTrailingComma)}}function G(t,r){var n;if(!r){var i=e.getThisParameter(t);i&&(n=[z(i)]);}if(e.isSetAccessorDeclaration(t)){var a=void 0;if(!r){var o=e.getSetAccessorValueParameter(t);o&&(a=z(o,void 0,ue(t,A.getAllAccessorDeclarations(t))));}a||(a=E.createParameterDeclaration(void 0,void 0,void 0,"value")),n=e.append(n,a);}return E.createNodeArray(n||e.emptyArray)}function Q(t,r){return e.hasEffectiveModifier(t,8)?void 0:e.visitNodes(r,re)}function X(t){return e.isSourceFile(t)||e.isTypeAliasDeclaration(t)||e.isModuleDeclaration(t)||e.isClassDeclaration(t)||e.isInterfaceDeclaration(t)||e.isFunctionLike(t)||e.isIndexSignatureDeclaration(t)||e.isMappedTypeNode(t)}function Y(e,t){M(A.isEntityNameVisible(e,t)),O(A.getTypeReferenceDirectivesForEntityName(e));}function Z(t,r){return e.hasJSDocNodes(t)&&e.hasJSDocNodes(r)&&(t.jsDoc=r.jsDoc),e.setCommentRange(t,e.getCommentRange(r))}function $(r,n){if(n){if(T=T||261!==r.kind&&200!==r.kind,e.isStringLiteralLike(n))if(S){var i=e.getExternalModuleNameFromDeclaration(t.getEmitHost(),A,r);if(i)return E.createStringLiteral(i)}else {var a=A.getSymbolOfExternalModuleSpecifier(n);a&&(p||(p=[])).push(a);}return n}}function ee(r){if(void 0!==e.getResolutionModeOverrideForClause(r))return e.isNightly()||t.addDiagnostic(e.createDiagnosticForNode(r,e.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next)),r}function te(t){for(;e.length(u);){var r=u.shift();if(!e.isLateVisibilityPaintedStatement(r))return e.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: ".concat(e.SyntaxKind?e.SyntaxKind[r.kind]:r.kind));var n=D;D=r.parent&&e.isSourceFile(r.parent)&&!(e.isExternalModule(r.parent)&&S);var i=ae(r);D=n,_.set(e.getOriginalNodeId(r),i);}return e.visitNodes(t,(function(t){if(e.isLateVisibilityPaintedStatement(t)){var r=e.getOriginalNodeId(t);if(_.has(r)){var n=_.get(r);return _.delete(r),n&&((e.isArray(n)?e.some(n,e.needsScopeMarker):e.needsScopeMarker(n))&&(C=!0),e.isSourceFile(t.parent)&&(e.isArray(n)?e.some(n,e.isExternalModuleIndicator):e.isExternalModuleIndicator(n))&&(T=!0)),n}}return t}))}function re(r){if(!se(r)){if(e.isDeclaration(r)){if(q(r))return;if(e.hasDynamicName(r)&&!A.isLateBound(e.getParseTreeNode(r)))return}if(!(e.isFunctionLike(r)&&A.isImplementationOfOverload(r)||e.isSemicolonClassElement(r))){var n;X(r)&&(n=o,o=r);var i=x,a=e.canProduceDiagnostics(r),s=d,c=(182===r.kind||195===r.kind)&&259!==r.parent.kind;if((e.isMethodDeclaration(r)||e.isMethodSignature(r))&&e.hasEffectiveModifier(r,8)){if(r.symbol&&r.symbol.declarations&&r.symbol.declarations[0]!==r)return;return h(E.createPropertyDeclaration(void 0,le(r),r.name,void 0,void 0,void 0))}if(a&&!d&&(x=e.createGetSymbolAccessibilityDiagnosticForNode(r)),e.isTypeQueryNode(r)&&Y(r.exprName,o),c&&(d=!0),function(e){switch(e.kind){case 175:case 171:case 169:case 172:case 173:case 167:case 166:case 168:case 174:case 176:case 254:case 163:case 228:case 178:case 189:case 179:case 180:case 200:return !0}return !1}(r))switch(r.kind){case 228:(e.isEntityName(r.expression)||e.isEntityNameExpression(r.expression))&&Y(r.expression,o);var l=e.visitEachChild(r,re,t);return h(E.updateExpressionWithTypeArguments(l,l.expression,l.typeArguments));case 178:return Y(r.typeName,o),l=e.visitEachChild(r,re,t),h(E.updateTypeReferenceNode(l,l.typeName,l.typeArguments));case 175:return h(E.updateConstructSignature(r,Q(r,r.typeParameters),H(r,r.parameters),V(r,r.type)));case 171:return h(E.createConstructorDeclaration(void 0,le(r),H(r,r.parameters,0),void 0));case 169:return e.isPrivateIdentifier(r.name)?h(void 0):h(E.createMethodDeclaration(void 0,le(r),void 0,r.name,r.questionToken,Q(r,r.typeParameters),H(r,r.parameters),V(r,r.type),void 0));case 172:if(e.isPrivateIdentifier(r.name))return h(void 0);var u=ue(r,A.getAllAccessorDeclarations(r));return h(E.updateGetAccessorDeclaration(r,void 0,le(r),r.name,G(r,e.hasEffectiveModifier(r,8)),V(r,u),void 0));case 173:return e.isPrivateIdentifier(r.name)?h(void 0):h(E.updateSetAccessorDeclaration(r,void 0,le(r),r.name,G(r,e.hasEffectiveModifier(r,8)),void 0));case 167:return e.isPrivateIdentifier(r.name)?h(void 0):h(E.updatePropertyDeclaration(r,void 0,le(r),r.name,r.questionToken,V(r,r.type),U(r)));case 166:return e.isPrivateIdentifier(r.name)?h(void 0):h(E.updatePropertySignature(r,le(r),r.name,r.questionToken,V(r,r.type)));case 168:return e.isPrivateIdentifier(r.name)?h(void 0):h(E.updateMethodSignature(r,le(r),r.name,r.questionToken,Q(r,r.typeParameters),H(r,r.parameters),V(r,r.type)));case 174:return h(E.updateCallSignature(r,Q(r,r.typeParameters),H(r,r.parameters),V(r,r.type)));case 176:return h(E.updateIndexSignature(r,void 0,le(r),H(r,r.parameters),e.visitNode(r.type,re)||E.createKeywordTypeNode(130)));case 254:return e.isBindingPattern(r.name)?oe(r.name):(c=!0,d=!0,h(E.updateVariableDeclaration(r,r.name,void 0,V(r,r.type),U(r))));case 163:return function(t){return 169===t.parent.kind&&e.hasEffectiveModifier(t.parent,8)}(r)&&(r.default||r.constraint)?h(E.updateTypeParameterDeclaration(r,r.modifiers,r.name,void 0,void 0)):h(e.visitEachChild(r,re,t));case 189:var _=e.visitNode(r.checkType,re),p=e.visitNode(r.extendsType,re),g=o;o=r.trueType;var y=e.visitNode(r.trueType,re);o=g;var v=e.visitNode(r.falseType,re);return h(E.updateConditionalTypeNode(r,_,p,y,v));case 179:return h(E.updateFunctionTypeNode(r,e.visitNodes(r.typeParameters,re),H(r,r.parameters),e.visitNode(r.type,re)));case 180:return h(E.updateConstructorTypeNode(r,le(r),e.visitNodes(r.typeParameters,re),H(r,r.parameters),e.visitNode(r.type,re)));case 200:return e.isLiteralImportTypeNode(r)?h(E.updateImportTypeNode(r,E.updateLiteralTypeNode(r.argument,$(r,r.argument.literal)),r.assertions,r.qualifier,e.visitNodes(r.typeArguments,re,e.isTypeNode),r.isTypeOf)):h(r);default:e.Debug.assertNever(r,"Attempted to process unhandled node kind: ".concat(e.SyntaxKind[r.kind]));}return e.isTupleTypeNode(r)&&e.getLineAndCharacterOfPosition(m,r.pos).line===e.getLineAndCharacterOfPosition(m,r.end).line&&e.setEmitFlags(r,1),h(e.visitEachChild(r,re,t))}}function h(t){return t&&a&&e.hasDynamicName(r)&&function(t){var r;d||(r=x,x=e.createGetSymbolAccessibilityDiagnosticForNodeName(t)),f=t.name,e.Debug.assert(A.isLateBound(e.getParseTreeNode(t))),Y(t.name.expression,o),d||(x=r),f=void 0;}(r),X(r)&&(o=n),a&&!d&&(x=i),c&&(d=s),t===r?t:t&&e.setOriginalNode(Z(t,r),r)}}function ne(t){if(function(e){switch(e.kind){case 256:case 261:case 265:case 258:case 257:case 259:case 260:case 237:case 266:case 272:case 271:return !0}return !1}(t)&&!se(t)){switch(t.kind){case 272:return e.isSourceFile(t.parent)&&(T=!0),k=!0,E.updateExportDeclaration(t,void 0,t.modifiers,t.isTypeOnly,t.exportClause,$(t,t.moduleSpecifier),e.getResolutionModeOverrideForClause(t.assertClause)?t.assertClause:void 0);case 271:if(e.isSourceFile(t.parent)&&(T=!0),k=!0,79===t.expression.kind)return t;var r=E.createUniqueName("_default",16);x=function(){return {diagnosticMessage:e.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,errorNode:t}},g=t;var n=E.createVariableDeclaration(r,void 0,A.createTypeOfExpression(t.expression,t,a,F),void 0);g=void 0;var i=E.createVariableStatement(D?[E.createModifier(135)]:[],E.createVariableDeclarationList([n],2));return Z(i,t),e.removeAllComments(t),[i,E.updateExportAssignment(t,t.decorators,t.modifiers,r)]}var o=ae(t);return _.set(e.getOriginalNodeId(t),o),t}}function ie(t){if(e.isImportEqualsDeclaration(t)||e.hasEffectiveModifier(t,512)||!e.canHaveModifiers(t))return t;var r=E.createModifiersFromModifierFlags(125950&e.getEffectiveModifierFlags(t));return E.updateModifiers(t,r)}function ae(t){if(u)for(;e.orderedRemoveItem(u,t););if(!se(t)){switch(t.kind){case 265:return function(t){if(A.isDeclarationVisible(t)){if(277===t.moduleReference.kind){var r=e.getExternalModuleImportEqualsDeclarationExpression(t);return E.updateImportEqualsDeclaration(t,void 0,t.modifiers,t.isTypeOnly,t.name,E.updateExternalModuleReference(t.moduleReference,$(t,r)))}var n=x;return x=e.createGetSymbolAccessibilityDiagnosticForNode(t),Y(t.moduleReference,o),x=n,t}}(t);case 266:return function(t){if(!t.importClause)return E.updateImportDeclaration(t,void 0,t.modifiers,t.importClause,$(t,t.moduleSpecifier),ee(t.assertClause));var r=t.importClause&&t.importClause.name&&A.isDeclarationVisible(t.importClause)?t.importClause.name:void 0;if(!t.importClause.namedBindings)return r&&E.updateImportDeclaration(t,void 0,t.modifiers,E.updateImportClause(t.importClause,t.importClause.isTypeOnly,r,void 0),$(t,t.moduleSpecifier),ee(t.assertClause));if(268===t.importClause.namedBindings.kind){var n=A.isDeclarationVisible(t.importClause.namedBindings)?t.importClause.namedBindings:void 0;return r||n?E.updateImportDeclaration(t,void 0,t.modifiers,E.updateImportClause(t.importClause,t.importClause.isTypeOnly,r,n),$(t,t.moduleSpecifier),ee(t.assertClause)):void 0}var i=e.mapDefined(t.importClause.namedBindings.elements,(function(e){return A.isDeclarationVisible(e)?e:void 0}));return i&&i.length||r?E.updateImportDeclaration(t,void 0,t.modifiers,E.updateImportClause(t.importClause,t.importClause.isTypeOnly,r,i&&i.length?E.updateNamedImports(t.importClause.namedBindings,i):void 0),$(t,t.moduleSpecifier),ee(t.assertClause)):A.isImportRequiredByAugmentation(t)?E.updateImportDeclaration(t,void 0,t.modifiers,void 0,$(t,t.moduleSpecifier),ee(t.assertClause)):void 0}(t)}if(!(e.isDeclaration(t)&&q(t)||e.isFunctionLike(t)&&A.isImplementationOfOverload(t))){var r;X(t)&&(r=o,o=t);var i=e.canProduceDiagnostics(t),s=x;i&&(x=e.createGetSymbolAccessibilityDiagnosticForNode(t));var c=D;switch(t.kind){case 259:return ye(E.updateTypeAliasDeclaration(t,void 0,le(t),t.name,e.visitNodes(t.typeParameters,re,e.isTypeParameterDeclaration),e.visitNode(t.type,re,e.isTypeNode)));case 258:return ye(E.updateInterfaceDeclaration(t,void 0,le(t),t.name,Q(t,t.typeParameters),_e(t.heritageClauses),e.visitNodes(t.members,re)));case 256:var l=ye(E.updateFunctionDeclaration(t,void 0,le(t),void 0,t.name,Q(t,t.typeParameters),H(t,t.parameters),V(t,t.type),void 0));if(l&&A.isExpandoFunctionDeclaration(t)&&function(t){var r;if(t.body)return !0;var n=null===(r=t.symbol.declarations)||void 0===r?void 0:r.filter((function(t){return e.isFunctionDeclaration(t)&&!t.body}));return !n||n.indexOf(t)===n.length-1}(t)){var d=A.getPropertiesOfContainerFunction(t),p=e.parseNodeFactory.createModuleDeclaration(void 0,void 0,l.name||E.createIdentifier("_default"),E.createModuleBlock([]),16);e.setParent(p,o),p.locals=e.createSymbolTable(d),p.symbol=d[0].parent;var m=[],y=e.mapDefined(d,(function(t){if(t.valueDeclaration&&e.isPropertyAccessExpression(t.valueDeclaration)){x=e.createGetSymbolAccessibilityDiagnosticForNode(t.valueDeclaration);var r=A.createTypeOfDeclaration(t.valueDeclaration,p,a,F);x=s;var n=e.unescapeLeadingUnderscores(t.escapedName),i=e.isStringANonContextualKeyword(n),o=i?E.getGeneratedNameForNode(t.valueDeclaration):E.createIdentifier(n);i&&m.push([o,n]);var c=E.createVariableDeclaration(o,void 0,r,void 0);return E.createVariableStatement(i?void 0:[E.createToken(93)],E.createVariableDeclarationList([c]))}}));m.length?y.push(E.createExportDeclaration(void 0,void 0,!1,E.createNamedExports(e.map(m,(function(e){var t=e[0],r=e[1];return E.createExportSpecifier(!1,t,r)}))))):y=e.mapDefined(y,(function(e){return E.updateModifiers(e,0)}));var v=E.createModuleDeclaration(void 0,le(t),t.name,E.createModuleBlock(y),16);if(!e.hasEffectiveModifier(l,512))return [l,v];var h=E.createModifiersFromModifierFlags(-514&e.getEffectiveModifierFlags(l)|2),b=E.updateFunctionDeclaration(l,void 0,h,void 0,l.name,l.typeParameters,l.parameters,l.type,void 0),S=E.updateModuleDeclaration(v,void 0,h,v.name,v.body),N=E.createExportAssignment(void 0,void 0,!1,v.name);return e.isSourceFile(t.parent)&&(T=!0),k=!0,[b,S,N]}return l;case 261:D=!1;var P=t.body;if(P&&262===P.kind){var w=C,I=k;k=!1,C=!1;var O=te(e.visitNodes(P.statements,ne));16777216&t.flags&&(C=!1),e.isGlobalScopeAugmentation(t)||(me=O,e.some(me,ce))||k||(O=C?E.createNodeArray(n$4(n$4([],O,!0),[e.createEmptyExports(E)],!1)):e.visitNodes(O,ie));var M=E.updateModuleBlock(P,O);D=c,C=w,k=I;var L=le(t);return ye(E.updateModuleDeclaration(t,void 0,L,e.isExternalModuleAugmentation(t)?$(t,t.name):t.name,M))}D=c,L=le(t),D=!1,e.visitNode(P,ne);var R=e.getOriginalNodeId(P);return M=_.get(R),_.delete(R),ye(E.updateModuleDeclaration(t,void 0,L,t.name,M));case 257:f=t.name,g=t,h=E.createNodeArray(le(t));var B=Q(t,t.typeParameters),j=e.getFirstConstructorWithBody(t),J=void 0;if(j){var z=x;J=e.compact(e.flatMap(j.parameters,(function(t){if(e.hasSyntacticModifier(t,16476)&&!se(t))return x=e.createGetSymbolAccessibilityDiagnosticForNode(t),79===t.name.kind?Z(E.createPropertyDeclaration(void 0,le(t),t.name,t.questionToken,V(t,t.type),U(t)),t):function r(n){for(var i,a=0,o=n.elements;a<o.length;a++){var s=o[a];e.isOmittedExpression(s)||(e.isBindingPattern(s.name)&&(i=e.concatenate(i,r(s.name))),(i=i||[]).push(E.createPropertyDeclaration(void 0,le(t),s.name,void 0,V(s,void 0),void 0)));}return i}(t.name)}))),x=z;}var K=e.some(t.members,(function(t){return !!t.name&&e.isPrivateIdentifier(t.name)}))?[E.createPropertyDeclaration(void 0,void 0,E.createPrivateIdentifier("#private"),void 0,void 0,void 0)]:void 0,G=e.concatenate(e.concatenate(K,J),e.visitNodes(t.members,re)),ae=E.createNodeArray(G),oe=e.getEffectiveBaseTypeNode(t);if(oe&&!e.isEntityNameExpression(oe.expression)&&104!==oe.expression.kind){var ue=t.name?e.unescapeLeadingUnderscores(t.name.escapedText):"default",de=E.createUniqueName("".concat(ue,"_base"),16);x=function(){return {diagnosticMessage:e.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1,errorNode:oe,typeName:t.name}};var pe=E.createVariableDeclaration(de,void 0,A.createTypeOfExpression(oe.expression,t,a,F),void 0),fe=E.createVariableStatement(D?[E.createModifier(135)]:[],E.createVariableDeclarationList([pe],2)),ge=E.createNodeArray(e.map(t.heritageClauses,(function(t){if(94===t.token){var r=x;x=e.createGetSymbolAccessibilityDiagnosticForNode(t.types[0]);var n=E.updateHeritageClause(t,e.map(t.types,(function(t){return E.updateExpressionWithTypeArguments(t,de,e.visitNodes(t.typeArguments,re))})));return x=r,n}return E.updateHeritageClause(t,e.visitNodes(E.createNodeArray(e.filter(t.types,(function(t){return e.isEntityNameExpression(t.expression)||104===t.expression.kind}))),re))})));return [fe,ye(E.updateClassDeclaration(t,void 0,h,t.name,B,ge,ae))]}return ge=_e(t.heritageClauses),ye(E.updateClassDeclaration(t,void 0,h,t.name,B,ge,ae));case 237:return ye(function(t){if(e.forEach(t.declarationList.declarations,W)){var r=e.visitNodes(t.declarationList.declarations,re);if(e.length(r))return E.updateVariableStatement(t,E.createNodeArray(le(t)),E.updateVariableDeclarationList(t.declarationList,r))}}(t));case 260:return ye(E.updateEnumDeclaration(t,void 0,E.createNodeArray(le(t)),t.name,E.createNodeArray(e.mapDefined(t.members,(function(e){if(!se(e)){var t=A.getConstantValue(e);return Z(E.updateEnumMember(e,e.name,void 0!==t?"string"==typeof t?E.createStringLiteral(t):E.createNumericLiteral(t):void 0),e)}})))))}return e.Debug.assertNever(t,"Unhandled top-level node in declaration emit: ".concat(e.SyntaxKind[t.kind]))}}var me;function ye(n){return X(t)&&(o=r),i&&(x=s),261===t.kind&&(D=c),n===t?n:(g=void 0,f=void 0,n&&e.setOriginalNode(Z(n,t),t))}}function oe(t){return e.flatten(e.mapDefined(t.elements,(function(t){return function(t){if(227!==t.kind&&t.name){if(!W(t))return;return e.isBindingPattern(t.name)?oe(t.name):E.createVariableDeclaration(t.name,void 0,V(t,void 0),void 0)}}(t)})))}function se(e){return !!I&&!!e&&r(e,m)}function ce(t){return e.isExportAssignment(t)||e.isExportDeclaration(t)}function le(t){var r=e.getEffectiveModifierFlags(t),n=function(t){var r=109307,n=D&&!function(e){return 258===e.kind}(t)?2:0,i=305===t.parent.kind;return (!i||S&&i&&e.isExternalModule(t.parent))&&(r^=2,n=0),s(t,r,n)}(t);return r===n?t.modifiers:E.createModifiersFromModifierFlags(n)}function ue(t,r){var n=c(t);return n||t===r.firstAccessor||(n=c(r.firstAccessor),x=e.createGetSymbolAccessibilityDiagnosticForNode(r.firstAccessor)),!n&&r.secondAccessor&&t!==r.secondAccessor&&(n=c(r.secondAccessor),x=e.createGetSymbolAccessibilityDiagnosticForNode(r.secondAccessor)),n}function _e(t){return E.createNodeArray(e.filter(e.map(t,(function(t){return E.updateHeritageClause(t,e.visitNodes(E.createNodeArray(e.filter(t.types,(function(r){return e.isEntityNameExpression(r.expression)||94===t.token&&104===r.expression.kind}))),re))})),(function(e){return e.types&&!!e.types.length})))}}function s(t,r,n){void 0===r&&(r=125947),void 0===n&&(n=0);var i=e.getEffectiveModifierFlags(t)&r|n;return 512&i&&!(1&i)&&(i^=1),512&i&&2&i&&(i^=2),i}function c(e){if(e)return 172===e.kind?e.type:e.parameters.length>0?e.parameters[0].type:void 0}e.transformDeclarations=o;}(t),function(e){var t,r;function i(t,r,n){if(n)return e.emptyArray;var i=e.getEmitScriptTarget(t),a=e.getEmitModuleKind(t),o=[];return e.addRange(o,r&&e.map(r.before,s)),o.push(e.transformTypeScript),o.push(e.transformClassFields),e.getJSXTransformEnabled(t)&&o.push(e.transformJsx),i<99&&o.push(e.transformESNext),i<8&&o.push(e.transformES2021),i<7&&o.push(e.transformES2020),i<6&&o.push(e.transformES2019),i<5&&o.push(e.transformES2018),i<4&&o.push(e.transformES2017),i<3&&o.push(e.transformES2016),i<2&&(o.push(e.transformES2015),o.push(e.transformGenerators)),o.push(function(t){switch(t){case e.ModuleKind.ESNext:case e.ModuleKind.ES2022:case e.ModuleKind.ES2020:case e.ModuleKind.ES2015:return e.transformECMAScriptModule;case e.ModuleKind.System:return e.transformSystemModule;case e.ModuleKind.Node16:case e.ModuleKind.NodeNext:return e.transformNodeModule;default:return e.transformModule}}(a)),i<1&&o.push(e.transformES5),e.addRange(o,r&&e.map(r.after,s)),o}function a(t){var r=[];return r.push(e.transformDeclarations),e.addRange(r,t&&e.map(t.afterDeclarations,c)),r}function o(t,r){return function(n){var i=t(n);return "function"==typeof i?r(n,i):function(t){return function(r){return e.isBundle(r)?t.transformBundle(r):t.transformSourceFile(r)}}(i)}}function s(t){return o(t,e.chainBundle)}function c(e){return o(e,(function(e,t){return t}))}function l(e,t){return t}function u(e,t,r){r(e,t);}!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Completed=2]="Completed",e[e.Disposed=3]="Disposed";}(t||(t={})),function(e){e[e.Substitution=1]="Substitution",e[e.EmitNotifications=2]="EmitNotifications";}(r||(r={})),e.noTransformers={scriptTransformers:e.emptyArray,declarationTransformers:e.emptyArray},e.getTransformers=function(e,t,r){return {scriptTransformers:i(e,t,r),declarationTransformers:a(t)}},e.noEmitSubstitution=l,e.noEmitNotification=u,e.transformNodes=function(t,r,i,a,o,s,c){for(var _,d,p,f,g,m=new Array(355),y=0,v=[],h=[],b=[],x=[],D=0,S=!1,T=[],C=0,k=l,E=u,N=0,F=[],A={factory:i,getCompilerOptions:function(){return a},getEmitResolver:function(){return t},getEmitHost:function(){return r},getEmitHelperFactory:e.memoize((function(){return e.createEmitHelperFactory(A)})),startLexicalEnvironment:function(){e.Debug.assert(N>0,"Cannot modify the lexical environment during initialization."),e.Debug.assert(N<2,"Cannot modify the lexical environment after transformation has completed."),e.Debug.assert(!S,"Lexical environment is suspended."),v[D]=_,h[D]=d,b[D]=p,x[D]=y,D++,_=void 0,d=void 0,p=void 0,y=0;},suspendLexicalEnvironment:function(){e.Debug.assert(N>0,"Cannot modify the lexical environment during initialization."),e.Debug.assert(N<2,"Cannot modify the lexical environment after transformation has completed."),e.Debug.assert(!S,"Lexical environment is already suspended."),S=!0;},resumeLexicalEnvironment:function(){e.Debug.assert(N>0,"Cannot modify the lexical environment during initialization."),e.Debug.assert(N<2,"Cannot modify the lexical environment after transformation has completed."),e.Debug.assert(S,"Lexical environment is not suspended."),S=!1;},endLexicalEnvironment:function(){var t;if(e.Debug.assert(N>0,"Cannot modify the lexical environment during initialization."),e.Debug.assert(N<2,"Cannot modify the lexical environment after transformation has completed."),e.Debug.assert(!S,"Lexical environment is suspended."),_||d||p){if(d&&(t=n$4([],d,!0)),_){var r=i.createVariableStatement(void 0,i.createVariableDeclarationList(_));e.setEmitFlags(r,1048576),t?t.push(r):t=[r];}p&&(t=n$4(t?n$4([],t,!0):[],p,!0));}return D--,_=v[D],d=h[D],p=b[D],y=x[D],0===D&&(v=[],h=[],b=[],x=[]),t},setLexicalEnvironmentFlags:function(e,t){y=t?y|e:y&~e;},getLexicalEnvironmentFlags:function(){return y},hoistVariableDeclaration:function(t){e.Debug.assert(N>0,"Cannot modify the lexical environment during initialization."),e.Debug.assert(N<2,"Cannot modify the lexical environment after transformation has completed.");var r=e.setEmitFlags(i.createVariableDeclaration(t),64);_?_.push(r):_=[r],1&y&&(y|=2);},hoistFunctionDeclaration:function(t){e.Debug.assert(N>0,"Cannot modify the lexical environment during initialization."),e.Debug.assert(N<2,"Cannot modify the lexical environment after transformation has completed."),e.setEmitFlags(t,1048576),d?d.push(t):d=[t];},addInitializationStatement:function(t){e.Debug.assert(N>0,"Cannot modify the lexical environment during initialization."),e.Debug.assert(N<2,"Cannot modify the lexical environment after transformation has completed."),e.setEmitFlags(t,1048576),p?p.push(t):p=[t];},startBlockScope:function(){e.Debug.assert(N>0,"Cannot start a block scope during initialization."),e.Debug.assert(N<2,"Cannot start a block scope after transformation has completed."),T[C]=f,C++,f=void 0;},endBlockScope:function(){e.Debug.assert(N>0,"Cannot end a block scope during initialization."),e.Debug.assert(N<2,"Cannot end a block scope after transformation has completed.");var t=e.some(f)?[i.createVariableStatement(void 0,i.createVariableDeclarationList(f.map((function(e){return i.createVariableDeclaration(e)})),1))]:void 0;return C--,f=T[C],0===C&&(T=[]),t},addBlockScopedVariable:function(t){e.Debug.assert(C>0,"Cannot add a block scoped variable outside of an iteration body."),(f||(f=[])).push(t);},requestEmitHelper:function t(r){if(e.Debug.assert(N>0,"Cannot modify the transformation context during initialization."),e.Debug.assert(N<2,"Cannot modify the transformation context after transformation has completed."),e.Debug.assert(!r.scoped,"Cannot request a scoped emit helper."),r.dependencies)for(var n=0,i=r.dependencies;n<i.length;n++){t(i[n]);}g=e.append(g,r);},readEmitHelpers:function(){e.Debug.assert(N>0,"Cannot modify the transformation context during initialization."),e.Debug.assert(N<2,"Cannot modify the transformation context after transformation has completed.");var t=g;return g=void 0,t},enableSubstitution:function(t){e.Debug.assert(N<2,"Cannot modify the transformation context after transformation has completed."),m[t]|=1;},enableEmitNotification:function(t){e.Debug.assert(N<2,"Cannot modify the transformation context after transformation has completed."),m[t]|=2;},isSubstitutionEnabled:J,isEmitNotificationEnabled:z,get onSubstituteNode(){return k},set onSubstituteNode(t){e.Debug.assert(N<1,"Cannot modify transformation hooks after initialization has completed."),e.Debug.assert(void 0!==t,"Value must not be 'undefined'"),k=t;},get onEmitNode(){return E},set onEmitNode(t){e.Debug.assert(N<1,"Cannot modify transformation hooks after initialization has completed."),e.Debug.assert(void 0!==t,"Value must not be 'undefined'"),E=t;},addDiagnostic:function(e){F.push(e);}},P=0,w=o;P<w.length;P++){var I=w[P];e.disposeEmitNodes(e.getSourceFileOfNode(e.getParseTreeNode(I)));}e.performance.mark("beforeTransform");var O=s.map((function(e){return e(A)})),M=function(e){for(var t=0,r=O;t<r.length;t++)e=(0, r[t])(e);return e};N=1;for(var L=[],R=0,B=o;R<B.length;R++)I=B[R],null===e.tracing||void 0===e.tracing||e.tracing.push("emit","transformNodes",305===I.kind?{path:I.path}:{kind:I.kind,pos:I.pos,end:I.end}),L.push((c?M:j)(I)),null===e.tracing||void 0===e.tracing||e.tracing.pop();return N=2,e.performance.mark("afterTransform"),e.performance.measure("transformTime","beforeTransform","afterTransform"),{transformed:L,substituteNode:function(t,r){return e.Debug.assert(N<3,"Cannot substitute a node after the result is disposed."),r&&J(r)&&k(t,r)||r},emitNodeWithNotification:function(t,r,n){e.Debug.assert(N<3,"Cannot invoke TransformationResult callbacks after the result is disposed."),r&&(z(r)?E(t,r,n):n(t,r));},isEmitNotificationEnabled:z,dispose:function(){if(N<3){for(var t=0,r=o;t<r.length;t++){var n=r[t];e.disposeEmitNodes(e.getSourceFileOfNode(e.getParseTreeNode(n)));}_=void 0,v=void 0,d=void 0,h=void 0,k=void 0,E=void 0,g=void 0,N=3;}},diagnostics:F};function j(t){return !t||e.isSourceFile(t)&&t.isDeclarationFile?t:M(t)}function J(t){return 0!=(1&m[t.kind])&&0==(4&e.getEmitFlags(t))}function z(t){return 0!=(2&m[t.kind])||0!=(2&e.getEmitFlags(t))}},e.nullTransformationContext={factory:e.factory,getCompilerOptions:function(){return {}},getEmitResolver:e.notImplemented,getEmitHost:e.notImplemented,getEmitHelperFactory:e.notImplemented,startLexicalEnvironment:e.noop,resumeLexicalEnvironment:e.noop,suspendLexicalEnvironment:e.noop,endLexicalEnvironment:e.returnUndefined,setLexicalEnvironmentFlags:e.noop,getLexicalEnvironmentFlags:function(){return 0},hoistVariableDeclaration:e.noop,hoistFunctionDeclaration:e.noop,addInitializationStatement:e.noop,startBlockScope:e.noop,endBlockScope:e.returnUndefined,addBlockScopedVariable:e.noop,requestEmitHelper:e.noop,readEmitHelpers:e.notImplemented,enableSubstitution:e.noop,enableEmitNotification:e.noop,isSubstitutionEnabled:e.notImplemented,isEmitNotificationEnabled:e.notImplemented,onSubstituteNode:l,onEmitNode:u,addDiagnostic:e.noop};}(t),function(e){var t,r,i=function(){var e=[];return e[1024]=["{","}"],e[2048]=["(",")"],e[4096]=["<",">"],e[8192]=["[","]"],e}();function a(t,r,n,i,a,s){void 0===i&&(i=!1);var l=e.isArray(n)?n:e.getSourceFilesToEmit(t,n,i),u=t.getCompilerOptions();if(e.outFile(u)){var _=t.getPrependNodes();if(l.length||_.length){var d=e.factory.createBundle(l,_);if(g=r(c(d,t,i),d))return g}}else {if(!a)for(var p=0,f=l;p<f.length;p++){var g,m=f[p];if(g=r(c(m,t,i),m))return g}if(s){var y=o(u);if(y)return r({buildInfoPath:y},void 0)}}}function o(t){var r=t.configFilePath;if(e.isIncrementalCompilation(t)){if(t.tsBuildInfoFile)return t.tsBuildInfoFile;var n,i=e.outFile(t);if(i)n=e.removeFileExtension(i);else {if(!r)return;var a=e.removeFileExtension(r);n=t.outDir?t.rootDir?e.resolvePath(t.outDir,e.getRelativePathFromDirectory(t.rootDir,a,!0)):e.combinePaths(t.outDir,e.getBaseFileName(a)):a;}return n+".tsbuildinfo"}}function s(t,r){var n=e.outFile(t),i=t.emitDeclarationOnly?void 0:n,a=i&&l(i,t),s=r||e.getEmitDeclarations(t)?e.removeFileExtension(n)+".d.ts":void 0;return {jsFilePath:i,sourceMapFilePath:a,declarationFilePath:s,declarationMapPath:s&&e.getAreDeclarationMapsEnabled(t)?s+".map":void 0,buildInfoPath:o(t)}}function c(t,r,n){var i=r.getCompilerOptions();if(306===t.kind)return s(i,n);var a=e.getOwnEmitOutputFilePath(t.fileName,r,u(t.fileName,i)),o=e.isJsonSourceFile(t),c=o&&0===e.comparePaths(t.fileName,a,r.getCurrentDirectory(),!r.useCaseSensitiveFileNames()),_=i.emitDeclarationOnly||c?void 0:a,d=!_||e.isJsonSourceFile(t)?void 0:l(_,i),p=n||e.getEmitDeclarations(i)&&!o?e.getDeclarationEmitOutputFilePath(t.fileName,r):void 0;return {jsFilePath:_,sourceMapFilePath:d,declarationFilePath:p,declarationMapPath:p&&e.getAreDeclarationMapsEnabled(i)?p+".map":void 0,buildInfoPath:void 0}}function l(e,t){return t.sourceMap&&!t.inlineSourceMap?e+".map":void 0}function u(t,r){return e.fileExtensionIs(t,".json")?".json":1===r.jsx&&e.fileExtensionIsOneOf(t,[".jsx",".tsx"])?".jsx":e.fileExtensionIsOneOf(t,[".mts",".mjs"])?".mjs":e.fileExtensionIsOneOf(t,[".cts",".cjs"])?".cjs":".js"}function _(t,r,n,i,a){return i?e.resolvePath(i,e.getRelativePathFromDirectory(a?a():v(r,n),t,n)):t}function d(t,r,n,i){return e.changeExtension(_(t,r,n,r.options.declarationDir||r.options.outDir,i),e.getDeclarationEmitExtensionForPath(t))}function p(t,r,n,i){if(!r.options.emitDeclarationOnly){var a=e.fileExtensionIs(t,".json"),o=e.changeExtension(_(t,r,n,r.options.outDir,i),u(t,r.options));return a&&0===e.comparePaths(t,o,e.Debug.checkDefined(r.options.configFilePath),n)?void 0:o}}function f(){var t;return {addOutput:function(e){e&&(t||(t=[])).push(e);},getOutputs:function(){return t||e.emptyArray}}}function g(e,t){var r=s(e.options,!1),n=r.jsFilePath,i=r.sourceMapFilePath,a=r.declarationFilePath,o=r.declarationMapPath,c=r.buildInfoPath;t(n),t(i),t(a),t(o),t(c);}function m(t,r,n,i,a){if(!e.isDeclarationFileName(r)){var o=p(r,t,n,a);if(i(o),!e.fileExtensionIs(r,".json")&&(o&&t.options.sourceMap&&i("".concat(o,".map")),e.getEmitDeclarations(t.options))){var s=d(r,t,n,a);i(s),t.options.declarationMap&&i("".concat(s,".map"));}}}function y(t,r,n,i,a){var o;return t.rootDir?(o=e.getNormalizedAbsolutePath(t.rootDir,n),null==a||a(t.rootDir)):t.composite&&t.configFilePath?(o=e.getDirectoryPath(e.normalizeSlashes(t.configFilePath)),null==a||a(o)):o=e.computeCommonSourceDirectoryOfFilenames(r(),n,i),o&&o[o.length-1]!==e.directorySeparator&&(o+=e.directorySeparator),o}function v(t,r){var n=t.options,i=t.fileNames;return y(n,(function(){return e.filter(i,(function(t){return !(n.noEmitForJsFiles&&e.fileExtensionIsOneOf(t,e.supportedJSExtensionsFlat)||e.isDeclarationFileName(t))}))}),e.getDirectoryPath(e.normalizeSlashes(e.Debug.checkDefined(n.configFilePath))),e.createGetCanonicalFileName(!r))}function h(t,r,n,i,o,s,c){var l,u,_=i.scriptTransformers,d=i.declarationTransformers,p=r.getCompilerOptions(),f=p.sourceMap||p.inlineSourceMap||e.getAreDeclarationMapsEnabled(p)?[]:void 0,g=p.listEmittedFiles?[]:void 0,m=e.createDiagnosticCollection(),y=e.getNewLineCharacter(p,(function(){return r.getNewLine()})),v=e.createTextWriter(y),h=e.performance.createTimer("printTime","beforePrint","afterPrint"),x=h.enter,S=h.exit,T=!1;return x(),a(r,(function(i,a){var s,f=i.jsFilePath,y=i.sourceMapFilePath,v=i.declarationFilePath,h=i.declarationMapPath,x=i.buildInfoPath;function S(t){return e.ensurePathIsNonModuleName(e.getRelativePathFromDirectory(s,t,r.getCanonicalFileName))}x&&a&&e.isBundle(a)&&(s=e.getDirectoryPath(e.getNormalizedAbsolutePath(x,r.getCurrentDirectory())),l={commonSourceDirectory:S(r.getCommonSourceDirectory()),sourceFiles:a.sourceFiles.map((function(t){return S(e.getNormalizedAbsolutePath(t.fileName,r.getCurrentDirectory()))}))}),null===e.tracing||void 0===e.tracing||e.tracing.push("emit","emitJsFileOrBundle",{jsFilePath:f}),function(n,i,a,s){if(n&&!o&&i)if(i&&r.isEmitBlocked(i)||p.noEmit)T=!0;else {var c=e.transformNodes(t,r,e.factory,p,[n],_,!1),u=D({removeComments:p.removeComments,newLine:p.newLine,noEmitHelpers:p.noEmitHelpers,module:p.module,target:p.target,sourceMap:p.sourceMap,inlineSourceMap:p.inlineSourceMap,inlineSources:p.inlineSources,extendedDiagnostics:p.extendedDiagnostics,writeBundleFileInfo:!!l,relativeToBuildInfo:s},{hasGlobalName:t.hasGlobalName,onEmitNode:c.emitNodeWithNotification,isEmitNotificationEnabled:c.isEmitNotificationEnabled,substituteNode:c.substituteNode});e.Debug.assert(1===c.transformed.length,"Should only see one output from the transform"),k(i,a,c.transformed[0],u,p),c.dispose(),l&&(l.js=u.bundleFileInfo);}}(a,f,y,S),null===e.tracing||void 0===e.tracing||e.tracing.pop(),null===e.tracing||void 0===e.tracing||e.tracing.push("emit","emitDeclarationFileOrBundle",{declarationFilePath:v}),function(n,i,a,s){if(n)if(i){var _=e.isSourceFile(n)?[n]:n.sourceFiles,f=c?_:e.filter(_,e.isSourceFileNotJson),g=e.outFile(p)?[e.factory.createBundle(f,e.isSourceFile(n)?void 0:n.prepends)]:f;o&&!e.getEmitDeclarations(p)&&f.forEach(C);var y=e.transformNodes(t,r,e.factory,p,g,d,!1);if(e.length(y.diagnostics))for(var v=0,h=y.diagnostics;v<h.length;v++){var b=h[v];m.add(b);}var x=D({removeComments:p.removeComments,newLine:p.newLine,noEmitHelpers:!0,module:p.module,target:p.target,sourceMap:p.sourceMap,inlineSourceMap:p.inlineSourceMap,extendedDiagnostics:p.extendedDiagnostics,onlyPrintJsDocStyle:!0,writeBundleFileInfo:!!l,recordInternalSection:!!l,relativeToBuildInfo:s},{hasGlobalName:t.hasGlobalName,onEmitNode:y.emitNodeWithNotification,isEmitNotificationEnabled:y.isEmitNotificationEnabled,substituteNode:y.substituteNode}),S=!!y.diagnostics&&!!y.diagnostics.length||!!r.isEmitBlocked(i)||!!p.noEmit;if(T=T||S,(!S||c)&&(e.Debug.assert(1===y.transformed.length,"Should only see one output from the decl transform"),k(i,a,y.transformed[0],x,{sourceMap:!c&&p.declarationMap,sourceRoot:p.sourceRoot,mapRoot:p.mapRoot,extendedDiagnostics:p.extendedDiagnostics}),c&&305===y.transformed[0].kind)){var E=y.transformed[0];u=E.exportedModulesFromDeclarationEmit;}y.dispose(),l&&(l.dts=x.bundleFileInfo);}else (o||p.emitDeclarationOnly)&&(T=!0);}(a,v,h,S),null===e.tracing||void 0===e.tracing||e.tracing.pop(),null===e.tracing||void 0===e.tracing||e.tracing.push("emit","emitBuildInfo",{buildInfoPath:x}),function(t,i){if(i&&!n&&!T){var a=r.getProgramBuildInfo();if(r.isEmitBlocked(i))T=!0;else {var o=e.version;e.writeFile(r,m,i,b({bundle:t,program:a,version:o}),!1);}}}(l,x),null===e.tracing||void 0===e.tracing||e.tracing.pop(),!T&&g&&(o||(f&&g.push(f),y&&g.push(y),x&&g.push(x)),v&&g.push(v),h&&g.push(h));}),e.getSourceFilesToEmit(r,n,c),c,s,!n),S(),{emitSkipped:T,diagnostics:m.getDiagnostics(),emittedFiles:g,sourceMaps:f,exportedModulesFromDeclarationEmit:u};function C(r){e.isExportAssignment(r)?79===r.expression.kind&&t.collectLinkedAliases(r.expression,!0):e.isExportSpecifier(r)?t.collectLinkedAliases(r.propertyName||r.name,!0):e.forEachChild(r,C);}function k(t,n,i,a,o){var s,c,l=306===i.kind?i:void 0,u=305===i.kind?i:void 0,_=l?l.sourceFiles:[u];if(function(t,r){return (t.sourceMap||t.inlineSourceMap)&&(305!==r.kind||!e.fileExtensionIs(r.fileName,".json"))}(o,i)&&(s=e.createSourceMapGenerator(r,e.getBaseFileName(e.normalizeSlashes(t)),function(t){var r=e.normalizeSlashes(t.sourceRoot||"");return r?e.ensureTrailingDirectorySeparator(r):r}(o),function(t,n,i){if(t.sourceRoot)return r.getCommonSourceDirectory();if(t.mapRoot){var a=e.normalizeSlashes(t.mapRoot);return i&&(a=e.getDirectoryPath(e.getSourceFilePathInNewDir(i.fileName,r,a))),0===e.getRootLength(a)&&(a=e.combinePaths(r.getCommonSourceDirectory(),a)),a}return e.getDirectoryPath(e.normalizePath(n))}(o,t,u),o)),l?a.writeBundle(l,v,s):a.writeFile(u,v,s),s){f&&f.push({inputSourceFileNames:s.getSources(),sourceMap:s.toJSON()});var d=function(t,n,i,a,o){if(t.inlineSourceMap){var s=n.toString(),c=e.base64encode(e.sys,s);return "data:application/json;base64,".concat(c)}var l=e.getBaseFileName(e.normalizeSlashes(e.Debug.checkDefined(a)));if(t.mapRoot){var u=e.normalizeSlashes(t.mapRoot);return o&&(u=e.getDirectoryPath(e.getSourceFilePathInNewDir(o.fileName,r,u))),0===e.getRootLength(u)?(u=e.combinePaths(r.getCommonSourceDirectory(),u),encodeURI(e.getRelativePathToDirectoryOrUrl(e.getDirectoryPath(e.normalizePath(i)),e.combinePaths(u,l),r.getCurrentDirectory(),r.getCanonicalFileName,!0))):encodeURI(e.combinePaths(u,l))}return encodeURI(l)}(o,s,t,n,u);if(d&&(v.isAtStartOfLine()||v.rawWrite(y),c=v.getTextPos(),v.writeComment("//# ".concat("sourceMappingURL","=").concat(d))),n){var g=s.toString();e.writeFile(r,m,n,g,!1,_);}}else v.writeLine();e.writeFile(r,m,t,v.getText(),!!p.emitBOM,_,{sourceMapUrlPos:c}),v.clear();}}function b(e){return JSON.stringify(e)}function x(e){return JSON.parse(e)}function D(t,r){void 0===t&&(t={}),void 0===r&&(r={});var n,a,o,s,c,l,u,_,d,p,f,g,m,y,v,h,b,x,D,k=r.hasGlobalName,E=r.onEmitNode,N=void 0===E?e.noEmitNotification:E,F=r.isEmitNotificationEnabled,A=r.substituteNode,P=void 0===A?e.noEmitSubstitution:A,w=r.onBeforeEmitNode,I=r.onAfterEmitNode,O=r.onBeforeEmitNodeArray,M=r.onAfterEmitNodeArray,L=r.onBeforeEmitToken,R=r.onAfterEmitToken,B=!!t.extendedDiagnostics,j=e.getNewLineCharacter(t),J=e.getEmitModuleKind(t),z=new e.Map,K=t.preserveSourceNewlines,U=function(e){p.write(e);},V=t.writeBundleFileInfo?{sections:[]}:void 0,q=V?e.Debug.checkDefined(t.relativeToBuildInfo):void 0,W=t.recordInternalSection,H=0,G="text",Q=!0,X=-1,Y=-1,Z=-1,$=-1,ee=-1,te=!1,re=!!t.removeComments,ne=e.performance.createTimerIf(B,"commentTime","beforeComment","afterComment"),ie=ne.enter,ae=ne.exit,oe=e.factory.parenthesizer,se={select:function(e){return 0===e?oe.parenthesizeLeadingTypeArgument:void 0}},ce=function(){return e.createBinaryExpressionTrampoline((function(e,t){if(t){t.stackIndex++,t.preserveSourceNewlinesStack[t.stackIndex]=K,t.containerPosStack[t.stackIndex]=Z,t.containerEndStack[t.stackIndex]=$,t.declarationListContainerEndStack[t.stackIndex]=ee;var r=t.shouldEmitCommentsStack[t.stackIndex]=Oe(e),n=t.shouldEmitSourceMapsStack[t.stackIndex]=Me(e);null==w||w(e),r&&Rr(e),n&&on(e),Pe(e);}else t={stackIndex:0,preserveSourceNewlinesStack:[void 0],containerPosStack:[-1],containerEndStack:[-1],declarationListContainerEndStack:[-1],shouldEmitCommentsStack:[!1],shouldEmitSourceMapsStack:[!1]};return t}),(function(e,r,n){return t(e,n,"left")}),(function(e,t,r){var n=27!==e.kind,i=vr(r,r.left,e),a=vr(r,e,r.right);lr(i,n),Qr(e.pos),ar(e,101===e.kind?Gt:Qt),Yr(e.end,!0),lr(a,!0);}),(function(e,r,n){return t(e,n,"right")}),(function(e,t){if(ur(vr(e,e.left,e.operatorToken),vr(e,e.operatorToken,e.right)),t.stackIndex>0){var r=t.preserveSourceNewlinesStack[t.stackIndex],n=t.containerPosStack[t.stackIndex],i=t.containerEndStack[t.stackIndex],a=t.declarationListContainerEndStack[t.stackIndex],o=t.shouldEmitCommentsStack[t.stackIndex],s=t.shouldEmitSourceMapsStack[t.stackIndex];we(r),s&&sn(e),o&&Br(e,n,i,a),null==I||I(e),t.stackIndex--;}}),void 0);function t(t,r,n){var i="left"===n?oe.getParenthesizeLeftSideOfBinaryForOperator(r.operatorToken.kind):oe.getParenthesizeRightSideOfBinaryForOperator(r.operatorToken.kind),a=Le(0,1,t);if(a===ze&&(e.Debug.assertIsDefined(x),a=Re(1,1,t=i(e.cast(x,e.isExpression))),x=void 0),(a===Lr||a===an||a===je)&&e.isBinaryExpression(t))return t;D=i,a(1,t);}}();return Ce(),{printNode:function(t,r,n){switch(t){case 0:e.Debug.assert(e.isSourceFile(r),"Expected a SourceFile node.");break;case 2:e.Debug.assert(e.isIdentifier(r),"Expected an Identifier node.");break;case 1:e.Debug.assert(e.isExpression(r),"Expected an Expression node.");}switch(r.kind){case 305:return ue(r);case 306:return le(r);case 307:return i=r,a=be(),o=p,Te(a,void 0),De(4,i,void 0),Ce(),p=o,xe()}var i,a,o;return _e(t,r,n,be()),xe()},printList:function(e,t,r){return de(e,t,r,be()),xe()},printFile:ue,printBundle:le,writeNode:_e,writeList:de,writeFile:he,writeBundle:ve,bundleFileInfo:V};function le(e){return ve(e,be(),void 0),xe()}function ue(e){return he(e,be(),void 0),xe()}function _e(e,t,r,n){var i=p;Te(n,void 0),De(e,t,r),Ce(),p=i;}function de(e,t,r,n){var i=p;Te(n,void 0),r&&Se(r),zt(void 0,t,e),Ce(),p=i;}function pe(){return p.getTextPosWithWriteLine?p.getTextPosWithWriteLine():p.getTextPos()}function fe(t,r,n){var i=e.lastOrUndefined(V.sections);i&&i.kind===n?i.end=r:V.sections.push({pos:t,end:r,kind:n});}function ge(t){if(W&&V&&n&&(e.isDeclaration(t)||e.isVariableStatement(t))&&e.isInternalDeclaration(t,n)&&"internal"!==G){var r=G;return ye(p.getTextPos()),H=pe(),G="internal",r}}function me(e){e&&(ye(p.getTextPos()),H=pe(),G=e);}function ye(e){return H<e&&(fe(H,e,G),!0)}function ve(r,n,i){var a;g=!1;var o=p;Te(n,i),Et(r),kt(r),Ke(r),function(t){Dt(!!t.hasNoDefaultLib,t.syntheticFileReferences||[],t.syntheticTypeReferences||[],t.syntheticLibReferences||[]);for(var r=0,n=t.prepends;r<n.length;r++){var i=n[r];if(e.isUnparsedSource(i)&&i.syntheticReferences)for(var a=0,o=i.syntheticReferences;a<o.length;a++)Ee(o[a]),tr();}}(r);for(var s=0,c=r.prepends;s<c.length;s++){var l=c[s];tr();var u=p.getTextPos(),_=V&&V.sections;if(_&&(V.sections=[]),De(4,l,void 0),V){var d=V.sections;V.sections=_,l.oldFileOfCurrentEmit?(a=V.sections).push.apply(a,d):(d.forEach((function(t){return e.Debug.assert(e.isBundleFileTextLike(t))})),V.sections.push({pos:u,end:p.getTextPos(),kind:"prepend",data:q(l.fileName),texts:d}));}}H=pe();for(var f=0,m=r.sourceFiles;f<m.length;f++){var y=m[f];De(0,y,y);}if(V&&r.sourceFiles.length&&ye(p.getTextPos())){var v=function(t){for(var r,n=new e.Set,i=0;i<t.sourceFiles.length;i++){for(var a=t.sourceFiles[i],o=void 0,s=0,c=0,l=a.statements;c<l.length;c++){var u=l[c];if(!e.isPrologueDirective(u))break;n.has(u.expression.text)||(n.add(u.expression.text),(o||(o=[])).push({pos:u.pos,end:u.end,expression:{pos:u.expression.pos,end:u.expression.end,text:u.expression.text}}),s=s<u.end?u.end:s);}o&&(r||(r=[])).push({file:i,text:a.text.substring(0,s),directives:o});}return r}(r);v&&(V.sources||(V.sources={}),V.sources.prologues=v);var h=function(r){var n;if(J!==e.ModuleKind.None&&!t.noEmitHelpers){for(var i=new e.Map,a=0,o=r.sourceFiles;a<o.length;a++){var s=o[a],c=void 0!==e.getExternalHelpersModuleName(s),l=Ue(s);if(l)for(var u=0,_=l;u<_.length;u++){var d=_[u];d.scoped||c||i.get(d.name)||(i.set(d.name,!0),(n||(n=[])).push(d.name));}}return n}}(r);h&&(V.sources||(V.sources={}),V.sources.helpers=h);}Ce(),p=o;}function he(e,t,r){g=!0;var n=p;Te(t,r),Et(e),kt(e),De(0,e,e),Ce(),p=n;}function be(){return f||(f=e.createTextWriter(j))}function xe(){var e=f.getText();return f.clear(),e}function De(e,t,r){r&&Se(r),Ie(e,t,void 0);}function Se(e){n=e,h=void 0,b=void 0,e&&_n(e);}function Te(r,n){r&&t.omitTrailingSemicolon&&(r=e.getTrailingSemicolonDeferringWriter(r)),m=n,Q=!(p=r)||!m;}function Ce(){a=[],o=[],s=new e.Set,c=[],l=0,u=[],n=void 0,h=void 0,b=void 0,Te(void 0,void 0);}function ke(){return h||(h=e.getLineStarts(e.Debug.checkDefined(n)))}function Ee(e,t){if(void 0!==e){var r=ge(e);Ie(4,e,t),me(r);}}function Ne(e){void 0!==e&&Ie(2,e,void 0);}function Fe(e,t){void 0!==e&&Ie(1,e,t);}function Ae(t){Ie(e.isStringLiteral(t)?6:4,t);}function Pe(t){K&&134217728&e.getEmitFlags(t)&&(K=!1);}function we(e){K=e;}function Ie(e,t,r){D=r,Le(0,e,t)(e,t),D=void 0;}function Oe(t){return !re&&!e.isSourceFile(t)}function Me(t){return !(Q||e.isSourceFile(t)||e.isInJsonFile(t)||e.isUnparsedSource(t)||e.isUnparsedPrepend(t))}function Le(t,r,n){switch(t){case 0:if(N!==e.noEmitNotification&&(!F||F(n)))return Be;case 1:if(P!==e.noEmitSubstitution&&(x=P(r,n)||n)!==n)return D&&(x=D(x)),ze;case 2:if(Oe(n))return Lr;case 3:if(Me(n))return an;case 4:return je;default:return e.Debug.assertNever(t)}}function Re(e,t,r){return Le(e+1,t,r)}function Be(e,t){var r=Re(0,e,t);N(e,t,r);}function je(e,t){if(null==w||w(t),K){var r=K;Pe(t),Je(e,t),we(r);}else Je(e,t);null==I||I(t),D=void 0;}function Je(t,r,i){if(void 0===i&&(i=!0),i){var a=e.getSnippetElement(r);if(a)return function(t,r,n){switch(n.kind){case 1:!function(e,t,r){er("${".concat(r.order,":")),Je(e,t,!1),er("}");}(t,r,n);break;case 0:!function(t,r,n){e.Debug.assert(236===r.kind,"A tab stop cannot be attached to a node of kind ".concat(e.Debug.formatSyntaxKind(r.kind),".")),e.Debug.assert(5!==t,"A tab stop cannot be attached to an embedded statement."),er("$".concat(n.order));}(t,r,n);}}(t,r,a)}if(0===t)return xt(e.cast(r,e.isSourceFile));if(2===t)return We(e.cast(r,e.isIdentifier));if(6===t)return Ve(e.cast(r,e.isStringLiteral),!0);if(3===t)return function(e){Ee(e.name),Zt(),Gt("in"),Zt(),Ee(e.constraint);}(e.cast(r,e.isTypeParameterDeclaration));if(5===t)return e.Debug.assertNode(r,e.isEmptyStatement),Ye(!0);if(4===t){switch(r.kind){case 15:case 16:case 17:return Ve(r,!1);case 79:return We(r);case 80:return He(r);case 161:return function(e){(function(e){79===e.kind?Fe(e):Ee(e);})(e.left),Wt("."),Ee(e.right);}(r);case 162:return function(e){Wt("["),Fe(e.expression,oe.parenthesizeExpressionOfComputedPropertyName),Wt("]");}(r);case 163:return function(e){Ft(e,e.modifiers),Ee(e.name),e.constraint&&(Zt(),Gt("extends"),Zt(),Ee(e.constraint)),e.default&&(Zt(),Qt("="),Zt(),Ee(e.default));}(r);case 164:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Ee(e.dotDotDotToken),Nt(e.name,Xt),Ee(e.questionToken),e.parent&&317===e.parent.kind&&!e.name?Ee(e.type):At(e.type),Pt(e.initializer,e.type?e.type.end:e.questionToken?e.questionToken.end:e.name?e.name.end:e.modifiers?e.modifiers.end:e.decorators?e.decorators.end:e.pos,e,oe.parenthesizeExpressionForDisallowedComma);}(r);case 165:return _=r,Wt("@"),void Fe(_.expression,oe.parenthesizeLeftSideOfAccess);case 166:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Nt(e.name,$t),Ee(e.questionToken),At(e.type),Ht();}(r);case 167:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Ee(e.name),Ee(e.questionToken),Ee(e.exclamationToken),At(e.type),Pt(e.initializer,e.type?e.type.end:e.questionToken?e.questionToken.end:e.name.end,e),Ht();}(r);case 168:return function(e){Sr(e),Mt(e,e.decorators),Ft(e,e.modifiers),Ee(e.name),Ee(e.questionToken),Rt(e,e.typeParameters),Bt(e,e.parameters),At(e.type),Ht(),Tr(e);}(r);case 169:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Ee(e.asteriskToken),Ee(e.name),Ee(e.questionToken),ot(e,st);}(r);case 170:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Gt("static"),ct(e.body);}(r);case 171:return function(e){Ft(e,e.modifiers),Gt("constructor"),ot(e,st);}(r);case 172:case 173:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Gt(172===e.kind?"get":"set"),Zt(),Ee(e.name),ot(e,st);}(r);case 174:return function(e){Sr(e),Mt(e,e.decorators),Ft(e,e.modifiers),Rt(e,e.typeParameters),Bt(e,e.parameters),At(e.type),Ht(),Tr(e);}(r);case 175:return function(e){Sr(e),Mt(e,e.decorators),Ft(e,e.modifiers),Gt("new"),Zt(),Rt(e,e.typeParameters),Bt(e,e.parameters),At(e.type),Ht(),Tr(e);}(r);case 176:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),zt(e,e.parameters,8848),At(e.type),Ht();}(r);case 177:return function(e){e.assertsModifier&&(Ee(e.assertsModifier),Zt()),Ee(e.parameterName),e.type&&(Zt(),Gt("is"),Zt(),Ee(e.type));}(r);case 178:return function(e){Ee(e.typeName),Lt(e,e.typeArguments);}(r);case 179:return function(e){Sr(e),Rt(e,e.typeParameters),jt(e,e.parameters),Zt(),Wt("=>"),Zt(),Ee(e.type),Tr(e);}(r);case 180:return function(e){Sr(e),Ft(e,e.modifiers),Gt("new"),Zt(),Rt(e,e.typeParameters),Bt(e,e.parameters),Zt(),Wt("=>"),Zt(),Ee(e.type),Tr(e);}(r);case 181:return function(e){Gt("typeof"),Zt(),Ee(e.exprName),Lt(e,e.typeArguments);}(r);case 182:return function(t){Wt("{");var r=1&e.getEmitFlags(t)?768:32897;zt(t,t.members,524288|r),Wt("}");}(r);case 183:return function(e){Ee(e.elementType,oe.parenthesizeNonArrayTypeOfPostfixType),Wt("["),Wt("]");}(r);case 184:return function(t){et(22,t.pos,Wt,t);var r=1&e.getEmitFlags(t)?528:657;zt(t,t.elements,524288|r,oe.parenthesizeElementTypeOfTupleType),et(23,t.elements.end,Wt,t);}(r);case 185:return function(e){Ee(e.type,oe.parenthesizeTypeOfOptionalType),Wt("?");}(r);case 187:return function(e){zt(e,e.types,516,oe.parenthesizeConstituentTypeOfUnionType);}(r);case 188:return function(e){zt(e,e.types,520,oe.parenthesizeConstituentTypeOfIntersectionType);}(r);case 189:return function(e){Ee(e.checkType,oe.parenthesizeCheckTypeOfConditionalType),Zt(),Gt("extends"),Zt(),Ee(e.extendsType,oe.parenthesizeExtendsTypeOfConditionalType),Zt(),Wt("?"),Zt(),Ee(e.trueType),Zt(),Wt(":"),Zt(),Ee(e.falseType);}(r);case 190:return function(e){Gt("infer"),Zt(),Ee(e.typeParameter);}(r);case 191:return function(e){Wt("("),Ee(e.type),Wt(")");}(r);case 228:return Qe(r);case 192:return void Gt("this");case 193:return function(e){or(e.operator,Gt),Zt();var t=145===e.operator?oe.parenthesizeOperandOfReadonlyTypeOperator:oe.parenthesizeOperandOfTypeOperator;Ee(e.type,t);}(r);case 194:return function(e){Ee(e.objectType,oe.parenthesizeNonArrayTypeOfPostfixType),Wt("["),Ee(e.indexType),Wt("]");}(r);case 195:return function(t){var r=e.getEmitFlags(t);Wt("{"),1&r?Zt():(tr(),rr()),t.readonlyToken&&(Ee(t.readonlyToken),145!==t.readonlyToken.kind&&Gt("readonly"),Zt()),Wt("["),Ie(3,t.typeParameter),t.nameType&&(Zt(),Gt("as"),Zt(),Ee(t.nameType)),Wt("]"),t.questionToken&&(Ee(t.questionToken),57!==t.questionToken.kind&&Wt("?")),Wt(":"),Zt(),Ee(t.type),Ht(),1&r?Zt():(tr(),nr()),zt(t,t.members,2),Wt("}");}(r);case 196:return function(e){Fe(e.literal);}(r);case 197:return function(e){Ee(e.dotDotDotToken),Ee(e.name),Ee(e.questionToken),et(58,e.name.end,Wt,e),Zt(),Ee(e.type);}(r);case 198:return function(e){Ee(e.head),zt(e,e.templateSpans,262144);}(r);case 199:return function(e){Ee(e.type),Ee(e.literal);}(r);case 200:return function(e){if(e.isTypeOf&&(Gt("typeof"),Zt()),Gt("import"),Wt("("),Ee(e.argument),e.assertions){Wt(","),Zt(),Wt("{"),Zt(),Gt("assert"),Wt(":"),Zt();var t=e.assertions.assertClause.elements;zt(e.assertions.assertClause,t,526226),Zt(),Wt("}");}Wt(")"),e.qualifier&&(Wt("."),Ee(e.qualifier)),Lt(e,e.typeArguments);}(r);case 201:return function(e){Wt("{"),zt(e,e.elements,525136),Wt("}");}(r);case 202:return function(e){Wt("["),zt(e,e.elements,524880),Wt("]");}(r);case 203:return function(e){Ee(e.dotDotDotToken),e.propertyName&&(Ee(e.propertyName),Wt(":"),Zt()),Ee(e.name),Pt(e.initializer,e.name.end,e,oe.parenthesizeExpressionForDisallowedComma);}(r);case 233:return function(e){Fe(e.expression),Ee(e.literal);}(r);case 234:return void Ht();case 235:return function(e){Xe(e,!e.multiLine&&hr(e));}(r);case 237:return function(e){Ft(e,e.modifiers),Ee(e.declarationList),Ht();}(r);case 236:return Ye(!1);case 238:return function(t){Fe(t.expression,oe.parenthesizeExpressionOfExpressionStatement),n&&e.isJsonSourceFile(n)&&!e.nodeIsSynthesized(t.expression)||Ht();}(r);case 239:return function(e){var t=et(99,e.pos,Gt,e);Zt(),et(20,t,Wt,e),Fe(e.expression),et(21,e.expression.end,Wt,e),Ot(e,e.thenStatement),e.elseStatement&&(sr(e,e.thenStatement,e.elseStatement),et(91,e.thenStatement.end,Gt,e),239===e.elseStatement.kind?(Zt(),Ee(e.elseStatement)):Ot(e,e.elseStatement));}(r);case 240:return function(t){et(90,t.pos,Gt,t),Ot(t,t.statement),e.isBlock(t.statement)&&!K?Zt():sr(t,t.statement,t.expression),Ze(t,t.statement.end),Ht();}(r);case 241:return function(e){Ze(e,e.pos),Ot(e,e.statement);}(r);case 242:return function(e){var t=et(97,e.pos,Gt,e);Zt();var r=et(20,t,Wt,e);$e(e.initializer),r=et(26,e.initializer?e.initializer.end:r,Wt,e),It(e.condition),r=et(26,e.condition?e.condition.end:r,Wt,e),It(e.incrementor),et(21,e.incrementor?e.incrementor.end:r,Wt,e),Ot(e,e.statement);}(r);case 243:return function(e){var t=et(97,e.pos,Gt,e);Zt(),et(20,t,Wt,e),$e(e.initializer),Zt(),et(101,e.initializer.end,Gt,e),Zt(),Fe(e.expression),et(21,e.expression.end,Wt,e),Ot(e,e.statement);}(r);case 244:return function(e){var t=et(97,e.pos,Gt,e);Zt(),function(e){e&&(Ee(e),Zt());}(e.awaitModifier),et(20,t,Wt,e),$e(e.initializer),Zt(),et(160,e.initializer.end,Gt,e),Zt(),Fe(e.expression),et(21,e.expression.end,Wt,e),Ot(e,e.statement);}(r);case 245:return function(e){et(86,e.pos,Gt,e),wt(e.label),Ht();}(r);case 246:return function(e){et(81,e.pos,Gt,e),wt(e.label),Ht();}(r);case 247:return function(e){et(105,e.pos,Gt,e),It(e.expression&&nt(e.expression),nt),Ht();}(r);case 248:return function(e){var t=et(116,e.pos,Gt,e);Zt(),et(20,t,Wt,e),Fe(e.expression),et(21,e.expression.end,Wt,e),Ot(e,e.statement);}(r);case 249:return function(e){var t=et(107,e.pos,Gt,e);Zt(),et(20,t,Wt,e),Fe(e.expression),et(21,e.expression.end,Wt,e),Zt(),Ee(e.caseBlock);}(r);case 250:return function(e){Ee(e.label),et(58,e.label.end,Wt,e),Zt(),Ee(e.statement);}(r);case 251:return function(e){et(109,e.pos,Gt,e),It(nt(e.expression),nt),Ht();}(r);case 252:return function(e){et(111,e.pos,Gt,e),Zt(),Ee(e.tryBlock),e.catchClause&&(sr(e,e.tryBlock,e.catchClause),Ee(e.catchClause)),e.finallyBlock&&(sr(e,e.catchClause||e.tryBlock,e.finallyBlock),et(96,(e.catchClause||e.tryBlock).end,Gt,e),Zt(),Ee(e.finallyBlock));}(r);case 253:return function(e){ir(87,e.pos,Gt),Ht();}(r);case 254:return function(e){var t,r,n,i,a;Ee(e.name),Ee(e.exclamationToken),At(e.type),Pt(e.initializer,null!==(a=null!==(r=null===(t=e.type)||void 0===t?void 0:t.end)&&void 0!==r?r:null===(i=null===(n=e.name.emitNode)||void 0===n?void 0:n.typeNode)||void 0===i?void 0:i.end)&&void 0!==a?a:e.name.end,e,oe.parenthesizeExpressionForDisallowedComma);}(r);case 255:return function(t){Gt(e.isLet(t)?"let":e.isVarConst(t)?"const":"var"),Zt(),zt(t,t.declarations,528);}(r);case 256:return function(e){at(e);}(r);case 257:return function(e){_t(e);}(r);case 258:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Gt("interface"),Zt(),Ee(e.name),Rt(e,e.typeParameters),zt(e,e.heritageClauses,512),Zt(),Wt("{"),zt(e,e.members,129),Wt("}");}(r);case 259:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),Gt("type"),Zt(),Ee(e.name),Rt(e,e.typeParameters),Zt(),Wt("="),Zt(),Ee(e.type),Ht();}(r);case 260:return function(e){Ft(e,e.modifiers),Gt("enum"),Zt(),Ee(e.name),Zt(),Wt("{"),zt(e,e.members,145),Wt("}");}(r);case 261:return function(t){Ft(t,t.modifiers),1024&~t.flags&&(Gt(16&t.flags?"namespace":"module"),Zt()),Ee(t.name);var r=t.body;if(!r)return Ht();for(;r&&e.isModuleDeclaration(r);)Wt("."),Ee(r.name),r=r.body;Zt(),Ee(r);}(r);case 262:return function(t){Sr(t),e.forEach(t.statements,kr),Xe(t,hr(t)),Tr(t);}(r);case 263:return function(e){et(18,e.pos,Wt,e),zt(e,e.clauses,129),et(19,e.clauses.end,Wt,e,!0);}(r);case 264:return function(e){var t=et(93,e.pos,Gt,e);Zt(),t=et(127,t,Gt,e),Zt(),t=et(142,t,Gt,e),Zt(),Ee(e.name),Ht();}(r);case 265:return function(e){Ft(e,e.modifiers),et(100,e.modifiers?e.modifiers.end:e.pos,Gt,e),Zt(),e.isTypeOnly&&(et(152,e.pos,Gt,e),Zt()),Ee(e.name),Zt(),et(63,e.name.end,Wt,e),Zt(),function(e){79===e.kind?Fe(e):Ee(e);}(e.moduleReference),Ht();}(r);case 266:return function(e){Ft(e,e.modifiers),et(100,e.modifiers?e.modifiers.end:e.pos,Gt,e),Zt(),e.importClause&&(Ee(e.importClause),Zt(),et(156,e.importClause.end,Gt,e),Zt()),Fe(e.moduleSpecifier),e.assertClause&&wt(e.assertClause),Ht();}(r);case 267:return function(e){e.isTypeOnly&&(et(152,e.pos,Gt,e),Zt()),Ee(e.name),e.name&&e.namedBindings&&(et(27,e.name.end,Wt,e),Zt()),Ee(e.namedBindings);}(r);case 268:return function(e){var t=et(41,e.pos,Wt,e);Zt(),et(127,t,Gt,e),Zt(),Ee(e.name);}(r);case 274:return function(e){var t=et(41,e.pos,Wt,e);Zt(),et(127,t,Gt,e),Zt(),Ee(e.name);}(r);case 269:return function(e){dt(e);}(r);case 270:return function(e){pt(e);}(r);case 271:return function(e){var t=et(93,e.pos,Gt,e);Zt(),e.isExportEquals?et(63,t,Qt,e):et(88,t,Gt,e),Zt(),Fe(e.expression,e.isExportEquals?oe.getParenthesizeRightSideOfBinaryForOperator(63):oe.parenthesizeExpressionOfExportDefault),Ht();}(r);case 272:return function(e){var t=et(93,e.pos,Gt,e);Zt(),e.isTypeOnly&&(t=et(152,t,Gt,e),Zt()),e.exportClause?Ee(e.exportClause):t=et(41,t,Wt,e),e.moduleSpecifier&&(Zt(),et(156,e.exportClause?e.exportClause.end:t,Gt,e),Zt(),Fe(e.moduleSpecifier)),e.assertClause&&wt(e.assertClause),Ht();}(r);case 273:return function(e){dt(e);}(r);case 275:return function(e){pt(e);}(r);case 293:return function(e){et(129,e.pos,Gt,e),Zt(),zt(e,e.elements,526226);}(r);case 294:return function(t){Ee(t.name),Wt(":"),Zt();var r=t.value;0==(512&e.getEmitFlags(r))&&Yr(e.getCommentRange(r).pos),Ee(r);}(r);case 276:return;case 277:return function(e){Gt("require"),Wt("("),Fe(e.expression),Wt(")");}(r);case 11:return function(e){p.writeLiteral(e.text);}(r);case 280:case 283:return function(t){if(Wt("<"),e.isJsxOpeningElement(t)){var r=gr(t.tagName,t);ft(t.tagName),Lt(t,t.typeArguments),t.attributes.properties&&t.attributes.properties.length>0&&Zt(),Ee(t.attributes),mr(t.attributes,t),ur(r);}Wt(">");}(r);case 281:case 284:return function(t){Wt("</"),e.isJsxClosingElement(t)&&ft(t.tagName),Wt(">");}(r);case 285:return function(e){Ee(e.name),function(e,t,r,n){r&&(t("="),n(r));}(0,Wt,e.initializer,Ae);}(r);case 286:return function(e){zt(e,e.properties,262656);}(r);case 287:return function(e){Wt("{..."),Fe(e.expression),Wt("}");}(r);case 288:return function(t){var r,i;if(t.expression||!re&&!e.nodeIsSynthesized(t)&&(function(t){var r=!1;return e.forEachTrailingCommentRange((null==n?void 0:n.text)||"",t+1,(function(){return r=!0})),r}(i=t.pos)||function(t){var r=!1;return e.forEachLeadingCommentRange((null==n?void 0:n.text)||"",t+1,(function(){return r=!0})),r}(i))){var a=n&&!e.nodeIsSynthesized(t)&&e.getLineAndCharacterOfPosition(n,t.pos).line!==e.getLineAndCharacterOfPosition(n,t.end).line;a&&p.increaseIndent();var o=et(18,t.pos,Wt,t);Ee(t.dotDotDotToken),Fe(t.expression),et(19,(null===(r=t.expression)||void 0===r?void 0:r.end)||o,Wt,t),a&&p.decreaseIndent();}}(r);case 289:return function(e){et(82,e.pos,Gt,e),Zt(),Fe(e.expression,oe.parenthesizeExpressionForDisallowedComma),gt(e,e.statements,e.expression.end);}(r);case 290:return function(e){var t=et(88,e.pos,Gt,e);gt(e,e.statements,t);}(r);case 291:return function(e){Zt(),or(e.token,Gt),Zt(),zt(e,e.types,528);}(r);case 292:return function(e){var t=et(83,e.pos,Gt,e);Zt(),e.variableDeclaration&&(et(20,t,Wt,e),Ee(e.variableDeclaration),et(21,e.variableDeclaration.end,Wt,e),Zt()),Ee(e.block);}(r);case 296:return function(t){Ee(t.name),Wt(":"),Zt();var r=t.initializer;0==(512&e.getEmitFlags(r))&&Yr(e.getCommentRange(r).pos),Fe(r,oe.parenthesizeExpressionForDisallowedComma);}(r);case 297:return function(e){Ee(e.name),e.objectAssignmentInitializer&&(Zt(),Wt("="),Zt(),Fe(e.objectAssignmentInitializer,oe.parenthesizeExpressionForDisallowedComma));}(r);case 298:return function(e){e.expression&&(et(25,e.pos,Wt,e),Fe(e.expression,oe.parenthesizeExpressionForDisallowedComma));}(r);case 299:return function(e){Ee(e.name),Pt(e.initializer,e.name.end,e,oe.parenthesizeExpressionForDisallowedComma);}(r);case 300:return qe(r);case 307:case 301:return function(e){for(var t=0,r=e.texts;t<r.length;t++){var n=r[t];tr(),Ee(n);}}(r);case 302:case 303:return l=r,u=pe(),qe(l),void(V&&fe(u,p.getTextPos(),302===l.kind?"text":"internal"));case 304:return function(t){var r=pe();if(qe(t),V){var n=e.clone(t.section);n.pos=r,n.end=p.getTextPos(),V.sections.push(n);}}(r);case 305:return xt(r);case 306:return e.Debug.fail("Bundles should be printed using printBundle");case 308:return e.Debug.fail("InputFiles should not be printed");case 309:return bt(r);case 310:return function(e){Zt(),Wt("{"),Ee(e.name),Wt("}");}(r);case 312:return Wt("*");case 313:return Wt("?");case 314:return function(e){Wt("?"),Ee(e.type);}(r);case 315:return function(e){Wt("!"),Ee(e.type);}(r);case 316:return function(e){Ee(e.type),Wt("=");}(r);case 317:return function(e){Gt("function"),Bt(e,e.parameters),Wt(":"),Ee(e.type);}(r);case 186:case 318:return function(e){Wt("..."),Ee(e.type);}(r);case 319:return;case 320:return function(t){if(U("/**"),t.comment){var r=e.getTextOfJSDocComment(t.comment);if(r)for(var n=0,i=r.split(/\r\n?|\n/g);n<i.length;n++){var a=i[n];tr(),Zt(),Wt("*"),Zt(),U(a);}}t.tags&&(1!==t.tags.length||343!==t.tags[0].kind||t.comment?zt(t,t.tags,33):(Zt(),Ee(t.tags[0]))),Zt(),U("*/");}(r);case 322:return mt(r);case 323:return yt(r);case 327:case 332:case 337:return vt((c=r).tagName),void ht(c.comment);case 328:case 329:return function(e){vt(e.tagName),Zt(),Wt("{"),Ee(e.class),Wt("}"),ht(e.comment);}(r);case 330:case 331:return;case 333:case 334:case 335:case 336:return;case 338:return function(e){vt(e.tagName),e.name&&(Zt(),Ee(e.name)),ht(e.comment),yt(e.typeExpression);}(r);case 340:case 347:return vt((s=r).tagName),bt(s.typeExpression),Zt(),s.isBracketed&&Wt("["),Ee(s.name),s.isBracketed&&Wt("]"),void ht(s.comment);case 339:case 341:case 342:case 343:return function(e){vt(e.tagName),bt(e.typeExpression),ht(e.comment);}(r);case 344:return function(e){vt(e.tagName),bt(e.constraint),Zt(),zt(e,e.typeParameters,528),ht(e.comment);}(r);case 345:return function(e){vt(e.tagName),e.typeExpression&&(309===e.typeExpression.kind?bt(e.typeExpression):(Zt(),Wt("{"),U("Object"),e.typeExpression.isArrayType&&(Wt("["),Wt("]")),Wt("}"))),e.fullName&&(Zt(),Ee(e.fullName)),ht(e.comment),e.typeExpression&&322===e.typeExpression.kind&&mt(e.typeExpression);}(r);case 346:return function(e){vt(e.tagName),Ee(e.name),ht(e.comment);}(r);case 349:case 353:case 352:return}if(e.isExpression(r)&&(t=1,P!==e.noEmitSubstitution)){var o=P(t,r)||r;o!==r&&(r=o,D&&(r=D(r)));}}var s,c,l,u,_;if(1===t)switch(r.kind){case 8:case 9:return function(e){Ve(e,!1);}(r);case 10:case 13:case 14:return Ve(r,!1);case 79:return We(r);case 80:return He(r);case 204:return function(e){Kt(e,e.elements,8914|(e.multiLine?65536:0),oe.parenthesizeExpressionForDisallowedComma);}(r);case 205:return function(t){e.forEach(t.properties,Er);var r=65536&e.getEmitFlags(t);r&&rr();var i=t.multiLine?65536:0,a=n&&n.languageVersion>=1&&!e.isJsonSourceFile(n)?64:0;zt(t,t.properties,526226|a|i),r&&nr();}(r);case 206:return function(t){Fe(t.expression,oe.parenthesizeLeftSideOfAccess);var r=t.questionDotToken||e.setTextRangePosEnd(e.factory.createToken(24),t.expression.end,t.name.pos),n=vr(t,t.expression,r),i=vr(t,r,t.name);lr(n,!1),28===r.kind||!function(t){if(t=e.skipPartiallyEmittedExpressions(t),e.isNumericLiteral(t)){var r=Dr(t,!0,!1);return !t.numericLiteralFlags&&!e.stringContains(r,e.tokenToString(24))}if(e.isAccessExpression(t)){var n=e.getConstantValue(t);return "number"==typeof n&&isFinite(n)&&Math.floor(n)===n}}(t.expression)||p.hasTrailingComment()||p.hasTrailingWhitespace()||Wt("."),t.questionDotToken?Ee(r):et(r.kind,t.expression.end,Wt,t),lr(i,!1),Ee(t.name),ur(n,i);}(r);case 207:return function(e){Fe(e.expression,oe.parenthesizeLeftSideOfAccess),Ee(e.questionDotToken),et(22,e.expression.end,Wt,e),Fe(e.argumentExpression),et(23,e.argumentExpression.end,Wt,e);}(r);case 208:return function(t){var r=536870912&e.getEmitFlags(t);r&&(Wt("("),Vt("0"),Wt(","),Zt()),Fe(t.expression,oe.parenthesizeLeftSideOfAccess),r&&Wt(")"),Ee(t.questionDotToken),Lt(t,t.typeArguments),Kt(t,t.arguments,2576,oe.parenthesizeExpressionForDisallowedComma);}(r);case 209:return function(e){et(103,e.pos,Gt,e),Zt(),Fe(e.expression,oe.parenthesizeExpressionOfNew),Lt(e,e.typeArguments),Kt(e,e.arguments,18960,oe.parenthesizeExpressionForDisallowedComma);}(r);case 210:return function(t){var r=536870912&e.getEmitFlags(t);r&&(Wt("("),Vt("0"),Wt(","),Zt()),Fe(t.tag,oe.parenthesizeLeftSideOfAccess),r&&Wt(")"),Lt(t,t.typeArguments),Zt(),Fe(t.template);}(r);case 211:return function(e){Wt("<"),Ee(e.type),Wt(">"),Fe(e.expression,oe.parenthesizeOperandOfPrefixUnary);}(r);case 212:return function(e){var t=et(20,e.pos,Wt,e),r=gr(e.expression,e);Fe(e.expression,void 0),mr(e.expression,e),ur(r),et(21,e.expression?e.expression.end:t,Wt,e);}(r);case 213:return function(e){Nr(e.name),at(e);}(r);case 214:return function(e){Mt(e,e.decorators),Ft(e,e.modifiers),ot(e,Ge);}(r);case 215:return function(e){et(89,e.pos,Gt,e),Zt(),Fe(e.expression,oe.parenthesizeOperandOfPrefixUnary);}(r);case 216:return function(e){et(112,e.pos,Gt,e),Zt(),Fe(e.expression,oe.parenthesizeOperandOfPrefixUnary);}(r);case 217:return function(e){et(114,e.pos,Gt,e),Zt(),Fe(e.expression,oe.parenthesizeOperandOfPrefixUnary);}(r);case 218:return function(e){et(132,e.pos,Gt,e),Zt(),Fe(e.expression,oe.parenthesizeOperandOfPrefixUnary);}(r);case 219:return function(e){or(e.operator,Qt),function(e){var t=e.operand;return 219===t.kind&&(39===e.operator&&(39===t.operator||45===t.operator)||40===e.operator&&(40===t.operator||46===t.operator))}(e)&&Zt(),Fe(e.operand,oe.parenthesizeOperandOfPrefixUnary);}(r);case 220:return function(e){Fe(e.operand,oe.parenthesizeOperandOfPostfixUnary),or(e.operator,Qt);}(r);case 221:return ce(r);case 222:return function(e){var t=vr(e,e.condition,e.questionToken),r=vr(e,e.questionToken,e.whenTrue),n=vr(e,e.whenTrue,e.colonToken),i=vr(e,e.colonToken,e.whenFalse);Fe(e.condition,oe.parenthesizeConditionOfConditionalExpression),lr(t,!0),Ee(e.questionToken),lr(r,!0),Fe(e.whenTrue,oe.parenthesizeBranchOfConditionalExpression),ur(t,r),lr(n,!0),Ee(e.colonToken),lr(i,!0),Fe(e.whenFalse,oe.parenthesizeBranchOfConditionalExpression),ur(n,i);}(r);case 223:return function(e){Ee(e.head),zt(e,e.templateSpans,262144);}(r);case 224:return function(e){et(125,e.pos,Gt,e),Ee(e.asteriskToken),It(e.expression&&nt(e.expression),it);}(r);case 225:return function(e){et(25,e.pos,Wt,e),Fe(e.expression,oe.parenthesizeExpressionForDisallowedComma);}(r);case 226:return function(e){Nr(e.name),_t(e);}(r);case 227:return;case 229:return function(e){Fe(e.expression,void 0),e.type&&(Zt(),Gt("as"),Zt(),Ee(e.type));}(r);case 230:return function(e){Fe(e.expression,oe.parenthesizeLeftSideOfAccess),Qt("!");}(r);case 228:return Qe(r);case 231:return function(e){ir(e.keywordToken,e.pos,Wt),Wt("."),Ee(e.name);}(r);case 232:return e.Debug.fail("SyntheticExpression should never be printed.");case 278:return function(e){Ee(e.openingElement),zt(e,e.children,262144),Ee(e.closingElement);}(r);case 279:return function(e){Wt("<"),ft(e.tagName),Lt(e,e.typeArguments),Zt(),Ee(e.attributes),Wt("/>");}(r);case 282:return function(e){Ee(e.openingFragment),zt(e,e.children,262144),Ee(e.closingFragment);}(r);case 348:return e.Debug.fail("SyntaxList should not be printed");case 349:return;case 350:return function(t){var r=e.getEmitFlags(t);512&r||t.pos===t.expression.pos||Yr(t.expression.pos),Fe(t.expression),1024&r||t.end===t.expression.end||Qr(t.expression.end);}(r);case 351:return function(e){Kt(e,e.elements,528,void 0);}(r);case 352:case 353:return;case 354:return e.Debug.fail("SyntheticReferenceExpression should not be printed")}return e.isKeyword(r.kind)?ar(r,Gt):e.isTokenKind(r.kind)?ar(r,Wt):void e.Debug.fail("Unhandled SyntaxKind: ".concat(e.Debug.formatSyntaxKind(r.kind),"."))}function ze(t,r){var n=Re(1,t,r);e.Debug.assertIsDefined(x),r=x,x=void 0,n(t,r);}function Ke(r){var i=!1,a=306===r.kind?r:void 0;if(!a||J!==e.ModuleKind.None){for(var o=a?a.prepends.length:0,s=a?a.sourceFiles.length+o:1,c=0;c<s;c++){var l=a?c<o?a.prepends[c]:a.sourceFiles[c-o]:r,u=e.isSourceFile(l)?l:e.isUnparsedSource(l)?void 0:n,_=t.noEmitHelpers||!!u&&e.hasRecordedExternalHelpers(u),d=(e.isSourceFile(l)||e.isUnparsedSource(l))&&!g,f=e.isUnparsedSource(l)?l.helpers:Ue(l);if(f)for(var m=0,y=f;m<y.length;m++){var v=y[m];if(v.scoped){if(a)continue}else {if(_)continue;if(d){if(z.get(v.name))continue;z.set(v.name,!0);}}var h=pe();"string"==typeof v.text?cr(v.text):cr(v.text(Mr)),V&&V.sections.push({pos:h,end:p.getTextPos(),kind:"emitHelpers",data:v.name}),i=!0;}}return i}}function Ue(t){var r=e.getEmitHelpers(t);return r&&e.stableSort(r,e.compareEmitHelpers)}function Ve(r,n){var i,a=Dr(r,t.neverAsciiEscape,n);!t.sourceMap&&!t.inlineSourceMap||10!==r.kind&&!e.isTemplateLiteralKind(r.kind)?(i=a,p.writeStringLiteral(i)):Vt(a);}function qe(e){p.rawWrite(e.parent.text.substring(e.pos,e.end));}function We(e){(e.symbol?qt:U)(xr(e,!1),e.symbol),zt(e,e.typeArguments,53776);}function He(e){(e.symbol?qt:U)(xr(e,!1),e.symbol);}function Ge(e){Rt(e,e.typeParameters),jt(e,e.parameters),At(e.type),Zt(),Ee(e.equalsGreaterThanToken);}function Qe(e){Fe(e.expression,oe.parenthesizeLeftSideOfAccess),Lt(e,e.typeArguments);}function Xe(t,r){et(18,t.pos,Wt,t);var n=r||1&e.getEmitFlags(t)?768:129;zt(t,t.statements,n),et(19,t.statements.end,Wt,t,!!(1&n));}function Ye(e){e?Wt(";"):Ht();}function Ze(e,t){var r=et(115,t,Gt,e);Zt(),et(20,r,Wt,e),Fe(e.expression),et(21,e.expression.end,Wt,e);}function $e(e){void 0!==e&&(255===e.kind?Ee(e):Fe(e));}function et(t,r,i,a,o){var s=e.getParseTreeNode(a),c=s&&s.kind===a.kind,l=r;if(c&&n&&(r=e.skipTrivia(n.text,r)),c&&a.pos!==l){var u=o&&n&&!e.positionsAreOnSameLine(l,r,n);u&&rr(),Qr(l),u&&nr();}if(r=or(t,i,r),c&&a.end!==r){var _=288===a.kind;Yr(r,!_,_);}return r}function tt(e){return 2===e.kind||!!e.hasTrailingNewLine}function rt(t){return !!n&&(!!e.some(e.getLeadingCommentRanges(n.text,t.pos),tt)||!!e.some(e.getSyntheticLeadingComments(t),tt)||!!e.isPartiallyEmittedExpression(t)&&(!(t.pos===t.expression.pos||!e.some(e.getTrailingCommentRanges(n.text,t.expression.pos),tt))||rt(t.expression)))}function nt(t){if(!re&&e.isPartiallyEmittedExpression(t)&&rt(t)){var r=e.getParseTreeNode(t);if(r&&e.isParenthesizedExpression(r)){var n=e.factory.createParenthesizedExpression(t.expression);return e.setOriginalNode(n,t),e.setTextRange(n,r),n}return e.factory.createParenthesizedExpression(t)}return t}function it(e){return nt(oe.parenthesizeExpressionForDisallowedComma(e))}function at(e){Mt(e,e.decorators),Ft(e,e.modifiers),Gt("function"),Ee(e.asteriskToken),Zt(),Ne(e.name),ot(e,st);}function ot(t,r){var n=t.body;if(n)if(e.isBlock(n)){var i=65536&e.getEmitFlags(t);i&&rr(),Sr(t),e.forEach(t.parameters,kr),kr(t.body),r(t),ct(n),Tr(t),i&&nr();}else r(t),Zt(),Fe(n,oe.parenthesizeConciseBodyOfArrowFunction);else r(t),Ht();}function st(e){Rt(e,e.typeParameters),Bt(e,e.parameters),At(e.type);}function ct(t){null==w||w(t),Zt(),Wt("{"),rr();var r=function(t){if(1&e.getEmitFlags(t))return !0;if(t.multiLine)return !1;if(!e.nodeIsSynthesized(t)&&n&&!e.rangeIsOnSingleLine(t,n))return !1;if(_r(t,t.statements,2)||pr(t,t.statements,2))return !1;for(var r,i=0,a=t.statements;i<a.length;i++){var o=a[i];if(dr(r,o,2)>0)return !1;r=o;}return !0}(t)?lt:ut;Ur(t,t.statements,r),nr(),ir(19,t.statements.end,Wt,t),null==I||I(t);}function lt(e){ut(e,!0);}function ut(e,t){var r=Tt(e.statements),n=p.getTextPos();Ke(e),0===r&&n===p.getTextPos()&&t?(nr(),zt(e,e.statements,768),rr()):zt(e,e.statements,1,void 0,r);}function _t(t){e.forEach(t.members,Er),Mt(t,t.decorators),Ft(t,t.modifiers),Gt("class"),t.name&&(Zt(),Ne(t.name));var r=65536&e.getEmitFlags(t);r&&rr(),Rt(t,t.typeParameters),zt(t,t.heritageClauses,0),Zt(),Wt("{"),zt(t,t.members,129),Wt("}"),r&&nr();}function dt(e){Wt("{"),zt(e,e.elements,525136),Wt("}");}function pt(e){e.isTypeOnly&&(Gt("type"),Zt()),e.propertyName&&(Ee(e.propertyName),Zt(),et(127,e.propertyName.end,Gt,e),Zt()),Ee(e.name);}function ft(e){79===e.kind?Fe(e):Ee(e);}function gt(t,r,i){var a=163969;1===r.length&&(!n||e.nodeIsSynthesized(t)||e.nodeIsSynthesized(r[0])||e.rangeStartPositionsAreOnSameLine(t,r[0],n))?(ir(58,i,Wt,t),Zt(),a&=-130):et(58,i,Wt,t),zt(t,r,a);}function mt(t){zt(t,e.factory.createNodeArray(t.jsDocPropertyTags),33);}function yt(t){t.typeParameters&&zt(t,e.factory.createNodeArray(t.typeParameters),33),t.parameters&&zt(t,e.factory.createNodeArray(t.parameters),33),t.type&&(tr(),Zt(),Wt("*"),Zt(),Ee(t.type));}function vt(e){Wt("@"),Ee(e);}function ht(t){var r=e.getTextOfJSDocComment(t);r&&(Zt(),U(r));}function bt(e){e&&(Zt(),Wt("{"),Ee(e.type),Wt("}"));}function xt(t){tr();var r=t.statements;0===r.length||!e.isPrologueDirective(r[0])||e.nodeIsSynthesized(r[0])?Ur(t,r,St):St(t);}function Dt(t,r,i,a){if(t){var o=p.getTextPos();Yt('/// <reference no-default-lib="true"/>'),V&&V.sections.push({pos:o,end:p.getTextPos(),kind:"no-default-lib"}),tr();}if(n&&n.moduleName&&(Yt('/// <amd-module name="'.concat(n.moduleName,'" />')),tr()),n&&n.amdDependencies)for(var s=0,c=n.amdDependencies;s<c.length;s++){var l=c[s];l.name?Yt('/// <amd-dependency name="'.concat(l.name,'" path="').concat(l.path,'" />')):Yt('/// <amd-dependency path="'.concat(l.path,'" />')),tr();}for(var u=0,_=r;u<_.length;u++){var d=_[u];o=p.getTextPos(),Yt('/// <reference path="'.concat(d.fileName,'" />')),V&&V.sections.push({pos:o,end:p.getTextPos(),kind:"reference",data:d.fileName}),tr();}for(var f=0,g=i;f<g.length;f++){d=g[f],o=p.getTextPos();var m=d.resolutionMode&&d.resolutionMode!==(null==n?void 0:n.impliedNodeFormat)?'resolution-mode="'.concat(d.resolutionMode===e.ModuleKind.ESNext?"import":"require",'"'):"";Yt('/// <reference types="'.concat(d.fileName,'" ').concat(m,"/>")),V&&V.sections.push({pos:o,end:p.getTextPos(),kind:d.resolutionMode?d.resolutionMode===e.ModuleKind.ESNext?"type-import":"type-require":"type",data:d.fileName}),tr();}for(var y=0,v=a;y<v.length;y++)d=v[y],o=p.getTextPos(),Yt('/// <reference lib="'.concat(d.fileName,'" />')),V&&V.sections.push({pos:o,end:p.getTextPos(),kind:"lib",data:d.fileName}),tr();}function St(t){var r=t.statements;Sr(t),e.forEach(t.statements,kr),Ke(t);var n=e.findIndex(r,(function(t){return !e.isPrologueDirective(t)}));!function(e){e.isDeclarationFile&&Dt(e.hasNoDefaultLib,e.referencedFiles,e.typeReferenceDirectives,e.libReferenceDirectives);}(t),zt(t,r,1,void 0,-1===n?r.length:n),Tr(t);}function Tt(t,r,n,i){for(var a=!!r,o=0;o<t.length;o++){var s=t[o];if(!e.isPrologueDirective(s))return o;if(!n||!n.has(s.expression.text)){a&&(a=!1,Se(r)),tr();var c=p.getTextPos();Ee(s),i&&V&&V.sections.push({pos:c,end:p.getTextPos(),kind:"prologue",data:s.expression.text}),n&&n.add(s.expression.text);}}return t.length}function Ct(e,t){for(var r=0,n=e;r<n.length;r++){var i=n[r];if(!t.has(i.data)){tr();var a=p.getTextPos();Ee(i),V&&V.sections.push({pos:a,end:p.getTextPos(),kind:"prologue",data:i.data}),t&&t.add(i.data);}}}function kt(t){if(e.isSourceFile(t))Tt(t.statements,t);else {for(var r=new e.Set,n=0,i=t.prepends;n<i.length;n++)Ct(i[n].prologues,r);for(var a=0,o=t.sourceFiles;a<o.length;a++){var s=o[a];Tt(s.statements,s,r,!0);}Se(void 0);}}function Et(t){if(e.isSourceFile(t)||e.isUnparsedSource(t)){var r=e.getShebang(t.text);if(r)return Yt(r),tr(),!0}else {for(var n=0,i=t.prepends;n<i.length;n++){var a=i[n];if(e.Debug.assertNode(a,e.isUnparsedSource),Et(a))return !0}for(var o=0,s=t.sourceFiles;o<s.length;o++)if(Et(s[o]))return !0}}function Nt(e,t){if(e){var r=U;U=t,Ee(e),U=r;}}function Ft(e,t){t&&t.length&&(zt(e,t,262656),Zt());}function At(e){e&&(Wt(":"),Zt(),Ee(e));}function Pt(e,t,r,n){e&&(Zt(),et(63,t,Qt,r),Zt(),Fe(e,n));}function wt(e){e&&(Zt(),Ee(e));}function It(e,t){e&&(Zt(),Fe(e,t));}function Ot(t,r){e.isBlock(r)||1&e.getEmitFlags(t)?(Zt(),Ee(r)):(tr(),rr(),e.isEmptyStatement(r)?Ie(5,r):Ee(r),nr());}function Mt(e,t){zt(e,t,2146305);}function Lt(e,t){zt(e,t,53776,se);}function Rt(t,r){if(e.isFunctionLike(t)&&t.typeArguments)return Lt(t,t.typeArguments);zt(t,r,53776);}function Bt(e,t){zt(e,t,2576);}function jt(t,r){!function(t,r){var n=e.singleOrUndefined(r);return n&&n.pos===t.pos&&e.isArrowFunction(t)&&!t.type&&!e.some(t.decorators)&&!e.some(t.modifiers)&&!e.some(t.typeParameters)&&!e.some(n.decorators)&&!e.some(n.modifiers)&&!n.dotDotDotToken&&!n.questionToken&&!n.type&&!n.initializer&&e.isIdentifier(n.name)}(t,r)?Bt(t,r):zt(t,r,528);}function Jt(e){switch(60&e){case 0:break;case 16:Wt(",");break;case 4:Zt(),Wt("|");break;case 32:Zt(),Wt("*"),Zt();break;case 8:Zt(),Wt("&");}}function zt(e,t,r,n,i,a){Ut(Ee,e,t,r,n,i,a);}function Kt(e,t,r,n,i,a){Ut(Fe,e,t,r,n,i,a);}function Ut(t,r,a,o,s,c,l){if(void 0===c&&(c=0),void 0===l&&(l=a?a.length-c:0),!(void 0===a&&16384&o)){var u=void 0===a||c>=a.length||0===l;if(u&&32768&o)return O&&O(a),void(M&&M(a));if(15360&o&&(Wt(function(e){return i[15360&e][0]}(o)),u&&a&&Yr(a.pos,!0)),O&&O(a),u)!(1&o)||K&&(!r||n&&e.rangeIsOnSingleLine(r,n))?256&o&&!(524288&o)&&Zt():tr();else {e.Debug.type(a);var _=0==(262144&o),p=_,f=_r(r,a,o);f?(tr(f),p=!1):256&o&&Zt(),128&o&&rr();for(var g=function(e,t){return 1===e.length?S:"object"==typeof t?T:C}(t,s),m=void 0,y=void 0,v=!1,h=0;h<l;h++){var b=a[c+h];if(32&o)tr(),Jt(o);else if(m){60&o&&m.end!==(r?r.end:-1)&&Qr(m.end),Jt(o),me(y);var x=dr(m,b,o);x>0?(0==(131&o)&&(rr(),v=!0),tr(x),p=!1):m&&512&o&&Zt();}y=ge(b),p?Yr(e.getCommentRange(b).pos):p=_,d=b.pos,g(b,t,s,h),v&&(nr(),v=!1),m=b;}var D=m?e.getEmitFlags(m):0,k=re||!!(1024&D),E=(null==a?void 0:a.hasTrailingComma)&&64&o&&16&o;E&&(m&&!k?et(27,m.end,Wt,m):Wt(",")),m&&(r?r.end:-1)!==m.end&&60&o&&!k&&Qr(E&&(null==a?void 0:a.end)?a.end:m.end),128&o&&nr(),me(y);var N=pr(r,a,o);N?tr(N):2097408&o&&Zt();}M&&M(a),15360&o&&(u&&a&&Qr(a.end),Wt(function(e){return i[15360&e][1]}(o)));}}function Vt(e){p.writeLiteral(e);}function qt(e,t){p.writeSymbol(e,t);}function Wt(e){p.writePunctuation(e);}function Ht(){p.writeTrailingSemicolon(";");}function Gt(e){p.writeKeyword(e);}function Qt(e){p.writeOperator(e);}function Xt(e){p.writeParameter(e);}function Yt(e){p.writeComment(e);}function Zt(){p.writeSpace(" ");}function $t(e){p.writeProperty(e);}function er(e){p.nonEscapingWrite?p.nonEscapingWrite(e):p.write(e);}function tr(e){void 0===e&&(e=1);for(var t=0;t<e;t++)p.writeLine(t>0);}function rr(){p.increaseIndent();}function nr(){p.decreaseIndent();}function ir(t,r,n,i){return Q?or(t,n,r):function(t,r,n,i,a){if(Q||t&&e.isInJsonFile(t))return a(r,n,i);var o=t&&t.emitNode,s=o&&o.flags||0,c=o&&o.tokenSourceMapRanges&&o.tokenSourceMapRanges[r],l=c&&c.source||y;return i=cn(l,c?c.pos:i),0==(128&s)&&i>=0&&un(l,i),i=a(r,n,i),c&&(i=c.end),0==(256&s)&&i>=0&&un(l,i),i}(i,t,n,r,or)}function ar(t,r){L&&L(t),r(e.tokenToString(t.kind)),R&&R(t);}function or(t,r,n){var i=e.tokenToString(t);return r(i),n<0?n:n+i.length}function sr(t,r,n){if(1&e.getEmitFlags(t))Zt();else if(K){var i=vr(t,r,n);i?tr(i):Zt();}else tr();}function cr(t){for(var r=t.split(/\r\n?|\n/g),n=e.guessIndentation(r),i=0,a=r;i<a.length;i++){var o=a[i],s=n?o.slice(n):o;s.length&&(tr(),U(s));}}function lr(e,t){e?(rr(),tr(e)):t&&Zt();}function ur(e,t){e&&nr(),t&&nr();}function _r(t,r,i){if(2&i||K){if(65536&i)return 1;var a=r[0];if(void 0===a)return !t||n&&e.rangeIsOnSingleLine(t,n)?0:1;if(a.pos===d)return 0;if(11===a.kind)return 0;if(n&&t&&!e.positionIsSynthesized(t.pos)&&!e.nodeIsSynthesized(a)&&(!a.parent||e.getOriginalNode(a.parent)===e.getOriginalNode(t)))return K?fr((function(r){return e.getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(a.pos,t.pos,n,r)})):e.rangeStartPositionsAreOnSameLine(t,a,n)?0:1;if(yr(a,i))return 1}return 1&i?1:0}function dr(t,r,i){if(2&i||K){if(void 0===t||void 0===r)return 0;if(11===r.kind)return 0;if(n&&!e.nodeIsSynthesized(t)&&!e.nodeIsSynthesized(r))return K&&function(t,r){if(r.pos<t.end)return !1;t=e.getOriginalNode(t),r=e.getOriginalNode(r);var n=t.parent;if(!n||n!==r.parent)return !1;var i=e.getContainingNodeArray(t),a=null==i?void 0:i.indexOf(t);return void 0!==a&&a>-1&&i.indexOf(r)===a+1}(t,r)?fr((function(i){return e.getLinesBetweenRangeEndAndRangeStart(t,r,n,i)})):!K&&(a=t,o=r,(a=e.getOriginalNode(a)).parent&&a.parent===e.getOriginalNode(o).parent)?e.rangeEndIsOnSameLineAsRangeStart(t,r,n)?0:1:65536&i?1:0;if(yr(t,i)||yr(r,i))return 1}else if(e.getStartsOnNewLine(r))return 1;var a,o;return 1&i?1:0}function pr(t,r,i){if(2&i||K){if(65536&i)return 1;var a=e.lastOrUndefined(r);if(void 0===a)return !t||n&&e.rangeIsOnSingleLine(t,n)?0:1;if(n&&t&&!e.positionIsSynthesized(t.pos)&&!e.nodeIsSynthesized(a)&&(!a.parent||a.parent===t)){if(K){var o=e.isNodeArray(r)&&!e.positionIsSynthesized(r.end)?r.end:a.end;return fr((function(r){return e.getLinesBetweenPositionAndNextNonWhitespaceCharacter(o,t.end,n,r)}))}return e.rangeEndPositionsAreOnSameLine(t,a,n)?0:1}if(yr(a,i))return 1}return 1&i&&!(131072&i)?1:0}function fr(t){e.Debug.assert(!!K);var r=t(!0);return 0===r?t(!1):r}function gr(e,t){var r=K&&_r(t,[e],0);return r&&lr(r,!1),!!r}function mr(e,t){var r=K&&pr(t,[e],0);r&&tr(r);}function yr(t,r){if(e.nodeIsSynthesized(t)){var n=e.getStartsOnNewLine(t);return void 0===n?0!=(65536&r):n}return 0!=(65536&r)}function vr(t,r,i){return 131072&e.getEmitFlags(t)?0:(t=br(t),r=br(r),i=br(i),e.getStartsOnNewLine(i)?1:!n||e.nodeIsSynthesized(t)||e.nodeIsSynthesized(r)||e.nodeIsSynthesized(i)?0:K?fr((function(t){return e.getLinesBetweenRangeEndAndRangeStart(r,i,n,t)})):e.rangeEndIsOnSameLineAsRangeStart(r,i,n)?0:1)}function hr(t){return 0===t.statements.length&&(!n||e.rangeEndIsOnSameLineAsRangeStart(t,t,n))}function br(t){for(;212===t.kind&&e.nodeIsSynthesized(t);)t=t.expression;return t}function xr(t,r){if(e.isGeneratedIdentifier(t))return Fr(t);if(e.isStringLiteral(t)&&t.textSourceNode)return xr(t.textSourceNode,r);var i=n,a=!!i&&!!t.parent&&!e.nodeIsSynthesized(t);if(e.isMemberName(t)){if(!a||e.getSourceFileOfNode(t)!==e.getOriginalNode(i))return e.idText(t)}else if(e.Debug.assertNode(t,e.isLiteralExpression),!a)return t.text;return e.getSourceTextOfNodeFromSourceFile(i,t,r)}function Dr(r,i,a){if(10===r.kind&&r.textSourceNode){var o=r.textSourceNode;if(e.isIdentifier(o)||e.isNumericLiteral(o)){var s=e.isNumericLiteral(o)?o.text:xr(o);return a?'"'.concat(e.escapeJsxAttributeString(s),'"'):i||16777216&e.getEmitFlags(r)?'"'.concat(e.escapeString(s),'"'):'"'.concat(e.escapeNonAsciiString(s),'"')}return Dr(o,i,a)}var c=(i?1:0)|(a?2:0)|(t.terminateUnterminatedLiterals?4:0)|(t.target&&99===t.target?8:0);return e.getLiteralText(r,n,c)}function Sr(t){t&&524288&e.getEmitFlags(t)||(c.push(l),l=0,u.push(_));}function Tr(t){t&&524288&e.getEmitFlags(t)||(l=c.pop(),_=u.pop());}function Cr(t){_&&_!==e.lastOrUndefined(u)||(_=new e.Set),_.add(t);}function kr(t){if(t)switch(t.kind){case 235:e.forEach(t.statements,kr);break;case 250:case 248:case 240:case 241:kr(t.statement);break;case 239:kr(t.thenStatement),kr(t.elseStatement);break;case 242:case 244:case 243:kr(t.initializer),kr(t.statement);break;case 249:kr(t.caseBlock);break;case 263:e.forEach(t.clauses,kr);break;case 289:case 290:e.forEach(t.statements,kr);break;case 252:kr(t.tryBlock),kr(t.catchClause),kr(t.finallyBlock);break;case 292:kr(t.variableDeclaration),kr(t.block);break;case 237:kr(t.declarationList);break;case 255:e.forEach(t.declarations,kr);break;case 254:case 164:case 203:case 257:Nr(t.name);break;case 256:Nr(t.name),524288&e.getEmitFlags(t)&&(e.forEach(t.parameters,kr),kr(t.body));break;case 201:case 202:e.forEach(t.elements,kr);break;case 266:kr(t.importClause);break;case 267:Nr(t.name),kr(t.namedBindings);break;case 268:case 274:Nr(t.name);break;case 269:e.forEach(t.elements,kr);break;case 270:Nr(t.propertyName||t.name);}}function Er(e){if(e)switch(e.kind){case 296:case 297:case 167:case 169:case 172:case 173:Nr(e.name);}}function Nr(t){t&&(e.isGeneratedIdentifier(t)?Fr(t):e.isBindingPattern(t)&&kr(t));}function Fr(t){if(4==(7&t.autoGenerateFlags))return Ar(function(t){for(var r=t.autoGenerateId,n=t,i=n.original;i&&(n=i,!(e.isIdentifier(n)&&4&n.autoGenerateFlags&&n.autoGenerateId!==r));)i=n.original;return n}(t),t.autoGenerateFlags);var r=t.autoGenerateId;return o[r]||(o[r]=function(t){switch(7&t.autoGenerateFlags){case 1:return Ir(0,!!(8&t.autoGenerateFlags));case 2:return Ir(268435456,!!(8&t.autoGenerateFlags));case 3:return Or(e.idText(t),32&t.autoGenerateFlags?wr:Pr,!!(16&t.autoGenerateFlags),!!(8&t.autoGenerateFlags))}return e.Debug.fail("Unsupported GeneratedIdentifierKind.")}(t))}function Ar(t,r){var n=e.getNodeId(t);return a[n]||(a[n]=function(t,r){switch(t.kind){case 79:return Or(xr(t),Pr,!!(16&r),!!(8&r));case 261:case 260:return function(t){var r=xr(t.name);return function(t,r){for(var n=r;e.isNodeDescendantOf(n,r);n=n.nextContainer)if(n.locals){var i=n.locals.get(e.escapeLeadingUnderscores(t));if(i&&3257279&i.flags)return !1}return !0}(r,t)?r:Or(r)}(t);case 266:case 272:return function(t){var r=e.getExternalModuleName(t);return Or(e.isStringLiteral(r)?e.makeIdentifierFromModuleName(r.text):"module")}(t);case 256:case 257:case 271:return Or("default");case 226:return Or("class");case 169:case 172:case 173:return function(t){return e.isIdentifier(t.name)?Ar(t.name):Ir(0)}(t);case 162:return Ir(0,!0);default:return Ir(0)}}(t,r))}function Pr(e){return wr(e)&&!s.has(e)&&!(_&&_.has(e))}function wr(t){return !n||e.isFileLevelUniqueName(n,t,k)}function Ir(e,t){if(e&&!(l&e)&&Pr(r=268435456===e?"_i":"_n"))return l|=e,t&&Cr(r),r;for(;;){var r,n=268435455&l;if(l++,8!==n&&13!==n&&Pr(r=n<26?"_"+String.fromCharCode(97+n):"_"+(n-26)))return t&&Cr(r),r}}function Or(e,t,r,n){if(void 0===t&&(t=Pr),r&&t(e))return n?Cr(e):s.add(e),e;95!==e.charCodeAt(e.length-1)&&(e+="_");for(var i=1;;){var a=e+i;if(t(a))return n?Cr(a):s.add(a),a;i++;}}function Mr(e){return Or(e,wr,!0)}function Lr(e,t){var r=Re(2,e,t),n=Z,i=$,a=ee;Rr(t),r(e,t),Br(t,n,i,a);}function Rr(t){var r=e.getEmitFlags(t),n=e.getCommentRange(t);!function(t,r,n,i){ie(),te=!1;var a=n<0||0!=(512&r)||11===t.kind,o=i<0||0!=(1024&r)||11===t.kind;(n>0||i>0)&&n!==i&&(a||Vr(n,349!==t.kind),(!a||n>=0&&0!=(512&r))&&(Z=n),(!o||i>=0&&0!=(1024&r))&&($=i,255===t.kind&&(ee=i))),e.forEach(e.getSyntheticLeadingComments(t),Jr),ae();}(t,r,n.pos,n.end),2048&r&&(re=!0);}function Br(t,r,n,i){var a=e.getEmitFlags(t),o=e.getCommentRange(t);2048&a&&(re=!1),jr(t,a,o.pos,o.end,r,n,i);var s=e.getTypeNode(t);s&&jr(t,a,s.pos,s.end,r,n,i);}function jr(t,r,n,i,a,o,s){ie();var c=i<0||0!=(1024&r)||11===t.kind;e.forEach(e.getSyntheticTrailingComments(t),zr),(n>0||i>0)&&n!==i&&(Z=a,$=o,ee=s,c||349===t.kind||function(e){tn(e,Xr);}(i)),ae();}function Jr(e){(e.hasLeadingNewline||2===e.kind)&&p.writeLine(),Kr(e),e.hasTrailingNewLine||2===e.kind?p.writeLine():p.writeSpace(" ");}function zr(e){p.isAtStartOfLine()||p.writeSpace(" "),Kr(e),e.hasTrailingNewLine&&p.writeLine();}function Kr(t){var r=function(e){return 3===e.kind?"/*".concat(e.text,"*/"):"//".concat(e.text)}(t),n=3===t.kind?e.computeLineStarts(r):void 0;e.writeCommentRange(r,n,p,0,r.length,j);}function Ur(t,r,i){ie();var a,o,s=r.pos,c=r.end,l=e.getEmitFlags(t),u=re||c<0||0!=(1024&l);s<0||0!=(512&l)||(a=r,(o=n&&e.emitDetachedComments(n.text,ke(),p,rn,a,j,re))&&(b?b.push(o):b=[o])),ae(),2048&l&&!re?(re=!0,i(t),re=!1):i(t),ie(),u||(Vr(r.end,!0),te&&!p.isAtStartOfLine()&&p.writeLine()),ae();}function Vr(e,t){te=!1,t?0===e&&(null==n?void 0:n.isDeclarationFile)?en(e,Wr):en(e,Gr):0===e&&en(e,qr);}function qr(e,t,r,n,i){nn(e,t)&&Gr(e,t,r,n,i);}function Wr(e,t,r,n,i){nn(e,t)||Gr(e,t,r,n,i);}function Hr(r,n){return !t.onlyPrintJsDocStyle||e.isJSDocLikeText(r,n)||e.isPinnedComment(r,n)}function Gr(t,r,i,a,o){n&&Hr(n.text,t)&&(te||(e.emitNewLineBeforeLeadingCommentOfPosition(ke(),p,o,t),te=!0),ln(t),e.writeCommentRange(n.text,ke(),p,t,r,j),ln(r),a?p.writeLine():3===i&&p.writeSpace(" "));}function Qr(e){re||-1===e||Vr(e,!0);}function Xr(t,r,i,a){n&&Hr(n.text,t)&&(p.isAtStartOfLine()||p.writeSpace(" "),ln(t),e.writeCommentRange(n.text,ke(),p,t,r,j),ln(r),a&&p.writeLine());}function Yr(e,t,r){re||(ie(),tn(e,t?Xr:r?Zr:$r),ae());}function Zr(t,r,i){n&&(ln(t),e.writeCommentRange(n.text,ke(),p,t,r,j),ln(r),2===i&&p.writeLine());}function $r(t,r,i,a){n&&(ln(t),e.writeCommentRange(n.text,ke(),p,t,r,j),ln(r),a?p.writeLine():p.writeSpace(" "));}function en(t,r){!n||-1!==Z&&t===Z||(function(t){return void 0!==b&&e.last(b).nodePos===t}(t)?function(t){if(n){var r=e.last(b).detachedCommentEndPos;b.length-1?b.pop():b=void 0,e.forEachLeadingCommentRange(n.text,r,t,r);}}(r):e.forEachLeadingCommentRange(n.text,t,r,t));}function tn(t,r){n&&(-1===$||t!==$&&t!==ee)&&e.forEachTrailingCommentRange(n.text,t,r);}function rn(t,r,i,a,o,s){n&&Hr(n.text,a)&&(ln(a),e.writeCommentRange(t,r,i,a,o,s),ln(o));}function nn(t,r){return !!n&&e.isRecognizedTripleSlashComment(n.text,t,r)}function an(e,t){var r=Re(3,e,t);on(t),r(e,t),sn(t);}function on(t){var r=e.getEmitFlags(t),n=e.getSourceMapRange(t);if(e.isUnparsedNode(t)){e.Debug.assertIsDefined(t.parent,"UnparsedNodes must have parent pointers");var i=function(t){return void 0===t.parsedSourceMap&&void 0!==t.sourceMapText&&(t.parsedSourceMap=e.tryParseRawSourceMap(t.sourceMapText)||!1),t.parsedSourceMap||void 0}(t.parent);i&&m&&m.appendSourceMap(p.getLine(),p.getColumn(),i,t.parent.sourceMapPath,t.parent.getLineAndCharacterOfPosition(t.pos),t.parent.getLineAndCharacterOfPosition(t.end));}else {var a=n.source||y;349!==t.kind&&0==(16&r)&&n.pos>=0&&un(n.source||y,cn(a,n.pos)),64&r&&(Q=!0);}}function sn(t){var r=e.getEmitFlags(t),n=e.getSourceMapRange(t);e.isUnparsedNode(t)||(64&r&&(Q=!1),349!==t.kind&&0==(32&r)&&n.end>=0&&un(n.source||y,n.end));}function cn(t,r){return t.skipTrivia?t.skipTrivia(r):e.skipTrivia(t.text,r)}function ln(t){if(!(Q||e.positionIsSynthesized(t)||dn(y))){var r=e.getLineAndCharacterOfPosition(y,t),n=r.line,i=r.character;m.addMapping(p.getLine(),p.getColumn(),X,n,i,void 0);}}function un(e,t){if(e!==y){var r=y,n=X;_n(e),ln(t),function(e,t){y=e,X=t;}(r,n);}else ln(t);}function _n(e){Q||(y=e,e!==v?dn(e)||(X=m.addSource(e.fileName),t.inlineSources&&m.setSourceContent(X,e.text),v=e,Y=X):X=Y);}function dn(t){return e.fileExtensionIs(t.fileName,".json")}}function S(e,t,r,n){t(e);}function T(e,t,r,n){t(e,r.select(n));}function C(e,t,r,n){t(e,r);}e.isBuildInfoFile=function(t){return e.fileExtensionIs(t,".tsbuildinfo")},e.forEachEmittedFile=a,e.getTsBuildInfoEmitOutputFilePath=o,e.getOutputPathsForBundle=s,e.getOutputPathsFor=c,e.getOutputExtension=u,e.getOutputDeclarationFileName=d,e.getCommonSourceDirectory=y,e.getCommonSourceDirectoryOfConfig=v,e.getAllProjectOutputs=function(t,r){var n=f(),i=n.addOutput,a=n.getOutputs;if(e.outFile(t.options))g(t,i);else {for(var s=e.memoize((function(){return v(t,r)})),c=0,l=t.fileNames;c<l.length;c++){var u=l[c];m(t,u,r,i,s);}i(o(t.options));}return a()},e.getOutputFileNames=function(t,r,n){r=e.normalizePath(r),e.Debug.assert(e.contains(t.fileNames,r),"Expected fileName to be present in command line");var i=f(),a=i.addOutput,o=i.getOutputs;return e.outFile(t.options)?g(t,a):m(t,r,n,a),o()},e.getFirstProjectOutput=function(t,r){if(e.outFile(t.options)){var n=s(t.options,!1).jsFilePath;return e.Debug.checkDefined(n,"project ".concat(t.options.configFilePath," expected to have at least one output"))}for(var i=e.memoize((function(){return v(t,r)})),a=0,c=t.fileNames;a<c.length;a++){var l=c[a];if(!e.isDeclarationFileName(l)){if(n=p(l,t,r,i))return n;if(!e.fileExtensionIs(l,".json")&&e.getEmitDeclarations(t.options))return d(l,t,r,i)}}return o(t.options)||e.Debug.fail("project ".concat(t.options.configFilePath," expected to have at least one output"))},e.emitFiles=h,e.getBuildInfoText=b,e.getBuildInfo=x,e.notImplementedResolver={hasGlobalName:e.notImplemented,getReferencedExportContainer:e.notImplemented,getReferencedImportDeclaration:e.notImplemented,getReferencedDeclarationWithCollidingName:e.notImplemented,isDeclarationWithCollidingName:e.notImplemented,isValueAliasDeclaration:e.notImplemented,isReferencedAliasDeclaration:e.notImplemented,isTopLevelValueImportEqualsWithEntityName:e.notImplemented,getNodeCheckFlags:e.notImplemented,isDeclarationVisible:e.notImplemented,isLateBound:function(e){return !1},collectLinkedAliases:e.notImplemented,isImplementationOfOverload:e.notImplemented,isRequiredInitializedParameter:e.notImplemented,isOptionalUninitializedParameterProperty:e.notImplemented,isExpandoFunctionDeclaration:e.notImplemented,getPropertiesOfContainerFunction:e.notImplemented,createTypeOfDeclaration:e.notImplemented,createReturnTypeOfSignatureDeclaration:e.notImplemented,createTypeOfExpression:e.notImplemented,createLiteralConstValue:e.notImplemented,isSymbolAccessible:e.notImplemented,isEntityNameVisible:e.notImplemented,getConstantValue:e.notImplemented,getReferencedValueDeclaration:e.notImplemented,getTypeReferenceSerializationKind:e.notImplemented,isOptionalParameter:e.notImplemented,moduleExportsSomeValue:e.notImplemented,isArgumentsLocalBinding:e.notImplemented,getExternalModuleFileFromDeclaration:e.notImplemented,getTypeReferenceDirectivesForEntityName:e.notImplemented,getTypeReferenceDirectivesForSymbol:e.notImplemented,isLiteralConstDeclaration:e.notImplemented,getJsxFactoryEntity:e.notImplemented,getJsxFragmentFactoryEntity:e.notImplemented,getAllAccessorDeclarations:e.notImplemented,getSymbolOfExternalModuleSpecifier:e.notImplemented,isBindingCapturedByNode:e.notImplemented,getDeclarationStatementsForSourceFile:e.notImplemented,isImportRequiredByAugmentation:e.notImplemented},e.emitUsingBuildInfo=function(t,r,i,a){var o=s(t.options,!1),c=o.buildInfoPath,l=o.jsFilePath,u=o.sourceMapFilePath,_=o.declarationFilePath,d=o.declarationMapPath,p=r.readFile(e.Debug.checkDefined(c));if(!p)return c;var f=r.readFile(e.Debug.checkDefined(l));if(!f)return l;var g=u&&r.readFile(u);if(u&&!g||t.options.inlineSourceMap)return u||"inline sourcemap decoding";var m=_&&r.readFile(_);if(_&&!m)return _;var y=d&&r.readFile(d);if(d&&!y||t.options.inlineSourceMap)return d||"inline sourcemap decoding";var v=x(p);if(!v.bundle||!v.bundle.js||m&&!v.bundle.dts)return c;var D=e.getDirectoryPath(e.getNormalizedAbsolutePath(c,r.getCurrentDirectory())),S=e.createInputFiles(f,m,u,g,d,y,l,_,c,v,!0),T=[],C=e.createPrependNodes(t.projectReferences,i,(function(e){return r.readFile(e)})),k=function(t,r,n){var i,a=e.Debug.checkDefined(t.js),o=(null===(i=a.sources)||void 0===i?void 0:i.prologues)&&e.arrayToMap(a.sources.prologues,(function(e){return e.file}));return t.sourceFiles.map((function(t,i){var a,s,c=null==o?void 0:o.get(i),l=null==c?void 0:c.directives.map((function(t){var r=e.setTextRange(e.factory.createStringLiteral(t.expression.text),t.expression),n=e.setTextRange(e.factory.createExpressionStatement(r),t);return e.setParent(r,n),n})),u=e.factory.createToken(1),_=e.factory.createSourceFile(null!=l?l:[],u,0);return _.fileName=e.getRelativePathFromDirectory(n.getCurrentDirectory(),e.getNormalizedAbsolutePath(t,r),!n.useCaseSensitiveFileNames()),_.text=null!==(a=null==c?void 0:c.text)&&void 0!==a?a:"",e.setTextRangePosWidth(_,0,null!==(s=null==c?void 0:c.text.length)&&void 0!==s?s:0),e.setEachParent(_.statements,_),e.setTextRangePosWidth(u,_.end,0),e.setParent(u,_),_}))}(v.bundle,D,r),E={getPrependNodes:e.memoize((function(){return n$4(n$4([],C,!0),[S],!1)})),getCanonicalFileName:r.getCanonicalFileName,getCommonSourceDirectory:function(){return e.getNormalizedAbsolutePath(v.bundle.commonSourceDirectory,D)},getCompilerOptions:function(){return t.options},getCurrentDirectory:function(){return r.getCurrentDirectory()},getNewLine:function(){return r.getNewLine()},getSourceFile:e.returnUndefined,getSourceFileByPath:e.returnUndefined,getSourceFiles:function(){return k},getLibFileFromReference:e.notImplemented,isSourceFileFromExternalLibrary:e.returnFalse,getResolvedProjectReferenceToRedirect:e.returnUndefined,getProjectReferenceRedirect:e.returnUndefined,isSourceOfProjectReferenceRedirect:e.returnFalse,writeFile:function(t,r,n){switch(t){case l:if(f===r)return;break;case u:if(g===r)return;break;case c:var i=x(r);i.program=v.program;var a=v.bundle,o=a.js,s=a.dts,p=a.sourceFiles;return i.bundle.js.sources=o.sources,s&&(i.bundle.dts.sources=s.sources),i.bundle.sourceFiles=p,void T.push({name:t,text:b(i),writeByteOrderMark:n});case _:if(m===r)return;break;case d:if(y===r)return;break;default:e.Debug.fail("Unexpected path: ".concat(t));}T.push({name:t,text:r,writeByteOrderMark:n});},isEmitBlocked:e.returnFalse,readFile:function(e){return r.readFile(e)},fileExists:function(e){return r.fileExists(e)},useCaseSensitiveFileNames:function(){return r.useCaseSensitiveFileNames()},getProgramBuildInfo:e.returnUndefined,getSourceFileFromReference:e.returnUndefined,redirectTargetsMap:e.createMultiMap(),getFileIncludeReasons:e.notImplemented};return h(e.notImplementedResolver,E,void 0,e.getTransformers(t.options,a)),T},function(e){e[e.Notification=0]="Notification",e[e.Substitution=1]="Substitution",e[e.Comments=2]="Comments",e[e.SourceMaps=3]="SourceMaps",e[e.Emit=4]="Emit";}(t||(t={})),e.createPrinter=D,function(e){e[e.Auto=0]="Auto",e[e.CountMask=268435455]="CountMask",e[e._i=268435456]="_i";}(r||(r={}));}(t),function(e){var t,r;function i(e){e.watcher.close();}e.createCachedDirectoryStructureHost=function(t,r,n){if(t.getDirectories&&t.readDirectory){var i=new e.Map,a=e.createGetCanonicalFileName(n);return {useCaseSensitiveFileNames:n,fileExists:function(e){var r=c(o(e));return r&&d(r.files,l(e))||t.fileExists(e)},readFile:function(e,r){return t.readFile(e,r)},directoryExists:t.directoryExists&&function(r){var n=o(r);return i.has(e.ensureTrailingDirectorySeparator(n))||t.directoryExists(r)},getDirectories:function(e){var r=u(e,o(e));return r?r.directories.slice():t.getDirectories(e)},readDirectory:function(i,a,s,c,_){var d,p=o(i),g=u(i,p);return void 0!==g?e.matchFiles(i,a,s,c,n,r,_,(function(t){var r=o(t);if(r===p)return g||m(t,r);var n=u(t,r);return void 0!==n?n||m(t,r):e.emptyFileSystemEntries}),f):t.readDirectory(i,a,s,c,_);function m(r,n){if(d&&n===p)return d;var i={files:e.map(t.readDirectory(r,void 0,void 0,["*.*"]),l)||e.emptyArray,directories:t.getDirectories(r)||e.emptyArray};return n===p&&(d=i),i}},createDirectory:t.createDirectory&&function(e){var r=c(o(e)),n=l(e);r&&p(r.directories,n,!0),t.createDirectory(e);},writeFile:t.writeFile&&function(e,r,n){var i=c(o(e));return i&&g(i,l(e),!0),t.writeFile(e,r,n)},addOrDeleteFileOrDirectory:function(e,r){if(void 0===s(r)){var n=c(r);if(n){if(t.directoryExists){var i=l(e),a={fileExists:t.fileExists(r),directoryExists:t.directoryExists(r)};return a.directoryExists||d(n.directories,i)?m():g(n,i,a.fileExists),a}m();}}else m();},addOrDeleteFile:function(t,r,n){if(n!==e.FileWatcherEventKind.Changed){var i=c(r);i&&g(i,l(t),n===e.FileWatcherEventKind.Created);}},clearCache:m,realpath:t.realpath&&f}}function o(t){return e.toPath(t,r,a)}function s(t){return i.get(e.ensureTrailingDirectorySeparator(t))}function c(t){return s(e.getDirectoryPath(t))}function l(t){return e.getBaseFileName(e.normalizePath(t))}function u(r,n){var a=s(n=e.ensureTrailingDirectorySeparator(n));if(a)return a;try{return function(r,n){var a;if(!t.realpath||e.ensureTrailingDirectorySeparator(o(t.realpath(r)))===n){var s={files:e.map(t.readDirectory(r,void 0,void 0,["*.*"]),l)||[],directories:t.getDirectories(r)||[]};return i.set(e.ensureTrailingDirectorySeparator(n),s),s}if(null===(a=t.directoryExists)||void 0===a?void 0:a.call(t,r))return i.set(n,!1),!1}(r,n)}catch(t){return void e.Debug.assert(!i.has(e.ensureTrailingDirectorySeparator(n)))}}function _(e,t){return a(e)===a(t)}function d(t,r){return e.some(t,(function(e){return _(e,r)}))}function p(t,r,n){if(d(t,r)){if(!n)return e.filterMutate(t,(function(e){return !_(e,r)}))}else if(n)return t.push(r)}function f(e){return t.realpath?t.realpath(e):e}function g(e,t,r){p(e.files,t,r);}function m(){i.clear();}},(r=e.ConfigFileProgramReloadLevel||(e.ConfigFileProgramReloadLevel={}))[r.None=0]="None",r[r.Partial=1]="Partial",r[r.Full=2]="Full",e.updateSharedExtendedConfigFileWatcher=function(t,r,n,i,a){var o,s=e.arrayToMap((null===(o=null==r?void 0:r.configFile)||void 0===o?void 0:o.extendedSourceFiles)||e.emptyArray,a);n.forEach((function(e,r){s.has(r)||(e.projects.delete(t),e.close());})),s.forEach((function(r,a){var o=n.get(a);o?o.projects.add(t):n.set(a,{projects:new e.Set([t]),watcher:i(r,a),close:function(){var e=n.get(a);e&&0===e.projects.size&&(e.watcher.close(),n.delete(a));}});}));},e.clearSharedExtendedConfigFileWatcher=function(e,t){t.forEach((function(t){t.projects.delete(e)&&t.close();}));},e.cleanExtendedConfigCache=function e(t,r,n){t.delete(r)&&t.forEach((function(i,a){var o;(null===(o=i.extendedResult.extendedSourceFiles)||void 0===o?void 0:o.some((function(e){return n(e)===r})))&&e(t,a,n);}));},e.updatePackageJsonWatch=function(t,r,n){var i=new e.Map(t);e.mutateMap(r,i,{createNewValue:n,onDeleteValue:e.closeFileWatcher});},e.updateMissingFilePathsWatch=function(t,r,n){var i=t.getMissingFilePaths(),a=e.arrayToMap(i,e.identity,e.returnTrue);e.mutateMap(r,a,{createNewValue:n,onDeleteValue:e.closeFileWatcher});},e.updateWatchingWildcardDirectories=function(t,r,n){function a(e,t){return {watcher:n(e,t),flags:t}}e.mutateMap(t,r,{createNewValue:a,onDeleteValue:i,onExistingValue:function(e,r,n){e.flags!==r&&(e.watcher.close(),t.set(n,a(n,r)));}});},e.isIgnoredFileFromWildCardWatching=function(t){var r=t.watchedDirPath,n=t.fileOrDirectory,i=t.fileOrDirectoryPath,a=t.configFileName,o=t.options,s=t.program,c=t.extraFileExtensions,l=t.currentDirectory,u=t.useCaseSensitiveFileNames,_=t.writeLog,d=t.toPath,p=e.removeIgnoredPath(i);if(!p)return _("Project: ".concat(a," Detected ignored path: ").concat(n)),!0;if((i=p)===r)return !1;if(e.hasExtension(i)&&!e.isSupportedSourceFileName(n,o,c))return _("Project: ".concat(a," Detected file add/remove of non supported extension: ").concat(n)),!0;if(e.isExcludedFile(n,o.configFile.configFileSpecs,e.getNormalizedAbsolutePath(e.getDirectoryPath(a),l),u,l))return _("Project: ".concat(a," Detected excluded file: ").concat(n)),!0;if(!s)return !1;if(e.outFile(o)||o.outDir)return !1;if(e.isDeclarationFileName(i)){if(o.declarationDir)return !1}else if(!e.fileExtensionIsOneOf(i,e.supportedJSExtensionsFlat))return !1;var f=e.removeFileExtension(i),g=e.isArray(s)?void 0:function(e){return !!e.getState}(s)?s.getProgramOrUndefined():s,m=g||e.isArray(s)?void 0:s;return !(!y(f+".ts")&&!y(f+".tsx")||(_("Project: ".concat(a," Detected output file: ").concat(n)),0));function y(t){return g?!!g.getSourceFileByPath(t):m?m.getState().fileInfos.has(t):!!e.find(s,(function(e){return d(e)===t}))}},e.isEmittedFileOfProgram=function(e,t){return !!e&&e.isEmittedFile(t)},function(e){e[e.None=0]="None",e[e.TriggerOnly=1]="TriggerOnly",e[e.Verbose=2]="Verbose";}(t=e.WatchLogLevel||(e.WatchLogLevel={})),e.getWatchFactory=function(r,i,a,o){e.setSysLog(i===t.Verbose?a:e.noop);var s={watchFile:function(e,t,n,i){return r.watchFile(e,t,n,i)},watchDirectory:function(e,t,n,i){return r.watchDirectory(e,t,0!=(1&n),i)}},c=i!==t.None?{watchFile:d("watchFile"),watchDirectory:d("watchDirectory")}:void 0,l=i===t.Verbose?{watchFile:function(e,t,r,n,i,s){a("FileWatcher:: Added:: ".concat(p(e,r,n,i,s,o)));var l=c.watchFile(e,t,r,n,i,s);return {close:function(){a("FileWatcher:: Close:: ".concat(p(e,r,n,i,s,o))),l.close();}}},watchDirectory:function(t,r,n,i,s,l){var u="DirectoryWatcher:: Added:: ".concat(p(t,n,i,s,l,o));a(u);var _=e.timestamp(),d=c.watchDirectory(t,r,n,i,s,l),f=e.timestamp()-_;return a("Elapsed:: ".concat(f,"ms ").concat(u)),{close:function(){var r="DirectoryWatcher:: Close:: ".concat(p(t,n,i,s,l,o));a(r);var c=e.timestamp();d.close();var u=e.timestamp()-c;a("Elapsed:: ".concat(u,"ms ").concat(r));}}}}:c||s,u=i===t.Verbose?function(e,t,r,n,i){return a("ExcludeWatcher:: Added:: ".concat(p(e,t,r,n,i,o))),{close:function(){return a("ExcludeWatcher:: Close:: ".concat(p(e,t,r,n,i,o)))}}}:e.returnNoopFileWatcher;return {watchFile:_("watchFile"),watchDirectory:_("watchDirectory")};function _(t){return function(n,i,a,o,s,c){var _;return e.matchesExclude(n,"watchFile"===t?null==o?void 0:o.excludeFiles:null==o?void 0:o.excludeDirectories,"boolean"==typeof r.useCaseSensitiveFileNames?r.useCaseSensitiveFileNames:r.useCaseSensitiveFileNames(),(null===(_=r.getCurrentDirectory)||void 0===_?void 0:_.call(r))||"")?u(n,a,o,s,c):l[t].call(void 0,n,i,a,o,s,c)}}function d(t){return function(r,i,c,l,u,_){return s[t].call(void 0,r,(function(){for(var s=[],d=0;d<arguments.length;d++)s[d]=arguments[d];var f="".concat("watchFile"===t?"FileWatcher":"DirectoryWatcher",":: Triggered with ").concat(s[0]," ").concat(void 0!==s[1]?s[1]:"",":: ").concat(p(r,c,l,u,_,o));a(f);var g=e.timestamp();i.call.apply(i,n$4([void 0],s,!1));var m=e.timestamp()-g;a("Elapsed:: ".concat(m,"ms ").concat(f));}),c,l,u,_)}}function p(e,t,r,n,i,a){return "WatchInfo: ".concat(e," ").concat(t," ").concat(JSON.stringify(r)," ").concat(a?a(n,i):void 0===i?n:"".concat(n," ").concat(i))}},e.getFallbackOptions=function(t){var r=null==t?void 0:t.fallbackPolling;return {watchFile:void 0!==r?r:e.WatchFileKind.PriorityPollingInterval}},e.closeFileWatcherOf=i;}(t),function(e){function t(t,r){var n=e.getDirectoryPath(r),i=e.isRootedDiskPath(t)?t:e.combinePaths(n,t);return e.normalizePath(i)}function r(e,t){return i(e,t)}function i(t,r,n){void 0===n&&(n=e.sys);var i,a=new e.Map,o=e.createGetCanonicalFileName(n.useCaseSensitiveFileNames),s=e.maybeBind(n,n.createHash)||e.generateDjb2Hash;function c(){return e.getDirectoryPath(e.normalizePath(n.getExecutingFilePath()))}var l=e.getNewLineCharacter(t,(function(){return n.newLine})),u=n.realpath&&function(e){return n.realpath(e)},_={getSourceFile:function(t,n,i){var a;try{e.performance.mark("beforeIORead"),a=_.readFile(t),e.performance.mark("afterIORead"),e.performance.measure("I/O Read","beforeIORead","afterIORead");}catch(e){i&&i(e.message),a="";}return void 0!==a?e.createSourceFile(t,a,n,r):void 0},getDefaultLibLocation:c,getDefaultLibFileName:function(t){return e.combinePaths(c(),e.getDefaultLibFileName(t))},writeFile:function(r,o,c,l){try{e.performance.mark("beforeIOWrite"),e.writeFileEnsuringDirectories(r,o,c,(function(r,a,o){return function(r,a,o){if(e.isWatchSet(t)&&n.getModifiedTime){i||(i=new e.Map);var c=s(a),l=n.getModifiedTime(r);if(l){var u=i.get(r);if(u&&u.byteOrderMark===o&&u.hash===c&&u.mtime.getTime()===l.getTime())return}n.writeFile(r,a,o);var _=n.getModifiedTime(r)||e.missingFileModifiedTime;i.set(r,{hash:c,byteOrderMark:o,mtime:_});}else n.writeFile(r,a,o);}(r,a,o)}),(function(e){return (_.createDirectory||n.createDirectory)(e)}),(function(e){return t=e,!!a.has(t)||!!(_.directoryExists||n.directoryExists)(t)&&(a.set(t,!0),!0);var t;})),e.performance.mark("afterIOWrite"),e.performance.measure("I/O Write","beforeIOWrite","afterIOWrite");}catch(e){l&&l(e.message);}},getCurrentDirectory:e.memoize((function(){return n.getCurrentDirectory()})),useCaseSensitiveFileNames:function(){return n.useCaseSensitiveFileNames},getCanonicalFileName:o,getNewLine:function(){return l},fileExists:function(e){return n.fileExists(e)},readFile:function(e){return n.readFile(e)},trace:function(e){return n.write(e+l)},directoryExists:function(e){return n.directoryExists(e)},getEnvironmentVariable:function(e){return n.getEnvironmentVariable?n.getEnvironmentVariable(e):""},getDirectories:function(e){return n.getDirectories(e)},realpath:u,readDirectory:function(e,t,r,i,a){return n.readDirectory(e,t,r,i,a)},createDirectory:function(e){return n.createDirectory(e)},createHash:e.maybeBind(n,n.createHash)};return _}function a(t,r){var n="".concat(e.diagnosticCategoryName(t)," TS").concat(t.code,": ").concat(f(t.messageText,r.getNewLine())).concat(r.getNewLine());if(t.file){var i=e.getLineAndCharacterOfPosition(t.file,t.start),a=i.line,o=i.character,s=t.file.fileName,c=e.convertToRelativePath(s,r.getCurrentDirectory(),(function(e){return r.getCanonicalFileName(e)}));return "".concat(c,"(").concat(a+1,",").concat(o+1,"): ")+n}return n}var o;e.findConfigFile=function(t,r,n){return void 0===n&&(n="tsconfig.json"),e.forEachAncestorDirectory(t,(function(t){var i=e.combinePaths(t,n);return r(i)?i:void 0}))},e.resolveTripleslashReference=t,e.computeCommonSourceDirectoryOfFilenames=function(t,r,n){var i;return e.forEach(t,(function(t){var a=e.getNormalizedPathComponents(t,r);if(a.pop(),i){for(var o=Math.min(i.length,a.length),s=0;s<o;s++)if(n(i[s])!==n(a[s])){if(0===s)return !0;i.length=s;break}a.length<i.length&&(i.length=a.length);}else i=a;}))?"":i?e.getPathFromPathComponents(i):r},e.createCompilerHost=r,e.createCompilerHostWorker=i,e.changeCompilerHostLikeToUseCache=function(t,r,i){var a=t.readFile,o=t.fileExists,s=t.directoryExists,c=t.createDirectory,l=t.writeFile,u=new e.Map,_=new e.Map,d=new e.Map,p=new e.Map,f=function(e,r){var n=a.call(t,r);return u.set(e,void 0!==n&&n),n};t.readFile=function(n){var i=r(n),o=u.get(i);return void 0!==o?!1!==o?o:void 0:e.fileExtensionIs(n,".json")||e.isBuildInfoFile(n)?f(i,n):a.call(t,n)};var g=i?function(t,n,a,o){var s=r(t),c=p.get(s);if(c)return c;var l=i(t,n,a,o);return l&&(e.isDeclarationFileName(t)||e.fileExtensionIs(t,".json"))&&p.set(s,l),l}:void 0;return t.fileExists=function(e){var n=r(e),i=_.get(n);if(void 0!==i)return i;var a=o.call(t,e);return _.set(n,!!a),a},l&&(t.writeFile=function(e,i){for(var a=[],o=2;o<arguments.length;o++)a[o-2]=arguments[o];var s=r(e);_.delete(s);var c=u.get(s);if(void 0!==c&&c!==i)u.delete(s),p.delete(s);else if(g){var d=p.get(s);d&&d.text!==i&&p.delete(s);}l.call.apply(l,n$4([t,e,i],a,!1));}),s&&c&&(t.directoryExists=function(e){var n=r(e),i=d.get(n);if(void 0!==i)return i;var a=s.call(t,e);return d.set(n,!!a),a},t.createDirectory=function(e){var n=r(e);d.delete(n),c.call(t,e);}),{originalReadFile:a,originalFileExists:o,originalDirectoryExists:s,originalCreateDirectory:c,originalWriteFile:l,getSourceFileWithCache:g,readFileWithCache:function(e){var t=r(e),n=u.get(t);return void 0!==n?!1!==n?n:void 0:f(t,e)}}},e.getPreEmitDiagnostics=function(t,r,n){var i;return i=e.addRange(i,t.getConfigFileParsingDiagnostics()),i=e.addRange(i,t.getOptionsDiagnostics(n)),i=e.addRange(i,t.getSyntacticDiagnostics(r,n)),i=e.addRange(i,t.getGlobalDiagnostics(n)),i=e.addRange(i,t.getSemanticDiagnostics(r,n)),e.getEmitDeclarations(t.getCompilerOptions())&&(i=e.addRange(i,t.getDeclarationDiagnostics(r,n))),e.sortAndDeduplicateDiagnostics(i||e.emptyArray)},e.formatDiagnostics=function(e,t){for(var r="",n=0,i=e;n<i.length;n++)r+=a(i[n],t);return r},e.formatDiagnostic=a,function(e){e.Grey="",e.Red="",e.Yellow="",e.Blue="",e.Cyan="";}(o=e.ForegroundColorEscapeSequences||(e.ForegroundColorEscapeSequences={}));var s="",c="",l=" ";function u(t){switch(t){case e.DiagnosticCategory.Error:return o.Red;case e.DiagnosticCategory.Warning:return o.Yellow;case e.DiagnosticCategory.Suggestion:return e.Debug.fail("Should never get an Info diagnostic on the command line.");case e.DiagnosticCategory.Message:return o.Blue}}function _(e,t){return t+e+c}function d(t,r,n,i,a,o){var l=e.getLineAndCharacterOfPosition(t,r),u=l.line,d=l.character,p=e.getLineAndCharacterOfPosition(t,r+n),f=p.line,g=p.character,m=e.getLineAndCharacterOfPosition(t,t.text.length).line,y=f-u>=4,v=(f+1+"").length;y&&(v=Math.max("...".length,v));for(var h="",b=u;b<=f;b++){h+=o.getNewLine(),y&&u+1<b&&b<f-1&&(h+=i+_(e.padLeft("...",v),s)+" "+o.getNewLine(),b=f-1);var x=e.getPositionOfLineAndCharacter(t,b,0),D=b<m?e.getPositionOfLineAndCharacter(t,b+1,0):t.text.length,S=t.text.slice(x,D);if(S=(S=e.trimStringEnd(S)).replace(/\t/g," "),h+=i+_(e.padLeft(b+1+"",v),s)+" ",h+=S+o.getNewLine(),h+=i+_(e.padLeft("",v),s)+" ",h+=a,b===u){var T=b===f?g:void 0;h+=S.slice(0,d).replace(/\S/g," "),h+=S.slice(d,T).replace(/./g,"~");}else h+=b===f?S.slice(0,g).replace(/./g,"~"):S.replace(/./g,"~");h+=c;}return h}function p(t,r,n,i){void 0===i&&(i=_);var a=e.getLineAndCharacterOfPosition(t,r),s=a.line,c=a.character,l="";return l+=i(n?e.convertToRelativePath(t.fileName,n.getCurrentDirectory(),(function(e){return n.getCanonicalFileName(e)})):t.fileName,o.Cyan),l+=":",l+=i("".concat(s+1),o.Yellow),(l+=":")+i("".concat(c+1),o.Yellow)}function f(t,r,n){if(void 0===n&&(n=0),e.isString(t))return t;if(void 0===t)return "";var i="";if(n){i+=r;for(var a=0;a<n;a++)i+=" ";}if(i+=t.messageText,n++,t.next)for(var o=0,s=t.next;o<s.length;o++)i+=f(s[o],r,n);return i}function g(t,r,n,i,a){if(0===t.length)return [];for(var o=[],s=new e.Map,c=0,l=t;c<l.length;c++){var u=l[c],_=void 0,d=m(u,i),p=e.isString(u)?u:u.fileName.toLowerCase(),f=void 0!==d?"".concat(d,"|").concat(p):p;s.has(f)?_=s.get(f):s.set(f,_=a(p,r,n,d)),o.push(_);}return o}function m(t,r){return (e.isString(t)?r:t.resolutionMode)||r}function y(e,t){if(void 0!==e.impliedNodeFormat)return h(e,O(e,t))}function v(t){var r;return e.isExportDeclaration(t)?t.isTypeOnly:!!(null===(r=t.importClause)||void 0===r?void 0:r.isTypeOnly)}function h(t,r){var n,i;if(void 0!==t.impliedNodeFormat){var a;if((e.isImportDeclaration(r.parent)||e.isExportDeclaration(r.parent))&&v(r.parent)&&(a=b(r.parent.assertClause)))return a;if(r.parent.parent&&e.isImportTypeNode(r.parent.parent)&&(a=b(null===(n=r.parent.parent.assertions)||void 0===n?void 0:n.assertClause)))return a;if(t.impliedNodeFormat!==e.ModuleKind.ESNext)return e.isImportCall(e.walkUpParenthesizedExpressions(r.parent))?e.ModuleKind.ESNext:e.ModuleKind.CommonJS;var o=null===(i=e.walkUpParenthesizedExpressions(r.parent))||void 0===i?void 0:i.parent;return o&&e.isImportEqualsDeclaration(o)?e.ModuleKind.CommonJS:e.ModuleKind.ESNext}}function b(t,r){if(t)if(1===e.length(t.elements)){var n=t.elements[0];if(e.isStringLiteralLike(n.name))if("resolution-mode"===n.name.text){if(e.isStringLiteralLike(n.value)){if("import"===n.value.text||"require"===n.value.text)return "import"===n.value.text?e.ModuleKind.ESNext:e.ModuleKind.CommonJS;null==r||r(n.value,e.Diagnostics.resolution_mode_should_be_either_require_or_import);}}else null==r||r(n.name,e.Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_assertions);}else null==r||r(t,e.Diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require);}function x(t,r,n,i,a){if(0===t.length)return [];for(var o=[],s=new e.Map,c=0,l=0,u=t;l<u.length;l++){var _=u[l],d=void 0,p=y(r,c);c++;var f=void 0!==p?"".concat(p,"|").concat(_):_;s.has(f)?d=s.get(f):s.set(f,d=a(_,p,n,i)),o.push(d);}return o}function D(t,r,n,i){var a;return function t(r,o,s){if(i){var c=i(r,s);if(c)return c}return e.forEach(o,(function(r,i){if(!r||!(null==a?void 0:a.has(r.sourceFile.path))){var o=n(r,s,i);return o||!r?o:((a||(a=new e.Set)).add(r.sourceFile.path),t(r.commandLine.projectReferences,r.references,r))}}))}(t,r,void 0)}function S(t){switch(null==t?void 0:t.kind){case e.FileIncludeKind.Import:case e.FileIncludeKind.ReferenceFile:case e.FileIncludeKind.TypeReferenceDirective:case e.FileIncludeKind.LibReferenceDirective:return !0;default:return !1}}function T(e){return void 0!==e.pos}function C(t,r){var n,i,a,o,s,c,l,u,_,d,p,f=e.Debug.checkDefined(t(r.file)),g=r.kind,m=r.index;switch(g){case e.FileIncludeKind.Import:var v=O(f,m);if(d=null===(s=null===(o=f.resolvedModules)||void 0===o?void 0:o.get(v.text,y(f,m)))||void 0===s?void 0:s.packageId,-1===v.pos)return {file:f,packageId:d,text:v.text};u=e.skipTrivia(f.text,v.pos),_=v.end;break;case e.FileIncludeKind.ReferenceFile:u=(n=f.referencedFiles[m]).pos,_=n.end;break;case e.FileIncludeKind.TypeReferenceDirective:u=(i=f.typeReferenceDirectives[m]).pos,_=i.end,p=i.resolutionMode,d=null===(l=null===(c=f.resolvedTypeReferenceDirectiveNames)||void 0===c?void 0:c.get(e.toFileNameLowerCase(f.typeReferenceDirectives[m].fileName),p||f.impliedNodeFormat))||void 0===l?void 0:l.packageId;break;case e.FileIncludeKind.LibReferenceDirective:u=(a=f.libReferenceDirectives[m]).pos,_=a.end;break;default:return e.Debug.assertNever(g)}return {file:f,pos:u,end:_,packageId:d}}function k(t,r,n,i){switch(e.getEmitModuleResolutionKind(i)){case e.ModuleResolutionKind.Node16:case e.ModuleResolutionKind.NodeNext:return e.fileExtensionIsOneOf(t,[".d.mts",".mts",".mjs"])?e.ModuleKind.ESNext:e.fileExtensionIsOneOf(t,[".d.cts",".cts",".cjs"])?e.ModuleKind.CommonJS:e.fileExtensionIsOneOf(t,[".d.ts",".ts",".tsx",".js",".jsx"])?"module"===(null==(a=e.getPackageScopeForPath(t,r,n,i))?void 0:a.packageJsonContent.type)?e.ModuleKind.ESNext:e.ModuleKind.CommonJS:void 0;default:return}var a;}function E(t,r,i,a){var o=t.getCompilerOptions();if(o.noEmit)return t.getSemanticDiagnostics(r,a),r||e.outFile(o)?e.emitSkippedWithNoDiagnostics:t.emitBuildInfo(i,a);if(o.noEmitOnError){var s=n$4(n$4(n$4(n$4([],t.getOptionsDiagnostics(a),!0),t.getSyntacticDiagnostics(r,a),!0),t.getGlobalDiagnostics(a),!0),t.getSemanticDiagnostics(r,a),!0);if(0===s.length&&e.getEmitDeclarations(t.getCompilerOptions())&&(s=t.getDeclarationDiagnostics(void 0,a)),s.length){var c;if(!r&&!e.outFile(o)){var l=t.emitBuildInfo(i,a);l.diagnostics&&(s=n$4(n$4([],s,!0),l.diagnostics,!0)),c=l.emittedFiles;}return {diagnostics:s,sourceMaps:void 0,emittedFiles:c,emitSkipped:!0}}}}function N(t,r){return e.filter(t,(function(e){return !e.skippedOn||!r[e.skippedOn]}))}function F(t,r){return void 0===r&&(r=t),{fileExists:function(e){return r.fileExists(e)},readDirectory:function(t,n,i,a,o){return e.Debug.assertIsDefined(r.readDirectory,"'CompilerHost.readDirectory' must be implemented to correctly process 'projectReferences'"),r.readDirectory(t,n,i,a,o)},readFile:function(e){return r.readFile(e)},useCaseSensitiveFileNames:t.useCaseSensitiveFileNames(),getCurrentDirectory:function(){return t.getCurrentDirectory()},onUnRecoverableConfigFileDiagnostic:t.onUnRecoverableConfigFileDiagnostic||e.returnUndefined,trace:t.trace?function(e){return t.trace(e)}:void 0}}function A(t,r,n){if(!t)return e.emptyArray;for(var i,a=0;a<t.length;a++){var o=t[a],s=r(o,a);if(o.prepend&&s&&s.options){if(!e.outFile(s.options))continue;var c=e.getOutputPathsForBundle(s.options,!0),l=c.jsFilePath,u=c.sourceMapFilePath,_=c.declarationFilePath,d=c.declarationMapPath,p=c.buildInfoPath,f=e.createInputFiles(n,l,u,_,d,p);(i||(i=[])).push(f);}}return i||e.emptyArray}function P(t,r){var n=r||t;return e.resolveConfigFileProjectName(n.path)}function w(t,r){switch(r.extension){case".ts":case".d.ts":return;case".tsx":return n();case".jsx":return n()||i();case".js":return i();case".json":return t.resolveJsonModule?void 0:e.Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used}function n(){return t.jsx?void 0:e.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set}function i(){return e.getAllowJSCompilerOption(t)||!e.getStrictOptionValue(t,"noImplicitAny")?void 0:e.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type}}function I(e){for(var t=e.imports,r=e.moduleAugmentations,n=t.map((function(e){return e.text})),i=0,a=r;i<a.length;i++){var o=a[i];10===o.kind&&n.push(o.text);}return n}function O(t,r){var n=t.imports,i=t.moduleAugmentations;if(r<n.length)return n[r];for(var a=n.length,o=0,s=i;o<s.length;o++){var c=s[o];if(10===c.kind){if(r===a)return c;a++;}}e.Debug.fail("should never ask for module name at index higher than possible module name");}e.formatColorAndReset=_,e.formatLocation=p,e.formatDiagnosticsWithColorAndContext=function(t,r){for(var n="",i=0,a=t;i<a.length;i++){var s=a[i];if(s.file&&(n+=p(y=s.file,v=s.start,r),n+=" - "),n+=_(e.diagnosticCategoryName(s),u(s.category)),n+=_(" TS".concat(s.code,": "),o.Grey),n+=f(s.messageText,r.getNewLine()),s.file&&(n+=r.getNewLine(),n+=d(s.file,s.start,s.length,"",u(s.category),r)),s.relatedInformation){n+=r.getNewLine();for(var c=0,g=s.relatedInformation;c<g.length;c++){var m=g[c],y=m.file,v=m.start,h=m.length,b=m.messageText;y&&(n+=r.getNewLine(),n+=" "+p(y,v,r),n+=d(y,v,h,l,o.Cyan,r)),n+=r.getNewLine(),n+=l+f(b,r.getNewLine());}}n+=r.getNewLine();}return n},e.flattenDiagnosticMessageText=f,e.loadWithTypeDirectiveCache=g,e.getModeForFileReference=m,e.getModeForResolutionAtIndex=y,e.isExclusivelyTypeOnlyImportOrExport=v,e.getModeForUsageLocation=h,e.getResolutionModeOverrideForClause=b,e.loadWithModeAwareCache=x,e.forEachResolvedProjectReference=function(e,t){return D(void 0,e,(function(e,r){return e&&t(e,r)}))},e.inferredTypesContainingFile="__inferred type names__.ts",e.isReferencedFile=S,e.isReferenceFileLocation=T,e.getReferencedFileLocation=C,e.isProgramUptoDate=function(t,r,n,i,a,o,s,c,l){if(!t||(null==s?void 0:s()))return !1;if(!e.arrayIsEqualTo(t.getRootFileNames(),r))return !1;var u;if(!e.arrayIsEqualTo(t.getProjectReferences(),l,(function(r,n,i){return e.projectReferenceIsEqualTo(r,n)&&d(t.getResolvedProjectReferences()[i],r)})))return !1;if(t.getSourceFiles().some((function(e){return !function(e){return e.version===i(e.resolvedPath,e.fileName)}(e)||o(e.path)})))return !1;if(t.getMissingFilePaths().some(a))return !1;var _=t.getCompilerOptions();return !(!e.compareDataObjects(_,n)||_.configFile&&n.configFile&&_.configFile.text!==n.configFile.text);function d(t,r){if(t){if(e.contains(u,t))return !0;var n=P(r),i=c(n);return !!i&&t.commandLine.options.configFile===i.options.configFile&&!!e.arrayIsEqualTo(t.commandLine.fileNames,i.fileNames)&&((u||(u=[])).push(t),!e.forEach(t.references,(function(e,r){return !d(e,t.commandLine.projectReferences[r])})))}var a=P(r);return !c(a)}},e.getConfigFileParsingDiagnostics=function(e){return e.options.configFile?n$4(n$4([],e.options.configFile.parseDiagnostics,!0),e.errors,!0):e.errors},e.getImpliedNodeFormatForFile=k,e.plainJSErrors=new e.Set([e.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,e.Diagnostics.A_module_cannot_have_multiple_default_exports.code,e.Diagnostics.Another_export_default_is_here.code,e.Diagnostics.The_first_export_default_is_here.code,e.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,e.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,e.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,e.Diagnostics.constructor_is_a_reserved_word.code,e.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,e.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,e.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,e.Diagnostics.Invalid_use_of_0_in_strict_mode.code,e.Diagnostics.A_label_is_not_allowed_here.code,e.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,e.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,e.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,e.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,e.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,e.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,e.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,e.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,e.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,e.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,e.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,e.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,e.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,e.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,e.Diagnostics.A_get_accessor_cannot_have_parameters.code,e.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,e.Diagnostics.A_rest_element_cannot_have_a_property_name.code,e.Diagnostics.A_rest_element_cannot_have_an_initializer.code,e.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,e.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,e.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,e.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,e.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,e.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,e.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,e.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,e.Diagnostics.An_export_declaration_cannot_have_modifiers.code,e.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,e.Diagnostics.An_import_declaration_cannot_have_modifiers.code,e.Diagnostics.An_object_member_cannot_be_declared_optional.code,e.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,e.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,e.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,e.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,e.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,e.Diagnostics.Classes_can_only_extend_a_single_class.code,e.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,e.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,e.Diagnostics.Duplicate_label_0.code,e.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,e.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,e.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,e.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,e.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,e.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,e.Diagnostics.Jump_target_cannot_cross_function_boundary.code,e.Diagnostics.Line_terminator_not_permitted_before_arrow.code,e.Diagnostics.Modifiers_cannot_appear_here.code,e.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,e.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,e.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,e.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,e.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,e.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,e.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,e.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,e.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,e.Diagnostics.Trailing_comma_not_allowed.code,e.Diagnostics.Variable_declaration_list_cannot_be_empty.code,e.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,e.Diagnostics._0_expected.code,e.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,e.Diagnostics._0_list_cannot_be_empty.code,e.Diagnostics._0_modifier_already_seen.code,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,e.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,e.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,e.Diagnostics._0_modifier_cannot_be_used_here.code,e.Diagnostics._0_modifier_must_precede_1_modifier.code,e.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,e.Diagnostics.const_declarations_must_be_initialized.code,e.Diagnostics.extends_clause_already_seen.code,e.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,e.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code]),e.createProgram=function(i,a,o,s,c){var l,u,_,d,p,f,v,h,b,O,M,L,R=e.isArray(i)?function(e,t,r,n,i){return {rootNames:e,options:t,host:r,oldProgram:n,configFileParsingDiagnostics:i}}(i,a,o,s,c):i,B=R.rootNames,j=R.options,J=R.configFileParsingDiagnostics,z=R.projectReferences,K=R.oldProgram,U=new e.Map,V=e.createMultiMap(),q={},W={},H=e.createModeAwareCache(),G="number"==typeof j.maxNodeModuleJsDepth?j.maxNodeModuleJsDepth:0,Q=0,X=new e.Map,Y=new e.Map;null===e.tracing||void 0===e.tracing||e.tracing.push("program","createProgram",{configFilePath:j.configFilePath,rootDir:j.rootDir},!0),e.performance.mark("beforeProgram");var Z,$,ee,te,re,ne=R.host||r(j),ie=F(ne),ae=j.noLib,oe=e.memoize((function(){return ne.getDefaultLibFileName(j)})),se=ne.getDefaultLibLocation?ne.getDefaultLibLocation():e.getDirectoryPath(oe()),ce=e.createDiagnosticCollection(),le=ne.getCurrentDirectory(),ue=e.getSupportedExtensions(j),_e=e.getSupportedExtensionsWithJsonIfResolveJsonModule(j,ue),de=new e.Map,pe=ne.hasInvalidatedResolution||e.returnFalse;if(ne.resolveModuleNames)te=function(t,r,n,i,a){return ne.resolveModuleNames(e.Debug.checkEachDefined(t),n,i,a,j,r).map((function(t){if(!t||void 0!==t.extension)return t;var r=e.clone(t);return r.extension=e.extensionFromPath(t.resolvedFileName),r}))},$=null===(l=ne.getModuleResolutionCache)||void 0===l?void 0:l.call(ne);else {$=e.createModuleResolutionCache(le,Ht,j);var fe=function(t,r,n,i){return e.resolveModuleName(t,n,j,ne,$,i,r).resolvedModule};te=function(t,r,n,i,a){return x(e.Debug.checkEachDefined(t),r,n,a,fe)};}if(ne.resolveTypeReferenceDirectives)re=function(t,r,n,i){return ne.resolveTypeReferenceDirectives(e.Debug.checkEachDefined(t),r,n,j,i)};else {ee=e.createTypeReferenceDirectiveResolutionCache(le,Ht,void 0,null==$?void 0:$.getPackageJsonInfoCache());var ge=function(t,r,n,i){return e.resolveTypeReferenceDirective(t,r,j,ne,n,ee,i).resolvedTypeReferenceDirective};re=function(t,r,n,i){return g(e.Debug.checkEachDefined(t),r,n,i,ge)};}var me,ye,ve,he,be,xe=new e.Map,De=new e.Map,Se=e.createMultiMap(),Te=!1,Ce=new e.Map,ke=ne.useCaseSensitiveFileNames()?new e.Map:void 0,Ee=!!(null===(u=ne.useSourceOfProjectReferenceRedirect)||void 0===u?void 0:u.call(ne))&&!j.disableSourceOfProjectReferenceRedirect,Ne=function(t){var r,n,i=t.compilerHost.fileExists,a=t.compilerHost.directoryExists,o=t.compilerHost.getDirectories,s=t.compilerHost.realpath;return t.useSourceOfProjectReferenceRedirect?(t.compilerHost.fileExists=c,a&&(n=t.compilerHost.directoryExists=function(n){return a.call(t.compilerHost,n)?(function(r){var n;if(t.getResolvedProjectReferences()&&!e.containsIgnoredPath(r)&&s&&e.stringContains(r,e.nodeModulesPathPart)){var i=t.getSymlinkCache(),a=e.ensureTrailingDirectorySeparator(t.toPath(r));if(!(null===(n=i.getSymlinkedDirectories())||void 0===n?void 0:n.has(a))){var o,c=e.normalizePath(s.call(t.compilerHost,r));c!==r&&(o=e.ensureTrailingDirectorySeparator(t.toPath(c)))!==a?i.setSymlinkedDirectory(r,{real:e.ensureTrailingDirectorySeparator(c),realPath:o}):i.setSymlinkedDirectory(a,!1);}}}(n),!0):!!t.getResolvedProjectReferences()&&(r||(r=new e.Set,t.forEachResolvedProjectReference((function(n){var i=e.outFile(n.commandLine.options);if(i)r.add(e.getDirectoryPath(t.toPath(i)));else {var a=n.commandLine.options.declarationDir||n.commandLine.options.outDir;a&&r.add(t.toPath(a));}}))),l(n,!1))}),o&&(t.compilerHost.getDirectories=function(e){return !t.getResolvedProjectReferences()||a&&a.call(t.compilerHost,e)?o.call(t.compilerHost,e):[]}),s&&(t.compilerHost.realpath=function(e){var r;return (null===(r=t.getSymlinkCache().getSymlinkedFiles())||void 0===r?void 0:r.get(t.toPath(e)))||s.call(t.compilerHost,e)}),{onProgramCreateComplete:function(){t.compilerHost.fileExists=i,t.compilerHost.directoryExists=a,t.compilerHost.getDirectories=o;},fileExists:c,directoryExists:n}):{onProgramCreateComplete:e.noop,fileExists:c};function c(r){return !!i.call(t.compilerHost,r)||!!t.getResolvedProjectReferences()&&!!e.isDeclarationFileName(r)&&l(r,!0)}function l(n,a){var o,s=a?function(r){return function(r){var n=t.getSourceOfProjectReferenceRedirect(t.toPath(r));return void 0!==n?!e.isString(n)||i.call(t.compilerHost,n):void 0}(r)}:function(n){return function(n){var i=t.toPath(n),a="".concat(i).concat(e.directorySeparator);return e.forEachKey(r,(function(t){return i===t||e.startsWith(t,a)||e.startsWith(i,"".concat(t,"/"))}))}(n)},c=s(n);if(void 0!==c)return c;var l=t.getSymlinkCache(),u=l.getSymlinkedDirectories();if(!u)return !1;var _=t.toPath(n);return !!e.stringContains(_,e.nodeModulesPathPart)&&(!(!a||!(null===(o=l.getSymlinkedFiles())||void 0===o?void 0:o.has(_)))||e.firstDefinedIterator(u.entries(),(function(r){var i=r[0],o=r[1];if(o&&e.startsWith(_,i)){var c=s(_.replace(i,o.realPath));if(a&&c){var u=e.getNormalizedAbsolutePath(n,t.compilerHost.getCurrentDirectory());l.setSymlinkedFile(_,"".concat(o.real).concat(u.replace(new RegExp(i,"i"),"")));}return c}}))||!1)}}({compilerHost:ne,getSymlinkCache:dr,useSourceOfProjectReferenceRedirect:Ee,toPath:Ye,getResolvedProjectReferences:rt,getSourceOfProjectReferenceRedirect:jt,forEachResolvedProjectReference:Bt}),Fe=Ne.onProgramCreateComplete,Ae=Ne.fileExists,Pe=Ne.directoryExists,we=ne.readFile.bind(ne);null===e.tracing||void 0===e.tracing||e.tracing.push("program","shouldProgramCreateNewSourceFiles",{hasOldProgram:!!K});var Ie,Oe=function(t,r){return !!t&&e.optionsHaveChanges(t.getCompilerOptions(),r,e.sourceFileAffectingCompilerOptions)}(K,j);if(null===e.tracing||void 0===e.tracing||e.tracing.pop(),null===e.tracing||void 0===e.tracing||e.tracing.push("program","tryReuseStructureFromOldProgram",{}),Ie=function(){var t;if(!K)return 0;var r=K.getCompilerOptions();if(e.changesAffectModuleResolution(r,j))return 0;var n=K.getRootFileNames();if(!e.arrayIsEqualTo(n,B))return 0;if(D(K.getProjectReferences(),K.getResolvedProjectReferences(),(function(t,r,n){var i=Qt((r?r.commandLine.projectReferences:z)[n]);return t?!i||i.sourceFile!==t.sourceFile||!e.arrayIsEqualTo(t.commandLine.fileNames,i.commandLine.fileNames):void 0!==i}),(function(t,r){var n=r?zt(r.sourceFile.path).commandLine.projectReferences:z;return !e.arrayIsEqualTo(t,n,e.projectReferenceIsEqualTo)})))return 0;z&&(ye=z.map(Qt));var i=[],a=[];if(Ie=2,K.getMissingFilePaths().some((function(e){return ne.fileExists(e)})))return 0;var o,s=K.getSourceFiles();!function(e){e[e.Exists=0]="Exists",e[e.Modified=1]="Modified";}(o||(o={}));for(var c=new e.Map,l=0,u=s;l<u.length;l++){var _=u[l];if(!(M=ne.getSourceFileByPath?ne.getSourceFileByPath(_.fileName,_.resolvedPath,Pt(_.fileName,$,ne,j),void 0,Oe):ne.getSourceFile(_.fileName,Pt(_.fileName,$,ne,j),void 0,Oe)))return 0;e.Debug.assert(!M.redirectInfo,"Host should not return a redirect source file from `getSourceFile`");var d=void 0;if(_.redirectInfo){if(M!==_.redirectInfo.unredirected)return 0;d=!1,M=_;}else if(K.redirectTargetsMap.has(_.path)){if(M!==_)return 0;d=!1;}else d=M!==_;M.path=_.path,M.originalFileName=_.originalFileName,M.resolvedPath=_.resolvedPath,M.fileName=_.fileName;var p=K.sourceFileToPackageName.get(_.path);if(void 0!==p){var f=c.get(p),g=d?1:0;if(void 0!==f&&1===g||1===f)return 0;c.set(p,g);}d?(e.arrayIsEqualTo(_.libReferenceDirectives,M.libReferenceDirectives,Dt)||(Ie=1),_.hasNoDefaultLib!==M.hasNoDefaultLib&&(Ie=1),e.arrayIsEqualTo(_.referencedFiles,M.referencedFiles,Dt)||(Ie=1),Ct(M),e.arrayIsEqualTo(_.imports,M.imports,St)||(Ie=1),e.arrayIsEqualTo(_.moduleAugmentations,M.moduleAugmentations,St)||(Ie=1),(6291456&_.flags)!=(6291456&M.flags)&&(Ie=1),e.arrayIsEqualTo(_.typeReferenceDirectives,M.typeReferenceDirectives,Dt)||(Ie=1),a.push({oldFile:_,newFile:M})):pe(_.path)&&(Ie=1,a.push({oldFile:_,newFile:M})),i.push(M);}if(2!==Ie)return Ie;for(var m=a.map((function(e){return e.oldFile})),y=0,h=s;y<h.length;y++){var b=h[y];if(!e.contains(m,b))for(var x=0,S=b.ambientModuleNames;x<S.length;x++){var T=S[x];U.set(T,b.fileName);}}for(var C=0,k=a;C<k.length;C++){var E=k[C],N=(_=E.oldFile,I(M=E.newFile)),F=$e(N,M);e.hasChangesInResolutions(N,F,_.resolvedModules,_,e.moduleResolutionIsEqualTo)?(Ie=1,M.resolvedModules=e.zipToModeAwareCache(M,N,F)):M.resolvedModules=_.resolvedModules;var A=M.typeReferenceDirectives,P=He(A,M);e.hasChangesInResolutions(A,P,_.resolvedTypeReferenceDirectiveNames,_,e.typeDirectiveIsEqualTo)?(Ie=1,M.resolvedTypeReferenceDirectiveNames=e.zipToModeAwareCache(M,A,P)):M.resolvedTypeReferenceDirectiveNames=_.resolvedTypeReferenceDirectiveNames;}if(2!==Ie)return Ie;if(e.changesAffectingProgramStructure(r,j)||(null===(t=ne.hasChangedAutomaticTypeDirectiveNames)||void 0===t?void 0:t.call(ne)))return 1;me=K.getMissingFilePaths(),e.Debug.assert(i.length===K.getSourceFiles().length);for(var w=0,O=i;w<O.length;w++){var M=O[w];Ce.set(M.path,M);}return K.getFilesByNameMap().forEach((function(e,t){e?e.path!==t?Ce.set(t,Ce.get(e.path)):K.isSourceFileFromExternalLibrary(e)&&Y.set(e.path,!0):Ce.set(t,e);})),v=i,V=K.getFileIncludeReasons(),L=K.getFileProcessingDiagnostics(),H=K.getResolvedTypeReferenceDirectives(),De=K.sourceFileToPackageName,Se=K.redirectTargetsMap,Te=K.usesUriStyleNodeCoreModules,2}(),null===e.tracing||void 0===e.tracing||e.tracing.pop(),2!==Ie){p=[],f=[],z&&(ye||(ye=z.map(Qt)),B.length&&(null==ye||ye.forEach((function(t,r){if(t){var n=e.outFile(t.commandLine.options);if(Ee){if(n||e.getEmitModuleKind(t.commandLine.options)===e.ModuleKind.None)for(var i=0,a=t.commandLine.fileNames;i<a.length;i++)Nt(l=a[i],{kind:e.FileIncludeKind.SourceFromProjectReference,index:r});}else if(n)Nt(e.changeExtension(n,".d.ts"),{kind:e.FileIncludeKind.OutputFromProjectReference,index:r});else if(e.getEmitModuleKind(t.commandLine.options)===e.ModuleKind.None)for(var o=e.memoize((function(){return e.getCommonSourceDirectoryOfConfig(t.commandLine,!ne.useCaseSensitiveFileNames())})),s=0,c=t.commandLine.fileNames;s<c.length;s++){var l=c[s];e.isDeclarationFileName(l)||e.fileExtensionIs(l,".json")||Nt(e.getOutputDeclarationFileName(l,t.commandLine,!ne.useCaseSensitiveFileNames(),o),{kind:e.FileIncludeKind.OutputFromProjectReference,index:r});}}})))),null===e.tracing||void 0===e.tracing||e.tracing.push("program","processRootFiles",{count:B.length}),e.forEach(B,(function(t,r){return xt(t,!1,!1,{kind:e.FileIncludeKind.RootFile,index:r})})),null===e.tracing||void 0===e.tracing||e.tracing.pop();var Me=B.length?e.getAutomaticTypeDirectiveNames(j,ne):e.emptyArray;if(Me.length){null===e.tracing||void 0===e.tracing||e.tracing.push("program","processTypeReferences",{count:Me.length});for(var Le=j.configFilePath?e.getDirectoryPath(j.configFilePath):ne.getCurrentDirectory(),Re=He(Me,e.combinePaths(Le,e.inferredTypesContainingFile)),Be=0;Be<Me.length;Be++)Vt(Me[Be],void 0,Re[Be],{kind:e.FileIncludeKind.AutomaticTypeDirectiveFile,typeReference:Me[Be],packageId:null===(_=Re[Be])||void 0===_?void 0:_.packageId});null===e.tracing||void 0===e.tracing||e.tracing.pop();}if(B.length&&!ae){var je=oe();!j.lib&&je?xt(je,!0,!1,{kind:e.FileIncludeKind.LibFile}):e.forEach(j.lib,(function(t,r){xt(qt(t),!0,!1,{kind:e.FileIncludeKind.LibFile,index:r});}));}me=e.arrayFrom(e.mapDefinedIterator(Ce.entries(),(function(e){var t=e[0];return void 0===e[1]?t:void 0}))),v=e.stableSort(p,(function(t,r){return e.compareValues(Xe(t),Xe(r))})).concat(f),p=void 0,f=void 0;}if(e.Debug.assert(!!me),K&&ne.onReleaseOldSourceFile){for(var Je=0,ze=K.getSourceFiles();Je<ze.length;Je++){var Ke=ze[Je],Ue=ct(Ke.resolvedPath);(Oe||!Ue||Ke.resolvedPath===Ke.path&&Ue.resolvedPath!==Ke.path)&&ne.onReleaseOldSourceFile(Ke,K.getCompilerOptions(),!!ct(Ke.path));}ne.getParsedCommandLine||K.forEachResolvedProjectReference((function(e){zt(e.sourceFile.path)||ne.onReleaseOldSourceFile(e.sourceFile,K.getCompilerOptions(),!1);}));}K&&ne.onReleaseParsedCommandLine&&D(K.getProjectReferences(),K.getResolvedProjectReferences(),(function(e,t,r){var n=P((null==t?void 0:t.commandLine.projectReferences[r])||K.getProjectReferences()[r]);(null==ve?void 0:ve.has(Ye(n)))||ne.onReleaseParsedCommandLine(n,e,K.getCompilerOptions());})),ee=void 0,K=void 0;var Ve={getRootFileNames:function(){return B},getSourceFile:st,getSourceFileByPath:ct,getSourceFiles:function(){return v},getMissingFilePaths:function(){return me},getModuleResolutionCache:function(){return $},getFilesByNameMap:function(){return Ce},getCompilerOptions:function(){return j},getSyntacticDiagnostics:function(e,t){return lt(e,_t,t)},getOptionsDiagnostics:function(){return e.sortAndDeduplicateDiagnostics(e.concatenate(ce.getGlobalDiagnostics(),function(){if(!j.configFile)return e.emptyArray;var t=ce.getDiagnostics(j.configFile.fileName);return Bt((function(r){t=e.concatenate(t,ce.getDiagnostics(r.sourceFile.fileName));})),t}()))},getGlobalDiagnostics:function(){return B.length?e.sortAndDeduplicateDiagnostics(at().getGlobalDiagnostics().slice()):e.emptyArray},getSemanticDiagnostics:function(e,t){return lt(e,pt,t)},getCachedSemanticDiagnostics:function(e){var t;return e?null===(t=q.perFile)||void 0===t?void 0:t.get(e.path):q.allDiagnostics},getSuggestionDiagnostics:function(e,t){return dt((function(){return at().getSuggestionDiagnostics(e,t)}))},getDeclarationDiagnostics:function(t,r){var n=Ve.getCompilerOptions();return !t||e.outFile(n)?yt(t,r):lt(t,bt,r)},getBindAndCheckDiagnostics:function(e,t){return ft(e,t)},getProgramDiagnostics:ut,getTypeChecker:at,getClassifiableNames:function(){var t;if(!M){at(),M=new e.Set;for(var r=0,n=v;r<n.length;r++){null===(t=n[r].classifiableNames)||void 0===t||t.forEach((function(e){return M.add(e)}));}}return M},getCommonSourceDirectory:Ze,emit:function(t,r,n,i,a,o){null===e.tracing||void 0===e.tracing||e.tracing.push("emit","emit",{path:null==t?void 0:t.path},!0);var s=dt((function(){return function(t,r,n,i,a,o,s){if(!s){var c=E(t,r,n,i);if(c)return c}var l=at().getEmitResolver(e.outFile(j)?void 0:r,i);e.performance.mark("beforeEmit");var u=e.emitFiles(l,et(n),r,e.getTransformers(j,o,a),a,!1,s);return e.performance.mark("afterEmit"),e.performance.measure("Emit","beforeEmit","afterEmit"),u}(Ve,t,r,n,i,a,o)}));return null===e.tracing||void 0===e.tracing||e.tracing.pop(),s},getCurrentDirectory:function(){return le},getNodeCount:function(){return at().getNodeCount()},getIdentifierCount:function(){return at().getIdentifierCount()},getSymbolCount:function(){return at().getSymbolCount()},getTypeCount:function(){return at().getTypeCount()},getInstantiationCount:function(){return at().getInstantiationCount()},getRelationCacheSizes:function(){return at().getRelationCacheSizes()},getFileProcessingDiagnostics:function(){return L},getResolvedTypeReferenceDirectives:function(){return H},isSourceFileFromExternalLibrary:it,isSourceFileDefaultLibrary:function(t){if(!t.isDeclarationFile)return !1;if(t.hasNoDefaultLib)return !0;if(!j.noLib)return !1;var r=ne.useCaseSensitiveFileNames()?e.equateStringsCaseSensitive:e.equateStringsCaseInsensitive;return j.lib?e.some(j.lib,(function(e){return r(t.fileName,qt(e))})):r(t.fileName,oe())},getSourceFileFromReference:function(e,r){return kt(t(r.fileName,e.fileName),st)},getLibFileFromReference:function(t){var r=e.toFileNameLowerCase(t.fileName),n=e.libMap.get(r);if(n)return st(qt(n))},sourceFileToPackageName:De,redirectTargetsMap:Se,usesUriStyleNodeCoreModules:Te,isEmittedFile:function(t){if(j.noEmit)return !1;var r=Ye(t);if(ct(r))return !1;var n=e.outFile(j);if(n)return _r(r,n)||_r(r,e.removeFileExtension(n)+".d.ts");if(j.declarationDir&&e.containsPath(j.declarationDir,r,le,!ne.useCaseSensitiveFileNames()))return !0;if(j.outDir)return e.containsPath(j.outDir,r,le,!ne.useCaseSensitiveFileNames());if(e.fileExtensionIsOneOf(r,e.supportedJSExtensionsFlat)||e.isDeclarationFileName(r)){var i=e.removeFileExtension(r);return !!ct(i+".ts")||!!ct(i+".tsx")}return !1},getConfigFileParsingDiagnostics:function(){return J||e.emptyArray},getResolvedModuleWithFailedLookupLocationsFromCache:function(t,r,n){return $&&e.resolveModuleNameFromCache(t,r,$,n)},getProjectReferences:function(){return z},getResolvedProjectReferences:rt,getProjectReferenceRedirect:Ot,getResolvedProjectReferenceToRedirect:Rt,getResolvedProjectReferenceByPath:zt,forEachResolvedProjectReference:Bt,isSourceOfProjectReferenceRedirect:Jt,emitBuildInfo:function(t){e.Debug.assert(!e.outFile(j)),null===e.tracing||void 0===e.tracing||e.tracing.push("emit","emitBuildInfo",{},!0),e.performance.mark("beforeEmit");var r=e.emitFiles(e.notImplementedResolver,et(t),void 0,e.noTransformers,!1,!0);return e.performance.mark("afterEmit"),e.performance.measure("Emit","beforeEmit","afterEmit"),null===e.tracing||void 0===e.tracing||e.tracing.pop(),r},fileExists:Ae,readFile:we,directoryExists:Pe,getSymlinkCache:dr,realpath:null===(d=ne.realpath)||void 0===d?void 0:d.bind(ne),useCaseSensitiveFileNames:function(){return ne.useCaseSensitiveFileNames()},getFileIncludeReasons:function(){return V},structureIsReused:Ie,writeFile:tt};return Fe(),null==L||L.forEach((function(t){switch(t.kind){case 1:return ce.add(Xt(t.file&&ct(t.file),t.fileProcessingReason,t.diagnostic,t.args||e.emptyArray));case 0:var r=C(ct,t.reason),i=r.file,a=r.pos,o=r.end;return ce.add(e.createFileDiagnostic.apply(void 0,n$4([i,e.Debug.checkDefined(a),e.Debug.checkDefined(o)-a,t.diagnostic],t.args||e.emptyArray,!1)));default:e.Debug.assertNever(t);}})),function(){j.strictPropertyInitialization&&!e.getStrictOptionValue(j,"strictNullChecks")&&ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"strictPropertyInitialization","strictNullChecks"),j.exactOptionalPropertyTypes&&!e.getStrictOptionValue(j,"strictNullChecks")&&ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"exactOptionalPropertyTypes","strictNullChecks"),j.isolatedModules&&(j.out&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"out","isolatedModules"),j.outFile&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"outFile","isolatedModules")),j.inlineSourceMap&&(j.sourceMap&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"sourceMap","inlineSourceMap"),j.mapRoot&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"mapRoot","inlineSourceMap")),j.composite&&(!1===j.declaration&&ir(e.Diagnostics.Composite_projects_may_not_disable_declaration_emit,"declaration"),!1===j.incremental&&ir(e.Diagnostics.Composite_projects_may_not_disable_incremental_compilation,"declaration"));var t,r=e.outFile(j);if(j.tsBuildInfoFile?e.isIncrementalCompilation(j)||ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2,"tsBuildInfoFile","incremental","composite"):!j.incremental||r||j.configFilePath||ce.add(e.createCompilerDiagnostic(e.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)),t=j.suppressOutputPathCheck?void 0:e.getTsBuildInfoEmitOutputFilePath(j),D(z,ye,(function(r,n,i){var a=(n?n.commandLine.projectReferences:z)[i],o=n&&n.sourceFile;if(r){var s=r.commandLine.options;if(s.composite&&!s.noEmit||(n?n.commandLine.fileNames:B).length&&(s.composite||or(o,i,e.Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true,a.path),s.noEmit&&or(o,i,e.Diagnostics.Referenced_project_0_may_not_disable_emit,a.path)),a.prepend){var c=e.outFile(s);c?ne.fileExists(c)||or(o,i,e.Diagnostics.Output_file_0_from_project_1_does_not_exist,c,a.path):or(o,i,e.Diagnostics.Cannot_prepend_project_0_because_it_does_not_have_outFile_set,a.path);}!n&&t&&t===e.getTsBuildInfoEmitOutputFilePath(s)&&(or(o,i,e.Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1,t,a.path),de.set(Ye(t),!0));}else or(o,i,e.Diagnostics.File_0_not_found,a.path);})),j.composite)for(var n=new e.Set(B.map(Ye)),i=0,a=v;i<a.length;i++){var o=a[i];e.sourceFileMayBeEmitted(o,Ve)&&!n.has(o.path)&&Zt(o,e.Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,[o.fileName,j.configFilePath||""]);}if(j.paths)for(var s in j.paths)if(e.hasProperty(j.paths,s))if(e.hasZeroOrOneAsteriskCharacter(s)||er(!0,s,e.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character,s),e.isArray(j.paths[s])){var c=j.paths[s].length;0===c&&er(!1,s,e.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array,s);for(var l=0;l<c;l++){var u=j.paths[s][l],_=typeof u;"string"===_?(e.hasZeroOrOneAsteriskCharacter(u)||$t(s,l,e.Diagnostics.Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character,u,s),j.baseUrl||e.pathIsRelative(u)||e.pathIsAbsolute(u)||$t(s,l,e.Diagnostics.Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash)):$t(s,l,e.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2,u,s,_);}}else er(!1,s,e.Diagnostics.Substitutions_for_pattern_0_should_be_an_array,s);j.sourceMap||j.inlineSourceMap||(j.inlineSources&&ir(e.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided,"inlineSources"),j.sourceRoot&&ir(e.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided,"sourceRoot")),j.out&&j.outFile&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"out","outFile"),!j.mapRoot||j.sourceMap||j.declarationMap||ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2,"mapRoot","sourceMap","declarationMap"),j.declarationDir&&(e.getEmitDeclarations(j)||ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2,"declarationDir","declaration","composite"),r&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"declarationDir",j.out?"out":"outFile")),j.declarationMap&&!e.getEmitDeclarations(j)&&ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2,"declarationMap","declaration","composite"),j.lib&&j.noLib&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"lib","noLib"),j.noImplicitUseStrict&&e.getStrictOptionValue(j,"alwaysStrict")&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"noImplicitUseStrict","alwaysStrict");var d=e.getEmitScriptTarget(j),p=e.find(v,(function(t){return e.isExternalModule(t)&&!t.isDeclarationFile}));if(j.isolatedModules){j.module===e.ModuleKind.None&&d<2&&ir(e.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher,"isolatedModules","target"),!1===j.preserveConstEnums&&ir(e.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled,"preserveConstEnums","isolatedModules");var f=e.find(v,(function(t){return !e.isExternalModule(t)&&!e.isSourceFileJS(t)&&!t.isDeclarationFile&&6!==t.scriptKind}));if(f){var g=e.getErrorSpanForNode(f,f);ce.add(e.createFileDiagnostic(f,g.start,g.length,e.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module,e.getBaseFileName(f.fileName)));}}else p&&d<2&&j.module===e.ModuleKind.None&&(g=e.getErrorSpanForNode(p,"boolean"==typeof p.externalModuleIndicator?p:p.externalModuleIndicator),ce.add(e.createFileDiagnostic(p,g.start,g.length,e.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none)));if(r&&!j.emitDeclarationOnly&&(j.module&&j.module!==e.ModuleKind.AMD&&j.module!==e.ModuleKind.System?ir(e.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0,j.out?"out":"outFile","module"):void 0===j.module&&p&&(g=e.getErrorSpanForNode(p,"boolean"==typeof p.externalModuleIndicator?p:p.externalModuleIndicator),ce.add(e.createFileDiagnostic(p,g.start,g.length,e.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system,j.out?"out":"outFile")))),j.resolveJsonModule&&(e.getEmitModuleResolutionKind(j)!==e.ModuleResolutionKind.NodeJs&&e.getEmitModuleResolutionKind(j)!==e.ModuleResolutionKind.Node16&&e.getEmitModuleResolutionKind(j)!==e.ModuleResolutionKind.NodeNext?ir(e.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy,"resolveJsonModule"):e.hasJsonModuleEmitEnabled(j)||ir(e.Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext,"resolveJsonModule","module")),j.outDir||j.rootDir||j.sourceRoot||j.mapRoot){var m=Ze();j.outDir&&""===m&&v.some((function(t){return e.getRootLength(t.fileName)>1}))&&ir(e.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files,"outDir");}if(j.useDefineForClassFields&&0===d&&ir(e.Diagnostics.Option_0_cannot_be_specified_when_option_target_is_ES3,"useDefineForClassFields"),j.checkJs&&!e.getAllowJSCompilerOption(j)&&ce.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"checkJs","allowJs")),j.emitDeclarationOnly&&(e.getEmitDeclarations(j)||ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2,"emitDeclarationOnly","declaration","composite"),j.noEmit&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"emitDeclarationOnly","noEmit")),j.emitDecoratorMetadata&&!j.experimentalDecorators&&ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"emitDecoratorMetadata","experimentalDecorators"),j.jsxFactory?(j.reactNamespace&&ir(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"reactNamespace","jsxFactory"),4!==j.jsx&&5!==j.jsx||ir(e.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1,"jsxFactory",e.inverseJsxOptionMap.get(""+j.jsx)),e.parseIsolatedEntityName(j.jsxFactory,d)||ar("jsxFactory",e.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name,j.jsxFactory)):j.reactNamespace&&!e.isIdentifierText(j.reactNamespace,d)&&ar("reactNamespace",e.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier,j.reactNamespace),j.jsxFragmentFactory&&(j.jsxFactory||ir(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"jsxFragmentFactory","jsxFactory"),4!==j.jsx&&5!==j.jsx||ir(e.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1,"jsxFragmentFactory",e.inverseJsxOptionMap.get(""+j.jsx)),e.parseIsolatedEntityName(j.jsxFragmentFactory,d)||ar("jsxFragmentFactory",e.Diagnostics.Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name,j.jsxFragmentFactory)),j.reactNamespace&&(4!==j.jsx&&5!==j.jsx||ir(e.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1,"reactNamespace",e.inverseJsxOptionMap.get(""+j.jsx))),j.jsxImportSource&&2===j.jsx&&ir(e.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1,"jsxImportSource",e.inverseJsxOptionMap.get(""+j.jsx)),j.preserveValueImports&&e.getEmitModuleKind(j)<e.ModuleKind.ES2015&&ar("importsNotUsedAsValues",e.Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later),!j.noEmit&&!j.suppressOutputPathCheck){var y=et(),h=new e.Set;e.forEachEmittedFile(y,(function(e){j.emitDeclarationOnly||b(e.jsFilePath,h),b(e.declarationFilePath,h);}));}function b(t,r){if(t){var n=Ye(t);if(Ce.has(n)){var i=void 0;j.configFilePath||(i=e.chainDiagnosticMessages(void 0,e.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig)),i=e.chainDiagnosticMessages(i,e.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file,t),ur(t,e.createCompilerDiagnosticFromMessageChain(i));}var a=ne.useCaseSensitiveFileNames()?n:e.toFileNameLowerCase(n);r.has(a)?ur(t,e.createCompilerDiagnostic(e.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files,t)):r.add(a);}}}(),e.performance.mark("afterProgram"),e.performance.measure("Program","beforeProgram","afterProgram"),null===e.tracing||void 0===e.tracing||e.tracing.pop(),Ve;function qe(e){if(e)for(var t=0,r=e;t<r.length;t++){var n=r[t];ce.add(n);}}function We(t,r,n){if(!t.length)return e.emptyArray;var i=e.getNormalizedAbsolutePath(r.originalFileName,le),a=Ge(r);null===e.tracing||void 0===e.tracing||e.tracing.push("program","resolveModuleNamesWorker",{containingFileName:i}),e.performance.mark("beforeResolveModule");var o=te(t,r,i,n,a);return e.performance.mark("afterResolveModule"),e.performance.measure("ResolveModule","beforeResolveModule","afterResolveModule"),null===e.tracing||void 0===e.tracing||e.tracing.pop(),function(t,r){var n;if($)for(var i=e.getNormalizedAbsolutePath(r.originalFileName,le),a=e.isString(r)?void 0:r.impliedNodeFormat,o=e.getDirectoryPath(i),s=Ge(r),c=0,l=0,u=t;l<u.length;l++){var _=u[l],d="string"==typeof _?y(r,c):m(_,a),p="string"==typeof _?_:_.fileName;c++,e.isExternalModuleNameRelative(p)||qe(null===(n=$.getOrCreateCacheForModuleName(p,d,s).get(o))||void 0===n?void 0:n.resolutionDiagnostics);}}(t,r),o}function He(t,r){if(!t.length)return [];var n=e.isString(r)?r:e.getNormalizedAbsolutePath(r.originalFileName,le),i=e.isString(r)?void 0:Ge(r),a=e.isString(r)?void 0:r.impliedNodeFormat;null===e.tracing||void 0===e.tracing||e.tracing.push("program","resolveTypeReferenceDirectiveNamesWorker",{containingFileName:n}),e.performance.mark("beforeResolveTypeReference");var o=re(t,n,i,a);return e.performance.mark("afterResolveTypeReference"),e.performance.measure("ResolveTypeReference","beforeResolveTypeReference","afterResolveTypeReference"),null===e.tracing||void 0===e.tracing||e.tracing.pop(),o}function Ge(t){var r=Rt(t.originalFileName);if(r||!e.isDeclarationFileName(t.originalFileName))return r;var n=Qe(t.path);if(n)return n;if(ne.realpath&&j.preserveSymlinks&&e.stringContains(t.originalFileName,e.nodeModulesPathPart)){var i=Ye(ne.realpath(t.originalFileName));return i===t.path?void 0:Qe(i)}}function Qe(t){var r=jt(t);return e.isString(r)?Rt(r):r?Bt((function(r){var n=e.outFile(r.commandLine.options);if(n)return Ye(n)===t?r:void 0})):void 0}function Xe(t){if(e.containsPath(se,t.fileName,!1)){var r=e.getBaseFileName(t.fileName);if("lib.d.ts"===r||"lib.es6.d.ts"===r)return 0;var n=e.removeSuffix(e.removePrefix(r,"lib."),".d.ts"),i=e.libs.indexOf(n);if(-1!==i)return i+1}return e.libs.length+2}function Ye(t){return e.toPath(t,le,Ht)}function Ze(){if(void 0===b){var t=e.filter(v,(function(t){return e.sourceFileMayBeEmitted(t,Ve)}));b=e.getCommonSourceDirectory(j,(function(){return e.mapDefined(t,(function(e){return e.isDeclarationFile?void 0:e.fileName}))}),le,Ht,(function(r){return function(t,r){for(var n=!0,i=ne.getCanonicalFileName(e.getNormalizedAbsolutePath(r,le)),a=0,o=t;a<o.length;a++){var s=o[a];s.isDeclarationFile||0!==ne.getCanonicalFileName(e.getNormalizedAbsolutePath(s.fileName,le)).indexOf(i)&&(Zt(s,e.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,[s.fileName,r]),n=!1);}return n}(t,r)}));}return b}function $e(t,r){if(0===Ie&&!r.ambientModuleNames.length)return We(t,r,void 0);var n,i,a,o=K&&K.getSourceFile(r.fileName);if(o!==r&&r.resolvedModules){for(var s=[],c=0,l=0,u=t;l<u.length;l++){var _=u[l],d=r.resolvedModules.get(_,y(r,c));c++,s.push(d);}return s}var p={};for(c=0;c<t.length;c++){if(_=t[c],r===o&&!pe(o.path)){var f=e.getResolvedModule(o,_,y(o,c));if(f){e.isTraceEnabled(j,ne)&&e.trace(ne,f.packageId?e.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3:e.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2,_,e.getNormalizedAbsolutePath(r.originalFileName,le),f.resolvedFileName,f.packageId&&e.packageIdToString(f.packageId)),(i||(i=new Array(t.length)))[c]=f,(a||(a=[])).push(_);continue}}var g=!1;e.contains(r.ambientModuleNames,_)?(g=!0,e.isTraceEnabled(j,ne)&&e.trace(ne,e.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1,_,e.getNormalizedAbsolutePath(r.originalFileName,le))):g=h(_,c),g?(i||(i=new Array(t.length)))[c]=p:(n||(n=[])).push(_);}var m=n&&n.length?We(n,r,a):e.emptyArray;if(!i)return e.Debug.assert(m.length===t.length),m;var v=0;for(c=0;c<i.length;c++)i[c]?i[c]===p&&(i[c]=void 0):(i[c]=m[v],v++);return e.Debug.assert(v===m.length),i;function h(t,r){if(r>=e.length(null==o?void 0:o.imports)+e.length(null==o?void 0:o.moduleAugmentations))return !1;var n=e.getResolvedModule(o,t,o&&y(o,r)),i=n&&K.getSourceFile(n.resolvedFileName);if(n&&i)return !1;var a=U.get(t);return !!a&&(e.isTraceEnabled(j,ne)&&e.trace(ne,e.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified,t,a),!0)}}function et(t){return {getPrependNodes:nt,getCanonicalFileName:Ht,getCommonSourceDirectory:Ve.getCommonSourceDirectory,getCompilerOptions:Ve.getCompilerOptions,getCurrentDirectory:function(){return le},getNewLine:function(){return ne.getNewLine()},getSourceFile:Ve.getSourceFile,getSourceFileByPath:Ve.getSourceFileByPath,getSourceFiles:Ve.getSourceFiles,getLibFileFromReference:Ve.getLibFileFromReference,isSourceFileFromExternalLibrary:it,getResolvedProjectReferenceToRedirect:Rt,getProjectReferenceRedirect:Ot,isSourceOfProjectReferenceRedirect:Jt,getSymlinkCache:dr,writeFile:t||tt,isEmitBlocked:ot,readFile:function(e){return ne.readFile(e)},fileExists:function(t){var r=Ye(t);return !!ct(r)||!e.contains(me,r)&&ne.fileExists(t)},useCaseSensitiveFileNames:function(){return ne.useCaseSensitiveFileNames()},getProgramBuildInfo:function(){return Ve.getProgramBuildInfo&&Ve.getProgramBuildInfo()},getSourceFileFromReference:function(e,t){return Ve.getSourceFileFromReference(e,t)},redirectTargetsMap:Se,getFileIncludeReasons:Ve.getFileIncludeReasons}}function tt(e,t,r,n,i,a){ne.writeFile(e,t,r,n,i,a);}function rt(){return ye}function nt(){return A(z,(function(e,t){var r;return null===(r=ye[t])||void 0===r?void 0:r.commandLine}),(function(e){var t=Ye(e),r=ct(t);return r?r.text:Ce.has(t)?void 0:ne.readFile(t)}))}function it(e){return !!Y.get(e.path)}function at(){return O||(O=e.createTypeChecker(Ve))}function ot(e){return de.has(Ye(e))}function st(e){return ct(Ye(e))}function ct(e){return Ce.get(e)||void 0}function lt(t,r,n){return t?r(t,n):e.sortAndDeduplicateDiagnostics(e.flatMap(Ve.getSourceFiles(),(function(e){return n&&n.throwIfCancellationRequested(),r(e,n)})))}function ut(t){var r;if(e.skipTypeChecking(t,j,Ve))return e.emptyArray;var n=ce.getDiagnostics(t.fileName);return (null===(r=t.commentDirectives)||void 0===r?void 0:r.length)?mt(t,t.commentDirectives,n).diagnostics:n}function _t(t){return e.isSourceFileJS(t)?(t.additionalSyntacticDiagnostics||(t.additionalSyntacticDiagnostics=function(t){return dt((function(){var r=[];return n(t,t),e.forEachChildRecursively(t,n,(function(t,n){switch(n.decorators!==t||j.experimentalDecorators||r.push(a(n,e.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)),n.kind){case 257:case 226:case 169:case 171:case 172:case 173:case 213:case 256:case 214:if(t===n.typeParameters)return r.push(i(t,e.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)),"skip";case 237:if(t===n.modifiers)return function(t,n){for(var i=0,o=t;i<o.length;i++){var s=o[i];switch(s.kind){case 85:if(n)continue;case 123:case 121:case 122:case 145:case 135:case 126:case 159:case 101:case 144:r.push(a(s,e.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files,e.tokenToString(s.kind)));}}}(n.modifiers,237===n.kind),"skip";break;case 167:if(t===n.modifiers){for(var o=0,s=t;o<s.length;o++){var c=s[o];124!==c.kind&&r.push(a(c,e.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files,e.tokenToString(c.kind)));}return "skip"}break;case 164:if(t===n.modifiers)return r.push(i(t,e.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)),"skip";break;case 208:case 209:case 228:case 279:case 280:case 210:if(t===n.typeArguments)return r.push(i(t,e.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)),"skip"}})),r;function n(t,n){switch(n.kind){case 164:case 167:case 169:if(n.questionToken===t)return r.push(a(t,e.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files,"?")),"skip";case 168:case 171:case 172:case 173:case 213:case 256:case 214:case 254:if(n.type===t)return r.push(a(t,e.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)),"skip"}switch(t.kind){case 267:if(t.isTypeOnly)return r.push(a(n,e.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files,"import type")),"skip";break;case 272:if(t.isTypeOnly)return r.push(a(t,e.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files,"export type")),"skip";break;case 270:case 275:if(t.isTypeOnly)return r.push(a(t,e.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files,e.isImportSpecifier(t)?"import...type":"export...type")),"skip";break;case 265:return r.push(a(t,e.Diagnostics.import_can_only_be_used_in_TypeScript_files)),"skip";case 271:if(t.isExportEquals)return r.push(a(t,e.Diagnostics.export_can_only_be_used_in_TypeScript_files)),"skip";break;case 291:if(117===t.token)return r.push(a(t,e.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)),"skip";break;case 258:var i=e.tokenToString(118);return e.Debug.assertIsDefined(i),r.push(a(t,e.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files,i)),"skip";case 261:var o=16&t.flags?e.tokenToString(142):e.tokenToString(141);return e.Debug.assertIsDefined(o),r.push(a(t,e.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files,o)),"skip";case 259:return r.push(a(t,e.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)),"skip";case 260:var s=e.Debug.checkDefined(e.tokenToString(92));return r.push(a(t,e.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files,s)),"skip";case 230:return r.push(a(t,e.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)),"skip";case 229:return r.push(a(t.type,e.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)),"skip";case 211:e.Debug.fail();}}function i(r,n,i,a,o){var s=r.pos;return e.createFileDiagnostic(t,s,r.end-s,n,i,a,o)}function a(r,n,i,a,o){return e.createDiagnosticForNodeInSourceFile(t,r,n,i,a,o)}}))}(t)),e.concatenate(t.additionalSyntacticDiagnostics,t.parseDiagnostics)):t.parseDiagnostics}function dt(t){try{return t()}catch(t){throw t instanceof e.OperationCanceledException&&(O=void 0),t}}function pt(t,r){return e.concatenate(N(ft(t,r),j),ut(t))}function ft(e,t){return ht(e,t,q,gt)}function gt(t,r){return dt((function(){if(e.skipTypeChecking(t,j,Ve))return e.emptyArray;var n=at();e.Debug.assert(!!t.bindDiagnostics);var i=(1===t.scriptKind||2===t.scriptKind)&&e.isCheckJsEnabledForFile(t,j),a=e.isPlainJsFile(t,j.checkJs),o=!(t.checkJsDirective&&!1===t.checkJsDirective.enabled)&&(3===t.scriptKind||4===t.scriptKind||5===t.scriptKind||a||i||7===t.scriptKind),s=o?t.bindDiagnostics:e.emptyArray,c=o?n.getDiagnostics(t,r):e.emptyArray;return a&&(s=e.filter(s,(function(t){return e.plainJSErrors.has(t.code)})),c=e.filter(c,(function(t){return e.plainJSErrors.has(t.code)}))),function(t,r){for(var n,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];var o=e.flatten(i);if(!r||!(null===(n=t.commentDirectives)||void 0===n?void 0:n.length))return o;for(var s=mt(t,t.commentDirectives,o),c=s.diagnostics,l=s.directives,u=0,_=l.getUnusedExpectations();u<_.length;u++){var d=_[u];c.push(e.createDiagnosticForRange(t,d.range,e.Diagnostics.Unused_ts_expect_error_directive));}return c}(t,o&&!a,s,c,i?t.jsDocDiagnostics:void 0)}))}function mt(t,r,n){var i=e.createCommentDirectivesMap(t,r);return {diagnostics:n.filter((function(t){return -1===function(t,r){var n=t.file,i=t.start;if(!n)return -1;for(var a=e.getLineStarts(n),o=e.computeLineAndCharacterOfPosition(a,i).line-1;o>=0;){if(r.markUsed(o))return o;var s=n.text.slice(a[o],a[o+1]).trim();if(""!==s&&!/^(\s*)\/\/(.*)$/.test(s))return -1;o--;}return -1}(t,i)})),directives:i}}function yt(e,t){return ht(e,t,W,vt)}function vt(t,r){return dt((function(){var n=at().getEmitResolver(t,r);return e.getDeclarationDiagnostics(et(e.noop),n,t)||e.emptyArray}))}function ht(t,r,n,i){var a,o=t?null===(a=n.perFile)||void 0===a?void 0:a.get(t.path):n.allDiagnostics;if(o)return o;var s=i(t,r);return t?(n.perFile||(n.perFile=new e.Map)).set(t.path,s):n.allDiagnostics=s,s}function bt(e,t){return e.isDeclarationFile?[]:yt(e,t)}function xt(t,r,n,i){Et(e.normalizePath(t),r,n,void 0,i);}function Dt(e,t){return e.fileName===t.fileName}function St(e,t){return 79===e.kind?79===t.kind&&e.escapedText===t.escapedText:10===t.kind&&e.text===t.text}function Tt(t,r){var n=e.factory.createStringLiteral(t),i=e.factory.createImportDeclaration(void 0,void 0,void 0,n,void 0);return e.addEmitFlags(i,67108864),e.setParent(n,i),e.setParent(i,r),n.flags&=-9,i.flags&=-9,n}function Ct(t){if(!t.imports){var r,n,i,a=e.isSourceFileJS(t),o=e.isExternalModule(t);if((j.isolatedModules||o)&&!t.isDeclarationFile){j.importHelpers&&(r=[Tt(e.externalHelpersModuleNameText,t)]);var s=e.getJSXRuntimeImport(e.getJSXImplicitImportBase(j,t),j);s&&(r||(r=[])).push(Tt(s,t));}for(var c=0,l=t.statements;c<l.length;c++)u(l[c],!1);return (2097152&t.flags||a)&&function(t){for(var n=/import|require/g;null!==n.exec(t.text);){var i=_(t,n.lastIndex);a&&e.isRequireCall(i,!0)||e.isImportCall(i)&&i.arguments.length>=1&&e.isStringLiteralLike(i.arguments[0])?(e.setParentRecursive(i,!1),r=e.append(r,i.arguments[0])):e.isLiteralImportTypeNode(i)&&(e.setParentRecursive(i,!1),r=e.append(r,i.argument.literal));}}(t),t.imports=r||e.emptyArray,t.moduleAugmentations=n||e.emptyArray,void(t.ambientModuleNames=i||e.emptyArray)}function u(a,s){if(e.isAnyImportOrReExport(a)){var c=e.getExternalModuleName(a);!(c&&e.isStringLiteral(c)&&c.text)||s&&e.isExternalModuleNameRelative(c.text)||(e.setParentRecursive(a,!1),r=e.append(r,c),Te||0!==Q||t.isDeclarationFile||(Te=e.startsWith(c.text,"node:")));}else if(e.isModuleDeclaration(a)&&e.isAmbientModule(a)&&(s||e.hasSyntacticModifier(a,2)||t.isDeclarationFile)){a.name.parent=a;var l=e.getTextOfIdentifierOrLiteral(a.name);if(o||s&&!e.isExternalModuleNameRelative(l))(n||(n=[])).push(a.name);else if(!s){t.isDeclarationFile&&(i||(i=[])).push(l);var _=a.body;if(_)for(var d=0,p=_.statements;d<p.length;d++)u(p[d],!0);}}}function _(t,r){for(var n=t,i=function(e){if(e.pos<=r&&(r<e.end||r===e.end&&1===e.kind))return e};;){var o=a&&e.hasJSDocNodes(n)&&e.forEach(n.jsDoc,i)||e.forEachChild(n,i);if(!o)return n;n=o;}}}function kt(t,r,n,i){if(e.hasExtension(t)){var a=ne.getCanonicalFileName(t);if(!j.allowNonTsExtensions&&!e.forEach(e.flatten(_e),(function(t){return e.fileExtensionIs(a,t)})))return void(n&&(e.hasJSFileExtension(a)?n(e.Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option,t):n(e.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1,t,"'"+e.flatten(ue).join("', '")+"'")));var o=r(t);if(n)if(o)S(i)&&a===ne.getCanonicalFileName(ct(i.file).fileName)&&n(e.Diagnostics.A_file_cannot_have_a_reference_to_itself);else {var s=Ot(t);s?n(e.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1,s,t):n(e.Diagnostics.File_0_not_found,t);}return o}var c=j.allowNonTsExtensions&&r(t);if(c)return c;if(!n||!j.allowNonTsExtensions){var l=e.forEach(ue[0],(function(e){return r(t+e)}));return n&&!l&&n(e.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1,t,"'"+e.flatten(ue).join("', '")+"'"),l}n(e.Diagnostics.File_0_not_found,t);}function Et(e,t,r,n,i){kt(e,(function(e){return At(e,t,r,i,n)}),(function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Yt(void 0,i,e,t)}),i);}function Nt(e,t){return Et(e,!1,!1,void 0,t)}function Ft(t,r,n){!S(n)&&e.some(V.get(r.path),S)?Yt(r,n,e.Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing,[r.fileName,t]):Yt(r,n,e.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing,[t,r.fileName]);}function At(t,r,n,i,a){null===e.tracing||void 0===e.tracing||e.tracing.push("program","findSourceFile",{fileName:t,isDefaultLib:r||void 0,fileIncludeKind:e.FileIncludeKind[i.kind]});var o=function(t,r,n,i,a){var o=Ye(t);if(Ee){var s=jt(o);if(!s&&ne.realpath&&j.preserveSymlinks&&e.isDeclarationFileName(t)&&e.stringContains(t,e.nodeModulesPathPart)){var c=Ye(ne.realpath(t));c!==o&&(s=jt(c));}if(s){var l=e.isString(s)?At(s,r,n,i,a):void 0;return l&&It(l,o,void 0),l}}var u,_=t;if(Ce.has(o)){var d=Ce.get(o);if(wt(d||void 0,i),d&&j.forceConsistentCasingInFileNames){var g=d.fileName;Ye(g)!==Ye(t)&&(t=Ot(t)||t),e.getNormalizedAbsolutePathWithoutRoot(g,le)!==e.getNormalizedAbsolutePathWithoutRoot(t,le)&&Ft(t,d,i);}return d&&Y.get(d.path)&&0===Q?(Y.set(d.path,!1),j.noResolve||(Kt(d,r),Ut(d)),j.noLib||Wt(d),X.set(d.path,!1),Gt(d)):d&&X.get(d.path)&&Q<G&&(X.set(d.path,!1),Gt(d)),d||void 0}if(S(i)&&!Ee){var m=Mt(t);if(m){if(e.outFile(m.commandLine.options))return;var y=Lt(m,t);t=y,u=Ye(y);}}var v=ne.getSourceFile(t,Pt(t,$,ne,j),(function(r){return Yt(void 0,i,e.Diagnostics.Cannot_read_file_0_Colon_1,[t,r])}),Oe);if(a){var h=e.packageIdToString(a),b=xe.get(h);if(b){var x=function(e,t,r,n,i,a){var o=Object.create(e);return o.fileName=r,o.path=n,o.resolvedPath=i,o.originalFileName=a,o.redirectInfo={redirectTarget:e,unredirected:t},Y.set(n,Q>0),Object.defineProperties(o,{id:{get:function(){return this.redirectInfo.redirectTarget.id},set:function(e){this.redirectInfo.redirectTarget.id=e;}},symbol:{get:function(){return this.redirectInfo.redirectTarget.symbol},set:function(e){this.redirectInfo.redirectTarget.symbol=e;}}}),o}(b,v,t,o,Ye(t),_);return Se.add(b.path,t),It(x,o,u),wt(x,i),De.set(o,e.packageIdToPackageName(a)),f.push(x),x}v&&(xe.set(h,v),De.set(o,e.packageIdToPackageName(a)));}if(It(v,o,u),v){if(Y.set(o,Q>0),v.fileName=t,v.path=o,v.resolvedPath=Ye(t),v.originalFileName=_,wt(v,i),ne.useCaseSensitiveFileNames()){var D=e.toFileNameLowerCase(o),T=ke.get(D);T?Ft(t,T,i):ke.set(D,v);}ae=ae||v.hasNoDefaultLib&&!n,j.noResolve||(Kt(v,r),Ut(v)),j.noLib||Wt(v),Gt(v),r?p.push(v):f.push(v);}return v}(t,r,n,i,a);return null===e.tracing||void 0===e.tracing||e.tracing.pop(),o}function Pt(t,r,n,i){var a=k(Ye(t),null==r?void 0:r.getPackageJsonInfoCache(),n,i);return {languageVersion:e.getEmitScriptTarget(i),impliedNodeFormat:a,setExternalModuleIndicator:e.getSetExternalModuleIndicator(i)}}function wt(e,t){e&&V.add(e.path,t);}function It(e,t,r){r?(Ce.set(r,e),Ce.set(t,e||!1)):Ce.set(t,e);}function Ot(e){var t=Mt(e);return t&&Lt(t,e)}function Mt(t){if(ye&&ye.length&&!e.isDeclarationFileName(t)&&!e.fileExtensionIs(t,".json"))return Rt(t)}function Lt(t,r){var n=e.outFile(t.commandLine.options);return n?e.changeExtension(n,".d.ts"):e.getOutputDeclarationFileName(r,t.commandLine,!ne.useCaseSensitiveFileNames())}function Rt(t){void 0===he&&(he=new e.Map,Bt((function(e){Ye(j.configFilePath)!==e.sourceFile.path&&e.commandLine.fileNames.forEach((function(t){return he.set(Ye(t),e.sourceFile.path)}));})));var r=he.get(Ye(t));return r&&zt(r)}function Bt(t){return e.forEachResolvedProjectReference(ye,t)}function jt(t){if(e.isDeclarationFileName(t))return void 0===be&&(be=new e.Map,Bt((function(t){var r=e.outFile(t.commandLine.options);if(r){var n=e.changeExtension(r,".d.ts");be.set(Ye(n),!0);}else {var i=e.memoize((function(){return e.getCommonSourceDirectoryOfConfig(t.commandLine,!ne.useCaseSensitiveFileNames())}));e.forEach(t.commandLine.fileNames,(function(r){if(!e.isDeclarationFileName(r)&&!e.fileExtensionIs(r,".json")){var n=e.getOutputDeclarationFileName(r,t.commandLine,!ne.useCaseSensitiveFileNames(),i);be.set(Ye(n),r);}}));}}))),be.get(t)}function Jt(e){return Ee&&!!Rt(e)}function zt(e){if(ve)return ve.get(e)||void 0}function Kt(r,n){e.forEach(r.referencedFiles,(function(i,a){Et(t(i.fileName,r.fileName),n,!1,void 0,{kind:e.FileIncludeKind.ReferenceFile,file:r.path,index:a});}));}function Ut(t){var r=t.typeReferenceDirectives;if(r)for(var n=He(r,t),i=0;i<r.length;i++){var a=t.typeReferenceDirectives[i],o=n[i],s=e.toFileNameLowerCase(a.fileName);e.setResolvedTypeReferenceDirective(t,s,o);var c=a.resolutionMode||t.impliedNodeFormat;c&&e.getEmitModuleResolutionKind(j)!==e.ModuleResolutionKind.Node16&&e.getEmitModuleResolutionKind(j)!==e.ModuleResolutionKind.NodeNext&&ce.add(e.createDiagnosticForRange(t,a,e.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)),Vt(s,c,o,{kind:e.FileIncludeKind.TypeReferenceDirective,file:t.path,index:i});}}function Vt(t,r,n,i){null===e.tracing||void 0===e.tracing||e.tracing.push("program","processTypeReferenceDirective",{directive:t,hasResolved:!!$e,refKind:i.kind,refPath:S(i)?i.file:void 0}),function(t,r,n,i){var a=H.get(t,r);if(!a||!a.primary){var o=!0;if(n){if(n.isExternalLibraryImport&&Q++,n.primary)Et(n.resolvedFileName,!1,!1,n.packageId,i);else if(a){if(n.resolvedFileName!==a.resolvedFileName){var s=ne.readFile(n.resolvedFileName),c=st(a.resolvedFileName);s!==c.text&&Yt(c,i,e.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict,[t,n.resolvedFileName,a.resolvedFileName]);}o=!1;}else Et(n.resolvedFileName,!1,!1,n.packageId,i);n.isExternalLibraryImport&&Q--;}else Yt(void 0,i,e.Diagnostics.Cannot_find_type_definition_file_for_0,[t]);o&&H.set(t,r,n);}}(t,r,n,i),null===e.tracing||void 0===e.tracing||e.tracing.pop();}function qt(t){for(var r=t.split("."),n=r[1],i=2;r[i]&&"d"!==r[i];)n+=(2===i?"/":"-")+r[i],i++;var a=e.combinePaths(le,"__lib_node_modules_lookup_".concat(t,"__.ts")),o=e.resolveModuleName("@typescript/lib-"+n,a,{moduleResolution:e.ModuleResolutionKind.NodeJs},ne,$);return (null==o?void 0:o.resolvedModule)?o.resolvedModule.resolvedFileName:e.combinePaths(se,t)}function Wt(t){e.forEach(t.libReferenceDirectives,(function(r,n){var i=e.toFileNameLowerCase(r.fileName),a=e.libMap.get(i);if(a)xt(qt(a),!0,!0,{kind:e.FileIncludeKind.LibReferenceDirective,file:t.path,index:n});else {var o=e.removeSuffix(e.removePrefix(i,"lib."),".d.ts"),s=e.getSpellingSuggestion(o,e.libs,e.identity),c=s?e.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1:e.Diagnostics.Cannot_find_lib_definition_for_0;(L||(L=[])).push({kind:0,reason:{kind:e.FileIncludeKind.LibReferenceDirective,file:t.path,index:n},diagnostic:c,args:[i,s]});}}));}function Ht(e){return ne.getCanonicalFileName(e)}function Gt(t){var r;if(Ct(t),t.imports.length||t.moduleAugmentations.length){var n=I(t),i=$e(n,t);e.Debug.assert(i.length===n.length);for(var a=(Ee?null===(r=Ge(t))||void 0===r?void 0:r.commandLine.options:void 0)||j,o=0;o<n.length;o++){var s=i[o];if(e.setResolvedModule(t,n[o],s,y(t,o)),s){var c=s.isExternalLibraryImport,l=!e.resolutionExtensionIsTSOrJson(s.extension),u=c&&l,_=s.resolvedFileName;c&&Q++;var d=u&&Q>G,p=_&&!w(a,s)&&!a.noResolve&&o<t.imports.length&&!d&&!(l&&!e.getAllowJSCompilerOption(a))&&(e.isInJSFile(t.imports[o])||!(8388608&t.imports[o].flags));d?X.set(t.path,!0):p&&At(_,!1,!1,{kind:e.FileIncludeKind.Import,file:t.path,index:o},s.packageId),c&&Q--;}}}else t.resolvedModules=void 0;}function Qt(t){ve||(ve=new e.Map);var r,n,i=P(t),a=Ye(i),o=ve.get(a);if(void 0!==o)return o||void 0;if(ne.getParsedCommandLine){if(!(r=ne.getParsedCommandLine(i)))return It(void 0,a,void 0),void ve.set(a,!1);n=e.Debug.checkDefined(r.options.configFile),e.Debug.assert(!n.path||n.path===a),It(n,a,void 0);}else {var s=e.getNormalizedAbsolutePath(e.getDirectoryPath(i),ne.getCurrentDirectory());if(It(n=ne.getSourceFile(i,100),a,void 0),void 0===n)return void ve.set(a,!1);r=e.parseJsonSourceFileConfigFileContent(n,ie,s,void 0,i);}n.fileName=i,n.path=a,n.resolvedPath=a,n.originalFileName=i;var c={commandLine:r,sourceFile:n};return ve.set(a,c),r.projectReferences&&(c.references=r.projectReferences.map(Qt)),c}function Xt(t,r,i,a){var o,s,c,l=S(r)?r:void 0;t&&(null===(o=V.get(t.path))||void 0===o||o.forEach(f)),r&&f(r),l&&1===(null==s?void 0:s.length)&&(s=void 0);var u=l&&C(ct,l),_=s&&e.chainDiagnosticMessages(s,e.Diagnostics.The_file_is_in_the_program_because_Colon),d=t&&e.explainIfFileIsRedirect(t),p=e.chainDiagnosticMessages.apply(void 0,n$4([d?_?n$4([_],d,!0):d:_,i],a||e.emptyArray,!1));return u&&T(u)?e.createFileDiagnosticFromMessageChain(u.file,u.pos,u.end-u.pos,p,c):e.createCompilerDiagnosticFromMessageChain(p,c);function f(t){(s||(s=[])).push(e.fileIncludeReasonToDiagnostics(Ve,t)),!l&&S(t)?l=t:l!==t&&(c=e.append(c,function(t){if(S(t)){var r,n=C(ct,t);switch(t.kind){case e.FileIncludeKind.Import:r=e.Diagnostics.File_is_included_via_import_here;break;case e.FileIncludeKind.ReferenceFile:r=e.Diagnostics.File_is_included_via_reference_here;break;case e.FileIncludeKind.TypeReferenceDirective:r=e.Diagnostics.File_is_included_via_type_library_reference_here;break;case e.FileIncludeKind.LibReferenceDirective:r=e.Diagnostics.File_is_included_via_library_reference_here;break;default:e.Debug.assertNever(t);}return T(n)?e.createFileDiagnostic(n.file,n.pos,n.end-n.pos,r):void 0}if(j.configFile){var i,a,o,s;switch(t.kind){case e.FileIncludeKind.RootFile:if(!j.configFile.configFileSpecs)return;var c=e.getNormalizedAbsolutePath(B[t.index],le),l=e.getMatchedFileSpec(Ve,c);if(l){i=e.getTsConfigPropArrayElementValue(j.configFile,"files",l),a=e.Diagnostics.File_is_matched_by_files_list_specified_here;break}var u=e.getMatchedIncludeSpec(Ve,c);if(!u)return;i=e.getTsConfigPropArrayElementValue(j.configFile,"include",u),a=e.Diagnostics.File_is_matched_by_include_pattern_specified_here;break;case e.FileIncludeKind.SourceFromProjectReference:case e.FileIncludeKind.OutputFromProjectReference:var _=e.Debug.checkDefined(null==ye?void 0:ye[t.index]),d=D(z,ye,(function(e,t,r){return e===_?{sourceFile:(null==t?void 0:t.sourceFile)||j.configFile,index:r}:void 0}));if(!d)return;var p=d.sourceFile,f=d.index,g=e.firstDefined(e.getTsConfigPropArray(p,"references"),(function(t){return e.isArrayLiteralExpression(t.initializer)?t.initializer:void 0}));return g&&g.elements.length>f?e.createDiagnosticForNodeInSourceFile(p,g.elements[f],t.kind===e.FileIncludeKind.OutputFromProjectReference?e.Diagnostics.File_is_output_from_referenced_project_specified_here:e.Diagnostics.File_is_source_from_referenced_project_specified_here):void 0;case e.FileIncludeKind.AutomaticTypeDirectiveFile:if(!j.types)return;i=nr("types",t.typeReference),a=e.Diagnostics.File_is_entry_point_of_type_library_specified_here;break;case e.FileIncludeKind.LibFile:if(void 0!==t.index){i=nr("lib",j.lib[t.index]),a=e.Diagnostics.File_is_library_specified_here;break}var m=e.forEachEntry(e.targetOptionDeclaration.type,(function(t,r){return t===e.getEmitScriptTarget(j)?r:void 0}));i=m?(o=m,(s=tr("target"))&&e.firstDefined(s,(function(t){return e.isStringLiteral(t.initializer)&&t.initializer.text===o?t.initializer:void 0}))):void 0,a=e.Diagnostics.File_is_default_library_for_target_specified_here;break;default:e.Debug.assertNever(t);}return i&&e.createDiagnosticForNodeInSourceFile(j.configFile,i,a)}}(t))),t===r&&(r=void 0);}}function Yt(e,t,r,n){(L||(L=[])).push({kind:1,file:e&&e.path,fileProcessingReason:t,diagnostic:r,args:n});}function Zt(e,t,r){ce.add(Xt(e,void 0,t,r));}function $t(t,r,n,i,a,o){for(var s=!0,c=0,l=rr();c<l.length;c++){var u=l[c];if(e.isObjectLiteralExpression(u.initializer))for(var _=0,d=e.getPropertyAssignment(u.initializer,t);_<d.length;_++){var p=d[_].initializer;e.isArrayLiteralExpression(p)&&p.elements.length>r&&(ce.add(e.createDiagnosticForNodeInSourceFile(j.configFile,p.elements[r],n,i,a,o)),s=!1);}}s&&ce.add(e.createCompilerDiagnostic(n,i,a,o));}function er(t,r,n,i){for(var a=!0,o=0,s=rr();o<s.length;o++){var c=s[o];e.isObjectLiteralExpression(c.initializer)&&lr(c.initializer,t,r,void 0,n,i)&&(a=!1);}a&&ce.add(e.createCompilerDiagnostic(n,i));}function tr(t){var r=cr();return r&&e.getPropertyAssignment(r,t)}function rr(){return tr("paths")||e.emptyArray}function nr(t,r){var n=cr();return n&&e.getPropertyArrayElementValue(n,t,r)}function ir(e,t,r,n){sr(!0,t,r,e,t,r,n);}function ar(e,t,r,n){sr(!1,e,void 0,t,r,n);}function or(t,r,n,i,a){var o=e.firstDefined(e.getTsConfigPropArray(t||j.configFile,"references"),(function(t){return e.isArrayLiteralExpression(t.initializer)?t.initializer:void 0}));o&&o.elements.length>r?ce.add(e.createDiagnosticForNodeInSourceFile(t||j.configFile,o.elements[r],n,i,a)):ce.add(e.createCompilerDiagnostic(n,i,a));}function sr(t,r,n,i,a,o,s){var c=cr();(!c||!lr(c,t,r,n,i,a,o,s))&&ce.add(e.createCompilerDiagnostic(i,a,o,s));}function cr(){if(void 0===Z){Z=!1;var t=e.getTsConfigObjectLiteralExpression(j.configFile);if(t)for(var r=0,n=e.getPropertyAssignment(t,"compilerOptions");r<n.length;r++){var i=n[r];if(e.isObjectLiteralExpression(i.initializer)){Z=i.initializer;break}}}return Z||void 0}function lr(t,r,n,i,a,o,s,c){for(var l=e.getPropertyAssignment(t,n,i),u=0,_=l;u<_.length;u++){var d=_[u];ce.add(e.createDiagnosticForNodeInSourceFile(j.configFile,r?d.name:d.initializer,a,o,s,c));}return !!l.length}function ur(e,t){de.set(Ye(e),!0),ce.add(t);}function _r(t,r){return 0===e.comparePaths(t,r,le,!ne.useCaseSensitiveFileNames())}function dr(){return ne.getSymlinkCache?ne.getSymlinkCache():(h||(h=e.createSymlinkCache(le,Ht)),v&&H&&!h.hasProcessedResolutions()&&h.setSymlinksFromResolutions(v,H),h)}},e.emitSkippedWithNoDiagnostics={diagnostics:e.emptyArray,sourceMaps:void 0,emittedFiles:void 0,emitSkipped:!0},e.handleNoEmitOptions=E,e.filterSemanticDiagnostics=N,e.parseConfigHostFromCompilerHostLike=F,e.createPrependNodes=A,e.resolveProjectReferencePath=P,e.getResolutionDiagnostic=w,e.getModuleNameStringLiteralAt=O;}(t),function(e){function t(e,t,r,n,i,a){var o=[],s=e.emit(t,(function(e,t,r){o.push({name:e,writeByteOrderMark:r,text:t});}),n,r,i,a),c=s.emitSkipped,l=s.diagnostics,u=s.exportedModulesFromDeclarationEmit;return {outputFiles:o,emitSkipped:c,diagnostics:l,exportedModulesFromDeclarationEmit:u}}e.getFileEmitOutput=t,function(r){function n(){return function t(r,n,a){var o={clone:function(){return t(new e.Map(r),new e.Map(n),a&&new e.Set(a))},forEach:function(e){return r.forEach(e)},getKeys:function(e){return n.get(e)},getValues:function(e){return r.get(e)},hasKey:function(e){return r.has(e)},keys:function(){return r.keys()},deletedKeys:function(){return a},deleteKey:function(t){(a||(a=new e.Set)).add(t);var o=r.get(t);return !!o&&(o.forEach((function(e){return i(n,e,t)})),r.delete(t),!0)},set:function(t,s){null==a||a.delete(t);var c=r.get(t);return r.set(t,s),null==c||c.forEach((function(e){s.has(e)||i(n,e,t);})),s.forEach((function(r){(null==c?void 0:c.has(r))||function(t,r,n){var i=t.get(r);i||(i=new e.Set,t.set(r,i)),i.add(n);}(n,r,t);})),o},clear:function(){r.clear(),n.clear(),null==a||a.clear();}};return o}(new e.Map,new e.Map,void 0)}function i(e,t,r){var n=e.get(t);return !!(null==n?void 0:n.delete(r))&&(n.size||e.delete(t),!0)}function a(t){return e.mapDefined(t.declarations,(function(t){var r;return null===(r=e.getSourceFileOfNode(t))||void 0===r?void 0:r.resolvedPath}))}function o(e,t){var r=e.getSymbolAtLocation(t);return r&&a(r)}function s(t,r,n,i){return e.toPath(t.getProjectReferenceRedirect(r)||r,n,i)}function c(t,r,n){var i;if(r.imports&&r.imports.length>0)for(var a=t.getTypeChecker(),c=0,l=r.imports;c<l.length;c++){var u=o(a,l[c]);null==u||u.forEach(S);}var _=e.getDirectoryPath(r.resolvedPath);if(r.referencedFiles&&r.referencedFiles.length>0)for(var d=0,p=r.referencedFiles;d<p.length;d++){var f=p[d];S(s(t,f.fileName,_,n));}if(r.resolvedTypeReferenceDirectiveNames&&r.resolvedTypeReferenceDirectiveNames.forEach((function(e){if(e){var r=e.resolvedFileName;S(s(t,r,_,n));}})),r.moduleAugmentations.length){a=t.getTypeChecker();for(var g=0,m=r.moduleAugmentations;g<m.length;g++){var y=m[g];if(e.isStringLiteral(y)){var v=a.getSymbolAtLocation(y);v&&D(v);}}}for(var h=0,b=t.getTypeChecker().getAmbientModules();h<b.length;h++){var x=b[h];x.declarations&&x.declarations.length>1&&D(x);}return i;function D(t){if(t.declarations)for(var n=0,i=t.declarations;n<i.length;n++){var a=i[n],o=e.getSourceFileOfNode(a);o&&o!==r&&S(o.resolvedPath);}}function S(t){(i||(i=new e.Set)).add(t);}}function l(e,t){return t&&!t.referencedMap==!e}function u(e,t){t.forEach((function(t,r){return _(e,t,r)}));}function _(e,t,r){e.fileInfos.get(r).signature=t,e.hasCalledUpdateShapeSignature.add(r);}function d(r,n,i,a,o,s,c,l){if(void 0===l&&(l=r.useFileVersionAsSignature),e.Debug.assert(!!i),e.Debug.assert(!c||!!r.exportedModulesMap,"Compute visible to outside map only if visibleToOutsideReferencedMap present in the state"),r.hasCalledUpdateShapeSignature.has(i.resolvedPath)||a.has(i.resolvedPath))return !1;var u=r.fileInfos.get(i.resolvedPath);if(!u)return e.Debug.fail();var _,d=u.signature;if(!i.isDeclarationFile&&!l){var f=t(n,i,!0,o,void 0,!0),g=e.firstOrUndefined(f.outputFiles);g&&(e.Debug.assert(e.isDeclarationFileName(g.name),"File extension for signature expected to be dts",(function(){return "Found: ".concat(e.getAnyExtensionFromPath(g.name)," for ").concat(g.name,":: All output files: ").concat(JSON.stringify(f.outputFiles.map((function(e){return e.name}))))})),_=(s||e.generateDjb2Hash)(g.text),c&&_!==d&&p(i,f.exportedModulesFromDeclarationEmit,c));}if(void 0===_&&(_=i.version,c&&_!==d)){var m=r.referencedMap?r.referencedMap.getValues(i.resolvedPath):void 0;m?c.set(i.resolvedPath,m):c.deleteKey(i.resolvedPath);}return a.set(i.resolvedPath,_),_!==d}function p(t,r,n){var i;r?(r.forEach((function(t){var r;(null==(r=a(t))?void 0:r.length)&&(i||(i=new e.Set),r.forEach((function(e){return i.add(e)})));})),i?n.set(t.resolvedPath,i):n.deleteKey(t.resolvedPath)):n.deleteKey(t.resolvedPath);}function f(t,r){if(!t.allFileNames){var n=r.getSourceFiles();t.allFileNames=n===e.emptyArray?e.emptyArray:n.map((function(e){return e.fileName}));}return t.allFileNames}function g(t,r){var n=t.referencedMap.getKeys(r);return n?e.arrayFrom(n.keys()):[]}function m(t){return function(t){return e.some(t.moduleAugmentations,(function(t){return e.isGlobalScopeAugmentation(t.parent)}))}(t)||!e.isExternalOrCommonJsModule(t)&&!e.isJsonSourceFile(t)&&!function(t){for(var r=0,n=t.statements;r<n.length;r++){var i=n[r];if(!e.isModuleWithStringLiteralName(i))return !1}return !0}(t)}function y(t,r,n){if(t.allFilesExcludingDefaultLibraryFile)return t.allFilesExcludingDefaultLibraryFile;var i;n&&c(n);for(var a=0,o=r.getSourceFiles();a<o.length;a++){var s=o[a];s!==n&&c(s);}return t.allFilesExcludingDefaultLibraryFile=i||e.emptyArray,t.allFilesExcludingDefaultLibraryFile;function c(e){r.isSourceFileDefaultLibrary(e)||(i||(i=[])).push(e);}}function v(t,r,n){var i=r.getCompilerOptions();return i&&e.outFile(i)?[n]:y(t,r,n)}function h(t,r,n,i,a,o,s){if(m(n))return y(t,r,n);var c=r.getCompilerOptions();if(c&&(c.isolatedModules||e.outFile(c)))return [n];var l=new e.Map;l.set(n.resolvedPath,n);for(var u=g(t,n.resolvedPath);u.length>0;){var _=u.pop();if(!l.has(_)){var p=r.getSourceFileByPath(_);l.set(_,p),p&&d(t,r,p,i,a,o,s)&&u.push.apply(u,g(t,p.resolvedPath));}}return e.arrayFrom(e.mapDefinedIterator(l.values(),(function(e){return e})))}r.createManyToManyPathMap=n,r.canReuseOldState=l,r.create=function(t,r,i,a){var o=new e.Map,s=t.getCompilerOptions().module!==e.ModuleKind.None?n():void 0,u=s?n():void 0,_=new e.Set,d=l(s,i);t.getTypeChecker();for(var p=0,f=t.getSourceFiles();p<f.length;p++){var g=f[p],y=e.Debug.checkDefined(g.version,"Program intended to be used with Builder should have source files with versions set"),v=d?i.fileInfos.get(g.resolvedPath):void 0;if(s){var h=c(t,g,r);if(h&&s.set(g.resolvedPath,h),d){var b=i.exportedModulesMap.getValues(g.resolvedPath);b&&u.set(g.resolvedPath,b);}}o.set(g.resolvedPath,{version:y,signature:v&&v.signature,affectsGlobalScope:m(g)||void 0,impliedFormat:g.impliedNodeFormat});}return {fileInfos:o,referencedMap:s,exportedModulesMap:u,hasCalledUpdateShapeSignature:_,useFileVersionAsSignature:!a&&!d}},r.releaseCache=function(e){e.allFilesExcludingDefaultLibraryFile=void 0,e.allFileNames=void 0;},r.clone=function(t){var r,n;return {fileInfos:new e.Map(t.fileInfos),referencedMap:null===(r=t.referencedMap)||void 0===r?void 0:r.clone(),exportedModulesMap:null===(n=t.exportedModulesMap)||void 0===n?void 0:n.clone(),hasCalledUpdateShapeSignature:new e.Set(t.hasCalledUpdateShapeSignature),useFileVersionAsSignature:t.useFileVersionAsSignature}},r.getFilesAffectedBy=function(t,r,n,i,a,o,s){var c=o||new e.Map,l=r.getSourceFileByPath(n);if(!l)return e.emptyArray;if(!d(t,r,l,c,i,a,s))return [l];var _=(t.referencedMap?h:v)(t,r,l,c,i,a,s);return o||u(t,c),_},r.updateSignaturesFromCache=u,r.updateSignatureOfFile=_,r.updateShapeSignature=d,r.updateExportedModules=p,r.updateExportedFilesMapFromCache=function(t,r){var n;r&&(e.Debug.assert(!!t.exportedModulesMap),null===(n=r.deletedKeys())||void 0===n||n.forEach((function(e){return t.exportedModulesMap.deleteKey(e)})),r.forEach((function(e,r){return t.exportedModulesMap.set(r,e)})));},r.getAllDependencies=function(t,r,n){var i=r.getCompilerOptions();if(e.outFile(i))return f(t,r);if(!t.referencedMap||m(n))return f(t,r);for(var a=new e.Set,o=[n.resolvedPath];o.length;){var s=o.pop();if(!a.has(s)){a.add(s);var c=t.referencedMap.getValues(s);if(c)for(var l=c.keys(),u=l.next();!u.done;u=l.next())o.push(u.value);}}return e.arrayFrom(e.mapDefinedIterator(a.keys(),(function(e){var t,n;return null!==(n=null===(t=r.getSourceFileByPath(e))||void 0===t?void 0:t.fileName)&&void 0!==n?n:e})))},r.getReferencedByPaths=g,r.getAllFilesExcludingDefaultLibraryFile=y;}(e.BuilderState||(e.BuilderState={}));}(t),function(e){var t,r;function n(e,t,r){var n=e.file;return i$1(i$1({},e),{file:n?t.getSourceFileByPath(r(n)):void 0})}function a(t,r){e.Debug.assert(!r||!t.affectedFiles||t.affectedFiles[t.affectedFilesIndex-1]!==r||!t.semanticDiagnosticsPerFile.has(r.resolvedPath));}function o(t,r,n,i){for(var a;;){var o=t.affectedFiles;if(o){for(var s=t.seenAffectedFiles,c=t.affectedFilesIndex;c<o.length;){var u=o[c];if(!s.has(u.resolvedPath))return t.affectedFilesIndex=c,l(t,u,r,n,i),u;c++;}t.changedFilesSet.delete(t.currentChangedFilePath),t.currentChangedFilePath=void 0,e.BuilderState.updateSignaturesFromCache(t,t.currentAffectedFilesSignatures),t.currentAffectedFilesSignatures.clear(),e.BuilderState.updateExportedFilesMapFromCache(t,t.currentAffectedFilesExportedModulesMap),null===(a=t.currentAffectedFilesExportedModulesMap)||void 0===a||a.clear(),t.affectedFiles=void 0;}var _=t.changedFilesSet.keys().next();if(_.done)return;var d=e.Debug.checkDefined(t.program),p=d.getCompilerOptions();if(e.outFile(p))return e.Debug.assert(!t.semanticDiagnosticsPerFile),d;t.currentAffectedFilesSignatures||(t.currentAffectedFilesSignatures=new e.Map),t.exportedModulesMap&&(t.currentAffectedFilesExportedModulesMap||(t.currentAffectedFilesExportedModulesMap=e.BuilderState.createManyToManyPathMap())),t.affectedFiles=e.BuilderState.getFilesAffectedBy(t,d,_.value,r,n,t.currentAffectedFilesSignatures,t.currentAffectedFilesExportedModulesMap),t.currentChangedFilePath=_.value,t.affectedFilesIndex=0,t.seenAffectedFiles||(t.seenAffectedFiles=new e.Set);}}function s(e){e.affectedFilesPendingEmit=void 0,e.affectedFilesPendingEmitKind=void 0,e.affectedFilesPendingEmitIndex=void 0;}function c(t){if(!t.cleanedDiagnosticsOfLibFiles){t.cleanedDiagnosticsOfLibFiles=!0;var r=e.Debug.checkDefined(t.program),n=r.getCompilerOptions();e.forEach(r.getSourceFiles(),(function(i){return r.isSourceFileDefaultLibrary(i)&&!e.skipTypeChecking(i,n,r)&&_(t,i.resolvedPath)}));}}function l(t,r,n,i,a){var o;if(_(t,r.resolvedPath),t.allFilesExcludingDefaultLibraryFile===t.affectedFiles)return c(t),void e.BuilderState.updateShapeSignature(t,e.Debug.checkDefined(t.program),r,e.Debug.checkDefined(t.currentAffectedFilesSignatures),n,i,t.currentAffectedFilesExportedModulesMap);e.Debug.assert(t.hasCalledUpdateShapeSignature.has(r.resolvedPath)||(null===(o=t.currentAffectedFilesSignatures)||void 0===o?void 0:o.has(r.resolvedPath)),"Signature not updated for affected file: ".concat(r.fileName)),t.compilerOptions.assumeChangesOnlyAffectDirectDependencies||function(t,r,n,i,a){if(t.exportedModulesMap&&t.changedFilesSet.has(r.resolvedPath)&&d(t,r.resolvedPath)){if(t.compilerOptions.isolatedModules){var o=new e.Map;o.set(r.resolvedPath,!0);for(var s=e.BuilderState.getReferencedByPaths(t,r.resolvedPath);s.length>0;){var c=s.pop();if(!o.has(c)){if(o.set(c,!0),f(t,c,n,i,a))return;if(u(t,c,n,i,a),d(t,c)){var l=e.Debug.checkDefined(t.program).getSourceFileByPath(c);s.push.apply(s,e.BuilderState.getReferencedByPaths(t,l.resolvedPath));}}}}e.Debug.assert(!!t.currentAffectedFilesExportedModulesMap);var _=new e.Set;p(t,r.resolvedPath,(function(r){if(f(t,r,n,i,a))return !0;var o=t.referencedMap.getKeys(r);return o&&e.forEachKey(o,(function(e){return g(t,e,_,n,i,a)}))}));}}(t,r,n,i,a);}function u(t,r,n,i,a){if(_(t,r),!t.changedFilesSet.has(r)){var o=e.Debug.checkDefined(t.program),s=o.getSourceFileByPath(r);s&&(e.BuilderState.updateShapeSignature(t,o,s,e.Debug.checkDefined(t.currentAffectedFilesSignatures),n,i,t.currentAffectedFilesExportedModulesMap,!a.disableUseFileVersionAsSignature),e.getEmitDeclarations(t.compilerOptions)&&T(t,r,0));}}function _(e,t){return !e.semanticDiagnosticsFromOldState||(e.semanticDiagnosticsFromOldState.delete(t),e.semanticDiagnosticsPerFile.delete(t),!e.semanticDiagnosticsFromOldState.size)}function d(t,r){return e.Debug.checkDefined(t.currentAffectedFilesSignatures).get(r)!==e.Debug.checkDefined(t.fileInfos.get(r)).signature}function p(t,r,n){var i=t.currentAffectedFilesExportedModulesMap.getKeys(r);return i&&e.forEachKey(i,n)||(i=t.exportedModulesMap.getKeys(r))&&e.forEachKey(i,(function(e){var r;return t.currentAffectedFilesExportedModulesMap.hasKey(e)||(null===(r=t.currentAffectedFilesExportedModulesMap.deletedKeys())||void 0===r?void 0:r.has(e))?void 0:n(e)}))}function f(t,r,n,i,a){var o;return !!(null===(o=t.fileInfos.get(r))||void 0===o?void 0:o.affectsGlobalScope)&&(e.BuilderState.getAllFilesExcludingDefaultLibraryFile(t,t.program,void 0).forEach((function(e){return u(t,e.resolvedPath,n,i,a)})),c(t),!0)}function g(t,r,n,i,a,o){var s;if(e.tryAddToSet(n,r)){if(f(t,r,i,a,o))return !0;u(t,r,i,a,o),e.Debug.assert(!!t.currentAffectedFilesExportedModulesMap),p(t,r,(function(e){return g(t,e,n,i,a,o)})),null===(s=t.referencedMap.getKeys(r))||void 0===s||s.forEach((function(e){return !n.has(e)&&u(t,e,i,a,o)}));}}function m(t,r,n,i,a){a?t.buildInfoEmitPending=!1:r===t.program?(t.changedFilesSet.clear(),t.programEmitComplete=!0):(t.seenAffectedFiles.add(r.resolvedPath),void 0!==n&&(t.seenEmittedFiles||(t.seenEmittedFiles=new e.Map)).set(r.resolvedPath,n),i?(t.affectedFilesPendingEmitIndex++,t.buildInfoEmitPending=!0):t.affectedFilesIndex++);}function y(e,t,r){return m(e,r),{result:t,affected:r}}function v(e,t,r,n,i,a){return m(e,r,n,i,a),{result:t,affected:r}}function h(t,r,n){return e.concatenate(function(t,r,n){var i=r.resolvedPath;if(t.semanticDiagnosticsPerFile){var a=t.semanticDiagnosticsPerFile.get(i);if(a)return e.filterSemanticDiagnostics(a,t.compilerOptions)}var o=e.Debug.checkDefined(t.program).getBindAndCheckDiagnostics(r,n);return t.semanticDiagnosticsPerFile&&t.semanticDiagnosticsPerFile.set(i,o),e.filterSemanticDiagnostics(o,t.compilerOptions)}(t,r,n),e.Debug.checkDefined(t.program).getProgramDiagnostics(r))}function b(t,r){for(var n,i=e.getOptionsNameMap().optionsNameMap,a=0,o=e.getOwnKeys(t).sort(e.compareStringsCaseSensitive);a<o.length;a++){var s=o[a],c=s.toLowerCase(),l=i.get(c);((null==l?void 0:l.affectsEmit)||(null==l?void 0:l.affectsSemanticDiagnostics)||"strict"===c||"skiplibcheck"===c||"skipdefaultlibcheck"===c)&&((n||(n={}))[s]=x(l,t[s],r));}return n}function x(e,t,r){if(e)if("list"===e.type){var n=t;if(e.element.isFilePath&&n.length)return n.map(r)}else if(e.isFilePath)return r(t);return t}function D(t,r){return e.Debug.assert(!!t.length),t.map((function(e){var t=S(e,r);t.reportsUnnecessary=e.reportsUnnecessary,t.reportDeprecated=e.reportsDeprecated,t.source=e.source,t.skippedOn=e.skippedOn;var n=e.relatedInformation;return t.relatedInformation=n?n.length?n.map((function(e){return S(e,r)})):[]:void 0,t}))}function S(e,t){var r=e.file;return i$1(i$1({},e),{file:r?t(r.resolvedPath):void 0})}function T(t,r,n){t.affectedFilesPendingEmit||(t.affectedFilesPendingEmit=[]),t.affectedFilesPendingEmitKind||(t.affectedFilesPendingEmitKind=new e.Map);var i=t.affectedFilesPendingEmitKind.get(r);t.affectedFilesPendingEmit.push(r),t.affectedFilesPendingEmitKind.set(r,i||n),void 0===t.affectedFilesPendingEmitIndex&&(t.affectedFilesPendingEmitIndex=0);}function C(t){return e.isString(t)?{version:t,signature:t,affectsGlobalScope:void 0,impliedFormat:void 0}:e.isString(t.signature)?t:{version:t.version,signature:!1===t.signature?void 0:t.version,affectsGlobalScope:t.affectsGlobalScope,impliedFormat:t.impliedFormat}}function k(t,r){return {getState:e.notImplemented,backupState:e.noop,restoreState:e.noop,getProgram:n,getProgramOrUndefined:function(){return t().program},releaseProgram:function(){return t().program=void 0},getCompilerOptions:function(){return t().compilerOptions},getSourceFile:function(e){return n().getSourceFile(e)},getSourceFiles:function(){return n().getSourceFiles()},getOptionsDiagnostics:function(e){return n().getOptionsDiagnostics(e)},getGlobalDiagnostics:function(e){return n().getGlobalDiagnostics(e)},getConfigFileParsingDiagnostics:function(){return r},getSyntacticDiagnostics:function(e,t){return n().getSyntacticDiagnostics(e,t)},getDeclarationDiagnostics:function(e,t){return n().getDeclarationDiagnostics(e,t)},getSemanticDiagnostics:function(e,t){return n().getSemanticDiagnostics(e,t)},emit:function(e,t,r,i,a){return n().emit(e,t,r,i,a)},emitBuildInfo:function(e,t){return n().emitBuildInfo(e,t)},getAllDependencies:e.notImplemented,getCurrentDirectory:function(){return n().getCurrentDirectory()},close:e.noop};function n(){return e.Debug.checkDefined(t().program)}}(r=e.BuilderFileEmit||(e.BuilderFileEmit={}))[r.DtsOnly=0]="DtsOnly",r[r.Full=1]="Full",function(e){e[e.SemanticDiagnosticsBuilderProgram=0]="SemanticDiagnosticsBuilderProgram",e[e.EmitAndSemanticDiagnosticsBuilderProgram=1]="EmitAndSemanticDiagnosticsBuilderProgram";}(t=e.BuilderProgramKind||(e.BuilderProgramKind={})),e.getBuilderCreationParameters=function(t,r,n,i,a,o){var s,c,l;return void 0===t?(e.Debug.assert(void 0===r),s=n,l=i,e.Debug.assert(!!l),c=l.getProgram()):e.isArray(t)?(l=i,c=e.createProgram({rootNames:t,options:r,host:n,oldProgram:l&&l.getProgramOrUndefined(),configFileParsingDiagnostics:a,projectReferences:o}),s=n):(c=t,s=r,l=n,a=i),{host:s,newProgram:c,oldProgram:l,configFileParsingDiagnostics:a||e.emptyArray}},e.createBuilderProgram=function(r,i){var c=i.newProgram,l=i.host,u=i.oldProgram,_=i.configFileParsingDiagnostics,d=u&&u.getState();if(d&&c===d.program&&_===c.getConfigFileParsingDiagnostics())return c=void 0,d=void 0,u;var p,f=e.createGetCanonicalFileName(l.useCaseSensitiveFileNames()),g=e.maybeBind(l,l.createHash),x=function(t,r,i,a){var o=e.BuilderState.create(t,r,i,a);o.program=t;var s=t.getCompilerOptions();o.compilerOptions=s,e.outFile(s)||(o.semanticDiagnosticsPerFile=new e.Map),o.changedFilesSet=new e.Set;var c=e.BuilderState.canReuseOldState(o.referencedMap,i),l=c?i.compilerOptions:void 0,u=c&&i.semanticDiagnosticsPerFile&&!!o.semanticDiagnosticsPerFile&&!e.compilerOptionsAffectSemanticDiagnostics(s,l);if(c){if(!i.currentChangedFilePath){var _=i.currentAffectedFilesSignatures;e.Debug.assert(!(i.affectedFiles||_&&_.size),"Cannot reuse if only few affected files of currentChangedFile were iterated");}var d=i.changedFilesSet;u&&e.Debug.assert(!d||!e.forEachKey(d,(function(e){return i.semanticDiagnosticsPerFile.has(e)})),"Semantic diagnostics shouldnt be available for changed files"),null==d||d.forEach((function(e){return o.changedFilesSet.add(e)})),!e.outFile(s)&&i.affectedFilesPendingEmit&&(o.affectedFilesPendingEmit=i.affectedFilesPendingEmit.slice(),o.affectedFilesPendingEmitKind=i.affectedFilesPendingEmitKind&&new e.Map(i.affectedFilesPendingEmitKind),o.affectedFilesPendingEmitIndex=i.affectedFilesPendingEmitIndex,o.seenAffectedFiles=new e.Set);}var p=o.referencedMap,f=c?i.referencedMap:void 0,g=u&&!s.skipLibCheck==!l.skipLibCheck,m=g&&!s.skipDefaultLibCheck==!l.skipDefaultLibCheck;return o.fileInfos.forEach((function(a,s){var l,_,d,y;if(!c||!(l=i.fileInfos.get(s))||l.version!==a.version||(d=_=p&&p.getValues(s))!==(y=f&&f.getValues(s))&&(void 0===d||void 0===y||d.size!==y.size||e.forEachKey(d,(function(e){return !y.has(e)})))||_&&e.forEachKey(_,(function(e){return !o.fileInfos.has(e)&&i.fileInfos.has(e)})))o.changedFilesSet.add(s);else if(u){var v=t.getSourceFileByPath(s);if(v.isDeclarationFile&&!g)return;if(v.hasNoDefaultLib&&!m)return;var h=i.semanticDiagnosticsPerFile.get(s);h&&(o.semanticDiagnosticsPerFile.set(s,i.hasReusableDiagnostic?function(t,r,i){if(!t.length)return e.emptyArray;var a=e.getDirectoryPath(e.getNormalizedAbsolutePath(e.getTsBuildInfoEmitOutputFilePath(r.getCompilerOptions()),r.getCurrentDirectory()));return t.map((function(e){var t=n(e,r,o);t.reportsUnnecessary=e.reportsUnnecessary,t.reportsDeprecated=e.reportDeprecated,t.source=e.source,t.skippedOn=e.skippedOn;var i=e.relatedInformation;return t.relatedInformation=i?i.length?i.map((function(e){return n(e,r,o)})):[]:void 0,t}));function o(t){return e.toPath(t,a,i)}}(h,t,r):h),o.semanticDiagnosticsFromOldState||(o.semanticDiagnosticsFromOldState=new e.Set),o.semanticDiagnosticsFromOldState.add(s));}})),c&&e.forEachEntry(i.fileInfos,(function(e,t){return e.affectsGlobalScope&&!o.fileInfos.has(t)}))?e.BuilderState.getAllFilesExcludingDefaultLibraryFile(o,t,void 0).forEach((function(e){return o.changedFilesSet.add(e.resolvedPath)})):l&&!e.outFile(s)&&e.compilerOptionsAffectEmit(s,l)&&(t.getSourceFiles().forEach((function(e){return T(o,e.resolvedPath,1)})),e.Debug.assert(!o.seenAffectedFiles||!o.seenAffectedFiles.size),o.seenAffectedFiles=o.seenAffectedFiles||new e.Set),c&&e.forEachEntry(i.fileInfos,(function(e,t){o.fileInfos.has(t)&&o.fileInfos.get(t).impliedFormat!==e.impliedFormat&&o.changedFilesSet.add(t);})),o.buildInfoEmitPending=!!o.changedFilesSet.size,o}(c,f,d,l.disableUseFileVersionAsSignature);c.getProgramBuildInfo=function(){return function(t,r){if(!e.outFile(t.compilerOptions)){var n,i,a,o,s,c,l=e.Debug.checkDefined(t.program).getCurrentDirectory(),u=e.getDirectoryPath(e.getNormalizedAbsolutePath(e.getTsBuildInfoEmitOutputFilePath(t.compilerOptions),l)),_=[],d=new e.Map,p=e.arrayFrom(t.fileInfos.entries(),(function(r){var n=r[0],i=r[1],a=C(n);e.Debug.assert(_[a-1]===T(n));var o=t.currentAffectedFilesSignatures&&t.currentAffectedFilesSignatures.get(n),s=null!=o?o:i.signature;return i.version===s?i.affectsGlobalScope||i.impliedFormat?{version:i.version,signature:void 0,affectsGlobalScope:i.affectsGlobalScope,impliedFormat:i.impliedFormat}:i.version:void 0!==s?void 0===o?i:{version:i.version,signature:o,affectsGlobalScope:i.affectsGlobalScope,impliedFormat:i.impliedFormat}:{version:i.version,signature:!1,affectsGlobalScope:i.affectsGlobalScope,impliedFormat:i.impliedFormat}}));if(t.referencedMap&&(a=e.arrayFrom(t.referencedMap.keys()).sort(e.compareStringsCaseSensitive).map((function(e){return [C(e),k(t.referencedMap.getValues(e))]}))),t.exportedModulesMap&&(o=e.mapDefined(e.arrayFrom(t.exportedModulesMap.keys()).sort(e.compareStringsCaseSensitive),(function(e){var r;if(t.currentAffectedFilesExportedModulesMap){if(null===(r=t.currentAffectedFilesExportedModulesMap.deletedKeys())||void 0===r?void 0:r.has(e))return;var n=t.currentAffectedFilesExportedModulesMap.getValues(e);if(n)return [C(e),k(n)]}return [C(e),k(t.exportedModulesMap.getValues(e))]}))),t.semanticDiagnosticsPerFile)for(var f=0,g=e.arrayFrom(t.semanticDiagnosticsPerFile.keys()).sort(e.compareStringsCaseSensitive);f<g.length;f++){var m=g[f],y=t.semanticDiagnosticsPerFile.get(m);(s||(s=[])).push(y.length?[C(m),t.hasReusableDiagnostic?y:D(y,T)]:C(m));}if(t.affectedFilesPendingEmit)for(var v=new e.Set,h=0,x=t.affectedFilesPendingEmit.slice(t.affectedFilesPendingEmitIndex).sort(e.compareStringsCaseSensitive);h<x.length;h++){var S=x[h];e.tryAddToSet(v,S)&&(c||(c=[])).push([C(S),t.affectedFilesPendingEmitKind.get(S)]);}return {fileNames:_,fileInfos:p,options:b(t.compilerOptions,(function(t){return T(e.getNormalizedAbsolutePath(t,l))})),fileIdsList:n,referencedMap:a,exportedModulesMap:o,semanticDiagnosticsPerFile:s,affectedFilesPendingEmit:c}}function T(t){return e.ensurePathIsNonModuleName(e.getRelativePathFromDirectory(u,t,r))}function C(e){var t=d.get(e);return void 0===t&&(_.push(T(e)),d.set(e,t=_.length)),t}function k(t){var r=e.arrayFrom(t.keys(),C).sort(e.compareValues),a=r.join(),o=null==i?void 0:i.get(a);return void 0===o&&((n||(n=[])).push(r),(i||(i=new e.Map)).set(a,o=n.length)),o}}(x,f)},c=void 0,u=void 0,d=void 0;var S=function(){return x},C=k(S,_);return C.getState=S,C.backupState=function(){e.Debug.assert(void 0===p),p=function(t){var r,n=e.BuilderState.clone(t);return n.semanticDiagnosticsPerFile=t.semanticDiagnosticsPerFile&&new e.Map(t.semanticDiagnosticsPerFile),n.changedFilesSet=new e.Set(t.changedFilesSet),n.affectedFiles=t.affectedFiles,n.affectedFilesIndex=t.affectedFilesIndex,n.currentChangedFilePath=t.currentChangedFilePath,n.currentAffectedFilesSignatures=t.currentAffectedFilesSignatures&&new e.Map(t.currentAffectedFilesSignatures),n.currentAffectedFilesExportedModulesMap=null===(r=t.currentAffectedFilesExportedModulesMap)||void 0===r?void 0:r.clone(),n.seenAffectedFiles=t.seenAffectedFiles&&new e.Set(t.seenAffectedFiles),n.cleanedDiagnosticsOfLibFiles=t.cleanedDiagnosticsOfLibFiles,n.semanticDiagnosticsFromOldState=t.semanticDiagnosticsFromOldState&&new e.Set(t.semanticDiagnosticsFromOldState),n.program=t.program,n.compilerOptions=t.compilerOptions,n.affectedFilesPendingEmit=t.affectedFilesPendingEmit&&t.affectedFilesPendingEmit.slice(),n.affectedFilesPendingEmitKind=t.affectedFilesPendingEmitKind&&new e.Map(t.affectedFilesPendingEmitKind),n.affectedFilesPendingEmitIndex=t.affectedFilesPendingEmitIndex,n.seenEmittedFiles=t.seenEmittedFiles&&new e.Map(t.seenEmittedFiles),n.programEmitComplete=t.programEmitComplete,n}(x);},C.restoreState=function(){x=e.Debug.checkDefined(p),p=void 0;},C.getAllDependencies=function(t){return e.BuilderState.getAllDependencies(x,e.Debug.checkDefined(x.program),t)},C.getSemanticDiagnostics=function(t,r){a(x,t);var n,i=e.Debug.checkDefined(x.program).getCompilerOptions();if(e.outFile(i))return e.Debug.assert(!x.semanticDiagnosticsPerFile),e.Debug.checkDefined(x.program).getSemanticDiagnostics(t,r);if(t)return h(x,t,r);for(;F(r););for(var o=0,s=e.Debug.checkDefined(x.program).getSourceFiles();o<s.length;o++){var c=s[o];n=e.addRange(n,h(x,c,r));}return n||e.emptyArray},C.emit=function(n,i,o,c,u){var _;r===t.EmitAndSemanticDiagnosticsBuilderProgram&&a(x,n);var d=e.handleNoEmitOptions(C,n,i,o);if(d)return d;if(!n){if(r===t.EmitAndSemanticDiagnosticsBuilderProgram){for(var p=[],f=!1,g=void 0,m=[],y=void 0;y=E(i,o,c,u);)f=f||y.result.emitSkipped,g=e.addRange(g,y.result.diagnostics),m=e.addRange(m,y.result.emittedFiles),p=e.addRange(p,y.result.sourceMaps);return {emitSkipped:f,diagnostics:g||e.emptyArray,emittedFiles:m,sourceMaps:p}}(null===(_=x.affectedFilesPendingEmitKind)||void 0===_?void 0:_.size)&&(e.Debug.assert(r===t.SemanticDiagnosticsBuilderProgram),c&&!e.every(x.affectedFilesPendingEmit,(function(e,t){return t<x.affectedFilesPendingEmitIndex||0===x.affectedFilesPendingEmitKind.get(e)}))||s(x));}return e.Debug.checkDefined(x.program).emit(n,e.outFile(x.compilerOptions)||!e.getEmitDeclarations(x.compilerOptions)||u?i||e.maybeBind(l,l.writeFile):N(i),o,c,u)},C.releaseProgram=function(){!function(t){e.BuilderState.releaseCache(t),t.program=void 0;}(x),p=void 0;},r===t.SemanticDiagnosticsBuilderProgram?C.getSemanticDiagnosticsOfNextAffectedFile=F:r===t.EmitAndSemanticDiagnosticsBuilderProgram?(C.getSemanticDiagnosticsOfNextAffectedFile=F,C.emitNextAffectedFile=E,C.emitBuildInfo=function(t,r){if(x.buildInfoEmitPending){var n=e.Debug.checkDefined(x.program).emitBuildInfo(t||e.maybeBind(l,l.writeFile),r);return x.buildInfoEmitPending=!1,n}return e.emitSkippedWithNoDiagnostics}):e.notImplemented(),C;function E(t,r,n,i){var a=o(x,r,g,l),c=1,u=!1;if(!a)if(e.outFile(x.compilerOptions)){var _=e.Debug.checkDefined(x.program);if(x.programEmitComplete)return;a=_;}else {var d=function(t){var r=t.affectedFilesPendingEmit;if(r){for(var n=t.seenEmittedFiles||(t.seenEmittedFiles=new e.Map),i=t.affectedFilesPendingEmitIndex;i<r.length;i++){var a=e.Debug.checkDefined(t.program).getSourceFileByPath(r[i]);if(a){var o=n.get(a.resolvedPath),c=e.Debug.checkDefined(e.Debug.checkDefined(t.affectedFilesPendingEmitKind).get(a.resolvedPath));if(void 0===o||o<c)return t.affectedFilesPendingEmitIndex=i,{affectedFile:a,emitKind:c}}}s(t);}}(x);if(!d){if(!x.buildInfoEmitPending)return;var p=e.Debug.checkDefined(x.program);return v(x,p.emitBuildInfo(t||e.maybeBind(l,l.writeFile),r),p,1,!1,!0)}a=d.affectedFile,c=d.emitKind,u=!0;}return v(x,e.Debug.checkDefined(x.program).emit(a===x.program?void 0:a,a!==x.program&&e.getEmitDeclarations(x.compilerOptions)&&!i?N(t):t||e.maybeBind(l,l.writeFile),r,n||0===c,i),a,c,u)}function N(t){return function(r,n,i,a,o,s){var c;if(e.isDeclarationFileName(r)){e.Debug.assert(1===(null==o?void 0:o.length));var u=o[0],_=x.fileInfos.get(u.resolvedPath);if(((null===(c=x.currentAffectedFilesSignatures)||void 0===c?void 0:c.get(u.resolvedPath))||_.signature)===u.version){var d=(g||e.generateDjb2Hash)(void 0!==(null==s?void 0:s.sourceMapUrlPos)?n.substring(0,s.sourceMapUrlPos):n);d!==u.version&&(l.storeFilesChangingSignatureDuringEmit&&(x.filesChangingSignature||(x.filesChangingSignature=new e.Set)).add(u.resolvedPath),x.exportedModulesMap&&e.BuilderState.updateExportedModules(u,u.exportedModulesFromDeclarationEmit,x.currentAffectedFilesExportedModulesMap||(x.currentAffectedFilesExportedModulesMap=e.BuilderState.createManyToManyPathMap())),x.affectedFiles&&x.affectedFilesIndex<x.affectedFiles.length?x.currentAffectedFilesSignatures.set(u.resolvedPath,d):(_.signature=d,x.exportedModulesMap&&e.BuilderState.updateExportedFilesMapFromCache(x,x.currentAffectedFilesExportedModulesMap)));}}t?t(r,n,i,a,o,s):l.writeFile?l.writeFile(r,n,i,a,o,s):x.program.writeFile(r,n,i,a,o,s);}}function F(e,n){for(;;){var i=o(x,e,g,l);if(!i)return;if(i===x.program)return y(x,x.program.getSemanticDiagnostics(void 0,e),i);if((r===t.EmitAndSemanticDiagnosticsBuilderProgram||x.compilerOptions.noEmit||x.compilerOptions.noEmitOnError)&&T(x,i.resolvedPath,1),!n||!n(i))return y(x,h(x,i,e),i);m(x,i);}}},e.toBuilderStateFileInfo=C,e.createBuildProgramUsingProgramBuildInfo=function(t,r,n){var i,a=e.getDirectoryPath(e.getNormalizedAbsolutePath(r,n.getCurrentDirectory())),o=e.createGetCanonicalFileName(n.useCaseSensitiveFileNames()),s=t.fileNames.map((function(t){return e.toPath(t,a,o)})),c=null===(i=t.fileIdsList)||void 0===i?void 0:i.map((function(t){return new e.Set(t.map(_))})),l=new e.Map;t.fileInfos.forEach((function(e,t){return l.set(_(t+1),C(e))}));var u={fileInfos:l,compilerOptions:t.options?e.convertToOptionsWithAbsolutePaths(t.options,(function(t){return e.getNormalizedAbsolutePath(t,a)})):{},referencedMap:d(t.referencedMap),exportedModulesMap:d(t.exportedModulesMap),semanticDiagnosticsPerFile:t.semanticDiagnosticsPerFile&&e.arrayToMap(t.semanticDiagnosticsPerFile,(function(t){return _(e.isNumber(t)?t:t[0])}),(function(t){return e.isNumber(t)?e.emptyArray:t[1]})),hasReusableDiagnostic:!0,affectedFilesPendingEmit:e.map(t.affectedFilesPendingEmit,(function(e){return _(e[0])})),affectedFilesPendingEmitKind:t.affectedFilesPendingEmit&&e.arrayToMap(t.affectedFilesPendingEmit,(function(e){return _(e[0])}),(function(e){return e[1]})),affectedFilesPendingEmitIndex:t.affectedFilesPendingEmit&&0};return {getState:function(){return u},backupState:e.noop,restoreState:e.noop,getProgram:e.notImplemented,getProgramOrUndefined:e.returnUndefined,releaseProgram:e.noop,getCompilerOptions:function(){return u.compilerOptions},getSourceFile:e.notImplemented,getSourceFiles:e.notImplemented,getOptionsDiagnostics:e.notImplemented,getGlobalDiagnostics:e.notImplemented,getConfigFileParsingDiagnostics:e.notImplemented,getSyntacticDiagnostics:e.notImplemented,getDeclarationDiagnostics:e.notImplemented,getSemanticDiagnostics:e.notImplemented,emit:e.notImplemented,getAllDependencies:e.notImplemented,getCurrentDirectory:e.notImplemented,emitNextAffectedFile:e.notImplemented,getSemanticDiagnosticsOfNextAffectedFile:e.notImplemented,emitBuildInfo:e.notImplemented,close:e.noop};function _(e){return s[e-1]}function d(t){if(t){var r=e.BuilderState.createManyToManyPathMap();return t.forEach((function(e){var t=e[0],n=e[1];return r.set(_(t),c[n-1])})),r}}},e.createRedirectedBuilderProgram=k;}(t),function(e){e.createSemanticDiagnosticsBuilderProgram=function(t,r,n,i,a,o){return e.createBuilderProgram(e.BuilderProgramKind.SemanticDiagnosticsBuilderProgram,e.getBuilderCreationParameters(t,r,n,i,a,o))},e.createEmitAndSemanticDiagnosticsBuilderProgram=function(t,r,n,i,a,o){return e.createBuilderProgram(e.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram,e.getBuilderCreationParameters(t,r,n,i,a,o))},e.createAbstractBuilder=function(t,r,n,i,a,o){var s=e.getBuilderCreationParameters(t,r,n,i,a,o),c=s.newProgram,l=s.configFileParsingDiagnostics;return e.createRedirectedBuilderProgram((function(){return {program:c,compilerOptions:c.getCompilerOptions()}}),l)};}(t),function(e){function t(t){return e.endsWith(t,"/node_modules/.staging")?e.removeSuffix(t,"/.staging"):e.some(e.ignoredPaths,(function(r){return e.stringContains(t,r)}))?void 0:t}function r(t){var r=e.getRootLength(t);if(t.length===r)return !1;var n=t.indexOf(e.directorySeparator,r);if(-1===n)return !1;var i=t.substring(r,n+1),a=r>1||47!==t.charCodeAt(0);if(a&&0!==t.search(/[a-zA-Z]:/)&&0===i.search(/[a-zA-z]\$\//)){if(-1===(n=t.indexOf(e.directorySeparator,n+1)))return !1;i=t.substring(r+i.length,n+1);}if(a&&0!==i.search(/users\//i))return !0;for(var o=n+1,s=2;s>0;s--)if(0===(o=t.indexOf(e.directorySeparator,o)+1))return !1;return !0}function n(e){var t,r;return !(!(null===(t=e.resolvedModule)||void 0===t?void 0:t.originalPath)&&!(null===(r=e.resolvedTypeReferenceDirective)||void 0===r?void 0:r.originalPath))}e.removeIgnoredPath=t,e.canWatchDirectory=r,e.createResolutionCache=function(i,a,o){var s,c,l,u,_,d,p=e.createMultiMap(),f=[],g=e.createMultiMap(),m=!1,y=e.memoize((function(){return i.getCurrentDirectory()})),v=i.getCachedDirectoryStructureHost(),h=new e.Map,b=e.createCacheWithRedirects(),x=e.createCacheWithRedirects(),D=e.createModuleResolutionCache(y(),i.getCanonicalFileName,void 0,b,x),S=new e.Map,T=e.createCacheWithRedirects(),C=e.createTypeReferenceDirectiveResolutionCache(y(),i.getCanonicalFileName,void 0,D.getPackageJsonInfoCache(),T),k=[".ts",".tsx",".js",".jsx",".json"],E=new e.Map,N=new e.Map,F=a&&e.removeTrailingDirectorySeparator(e.getNormalizedAbsolutePath(a,y())),A=F&&i.toPath(F),P=void 0!==A?A.split(e.directorySeparator).length:0,w=new e.Map;return {getModuleResolutionCache:function(){return D},startRecordingFilesWithChangedResolutions:function(){s=[];},finishRecordingFilesWithChangedResolutions:function(){var e=s;return s=void 0,e},startCachingPerDirectoryResolution:R,finishCachingPerDirectoryResolution:function(){l=void 0,R(),N.forEach((function(e,t){0===e.refCount&&(N.delete(t),e.watcher.close());})),m=!1;},resolveModuleNames:function(t,r,n,i,a){return J({names:t,containingFile:r,redirectedReference:i,cache:h,perDirectoryCacheWithRedirects:b,loader:B,getResolutionWithResolvedFileName:I,shouldRetryResolution:function(t){return !t.resolvedModule||!e.resolutionExtensionIsTSOrJson(t.resolvedModule.extension)},reusedNames:n,logChanges:o,containingSourceFile:a})},getResolvedModuleWithFailedLookupLocationsFromCache:function(e,t,r){var n=h.get(i.toPath(t));return n?n.get(e,r):void 0},resolveTypeReferenceDirectives:function(e,t,r,n){return J({names:e,containingFile:t,redirectedReference:r,cache:S,perDirectoryCacheWithRedirects:T,loader:j,getResolutionWithResolvedFileName:O,shouldRetryResolution:function(e){return void 0===e.resolvedTypeReferenceDirective},containingSourceFileMode:n})},removeResolutionsFromProjectReferenceRedirects:function(t){if(e.fileExtensionIs(t,".json")){var r=i.getCurrentProgram();if(r){var n=r.getResolvedProjectReferenceByPath(t);n&&n.commandLine.fileNames.forEach((function(e){return $(i.toPath(e))}));}}},removeResolutionsOfFile:$,hasChangedAutomaticTypeDirectiveNames:function(){return m},invalidateResolutionOfFile:function(t){$(t);var r=m;ee(g.get(t),e.returnTrue)&&m&&!r&&i.onChangedAutomaticTypeDirectiveNames();},invalidateResolutionsOfFailedLookupLocations:re,setFilesWithInvalidatedNonRelativeUnresolvedImports:function(t){e.Debug.assert(l===t||void 0===l),l=t;},createHasInvalidatedResolution:function(t){if(re(),t)return c=void 0,e.returnTrue;var r=c;return c=void 0,function(e){return !!r&&r.has(e)||L(e)}},isFileWithInvalidatedNonRelativeUnresolvedImports:L,updateTypeRootsWatch:function(){var t=i.getCompilationSettings();if(t.types)ie();else {var r=e.getEffectiveTypeRoots(t,{directoryExists:oe,getCurrentDirectory:y});r?e.mutateMap(w,e.arrayToMap(r,(function(e){return i.toPath(e)})),{createNewValue:ae,onDeleteValue:e.closeFileWatcher}):ie();}},closeTypeRootsWatch:ie,clear:function(){e.clearMap(N,e.closeFileWatcherOf),E.clear(),p.clear(),ie(),h.clear(),S.clear(),g.clear(),f.length=0,u=void 0,_=void 0,d=void 0,R(),m=!1;}};function I(e){return e.resolvedModule}function O(e){return e.resolvedTypeReferenceDirective}function M(t,r){return !(void 0===t||r.length<=t.length)&&e.startsWith(r,t)&&r[t.length]===e.directorySeparator}function L(e){if(!l)return !1;var t=l.get(e);return !!t&&!!t.length}function R(){D.clear(),C.clear(),p.forEach(H),p.clear();}function B(t,r,n,a,o,s,c){var l,u=e.resolveModuleName(t,r,n,a,D,o,c);if(!i.getGlobalCache)return u;var _=i.getGlobalCache();if(!(void 0===_||e.isExternalModuleNameRelative(t)||u.resolvedModule&&e.extensionIsTS(u.resolvedModule.extension))){var d=e.loadModuleFromGlobalCache(e.Debug.checkDefined(i.globalCacheResolutionModuleName)(t),i.projectName,n,a,_,D),p=d.resolvedModule,f=d.failedLookupLocations;if(p)return u.resolvedModule=p,(l=u.failedLookupLocations).push.apply(l,f),u}return u}function j(t,r,n,i,a,o,s){return e.resolveTypeReferenceDirective(t,r,n,i,a,C,s)}function J(t){var r,a,o,c=t.names,l=t.containingFile,u=t.redirectedReference,_=t.cache,d=t.perDirectoryCacheWithRedirects,p=t.loader,f=t.getResolutionWithResolvedFileName,g=t.shouldRetryResolution,m=t.reusedNames,y=t.logChanges,v=t.containingSourceFile,h=t.containingSourceFileMode,b=i.toPath(l),x=_.get(b)||_.set(b,e.createModeAwareCache()).get(b),D=e.getDirectoryPath(b),S=d.getOrCreateMapOfCacheRedirects(u),T=S.get(D);T||(T=e.createModeAwareCache(),S.set(D,T));for(var C=[],k=i.getCompilationSettings(),E=y&&L(b),N=i.getCurrentProgram(),F=N&&N.getResolvedProjectReferenceToRedirect(l),A=F?!u||u.sourceFile.path!==F.sourceFile.path:!!u,P=e.createModeAwareCache(),w=0,I=0,O=c;I<O.length;I++){var M=O[I],R=e.isString(M)?M:M.fileName.toLowerCase(),j=e.isString(M)?v?e.getModeForResolutionAtIndex(v,w):void 0:e.getModeForFileReference(M,h);w++;var J=x.get(R,j);if(!P.has(R,j)&&A||!J||J.isInvalidated||E&&!e.isExternalModuleNameRelative(R)&&g(J)){var z=J,K=T.get(R,j);if(K){J=K;var U=(null===(r=i.getCompilerHost)||void 0===r?void 0:r.call(i))||i;if(e.isTraceEnabled(k,U)){var V=f(J);e.trace(U,p===B?(null==V?void 0:V.resolvedFileName)?V.packagetId?e.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4:e.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3:e.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved:(null==V?void 0:V.resolvedFileName)?V.packagetId?e.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4:e.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3:e.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved,R,l,e.getDirectoryPath(l),null==V?void 0:V.resolvedFileName,(null==V?void 0:V.packagetId)&&e.packageIdToString(V.packagetId));}}else J=p(R,l,k,(null===(a=i.getCompilerHost)||void 0===a?void 0:a.call(i))||i,u,v,j),T.set(R,j,J),i.onDiscoveredSymlink&&n(J)&&i.onDiscoveredSymlink();x.set(R,j,J),q(R,J,b,f),z&&Q(z,b,f),y&&s&&!W(z,J)&&(s.push(b),y=!1);}else U=(null===(o=i.getCompilerHost)||void 0===o?void 0:o.call(i))||i,e.isTraceEnabled(k,U)&&!P.has(R,j)&&(V=f(J),e.trace(U,p===B?(null==V?void 0:V.resolvedFileName)?V.packagetId?e.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3:e.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2:e.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved:(null==V?void 0:V.resolvedFileName)?V.packagetId?e.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3:e.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2:e.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved,R,l,null==V?void 0:V.resolvedFileName,(null==V?void 0:V.packagetId)&&e.packageIdToString(V.packagetId)));e.Debug.assert(void 0!==J&&!J.isInvalidated),P.set(R,j,!0),C.push(f(J));}return x.forEach((function(t,r,n){P.has(r,n)||e.contains(m,r)||(Q(t,b,f),x.delete(r,n));})),C;function W(e,t){if(e===t)return !0;if(!e||!t)return !1;var r=f(e),n=f(t);return r===n||!(!r||!n)&&r.resolvedFileName===n.resolvedFileName}}function z(t){return e.endsWith(t,"/node_modules/@types")}function K(t,r){if(M(A,r)){t=e.isRootedDiskPath(t)?e.normalizePath(t):e.getNormalizedAbsolutePath(t,y());var n=r.split(e.directorySeparator),i=t.split(e.directorySeparator);return e.Debug.assert(i.length===n.length,"FailedLookup: ".concat(t," failedLookupLocationPath: ").concat(r)),n.length>P+1?{dir:i.slice(0,P+1).join(e.directorySeparator),dirPath:n.slice(0,P+1).join(e.directorySeparator)}:{dir:F,dirPath:A,nonRecursive:!1}}return U(e.getDirectoryPath(e.getNormalizedAbsolutePath(t,y())),e.getDirectoryPath(r))}function U(t,n){for(;e.pathContainsNodeModules(n);)t=e.getDirectoryPath(t),n=e.getDirectoryPath(n);if(e.isNodeModulesDirectory(n))return r(e.getDirectoryPath(n))?{dir:t,dirPath:n}:void 0;var i,a,o=!0;if(void 0!==A)for(;!M(n,A);){var s=e.getDirectoryPath(n);if(s===n)break;o=!1,i=n,a=t,n=s,t=e.getDirectoryPath(t);}return r(n)?{dir:a||t,dirPath:i||n,nonRecursive:o}:void 0}function V(t){return e.fileExtensionIsOneOf(t,k)}function q(t,r,n,a){if(r.refCount)r.refCount++,e.Debug.assertIsDefined(r.files);else {r.refCount=1,e.Debug.assert(0===e.length(r.files)),e.isExternalModuleNameRelative(t)?W(r):p.add(t,r);var o=a(r);o&&o.resolvedFileName&&g.add(i.toPath(o.resolvedFileName),r);}(r.files||(r.files=[])).push(n);}function W(t){e.Debug.assert(!!t.refCount);var r=t.failedLookupLocations;if(r.length){f.push(t);for(var n=!1,a=0,o=r;a<o.length;a++){var s=o[a],c=i.toPath(s),l=K(s,c);if(l){var u=l.dir,_=l.dirPath,d=l.nonRecursive;if(!V(c)){var p=E.get(c)||0;E.set(c,p+1);}_===A?(e.Debug.assert(!d),n=!0):G(u,_,d);}}n&&G(F,A,!0);}}function H(e,t){var r=i.getCurrentProgram();r&&r.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(t)||e.forEach(W);}function G(t,r,n){var i=N.get(r);i?(e.Debug.assert(!!n==!!i.nonRecursive),i.refCount++):N.set(r,{watcher:Y(t,r,n),refCount:1,nonRecursive:n});}function Q(t,r,n){if(e.unorderedRemoveItem(e.Debug.checkDefined(t.files),r),t.refCount--,!t.refCount){var a=n(t);if(a&&a.resolvedFileName&&g.remove(i.toPath(a.resolvedFileName),t),e.unorderedRemoveItem(f,t)){for(var o=!1,s=0,c=t.failedLookupLocations;s<c.length;s++){var l=c[s],u=i.toPath(l),_=K(l,u);if(_){var d=_.dirPath,p=E.get(u);p&&(1===p?E.delete(u):(e.Debug.assert(p>1),E.set(u,p-1))),d===A?o=!0:X(d);}}o&&X(A);}}}function X(e){N.get(e).refCount--;}function Y(e,t,r){return i.watchDirectoryOfFailedLookupLocation(e,(function(e){var r=i.toPath(e);v&&v.addOrDeleteFileOrDirectory(e,r),te(r,t===r);}),r?0:1)}function Z(e,t,r){var n=e.get(t);n&&(n.forEach((function(e){return Q(e,t,r)})),e.delete(t));}function $(e){Z(h,e,I),Z(S,e,O);}function ee(t,r){if(!t)return !1;for(var n=!1,i=0,a=t;i<a.length;i++){var o=a[i];if(!o.isInvalidated&&r(o)){o.isInvalidated=n=!0;for(var s=0,l=e.Debug.checkDefined(o.files);s<l.length;s++){var u=l[s];(c||(c=new e.Set)).add(u),m=m||e.endsWith(u,e.inferredTypesContainingFile);}}}return n}function te(r,n){if(n)(d||(d=[])).push(r);else {var a=t(r);if(!a)return !1;if(r=a,i.fileIsOpen(r))return !1;var o=e.getDirectoryPath(r);if(z(r)||e.isNodeModulesDirectory(r)||z(o)||e.isNodeModulesDirectory(o))(u||(u=[])).push(r),(_||(_=new e.Set)).add(r);else {if(!V(r)&&!E.has(r))return !1;if(e.isEmittedFileOfProgram(i.getCurrentProgram(),r))return !1;(u||(u=[])).push(r);var s=e.parseNodeModuleFromPath(r);s&&(_||(_=new e.Set)).add(s);}}i.scheduleInvalidateResolutionsOfFailedLookupLocations();}function re(){if(!u&&!_&&!d)return !1;var e=ee(f,ne);return u=void 0,_=void 0,d=void 0,e}function ne(t){return t.failedLookupLocations.some((function(t){var r=i.toPath(t);return e.contains(u,r)||e.firstDefinedIterator((null==_?void 0:_.keys())||e.emptyIterator,(function(t){return !!e.startsWith(r,t)||void 0}))||(null==d?void 0:d.some((function(e){return M(e,r)})))}))}function ie(){e.clearMap(w,e.closeFileWatcher);}function ae(e,t){return i.watchTypeRootsDirectory(t,(function(r){var n=i.toPath(r);v&&v.addOrDeleteFileOrDirectory(r,n),m=!0,i.onChangedAutomaticTypeDirectiveNames();var a=function(e,t){if(M(A,t))return A;var r=U(e,t);return r&&N.has(r.dirPath)?r.dirPath:void 0}(t,e);a&&te(n,a===n);}),1)}function oe(t){var n=e.getDirectoryPath(e.getDirectoryPath(t)),a=i.toPath(n);return a===A||r(a)}};}(t),function(e){!function(t){var r,a,o;function s(t,r,n,i){var a=r.importModuleSpecifierPreference,o=r.importModuleSpecifierEnding;return {relativePreference:"relative"===a?0:"non-relative"===a?1:"project-relative"===a?3:2,ending:function(){switch(o){case"minimal":return 0;case"index":return 1;case"js":return 2;default:return function(t){var r=t.imports;return e.firstDefined(r,(function(t){var r=t.text;return e.pathIsRelative(r)?e.hasJSFileExtension(r):void 0}))||!1}(i)||c(n,i.path,t)?2:e.getEmitModuleResolutionKind(n)!==e.ModuleResolutionKind.NodeJs?1:0}}()}}function c(t,r,n){var i;return (e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.Node16||e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.NodeNext)&&e.getImpliedNodeFormatForFile(r,null===(i=n.getPackageJsonInfoCache)||void 0===i?void 0:i.call(n),function(t){var r;return {fileExists:t.fileExists,readFile:e.Debug.checkDefined(t.readFile),directoryExists:t.directoryExists,getCurrentDirectory:t.getCurrentDirectory,realpath:t.realpath,useCaseSensitiveFileNames:null===(r=t.useCaseSensitiveFileNames)||void 0===r?void 0:r.call(t)}}(n),t)!==e.ModuleKind.CommonJS}function l(t,r,n,i,a,o,s,c){void 0===c&&(c={});var l=d(n,a),u=v(n,i,a,s,c);return e.firstDefined(u,(function(e){return D(e,l,r,a,t,s,void 0,c.overrideImportMode)}))||p(i,l,t,a,o)}function u(t,r,n,i,a){var o;void 0===a&&(a={});var s=e.getSourceFileOfModule(t);if(!s)return e.emptyArray;var c=null===(o=n.getModuleSpecifierCache)||void 0===o?void 0:o.call(n),l=null==c?void 0:c.get(r.path,s.path,i,a);return [null==l?void 0:l.moduleSpecifiers,s,null==l?void 0:l.modulePaths,c]}function _(t,r,n,i,a,o,c){void 0===c&&(c={});var l=!1,_=function(t,r){var n,i=null===(n=t.declarations)||void 0===n?void 0:n.find((function(t){return e.isNonGlobalAmbientModule(t)&&(!e.isExternalModuleAugmentation(t)||!e.isExternalModuleNameRelative(e.getTextOfIdentifierOrLiteral(t.name)))}));if(i)return i.name.text;var a=e.mapDefined(t.declarations,(function(t){var n,i,a,o;if(e.isModuleDeclaration(t)){var s=function(e){for(;4&e.flags;)e=e.parent;return e}(t);if((null===(n=null==s?void 0:s.parent)||void 0===n?void 0:n.parent)&&e.isModuleBlock(s.parent)&&e.isAmbientModule(s.parent.parent)&&e.isSourceFile(s.parent.parent.parent)){var c=null===(o=null===(a=null===(i=s.parent.parent.symbol.exports)||void 0===i?void 0:i.get("export="))||void 0===a?void 0:a.valueDeclaration)||void 0===o?void 0:o.expression;if(c){var l=r.getSymbolAtLocation(c);if(l&&(2097152&(null==l?void 0:l.flags)?r.getAliasedSymbol(l):l)===t.symbol)return s.parent.parent}}}}))[0];return a?a.name.text:void 0}(t,r);if(_)return {moduleSpecifiers:[_],computedWithoutCache:l};var f=u(t,i,a,o,c),g=f[0],m=f[1],y=f[2],v=f[3];if(g)return {moduleSpecifiers:g,computedWithoutCache:l};if(!m)return {moduleSpecifiers:e.emptyArray,computedWithoutCache:l};l=!0,y||(y=h(i.path,m.originalFileName,a));var b=function(t,r,n,i,a,o){void 0===o&&(o={});var c=d(n.path,i),l=s(i,a,r,n),u=e.forEach(t,(function(t){return e.forEach(i.getFileIncludeReasons().get(e.toPath(t.path,i.getCurrentDirectory(),c.getCanonicalFileName)),(function(t){if(t.kind===e.FileIncludeKind.Import&&t.file===n.path&&(!n.impliedNodeFormat||n.impliedNodeFormat===e.getModeForResolutionAtIndex(n,t.index))){var r=e.getModuleNameStringLiteralAt(n,t.index).text;return 1===l.relativePreference&&e.pathIsRelative(r)?void 0:r}}))}));if(u)return [u];for(var _,f,g,m=e.some(t,(function(e){return e.isInNodeModules})),y=0,v=t;y<v.length;y++){var h=v[y],b=D(h,c,n,i,r,a,void 0,o.overrideImportMode);if(_=e.append(_,b),b&&h.isRedirect)return _;if(!b&&!h.isRedirect){var x=p(h.path,c,r,i,l);e.pathIsBareSpecifier(x)?f=e.append(f,x):m&&!h.isInNodeModules||(g=e.append(g,x));}}return (null==f?void 0:f.length)?f:(null==_?void 0:_.length)?_:e.Debug.checkDefined(g)}(y,n,i,a,o,c);return null==v||v.set(i.path,m.path,o,c,y,b),{moduleSpecifiers:b,computedWithoutCache:l}}function d(t,r){return {getCanonicalFileName:e.createGetCanonicalFileName(!r.useCaseSensitiveFileNames||r.useCaseSensitiveFileNames()),importingSourceFileName:t,sourceDirectory:e.getDirectoryPath(t)}}function p(t,r,n,i,a){var o=a.ending,s=a.relativePreference,c=n.baseUrl,l=n.paths,u=n.rootDirs,_=r.sourceDirectory,d=r.getCanonicalFileName,p=u&&function(t,r,n,i,a,o){var s=S(r,t,i);if(void 0!==s){var c=S(n,t,i),l=void 0!==c?e.ensurePathIsNonModuleName(e.getRelativePathFromDirectory(c,s,i)):s;return e.getEmitModuleResolutionKind(o)===e.ModuleResolutionKind.NodeJs?T(l,a,o):e.removeFileExtension(l)}}(u,t,_,d,o,n)||T(e.ensurePathIsNonModuleName(e.getRelativePathFromDirectory(_,t,d)),o,n);if(!c&&!l||0===s)return p;var g=E(t,e.getNormalizedAbsolutePath(e.getPathsBasePath(n,i)||c,i.getCurrentDirectory()),d);if(!g)return p;var y=T(g,o,n),v=l&&b(e.removeFileExtension(g),y,l),h=void 0===v&&void 0!==c?y:v;if(!h)return p;if(1===s)return h;if(3===s){var x=n.configFilePath?e.toPath(e.getDirectoryPath(n.configFilePath),i.getCurrentDirectory(),r.getCanonicalFileName):r.getCanonicalFileName(i.getCurrentDirectory()),D=e.toPath(t,x,d),C=e.startsWith(_,x),k=e.startsWith(D,x);if(C&&!k||!C&&k)return h;var F=m(i,e.getDirectoryPath(D));return m(i,_)!==F?h:p}return 2!==s&&e.Debug.assertNever(s),N(h)||f(p)<f(h)?p:h}function f(t){for(var r=0,n=e.startsWith(t,"./")?2:0;n<t.length;n++)47===t.charCodeAt(n)&&r++;return r}function g(t,r){return e.compareBooleans(r.isRedirect,t.isRedirect)||e.compareNumberOfDirectorySeparators(t.path,r.path)}function m(t,r){return t.getNearestAncestorDirectoryWithPackageJson?t.getNearestAncestorDirectoryWithPackageJson(r):!!e.forEachAncestorDirectory(r,(function(r){return !!t.fileExists(e.combinePaths(r,"package.json"))||void 0}))}function y(t,r,i,a,o){var s,c=e.hostGetCanonicalFileName(i),l=i.getCurrentDirectory(),u=i.isSourceOfProjectReferenceRedirect(r)?i.getProjectReferenceRedirect(r):void 0,_=e.toPath(r,l,c),d=i.redirectTargetsMap.get(_)||e.emptyArray,p=n$4(n$4(n$4([],u?[u]:e.emptyArray,!0),[r],!1),d,!0).map((function(t){return e.getNormalizedAbsolutePath(t,l)})),f=!e.every(p,e.containsIgnoredPath);if(!a){var g=e.forEach(p,(function(t){return !(f&&e.containsIgnoredPath(t))&&o(t,u===t)}));if(g)return g}var m=null===(s=i.getSymlinkCache)||void 0===s?void 0:s.call(i).getSymlinkedDirectoriesByRealpath(),y=e.getNormalizedAbsolutePath(r,l);return m&&e.forEachAncestorDirectory(e.getDirectoryPath(y),(function(r){var n=m.get(e.ensureTrailingDirectorySeparator(e.toPath(r,l,c)));if(n)return !e.startsWithDirectory(t,r,c)&&e.forEach(p,(function(t){if(e.startsWithDirectory(t,r,c))for(var i=e.getRelativePathFromDirectory(r,t,c),a=0,s=n;a<s.length;a++){var l=s[a],_=e.resolvePath(l,i),d=o(_,t===u);if(f=!0,d)return d}}))}))||(a?e.forEach(p,(function(t){return f&&e.containsIgnoredPath(t)?void 0:o(t,t===u)})):void 0)}function v(t,r,n,i,a){var o;void 0===a&&(a={});var s=e.toPath(r,n.getCurrentDirectory(),e.hostGetCanonicalFileName(n)),c=null===(o=n.getModuleSpecifierCache)||void 0===o?void 0:o.call(n);if(c){var l=c.get(t,s,i,a);if(null==l?void 0:l.modulePaths)return l.modulePaths}var u=h(t,r,n);return c&&c.setModulePaths(t,s,i,a,u),u}function h(t,r,n){var i=e.hostGetCanonicalFileName(n),a=new e.Map,o=!1;y(t,r,n,!0,(function(t,r){var n=e.pathContainsNodeModules(t);a.set(t,{path:i(t),isRedirect:r,isInNodeModules:n}),o=o||n;}));for(var s,c=[],l=function(t){var r,n=e.ensureTrailingDirectorySeparator(t);a.forEach((function(t,i){var o=t.path,s=t.isRedirect,c=t.isInNodeModules;e.startsWith(o,n)&&((r||(r=[])).push({path:i,isRedirect:s,isInNodeModules:c}),a.delete(i));})),r&&(r.length>1&&r.sort(g),c.push.apply(c,r));var i=e.getDirectoryPath(t);if(i===t)return s=t,"break";s=t=i;},u=e.getDirectoryPath(t);0!==a.size;){var _=l(u);if(u=s,"break"===_)break}if(a.size){var d=e.arrayFrom(a.values());d.length>1&&d.sort(g),c.push.apply(c,d);}return c}function b(t,r,n){for(var i in n)for(var a=0,o=n[i];a<o.length;a++){var s=o[a],c=e.removeFileExtension(e.normalizePath(s)),l=c.indexOf("*");if(-1!==l){var u=c.substr(0,l),_=c.substr(l+1);if(r.length>=u.length+_.length&&e.startsWith(r,u)&&e.endsWith(r,_)||!_&&r===e.removeTrailingDirectorySeparator(u)){var d=r.substr(u.length,r.length-_.length-u.length);return i.replace("*",d)}}else if(c===r||c===t)return i}}function x(t,r,n,i,a,o,s){if(void 0===s&&(s=0),"string"==typeof a){var c=e.getNormalizedAbsolutePath(e.combinePaths(n,a),void 0),l=e.hasTSFileExtension(r)?e.removeFileExtension(r)+k(r,t):void 0;switch(s){case 0:if(0===e.comparePaths(r,c)||l&&0===e.comparePaths(l,c))return {moduleFileToTry:i};break;case 1:if(e.containsPath(c,r)){var u=e.getRelativePathFromDirectory(c,r,!1);return {moduleFileToTry:e.getNormalizedAbsolutePath(e.combinePaths(e.combinePaths(i,a),u),void 0)}}break;case 2:var _=c.indexOf("*"),d=c.slice(0,_),p=c.slice(_+1);if(e.startsWith(r,d)&&e.endsWith(r,p)){var f=r.slice(d.length,r.length-p.length);return {moduleFileToTry:i.replace("*",f)}}if(l&&e.startsWith(l,d)&&e.endsWith(l,p))return f=l.slice(d.length,l.length-p.length),{moduleFileToTry:i.replace("*",f)}}}else {if(Array.isArray(a))return e.forEach(a,(function(e){return x(t,r,n,i,e,o)}));if("object"==typeof a&&null!==a){if(e.allKeysStartWithDot(a))return e.forEach(e.getOwnKeys(a),(function(s){var c=e.getNormalizedAbsolutePath(e.combinePaths(i,s),void 0),l=e.endsWith(s,"/")?1:e.stringContains(s,"*")?2:0;return x(t,r,n,c,a[s],o,l)}));for(var g=0,m=e.getOwnKeys(a);g<m.length;g++){var y=m[g];if("default"===y||o.indexOf(y)>=0||e.isApplicableVersionedTypesKey(o,y)){var v=a[y],h=x(t,r,n,i,v,o);if(h)return h}}}}}function D(t,r,n,a,o,c,l,u){var _=t.path,d=t.isRedirect,p=r.getCanonicalFileName,f=r.sourceDirectory;if(a.fileExists&&a.readFile){var g=e.getNodeModulePathParts(_);if(g){var m=_,y=!1;if(!l)for(var v=s(a,c,o,n),h=g.packageRootIndex,D=void 0;;){var S=O(h),C=S.moduleFileToTry,E=S.packageRootPath,N=S.blockedByExports,F=S.verbatimFromExports;if(e.getEmitModuleResolutionKind(o)!==e.ModuleResolutionKind.Classic){if(N)return;if(F)return C}if(E){m=E,y=!0;break}if(D||(D=C),-1===(h=_.indexOf(e.directorySeparator,h+1))){m=T(D,v.ending,o,a);break}}if(!d||y){var A=a.getGlobalTypingsCacheLocation&&a.getGlobalTypingsCacheLocation(),P=p(m.substring(0,g.topLevelNodeModulesIndex));if(e.startsWith(f,P)||A&&e.startsWith(p(A),P)){var w=m.substring(g.topLevelPackageNameIndex+1),I=e.getPackageNameFromTypesPackageName(w);return e.getEmitModuleResolutionKind(o)===e.ModuleResolutionKind.Classic&&I===w?void 0:I}}}}function O(t){var r,s,c=_.substring(0,t),l=e.combinePaths(c,"package.json"),d=_,f=null===(s=null===(r=a.getPackageJsonInfoCache)||void 0===r?void 0:r.call(a))||void 0===s?void 0:s.getPackageJsonInfo(l);if("object"==typeof f||void 0===f&&a.fileExists(l)){var m=(null==f?void 0:f.packageJsonContent)||JSON.parse(a.readFile(l));if(e.getEmitModuleResolutionKind(o)===e.ModuleResolutionKind.Node16||e.getEmitModuleResolutionKind(o)===e.ModuleResolutionKind.NodeNext){var y=["node",u||n.impliedNodeFormat===e.ModuleKind.ESNext?"import":"require","types"],v=m.exports&&"string"==typeof m.name?x(o,_,c,e.getPackageNameFromTypesPackageName(m.name),m.exports,y):void 0;if(v){var h=e.hasTSFileExtension(v.moduleFileToTry)?{moduleFileToTry:e.removeFileExtension(v.moduleFileToTry)+k(v.moduleFileToTry,o)}:v;return i$1(i$1({},h),{verbatimFromExports:!0})}if(m.exports)return {moduleFileToTry:_,blockedByExports:!0}}var D=m.typesVersions?e.getPackageJsonTypesVersionsPaths(m.typesVersions):void 0;if(D){var S=_.slice(c.length+1),C=b(e.removeFileExtension(S),T(S,0,o),D.paths);void 0!==C&&(d=e.combinePaths(c,C));}var E=m.typings||m.types||m.main||"index.js";if(e.isString(E)){var N=e.toPath(E,c,p);if(e.removeFileExtension(N)===e.removeFileExtension(p(d)))return {packageRootPath:c,moduleFileToTry:d}}}else {var F=p(d.substring(g.packageRootIndex+1));if("index.d.ts"===F||"index.js"===F||"index.ts"===F||"index.tsx"===F)return {moduleFileToTry:d,packageRootPath:c}}return {moduleFileToTry:d}}}function S(t,r,n){return e.firstDefined(r,(function(e){var r=E(t,e,n);return void 0!==r&&N(r)?void 0:r}))}function T(t,r,n,i){if(e.fileExtensionIsOneOf(t,[".json",".mjs",".cjs"]))return t;var a=e.removeFileExtension(t);if(t===a)return t;if(e.fileExtensionIsOneOf(t,[".d.mts",".mts",".d.cts",".cts"]))return a+C(t,n);switch(r){case 0:var o=e.removeSuffix(a,"/index");return i&&o!==a&&function(t,r){if(t.fileExists)for(var n=0,i=e.flatten(e.getSupportedExtensions({allowJs:!0},[{extension:"node",isMixedContent:!1},{extension:"json",isMixedContent:!1,scriptKind:6}]));n<i.length;n++){var a=r+i[n];if(t.fileExists(a))return a}}(i,o)?a:o;case 1:return a;case 2:return a+C(t,n);default:return e.Debug.assertNever(r)}}function C(t,r){var n;return null!==(n=k(t,r))&&void 0!==n?n:e.Debug.fail("Extension ".concat(e.extensionFromPath(t)," is unsupported:: FileName:: ").concat(t))}function k(t,r){var n=e.tryGetExtensionFromPath(t);switch(n){case".ts":case".d.ts":return ".js";case".tsx":return 1===r.jsx?".jsx":".js";case".js":case".jsx":case".json":return n;case".d.mts":case".mts":case".mjs":return ".mjs";case".d.cts":case".cts":case".cjs":return ".cjs";default:return}}function E(t,r,n){var i=e.getRelativePathToDirectoryOrUrl(r,t,r,n,!1);return e.isRootedDiskPath(i)?void 0:i}function N(t){return e.startsWith(t,"..")}!function(e){e[e.Relative=0]="Relative",e[e.NonRelative=1]="NonRelative",e[e.Shortest=2]="Shortest",e[e.ExternalNonRelative=3]="ExternalNonRelative";}(r||(r={})),function(e){e[e.Minimal=0]="Minimal",e[e.Index=1]="Index",e[e.JsExtension=2]="JsExtension";}(a||(a={})),t.updateModuleSpecifier=function(t,r,n,i,a,o,s){void 0===s&&(s={});var u=l(t,r,n,i,a,function(t,r,n,i){return {relativePreference:e.isExternalModuleNameRelative(r)?0:1,ending:e.hasJSFileExtension(r)||c(t,n,i)?2:e.getEmitModuleResolutionKind(t)!==e.ModuleResolutionKind.NodeJs||e.endsWith(r,"index")?1:0}}(t,o,n,a),{},s);if(u!==o)return u},t.getModuleSpecifier=function(e,t,r,n,i,a){return void 0===a&&(a={}),l(e,t,r,n,i,s(i,{},e,t),{},a)},t.getNodeModulesPackageName=function(t,r,n,i,a,o){void 0===o&&(o={});var s=d(r.path,i),c=v(r.path,n,i,a,o);return e.firstDefined(c,(function(e){return D(e,s,r,i,t,a,!0,o.overrideImportMode)}))},t.tryGetModuleSpecifiersFromCache=function(e,t,r,n,i){return void 0===i&&(i={}),u(e,t,r,n,i)[0]},t.getModuleSpecifiers=function(e,t,r,n,i,a,o){return void 0===o&&(o={}),_(e,t,r,n,i,a,o).moduleSpecifiers},t.getModuleSpecifiersWithCacheInfo=_,t.countPathComponents=f,t.forEachFileNameOfModule=y,function(e){e[e.Exact=0]="Exact",e[e.Directory=1]="Directory",e[e.Pattern=2]="Pattern";}(o||(o={})),t.tryGetJSExtensionForFile=k;}(e.moduleSpecifiers||(e.moduleSpecifiers={}));}(t),function(e){var t=e.sys?{getCurrentDirectory:function(){return e.sys.getCurrentDirectory()},getNewLine:function(){return e.sys.newLine},getCanonicalFileName:e.createGetCanonicalFileName(e.sys.useCaseSensitiveFileNames)}:void 0;function r(r,n){var i=r===e.sys&&t?t:{getCurrentDirectory:function(){return r.getCurrentDirectory()},getNewLine:function(){return r.newLine},getCanonicalFileName:e.createGetCanonicalFileName(r.useCaseSensitiveFileNames)};if(!n)return function(t){return r.write(e.formatDiagnostic(t,i))};var a=new Array(1);return function(t){a[0]=t,r.write(e.formatDiagnosticsWithColorAndContext(a,i)+i.getNewLine()),a[0]=void 0;}}function i(t,r,n){return !(!t.clearScreen||n.preserveWatchOutput||n.extendedDiagnostics||n.diagnostics||!e.contains(e.screenStartingMessageCodes,r.code)||(t.clearScreen(),0))}function a(e){return e.now?e.now().toLocaleTimeString("en-US",{timeZone:"UTC"}):(new Date).toLocaleTimeString()}function o(t,r){return r?function(r,n,o){i(t,r,o);var s="[".concat(e.formatColorAndReset(a(t),e.ForegroundColorEscapeSequences.Grey),"] ");s+="".concat(e.flattenDiagnosticMessageText(r.messageText,t.newLine)).concat(n+n),t.write(s);}:function(r,n,o){var s="";i(t,r,o)||(s+=n),s+="".concat(a(t)," - "),s+="".concat(e.flattenDiagnosticMessageText(r.messageText,t.newLine)).concat(function(t,r){return e.contains(e.screenStartingMessageCodes,t.code)?r+r:r}(r,n)),t.write(s);}}function s(t){return e.countWhere(t,(function(t){return t.category===e.DiagnosticCategory.Error}))}function c(t){return e.filter(t,(function(t){return t.category===e.DiagnosticCategory.Error})).map((function(e){if(void 0!==e.file)return "".concat(e.file.fileName)})).map((function(r){var n=e.find(t,(function(e){return void 0!==e.file&&e.file.fileName===r}));if(void 0!==n){var i=e.getLineAndCharacterOfPosition(n.file,n.start).line;return {fileName:r,line:i+1}}}))}function l(t){return 1===t?e.Diagnostics.Found_1_error_Watching_for_file_changes:e.Diagnostics.Found_0_errors_Watching_for_file_changes}function u(t,r){var n=e.formatColorAndReset(":"+t.line,e.ForegroundColorEscapeSequences.Grey);return e.pathIsAbsolute(t.fileName)&&e.pathIsAbsolute(r)?e.getRelativePathFromDirectory(r,t.fileName,!1)+n:t.fileName+n}function _(t,r,n,i){if(0===t)return "";var a=r.filter((function(e){return void 0!==e})),o=a.map((function(e){return "".concat(e.fileName,":").concat(e.line)})).filter((function(e,t,r){return r.indexOf(e)===t})),s=a[0]&&u(a[0],i.getCurrentDirectory()),c=1===t?e.createCompilerDiagnostic(void 0!==r[0]?e.Diagnostics.Found_1_error_in_1:e.Diagnostics.Found_1_error,t,s):e.createCompilerDiagnostic(0===o.length?e.Diagnostics.Found_0_errors:1===o.length?e.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1:e.Diagnostics.Found_0_errors_in_1_files,t,1===o.length?s:o.length),l=o.length>1?function(t,r){var n=t.filter((function(e,t,r){return t===r.findIndex((function(t){return (null==t?void 0:t.fileName)===(null==e?void 0:e.fileName)}))}));if(0===n.length)return "";var i=function(e){return Math.log(e)*Math.LOG10E+1},a=n.map((function(r){return [r,e.countWhere(t,(function(e){return e.fileName===r.fileName}))]})),o=a.reduce((function(e,t){return Math.max(e,t[1]||0)}),0),s=e.Diagnostics.Errors_Files.message,c=s.split(" ")[0].length,l=Math.max(c,i(o)),_=Math.max(i(o)-c,0),d="";return d+=" ".repeat(_)+s+"\n",a.forEach((function(e){var t=e[0],n=e[1],i=Math.log(n)*Math.LOG10E+1|0,a=i<l?" ".repeat(l-i):"",o=u(t,r.getCurrentDirectory());d+="".concat(a).concat(n," ").concat(o,"\n");})),d}(a,i):"";return "".concat(n).concat(e.flattenDiagnosticMessageText(c.messageText,n)).concat(n).concat(n).concat(l)}function d(e){return !!e.getState}function p(t,r){var n=t.getCompilerOptions();n.explainFiles?f(d(t)?t.getProgram():t,r):(n.listFiles||n.listFilesOnly)&&e.forEach(t.getSourceFiles(),(function(e){r(e.fileName);}));}function f(t,r){for(var n,i,a=t.getFileIncludeReasons(),o=e.createGetCanonicalFileName(t.useCaseSensitiveFileNames()),s=function(r){return e.convertToRelativePath(r,t.getCurrentDirectory(),o)},c=0,l=t.getSourceFiles();c<l.length;c++){var u=l[c];r("".concat(h(u,s))),null===(n=a.get(u.path))||void 0===n||n.forEach((function(e){return r(" ".concat(v(t,e,s).messageText))})),null===(i=g(u,s))||void 0===i||i.forEach((function(e){return r(" ".concat(e.messageText))}));}}function g(t,r){var n;return t.path!==t.resolvedPath&&(n||(n=[])).push(e.chainDiagnosticMessages(void 0,e.Diagnostics.File_is_output_of_project_reference_source_0,h(t.originalFileName,r))),t.redirectInfo&&(n||(n=[])).push(e.chainDiagnosticMessages(void 0,e.Diagnostics.File_redirects_to_file_0,h(t.redirectInfo.redirectTarget,r))),n}function m(t,r){var n,i=t.getCompilerOptions().configFile;if(null===(n=null==i?void 0:i.configFileSpecs)||void 0===n?void 0:n.validatedFilesSpec){var a=e.createGetCanonicalFileName(t.useCaseSensitiveFileNames()),o=a(r),s=e.getDirectoryPath(e.getNormalizedAbsolutePath(i.fileName,t.getCurrentDirectory()));return e.find(i.configFileSpecs.validatedFilesSpec,(function(t){return a(e.getNormalizedAbsolutePath(t,s))===o}))}}function y(t,r){var n,i,a=t.getCompilerOptions().configFile;if(null===(n=null==a?void 0:a.configFileSpecs)||void 0===n?void 0:n.validatedIncludeSpecs){var o=e.fileExtensionIs(r,".json"),s=e.getDirectoryPath(e.getNormalizedAbsolutePath(a.fileName,t.getCurrentDirectory())),c=t.useCaseSensitiveFileNames();return e.find(null===(i=null==a?void 0:a.configFileSpecs)||void 0===i?void 0:i.validatedIncludeSpecs,(function(t){if(o&&!e.endsWith(t,".json"))return !1;var n=e.getPatternFromSpec(t,s,"files");return !!n&&e.getRegexFromPattern("(".concat(n,")$"),c).test(r)}))}}function v(t,r,n){var i,a,o=t.getCompilerOptions();if(e.isReferencedFile(r)){var s=e.getReferencedFileLocation((function(e){return t.getSourceFileByPath(e)}),r),c=e.isReferenceFileLocation(s)?s.file.text.substring(s.pos,s.end):'"'.concat(s.text,'"'),l=void 0;switch(e.Debug.assert(e.isReferenceFileLocation(s)||r.kind===e.FileIncludeKind.Import,"Only synthetic references are imports"),r.kind){case e.FileIncludeKind.Import:l=e.isReferenceFileLocation(s)?s.packageId?e.Diagnostics.Imported_via_0_from_file_1_with_packageId_2:e.Diagnostics.Imported_via_0_from_file_1:s.text===e.externalHelpersModuleNameText?s.packageId?e.Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions:e.Diagnostics.Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions:s.packageId?e.Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions:e.Diagnostics.Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions;break;case e.FileIncludeKind.ReferenceFile:e.Debug.assert(!s.packageId),l=e.Diagnostics.Referenced_via_0_from_file_1;break;case e.FileIncludeKind.TypeReferenceDirective:l=s.packageId?e.Diagnostics.Type_library_referenced_via_0_from_file_1_with_packageId_2:e.Diagnostics.Type_library_referenced_via_0_from_file_1;break;case e.FileIncludeKind.LibReferenceDirective:e.Debug.assert(!s.packageId),l=e.Diagnostics.Library_referenced_via_0_from_file_1;break;default:e.Debug.assertNever(r);}return e.chainDiagnosticMessages(void 0,l,c,h(s.file,n),s.packageId&&e.packageIdToString(s.packageId))}switch(r.kind){case e.FileIncludeKind.RootFile:if(!(null===(i=o.configFile)||void 0===i?void 0:i.configFileSpecs))return e.chainDiagnosticMessages(void 0,e.Diagnostics.Root_file_specified_for_compilation);var u=e.getNormalizedAbsolutePath(t.getRootFileNames()[r.index],t.getCurrentDirectory());if(m(t,u))return e.chainDiagnosticMessages(void 0,e.Diagnostics.Part_of_files_list_in_tsconfig_json);var _=y(t,u);return _?e.chainDiagnosticMessages(void 0,e.Diagnostics.Matched_by_include_pattern_0_in_1,_,h(o.configFile,n)):e.chainDiagnosticMessages(void 0,e.Diagnostics.Root_file_specified_for_compilation);case e.FileIncludeKind.SourceFromProjectReference:case e.FileIncludeKind.OutputFromProjectReference:var d=r.kind===e.FileIncludeKind.OutputFromProjectReference,p=e.Debug.checkDefined(null===(a=t.getResolvedProjectReferences())||void 0===a?void 0:a[r.index]);return e.chainDiagnosticMessages(void 0,e.outFile(o)?d?e.Diagnostics.Output_from_referenced_project_0_included_because_1_specified:e.Diagnostics.Source_from_referenced_project_0_included_because_1_specified:d?e.Diagnostics.Output_from_referenced_project_0_included_because_module_is_specified_as_none:e.Diagnostics.Source_from_referenced_project_0_included_because_module_is_specified_as_none,h(p.sourceFile.fileName,n),o.outFile?"--outFile":"--out");case e.FileIncludeKind.AutomaticTypeDirectiveFile:return e.chainDiagnosticMessages(void 0,o.types?r.packageId?e.Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1:e.Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions:r.packageId?e.Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1:e.Diagnostics.Entry_point_for_implicit_type_library_0,r.typeReference,r.packageId&&e.packageIdToString(r.packageId));case e.FileIncludeKind.LibFile:if(void 0!==r.index)return e.chainDiagnosticMessages(void 0,e.Diagnostics.Library_0_specified_in_compilerOptions,o.lib[r.index]);var f=e.forEachEntry(e.targetOptionDeclaration.type,(function(t,r){return t===e.getEmitScriptTarget(o)?r:void 0}));return e.chainDiagnosticMessages(void 0,f?e.Diagnostics.Default_library_for_target_0:e.Diagnostics.Default_library,f);default:e.Debug.assertNever(r);}}function h(t,r){var n=e.isString(t)?t:t.fileName;return r?r(n):n}function b(t,r,n,i,a,o,l,u){var _=!!t.getCompilerOptions().listFilesOnly,d=t.getConfigFileParsingDiagnostics().slice(),f=d.length;e.addRange(d,t.getSyntacticDiagnostics(void 0,o)),d.length===f&&(e.addRange(d,t.getOptionsDiagnostics(o)),_||(e.addRange(d,t.getGlobalDiagnostics(o)),d.length===f&&e.addRange(d,t.getSemanticDiagnostics(void 0,o))));var g=_?{emitSkipped:!0,diagnostics:e.emptyArray}:t.emit(void 0,a,o,l,u),m=g.emittedFiles,y=g.diagnostics;e.addRange(d,y);var v=e.sortAndDeduplicateDiagnostics(d);if(v.forEach(r),n){var h=t.getCurrentDirectory();e.forEach(m,(function(t){var r=e.getNormalizedAbsolutePath(t,h);n("TSFILE: ".concat(r));})),p(t,n);}return i&&i(s(v),c(v)),{emitResult:g,diagnostics:v}}function x(t,r,n,i,a,o,s,c){var l=b(t,r,n,i,a,o,s,c),u=l.emitResult,_=l.diagnostics;return u.emitSkipped&&_.length>0?e.ExitStatus.DiagnosticsPresent_OutputsSkipped:_.length>0?e.ExitStatus.DiagnosticsPresent_OutputsGenerated:e.ExitStatus.Success}function D(t,r){return void 0===t&&(t=e.sys),{onWatchStatusChange:r||o(t),watchFile:e.maybeBind(t,t.watchFile)||e.returnNoopFileWatcher,watchDirectory:e.maybeBind(t,t.watchDirectory)||e.returnNoopFileWatcher,setTimeout:e.maybeBind(t,t.setTimeout)||e.noop,clearTimeout:e.maybeBind(t,t.clearTimeout)||e.noop}}function S(t,r){var n=e.memoize((function(){return e.getDirectoryPath(e.normalizePath(t.getExecutingFilePath()))}));return {useCaseSensitiveFileNames:function(){return t.useCaseSensitiveFileNames},getNewLine:function(){return t.newLine},getCurrentDirectory:e.memoize((function(){return t.getCurrentDirectory()})),getDefaultLibLocation:n,getDefaultLibFileName:function(t){return e.combinePaths(n(),e.getDefaultLibFileName(t))},fileExists:function(e){return t.fileExists(e)},readFile:function(e,r){return t.readFile(e,r)},directoryExists:function(e){return t.directoryExists(e)},getDirectories:function(e){return t.getDirectories(e)},readDirectory:function(e,r,n,i,a){return t.readDirectory(e,r,n,i,a)},realpath:e.maybeBind(t,t.realpath),getEnvironmentVariable:e.maybeBind(t,t.getEnvironmentVariable),trace:function(e){return t.write(e+t.newLine)},createDirectory:function(e){return t.createDirectory(e)},writeFile:function(e,r,n){return t.writeFile(e,r,n)},createHash:e.maybeBind(t,t.createHash),createProgram:r||e.createEmitAndSemanticDiagnosticsBuilderProgram,disableUseFileVersionAsSignature:t.disableUseFileVersionAsSignature,storeFilesChangingSignatureDuringEmit:t.storeFilesChangingSignatureDuringEmit}}function T(t,r,n,i){void 0===t&&(t=e.sys);var a=function(e){return t.write(e+t.newLine)},o=S(t,r);return e.copyProperties(o,D(t,i)),o.afterProgramCreate=function(r){var i=r.getCompilerOptions(),s=e.getNewLineCharacter(i,(function(){return t.newLine}));b(r,n,a,(function(t){return o.onWatchStatusChange(e.createCompilerDiagnostic(l(t),t),s,i,t)}));},o}function C(t,r,n){r(n),t.exit(e.ExitStatus.DiagnosticsPresent_OutputsSkipped);}e.createDiagnosticReporter=r,e.screenStartingMessageCodes=[e.Diagnostics.Starting_compilation_in_watch_mode.code,e.Diagnostics.File_change_detected_Starting_incremental_compilation.code],e.getLocaleTimeString=a,e.createWatchStatusReporter=o,e.parseConfigFileWithSystem=function(t,r,n,i,a,o){var s=a;s.onUnRecoverableConfigFileDiagnostic=function(e){return C(a,o,e)};var c=e.getParsedCommandLineOfConfigFile(t,r,s,n,i);return s.onUnRecoverableConfigFileDiagnostic=void 0,c},e.getErrorCountForSummary=s,e.getFilesInErrorForSummary=c,e.getWatchErrorSummaryDiagnosticMessage=l,e.getErrorSummaryText=_,e.isBuilderProgram=d,e.listFiles=p,e.explainFiles=f,e.explainIfFileIsRedirect=g,e.getMatchedFileSpec=m,e.getMatchedIncludeSpec=y,e.fileIncludeReasonToDiagnostics=v,e.emitFilesAndReportErrors=b,e.emitFilesAndReportErrorsAndGetExitStatus=x,e.noopFileWatcher={close:e.noop},e.returnNoopFileWatcher=function(){return e.noopFileWatcher},e.createWatchHost=D,e.WatchType={ConfigFile:"Config file",ExtendedConfigFile:"Extended config file",SourceFile:"Source file",MissingFile:"Missing file",WildcardDirectory:"Wild card directory",FailedLookupLocations:"Failed Lookup Locations",TypeRoots:"Type roots",ConfigFileOfReferencedProject:"Config file of referened project",ExtendedConfigOfReferencedProject:"Extended config file of referenced project",WildcardDirectoryOfReferencedProject:"Wild card directory of referenced project",PackageJson:"package.json file"},e.createWatchFactory=function(t,r){var n=t.trace?r.extendedDiagnostics?e.WatchLogLevel.Verbose:r.diagnostics?e.WatchLogLevel.TriggerOnly:e.WatchLogLevel.None:e.WatchLogLevel.None,i=n!==e.WatchLogLevel.None?function(e){return t.trace(e)}:e.noop,a=e.getWatchFactory(t,n,i);return a.writeLog=i,a},e.createCompilerHostFromProgramHost=function(t,r,n){void 0===n&&(n=t);var i=t.useCaseSensitiveFileNames(),a=e.memoize((function(){return t.getNewLine()}));return {getSourceFile:function(n,i,a){var o;try{e.performance.mark("beforeIORead"),o=t.readFile(n,r().charset),e.performance.mark("afterIORead"),e.performance.measure("I/O Read","beforeIORead","afterIORead");}catch(e){a&&a(e.message),o="";}return void 0!==o?e.createSourceFile(n,o,i):void 0},getDefaultLibLocation:e.maybeBind(t,t.getDefaultLibLocation),getDefaultLibFileName:function(e){return t.getDefaultLibFileName(e)},writeFile:function(r,n,i,a){try{e.performance.mark("beforeIOWrite"),e.writeFileEnsuringDirectories(r,n,i,(function(e,r,n){return t.writeFile(e,r,n)}),(function(e){return t.createDirectory(e)}),(function(e){return t.directoryExists(e)})),e.performance.mark("afterIOWrite"),e.performance.measure("I/O Write","beforeIOWrite","afterIOWrite");}catch(e){a&&a(e.message);}},getCurrentDirectory:e.memoize((function(){return t.getCurrentDirectory()})),useCaseSensitiveFileNames:function(){return i},getCanonicalFileName:e.createGetCanonicalFileName(i),getNewLine:function(){return e.getNewLineCharacter(r(),a)},fileExists:function(e){return t.fileExists(e)},readFile:function(e){return t.readFile(e)},trace:e.maybeBind(t,t.trace),directoryExists:e.maybeBind(n,n.directoryExists),getDirectories:e.maybeBind(n,n.getDirectories),realpath:e.maybeBind(t,t.realpath),getEnvironmentVariable:e.maybeBind(t,t.getEnvironmentVariable)||function(){return ""},createHash:e.maybeBind(t,t.createHash),readDirectory:e.maybeBind(t,t.readDirectory),disableUseFileVersionAsSignature:t.disableUseFileVersionAsSignature,storeFilesChangingSignatureDuringEmit:t.storeFilesChangingSignatureDuringEmit}},e.setGetSourceFileAsHashVersioned=function(t,r){var i=t.getSourceFile,a=e.maybeBind(r,r.createHash)||e.generateDjb2Hash;t.getSourceFile=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o=i.call.apply(i,n$4([t],e,!1));return o&&(o.version=a(o.text)),o};},e.createProgramHost=S,e.createWatchCompilerHostOfConfigFile=function(e){var t=e.configFileName,n=e.optionsToExtend,i=e.watchOptionsToExtend,a=e.extraFileExtensions,o=e.system,s=e.createProgram,c=e.reportDiagnostic,l=e.reportWatchStatus,u=c||r(o),_=T(o,s,u,l);return _.onUnRecoverableConfigFileDiagnostic=function(e){return C(o,u,e)},_.configFileName=t,_.optionsToExtend=n,_.watchOptionsToExtend=i,_.extraFileExtensions=a,_},e.createWatchCompilerHostOfFilesAndCompilerOptions=function(e){var t=e.rootFiles,n=e.options,i=e.watchOptions,a=e.projectReferences,o=e.system,s=e.createProgram,c=e.reportDiagnostic,l=e.reportWatchStatus,u=T(o,s,c||r(o),l);return u.rootFiles=t,u.options=n,u.watchOptions=i,u.projectReferences=a,u},e.performIncrementalCompilation=function(t){var n=t.system||e.sys,i=t.host||(t.host=e.createIncrementalCompilerHost(t.options,n)),a=e.createIncrementalProgram(t),o=x(a,t.reportDiagnostic||r(n),(function(e){return i.trace&&i.trace(e)}),t.reportErrorSummary||t.options.pretty?function(e,t){return n.write(_(e,t,n.newLine,i))}:void 0);return t.afterProgramEmitAndDiagnostics&&t.afterProgramEmitAndDiagnostics(a),o};}(t),function(e){function t(t,r){if(!e.outFile(t)){var n=e.getTsBuildInfoEmitOutputFilePath(t);if(n){var i=r.readFile(n);if(i){var a=e.getBuildInfo(i);if(a.version===e.version&&a.program)return e.createBuildProgramUsingProgramBuildInfo(a.program,n,r)}}}}function r(t,r){void 0===r&&(r=e.sys);var n=e.createCompilerHostWorker(t,void 0,r);return n.createHash=e.maybeBind(r,r.createHash),n.disableUseFileVersionAsSignature=r.disableUseFileVersionAsSignature,n.storeFilesChangingSignatureDuringEmit=r.storeFilesChangingSignatureDuringEmit,e.setGetSourceFileAsHashVersioned(n,r),e.changeCompilerHostLikeToUseCache(n,(function(t){return e.toPath(t,n.getCurrentDirectory(),n.getCanonicalFileName)})),n}e.readBuilderProgram=t,e.createIncrementalCompilerHost=r,e.createIncrementalProgram=function(n){var i=n.rootNames,a=n.options,o=n.configFileParsingDiagnostics,s=n.projectReferences,c=n.host,l=n.createProgram;return c=c||r(a),(l=l||e.createEmitAndSemanticDiagnosticsBuilderProgram)(i,a,c,t(a,c),o,s)},e.createWatchCompilerHost=function(t,r,n,i,a,o,s,c){return e.isArray(t)?e.createWatchCompilerHostOfFilesAndCompilerOptions({rootFiles:t,options:r,watchOptions:c,projectReferences:s,system:n,createProgram:i,reportDiagnostic:a,reportWatchStatus:o}):e.createWatchCompilerHostOfConfigFile({configFileName:t,optionsToExtend:r,watchOptionsToExtend:s,extraFileExtensions:c,system:n,createProgram:i,reportDiagnostic:a,reportWatchStatus:o})},e.createWatchProgram=function(r){var a,o,s,c,l,u,_,d,p,f,g,m,y=r.extendedConfigCache,v=!1,h=!1,b=new e.Map,x=!1,D=r.useCaseSensitiveFileNames(),S=r.getCurrentDirectory(),T=r.configFileName,C=r.optionsToExtend,k=void 0===C?{}:C,E=r.watchOptionsToExtend,N=r.extraFileExtensions,F=r.createProgram,A=r.rootFiles,P=r.options,w=r.watchOptions,I=r.projectReferences,O=!1,M=!1,L=void 0===T?void 0:e.createCachedDirectoryStructureHost(r,S,D),R=L||r,B=e.parseConfigHostFromCompilerHostLike(r,R),j=ee();T&&r.configFileParsingResult&&(ge(r.configFileParsingResult),j=ee()),se(e.Diagnostics.Starting_compilation_in_watch_mode),T&&!r.configFileParsingResult&&(j=e.getNewLineCharacter(k,(function(){return r.getNewLine()})),e.Debug.assert(!A),fe(),j=ee());var J,z=e.createWatchFactory(r,P),K=z.watchFile,U=z.watchDirectory,V=z.writeLog,q=e.createGetCanonicalFileName(D);V("Current directory: ".concat(S," CaseSensitiveFileNames: ").concat(D)),T&&(J=K(T,(function(){e.Debug.assert(!!T),o=e.ConfigFileProgramReloadLevel.Full,_e();}),e.PollingInterval.High,w,e.WatchType.ConfigFile));var W=e.createCompilerHostFromProgramHost(r,(function(){return P}),R);e.setGetSourceFileAsHashVersioned(W,r);var H=W.getSourceFile;W.getSourceFile=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return ie.apply(void 0,n$4([e,te(e)],t,!1))},W.getSourceFileByPath=ie,W.getNewLine=function(){return j},W.fileExists=ne,W.onReleaseOldSourceFile=function(e,t,r){var n=b.get(e.resolvedPath);void 0!==n&&(re(n)?(f||(f=[])).push(e.path):n.sourceFile===e&&(n.fileWatcher&&n.fileWatcher.close(),b.delete(e.resolvedPath),r||G.removeResolutionsOfFile(e.path)));},W.onReleaseParsedCommandLine=function(t){var r,n=te(t),i=null==d?void 0:d.get(n);i&&(d.delete(n),i.watchedDirectories&&e.clearMap(i.watchedDirectories,e.closeFileWatcherOf),null===(r=i.watcher)||void 0===r||r.close(),e.clearSharedExtendedConfigFileWatcher(n,p));},W.toPath=te,W.getCompilationSettings=function(){return P},W.useSourceOfProjectReferenceRedirect=e.maybeBind(r,r.useSourceOfProjectReferenceRedirect),W.watchDirectoryOfFailedLookupLocation=function(t,r,n){return U(t,r,n,w,e.WatchType.FailedLookupLocations)},W.watchTypeRootsDirectory=function(t,r,n){return U(t,r,n,w,e.WatchType.TypeRoots)},W.getCachedDirectoryStructureHost=function(){return L},W.scheduleInvalidateResolutionsOfFailedLookupLocations=function(){if(!r.setTimeout||!r.clearTimeout)return G.invalidateResolutionsOfFailedLookupLocations();var e=le();V("Scheduling invalidateFailedLookup".concat(e?", Cancelled earlier one":"")),_=r.setTimeout(ue,250);},W.onInvalidatedResolution=_e,W.onChangedAutomaticTypeDirectiveNames=_e,W.fileIsOpen=e.returnFalse,W.getCurrentProgram=Z,W.writeLog=V,W.getParsedCommandLine=me;var G=e.createResolutionCache(W,T?e.getDirectoryPath(e.getNormalizedAbsolutePath(T,S)):S,!1);W.resolveModuleNames=r.resolveModuleNames?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.resolveModuleNames.apply(r,e)}:function(e,t,r,n,i,a){return G.resolveModuleNames(e,t,r,n,a)},W.resolveTypeReferenceDirectives=r.resolveTypeReferenceDirectives?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.resolveTypeReferenceDirectives.apply(r,e)}:function(e,t,r,n,i){return G.resolveTypeReferenceDirectives(e,t,r,i)};var Q=!!r.resolveModuleNames||!!r.resolveTypeReferenceDirectives;return a=t(P,W),$(),Te(),T&&ke(te(T),P,w,e.WatchType.ExtendedConfigFile),T?{getCurrentProgram:Y,getProgram:pe,close:X}:{getCurrentProgram:Y,getProgram:pe,updateRootFileNames:function(t){e.Debug.assert(!T,"Cannot update root file names with config file watch mode"),A=t,_e();},close:X};function X(){le(),G.clear(),e.clearMap(b,(function(e){e&&e.fileWatcher&&(e.fileWatcher.close(),e.fileWatcher=void 0);})),J&&(J.close(),J=void 0),null==y||y.clear(),y=void 0,p&&(e.clearMap(p,e.closeFileWatcherOf),p=void 0),l&&(e.clearMap(l,e.closeFileWatcherOf),l=void 0),s&&(e.clearMap(s,e.closeFileWatcher),s=void 0),d&&(e.clearMap(d,(function(t){var r;null===(r=t.watcher)||void 0===r||r.close(),t.watcher=void 0,t.watchedDirectories&&e.clearMap(t.watchedDirectories,e.closeFileWatcherOf),t.watchedDirectories=void 0;})),d=void 0),c&&(e.clearMap(c,e.closeFileWatcher),c=void 0);}function Y(){return a}function Z(){return a&&a.getProgramOrUndefined()}function $(){V("Synchronizing program"),le();var t=Y();x&&(j=ee(),t&&(v||e.changesAffectModuleResolution(t.getCompilerOptions(),P))&&G.clear());var n=G.createHasInvalidatedResolution(Q||v);return e.isProgramUptoDate(Z(),A,P,oe,ne,n,ce,me,I)?M&&(h&&se(e.Diagnostics.File_change_detected_Starting_incremental_compilation),a=F(void 0,void 0,W,a,m,I),M=!1):(h&&se(e.Diagnostics.File_change_detected_Starting_incremental_compilation),function(t){V("CreatingProgramWith::"),V(" roots: ".concat(JSON.stringify(A))),V(" options: ".concat(JSON.stringify(P))),I&&V(" projectReferences: ".concat(JSON.stringify(I)));var r=x||!Z();x=!1,M=!1,G.startCachingPerDirectoryResolution(),W.hasInvalidatedResolution=t,W.hasChangedAutomaticTypeDirectiveNames=ce,a=F(A,P,W,a,m,I);var n=e.map(G.getModuleResolutionCache().getPackageJsonInfoCache().entries(),(function(e){var t=e[0],r=e[1];return [W.realpath?te(W.realpath(t)):t,r]}));if(G.finishCachingPerDirectoryResolution(),e.updateMissingFilePathsWatch(a.getProgram(),s||(s=new e.Map),be),e.updatePackageJsonWatch(n,c||(c=new e.Map),xe),r&&G.updateTypeRootsWatch(),f){for(var i=0,o=f;i<o.length;i++){var l=o[i];s.has(l)||b.delete(l);}f=void 0;}}(n)),v=!1,h=!1,r.afterProgramCreate&&t!==a&&r.afterProgramCreate(a),a}function ee(){return e.getNewLineCharacter(P||k,(function(){return r.getNewLine()}))}function te(t){return e.toPath(t,S,q)}function re(e){return "boolean"==typeof e}function ne(e){var t=te(e);return !re(b.get(t))&&R.fileExists(e)}function ie(t,r,n,i,a){var o=b.get(r);if(!re(o)){if(void 0===o||a||function(e){return "boolean"==typeof e.version}(o)){var s=H(t,n,i);if(o)s?(o.sourceFile=s,o.version=s.version,o.fileWatcher||(o.fileWatcher=ye(r,t,ve,e.PollingInterval.Low,w,e.WatchType.SourceFile))):(o.fileWatcher&&o.fileWatcher.close(),b.set(r,!1));else if(s){var c=ye(r,t,ve,e.PollingInterval.Low,w,e.WatchType.SourceFile);b.set(r,{sourceFile:s,version:s.version,fileWatcher:c});}else b.set(r,!1);return s&&(s.impliedNodeFormat=e.getImpliedNodeFormatForFile(r,G.getModuleResolutionCache().getPackageJsonInfoCache(),W,W.getCompilationSettings())),s}return o.sourceFile}}function ae(e){var t=b.get(e);void 0!==t&&(re(t)?b.set(e,{version:!1}):t.version=!1);}function oe(e){var t=b.get(e);return t&&t.version?t.version:void 0}function se(t){r.onWatchStatusChange&&r.onWatchStatusChange(e.createCompilerDiagnostic(t),j,P||k);}function ce(){return G.hasChangedAutomaticTypeDirectiveNames()}function le(){return !!_&&(r.clearTimeout(_),_=void 0,!0)}function ue(){_=void 0,G.invalidateResolutionsOfFailedLookupLocations()&&_e();}function _e(){r.setTimeout&&r.clearTimeout&&(u&&r.clearTimeout(u),V("Scheduling update"),u=r.setTimeout(de,250));}function de(){u=void 0,h=!0,pe();}function pe(){switch(o){case e.ConfigFileProgramReloadLevel.Partial:e.perfLogger.logStartUpdateProgram("PartialConfigReload"),V("Reloading new file names and options"),o=e.ConfigFileProgramReloadLevel.None,A=e.getFileNamesFromConfigSpecs(P.configFile.configFileSpecs,e.getNormalizedAbsolutePath(e.getDirectoryPath(T),S),P,B,N),e.updateErrorForNoInputFiles(A,e.getNormalizedAbsolutePath(T,S),P.configFile.configFileSpecs,m,O)&&(M=!0),$();break;case e.ConfigFileProgramReloadLevel.Full:e.perfLogger.logStartUpdateProgram("FullConfigReload"),V("Reloading config file: ".concat(T)),o=e.ConfigFileProgramReloadLevel.None,L&&L.clearCache(),fe(),x=!0,$(),Te(),ke(te(T),P,w,e.WatchType.ExtendedConfigFile);break;default:e.perfLogger.logStartUpdateProgram("SynchronizeProgram"),$();}return e.perfLogger.logStopUpdateProgram("Done"),Y()}function fe(){ge(e.getParsedCommandLineOfConfigFile(T,k,B,y||(y=new e.Map),E,N));}function ge(t){A=t.fileNames,P=t.options,w=t.watchOptions,I=t.projectReferences,g=t.wildcardDirectories,m=e.getConfigFileParsingDiagnostics(t).slice(),O=e.canJsonReportNoInputFiles(t.raw),M=!0;}function me(t){var n=te(t),a=null==d?void 0:d.get(n);if(a){if(!a.reloadLevel)return a.parsedCommandLine;if(a.parsedCommandLine&&a.reloadLevel===e.ConfigFileProgramReloadLevel.Partial&&!r.getParsedCommandLine){V("Reloading new file names and options");var o=e.getFileNamesFromConfigSpecs(a.parsedCommandLine.options.configFile.configFileSpecs,e.getNormalizedAbsolutePath(e.getDirectoryPath(t),S),P,B);return a.parsedCommandLine=i$1(i$1({},a.parsedCommandLine),{fileNames:o}),a.reloadLevel=void 0,a.parsedCommandLine}}V("Loading config file: ".concat(t));var s=r.getParsedCommandLine?r.getParsedCommandLine(t):function(t){var r=B.onUnRecoverableConfigFileDiagnostic;B.onUnRecoverableConfigFileDiagnostic=e.noop;var n=e.getParsedCommandLineOfConfigFile(t,void 0,B,y||(y=new e.Map),E);return B.onUnRecoverableConfigFileDiagnostic=r,n}(t);return a?(a.parsedCommandLine=s,a.reloadLevel=void 0):(d||(d=new e.Map)).set(n,a={parsedCommandLine:s}),function(t,r,n){var i,a,o,s,c;n.watcher||(n.watcher=K(t,(function(n,i){he(t,r,i);var a=null==d?void 0:d.get(r);a&&(a.reloadLevel=e.ConfigFileProgramReloadLevel.Full),G.removeResolutionsFromProjectReferenceRedirects(r),_e();}),e.PollingInterval.High,(null===(i=n.parsedCommandLine)||void 0===i?void 0:i.watchOptions)||w,e.WatchType.ConfigFileOfReferencedProject)),(null===(a=n.parsedCommandLine)||void 0===a?void 0:a.wildcardDirectories)?e.updateWatchingWildcardDirectories(n.watchedDirectories||(n.watchedDirectories=new e.Map),new e.Map(e.getEntries(null===(o=n.parsedCommandLine)||void 0===o?void 0:o.wildcardDirectories)),(function(i,a){var o;return U(i,(function(n){var a=te(n);L&&L.addOrDeleteFileOrDirectory(n,a),ae(a);var o=null==d?void 0:d.get(r);(null==o?void 0:o.parsedCommandLine)&&(e.isIgnoredFileFromWildCardWatching({watchedDirPath:te(i),fileOrDirectory:n,fileOrDirectoryPath:a,configFileName:t,options:o.parsedCommandLine.options,program:o.parsedCommandLine.fileNames,currentDirectory:S,useCaseSensitiveFileNames:D,writeLog:V,toPath:te})||o.reloadLevel!==e.ConfigFileProgramReloadLevel.Full&&(o.reloadLevel=e.ConfigFileProgramReloadLevel.Partial,_e()));}),a,(null===(o=n.parsedCommandLine)||void 0===o?void 0:o.watchOptions)||w,e.WatchType.WildcardDirectoryOfReferencedProject)})):n.watchedDirectories&&(e.clearMap(n.watchedDirectories,e.closeFileWatcherOf),n.watchedDirectories=void 0),ke(r,null===(s=n.parsedCommandLine)||void 0===s?void 0:s.options,(null===(c=n.parsedCommandLine)||void 0===c?void 0:c.watchOptions)||w,e.WatchType.ExtendedConfigOfReferencedProject);}(t,n,a),s}function ye(e,t,r,n,i,a){return K(t,(function(t,n){return r(t,n,e)}),n,i,a)}function ve(t,r,n){he(t,n,r),r===e.FileWatcherEventKind.Deleted&&b.has(n)&&G.invalidateResolutionOfFile(n),ae(n),_e();}function he(e,t,r){L&&L.addOrDeleteFile(e,t,r);}function be(t){return (null==d?void 0:d.has(t))?e.noopFileWatcher:ye(t,t,Se,e.PollingInterval.Medium,w,e.WatchType.MissingFile)}function xe(t){return b.has(t)?e.noopFileWatcher:ye(t,t,De,e.PollingInterval.High,w,e.WatchType.PackageJson)}function De(t,r,n){he(t,n,r),o=e.ConfigFileProgramReloadLevel.Full,v=!0,_e();}function Se(t,r,n){he(t,n,r),r===e.FileWatcherEventKind.Created&&s.has(n)&&(s.get(n).close(),s.delete(n),ae(n),_e());}function Te(){g?e.updateWatchingWildcardDirectories(l||(l=new e.Map),new e.Map(e.getEntries(g)),Ce):l&&e.clearMap(l,e.closeFileWatcherOf);}function Ce(t,r){return U(t,(function(r){e.Debug.assert(!!T);var n=te(r);L&&L.addOrDeleteFileOrDirectory(r,n),ae(n),e.isIgnoredFileFromWildCardWatching({watchedDirPath:te(t),fileOrDirectory:r,fileOrDirectoryPath:n,configFileName:T,extraFileExtensions:N,options:P,program:Y()||A,currentDirectory:S,useCaseSensitiveFileNames:D,writeLog:V,toPath:te})||o!==e.ConfigFileProgramReloadLevel.Full&&(o=e.ConfigFileProgramReloadLevel.Partial,_e());}),r,w,e.WatchType.WildcardDirectory)}function ke(t,r,n,i){e.updateSharedExtendedConfigFileWatcher(t,r,p||(p=new e.Map),(function(t,r){return K(t,(function(n,i){var a;he(t,r,i),y&&e.cleanExtendedConfigCache(y,r,te);var s=null===(a=p.get(r))||void 0===a?void 0:a.projects;(null==s?void 0:s.size)&&s.forEach((function(t){if(te(T)===t)o=e.ConfigFileProgramReloadLevel.Full;else {var r=null==d?void 0:d.get(t);r&&(r.reloadLevel=e.ConfigFileProgramReloadLevel.Full),G.removeResolutionsFromProjectReferenceRedirects(t);}_e();}));}),e.PollingInterval.High,n,i)}),te);}};}(t),function(e){var t;(t=e.UpToDateStatusType||(e.UpToDateStatusType={}))[t.Unbuildable=0]="Unbuildable",t[t.UpToDate=1]="UpToDate",t[t.UpToDateWithUpstreamTypes=2]="UpToDateWithUpstreamTypes",t[t.OutOfDateWithPrepend=3]="OutOfDateWithPrepend",t[t.OutputMissing=4]="OutputMissing",t[t.OutOfDateWithSelf=5]="OutOfDateWithSelf",t[t.OutOfDateWithUpstream=6]="OutOfDateWithUpstream",t[t.UpstreamOutOfDate=7]="UpstreamOutOfDate",t[t.UpstreamBlocked=8]="UpstreamBlocked",t[t.ComputingUpstream=9]="ComputingUpstream",t[t.TsVersionOutputOfDate=10]="TsVersionOutputOfDate",t[t.ContainerOnly=11]="ContainerOnly",e.resolveConfigFileProjectName=function(t){return e.fileExtensionIs(t,".json")?t:e.combinePaths(t,"tsconfig.json")};}(t),function(e){var t,r,i,a=new Date(-864e13),o=new Date(864e13);function s(t,r){return function(t,r,n){var i,a=t.get(r);return a||(i=new e.Map,t.set(r,i)),a||i}(t,r)}function c(e,t){return t>e?t:e}function l(e){return !!e&&!!e.buildOrder}function u(e){return l(e)?e.buildOrder:e}function _(t,r){return function(n){var i=r?"[".concat(e.formatColorAndReset(e.getLocaleTimeString(t),e.ForegroundColorEscapeSequences.Grey),"] "):"".concat(e.getLocaleTimeString(t)," - ");i+="".concat(e.flattenDiagnosticMessageText(n.messageText,t.newLine)).concat(t.newLine+t.newLine),t.write(i);}}function d(t,r,n,i){var a=e.createProgramHost(t,r);return a.getModifiedTime=t.getModifiedTime?function(e){return t.getModifiedTime(e)}:e.returnUndefined,a.setModifiedTime=t.setModifiedTime?function(e,r){return t.setModifiedTime(e,r)}:e.noop,a.deleteFile=t.deleteFile?function(e){return t.deleteFile(e)}:e.noop,a.reportDiagnostic=n||e.createDiagnosticReporter(t),a.reportSolutionBuilderStatus=i||_(t),a.now=e.maybeBind(t,t.now),a}function p(t,r){return e.toPath(r,t.currentDirectory,t.getCanonicalFileName)}function f(e,t){var r=e.resolvedConfigFilePaths,n=r.get(t);if(void 0!==n)return n;var i=p(e,t);return r.set(t,i),i}function g(e){return !!e.options}function m(e,t){var r=e.configFileCache.get(t);return r&&g(r)?r:void 0}function y(t,r,n){var i,a=t.configFileCache,o=a.get(n);if(o)return g(o)?o:void 0;var s,c=t.parseConfigFileHost,l=t.baseCompilerOptions,u=t.baseWatchOptions,_=t.extendedConfigCache,d=t.host;return d.getParsedCommandLine?(s=d.getParsedCommandLine(r))||(i=e.createCompilerDiagnostic(e.Diagnostics.File_0_not_found,r)):(c.onUnRecoverableConfigFileDiagnostic=function(e){return i=e},s=e.getParsedCommandLineOfConfigFile(r,l,c,_,u),c.onUnRecoverableConfigFileDiagnostic=e.noop),a.set(n,s||i),s}function v(t,r){return e.resolveConfigFileProjectName(e.resolvePath(t.currentDirectory,r))}function h(t,r){for(var n,i,a=new e.Map,o=new e.Map,s=[],c=0,l=r;c<l.length;c++)u(l[c]);return i?{buildOrder:n||e.emptyArray,circularDiagnostics:i}:n||e.emptyArray;function u(r,c){var l=f(t,r);if(!o.has(l))if(a.has(l))c||(i||(i=[])).push(e.createCompilerDiagnostic(e.Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0,s.join("\r\n")));else {a.set(l,!0),s.push(r);var _=y(t,r,l);if(_&&_.projectReferences)for(var d=0,p=_.projectReferences;d<p.length;d++){var g=p[d];u(v(t,g.path),c||g.circular);}s.pop(),o.set(l,!0),(n||(n=[])).push(r);}}}function b(t){return t.buildOrder||function(t){var r=h(t,t.rootNames.map((function(e){return v(t,e)})));t.resolvedConfigFilePaths.clear();var n=new e.Map(u(r).map((function(e){return [f(t,e),!0]}))),i={onDeleteValue:e.noop};return e.mutateMapSkippingNewValues(t.configFileCache,n,i),e.mutateMapSkippingNewValues(t.projectStatus,n,i),e.mutateMapSkippingNewValues(t.buildInfoChecked,n,i),e.mutateMapSkippingNewValues(t.builderPrograms,n,i),e.mutateMapSkippingNewValues(t.diagnostics,n,i),e.mutateMapSkippingNewValues(t.projectPendingBuild,n,i),e.mutateMapSkippingNewValues(t.projectErrorsReported,n,i),t.watch&&(e.mutateMapSkippingNewValues(t.allWatchedConfigFiles,n,{onDeleteValue:e.closeFileWatcher}),t.allWatchedExtendedConfigFiles.forEach((function(e){e.projects.forEach((function(t){n.has(t)||e.projects.delete(t);})),e.close();})),e.mutateMapSkippingNewValues(t.allWatchedWildcardDirectories,n,{onDeleteValue:function(t){return t.forEach(e.closeFileWatcherOf)}}),e.mutateMapSkippingNewValues(t.allWatchedInputFiles,n,{onDeleteValue:function(t){return t.forEach(e.closeFileWatcher)}}),e.mutateMapSkippingNewValues(t.allWatchedPackageJsonFiles,n,{onDeleteValue:function(t){return t.forEach(e.closeFileWatcher)}})),t.buildOrder=r}(t)}function x(t,r,n){var i=r&&v(t,r),a=b(t);if(l(a))return a;if(i){var o=f(t,i);if(-1===e.findIndex(a,(function(e){return f(t,e)===o})))return}var s=i?h(t,[i]):a;return e.Debug.assert(!l(s)),e.Debug.assert(!n||void 0!==i),e.Debug.assert(!n||s[s.length-1]===i),n?s.slice(0,s.length-1):s}function D(t){t.cache&&S(t);var r=t.compilerHost,i=t.host,a=t.readFileWithCache,o=r.getSourceFile,s=e.changeCompilerHostLikeToUseCache(i,(function(e){return p(t,e)}),(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.call.apply(o,n$4([r],e,!1))})),c=s.originalReadFile,l=s.originalFileExists,u=s.originalDirectoryExists,_=s.originalCreateDirectory,d=s.originalWriteFile,f=s.getSourceFileWithCache,g=s.readFileWithCache;t.readFileWithCache=g,r.getSourceFile=f,t.cache={originalReadFile:c,originalFileExists:l,originalDirectoryExists:u,originalCreateDirectory:_,originalWriteFile:d,originalReadFileWithCache:a,originalGetSourceFile:o};}function S(e){if(e.cache){var t=e.cache,r=e.host,n=e.compilerHost,i=e.extendedConfigCache,a=e.moduleResolutionCache,o=e.typeReferenceDirectiveResolutionCache;r.readFile=t.originalReadFile,r.fileExists=t.originalFileExists,r.directoryExists=t.originalDirectoryExists,r.createDirectory=t.originalCreateDirectory,r.writeFile=t.originalWriteFile,n.getSourceFile=t.originalGetSourceFile,e.readFileWithCache=t.originalReadFileWithCache,i.clear(),null==a||a.clear(),null==o||o.clear(),e.cache=void 0;}}function T(e,t){e.projectStatus.delete(t),e.diagnostics.delete(t);}function C(e,t,r){var n=e.projectPendingBuild,i=n.get(t);(void 0===i||i<r)&&n.set(t,r);}function k(t,r){t.allProjectBuildPending&&(t.allProjectBuildPending=!1,t.options.watch&&ee(t,e.Diagnostics.Starting_compilation_in_watch_mode),D(t),u(b(t)).forEach((function(r){return t.projectPendingBuild.set(f(t,r),e.ConfigFileProgramReloadLevel.None)})),r&&r.throwIfCancellationRequested());}function E(t,r){return t.projectPendingBuild.delete(r),t.currentInvalidatedProject=void 0,t.diagnostics.has(r)?e.ExitStatus.DiagnosticsPresent_OutputsSkipped:e.ExitStatus.Success}function N(e,t,n,i,a){var o=!0;return {kind:r.UpdateOutputFileStamps,project:t,projectPath:n,buildOrder:a,getCompilerOptions:function(){return i.options},getCurrentDirectory:function(){return e.currentDirectory},updateOutputFileStatmps:function(){B(e,i,n),o=!1;},done:function(){return o&&B(e,i,n),E(e,n)}}}function F(s,l,u,_,d,g,m){var h,b,x,D=s===r.Build?i.CreateProgram:i.EmitBundle;return s===r.Build?{kind:s,project:u,projectPath:_,buildOrder:m,getCompilerOptions:function(){return g.options},getCurrentDirectory:function(){return l.currentDirectory},getBuilderProgram:function(){return T(e.identity)},getProgram:function(){return T((function(e){return e.getProgramOrUndefined()}))},getSourceFile:function(e){return T((function(t){return t.getSourceFile(e)}))},getSourceFiles:function(){return C((function(e){return e.getSourceFiles()}))},getOptionsDiagnostics:function(e){return C((function(t){return t.getOptionsDiagnostics(e)}))},getGlobalDiagnostics:function(e){return C((function(t){return t.getGlobalDiagnostics(e)}))},getConfigFileParsingDiagnostics:function(){return C((function(e){return e.getConfigFileParsingDiagnostics()}))},getSyntacticDiagnostics:function(e,t){return C((function(r){return r.getSyntacticDiagnostics(e,t)}))},getAllDependencies:function(e){return C((function(t){return t.getAllDependencies(e)}))},getSemanticDiagnostics:function(e,t){return C((function(r){return r.getSemanticDiagnostics(e,t)}))},getSemanticDiagnosticsOfNextAffectedFile:function(e,t){return T((function(r){return r.getSemanticDiagnosticsOfNextAffectedFile&&r.getSemanticDiagnosticsOfNextAffectedFile(e,t)}))},emit:function(e,t,r,n,a){return e||n?T((function(i){var o,s;return i.emit(e,t,r,n,a||(null===(s=(o=l.host).getCustomTransformers)||void 0===s?void 0:s.call(o,u)))})):(z(i.SemanticDiagnostics,r),D===i.EmitBuildInfo?L(t,r):D===i.Emit?M(t,r,a):void 0)},done:S}:{kind:s,project:u,projectPath:_,buildOrder:m,getCompilerOptions:function(){return g.options},getCurrentDirectory:function(){return l.currentDirectory},emit:function(e,t){return D!==i.EmitBundle?x:J(e,t)},done:S};function S(e,t,r){return z(i.Done,e,t,r),E(l,_)}function T(e){return z(i.CreateProgram),h&&e(h)}function C(t){return T(t)||e.emptyArray}function k(){var r,n;if(e.Debug.assert(void 0===h),l.options.dry)return $(l,e.Diagnostics.A_non_dry_build_would_build_project_0,u),b=t.Success,void(D=i.QueueReferencingProjects);if(l.options.verbose&&$(l,e.Diagnostics.Building_project_0,u),0===g.fileNames.length)return re(l,_,e.getConfigFileParsingDiagnostics(g)),b=t.None,void(D=i.QueueReferencingProjects);var a=l.host,o=l.compilerHost;l.projectCompilerOptions=g.options,null===(r=l.moduleResolutionCache)||void 0===r||r.update(g.options),null===(n=l.typeReferenceDirectiveResolutionCache)||void 0===n||n.update(g.options),h=a.createProgram(g.fileNames,g.options,o,function(t,r,n){var i=t.options,a=t.builderPrograms,o=t.compilerHost;if(!i.force)return a.get(r)||e.readBuilderProgram(n.options,o)}(l,_,g),e.getConfigFileParsingDiagnostics(g),g.projectReferences),l.watch&&(l.lastCachedPackageJsonLookups.set(_,l.moduleResolutionCache&&e.map(l.moduleResolutionCache.getPackageJsonInfoCache().entries(),(function(e){var t=e[0],r=e[1];return [l.host.realpath&&r?p(l,l.host.realpath(t)):t,r]}))),l.builderPrograms.set(_,h)),D++;}function N(e,t,r){var n;e.length?(n=O(l,_,h,g,e,t,r),b=n.buildResult,D=n.step):D++;}function A(r){e.Debug.assertIsDefined(h),N(n$4(n$4(n$4(n$4([],h.getConfigFileParsingDiagnostics(),!0),h.getOptionsDiagnostics(r),!0),h.getGlobalDiagnostics(r),!0),h.getSyntacticDiagnostics(void 0,r),!0),t.SyntaxErrors,"Syntactic");}function P(r){N(e.Debug.checkDefined(h).getSemanticDiagnostics(void 0,r),t.TypeErrors,"Semantic");}function M(r,n,o){var s,d,f,m;e.Debug.assertIsDefined(h),e.Debug.assert(D===i.Emit),h.backupState();var y=[],v=e.emitFilesAndReportErrors(h,(function(e){return (m||(m=[])).push(e)}),void 0,void 0,(function(e,t,r){return y.push({name:e,text:t,writeByteOrderMark:r})}),n,!1,o||(null===(f=(d=l.host).getCustomTransformers)||void 0===f?void 0:f.call(d,u))).emitResult;if(m)return h.restoreState(),s=O(l,_,h,g,m,t.DeclarationEmitErrors,"Declaration file"),b=s.buildResult,D=s.step,{emitSkipped:!0,diagnostics:v.diagnostics};var x=l.host,S=l.compilerHost,T=t.DeclarationOutputUnchanged,C=a,k=!1,E=e.createDiagnosticCollection(),N=new e.Map;return y.forEach((function(n){var i,a=n.name,o=n.text,s=n.writeByteOrderMark;!k&&e.isDeclarationFileName(a)&&(x.fileExists(a)&&l.readFileWithCache(a)===o?i=x.getModifiedTime(a):(T&=~t.DeclarationOutputUnchanged,k=!0)),N.set(p(l,a),a),e.writeFile(r?{writeFile:r}:S,E,a,o,s),void 0!==i&&(C=c(i,C));})),B(E,N,C,k,y.length?y[0].name:e.getFirstProjectOutput(g,!x.useCaseSensitiveFileNames()),T),v}function L(r,a){e.Debug.assertIsDefined(h),e.Debug.assert(D===i.EmitBuildInfo);var o=h.emitBuildInfo(r,a);return o.diagnostics.length&&(te(l,o.diagnostics),l.diagnostics.set(_,n$4(n$4([],l.diagnostics.get(_),!0),o.diagnostics,!0)),b=t.EmitErrors&b),o.emittedFiles&&l.write&&o.emittedFiles.forEach((function(e){return w(l,g,e)})),I(l,h,g),D=i.QueueReferencingProjects,o}function B(r,n,a,s,c,u){var d,p=r.getDiagnostics();if(p.length)return d=O(l,_,h,g,p,t.EmitErrors,"Emit"),b=d.buildResult,D=d.step,p;l.write&&n.forEach((function(e){return w(l,g,e)}));var f=R(l,g,a,e.Diagnostics.Updating_unchanged_output_timestamps_of_project_0,n);return l.diagnostics.delete(_),l.projectStatus.set(_,{type:e.UpToDateStatusType.UpToDate,newestDeclarationFileContentChangedTime:s?o:f,oldestOutputFileName:c}),I(l,h,g),D=i.QueueReferencingProjects,b=u,p}function J(n,o){var c,h;if(e.Debug.assert(s===r.UpdateBundle),l.options.dry)return $(l,e.Diagnostics.A_non_dry_build_would_update_output_of_project_0,u),b=t.Success,void(D=i.QueueReferencingProjects);l.options.verbose&&$(l,e.Diagnostics.Updating_output_of_project_0,u);var S=l.compilerHost;l.projectCompilerOptions=g.options;var T=e.emitUsingBuildInfo(g,S,(function(e){var t=v(l,e.path);return y(l,t,f(l,t))}),o||(null===(h=(c=l.host).getCustomTransformers)||void 0===h?void 0:h.call(c,u)));if(e.isString(T))return $(l,e.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1,u,Z(l,T)),D=i.BuildInvalidatedProjectOfBundle,x=F(r.Build,l,u,_,d,g,m);e.Debug.assert(!!T.length);var C=e.createDiagnosticCollection(),k=new e.Map;return T.forEach((function(t){var r=t.name,i=t.text,a=t.writeByteOrderMark;k.set(p(l,r),r),e.writeFile(n?{writeFile:n}:S,C,r,i,a);})),{emitSkipped:!1,diagnostics:B(C,k,a,!1,T[0].name,t.DeclarationOutputUnchanged)}}function z(t,r,n,a){for(;D<=t&&D<i.Done;){var o=D;switch(D){case i.CreateProgram:k();break;case i.SyntaxDiagnostics:A(r);break;case i.SemanticDiagnostics:P(r);break;case i.Emit:M(n,r,a);break;case i.EmitBuildInfo:L(n,r);break;case i.EmitBundle:J(n,a);break;case i.BuildInvalidatedProjectOfBundle:e.Debug.checkDefined(x).done(r,n,a),D=i.Done;break;case i.QueueReferencingProjects:j(l,u,_,d,g,m,e.Debug.checkDefined(b)),D++;break;case i.Done:default:e.assertType(D);}e.Debug.assert(D>o);}}}function A(t,r,n){var i=t.options;return !(r.type===e.UpToDateStatusType.OutOfDateWithPrepend&&!i.force&&0!==n.fileNames.length&&!e.getConfigFileParsingDiagnostics(n).length&&e.isIncrementalCompilation(n.options))}function P(t,n,i){if(t.projectPendingBuild.size&&!l(n)){if(t.currentInvalidatedProject)return e.arrayIsEqualTo(t.currentInvalidatedProject.buildOrder,n)?t.currentInvalidatedProject:void 0;for(var a=t.options,o=t.projectPendingBuild,s=0;s<n.length;s++){var c=n[s],u=f(t,c),_=t.projectPendingBuild.get(u);if(void 0!==_){i&&(i=!1,ae(t,n));var d=y(t,c,u);if(d){_===e.ConfigFileProgramReloadLevel.Full?(W(t,c,u,d),H(t,u,d),G(t,c,u,d),Q(t,c,u,d),X(t,c,u,d)):_===e.ConfigFileProgramReloadLevel.Partial&&(d.fileNames=e.getFileNamesFromConfigSpecs(d.options.configFile.configFileSpecs,e.getDirectoryPath(c),d.options,t.parseConfigFileHost),e.updateErrorForNoInputFiles(d.fileNames,c,d.options.configFile.configFileSpecs,d.errors,e.canJsonReportNoInputFiles(d.raw)),Q(t,c,u,d),X(t,c,u,d));var p=L(t,d,u);if(oe(t,c,p),!a.force){if(p.type===e.UpToDateStatusType.UpToDate){re(t,u,e.getConfigFileParsingDiagnostics(d)),o.delete(u),a.dry&&$(t,e.Diagnostics.Project_0_is_up_to_date,c);continue}if(p.type===e.UpToDateStatusType.UpToDateWithUpstreamTypes)return re(t,u,e.getConfigFileParsingDiagnostics(d)),N(t,c,u,d,n)}if(p.type!==e.UpToDateStatusType.UpstreamBlocked){if(p.type!==e.UpToDateStatusType.ContainerOnly)return F(A(t,p,d)?r.Build:r.UpdateBundle,t,c,u,s,d,n);re(t,u,e.getConfigFileParsingDiagnostics(d)),o.delete(u);}else re(t,u,e.getConfigFileParsingDiagnostics(d)),o.delete(u),a.verbose&&$(t,p.upstreamProjectBlocked?e.Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built:e.Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors,c,p.upstreamProjectName);}else ne(t,u),o.delete(u);}}}}function w(e,t,r){var n=e.write;n&&t.options.listEmittedFiles&&n("TSFILE: ".concat(r));}function I(t,r,n){r?(r&&t.write&&e.listFiles(r,t.write),t.host.afterProgramEmitAndDiagnostics&&t.host.afterProgramEmitAndDiagnostics(r),r.releaseProgram()):t.host.afterEmitBundle&&t.host.afterEmitBundle(n),t.projectCompilerOptions=t.baseCompilerOptions;}function O(r,n,a,o,s,c,l){var u=!(c&t.SyntaxErrors)&&a&&!e.outFile(a.getCompilerOptions());return re(r,n,s),r.projectStatus.set(n,{type:e.UpToDateStatusType.Unbuildable,reason:"".concat(l," errors")}),u?{buildResult:c,step:i.EmitBuildInfo}:(I(r,a,o),{buildResult:c,step:i.QueueReferencingProjects})}function M(t,r,n,i){if(n<e.getModifiedTime(t.host,r))return {type:e.UpToDateStatusType.OutOfDateWithSelf,outOfDateOutputFileName:i,newerInputFileName:r}}function L(t,r,n){if(void 0===r)return {type:e.UpToDateStatusType.Unbuildable,reason:"File deleted mid-build"};var i=t.projectStatus.get(n);if(void 0!==i)return i;var s=function(t,r,n){for(var i=!!t.options.force,s=void 0,l=a,u=t.host,_=0,d=r.fileNames;_<d.length;_++){var p=d[_];if(!u.fileExists(p))return {type:e.UpToDateStatusType.Unbuildable,reason:"".concat(p," does not exist")};if(!i){var g=e.getModifiedTime(u,p);g>l&&(s=p,l=g);}}if(!r.fileNames.length&&!e.canJsonReportNoInputFiles(r.raw))return {type:e.UpToDateStatusType.ContainerOnly};var m,v=e.getAllProjectOutputs(r,!u.useCaseSensitiveFileNames()),h="(none)",b=o,x="(none)",D=a,S=a,T=!1;if(!i)for(var C=0,k=v;C<k.length;C++){var E=k[C];if(!u.fileExists(E)){m=E;break}var N=e.getModifiedTime(u,E);if(N<b&&(b=N,h=E),N<l){T=!0;break}N>D&&(D=N,x=E),e.isDeclarationFileName(E)&&(S=c(S,e.getModifiedTime(u,E)));}var F,A=!1,P=!1;if(r.projectReferences){t.projectStatus.set(n,{type:e.UpToDateStatusType.ComputingUpstream});for(var w=0,I=r.projectReferences;w<I.length;w++){var O=I[w];P=P||!!O.prepend;var R=e.resolveProjectReferencePath(O),B=f(t,R),j=L(t,y(t,R,B),B);if(j.type!==e.UpToDateStatusType.ComputingUpstream&&j.type!==e.UpToDateStatusType.ContainerOnly){if(j.type===e.UpToDateStatusType.Unbuildable||j.type===e.UpToDateStatusType.UpstreamBlocked)return {type:e.UpToDateStatusType.UpstreamBlocked,upstreamProjectName:O.path,upstreamProjectBlocked:j.type===e.UpToDateStatusType.UpstreamBlocked};if(j.type!==e.UpToDateStatusType.UpToDate)return {type:e.UpToDateStatusType.UpstreamOutOfDate,upstreamProjectName:O.path};if(!i&&!m){if(j.newestInputFileTime&&j.newestInputFileTime<=b)continue;if(j.newestDeclarationFileContentChangedTime&&j.newestDeclarationFileContentChangedTime<=b){A=!0,F=O.path;continue}return e.Debug.assert(void 0!==h,"Should have an oldest output filename here"),{type:e.UpToDateStatusType.OutOfDateWithUpstream,outOfDateOutputFileName:h,newerProjectName:O.path}}}}}if(void 0!==m)return {type:e.UpToDateStatusType.OutputMissing,missingOutputFileName:m};if(T)return {type:e.UpToDateStatusType.OutOfDateWithSelf,outOfDateOutputFileName:h,newerInputFileName:s};var J=M(t,r.options.configFilePath,b,h);if(J)return J;var z=e.forEach(r.options.configFile.extendedSourceFiles||e.emptyArray,(function(e){return M(t,e,b,h)}));if(z)return z;var K=e.forEach(t.lastCachedPackageJsonLookups.get(n)||e.emptyArray,(function(e){var r=e[0];return M(t,r,b,h)}));if(K)return K;if(!i&&!t.buildInfoChecked.has(n)){t.buildInfoChecked.set(n,!0);var U=e.getTsBuildInfoEmitOutputFilePath(r.options);if(U){var V=t.readFileWithCache(U),q=V&&e.getBuildInfo(V);if(q&&(q.bundle||q.program)&&q.version!==e.version)return {type:e.UpToDateStatusType.TsVersionOutputOfDate,version:q.version}}}return P&&A?{type:e.UpToDateStatusType.OutOfDateWithPrepend,outOfDateOutputFileName:h,newerProjectName:F}:{type:A?e.UpToDateStatusType.UpToDateWithUpstreamTypes:e.UpToDateStatusType.UpToDate,newestDeclarationFileContentChangedTime:S,newestInputFileTime:l,newestOutputFileTime:D,newestInputFileName:s,newestOutputFileName:x,oldestOutputFileName:h}}(t,r,n);return t.projectStatus.set(n,s),s}function R(t,r,n,i,a){if(r.options.noEmit)return n;var o=t.host,s=e.getAllProjectOutputs(r,!o.useCaseSensitiveFileNames());if(!a||s.length!==a.size)for(var l=!!t.options.verbose,u=o.now?o.now():new Date,_=0,d=s;_<d.length;_++){var f=d[_];a&&a.has(p(t,f))||(l&&(l=!1,$(t,i,r.options.configFilePath)),e.isDeclarationFileName(f)&&(n=c(n,e.getModifiedTime(o,f))),o.setModifiedTime(f,u));}return n}function B(t,r,n){if(t.options.dry)return $(t,e.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0,r.options.configFilePath);var i=R(t,r,a,e.Diagnostics.Updating_output_timestamps_of_project_0);t.projectStatus.set(n,{type:e.UpToDateStatusType.UpToDate,newestDeclarationFileContentChangedTime:i,oldestOutputFileName:e.getFirstProjectOutput(r,!t.host.useCaseSensitiveFileNames())});}function j(r,n,i,a,o,s,c){if(!(c&t.AnyErrors)&&o.options.composite)for(var l=a+1;l<s.length;l++){var u=s[l],_=f(r,u);if(!r.projectPendingBuild.has(_)){var d=y(r,u,_);if(d&&d.projectReferences)for(var p=0,g=d.projectReferences;p<g.length;p++){var m=g[p];if(f(r,v(r,m.path))===i){var h=r.projectStatus.get(_);if(h)switch(h.type){case e.UpToDateStatusType.UpToDate:if(c&t.DeclarationOutputUnchanged){m.prepend?r.projectStatus.set(_,{type:e.UpToDateStatusType.OutOfDateWithPrepend,outOfDateOutputFileName:h.oldestOutputFileName,newerProjectName:n}):h.type=e.UpToDateStatusType.UpToDateWithUpstreamTypes;break}case e.UpToDateStatusType.UpToDateWithUpstreamTypes:case e.UpToDateStatusType.OutOfDateWithPrepend:c&t.DeclarationOutputUnchanged||r.projectStatus.set(_,{type:e.UpToDateStatusType.OutOfDateWithUpstream,outOfDateOutputFileName:h.type===e.UpToDateStatusType.OutOfDateWithPrepend?h.outOfDateOutputFileName:h.oldestOutputFileName,newerProjectName:n});break;case e.UpToDateStatusType.UpstreamBlocked:f(r,v(r,h.upstreamProjectName))===i&&T(r,_);}C(r,_,e.ConfigFileProgramReloadLevel.None);break}}}}}function J(t,r,n,i,a,o){var s=x(t,r,o);if(!s)return e.ExitStatus.InvalidProject_OutputsSkipped;k(t,n);for(var c=!0,_=0;;){var d=P(t,s,c);if(!d)break;c=!1,d.done(n,i,null==a?void 0:a(d.project)),t.diagnostics.has(d.projectPath)||_++;}return S(t),ie(t,s),function(e,t){if(e.watchAllProjectsPending){e.watchAllProjectsPending=!1;for(var r=0,n=u(t);r<n.length;r++){var i=n[r],a=f(e,i),o=y(e,i,a);W(e,i,a,o),H(e,a,o),o&&(G(e,i,a,o),Q(e,i,a,o),X(e,i,a,o));}}}(t,s),l(s)?e.ExitStatus.ProjectReferenceCycle_OutputsSkipped:s.some((function(e){return t.diagnostics.has(f(t,e))}))?_?e.ExitStatus.DiagnosticsPresent_OutputsGenerated:e.ExitStatus.DiagnosticsPresent_OutputsSkipped:e.ExitStatus.Success}function z(t,r,n){var i=x(t,r,n);if(!i)return e.ExitStatus.InvalidProject_OutputsSkipped;if(l(i))return te(t,i.circularDiagnostics),e.ExitStatus.ProjectReferenceCycle_OutputsSkipped;for(var a=t.options,o=t.host,s=a.dry?[]:void 0,c=0,u=i;c<u.length;c++){var _=u[c],d=f(t,_),g=y(t,_,d);if(void 0!==g){var m=e.getAllProjectOutputs(g,!o.useCaseSensitiveFileNames());if(m.length)for(var v=new e.Set(g.fileNames.map((function(e){return p(t,e)}))),h=0,b=m;h<b.length;h++){var D=b[h];v.has(p(t,D))||o.fileExists(D)&&(s?s.push(D):(o.deleteFile(D),K(t,d,e.ConfigFileProgramReloadLevel.None)));}}else ne(t,d);}return s&&$(t,e.Diagnostics.A_non_dry_build_would_delete_the_following_files_Colon_0,s.map((function(e){return "\r\n * ".concat(e)})).join("")),e.ExitStatus.Success}function K(t,r,n){t.host.getParsedCommandLine&&n===e.ConfigFileProgramReloadLevel.Partial&&(n=e.ConfigFileProgramReloadLevel.Full),n===e.ConfigFileProgramReloadLevel.Full&&(t.configFileCache.delete(r),t.buildOrder=void 0),t.needsSummary=!0,T(t,r),C(t,r,n),D(t);}function U(e,t,r){e.reportFileChangeDetected=!0,K(e,t,r),V(e);}function V(e){var t=e.hostWithWatch;t.setTimeout&&t.clearTimeout&&(e.timerToBuildInvalidatedProject&&t.clearTimeout(e.timerToBuildInvalidatedProject),e.timerToBuildInvalidatedProject=t.setTimeout(q,250,e));}function q(t){t.timerToBuildInvalidatedProject=void 0,t.reportFileChangeDetected&&(t.reportFileChangeDetected=!1,t.projectErrorsReported.clear(),ee(t,e.Diagnostics.File_change_detected_Starting_incremental_compilation));var r=b(t),n=P(t,r,!1);n&&(n.done(),t.projectPendingBuild.size)?t.watch&&!t.timerToBuildInvalidatedProject&&V(t):(S(t),ie(t,r));}function W(t,r,n,i){t.watch&&!t.allWatchedConfigFiles.has(n)&&t.allWatchedConfigFiles.set(n,t.watchFile(r,(function(){U(t,n,e.ConfigFileProgramReloadLevel.Full);}),e.PollingInterval.High,null==i?void 0:i.watchOptions,e.WatchType.ConfigFile,r));}function H(t,r,n){e.updateSharedExtendedConfigFileWatcher(r,null==n?void 0:n.options,t.allWatchedExtendedConfigFiles,(function(r,i){return t.watchFile(r,(function(){var r;return null===(r=t.allWatchedExtendedConfigFiles.get(i))||void 0===r?void 0:r.projects.forEach((function(r){return U(t,r,e.ConfigFileProgramReloadLevel.Full)}))}),e.PollingInterval.High,null==n?void 0:n.watchOptions,e.WatchType.ExtendedConfigFile)}),(function(e){return p(t,e)}));}function G(t,r,n,i){t.watch&&e.updateWatchingWildcardDirectories(s(t.allWatchedWildcardDirectories,n),new e.Map(e.getEntries(i.wildcardDirectories)),(function(a,o){return t.watchDirectory(a,(function(o){var s;e.isIgnoredFileFromWildCardWatching({watchedDirPath:p(t,a),fileOrDirectory:o,fileOrDirectoryPath:p(t,o),configFileName:r,currentDirectory:t.currentDirectory,options:i.options,program:t.builderPrograms.get(n)||(null===(s=m(t,n))||void 0===s?void 0:s.fileNames),useCaseSensitiveFileNames:t.parseConfigFileHost.useCaseSensitiveFileNames,writeLog:function(e){return t.writeLog(e)},toPath:function(e){return p(t,e)}})||U(t,n,e.ConfigFileProgramReloadLevel.Partial);}),o,null==i?void 0:i.watchOptions,e.WatchType.WildcardDirectory,r)}));}function Q(t,r,n,i){t.watch&&e.mutateMap(s(t.allWatchedInputFiles,n),e.arrayToMap(i.fileNames,(function(e){return p(t,e)})),{createNewValue:function(a,o){return t.watchFile(o,(function(){return U(t,n,e.ConfigFileProgramReloadLevel.None)}),e.PollingInterval.Low,null==i?void 0:i.watchOptions,e.WatchType.SourceFile,r)},onDeleteValue:e.closeFileWatcher});}function X(t,r,n,i){t.watch&&t.lastCachedPackageJsonLookups&&e.mutateMap(s(t.allWatchedPackageJsonFiles,n),new e.Map(t.lastCachedPackageJsonLookups.get(n)),{createNewValue:function(a,o){return t.watchFile(a,(function(){return U(t,n,e.ConfigFileProgramReloadLevel.None)}),e.PollingInterval.High,null==i?void 0:i.watchOptions,e.WatchType.PackageJson,r)},onDeleteValue:e.closeFileWatcher});}function Y(t,r,n,i,a){var o=function(t,r,n,i,a){var o,s,c=r,l=r,u=c.getCurrentDirectory(),_=e.createGetCanonicalFileName(c.useCaseSensitiveFileNames()),d=(o=i,s={},e.commonOptionsWithBuild.forEach((function(t){e.hasProperty(o,t.name)&&(s[t.name]=o[t.name]);})),s),p=e.createCompilerHostFromProgramHost(c,(function(){return T.projectCompilerOptions}));e.setGetSourceFileAsHashVersioned(p,c),p.getParsedCommandLine=function(e){return y(T,e,f(T,e))},p.resolveModuleNames=e.maybeBind(c,c.resolveModuleNames),p.resolveTypeReferenceDirectives=e.maybeBind(c,c.resolveTypeReferenceDirectives);var g=p.resolveModuleNames?void 0:e.createModuleResolutionCache(u,_),m=p.resolveTypeReferenceDirectives?void 0:e.createTypeReferenceDirectiveResolutionCache(u,_,void 0,null==g?void 0:g.getPackageJsonInfoCache());if(!p.resolveModuleNames){var v=function(t,r,n,i){return e.resolveModuleName(t,n,T.projectCompilerOptions,p,g,i,r).resolvedModule};p.resolveModuleNames=function(t,r,n,i,a,o){return e.loadWithModeAwareCache(e.Debug.checkEachDefined(t),e.Debug.checkDefined(o),r,i,v)},p.getModuleResolutionCache=function(){return g};}if(!p.resolveTypeReferenceDirectives){var h=function(t,r,n,i){return e.resolveTypeReferenceDirective(t,r,T.projectCompilerOptions,p,n,T.typeReferenceDirectiveResolutionCache,i).resolvedTypeReferenceDirective};p.resolveTypeReferenceDirectives=function(t,r,n,i,a){return e.loadWithTypeDirectiveCache(e.Debug.checkEachDefined(t),r,n,a,h)};}var b=e.createWatchFactory(l,i),x=b.watchFile,D=b.watchDirectory,S=b.writeLog,T={host:c,hostWithWatch:l,currentDirectory:u,getCanonicalFileName:_,parseConfigFileHost:e.parseConfigHostFromCompilerHostLike(c),write:e.maybeBind(c,c.trace),options:i,baseCompilerOptions:d,rootNames:n,baseWatchOptions:a,resolvedConfigFilePaths:new e.Map,configFileCache:new e.Map,projectStatus:new e.Map,buildInfoChecked:new e.Map,extendedConfigCache:new e.Map,builderPrograms:new e.Map,diagnostics:new e.Map,projectPendingBuild:new e.Map,projectErrorsReported:new e.Map,compilerHost:p,moduleResolutionCache:g,typeReferenceDirectiveResolutionCache:m,buildOrder:void 0,readFileWithCache:function(e){return c.readFile(e)},projectCompilerOptions:d,cache:void 0,allProjectBuildPending:!0,needsSummary:!0,watchAllProjectsPending:t,currentInvalidatedProject:void 0,watch:t,allWatchedWildcardDirectories:new e.Map,allWatchedInputFiles:new e.Map,allWatchedConfigFiles:new e.Map,allWatchedExtendedConfigFiles:new e.Map,allWatchedPackageJsonFiles:new e.Map,lastCachedPackageJsonLookups:new e.Map,timerToBuildInvalidatedProject:void 0,reportFileChangeDetected:!1,watchFile:x,watchDirectory:D,writeLog:S};return T}(t,r,n,i,a);return {build:function(e,t,r,n){return J(o,e,t,r,n)},clean:function(e){return z(o,e)},buildReferences:function(e,t,r,n){return J(o,e,t,r,n,!0)},cleanReferences:function(e){return z(o,e,!0)},getNextInvalidatedProject:function(e){return k(o,e),P(o,b(o),!1)},getBuildOrder:function(){return b(o)},getUpToDateStatusOfProject:function(e){var t=v(o,e),r=f(o,t);return L(o,y(o,t,r),r)},invalidateProject:function(t,r){return K(o,t,r||e.ConfigFileProgramReloadLevel.None)},buildNextInvalidatedProject:function(){return q(o)},getAllParsedConfigs:function(){return e.arrayFrom(e.mapDefinedIterator(o.configFileCache.values(),(function(e){return g(e)?e:void 0})))},close:function(){return function(t){e.clearMap(t.allWatchedConfigFiles,e.closeFileWatcher),e.clearMap(t.allWatchedExtendedConfigFiles,e.closeFileWatcherOf),e.clearMap(t.allWatchedWildcardDirectories,(function(t){return e.clearMap(t,e.closeFileWatcherOf)})),e.clearMap(t.allWatchedInputFiles,(function(t){return e.clearMap(t,e.closeFileWatcher)})),e.clearMap(t.allWatchedPackageJsonFiles,(function(t){return e.clearMap(t,e.closeFileWatcher)}));}(o)}}}function Z(t,r){return e.convertToRelativePath(r,t.currentDirectory,(function(e){return t.getCanonicalFileName(e)}))}function $(t,r){for(var i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];t.host.reportSolutionBuilderStatus(e.createCompilerDiagnostic.apply(void 0,n$4([r],i,!1)));}function ee(t,r){for(var i,a,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];null===(a=(i=t.hostWithWatch).onWatchStatusChange)||void 0===a||a.call(i,e.createCompilerDiagnostic.apply(void 0,n$4([r],o,!1)),t.host.getNewLine(),t.baseCompilerOptions);}function te(e,t){var r=e.host;t.forEach((function(e){return r.reportDiagnostic(e)}));}function re(e,t,r){te(e,r),e.projectErrorsReported.set(t,!0),r.length&&e.diagnostics.set(t,r);}function ne(e,t){re(e,t,[e.configFileCache.get(t)]);}function ie(t,r){if(t.needsSummary){t.needsSummary=!1;var i=t.watch||!!t.host.reportErrorSummary,a=t.diagnostics,o=0,s=[];l(r)?(ae(t,r.buildOrder),te(t,r.circularDiagnostics),i&&(o+=e.getErrorCountForSummary(r.circularDiagnostics)),i&&(s=n$4(n$4([],s,!0),e.getFilesInErrorForSummary(r.circularDiagnostics),!0))):(r.forEach((function(r){var n=f(t,r);t.projectErrorsReported.has(n)||te(t,a.get(n)||e.emptyArray);})),i&&a.forEach((function(t){return o+=e.getErrorCountForSummary(t)})),i&&a.forEach((function(t){return n$4(n$4([],s,!0),e.getFilesInErrorForSummary(t),!0)}))),t.watch?ee(t,e.getWatchErrorSummaryDiagnosticMessage(o),o):t.host.reportErrorSummary&&t.host.reportErrorSummary(o,s);}}function ae(t,r){t.options.verbose&&$(t,e.Diagnostics.Projects_in_this_build_Colon_0,r.map((function(e){return "\r\n * "+Z(t,e)})).join(""));}function oe(t,r,n){t.options.verbose&&function(t,r,n){if(t.options.force&&(n.type===e.UpToDateStatusType.UpToDate||n.type===e.UpToDateStatusType.UpToDateWithUpstreamTypes))return $(t,e.Diagnostics.Project_0_is_being_forcibly_rebuilt,Z(t,r));switch(n.type){case e.UpToDateStatusType.OutOfDateWithSelf:return $(t,e.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2,Z(t,r),Z(t,n.outOfDateOutputFileName),Z(t,n.newerInputFileName));case e.UpToDateStatusType.OutOfDateWithUpstream:return $(t,e.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2,Z(t,r),Z(t,n.outOfDateOutputFileName),Z(t,n.newerProjectName));case e.UpToDateStatusType.OutputMissing:return $(t,e.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist,Z(t,r),Z(t,n.missingOutputFileName));case e.UpToDateStatusType.UpToDate:if(void 0!==n.newestInputFileTime)return $(t,e.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2,Z(t,r),Z(t,n.newestInputFileName||""),Z(t,n.oldestOutputFileName||""));break;case e.UpToDateStatusType.OutOfDateWithPrepend:return $(t,e.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed,Z(t,r),Z(t,n.newerProjectName));case e.UpToDateStatusType.UpToDateWithUpstreamTypes:return $(t,e.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,Z(t,r));case e.UpToDateStatusType.UpstreamOutOfDate:return $(t,e.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,Z(t,r),Z(t,n.upstreamProjectName));case e.UpToDateStatusType.UpstreamBlocked:return $(t,n.upstreamProjectBlocked?e.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built:e.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,Z(t,r),Z(t,n.upstreamProjectName));case e.UpToDateStatusType.Unbuildable:return $(t,e.Diagnostics.Failed_to_parse_file_0_Colon_1,Z(t,r),n.reason);case e.UpToDateStatusType.TsVersionOutputOfDate:return $(t,e.Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,Z(t,r),n.version,e.version);case e.UpToDateStatusType.ContainerOnly:case e.UpToDateStatusType.ComputingUpstream:break;default:e.assertType(n);}}(t,r,n);}!function(e){e[e.None=0]="None",e[e.Success=1]="Success",e[e.DeclarationOutputUnchanged=2]="DeclarationOutputUnchanged",e[e.ConfigFileErrors=4]="ConfigFileErrors",e[e.SyntaxErrors=8]="SyntaxErrors",e[e.TypeErrors=16]="TypeErrors",e[e.DeclarationEmitErrors=32]="DeclarationEmitErrors",e[e.EmitErrors=64]="EmitErrors",e[e.AnyErrors=124]="AnyErrors";}(t||(t={})),e.isCircularBuildOrder=l,e.getBuildOrderFromAnyBuildOrder=u,e.createBuilderStatusReporter=_,e.createSolutionBuilderHost=function(t,r,n,i,a){void 0===t&&(t=e.sys);var o=d(t,r,n,i);return o.reportErrorSummary=a,o},e.createSolutionBuilderWithWatchHost=function(t,r,n,i,a){void 0===t&&(t=e.sys);var o=d(t,r,n,i),s=e.createWatchHost(t,a);return e.copyProperties(o,s),o},e.createSolutionBuilder=function(e,t,r){return Y(!1,e,t,r)},e.createSolutionBuilderWithWatch=function(e,t,r,n){return Y(!0,e,t,r,n)},function(e){e[e.Build=0]="Build",e[e.UpdateBundle=1]="UpdateBundle",e[e.UpdateOutputFileStamps=2]="UpdateOutputFileStamps";}(r=e.InvalidatedProjectKind||(e.InvalidatedProjectKind={})),function(e){e[e.CreateProgram=0]="CreateProgram",e[e.SyntaxDiagnostics=1]="SyntaxDiagnostics",e[e.SemanticDiagnostics=2]="SemanticDiagnostics",e[e.Emit=3]="Emit",e[e.EmitBundle=4]="EmitBundle",e[e.EmitBuildInfo=5]="EmitBuildInfo",e[e.BuildInvalidatedProjectOfBundle=6]="BuildInvalidatedProjectOfBundle",e[e.QueueReferencingProjects=7]="QueueReferencingProjects",e[e.Done=8]="Done";}(i||(i={}));}(t),function(e){var t,r;(t=e.server||(e.server={})).ActionSet="action::set",t.ActionInvalidate="action::invalidate",t.ActionPackageInstalled="action::packageInstalled",t.EventTypesRegistry="event::typesRegistry",t.EventBeginInstallTypes="event::beginInstallTypes",t.EventEndInstallTypes="event::endInstallTypes",t.EventInitializationFailed="event::initializationFailed",(r=t.Arguments||(t.Arguments={})).GlobalCacheLocation="--globalTypingsCacheLocation",r.LogFile="--logFile",r.EnableTelemetry="--enableTelemetry",r.TypingSafeListLocation="--typingSafeListLocation",r.TypesMapLocation="--typesMapLocation",r.NpmLocation="--npmLocation",r.ValidateDefaultNpmLocation="--validateDefaultNpmLocation",t.hasArgument=function(t){return e.sys.args.indexOf(t)>=0},t.findArgument=function(t){var r=e.sys.args.indexOf(t);return r>=0&&r<e.sys.args.length-1?e.sys.args[r+1]:void 0},t.nowString=function(){var t=new Date;return "".concat(e.padLeft(t.getHours().toString(),2,"0"),":").concat(e.padLeft(t.getMinutes().toString(),2,"0"),":").concat(e.padLeft(t.getSeconds().toString(),2,"0"),".").concat(e.padLeft(t.getMilliseconds().toString(),3,"0"))};}(t),function(e){!function(t){function r(t,r){return new e.Version(e.getProperty(r,"ts".concat(e.versionMajorMinor))||e.getProperty(r,"latest")).compareTo(t.version)<=0}t.isTypingUpToDate=r;var i,a=["assert","assert/strict","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","dns/promises","domain","events","fs","fs/promises","http","https","http2","inspector","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","stream/promises","string_decoder","timers","timers/promises","tls","trace_events","tty","url","util","util/types","v8","vm","wasi","worker_threads","zlib"];function o(e){return t.nodeCoreModules.has(e)?"node":e}function s(e,t){if(!e)return 1;if(e.length>214)return 2;if(46===e.charCodeAt(0))return 3;if(95===e.charCodeAt(0))return 4;if(t){var r=/^@([^/]+)\/([^/]+)$/.exec(e);if(r){var n=s(r[1],!1);if(0!==n)return {name:r[1],isScopeName:!0,result:n};var i=s(r[2],!1);return 0!==i?{name:r[2],isScopeName:!1,result:i}:0}}return encodeURIComponent(e)!==e?5:0}function c(t,r,n,i){var a=i?"Scope":"Package";switch(r){case 1:return "'".concat(t,"':: ").concat(a," name '").concat(n,"' cannot be empty");case 2:return "'".concat(t,"':: ").concat(a," name '").concat(n,"' should be less than ").concat(214," characters");case 3:return "'".concat(t,"':: ").concat(a," name '").concat(n,"' cannot start with '.'");case 4:return "'".concat(t,"':: ").concat(a," name '").concat(n,"' cannot start with '_'");case 5:return "'".concat(t,"':: ").concat(a," name '").concat(n,"' contains non URI safe characters");case 0:return e.Debug.fail();default:throw e.Debug.assertNever(r)}}t.prefixedNodeCoreModuleList=a.map((function(e){return "node:".concat(e)})),t.nodeCoreModuleList=n$4(n$4([],a,!0),t.prefixedNodeCoreModuleList,!0),t.nodeCoreModules=new e.Set(t.nodeCoreModuleList),t.nonRelativeModuleNameForTypingCache=o,t.loadSafeList=function(t,r){var n=e.readConfigFile(r,(function(e){return t.readFile(e)}));return new e.Map(e.getEntries(n.config))},t.loadTypesMap=function(t,r){var n=e.readConfigFile(r,(function(e){return t.readFile(e)}));if(n.config)return new e.Map(e.getEntries(n.config.simpleMap))},t.discoverTypings=function(t,n,i,a,s,c,l,u,_){if(!l||!l.enable)return {cachedTypingPaths:[],newTypingNames:[],filesToWatch:[]};var d=new e.Map;i=e.mapDefined(i,(function(t){var r=e.normalizePath(t);if(e.hasJSFileExtension(r))return r}));var p=[];l.include&&S(l.include,"Explicitly included types");var f=l.exclude||[],g=new e.Set(i.map(e.getDirectoryPath));g.add(a),g.forEach((function(e){T(e,"bower.json","bower_components",p),T(e,"package.json","node_modules",p);})),l.disableFilenameBasedTypeAcquisition||function(t){var r=e.mapDefined(t,(function(t){if(e.hasJSFileExtension(t)){var r=e.removeFileExtension(e.getBaseFileName(t.toLowerCase())),n=e.removeMinAndVersionNumbers(r);return s.get(n)}}));r.length&&S(r,"Inferred typings from file names"),e.some(t,(function(t){return e.fileExtensionIs(t,".jsx")}))&&(n&&n("Inferred 'react' typings due to presence of '.jsx' extension"),D("react"));}(i),u&&S(e.deduplicate(u.map(o),e.equateStringsCaseSensitive,e.compareStringsCaseSensitive),"Inferred typings from unresolved imports"),c.forEach((function(e,t){var n=_.get(t);d.has(t)&&void 0===d.get(t)&&void 0!==n&&r(e,n)&&d.set(t,e.typingLocation);}));for(var m=0,y=f;m<y.length;m++){var v=y[m];d.delete(v)&&n&&n("Typing for ".concat(v," is in exclude list, will be ignored."));}var h=[],b=[];d.forEach((function(e,t){void 0!==e?b.push(e):h.push(t);}));var x={cachedTypingPaths:b,newTypingNames:h,filesToWatch:p};return n&&n("Result: ".concat(JSON.stringify(x))),x;function D(e){d.has(e)||d.set(e,void 0);}function S(t,r){n&&n("".concat(r,": ").concat(JSON.stringify(t))),e.forEach(t,D);}function T(r,i,a,o){var s,c,l=e.combinePaths(r,i);t.fileExists(l)&&(o.push(l),s=e.readConfigFile(l,(function(e){return t.readFile(e)})).config,S(c=e.flatMap([s.dependencies,s.devDependencies,s.optionalDependencies,s.peerDependencies],e.getOwnKeys),"Typing names in '".concat(l,"' dependencies")));var u=e.combinePaths(r,a);if(o.push(u),t.directoryExists(u)){var _=[],p=c?c.map((function(t){return e.combinePaths(u,t,i)})):t.readDirectory(u,[".json"],void 0,void 0,3).filter((function(t){if(e.getBaseFileName(t)!==i)return !1;var r=e.getPathComponents(e.normalizePath(t)),n="@"===r[r.length-3][0];return n&&r[r.length-4].toLowerCase()===a||!n&&r[r.length-3].toLowerCase()===a}));n&&n("Searching for typing names in ".concat(u,"; all files: ").concat(JSON.stringify(p)));for(var f=0,g=p;f<g.length;f++){var m=g[f],y=e.normalizePath(m),v=e.readConfigFile(y,(function(e){return t.readFile(e)})).config;if(v.name){var h=v.types||v.typings;if(h){var b=e.getNormalizedAbsolutePath(h,e.getDirectoryPath(y));t.fileExists(b)?(n&&n(" Package '".concat(v.name,"' provides its own types.")),d.set(v.name,b)):n&&n(" Package '".concat(v.name,"' provides its own types but they are missing."));}else _.push(v.name);}}S(_," Found package names");}}},(i=t.NameValidationResult||(t.NameValidationResult={}))[i.Ok=0]="Ok",i[i.EmptyName=1]="EmptyName",i[i.NameTooLong=2]="NameTooLong",i[i.NameStartsWithDot=3]="NameStartsWithDot",i[i.NameStartsWithUnderscore=4]="NameStartsWithUnderscore",i[i.NameContainsNonURISafeCharacters=5]="NameContainsNonURISafeCharacters",t.validatePackageName=function(e){return s(e,!0)},t.renderPackageNameValidationFailure=function(e,t){return "object"==typeof e?c(t,e.result,e.name,e.isScopeName):c(t,e,t,!1)};}(e.JsTyping||(e.JsTyping={}));}(t),function(e){var t,r,n,i,a,o,s,c,l,u,_,d,p,f,g,m,y,v,h,b,x;function D(e){return {indentSize:4,tabSize:4,newLineCharacter:e||"\n",convertTabsToSpaces:!0,indentStyle:t.Smart,insertSpaceAfterConstructor:!1,insertSpaceAfterCommaDelimiter:!0,insertSpaceAfterSemicolonInForStatements:!0,insertSpaceBeforeAndAfterBinaryOperators:!0,insertSpaceAfterKeywordsInControlFlowStatements:!0,insertSpaceAfterFunctionKeywordForAnonymousFunctions:!1,insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:!1,insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:!1,insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces:!0,insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:!1,insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces:!1,insertSpaceBeforeFunctionParenthesis:!1,placeOpenBraceOnNewLineForFunctions:!1,placeOpenBraceOnNewLineForControlBlocks:!1,semicolons:r.Ignore,trimTrailingWhitespace:!0}}b=e.ScriptSnapshot||(e.ScriptSnapshot={}),x=function(){function e(e){this.text=e;}return e.prototype.getText=function(e,t){return 0===e&&t===this.text.length?this.text:this.text.substring(e,t)},e.prototype.getLength=function(){return this.text.length},e.prototype.getChangeRange=function(){},e}(),b.fromString=function(e){return new x(e)},(h=e.PackageJsonDependencyGroup||(e.PackageJsonDependencyGroup={}))[h.Dependencies=1]="Dependencies",h[h.DevDependencies=2]="DevDependencies",h[h.PeerDependencies=4]="PeerDependencies",h[h.OptionalDependencies=8]="OptionalDependencies",h[h.All=15]="All",(v=e.PackageJsonAutoImportPreference||(e.PackageJsonAutoImportPreference={}))[v.Off=0]="Off",v[v.On=1]="On",v[v.Auto=2]="Auto",(y=e.LanguageServiceMode||(e.LanguageServiceMode={}))[y.Semantic=0]="Semantic",y[y.PartialSemantic=1]="PartialSemantic",y[y.Syntactic=2]="Syntactic",e.emptyOptions={},(m=e.SemanticClassificationFormat||(e.SemanticClassificationFormat={})).Original="original",m.TwentyTwenty="2020",(g=e.CompletionTriggerKind||(e.CompletionTriggerKind={}))[g.Invoked=1]="Invoked",g[g.TriggerCharacter=2]="TriggerCharacter",g[g.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions",(f=e.InlayHintKind||(e.InlayHintKind={})).Type="Type",f.Parameter="Parameter",f.Enum="Enum",(p=e.HighlightSpanKind||(e.HighlightSpanKind={})).none="none",p.definition="definition",p.reference="reference",p.writtenReference="writtenReference",function(e){e[e.None=0]="None",e[e.Block=1]="Block",e[e.Smart=2]="Smart";}(t=e.IndentStyle||(e.IndentStyle={})),function(e){e.Ignore="ignore",e.Insert="insert",e.Remove="remove";}(r=e.SemicolonPreference||(e.SemicolonPreference={})),e.getDefaultFormatCodeSettings=D,e.testFormatSettings=D("\n"),(d=e.SymbolDisplayPartKind||(e.SymbolDisplayPartKind={}))[d.aliasName=0]="aliasName",d[d.className=1]="className",d[d.enumName=2]="enumName",d[d.fieldName=3]="fieldName",d[d.interfaceName=4]="interfaceName",d[d.keyword=5]="keyword",d[d.lineBreak=6]="lineBreak",d[d.numericLiteral=7]="numericLiteral",d[d.stringLiteral=8]="stringLiteral",d[d.localName=9]="localName",d[d.methodName=10]="methodName",d[d.moduleName=11]="moduleName",d[d.operator=12]="operator",d[d.parameterName=13]="parameterName",d[d.propertyName=14]="propertyName",d[d.punctuation=15]="punctuation",d[d.space=16]="space",d[d.text=17]="text",d[d.typeParameterName=18]="typeParameterName",d[d.enumMemberName=19]="enumMemberName",d[d.functionName=20]="functionName",d[d.regularExpressionLiteral=21]="regularExpressionLiteral",d[d.link=22]="link",d[d.linkName=23]="linkName",d[d.linkText=24]="linkText",(_=e.CompletionInfoFlags||(e.CompletionInfoFlags={}))[_.None=0]="None",_[_.MayIncludeAutoImports=1]="MayIncludeAutoImports",_[_.IsImportStatementCompletion=2]="IsImportStatementCompletion",_[_.IsContinuation=4]="IsContinuation",_[_.ResolvedModuleSpecifiers=8]="ResolvedModuleSpecifiers",_[_.ResolvedModuleSpecifiersBeyondLimit=16]="ResolvedModuleSpecifiersBeyondLimit",_[_.MayIncludeMethodSnippets=32]="MayIncludeMethodSnippets",(u=e.OutliningSpanKind||(e.OutliningSpanKind={})).Comment="comment",u.Region="region",u.Code="code",u.Imports="imports",(l=e.OutputFileType||(e.OutputFileType={}))[l.JavaScript=0]="JavaScript",l[l.SourceMap=1]="SourceMap",l[l.Declaration=2]="Declaration",(c=e.EndOfLineState||(e.EndOfLineState={}))[c.None=0]="None",c[c.InMultiLineCommentTrivia=1]="InMultiLineCommentTrivia",c[c.InSingleQuoteStringLiteral=2]="InSingleQuoteStringLiteral",c[c.InDoubleQuoteStringLiteral=3]="InDoubleQuoteStringLiteral",c[c.InTemplateHeadOrNoSubstitutionTemplate=4]="InTemplateHeadOrNoSubstitutionTemplate",c[c.InTemplateMiddleOrTail=5]="InTemplateMiddleOrTail",c[c.InTemplateSubstitutionPosition=6]="InTemplateSubstitutionPosition",(s=e.TokenClass||(e.TokenClass={}))[s.Punctuation=0]="Punctuation",s[s.Keyword=1]="Keyword",s[s.Operator=2]="Operator",s[s.Comment=3]="Comment",s[s.Whitespace=4]="Whitespace",s[s.Identifier=5]="Identifier",s[s.NumberLiteral=6]="NumberLiteral",s[s.BigIntLiteral=7]="BigIntLiteral",s[s.StringLiteral=8]="StringLiteral",s[s.RegExpLiteral=9]="RegExpLiteral",(o=e.ScriptElementKind||(e.ScriptElementKind={})).unknown="",o.warning="warning",o.keyword="keyword",o.scriptElement="script",o.moduleElement="module",o.classElement="class",o.localClassElement="local class",o.interfaceElement="interface",o.typeElement="type",o.enumElement="enum",o.enumMemberElement="enum member",o.variableElement="var",o.localVariableElement="local var",o.functionElement="function",o.localFunctionElement="local function",o.memberFunctionElement="method",o.memberGetAccessorElement="getter",o.memberSetAccessorElement="setter",o.memberVariableElement="property",o.constructorImplementationElement="constructor",o.callSignatureElement="call",o.indexSignatureElement="index",o.constructSignatureElement="construct",o.parameterElement="parameter",o.typeParameterElement="type parameter",o.primitiveType="primitive type",o.label="label",o.alias="alias",o.constElement="const",o.letElement="let",o.directory="directory",o.externalModuleName="external module name",o.jsxAttribute="JSX attribute",o.string="string",o.link="link",o.linkName="link name",o.linkText="link text",(a=e.ScriptElementKindModifier||(e.ScriptElementKindModifier={})).none="",a.publicMemberModifier="public",a.privateMemberModifier="private",a.protectedMemberModifier="protected",a.exportedModifier="export",a.ambientModifier="declare",a.staticModifier="static",a.abstractModifier="abstract",a.optionalModifier="optional",a.deprecatedModifier="deprecated",a.dtsModifier=".d.ts",a.tsModifier=".ts",a.tsxModifier=".tsx",a.jsModifier=".js",a.jsxModifier=".jsx",a.jsonModifier=".json",a.dmtsModifier=".d.mts",a.mtsModifier=".mts",a.mjsModifier=".mjs",a.dctsModifier=".d.cts",a.ctsModifier=".cts",a.cjsModifier=".cjs",(i=e.ClassificationTypeNames||(e.ClassificationTypeNames={})).comment="comment",i.identifier="identifier",i.keyword="keyword",i.numericLiteral="number",i.bigintLiteral="bigint",i.operator="operator",i.stringLiteral="string",i.whiteSpace="whitespace",i.text="text",i.punctuation="punctuation",i.className="class name",i.enumName="enum name",i.interfaceName="interface name",i.moduleName="module name",i.typeParameterName="type parameter name",i.typeAliasName="type alias name",i.parameterName="parameter name",i.docCommentTagName="doc comment tag name",i.jsxOpenTagName="jsx open tag name",i.jsxCloseTagName="jsx close tag name",i.jsxSelfClosingTagName="jsx self closing tag name",i.jsxAttribute="jsx attribute",i.jsxText="jsx text",i.jsxAttributeStringLiteralValue="jsx attribute string literal value",(n=e.ClassificationType||(e.ClassificationType={}))[n.comment=1]="comment",n[n.identifier=2]="identifier",n[n.keyword=3]="keyword",n[n.numericLiteral=4]="numericLiteral",n[n.operator=5]="operator",n[n.stringLiteral=6]="stringLiteral",n[n.regularExpressionLiteral=7]="regularExpressionLiteral",n[n.whiteSpace=8]="whiteSpace",n[n.text=9]="text",n[n.punctuation=10]="punctuation",n[n.className=11]="className",n[n.enumName=12]="enumName",n[n.interfaceName=13]="interfaceName",n[n.moduleName=14]="moduleName",n[n.typeParameterName=15]="typeParameterName",n[n.typeAliasName=16]="typeAliasName",n[n.parameterName=17]="parameterName",n[n.docCommentTagName=18]="docCommentTagName",n[n.jsxOpenTagName=19]="jsxOpenTagName",n[n.jsxCloseTagName=20]="jsxCloseTagName",n[n.jsxSelfClosingTagName=21]="jsxSelfClosingTagName",n[n.jsxAttribute=22]="jsxAttribute",n[n.jsxText=23]="jsxText",n[n.jsxAttributeStringLiteralValue=24]="jsxAttributeStringLiteralValue",n[n.bigintLiteral=25]="bigintLiteral";}(t),function(e){function t(t){switch(t.kind){case 254:return e.isInJSFile(t)&&e.getJSDocEnumTag(t)?7:1;case 164:case 203:case 167:case 166:case 296:case 297:case 169:case 168:case 171:case 172:case 173:case 256:case 213:case 214:case 292:case 285:return 1;case 163:case 258:case 259:case 182:return 2;case 345:return void 0===t.name?3:2;case 299:case 257:return 3;case 261:return e.isAmbientModule(t)||1===e.getModuleInstanceState(t)?5:4;case 260:case 269:case 270:case 265:case 266:case 271:case 272:return 7;case 305:return 5}return 7}function r(t){for(;161===t.parent.kind;)t=t.parent;return e.isInternalModuleImportEqualsDeclaration(t.parent)&&t.parent.moduleReference===t}function n(e){return e.expression}function a(e){return e.tag}function o(e){return e.tagName}function s(t,r,n,i,a){var o=i?l(t):c(t);return a&&(o=e.skipOuterExpressions(o)),!!o&&!!o.parent&&r(o.parent)&&n(o.parent)===o}function c(e){return d(e)?e.parent:e}function l(e){return d(e)||p(e)?e.parent:e}function u(t){var r;return e.isIdentifier(t)&&(null===(r=e.tryCast(t.parent,e.isBreakOrContinueStatement))||void 0===r?void 0:r.label)===t}function _(t){var r;return e.isIdentifier(t)&&(null===(r=e.tryCast(t.parent,e.isLabeledStatement))||void 0===r?void 0:r.label)===t}function d(t){var r;return (null===(r=e.tryCast(t.parent,e.isPropertyAccessExpression))||void 0===r?void 0:r.name)===t}function p(t){var r;return (null===(r=e.tryCast(t.parent,e.isElementAccessExpression))||void 0===r?void 0:r.argumentExpression)===t}var f;e.scanner=e.createScanner(99,!0),(f=e.SemanticMeaning||(e.SemanticMeaning={}))[f.None=0]="None",f[f.Value=1]="Value",f[f.Type=2]="Type",f[f.Namespace=4]="Namespace",f[f.All=7]="All",e.getMeaningFromDeclaration=t,e.getMeaningFromLocation=function(n){var i=(n=w(n)).parent;return 305===n.kind?1:e.isExportAssignment(i)||e.isExportSpecifier(i)||e.isExternalModuleReference(i)||e.isImportSpecifier(i)||e.isImportClause(i)||e.isImportEqualsDeclaration(i)&&n===i.name?7:r(n)?function(t){var r=161===t.kind?t:e.isQualifiedName(t.parent)&&t.parent.right===t?t.parent:void 0;return r&&265===r.parent.kind?7:4}(n):e.isDeclarationName(n)?t(i):e.isEntityName(n)&&e.findAncestor(n,e.or(e.isJSDocNameReference,e.isJSDocLinkLike,e.isJSDocMemberName))?7:function(t){switch(e.isRightSideOfQualifiedNameOrPropertyAccess(t)&&(t=t.parent),t.kind){case 108:return !e.isExpressionNode(t);case 192:return !0}switch(t.parent.kind){case 178:return !0;case 200:return !t.parent.isTypeOf;case 228:return e.isPartOfTypeNode(t.parent)}return !1}(n)?2:function(e){return function(e){var t=e,r=!0;if(161===t.parent.kind){for(;t.parent&&161===t.parent.kind;)t=t.parent;r=t.right===e;}return 178===t.parent.kind&&!r}(e)||function(e){var t=e,r=!0;if(206===t.parent.kind){for(;t.parent&&206===t.parent.kind;)t=t.parent;r=t.name===e;}if(!r&&228===t.parent.kind&&291===t.parent.parent.kind){var n=t.parent.parent.parent;return 257===n.kind&&117===t.parent.parent.token||258===n.kind&&94===t.parent.parent.token}return !1}(e)}(n)?4:e.isTypeParameterDeclaration(i)?(e.Debug.assert(e.isJSDocTemplateTag(i.parent)),2):e.isLiteralTypeNode(i)?3:1},e.isInRightSideOfInternalImportEqualsDeclaration=r,e.isCallExpressionTarget=function(t,r,i){return void 0===r&&(r=!1),void 0===i&&(i=!1),s(t,e.isCallExpression,n,r,i)},e.isNewExpressionTarget=function(t,r,i){return void 0===r&&(r=!1),void 0===i&&(i=!1),s(t,e.isNewExpression,n,r,i)},e.isCallOrNewExpressionTarget=function(t,r,i){return void 0===r&&(r=!1),void 0===i&&(i=!1),s(t,e.isCallOrNewExpression,n,r,i)},e.isTaggedTemplateTag=function(t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=!1),s(t,e.isTaggedTemplateExpression,a,r,n)},e.isDecoratorTarget=function(t,r,i){return void 0===r&&(r=!1),void 0===i&&(i=!1),s(t,e.isDecorator,n,r,i)},e.isJsxOpeningLikeElementTagName=function(t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=!1),s(t,e.isJsxOpeningLikeElement,o,r,n)},e.climbPastPropertyAccess=c,e.climbPastPropertyOrElementAccess=l,e.getTargetLabel=function(e,t){for(;e;){if(250===e.kind&&e.label.escapedText===t)return e.label;e=e.parent;}},e.hasPropertyAccessExpressionWithName=function(t,r){return !!e.isPropertyAccessExpression(t.expression)&&t.expression.name.text===r},e.isJumpStatementTarget=u,e.isLabelOfLabeledStatement=_,e.isLabelName=function(e){return _(e)||u(e)},e.isTagName=function(t){var r;return (null===(r=e.tryCast(t.parent,e.isJSDocTag))||void 0===r?void 0:r.tagName)===t},e.isRightSideOfQualifiedName=function(t){var r;return (null===(r=e.tryCast(t.parent,e.isQualifiedName))||void 0===r?void 0:r.right)===t},e.isRightSideOfPropertyAccess=d,e.isArgumentExpressionOfElementAccess=p,e.isNameOfModuleDeclaration=function(t){var r;return (null===(r=e.tryCast(t.parent,e.isModuleDeclaration))||void 0===r?void 0:r.name)===t},e.isNameOfFunctionDeclaration=function(t){var r;return e.isIdentifier(t)&&(null===(r=e.tryCast(t.parent,e.isFunctionLike))||void 0===r?void 0:r.name)===t},e.isLiteralNameOfPropertyDeclarationOrIndexAccess=function(t){switch(t.parent.kind){case 167:case 166:case 296:case 299:case 169:case 168:case 172:case 173:case 261:return e.getNameOfDeclaration(t.parent)===t;case 207:return t.parent.argumentExpression===t;case 162:return !0;case 196:return 194===t.parent.parent.kind;default:return !1}},e.isExpressionOfExternalModuleImportEqualsDeclaration=function(t){return e.isExternalModuleImportEqualsDeclaration(t.parent.parent)&&e.getExternalModuleImportEqualsDeclarationExpression(t.parent.parent)===t},e.getContainerNode=function(t){for(e.isJSDocTypeAlias(t)&&(t=t.parent.parent);;){if(!(t=t.parent))return;switch(t.kind){case 305:case 169:case 168:case 256:case 213:case 172:case 173:case 257:case 258:case 260:case 261:return t}}},e.getNodeKind=function t(r){switch(r.kind){case 305:return e.isExternalModule(r)?"module":"script";case 261:return "module";case 257:case 226:return "class";case 258:return "interface";case 259:case 338:case 345:return "type";case 260:return "enum";case 254:return c(r);case 203:return c(e.getRootDeclaration(r));case 214:case 256:case 213:return "function";case 172:return "getter";case 173:return "setter";case 169:case 168:return "method";case 296:var n=r.initializer;return e.isFunctionLike(n)?"method":"property";case 167:case 166:case 297:case 298:return "property";case 176:return "index";case 175:return "construct";case 174:return "call";case 171:case 170:return "constructor";case 163:return "type parameter";case 299:return "enum member";case 164:return e.hasSyntacticModifier(r,16476)?"property":"parameter";case 265:case 270:case 275:case 268:case 274:return "alias";case 221:var i=e.getAssignmentDeclarationKind(r),a=r.right;switch(i){case 7:case 8:case 9:case 0:return "";case 1:case 2:var o=t(a);return ""===o?"const":o;case 3:return e.isFunctionExpression(a)?"method":"property";case 4:return "property";case 5:return e.isFunctionExpression(a)?"method":"property";case 6:return "local class";default:return e.assertType(i),""}case 79:return e.isImportClause(r.parent)?"alias":"";case 271:var s=t(r.expression);return ""===s?"const":s;default:return ""}function c(t){return e.isVarConst(t)?"const":e.isLet(t)?"let":"var"}},e.isThis=function(t){switch(t.kind){case 108:return !0;case 79:return e.identifierIsThisKeyword(t)&&164===t.parent.kind;default:return !1}};var g,m=/^\/\/\/\s*</;function y(e,t){return h(e.pos,e.end,t)}function v(e,t){return e.pos<t&&t<e.end}function h(e,t,r){return e<=r.pos&&t>=r.end}function b(e,t,r,n){return Math.max(e,r)<Math.min(t,n)}function x(t,r){if(void 0===t||e.nodeIsMissing(t))return !1;switch(t.kind){case 257:case 258:case 260:case 205:case 201:case 182:case 235:case 262:case 263:case 269:case 273:return D(t,19,r);case 292:return x(t.block,r);case 209:if(!t.arguments)return !0;case 208:case 212:case 191:return D(t,21,r);case 179:case 180:return x(t.type,r);case 171:case 172:case 173:case 256:case 213:case 169:case 168:case 175:case 174:case 214:return t.body?x(t.body,r):t.type?x(t.type,r):S(t,21,r);case 261:return !!t.body&&x(t.body,r);case 239:return t.elseStatement?x(t.elseStatement,r):x(t.thenStatement,r);case 238:return x(t.expression,r)||S(t,26,r);case 204:case 202:case 207:case 162:case 184:return D(t,23,r);case 176:return t.type?x(t.type,r):S(t,23,r);case 289:case 290:return !1;case 242:case 243:case 244:case 241:return x(t.statement,r);case 240:return S(t,115,r)?D(t,21,r):x(t.statement,r);case 181:return x(t.exprName,r);case 216:case 215:case 217:case 224:case 225:return x(t.expression,r);case 210:return x(t.template,r);case 223:return x(e.lastOrUndefined(t.templateSpans),r);case 233:return e.nodeIsPresent(t.literal);case 272:case 266:return e.nodeIsPresent(t.moduleSpecifier);case 219:return x(t.operand,r);case 221:return x(t.right,r);case 222:return x(t.whenFalse,r);default:return !0}}function D(t,r,n){var i=t.getChildren(n);if(i.length){var a=e.last(i);if(a.kind===r)return !0;if(26===a.kind&&1!==i.length)return i[i.length-2].kind===r}return !1}function S(e,t,r){return !!T(e,t,r)}function T(t,r,n){return e.find(t.getChildren(n),(function(e){return e.kind===r}))}function C(t){var r=e.find(t.parent.getChildren(),(function(r){return e.isSyntaxList(r)&&y(r,t)}));return e.Debug.assert(!r||e.contains(r.getChildren(),t)),r}function k(e){return 88===e.kind}function E(e){return 84===e.kind}function N(e){return 98===e.kind}function F(t,r){if(t.importClause){if(t.importClause.name&&t.importClause.namedBindings)return;if(t.importClause.name)return t.importClause.name;if(t.importClause.namedBindings){if(e.isNamedImports(t.importClause.namedBindings)){var n=e.singleOrUndefined(t.importClause.namedBindings.elements);if(!n)return;return n.name}if(e.isNamespaceImport(t.importClause.namedBindings))return t.importClause.namedBindings.name}}if(!r)return t.moduleSpecifier}function A(t,r){if(t.exportClause){if(e.isNamedExports(t.exportClause)){if(!e.singleOrUndefined(t.exportClause.elements))return;return t.exportClause.elements[0].name}if(e.isNamespaceExport(t.exportClause))return t.exportClause.name}if(!r)return t.moduleSpecifier}function P(t,r){var n=t.parent;if((e.isModifier(t)&&(r||88!==t.kind)?e.contains(n.modifiers,t):84===t.kind?e.isClassDeclaration(n)||e.isClassExpression(t):98===t.kind?e.isFunctionDeclaration(n)||e.isFunctionExpression(t):118===t.kind?e.isInterfaceDeclaration(n):92===t.kind?e.isEnumDeclaration(n):152===t.kind?e.isTypeAliasDeclaration(n):142===t.kind||141===t.kind?e.isModuleDeclaration(n):100===t.kind?e.isImportEqualsDeclaration(n):136===t.kind?e.isGetAccessorDeclaration(n):149===t.kind&&e.isSetAccessorDeclaration(n))&&(a=function(t,r){if(!r)switch(t.kind){case 257:case 226:return function(t){if(e.isNamedDeclaration(t))return t.name;if(e.isClassDeclaration(t)){var r=t.modifiers&&e.find(t.modifiers,k);if(r)return r}if(e.isClassExpression(t)){var n=e.find(t.getChildren(),E);if(n)return n}}(t);case 256:case 213:return function(t){if(e.isNamedDeclaration(t))return t.name;if(e.isFunctionDeclaration(t)){var r=e.find(t.modifiers,k);if(r)return r}if(e.isFunctionExpression(t)){var n=e.find(t.getChildren(),N);if(n)return n}}(t)}if(e.isNamedDeclaration(t))return t.name}(n,r)))return a;if((113===t.kind||85===t.kind||119===t.kind)&&e.isVariableDeclarationList(n)&&1===n.declarations.length){var i=n.declarations[0];if(e.isIdentifier(i.name))return i.name}if(152===t.kind){if(e.isImportClause(n)&&n.isTypeOnly&&(a=F(n.parent,r)))return a;if(e.isExportDeclaration(n)&&n.isTypeOnly&&(a=A(n,r)))return a}if(127===t.kind){if(e.isImportSpecifier(n)&&n.propertyName||e.isExportSpecifier(n)&&n.propertyName||e.isNamespaceImport(n)||e.isNamespaceExport(n))return n.name;if(e.isExportDeclaration(n)&&n.exportClause&&e.isNamespaceExport(n.exportClause))return n.exportClause.name}if(100===t.kind&&e.isImportDeclaration(n)&&(a=F(n,r)))return a;if(93===t.kind){var a;if(e.isExportDeclaration(n)&&(a=A(n,r)))return a;if(e.isExportAssignment(n))return e.skipOuterExpressions(n.expression)}if(146===t.kind&&e.isExternalModuleReference(n))return n.expression;if(156===t.kind&&(e.isImportDeclaration(n)||e.isExportDeclaration(n))&&n.moduleSpecifier)return n.moduleSpecifier;if((94===t.kind||117===t.kind)&&e.isHeritageClause(n)&&n.token===t.kind&&(a=function(e){if(1===e.types.length)return e.types[0].expression}(n)))return a;if(94===t.kind){if(e.isTypeParameterDeclaration(n)&&n.constraint&&e.isTypeReferenceNode(n.constraint))return n.constraint.typeName;if(e.isConditionalTypeNode(n)&&e.isTypeReferenceNode(n.extendsType))return n.extendsType.typeName}if(137===t.kind&&e.isInferTypeNode(n))return n.typeParameter.name;if(101===t.kind&&e.isTypeParameterDeclaration(n)&&e.isMappedTypeNode(n.parent))return n.name;if(140===t.kind&&e.isTypeOperatorNode(n)&&140===n.operator&&e.isTypeReferenceNode(n.type))return n.type.typeName;if(145===t.kind&&e.isTypeOperatorNode(n)&&145===n.operator&&e.isArrayTypeNode(n.type)&&e.isTypeReferenceNode(n.type.elementType))return n.type.elementType.typeName;if(!r){if((103===t.kind&&e.isNewExpression(n)||114===t.kind&&e.isVoidExpression(n)||112===t.kind&&e.isTypeOfExpression(n)||132===t.kind&&e.isAwaitExpression(n)||125===t.kind&&e.isYieldExpression(n)||89===t.kind&&e.isDeleteExpression(n))&&n.expression)return e.skipOuterExpressions(n.expression);if((101===t.kind||102===t.kind)&&e.isBinaryExpression(n)&&n.operatorToken===t)return e.skipOuterExpressions(n.right);if(127===t.kind&&e.isAsExpression(n)&&e.isTypeReferenceNode(n.type))return n.type.typeName;if(101===t.kind&&e.isForInStatement(n)||160===t.kind&&e.isForOfStatement(n))return e.skipOuterExpressions(n.expression)}return t}function w(e){return P(e,!1)}function I(e,t,r){return M(e,t,!1,r,!1)}function O(e,t){return M(e,t,!0,void 0,!1)}function M(t,r,n,i,a){var o,s=t,c=function(){var a=s.getChildren(t),c=e.binarySearchKey(a,r,(function(e,t){return t}),(function(e,o){var s=n?a[e].getFullStart():a[e].getStart(t,!0);return s>r?1:u(a[e])?a[e-1]&&u(a[e-1])?1:0:i&&s===r&&a[e-1]&&a[e-1].getEnd()===r&&u(a[e-1])?1:-1}));return o?{value:o}:c>=0&&a[c]?(s=a[c],"continue-outer"):{value:s}};e:for(;;){var l=c();if("object"==typeof l)return l.value;switch(l){case"continue-outer":continue e}}function u(e){if((n?e.getFullStart():e.getStart(t,!0))>r)return !1;var s=e.getEnd();if(r<s||r===s&&(1===e.kind||a))return !0;if(i&&s===r){var c=R(r,t,e);if(c&&i(c))return o=c,!0}return !1}}function L(t,r,n){return function r(i){return e.isToken(i)&&i.pos===t.end?i:e.firstDefined(i.getChildren(n),(function(e){return (e.pos<=t.pos&&e.end>t.end||e.pos===t.end)&&H(e,n)?r(e):void 0}))}(r)}function R(t,r,n,i){var a=function a(o){if(B(o)&&1!==o.kind)return o;var s=o.getChildren(r),c=e.binarySearchKey(s,t,(function(e,t){return t}),(function(e,r){return t<s[e].end?!s[e-1]||t>=s[e-1].end?0:1:-1}));if(c>=0&&s[c]){var l=s[c];if(t<l.end){if(l.getStart(r,!i)>=t||!H(l,r)||z(l)){var u=J(s,c,r,o.kind);return u&&j(u,r)}return a(l)}}e.Debug.assert(void 0!==n||305===o.kind||1===o.kind||e.isJSDocCommentContainingNode(o));var _=J(s,s.length,r,o.kind);return _&&j(_,r)}(n||r);return e.Debug.assert(!(a&&z(a))),a}function B(t){return e.isToken(t)&&!z(t)}function j(e,t){if(B(e))return e;var r=e.getChildren(t);if(0===r.length)return e;var n=J(r,r.length,t,e.kind);return n&&j(n,t)}function J(t,r,n,i){for(var a=r-1;a>=0;a--)if(z(t[a]))0!==a||11!==i&&279!==i||e.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`");else if(H(t[a],n))return t[a]}function z(t){return e.isJsxText(t)&&t.containsOnlyTriviaWhiteSpaces}function K(t,r,n){var i=e.tokenToString(t.kind),a=e.tokenToString(r),o=t.getFullStart(),s=n.text.lastIndexOf(a,o);if(-1!==s){if(n.text.lastIndexOf(i,o-1)<s){var c=R(s+1,n);if(c&&c.kind===r)return c}for(var l=t.kind,u=0;;){var _=R(t.getFullStart(),n);if(!_)return;if((t=_).kind===r){if(0===u)return t;u--;}else t.kind===l&&u++;}}}function U(e,t,r){return t?e.getNonNullableType():r?e.getNonOptionalType():e}function V(t,r,n){var i=n.getTypeAtLocation(t);return e.isOptionalChain(t.parent)&&(i=U(i,e.isOptionalChainRoot(t.parent),!0)),(e.isNewExpression(t.parent)?i.getConstructSignatures():i.getCallSignatures()).filter((function(e){return !!e.typeParameters&&e.typeParameters.length>=r}))}function q(t,r){if(-1!==r.text.lastIndexOf("<",t?t.pos:r.text.length))for(var n=t,i=0,a=0;n;){switch(n.kind){case 29:if((n=R(n.getFullStart(),r))&&28===n.kind&&(n=R(n.getFullStart(),r)),!n||!e.isIdentifier(n))return;if(!i)return e.isDeclarationName(n)?void 0:{called:n,nTypeArguments:a};i--;break;case 49:i=3;break;case 48:i=2;break;case 31:i++;break;case 19:if(!(n=K(n,18,r)))return;break;case 21:if(!(n=K(n,20,r)))return;break;case 23:if(!(n=K(n,22,r)))return;break;case 27:a++;break;case 38:case 79:case 10:case 8:case 9:case 110:case 95:case 112:case 94:case 140:case 24:case 51:case 57:case 58:break;default:if(e.isTypeNode(n))break;return}n=R(n.getFullStart(),r);}}function W(t,r,n){return e.formatting.getRangeOfEnclosingComment(t,r,void 0,n)}function H(e,t){return 1===e.kind?!!e.jsDoc:0!==e.getWidth(t)}function G(e,t,r){var n=W(e,t,void 0);return !!n&&r===m.test(e.text.substring(n.pos,n.end))}function Q(t,r,n){return e.createTextSpanFromBounds(t.getStart(r),(n||t).getEnd())}function X(t){if(!t.isUnterminated)return e.createTextSpanFromBounds(t.getStart()+1,t.getEnd()-1)}function Y(e,t){return {span:e,newText:t}}function Z(e){return 152===e.kind}function $(t,r){return {fileExists:function(e){return t.fileExists(e)},getCurrentDirectory:function(){return r.getCurrentDirectory()},readFile:e.maybeBind(r,r.readFile),useCaseSensitiveFileNames:e.maybeBind(r,r.useCaseSensitiveFileNames),getSymlinkCache:e.maybeBind(r,r.getSymlinkCache)||t.getSymlinkCache,getModuleSpecifierCache:e.maybeBind(r,r.getModuleSpecifierCache),getPackageJsonInfoCache:function(){var e;return null===(e=t.getModuleResolutionCache())||void 0===e?void 0:e.getPackageJsonInfoCache()},getGlobalTypingsCacheLocation:e.maybeBind(r,r.getGlobalTypingsCacheLocation),redirectTargetsMap:t.redirectTargetsMap,getProjectReferenceRedirect:function(e){return t.getProjectReferenceRedirect(e)},isSourceOfProjectReferenceRedirect:function(e){return t.isSourceOfProjectReferenceRedirect(e)},getNearestAncestorDirectoryWithPackageJson:e.maybeBind(r,r.getNearestAncestorDirectoryWithPackageJson),getFileIncludeReasons:function(){return t.getFileIncludeReasons()}}}function ee(e,t){return i$1(i$1({},$(e,t)),{getCommonSourceDirectory:function(){return e.getCommonSourceDirectory()}})}function te(t,r,n,i,a){return e.factory.createImportDeclaration(void 0,void 0,t||r?e.factory.createImportClause(!!a,t,r&&r.length?e.factory.createNamedImports(r):void 0):void 0,"string"==typeof n?re(n,i):n,void 0)}function re(t,r){return e.factory.createStringLiteral(t,0===r)}function ne(t,r){return e.isStringDoubleQuoted(t,r)?1:0}function ie(t,r){if(r.quotePreference&&"auto"!==r.quotePreference)return "single"===r.quotePreference?0:1;var n=t.imports&&e.find(t.imports,(function(t){return e.isStringLiteral(t)&&!e.nodeIsSynthesized(t.parent)}));return n?ne(n,t):1}function ae(t){return "default"!==t.escapedName?t.escapedName:e.firstDefined(t.declarations,(function(t){var r=e.getNameOfDeclaration(t);return r&&79===r.kind?r.escapedText:void 0}))}function oe(t,r,n){return e.textSpanContainsPosition(t,r.getStart(n))&&r.getEnd()<=e.textSpanEnd(t)}function se(e,t){return !!e&&!!t&&e.start===t.start&&e.length===t.length}function ce(t){var r=t.declarations?e.firstOrUndefined(t.declarations):void 0;return !!e.findAncestor(r,(function(t){return !!e.isParameter(t)||!(e.isBindingElement(t)||e.isObjectBindingPattern(t)||e.isArrayBindingPattern(t))&&"quit"}))}e.getLineStartPositionForPosition=function(t,r){return e.getLineStarts(r)[r.getLineAndCharacterOfPosition(t).line]},e.rangeContainsRange=y,e.rangeContainsRangeExclusive=function(e,t){return v(e,t.pos)&&v(e,t.end)},e.rangeContainsPosition=function(e,t){return e.pos<=t&&t<=e.end},e.rangeContainsPositionExclusive=v,e.startEndContainsRange=h,e.rangeContainsStartEnd=function(e,t,r){return e.pos<=t&&e.end>=r},e.rangeOverlapsWithStartEnd=function(e,t,r){return b(e.pos,e.end,t,r)},e.nodeOverlapsWithStartEnd=function(e,t,r,n){return b(e.getStart(t),e.end,r,n)},e.startEndOverlapsWithStartEnd=b,e.positionBelongsToNode=function(t,r,n){return e.Debug.assert(t.pos<=r),r<t.end||!x(t,n)},e.findListItemInfo=function(t){var r=C(t);if(r){var n=r.getChildren();return {listItemIndex:e.indexOfNode(n,t),list:r}}},e.hasChildOfKind=S,e.findChildOfKind=T,e.findContainingList=C,e.getContextualTypeFromParentOrAncestorTypeNode=function(t,r){var n=Le(t,r);if(n)return n;var i=function(t){var r;return e.findAncestor(t,(function(t){return e.isTypeNode(t)&&(r=t),!e.isQualifiedName(t.parent)&&!e.isTypeNode(t.parent)&&!e.isTypeElement(t.parent)})),r}(t);return i&&r.getTypeAtLocation(i)},e.getAdjustedReferenceLocation=w,e.getAdjustedRenameLocation=function(e){return P(e,!0)},e.getTouchingPropertyName=function(t,r){return I(t,r,(function(t){return e.isPropertyNameLiteral(t)||e.isKeyword(t.kind)||e.isPrivateIdentifier(t)}))},e.getTouchingToken=I,e.getTokenAtPosition=O,e.findFirstNonJsxWhitespaceToken=function(e,t){for(var r=O(e,t);z(r);){var n=L(r,r.parent,e);if(!n)return;r=n;}return r},e.findTokenOnLeftOfPosition=function(t,r){var n=O(t,r);return e.isToken(n)&&r>n.getStart(t)&&r<n.getEnd()?n:R(r,t)},e.findNextToken=L,e.findPrecedingToken=R,e.isInString=function(t,r,n){if(void 0===n&&(n=R(r,t)),n&&e.isStringTextContainingNode(n)){var i=n.getStart(t),a=n.getEnd();if(i<r&&r<a)return !0;if(r===a)return !!n.isUnterminated}return !1},e.isInsideJsxElementOrAttribute=function(e,t){var r=O(e,t);return !!r&&(11===r.kind||29===r.kind&&11===r.parent.kind||29===r.kind&&288===r.parent.kind||!(!r||19!==r.kind||288!==r.parent.kind)||29===r.kind&&281===r.parent.kind)},e.isInTemplateString=function(t,r){var n=O(t,r);return e.isTemplateLiteralKind(n.kind)&&r>n.getStart(t)},e.isInJSXText=function(t,r){var n=O(t,r);return !!e.isJsxText(n)||!(18!==n.kind||!e.isJsxExpression(n.parent)||!e.isJsxElement(n.parent.parent))||!(29!==n.kind||!e.isJsxOpeningLikeElement(n.parent)||!e.isJsxElement(n.parent.parent))},e.isInsideJsxElement=function(e,t){return function(r){for(;r;)if(r.kind>=279&&r.kind<=288||11===r.kind||29===r.kind||31===r.kind||79===r.kind||19===r.kind||18===r.kind||43===r.kind)r=r.parent;else {if(278!==r.kind)return !1;if(t>r.getStart(e))return !0;r=r.parent;}return !1}(O(e,t))},e.findPrecedingMatchingToken=K,e.removeOptionality=U,e.isPossiblyTypeArgumentPosition=function t(r,n,i){var a=q(r,n);return void 0!==a&&(e.isPartOfTypeNode(a.called)||0!==V(a.called,a.nTypeArguments,i).length||t(a.called,n,i))},e.getPossibleGenericSignatures=V,e.getPossibleTypeArgumentsInfo=q,e.isInComment=W,e.hasDocComment=function(t,r){var n=O(t,r);return !!e.findAncestor(n,e.isJSDoc)},e.getNodeModifiers=function(t,r){void 0===r&&(r=0);var n=[],i=e.isDeclaration(t)?e.getCombinedNodeFlagsAlwaysIncludeJSDoc(t)&~r:0;return 8&i&&n.push("private"),16&i&&n.push("protected"),4&i&&n.push("public"),(32&i||e.isClassStaticBlockDeclaration(t))&&n.push("static"),128&i&&n.push("abstract"),1&i&&n.push("export"),8192&i&&n.push("deprecated"),16777216&t.flags&&n.push("declare"),271===t.kind&&n.push("export"),n.length>0?n.join(","):""},e.getTypeArgumentOrTypeParameterList=function(t){return 178===t.kind||208===t.kind?t.typeArguments:e.isFunctionLike(t)||257===t.kind||258===t.kind?t.typeParameters:void 0},e.isComment=function(e){return 2===e||3===e},e.isStringOrRegularExpressionOrTemplateLiteral=function(t){return !(10!==t&&13!==t&&!e.isTemplateLiteralKind(t))},e.isPunctuation=function(e){return 18<=e&&e<=78},e.isInsideTemplateLiteral=function(t,r,n){return e.isTemplateLiteralKind(t.kind)&&t.getStart(n)<r&&r<t.end||!!t.isUnterminated&&r===t.end},e.isAccessibilityModifier=function(e){switch(e){case 123:case 121:case 122:return !0}return !1},e.cloneCompilerOptions=function(t){var r=e.clone(t);return e.setConfigFileInOptions(r,t&&t.configFile),r},e.isArrayLiteralOrObjectLiteralDestructuringPattern=function e(t){if(204===t.kind||205===t.kind){if(221===t.parent.kind&&t.parent.left===t&&63===t.parent.operatorToken.kind)return !0;if(244===t.parent.kind&&t.parent.initializer===t)return !0;if(e(296===t.parent.kind?t.parent.parent:t.parent))return !0}return !1},e.isInReferenceComment=function(e,t){return G(e,t,!0)},e.isInNonReferenceComment=function(e,t){return G(e,t,!1)},e.getReplacementSpanForContextToken=function(e){if(e)switch(e.kind){case 10:case 14:return X(e);default:return Q(e)}},e.createTextSpanFromNode=Q,e.createTextSpanFromStringLiteralLikeContent=X,e.createTextRangeFromNode=function(t,r){return e.createRange(t.getStart(r),t.end)},e.createTextSpanFromRange=function(t){return e.createTextSpanFromBounds(t.pos,t.end)},e.createTextRangeFromSpan=function(t){return e.createRange(t.start,t.start+t.length)},e.createTextChangeFromStartLength=function(t,r,n){return Y(e.createTextSpan(t,r),n)},e.createTextChange=Y,e.typeKeywords=[130,128,158,133,95,137,140,143,104,147,148,145,150,151,110,114,153,154,155],e.isTypeKeyword=function(t){return e.contains(e.typeKeywords,t)},e.isTypeKeywordToken=Z,e.isTypeKeywordTokenOrIdentifier=function(t){return Z(t)||e.isIdentifier(t)&&"type"===t.text},e.isExternalModuleSymbol=function(e){return !!(1536&e.flags)&&34===e.name.charCodeAt(0)},e.nodeSeenTracker=function(){var t=[];return function(r){var n=e.getNodeId(r);return !t[n]&&(t[n]=!0)}},e.getSnapshotText=function(e){return e.getText(0,e.getLength())},e.repeatString=function(e,t){for(var r="",n=0;n<t;n++)r+=e;return r},e.skipConstraint=function(e){return e.isTypeParameter()&&e.getConstraint()||e},e.getNameFromPropertyName=function(t){return 162===t.kind?e.isStringOrNumericLiteralLike(t.expression)?t.expression.text:void 0:e.isPrivateIdentifier(t)?e.idText(t):e.getTextOfIdentifierOrLiteral(t)},e.programContainsModules=function(e){return e.getSourceFiles().some((function(t){return !(t.isDeclarationFile||e.isSourceFileFromExternalLibrary(t)||!t.externalModuleIndicator&&!t.commonJsModuleIndicator)}))},e.programContainsEsModules=function(e){return e.getSourceFiles().some((function(t){return !t.isDeclarationFile&&!e.isSourceFileFromExternalLibrary(t)&&!!t.externalModuleIndicator}))},e.compilerOptionsIndicateEsModules=function(t){return !!t.module||e.getEmitScriptTarget(t)>=2||!!t.noEmit},e.createModuleSpecifierResolutionHost=$,e.getModuleSpecifierResolverHost=ee,e.moduleResolutionRespectsExports=function(t){return t>=e.ModuleResolutionKind.Node16&&t<=e.ModuleResolutionKind.NodeNext},e.moduleResolutionUsesNodeModules=function(t){return t===e.ModuleResolutionKind.NodeJs||t>=e.ModuleResolutionKind.Node16&&t<=e.ModuleResolutionKind.NodeNext},e.makeImportIfNecessary=function(e,t,r,n){return e||t&&t.length?te(e,t,r,n):void 0},e.makeImport=te,e.makeStringLiteral=re,(g=e.QuotePreference||(e.QuotePreference={}))[g.Single=0]="Single",g[g.Double=1]="Double",e.quotePreferenceFromString=ne,e.getQuotePreference=ie,e.getQuoteFromPreference=function(t){switch(t){case 0:return "'";case 1:return '"';default:return e.Debug.assertNever(t)}},e.symbolNameNoDefault=function(t){var r=ae(t);return void 0===r?void 0:e.unescapeLeadingUnderscores(r)},e.symbolEscapedNameNoDefault=ae,e.isModuleSpecifierLike=function(t){return e.isStringLiteralLike(t)&&(e.isExternalModuleReference(t.parent)||e.isImportDeclaration(t.parent)||e.isRequireCall(t.parent,!1)&&t.parent.arguments[0]===t||e.isImportCall(t.parent)&&t.parent.arguments[0]===t)},e.isObjectBindingElementWithoutPropertyName=function(t){return e.isBindingElement(t)&&e.isObjectBindingPattern(t.parent)&&e.isIdentifier(t.name)&&!t.propertyName},e.getPropertySymbolFromBindingElement=function(e,t){var r=e.getTypeAtLocation(t.parent);return r&&e.getPropertyOfType(r,t.name.text)},e.getParentNodeInSpan=function(t,r,n){if(t)for(;t.parent;){if(e.isSourceFile(t.parent)||!oe(n,t.parent,r))return t;t=t.parent;}},e.findModifier=function(t,r){return t.modifiers&&e.find(t.modifiers,(function(e){return e.kind===r}))},e.insertImports=function(t,r,n,i){var a=237===(e.isArray(n)?n[0]:n).kind?e.isRequireVariableStatement:e.isAnyImportSyntax,o=e.filter(r.statements,a),s=e.isArray(n)?e.stableSort(n,e.OrganizeImports.compareImportsOrRequireStatements):[n];if(o.length)if(o&&e.OrganizeImports.importsAreSorted(o))for(var c=0,l=s;c<l.length;c++){var u=l[c],_=e.OrganizeImports.getImportDeclarationInsertionIndex(o,u);if(0===_){var d=o[0]===r.statements[0]?{leadingTriviaOption:e.textChanges.LeadingTriviaOption.Exclude}:{};t.insertNodeBefore(r,o[0],u,!1,d);}else {var p=o[_-1];t.insertNodeAfter(r,p,u);}}else {var f=e.lastOrUndefined(o);f?t.insertNodesAfter(r,f,s):t.insertNodesAtTopOfFile(r,s,i);}else t.insertNodesAtTopOfFile(r,s,i);},e.getTypeKeywordOfTypeOnlyImport=function(t,r){return e.Debug.assert(t.isTypeOnly),e.cast(t.getChildAt(0,r),Z)},e.textSpansEqual=se,e.documentSpansEqual=function(e,t){return e.fileName===t.fileName&&se(e.textSpan,t.textSpan)},e.forEachUnique=function(e,t){if(e)for(var r=0;r<e.length;r++)if(e.indexOf(e[r])===r){var n=t(e[r],r);if(n)return n}},e.isTextWhiteSpaceLike=function(t,r,n){for(var i=r;i<n;i++)if(!e.isWhiteSpaceLike(t.charCodeAt(i)))return !1;return !0},e.isFirstDeclarationOfSymbolParameter=ce;var le=function(){var t,r,n,i,a=10*e.defaultMaximumTruncationLength;l();var o=function(t){return c(t,e.SymbolDisplayPartKind.text)};return {displayParts:function(){var r=t.length&&t[t.length-1].text;return i>a&&r&&"..."!==r&&(e.isWhiteSpaceLike(r.charCodeAt(r.length-1))||t.push(_e(" ",e.SymbolDisplayPartKind.space)),t.push(_e("...",e.SymbolDisplayPartKind.punctuation))),t},writeKeyword:function(t){return c(t,e.SymbolDisplayPartKind.keyword)},writeOperator:function(t){return c(t,e.SymbolDisplayPartKind.operator)},writePunctuation:function(t){return c(t,e.SymbolDisplayPartKind.punctuation)},writeTrailingSemicolon:function(t){return c(t,e.SymbolDisplayPartKind.punctuation)},writeSpace:function(t){return c(t,e.SymbolDisplayPartKind.space)},writeStringLiteral:function(t){return c(t,e.SymbolDisplayPartKind.stringLiteral)},writeParameter:function(t){return c(t,e.SymbolDisplayPartKind.parameterName)},writeProperty:function(t){return c(t,e.SymbolDisplayPartKind.propertyName)},writeLiteral:function(t){return c(t,e.SymbolDisplayPartKind.stringLiteral)},writeSymbol:function(e,r){i>a||(s(),i+=e.length,t.push(ue(e,r)));},writeLine:function(){i>a||(i+=1,t.push(ye()),r=!0);},write:o,writeComment:o,getText:function(){return ""},getTextPos:function(){return 0},getColumn:function(){return 0},getLine:function(){return 0},isAtStartOfLine:function(){return !1},hasTrailingWhitespace:function(){return !1},hasTrailingComment:function(){return !1},rawWrite:e.notImplemented,getIndent:function(){return n},increaseIndent:function(){n++;},decreaseIndent:function(){n--;},clear:l,trackSymbol:function(){return !1},reportInaccessibleThisError:e.noop,reportInaccessibleUniqueSymbolError:e.noop,reportPrivateInBaseOfClassExpression:e.noop};function s(){if(!(i>a)&&r){var o=e.getIndentString(n);o&&(i+=o.length,t.push(_e(o,e.SymbolDisplayPartKind.space))),r=!1;}}function c(e,r){i>a||(s(),i+=e.length,t.push(_e(e,r)));}function l(){t=[],r=!0,n=0,i=0;}}();function ue(t,r){return _e(t,function(t){var r=t.flags;return 3&r?ce(t)?e.SymbolDisplayPartKind.parameterName:e.SymbolDisplayPartKind.localName:4&r||32768&r||65536&r?e.SymbolDisplayPartKind.propertyName:8&r?e.SymbolDisplayPartKind.enumMemberName:16&r?e.SymbolDisplayPartKind.functionName:32&r?e.SymbolDisplayPartKind.className:64&r?e.SymbolDisplayPartKind.interfaceName:384&r?e.SymbolDisplayPartKind.enumName:1536&r?e.SymbolDisplayPartKind.moduleName:8192&r?e.SymbolDisplayPartKind.methodName:262144&r?e.SymbolDisplayPartKind.typeParameterName:524288&r||2097152&r?e.SymbolDisplayPartKind.aliasName:e.SymbolDisplayPartKind.text}(r))}function _e(t,r){return {text:t,kind:e.SymbolDisplayPartKind[r]}}function de(t){return _e(e.tokenToString(t),e.SymbolDisplayPartKind.keyword)}function pe(t){return _e(t,e.SymbolDisplayPartKind.text)}function fe(t){return _e(t,e.SymbolDisplayPartKind.linkText)}function ge(t,r){return {text:t,kind:e.SymbolDisplayPartKind[e.SymbolDisplayPartKind.linkName],target:{fileName:e.getSourceFileOfNode(r).fileName,textSpan:Q(r)}}}function me(t){return _e(t,e.SymbolDisplayPartKind.link)}function ye(){return _e("\n",e.SymbolDisplayPartKind.lineBreak)}function ve(e){try{return e(le),le.displayParts()}finally{le.clear();}}function he(e){return 0!=(33554432&e.flags)}function be(e){return 0!=(2097152&e.flags)}function xe(e,t){void 0===t&&(t=!0);var r=e&&Se(e);return r&&!t&&ke(r),r}function De(t,r,n){var i=n(t);return i?e.setOriginalNode(i,t):i=Se(t,n),i&&!r&&ke(i),i}function Se(t,r){var n=r?function(e){return De(e,!0,r)}:xe,i=r?function(e){return e&&Ce(e,!0,r)}:function(e){return e&&Te(e)},a=e.visitEachChild(t,n,e.nullTransformationContext,i,n);if(a===t){var o=e.isStringLiteral(t)?e.setOriginalNode(e.factory.createStringLiteralFromNode(t),t):e.isNumericLiteral(t)?e.setOriginalNode(e.factory.createNumericLiteral(t.text,t.numericLiteralFlags),t):e.factory.cloneNode(t);return e.setTextRange(o,t)}return a.parent=void 0,a}function Te(t,r){return void 0===r&&(r=!0),t&&e.factory.createNodeArray(t.map((function(e){return xe(e,r)})),t.hasTrailingComma)}function Ce(t,r,n){return e.factory.createNodeArray(t.map((function(e){return De(e,r,n)})),t.hasTrailingComma)}function ke(e){Ee(e),Ne(e);}function Ee(e){Fe(e,512,Ae);}function Ne(t){Fe(t,1024,e.getLastChild);}function Fe(t,r,n){e.addEmitFlags(t,r);var i=n(t);i&&Fe(i,r,n);}function Ae(e){return e.forEachChild((function(e){return e}))}function Pe(t,r,n,i,a){e.forEachLeadingCommentRange(n.text,t.pos,Oe(r,n,i,a,e.addSyntheticLeadingComment));}function we(t,r,n,i,a){e.forEachTrailingCommentRange(n.text,t.end,Oe(r,n,i,a,e.addSyntheticTrailingComment));}function Ie(t,r,n,i,a){e.forEachTrailingCommentRange(n.text,t.pos,Oe(r,n,i,a,e.addSyntheticLeadingComment));}function Oe(e,t,r,n,i){return function(a,o,s,c){3===s?(a+=2,o-=2):a+=2,i(e,r||s,t.text.slice(a,o),void 0!==n?n:c);}}function Me(t,r){if(e.startsWith(t,r))return 0;var n=t.indexOf(" "+r);return -1===n&&(n=t.indexOf("."+r)),-1===n&&(n=t.indexOf('"'+r)),-1===n?-1:n+1}function Le(e,t){var r=e.parent;switch(r.kind){case 209:return t.getContextualType(r);case 221:var n=r,i=n.left,a=n.operatorToken,o=n.right;return Re(a.kind)?t.getTypeAtLocation(e===o?i:o):t.getContextualType(e);case 289:return r.expression===e?Be(r,t):void 0;default:return t.getContextualType(e)}}function Re(e){switch(e){case 36:case 34:case 37:case 35:return !0;default:return !1}}function Be(e,t){return t.getTypeAtLocation(e.parent.parent.expression)}function je(e){return 174===e||175===e||176===e||166===e||168===e}function Je(e){return 256===e||171===e||169===e||172===e||173===e}function ze(e){return 261===e}function Ke(e){return 237===e||238===e||240===e||245===e||246===e||247===e||251===e||253===e||167===e||259===e||266===e||265===e||272===e||264===e||271===e}function Ue(t){var r=0,n=0;return e.forEachChild(t,(function i(a){if(Ke(a.kind))26===(null==(o=a.getLastToken(t))?void 0:o.kind)?r++:n++;else if(je(a.kind)){var o;26===(null==(o=a.getLastToken(t))?void 0:o.kind)?r++:o&&27!==o.kind&&e.getLineAndCharacterOfPosition(t,o.getStart(t)).line!==e.getLineAndCharacterOfPosition(t,e.getSpanOfTokenAtPosition(t,o.end).start).line&&n++;}return r+n>=5||e.forEachChild(a,i)})),0===r&&n<=1||r/n>.2}function Ve(e,t){return We(e,e.fileExists,t)}function qe(e){try{return e()}catch(e){return}}function We(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return qe((function(){return t&&t.apply(e,r)}))}function He(t,r){if(!r.fileExists)return [];var n=[];return e.forEachAncestorDirectory(e.getDirectoryPath(t),(function(t){var i=e.combinePaths(t,"package.json");if(r.fileExists(i)){var a=Ge(i,r);a&&n.push(a);}})),n}function Ge(t,r){if(r.readFile){var n=function(e){try{return JSON.parse(e)}catch(e){return}}(r.readFile(t)||""),a={};if(n)for(var o=0,s=["dependencies","devDependencies","optionalDependencies","peerDependencies"];o<s.length;o++){var c=s[o],l=n[c];if(l){var u=new e.Map;for(var _ in l)u.set(_,l[_]);a[c]=u;}}var d=[[1,a.dependencies],[2,a.devDependencies],[8,a.optionalDependencies],[4,a.peerDependencies]];return i$1(i$1({},a),{parseable:!!n,fileName:t,get:p,has:function(e,t){return !!p(e,t)}})}function p(e,t){void 0===t&&(t=15);for(var r=0,n=d;r<n.length;r++){var i=n[r],a=i[0],o=i[1];if(o&&t&a){var s=o.get(e);if(void 0!==s)return s}}}}function Qe(t){return e.some(t.imports,(function(t){var r=t.text;return e.JsTyping.nodeCoreModules.has(r)}))}function Xe(e){return void 0!==e.file&&void 0!==e.start&&void 0!==e.length}function Ye(e){return !(33554432&e.flags||"export="!==e.escapedName&&"default"!==e.escapedName)}function Ze(t){return e.firstDefined(t.declarations,(function(t){var r;return e.isExportAssignment(t)?null===(r=e.tryCast(e.skipOuterExpressions(t.expression),e.isIdentifier))||void 0===r?void 0:r.text:void 0}))}function $e(t){var r;return e.Debug.checkDefined(t.parent,"Symbol parent was undefined. Flags: ".concat(e.Debug.formatSymbolFlags(t.flags),". ")+"Declarations: ".concat(null===(r=t.declarations)||void 0===r?void 0:r.map((function(t){var r=e.Debug.formatSyntaxKind(t.kind),n=e.isInJSFile(t),i=t.expression;return (n?"[JS]":"")+r+(i?" (expression: ".concat(e.Debug.formatSyntaxKind(i.kind),")"):"")})).join(", "),"."))}function et(t){var r=t.getSourceFile();return !(!r.externalModuleIndicator&&!r.commonJsModuleIndicator)&&(e.isInJSFile(t)||!e.findAncestor(t,e.isGlobalScopeAugmentation))}e.symbolPart=ue,e.displayPart=_e,e.spacePart=function(){return _e(" ",e.SymbolDisplayPartKind.space)},e.keywordPart=de,e.punctuationPart=function(t){return _e(e.tokenToString(t),e.SymbolDisplayPartKind.punctuation)},e.operatorPart=function(t){return _e(e.tokenToString(t),e.SymbolDisplayPartKind.operator)},e.parameterNamePart=function(t){return _e(t,e.SymbolDisplayPartKind.parameterName)},e.propertyNamePart=function(t){return _e(t,e.SymbolDisplayPartKind.propertyName)},e.textOrKeywordPart=function(t){var r=e.stringToToken(t);return void 0===r?pe(t):de(r)},e.textPart=pe,e.typeAliasNamePart=function(t){return _e(t,e.SymbolDisplayPartKind.aliasName)},e.typeParameterNamePart=function(t){return _e(t,e.SymbolDisplayPartKind.typeParameterName)},e.linkTextPart=fe,e.linkNamePart=ge,e.linkPart=me,e.buildLinkParts=function(t,r){var n,i=e.isJSDocLink(t)?"link":e.isJSDocLinkCode(t)?"linkcode":"linkplain",a=[me("{@".concat(i," "))];if(t.name){var o=null==r?void 0:r.getSymbolAtLocation(t.name),s=function(e){if(0===e.indexOf("()"))return 2;if("<"!==e[0])return 0;for(var t=0,r=0;r<e.length;)if("<"===e[r]&&t++,">"===e[r]&&t--,r++,!t)return r;return 0}(t.text),c=e.getTextOfNode(t.name)+t.text.slice(0,s),l=function(e){var t=0;if(124===e.charCodeAt(t++)){for(;t<e.length&&32===e.charCodeAt(t);)t++;return e.slice(t)}return e}(t.text.slice(s)),u=(null==o?void 0:o.valueDeclaration)||(null===(n=null==o?void 0:o.declarations)||void 0===n?void 0:n[0]);u?(a.push(ge(c,u)),l&&a.push(fe(l))):a.push(fe(c+(s||0===l.indexOf("://")?"":" ")+l));}else t.text&&a.push(fe(t.text));return a.push(me("}")),a},e.getNewLineOrDefaultFromHost=function(e,t){var r;return (null==t?void 0:t.newLineCharacter)||(null===(r=e.getNewLine)||void 0===r?void 0:r.call(e))||"\r\n"},e.lineBreakPart=ye,e.mapToDisplayParts=ve,e.typeToDisplayParts=function(e,t,r,n){return void 0===n&&(n=0),ve((function(i){e.writeType(t,r,17408|n,i);}))},e.symbolToDisplayParts=function(e,t,r,n,i){return void 0===i&&(i=0),ve((function(a){e.writeSymbol(t,r,n,8|i,a);}))},e.signatureToDisplayParts=function(e,t,r,n){return void 0===n&&(n=0),n|=25632,ve((function(i){e.writeSignature(t,r,n,void 0,i);}))},e.nodeToDisplayParts=function(t,r){var n=r.getSourceFile();return ve((function(r){e.createPrinter({removeComments:!0,omitTrailingSemicolon:!0}).writeNode(4,t,n,r);}))},e.isImportOrExportSpecifierName=function(t){return !!t.parent&&e.isImportOrExportSpecifier(t.parent)&&t.parent.propertyName===t},e.getScriptKind=function(t,r){return e.ensureScriptKind(t,r.getScriptKind&&r.getScriptKind(t))},e.getSymbolTarget=function(t,r){for(var n=t;be(n)||he(n)&&n.target;)n=he(n)&&n.target?n.target:e.skipAlias(n,r);return n},e.getUniqueSymbolId=function(t,r){return e.getSymbolId(e.skipAlias(t,r))},e.getFirstNonSpaceCharacterPosition=function(t,r){for(;e.isWhiteSpaceLike(t.charCodeAt(r));)r+=1;return r},e.getPrecedingNonSpaceCharacterPosition=function(t,r){for(;r>-1&&e.isWhiteSpaceSingleLine(t.charCodeAt(r));)r-=1;return r+1},e.getSynthesizedDeepClone=xe,e.getSynthesizedDeepCloneWithReplacements=De,e.getSynthesizedDeepClones=Te,e.getSynthesizedDeepClonesWithReplacements=Ce,e.suppressLeadingAndTrailingTrivia=ke,e.suppressLeadingTrivia=Ee,e.suppressTrailingTrivia=Ne,e.copyComments=function(e,t){var r=e.getSourceFile();!function(e,t){for(var r=e.getFullStart(),n=e.getStart(),i=r;i<n;i++)if(10===t.charCodeAt(i))return !0;return !1}(e,r.text)?Ie(e,t,r):Pe(e,t,r),we(e,t,r);},e.getUniqueName=function(t,r){for(var n=t,i=1;!e.isFileLevelUniqueName(r,n);i++)n="".concat(t,"_").concat(i);return n},e.getRenameLocation=function(t,r,n,i){for(var a=0,o=-1,s=0,c=t;s<c.length;s++){var l=c[s],u=l.fileName,_=l.textChanges;e.Debug.assert(u===r);for(var d=0,p=_;d<p.length;d++){var f=p[d],g=f.span,m=f.newText,y=Me(m,n);if(-1!==y&&(o=g.start+a+y,!i))return o;a+=m.length-g.length;}}return e.Debug.assert(i),e.Debug.assert(o>=0),o},e.copyLeadingComments=Pe,e.copyTrailingComments=we,e.copyTrailingAsLeadingComments=Ie,e.needsParentheses=function(t){return e.isBinaryExpression(t)&&27===t.operatorToken.kind||e.isObjectLiteralExpression(t)||e.isAsExpression(t)&&e.isObjectLiteralExpression(t.expression)},e.getContextualTypeFromParent=Le,e.quote=function(t,r,n){var i=ie(t,r),a=JSON.stringify(n);return 0===i?"'".concat(e.stripQuotes(a).replace(/'/g,"\\'").replace(/\\"/g,'"'),"'"):a},e.isEqualityOperatorKind=Re,e.isStringLiteralOrTemplate=function(e){switch(e.kind){case 10:case 14:case 223:case 210:return !0;default:return !1}},e.hasIndexSignature=function(e){return !!e.getStringIndexType()||!!e.getNumberIndexType()},e.getSwitchedType=Be,e.ANONYMOUS="anonymous function",e.getTypeNodeIfAccessible=function(e,t,r,n){var i=r.getTypeChecker(),a=!0,o=function(){return a=!1},s=i.typeToTypeNode(e,t,1,{trackSymbol:function(e,t,r){return !(a=a&&0===i.isSymbolAccessible(e,t,r,!1).accessibility)},reportInaccessibleThisError:o,reportPrivateInBaseOfClassExpression:o,reportInaccessibleUniqueSymbolError:o,moduleResolverHost:ee(r,n)});return a?s:void 0},e.syntaxRequiresTrailingSemicolonOrASI=Ke,e.syntaxMayBeASICandidate=e.or(je,Je,ze,Ke),e.positionIsASICandidate=function(t,r,n){var i=e.findAncestor(r,(function(r){return r.end!==t?"quit":e.syntaxMayBeASICandidate(r.kind)}));return !!i&&function(t,r){var n=t.getLastToken(r);if(n&&26===n.kind)return !1;if(je(t.kind)){if(n&&27===n.kind)return !1}else if(ze(t.kind)){if((i=e.last(t.getChildren(r)))&&e.isModuleBlock(i))return !1}else if(Je(t.kind)){var i;if((i=e.last(t.getChildren(r)))&&e.isFunctionBlock(i))return !1}else if(!Ke(t.kind))return !1;if(240===t.kind)return !0;var a=L(t,e.findAncestor(t,(function(e){return !e.parent})),r);return !a||19===a.kind||r.getLineAndCharacterOfPosition(t.getEnd()).line!==r.getLineAndCharacterOfPosition(a.getStart(r)).line}(i,n)},e.probablyUsesSemicolons=Ue,e.tryGetDirectories=function(e,t){return We(e,e.getDirectories,t)||[]},e.tryReadDirectory=function(t,r,n,i,a){return We(t,t.readDirectory,r,n,i,a)||e.emptyArray},e.tryFileExists=Ve,e.tryDirectoryExists=function(t,r){return qe((function(){return e.directoryProbablyExists(r,t)}))||!1},e.tryAndIgnoreErrors=qe,e.tryIOAndConsumeErrors=We,e.findPackageJsons=function(t,r,n){var i=[];return e.forEachAncestorDirectory(t,(function(t){if(t===n)return !0;var a=e.combinePaths(t,"package.json");Ve(r,a)&&i.push(a);})),i},e.findPackageJson=function(t,r){var n;return e.forEachAncestorDirectory(t,(function(t){return "node_modules"===t||!!(n=e.findConfigFile(t,(function(e){return Ve(r,e)}),"package.json"))||void 0})),n},e.getPackageJsonsVisibleToFile=He,e.createPackageJsonInfo=Ge,e.createPackageJsonImportFilter=function(t,r,n){var i,a=(n.getPackageJsonsVisibleToFile&&n.getPackageJsonsVisibleToFile(t.fileName)||He(t.fileName,n)).filter((function(e){return e.parseable}));return {allowsImportingAmbientModule:function(t,r){if(!a.length||!t.valueDeclaration)return !0;var n=c(t.valueDeclaration.getSourceFile().fileName,r);if(void 0===n)return !0;var i=e.stripQuotes(t.getName());return !!s(i)||(o(n)||o(i))},allowsImportingSourceFile:function(e,t){if(!a.length)return !0;var r=c(e.fileName,t);return !r||o(r)},allowsImportingSpecifier:function(t){return !(a.length&&!s(t))||(!(!e.pathIsRelative(t)&&!e.isRootedDiskPath(t))||o(t))}};function o(t){for(var r=l(t),n=0,i=a;n<i.length;n++){var o=i[n];if(o.has(r)||o.has(e.getTypesPackageName(r)))return !0}return !1}function s(r){return !!(e.isSourceFileJS(t)&&e.JsTyping.nodeCoreModules.has(r)&&(void 0===i&&(i=Qe(t)),i))}function c(i,a){if(e.stringContains(i,"node_modules")){var o=e.moduleSpecifiers.getNodeModulesPackageName(n.getCompilationSettings(),t,i,a,r);if(o)return e.pathIsRelative(o)||e.isRootedDiskPath(o)?void 0:l(o)}}function l(t){var r=e.getPathComponents(e.getPackageNameFromTypesPackageName(t)).slice(1);return e.startsWith(r[0],"@")?"".concat(r[0],"/").concat(r[1]):r[0]}},e.consumesNodeCoreModules=Qe,e.isInsideNodeModules=function(t){return e.contains(e.getPathComponents(t),"node_modules")},e.isDiagnosticWithLocation=Xe,e.findDiagnosticForNode=function(t,r){var n=Q(t),i=e.binarySearchKey(r,n,e.identity,e.compareTextSpans);if(i>=0){var a=r[i];return e.Debug.assertEqual(a.file,t.getSourceFile(),"Diagnostics proided to 'findDiagnosticForNode' must be from a single SourceFile"),e.cast(a,Xe)}},e.getDiagnosticsWithinSpan=function(t,r){var n,i=e.binarySearchKey(r,t.start,(function(e){return e.start}),e.compareValues);for(i<0&&(i=~i);(null===(n=r[i-1])||void 0===n?void 0:n.start)===t.start;)i--;for(var a=[],o=e.textSpanEnd(t);;){var s=e.tryCast(r[i],Xe);if(!s||s.start>o)break;e.textSpanContainsTextSpan(t,s)&&a.push(s),i++;}return a},e.getRefactorContextSpan=function(t){var r=t.startPosition,n=t.endPosition;return e.createTextSpanFromBounds(r,void 0===n?r:n)},e.getFixableErrorSpanExpression=function(t,r){var n=O(t,r.start);return e.findAncestor(n,(function(n){return n.getStart(t)<r.start||n.getEnd()>e.textSpanEnd(r)?"quit":e.isExpression(n)&&se(r,Q(n,t))}))},e.mapOneOrMany=function(t,r,n){return void 0===n&&(n=e.identity),t?e.isArray(t)?n(e.map(t,r)):r(t,0):void 0},e.firstOrOnly=function(t){return e.isArray(t)?e.first(t):t},e.getNamesForExportedSymbol=function(t,r){if(Ye(t)){var n=Ze(t);if(n)return n;var i=e.codefix.moduleSymbolToValidIdentifier($e(t),r,!1),a=e.codefix.moduleSymbolToValidIdentifier($e(t),r,!0);return i===a?i:[i,a]}return t.name},e.getNameForExportedSymbol=function(t,r,n){return Ye(t)?Ze(t)||e.codefix.moduleSymbolToValidIdentifier($e(t),r,!!n):t.name},e.stringContainsAt=function(e,t,r){var n=t.length;if(n+r>e.length)return !1;for(var i=0;i<n;i++)if(t.charCodeAt(i)!==e.charCodeAt(i+r))return !1;return !0},e.startsWithUnderscore=function(e){return 95===e.charCodeAt(0)},e.isGlobalDeclaration=function(e){return !et(e)},e.isNonGlobalDeclaration=et,e.isDeprecatedDeclaration=function(t){return !!(8192&e.getCombinedNodeFlagsAlwaysIncludeJSDoc(t))},e.shouldUseUriStyleNodeCoreModules=function(t,r){var n=e.firstDefined(t.imports,(function(t){if(e.JsTyping.nodeCoreModules.has(t.text))return e.startsWith(t.text,"node:")}));return null!=n?n:r.usesUriStyleNodeCoreModules},e.getNewLineKind=function(e){return "\n"===e?1:0},e.diagnosticToString=function(t){return e.isArray(t)?e.formatStringFromArgs(e.getLocaleSpecificMessage(t[0]),t.slice(1)):e.getLocaleSpecificMessage(t)},e.getFormatCodeSettingsForWriting=function(t,r){var n=t.options,a=!n.semicolons||n.semicolons===e.SemicolonPreference.Ignore,o=n.semicolons===e.SemicolonPreference.Remove||a&&!Ue(r);return i$1(i$1({},n),{semicolons:o?e.SemicolonPreference.Remove:e.SemicolonPreference.Ignore})},e.jsxModeNeedsExplicitImport=function(e){return 2===e||3===e};}(t),function(e){function t(t){var r,n=1,i=e.createMultiMap(),a=new e.Map,o=new e.Map,s={isUsableByFile:function(e){return e===r},isEmpty:function(){return !i.size},clear:function(){i.clear(),a.clear(),r=void 0;},add:function(t,c,l,u,_,d,p,f){var g;if(t!==r&&(s.clear(),r=t),_){var m=e.getNodeModulePathParts(_.fileName);if(m){var y=m.topLevelNodeModulesIndex,v=m.topLevelPackageNameIndex,h=m.packageRootIndex;if(g=e.unmangleScopedPackageName(e.getPackageNameFromTypesPackageName(_.fileName.substring(v+1,h))),e.startsWith(t,_.path.substring(0,y))){var b=o.get(g),x=_.fileName.substring(0,v+1);b?y>b.indexOf(e.nodeModulesPathPart)&&o.set(g,x):o.set(g,x);}}}var D=1===d&&e.getLocalSymbolForExportDefault(c)||c,S=0===d||e.isExternalModuleSymbol(D)?e.unescapeLeadingUnderscores(l):e.getNamesForExportedSymbol(D,void 0),T="string"==typeof S?S:S[0],C="string"==typeof S?void 0:S[1],k=e.stripQuotes(u.name),E=n++,N=e.skipAlias(c,f),F=33554432&c.flags?void 0:c,A=33554432&u.flags?void 0:u;F&&A||a.set(E,[c,u]),i.add(function(t,r,n,i){var a=n||"";return "".concat(t,"|").concat(e.getSymbolId(e.skipAlias(r,i)),"|").concat(a)}(T,c,e.isExternalModuleNameRelative(k)?void 0:k,f),{id:E,symbolTableKey:l,symbolName:T,capitalizedSymbolName:C,moduleName:k,moduleFile:_,moduleFileName:null==_?void 0:_.fileName,packageName:g,exportKind:d,targetFlags:N.flags,isFromPackageJson:p,symbol:F,moduleSymbol:A});},get:function(e,t){if(e===r){var n=i.get(t);return null==n?void 0:n.map(c)}},search:function(n,a,s,l){n===r&&i.forEach((function(r,n){var i=function(e){var t=e.substring(0,e.indexOf("|")),r=e.substring(e.lastIndexOf("|")+1);return {symbolName:t,ambientModuleName:""===r?void 0:r}}(n),u=i.symbolName,_=i.ambientModuleName,d=a&&r[0].capitalizedSymbolName||u;if(s(d,r[0].targetFlags)){var p=r.map(c).filter((function(n,i){return function(r,n){if(!n||!r.moduleFileName)return !0;var i=t.getGlobalTypingsCacheLocation();if(i&&e.startsWith(r.moduleFileName,i))return !0;var a=o.get(n);return !a||e.startsWith(r.moduleFileName,a)}(n,r[i].packageName)}));p.length&&l(p,d,!!_,n);}}));},releaseSymbols:function(){a.clear();},onFileChanged:function(t,n,i){return !(l(t)&&l(n)||(r&&r!==n.path||i&&e.consumesNodeCoreModules(t)!==e.consumesNodeCoreModules(n)||!e.arrayIsEqualTo(t.moduleAugmentations,n.moduleAugmentations)||!function(t,r){if(!e.arrayIsEqualTo(t.ambientModuleNames,r.ambientModuleNames))return !1;for(var n=-1,i=-1,a=function(a){var o=function(t){return e.isNonGlobalAmbientModule(t)&&t.name.text===a};if(n=e.findIndex(t.statements,o,n+1),i=e.findIndex(r.statements,o,i+1),t.statements[n]!==r.statements[i])return {value:!1}},o=0,s=r.ambientModuleNames;o<s.length;o++){var c=a(s[o]);if("object"==typeof c)return c.value}return !0}(t,n)?(s.clear(),0):(r=n.path,1)))}};return e.Debug.isDebugging&&Object.defineProperty(s,"__cache",{get:function(){return i}}),s;function c(r){if(r.symbol&&r.moduleSymbol)return r;var n=r.id,i=r.exportKind,o=r.targetFlags,s=r.isFromPackageJson,c=r.moduleFileName,l=a.get(n)||e.emptyArray,u=l[0],_=l[1];if(u&&_)return {symbol:u,moduleSymbol:_,moduleFileName:c,exportKind:i,targetFlags:o,isFromPackageJson:s};var d=(s?t.getPackageJsonAutoImportProvider():t.getCurrentProgram()).getTypeChecker(),p=r.moduleSymbol||_||e.Debug.checkDefined(r.moduleFile?d.getMergedSymbol(r.moduleFile.symbol):d.tryFindAmbientModule(r.moduleName)),f=r.symbol||u||e.Debug.checkDefined(2===i?d.resolveExternalModuleSymbol(p):d.tryGetMemberInModuleExportsAndProperties(e.unescapeLeadingUnderscores(r.symbolTableKey),p),"Could not find symbol '".concat(r.symbolName,"' by key '").concat(r.symbolTableKey,"' in module ").concat(p.name));return a.set(n,[f,p]),{symbol:f,moduleSymbol:p,moduleFileName:c,exportKind:i,targetFlags:o,isFromPackageJson:s}}function l(e){return !(e.commonJsModuleIndicator||e.externalModuleIndicator||e.moduleAugmentations||e.ambientModuleNames)}}function r(t,r,i,a){var o,s;n(t.getTypeChecker(),t.getSourceFiles(),(function(e,r){return a(e,r,t,!1)}));var c=i&&(null===(o=r.getPackageJsonAutoImportProvider)||void 0===o?void 0:o.call(r));if(c){var l=e.timestamp();n(c.getTypeChecker(),c.getSourceFiles(),(function(e,t){return a(e,t,c,!0)})),null===(s=r.log)||void 0===s||s.call(r,"forEachExternalModuleToImportFrom autoImportProvider: ".concat(e.timestamp()-l));}}function n(t,r,n){for(var i=0,a=t.getAmbientModules();i<a.length;i++){var o=a[i];e.stringContains(o.name,"*")||n(o,void 0);}for(var s=0,c=r;s<c.length;s++){var l=c[s];e.isExternalOrCommonJsModule(l)&&n(t.getMergedSymbol(l.symbol),l);}}function a(e,t,r){var n=function(e,t){var r=t.resolveExternalModuleSymbol(e);if(r!==e)return {symbol:r,exportKind:2};var n=t.tryGetMemberInModuleExports("default",e);return n?{symbol:n,exportKind:1}:void 0}(e,t);if(n){var a=n.symbol,o=n.exportKind,c=s(a,t,r);return c&&i$1({symbol:a,exportKind:o},c)}}function o(t,r){return !(r.isUndefinedSymbol(t)||r.isUnknownSymbol(t)||e.isKnownSymbol(t)||e.isPrivateIdentifierSymbol(t))}function s(t,r,n){var i=e.getLocalSymbolForExportDefault(t);if(i)return {symbolForMeaning:i,name:i.name};var a,o=(a=t).declarations&&e.firstDefined(a.declarations,(function(t){var r;return e.isExportAssignment(t)?null===(r=e.tryCast(e.skipOuterExpressions(t.expression),e.isIdentifier))||void 0===r?void 0:r.text:e.isExportSpecifier(t)?(e.Debug.assert("default"===t.name.text,"Expected the specifier to be a default export"),t.propertyName&&t.propertyName.text):void 0}));if(void 0!==o)return {symbolForMeaning:t,name:o};if(2097152&t.flags){var c=r.getImmediateAliasedSymbol(t);if(c&&c.parent)return s(c,r,n)}return "default"!==t.escapedName&&"export="!==t.escapedName?{symbolForMeaning:t,name:t.getName()}:{symbolForMeaning:t,name:e.getNameForExportedSymbol(t,n.target)}}var c,l;(l=e.ImportKind||(e.ImportKind={}))[l.Named=0]="Named",l[l.Default=1]="Default",l[l.Namespace=2]="Namespace",l[l.CommonJS=3]="CommonJS",(c=e.ExportKind||(e.ExportKind={}))[c.Named=0]="Named",c[c.Default=1]="Default",c[c.ExportEquals=2]="ExportEquals",c[c.UMD=3]="UMD",e.createCacheableExportInfoMap=t,e.isImportableFile=function(t,r,n,i,a,o,s){var c;if(r===n)return !1;var l=null==s?void 0:s.get(r.path,n.path,i,{});if(void 0!==(null==l?void 0:l.isBlockedByPackageJsonDependencies))return !l.isBlockedByPackageJsonDependencies;var u=e.hostGetCanonicalFileName(o),_=null===(c=o.getGlobalTypingsCacheLocation)||void 0===c?void 0:c.call(o),d=!!e.moduleSpecifiers.forEachFileNameOfModule(r.fileName,n.fileName,o,!1,(function(i){var a=t.getSourceFile(i);return (a===n||!a)&&function(t,r,n,i){var a=e.forEachAncestorDirectory(r,(function(t){return "node_modules"===e.getBaseFileName(t)?t:void 0})),o=a&&e.getDirectoryPath(n(a));return void 0===o||e.startsWith(n(t),o)||!!i&&e.startsWith(n(i),o)}(r.fileName,i,u,_)}));if(a){var p=d&&a.allowsImportingSourceFile(n,o);return null==s||s.setBlockedByPackageJsonDependencies(r.path,n.path,i,{},!p),p}return d},e.forEachExternalModuleToImportFrom=r,e.getExportInfoMap=function(n,i,s,c){var l,u,_,d,p,f=e.timestamp();null===(l=i.getPackageJsonAutoImportProvider)||void 0===l||l.call(i);var g=(null===(u=i.getCachedExportInfoMap)||void 0===u?void 0:u.call(i))||t({getCurrentProgram:function(){return s},getPackageJsonAutoImportProvider:function(){var e;return null===(e=i.getPackageJsonAutoImportProvider)||void 0===e?void 0:e.call(i)},getGlobalTypingsCacheLocation:function(){var e;return null===(e=i.getGlobalTypingsCacheLocation)||void 0===e?void 0:e.call(i)}});if(g.isUsableByFile(n.path))return null===(_=i.log)||void 0===_||_.call(i,"getExportInfoMap: cache hit"),g;null===(d=i.log)||void 0===d||d.call(i,"getExportInfoMap: cache miss or empty; calculating new results");var m=s.getCompilerOptions(),y=0;try{r(s,i,!0,(function(t,r,i,s){++y%100==0&&(null==c||c.throwIfCancellationRequested());var l=new e.Map,u=i.getTypeChecker(),_=a(t,u,m);_&&o(_.symbol,u)&&g.add(n.path,_.symbol,1===_.exportKind?"default":"export=",t,r,_.exportKind,s,u),u.forEachExportAndPropertyOfModule(t,(function(i,a){i!==(null==_?void 0:_.symbol)&&o(i,u)&&e.addToSeen(l,a)&&g.add(n.path,i,a,t,r,0,s,u);}));}));}catch(e){throw g.clear(),e}return null===(p=i.log)||void 0===p||p.call(i,"getExportInfoMap: done in ".concat(e.timestamp()-f," ms")),g},e.getDefaultLikeExportInfo=a;}(t),function(e){e.createClassifier=function(){var o=e.createScanner(99,!1);function s(i,s,c){var l=0,u=0,_=[],d=function(t){switch(t){case 3:return {prefix:'"\\\n'};case 2:return {prefix:"'\\\n"};case 1:return {prefix:"/*\n"};case 4:return {prefix:"`\n"};case 5:return {prefix:"}\n",pushTemplate:!0};case 6:return {prefix:"",pushTemplate:!0};case 0:return {prefix:""};default:return e.Debug.assertNever(t)}}(s),p=d.prefix,f=d.pushTemplate;i=p+i;var g=p.length;f&&_.push(15),o.setText(i);var m=0,y=[],v=0;do{l=o.scan(),e.isTrivia(l)||(x(),u=l);var h=o.getTextPos();if(n(o.getTokenPos(),h,g,a(l),y),h>=i.length){var b=r(o,l,e.lastOrUndefined(_));void 0!==b&&(m=b);}}while(1!==l);function x(){switch(l){case 43:case 68:t[u]||13!==o.reScanSlashToken()||(l=13);break;case 29:79===u&&v++;break;case 31:v>0&&v--;break;case 130:case 150:case 147:case 133:case 151:v>0&&!c&&(l=79);break;case 15:_.push(l);break;case 18:_.length>0&&_.push(l);break;case 19:if(_.length>0){var r=e.lastOrUndefined(_);15===r?17===(l=o.reScanTemplateToken(!1))?_.pop():e.Debug.assertEqual(l,16,"Should have been a template middle."):(e.Debug.assertEqual(r,18,"Should have been an open brace"),_.pop());}break;default:if(!e.isKeyword(l))break;(24===u||e.isKeyword(u)&&e.isKeyword(l)&&!function(t,r){if(!e.isAccessibilityModifier(t))return !0;switch(r){case 136:case 149:case 134:case 124:return !0;default:return !1}}(u,l))&&(l=79);}}return {endOfLineState:m,spans:y}}return {getClassificationsForLine:function(t,r,n){return function(t,r){for(var n=[],a=t.spans,o=0,s=0;s<a.length;s+=3){var c=a[s],l=a[s+1],u=a[s+2];if(o>=0){var _=c-o;_>0&&n.push({length:_,classification:e.TokenClass.Whitespace});}n.push({length:l,classification:i(u)}),o=c+l;}var d=r.length-o;return d>0&&n.push({length:d,classification:e.TokenClass.Whitespace}),{entries:n,finalLexState:t.endOfLineState}}(s(t,r,n),t)},getEncodedLexicalClassifications:s}};var t=e.arrayToNumericMap([79,10,8,9,13,108,45,46,21,23,19,110,95],(function(e){return e}),(function(){return !0}));function r(t,r,n){switch(r){case 10:if(!t.isUnterminated())return;for(var i=t.getTokenText(),a=i.length-1,o=0;92===i.charCodeAt(a-o);)o++;if(0==(1&o))return;return 34===i.charCodeAt(0)?3:2;case 3:return t.isUnterminated()?1:void 0;default:if(e.isTemplateLiteralKind(r)){if(!t.isUnterminated())return;switch(r){case 17:return 5;case 14:return 4;default:return e.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #"+r)}}return 15===n?6:void 0}}function n(e,t,r,n,i){if(8!==n){0===e&&r>0&&(e+=r);var a=t-e;a>0&&i.push(e-r,a,n);}}function i(t){switch(t){case 1:return e.TokenClass.Comment;case 3:return e.TokenClass.Keyword;case 4:return e.TokenClass.NumberLiteral;case 25:return e.TokenClass.BigIntLiteral;case 5:return e.TokenClass.Operator;case 6:return e.TokenClass.StringLiteral;case 8:return e.TokenClass.Whitespace;case 10:return e.TokenClass.Punctuation;case 2:case 11:case 12:case 13:case 14:case 15:case 16:case 9:case 17:return e.TokenClass.Identifier;default:return}}function a(t){if(e.isKeyword(t))return 3;if(function(e){switch(e){case 41:case 43:case 44:case 39:case 40:case 47:case 48:case 49:case 29:case 31:case 32:case 33:case 102:case 101:case 127:case 34:case 35:case 36:case 37:case 50:case 52:case 51:case 55:case 56:case 74:case 73:case 78:case 70:case 71:case 72:case 64:case 65:case 66:case 68:case 69:case 63:case 27:case 60:case 75:case 76:case 77:return !0;default:return !1}}(t)||function(e){switch(e){case 39:case 40:case 54:case 53:case 45:case 46:return !0;default:return !1}}(t))return 5;if(t>=18&&t<=78)return 10;switch(t){case 8:return 4;case 9:return 25;case 10:return 6;case 13:return 7;case 7:case 3:case 2:return 1;case 5:case 4:return 8;case 79:default:return e.isTemplateLiteralKind(t)?6:2}}function o(e,t){switch(t){case 261:case 257:case 258:case 256:case 226:case 213:case 214:e.throwIfCancellationRequested();}}function s(t,r,n,i,a){var s=[];return n.forEachChild((function l(u){if(u&&e.textSpanIntersectsWith(a,u.pos,u.getFullWidth())){if(o(r,u.kind),e.isIdentifier(u)&&!e.nodeIsMissing(u)&&i.has(u.escapedText)){var _=t.getSymbolAtLocation(u),d=_&&c(_,e.getMeaningFromLocation(u),t);d&&function(t,r,n){var i=r-t;e.Debug.assert(i>0,"Classification had non-positive length of ".concat(i)),s.push(t),s.push(i),s.push(n);}(u.getStart(n),u.getEnd(),d);}u.forEachChild(l);}})),{spans:s,endOfLineState:0}}function c(t,r,n){var i=t.getFlags();return 0==(2885600&i)?void 0:32&i?11:384&i?12:524288&i?16:1536&i?4&r||1&r&&function(t){return e.some(t.declarations,(function(t){return e.isModuleDeclaration(t)&&1===e.getModuleInstanceState(t)}))}(t)?14:void 0:2097152&i?c(n.getAliasedSymbol(t),r,n):2&r?64&i?13:262144&i?15:void 0:void 0}function l(e){switch(e){case 1:return "comment";case 2:return "identifier";case 3:return "keyword";case 4:return "number";case 25:return "bigint";case 5:return "operator";case 6:return "string";case 8:return "whitespace";case 9:return "text";case 10:return "punctuation";case 11:return "class name";case 12:return "enum name";case 13:return "interface name";case 14:return "module name";case 15:return "type parameter name";case 16:return "type alias name";case 17:return "parameter name";case 18:return "doc comment tag name";case 19:return "jsx open tag name";case 20:return "jsx close tag name";case 21:return "jsx self closing tag name";case 22:return "jsx attribute";case 23:return "jsx text";case 24:return "jsx attribute string literal value";default:return}}function u(t){e.Debug.assert(t.spans.length%3==0);for(var r=t.spans,n=[],i=0;i<r.length;i+=3)n.push({textSpan:e.createTextSpan(r[i],r[i+1]),classificationType:l(r[i+2])});return n}function _(t,r,n){var i=n.start,a=n.length,s=e.createScanner(99,!1,r.languageVariant,r.text),c=e.createScanner(99,!1,r.languageVariant,r.text),l=[];return v(r),{spans:l,endOfLineState:0};function u(e,t,r){l.push(e),l.push(t),l.push(r);}function _(t,n,i,a){if(3===n){var o=e.parseIsolatedJSDocComment(r.text,i,a);if(o&&o.jsDoc)return e.setParent(o.jsDoc,t),void function(e){var t,r,n,i,a,o,s,c=e.pos;if(e.tags)for(var l=0,_=e.tags;l<_.length;l++){var f=_[l];f.pos!==c&&d(c,f.pos-c),u(f.pos,1,10),u(f.tagName.pos,f.tagName.end-f.tagName.pos,18),c=f.tagName.end;var g=f.tagName.end;switch(f.kind){case 340:var m=f;b(m),g=m.isNameFirst&&(null===(t=m.typeExpression)||void 0===t?void 0:t.end)||m.name.end;break;case 347:var y=f;g=y.isNameFirst&&(null===(r=y.typeExpression)||void 0===r?void 0:r.end)||y.name.end;break;case 344:p(f),c=f.end,g=f.typeParameters.end;break;case 345:var h=f;g=309===(null===(n=h.typeExpression)||void 0===n?void 0:n.kind)&&(null===(i=h.fullName)||void 0===i?void 0:i.end)||(null===(a=h.typeExpression)||void 0===a?void 0:a.end)||g;break;case 338:g=f.typeExpression.end;break;case 343:v(f.typeExpression),c=f.end,g=f.typeExpression.end;break;case 342:case 339:g=f.typeExpression.end;break;case 341:v(f.typeExpression),c=f.end,g=(null===(o=f.typeExpression)||void 0===o?void 0:o.end)||g;break;case 346:g=(null===(s=f.name)||void 0===s?void 0:s.end)||g;break;case 328:case 329:g=f.class.end;}"object"==typeof f.comment?d(f.comment.pos,f.comment.end-f.comment.pos):"string"==typeof f.comment&&d(g,f.end-g);}return void(c!==e.end&&d(c,e.end-c));function b(e){e.isNameFirst&&(d(c,e.name.pos-c),u(e.name.pos,e.name.end-e.name.pos,17),c=e.name.end),e.typeExpression&&(d(c,e.typeExpression.pos-c),v(e.typeExpression),c=e.typeExpression.end),e.isNameFirst||(d(c,e.name.pos-c),u(e.name.pos,e.name.end-e.name.pos,17),c=e.name.end);}}(o.jsDoc)}else if(2===n&&function(t,n){var i=/(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/gim,a=r.text.substr(t,n),o=/^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im.exec(a);if(!o)return !1;if(!o[3]||!(o[3]in e.commentPragmas))return !1;var s=t;d(s,o[1].length),u(s+=o[1].length,o[2].length,10),u(s+=o[2].length,o[3].length,21),s+=o[3].length;for(var c=o[4],l=s;;){var _=i.exec(c);if(!_)break;var p=s+_.index+_[1].length;p>l&&(d(l,p-l),l=p),u(l,_[2].length,22),l+=_[2].length,_[3].length&&(d(l,_[3].length),l+=_[3].length),u(l,_[4].length,5),l+=_[4].length,_[5].length&&(d(l,_[5].length),l+=_[5].length),u(l,_[6].length,24),l+=_[6].length;}(s+=o[4].length)>l&&d(l,s-l),o[5]&&(u(s,o[5].length,10),s+=o[5].length);var f=t+n;return s<f&&d(s,f-s),!0}(i,a))return;d(i,a);}function d(e,t){u(e,t,1);}function p(e){for(var t=0,r=e.getChildren();t<r.length;t++)v(r[t]);}function f(t,r,n){var i;for(i=r;i<n&&!e.isLineBreak(t.charCodeAt(i));i++);for(u(r,i-r,1),c.setTextPos(i);c.getTextPos()<n;)g();}function g(){var e=c.getTextPos(),t=c.scan(),r=c.getTextPos(),n=y(t);n&&u(e,r-e,n);}function m(t){if(e.isJSDoc(t))return !0;if(e.nodeIsMissing(t))return !0;var n=function(e){switch(e.parent&&e.parent.kind){case 280:if(e.parent.tagName===e)return 19;break;case 281:if(e.parent.tagName===e)return 20;break;case 279:if(e.parent.tagName===e)return 21;break;case 285:if(e.parent.name===e)return 22}}(t);if(!e.isToken(t)&&11!==t.kind&&void 0===n)return !1;var i=11===t.kind?t.pos:function(t){for(s.setTextPos(t.pos);;){var n=s.getTextPos();if(!e.couldStartTrivia(r.text,n))return n;var i=s.scan(),a=s.getTextPos(),o=a-n;if(!e.isTrivia(i))return n;switch(i){case 4:case 5:continue;case 2:case 3:_(t,i,n,o),s.setTextPos(a);continue;case 7:var c=r.text,l=c.charCodeAt(n);if(60===l||62===l){u(n,o,1);continue}e.Debug.assert(124===l||61===l),f(c,n,a);break;case 6:break;default:e.Debug.assertNever(i);}}}(t),a=t.end-i;if(e.Debug.assert(a>=0),a>0){var o=n||y(t.kind,t);o&&u(i,a,o);}return !0}function y(t,r){if(e.isKeyword(t))return 3;if((29===t||31===t)&&r&&e.getTypeArgumentOrTypeParameterList(r.parent))return 10;if(e.isPunctuation(t)){if(r){var n=r.parent;if(63===t&&(254===n.kind||167===n.kind||164===n.kind||285===n.kind))return 5;if(221===n.kind||219===n.kind||220===n.kind||222===n.kind)return 5}return 10}if(8===t)return 4;if(9===t)return 25;if(10===t)return r&&285===r.parent.kind?24:6;if(13===t)return 6;if(e.isTemplateLiteralKind(t))return 6;if(11===t)return 23;if(79===t){if(r){switch(r.parent.kind){case 257:return r.parent.name===r?11:void 0;case 163:return r.parent.name===r?15:void 0;case 258:return r.parent.name===r?13:void 0;case 260:return r.parent.name===r?12:void 0;case 261:return r.parent.name===r?14:void 0;case 164:return r.parent.name===r?e.isThisIdentifier(r)?3:17:void 0}if(e.isConstTypeReference(r.parent))return 3}return 2}}function v(n){if(n&&e.decodedTextSpanIntersectsWith(i,a,n.pos,n.getFullWidth())){o(t,n.kind);for(var s=0,c=n.getChildren(r);s<c.length;s++){var l=c[s];m(l)||v(l);}}}}e.getSemanticClassifications=function(e,t,r,n,i){return u(s(e,t,r,n,i))},e.getEncodedSemanticClassifications=s,e.getSyntacticClassifications=function(e,t,r){return u(_(e,t,r))},e.getEncodedSyntacticClassifications=_;}(t),function(e){var t;(function(t){function r(e,t,r,i){return {spans:n(e,r,i,t),endOfLineState:0}}function n(t,r,n,o){var s=[];return t&&r&&function(t,r,n,o,s){var c=t.getTypeChecker(),u=!1;!function _(d){switch(d.kind){case 261:case 257:case 258:case 256:case 226:case 213:case 214:s.throwIfCancellationRequested();}if(d&&e.textSpanIntersectsWith(n,d.pos,d.getFullWidth())&&0!==d.getFullWidth()){var p=u;if((e.isJsxElement(d)||e.isJsxSelfClosingElement(d))&&(u=!0),e.isJsxExpression(d)&&(u=!1),e.isIdentifier(d)&&!u&&!function(t){var r=t.parent;return r&&(e.isImportClause(r)||e.isImportSpecifier(r)||e.isNamespaceImport(r))}(d)&&!e.isInfinityOrNaNString(d.escapedText)){var f=c.getSymbolAtLocation(d);if(f){2097152&f.flags&&(f=c.getAliasedSymbol(f));var g=function(t,r){var n=t.getFlags();if(32&n)return 0;if(384&n)return 1;if(524288&n)return 5;if(64&n){if(2&r)return 2}else if(262144&n)return 4;var a=t.valueDeclaration||t.declarations&&t.declarations[0];return a&&e.isBindingElement(a)&&(a=i(a)),a&&l.get(a.kind)}(f,e.getMeaningFromLocation(d));if(void 0!==g){var m=0;d.parent&&(e.isBindingElement(d.parent)||l.get(d.parent.kind)===g)&&d.parent.name===d&&(m=1),6===g&&a(d)&&(g=9),g=function(t,r,n){if(7===n||9===n||6===n){var i=t.getTypeAtLocation(r);if(i){var o=function(e){return e(i)||i.isUnion()&&i.types.some(e)};if(6!==n&&o((function(e){return e.getConstructSignatures().length>0})))return 0;if(o((function(e){return e.getCallSignatures().length>0}))&&!o((function(e){return e.getProperties().length>0}))||function(t){for(;a(t);)t=t.parent;return e.isCallExpression(t.parent)&&t.parent.expression===t}(r))return 9===n?11:10}}return n}(c,d,g);var y=f.valueDeclaration;if(y){var v=e.getCombinedModifierFlags(y),h=e.getCombinedNodeFlags(y);32&v&&(m|=2),256&v&&(m|=4),0!==g&&2!==g&&(64&v||2&h||8&f.getFlags())&&(m|=8),7!==g&&10!==g||!function(t,r){return e.isBindingElement(t)&&(t=i(t)),e.isVariableDeclaration(t)?(!e.isSourceFile(t.parent.parent.parent)||e.isCatchClause(t.parent))&&t.getSourceFile()===r:!!e.isFunctionDeclaration(t)&&!e.isSourceFile(t.parent)&&t.getSourceFile()===r}(y,r)||(m|=32),t.isSourceFileDefaultLibrary(y.getSourceFile())&&(m|=16);}else f.declarations&&f.declarations.some((function(e){return t.isSourceFileDefaultLibrary(e.getSourceFile())}))&&(m|=16);o(d,g,m);}}}e.forEachChild(d,_),u=p;}}(r);}(t,r,n,(function(e,t,n){s.push(e.getStart(r),e.getWidth(r),(t+1<<8)+n);}),o),s}function i(t){for(;;){if(!e.isBindingElement(t.parent.parent))return t.parent.parent;t=t.parent.parent;}}function a(t){return e.isQualifiedName(t.parent)&&t.parent.right===t||e.isPropertyAccessExpression(t.parent)&&t.parent.name===t}var o,s,c;(c=t.TokenEncodingConsts||(t.TokenEncodingConsts={}))[c.typeOffset=8]="typeOffset",c[c.modifierMask=255]="modifierMask",(s=t.TokenType||(t.TokenType={}))[s.class=0]="class",s[s.enum=1]="enum",s[s.interface=2]="interface",s[s.namespace=3]="namespace",s[s.typeParameter=4]="typeParameter",s[s.type=5]="type",s[s.parameter=6]="parameter",s[s.variable=7]="variable",s[s.enumMember=8]="enumMember",s[s.property=9]="property",s[s.function=10]="function",s[s.member=11]="member",(o=t.TokenModifier||(t.TokenModifier={}))[o.declaration=0]="declaration",o[o.static=1]="static",o[o.async=2]="async",o[o.readonly=3]="readonly",o[o.defaultLibrary=4]="defaultLibrary",o[o.local=5]="local",t.getSemanticClassifications=function(t,n,i,a){var o=r(t,n,i,a);e.Debug.assert(o.spans.length%3==0);for(var s=o.spans,c=[],l=0;l<s.length;l+=3)c.push({textSpan:e.createTextSpan(s[l],s[l+1]),classificationType:s[l+2]});return c},t.getEncodedSemanticClassifications=r;var l=new e.Map([[254,7],[164,6],[167,9],[261,3],[260,1],[299,8],[257,0],[169,11],[256,10],[213,10],[168,11],[172,9],[173,9],[166,9],[258,2],[259,5],[163,4],[296,9],[297,9]]);})((t=e.classifier||(e.classifier={})).v2020||(t.v2020={}));}(t),function(e){var t;(function(r){function i(e){return {isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:!0,entries:e.map((function(e){var r=e.name,n=e.kind,i=e.span;return {name:r,kind:n,kindModifiers:a(e.extension),sortText:t.SortText.LocationPriority,replacementSpan:i}}))}}function a(t){switch(t){case".d.ts":return ".d.ts";case".js":return ".js";case".json":return ".json";case".jsx":return ".jsx";case".ts":return ".ts";case".tsx":return ".tsx";case".d.mts":return ".d.mts";case".mjs":return ".mjs";case".mts":return ".mts";case".d.cts":return ".d.cts";case".cjs":return ".cjs";case".cts":return ".cts";case".tsbuildinfo":return e.Debug.fail("Extension ".concat(".tsbuildinfo"," is unsupported."));case void 0:return "";default:return e.Debug.assertNever(t)}}var o,s;function c(r,n,i,a,o,s,c){var d,p,f=l(n.parent);switch(f.kind){case 196:var m=l(f.parent);switch(m.kind){case 178:var y=m,v=e.findAncestor(f,(function(e){return e.parent===y}));return v?{kind:2,types:_(a.getTypeArgumentConstraint(v)),isNewIdentifier:!1}:void 0;case 194:var h=m,b=h.indexType,x=h.objectType;if(!e.rangeContainsPosition(b,i))return;return u(a.getTypeFromTypeNode(x));case 200:return {kind:0,paths:g(r,n,o,s,a,c)};case 187:if(!e.isTypeReferenceNode(m.parent))return;var D=(d=m,p=f,e.mapDefined(d.types,(function(t){return t!==p&&e.isLiteralTypeNode(t)&&e.isStringLiteral(t.literal)?t.literal.text:void 0})));return {kind:2,types:_(a.getTypeArgumentConstraint(m)).filter((function(t){return !e.contains(D,t.value)})),isNewIdentifier:!1};default:return}case 296:return e.isObjectLiteralExpression(f.parent)&&f.name===n?function(r,n){var i=r.getContextualType(n);if(i){var a=r.getContextualType(n,4);return {kind:1,symbols:t.getPropertiesForObjectExpression(i,a,n,r),hasIndexSignature:e.hasIndexSignature(i)}}}(a,f.parent):E();case 207:var S=f,T=S.expression,C=S.argumentExpression;return n===e.skipParentheses(C)?u(a.getTypeAtLocation(T)):void 0;case 208:case 209:case 285:if(!function(t){return e.isCallExpression(t.parent)&&e.firstOrUndefined(t.parent.arguments)===t&&e.isIdentifier(t.parent.expression)&&"require"===t.parent.expression.escapedText}(n)&&!e.isImportCall(f)){var k=e.SignatureHelp.getArgumentInfoForCompletions(285===f.kind?f.parent:n,i,r);return k?function(t,r,n,i){var a=!1,o=new e.Map,s=[],c=e.isJsxOpeningLikeElement(t)?e.Debug.checkDefined(e.findAncestor(r.parent,e.isJsxAttribute)):r;return i.getResolvedSignatureForStringLiteralCompletions(t,c,s),{kind:2,types:e.flatMap(s,(function(r){if(e.signatureHasRestParameter(r)||!(n.argumentCount>r.parameters.length)){var s=r.getTypeParameterAtPosition(n.argumentIndex);if(e.isJsxOpeningLikeElement(t)){var l=i.getTypeOfPropertyOfType(s,c.name.text);l&&(s=l);}return a=a||!!(4&s.flags),_(s,o)}})),isNewIdentifier:a}}(k.invocation,n,k,a):E()}case 266:case 272:case 277:return {kind:0,paths:g(r,n,o,s,a,c)};default:return E()}function E(){return {kind:2,types:_(e.getContextualTypeFromParent(n,a)),isNewIdentifier:!1}}}function l(t){switch(t.kind){case 191:return e.walkUpParenthesizedTypes(t);case 212:return e.walkUpParenthesizedExpressions(t);default:return t}}function u(t){return t&&{kind:1,symbols:e.filter(t.getApparentProperties(),(function(t){return !(t.valueDeclaration&&e.isPrivateIdentifierClassElementDeclaration(t.valueDeclaration))})),hasIndexSignature:e.hasIndexSignature(t)}}function _(t,r){return void 0===r&&(r=new e.Map),t?(t=e.skipConstraint(t)).isUnion()?e.flatMap(t.types,(function(e){return _(e,r)})):!t.isStringLiteral()||1024&t.flags||!e.addToSeen(r,t.value)?e.emptyArray:[t]:e.emptyArray}function d(e,t,r){return {name:e,kind:t,extension:r}}function p(e){return d(e,"directory",void 0)}function f(t,r,n){var i=function(t,r){var n=Math.max(t.lastIndexOf(e.directorySeparator),t.lastIndexOf(e.altDirectorySeparator)),i=-1!==n?n+1:0,a=t.length-i;return 0===a||e.isIdentifierText(t.substr(i,a),99)?void 0:e.createTextSpan(r+i,a)}(t,r),a=0===t.length?void 0:e.createTextSpan(r,t.length);return n.map((function(t){var r=t.name,n=t.kind,o=t.extension;return -1!==Math.max(r.indexOf(e.directorySeparator),r.indexOf(e.altDirectorySeparator))?{name:r,kind:n,extension:o,span:a}:{name:r,kind:n,extension:o,span:i}}))}function g(t,r,i,a,o,s){return f(r.text,r.getStart(t)+1,function(t,r,i,a,o,s){var c,l=e.normalizeSlashes(r.text),u=t.path,_=e.getDirectoryPath(u);return function(e){if(e&&e.length>=2&&46===e.charCodeAt(0)){var t=e.length>=3&&46===e.charCodeAt(1)?2:1,r=e.charCodeAt(t);return 47===r||92===r}return !1}(l)||!i.baseUrl&&(e.isRootedDiskPath(l)||e.isUrl(l))?function(t,r,i,a,o,s){var c=m(i,s);return i.rootDirs?function(t,r,i,a,o,s,c){var l=function(t,r,i,a){t=t.map((function(t){return e.normalizePath(e.isRootedDiskPath(t)?t:e.combinePaths(r,t))}));var o=e.firstDefined(t,(function(t){return e.containsPath(t,i,r,a)?i.substr(t.length):void 0}));return e.deduplicate(n$4(n$4([],t.map((function(t){return e.combinePaths(t,o)})),!0),[i],!1),e.equateStringsCaseSensitive,e.compareStringsCaseSensitive)}(t,o.project||s.getCurrentDirectory(),i,!(s.useCaseSensitiveFileNames&&s.useCaseSensitiveFileNames()));return e.flatMap(l,(function(e){return h(r,e,a,s,c)}))}(i.rootDirs,t,r,c,i,a,o):h(t,r,c,a,o)}(l,_,i,a,u,(c=e.isStringLiteralLike(r)?e.getModeForUsageLocation(t,r):void 0,"js"===s.importModuleSpecifierEnding||c===e.ModuleKind.ESNext?2:0)):function(t,r,n,i,a){var o=n.baseUrl,s=n.paths,c=[],l=m(n);if(o){var u=n.project||i.getCurrentDirectory(),_=e.normalizePath(e.combinePaths(u,o));h(t,_,l,i,void 0,c),s&&b(c,t,_,l.extensions,s,i);}for(var p=x(t),f=0,g=function(t,r,n){var i=n.getAmbientModules().map((function(t){return e.stripQuotes(t.name)})).filter((function(r){return e.startsWith(r,t)}));if(void 0!==r){var a=e.ensureTrailingDirectorySeparator(r);return i.map((function(t){return e.removePrefix(t,a)}))}return i}(t,p,a);f<g.length;f++){var v=g[f];c.push(d(v,"external module name",void 0));}if(S(i,n,r,p,l,c),y(n)){var D=!1;if(void 0===p)for(var T=function(e){c.some((function(t){return t.name===e}))||(D=!0,c.push(d(e,"external module name",void 0)));},k=0,E=function(t,r){if(!t.readFile||!t.fileExists)return e.emptyArray;for(var n=[],i=0,a=e.findPackageJsons(r,t);i<a.length;i++)for(var o=a[i],s=e.readJson(o,t),c=0,l=C;c<l.length;c++){var u=s[l[c]];if(u)for(var _ in u)u.hasOwnProperty(_)&&!e.startsWith(_,"@types/")&&n.push(_);}return n}(i,r);k<E.length;k++)T(E[k]);if(!D){var N=function(r){var n=e.combinePaths(r,"node_modules");e.tryDirectoryExists(i,n)&&h(t,n,l,i,void 0,c);};if(p&&function(t){return e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.Node16||e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.NodeNext}(n)){var F=N;N=function(r){var n=e.getPathComponents(t);n.shift();var a=n.shift();if(!a)return F(r);if(e.startsWith(a,"@")){var o=n.shift();if(!o)return F(r);a=e.combinePaths(a,o);}var s=e.combinePaths(r,"node_modules",a,"package.json");if(e.tryFileExists(i,s)){var l=e.readJson(s,i).exports;if(l){if("object"!=typeof l||null===l)return;var u=e.getOwnKeys(l),_=n.join("/"),p=e.mapDefined(u,(function(t){if("."!==t&&e.startsWith(t,"./")){var r=t.substring(2);if(e.startsWith(r,_))return e.stringContains(r,"*")?r.slice(0,r.indexOf("*")):r}}));return void e.forEach(p,(function(e){e&&c.push(d(e,"external module name",void 0));}))}}return F(r)};}e.forEachAncestorDirectory(r,N);}}return c}(l,_,i,a,o)}(t,r,i,a,o,s))}function m(t,r){return void 0===r&&(r=0),{extensions:e.flatten(v(t)),includeExtensionsOption:r}}function y(t){return e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.NodeJs||e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.Node16||e.getEmitModuleResolutionKind(t)===e.ModuleResolutionKind.NodeNext}function v(t){var r=e.getSupportedExtensions(t);return y(t)?e.getSupportedExtensionsWithJsonIfResolveJsonModule(t,r):r}function h(t,r,n,i,a,o){var s=n.extensions,c=n.includeExtensionsOption;void 0===o&&(o=[]),void 0===t&&(t=""),t=e.normalizeSlashes(t),e.hasTrailingDirectorySeparator(t)||(t=e.getDirectoryPath(t)),""===t&&(t="."+e.directorySeparator),t=e.ensureTrailingDirectorySeparator(t);var l=e.resolvePath(r,t),u=e.hasTrailingDirectorySeparator(l)?l:e.getDirectoryPath(l),_=!(i.useCaseSensitiveFileNames&&i.useCaseSensitiveFileNames());if(!e.tryDirectoryExists(i,u))return o;var f=e.tryReadDirectory(i,u,s,void 0,["./*"]);if(f){for(var g=new e.Map,m=0,y=f;m<y.length;m++){var v=y[m];if(v=e.normalizePath(v),!a||0!==e.comparePaths(v,a,r,_)){var h=void 0,x=e.moduleSpecifiers.tryGetJSExtensionForFile(v,i.getCompilationSettings());0!==c||e.fileExtensionIsOneOf(v,[".json",".mts",".cts",".d.mts",".d.cts",".mjs",".cjs"])?(e.fileExtensionIsOneOf(v,[".mts",".cts",".d.mts",".d.cts",".mjs",".cjs"])||2===c)&&x?(h=e.changeExtension(e.getBaseFileName(v),x),g.set(h,x)):(h=e.getBaseFileName(v),g.set(h,e.tryGetExtensionFromPath(v))):(h=e.removeFileExtension(e.getBaseFileName(v)),g.set(h,e.tryGetExtensionFromPath(v)));}}g.forEach((function(e,t){o.push(d(t,"script",e));}));}var D=e.tryGetDirectories(i,u);if(D)for(var S=0,T=D;S<T.length;S++){var C=T[S],k=e.getBaseFileName(e.normalizePath(C));"@types"!==k&&o.push(p(k));}var E=e.findPackageJson(u,i);if(E){var N=e.readJson(E,i).typesVersions;if("object"==typeof N){var F=e.getPackageJsonTypesVersionsPaths(N),A=F&&F.paths,P=l.slice(e.ensureTrailingDirectorySeparator(u).length);A&&b(o,P,u,s,A,i);}}return o}function b(t,r,n,i,a,o){for(var s in a)if(e.hasProperty(a,s)){var c=a[s];if(c)for(var l=function(e,r,n){t.some((function(t){return t.name===e}))||t.push(d(e,r,n));},u=0,_=D(s,c,r,n,i,o);u<_.length;u++){var p=_[u];l(p.name,p.kind,p.extension);}}}function x(t){return k(t)?e.hasTrailingDirectorySeparator(t)?t:e.getDirectoryPath(t):void 0}function D(t,r,i,a,o,s){if(!e.endsWith(t,"*"))return e.stringContains(t,"*")?e.emptyArray:u(t);var c=t.slice(0,t.length-1),l=e.tryRemovePrefix(i,c);return void 0===l?u(c):e.flatMap(r,(function(t){return function(t,r,i,a,o){if(o.readDirectory){var s=e.tryParsePattern(i);if(void 0!==s&&!e.isString(s)){var c=e.resolvePath(s.prefix),l=e.hasTrailingDirectorySeparator(s.prefix)?c:e.getDirectoryPath(c),u=e.hasTrailingDirectorySeparator(s.prefix)?"":e.getBaseFileName(c),_=k(t),f=_?e.hasTrailingDirectorySeparator(t)?t:e.getDirectoryPath(t):void 0,g=_?e.combinePaths(l,u+f):l,m=e.normalizePath(s.suffix),y=e.normalizePath(e.combinePaths(r,g)),v=_?y:e.ensureTrailingDirectorySeparator(y)+u,h=m?"**/*":"./*",b=e.mapDefined(e.tryReadDirectory(o,y,a,void 0,[h]),(function(t){var r=e.tryGetExtensionFromPath(t),n=D(t);return void 0===n?void 0:d(e.removeFileExtension(n),"script",r)})),x=e.mapDefined(e.tryGetDirectories(o,y).map((function(t){return e.combinePaths(y,t)})),(function(e){var t=D(e);return void 0===t?void 0:p(t)}));return n$4(n$4([],b,!0),x,!0)}}function D(t){var r,n,i,a=(r=e.normalizePath(t),n=v,i=m,e.startsWith(r,n)&&e.endsWith(r,i)?r.slice(n.length,r.length-i.length):void 0);return void 0===a?void 0:function(t){return t[0]===e.directorySeparator?t.slice(1):t}(a)}}(l,a,t,o,s)}));function u(t){return e.startsWith(t,i)?[p(t)]:e.emptyArray}}function S(t,r,n,i,a,o){void 0===o&&(o=[]);for(var s=new e.Map,c=0,l=e.tryAndIgnoreErrors((function(){return e.getEffectiveTypeRoots(r,t)}))||e.emptyArray;c<l.length;c++)f(l[c]);for(var u=0,_=e.findPackageJsons(n,t);u<_.length;u++){var p=_[u];f(e.combinePaths(e.getDirectoryPath(p),"node_modules/@types"));}return o;function f(n){if(e.tryDirectoryExists(t,n))for(var c=0,l=e.tryGetDirectories(t,n);c<l.length;c++){var u=l[c],_=e.unmangleScopedPackageName(u);if(!r.types||e.contains(r.types,_))if(void 0===i)s.has(_)||(o.push(d(_,"external module name",void 0)),s.set(_,!0));else {var p=e.combinePaths(n,u),f=e.tryRemoveDirectoryPrefix(i,_,e.hostGetCanonicalFileName(t));void 0!==f&&h(f,p,a,t,void 0,o);}}}}r.getStringLiteralCompletions=function(r,n,a,o,s,l,u,_){if(e.isInReferenceComment(r,n))return (d=function(t,r,n,i){var a=e.getTokenAtPosition(t,r),o=e.getLeadingCommentRanges(t.text,a.pos),s=o&&e.find(o,(function(e){return r>=e.pos&&r<=e.end}));if(s){var c=t.text.slice(s.pos,r),l=T.exec(c);if(l){var u=l[1],_=l[2],d=l[3],p=e.getDirectoryPath(t.path),g="path"===_?h(d,p,m(n,1),i,t.path):"types"===_?S(i,n,p,x(d),m(n)):e.Debug.fail();return f(d,s.pos+u.length,g)}}}(r,n,o,s))&&i(d);if(e.isInString(r,n,a)){if(!a||!e.isStringLiteralLike(a))return;var d;return function(r,n,a,o,s,c,l,u){if(void 0!==r){var _=e.createTextSpanFromStringLiteralLikeContent(n);switch(r.kind){case 0:return i(r.paths);case 1:var d=e.createSortedArray();return t.getCompletionEntriesFromSymbols(r.symbols,d,n,n,a,a,o,s,99,c,4,u,l,void 0),{isGlobalCompletion:!1,isMemberCompletion:!0,isNewIdentifierLocation:r.hasIndexSignature,optionalReplacementSpan:_,entries:d};case 2:return d=r.types.map((function(r){return {name:r.value,kindModifiers:"",kind:"string",sortText:t.SortText.LocationPriority,replacementSpan:e.getReplacementSpanForContextToken(n)}})),{isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:r.isNewIdentifier,optionalReplacementSpan:_,entries:d};default:return e.Debug.assertNever(r)}}}(d=c(r,a,n,l.getTypeChecker(),o,s,_),a,r,s,l,u,o,_)}},r.getStringLiteralCompletionDetails=function(r,n,i,o,s,l,u,_,d){if(o&&e.isStringLiteralLike(o)){var p=c(n,o,i,s,l,u,d);return p&&function(r,n,i,o,s,c){switch(i.kind){case 0:return (l=e.find(i.paths,(function(e){return e.name===r})))&&t.createCompletionDetails(r,a(l.extension),l.kind,[e.textPart(r)]);case 1:var l;return (l=e.find(i.symbols,(function(e){return e.name===r})))&&t.createCompletionDetailsForSymbol(l,s,o,n,c);case 2:return e.find(i.types,(function(e){return e.value===r}))?t.createCompletionDetails(r,"","type",[e.textPart(r)]):void 0;default:return e.Debug.assertNever(i)}}(r,o,p,n,s,_)}},function(e){e[e.Paths=0]="Paths",e[e.Properties=1]="Properties",e[e.Types=2]="Types";}(o||(o={})),function(e){e[e.Exclude=0]="Exclude",e[e.Include=1]="Include",e[e.ModuleSpecifierCompletion=2]="ModuleSpecifierCompletion";}(s||(s={}));var T=/^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\3"]*)$/,C=["dependencies","devDependencies","peerDependencies","optionalDependencies"];function k(t){return e.stringContains(t,e.directorySeparator)}})((t=e.Completions||(e.Completions={})).StringCompletions||(t.StringCompletions={}));}(t),function(e){!function(t){var r,n,a,o,s,c;function l(e){return !!(e&&4&e.kind)}function u(e){return !(!e||32!==e.kind)}function _(e){return (l(e)||u(e))&&!!e.isFromPackageJson}function d(e){return !!(e&&64&e.kind)}function p(e){return !!(e&&128&e.kind)}function f(r,n,i,a,o,s,c,l,u){var _,d,p,f=e.timestamp(),g=c||e.moduleResolutionRespectsExports(e.getEmitModuleResolutionKind(a.getCompilerOptions())),m=!1,y=0,v=0,h=0,b=0,x=u({tryResolve:function(e,r,n){if(n){var a=i.getModuleSpecifierForBestExportInfo(e,r,o,l);return a&&y++,a||"failed"}var c=g||s.allowIncompleteCompletions&&v<t.moduleSpecifierResolutionLimit,u=!c&&s.allowIncompleteCompletions&&b<t.moduleSpecifierResolutionCacheAttemptLimit,_=c||u?i.getModuleSpecifierForBestExportInfo(e,r,o,l,u):void 0;return (!c&&!u||u&&!_)&&(m=!0),v+=(null==_?void 0:_.computedWithoutCacheCount)||0,h+=e.length-((null==_?void 0:_.computedWithoutCacheCount)||0),u&&b++,_||(g?"failed":"skipped")},skippedAny:function(){return m},resolvedAny:function(){return v>0},resolvedBeyondLimit:function(){return v>t.moduleSpecifierResolutionLimit}}),D=b?" (".concat((h/b*100).toFixed(1),"% hit rate)"):"";return null===(_=n.log)||void 0===_||_.call(n,"".concat(r,": resolved ").concat(v," module specifiers, plus ").concat(y," ambient and ").concat(h," from cache").concat(D)),null===(d=n.log)||void 0===d||d.call(n,"".concat(r,": response is ").concat(m?"incomplete":"complete")),null===(p=n.log)||void 0===p||p.call(n,"".concat(r,": ").concat(e.timestamp()-f)),x}function g(t,r){var n,i,a=e.compareStringsCaseSensitiveUI(t.sortText,r.sortText);return 0===a&&(a=e.compareStringsCaseSensitiveUI(t.name,r.name)),0===a&&(null===(n=t.data)||void 0===n?void 0:n.moduleSpecifier)&&(null===(i=r.data)||void 0===i?void 0:i.moduleSpecifier)&&(a=e.compareNumberOfDirectorySeparators(t.data.moduleSpecifier,r.data.moduleSpecifier)),0===a?-1:a}function m(e){return !!(null==e?void 0:e.moduleSpecifier)}function y(e){return {isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:!1,entries:e}}function v(e,t,r){return {kind:4,keywordCompletions:V(e,t),isNewIdentifierLocation:r}}function h(t){return 79===(null==t?void 0:t.kind)?e.createTextSpanFromNode(t):void 0}function b(t,r){return e.isSourceFileJS(t)&&!e.isCheckJsEnabledForFile(t,r)}function x(e){switch(e){case 0:case 3:case 2:return !0;default:return !1}}function D(t,r,n){return "object"==typeof n?e.pseudoBigIntToString(n)+"n":e.isString(n)?e.quote(t,r,n):JSON.stringify(n)}function S(e,r,n){return {name:D(e,r,n),kind:"string",kindModifiers:"",sortText:t.SortText.LocationPriority}}function T(n,i,a,o,s,c,d,f,g,m,y,v,h,b,x,D,S,T,k,N,w,I){var O,M,L,R,B,j,J,z,K=e.getReplacementSpanForContextToken(a),U=P(y),V=f.getTypeChecker(),q=y&&function(e){return !!(16&e.kind)}(y),W=y&&function(e){return !!(2&e.kind)}(y)||m;if(y&&function(e){return !!(1&e.kind)}(y))L=m?"this".concat(q?"?.":"","[").concat(F(c,T,g),"]"):"this".concat(q?"?.":".").concat(g);else if((W||q)&&h){L=W?"[".concat(m?F(c,T,g):g,"]"):g,(q||h.questionDotToken)&&(L="?.".concat(L));var H=e.findChildOfKind(h,24,c)||e.findChildOfKind(h,28,c);if(!H)return;var G=e.startsWith(g,h.name.text)?h.name.end:H.end;K=e.createTextSpanFromBounds(H.getStart(c),G);}if(b&&(void 0===L&&(L=g),L="{".concat(L,"}"),"boolean"!=typeof b&&(K=e.createTextSpanFromNode(b,c))),y&&function(e){return !!(8&e.kind)}(y)&&h){void 0===L&&(L=g);var Q=e.findPrecedingToken(h.pos,c),X="";Q&&e.positionIsASICandidate(Q.end,Q.parent,c)&&(X=";"),X+="(await ".concat(h.expression.getText(),")"),L=m?"".concat(X).concat(L):"".concat(X).concat(q?"?.":".").concat(L),K=e.createTextSpanFromBounds(h.getStart(c),h.end);}if(u(y)&&(j=[e.textPart(y.moduleSpecifier)],x&&(L=(O=function(t,r,n,i,a,o,s){var c,l,u,_=r.getSourceFile(),d=e.createTextSpanFromNode(e.findAncestor(r,e.or(e.isImportDeclaration,e.isImportEqualsDeclaration))||r,_),p=e.quote(_,s,i.moduleSpecifier),f=i.isDefaultExport?1:"export="===i.exportName?2:0,g=s.includeCompletionsWithSnippetText?"$1":"",m=e.codefix.getImportKind(_,f,o,!0),y=(null===(l=null===(c=e.tryCast(r,e.isImportDeclaration))||void 0===c?void 0:c.importClause)||void 0===l?void 0:l.isTypeOnly)||(null===(u=e.tryCast(r,e.isImportEqualsDeclaration))||void 0===u?void 0:u.isTypeOnly),v=ne(r,n),h=y?" ".concat(e.tokenToString(152)," "):" ",b=v?"".concat(e.tokenToString(152)," "):"",x=a?";":"";switch(m){case 3:return {replacementSpan:d,insertText:"import".concat(h).concat(e.escapeSnippetText(t)).concat(g," = require(").concat(p,")").concat(x)};case 1:return {replacementSpan:d,insertText:"import".concat(h).concat(e.escapeSnippetText(t)).concat(g," from ").concat(p).concat(x)};case 2:return {replacementSpan:d,insertText:"import".concat(h,"* as ").concat(e.escapeSnippetText(t)," from ").concat(p).concat(x)};case 0:return {replacementSpan:d,insertText:"import".concat(h,"{ ").concat(b).concat(e.escapeSnippetText(t)).concat(g," } from ").concat(p).concat(x)}}}(g,x,o,y,D,S,T)).insertText,K=O.replacementSpan,B=!!T.includeCompletionsWithSnippetText||void 0)),64===(null==y?void 0:y.kind)&&(J=!0),T.includeCompletionsWithClassMemberSnippets&&T.includeCompletionsWithInsertText&&3===k&&function(t,r){if(e.isInJSFile(r))return !1;return !!(106500&t.flags)&&(e.isClassLike(r)||r.parent&&r.parent.parent&&e.isClassElement(r.parent)&&r===r.parent.name&&e.isClassLike(r.parent.parent)||r.parent&&e.isSyntaxList(r)&&e.isClassLike(r.parent))}(n,s)){var Y=void 0;L=(M=C(d,f,S,T,g,n,s,o,N)).insertText,B=M.isSnippet,Y=M.importAdder,K=M.replacementSpan,i=t.SortText.ClassMemberSnippets,(null==Y?void 0:Y.hasFixes())&&(J=!0,U=r.ClassMemberSnippet);}if(y&&p(y)&&(L=y.insertText,B=y.isSnippet,z=y.labelDetails,T.useLabelDetailsInCompletionEntries||(g+=z.detail,z=void 0),U=r.ObjectLiteralMethodSnippet,i=t.SortText.SortBelow(i)),w&&!I&&T.includeCompletionsWithSnippetText&&T.jsxAttributeCompletionStyle&&"none"!==T.jsxAttributeCompletionStyle){var Z="braces"===T.jsxAttributeCompletionStyle,$=V.getTypeOfSymbolAtLocation(n,s);"auto"!==T.jsxAttributeCompletionStyle||528&$.flags||1048576&$.flags&&e.find($.types,(function(e){return !!(528&e.flags)}))||(402653316&$.flags||1048576&$.flags&&e.every($.types,(function(e){return !!(402686084&e.flags)}))?(L="".concat(e.escapeSnippetText(g),"=").concat(e.quote(c,T,"$1")),B=!0):Z=!0),Z&&(L="".concat(e.escapeSnippetText(g),"={$1}"),B=!0);}if(void 0===L||T.includeCompletionsWithInsertText)return (l(y)||u(y))&&(R=E(y),J=!x),{name:g,kind:e.SymbolDisplay.getSymbolKind(V,n,s),kindModifiers:e.SymbolDisplay.getSymbolModifiers(V,n),sortText:i,source:U,hasAction:!!J||void 0,isRecommended:A(n,v,V)||void 0,insertText:L,replacementSpan:K,sourceDisplay:j,labelDetails:z,isSnippet:B,isPackageJsonImport:_(y)||void 0,isImportStatementCompletion:!!x||void 0,data:R}}function C(t,r,n,i,a,o,s,c,l){var u,_,d=e.findAncestor(s,e.isClassLike);if(!d)return {insertText:a};var p,f=a,g=r.getTypeChecker(),m=s.getSourceFile(),y=k({removeComments:!0,module:n.module,target:n.target,omitTrailingSemicolon:!1,newLine:e.getNewLineKind(e.getNewLineCharacter(n,e.maybeBind(t,t.getNewLine)))}),v=e.codefix.createImportAdder(m,r,i,t);if(i.includeCompletionsWithSnippetText){u=!0;var h=e.factory.createEmptyStatement();p=e.factory.createBlock([h],!0),e.setSnippetElement(h,{kind:0,order:0});}else p=e.factory.createBlock([],!0);var b=0,x=function(t){if(!t)return {modifiers:0};var r,n,i,a=0;return i=t,(n=e.isModifier(i)?i.kind:e.isIdentifier(i)&&i.originalKeywordKind&&e.isModifierKind(i.originalKeywordKind)?i.originalKeywordKind:void 0)&&(a|=e.modifierToFlag(n),r=e.createTextSpanFromNode(t)),e.isPropertyDeclaration(t.parent)&&(a|=e.modifiersToFlags(t.parent.modifiers),r=e.createTextSpanFromNode(t.parent)),{modifiers:a,span:r}}(c),D=x.modifiers,S=x.span,T=!!(128&D),C=[];if(e.codefix.addNewNodeForMemberSymbol(o,d,m,{program:r,host:t},i,v,(function(t){var r=0;T&&(r|=128),e.isClassElement(t)&&1===g.getMemberOverrideModifierStatus(d,t)&&(r|=16384),C.length||(b=t.modifierFlagsCache|r|D),t=e.factory.updateModifiers(t,b),C.push(t);}),p,2,T),C.length){var E=131073;_=S,f=l?y.printAndFormatSnippetList(E,e.factory.createNodeArray(C),m,l):y.printSnippetList(E,e.factory.createNodeArray(C),m);}return {insertText:f,isSnippet:u,importAdder:v,replacementSpan:_}}function k(t){var r,n=e.textChanges.createWriter(e.getNewLineCharacter(t)),a=e.createPrinter(t,n),o=i$1(i$1({},n),{write:function(e){return s(e,(function(){return n.write(e)}))},nonEscapingWrite:n.write,writeLiteral:function(e){return s(e,(function(){return n.writeLiteral(e)}))},writeStringLiteral:function(e){return s(e,(function(){return n.writeStringLiteral(e)}))},writeSymbol:function(e,t){return s(e,(function(){return n.writeSymbol(e,t)}))},writeParameter:function(e){return s(e,(function(){return n.writeParameter(e)}))},writeComment:function(e){return s(e,(function(){return n.writeComment(e)}))},writeProperty:function(e){return s(e,(function(){return n.writeProperty(e)}))}});return {printSnippetList:function(t,n,i){var a=c(t,n,i);return r?e.textChanges.applyChanges(a,r):a},printAndFormatSnippetList:function(t,n,a,o){var s={text:c(t,n,a),getLineAndCharacterOfPosition:function(t){return e.getLineAndCharacterOfPosition(this,t)}},l=e.getFormatCodeSettingsForWriting(o,a),u=e.flatMap(n,(function(t){var r=e.textChanges.assignPositionsToNode(t);return e.formatting.formatNodeGivenIndentation(r,s,a.languageVariant,0,0,i$1(i$1({},o),{options:l}))})),_=r?e.stableSort(e.concatenate(u,r),(function(t,r){return e.compareTextSpans(t.span,r.span)})):u;return e.textChanges.applyChanges(s.text,_)}};function s(t,i){var a=e.escapeSnippetText(t);if(a!==t){var o=n.getTextPos();i();var s=n.getTextPos();r=e.append(r||(r=[]),{newText:a,span:{start:o,length:s-o}});}else i();}function c(e,t,n){return r=void 0,o.clear(),a.writeList(e,t,n,o),o.getText()}}function E(t){var r=t.fileName?void 0:e.stripQuotes(t.moduleSymbol.name),n=!!t.isFromPackageJson||void 0;return u(t)?{exportName:t.exportName,moduleSpecifier:t.moduleSpecifier,ambientModuleName:r,fileName:t.fileName,isPackageJsonImport:n}:{exportName:t.exportName,exportMapKey:t.exportMapKey,fileName:t.fileName,ambientModuleName:t.fileName?void 0:e.stripQuotes(t.moduleSymbol.name),isPackageJsonImport:!!t.isFromPackageJson||void 0}}function N(e,t,r){var n="default"===e.exportName,i=!!e.isPackageJsonImport;return m(e)?{kind:32,exportName:e.exportName,moduleSpecifier:e.moduleSpecifier,symbolName:t,fileName:e.fileName,moduleSymbol:r,isDefaultExport:n,isFromPackageJson:i}:{kind:4,exportName:e.exportName,exportMapKey:e.exportMapKey,symbolName:t,fileName:e.fileName,moduleSymbol:r,isDefaultExport:n,isFromPackageJson:i}}function F(t,r,n){return /^\d+$/.test(n)?n:e.quote(t,r,n)}function A(e,t,r){return e===t||!!(1048576&e.flags)&&r.getExportSymbolOfSymbol(e)===t}function P(t){return l(t)?e.stripQuotes(t.moduleSymbol.name):u(t)?t.moduleSpecifier:1===(null==t?void 0:t.kind)?r.ThisProperty:64===(null==t?void 0:t.kind)?r.TypeOnlyAlias:void 0}function w(r,n,i,a,o,s,c,l,u,_,f,m,y,v,h,b,x,D,S,C,k,E,N,F){for(var A,P,w=e.timestamp(),I=(P=o,e.findAncestor(P,(function(t){return e.isFunctionBlock(t)||function(t){return t.parent&&e.isArrowFunction(t.parent)&&t.parent.body===t}(t)||e.isBindingPattern(t)?"quit":e.isVariableDeclaration(t)}))),O=e.probablyUsesSemicolons(s),M=l.getTypeChecker(),L=new e.Map,R=0;R<r.length;R++){var B=r[R],j=null==k?void 0:k[R],J=z(B,u,j,f,!!x);if(J&&(!L.get(J.name)||j&&p(j))&&(1!==f||!E||H(B,E))){var K=J.name,U=J.needsConvertPropertyAccess,V=null!==(A=null==E?void 0:E[e.getSymbolId(B)])&&void 0!==A?A:t.SortText.LocationPriority,q=T(B,se(B,M)?t.SortText.Deprecated(V):V,i,a,o,s,c,l,K,U,j,C,b,D,S,O,y,m,f,v,N,F);if(q){var W=(!j||d(j))&&!(void 0===B.parent&&!e.some(B.declarations,(function(e){return e.getSourceFile()===o.getSourceFile()})));L.set(K,W),e.insertSorted(n,q,g,!0);}}}return _("getCompletionsAtPosition: getCompletionEntriesFromSymbols: "+(e.timestamp()-w)),{has:function(e){return L.has(e)},add:function(e){return L.set(e,!0)}};function H(r,n){var i=r.flags;if(!e.isSourceFile(o)){if(e.isExportAssignment(o.parent))return !0;if(I&&r.valueDeclaration===I)return !1;var a=e.skipAlias(r,M);if(s.externalModuleIndicator&&!y.allowUmdGlobalAccess&&n[e.getSymbolId(r)]===t.SortText.GlobalsOrKeywords&&(n[e.getSymbolId(a)]===t.SortText.AutoImportSuggestions||n[e.getSymbolId(a)]===t.SortText.LocationPriority))return !1;if(i|=e.getCombinedLocalAndExportSymbolFlags(a),e.isInRightSideOfInternalImportEqualsDeclaration(o))return !!(1920&i);if(h)return oe(r,M)}return !!(111551&i)}}function I(t,n,i,a,o,s,c){if(o.data){var l=J(o.name,o.data,t,s);if(l){var u=j(a,i),_=u.contextToken,d=u.previousToken;return {type:"symbol",symbol:l.symbol,location:e.getTouchingPropertyName(i,a),previousToken:d,contextToken:_,isJsxInitializer:!1,isTypeOnlyLocation:!1,origin:l.origin}}}var p=t.getCompilerOptions(),f=B(t,n,i,p,a,{includeCompletionsForModuleExports:!0,includeCompletionsWithInsertText:!0},o,s,void 0);if(!f)return {type:"none"};if(0!==f.kind)return {type:"request",request:f};var g=f.symbols,m=f.literals,y=f.location,v=f.completionKind,h=f.symbolToOriginInfoMap,b=f.contextToken,x=f.previousToken,S=f.isJsxInitializer,T=f.isTypeOnlyLocation,C=e.find(m,(function(e){return D(i,c,e)===o.name}));return void 0!==C?{type:"literal",literal:C}:e.firstDefined(g,(function(t,n){var i=h[n],a=z(t,e.getEmitScriptTarget(p),i,v,f.isJsxIdentifierExpected);return a&&a.name===o.name&&(o.source===r.ClassMemberSnippet&&106500&t.flags||o.source===r.ObjectLiteralMethodSnippet&&8196&t.flags||P(i)===o.source)?{type:"symbol",symbol:t,location:y,origin:i,contextToken:b,previousToken:x,isJsxInitializer:S,isTypeOnlyLocation:T}:void 0}))||{type:"none"}}function O(t,r,n){return L(t,"",r,[e.displayPart(t,n)])}function M(t,r,n,i,a,o,s){var c=r.runWithCancellationToken(a,(function(r){return e.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(r,t,n,i,i,7)})),l=c.displayParts,u=c.documentation,_=c.symbolKind,d=c.tags;return L(t.name,e.SymbolDisplay.getSymbolModifiers(r,t),_,l,u,d,o,s)}function L(e,t,r,n,i,a,o,s){return {name:e,kindModifiers:t,kind:r,displayParts:n,documentation:i,tags:a,codeActions:o,source:s,sourceDisplay:s}}function R(t,r,n){var i=n.getAccessibleSymbolChain(t,r,67108863,!1);return i?e.first(i):t.parent&&(function(e){var t;return !!(null===(t=e.declarations)||void 0===t?void 0:t.some((function(e){return 305===e.kind})))}(t.parent)?t:R(t.parent,r,n))}function B(r,n,a,o,s,c,l,u,_,d){var p=r.getTypeChecker(),g=b(a,o),m=e.timestamp(),y=e.getTokenAtPosition(a,s);n("getCompletionData: Get current token: "+(e.timestamp()-m)),m=e.timestamp();var h=e.isInComment(a,s,y);n("getCompletionData: Is inside comment: "+(e.timestamp()-m));var x=!1,D=!1;if(h){if(e.hasDocComment(a,s)){if(64===a.text.charCodeAt(s-1))return {kind:1};var S=e.getLineStartPositionForPosition(s,a);if(!/[^\*|\s(/)]/.test(a.text.substring(S,s)))return {kind:2}}var T=function(t,r){return e.findAncestor(t,(function(t){return !(!e.isJSDocTag(t)||!e.rangeContainsPosition(t,r))||!!e.isJSDoc(t)&&"quit"}))}(y,s);if(T){if(T.tagName.pos<=s&&s<=T.tagName.end)return {kind:1};var C=function(t){if(function(e){switch(e.kind){case 340:case 347:case 341:case 343:case 345:return !0;case 344:return !!e.constraint;default:return !1}}(t)){var r=e.isJSDocTemplateTag(t)?t.constraint:t.typeExpression;return r&&309===r.kind?r:void 0}}(T);if(C&&((y=e.getTokenAtPosition(a,s))&&(e.isDeclarationName(y)||347===y.parent.kind&&y.parent.name===y)||(x=Re(C))),!x&&e.isJSDocParameterTag(T)&&(e.nodeIsMissing(T.name)||T.name.pos<=s&&s<=T.name.end))return {kind:3,tag:T}}if(!x)return void n("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.")}m=e.timestamp();var E=!x&&e.isSourceFileJS(a),N=j(s,a),F=N.previousToken,A=N.contextToken;n("getCompletionData: Get previous token: "+(e.timestamp()-m));var P,w,I,O=y,M=!1,L=!1,B=!1,J=!1,K=!1,U=!1,V=e.getTouchingPropertyName(a,s),q=0,G=!1,Y=0;if(A){var ie=re(A);if(G=ie.isNewIdentifierLocation,ie.keywordCompletion){if(ie.isKeywordOnlyCompletion)return {kind:4,keywordCompletions:[(I=ie.keywordCompletion,{name:e.tokenToString(I),kind:"keyword",kindModifiers:"",sortText:t.SortText.GlobalsOrKeywords})],isNewIdentifierLocation:G};q=function(t){switch(t){case 152:return 8;default:e.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters");}}(ie.keywordCompletion);}if(ie.replacementNode&&c.includeCompletionsForImportStatements&&c.includeCompletionsWithInsertText&&(w=ie.replacementNode,Y|=2),!w&&function(t){var r=e.timestamp(),i=function(t){return (e.isRegularExpressionLiteral(t)||e.isStringTextContainingNode(t))&&(e.rangeContainsPositionExclusive(e.createTextRangeFromSpan(e.createTextSpanFromNode(t)),s)||s===t.end&&(!!t.isUnterminated||e.isRegularExpressionLiteral(t)))}(t)||function(t){var r=t.parent,n=r.kind;switch(t.kind){case 27:return 254===n||function(t){return 255===t.parent.kind&&!e.isPossiblyTypeArgumentPosition(t,a,p)}(t)||237===n||260===n||Ie(n)||258===n||202===n||259===n||e.isClassLike(r)&&!!r.typeParameters&&r.typeParameters.end>=t.pos;case 24:return 202===n;case 58:return 203===n;case 22:return 202===n;case 20:return 292===n||Ie(n);case 18:return 260===n;case 29:return 257===n||226===n||258===n||259===n||e.isFunctionLikeKind(n);case 124:return 167===n&&!e.isClassLike(r.parent);case 25:return 164===n||!!r.parent&&202===r.parent.kind;case 123:case 121:case 122:return 164===n&&!e.isConstructorDeclaration(r.parent);case 127:return 270===n||275===n||268===n;case 136:case 149:return !ee(t);case 79:if(270===n&&t===r.name&&"type"===t.text)return !1;break;case 84:case 92:case 118:case 98:case 113:case 100:case 119:case 85:case 137:return !0;case 152:return 270!==n;case 41:return e.isFunctionLike(t.parent)&&!e.isMethodDeclaration(t.parent)}if(H(Q(t))&&ee(t))return !1;if(Pe(t)&&(!e.isIdentifier(t)||e.isParameterPropertyModifier(Q(t))||Re(t)))return !1;switch(Q(t)){case 126:case 84:case 85:case 135:case 92:case 98:case 118:case 119:case 121:case 122:case 123:case 124:case 113:return !0;case 131:return e.isPropertyDeclaration(t.parent)}if(e.findAncestor(t.parent,e.isClassLike)&&t===F&&we(t,s))return !1;var i=e.getAncestor(t.parent,167);if(i&&t!==F&&e.isClassLike(F.parent.parent)&&s<=F.end){if(we(t,F.end))return !1;if(63!==t.kind&&(e.isInitializedProperty(i)||e.hasType(i)))return !0}return e.isDeclarationName(t)&&!e.isShorthandPropertyAssignment(t.parent)&&!e.isJsxAttribute(t.parent)&&!(e.isClassLike(t.parent)&&(t!==F||s>F.end))}(t)||function(e){if(8===e.kind){var t=e.getFullText();return "."===t.charAt(t.length-1)}return !1}(t)||function(e){if(11===e.kind)return !0;if(31===e.kind&&e.parent){if(V===e.parent&&(280===V.kind||279===V.kind))return !1;if(280===e.parent.kind)return 280!==V.parent.kind;if(281===e.parent.kind||279===e.parent.kind)return !!e.parent.parent&&278===e.parent.parent.kind}return !1}(t)||e.isBigIntLiteral(t);return n("getCompletionsAtPosition: isCompletionListBlocker: "+(e.timestamp()-r)),i}(A))return n("Returning an empty list because completion was requested in an invalid position."),q?v(q,E,Ae()):void 0;var ae=A.parent;if(24===A.kind||28===A.kind)switch(M=24===A.kind,L=28===A.kind,ae.kind){case 206:O=(P=ae).expression;var se=e.getLeftmostAccessExpression(P);if(e.nodeIsMissing(se)||(e.isCallExpression(O)||e.isFunctionLike(O))&&O.end===A.pos&&O.getChildCount(a)&&21!==e.last(O.getChildren(a)).kind)return;break;case 161:O=ae.left;break;case 261:O=ae.name;break;case 200:O=ae;break;case 231:O=ae.getFirstToken(a),e.Debug.assert(100===O.kind||103===O.kind);break;default:return}else if(!w&&1===a.languageVariant){if(ae&&206===ae.kind&&(A=ae,ae=ae.parent),y.parent===V)switch(y.kind){case 31:278!==y.parent.kind&&280!==y.parent.kind||(V=y);break;case 43:279===y.parent.kind&&(V=y);}switch(ae.kind){case 281:43===A.kind&&(J=!0,V=A);break;case 221:if(!te(ae))break;case 279:case 278:case 280:U=!0,29===A.kind&&(B=!0,V=A);break;case 288:case 287:19===F.kind&&31===y.kind&&(U=!0);break;case 285:if(ae.initializer===F&&F.end<s){U=!0;break}switch(F.kind){case 63:K=!0;break;case 79:U=!0,ae!==F.parent&&!ae.initializer&&e.findChildOfKind(ae,63,a)&&(K=F);}}}}var le,ue=e.timestamp(),_e=5,de=!1,pe=!1,fe=[],ge=[],me=[],ye=new e.Map,ve=x||!!w&&e.isTypeOnlyImportOrExportDeclaration(V.parent)||!function(t){return t&&(112===t.kind&&(181===t.parent.kind||e.isTypeOfExpression(t.parent))||128===t.kind&&177===t.parent.kind)}(A)&&(e.isPossiblyTypeArgumentPosition(A,a,p)||e.isPartOfTypeNode(V)||function(t){if(t){var r=t.parent.kind;switch(t.kind){case 58:return 167===r||166===r||164===r||254===r||e.isFunctionLikeKind(r);case 63:return 259===r;case 127:return 229===r;case 29:return 178===r||211===r;case 94:return 163===r}}return !1}(A)),he=e.memoizeOne((function(t){return e.createModuleSpecifierResolutionHost(t?u.getPackageJsonAutoImportProvider():r,u)}));if(M||L)!function(){_e=2;var t,r,n=e.isLiteralImportTypeNode(O),i=x||n&&!O.isTypeOf||e.isPartOfTypeNode(O.parent)||e.isPossiblyTypeArgumentPosition(A,a,p),o=e.isInRightSideOfInternalImportEqualsDeclaration(O);if(e.isEntityName(O)||n||e.isPropertyAccessExpression(O)){var s=e.isModuleDeclaration(O.parent);s&&(G=!0);var l=p.getSymbolAtLocation(O);if(l&&1920&(l=e.skipAlias(l,p)).flags){var u=p.getExportsOfModule(l);e.Debug.assertEachIsDefined(u,"getExportsOfModule() should all be defined");for(var _=function(e){return p.isValidPropertyAccess(n?O:O.parent,e.name)},d=function(e){return oe(e,p)},f=s?function(e){var t;return !!(1920&e.flags)&&!(null===(t=e.declarations)||void 0===t?void 0:t.every((function(e){return e.parent===O.parent})))}:o?function(e){return d(e)||_(e)}:i?d:_,g=0,m=u;g<m.length;g++){var y=m[g];f(y)&&fe.push(y);}if(!i&&l.declarations&&l.declarations.some((function(e){return 305!==e.kind&&261!==e.kind&&260!==e.kind}))){var v=!1;(t=p.getTypeOfSymbolAtLocation(l,O).getNonOptionalType()).isNullableType()&&((r=M&&!L&&!1!==c.includeAutomaticOptionalChainCompletions)||L)&&(t=t.getNonNullableType(),r&&(v=!0)),Ce(t,!!(32768&O.flags),v);}return}}i||(p.tryGetThisTypeAt(O,!1),v=!1,(t=p.getTypeAtLocation(O).getNonOptionalType()).isNullableType()&&((r=M&&!L&&!1!==c.includeAutomaticOptionalChainCompletions)||L)&&(t=t.getNonNullableType(),r&&(v=!0)),Ce(t,!!(32768&O.flags),v));}();else if(B)fe=p.getJsxIntrinsicTagNamesAt(V),e.Debug.assertEachIsDefined(fe,"getJsxIntrinsicTagNames() should all be defined"),Ne(),_e=1,q=0;else if(J){var be=A.parent.parent.openingElement.tagName,xe=p.getSymbolAtLocation(be);xe&&(fe=[xe]),_e=1,q=0;}else if(!Ne())return q?v(q,E,G):void 0;n("getCompletionData: Semantic work: "+(e.timestamp()-ue));var De=F&&function(t,r,n,i){var a=t.parent;switch(t.kind){case 79:return e.getContextualTypeFromParent(t,i);case 63:switch(a.kind){case 254:return i.getContextualType(a.initializer);case 221:return i.getTypeAtLocation(a.left);case 285:return i.getContextualTypeForJsxAttribute(a);default:return}case 103:return i.getContextualType(a);case 82:var o=e.tryCast(a,e.isCaseClause);return o?e.getSwitchedType(o,i):void 0;case 18:return !e.isJsxExpression(a)||e.isJsxElement(a.parent)||e.isJsxFragment(a.parent)?void 0:i.getContextualTypeForJsxAttribute(a.parent);default:var s=e.SignatureHelp.getArgumentInfoForCompletions(t,r,n);return s?i.getContextualTypeForArgumentAtIndex(s.invocation,s.argumentIndex+(27===t.kind?1:0)):e.isEqualityOperatorKind(t.kind)&&e.isBinaryExpression(a)&&e.isEqualityOperatorKind(a.operatorToken.kind)?i.getTypeAtLocation(a.left):i.getContextualType(t)}}(F,s,a,p),Se=e.mapDefined(De&&(De.isUnion()?De.types:[De]),(function(e){return !e.isLiteral()||1024&e.flags?void 0:e.value})),Te=F&&De&&function(t,r,n){return e.firstDefined(r&&(r.isUnion()?r.types:[r]),(function(r){var i=r&&r.symbol;return i&&424&i.flags&&!e.isAbstractConstructorSymbol(i)?R(i,t,n):void 0}))}(F,De,p);return {kind:0,symbols:fe,completionKind:_e,isInSnippetScope:D,propertyAccessToConvert:P,isNewIdentifierLocation:G,location:V,keywordFilters:q,literals:Se,symbolToOriginInfoMap:ge,recommendedCompletion:Te,previousToken:F,contextToken:A,isJsxInitializer:K,insideJsDocTagTypeExpression:x,symbolToSortTextMap:me,isTypeOnlyLocation:ve,isJsxIdentifierExpected:U,isRightOfOpenTag:B,importCompletionNode:w,hasUnresolvedAutoImports:pe,flags:Y};function Ce(t,r,n){G=!!t.getStringIndexType(),L&&e.some(t.getCallSignatures())&&(G=!0);var i=200===O.kind?O:O.parent;if(g)fe.push.apply(fe,e.filter(Z(t,p),(function(e){return p.isValidPropertyAccessForCompletions(i,t,e)})));else for(var a=0,o=t.getApparentProperties();a<o.length;a++){var s=o[a];p.isValidPropertyAccessForCompletions(i,t,s)&&ke(s,!1,n);}if(r&&c.includeCompletionsWithInsertText){var l=p.getPromisedTypeOfPromise(t);if(l)for(var u=0,_=l.getApparentProperties();u<_.length;u++)s=_[u],p.isValidPropertyAccessForCompletions(i,l,s)&&ke(s,!0,n);}}function ke(n,i,o){var l,_=e.firstDefined(n.declarations,(function(t){return e.tryCast(e.getNameOfDeclaration(t),e.isComputedPropertyName)}));if(_){var d=Ee(_.expression),f=d&&p.getSymbolAtLocation(d),g=f&&R(f,A,p);if(g&&e.addToSeen(ye,e.getSymbolId(g))){var m=fe.length;fe.push(g);var y=g.parent;if(y&&e.isExternalModuleSymbol(y)&&p.tryGetMemberInModuleExportsAndProperties(g.name,y)===g){var v=e.isExternalModuleNameRelative(e.stripQuotes(y.name))?null===(l=e.getSourceFileOfModule(y))||void 0===l?void 0:l.fileName:void 0,h=((le||(le=e.codefix.createImportSpecifierResolver(a,r,u,c))).getModuleSpecifierForBestExportInfo([{exportKind:0,moduleFileName:v,isFromPackageJson:!1,moduleSymbol:y,symbol:g,targetFlags:e.skipAlias(g,p).flags}],g.name,s,e.isValidTypeOnlyAliasUseSite(V))||{}).moduleSpecifier;if(h){var b={kind:S(6),moduleSymbol:y,isDefaultExport:!1,symbolName:g.name,exportName:g.name,fileName:v,moduleSpecifier:h};ge[m]=b;}}else ge[m]={kind:S(2)};}else c.includeCompletionsWithInsertText&&(D(n),x(n),fe.push(n));}else D(n),x(n),fe.push(n);function x(r){(function(t){return !!(t.valueDeclaration&&32&e.getEffectiveModifierFlags(t.valueDeclaration)&&e.isClassLike(t.valueDeclaration.parent))})(r)&&(me[e.getSymbolId(r)]=t.SortText.LocalDeclarationPriority);}function D(t){c.includeCompletionsWithInsertText&&(i&&e.addToSeen(ye,e.getSymbolId(t))?ge[fe.length]={kind:S(8)}:o&&(ge[fe.length]={kind:16}));}function S(e){return o?16|e:e}}function Ee(t){return e.isIdentifier(t)?t:e.isPropertyAccessExpression(t)?Ee(t.expression):void 0}function Ne(){return 1===(function(){var t=function(t){if(t){var r=t.parent;switch(t.kind){case 18:if(e.isTypeLiteralNode(r))return r;break;case 26:case 27:case 79:if(166===r.kind&&e.isTypeLiteralNode(r.parent))return r.parent}}}(A);if(!t)return 0;var r=(e.isIntersectionTypeNode(t.parent)?t.parent:void 0)||t,n=$(r,p);if(!n)return 0;var i=p.getTypeFromTypeNode(r),a=Z(n,p),o=Z(i,p),s=new e.Set;return o.forEach((function(e){return s.add(e.escapedName)})),fe=e.concatenate(fe,e.filter(a,(function(e){return !s.has(e.escapedName)}))),_e=0,G=!0,1}()||function(){var n,a,s,l,d=fe.length,f=function(t){if(t){var r=t.parent;switch(t.kind){case 18:case 27:if(e.isObjectLiteralExpression(r)||e.isObjectBindingPattern(r))return r;break;case 41:return e.isMethodDeclaration(r)?e.tryCast(r.parent,e.isObjectLiteralExpression):void 0;case 79:return "async"===t.text&&e.isShorthandPropertyAssignment(t.parent)?t.parent.parent:void 0}}}(A);if(!f)return 0;if(_e=0,205===f.kind){var g=function(t,r){var n=r.getContextualType(t);if(n)return n;var i=e.walkUpParenthesizedExpressions(t.parent);return e.isBinaryExpression(i)&&63===i.operatorToken.kind&&t===i.left?r.getTypeAtLocation(i):e.isExpression(i)?r.getContextualType(i):void 0}(f,p);if(void 0===g)return 33554432&f.flags?2:(de=!0,0);var m=p.getContextualType(f,4),y=(m||g).getStringIndexType(),v=(m||g).getNumberIndexType();if(G=!!y||!!v,n=X(g,m,f,p),a=f.properties,0===n.length&&!v)return de=!0,0}else {e.Debug.assert(201===f.kind),G=!1;var h=e.getRootDeclaration(f.parent);if(!e.isVariableLike(h))return e.Debug.fail("Root declaration is not variable-like.");var b=e.hasInitializer(h)||!!e.getEffectiveTypeAnnotationNode(h)||244===h.parent.parent.kind;if(b||164!==h.kind||(e.isExpression(h.parent)?b=!!p.getContextualType(h.parent):169!==h.parent.kind&&173!==h.parent.kind||(b=e.isExpression(h.parent.parent)&&!!p.getContextualType(h.parent.parent))),b){var x=p.getTypeAtLocation(f);if(!x)return 2;n=p.getPropertiesOfType(x).filter((function(e){return p.isPropertyAccessible(f,!1,!1,x,e)})),a=f.elements;}}if(n&&n.length>0){var D=function(t,r){if(0===r.length)return t;for(var n=new e.Set,i=new e.Set,a=0,o=r;a<o.length;a++){var s=o[a];if((296===s.kind||297===s.kind||203===s.kind||169===s.kind||172===s.kind||173===s.kind||298===s.kind)&&!Re(s)){var c=void 0;if(e.isSpreadAssignment(s))Oe(s,n);else if(e.isBindingElement(s)&&s.propertyName)79===s.propertyName.kind&&(c=s.propertyName.escapedText);else {var l=e.getNameOfDeclaration(s);c=l&&e.isPropertyNameLiteral(l)?e.getEscapedTextOfIdentifierOrLiteral(l):void 0;}void 0!==c&&i.add(c);}}var u=t.filter((function(e){return !i.has(e.escapedName)}));return Le(n,u),u}(n,e.Debug.checkDefined(a));fe=e.concatenate(fe,D),Me(),205===f.kind&&c.includeCompletionsWithObjectLiteralMethodSnippets&&c.includeCompletionsWithInsertText&&(function(r){for(var n,i=r;i<fe.length;i++){var a=fe[i],s=e.getSymbolId(a),c=null==ge?void 0:ge[i],l=z(a,e.getEmitScriptTarget(o),c,0,!1);if(l){var u=null!==(n=me[s])&&void 0!==n?n:t.SortText.LocationPriority,_=l.name;me[s]=t.SortText.ObjectLiteralProperty(u,_);}}}(d),s=D,l=f,e.isInJSFile(V)||s.forEach((function(t){if(8196&t.flags){var n=z(t,e.getEmitScriptTarget(o),void 0,0,!1);if(n){var a=function(t,r,n,i,a,o,s,c){var l=s.includeCompletionsWithSnippetText||void 0,u=r,_=n.getSourceFile(),d=function(t,r,n,i,a,o){var s=t.getDeclarations();if(s&&s.length){var c=i.getTypeChecker(),l=s[0],u=e.getSynthesizedDeepClone(e.getNameOfDeclaration(l),!1),_=c.getWidenedType(c.getTypeOfSymbolAtLocation(t,r)),d=0===e.getQuotePreference(n,o)?268435456:void 0;switch(l.kind){case 166:case 167:case 168:case 169:var p=1048576&_.flags&&_.types.length<10?c.getUnionType(_.types,2):_;if(1048576&p.flags){var f=e.filter(p.types,(function(e){return c.getSignaturesOfType(e,0).length>0}));if(1!==f.length)return;p=f[0];}if(1!==c.getSignaturesOfType(p,0).length)return;var g=c.typeToTypeNode(p,r,d,e.codefix.getNoopSymbolTrackerWithResolver({program:i,host:a}));if(!g||!e.isFunctionTypeNode(g))return;var m=void 0;if(o.includeCompletionsWithSnippetText){var y=e.factory.createEmptyStatement();m=e.factory.createBlock([y],!0),e.setSnippetElement(y,{kind:0,order:0});}else m=e.factory.createBlock([],!0);var v=g.parameters.map((function(t){return e.factory.createParameterDeclaration(void 0,void 0,t.dotDotDotToken,t.name,t.questionToken,void 0,t.initializer)}));return e.factory.createMethodDeclaration(void 0,void 0,void 0,u,void 0,void 0,v,void 0,m);default:return}}}(t,n,_,i,a,s);if(d){var p=k({removeComments:!0,module:o.module,target:o.target,omitTrailingSemicolon:!1,newLine:e.getNewLineKind(e.getNewLineCharacter(o,e.maybeBind(a,a.getNewLine)))});u=c?p.printAndFormatSnippetList(80,e.factory.createNodeArray([d],!0),_,c):p.printSnippetList(80,e.factory.createNodeArray([d],!0),_);var f=e.createPrinter({removeComments:!0,module:o.module,target:o.target,omitTrailingSemicolon:!0}),g=e.factory.createMethodSignature(void 0,"",d.questionToken,d.typeParameters,d.parameters,d.type);return {isSnippet:l,insertText:u,labelDetails:{detail:f.printNode(4,g,_)}}}}(t,n.name,l,r,u,o,c,_);if(a){var s=i$1({kind:128},a);Y|=32,ge[fe.length]=s,fe.push(t);}}}})));}return 1}()||(w?(G=!0,Fe(),1):0)||function(){if(!A)return 0;var t=18===A.kind||27===A.kind?e.tryCast(A.parent,e.isNamedImportsOrExports):e.isTypeKeywordTokenOrIdentifier(A)?e.tryCast(A.parent.parent,e.isNamedImportsOrExports):void 0;if(!t)return 0;e.isTypeKeywordTokenOrIdentifier(A)||(q=8);var r=(269===t.kind?t.parent.parent:t.parent).moduleSpecifier;if(!r)return G=!0,269===t.kind?2:0;var n=p.getSymbolAtLocation(r);if(!n)return G=!0,2;_e=3,G=!1;var i=p.getExportsAndPropertiesOfModule(n),a=new e.Set(t.elements.filter((function(e){return !Re(e)})).map((function(e){return (e.propertyName||e.name).escapedText}))),o=i.filter((function(e){return "default"!==e.escapedName&&!a.has(e.escapedName)}));return fe=e.concatenate(fe,o),o.length||(q=0),1}()||function(){var r,n=!A||18!==A.kind&&27!==A.kind?void 0:e.tryCast(A.parent,e.isNamedExports);if(!n)return 0;var i=e.findAncestor(n,e.or(e.isSourceFile,e.isModuleDeclaration));return _e=5,G=!1,null===(r=i.locals)||void 0===r||r.forEach((function(r,n){var a,o;fe.push(r),(null===(o=null===(a=i.symbol)||void 0===a?void 0:a.exports)||void 0===o?void 0:o.has(n))&&(me[e.getSymbolId(r)]=t.SortText.OptionalMember);})),1}()||(function(t){if(t){var r=t.parent;switch(t.kind){case 20:case 27:return e.isConstructorDeclaration(t.parent)?t.parent:void 0;default:if(Pe(t))return r.parent}}}(A)?(_e=5,G=!0,q=4,1):0)||function(){var t=function(t,r,n,i){switch(n.kind){case 348:return e.tryCast(n.parent,e.isObjectTypeDeclaration);case 1:var a=e.tryCast(e.lastOrUndefined(e.cast(n.parent,e.isSourceFile).statements),e.isObjectTypeDeclaration);if(a&&!e.findChildOfKind(a,19,t))return a;break;case 79:if(e.isPropertyDeclaration(n.parent)&&n.parent.initializer===n)return;if(ee(n))return e.findAncestor(n,e.isObjectTypeDeclaration)}if(r){if(134===n.kind||e.isIdentifier(r)&&e.isPropertyDeclaration(r.parent)&&e.isClassLike(n))return e.findAncestor(r,e.isClassLike);switch(r.kind){case 63:return;case 26:case 19:return ee(n)&&n.parent.name===n?n.parent.parent:e.tryCast(n,e.isObjectTypeDeclaration);case 18:case 27:return e.tryCast(r.parent,e.isObjectTypeDeclaration);default:if(!ee(r))return e.getLineAndCharacterOfPosition(t,r.getEnd()).line!==e.getLineAndCharacterOfPosition(t,i).line&&e.isObjectTypeDeclaration(n)?n:void 0;var o=e.isClassLike(r.parent.parent)?H:W;return o(r.kind)||41===r.kind||e.isIdentifier(r)&&o(e.stringToToken(r.text))?r.parent.parent:void 0}}}(a,A,V,s);if(!t)return 0;if(_e=3,G=!0,q=41===A.kind?0:e.isClassLike(t)?2:3,!e.isClassLike(t))return 1;var r=26===A.kind?A.parent.parent:A.parent,n=e.isClassElement(r)?e.getEffectiveModifierFlags(r):0;if(79===A.kind&&!Re(A))switch(A.getText()){case"private":n|=8;break;case"static":n|=32;break;case"override":n|=16384;}if(e.isClassStaticBlockDeclaration(r)&&(n|=32),!(8&n)){var i=e.isClassLike(t)&&16384&n?e.singleElementArray(e.getEffectiveBaseTypeNode(t)):e.getAllSuperTypeNodes(t),o=e.flatMap(i,(function(e){var r=p.getTypeAtLocation(e);return 32&n?(null==r?void 0:r.symbol)&&p.getPropertiesOfType(p.getTypeOfSymbolAtLocation(r.symbol,t)):r&&p.getPropertiesOfType(r)}));fe=e.concatenate(fe,function(t,r,n){for(var i=new e.Set,a=0,o=r;a<o.length;a++){var s=o[a];if(!(167!==s.kind&&169!==s.kind&&172!==s.kind&&173!==s.kind||Re(s)||e.hasEffectiveModifier(s,8)||e.isStatic(s)!==!!(32&n))){var c=e.getPropertyNameForPropertyNameNode(s.name);c&&i.add(c);}}return t.filter((function(t){return !(i.has(t.escapedName)||!t.declarations||8&e.getDeclarationModifierFlagsFromSymbol(t)||t.valueDeclaration&&e.isPrivateIdentifierClassElementDeclaration(t.valueDeclaration))}))}(o,t.members,n));}return 1}()||function(){var t=function(t){if(t){var r=t.parent;switch(t.kind){case 31:case 30:case 43:case 79:case 206:case 286:case 285:case 287:if(r&&(279===r.kind||280===r.kind)){if(31===t.kind){var n=e.findPrecedingToken(t.pos,a,void 0);if(!r.typeArguments||n&&43===n.kind)break}return r}if(285===r.kind)return r.parent.parent;break;case 10:if(r&&(285===r.kind||287===r.kind))return r.parent.parent;break;case 19:if(r&&288===r.kind&&r.parent&&285===r.parent.kind)return r.parent.parent.parent;if(r&&287===r.kind)return r.parent.parent}}}(A),r=t&&p.getContextualType(t.attributes);if(!r)return 0;var n=t&&p.getContextualType(t.attributes,4);return fe=e.concatenate(fe,function(t,r){for(var n=new e.Set,i=new e.Set,a=0,o=r;a<o.length;a++){var s=o[a];Re(s)||(285===s.kind?n.add(s.name.escapedText):e.isJsxSpreadAttribute(s)&&Oe(s,i));}var c=t.filter((function(e){return !n.has(e.escapedName)}));return Le(i,c),c}(X(r,n,t.attributes,p),t.attributes.properties)),Me(),_e=3,G=!1,1}()||(function(){q=function(t){if(t){var r,n=e.findAncestor(t.parent,(function(t){return e.isClassLike(t)?"quit":!(!e.isFunctionLikeDeclaration(t)||r!==t.body)||(r=t,!1)}));return n&&n}}(A)?5:1,_e=1,G=Ae(),F!==A&&e.Debug.assert(!!F,"Expected 'contextToken' to be defined when different from 'previousToken'.");var r=F!==A?F.getStart():s,n=function(t,r,n){for(var i=t;i&&!e.positionBelongsToNode(i,r,n);)i=i.parent;return i}(A,r,a)||a;D=function(t){switch(t.kind){case 305:case 223:case 288:case 235:return !0;default:return e.isStatement(t)}}(n);var i=2887656|(ve?0:111551),o=F&&!e.isValidTypeOnlyAliasUseSite(F);fe=e.concatenate(fe,p.getSymbolsInScope(n,i)),e.Debug.assertEachIsDefined(fe,"getSymbolsInScope() should all be defined");for(var l=0;l<fe.length;l++){var u=fe[l];if(p.isArgumentsSymbol(u)||e.some(u.declarations,(function(e){return e.getSourceFile()===a}))||(me[e.getSymbolId(u)]=t.SortText.GlobalsOrKeywords),o&&!(111551&u.flags)){var _=u.declarations&&e.find(u.declarations,e.isTypeOnlyImportOrExportDeclaration);if(_){var d={kind:64,declaration:_};ge[l]=d;}}}if(c.includeCompletionsWithInsertText&&305!==n.kind){var f=p.tryGetThisTypeAt(n,!1);if(f&&!function(e,t,r){var n=r.resolveName("self",void 0,111551,!1);if(n&&r.getTypeOfSymbolAtLocation(n,t)===e)return !0;var i=r.resolveName("global",void 0,111551,!1);if(i&&r.getTypeOfSymbolAtLocation(i,t)===e)return !0;var a=r.resolveName("globalThis",void 0,111551,!1);return !(!a||r.getTypeOfSymbolAtLocation(a,t)!==e)}(f,a,p))for(var g=0,m=Z(f,p);g<m.length;g++)u=m[g],ge[fe.length]={kind:1},fe.push(u),me[e.getSymbolId(u)]=t.SortText.SuggestedClassMembers;}Fe(),ve&&(q=A&&e.isAssertionExpression(A.parent)?6:7);}(),1))}function Fe(){var n,i;if((w||!de&&c.includeCompletionsForModuleExports&&(a.externalModuleIndicator||a.commonJsModuleIndicator||e.compilerOptionsIndicateEsModules(r.getCompilerOptions())||e.programContainsModules(r)))&&(e.Debug.assert(!(null==l?void 0:l.data),"Should not run 'collectAutoImports' when faster path is available via `data`"),!l||l.source)){Y|=1;var o=F===A&&w&&ne(w,A)?"":F&&e.isIdentifier(F)?F.text.toLowerCase():"",_=null===(n=u.getModuleSpecifierCache)||void 0===n?void 0:n.call(u),p=e.getExportInfoMap(a,u,r,d),g=null===(i=u.getPackageJsonAutoImportProvider)||void 0===i?void 0:i.call(u),m=l?void 0:e.createPackageJsonImportFilter(a,c,u);f("collectAutoImports",u,le||(le=e.codefix.createImportSpecifierResolver(a,r,u,c)),r,s,c,!!w,e.isValidTypeOnlyAliasUseSite(V),(function(r){p.search(a.path,B,(function(t,r){if(!e.isIdentifierText(t,e.getEmitScriptTarget(u.getCompilationSettings())))return !1;if(!l&&e.isStringANonContextualKeyword(t))return !1;if(!(ve||w||111551&r))return !1;if(ve&&!(790504&r))return !1;var n=t.charCodeAt(0);return (!B||!(n<65||n>90))&&(!!l||ce(t,o))}),(function(n,i,a,o){var s,c,u,_;if(!l||e.some(n,(function(t){return l.source===e.stripQuotes(t.moduleSymbol.name)}))){var d=e.find(n,y);if(d){var p=r.tryResolve(n,i,a)||{};if("failed"!==p){var f,g=d;"skipped"!==p&&(g=void 0===(s=p.exportInfo)?d:s,f=p.moduleSpecifier);var m=1===g.exportKind;c=m&&e.getLocalSymbolForExportDefault(g.symbol)||g.symbol,u={kind:f?32:4,moduleSpecifier:f,symbolName:i,exportMapKey:o,exportName:2===g.exportKind?"export=":g.symbol.name,fileName:g.moduleFileName,isDefaultExport:m,moduleSymbol:g.moduleSymbol,isFromPackageJson:g.isFromPackageJson},_=e.getSymbolId(c),me[_]!==t.SortText.GlobalsOrKeywords&&(ge[fe.length]=u,me[_]=w?t.SortText.LocationPriority:t.SortText.AutoImportSuggestions,fe.push(c));}}}})),pe=r.skippedAny(),Y|=r.resolvedAny()?8:0,Y|=r.resolvedBeyondLimit()?16:0;}));}function y(t){var n=e.tryCast(t.moduleSymbol.valueDeclaration,e.isSourceFile);if(!n){var i=e.stripQuotes(t.moduleSymbol.name);return (!e.JsTyping.nodeCoreModules.has(i)||e.startsWith(i,"node:")===e.shouldUseUriStyleNodeCoreModules(a,r))&&(!m||m.allowsImportingAmbientModule(t.moduleSymbol,he(t.isFromPackageJson)))}return e.isImportableFile(t.isFromPackageJson?g:r,a,n,c,m,he(t.isFromPackageJson),_)}}function Ae(){if(A){var e=A.parent.kind,t=Q(A);switch(t){case 27:return 208===e||171===e||209===e||204===e||221===e||179===e||205===e;case 20:return 208===e||171===e||209===e||212===e||191===e;case 22:return 204===e||176===e||162===e;case 141:case 142:case 100:return !0;case 24:return 261===e;case 18:return 257===e||205===e;case 63:return 254===e||221===e;case 15:return 223===e;case 16:return 233===e;case 131:return 169===e||297===e;case 41:return 169===e}if(H(t))return !0}return !1}function Pe(t){return !!t.parent&&e.isParameter(t.parent)&&e.isConstructorDeclaration(t.parent.parent)&&(e.isParameterPropertyModifier(t.kind)||e.isDeclarationName(t))}function we(t,r){return 63!==t.kind&&(26===t.kind||!e.positionsAreOnSameLine(t.end,r,a))}function Ie(t){return e.isFunctionLikeKind(t)&&171!==t}function Oe(e,t){var r=e.expression,n=p.getSymbolAtLocation(r),i=n&&p.getTypeOfSymbolAtLocation(n,r),a=i&&i.properties;a&&a.forEach((function(e){t.add(e.name);}));}function Me(){fe.forEach((function(r){var n;if(16777216&r.flags){var i=e.getSymbolId(r);me[i]=null!==(n=me[i])&&void 0!==n?n:t.SortText.OptionalMember;}}));}function Le(r,n){if(0!==r.size)for(var i=0,a=n;i<a.length;i++){var o=a[i];r.has(o.name)&&(me[e.getSymbolId(o)]=t.SortText.MemberDeclaredBySpreadAssignment);}}function Re(e){return e.getStart(a)<=s&&s<=e.getEnd()}}function j(t,r){var n=e.findPrecedingToken(t,r);return n&&t<=n.end&&(e.isMemberName(n)||e.isKeyword(n.kind))?{contextToken:e.findPrecedingToken(n.getFullStart(),r,void 0),previousToken:n}:{contextToken:n,previousToken:n}}function J(t,r,n,i){var a=r.isPackageJsonImport?i.getPackageJsonAutoImportProvider():n,o=a.getTypeChecker(),s=r.ambientModuleName?o.tryFindAmbientModule(r.ambientModuleName):r.fileName?o.getMergedSymbol(e.Debug.checkDefined(a.getSourceFile(r.fileName)).symbol):void 0;if(s){var c="export="===r.exportName?o.resolveExternalModuleSymbol(s):o.tryGetMemberInModuleExportsAndProperties(r.exportName,s);if(c)return {symbol:c="default"===r.exportName&&e.getLocalSymbolForExportDefault(c)||c,origin:N(r,t,s)}}}function z(t,r,n,i,a){var o=function(e){return l(e)||u(e)}(n)?n.symbolName:t.name;if(!(void 0===o||1536&t.flags&&e.isSingleOrDoubleQuote(o.charCodeAt(0))||e.isKnownSymbol(t))){var s={name:o,needsConvertPropertyAccess:!1};if(e.isIdentifierText(o,r,a?1:0)||t.valueDeclaration&&e.isPrivateIdentifierClassElementDeclaration(t.valueDeclaration))return s;switch(i){case 3:return;case 0:return {name:JSON.stringify(o),needsConvertPropertyAccess:!1};case 2:case 1:return 32===o.charCodeAt(0)?void 0:{name:o,needsConvertPropertyAccess:!0};case 5:case 4:return s;default:e.Debug.assertNever(i);}}}t.moduleSpecifierResolutionLimit=100,t.moduleSpecifierResolutionCacheAttemptLimit=1e3,t.SortText={LocalDeclarationPriority:"10",LocationPriority:"11",OptionalMember:"12",MemberDeclaredBySpreadAssignment:"13",SuggestedClassMembers:"14",GlobalsOrKeywords:"15",AutoImportSuggestions:"16",ClassMemberSnippets:"17",JavascriptIdentifiers:"18",Deprecated:function(e){return "z"+e},ObjectLiteralProperty:function(e,t){return "".concat(e,"\0").concat(t,"\0")},SortBelow:function(e){return e+"1"}},function(e){e.ThisProperty="ThisProperty/",e.ClassMemberSnippet="ClassMemberSnippet/",e.TypeOnlyAlias="TypeOnlyAlias/",e.ObjectLiteralMethodSnippet="ObjectLiteralMethodSnippet/";}(r=t.CompletionSource||(t.CompletionSource={})),function(e){e[e.ThisType=1]="ThisType",e[e.SymbolMember=2]="SymbolMember",e[e.Export=4]="Export",e[e.Promise=8]="Promise",e[e.Nullable=16]="Nullable",e[e.ResolvedExport=32]="ResolvedExport",e[e.TypeOnlyAlias=64]="TypeOnlyAlias",e[e.ObjectLiteralMethod=128]="ObjectLiteralMethod",e[e.SymbolMemberNoExport=2]="SymbolMemberNoExport",e[e.SymbolMemberExport=6]="SymbolMemberExport";}(n||(n={})),function(e){e[e.None=0]="None",e[e.All=1]="All",e[e.ClassElementKeywords=2]="ClassElementKeywords",e[e.InterfaceElementKeywords=3]="InterfaceElementKeywords",e[e.ConstructorParameterKeywords=4]="ConstructorParameterKeywords",e[e.FunctionLikeBodyKeywords=5]="FunctionLikeBodyKeywords",e[e.TypeAssertionKeywords=6]="TypeAssertionKeywords",e[e.TypeKeywords=7]="TypeKeywords",e[e.TypeKeyword=8]="TypeKeyword",e[e.Last=8]="Last";}(a||(a={})),function(e){e[e.Continue=0]="Continue",e[e.Success=1]="Success",e[e.Fail=2]="Fail";}(o||(o={})),t.getCompletionsAtPosition=function(r,n,a,o,s,c,l,u,_,d){var p,v=j(s,o).previousToken;if(!l||e.isInString(o,s,v)||function(t,r,n,i){switch(r){case".":case"@":return !0;case'"':case"'":case"`":return !!n&&e.isStringLiteralOrTemplate(n)&&i===n.getStart(t)+1;case"#":return !!n&&e.isPrivateIdentifier(n)&&!!e.getContainingClass(n);case"<":return !!n&&29===n.kind&&(!e.isBinaryExpression(n.parent)||te(n.parent));case"/":return !!n&&(e.isStringLiteralLike(n)?!!e.tryGetImportFromModuleSpecifier(n):43===n.kind&&e.isJsxClosingElement(n.parent));case" ":return !!n&&e.isImportKeyword(n)&&305===n.parent.kind;default:return e.Debug.assertNever(r)}}(o,l,v,s)){if(" "===l)return c.includeCompletionsForImportStatements&&c.includeCompletionsWithInsertText?{isGlobalCompletion:!0,isMemberCompletion:!1,isNewIdentifierLocation:!0,isIncomplete:!0,entries:[]}:void 0;var D=n.getCompilerOptions(),T=c.allowIncompleteCompletions?null===(p=r.getIncompleteCompletionsCache)||void 0===p?void 0:p.call(r):void 0;if(T&&3===u&&v&&e.isIdentifier(v)){var C=function(t,r,n,a,o,s,c){var l=t.get();if(l){var u=n.text.toLowerCase(),_=e.getExportInfoMap(r,o,a,c),d=f("continuePreviousIncompleteResponse",o,e.codefix.createImportSpecifierResolver(r,a,o,s),a,n.getStart(),s,!1,e.isValidTypeOnlyAliasUseSite(n),(function(t){var n=e.mapDefined(l.entries,(function(n){var s;if(!n.hasAction||!n.source||!n.data||m(n.data))return n;if(ce(n.name,u)){var c=e.Debug.checkDefined(J(n.name,n.data,a,o)).origin,l=_.get(r.path,n.data.exportMapKey),d=l&&t.tryResolve(l,n.name,!e.isExternalModuleNameRelative(e.stripQuotes(c.moduleSymbol.name)));if("skipped"===d)return n;if(d&&"failed"!==d){var p=i$1(i$1({},c),{kind:32,moduleSpecifier:d.moduleSpecifier});return n.data=E(p),n.source=P(p),n.sourceDisplay=[e.textPart(p.moduleSpecifier)],n}null===(s=o.log)||void 0===s||s.call(o,"Unexpected failure resolving auto import for '".concat(n.name,"' from '").concat(n.source,"'"));}}));return t.skippedAny()||(l.isIncomplete=void 0),n}));return l.entries=d,l.flags=4|(l.flags||0),l}}(T,o,v,n,r,c,_);if(C)return C}else null==T||T.clear();var k=t.StringCompletions.getStringLiteralCompletions(o,s,v,D,r,n,a,c);if(k)return k;if(v&&e.isBreakOrContinueStatement(v.parent)&&(81===v.kind||86===v.kind||79===v.kind))return function(r){var n=function(r){for(var n=[],i=new e.Map,a=r;a&&!e.isFunctionLike(a);){if(e.isLabeledStatement(a)){var o=a.label.text;i.has(o)||(i.set(o,!0),n.push({name:o,kindModifiers:"",kind:"label",sortText:t.SortText.LocationPriority}));}a=a.parent;}return n}(r);if(n.length)return {isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:!1,entries:n}}(v.parent);var N,F=B(n,a,o,D,s,c,void 0,r,d,_);if(F)switch(F.kind){case 0:var A=function(r,n,i,a,o,s,c,l,u){var _=s.symbols,d=s.contextToken,p=s.completionKind,f=s.isInSnippetScope,m=s.isNewIdentifierLocation,y=s.location,v=s.propertyAccessToConvert,D=s.keywordFilters,T=s.literals,C=s.symbolToOriginInfoMap,k=s.recommendedCompletion,E=s.isJsxInitializer,N=s.isTypeOnlyLocation,F=s.isJsxIdentifierExpected,A=s.isRightOfOpenTag,P=s.importCompletionNode,I=s.insideJsDocTagTypeExpression,O=s.symbolToSortTextMap,M=s.hasUnresolvedAutoImports;if(1===e.getLanguageVariant(r.scriptKind)){var L=function(r,n){var i=e.findAncestor(r,(function(e){switch(e.kind){case 281:return !0;case 43:case 31:case 79:case 206:return !1;default:return "quit"}}));if(i){var a=!!e.findChildOfKind(i,31,n),o=i.parent.openingElement.tagName.getText(n)+(a?"":">");return {isGlobalCompletion:!1,isMemberCompletion:!0,isNewIdentifierLocation:!1,optionalReplacementSpan:e.createTextSpanFromNode(i.tagName),entries:[{name:o,kind:"class",kindModifiers:void 0,sortText:t.SortText.LocationPriority}]}}}(y,r);if(L)return L}var R=e.createSortedArray();if(b(r,a)){var B=w(_,R,void 0,d,y,r,n,i,e.getEmitScriptTarget(a),o,p,c,a,l,N,v,F,E,P,k,C,O,F,A);!function(r,n,i,a,o){e.getNameTable(r).forEach((function(r,s){if(r!==n){var c=e.unescapeLeadingUnderscores(s);!i.has(c)&&e.isIdentifierText(c,a)&&(i.add(c),e.insertSorted(o,{name:c,kind:"warning",kindModifiers:"",sortText:t.SortText.JavascriptIdentifiers,isFromUncheckedFile:!0},g));}}));}(r,y.pos,B,e.getEmitScriptTarget(a),R);}else {if(!(m||_&&0!==_.length||0!==D))return;w(_,R,void 0,d,y,r,n,i,e.getEmitScriptTarget(a),o,p,c,a,l,N,v,F,E,P,k,C,O,F,A);}if(0!==D)for(var j=new e.Set(R.map((function(e){return e.name}))),J=0,z=V(D,!I&&e.isSourceFileJS(r));J<z.length;J++){var K=z[J];(N&&e.isTypeKeyword(e.stringToToken(K.name))||!j.has(K.name))&&e.insertSorted(R,K,g,!0);}for(var U=new e.Set(R.map((function(e){return e.name}))),q=0,W=function(r,n){var i=[];if(r){var a=r.getSourceFile(),o=r.parent,s=a.getLineAndCharacterOfPosition(r.end).line,c=a.getLineAndCharacterOfPosition(n).line;(e.isImportDeclaration(o)||e.isExportDeclaration(o)&&o.moduleSpecifier)&&r===o.moduleSpecifier&&s===c&&i.push({name:e.tokenToString(129),kind:"keyword",kindModifiers:"",sortText:t.SortText.GlobalsOrKeywords});}return i}(d,u);q<W.length;q++)K=W[q],U.has(K.name)||e.insertSorted(R,K,g,!0);for(var H=0,G=T;H<G.length;H++){var Q=G[H];e.insertSorted(R,S(r,c,Q),g,!0);}return {flags:s.flags,isGlobalCompletion:f,isIncomplete:!(!c.allowIncompleteCompletions||!M)||void 0,isMemberCompletion:x(p),isNewIdentifierLocation:m,optionalReplacementSpan:h(y),entries:R}}(o,r,n,D,a,F,c,d,s);return (null==A?void 0:A.isIncomplete)&&(null==T||T.set(A)),A;case 1:return y(e.JsDoc.getJSDocTagNameCompletions());case 2:return y(e.JsDoc.getJSDocTagCompletions());case 3:return y(e.JsDoc.getJSDocParameterNameCompletions(F.tag));case 4:return N=F.keywordCompletions,{isGlobalCompletion:!1,isMemberCompletion:!1,isNewIdentifierLocation:F.isNewIdentifierLocation,entries:N.slice()};default:return e.Debug.assertNever(F)}}},t.getCompletionEntriesFromSymbols=w,t.getCompletionEntryDetails=function(n,i,a,o,s,c,_,p,f){var g=n.getTypeChecker(),m=n.getCompilerOptions(),y=s.name,v=s.source,h=s.data,b=e.findPrecedingToken(o,a);if(e.isInString(a,o,b))return t.StringCompletions.getStringLiteralCompletionDetails(y,a,o,b,g,m,c,f,p);var x=I(n,i,a,o,s,c,p);switch(x.type){case"request":var S=x.request;switch(S.kind){case 1:return e.JsDoc.getJSDocTagNameCompletionDetails(y);case 2:return e.JsDoc.getJSDocTagCompletionDetails(y);case 3:return e.JsDoc.getJSDocParameterNameCompletionDetails(y);case 4:return e.some(S.keywordCompletions,(function(e){return e.name===y}))?O(y,"keyword",e.SymbolDisplayPartKind.keyword):void 0;default:return e.Debug.assertNever(S)}case"symbol":var T=x.symbol,k=x.location,E=x.contextToken,N=x.origin,F=x.previousToken,A=function(t,n,i,a,o,s,c,_,p,f,g,m,y,v,h){if((null==v?void 0:v.moduleSpecifier)&&g&&re(i||g).replacementNode)return {codeActions:void 0,sourceDisplay:[e.textPart(v.moduleSpecifier)]};if(h===r.ClassMemberSnippet){var b=C(c,s,_,y,t,o,n,i,m).importAdder;if(b)return {sourceDisplay:void 0,codeActions:[{changes:e.textChanges.ChangeTracker.with({host:c,formatContext:m,preferences:y},b.writeFixes),description:e.diagnosticToString([e.Diagnostics.Includes_imports_of_types_referenced_by_0,t])}]}}if(d(a)){var x=e.codefix.getPromoteTypeOnlyCompletionAction(p,a.declaration.name,s,c,m,y);return e.Debug.assertIsDefined(x,"Expected to have a code action for promoting type-only alias"),{codeActions:[x],sourceDisplay:void 0}}if(!a||!l(a)&&!u(a))return {codeActions:void 0,sourceDisplay:void 0};var D=a.isFromPackageJson?c.getPackageJsonAutoImportProvider().getTypeChecker():s.getTypeChecker(),S=a.moduleSymbol,T=D.getMergedSymbol(e.skipAlias(o.exportSymbol||o,D)),k=29===(null==i?void 0:i.kind)&&e.isJsxOpeningLikeElement(i.parent),E=e.codefix.getImportCompletionAction(T,S,p,e.getNameForExportedSymbol(o,e.getEmitScriptTarget(_),k),k,c,s,m,g&&e.isIdentifier(g)?g.getStart(p):f,y),N=E.moduleSpecifier,F=E.codeAction;return e.Debug.assert(!(null==v?void 0:v.moduleSpecifier)||N===v.moduleSpecifier),{sourceDisplay:[e.textPart(N)],codeActions:[F]}}(y,k,E,N,T,n,c,m,a,o,F,_,p,h,v);return M(T,g,a,k,f,A.codeActions,A.sourceDisplay);case"literal":var P=x.literal;return O(D(a,p,P),"string","string"==typeof P?e.SymbolDisplayPartKind.stringLiteral:e.SymbolDisplayPartKind.numericLiteral);case"none":return U().some((function(e){return e.name===y}))?O(y,"keyword",e.SymbolDisplayPartKind.keyword):void 0;default:e.Debug.assertNever(x);}},t.createCompletionDetailsForSymbol=M,t.createCompletionDetails=L,t.getCompletionEntrySymbol=function(e,t,r,n,i,a,o){var s=I(e,t,r,n,i,a,o);return "symbol"===s.type?s.symbol:void 0},function(e){e[e.Data=0]="Data",e[e.JsDocTagName=1]="JsDocTagName",e[e.JsDocTag=2]="JsDocTag",e[e.JsDocParameterName=3]="JsDocParameterName",e[e.Keywords=4]="Keywords";}(s||(s={})),(c=t.CompletionKind||(t.CompletionKind={}))[c.ObjectPropertyDeclaration=0]="ObjectPropertyDeclaration",c[c.Global=1]="Global",c[c.PropertyAccess=2]="PropertyAccess",c[c.MemberLike=3]="MemberLike",c[c.String=4]="String",c[c.None=5]="None";var K=[],U=e.memoize((function(){for(var r=[],n=81;n<=160;n++)r.push({name:e.tokenToString(n),kind:"keyword",kindModifiers:"",sortText:t.SortText.GlobalsOrKeywords});return r}));function V(t,r){if(!r)return q(t);var n=t+8+1;return K[n]||(K[n]=q(t).filter((function(t){return !function(e){switch(e){case 126:case 130:case 158:case 133:case 135:case 92:case 157:case 117:case 137:case 118:case 139:case 140:case 141:case 142:case 143:case 147:case 148:case 159:case 121:case 122:case 123:case 145:case 150:case 151:case 152:case 154:case 155:return !0;default:return !1}}(e.stringToToken(t.name))})))}function q(t){return K[t]||(K[t]=U().filter((function(r){var n=e.stringToToken(r.name);switch(t){case 0:return !1;case 1:return G(n)||135===n||141===n||152===n||142===n||126===n||e.isTypeKeyword(n)&&153!==n;case 5:return G(n);case 2:return H(n);case 3:return W(n);case 4:return e.isParameterPropertyModifier(n);case 6:return e.isTypeKeyword(n)||85===n;case 7:return e.isTypeKeyword(n);case 8:return 152===n;default:return e.Debug.assertNever(t)}})))}function W(e){return 145===e}function H(t){switch(t){case 126:case 134:case 136:case 149:case 131:case 135:case 159:return !0;default:return e.isClassMemberModifier(t)}}function G(t){return 131===t||132===t||127===t||!e.isContextualKeyword(t)&&!H(t)}function Q(t){return e.isIdentifier(t)?t.originalKeywordKind||0:t.kind}function X(t,r,n,i){var a=r&&r!==t,o=!a||3&r.flags?t:i.getUnionType([t,r]),s=function(t,r,n){return t.isUnion()?n.getAllPossiblePropertiesOfTypes(e.filter(t.types,(function(t){return !(131068&t.flags||n.isArrayLikeType(t)||n.isTypeInvalidDueToUnionDiscriminant(t,r)||e.typeHasCallOrConstructSignatures(t,n)||t.isClass()&&Y(t.getApparentProperties()))}))):t.getApparentProperties()}(o,n,i);return o.isClass()&&Y(s)?[]:a?e.filter(s,(function(t){return !e.length(t.declarations)||e.some(t.declarations,(function(e){return e.parent!==n}))})):s}function Y(t){return e.some(t,(function(t){return !!(24&e.getDeclarationModifierFlagsFromSymbol(t))}))}function Z(t,r){return t.isUnion()?e.Debug.checkEachDefined(r.getAllPossiblePropertiesOfTypes(t.types),"getAllPossiblePropertiesOfTypes() should all be defined"):e.Debug.checkEachDefined(t.getApparentProperties(),"getApparentProperties() should all be defined")}function $(t,r){if(t){if(e.isTypeNode(t)&&e.isTypeReferenceType(t.parent))return r.getTypeArgumentConstraint(t);var n=$(t.parent,r);if(n)switch(t.kind){case 166:return r.getTypeOfPropertyOfContextualType(n,t.symbol.escapedName);case 188:case 182:case 187:return n}}}function ee(t){return t.parent&&e.isClassOrTypeElement(t.parent)&&e.isObjectTypeDeclaration(t.parent.parent)}function te(t){var r=t.left;return e.nodeIsMissing(r)}function re(t){var r,n=!1,i=function(){var i=t.parent;if(e.isImportEqualsDeclaration(i))return r=152===t.kind?void 0:152,ae(i.moduleReference)?i:void 0;if(ne(i,t)&&ie(i.parent))return i;if(!e.isNamedImports(i)&&!e.isNamespaceImport(i))return e.isImportKeyword(t)&&e.isSourceFile(i)?(r=152,t):e.isImportKeyword(t)&&e.isImportDeclaration(i)?(r=152,ae(i.moduleSpecifier)?i:void 0):void 0;if(i.parent.isTypeOnly||18!==t.kind&&100!==t.kind&&27!==t.kind||(r=152),ie(i)){if(19!==t.kind&&79!==t.kind)return i.parent.parent;n=!0,r=156;}}();return {isKeywordOnlyCompletion:n,keywordCompletion:r,isNewIdentifierLocation:!(!i&&152!==r),replacementNode:i&&e.rangeIsOnSingleLine(i,i.getSourceFile())?i:void 0}}function ne(t,r){return e.isImportSpecifier(t)&&(t.isTypeOnly||r===t.name&&e.isTypeKeywordTokenOrIdentifier(r))}function ie(t){return ae(t.parent.parent.moduleSpecifier)&&(e.isNamespaceImport(t)||t.elements.length<2)&&!t.parent.name}function ae(t){var r;return !!e.nodeIsMissing(t)||!(null===(r=e.tryCast(e.isExternalModuleReference(t)?t.expression:t,e.isStringLiteralLike))||void 0===r?void 0:r.text)}function oe(t,r,n){return void 0===n&&(n=new e.Map),i(t)||i(e.skipAlias(t.exportSymbol||t,r));function i(t){return !!(788968&t.flags)||r.isUnknownSymbol(t)||!!(1536&t.flags)&&e.addToSeen(n,e.getSymbolId(t))&&r.getExportsOfModule(t).some((function(e){return oe(e,r,n)}))}}function se(t,r){var n=e.skipAlias(t,r).declarations;return !!e.length(n)&&e.every(n,e.isDeprecatedDeclaration)}function ce(e,t){if(0===t.length)return !0;for(var r,n=!1,i=0,a=e.length,o=0;o<a;o++){var s=e.charCodeAt(o),c=t.charCodeAt(i);if((s===c||s===(97<=(l=c)&&l<=122?l-32:l))&&(n||(n=void 0===r||97<=r&&r<=122&&65<=s&&s<=90||95===r&&95!==s),n&&i++,i===t.length))return !0;r=s;}var l;return !1}t.getPropertiesForObjectExpression=X;}(e.Completions||(e.Completions={}));}(t),function(e){!function(t){function r(t,r){return {fileName:r.fileName,textSpan:e.createTextSpanFromNode(t,r),kind:"none"}}function i(t){return e.isThrowStatement(t)?[t]:e.isTryStatement(t)?e.concatenate(t.catchClause?i(t.catchClause):t.tryBlock&&i(t.tryBlock),t.finallyBlock&&i(t.finallyBlock)):e.isFunctionLike(t)?void 0:o(t,i)}function a(t){return e.isBreakOrContinueStatement(t)?[t]:e.isFunctionLike(t)?void 0:o(t,a)}function o(t,r){var n=[];return t.forEachChild((function(t){var i=r(t);void 0!==i&&n.push.apply(n,e.toArray(i));})),n}function s(e,t){var r=c(t);return !!r&&r===e}function c(t){return e.findAncestor(t,(function(r){switch(r.kind){case 249:if(245===t.kind)return !1;case 242:case 243:case 244:case 241:case 240:return !t.label||function(t,r){return !!e.findAncestor(t.parent,(function(t){return e.isLabeledStatement(t)?t.label.escapedText===r:"quit"}))}(r,t.label.escapedText);default:return e.isFunctionLike(r)&&"quit"}}))}function l(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return !(!r||!e.contains(n,r.kind)||(t.push(r),0))}function u(t){var r=[];if(l(r,t.getFirstToken(),97,115,90)&&240===t.kind)for(var n=t.getChildren(),i=n.length-1;i>=0&&!l(r,n[i],115);i--);return e.forEach(a(t.statement),(function(e){s(t,e)&&l(r,e.getFirstToken(),81,86);})),r}function _(e){var t=c(e);if(t)switch(t.kind){case 242:case 243:case 244:case 240:case 241:return u(t);case 249:return d(t)}}function d(t){var r=[];return l(r,t.getFirstToken(),107),e.forEach(t.caseBlock.clauses,(function(n){l(r,n.getFirstToken(),82,88),e.forEach(a(n),(function(e){s(t,e)&&l(r,e.getFirstToken(),81);}));})),r}function p(t,r){var n=[];return l(n,t.getFirstToken(),111),t.catchClause&&l(n,t.catchClause.getFirstToken(),83),t.finallyBlock&&l(n,e.findChildOfKind(t,96,r),96),n}function f(t,r){var n=function(t){for(var r=t;r.parent;){var n=r.parent;if(e.isFunctionBlock(n)||305===n.kind)return n;if(e.isTryStatement(n)&&n.tryBlock===r&&n.catchClause)return r;r=n;}}(t);if(n){var a=[];return e.forEach(i(n),(function(t){a.push(e.findChildOfKind(t,109,r));})),e.isFunctionBlock(n)&&e.forEachReturnStatement(n,(function(t){a.push(e.findChildOfKind(t,105,r));})),a}}function g(t,r){var n=e.getContainingFunction(t);if(n){var a=[];return e.forEachReturnStatement(e.cast(n.body,e.isBlock),(function(t){a.push(e.findChildOfKind(t,105,r));})),e.forEach(i(n.body),(function(t){a.push(e.findChildOfKind(t,109,r));})),a}}function m(t){var r=e.getContainingFunction(t);if(r){var n=[];return r.modifiers&&r.modifiers.forEach((function(e){l(n,e,131);})),e.forEachChild(r,(function(t){y(t,(function(t){e.isAwaitExpression(t)&&l(n,t.getFirstToken(),132);}));})),n}}function y(t,r){r(t),e.isFunctionLike(t)||e.isClassLike(t)||e.isInterfaceDeclaration(t)||e.isModuleDeclaration(t)||e.isTypeAliasDeclaration(t)||e.isTypeNode(t)||e.forEachChild(t,(function(e){return y(e,r)}));}t.getDocumentHighlights=function(t,i,a,o,s){var c=e.getTouchingPropertyName(a,o);if(c.parent&&(e.isJsxOpeningElement(c.parent)&&c.parent.tagName===c||e.isJsxClosingElement(c.parent))){var v=c.parent.parent,h=[v.openingElement,v.closingElement].map((function(e){return r(e.tagName,a)}));return [{fileName:a.fileName,highlightSpans:h}]}return function(t,r,n,i,a){var o=new e.Set(a.map((function(e){return e.fileName}))),s=e.FindAllReferences.getReferenceEntriesForNode(t,r,n,a,i,void 0,o);if(s){var c=e.arrayToMultiMap(s.map(e.FindAllReferences.toHighlightSpan),(function(e){return e.fileName}),(function(e){return e.span})),l=e.createGetCanonicalFileName(n.useCaseSensitiveFileNames());return e.mapDefined(e.arrayFrom(c.entries()),(function(t){var r=t[0],i=t[1];if(!o.has(r)){if(!n.redirectTargetsMap.has(e.toPath(r,n.getCurrentDirectory(),l)))return;var s=n.getSourceFile(r);r=e.find(a,(function(e){return !!e.redirectInfo&&e.redirectInfo.redirectTarget===s})).fileName,e.Debug.assert(o.has(r));}return {fileName:r,highlightSpans:i}}))}}(o,c,t,i,s)||function(t,i){var a=function(t,i){switch(t.kind){case 99:case 91:return e.isIfStatement(t.parent)?function(t,n){for(var i=function(t,r){for(var n=[];e.isIfStatement(t.parent)&&t.parent.elseStatement===t;)t=t.parent;for(;;){var i=t.getChildren(r);l(n,i[0],99);for(var a=i.length-1;a>=0&&!l(n,i[a],91);a--);if(!t.elseStatement||!e.isIfStatement(t.elseStatement))break;t=t.elseStatement;}return n}(t,n),a=[],o=0;o<i.length;o++){if(91===i[o].kind&&o<i.length-1){for(var s=i[o],c=i[o+1],u=!0,_=c.getStart(n)-1;_>=s.end;_--)if(!e.isWhiteSpaceSingleLine(n.text.charCodeAt(_))){u=!1;break}if(u){a.push({fileName:n.fileName,textSpan:e.createTextSpanFromBounds(s.getStart(),c.end),kind:"reference"}),o++;continue}}a.push(r(i[o],n));}return a}(t.parent,i):void 0;case 105:return c(t.parent,e.isReturnStatement,g);case 109:return c(t.parent,e.isThrowStatement,f);case 111:case 83:case 96:return c(83===t.kind?t.parent.parent:t.parent,e.isTryStatement,p);case 107:return c(t.parent,e.isSwitchStatement,d);case 82:case 88:return e.isDefaultClause(t.parent)||e.isCaseClause(t.parent)?c(t.parent.parent.parent,e.isSwitchStatement,d):void 0;case 81:case 86:return c(t.parent,e.isBreakOrContinueStatement,_);case 97:case 115:case 90:return c(t.parent,(function(t){return e.isIterationStatement(t,!0)}),u);case 134:return s(e.isConstructorDeclaration,[134]);case 136:case 149:return s(e.isAccessor,[136,149]);case 132:return c(t.parent,e.isAwaitExpression,m);case 131:return v(m(t));case 125:return v(function(t){var r=e.getContainingFunction(t);if(r){var n=[];return e.forEachChild(r,(function(t){y(t,(function(t){e.isYieldExpression(t)&&l(n,t.getFirstToken(),125);}));})),n}}(t));case 101:return;default:return e.isModifierKind(t.kind)&&(e.isDeclaration(t.parent)||e.isVariableStatement(t.parent))?v((a=t.kind,o=t.parent,e.mapDefined(function(t,r){var i=t.parent;switch(i.kind){case 262:case 305:case 235:case 289:case 290:return 128&r&&e.isClassDeclaration(t)?n$4(n$4([],t.members,!0),[t],!1):i.statements;case 171:case 169:case 256:return n$4(n$4([],i.parameters,!0),e.isClassLike(i.parent)?i.parent.members:[],!0);case 257:case 226:case 258:case 182:var a=i.members;if(92&r){var o=e.find(i.members,e.isConstructorDeclaration);if(o)return n$4(n$4([],a,!0),o.parameters,!0)}else if(128&r)return n$4(n$4([],a,!0),[i],!1);return a;case 205:return;default:e.Debug.assertNever(i,"Invalid container kind.");}}(o,e.modifierToFlag(a)),(function(t){return e.findModifier(t,a)})))):void 0}var a,o;function s(r,n){return c(t.parent,r,(function(t){return e.mapDefined(t.symbol.declarations,(function(t){return r(t)?e.find(t.getChildren(i),(function(t){return e.contains(n,t.kind)})):void 0}))}))}function c(e,t,r){return t(e)?v(r(e,i)):void 0}function v(e){return e&&e.map((function(e){return r(e,i)}))}}(t,i);return a&&[{fileName:i.fileName,highlightSpans:a}]}(c,a)};}(e.DocumentHighlights||(e.DocumentHighlights={}));}(t),function(e){function t(e){return !!e.sourceFile}function r(r,n,a){void 0===n&&(n="");var o=new e.Map,s=e.createGetCanonicalFileName(!!r);function c(e){return "function"==typeof e.getCompilationSettings?e.getCompilationSettings():e}function l(e,t,r,n,i,a,o){return d(e,t,r,n,i,a,!0,o)}function u(e,t,r,n,i,a,o){return d(e,t,c(r),n,i,a,!1,o)}function _(r,n){var i=t(r)?r:r.get(e.Debug.checkDefined(n,"If there are more than one scriptKind's for same document the scriptKind should be provided"));return e.Debug.assert(void 0===n||!i||i.sourceFile.scriptKind===n,"Script kind should match provided ScriptKind:".concat(n," and sourceFile.scriptKind: ").concat(null==i?void 0:i.sourceFile.scriptKind,", !entry: ").concat(!i)),i}function d(r,n,i,s,l,u,d,p){var f,g,m,y;p=e.ensureScriptKind(r,p);var v=c(i),h=i===v?void 0:i,b={languageVersion:6===p?100:e.getEmitScriptTarget(v),impliedNodeFormat:h&&e.getImpliedNodeFormatForFile(n,null===(y=null===(m=null===(g=null===(f=h.getCompilerHost)||void 0===f?void 0:f.call(h))||void 0===g?void 0:g.getModuleResolutionCache)||void 0===m?void 0:m.call(g))||void 0===y?void 0:y.getPackageJsonInfoCache(),h,v),setExternalModuleIndicator:e.getSetExternalModuleIndicator(v)},x=o.size,D=e.getOrUpdate(o,s,(function(){return new e.Map}));if(e.tracing){o.size>x&&e.tracing.instant("session","createdDocumentRegistryBucket",{configFilePath:v.configFilePath,key:s});var S=!e.isDeclarationFileName(n)&&e.forEachEntry(o,(function(e,t){return t!==s&&e.has(n)&&t}));S&&e.tracing.instant("session","documentRegistryBucketOverlap",{path:n,key1:S,key2:s});}var T=D.get(n),C=T&&_(T,p);if(!C&&a&&(k=a.getDocument(s,n))&&(e.Debug.assert(d),C={sourceFile:k,languageServiceRefCount:0},E()),C)C.sourceFile.version!==u&&(C.sourceFile=e.updateLanguageServiceSourceFile(C.sourceFile,l,u,l.getChangeRange(C.sourceFile.scriptSnapshot)),a&&a.setDocument(s,n,C.sourceFile)),d&&C.languageServiceRefCount++;else {var k=e.createLanguageServiceSourceFile(r,l,b,u,!1,p);a&&a.setDocument(s,n,k),C={sourceFile:k,languageServiceRefCount:1},E();}return e.Debug.assert(0!==C.languageServiceRefCount),C.sourceFile;function E(){if(T)if(t(T)){var r=new e.Map;r.set(T.sourceFile.scriptKind,T),r.set(p,C),D.set(n,r);}else T.set(p,C);else D.set(n,C);}}function p(r,n,i){var a=e.Debug.checkDefined(o.get(n)),s=a.get(r),c=_(s,i);c.languageServiceRefCount--,e.Debug.assert(c.languageServiceRefCount>=0),0===c.languageServiceRefCount&&(t(s)?a.delete(r):(s.delete(i),1===s.size&&a.set(r,e.firstDefinedIterator(s.values(),e.identity))));}return {acquireDocument:function(t,r,a,o,u){return l(t,e.toPath(t,n,s),r,i(c(r)),a,o,u)},acquireDocumentWithKey:l,updateDocument:function(t,r,a,o,l){return u(t,e.toPath(t,n,s),r,i(c(r)),a,o,l)},updateDocumentWithKey:u,releaseDocument:function(t,r,a){return p(e.toPath(t,n,s),i(r),a)},releaseDocumentWithKey:p,getLanguageServiceRefCounts:function(t,r){return e.arrayFrom(o.entries(),(function(e){var n=e[0],i=e[1].get(t),a=i&&_(i,r);return [n,a&&a.languageServiceRefCount]}))},reportStats:function(){var r=e.arrayFrom(o.keys()).filter((function(e){return e&&"_"===e.charAt(0)})).map((function(e){var r=o.get(e),n=[];return r.forEach((function(e,r){t(e)?n.push({name:r,scriptKind:e.sourceFile.scriptKind,refCount:e.languageServiceRefCount}):e.forEach((function(e,t){return n.push({name:r,scriptKind:t,refCount:e.languageServiceRefCount})}));})),n.sort((function(e,t){return t.refCount-e.refCount})),{bucket:e,sourceFiles:n}}));return JSON.stringify(r,void 0,2)},getKeyForCompilationSettings:i}}function n(t){var r;if(null===t||"object"!=typeof t)return ""+t;if(e.isArray(t))return "[".concat(null===(r=e.map(t,(function(e){return n(e)})))||void 0===r?void 0:r.join(","),"]");var i="{";for(var a in t)e.hasOwnProperty.call(t,a)&&(i+="".concat(a,": ").concat(n(t[a])));return i+"}"}function i(t){return e.sourceFileAffectingCompilerOptions.map((function(r){return n(e.getCompilerOptionValue(t,r))})).join("|")+(t.pathsBasePath?"|".concat(t.pathsBasePath):void 0)}e.createDocumentRegistry=function(e,t){return r(e,t)},e.createDocumentRegistryInternal=r;}(t),function(e){!function(t){function r(t,r){return e.forEach(305===t.kind?t.statements:t.body.statements,(function(t){return r(t)||c(t)&&e.forEach(t.body&&t.body.statements,r)}))}function n(t,n){if(t.externalModuleIndicator||void 0!==t.imports)for(var i=0,a=t.imports;i<a.length;i++){var o=a[i];n(e.importFromModuleSpecifier(o),o);}else r(t,(function(t){switch(t.kind){case 272:case 266:(r=t).moduleSpecifier&&e.isStringLiteral(r.moduleSpecifier)&&n(r,r.moduleSpecifier);break;case 265:var r;l(r=t)&&n(r,r.moduleReference.expression);}}));}function a(t,r,n){var i=t.parent;if(i){var a=n.getMergedSymbol(i);return e.isExternalModuleSymbol(a)?{exportingModuleSymbol:a,exportKind:r}:void 0}}function o(e,t){return t.getMergedSymbol(s(e).symbol)}function s(t){if(208===t.kind)return t.getSourceFile();var r=t.parent;return 305===r.kind?r:(e.Debug.assert(262===r.kind),e.cast(r.parent,c))}function c(e){return 261===e.kind&&10===e.name.kind}function l(e){return 277===e.moduleReference.kind&&10===e.moduleReference.expression.kind}var u,_;t.createImportTracker=function(t,a,u,_){var d=function(t,r,i){for(var a=new e.Map,o=0,s=t;o<s.length;o++){var c=s[o];i&&i.throwIfCancellationRequested(),n(c,(function(t,n){var i=r.getSymbolAtLocation(n);if(i){var o=e.getSymbolId(i).toString(),s=a.get(o);s||a.set(o,s=[]),s.push(t);}}));}return a}(t,u,_);return function(n,p,f){var g=function(t,n,i,a,l,u){var _=a.exportingModuleSymbol,d=a.exportKind,p=e.nodeSeenTracker(),f=e.nodeSeenTracker(),g=[],m=!!_.globalExports,y=m?void 0:[];return function t(r){var n=x(r);if(n)for(var i=0,a=n;i<a.length;i++){var _=a[i];if(p(_))switch(u&&u.throwIfCancellationRequested(),_.kind){case 208:if(e.isImportCall(_)){S=_,b(e.findAncestor(S,c)||S.getSourceFile(),!!v(S,!0));break}if(!m){var f=_.parent;if(2===d&&254===f.kind){var y=f.name;if(79===y.kind){g.push(y);break}}}break;case 79:break;case 265:h(_,_.name,e.hasSyntacticModifier(_,1),!1);break;case 266:g.push(_);var D=_.importClause&&_.importClause.namedBindings;D&&268===D.kind?h(_,D.name,!1,!0):!m&&e.isDefaultImport(_)&&b(s(_));break;case 272:_.exportClause?274===_.exportClause.kind?b(s(_),!0):g.push(_):t(o(_,l));break;case 200:_.isTypeOf&&!_.qualifier&&v(_)&&b(_.getSourceFile(),!0),g.push(_);break;default:e.Debug.failBadSyntaxKind(_,"Unexpected import kind.");}}var S;}(_),{directImports:g,indirectUsers:function(){if(m)return t;if(_.declarations)for(var r=0,i=_.declarations;r<i.length;r++){var a=i[r];e.isExternalModuleAugmentation(a)&&n.has(a.getSourceFile().fileName)&&b(a);}return y.map(e.getSourceFileOfNode)}()};function v(t,r){return void 0===r&&(r=!1),e.findAncestor(t,(function(t){return r&&c(t)?"quit":e.some(t.modifiers,(function(e){return 93===e.kind}))}))}function h(t,n,i,a){if(2===d)a||g.push(t);else if(!m){var o=s(t);e.Debug.assert(305===o.kind||261===o.kind),i||function(t,n,i){var a=i.getSymbolAtLocation(n);return !!r(t,(function(t){if(e.isExportDeclaration(t)){var r=t.exportClause;return !t.moduleSpecifier&&r&&e.isNamedExports(r)&&r.elements.some((function(e){return i.getExportSpecifierLocalTargetSymbol(e)===a}))}}))}(o,n,l)?b(o,!0):b(o);}}function b(t,r){if(void 0===r&&(r=!1),e.Debug.assert(!m),f(t)&&(y.push(t),r)){var n=l.getMergedSymbol(t.symbol);if(n){e.Debug.assert(!!(1536&n.flags));var i=x(n);if(i)for(var a=0,o=i;a<o.length;a++){var c=o[a];e.isImportTypeNode(c)||b(s(c),!0);}}}}function x(t){return i.get(e.getSymbolId(t).toString())}}(t,a,d,p,u,_),m=g.directImports,y=g.indirectUsers;return i$1({indirectUsers:y},function(t,r,n,i,a){var o=[],s=[];function c(e,t){o.push([e,t]);}if(t)for(var u=0,_=t;u<_.length;u++)d(_[u]);return {importSearches:o,singleReferences:s};function d(t){if(265!==t.kind)if(79!==t.kind)if(200!==t.kind){if(10===t.moduleSpecifier.kind)if(272!==t.kind){var o=t.importClause||{name:void 0,namedBindings:void 0},u=o.name,_=o.namedBindings;if(_)switch(_.kind){case 268:p(_.name);break;case 269:0!==n&&1!==n||f(_);break;default:e.Debug.assertNever(_);}!u||1!==n&&2!==n||a&&u.escapedText!==e.symbolEscapedNameNoDefault(r)||c(u,i.getSymbolAtLocation(u));}else t.exportClause&&e.isNamedExports(t.exportClause)&&f(t.exportClause);}else if(t.qualifier){var d=e.getFirstIdentifier(t.qualifier);d.escapedText===e.symbolName(r)&&s.push(d);}else 2===n&&s.push(t.argument.literal);else p(t);else l(t)&&p(t.name);}function p(e){2!==n||a&&!g(e.escapedText)||c(e,i.getSymbolAtLocation(e));}function f(e){if(e)for(var t=0,n=e.elements;t<n.length;t++){var o=n[t],l=o.name,u=o.propertyName;g((u||l).escapedText)&&(u?(s.push(u),a&&l.escapedText!==r.escapedName||c(l,i.getSymbolAtLocation(l))):c(l,275===o.kind&&o.propertyName?i.getExportSpecifierLocalTargetSymbol(o):i.getSymbolAtLocation(l)));}}function g(e){return e===r.escapedName||0!==n&&"default"===e}}(m,n,p.exportKind,u,f))}},(_=t.ExportKind||(t.ExportKind={}))[_.Named=0]="Named",_[_.Default=1]="Default",_[_.ExportEquals=2]="ExportEquals",(u=t.ImportExport||(t.ImportExport={}))[u.Import=0]="Import",u[u.Export=1]="Export",t.findModuleReferences=function(e,t,r){for(var i=[],a=e.getTypeChecker(),o=0,s=t;o<s.length;o++){var c=s[o],l=r.valueDeclaration;if(305===(null==l?void 0:l.kind)){for(var u=0,_=c.referencedFiles;u<_.length;u++){var d=_[u];e.getSourceFileFromReference(c,d)===l&&i.push({kind:"reference",referencingFile:c,ref:d});}for(var p=0,f=c.typeReferenceDirectives;p<f.length;p++){d=f[p];var g=e.getResolvedTypeReferenceDirectives().get(d.fileName,d.resolutionMode||c.impliedNodeFormat);void 0!==g&&g.resolvedFileName===l.fileName&&i.push({kind:"reference",referencingFile:c,ref:d});}}n(c,(function(e,t){a.getSymbolAtLocation(t)===r&&i.push({kind:"import",literal:t});}));}return i},t.getImportOrExportSymbol=function(t,r,n,i){return i?o():o()||function(){if(function(t){var r=t.parent;switch(r.kind){case 265:return r.name===t&&l(r);case 270:return !r.propertyName;case 267:case 268:return e.Debug.assert(r.name===t),!0;case 203:return e.isInJSFile(t)&&e.isVariableDeclarationInitializedToBareOrAccessedRequire(r.parent.parent);default:return !1}}(t)){var i=n.getImmediateAliasedSymbol(r);if(i){"export="===(i=function(t,r){if(t.declarations)for(var n=0,i=t.declarations;n<i.length;n++){var a=i[n];if(e.isExportSpecifier(a)&&!a.propertyName&&!a.parent.parent.moduleSpecifier)return r.getExportSpecifierLocalTargetSymbol(a);if(e.isPropertyAccessExpression(a)&&e.isModuleExportsAccessExpression(a.expression)&&!e.isPrivateIdentifier(a.name))return r.getSymbolAtLocation(a);if(e.isShorthandPropertyAssignment(a)&&e.isBinaryExpression(a.parent.parent)&&2===e.getAssignmentDeclarationKind(a.parent.parent))return r.getExportSpecifierLocalTargetSymbol(a.name)}return t}(i,n)).escapedName&&(i=function(t,r){if(2097152&t.flags)return e.Debug.checkDefined(r.getImmediateAliasedSymbol(t));var n=e.Debug.checkDefined(t.valueDeclaration);return e.isExportAssignment(n)?e.Debug.checkDefined(n.expression.symbol):e.isBinaryExpression(n)?e.Debug.checkDefined(n.right.symbol):e.isSourceFile(n)?e.Debug.checkDefined(n.symbol):e.Debug.fail()}(i,n));var a=e.symbolEscapedNameNoDefault(i);return void 0===a||"default"===a||a===r.escapedName?{kind:0,symbol:i}:void 0}}}();function o(){var a,o=t.parent,l=o.parent;if(r.exportSymbol)return 206===o.kind?(null===(a=r.declarations)||void 0===a?void 0:a.some((function(e){return e===o})))&&e.isBinaryExpression(l)?d(l,!1):void 0:s(r.exportSymbol,c(o));var u=function(t,r){var n=e.isVariableDeclaration(t)?t:e.isBindingElement(t)?e.walkUpBindingElementsAndPatterns(t):void 0;return n?t.name!==r||e.isCatchClause(n.parent)?void 0:e.isVariableStatement(n.parent.parent)?n.parent.parent:void 0:t}(o,t);if(u&&e.hasSyntacticModifier(u,1)){if(e.isImportEqualsDeclaration(u)&&u.moduleReference===t){if(i)return;return {kind:0,symbol:n.getSymbolAtLocation(u.name)}}return s(r,c(u))}if(e.isNamespaceExport(o))return s(r,0);if(e.isExportAssignment(o))return _(o);if(e.isExportAssignment(l))return _(l);if(e.isBinaryExpression(o))return d(o,!0);if(e.isBinaryExpression(l))return d(l,!0);if(e.isJSDocTypedefTag(o))return s(r,0);function _(e){if(e.symbol.parent){var t=e.isExportEquals?2:1;return {kind:1,symbol:r,exportInfo:{exportingModuleSymbol:e.symbol.parent,exportKind:t}}}}function d(t,i){var a;switch(e.getAssignmentDeclarationKind(t)){case 1:a=0;break;case 2:a=2;break;default:return}var o=i?n.getSymbolAtLocation(e.getNameOfAccessExpression(e.cast(t.left,e.isAccessExpression))):r;return o&&s(o,a)}}function s(e,t){var r=a(e,t,n);return r&&{kind:1,symbol:e,exportInfo:r}}function c(t){return e.hasSyntacticModifier(t,512)?1:0}},t.getExportInfo=a;}(e.FindAllReferences||(e.FindAllReferences={}));}(t),function(e){!function(t){var r,a,o,s;function c(e,t){return void 0===t&&(t=1),{kind:t,node:e.name||e,context:u(e)}}function l(e){return e&&void 0===e.kind}function u(t){if(e.isDeclaration(t))return _(t);if(t.parent){if(!e.isDeclaration(t.parent)&&!e.isExportAssignment(t.parent)){if(e.isInJSFile(t)){var r=e.isBinaryExpression(t.parent)?t.parent:e.isAccessExpression(t.parent)&&e.isBinaryExpression(t.parent.parent)&&t.parent.parent.left===t.parent?t.parent.parent:void 0;if(r&&0!==e.getAssignmentDeclarationKind(r))return _(r)}if(e.isJsxOpeningElement(t.parent)||e.isJsxClosingElement(t.parent))return t.parent.parent;if(e.isJsxSelfClosingElement(t.parent)||e.isLabeledStatement(t.parent)||e.isBreakOrContinueStatement(t.parent))return t.parent;if(e.isStringLiteralLike(t)){var n=e.tryGetImportFromModuleSpecifier(t);if(n){var i=e.findAncestor(n,(function(t){return e.isDeclaration(t)||e.isStatement(t)||e.isJSDocTag(t)}));return e.isDeclaration(i)?_(i):i}}var a=e.findAncestor(t,e.isComputedPropertyName);return a?_(a.parent):void 0}return t.parent.name===t||e.isConstructorDeclaration(t.parent)||e.isExportAssignment(t.parent)||(e.isImportOrExportSpecifier(t.parent)||e.isBindingElement(t.parent))&&t.parent.propertyName===t||88===t.kind&&e.hasSyntacticModifier(t.parent,513)?_(t.parent):void 0}}function _(t){if(t)switch(t.kind){case 254:return e.isVariableDeclarationList(t.parent)&&1===t.parent.declarations.length?e.isVariableStatement(t.parent.parent)?t.parent.parent:e.isForInOrOfStatement(t.parent.parent)?_(t.parent.parent):t.parent:t;case 203:return _(t.parent.parent);case 270:return t.parent.parent.parent;case 275:case 268:return t.parent.parent;case 267:case 274:return t.parent;case 221:return e.isExpressionStatement(t.parent)?t.parent:t;case 244:case 243:return {start:t.initializer,end:t.expression};case 296:case 297:return e.isArrayLiteralOrObjectLiteralDestructuringPattern(t.parent)?_(e.findAncestor(t.parent,(function(t){return e.isBinaryExpression(t)||e.isForInOrOfStatement(t)}))):t;default:return t}}function d(e,t,r){if(r){var n=l(r)?b(r.start,t,r.end):b(r,t);return n.start!==e.start||n.length!==e.length?{contextSpan:n}:void 0}}function p(t,n,i,a,o){if(305!==a.kind){var s=t.getTypeChecker();if(297===a.parent.kind){var l=[];return r.getReferenceEntriesForShorthandPropertyAssignment(a,s,(function(e){return l.push(c(e))})),l}if(106===a.kind||e.isSuperProperty(a.parent)){var u=s.getSymbolAtLocation(a);return u.valueDeclaration&&[c(u.valueDeclaration)]}return f(o,a,t,i,n,{implementations:!0,use:1})}}function f(t,n,i,a,o,s,c){return void 0===s&&(s={}),void 0===c&&(c=new e.Set(a.map((function(e){return e.fileName})))),g(r.getReferencedSymbolsForNode(t,n,i,a,o,s,c))}function g(t){return t&&e.flatMap(t,(function(e){return e.references}))}function m(t){var r=t.getSourceFile();return {sourceFile:r,textSpan:b(e.isComputedPropertyName(t)?t.expression:t,r)}}function y(t,n,i){var a=r.getIntersectingMeaningFromDeclarations(i,t),o=t.declarations&&e.firstOrUndefined(t.declarations)||i,s=e.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(n,t,o.getSourceFile(),o,o,a);return {displayParts:s.displayParts,kind:s.symbolKind}}function v(e){var t=h(e);if(0===e.kind)return i$1(i$1({},t),{isWriteAccess:!1});var r=e.kind,n=e.node;return i$1(i$1({},t),{isWriteAccess:D(n),isInString:2===r||void 0})}function h(e){if(0===e.kind)return {textSpan:e.textSpan,fileName:e.fileName};var t=e.node.getSourceFile(),r=b(e.node,t);return i$1({textSpan:r,fileName:t.fileName},d(r,t,e.context))}function b(t,r,n){var i=t.getStart(r),a=(n||t).getEnd();return e.isStringLiteralLike(t)&&a-i>2&&(e.Debug.assert(void 0===n),i+=1,a-=1),e.createTextSpanFromBounds(i,a)}function x(e){return 0===e.kind?e.textSpan:b(e.node,e.node.getSourceFile())}function D(t){var r=e.getDeclarationFromName(t);return !!r&&function(t){if(16777216&t.flags)return !0;switch(t.kind){case 221:case 203:case 257:case 226:case 88:case 260:case 299:case 275:case 267:case 265:case 270:case 258:case 338:case 345:case 285:case 261:case 264:case 268:case 274:case 164:case 297:case 259:case 163:return !0;case 296:return !e.isArrayLiteralOrObjectLiteralDestructuringPattern(t.parent);case 256:case 213:case 171:case 169:case 172:case 173:return !!t.body;case 254:case 167:return !!t.initializer||e.isCatchClause(t.parent);case 168:case 166:case 347:case 340:return !1;default:return e.Debug.failBadSyntaxKind(t)}}(r)||88===t.kind||e.isWriteAccess(t)}function S(t,r){var n;if(!r)return !1;var i=e.getDeclarationFromName(t)||(88===t.kind?t.parent:e.isLiteralComputedPropertyDeclarationName(t)||134===t.kind&&e.isConstructorDeclaration(t.parent)?t.parent.parent:void 0),a=i&&e.isBinaryExpression(i)?i.left:void 0;return !(!i||!(null===(n=r.declarations)||void 0===n?void 0:n.some((function(e){return e===i||e===a}))))}(s=t.DefinitionKind||(t.DefinitionKind={}))[s.Symbol=0]="Symbol",s[s.Label=1]="Label",s[s.Keyword=2]="Keyword",s[s.This=3]="This",s[s.String=4]="String",s[s.TripleSlashReference=5]="TripleSlashReference",(o=t.EntryKind||(t.EntryKind={}))[o.Span=0]="Span",o[o.Node=1]="Node",o[o.StringLiteral=2]="StringLiteral",o[o.SearchedLocalFoundProperty=3]="SearchedLocalFoundProperty",o[o.SearchedPropertyFoundLocal=4]="SearchedPropertyFoundLocal",t.nodeEntry=c,t.isContextWithStartAndEndNode=l,t.getContextNode=_,t.toContextSpan=d,(a=t.FindReferencesUse||(t.FindReferencesUse={}))[a.Other=0]="Other",a[a.References=1]="References",a[a.Rename=2]="Rename",t.findReferencedSymbols=function(t,n,a,o,s){var c=e.getTouchingPropertyName(o,s),l={use:1},u=r.getReferencedSymbolsForNode(s,c,t,a,n,l),p=t.getTypeChecker(),f=r.getAdjustedNode(c,l),g=function(t){return 88===t.kind||!!e.getDeclarationFromName(t)||e.isLiteralComputedPropertyDeclarationName(t)||134===t.kind&&e.isConstructorDeclaration(t.parent)}(f)?p.getSymbolAtLocation(f):void 0;return u&&u.length?e.mapDefined(u,(function(t){var r=t.definition,a=t.references;return r&&{definition:p.runWithCancellationToken(n,(function(t){return function(t,r,n){var a=function(){switch(t.type){case 0:var a=y(p=t.symbol,r,n),o=a.displayParts,s=a.kind,c=o.map((function(e){return e.text})).join(""),l=p.declarations&&e.firstOrUndefined(p.declarations),u=l?e.getNameOfDeclaration(l)||l:n;return i$1(i$1({},m(u)),{name:c,kind:s,displayParts:o,context:_(l)});case 1:return u=t.node,i$1(i$1({},m(u)),{name:u.text,kind:"label",displayParts:[e.displayPart(u.text,e.SymbolDisplayPartKind.text)]});case 2:u=t.node;var d=e.tokenToString(u.kind);return i$1(i$1({},m(u)),{name:d,kind:"keyword",displayParts:[{text:d,kind:"keyword"}]});case 3:u=t.node;var p,f=(p=r.getSymbolAtLocation(u))&&e.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(r,p,u.getSourceFile(),e.getContainerNode(u),u).displayParts||[e.textPart("this")];return i$1(i$1({},m(u)),{name:"this",kind:"var",displayParts:f});case 4:return u=t.node,i$1(i$1({},m(u)),{name:u.text,kind:"var",displayParts:[e.displayPart(e.getTextOfNode(u),e.SymbolDisplayPartKind.stringLiteral)]});case 5:return {textSpan:e.createTextSpanFromRange(t.reference),sourceFile:t.file,name:t.reference.fileName,kind:"string",displayParts:[e.displayPart('"'.concat(t.reference.fileName,'"'),e.SymbolDisplayPartKind.stringLiteral)]};default:return e.Debug.assertNever(t)}}(),o=a.sourceFile,s=a.textSpan,c=a.name,l=a.kind,u=a.displayParts,p=a.context;return i$1({containerKind:"",containerName:"",fileName:o.fileName,kind:l,name:c,textSpan:s,displayParts:u},d(s,o,p))}(r,t,c)})),references:a.map((function(e){return function(e,t){var r=v(e);return t?i$1(i$1({},r),{isDefinition:0!==e.kind&&S(e.node,t)}):r}(e,g)}))}})):void 0},t.getImplementationsAtPosition=function(t,r,a,o,s){var c,l=e.getTouchingPropertyName(o,s),u=p(t,r,a,l,s);if(206===l.parent.kind||203===l.parent.kind||207===l.parent.kind||106===l.kind)c=u&&n$4([],u,!0);else for(var _=u&&n$4([],u,!0),d=new e.Map;_&&_.length;){var f=_.shift();if(e.addToSeen(d,e.getNodeId(f.node))){c=e.append(c,f);var g=p(t,r,a,f.node,f.node.pos);g&&_.push.apply(_,g);}}var m=t.getTypeChecker();return e.map(c,(function(t){return function(t,r){var n=h(t);if(0!==t.kind){var a=t.node;return i$1(i$1({},n),function(t,r){var n=r.getSymbolAtLocation(e.isDeclaration(t)&&t.name?t.name:t);return n?y(n,r,t):205===t.kind?{kind:"interface",displayParts:[e.punctuationPart(20),e.textPart("object literal"),e.punctuationPart(21)]}:226===t.kind?{kind:"local class",displayParts:[e.punctuationPart(20),e.textPart("anonymous local class"),e.punctuationPart(21)]}:{kind:e.getNodeKind(t),displayParts:[]}}(a,r))}return i$1(i$1({},n),{kind:"",displayParts:[]})}(t,m)}))},t.findReferenceOrRenameEntries=function(t,n,i,a,o,s,c){return e.map(g(r.getReferencedSymbolsForNode(o,a,t,i,n,s)),(function(e){return c(e,a,t.getTypeChecker())}))},t.getReferenceEntriesForNode=f,t.toRenameLocation=function(t,r,n,a){return i$1(i$1({},h(t)),a&&function(t,r,n){if(0!==t.kind&&e.isIdentifier(r)){var i=t.node,a=t.kind,o=i.parent,s=r.text,c=e.isShorthandPropertyAssignment(o);if(c||e.isObjectBindingElementWithoutPropertyName(o)&&o.name===i&&void 0===o.dotDotDotToken){var l={prefixText:s+": "},u={suffixText:": "+s};if(3===a)return l;if(4===a)return u;if(c){var _=o.parent;return e.isObjectLiteralExpression(_)&&e.isBinaryExpression(_.parent)&&e.isModuleExportsAccessExpression(_.parent.left)?l:u}return l}if(e.isImportSpecifier(o)&&!o.propertyName){var d=e.isExportSpecifier(r.parent)?n.getExportSpecifierLocalTargetSymbol(r.parent):n.getSymbolAtLocation(r);return e.contains(d.declarations,o)?{prefixText:s+" as "}:e.emptyOptions}if(e.isExportSpecifier(o)&&!o.propertyName)return r===t.node||n.getSymbolAtLocation(r)===n.getSymbolAtLocation(t.node)?{prefixText:s+" as "}:{suffixText:" as "+s}}return e.emptyOptions}(t,r,n))},t.toReferenceEntry=v,t.toHighlightSpan=function(e){var t=h(e);if(0===e.kind)return {fileName:t.fileName,span:{textSpan:t.textSpan,kind:"reference"}};var r=D(e.node),n=i$1({textSpan:t.textSpan,kind:r?"writtenReference":"reference",isInString:2===e.kind||void 0},t.contextSpan&&{contextSpan:t.contextSpan});return {fileName:t.fileName,span:n}},t.getTextSpanOfEntry=x,function(r){function n(t,r){return 1===r.use?t=e.getAdjustedReferenceLocation(t):2===r.use&&(t=e.getAdjustedRenameLocation(t)),t}function i(t,r,n){for(var i,a=0,o=r.get(t.path)||e.emptyArray;a<o.length;a++){var s=o[a];if(e.isReferencedFile(s)){var c=n.getSourceFileByPath(s.file),l=e.getReferencedFileLocation(n.getSourceFileByPath,s);e.isReferenceFileLocation(l)&&(i=e.append(i,{kind:0,fileName:c.fileName,textSpan:e.createTextSpanFromRange(l)}));}}return i}function a(t,r,n){if(t.parent&&e.isNamespaceExportDeclaration(t.parent)){var i=n.getAliasedSymbol(r),a=n.getMergedSymbol(i);if(i!==a)return a}}function o(t,r,n,i,a,o){var c=1536&t.flags&&t.declarations&&e.find(t.declarations,e.isSourceFile);if(c){var l=t.exports.get("export="),_=u(r,t,!!l,n,o);if(!l||!o.has(c.fileName))return _;var p=r.getTypeChecker();return s(r,_,d(t=e.skipAlias(l,p),void 0,n,o,p,i,a))}}function s(t){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){var s=o[a];if(s&&s.length)if(r)for(var c=function(n){if(!n.definition||0!==n.definition.type)return r.push(n),"continue";var i=n.definition.symbol,a=e.findIndex(r,(function(e){return !!e.definition&&0===e.definition.type&&e.definition.symbol===i}));if(-1===a)return r.push(n),"continue";var o=r[a];r[a]={definition:o.definition,references:o.references.concat(n.references).sort((function(r,n){var i=l(t,r),a=l(t,n);if(i!==a)return e.compareValues(i,a);var o=x(r),s=x(n);return o.start!==s.start?e.compareValues(o.start,s.start):e.compareValues(o.length,s.length)}))};},u=0,_=s;u<_.length;u++){var d=_[u];c(d);}else r=s;}return r}function l(e,t){var r=0===t.kind?e.getSourceFile(t.fileName):t.node.getSourceFile();return e.getSourceFiles().indexOf(r)}function u(r,n,i,a,o){e.Debug.assert(!!n.valueDeclaration);var s=e.mapDefined(t.findModuleReferences(r,a,n),(function(t){if("import"===t.kind){var r=t.literal.parent;if(e.isLiteralTypeNode(r)){var n=e.cast(r.parent,e.isImportTypeNode);if(i&&!n.qualifier)return}return c(t.literal)}return {kind:0,fileName:t.referencingFile.fileName,textSpan:e.createTextSpanFromRange(t.ref)}}));if(n.declarations)for(var l=0,u=n.declarations;l<u.length;l++)switch((f=u[l]).kind){case 305:break;case 261:o.has(f.getSourceFile().fileName)&&s.push(c(f.name));break;default:e.Debug.assert(!!(33554432&n.flags),"Expected a module symbol to be declared by a SourceFile or ModuleDeclaration.");}var _=n.exports.get("export=");if(null==_?void 0:_.declarations)for(var d=0,p=_.declarations;d<p.length;d++){var f,g=(f=p[d]).getSourceFile();if(o.has(g.fileName)){var m=e.isBinaryExpression(f)&&e.isPropertyAccessExpression(f.left)?f.left.expression:e.isExportAssignment(f)?e.Debug.checkDefined(e.findChildOfKind(f,93,g)):e.getNameOfDeclaration(f)||f;s.push(c(m));}}return s.length?[{definition:{type:0,symbol:n},references:s}]:e.emptyArray}function _(t){return 145===t.kind&&e.isTypeOperatorNode(t.parent)&&145===t.parent.operator}function d(t,r,n,i,a,o,s){var c=r&&function(t,r,n,i){var a=r.parent;return e.isExportSpecifier(a)&&i?A(r,t,a,n):e.firstDefined(t.declarations,(function(i){if(!i.parent){if(33554432&t.flags)return;e.Debug.fail("Unexpected symbol at ".concat(e.Debug.formatSyntaxKind(r.kind),": ").concat(e.Debug.formatSymbol(t)));}return e.isTypeLiteralNode(i.parent)&&e.isUnionTypeNode(i.parent.parent)?n.getPropertyOfType(n.getTypeFromTypeNode(i.parent.parent),t.name):void 0}))}(t,r,a,!U(s))||t,l=r?J(r,c):7,u=[],_=new g(n,i,r?function(t){switch(t.kind){case 171:case 134:return 1;case 79:if(e.isClassLike(t.parent))return e.Debug.assert(t.parent.name===t),2;default:return 0}}(r):0,a,o,l,s,u),d=U(s)&&c.declarations?e.find(c.declarations,e.isExportSpecifier):void 0;if(d)F(d.name,c,d,_.createSearch(r,t,void 0),_,!0,!0);else if(r&&88===r.kind&&"default"===c.escapedName&&c.parent)P(r,c,_),m(r,c,{exportingModuleSymbol:c.parent,exportKind:1},_);else {var f=_.createSearch(r,c,void 0,{allSearchSymbols:r?R(c,r,a,2===s.use,!!s.providePrefixAndSuffixTextForRename,!!s.implementations):[c]});p(c,_,f);}return u}function p(t,r,n){var i=function(t){var r=t.declarations,n=t.flags,i=t.parent,a=t.valueDeclaration;if(a&&(213===a.kind||226===a.kind))return a;if(r){if(8196&n){var o=e.find(r,(function(t){return e.hasEffectiveModifier(t,8)||e.isPrivateIdentifierClassElementDeclaration(t)}));return o?e.getAncestor(o,257):void 0}if(!r.some(e.isObjectBindingElementWithoutPropertyName)){var s,c=i&&!(262144&t.flags);if(!c||e.isExternalModuleSymbol(i)&&!i.globalExports){for(var l=0,u=r;l<u.length;l++){var _=u[l],d=e.getContainerNode(_);if(s&&s!==d)return;if(!d||305===d.kind&&!e.isExternalOrCommonJsModule(d))return;if(s=d,e.isFunctionExpression(s))for(var p=void 0;p=e.getNextJSDocCommentLocation(s);)s=p;}return c?s.getSourceFile():s}}}}(t);if(i)k(i,i.getSourceFile(),n,r,!(e.isSourceFile(i)&&!e.contains(r.sourceFiles,i)));else for(var a=0,o=r.sourceFiles;a<o.length;a++){var s=o[a];r.cancellationToken.throwIfCancellationRequested(),h(s,n,r);}}var f;r.getReferencedSymbolsForNode=function(t,r,l,p,f,g,m){var y,v;if(void 0===g&&(g={}),void 0===m&&(m=new e.Set(p.map((function(e){return e.fileName})))),r=n(r,g),e.isSourceFile(r)){var h=e.GoToDefinition.getReferenceAtPosition(r,t,l);if(!(null==h?void 0:h.file))return;var b=l.getTypeChecker().getMergedSymbol(h.file.symbol);if(b)return u(l,b,!1,p,m);if(!(F=l.getFileIncludeReasons()))return;return [{definition:{type:5,reference:h.reference,file:r},references:i(h.file,F,l)||e.emptyArray}]}if(!g.implementations){var x=function(t,r,n){if(e.isTypeKeyword(t.kind)){if(114===t.kind&&e.isVoidExpression(t.parent))return;if(145===t.kind&&!_(t))return;return function(t,r,n,i){var a=e.flatMap(t,(function(t){return n.throwIfCancellationRequested(),e.mapDefined(D(t,e.tokenToString(r),t),(function(e){if(e.kind===r&&(!i||i(e)))return c(e)}))}));return a.length?[{definition:{type:2,node:a[0].node},references:a}]:void 0}(r,t.kind,n,145===t.kind?_:void 0)}if(e.isImportMeta(t.parent)&&t.parent.name===t)return function(t,r){var n=e.flatMap(t,(function(t){return r.throwIfCancellationRequested(),e.mapDefined(D(t,"meta",t),(function(t){var r=t.parent;if(e.isImportMeta(r))return c(r)}))}));return n.length?[{definition:{type:2,node:n[0].node},references:n}]:void 0}(r,n);if(e.isStaticModifier(t)&&e.isClassStaticBlockDeclaration(t.parent))return [{definition:{type:2,node:t},references:[c(t)]}];if(e.isJumpStatementTarget(t)){var i=e.getTargetLabel(t.parent,t.text);return i&&T(i.parent,i)}return e.isLabelOfLabeledStatement(t)?T(t.parent,t):e.isThis(t)?function(t,r,n){var i=e.getThisContainer(t,!1),a=32;switch(i.kind){case 169:case 168:if(e.isObjectLiteralMethod(i)){a&=e.getSyntacticModifierFlags(i),i=i.parent;break}case 167:case 166:case 171:case 172:case 173:a&=e.getSyntacticModifierFlags(i),i=i.parent;break;case 305:if(e.isExternalModule(i)||L(t))return;case 256:case 213:break;default:return}var o=e.flatMap(305===i.kind?r:[i.getSourceFile()],(function(t){return n.throwIfCancellationRequested(),D(t,"this",e.isSourceFile(i)?t:i).filter((function(t){if(!e.isThis(t))return !1;var r=e.getThisContainer(t,!1);switch(i.kind){case 213:case 256:return i.symbol===r.symbol;case 169:case 168:return e.isObjectLiteralMethod(i)&&i.symbol===r.symbol;case 226:case 257:case 205:return r.parent&&i.symbol===r.parent.symbol&&e.isStatic(r)===!!a;case 305:return 305===r.kind&&!e.isExternalModule(r)&&!L(t)}}))})).map((function(e){return c(e)}));return [{definition:{type:3,node:e.firstDefined(o,(function(t){return e.isParameter(t.node.parent)?t.node:void 0}))||t},references:o}]}(t,r,n):106===t.kind?function(t){var r=e.getSuperContainer(t,!1);if(r){var n=32;switch(r.kind){case 167:case 166:case 169:case 168:case 171:case 172:case 173:n&=e.getSyntacticModifierFlags(r),r=r.parent;break;default:return}var i=r.getSourceFile(),a=e.mapDefined(D(i,"super",r),(function(t){if(106===t.kind){var i=e.getSuperContainer(t,!1);return i&&e.isStatic(i)===!!n&&i.parent.symbol===r.symbol?c(t):void 0}}));return [{definition:{type:0,symbol:r.symbol},references:a}]}}(t):void 0}(r,p,f);if(x)return x}var S=l.getTypeChecker(),C=S.getSymbolAtLocation(e.isConstructorDeclaration(r)&&r.parent.name||r);if(C){if("export="===C.escapedName)return u(l,C.parent,!1,p,m);var k=o(C,l,p,f,g,m);if(k&&!(33554432&C.flags))return k;var E=a(r,C,S),N=E&&o(E,l,p,f,g,m);return s(l,k,d(C,r,p,m,S,f,g),N)}if(!g.implementations&&e.isStringLiteralLike(r)){if(e.isModuleSpecifierLike(r)){var F=l.getFileIncludeReasons(),A=null===(v=null===(y=r.getSourceFile().resolvedModules)||void 0===y?void 0:y.get(r.text,e.getModeForUsageLocation(r.getSourceFile(),r)))||void 0===v?void 0:v.resolvedFileName,P=A?l.getSourceFile(A):void 0;if(P)return [{definition:{type:4,node:r},references:i(P,F,l)||e.emptyArray}]}return function(t,r,n,i){var a=e.getContextualTypeFromParentOrAncestorTypeNode(t,n),o=e.flatMap(r,(function(r){return i.throwIfCancellationRequested(),e.mapDefined(D(r,t.text),(function(i){if(e.isStringLiteralLike(i)&&i.text===t.text){if(!a)return e.isNoSubstitutionTemplateLiteral(i)&&!e.rangeIsOnSingleLine(i,r)?void 0:c(i,2);var o=e.getContextualTypeFromParentOrAncestorTypeNode(i,n);if(a!==n.getStringType()&&a===o)return c(i,2)}}))}));return [{definition:{type:4,node:t},references:o}]}(r,p,S,f)}},r.getAdjustedNode=n,r.getReferencesForFileName=function(t,r,n,a){var o,s;void 0===a&&(a=new e.Set(n.map((function(e){return e.fileName}))));var c=null===(o=r.getSourceFile(t))||void 0===o?void 0:o.symbol;if(c)return (null===(s=u(r,c,!1,n,a)[0])||void 0===s?void 0:s.references)||e.emptyArray;var l=r.getFileIncludeReasons(),_=r.getSourceFile(t);return _&&l&&i(_,l,r)||e.emptyArray},function(e){e[e.None=0]="None",e[e.Constructor=1]="Constructor",e[e.Class=2]="Class";}(f||(f={}));var g=function(){function r(t,r,n,i,a,o,s,c){this.sourceFiles=t,this.sourceFilesSet=r,this.specialSearchKind=n,this.checker=i,this.cancellationToken=a,this.searchMeaning=o,this.options=s,this.result=c,this.inheritsFromCache=new e.Map,this.markSeenContainingTypeReference=e.nodeSeenTracker(),this.markSeenReExportRHS=e.nodeSeenTracker(),this.symbolIdToReferences=[],this.sourceFileToSeenSymbols=[];}return r.prototype.includesSourceFile=function(e){return this.sourceFilesSet.has(e.fileName)},r.prototype.getImportSearches=function(e,r){return this.importTracker||(this.importTracker=t.createImportTracker(this.sourceFiles,this.sourceFilesSet,this.checker,this.cancellationToken)),this.importTracker(e,r,2===this.options.use)},r.prototype.createSearch=function(t,r,n,i){void 0===i&&(i={});var a=i.text,o=void 0===a?e.stripQuotes(e.symbolName(e.getLocalSymbolForExportDefault(r)||function(t){if(33555968&t.flags){var r=t.declarations&&e.find(t.declarations,(function(t){return !e.isSourceFile(t)&&!e.isModuleDeclaration(t)}));return r&&r.symbol}}(r)||r)):a,s=i.allSearchSymbols,c=void 0===s?[r]:s;return {symbol:r,comingFrom:n,text:o,escapedText:e.escapeLeadingUnderscores(o),parents:this.options.implementations&&t?function(t,r,n){var i=e.isRightSideOfPropertyAccess(t)?t.parent:void 0,a=i&&n.getTypeAtLocation(i.expression),o=e.mapDefined(a&&(a.isUnionOrIntersection()?a.types:a.symbol===r.parent?void 0:[a]),(function(e){return e.symbol&&96&e.symbol.flags?e.symbol:void 0}));return 0===o.length?void 0:o}(t,r,this.checker):void 0,allSearchSymbols:c,includes:function(t){return e.contains(c,t)}}},r.prototype.referenceAdder=function(t){var r=e.getSymbolId(t),n=this.symbolIdToReferences[r];return n||(n=this.symbolIdToReferences[r]=[],this.result.push({definition:{type:0,symbol:t},references:n})),function(e,t){return n.push(c(e,t))}},r.prototype.addStringOrCommentReference=function(e,t){this.result.push({definition:void 0,references:[{kind:0,fileName:e,textSpan:t}]});},r.prototype.markSearchedSymbols=function(t,r){for(var n=e.getNodeId(t),i=this.sourceFileToSeenSymbols[n]||(this.sourceFileToSeenSymbols[n]=new e.Set),a=!1,o=0,s=r;o<s.length;o++){var c=s[o];a=e.tryAddToSet(i,e.getSymbolId(c))||a;}return a},r}();function m(e,t,r,n){var i=n.getImportSearches(t,r),a=i.importSearches,o=i.singleReferences,s=i.indirectUsers;if(o.length)for(var c=n.referenceAdder(t),l=0,u=o;l<u.length;l++){var _=u[l];y(_,n)&&c(_);}for(var d=0,p=a;d<p.length;d++){var f=p[d],g=f[0],m=f[1];C(g.getSourceFile(),n.createSearch(g,m,1),n);}if(s.length){var v=void 0;switch(r.exportKind){case 0:v=n.createSearch(e,t,1);break;case 1:v=2===n.options.use?void 0:n.createSearch(e,t,1,{text:"default"});}if(v)for(var b=0,x=s;b<x.length;b++)h(x[b],v,n);}}function y(t,r){return !(!E(t,r)||2===r.options.use&&(!e.isIdentifier(t)||e.isImportOrExportSpecifier(t.parent)&&"default"===t.escapedText))}function v(e,t){if(e.declarations)for(var r=0,n=e.declarations;r<n.length;r++){var i=n[r],a=i.getSourceFile();C(a,t.createSearch(i,e,0),t,t.includesSourceFile(a));}}function h(t,r,n){void 0!==e.getNameTable(t).get(r.escapedText)&&C(t,r,n);}function b(t,r,n,i,a){void 0===a&&(a=n);var o=e.isParameterPropertyDeclaration(t.parent,t.parent.parent)?e.first(r.getSymbolsOfParameterPropertyDeclaration(t.parent,t.text)):r.getSymbolAtLocation(t);if(o)for(var s=0,c=D(n,o.name,a);s<c.length;s++){var l=c[s];if(e.isIdentifier(l)&&l!==t&&l.escapedText===t.escapedText){var u=r.getSymbolAtLocation(l);if(u===o||r.getShorthandAssignmentValueSymbol(l.parent)===o||e.isExportSpecifier(l.parent)&&A(l,u,l.parent,r)===o){var _=i(l);if(_)return _}}}}function D(t,r,n){return void 0===n&&(n=t),S(t,r,n).map((function(r){return e.getTouchingPropertyName(t,r)}))}function S(t,r,n){void 0===n&&(n=t);var i=[];if(!r||!r.length)return i;for(var a=t.text,o=a.length,s=r.length,c=a.indexOf(r,n.pos);c>=0&&!(c>n.end);){var l=c+s;0!==c&&e.isIdentifierPart(a.charCodeAt(c-1),99)||l!==o&&e.isIdentifierPart(a.charCodeAt(l),99)||i.push(c),c=a.indexOf(r,c+s+1);}return i}function T(t,r){var n=t.getSourceFile(),i=r.text,a=e.mapDefined(D(n,i,t),(function(t){return t===r||e.isJumpStatementTarget(t)&&e.getTargetLabel(t,i)===r?c(t):void 0}));return [{definition:{type:1,node:r},references:a}]}function C(e,t,r,n){return void 0===n&&(n=!0),r.cancellationToken.throwIfCancellationRequested(),k(e,e,t,r,n)}function k(e,t,r,n,i){if(n.markSearchedSymbols(t,r.allSearchSymbols))for(var a=0,o=S(t,r.text,e);a<o.length;a++)N(t,o[a],r,n,i);}function E(t,r){return !!(e.getMeaningFromLocation(t)&r.searchMeaning)}function N(r,n,i,a,o){var s=e.getTouchingPropertyName(r,n);if(function(t,r){switch(t.kind){case 80:if(e.isJSDocMemberName(t.parent))return !0;case 79:return t.text.length===r.length;case 14:case 10:var n=t;return (e.isLiteralNameOfPropertyDeclarationOrIndexAccess(n)||e.isNameOfModuleDeclaration(t)||e.isExpressionOfExternalModuleImportEqualsDeclaration(t)||e.isCallExpression(t.parent)&&e.isBindableObjectDefinePropertyCall(t.parent)&&t.parent.arguments[1]===t)&&n.text.length===r.length;case 8:return e.isLiteralNameOfPropertyDeclarationOrIndexAccess(t)&&t.text.length===r.length;case 88:return "default".length===r.length;default:return !1}}(s,i.text)){if(E(s,a)){var c=a.checker.getSymbolAtLocation(s);if(c){var l=s.parent;if(!e.isImportSpecifier(l)||l.propertyName!==s){if(e.isExportSpecifier(l))return e.Debug.assert(79===s.kind),void F(s,c,l,i,a,o);var u=function(t,r,n,i){var a=i.checker;return B(r,n,a,!1,2!==i.options.use||!!i.options.providePrefixAndSuffixTextForRename,(function(n,i,a,o){return a&&j(r)!==j(a)&&(a=void 0),t.includes(a||i||n)?{symbol:!i||6&e.getCheckFlags(n)?n:i,kind:o}:void 0}),(function(e){return !(t.parents&&!t.parents.some((function(t){return M(e.parent,t,i.inheritsFromCache,a)})))}))}(i,c,s,a);if(u){switch(a.specialSearchKind){case 0:o&&P(s,u,a);break;case 1:!function(t,r,n,i){e.isNewExpressionTarget(t)&&P(t,n.symbol,i);var a,o=function(){return i.referenceAdder(n.symbol)};if(e.isClassLike(t.parent))e.Debug.assert(88===t.kind||t.parent.name===t),function(t,r,n){var i=w(t);if(i&&i.declarations)for(var a=0,o=i.declarations;a<o.length;a++){var s=o[a],c=e.findChildOfKind(s,134,r);e.Debug.assert(171===s.kind&&!!c),n(c);}t.exports&&t.exports.forEach((function(t){var r=t.valueDeclaration;if(r&&169===r.kind){var i=r.body;i&&K(i,108,(function(t){e.isNewExpressionTarget(t)&&n(t);}));}}));}(n.symbol,r,o());else {var s=(a=t,e.tryGetClassExtendingExpressionWithTypeArguments(e.climbPastPropertyAccess(a).parent));s&&(function(t,r){var n=w(t.symbol);if(n&&n.declarations)for(var i=0,a=n.declarations;i<a.length;i++){var o=a[i];e.Debug.assert(171===o.kind);var s=o.body;s&&K(s,106,(function(t){e.isCallExpressionTarget(t)&&r(t);}));}}(s,o()),function(e,t){if(!function(e){return !!w(e.symbol)}(e)){var r=e.symbol,n=t.createSearch(void 0,r,void 0);p(r,t,n);}}(s,i));}}(s,r,i,a);break;case 2:!function(t,r,n){P(t,r.symbol,n);var i=t.parent;if(2!==n.options.use&&e.isClassLike(i)){e.Debug.assert(i.name===t);for(var a=n.referenceAdder(r.symbol),o=0,s=i.members;o<s.length;o++){var c=s[o];e.isMethodOrAccessor(c)&&e.isStatic(c)&&c.body&&c.body.forEachChild((function t(r){108===r.kind?a(r):e.isFunctionLike(r)||e.isClassLike(r)||r.forEachChild(t);}));}}}(s,i,a);break;default:e.Debug.assertNever(a.specialSearchKind);}e.isInJSFile(s)&&203===s.parent.kind&&e.isVariableDeclarationInitializedToBareOrAccessedRequire(s.parent.parent.parent)&&!(c=s.parent.symbol)||function(e,r,n,i){var a=t.getImportOrExportSymbol(e,r,i.checker,1===n.comingFrom);if(a){var o=a.symbol;0===a.kind?U(i.options)||v(o,i):m(e,o,a.exportInfo,i);}}(s,c,i,a);}else !function(t,r,n){var i=t.flags,a=t.valueDeclaration,o=n.checker.getShorthandAssignmentValueSymbol(a),s=a&&e.getNameOfDeclaration(a);33554432&i||!s||!r.includes(o)||P(s,o,n);}(c,i,a);}}}}else !a.options.implementations&&(a.options.findInStrings&&e.isInString(r,n)||a.options.findInComments&&e.isInNonReferenceComment(r,n))&&a.addStringOrCommentReference(r.fileName,e.createTextSpan(n,i.text.length));}function F(r,n,i,a,o,s,c){e.Debug.assert(!c||!!o.options.providePrefixAndSuffixTextForRename,"If alwaysGetReferences is true, then prefix/suffix text must be enabled");var l=i.parent,u=i.propertyName,_=i.name,d=l.parent,p=A(r,n,i,o.checker);if(c||a.includes(p)){if(u?r===u?(d.moduleSpecifier||b(),s&&2!==o.options.use&&o.markSeenReExportRHS(_)&&P(_,e.Debug.checkDefined(i.symbol),o)):o.markSeenReExportRHS(r)&&b():2===o.options.use&&"default"===_.escapedText||b(),!U(o.options)||c){var f=88===r.originalKeywordKind||88===i.name.originalKeywordKind?1:0,g=e.Debug.checkDefined(i.symbol),y=t.getExportInfo(g,f,o.checker);y&&m(r,g,y,o);}if(1!==a.comingFrom&&d.moduleSpecifier&&!u&&!U(o.options)){var h=o.checker.getExportSpecifierLocalTargetSymbol(i);h&&v(h,o);}}function b(){s&&P(r,p,o);}}function A(t,r,n,i){return function(t,r){var n=r.parent,i=r.propertyName,a=r.name;return e.Debug.assert(i===t||a===t),i?i===t:!n.parent.moduleSpecifier}(t,n)&&i.getExportSpecifierLocalTargetSymbol(n)||r}function P(t,r,n){var i="kind"in r?r:{kind:void 0,symbol:r},a=i.kind,o=i.symbol;if(2!==n.options.use||88!==t.kind){var s=n.referenceAdder(o);n.options.implementations?function(t,r,n){var i;if(!e.isDeclarationName(t)||(16777216&(i=t.parent).flags?e.isInterfaceDeclaration(i)||e.isTypeAliasDeclaration(i):!(e.isVariableLike(i)?e.hasInitializer(i):e.isFunctionLikeDeclaration(i)?i.body:e.isClassLike(i)||e.isModuleOrEnumDeclaration(i)))){if(79===t.kind){297===t.parent.kind&&z(t,n.checker,r);var a=I(t);if(a)r(a);else {var o=e.findAncestor(t,(function(t){return !e.isQualifiedName(t.parent)&&!e.isTypeNode(t.parent)&&!e.isTypeElement(t.parent)})),s=o.parent;if(e.hasType(s)&&s.type===o&&n.markSeenContainingTypeReference(s))if(e.hasInitializer(s))l(s.initializer);else if(e.isFunctionLike(s)&&s.body){var c=s.body;235===c.kind?e.forEachReturnStatement(c,(function(e){e.expression&&l(e.expression);})):l(c);}else e.isAssertionExpression(s)&&l(s.expression);}}}else r(t);function l(e){O(e)&&r(e);}}(t,s,n):s(t,a);}}function w(e){return e.members&&e.members.get("__constructor")}function I(t){return e.isIdentifier(t)||e.isPropertyAccessExpression(t)?I(t.parent):e.isExpressionWithTypeArguments(t)?e.tryCast(t.parent.parent,e.isClassLike):void 0}function O(e){switch(e.kind){case 212:return O(e.expression);case 214:case 213:case 205:case 226:case 204:return !0;default:return !1}}function M(t,r,n,i){if(t===r)return !0;var a=e.getSymbolId(t)+","+e.getSymbolId(r),o=n.get(a);if(void 0!==o)return o;n.set(a,!1);var s=!!t.declarations&&t.declarations.some((function(t){return e.getAllSuperTypeNodes(t).some((function(e){var t=i.getTypeAtLocation(e);return !!t&&!!t.symbol&&M(t.symbol,r,n,i)}))}));return n.set(a,s),s}function L(e){return 79===e.kind&&164===e.parent.kind&&e.parent.name===e}function R(e,t,r,n,i,a){var o=[];return B(e,t,r,n,!(n&&i),(function(t,r,n){n&&j(e)!==j(n)&&(n=void 0),o.push(n||r||t);}),(function(){return !a})),o}function B(t,r,n,i,o,s,c){var l=e.getContainingObjectLiteralElement(r);if(l){var u=n.getShorthandAssignmentValueSymbol(r.parent);if(u&&i)return s(u,void 0,void 0,3);var _=n.getContextualType(l.parent),d=_&&e.firstDefined(e.getPropertySymbolsFromContextualType(l,n,_,!0),(function(e){return T(e,4)}));if(d)return d;var p=function(t,r){return e.isArrayLiteralOrObjectLiteralDestructuringPattern(t.parent.parent)?r.getPropertySymbolOfDestructuringAssignment(t):void 0}(r,n),f=p&&s(p,void 0,void 0,4);if(f)return f;var g=u&&s(u,void 0,void 0,3);if(g)return g}var m=a(r,t,n);if(m){var y=s(m,void 0,void 0,1);if(y)return y}var v=T(t);if(v)return v;if(t.valueDeclaration&&e.isParameterPropertyDeclaration(t.valueDeclaration,t.valueDeclaration.parent)){var h=n.getSymbolsOfParameterPropertyDeclaration(e.cast(t.valueDeclaration,e.isParameter),t.name);return e.Debug.assert(2===h.length&&!!(1&h[0].flags)&&!!(4&h[1].flags)),T(1&t.flags?h[1]:h[0])}var b=e.getDeclarationOfKind(t,275);if(!i||b&&!b.propertyName){var x=b&&n.getExportSpecifierLocalTargetSymbol(b);if(x){var D=s(x,void 0,void 0,1);if(D)return D}}if(!i){var S=void 0;return (S=o?e.isObjectBindingElementWithoutPropertyName(r.parent)?e.getPropertySymbolFromBindingElement(n,r.parent):void 0:C(t,n))&&T(S,4)}if(e.Debug.assert(i),o)return (S=C(t,n))&&T(S,4);function T(t,r){return e.firstDefined(n.getRootSymbols(t),(function(i){return s(t,i,void 0,r)||(i.parent&&96&i.parent.flags&&c(i)?function(t,r,n,i){var a=new e.Map;return function t(o){if(96&o.flags&&e.addToSeen(a,e.getSymbolId(o)))return e.firstDefined(o.declarations,(function(a){return e.firstDefined(e.getAllSuperTypeNodes(a),(function(a){var o=n.getTypeAtLocation(a),s=o&&o.symbol&&n.getPropertyOfType(o,r);return o&&s&&(e.firstDefined(n.getRootSymbols(s),i)||t(o.symbol))}))}))}(t)}(i.parent,i.name,n,(function(e){return s(t,i,e,r)})):void 0)}))}function C(t,r){var n=e.getDeclarationOfKind(t,203);if(n&&e.isObjectBindingElementWithoutPropertyName(n))return e.getPropertySymbolFromBindingElement(r,n)}}function j(t){return !!t.valueDeclaration&&!!(32&e.getEffectiveModifierFlags(t.valueDeclaration))}function J(t,r){var n=e.getMeaningFromLocation(t),i=r.declarations;if(i){var a=void 0;do{a=n;for(var o=0,s=i;o<s.length;o++){var c=s[o],l=e.getMeaningFromDeclaration(c);l&n&&(n|=l);}}while(n!==a)}return n}function z(t,r,n){var i=r.getSymbolAtLocation(t),a=r.getShorthandAssignmentValueSymbol(i.valueDeclaration);if(a)for(var o=0,s=a.getDeclarations();o<s.length;o++){var c=s[o];1&e.getMeaningFromDeclaration(c)&&n(c);}}function K(t,r,n){e.forEachChild(t,(function(e){e.kind===r&&n(e),K(e,r,n);}));}function U(e){return 2===e.use&&e.providePrefixAndSuffixTextForRename}r.eachExportReference=function(r,n,i,a,o,s,c,l){for(var u=t.createImportTracker(r,new e.Set(r.map((function(e){return e.fileName}))),n,i)(a,{exportKind:c?1:0,exportingModuleSymbol:o},!1),_=u.importSearches,d=u.indirectUsers,p=u.singleReferences,f=0,g=_;f<g.length;f++)l(g[f][0]);for(var m=0,y=p;m<y.length;m++){var v=y[m];e.isIdentifier(v)&&e.isImportTypeNode(v.parent)&&l(v);}for(var h=0,b=d;h<b.length;h++)for(var x=0,S=D(b[h],c?"default":s);x<S.length;x++){var T=S[x],C=n.getSymbolAtLocation(T),k=e.some(null==C?void 0:C.declarations,(function(t){return !!e.tryCast(t,e.isExportAssignment)}));!e.isIdentifier(T)||e.isImportOrExportSpecifier(T.parent)||C!==a&&!k||l(T);}},r.isSymbolReferencedInFile=function(e,t,r,n){return void 0===n&&(n=r),b(e,t,r,(function(){return !0}),n)||!1},r.eachSymbolReferenceInFile=b,r.getTopMostDeclarationNamesInFile=function(t,r){return e.filter(D(r,t),(function(t){return !!e.getDeclarationFromName(t)})).reduce((function(t,r){var n=function(t){for(var r=0;t;)t=e.getContainerNode(t),r++;return r}(r);return e.some(t.declarationNames)&&n!==t.depth?n<t.depth&&(t.declarationNames=[r],t.depth=n):(t.declarationNames.push(r),t.depth=n),t}),{depth:1/0,declarationNames:[]}).declarationNames},r.someSignatureUsage=function(t,r,n,i){if(!t.name||!e.isIdentifier(t.name))return !1;for(var a=e.Debug.checkDefined(n.getSymbolAtLocation(t.name)),o=0,s=r;o<s.length;o++)for(var c=0,l=D(s[o],a.name);c<l.length;c++){var u=l[c];if(e.isIdentifier(u)&&u!==t.name&&u.escapedText===t.name.escapedText){var _=e.climbPastPropertyAccess(u),d=e.isCallExpression(_.parent)&&_.parent.expression===_?_.parent:void 0,p=n.getSymbolAtLocation(u);if(p&&n.getRootSymbols(p).some((function(e){return e===a}))&&i(u,d))return !0}}return !1},r.getIntersectingMeaningFromDeclarations=J,r.getReferenceEntriesForShorthandPropertyAssignment=z;}(r=t.Core||(t.Core={}));}(e.FindAllReferences||(e.FindAllReferences={}));}(t),function(e){!function(t){function r(t){return (e.isFunctionExpression(t)||e.isArrowFunction(t)||e.isClassExpression(t))&&e.isVariableDeclaration(t.parent)&&t===t.parent.initializer&&e.isIdentifier(t.parent.name)&&!!(2&e.getCombinedNodeFlags(t.parent))}function n(t){return e.isSourceFile(t)||e.isModuleDeclaration(t)||e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isClassDeclaration(t)||e.isClassExpression(t)||e.isClassStaticBlockDeclaration(t)||e.isMethodDeclaration(t)||e.isMethodSignature(t)||e.isGetAccessorDeclaration(t)||e.isSetAccessorDeclaration(t)}function i(t){return e.isSourceFile(t)||e.isModuleDeclaration(t)&&e.isIdentifier(t.name)||e.isFunctionDeclaration(t)||e.isClassDeclaration(t)||e.isClassStaticBlockDeclaration(t)||e.isMethodDeclaration(t)||e.isMethodSignature(t)||e.isGetAccessorDeclaration(t)||e.isSetAccessorDeclaration(t)||function(t){return (e.isFunctionExpression(t)||e.isClassExpression(t))&&e.isNamedDeclaration(t)}(t)||r(t)}function a(t){return e.isSourceFile(t)?t:e.isNamedDeclaration(t)?t.name:r(t)?t.parent.name:e.Debug.checkDefined(t.modifiers&&e.find(t.modifiers,o))}function o(e){return 88===e.kind}function s(e,t){var r=a(t);return r&&e.getSymbolAtLocation(r)}function c(t,r){if(r.body)return r;if(e.isConstructorDeclaration(r))return e.getFirstConstructorWithBody(r.parent);if(e.isFunctionDeclaration(r)||e.isMethodDeclaration(r)){var n=s(t,r);return n&&n.valueDeclaration&&e.isFunctionLikeDeclaration(n.valueDeclaration)&&n.valueDeclaration.body?n.valueDeclaration:void 0}return r}function l(t,r){var n,a=s(t,r);if(a&&a.declarations){var o=e.indicesOf(a.declarations),c=e.map(a.declarations,(function(e){return {file:e.getSourceFile().fileName,pos:e.pos}}));o.sort((function(t,r){return e.compareStringsCaseSensitive(c[t].file,c[r].file)||c[t].pos-c[r].pos}));for(var l=void 0,u=0,_=e.map(o,(function(e){return a.declarations[e]}));u<_.length;u++){var d=_[u];i(d)&&(l&&l.parent===d.parent&&l.end===d.pos||(n=e.append(n,d)),l=d);}}return n}function u(t,r){var n,i,a;return e.isClassStaticBlockDeclaration(r)?r:e.isFunctionLikeDeclaration(r)?null!==(i=null!==(n=c(t,r))&&void 0!==n?n:l(t,r))&&void 0!==i?i:r:null!==(a=l(t,r))&&void 0!==a?a:r}function _(t,a){for(var o=t.getTypeChecker(),s=!1;;){if(i(a))return u(o,a);var c;if(n(a))return (c=e.findAncestor(a,i))&&u(o,c);if(e.isDeclarationName(a))return i(a.parent)?u(o,a.parent):n(a.parent)?(c=e.findAncestor(a.parent,i))&&u(o,c):e.isVariableDeclaration(a.parent)&&a.parent.initializer&&r(a.parent.initializer)?a.parent.initializer:void 0;if(e.isConstructorDeclaration(a))return i(a.parent)?a.parent:void 0;if(124!==a.kind||!e.isClassStaticBlockDeclaration(a.parent)){if(e.isVariableDeclaration(a)&&a.initializer&&r(a.initializer))return a.initializer;if(!s){var l=o.getSymbolAtLocation(a);if(l&&(2097152&l.flags&&(l=o.getAliasedSymbol(l)),l.valueDeclaration)){s=!0,a=l.valueDeclaration;continue}}return}a=a.parent;}}function d(t,n){var i=n.getSourceFile(),a=function(t,n){if(e.isSourceFile(n))return {text:n.fileName,pos:0,end:0};if((e.isFunctionDeclaration(n)||e.isClassDeclaration(n))&&!e.isNamedDeclaration(n)){var i=n.modifiers&&e.find(n.modifiers,o);if(i)return {text:"default",pos:i.getStart(),end:i.getEnd()}}if(e.isClassStaticBlockDeclaration(n)){var a=n.getSourceFile(),s=e.skipTrivia(a.text,e.moveRangePastModifiers(n).pos),c=s+6,l=(_=(u=t.getTypeChecker()).getSymbolAtLocation(n.parent))?"".concat(u.symbolToString(_,n.parent)," "):"";return {text:"".concat(l,"static {}"),pos:s,end:c}}var u,_,d=r(n)?n.parent.name:e.Debug.checkDefined(e.getNameOfDeclaration(n),"Expected call hierarchy item to have a name"),p=e.isIdentifier(d)?e.idText(d):e.isStringOrNumericLiteralLike(d)?d.text:e.isComputedPropertyName(d)&&e.isStringOrNumericLiteralLike(d.expression)?d.expression.text:void 0;if(void 0===p&&(_=(u=t.getTypeChecker()).getSymbolAtLocation(d))&&(p=u.symbolToString(_,n)),void 0===p){var f=e.createPrinter({removeComments:!0,omitTrailingSemicolon:!0});p=e.usingSingleLineStringWriter((function(e){return f.writeNode(4,n,n.getSourceFile(),e)}));}return {text:p,pos:d.getStart(),end:d.getEnd()}}(t,n),s=function(t){var n,i;if(r(t))return e.isModuleBlock(t.parent.parent.parent.parent)&&e.isIdentifier(t.parent.parent.parent.parent.parent.name)?t.parent.parent.parent.parent.parent.name.getText():void 0;switch(t.kind){case 172:case 173:case 169:return 205===t.parent.kind?null===(n=e.getAssignedName(t.parent))||void 0===n?void 0:n.getText():null===(i=e.getNameOfDeclaration(t.parent))||void 0===i?void 0:i.getText();case 256:case 257:case 261:if(e.isModuleBlock(t.parent)&&e.isIdentifier(t.parent.parent.name))return t.parent.parent.name.getText()}}(n),c=e.getNodeKind(n),l=e.getNodeModifiers(n),u=e.createTextSpanFromBounds(e.skipTrivia(i.text,n.getFullStart(),!1,!0),n.getEnd()),_=e.createTextSpanFromBounds(a.pos,a.end);return {file:i.fileName,kind:c,kindModifiers:l,name:a.text,containerName:s,span:u,selectionSpan:_}}function p(e){return void 0!==e}function f(t){if(1===t.kind){var r=t.node;if(e.isCallOrNewExpressionTarget(r,!0,!0)||e.isTaggedTemplateTag(r,!0,!0)||e.isDecoratorTarget(r,!0,!0)||e.isJsxOpeningLikeElementTagName(r,!0,!0)||e.isRightSideOfPropertyAccess(r)||e.isArgumentExpressionOfElementAccess(r)){var n=r.getSourceFile();return {declaration:e.findAncestor(r,i)||n,range:e.createTextRangeFromNode(r,n)}}}}function g(t){return e.getNodeId(t.declaration)}t.resolveCallHierarchyDeclaration=_,t.createCallHierarchyItem=d,t.getIncomingCalls=function(t,r,n){if(e.isSourceFile(r)||e.isModuleDeclaration(r)||e.isClassStaticBlockDeclaration(r))return [];var i=a(r),o=e.filter(e.FindAllReferences.findReferenceOrRenameEntries(t,n,t.getSourceFiles(),i,0,{use:1},f),p);return o?e.group(o,g,(function(r){return function(t,r){return {from:d(t,r[0].declaration),fromSpans:e.map(r,(function(t){return e.createTextSpanFromRange(t.range)}))}}(t,r)})):[]},t.getOutgoingCalls=function(t,r){return 16777216&r.flags||e.isMethodSignature(r)?[]:e.group(function(t,r){var n=[],a=function(t,r){function n(n){var i=e.isTaggedTemplateExpression(n)?n.tag:e.isJsxOpeningLikeElement(n)?n.tagName:e.isAccessExpression(n)||e.isClassStaticBlockDeclaration(n)?n:n.expression,a=_(t,i);if(a){var o=e.createTextRangeFromNode(i,n.getSourceFile());if(e.isArray(a))for(var s=0,c=a;s<c.length;s++){var l=c[s];r.push({declaration:l,range:o});}else r.push({declaration:a,range:o});}}return function t(r){if(r&&!(16777216&r.flags))if(i(r)){if(e.isClassLike(r))for(var a=0,o=r.members;a<o.length;a++){var s=o[a];s.name&&e.isComputedPropertyName(s.name)&&t(s.name.expression);}}else {switch(r.kind){case 79:case 265:case 266:case 272:case 258:case 259:return;case 170:return void n(r);case 211:case 229:return void t(r.expression);case 254:case 164:return t(r.name),void t(r.initializer);case 208:case 209:return n(r),t(r.expression),void e.forEach(r.arguments,t);case 210:return n(r),t(r.tag),void t(r.template);case 280:case 279:return n(r),t(r.tagName),void t(r.attributes);case 165:return n(r),void t(r.expression);case 206:case 207:n(r),e.forEachChild(r,t);}e.isPartOfTypeNode(r)||e.forEachChild(r,t);}}}(t,n);switch(r.kind){case 305:!function(t,r){e.forEach(t.statements,r);}(r,a);break;case 261:!function(t,r){!e.hasSyntacticModifier(t,2)&&t.body&&e.isModuleBlock(t.body)&&e.forEach(t.body.statements,r);}(r,a);break;case 256:case 213:case 214:case 169:case 172:case 173:!function(t,r,n){var i=c(t,r);i&&(e.forEach(i.parameters,n),n(i.body));}(t.getTypeChecker(),r,a);break;case 257:case 226:!function(t,r){e.forEach(t.decorators,r);var n=e.getClassExtendsHeritageElement(t);n&&r(n.expression);for(var i=0,a=t.members;i<a.length;i++){var o=a[i];e.forEach(o.decorators,r),e.isPropertyDeclaration(o)?r(o.initializer):e.isConstructorDeclaration(o)&&o.body?(e.forEach(o.parameters,r),r(o.body)):e.isClassStaticBlockDeclaration(o)&&r(o);}}(r,a);break;case 170:!function(e,t){t(e.body);}(r,a);break;default:e.Debug.assertNever(r);}return n}(t,r),g,(function(r){return function(t,r){return {to:d(t,r[0].declaration),fromSpans:e.map(r,(function(t){return e.createTextSpanFromRange(t.range)}))}}(t,r)}))};}(e.CallHierarchy||(e.CallHierarchy={}));}(t),function(e){function t(t,n,i,a){var o=i(t);return function(t){var s=a&&a.tryGetSourcePosition({fileName:t,pos:0}),c=function(t){if(i(t)===o)return n;var r=e.tryRemoveDirectoryPrefix(t,o,i);return void 0===r?void 0:n+"/"+r}(s?s.fileName:t);return s?void 0===c?void 0:function(t,n,i,a){var o=e.getRelativePathFromFile(t,n,a);return r(e.getDirectoryPath(i),o)}(s.fileName,c,t,i):c}}function r(t,r){return e.ensurePathIsNonModuleName(function(t,r){return e.normalizePath(e.combinePaths(t,r))}(t,r))}function n(t,r,n,i){if(r){if(r.resolvedModule){var a=s(r.resolvedModule.resolvedFileName);if(a)return a}return e.forEach(r.failedLookupLocations,(function(t){var r=n(t);return r&&e.find(i,(function(e){return e.fileName===r}))?o(t):void 0}))||e.pathIsRelative(t.text)&&e.forEach(r.failedLookupLocations,o)||r.resolvedModule&&{newFileName:r.resolvedModule.resolvedFileName,updated:!1}}function o(t){return e.endsWith(t,"/package.json")?void 0:s(t)}function s(e){var t=n(e);return t&&{newFileName:t,updated:!0}}}function i(t,r){return e.createRange(t.getStart(r)+1,t.end-1)}function a(t,r){if(e.isObjectLiteralExpression(t))for(var n=0,i=t.properties;n<i.length;n++){var a=i[n];e.isPropertyAssignment(a)&&e.isStringLiteral(a.name)&&r(a,a.name.text);}}e.getEditsForFileRename=function(o,s,c,l,u,_,d){var p=e.hostUsesCaseSensitiveFileNames(l),f=e.createGetCanonicalFileName(p),g=t(s,c,f,d),m=t(c,s,f,d);return e.textChanges.ChangeTracker.with({host:l,formatContext:u,preferences:_},(function(t){!function(t,n,o,s,c,l,u){var _=t.getCompilerOptions().configFile;if(_){var d=e.getDirectoryPath(_.fileName),p=e.getTsConfigObjectLiteralExpression(_);p&&a(p,(function(t,r){switch(r){case"files":case"include":case"exclude":if(f(t)||"include"!==r||!e.isArrayLiteralExpression(t.initializer))return;var i=e.mapDefined(t.initializer.elements,(function(t){return e.isStringLiteral(t)?t.text:void 0}));if(0===i.length)return;var o=e.getFileMatcherPatterns(d,[],i,u,l);return void(e.getRegexFromPattern(e.Debug.checkDefined(o.includeFilePattern),u).test(s)&&!e.getRegexFromPattern(e.Debug.checkDefined(o.includeFilePattern),u).test(c)&&n.insertNodeAfter(_,e.last(t.initializer.elements),e.factory.createStringLiteral(m(c))));case"compilerOptions":return void a(t.initializer,(function(t,r){var n=e.getOptionFromName(r);n&&(n.isFilePath||"list"===n.type&&n.element.isFilePath)?f(t):"paths"===r&&a(t.initializer,(function(t){if(e.isArrayLiteralExpression(t.initializer))for(var r=0,n=t.initializer.elements;r<n.length;r++)g(n[r]);}));}))}}));}function f(t){for(var r=!1,n=0,i=e.isArrayLiteralExpression(t.initializer)?t.initializer.elements:[t.initializer];n<i.length;n++)r=g(i[n])||r;return r}function g(t){if(!e.isStringLiteral(t))return !1;var a=r(d,t.text),s=o(a);return void 0!==s&&(n.replaceRangeWithText(_,i(t,_),m(s)),!0)}function m(t){return e.getRelativePathFromDirectory(d,t,!u)}}(o,t,g,s,c,l.getCurrentDirectory(),p),function(t,a,o,s,c,l){for(var u=t.getSourceFiles(),_=function(_){var d=o(_.fileName),p=null!=d?d:_.fileName,f=e.getDirectoryPath(p),g=s(_.fileName),m=g||_.fileName,y=e.getDirectoryPath(m),v=void 0!==d||void 0!==g;!function(t,r,n,a){for(var o=0,s=t.referencedFiles||e.emptyArray;o<s.length;o++){var c=s[o];void 0!==(_=n(c.fileName))&&_!==t.text.slice(c.pos,c.end)&&r.replaceRangeWithText(t,c,_);}for(var l=0,u=t.imports;l<u.length;l++){var _,d=u[l];void 0!==(_=a(d))&&_!==d.text&&r.replaceRangeWithText(t,i(d,t),_);}}(_,a,(function(t){if(e.pathIsRelative(t)){var n=r(y,t),i=o(n);return void 0===i?void 0:e.ensurePathIsNonModuleName(e.getRelativePathFromDirectory(f,i,l))}}),(function(r){var i=t.getTypeChecker().getSymbolAtLocation(r);if(!(null==i?void 0:i.declarations)||!i.declarations.some((function(t){return e.isAmbientModule(t)}))){var a=void 0!==g?n(r,e.resolveModuleName(r.text,m,t.getCompilerOptions(),c),o,u):function(t,r,i,a,o,s){if(t){var c=e.find(t.declarations,e.isSourceFile).fileName,l=s(c);return void 0===l?{newFileName:c,updated:!1}:{newFileName:l,updated:!0}}var u=e.getModeForUsageLocation(i,r);return n(r,o.resolveModuleNames?o.getResolvedModuleWithFailedLookupLocationsFromCache&&o.getResolvedModuleWithFailedLookupLocationsFromCache(r.text,i.fileName,u):a.getResolvedModuleWithFailedLookupLocationsFromCache(r.text,i.fileName,u),s,a.getSourceFiles())}(i,r,_,t,c,o);return void 0!==a&&(a.updated||v&&e.pathIsRelative(r.text))?e.moduleSpecifiers.updateModuleSpecifier(t.getCompilerOptions(),_,l(p),a.newFileName,e.createModuleSpecifierResolutionHost(t,c),r.text):void 0}}));},d=0,p=u;d<p.length;d++)_(p[d]);}(o,t,g,m,l,f);}))},e.getPathUpdater=t;}(t),function(e){!function(t){function r(t,r,i,s,d){var f,g,m,y,v,h=o(r,i,t),b=h&&[(m=h.reference.fileName,y=h.fileName,v=h.unverified,{fileName:y,textSpan:e.createTextSpanFromBounds(0,0),kind:"script",name:m,containerName:void 0,containerKind:void 0,unverified:v})]||e.emptyArray;if(null==h?void 0:h.file)return b;var x=e.getTouchingPropertyName(r,i);if(x!==r){var D=x.parent,S=t.getTypeChecker();if(159===x.kind||e.isJSDocOverrideTag(x)&&e.rangeContainsPosition(x.tagName,i))return function(t,r){var n=e.findAncestor(r,e.isClassElement);if(n&&n.name){var i=e.findAncestor(n,e.isClassLike);if(i){var a=e.getEffectiveBaseTypeNode(i),o=a?t.getTypeAtLocation(a):void 0;if(o){var s=e.unescapeLeadingUnderscores(e.getTextOfPropertyName(n.name)),c=e.hasStaticModifier(n)?t.getPropertyOfType(t.getTypeOfSymbolAtLocation(o.symbol,i),s):t.getPropertyOfType(o,s);if(c)return l(t,c,r)}}}}(S,x)||e.emptyArray;if(e.isJumpStatementTarget(x)){var T=e.getTargetLabel(x.parent,x.text);return T?[_(S,T,"label",x.text,void 0)]:void 0}if(e.isStaticModifier(x)&&e.isClassStaticBlockDeclaration(x.parent)){var C=x.parent.parent,k=c(C,S,d),E=k.symbol,N=k.failedAliasResolution,F=e.filter(C.members,e.isClassStaticBlockDeclaration),A=E?S.symbolToString(E,C):"",P=x.getSourceFile();return e.map(F,(function(t){var r=e.moveRangePastModifiers(t).pos;return r=e.skipTrivia(P.text,r),_(S,t,"constructor","static {}",A,!1,N,{start:r,length:"static".length})}))}var w=c(x,S,d),I=w.symbol,O=w.failedAliasResolution,M=x;if(s&&O){var L=e.forEach(n$4([x],(null==I?void 0:I.declarations)||e.emptyArray,!0),(function(t){return e.findAncestor(t,e.isAnyImportOrBareOrAccessedRequire)})),R=L&&e.tryGetModuleSpecifierFromDeclaration(L);R&&(I=(f=c(R,S,d)).symbol,O=f.failedAliasResolution,M=R);}if(!I&&e.isModuleSpecifierLike(M)){var B=null===(g=r.resolvedModules)||void 0===g?void 0:g.get(M.text,e.getModeForUsageLocation(r,M));if(B)return [{name:M.text,fileName:B.resolvedFileName,containerName:void 0,containerKind:void 0,kind:"script",textSpan:e.createTextSpan(0,0),failedAliasResolution:O,isAmbient:e.isDeclarationFileName(B.resolvedFileName),unverified:M!==x}]}if(!I)return e.concatenate(b,function(t,r){return e.mapDefined(r.getIndexInfosAtLocation(t),(function(e){return e.declaration&&p(r,e.declaration)}))}(x,S));if(!s||!e.every(I.declarations,(function(e){return e.getSourceFile().fileName===r.fileName}))){var j=function(t,r){var n=function(t){var r=e.findAncestor(t,(function(t){return !e.isRightSideOfPropertyAccess(t)})),n=null==r?void 0:r.parent;return n&&e.isCallLikeExpression(n)&&e.getInvokedExpression(n)===r?n:void 0}(r),i=n&&t.getResolvedSignature(n);return e.tryCast(i&&i.declaration,(function(t){return e.isFunctionLike(t)&&!e.isFunctionTypeNode(t)}))}(S,x);if(j&&(!e.isJsxOpeningLikeElement(x.parent)||!function(e){switch(e.kind){case 171:case 180:case 175:return !0;default:return !1}}(j))){var J=p(S,j,O);if(S.getRootSymbols(I).some((function(t){return function(t,r){return t===r.symbol||t===r.symbol.parent||e.isAssignmentExpression(r.parent)||!e.isCallLikeExpression(r.parent)&&t===r.parent.symbol}(t,j)})))return [J];var z=l(S,I,x,O,j)||e.emptyArray;return 106===x.kind?n$4([J],z,!0):n$4(n$4([],z,!0),[J],!1)}if(297===x.parent.kind){var K=S.getShorthandAssignmentValueSymbol(I.valueDeclaration),U=(null==K?void 0:K.declarations)?K.declarations.map((function(e){return u(e,S,K,x,!1,O)})):e.emptyArray;return e.concatenate(U,a(S,x)||e.emptyArray)}if(e.isPropertyName(x)&&e.isBindingElement(D)&&e.isObjectBindingPattern(D.parent)&&x===(D.propertyName||D.name)){var V=e.getNameFromPropertyName(x),q=S.getTypeAtLocation(D.parent);return void 0===V?e.emptyArray:e.flatMap(q.isUnion()?q.types:[q],(function(e){var t=e.getProperty(V);return t&&l(S,t,x)}))}return e.concatenate(b,a(S,x)||l(S,I,x,O))}}}function a(t,r){var n=e.getContainingObjectLiteralElement(r);if(n){var i=n&&t.getContextualType(n.parent);if(i)return e.flatMap(e.getPropertySymbolsFromContextualType(n,t,i,!1),(function(e){return l(t,e,r)}))}}function o(t,r,n){var i,a,o=f(t.referencedFiles,r);if(o)return (l=n.getSourceFileFromReference(t,o))&&{reference:o,fileName:l.fileName,file:l,unverified:!1};var s=f(t.typeReferenceDirectives,r);if(s){var c=n.getResolvedTypeReferenceDirectives().get(s.fileName,s.resolutionMode||t.impliedNodeFormat);return (l=c&&n.getSourceFile(c.resolvedFileName))&&{reference:s,fileName:l.fileName,file:l,unverified:!1}}var l,u=f(t.libReferenceDirectives,r);if(u)return (l=n.getLibFileFromReference(u))&&{reference:u,fileName:l.fileName,file:l,unverified:!1};if(null===(i=t.resolvedModules)||void 0===i?void 0:i.size()){var _=e.getTouchingToken(t,r);if(e.isModuleSpecifierLike(_)&&e.isExternalModuleNameRelative(_.text)&&t.resolvedModules.has(_.text,e.getModeForUsageLocation(t,_))){var d=null===(a=t.resolvedModules.get(_.text,e.getModeForUsageLocation(t,_)))||void 0===a?void 0:a.resolvedFileName,p=d||e.resolvePath(e.getDirectoryPath(t.fileName),_.text);return {file:n.getSourceFile(p),fileName:p,reference:{pos:_.getStart(),end:_.getEnd(),fileName:_.text},unverified:!d}}}}function s(t,r,n,i){return e.flatMap(!t.isUnion()||32&t.flags?[t]:t.types,(function(e){return e.symbol&&l(r,e.symbol,n,i)}))}function c(e,t,r){var n=t.getSymbolAtLocation(e),i=!1;if((null==n?void 0:n.declarations)&&2097152&n.flags&&!r&&function(e,t){return 79===e.kind&&(e.parent===t||268!==t.kind)}(e,n.declarations[0])){var a=t.getAliasedSymbol(n);if(a.declarations)return {symbol:a};i=!0;}return {symbol:n,failedAliasResolution:i}}function l(t,r,n,i,a){var o=e.filter(r.declarations,(function(e){return e!==a})),s=e.filter(o,(function(t){return !function(t){if(!e.isAssignmentDeclaration(t))return !1;var r=e.findAncestor(t,(function(t){return !!e.isAssignmentExpression(t)||!e.isAssignmentDeclaration(t)&&"quit"}));return !!r&&5===e.getAssignmentDeclarationKind(r)}(t)})),c=e.some(s)?s:o;return function(){if(32&r.flags&&!(19&r.flags)&&(e.isNewExpressionTarget(n)||134===n.kind))return l((e.find(o,e.isClassLike)||e.Debug.fail("Expected declaration to have at least one class-like declaration")).members,!0)}()||(e.isCallOrNewExpressionTarget(n)||e.isNameOfFunctionDeclaration(n)?l(o,!1):void 0)||e.map(c,(function(e){return u(e,t,r,n,!1,i)}));function l(a,o){if(a){var s=a.filter(o?e.isConstructorDeclaration:e.isFunctionLike),c=s.filter((function(e){return !!e.body}));return s.length?0!==c.length?c.map((function(e){return u(e,t,r,n)})):[u(e.last(s),t,r,n,!1,i)]:void 0}}}function u(t,r,n,i,a,o){var s=r.symbolToString(n),c=e.SymbolDisplay.getSymbolKind(r,n,i),l=n.parent?r.symbolToString(n.parent,i):"";return _(r,t,c,s,l,a,o)}function _(t,r,n,a,o,s,c,l){var u=r.getSourceFile();if(!l){var _=e.getNameOfDeclaration(r)||r;l=e.createTextSpanFromNode(_,u);}return i$1(i$1({fileName:u.fileName,textSpan:l,kind:n,name:a,containerKind:void 0,containerName:o},e.FindAllReferences.toContextSpan(l,u,e.FindAllReferences.getContextNode(r))),{isLocal:!d(t,r),isAmbient:!!(16777216&r.flags),unverified:s,failedAliasResolution:c})}function d(t,r){if(t.isDeclarationVisible(r))return !0;if(!r.parent)return !1;if(e.hasInitializer(r.parent)&&r.parent.initializer===r)return d(t,r.parent);switch(r.kind){case 167:case 172:case 173:case 169:if(e.hasEffectiveModifier(r,8))return !1;case 171:case 296:case 297:case 205:case 226:case 214:case 213:return d(t,r.parent);default:return !1}}function p(e,t,r){return u(t,e,t.symbol,t,!1,r)}function f(t,r){return e.find(t,(function(t){return e.textRangeContainsPositionInclusive(t,r)}))}t.getDefinitionAtPosition=r,t.getReferenceAtPosition=o,t.getTypeDefinitionAtPosition=function(t,r,n){var i=e.getTouchingPropertyName(r,n);if(i!==r){if(e.isImportMeta(i.parent)&&i.parent.name===i)return s(t.getTypeAtLocation(i.parent),t,i.parent,!1);var a=c(i,t,!1),o=a.symbol,u=a.failedAliasResolution;if(o){var _=t.getTypeOfSymbolAtLocation(o,i),d=function(t,r,n){if(r.symbol===t||t.valueDeclaration&&r.symbol&&e.isVariableDeclaration(t.valueDeclaration)&&t.valueDeclaration.initializer===r.symbol.valueDeclaration){var i=r.getCallSignatures();if(1===i.length)return n.getReturnTypeOfSignature(e.first(i))}}(o,_,t),p=d&&s(d,t,i,u),f=p&&0!==p.length?p:s(_,t,i,u);return f.length?f:!(111551&o.flags)&&788968&o.flags?l(t,e.skipAlias(o,t),i,u):void 0}}},t.getDefinitionAndBoundSpan=function(t,n,i){var a=r(t,n,i);if(a&&0!==a.length){var o=f(n.referencedFiles,i)||f(n.typeReferenceDirectives,i)||f(n.libReferenceDirectives,i);if(o)return {definitions:a,textSpan:e.createTextSpanFromRange(o)};var s=e.getTouchingPropertyName(n,i);return {definitions:a,textSpan:e.createTextSpan(s.getStart(),s.getWidth())}}},t.createDefinitionInfo=u,t.findReferenceInPosition=f;}(e.GoToDefinition||(e.GoToDefinition={}));}(t),function(e){!function(t){var r,i,a=["abstract","access","alias","argument","async","augments","author","borrows","callback","class","classdesc","constant","constructor","constructs","copyright","default","deprecated","description","emits","enum","event","example","exports","extends","external","field","file","fileoverview","fires","function","generator","global","hideconstructor","host","ignore","implements","inheritdoc","inner","instance","interface","kind","lends","license","link","listens","member","memberof","method","mixes","module","name","namespace","override","package","param","private","property","protected","public","readonly","requires","returns","see","since","static","summary","template","this","throws","todo","tutorial","type","typedef","var","variation","version","virtual","yields"];function o(t,r){return e.arraysEqual(t,r,(function(e,t){return e.kind===t.kind&&e.text===t.text}))}function s(t,r){return "string"==typeof t?[e.textPart(t)]:e.flatMap(t,(function(t){return 321===t.kind?[e.textPart(t.text)]:e.buildLinkParts(t,r)}))}function c(t,r){var i=t.comment,a=t.kind,o=function(t){switch(t){case 340:return e.parameterNamePart;case 347:return e.propertyNamePart;case 344:return e.typeParameterNamePart;case 345:case 338:return e.typeAliasNamePart;default:return e.textPart}}(a);switch(a){case 329:case 328:return d(t.class);case 344:var c=t,l=[];if(c.constraint&&l.push(e.textPart(c.constraint.getText())),e.length(c.typeParameters)){e.length(l)&&l.push(e.spacePart());var u=c.typeParameters[c.typeParameters.length-1];e.forEach(c.typeParameters,(function(t){l.push(o(t.getText())),u!==t&&l.push.apply(l,[e.punctuationPart(27),e.spacePart()]);}));}return i&&l.push.apply(l,n$4([e.spacePart()],s(i,r),!0)),l;case 343:return d(t.typeExpression);case 345:case 338:case 347:case 340:case 346:var _=t.name;return _?d(_):void 0===i?void 0:s(i,r);default:return void 0===i?void 0:s(i,r)}function d(t){return a=t.getText(),i?a.match(/^https?$/)?n$4([e.textPart(a)],s(i,r),!0):n$4([o(a),e.spacePart()],s(i,r),!0):[e.textPart(a)];var a;}}function l(t){return {name:t,kind:"",kindModifiers:"",displayParts:[e.textPart(t)],documentation:e.emptyArray,tags:void 0,codeActions:void 0}}function u(t,r){switch(t.kind){case 256:case 213:case 169:case 171:case 168:case 214:var n=t;return {commentOwner:t,parameters:n.parameters,hasReturn:_(n,r)};case 296:return u(t.initializer,r);case 257:case 258:case 166:case 260:case 299:case 259:return {commentOwner:t};case 237:var i=t.declarationList.declarations,a=1===i.length&&i[0].initializer?function(t){for(;212===t.kind;)t=t.expression;switch(t.kind){case 213:case 214:return t;case 226:return e.find(t.members,e.isConstructorDeclaration)}}(i[0].initializer):void 0;return a?{commentOwner:t,parameters:a.parameters,hasReturn:_(a,r)}:{commentOwner:t};case 305:return "quit";case 261:return 261===t.parent.kind?void 0:{commentOwner:t};case 238:return u(t.expression,r);case 221:var o=t;return 0===e.getAssignmentDeclarationKind(o)?"quit":e.isFunctionLike(o.right)?{commentOwner:t,parameters:o.right.parameters,hasReturn:_(o.right,r)}:{commentOwner:t};case 167:var s=t.initializer;if(s&&(e.isFunctionExpression(s)||e.isArrowFunction(s)))return {commentOwner:t,parameters:s.parameters,hasReturn:_(s,r)}}}function _(t,r){return !!(null==r?void 0:r.generateReturnInDocTemplate)&&(e.isArrowFunction(t)&&e.isExpression(t.body)||e.isFunctionLikeDeclaration(t)&&t.body&&e.isBlock(t.body)&&!!e.forEachReturnStatement(t.body,(function(e){return e})))}t.getJsDocCommentsFromDeclarations=function(t,r){var n=[];return e.forEachUnique(t,(function(t){for(var i=0,a=function(t){switch(t.kind){case 340:case 347:return [t];case 338:case 345:return [t,t.parent];default:return e.getJSDocCommentsAndTags(t)}}(t);i<a.length;i++){var c=a[i];if(!(void 0===c.comment||e.isJSDoc(c)&&345!==t.kind&&338!==t.kind&&c.tags&&c.tags.some((function(e){return 345===e.kind||338===e.kind}))&&!c.tags.some((function(e){return 340===e.kind||341===e.kind})))){var l=s(c.comment,r);e.contains(n,l,o)||n.push(l);}}})),e.flatten(e.intersperse(n,[e.lineBreakPart()]))},t.getJsDocTagsFromDeclarations=function(t,r){var n=[];return e.forEachUnique(t,(function(t){var i=e.getJSDocTags(t);if(!i.some((function(e){return 345===e.kind||338===e.kind}))||i.some((function(e){return 340===e.kind||341===e.kind})))for(var a=0,o=i;a<o.length;a++){var s=o[a];n.push({name:s.tagName.text,text:c(s,r)});}})),n},t.getJSDocTagNameCompletions=function(){return r||(r=e.map(a,(function(t){return {name:t,kind:"keyword",kindModifiers:"",sortText:e.Completions.SortText.LocationPriority}})))},t.getJSDocTagNameCompletionDetails=l,t.getJSDocTagCompletions=function(){return i||(i=e.map(a,(function(t){return {name:"@".concat(t),kind:"keyword",kindModifiers:"",sortText:e.Completions.SortText.LocationPriority}})))},t.getJSDocTagCompletionDetails=l,t.getJSDocParameterNameCompletions=function(t){if(!e.isIdentifier(t.name))return e.emptyArray;var r=t.name.text,n=t.parent,i=n.parent;return e.isFunctionLike(i)?e.mapDefined(i.parameters,(function(i){if(e.isIdentifier(i.name)){var a=i.name.text;if(!n.tags.some((function(r){return r!==t&&e.isJSDocParameterTag(r)&&e.isIdentifier(r.name)&&r.name.escapedText===a}))&&(void 0===r||e.startsWith(a,r)))return {name:a,kind:"parameter",kindModifiers:"",sortText:e.Completions.SortText.LocationPriority}}})):[]},t.getJSDocParameterNameCompletionDetails=function(t){return {name:t,kind:"parameter",kindModifiers:"",displayParts:[e.textPart(t)],documentation:e.emptyArray,tags:void 0,codeActions:void 0}},t.getDocCommentTemplateAtPosition=function(t,r,n,i){var a=e.getTokenAtPosition(r,n),o=e.findAncestor(a,e.isJSDoc);if(!o||void 0===o.comment&&!e.length(o.tags)){var s=a.getStart(r);if(o||!(s<n)){var c=function(t,r){return e.forEachAncestor(t,(function(e){return u(e,r)}))}(a,i);if(c){var l=c.commentOwner,_=c.parameters,d=c.hasReturn,p=e.hasJSDocNodes(l)&&l.jsDoc?e.lastOrUndefined(l.jsDoc):void 0;if(!(l.getStart(r)<n||p&&p!==o)){var f=function(t,r){for(var n=t.text,i=e.getLineStartPositionForPosition(r,t),a=i;a<=r&&e.isWhiteSpaceSingleLine(n.charCodeAt(a));a++);return n.slice(i,a)}(r,n),g=e.hasJSFileExtension(r.fileName),m=(_?function(e,t,r,n){return e.map((function(e,i){var a=e.name,o=e.dotDotDotToken,s=79===a.kind?a.text:"param"+i,c=t?o?"{...any} ":"{any} ":"";return "".concat(r," * @param ").concat(c).concat(s).concat(n)})).join("")}(_||[],g,f,t):"")+(d?function(e,t){return "".concat(e," * @returns").concat(t)}(f,t):"");if(m){var y="/**"+t+f+" * ";return {newText:y+t+m+f+" */"+(s===n?t+f:""),caretOffset:y.length}}return {newText:"/** */",caretOffset:3}}}}}};}(e.JsDoc||(e.JsDoc={}));}(t),function(e){!function(t){function r(e,t){switch(e.kind){case 267:case 270:case 265:var r=t.getSymbolAtLocation(e.name),n=t.getAliasedSymbol(r);return r.escapedName!==n.escapedName;default:return !0}}function n(t,r){var n=e.getNameOfDeclaration(t);return !!n&&(a(n,r)||162===n.kind&&i(n.expression,r))}function i(t,r){return a(t,r)||e.isPropertyAccessExpression(t)&&(r.push(t.name.text),!0)&&i(t.expression,r)}function a(t,r){return e.isPropertyNameLiteral(t)&&(r.push(e.getTextOfIdentifierOrLiteral(t)),!0)}function o(t){var r=[],a=e.getNameOfDeclaration(t);if(a&&162===a.kind&&!i(a.expression,r))return e.emptyArray;r.shift();for(var o=e.getContainerNode(t);o;){if(!n(o,r))return e.emptyArray;o=e.getContainerNode(o);}return r.reverse()}function s(t,r){return e.compareValues(t.matchKind,r.matchKind)||e.compareStringsCaseSensitiveUI(t.name,r.name)}function c(t){var r=t.declaration,n=e.getContainerNode(r),i=n&&e.getNameOfDeclaration(n);return {name:t.name,kind:e.getNodeKind(r),kindModifiers:e.getNodeModifiers(r),matchKind:e.PatternMatchKind[t.matchKind],isCaseSensitive:t.isCaseSensitive,fileName:t.fileName,textSpan:e.createTextSpanFromNode(r),containerName:i?i.text:"",containerKind:i?e.getNodeKind(n):""}}t.getNavigateToItems=function(t,n,i,a,l,u){var _=e.createPatternMatcher(a);if(!_)return e.emptyArray;for(var d=[],p=function(e){if(i.throwIfCancellationRequested(),u&&e.isDeclarationFile)return "continue";e.getNamedDeclarations().forEach((function(t,i){!function(e,t,n,i,a,s){var c=e.getMatchForLastSegmentOfPattern(t);if(c)for(var l=0,u=n;l<u.length;l++){var _=u[l];if(r(_,i))if(e.patternContainsDots){var d=e.getFullMatch(o(_),t);d&&s.push({name:t,fileName:a,matchKind:d.kind,isCaseSensitive:d.isCaseSensitive,declaration:_});}else s.push({name:t,fileName:a,matchKind:c.kind,isCaseSensitive:c.isCaseSensitive,declaration:_});}}(_,i,t,n,e.fileName,d);}));},f=0,g=t;f<g.length;f++)p(g[f]);return d.sort(s),(void 0===l?d:d.slice(0,l)).map(c)};}(e.NavigateTo||(e.NavigateTo={}));}(t),function(e){!function(t){var r,n,a,o,s,c=/\s+/g,l=[],u=[],_=[];function d(){a=void 0,n=void 0,l=[],o=void 0,_=[];}function p(e){return Q(e.getText(a))}function f(e){return e.node.kind}function g(e,t){e.children?e.children.push(t):e.children=[t];}function m(t){e.Debug.assert(!l.length);var r={node:t,name:void 0,additionalNodes:void 0,parent:void 0,children:void 0,indent:0};o=r;for(var n=0,i=t.statements;n<i.length;n++)E(i[n]);return S(),e.Debug.assert(!o&&!l.length),r}function y(e,t){g(o,v(e,t));}function v(t,r){return {node:t,name:r||(e.isDeclaration(t)||e.isExpression(t)?e.getNameOfDeclaration(t):void 0),additionalNodes:void 0,parent:o,children:void 0,indent:o.indent+1}}function h(t){s||(s=new e.Map),s.set(t,!0);}function b(e){for(var t=0;t<e;t++)S();}function x(t,r){for(var n=[];!e.isPropertyNameLiteral(r);){var i=e.getNameOrArgument(r),a=e.getElementOrPropertyAccessName(r);r=r.expression,"prototype"===a||e.isPrivateIdentifier(i)||n.push(i);}n.push(r);for(var o=n.length-1;o>0;o--)D(t,i=n[o]);return [n.length-1,n[0]]}function D(e,t){var r=v(e,t);g(o,r),l.push(o),u.push(s),s=void 0,o=r;}function S(){o.children&&(N(o.children,o),O(o.children)),o=l.pop(),s=u.pop();}function T(e,t,r){D(e,r),E(t),S();}function C(t){t.initializer&&function(e){switch(e.kind){case 214:case 213:case 226:return !0;default:return !1}}(t.initializer)?(D(t),e.forEachChild(t.initializer,E),S()):T(t,t.initializer);}function k(t){return !e.hasDynamicName(t)||221!==t.kind&&e.isPropertyAccessExpression(t.name.expression)&&e.isIdentifier(t.name.expression.expression)&&"Symbol"===e.idText(t.name.expression.expression)}function E(t){var r;if(n.throwIfCancellationRequested(),t&&!e.isToken(t))switch(t.kind){case 171:var i=t;T(i,i.body);for(var a=0,o=i.parameters;a<o.length;a++){var c=o[a];e.isParameterPropertyDeclaration(c,i)&&y(c);}break;case 169:case 172:case 173:case 168:k(t)&&T(t,t.body);break;case 167:k(t)&&C(t);break;case 166:k(t)&&y(t);break;case 267:var l=t;l.name&&y(l.name);var u=l.namedBindings;if(u)if(268===u.kind)y(u);else for(var _=0,d=u.elements;_<d.length;_++)y(d[_]);break;case 297:T(t,t.name);break;case 298:var p=t.expression;e.isIdentifier(p)?y(t,p):y(t);break;case 203:case 296:case 254:var f=t;e.isBindingPattern(f.name)?E(f.name):C(f);break;case 256:var g=t.name;g&&e.isIdentifier(g)&&h(g.text),T(t,t.body);break;case 214:case 213:T(t,t.body);break;case 260:D(t);for(var m=0,v=t.members;m<v.length;m++)V(A=v[m])||y(A);S();break;case 257:case 226:case 258:D(t);for(var N=0,F=t.members;N<F.length;N++){var A;E(A=F[N]);}S();break;case 261:T(t,U(t).body);break;case 271:var P=t.expression;(f=e.isObjectLiteralExpression(P)||e.isCallExpression(P)?P:e.isArrowFunction(P)||e.isFunctionExpression(P)?P.body:void 0)?(D(t),E(f),S()):y(t);break;case 275:case 265:case 176:case 174:case 175:case 259:y(t);break;case 208:case 221:var w=e.getAssignmentDeclarationKind(t);switch(w){case 1:case 2:return void T(t,t.right);case 6:case 3:var I=(J=t).left,O=3===w?I.expression:I,M=0,L=void 0;return e.isIdentifier(O.expression)?(h(O.expression.text),L=O.expression):(M=(r=x(J,O.expression))[0],L=r[1]),6===w?e.isObjectLiteralExpression(J.right)&&J.right.properties.length>0&&(D(J,L),e.forEachChild(J.right,E),S()):e.isFunctionExpression(J.right)||e.isArrowFunction(J.right)?T(t,J.right,L):(D(J,L),T(t,J.right,I.name),S()),void b(M);case 7:case 9:var R=t,B=(L=7===w?R.arguments[0]:R.arguments[0].expression,R.arguments[1]),j=x(t,L);return M=j[0],D(t,j[1]),D(t,e.setTextRange(e.factory.createIdentifier(B.text),B)),E(t.arguments[2]),S(),S(),void b(M);case 5:var J,z=(I=(J=t).left).expression;if(e.isIdentifier(z)&&"prototype"!==e.getElementOrPropertyAccessName(I)&&s&&s.has(z.text))return void(e.isFunctionExpression(J.right)||e.isArrowFunction(J.right)?T(t,J.right,z):e.isBindableStaticAccessExpression(I)&&(D(J,z),T(J.left,J.right,e.getNameOrArgument(I)),S()));break;case 4:case 0:case 8:break;default:e.Debug.assertNever(w);}default:e.hasJSDocNodes(t)&&e.forEach(t.jsDoc,(function(t){e.forEach(t.tags,(function(t){e.isJSDocTypeAlias(t)&&y(t);}));})),e.forEachChild(t,E);}}function N(t,r){var n=new e.Map;e.filterMutate(t,(function(t,i){var a=t.name||e.getNameOfDeclaration(t.node),o=a&&p(a);if(!o)return !0;var s=n.get(o);if(!s)return n.set(o,t),!0;if(s instanceof Array){for(var c=0,l=s;c<l.length;c++){var u;if(A(u=l[c],t,i,r))return !1}return s.push(t),!0}return !A(u=s,t,i,r)&&(n.set(o,[u,t]),!0)}));}t.getNavigationBarItems=function(t,r){n=r,a=t;try{return e.map((i=m(t),o=[],function e(t){if(function(e){if(e.children)return !0;switch(f(e)){case 257:case 226:case 260:case 258:case 261:case 305:case 259:case 345:case 338:return !0;case 214:case 256:case 213:return t(e);default:return !1}function t(e){if(!e.node.body)return !1;switch(f(e.parent)){case 262:case 305:case 169:case 171:return !0;default:return !1}}}(t)&&(o.push(t),t.children))for(var r=0,n=t.children;r<n.length;r++)e(n[r]);}(i),o),j)}finally{d();}var i,o;},t.getNavigationTree=function(e,t){n=t,a=e;try{return B(m(e))}finally{d();}};var F=((r={})[5]=!0,r[3]=!0,r[7]=!0,r[9]=!0,r[0]=!1,r[1]=!1,r[2]=!1,r[8]=!1,r[6]=!0,r[4]=!1,r);function A(t,r,n,a){return !!function(t,r,n,a){function o(t){return e.isFunctionExpression(t)||e.isFunctionDeclaration(t)||e.isVariableDeclaration(t)}var s=e.isBinaryExpression(r.node)||e.isCallExpression(r.node)?e.getAssignmentDeclarationKind(r.node):0,c=e.isBinaryExpression(t.node)||e.isCallExpression(t.node)?e.getAssignmentDeclarationKind(t.node):0;if(F[s]&&F[c]||o(t.node)&&F[s]||o(r.node)&&F[c]||e.isClassDeclaration(t.node)&&P(t.node)&&F[s]||e.isClassDeclaration(r.node)&&F[c]||e.isClassDeclaration(t.node)&&P(t.node)&&o(r.node)||e.isClassDeclaration(r.node)&&o(t.node)&&P(t.node)){var l=t.additionalNodes&&e.lastOrUndefined(t.additionalNodes)||t.node;if(!e.isClassDeclaration(t.node)&&!e.isClassDeclaration(r.node)||o(t.node)||o(r.node)){var u=o(t.node)?t.node:o(r.node)?r.node:void 0;if(void 0!==u){var _=v(e.setTextRange(e.factory.createConstructorDeclaration(void 0,void 0,[],void 0),u));_.indent=t.indent+1,_.children=t.node===u?t.children:r.children,t.children=t.node===u?e.concatenate([_],r.children||[r]):e.concatenate(t.children||[i$1({},t)],[_]);}else (t.children||r.children)&&(t.children=e.concatenate(t.children||[i$1({},t)],r.children||[r]),t.children&&(N(t.children,t),O(t.children)));l=t.node=e.setTextRange(e.factory.createClassDeclaration(void 0,void 0,t.name||e.factory.createIdentifier("__class__"),void 0,void 0,[]),t.node);}else t.children=e.concatenate(t.children,r.children),t.children&&N(t.children,t);var d=r.node;return a.children[n-1].node.end===l.end?e.setTextRange(l,{pos:l.pos,end:d.end}):(t.additionalNodes||(t.additionalNodes=[]),t.additionalNodes.push(e.setTextRange(e.factory.createClassDeclaration(void 0,void 0,t.name||e.factory.createIdentifier("__class__"),void 0,void 0,[]),r.node))),!0}return 0!==s}(t,r,n,a)||!!function(t,r,n){if(t.kind!==r.kind||t.parent!==r.parent&&(!w(t,n)||!w(r,n)))return !1;switch(t.kind){case 167:case 169:case 172:case 173:return e.isStatic(t)===e.isStatic(r);case 261:return I(t,r)&&K(t)===K(r);default:return !0}}(t.node,r.node,a)&&(function(t,r){var n;t.additionalNodes=t.additionalNodes||[],t.additionalNodes.push(r.node),r.additionalNodes&&(n=t.additionalNodes).push.apply(n,r.additionalNodes),t.children=e.concatenate(t.children,r.children),t.children&&(N(t.children,t),O(t.children));}(t,r),!0)}function P(e){return !!(8&e.flags)}function w(t,r){var n=e.isModuleBlock(t.parent)?t.parent.parent:t.parent;return n===r.node||e.contains(r.additionalNodes,n)}function I(e,t){return e.body&&t.body?e.body.kind===t.body.kind&&(261!==e.body.kind||I(e.body,t.body)):e.body===t.body}function O(e){e.sort(M);}function M(t,r){return e.compareStringsCaseSensitiveUI(L(t.node),L(r.node))||e.compareValues(f(t),f(r))}function L(t){if(261===t.kind)return z(t);var r=e.getNameOfDeclaration(t);if(r&&e.isPropertyName(r)){var n=e.getPropertyNameForPropertyNameNode(r);return n&&e.unescapeLeadingUnderscores(n)}switch(t.kind){case 213:case 214:case 226:return H(t);default:return}}function R(t,r){if(261===t.kind)return Q(z(t));if(r){var n=e.isIdentifier(r)?r.text:e.isElementAccessExpression(r)?"[".concat(p(r.argumentExpression),"]"):p(r);if(n.length>0)return Q(n)}switch(t.kind){case 305:var i=t;return e.isExternalModule(i)?'"'.concat(e.escapeString(e.getBaseFileName(e.removeFileExtension(e.normalizePath(i.fileName)))),'"'):"<global>";case 271:return e.isExportAssignment(t)&&t.isExportEquals?"export=":"default";case 214:case 256:case 213:case 257:case 226:return 512&e.getSyntacticModifierFlags(t)?"default":H(t);case 171:return "constructor";case 175:return "new()";case 174:return "()";case 176:return "[]";default:return "<unknown>"}}function B(t){return {text:R(t.node,t.name),kind:e.getNodeKind(t.node),kindModifiers:W(t.node),spans:J(t),nameSpan:t.name&&q(t.name),childItems:e.map(t.children,B)}}function j(t){return {text:R(t.node,t.name),kind:e.getNodeKind(t.node),kindModifiers:W(t.node),spans:J(t),childItems:e.map(t.children,(function(t){return {text:R(t.node,t.name),kind:e.getNodeKind(t.node),kindModifiers:e.getNodeModifiers(t.node),spans:J(t),childItems:_,indent:0,bolded:!1,grayed:!1}}))||_,indent:t.indent,bolded:!1,grayed:!1}}function J(e){var t=[q(e.node)];if(e.additionalNodes)for(var r=0,n=e.additionalNodes;r<n.length;r++){var i=n[r];t.push(q(i));}return t}function z(t){return e.isAmbientModule(t)?e.getTextOfNode(t.name):K(t)}function K(t){for(var r=[e.getTextOfIdentifierOrLiteral(t.name)];t.body&&261===t.body.kind;)t=t.body,r.push(e.getTextOfIdentifierOrLiteral(t.name));return r.join(".")}function U(t){return t.body&&e.isModuleDeclaration(t.body)?U(t.body):t}function V(e){return !e.name||162===e.name.kind}function q(t){return 305===t.kind?e.createTextSpanFromRange(t):e.createTextSpanFromNode(t,a)}function W(t){return t.parent&&254===t.parent.kind&&(t=t.parent),e.getNodeModifiers(t)}function H(t){var r=t.parent;if(t.name&&e.getFullWidth(t.name)>0)return Q(e.declarationNameToString(t.name));if(e.isVariableDeclaration(r))return Q(e.declarationNameToString(r.name));if(e.isBinaryExpression(r)&&63===r.operatorToken.kind)return p(r.left).replace(c,"");if(e.isPropertyAssignment(r))return p(r.name);if(512&e.getSyntacticModifierFlags(t))return "default";if(e.isClassLike(t))return "<class>";if(e.isCallExpression(r)){var n=G(r.expression);if(void 0!==n){if((n=Q(n)).length>150)return "".concat(n," callback");var i=Q(e.mapDefined(r.arguments,(function(t){return e.isStringLiteralLike(t)?t.getText(a):void 0})).join(", "));return "".concat(n,"(").concat(i,") callback")}}return "<function>"}function G(t){if(e.isIdentifier(t))return t.text;if(e.isPropertyAccessExpression(t)){var r=G(t.expression),n=t.name.text;return void 0===r?n:"".concat(r,".").concat(n)}}function Q(e){return (e=e.length>150?e.substring(0,150)+"...":e).replace(/\\?(\r?\n|\r|\u2028|\u2029)/g,"")}}(e.NavigationBar||(e.NavigationBar={}));}(t),function(e){!function(t){function r(t,r){for(var i=e.createScanner(t.languageVersion,!1,t.languageVariant),a=[],o=0,s=0,c=r;s<c.length;s++){var l=c[s];n(t,l,i)&&o++,a[o]||(a[o]=[]),a[o].push(l);}return a}function n(e,t,r){var n=t.getFullStart(),i=t.getStart();r.setText(e.text,n,i-n);for(var a=0;r.getTokenPos()<i;)if(4===r.scan()&&++a>=2)return !0;return !1}function i(t,r){var n=e.isStringLiteral(r)&&r.text;return e.isString(n)&&e.some(t.moduleAugmentations,(function(t){return e.isStringLiteral(t)&&t.text===n}))}function a(t){return void 0!==t&&e.isStringLiteralLike(t)?t.text:void 0}function o(t){var r;if(0===t.length)return t;var n=function(t){for(var r,n={defaultImports:[],namespaceImports:[],namedImports:[]},i={defaultImports:[],namespaceImports:[],namedImports:[]},a=0,o=t;a<o.length;a++){var s=o[a];if(void 0!==s.importClause){var c=s.importClause.isTypeOnly?n:i,l=s.importClause,u=l.name,_=l.namedBindings;u&&c.defaultImports.push(s),_&&(e.isNamespaceImport(_)?c.namespaceImports.push(s):c.namedImports.push(s));}else r=r||s;}return {importWithoutClause:r,typeOnlyImports:n,regularImports:i}}(t),i=n.importWithoutClause,a=n.typeOnlyImports,o=n.regularImports,s=[];i&&s.push(i);for(var u=0,_=[o,a];u<_.length;u++){var p=_[u],f=p===a,g=p.defaultImports,y=p.namespaceImports,v=p.namedImports;if(f||1!==g.length||1!==y.length||0!==v.length){for(var h=0,b=e.stableSort(y,(function(e,t){return d(e.importClause.namedBindings.name,t.importClause.namedBindings.name)}));h<b.length;h++){var x=b[h];s.push(c(x,void 0,x.importClause.namedBindings));}if(0!==g.length||0!==v.length){var D=void 0,S=[];if(1===g.length)D=g[0].importClause.name;else for(var T=0,C=g;T<C.length;T++)F=C[T],S.push(e.factory.createImportSpecifier(!1,e.factory.createIdentifier("default"),F.importClause.name));S.push.apply(S,m(v));var k=l(S),E=g.length>0?g[0]:v[0],N=0===k.length?D?void 0:e.factory.createNamedImports(e.emptyArray):0===v.length?e.factory.createNamedImports(k):e.factory.updateNamedImports(v[0].importClause.namedBindings,k);f&&D&&N?(s.push(c(E,D,void 0)),s.push(c(null!==(r=v[0])&&void 0!==r?r:E,void 0,N))):s.push(c(E,D,N));}}else {var F=g[0];s.push(c(F,F.importClause.name,y[0].importClause.namedBindings));}}return s}function s(t){if(0===t.length)return t;var r=function(e){for(var t,r=[],n=[],i=0,a=e;i<a.length;i++){var o=a[i];void 0===o.exportClause?t=t||o:o.isTypeOnly?n.push(o):r.push(o);}return {exportWithoutClause:t,namedExports:r,typeOnlyExports:n}}(t),n=r.exportWithoutClause,i=r.namedExports,a=r.typeOnlyExports,o=[];n&&o.push(n);for(var s=0,c=[i,a];s<c.length;s++){var u=c[s];if(0!==u.length){var _=[];_.push.apply(_,e.flatMap(u,(function(t){return t.exportClause&&e.isNamedExports(t.exportClause)?t.exportClause.elements:e.emptyArray})));var d=l(_),p=u[0];o.push(e.factory.updateExportDeclaration(p,p.decorators,p.modifiers,p.isTypeOnly,p.exportClause&&(e.isNamedExports(p.exportClause)?e.factory.updateNamedExports(p.exportClause,d):e.factory.updateNamespaceExport(p.exportClause,p.exportClause.name)),p.moduleSpecifier,p.assertClause));}}return o}function c(t,r,n){return e.factory.updateImportDeclaration(t,t.decorators,t.modifiers,e.factory.updateImportClause(t.importClause,t.importClause.isTypeOnly,r,n),t.moduleSpecifier,t.assertClause)}function l(t){return e.stableSort(t,u)}function u(t,r){return e.compareBooleans(t.isTypeOnly,r.isTypeOnly)||d(t.propertyName||t.name,r.propertyName||r.name)||d(t.name,r.name)}function _(t,r){var n=void 0===t?void 0:a(t),i=void 0===r?void 0:a(r);return e.compareBooleans(void 0===n,void 0===i)||e.compareBooleans(e.isExternalModuleNameRelative(n),e.isExternalModuleNameRelative(i))||e.compareStringsCaseInsensitive(n,i)}function d(t,r){return e.compareStringsCaseInsensitive(t.text,r.text)}function p(t){var r;switch(t.kind){case 265:return null===(r=e.tryCast(t.moduleReference,e.isExternalModuleReference))||void 0===r?void 0:r.expression;case 266:return t.moduleSpecifier;case 237:return t.declarationList.declarations[0].initializer.arguments[0]}}function f(t,r){return _(p(t),p(r))||function(t,r){return e.compareValues(g(t),g(r))}(t,r)}function g(e){var t;switch(e.kind){case 266:return e.importClause?e.importClause.isTypeOnly?1:268===(null===(t=e.importClause.namedBindings)||void 0===t?void 0:t.kind)?2:e.importClause.name?3:4:0;case 265:return 5;case 237:return 6}}function m(t){return e.flatMap(t,(function(t){return e.map(function(t){var r;return (null===(r=t.importClause)||void 0===r?void 0:r.namedBindings)&&e.isNamedImports(t.importClause.namedBindings)?t.importClause.namedBindings.elements:void 0}(t),(function(t){return t.name&&t.propertyName&&t.name.escapedText===t.propertyName.escapedText?e.factory.updateImportSpecifier(t,t.isTypeOnly,void 0,t.name):t}))}))}t.organizeImports=function(t,n,l,u,d,p){var g=e.textChanges.ChangeTracker.fromContext({host:l,formatContext:n,preferences:d}),m=function(r){return e.stableSort(o(function(t,r,n,a){if(a)return t;for(var o=n.getTypeChecker(),s=n.getCompilerOptions(),l=o.getJsxNamespace(r),u=o.getJsxFragmentFactory(r),_=!!(2&r.transformFlags),d=[],p=0,f=t;p<f.length;p++){var g=f[p],m=g.importClause,y=g.moduleSpecifier;if(m){var v=m.name,h=m.namedBindings;if(v&&!x(v)&&(v=void 0),h)if(e.isNamespaceImport(h))x(h.name)||(h=void 0);else {var b=h.elements.filter((function(e){return x(e.name)}));b.length<h.elements.length&&(h=b.length?e.factory.updateNamedImports(h,b):void 0);}v||h?d.push(c(g,v,h)):i(r,y)&&(r.isDeclarationFile?d.push(e.factory.createImportDeclaration(g.decorators,g.modifiers,void 0,y,void 0)):d.push(g));}else d.push(g);}return d;function x(t){return _&&(t.text===l||u&&t.text===u)&&e.jsxModeNeedsExplicitImport(s.jsx)||e.FindAllReferences.Core.isSymbolReferencedInFile(t,o,r)}}(r,t,u,p)),(function(e,t){return f(e,t)}))};r(t,t.statements.filter(e.isImportDeclaration)).forEach((function(e){return b(e,m)})),b(t.statements.filter(e.isExportDeclaration),s);for(var y=0,v=t.statements.filter(e.isAmbientModule);y<v.length;y++){var h=v[y];h.body&&(r(t,h.body.statements.filter(e.isImportDeclaration)).forEach((function(e){return b(e,m)})),b(h.body.statements.filter(e.isExportDeclaration),s));}return g.getChanges();function b(r,i){if(0!==e.length(r)){e.suppressLeadingTrivia(r[0]);var o=e.group(r,(function(e){return a(e.moduleSpecifier)})),s=e.stableSort(o,(function(e,t){return _(e[0].moduleSpecifier,t[0].moduleSpecifier)})),c=e.flatMap(s,(function(e){return a(e[0].moduleSpecifier)?i(e):e}));if(0===c.length)g.deleteNodes(t,r,{trailingTriviaOption:e.textChanges.TrailingTriviaOption.Include},!0);else {var u={leadingTriviaOption:e.textChanges.LeadingTriviaOption.Exclude,trailingTriviaOption:e.textChanges.TrailingTriviaOption.Include,suffix:e.getNewLineOrDefaultFromHost(l,n.options)};g.replaceNodeWithNodes(t,r[0],c,u);var d=g.nodeHasTrailingComment(t,r[0],u);g.deleteNodes(t,r.slice(1),{trailingTriviaOption:e.textChanges.TrailingTriviaOption.Include},d);}}}},t.coalesceImports=o,t.coalesceExports=s,t.compareImportOrExportSpecifiers=u,t.compareModuleSpecifiers=_,t.importsAreSorted=function(t){return e.arrayIsSorted(t,f)},t.importSpecifiersAreSorted=function(t){return e.arrayIsSorted(t,u)},t.getImportDeclarationInsertionIndex=function(t,r){var n=e.binarySearch(t,r,e.identity,f);return n<0?~n:n},t.getImportSpecifierInsertionIndex=function(t,r){var n=e.binarySearch(t,r,e.identity,u);return n<0?~n:n},t.compareImportsOrRequireStatements=f;}(e.OrganizeImports||(e.OrganizeImports={}));}(t),function(e){!function(t){t.collectElements=function(t,r){var u=[];return function(t,r,i){for(var u=40,_=0,d=n$4(n$4([],t.statements,!0),[t.endOfFileToken],!1),p=d.length;_<p;){for(;_<p&&!e.isAnyImportSyntax(d[_]);)m(d[_]),_++;if(_===p)break;for(var f=_;_<p&&e.isAnyImportSyntax(d[_]);)o(d[_],t,r,i),_++;var g=_-1;g!==f&&i.push(s(e.findChildOfKind(d[f],100,t).getStart(t),d[g].getEnd(),"imports"));}function m(n){var _;if(0!==u){r.throwIfCancellationRequested(),(e.isDeclaration(n)||e.isVariableStatement(n)||e.isReturnStatement(n)||e.isCallOrNewExpression(n)||1===n.kind)&&o(n,t,r,i),e.isFunctionLike(n)&&e.isBinaryExpression(n.parent)&&e.isPropertyAccessExpression(n.parent.left)&&o(n.parent.left,t,r,i),(e.isBlock(n)||e.isModuleBlock(n))&&a(n.statements.end,t,r,i),(e.isClassLike(n)||e.isInterfaceDeclaration(n))&&a(n.members.end,t,r,i);var d=function(t,r){switch(t.kind){case 235:if(e.isFunctionLike(t.parent))return function(t,r,n){var i=function(t,r,n){if(e.isNodeArrayMultiLine(t.parameters,n)){var i=e.findChildOfKind(t,20,n);if(i)return i}return e.findChildOfKind(r,18,n)}(t,r,n),a=e.findChildOfKind(r,19,n);return i&&a&&c(i,a,t,n,214!==t.kind)}(t.parent,t,r);switch(t.parent.kind){case 240:case 243:case 244:case 242:case 239:case 241:case 248:case 292:return u(t.parent);case 252:var n=t.parent;if(n.tryBlock===t)return u(t.parent);if(n.finallyBlock===t){var i=e.findChildOfKind(n,96,r);if(i)return u(i)}default:return l(e.createTextSpanFromNode(t,r),"code")}case 262:return u(t.parent);case 257:case 226:case 258:case 260:case 263:case 182:case 201:return u(t);case 184:return u(t,!1,!e.isTupleTypeNode(t.parent),22);case 289:case 290:return (a=t.statements).length?l(e.createTextSpanFromRange(a),"code"):void 0;case 205:return o(t);case 204:return o(t,22);case 278:return function(t){var n=e.createTextSpanFromBounds(t.openingElement.getStart(r),t.closingElement.getEnd()),i=t.openingElement.tagName.getText(r);return l(n,"code",n,!1,"<"+i+">...</"+i+">")}(t);case 282:return function(t){var n=e.createTextSpanFromBounds(t.openingFragment.getStart(r),t.closingFragment.getEnd());return l(n,"code",n,!1,"<>...</>")}(t);case 279:case 280:return function(e){if(0!==e.properties.length)return s(e.getStart(r),e.getEnd(),"code")}(t.attributes);case 223:case 14:return function(e){if(14!==e.kind||0!==e.text.length)return s(e.getStart(r),e.getEnd(),"code")}(t);case 202:return u(t,!1,!e.isBindingElement(t.parent),22);case 214:return function(t){if(!(e.isBlock(t.body)||e.isParenthesizedExpression(t.body)||e.positionsAreOnSameLine(t.body.getFullStart(),t.body.getEnd(),r)))return l(e.createTextSpanFromBounds(t.body.getFullStart(),t.body.getEnd()),"code",e.createTextSpanFromNode(t))}(t);case 208:return function(t){if(t.arguments.length){var n=e.findChildOfKind(t,20,r),i=e.findChildOfKind(t,21,r);if(n&&i&&!e.positionsAreOnSameLine(n.pos,i.pos,r))return c(n,i,t,r,!1,!0)}}(t);case 212:return function(t){if(!e.positionsAreOnSameLine(t.getStart(),t.getEnd(),r))return l(e.createTextSpanFromBounds(t.getStart(),t.getEnd()),"code",e.createTextSpanFromNode(t))}(t)}var a;function o(t,r){return void 0===r&&(r=18),u(t,!1,!e.isArrayLiteralExpression(t.parent)&&!e.isCallExpression(t.parent),r)}function u(n,i,a,o,s){void 0===i&&(i=!1),void 0===a&&(a=!0),void 0===o&&(o=18),void 0===s&&(s=18===o?19:23);var l=e.findChildOfKind(t,o,r),u=e.findChildOfKind(t,s,r);return l&&u&&c(l,u,n,r,i,a)}}(n,t);d&&i.push(d),u--,e.isCallExpression(n)?(u++,m(n.expression),u--,n.arguments.forEach(m),null===(_=n.typeArguments)||void 0===_||_.forEach(m)):e.isIfStatement(n)&&n.elseStatement&&e.isIfStatement(n.elseStatement)?(m(n.expression),m(n.thenStatement),u++,m(n.elseStatement),u--):n.forEachChild(m),u++;}}}(t,r,u),function(t,r){for(var n=[],a=0,o=t.getLineStarts();a<o.length;a++){var s=o[a],c=t.getLineEndOfPosition(s),u=i(t.text.substring(s,c));if(u&&!e.isInComment(t,s))if(u[1]){var _=n.pop();_&&(_.textSpan.length=c-_.textSpan.start,_.hintSpan.length=c-_.textSpan.start,r.push(_));}else {var d=e.createTextSpanFromBounds(t.text.indexOf("//",s),c);n.push(l(d,"region",d,!1,u[2]||"#region"));}}}(t,u),u.sort((function(e,t){return e.textSpan.start-t.textSpan.start}))};var r=/^#(end)?region(?:\s+(.*))?(?:\r)?$/;function i(t){return t=e.trimStringStart(t),e.startsWith(t,"//")?(t=e.trimString(t.slice(2)),r.exec(t)):null}function a(t,r,n,a){var o=e.getLeadingCommentRanges(r.text,t);if(o){for(var c=-1,l=-1,u=0,_=r.getFullText(),d=0,p=o;d<p.length;d++){var f=p[d],g=f.kind,m=f.pos,y=f.end;switch(n.throwIfCancellationRequested(),g){case 2:if(i(_.slice(m,y))){v(),u=0;break}0===u&&(c=m),l=y,u++;break;case 3:v(),a.push(s(m,y,"comment")),u=0;break;default:e.Debug.assertNever(g);}}v();}function v(){u>1&&a.push(s(c,l,"comment"));}}function o(t,r,n,i){e.isJsxText(t)||a(t.pos,r,n,i);}function s(t,r,n){return l(e.createTextSpanFromBounds(t,r),n)}function c(t,r,n,i,a,o){return void 0===a&&(a=!1),void 0===o&&(o=!0),l(e.createTextSpanFromBounds(o?t.getFullStart():t.getStart(i),r.getEnd()),"code",e.createTextSpanFromNode(n,i),a)}function l(e,t,r,n,i){return void 0===r&&(r=e),void 0===n&&(n=!1),void 0===i&&(i="..."),{textSpan:e,kind:t,hintSpan:r,bannerText:i,autoCollapse:n}}}(e.OutliningElementsCollector||(e.OutliningElementsCollector={}));}(t),function(e){var t;function r(e,t){return {kind:e,isCaseSensitive:t}}function n(e,t){var r=t.get(e);return r||t.set(e,r=y(e)),r}function i(i,a,o){var s=function(e,t){for(var r=e.length-t.length,n=function(r){if(T(t,(function(t,n){return d(e.charCodeAt(n+r))===t})))return {value:r}},i=0;i<=r;i++){var a=n(i);if("object"==typeof a)return a.value}return -1}(i,a.textLowerCase);if(0===s)return r(a.text.length===i.length?t.exact:t.prefix,e.startsWith(i,a.text));if(a.isLowerCase){if(-1===s)return;for(var _=0,p=n(i,o);_<p.length;_++){var f=p[_];if(c(i,f,a.text,!0))return r(t.substring,c(i,f,a.text,!1))}if(a.text.length<i.length&&u(i.charCodeAt(s)))return r(t.substring,!1)}else {if(i.indexOf(a.text)>0)return r(t.substring,!0);if(a.characterSpans.length>0){var g=n(i,o),m=!!l(i,g,a,!1)||!l(i,g,a,!0)&&void 0;if(void 0!==m)return r(t.camelCase,m)}}}function a(e,t,r){if(T(t.totalTextChunk.text,(function(e){return 32!==e&&42!==e}))){var n=i(e,t.totalTextChunk,r);if(n)return n}for(var a,s=0,c=t.subWordTextChunks;s<c.length;s++)a=o(a,i(e,c[s],r));return a}function o(t,r){return e.min(t,r,s)}function s(t,r){return void 0===t?1:void 0===r?-1:e.compareValues(t.kind,r.kind)||e.compareBooleans(!t.isCaseSensitive,!r.isCaseSensitive)}function c(e,t,r,n,i){return void 0===i&&(i={start:0,length:r.length}),i.length<=t.length&&S(0,i.length,(function(a){return function(e,t,r){return r?d(e)===d(t):e===t}(r.charCodeAt(i.start+a),e.charCodeAt(t.start+a),n)}))}function l(t,r,n,i){for(var s=n.characterSpans,l=0,_=0;;){if(_===s.length)return !0;if(l===r.length)return !1;for(var d=r[l],p=!1;_<s.length;_++){var f=s[_];if(p&&(!u(n.text.charCodeAt(s[_-1].start))||!u(n.text.charCodeAt(s[_].start))))break;if(!c(t,d,n.text,i,f))break;p=!0,d=e.createTextSpan(d.start+f.length,d.length-f.length);}l++;}}function u(t){if(t>=65&&t<=90)return !0;if(t<127||!e.isUnicodeIdentifierStart(t,99))return !1;var r=String.fromCharCode(t);return r===r.toUpperCase()}function _(t){if(t>=97&&t<=122)return !0;if(t<127||!e.isUnicodeIdentifierStart(t,99))return !1;var r=String.fromCharCode(t);return r===r.toLowerCase()}function d(e){return e>=65&&e<=90?e-65+97:e<127?e:String.fromCharCode(e).toLowerCase().charCodeAt(0)}function p(e){return e>=48&&e<=57}function f(e){for(var t=[],r=0,n=0,i=0;i<e.length;i++)u(a=e.charCodeAt(i))||_(a)||p(a)||95===a||36===a?(0===n&&(r=i),n++):n>0&&(t.push(g(e.substr(r,n))),n=0);var a;return n>0&&t.push(g(e.substr(r,n))),t}function g(e){var t=e.toLowerCase();return {text:e,textLowerCase:t,isLowerCase:e===t,characterSpans:m(e)}}function m(e){return v(e,!1)}function y(e){return v(e,!0)}function v(t,r){for(var n=[],i=0,a=1;a<t.length;a++){var o=p(t.charCodeAt(a-1)),s=p(t.charCodeAt(a)),c=D(t,r,a),l=r&&x(t,a,i);(h(t.charCodeAt(a-1))||h(t.charCodeAt(a))||o!==s||c||l)&&(b(t,i,a)||n.push(e.createTextSpan(i,a-i)),i=a);}return b(t,i,t.length)||n.push(e.createTextSpan(i,t.length-i)),n}function h(e){switch(e){case 33:case 34:case 35:case 37:case 38:case 39:case 40:case 41:case 42:case 44:case 45:case 46:case 47:case 58:case 59:case 63:case 64:case 91:case 92:case 93:case 95:case 123:case 125:return !0}return !1}function b(e,t,r){return T(e,(function(e){return h(e)&&95!==e}),t,r)}function x(e,t,r){return t!==r&&t+1<e.length&&u(e.charCodeAt(t))&&_(e.charCodeAt(t+1))&&T(e,u,r,t)}function D(e,t,r){var n=u(e.charCodeAt(r-1));return u(e.charCodeAt(r))&&(!t||!n)}function S(e,t,r){for(var n=e;n<t;n++)if(!r(n))return !1;return !0}function T(e,t,r,n){return void 0===r&&(r=0),void 0===n&&(n=e.length),S(r,n,(function(r){return t(e.charCodeAt(r),r)}))}!function(e){e[e.exact=0]="exact",e[e.prefix=1]="prefix",e[e.substring=2]="substring",e[e.camelCase=3]="camelCase";}(t=e.PatternMatchKind||(e.PatternMatchKind={})),e.createPatternMatcher=function(t){var r=new e.Map,n=t.trim().split(".").map((function(e){return {totalTextChunk:g(t=e.trim()),subWordTextChunks:f(t)};var t;}));if(!n.some((function(e){return !e.subWordTextChunks.length})))return {getFullMatch:function(t,i){return function(t,r,n,i){var s;if(a(r,e.last(n),i)&&!(n.length-1>t.length)){for(var c=n.length-2,l=t.length-1;c>=0;c-=1,l-=1)s=o(s,a(t[l],n[c],i));return s}}(t,i,n,r)},getMatchForLastSegmentOfPattern:function(t){return a(t,e.last(n),r)},patternContainsDots:n.length>1}},e.breakIntoCharacterSpans=m,e.breakIntoWordSpans=y;}(t),function(e){e.preProcessFile=function(t,r,n){void 0===r&&(r=!0),void 0===n&&(n=!1);var i,a,o,s={languageVersion:1,pragmas:void 0,checkJsDirective:void 0,referencedFiles:[],typeReferenceDirectives:[],libReferenceDirectives:[],amdDependencies:[],hasNoDefaultLib:void 0,moduleName:void 0},c=[],l=0,u=!1;function _(){return a=o,18===(o=e.scanner.scan())?l++:19===o&&l--,o}function d(){var t=e.scanner.getTokenValue(),r=e.scanner.getTokenPos();return {fileName:t,pos:r,end:r+t.length}}function p(){c.push(d()),f();}function f(){0===l&&(u=!0);}function g(){var t=e.scanner.getToken();return 135===t&&(141===(t=_())&&10===(t=_())&&(i||(i=[]),i.push({ref:d(),depth:l})),!0)}function m(){if(24===a)return !1;var t=e.scanner.getToken();if(100===t){if(20===(t=_())){if(10===(t=_())||14===t)return p(),!0}else {if(10===t)return p(),!0;if(152===t&&e.scanner.lookAhead((function(){var t=e.scanner.scan();return 156!==t&&(41===t||18===t||79===t||e.isKeyword(t))}))&&(t=_()),79===t||e.isKeyword(t))if(156===(t=_())){if(10===(t=_()))return p(),!0}else if(63===t){if(v(!0))return !0}else {if(27!==t)return !0;t=_();}if(18===t){for(t=_();19!==t&&1!==t;)t=_();19===t&&156===(t=_())&&10===(t=_())&&p();}else 41===t&&127===(t=_())&&(79===(t=_())||e.isKeyword(t))&&156===(t=_())&&10===(t=_())&&p();}return !0}return !1}function y(){var t=e.scanner.getToken();if(93===t){if(f(),152===(t=_())&&e.scanner.lookAhead((function(){var t=e.scanner.scan();return 41===t||18===t}))&&(t=_()),18===t){for(t=_();19!==t&&1!==t;)t=_();19===t&&156===(t=_())&&10===(t=_())&&p();}else if(41===t)156===(t=_())&&10===(t=_())&&p();else if(100===t&&(152===(t=_())&&e.scanner.lookAhead((function(){var t=e.scanner.scan();return 79===t||e.isKeyword(t)}))&&(t=_()),(79===t||e.isKeyword(t))&&63===(t=_())&&v(!0)))return !0;return !0}return !1}function v(t,r){void 0===r&&(r=!1);var n=t?_():e.scanner.getToken();return 146===n&&(20===(n=_())&&(10===(n=_())||r&&14===n)&&p(),!0)}function h(){var t=e.scanner.getToken();if(79===t&&"define"===e.scanner.getTokenValue()){if(20!==(t=_()))return !0;if(10===(t=_())||14===t){if(27!==(t=_()))return !0;t=_();}if(22!==t)return !0;for(t=_();23!==t&&1!==t;)10!==t&&14!==t||p(),t=_();return !0}return !1}if(r&&function(){for(e.scanner.setText(t),_();1!==e.scanner.getToken();){if(15===e.scanner.getToken()){var r=[e.scanner.getToken()],i=e.scanner.scan();e:for(;e.length(r);){switch(i){case 1:break e;case 100:m();break;case 15:r.push(i);break;case 18:e.length(r)&&r.push(i);break;case 19:e.length(r)&&(15===e.lastOrUndefined(r)?17===e.scanner.reScanTemplateToken(!1)&&r.pop():r.pop());}i=e.scanner.scan();}_();}g()||m()||y()||n&&(v(!1,!0)||h())||_();}e.scanner.setText(void 0);}(),e.processCommentPragmas(s,t),e.processPragmasIntoFields(s,e.noop),u){if(i)for(var b=0,x=i;b<x.length;b++){var D=x[b];c.push(D.ref);}return {referencedFiles:s.referencedFiles,typeReferenceDirectives:s.typeReferenceDirectives,libReferenceDirectives:s.libReferenceDirectives,importedFiles:c,isLibFile:!!s.hasNoDefaultLib,ambientExternalModules:void 0}}var S=void 0;if(i)for(var T=0,C=i;T<C.length;T++)0===(D=C[T]).depth?(S||(S=[]),S.push(D.ref.fileName)):c.push(D.ref);return {referencedFiles:s.referencedFiles,typeReferenceDirectives:s.typeReferenceDirectives,libReferenceDirectives:s.libReferenceDirectives,importedFiles:c,isLibFile:!!s.hasNoDefaultLib,ambientExternalModules:S}};}(t),function(e){!function(t){function r(e,t,r,n,a,o){return {canRename:!0,fileToRename:void 0,kind:r,displayName:e,fullDisplayName:t,kindModifiers:n,triggerSpan:i(a,o)}}function n(t){return {canRename:!1,localizedErrorMessage:e.getLocaleSpecificMessage(t)}}function i(t,r){var n=t.getStart(r),i=t.getWidth(r);return e.isStringLiteralLike(t)&&(n+=1,i-=2),e.createTextSpan(n,i)}function a(t){switch(t.kind){case 79:case 80:case 10:case 14:case 108:return !0;case 8:return e.isLiteralNameOfPropertyDeclarationOrIndexAccess(t);default:return !1}}t.getRenameInfo=function(t,i,o,s){var c=e.getAdjustedRenameLocation(e.getTouchingPropertyName(i,o));if(a(c)){var l=function(t,i,a,o,s){var c=i.getSymbolAtLocation(t);if(c){var l=c.declarations;if(l&&0!==l.length){if(l.some((function(t){return function(t,r){var n=r.getSourceFile();return t.isSourceFileDefaultLibrary(n)&&e.fileExtensionIs(n.fileName,".d.ts")}(o,t)})))return n(e.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library);if(!(e.isIdentifier(t)&&88===t.originalKeywordKind&&c.parent&&1536&c.parent.flags)){if(e.isStringLiteralLike(t)&&e.tryGetImportFromModuleSpecifier(t))return s&&s.allowRenameOfImportPath?function(t,r,i){if(!e.isExternalModuleNameRelative(t.text))return n(e.Diagnostics.You_cannot_rename_a_module_via_a_global_import);var a=i.declarations&&e.find(i.declarations,e.isSourceFile);if(a){var o=e.endsWith(t.text,"/index")||e.endsWith(t.text,"/index.js")?void 0:e.tryRemoveSuffix(e.removeFileExtension(a.fileName),"/index"),s=void 0===o?a.fileName:o,c=void 0===o?"module":"directory",l=t.text.lastIndexOf("/")+1;return {canRename:!0,fileToRename:s,kind:c,displayName:s,fullDisplayName:s,kindModifiers:"",triggerSpan:e.createTextSpan(t.getStart(r)+1+l,t.text.length-l)}}}(t,a,c):void 0;var u=e.SymbolDisplay.getSymbolKind(i,c,t),_=e.isImportOrExportSpecifierName(t)||e.isStringOrNumericLiteralLike(t)&&162===t.parent.kind?e.stripQuotes(e.getTextOfIdentifierOrLiteral(t)):void 0;return r(_||i.symbolToString(c),_||i.getFullyQualifiedName(c),u,e.SymbolDisplay.getSymbolModifiers(i,c),t,a)}}}else if(e.isStringLiteralLike(t)){var d=e.getContextualTypeFromParentOrAncestorTypeNode(t,i);if(d&&(128&d.flags||1048576&d.flags&&e.every(d.types,(function(e){return !!(128&e.flags)}))))return r(t.text,t.text,"string","",t,a)}else if(e.isLabelName(t)){var p=e.getTextOfNode(t);return r(p,p,"label","",t,a)}}(c,t.getTypeChecker(),i,t,s);if(l)return l}return n(e.Diagnostics.You_cannot_rename_this_element)},t.nodeIsEligibleForRename=a;}(e.Rename||(e.Rename={}));}(t),function(e){!function(t){function r(t,r,n){return e.Debug.assert(n.pos<=r),r<n.end||n.getEnd()===r&&e.getTouchingPropertyName(t,r).pos<n.end}t.getSmartSelectionRange=function(t,n){var o,s,c,_={textSpan:e.createTextSpanFromBounds(n.getFullStart(),n.getEnd())},d=n;e:for(;;){var p=a(d);if(!p.length)break;for(var f=0;f<p.length;f++){var g=p[f-1],m=p[f],y=p[f+1];if(e.getTokenPosOfNode(m,n,!0)>t)break e;var v=e.singleOrUndefined(e.getTrailingCommentRanges(n.text,m.end));if(v&&2===v.kind&&S(v.pos,v.end),r(n,t,m)){if(e.isBlock(m)||e.isTemplateSpan(m)||e.isTemplateHead(m)||e.isTemplateTail(m)||g&&e.isTemplateHead(g)||e.isVariableDeclarationList(m)&&e.isVariableStatement(d)||e.isSyntaxList(m)&&e.isVariableDeclarationList(d)||e.isVariableDeclaration(m)&&e.isSyntaxList(d)&&1===p.length||e.isJSDocTypeExpression(m)||e.isJSDocSignature(m)||e.isJSDocTypeLiteral(m)){d=m;break}e.isTemplateSpan(d)&&y&&e.isTemplateMiddleOrTemplateTail(y)&&D(m.getFullStart()-"${".length,y.getStart()+"}".length);var h=e.isSyntaxList(m)&&(18===(c=(s=g)&&s.kind)||22===c||20===c||280===c)&&l(y)&&!e.positionsAreOnSameLine(g.getStart(),y.getStart(),n),b=h?g.getEnd():m.getStart(),x=h?y.getStart():u(n,m);e.hasJSDocNodes(m)&&(null===(o=m.jsDoc)||void 0===o?void 0:o.length)&&D(e.first(m.jsDoc).getStart(),x),D(b,x),(e.isStringLiteral(m)||e.isTemplateLiteral(m))&&D(b+1,x-1),d=m;break}if(f===p.length-1)break e}}return _;function D(r,n){if(r!==n){var a=e.createTextSpanFromBounds(r,n);(!_||!e.textSpansEqual(a,_.textSpan)&&e.textSpanIntersectsWithPosition(a,t))&&(_=i$1({textSpan:a},_&&{parent:_}));}}function S(e,t){D(e,t);for(var r=e;47===n.text.charCodeAt(r);)r++;D(r,t);}};var n=e.or(e.isImportDeclaration,e.isImportEqualsDeclaration);function a(t){if(e.isSourceFile(t))return o(t.getChildAt(0).getChildren(),n);if(e.isMappedTypeNode(t)){var r=t.getChildren(),i=r[0],a=r.slice(1),l=e.Debug.checkDefined(a.pop());e.Debug.assertEqual(i.kind,18),e.Debug.assertEqual(l.kind,19);var u=o(a,(function(e){return e===t.readonlyToken||145===e.kind||e===t.questionToken||57===e.kind}));return [i,c(s(o(u,(function(e){var t=e.kind;return 22===t||163===t||23===t})),(function(e){return 58===e.kind}))),l]}if(e.isPropertySignature(t))return s(a=o(t.getChildren(),(function(r){return r===t.name||e.contains(t.modifiers,r)})),(function(e){return 58===e.kind}));if(e.isParameter(t)){var _=o(t.getChildren(),(function(e){return e===t.dotDotDotToken||e===t.name}));return s(o(_,(function(e){return e===_[0]||e===t.questionToken})),(function(e){return 63===e.kind}))}return e.isBindingElement(t)?s(t.getChildren(),(function(e){return 63===e.kind})):t.getChildren()}function o(e,t){for(var r,n=[],i=0,a=e;i<a.length;i++){var o=a[i];t(o)?(r=r||[]).push(o):(r&&(n.push(c(r)),r=void 0),n.push(o));}return r&&n.push(c(r)),n}function s(t,r,n){if(void 0===n&&(n=!0),t.length<2)return t;var i=e.findIndex(t,r);if(-1===i)return t;var a=t.slice(0,i),o=t[i],s=e.last(t),l=n&&26===s.kind,u=t.slice(i+1,l?t.length-1:void 0),_=e.compact([a.length?c(a):void 0,o,u.length?c(u):void 0]);return l?_.concat(s):_}function c(t){return e.Debug.assertGreaterThanOrEqual(t.length,1),e.setTextRangePosEnd(e.parseNodeFactory.createSyntaxList(t),t[0].pos,e.last(t).end)}function l(e){var t=e&&e.kind;return 19===t||23===t||21===t||281===t}function u(e,t){switch(t.kind){case 340:case 338:case 347:case 345:case 342:return e.getLineEndOfPosition(t.getStart());default:return t.getEnd()}}}(e.SmartSelectionRange||(e.SmartSelectionRange={}));}(t),function(e){!function(t){var r,i;function a(t,r,n){for(var i=t.getFullStart(),a=t.parent;a;){var o=e.findPrecedingToken(i,r,a,!0);if(o)return e.rangeContainsRange(n,o);a=a.parent;}return e.Debug.fail("Could not find preceding token")}function o(t,r,n){var i=function(t,r){if(29===t.kind||20===t.kind)return {list:p(t.parent,t,r),argumentIndex:0};var n=e.findContainingList(t);return n&&{list:n,argumentIndex:u(n,t)}}(t,n);if(i){var a=i.list,o=i.argumentIndex,s=function(t,r){var n=t.getChildren(),i=e.countWhere(n,(function(e){return 27!==e.kind}));return !r&&n.length>0&&27===e.last(n).kind&&i++,i}(a,e.isInString(n,r,t));return 0!==o&&e.Debug.assertLessThan(o,s),{list:a,argumentIndex:o,argumentCount:s,argumentsSpan:function(t,r){var n=t.getFullStart(),i=e.skipTrivia(r.text,t.getEnd(),!1);return e.createTextSpan(n,i-n)}(a,n)}}}function s(t,r,n){var i=t.parent;if(e.isCallOrNewExpression(i)){var a=i,s=o(t,r,n);if(!s)return;var c=s.list,l=s.argumentIndex,u=s.argumentCount,d=s.argumentsSpan;return {isTypeParameterList:!!i.typeArguments&&i.typeArguments.pos===c.pos,invocation:{kind:0,node:a},argumentsSpan:d,argumentIndex:l,argumentCount:u}}if(e.isNoSubstitutionTemplateLiteral(t)&&e.isTaggedTemplateExpression(i))return e.isInsideTemplateLiteral(t,r,n)?_(i,0,n):void 0;if(e.isTemplateHead(t)&&210===i.parent.kind){var p=i,f=p.parent;return e.Debug.assert(223===p.kind),_(f,l=e.isInsideTemplateLiteral(t,r,n)?0:1,n)}if(e.isTemplateSpan(i)&&e.isTaggedTemplateExpression(i.parent.parent)){var g=i;if(f=i.parent.parent,e.isTemplateTail(t)&&!e.isInsideTemplateLiteral(t,r,n))return;return _(f,l=function(t,r,n,i){return e.Debug.assert(n>=r.getStart(),"Assumed 'position' could not occur before node."),e.isTemplateLiteralToken(r)?e.isInsideTemplateLiteral(r,n,i)?0:t+2:t+1}(g.parent.templateSpans.indexOf(g),t,r,n),n)}if(e.isJsxOpeningLikeElement(i)){var m=i.attributes.pos,y=e.skipTrivia(n.text,i.attributes.end,!1);return {isTypeParameterList:!1,invocation:{kind:0,node:i},argumentsSpan:e.createTextSpan(m,y-m),argumentIndex:0,argumentCount:1}}var v=e.getPossibleTypeArgumentsInfo(t,n);if(v){var h=v.called,b=v.nTypeArguments;return {isTypeParameterList:!0,invocation:a={kind:1,called:h},argumentsSpan:d=e.createTextSpanFromBounds(h.getStart(n),t.end),argumentIndex:b,argumentCount:b+1}}}function c(t){return e.isBinaryExpression(t.parent)?c(t.parent):t}function l(t){return e.isBinaryExpression(t.left)?l(t.left)+1:2}function u(e,t){for(var r=0,n=0,i=e.getChildren();n<i.length;n++){var a=i[n];if(a===t)break;27!==a.kind&&r++;}return r}function _(t,r,n){var i=e.isNoSubstitutionTemplateLiteral(t.template)?1:t.template.templateSpans.length+1;return 0!==r&&e.Debug.assertLessThan(r,i),{isTypeParameterList:!1,invocation:{kind:0,node:t},argumentsSpan:d(t,n),argumentIndex:r,argumentCount:i}}function d(t,r){var n=t.template,i=n.getStart(),a=n.getEnd();return 223===n.kind&&0===e.last(n.templateSpans).literal.getFullWidth()&&(a=e.skipTrivia(r.text,a,!1)),e.createTextSpan(i,a-i)}function p(t,r,n){var i=t.getChildren(n),a=i.indexOf(r);return e.Debug.assert(a>=0&&i.length>a+1),i[a+1]}function f(t){return 0===t.kind?e.getInvokedExpression(t.node):t.called}function g(e){return 0===e.kind?e.node:1===e.kind?e.called:e.node}!function(e){e[e.Call=0]="Call",e[e.TypeArgs=1]="TypeArgs",e[e.Contextual=2]="Contextual";}(r||(r={})),t.getSignatureHelpItems=function(t,r,n,i,u){var _=t.getTypeChecker(),d=e.findTokenOnLeftOfPosition(r,n);if(d){var p=!!i&&"characterTyped"===i.kind;if(!p||!e.isInString(r,n,d)&&!e.isInComment(r,n)){var m=!!i&&"invoked"===i.kind,h=function(t,r,n,i,a){for(var u=function(t){e.Debug.assert(e.rangeContainsRange(t.parent,t),"Not a subspan",(function(){return "Child: ".concat(e.Debug.formatSyntaxKind(t.kind),", parent: ").concat(e.Debug.formatSyntaxKind(t.parent.kind))}));var a=function(t,r,n,i){return function(t,r,n,i){var a=function(t,r,n,i){if(20===t.kind||27===t.kind){var a=t.parent;switch(a.kind){case 212:case 169:case 213:case 214:var s=o(t,n,r);if(!s)return;var u=s.argumentIndex,_=s.argumentCount,d=s.argumentsSpan,p=e.isMethodDeclaration(a)?i.getContextualTypeForObjectLiteralElement(a):i.getContextualType(a);return p&&{contextualType:p,argumentIndex:u,argumentCount:_,argumentsSpan:d};case 221:var f=c(a),g=i.getContextualType(f),m=20===t.kind?0:l(a)-1,y=l(f);return g&&{contextualType:g,argumentIndex:m,argumentCount:y,argumentsSpan:e.createTextSpanFromNode(a)};default:return}}}(t,n,r,i);if(a){var s=a.contextualType,u=a.argumentIndex,_=a.argumentCount,d=a.argumentsSpan,p=s.getNonNullableType(),f=p.symbol;if(void 0!==f){var g,m=e.lastOrUndefined(p.getCallSignatures());return void 0===m?void 0:{isTypeParameterList:!1,invocation:{kind:2,signature:m,node:t,symbol:(g=f,"__type"===g.name&&e.firstDefined(g.declarations,(function(t){return e.isFunctionTypeNode(t)?t.parent.symbol:void 0}))||g)},argumentsSpan:d,argumentIndex:u,argumentCount:_}}}}(t,r,n,i)||s(t,r,n)}(t,r,n,i);if(a)return {value:a}},_=t;!e.isSourceFile(_)&&(a||!e.isBlock(_));_=_.parent){var d=u(_);if("object"==typeof d)return d.value}}(d,n,r,_,m);if(h){u.throwIfCancellationRequested();var b=function(t,r,n,i,o){var s=t.invocation,c=t.argumentCount;switch(s.kind){case 0:if(o&&!function(t,r,n){if(!e.isCallOrNewExpression(r))return !1;var i=r.getChildren(n);switch(t.kind){case 20:return e.contains(i,t);case 27:var o=e.findContainingList(t);return !!o&&e.contains(i,o);case 29:return a(t,n,r.expression);default:return !1}}(i,s.node,n))return;var l=[],u=r.getResolvedSignatureForSignatureHelp(s.node,l,c);return 0===l.length?void 0:{kind:0,candidates:l,resolvedSignature:u};case 1:var _=s.called;if(o&&!a(i,n,e.isIdentifier(_)?_.parent:_))return;if(0!==(l=e.getPossibleGenericSignatures(_,c,r)).length)return {kind:0,candidates:l,resolvedSignature:e.first(l)};var d=r.getSymbolAtLocation(_);return d&&{kind:1,symbol:d};case 2:return {kind:0,candidates:[s.signature],resolvedSignature:s.signature};default:return e.Debug.assertNever(s)}}(h,_,r,d,p);return u.throwIfCancellationRequested(),b?_.runWithCancellationToken(u,(function(e){return 0===b.kind?y(b.candidates,b.resolvedSignature,h,r,e):function(e,t,r,n){var i=t.argumentCount,a=t.argumentsSpan,o=t.invocation,s=t.argumentIndex,c=n.getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(e);return c?{items:[v(e,c,n,g(o),r)],applicableSpan:a,selectedItemIndex:0,argumentIndex:s,argumentCount:i}:void 0}(b.symbol,h,r,e)})):e.isSourceFileJS(r)?function(t,r,n){if(2!==t.invocation.kind){var i=f(t.invocation),a=e.isPropertyAccessExpression(i)?i.name.text:void 0,o=r.getTypeChecker();return void 0===a?void 0:e.firstDefined(r.getSourceFiles(),(function(r){return e.firstDefined(r.getNamedDeclarations().get(a),(function(e){var i=e.symbol&&o.getTypeOfSymbolAtLocation(e.symbol,e),a=i&&i.getCallSignatures();if(a&&a.length)return o.runWithCancellationToken(n,(function(e){return y(a,a[0],t,r,e,!0)}))}))}))}}(h,t,u):void 0}}}},function(e){e[e.Candidate=0]="Candidate",e[e.Type=1]="Type";}(i||(i={})),t.getArgumentInfoForCompletions=function(e,t,r){var n=s(e,t,r);return !n||n.isTypeParameterList||0!==n.invocation.kind?void 0:{invocation:n.invocation.node,argumentCount:n.argumentCount,argumentIndex:n.argumentIndex}};var m=70246400;function y(t,r,i,a,o,s){var c,l=i.isTypeParameterList,u=i.argumentCount,_=i.argumentsSpan,d=i.invocation,p=i.argumentIndex,m=g(d),y=2===d.kind?d.symbol:o.getSymbolAtLocation(f(d))||s&&(null===(c=r.declaration)||void 0===c?void 0:c.symbol),v=y?e.symbolToDisplayParts(o,y,s?a:void 0,void 0):e.emptyArray,D=e.map(t,(function(t){return function(t,r,i,a,o,s){var c=(i?b:x)(t,a,o,s);return e.map(c,(function(i){var s=i.isVariadic,c=i.parameters,l=i.prefix,u=i.suffix,_=n$4(n$4([],r,!0),l,!0),d=n$4(n$4([],u,!0),function(t,r,n){return e.mapToDisplayParts((function(e){e.writePunctuation(":"),e.writeSpace(" ");var i=n.getTypePredicateOfSignature(t);i?n.writeTypePredicate(i,r,void 0,e):n.writeType(n.getReturnTypeOfSignature(t),r,void 0,e);}))}(t,o,a),!0),p=t.getDocumentationComment(a),f=t.getJsDocTags();return {isVariadic:s,prefixDisplayParts:_,suffixDisplayParts:d,separatorDisplayParts:h,parameters:c,documentation:p,tags:f}}))}(t,v,l,o,m,a)}));0!==p&&e.Debug.assertLessThan(p,u);for(var S=0,T=0,C=0;C<D.length;C++){var k=D[C];if(t[C]===r&&(S=T,k.length>1))for(var E=0,N=0,F=k;N<F.length;N++){var A=F[N];if(A.isVariadic||A.parameters.length>=u){S=T+E;break}E++;}T+=k.length;}e.Debug.assert(-1!==S);var P={items:e.flatMapToMutable(D,e.identity),applicableSpan:_,selectedItemIndex:S,argumentIndex:p,argumentCount:u},w=P.items[S];if(w.isVariadic){var I=e.findIndex(w.parameters,(function(e){return !!e.isRest}));-1<I&&I<w.parameters.length-1?P.argumentIndex=w.parameters.length:P.argumentIndex=Math.min(P.argumentIndex,w.parameters.length-1);}return P}function v(t,r,i,a,o){var s=e.symbolToDisplayParts(i,t),c=e.createPrinter({removeComments:!0}),l=r.map((function(e){return D(e,i,a,o,c)})),u=t.getDocumentationComment(i),_=t.getJsDocTags(i);return {isVariadic:!1,prefixDisplayParts:n$4(n$4([],s,!0),[e.punctuationPart(29)],!1),suffixDisplayParts:[e.punctuationPart(31)],separatorDisplayParts:h,parameters:l,documentation:u,tags:_}}var h=[e.punctuationPart(27),e.spacePart()];function b(t,r,i,a){var o=(t.target||t).typeParameters,s=e.createPrinter({removeComments:!0}),c=(o||e.emptyArray).map((function(e){return D(e,r,i,a,s)})),l=t.thisParameter?[r.symbolToParameterDeclaration(t.thisParameter,i,m)]:[];return r.getExpandedParameters(t).map((function(t){var o=e.factory.createNodeArray(n$4(n$4([],l,!0),e.map(t,(function(e){return r.symbolToParameterDeclaration(e,i,m)})),!0)),u=e.mapToDisplayParts((function(e){s.writeList(2576,o,a,e);}));return {isVariadic:!1,parameters:c,prefix:[e.punctuationPart(29)],suffix:n$4([e.punctuationPart(31)],u,!0)}}))}function x(t,r,i,a){var o=e.createPrinter({removeComments:!0}),s=e.mapToDisplayParts((function(n){if(t.typeParameters&&t.typeParameters.length){var s=e.factory.createNodeArray(t.typeParameters.map((function(e){return r.typeParameterToDeclaration(e,i,m)})));o.writeList(53776,s,a,n);}})),c=r.getExpandedParameters(t),l=r.hasEffectiveRestParameter(t)?1===c.length?function(e){return !0}:function(e){return !!(e.length&&32768&e[e.length-1].checkFlags)}:function(e){return !1};return c.map((function(t){return {isVariadic:l(t),parameters:t.map((function(t){return function(t,r,n,i,a){var o=e.mapToDisplayParts((function(e){var o=r.symbolToParameterDeclaration(t,n,m);a.writeNode(4,o,i,e);})),s=r.isOptionalParameter(t.valueDeclaration),c=!!(32768&t.checkFlags);return {name:t.name,documentation:t.getDocumentationComment(r),displayParts:o,isOptional:s,isRest:c}}(t,r,i,a,o)})),prefix:n$4(n$4([],s,!0),[e.punctuationPart(20)],!1),suffix:[e.punctuationPart(21)]}}))}function D(t,r,n,i,a){var o=e.mapToDisplayParts((function(e){var o=r.typeParameterToDeclaration(t,n,m);a.writeNode(4,o,i,e);}));return {name:t.symbol.name,documentation:t.symbol.getDocumentationComment(r),displayParts:o,isOptional:!1,isRest:!1}}}(e.SignatureHelp||(e.SignatureHelp={}));}(t),function(e){!function(t){function r(e){return "literals"===e.includeInlayParameterNameHints}t.provideInlayHints=function(t){var n=t.file,i=t.program,a=t.span,o=t.cancellationToken,s=t.preferences,c=n.text,l=i.getCompilerOptions(),u=i.getTypeChecker(),_=[];return function t(i){if(i&&0!==i.getFullWidth()){switch(i.kind){case 261:case 257:case 258:case 256:case 226:case 213:case 169:case 214:o.throwIfCancellationRequested();}if(e.textSpanIntersectsWith(a,i.pos,i.getFullWidth())&&!e.isTypeNode(i))return s.includeInlayVariableTypeHints&&e.isVariableDeclaration(i)||s.includeInlayPropertyDeclarationTypeHints&&e.isPropertyDeclaration(i)?function(t){if(t.initializer&&!e.isBindingPattern(t.name)&&!e.getEffectiveTypeAnnotationNode(t)){var r=u.getTypeAtLocation(t);if(!f(r)){var n=b(r);n&&p(n,t.name.end);}}}(i):s.includeInlayEnumMemberValueHints&&e.isEnumMember(i)?function(e){if(!e.initializer){var t,r,n=u.getConstantValue(e);void 0!==n&&(t=n.toString(),r=e.end,_.push({text:"= ".concat(h(t,30)),position:r,kind:"Enum",whitespaceBefore:!0}));}}(i):function(e){return "literals"===e.includeInlayParameterNameHints||"all"===e.includeInlayParameterNameHints}(s)&&(e.isCallExpression(i)||e.isNewExpression(i))?function(t){var n=t.arguments;if(n&&n.length){var i=[],a=u.getResolvedSignatureForSignatureHelp(t,i);if(a&&i.length)for(var o=0;o<n.length;++o){var c=n[o],l=e.skipParentheses(c);if(!r(s)||y(l)){var _=u.getParameterIdentifierNameAtPosition(a,o);if(_){var p=_[0],f=_[1];if(!s.includeInlayParameterNameHintsWhenArgumentMatchesName&&g(l,p)&&!f)continue;var v=e.unescapeLeadingUnderscores(p);if(m(l,v))continue;d(v,c.getStart(),f);}}}}}(i):(s.includeInlayFunctionParameterTypeHints&&e.isFunctionLikeDeclaration(i)&&e.hasContextSensitiveParameters(i)&&function(t){var r=u.getSignatureFromDeclaration(t);if(r)for(var n=0;n<t.parameters.length&&n<r.parameters.length;++n){var i=t.parameters[n];if(!e.getEffectiveTypeAnnotationNode(i)){var a=v(r.parameters[n]);a&&p(a,i.questionToken?i.questionToken.end:i.name.end);}}}(i),s.includeInlayFunctionLikeReturnTypeHints&&function(t){return e.isArrowFunction(t)||e.isFunctionExpression(t)||e.isFunctionDeclaration(t)||e.isMethodDeclaration(t)||e.isGetAccessorDeclaration(t)}(i)&&function(t){if((!e.isArrowFunction(t)||e.findChildOfKind(t,20,n))&&!e.getEffectiveReturnTypeNode(t)&&t.body){var r=u.getSignatureFromDeclaration(t);if(r){var i=u.getReturnTypeOfSignature(r);if(!f(i)){var a=b(i);a&&p(a,function(t){var r=e.findChildOfKind(t,21,n);return r?r.end:t.parameters.end}(t));}}}}(i)),e.forEachChild(i,t)}}(n),_;function d(e,t,r){_.push({text:"".concat(r?"...":"").concat(h(e,30),":"),position:t,kind:"Parameter",whitespaceAfter:!0});}function p(e,t){_.push({text:": ".concat(h(e,30)),position:t,kind:"Type",whitespaceBefore:!0});}function f(e){return e.symbol&&1536&e.symbol.flags}function g(t,r){return e.isIdentifier(t)?t.text===r:!!e.isPropertyAccessExpression(t)&&t.name.text===r}function m(t,r){if(!e.isIdentifierText(r,l.target,e.getLanguageVariant(n.scriptKind)))return !1;var i=e.getLeadingCommentRanges(c,t.pos);if(!(null==i?void 0:i.length))return !1;var a=function(e){return new RegExp("^\\s?/\\*\\*?\\s?".concat(e,"\\s?\\*\\/\\s?$"))}(r);return e.some(i,(function(e){return a.test(c.substring(e.pos,e.end))}))}function y(t){switch(t.kind){case 219:var r=t.operand;return e.isLiteralExpression(r)||e.isIdentifier(r)&&e.isInfinityOrNaNString(r.escapedText);case 110:case 95:case 104:case 14:case 223:return !0;case 79:var n=t.escapedText;return function(e){return "undefined"===e}(n)||e.isInfinityOrNaNString(n)}return e.isLiteralExpression(t)}function v(t){var r=t.valueDeclaration;if(r&&e.isParameter(r)){var n=u.getTypeOfSymbolAtLocation(t,r);if(!f(n))return b(n)}}function h(e,t){return e.length>t?e.substr(0,t-"...".length)+"...":e}function b(t){var r=e.createPrinter({removeComments:!0});return e.usingSingleLineStringWriter((function(i){var a=u.typeToTypeNode(t,void 0,71286784,i);e.Debug.assertIsDefined(a,"should always get typenode"),r.writeNode(4,a,n,i);}))}};}(e.InlayHints||(e.InlayHints={}));}(t),function(e){var t=/^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/;function r(t,r,n){var i=e.tryParseRawSourceMap(r);if(i&&i.sources&&i.file&&i.mappings&&(!i.sourcesContent||!i.sourcesContent.some(e.isString)))return e.createDocumentPositionMapper(t,i,n)}e.getSourceMapper=function(t){var r=e.createGetCanonicalFileName(t.useCaseSensitiveFileNames()),n=t.getCurrentDirectory(),i=new e.Map,a=new e.Map;return {tryGetSourcePosition:function t(r){if(e.isDeclarationFileName(r.fileName)&&c(r.fileName)){var n=s(r.fileName).getSourcePosition(r);return n&&n!==r?t(n)||n:void 0}},tryGetGeneratedPosition:function(i){if(!e.isDeclarationFileName(i.fileName)){var a=c(i.fileName);if(a){var o=t.getProgram();if(!o.isSourceOfProjectReferenceRedirect(a.fileName)){var l=o.getCompilerOptions(),u=e.outFile(l),_=u?e.removeFileExtension(u)+".d.ts":e.getDeclarationEmitOutputFilePathWorker(i.fileName,o.getCompilerOptions(),n,o.getCommonSourceDirectory(),r);if(void 0!==_){var d=s(_,i.fileName).getGeneratedPosition(i);return d===i?void 0:d}}}}},toLineColumnOffset:function(e,t){return l(e).getLineAndCharacterOfPosition(t)},clearCache:function(){i.clear(),a.clear();}};function o(t){return e.toPath(t,n,r)}function s(n,i){var s,c=o(n),u=a.get(c);if(u)return u;if(t.getDocumentPositionMapper)s=t.getDocumentPositionMapper(n,i);else if(t.readFile){var _=l(n);s=_&&e.getDocumentPositionMapper({getSourceFileLike:l,getCanonicalFileName:r,log:function(e){return t.log(e)}},n,e.getLineInfo(_.text,e.getLineStarts(_)),(function(e){return !t.fileExists||t.fileExists(e)?t.readFile(e):void 0}));}return a.set(c,s||e.identitySourceMapConsumer),s||e.identitySourceMapConsumer}function c(e){var r=t.getProgram();if(r){var n=o(e),i=r.getSourceFileByPath(n);return i&&i.resolvedPath===n?i:void 0}}function l(r){return t.getSourceFileLike?t.getSourceFileLike(r):c(r)||function(r){var n=o(r),a=i.get(n);if(void 0!==a)return a||void 0;if(t.readFile&&(!t.fileExists||t.fileExists(n))){var s=t.readFile(n),c=!!s&&function(t,r){return {text:t,lineMap:void 0,getLineAndCharacterOfPosition:function(t){return e.computeLineAndCharacterOfPosition(e.getLineStarts(this),t)}}}(s);return i.set(n,c),c||void 0}i.set(n,!1);}(r)}},e.getDocumentPositionMapper=function(n,i,a,o){var s=e.tryGetSourceMappingURL(a);if(s){var c=t.exec(s);if(c){if(c[1]){var l=c[1];return r(n,e.base64decode(e.sys,l),i)}s=void 0;}}var u=[];s&&u.push(s),u.push(i+".map");for(var _=s&&e.getNormalizedAbsolutePath(s,e.getDirectoryPath(i)),d=0,p=u;d<p.length;d++){var f=p[d],g=e.getNormalizedAbsolutePath(f,e.getDirectoryPath(i)),m=o(g,_);if(e.isString(m))return r(n,m,g);if(void 0!==m)return m||void 0}};}(t),function(e){var t=new e.Map;function r(t){return e.isPropertyAccessExpression(t)?r(t.expression):t}function n(t){switch(t.kind){case 266:var r=t.importClause,n=t.moduleSpecifier;return r&&!r.name&&r.namedBindings&&268===r.namedBindings.kind&&e.isStringLiteral(n)?r.namedBindings.name:void 0;case 265:return t.name;default:return}}function i(e,t){var r=t.getSignatureFromDeclaration(e),n=r?t.getReturnTypeOfSignature(r):void 0;return !!n&&!!t.getPromisedTypeOfPromise(n)}function a(t,r){return e.isReturnStatement(t)&&!!t.expression&&o(t.expression,r)}function o(t,r){if(!s(t)||!c(t)||!t.arguments.every((function(e){return l(e,r)})))return !1;for(var n=t.expression.expression;s(n)||e.isPropertyAccessExpression(n);)if(e.isCallExpression(n)){if(!c(n)||!n.arguments.every((function(e){return l(e,r)})))return !1;n=n.expression.expression;}else n=n.expression;return !0}function s(t){return e.isCallExpression(t)&&(e.hasPropertyAccessExpressionWithName(t,"then")||e.hasPropertyAccessExpressionWithName(t,"catch")||e.hasPropertyAccessExpressionWithName(t,"finally"))}function c(t){var r=t.expression.name.text,n="then"===r?2:"catch"===r||"finally"===r?1:0;return !(t.arguments.length>n)&&(t.arguments.length<n||1===n||e.some(t.arguments,(function(t){return 104===t.kind||e.isIdentifier(t)&&"undefined"===t.text})))}function l(r,n){switch(r.kind){case 256:case 213:if(1&e.getFunctionFlags(r))return !1;case 214:t.set(u(r),!0);case 104:return !0;case 79:case 206:var i=n.getSymbolAtLocation(r);return !!i&&(n.isUndefinedSymbol(i)||e.some(e.skipAlias(i,n).declarations,(function(t){return e.isFunctionLike(t)||e.hasInitializer(t)&&!!t.initializer&&e.isFunctionLike(t.initializer)})));default:return !1}}function u(e){return "".concat(e.pos.toString(),":").concat(e.end.toString())}function _(e){switch(e.kind){case 256:case 169:case 213:case 214:return !0;default:return !1}}e.computeSuggestionDiagnostics=function(o,s,c){s.getSemanticDiagnostics(o,c);var l,d=[],p=s.getTypeChecker();o.impliedNodeFormat!==e.ModuleKind.CommonJS&&!e.fileExtensionIsOneOf(o.fileName,[".cts",".cjs"])&&o.commonJsModuleIndicator&&(e.programContainsEsModules(s)||e.compilerOptionsIndicateEsModules(s.getCompilerOptions()))&&function(t){return t.statements.some((function(t){switch(t.kind){case 237:return t.declarationList.declarations.some((function(t){return !!t.initializer&&e.isRequireCall(r(t.initializer),!0)}));case 238:var n=t.expression;if(!e.isBinaryExpression(n))return e.isRequireCall(n,!0);var i=e.getAssignmentDeclarationKind(n);return 1===i||2===i;default:return !1}}))}(o)&&d.push(e.createDiagnosticForNode((l=o.commonJsModuleIndicator,e.isBinaryExpression(l)?l.left:l),e.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));var f=e.isSourceFileJS(o);if(t.clear(),function r(n){if(f)(function(t,r){var n,i,a,o;if(213===t.kind){if(e.isVariableDeclaration(t.parent)&&(null===(n=t.symbol.members)||void 0===n?void 0:n.size))return !0;var s=r.getSymbolOfExpando(t,!1);return !(!s||!(null===(i=s.exports)||void 0===i?void 0:i.size)&&!(null===(a=s.members)||void 0===a?void 0:a.size))}return 256===t.kind&&!!(null===(o=t.symbol.members)||void 0===o?void 0:o.size)})(n,p)&&d.push(e.createDiagnosticForNode(e.isVariableDeclaration(n.parent)?n.parent.name:n,e.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));else {if(e.isVariableStatement(n)&&n.parent===o&&2&n.declarationList.flags&&1===n.declarationList.declarations.length){var s=n.declarationList.declarations[0].initializer;s&&e.isRequireCall(s,!0)&&d.push(e.createDiagnosticForNode(s,e.Diagnostics.require_call_may_be_converted_to_an_import));}e.codefix.parameterShouldGetTypeFromJSDoc(n)&&d.push(e.createDiagnosticForNode(n.name||n,e.Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types));}_(n)&&function(r,n,o){(function(t,r){return !e.isAsyncFunction(t)&&t.body&&e.isBlock(t.body)&&function(t,r){return !!e.forEachReturnStatement(t,(function(e){return a(e,r)}))}(t.body,r)&&i(t,r)})(r,n)&&!t.has(u(r))&&o.push(e.createDiagnosticForNode(!r.name&&e.isVariableDeclaration(r.parent)&&e.isIdentifier(r.parent.name)?r.parent.name:r,e.Diagnostics.This_may_be_converted_to_an_async_function));}(n,p,d),n.forEachChild(r);}(o),e.getAllowSyntheticDefaultImports(s.getCompilerOptions()))for(var g=0,m=o.imports;g<m.length;g++){var y=m[g],v=n(e.importFromModuleSpecifier(y));if(v){var h=e.getResolvedModule(o,y.text,e.getModeForUsageLocation(o,y)),b=h&&s.getSourceFile(h.resolvedFileName);b&&b.externalModuleIndicator&&!0!==b.externalModuleIndicator&&e.isExportAssignment(b.externalModuleIndicator)&&b.externalModuleIndicator.isExportEquals&&d.push(e.createDiagnosticForNode(v,e.Diagnostics.Import_may_be_converted_to_a_default_import));}}return e.addRange(d,o.bindSuggestionDiagnostics),e.addRange(d,s.getSuggestionDiagnostics(o,c)),d.sort((function(e,t){return e.start-t.start}))},e.returnsPromise=i,e.isReturnStatementWithFixablePromiseHandler=a,e.isFixablePromiseHandler=o,e.canBeConvertedToAsync=_;}(t),function(e){!function(t){var r=70246400;function n(t,r,n){var a=i(t,r,n);if(""!==a)return a;var o=e.getCombinedLocalAndExportSymbolFlags(r);return 32&o?e.getDeclarationOfKind(r,226)?"local class":"class":384&o?"enum":524288&o?"type":64&o?"interface":262144&o?"type parameter":8&o?"enum member":2097152&o?"alias":1536&o?"module":a}function i(t,r,n){var i=t.getRootSymbols(r);if(1===i.length&&8192&e.first(i).flags&&0!==t.getTypeOfSymbolAtLocation(r,n).getNonNullableType().getCallSignatures().length)return "method";if(t.isUndefinedSymbol(r))return "var";if(t.isArgumentsSymbol(r))return "local var";if(108===n.kind&&e.isExpression(n)||e.isThisInTypeQuery(n))return "parameter";var a=e.getCombinedLocalAndExportSymbolFlags(r);return 3&a?e.isFirstDeclarationOfSymbolParameter(r)?"parameter":r.valueDeclaration&&e.isVarConst(r.valueDeclaration)?"const":e.forEach(r.declarations,e.isLet)?"let":o(r)?"local var":"var":16&a?o(r)?"local function":"function":32768&a?"getter":65536&a?"setter":8192&a?"method":16384&a?"constructor":4&a?33554432&a&&6&r.checkFlags?e.forEach(t.getRootSymbols(r),(function(e){if(98311&e.getFlags())return "property"}))||(t.getTypeOfSymbolAtLocation(r,n).getCallSignatures().length?"method":"property"):"property":""}function a(t){if(t.declarations&&t.declarations.length){var r=t.declarations,n=r[0],i=r.slice(1),a=e.length(i)&&e.isDeprecatedDeclaration(n)&&e.some(i,(function(t){return !e.isDeprecatedDeclaration(t)}))?8192:0,o=e.getNodeModifiers(n,a);if(o)return o.split(",")}return []}function o(t){return !t.parent&&e.forEach(t.declarations,(function(t){if(213===t.kind)return !0;if(254!==t.kind&&256!==t.kind)return !1;for(var r=t.parent;!e.isFunctionBlock(r);r=r.parent)if(305===r.kind||262===r.kind)return !1;return !0}))}t.getSymbolKind=n,t.getSymbolModifiers=function(t,r){if(!r)return "";var n=new e.Set(a(r));if(2097152&r.flags){var i=t.getAliasedSymbol(r);i!==r&&e.forEach(a(i),(function(e){n.add(e);}));}return 16777216&r.flags&&n.add("optional"),n.size>0?e.arrayFrom(n.values()).join(","):""},t.getSymbolDisplayPartsDocumentationAndSymbolKind=function t(a,o,s,c,l,u,_){var d;void 0===u&&(u=e.getMeaningFromLocation(l));var p,f,g,m,y=[],v=[],h=[],b=e.getCombinedLocalAndExportSymbolFlags(o),x=1&u?i(a,o,l):"",D=!1,S=108===l.kind&&e.isInExpressionContext(l)||e.isThisInTypeQuery(l),T=!1;if(108===l.kind&&!S)return {displayParts:[e.keywordPart(108)],documentation:[],symbolKind:"primitive type",tags:void 0};if(""!==x||32&b||2097152&b){if("getter"===x||"setter"===x)if(q=e.find(o.declarations,(function(e){return e.name===l})))switch(q.kind){case 172:x="getter";break;case 173:x="setter";break;default:e.Debug.assertNever(q);}else x="property";var C=void 0;if(p=S?a.getTypeAtLocation(l):a.getTypeOfSymbolAtLocation(o,l),l.parent&&206===l.parent.kind){var k=l.parent.name;(k===l||k&&0===k.getFullWidth())&&(l=l.parent);}var E=void 0;if(e.isCallOrNewExpression(l)?E=l:(e.isCallExpressionTarget(l)||e.isNewExpressionTarget(l)||l.parent&&(e.isJsxOpeningLikeElement(l.parent)||e.isTaggedTemplateExpression(l.parent))&&e.isFunctionLike(o.valueDeclaration))&&(E=l.parent),E){C=a.getResolvedSignature(E);var N=209===E.kind||e.isCallExpression(E)&&106===E.expression.kind,F=N?p.getConstructSignatures():p.getCallSignatures();if(!C||e.contains(F,C.target)||e.contains(F,C)||(C=F.length?F[0]:void 0),C){switch(N&&32&b?(x="constructor",ee(p.symbol,x)):2097152&b?(te(x="alias"),y.push(e.spacePart()),N&&(4&C.flags&&(y.push(e.keywordPart(126)),y.push(e.spacePart())),y.push(e.keywordPart(103)),y.push(e.spacePart())),$(o)):ee(o,x),x){case"JSX attribute":case"property":case"var":case"const":case"let":case"parameter":case"local var":y.push(e.punctuationPart(58)),y.push(e.spacePart()),16&e.getObjectFlags(p)||!p.symbol||(e.addRange(y,e.symbolToDisplayParts(a,p.symbol,c,void 0,5)),y.push(e.lineBreakPart())),N&&(4&C.flags&&(y.push(e.keywordPart(126)),y.push(e.spacePart())),y.push(e.keywordPart(103)),y.push(e.spacePart())),re(C,F,262144);break;default:re(C,F);}D=!0,T=F.length>1;}}else if(e.isNameOfFunctionDeclaration(l)&&!(98304&b)||134===l.kind&&171===l.parent.kind){var A=l.parent;o.declarations&&e.find(o.declarations,(function(e){return e===(134===l.kind?A.parent:A)}))&&(F=171===A.kind?p.getNonNullableType().getConstructSignatures():p.getNonNullableType().getCallSignatures(),C=a.isImplementationOfOverload(A)?F[0]:a.getSignatureFromDeclaration(A),171===A.kind?(x="constructor",ee(p.symbol,x)):ee(174!==A.kind||2048&p.symbol.flags||4096&p.symbol.flags?o:p.symbol,x),C&&re(C,F),D=!0,T=F.length>1);}}if(32&b&&!D&&!S&&(Y(),e.getDeclarationOfKind(o,226)?te("local class"):y.push(e.keywordPart(84)),y.push(e.spacePart()),$(o),ne(o,s)),64&b&&2&u&&(X(),y.push(e.keywordPart(118)),y.push(e.spacePart()),$(o),ne(o,s)),524288&b&&2&u&&(X(),y.push(e.keywordPart(152)),y.push(e.spacePart()),$(o),ne(o,s),y.push(e.spacePart()),y.push(e.operatorPart(63)),y.push(e.spacePart()),e.addRange(y,e.typeToDisplayParts(a,e.isConstTypeReference(l.parent)?a.getTypeAtLocation(l.parent):a.getDeclaredTypeOfSymbol(o),c,8388608))),384&b&&(X(),e.some(o.declarations,(function(t){return e.isEnumDeclaration(t)&&e.isEnumConst(t)}))&&(y.push(e.keywordPart(85)),y.push(e.spacePart())),y.push(e.keywordPart(92)),y.push(e.spacePart()),$(o)),1536&b&&!S){X();var P=(q=e.getDeclarationOfKind(o,261))&&q.name&&79===q.name.kind;y.push(e.keywordPart(P?142:141)),y.push(e.spacePart()),$(o);}if(262144&b&&2&u)if(X(),y.push(e.punctuationPart(20)),y.push(e.textPart("type parameter")),y.push(e.punctuationPart(21)),y.push(e.spacePart()),$(o),o.parent)Z(),$(o.parent,c),ne(o.parent,c);else {var w=e.getDeclarationOfKind(o,163);if(void 0===w)return e.Debug.fail();(q=w.parent)&&(e.isFunctionLikeKind(q.kind)?(Z(),C=a.getSignatureFromDeclaration(q),175===q.kind?(y.push(e.keywordPart(103)),y.push(e.spacePart())):174!==q.kind&&q.name&&$(q.symbol),e.addRange(y,e.signatureToDisplayParts(a,C,s,32))):259===q.kind&&(Z(),y.push(e.keywordPart(152)),y.push(e.spacePart()),$(q.symbol),ne(q.symbol,s)));}if(8&b&&(x="enum member",ee(o,"enum member"),299===(null==(q=null===(d=o.declarations)||void 0===d?void 0:d[0])?void 0:q.kind))){var I=a.getConstantValue(q);void 0!==I&&(y.push(e.spacePart()),y.push(e.operatorPart(63)),y.push(e.spacePart()),y.push(e.displayPart(e.getTextOfConstantValue(I),"number"==typeof I?e.SymbolDisplayPartKind.numericLiteral:e.SymbolDisplayPartKind.stringLiteral)));}if(2097152&o.flags){if(X(),!D){var O=a.getAliasedSymbol(o);if(O!==o&&O.declarations&&O.declarations.length>0){var M=O.declarations[0],L=e.getNameOfDeclaration(M);if(L){var R=e.isModuleWithStringLiteralName(M)&&e.hasSyntacticModifier(M,2),B="default"!==o.name&&!R,j=t(a,O,e.getSourceFileOfNode(M),M,L,u,B?o:O);y.push.apply(y,j.displayParts),y.push(e.lineBreakPart()),g=j.documentation,m=j.tags;}else g=O.getContextualDocumentationComment(M,a),m=O.getJsDocTags(a);}}if(o.declarations)switch(o.declarations[0].kind){case 264:y.push(e.keywordPart(93)),y.push(e.spacePart()),y.push(e.keywordPart(142));break;case 271:y.push(e.keywordPart(93)),y.push(e.spacePart()),y.push(e.keywordPart(o.declarations[0].isExportEquals?63:88));break;case 275:y.push(e.keywordPart(93));break;default:y.push(e.keywordPart(100));}y.push(e.spacePart()),$(o),e.forEach(o.declarations,(function(t){if(265===t.kind){var r=t;if(e.isExternalModuleImportEqualsDeclaration(r))y.push(e.spacePart()),y.push(e.operatorPart(63)),y.push(e.spacePart()),y.push(e.keywordPart(146)),y.push(e.punctuationPart(20)),y.push(e.displayPart(e.getTextOfNode(e.getExternalModuleImportEqualsDeclarationExpression(r)),e.SymbolDisplayPartKind.stringLiteral)),y.push(e.punctuationPart(21));else {var n=a.getSymbolAtLocation(r.moduleReference);n&&(y.push(e.spacePart()),y.push(e.operatorPart(63)),y.push(e.spacePart()),$(n,c));}return !0}}));}if(!D)if(""!==x){if(p)if(S?(X(),y.push(e.keywordPart(108))):ee(o,x),"property"===x||"getter"===x||"setter"===x||"JSX attribute"===x||3&b||"local var"===x||S){if(y.push(e.punctuationPart(58)),y.push(e.spacePart()),p.symbol&&262144&p.symbol.flags){var J=e.mapToDisplayParts((function(t){var n=a.typeParameterToDeclaration(p,c,r);Q().writeNode(4,n,e.getSourceFileOfNode(e.getParseTreeNode(c)),t);}));e.addRange(y,J);}else e.addRange(y,e.typeToDisplayParts(a,p,c));if(o.target&&o.target.tupleLabelDeclaration){var z=o.target.tupleLabelDeclaration;e.Debug.assertNode(z.name,e.isIdentifier),y.push(e.spacePart()),y.push(e.punctuationPart(20)),y.push(e.textPart(e.idText(z.name))),y.push(e.punctuationPart(21));}}else (16&b||8192&b||16384&b||131072&b||98304&b||"method"===x)&&(F=p.getNonNullableType().getCallSignatures()).length&&(re(F[0],F),T=F.length>1);}else x=n(a,o,l);if(0!==v.length||T||(v=o.getContextualDocumentationComment(c,a)),0===v.length&&4&b&&o.parent&&o.declarations&&e.forEach(o.parent.declarations,(function(e){return 305===e.kind})))for(var K=0,U=o.declarations;K<U.length;K++)if((q=U[K]).parent&&221===q.parent.kind){var V=a.getSymbolAtLocation(q.parent.right);if(V&&(v=V.getDocumentationComment(a),h=V.getJsDocTags(a),v.length>0))break}if(0===v.length&&e.isIdentifier(l)&&o.valueDeclaration&&e.isBindingElement(o.valueDeclaration)){var q,W=(q=o.valueDeclaration).parent;if(e.isIdentifier(q.name)&&e.isObjectBindingPattern(W)){var H=e.getTextOfIdentifierOrLiteral(q.name),G=a.getTypeAtLocation(W);v=e.firstDefined(G.isUnion()?G.types:[G],(function(e){var t=e.getProperty(H);return t?t.getDocumentationComment(a):void 0}))||e.emptyArray;}}return 0!==h.length||T||(h=o.getContextualJsDocTags(c,a)),0===v.length&&g&&(v=g),0===h.length&&m&&(h=m),{displayParts:y,documentation:v,symbolKind:x,tags:0===h.length?void 0:h};function Q(){return f||(f=e.createPrinter({removeComments:!0})),f}function X(){y.length&&y.push(e.lineBreakPart()),Y();}function Y(){_&&(te("alias"),y.push(e.spacePart()));}function Z(){y.push(e.spacePart()),y.push(e.keywordPart(101)),y.push(e.spacePart());}function $(t,r){_&&t===o&&(t=_);var n=e.symbolToDisplayParts(a,t,r||s,void 0,7);e.addRange(y,n),16777216&o.flags&&y.push(e.punctuationPart(57));}function ee(t,r){X(),r&&(te(r),t&&!e.some(t.declarations,(function(t){return e.isArrowFunction(t)||(e.isFunctionExpression(t)||e.isClassExpression(t))&&!t.name}))&&(y.push(e.spacePart()),$(t)));}function te(t){switch(t){case"var":case"function":case"let":case"const":case"constructor":return void y.push(e.textOrKeywordPart(t));default:return y.push(e.punctuationPart(20)),y.push(e.textOrKeywordPart(t)),void y.push(e.punctuationPart(21))}}function re(t,r,n){void 0===n&&(n=0),e.addRange(y,e.signatureToDisplayParts(a,t,c,32|n)),r.length>1&&(y.push(e.spacePart()),y.push(e.punctuationPart(20)),y.push(e.operatorPart(39)),y.push(e.displayPart((r.length-1).toString(),e.SymbolDisplayPartKind.numericLiteral)),y.push(e.spacePart()),y.push(e.textPart(2===r.length?"overload":"overloads")),y.push(e.punctuationPart(21))),v=t.getDocumentationComment(a),h=t.getJsDocTags(),r.length>1&&0===v.length&&0===h.length&&(v=r[0].getDocumentationComment(a),h=r[0].getJsDocTags());}function ne(t,n){var i=e.mapToDisplayParts((function(i){var o=a.symbolToTypeParameterDeclarations(t,n,r);Q().writeList(53776,o,e.getSourceFileOfNode(e.getParseTreeNode(n)),i);}));e.addRange(y,i);}};}(e.SymbolDisplay||(e.SymbolDisplay={}));}(t),function(e){function t(t,r){var i=[],a=r.compilerOptions?n(r.compilerOptions,i):{},o=e.getDefaultCompilerOptions();for(var s in o)e.hasProperty(o,s)&&void 0===a[s]&&(a[s]=o[s]);for(var c=0,l=e.transpileOptionValueCompilerOptions;c<l.length;c++){var u=l[c];a[u.name]=u.transpileOptionValue;}a.suppressOutputPathCheck=!0,a.allowNonTsExtensions=!0;var _,d,p=e.getNewLineCharacter(a),f={getSourceFile:function(t){return t===e.normalizePath(g)?m:void 0},writeFile:function(t,r){e.fileExtensionIs(t,".map")?(e.Debug.assertEqual(d,void 0,"Unexpected multiple source map outputs, file:",t),d=r):(e.Debug.assertEqual(_,void 0,"Unexpected multiple outputs, file:",t),_=r);},getDefaultLibFileName:function(){return "lib.d.ts"},useCaseSensitiveFileNames:function(){return !1},getCanonicalFileName:function(e){return e},getCurrentDirectory:function(){return ""},getNewLine:function(){return p},fileExists:function(e){return e===g},readFile:function(){return ""},directoryExists:function(){return !0},getDirectories:function(){return []}},g=r.fileName||(r.compilerOptions&&r.compilerOptions.jsx?"module.tsx":"module.ts"),m=e.createSourceFile(g,t,{languageVersion:e.getEmitScriptTarget(a),impliedNodeFormat:e.getImpliedNodeFormatForFile(e.toPath(g,"",f.getCanonicalFileName),void 0,f,a),setExternalModuleIndicator:e.getSetExternalModuleIndicator(a)});r.moduleName&&(m.moduleName=r.moduleName),r.renamedDependencies&&(m.renamedDependencies=new e.Map(e.getEntries(r.renamedDependencies)));var y=e.createProgram([g],a,f);return r.reportDiagnostics&&(e.addRange(i,y.getSyntacticDiagnostics(m)),e.addRange(i,y.getOptionsDiagnostics())),y.emit(void 0,void 0,void 0,void 0,r.transformers),void 0===_?e.Debug.fail("Output generation failed"):{outputText:_,diagnostics:i,sourceMapText:d}}var r;function n(t,n){r=r||e.filter(e.optionDeclarations,(function(t){return "object"==typeof t.type&&!e.forEachEntry(t.type,(function(e){return "number"!=typeof e}))})),t=e.cloneCompilerOptions(t);for(var i=function(r){if(!e.hasProperty(t,r.name))return "continue";var i=t[r.name];e.isString(i)?t[r.name]=e.parseCustomTypeOption(r,i,n):e.forEachEntry(r.type,(function(e){return e===i}))||n.push(e.createCompilerDiagnosticForInvalidCustomType(r));},a=0,o=r;a<o.length;a++)i(o[a]);return t}e.transpileModule=t,e.transpile=function(r,n,i,a,o){var s=t(r,{compilerOptions:n,fileName:i,reportDiagnostics:!!a,moduleName:o});return e.addRange(a,s.diagnostics),s.outputText},e.fixupCompilerOptions=n;}(t),function(e){!function(t){var r;(r=t.FormattingRequestKind||(t.FormattingRequestKind={}))[r.FormatDocument=0]="FormatDocument",r[r.FormatSelection=1]="FormatSelection",r[r.FormatOnEnter=2]="FormatOnEnter",r[r.FormatOnSemicolon=3]="FormatOnSemicolon",r[r.FormatOnOpeningCurlyBrace=4]="FormatOnOpeningCurlyBrace",r[r.FormatOnClosingCurlyBrace=5]="FormatOnClosingCurlyBrace";var n=function(){function t(e,t,r){this.sourceFile=e,this.formattingRequestKind=t,this.options=r;}return t.prototype.updateContext=function(t,r,n,i,a){this.currentTokenSpan=e.Debug.checkDefined(t),this.currentTokenParent=e.Debug.checkDefined(r),this.nextTokenSpan=e.Debug.checkDefined(n),this.nextTokenParent=e.Debug.checkDefined(i),this.contextNode=e.Debug.checkDefined(a),this.contextNodeAllOnSameLine=void 0,this.nextNodeAllOnSameLine=void 0,this.tokensAreOnSameLine=void 0,this.contextNodeBlockIsOnOneLine=void 0,this.nextNodeBlockIsOnOneLine=void 0;},t.prototype.ContextNodeAllOnSameLine=function(){return void 0===this.contextNodeAllOnSameLine&&(this.contextNodeAllOnSameLine=this.NodeIsOnOneLine(this.contextNode)),this.contextNodeAllOnSameLine},t.prototype.NextNodeAllOnSameLine=function(){return void 0===this.nextNodeAllOnSameLine&&(this.nextNodeAllOnSameLine=this.NodeIsOnOneLine(this.nextTokenParent)),this.nextNodeAllOnSameLine},t.prototype.TokensAreOnSameLine=function(){if(void 0===this.tokensAreOnSameLine){var e=this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line,t=this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;this.tokensAreOnSameLine=e===t;}return this.tokensAreOnSameLine},t.prototype.ContextNodeBlockIsOnOneLine=function(){return void 0===this.contextNodeBlockIsOnOneLine&&(this.contextNodeBlockIsOnOneLine=this.BlockIsOnOneLine(this.contextNode)),this.contextNodeBlockIsOnOneLine},t.prototype.NextNodeBlockIsOnOneLine=function(){return void 0===this.nextNodeBlockIsOnOneLine&&(this.nextNodeBlockIsOnOneLine=this.BlockIsOnOneLine(this.nextTokenParent)),this.nextNodeBlockIsOnOneLine},t.prototype.NodeIsOnOneLine=function(e){return this.sourceFile.getLineAndCharacterOfPosition(e.getStart(this.sourceFile)).line===this.sourceFile.getLineAndCharacterOfPosition(e.getEnd()).line},t.prototype.BlockIsOnOneLine=function(t){var r=e.findChildOfKind(t,18,this.sourceFile),n=e.findChildOfKind(t,19,this.sourceFile);return !(!r||!n)&&this.sourceFile.getLineAndCharacterOfPosition(r.getEnd()).line===this.sourceFile.getLineAndCharacterOfPosition(n.getStart(this.sourceFile)).line},t}();t.FormattingContext=n;}(e.formatting||(e.formatting={}));}(t),function(e){var t,r,n,i;t=e.formatting||(e.formatting={}),n=e.createScanner(99,!1,0),i=e.createScanner(99,!1,1),function(e){e[e.Scan=0]="Scan",e[e.RescanGreaterThanToken=1]="RescanGreaterThanToken",e[e.RescanSlashToken=2]="RescanSlashToken",e[e.RescanTemplateToken=3]="RescanTemplateToken",e[e.RescanJsxIdentifier=4]="RescanJsxIdentifier",e[e.RescanJsxText=5]="RescanJsxText",e[e.RescanJsxAttributeValue=6]="RescanJsxAttributeValue";}(r||(r={})),t.getFormattingScanner=function(r,a,o,s,c){var l=1===a?i:n;l.setText(r),l.setTextPos(o);var u,_,d,p,f,g=!0,m=c({advance:function(){f=void 0,l.getStartPos()!==o?g=!!_&&4===e.last(_).kind:l.scan(),u=void 0,_=void 0;for(var t=l.getStartPos();t<s;){var r=l.getToken();if(!e.isTrivia(r))break;l.scan();var n={pos:t,end:l.getStartPos(),kind:r};t=l.getStartPos(),u=e.append(u,n);}d=l.getStartPos();},readTokenInfo:function(r){e.Debug.assert(y());var n,i=function(e){switch(e.kind){case 33:case 71:case 72:case 49:case 48:return !0}return !1}(r)?1:13===r.kind?2:function(e){return 16===e.kind||17===e.kind}(r)?3:function(t){if(t.parent)switch(t.parent.kind){case 285:case 280:case 281:case 279:return e.isKeyword(t.kind)||79===t.kind}return !1}(r)?4:(n=r,e.isJsxText(n)?5:function(t){return t.parent&&e.isJsxAttribute(t.parent)&&t.parent.initializer===t}(r)?6:0);if(f&&i===p)return h(f,r);l.getStartPos()!==d&&(e.Debug.assert(void 0!==f),l.setTextPos(d),l.scan());var a=function(t,r){var n,i=l.getToken();switch(p=0,r){case 1:if(31===i){p=1;var a=l.reScanGreaterToken();return e.Debug.assert(t.kind===a),a}break;case 2:if(43===(n=i)||68===n)return p=2,a=l.reScanSlashToken(),e.Debug.assert(t.kind===a),a;break;case 3:if(19===i)return p=3,l.reScanTemplateToken(!1);break;case 4:return p=4,l.scanJsxIdentifier();case 5:return p=5,l.reScanJsxToken(!1);case 6:return p=6,l.reScanJsxAttributeValue();case 0:break;default:e.Debug.assertNever(r);}return i}(r,i),o=t.createTextRangeWithKind(l.getStartPos(),l.getTextPos(),a);for(_&&(_=void 0);l.getStartPos()<s&&(a=l.scan(),e.isTrivia(a));){var c=t.createTextRangeWithKind(l.getStartPos(),l.getTextPos(),a);if(_||(_=[]),_.push(c),4===a){l.scan();break}}return h(f={leadingTrivia:u,trailingTrivia:_,token:o},r)},readEOFTokenRange:function(){return e.Debug.assert(v()),t.createTextRangeWithKind(l.getStartPos(),l.getTextPos(),1)},isOnToken:y,isOnEOF:v,getCurrentLeadingTrivia:function(){return u},lastTrailingTriviaWasNewLine:function(){return g},skipToEndOf:function(e){l.setTextPos(e.end),d=l.getStartPos(),p=void 0,f=void 0,g=!1,u=void 0,_=void 0;},skipToStartOf:function(e){l.setTextPos(e.pos),d=l.getStartPos(),p=void 0,f=void 0,g=!1,u=void 0,_=void 0;},getStartPos:function(){var e;return null!==(e=null==f?void 0:f.token.pos)&&void 0!==e?e:l.getTokenPos()}});return f=void 0,l.setText(void 0),m;function y(){var t=f?f.token.kind:l.getToken();return 1!==t&&!e.isTrivia(t)}function v(){return 1===(f?f.token.kind:l.getToken())}function h(t,r){return e.isToken(r)&&t.token.kind!==r.kind&&(t.token.kind=r.kind),t}};}(t),function(e){var t,r,n;(t=e.formatting||(e.formatting={})).anyContext=e.emptyArray,(n=t.RuleAction||(t.RuleAction={}))[n.StopProcessingSpaceActions=1]="StopProcessingSpaceActions",n[n.StopProcessingTokenActions=2]="StopProcessingTokenActions",n[n.InsertSpace=4]="InsertSpace",n[n.InsertNewLine=8]="InsertNewLine",n[n.DeleteSpace=16]="DeleteSpace",n[n.DeleteToken=32]="DeleteToken",n[n.InsertTrailingSemicolon=64]="InsertTrailingSemicolon",n[n.StopAction=3]="StopAction",n[n.ModifySpaceAction=28]="ModifySpaceAction",n[n.ModifyTokenAction=96]="ModifyTokenAction",(r=t.RuleFlags||(t.RuleFlags={}))[r.None=0]="None",r[r.CanDeleteNewLines=1]="CanDeleteNewLines";}(t),function(e){!function(t){function r(e,t,r,n,i,o){return void 0===o&&(o=0),{leftTokenRange:a(t),rightTokenRange:a(r),rule:{debugName:e,context:n,action:i,flags:o}}}function i(e){return {tokens:e,isSpecific:!0}}function a(t){return "number"==typeof t?i([t]):e.isArray(t)?i(t):t}function o(t,r,n){void 0===n&&(n=[]);for(var a=[],o=t;o<=r;o++)e.contains(n,o)||a.push(o);return i(a)}function s(e,t){return function(r){return r.options&&r.options[e]===t}}function c(e){return function(t){return t.options&&t.options.hasOwnProperty(e)&&!!t.options[e]}}function l(e){return function(t){return t.options&&t.options.hasOwnProperty(e)&&!t.options[e]}}function u(e){return function(t){return !t.options||!t.options.hasOwnProperty(e)||!t.options[e]}}function _(e){return function(t){return !t.options||!t.options.hasOwnProperty(e)||!t.options[e]||t.TokensAreOnSameLine()}}function d(e){return function(t){return !t.options||!t.options.hasOwnProperty(e)||!!t.options[e]}}function p(e){return 242===e.contextNode.kind}function f(e){return !p(e)}function g(e){switch(e.contextNode.kind){case 221:return 27!==e.contextNode.operatorToken.kind;case 222:case 189:case 229:case 275:case 270:case 177:case 187:case 188:return !0;case 203:case 259:case 265:case 271:case 254:case 164:case 299:case 167:case 166:return 63===e.currentTokenSpan.kind||63===e.nextTokenSpan.kind;case 243:case 163:return 101===e.currentTokenSpan.kind||101===e.nextTokenSpan.kind||63===e.currentTokenSpan.kind||63===e.nextTokenSpan.kind;case 244:return 160===e.currentTokenSpan.kind||160===e.nextTokenSpan.kind}return !1}function m(e){return !g(e)}function y(e){return !v(e)}function v(t){var r=t.contextNode.kind;return 167===r||166===r||164===r||254===r||e.isFunctionLikeKind(r)}function h(e){return 222===e.contextNode.kind||189===e.contextNode.kind}function b(e){return e.TokensAreOnSameLine()||C(e)}function x(e){return 201===e.contextNode.kind||195===e.contextNode.kind||function(e){return T(e)&&(e.ContextNodeAllOnSameLine()||e.ContextNodeBlockIsOnOneLine())}(e)}function D(e){return C(e)&&!(e.NextNodeAllOnSameLine()||e.NextNodeBlockIsOnOneLine())}function S(e){return T(e)&&!(e.ContextNodeAllOnSameLine()||e.ContextNodeBlockIsOnOneLine())}function T(e){return k(e.contextNode)}function C(e){return k(e.nextTokenParent)}function k(e){if(P(e))return !0;switch(e.kind){case 235:case 263:case 205:case 262:return !0}return !1}function E(e){switch(e.contextNode.kind){case 256:case 169:case 168:case 172:case 173:case 174:case 213:case 171:case 214:case 258:return !0}return !1}function N(e){return !E(e)}function F(e){return 256===e.contextNode.kind||213===e.contextNode.kind}function A(e){return P(e.contextNode)}function P(e){switch(e.kind){case 257:case 226:case 258:case 260:case 182:case 261:case 272:case 273:case 266:case 269:return !0}return !1}function w(e){switch(e.currentTokenParent.kind){case 257:case 261:case 260:case 292:case 262:case 249:return !0;case 235:var t=e.currentTokenParent.parent;if(!t||214!==t.kind&&213!==t.kind)return !0}return !1}function I(e){switch(e.contextNode.kind){case 239:case 249:case 242:case 243:case 244:case 241:case 252:case 240:case 248:case 292:return !0;default:return !1}}function O(e){return 205===e.contextNode.kind}function M(e){return function(e){return 208===e.contextNode.kind}(e)||function(e){return 209===e.contextNode.kind}(e)}function L(e){return 27!==e.currentTokenSpan.kind}function R(e){return 23!==e.nextTokenSpan.kind}function B(e){return 21!==e.nextTokenSpan.kind}function j(e){return 214===e.contextNode.kind}function J(e){return 200===e.contextNode.kind}function z(e){return e.TokensAreOnSameLine()&&11!==e.contextNode.kind}function K(e){return 11!==e.contextNode.kind}function U(e){return 278!==e.contextNode.kind&&282!==e.contextNode.kind}function V(e){return 288===e.contextNode.kind||287===e.contextNode.kind}function q(e){return 285===e.nextTokenParent.kind}function W(e){return 285===e.contextNode.kind}function H(e){return 279===e.contextNode.kind}function G(e){return !E(e)&&!C(e)}function Q(e){return e.TokensAreOnSameLine()&&!!e.contextNode.decorators&&X(e.currentTokenParent)&&!X(e.nextTokenParent)}function X(t){for(;e.isExpressionNode(t);)t=t.parent;return 165===t.kind}function Y(e){return 255===e.currentTokenParent.kind&&e.currentTokenParent.getStart(e.sourceFile)===e.currentTokenSpan.pos}function Z(e){return 2!==e.formattingRequestKind}function $(e){return 261===e.contextNode.kind}function ee(e){return 182===e.contextNode.kind}function te(e){return 175===e.contextNode.kind}function re(e,t){if(29!==e.kind&&31!==e.kind)return !1;switch(t.kind){case 178:case 211:case 259:case 257:case 226:case 258:case 256:case 213:case 214:case 169:case 168:case 174:case 175:case 208:case 209:case 228:return !0;default:return !1}}function ne(e){return re(e.currentTokenSpan,e.currentTokenParent)||re(e.nextTokenSpan,e.nextTokenParent)}function ie(e){return 211===e.contextNode.kind}function ae(e){return 114===e.currentTokenSpan.kind&&217===e.currentTokenParent.kind}function oe(e){return 224===e.contextNode.kind&&void 0!==e.contextNode.expression}function se(e){return 230===e.contextNode.kind}function ce(e){return !function(e){switch(e.contextNode.kind){case 239:case 242:case 243:case 244:case 240:case 241:return !0;default:return !1}}(e)}function le(t){var r=t.nextTokenSpan.kind,n=t.nextTokenSpan.pos;if(e.isTrivia(r)){var i=t.nextTokenParent===t.currentTokenParent?e.findNextToken(t.currentTokenParent,e.findAncestor(t.currentTokenParent,(function(e){return !e.parent})),t.sourceFile):t.nextTokenParent.getFirstToken(t.sourceFile);if(!i)return !0;r=i.kind,n=i.getStart(t.sourceFile);}return t.sourceFile.getLineAndCharacterOfPosition(t.currentTokenSpan.pos).line===t.sourceFile.getLineAndCharacterOfPosition(n).line?19===r||1===r:234!==r&&26!==r&&(258===t.contextNode.kind||259===t.contextNode.kind?!e.isPropertySignature(t.currentTokenParent)||!!t.currentTokenParent.type||20!==r:e.isPropertyDeclaration(t.currentTokenParent)?!t.currentTokenParent.initializer:242!==t.currentTokenParent.kind&&236!==t.currentTokenParent.kind&&234!==t.currentTokenParent.kind&&22!==r&&20!==r&&39!==r&&40!==r&&43!==r&&13!==r&&27!==r&&223!==r&&15!==r&&14!==r&&24!==r)}function ue(t){return e.positionIsASICandidate(t.currentTokenSpan.end,t.currentTokenParent,t.sourceFile)}t.getAllRules=function(){for(var a=[],T=0;T<=160;T++)1!==T&&a.push(T);function k(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return {tokens:a.filter((function(t){return !e.some((function(e){return e===t}))})),isSpecific:!1}}var P={tokens:a,isSpecific:!1},X=i(n$4(n$4([],a,!0),[3],!1)),re=i(n$4(n$4([],a,!0),[1],!1)),_e=o(81,160),de=o(29,78),pe=[101,102,160,127,139],fe=n$4([79],e.typeKeywords,!0),ge=X,me=i([79,3,84,93,100]),ye=i([21,3,90,111,96,91]),ve=[r("IgnoreBeforeComment",P,[2,3],t.anyContext,1),r("IgnoreAfterLineComment",2,P,t.anyContext,1),r("NotSpaceBeforeColon",P,58,[z,m,y],16),r("SpaceAfterColon",58,P,[z,m],4),r("NoSpaceBeforeQuestionMark",P,57,[z,m,y],16),r("SpaceAfterQuestionMarkInConditionalOperator",57,P,[z,h],4),r("NoSpaceAfterQuestionMark",57,P,[z],16),r("NoSpaceBeforeDot",P,[24,28],[z],16),r("NoSpaceAfterDot",[24,28],P,[z],16),r("NoSpaceBetweenImportParenInImportType",100,20,[z,J],16),r("NoSpaceAfterUnaryPrefixOperator",[45,46,54,53],[8,9,79,20,22,18,108,103],[z,m],16),r("NoSpaceAfterUnaryPreincrementOperator",45,[79,20,108,103],[z],16),r("NoSpaceAfterUnaryPredecrementOperator",46,[79,20,108,103],[z],16),r("NoSpaceBeforeUnaryPostincrementOperator",[79,21,23,103],45,[z,ce],16),r("NoSpaceBeforeUnaryPostdecrementOperator",[79,21,23,103],46,[z,ce],16),r("SpaceAfterPostincrementWhenFollowedByAdd",45,39,[z,g],4),r("SpaceAfterAddWhenFollowedByUnaryPlus",39,39,[z,g],4),r("SpaceAfterAddWhenFollowedByPreincrement",39,45,[z,g],4),r("SpaceAfterPostdecrementWhenFollowedBySubtract",46,40,[z,g],4),r("SpaceAfterSubtractWhenFollowedByUnaryMinus",40,40,[z,g],4),r("SpaceAfterSubtractWhenFollowedByPredecrement",40,46,[z,g],4),r("NoSpaceAfterCloseBrace",19,[27,26],[z],16),r("NewLineBeforeCloseBraceInBlockContext",X,19,[S],8),r("SpaceAfterCloseBrace",19,k(21),[z,w],4),r("SpaceBetweenCloseBraceAndElse",19,91,[z],4),r("SpaceBetweenCloseBraceAndWhile",19,115,[z],4),r("NoSpaceBetweenEmptyBraceBrackets",18,19,[z,O],16),r("SpaceAfterConditionalClosingParen",21,22,[I],4),r("NoSpaceBetweenFunctionKeywordAndStar",98,41,[F],16),r("SpaceAfterStarInGeneratorDeclaration",41,79,[F],4),r("SpaceAfterFunctionInFuncDecl",98,P,[E],4),r("NewLineAfterOpenBraceInBlockContext",18,P,[S],8),r("SpaceAfterGetSetInMember",[136,149],79,[E],4),r("NoSpaceBetweenYieldKeywordAndStar",125,41,[z,oe],16),r("SpaceBetweenYieldOrYieldStarAndOperand",[125,41],P,[z,oe],4),r("NoSpaceBetweenReturnAndSemicolon",105,26,[z],16),r("SpaceAfterCertainKeywords",[113,109,103,89,105,112,132],P,[z],4),r("SpaceAfterLetConstInVariableDeclaration",[119,85],P,[z,Y],4),r("NoSpaceBeforeOpenParenInFuncCall",P,20,[z,M,L],16),r("SpaceBeforeBinaryKeywordOperator",P,pe,[z,g],4),r("SpaceAfterBinaryKeywordOperator",pe,P,[z,g],4),r("SpaceAfterVoidOperator",114,P,[z,ae],4),r("SpaceBetweenAsyncAndOpenParen",131,20,[j,z],4),r("SpaceBetweenAsyncAndFunctionKeyword",131,[98,79],[z],4),r("NoSpaceBetweenTagAndTemplateString",[79,21],[14,15],[z],16),r("SpaceBeforeJsxAttribute",P,79,[q,z],4),r("SpaceBeforeSlashInJsxOpeningElement",P,43,[H,z],4),r("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement",43,31,[H,z],16),r("NoSpaceBeforeEqualInJsxAttribute",P,63,[W,z],16),r("NoSpaceAfterEqualInJsxAttribute",63,P,[W,z],16),r("NoSpaceAfterModuleImport",[141,146],20,[z],16),r("SpaceAfterCertainTypeScriptKeywords",[126,84,135,88,92,93,94,136,117,100,118,141,142,121,123,122,145,149,124,152,156,140,137],P,[z],4),r("SpaceBeforeCertainTypeScriptKeywords",P,[94,117,156],[z],4),r("SpaceAfterModuleName",10,18,[$],4),r("SpaceBeforeArrow",P,38,[z],4),r("SpaceAfterArrow",38,P,[z],4),r("NoSpaceAfterEllipsis",25,79,[z],16),r("NoSpaceAfterOptionalParameters",57,[21,27],[z,m],16),r("NoSpaceBetweenEmptyInterfaceBraceBrackets",18,19,[z,ee],16),r("NoSpaceBeforeOpenAngularBracket",fe,29,[z,ne],16),r("NoSpaceBetweenCloseParenAndAngularBracket",21,29,[z,ne],16),r("NoSpaceAfterOpenAngularBracket",29,P,[z,ne],16),r("NoSpaceBeforeCloseAngularBracket",P,31,[z,ne],16),r("NoSpaceAfterCloseAngularBracket",31,[20,22,31,27],[z,ne,N],16),r("SpaceBeforeAt",[21,79],59,[z],4),r("NoSpaceAfterAt",59,P,[z],16),r("SpaceAfterDecorator",P,[126,79,93,88,84,124,123,121,122,136,149,22,41],[Q],4),r("NoSpaceBeforeNonNullAssertionOperator",P,53,[z,se],16),r("NoSpaceAfterNewKeywordOnConstructorSignature",103,20,[z,te],16),r("SpaceLessThanAndNonJSXTypeAnnotation",29,29,[z],4)],he=[r("SpaceAfterConstructor",134,20,[c("insertSpaceAfterConstructor"),z],4),r("NoSpaceAfterConstructor",134,20,[u("insertSpaceAfterConstructor"),z],16),r("SpaceAfterComma",27,P,[c("insertSpaceAfterCommaDelimiter"),z,U,R,B],4),r("NoSpaceAfterComma",27,P,[u("insertSpaceAfterCommaDelimiter"),z,U],16),r("SpaceAfterAnonymousFunctionKeyword",[98,41],20,[c("insertSpaceAfterFunctionKeywordForAnonymousFunctions"),E],4),r("NoSpaceAfterAnonymousFunctionKeyword",[98,41],20,[u("insertSpaceAfterFunctionKeywordForAnonymousFunctions"),E],16),r("SpaceAfterKeywordInControl",_e,20,[c("insertSpaceAfterKeywordsInControlFlowStatements"),I],4),r("NoSpaceAfterKeywordInControl",_e,20,[u("insertSpaceAfterKeywordsInControlFlowStatements"),I],16),r("SpaceAfterOpenParen",20,P,[c("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"),z],4),r("SpaceBeforeCloseParen",P,21,[c("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"),z],4),r("SpaceBetweenOpenParens",20,20,[c("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"),z],4),r("NoSpaceBetweenParens",20,21,[z],16),r("NoSpaceAfterOpenParen",20,P,[u("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"),z],16),r("NoSpaceBeforeCloseParen",P,21,[u("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"),z],16),r("SpaceAfterOpenBracket",22,P,[c("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"),z],4),r("SpaceBeforeCloseBracket",P,23,[c("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"),z],4),r("NoSpaceBetweenBrackets",22,23,[z],16),r("NoSpaceAfterOpenBracket",22,P,[u("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"),z],16),r("NoSpaceBeforeCloseBracket",P,23,[u("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"),z],16),r("SpaceAfterOpenBrace",18,P,[d("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"),x],4),r("SpaceBeforeCloseBrace",P,19,[d("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"),x],4),r("NoSpaceBetweenEmptyBraceBrackets",18,19,[z,O],16),r("NoSpaceAfterOpenBrace",18,P,[l("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"),z],16),r("NoSpaceBeforeCloseBrace",P,19,[l("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"),z],16),r("SpaceBetweenEmptyBraceBrackets",18,19,[c("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces")],4),r("NoSpaceBetweenEmptyBraceBrackets",18,19,[l("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces"),z],16),r("SpaceAfterTemplateHeadAndMiddle",[15,16],P,[c("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"),K],4,1),r("SpaceBeforeTemplateMiddleAndTail",P,[16,17],[c("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"),z],4),r("NoSpaceAfterTemplateHeadAndMiddle",[15,16],P,[u("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"),K],16,1),r("NoSpaceBeforeTemplateMiddleAndTail",P,[16,17],[u("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"),z],16),r("SpaceAfterOpenBraceInJsxExpression",18,P,[c("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"),z,V],4),r("SpaceBeforeCloseBraceInJsxExpression",P,19,[c("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"),z,V],4),r("NoSpaceAfterOpenBraceInJsxExpression",18,P,[u("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"),z,V],16),r("NoSpaceBeforeCloseBraceInJsxExpression",P,19,[u("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"),z,V],16),r("SpaceAfterSemicolonInFor",26,P,[c("insertSpaceAfterSemicolonInForStatements"),z,p],4),r("NoSpaceAfterSemicolonInFor",26,P,[u("insertSpaceAfterSemicolonInForStatements"),z,p],16),r("SpaceBeforeBinaryOperator",P,de,[c("insertSpaceBeforeAndAfterBinaryOperators"),z,g],4),r("SpaceAfterBinaryOperator",de,P,[c("insertSpaceBeforeAndAfterBinaryOperators"),z,g],4),r("NoSpaceBeforeBinaryOperator",P,de,[u("insertSpaceBeforeAndAfterBinaryOperators"),z,g],16),r("NoSpaceAfterBinaryOperator",de,P,[u("insertSpaceBeforeAndAfterBinaryOperators"),z,g],16),r("SpaceBeforeOpenParenInFuncDecl",P,20,[c("insertSpaceBeforeFunctionParenthesis"),z,E],4),r("NoSpaceBeforeOpenParenInFuncDecl",P,20,[u("insertSpaceBeforeFunctionParenthesis"),z,E],16),r("NewLineBeforeOpenBraceInControl",ye,18,[c("placeOpenBraceOnNewLineForControlBlocks"),I,D],8,1),r("NewLineBeforeOpenBraceInFunction",ge,18,[c("placeOpenBraceOnNewLineForFunctions"),E,D],8,1),r("NewLineBeforeOpenBraceInTypeScriptDeclWithBlock",me,18,[c("placeOpenBraceOnNewLineForFunctions"),A,D],8,1),r("SpaceAfterTypeAssertion",31,P,[c("insertSpaceAfterTypeAssertion"),z,ie],4),r("NoSpaceAfterTypeAssertion",31,P,[u("insertSpaceAfterTypeAssertion"),z,ie],16),r("SpaceBeforeTypeAnnotation",P,[57,58],[c("insertSpaceBeforeTypeAnnotation"),z,v],4),r("NoSpaceBeforeTypeAnnotation",P,[57,58],[u("insertSpaceBeforeTypeAnnotation"),z,v],16),r("NoOptionalSemicolon",26,re,[s("semicolons",e.SemicolonPreference.Remove),le],32),r("OptionalSemicolon",P,re,[s("semicolons",e.SemicolonPreference.Insert),ue],64)],be=[r("NoSpaceBeforeSemicolon",P,26,[z],16),r("SpaceBeforeOpenBraceInControl",ye,18,[_("placeOpenBraceOnNewLineForControlBlocks"),I,Z,b],4,1),r("SpaceBeforeOpenBraceInFunction",ge,18,[_("placeOpenBraceOnNewLineForFunctions"),E,C,Z,b],4,1),r("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock",me,18,[_("placeOpenBraceOnNewLineForFunctions"),A,Z,b],4,1),r("NoSpaceBeforeComma",P,27,[z],16),r("NoSpaceBeforeOpenBracket",k(131,82),22,[z],16),r("NoSpaceAfterCloseBracket",23,P,[z,G],16),r("SpaceAfterSemicolon",26,P,[z],4),r("SpaceBetweenForAndAwaitKeyword",97,132,[z],4),r("SpaceBetweenStatements",[21,90,91,82],P,[z,U,f],4),r("SpaceAfterTryCatchFinally",[111,83,96],18,[z],4)];return n$4(n$4(n$4([],ve,!0),he,!0),be,!0)};}(e.formatting||(e.formatting={}));}(t),function(e){!function(t){var r;function n(e){var t=0;return 1&e&&(t|=28),2&e&&(t|=96),28&e&&(t|=28),96&e&&(t|=96),t}function i(t,r){return e.Debug.assert(t<=160&&r<=160,"Must compute formatting context from tokens"),t*o+r}t.getFormatContext=function(a,c){return {options:a,getRules:(void 0===r&&(l=t.getAllRules(),u=function(e){for(var t=new Array(o*o),r=new Array(t.length),n=0,a=e;n<a.length;n++)for(var c=a[n],l=c.leftTokenRange.isSpecific&&c.rightTokenRange.isSpecific,u=0,_=c.leftTokenRange.tokens;u<_.length;u++)for(var d=_[u],p=0,f=c.rightTokenRange.tokens;p<f.length;p++){var g=i(d,f[p]),m=t[g];void 0===m&&(m=t[g]=[]),s(m,c.rule,l,r,g);}return t}(l),r=function(t){var r=u[i(t.currentTokenSpan.kind,t.nextTokenSpan.kind)];if(r){for(var a=[],o=0,s=0,c=r;s<c.length;s++){var l=c[s],_=~n(o);l.action&_&&e.every(l.context,(function(e){return e(t)}))&&(a.push(l),o|=l.action);}if(a.length)return a}}),r),host:c};var l,u;};var a,o=161;function s(r,n,i,o,s){var c,l,u,_=3&n.action?i?a.StopRulesSpecific:a.StopRulesAny:n.context!==t.anyContext?i?a.ContextRulesSpecific:a.ContextRulesAny:i?a.NoContextRulesSpecific:a.NoContextRulesAny,d=o[s]||0;r.splice(function(e,t){for(var r=0,n=0;n<=t;n+=5)r+=31&e,e>>=5;return r}(d,_),0,n),o[s]=(u=1+((c=d)>>(l=_)&31),e.Debug.assert((31&u)===u,"Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."),c&~(31<<l)|u<<l);}!function(e){e[e.StopRulesSpecific=0]="StopRulesSpecific",e[e.StopRulesAny=5]="StopRulesAny",e[e.ContextRulesSpecific=10]="ContextRulesSpecific",e[e.ContextRulesAny=15]="ContextRulesAny",e[e.NoContextRulesSpecific=20]="NoContextRulesSpecific",e[e.NoContextRulesAny=25]="NoContextRulesAny";}(a||(a={}));}(e.formatting||(e.formatting={}));}(t),function(e){!function(t){var r,n,i,a,o;function s(t,r,n){var i=e.findPrecedingToken(t,n);return i&&i.kind===r&&t===i.getEnd()?i:void 0}function c(e){for(var t=e;t&&t.parent&&t.parent.end===e.end&&!l(t.parent,t);)t=t.parent;return t}function l(t,r){switch(t.kind){case 257:case 258:return e.rangeContainsRange(t.members,r);case 261:var n=t.body;return !!n&&262===n.kind&&e.rangeContainsRange(n.statements,r);case 305:case 235:case 262:return e.rangeContainsRange(t.statements,r);case 292:return e.rangeContainsRange(t.block.statements,r)}return !1}function u(t,r,n,i){return t?_({pos:e.getLineStartPositionForPosition(t.getStart(r),r),end:t.end},r,n,i):[]}function _(r,n,i,a){var o=function(t,r){return function n(i){var a=e.forEachChild(i,(function(n){return e.startEndContainsRange(n.getStart(r),n.end,t)&&n}));if(a){var o=n(a);if(o)return o}return i}(r)}(r,n);return t.getFormattingScanner(n.text,n.languageVariant,function(t,r,n){var i=t.getStart(n);if(i===r.pos&&t.end===r.end)return i;var a=e.findPrecedingToken(r.pos,n);return a?a.end>=r.pos?t.pos:a.end:t.pos}(o,r,n),r.end,(function(s){return d(r,o,t.SmartIndenter.getIndentationForNode(o,r,n,i.options),function(e,r,n){for(var i,a=-1;e;){var o=n.getLineAndCharacterOfPosition(e.getStart(n)).line;if(-1!==a&&o!==a)break;if(t.SmartIndenter.shouldIndentChildNode(r,e,i,n))return r.indentSize;a=o,i=e,e=e.parent;}return 0}(o,i.options,n),s,i,a,function(t,r){if(!t.length)return a;var n=t.filter((function(t){return e.rangeOverlapsWithStartEnd(r,t.start,t.start+t.length)})).sort((function(e,t){return e.start-t.start}));if(!n.length)return a;var i=0;return function(t){for(;;){if(i>=n.length)return !1;var r=n[i];if(t.end<=r.start)return !1;if(e.startEndOverlapsWithStartEnd(t.pos,t.end,r.start,r.start+r.length))return !0;i++;}};function a(){return !1}}(n.parseDiagnostics,r),n)}))}function d(r,n,i,a,o,s,c,l,u){var _,d,f,g,m,y=s.options,v=s.getRules,h=s.host,b=new t.FormattingContext(u,c,y),x=-1,D=[];if(o.advance(),o.isOnToken()){var S=u.getLineAndCharacterOfPosition(n.getStart(u)).line,T=S;n.decorators&&(T=u.getLineAndCharacterOfPosition(e.getNonDecoratorTokenPosOfNode(n,u)).line),function n(i,a,s,c,_,p){if(e.rangeOverlapsWithStartEnd(r,i.getStart(u),i.getEnd())){var f=F(i,s,_,p),g=a;for(e.forEachChild(i,(function(e){h(e,-1,i,f,s,c,!1);}),(function(n){!function(n,a,s,c){e.Debug.assert(e.isNodeArray(n));var l=function(e,t){switch(e.kind){case 171:case 256:case 213:case 169:case 168:case 214:if(e.typeParameters===t)return 29;if(e.parameters===t)return 20;break;case 208:case 209:if(e.typeArguments===t)return 29;if(e.arguments===t)return 20;break;case 178:if(e.typeArguments===t)return 29;break;case 182:return 18}return 0}(a,n),_=c,d=s;if(e.rangeOverlapsWithStartEnd(r,n.pos,n.end)){if(0!==l)for(;o.isOnToken()&&o.getStartPos()<r.end&&!((v=o.readTokenInfo(a)).token.end>n.pos);)if(v.token.kind===l){d=u.getLineAndCharacterOfPosition(v.token.pos).line,b(v,a,c,a);var p=void 0;if(-1!==x)p=x;else {var f=e.getLineStartPositionForPosition(v.token.pos,u);p=t.SmartIndenter.findFirstNonWhitespaceColumn(f,v.token.pos,u,y);}_=F(a,s,p,y.indentSize);}else b(v,a,c,a);for(var g=-1,m=0;m<n.length;m++)g=h(n[m],g,i,_,d,d,!0,0===m);var v,D=function(e){switch(e){case 20:return 21;case 29:return 31;case 18:return 19}return 0}(l);if(0!==D&&o.isOnToken()&&o.getStartPos()<r.end)27===(v=o.readTokenInfo(a)).token.kind&&e.isCallLikeExpression(a)&&d!==u.getLineAndCharacterOfPosition(v.token.pos).line&&(o.advance(),v=o.isOnToken()?o.readTokenInfo(a):void 0),v&&v.token.kind===D&&e.rangeContainsRange(a,v.token)&&b(v,a,_,a,!0);}else n.end<r.pos&&o.skipToEndOf(n);}(n,i,s,f);}));o.isOnToken()&&o.getStartPos()<r.end;){var v=o.readTokenInfo(i);if(v.token.end>Math.min(i.end,r.end))break;b(v,i,f,i);}}function h(a,s,c,l,_,d,p,f){if(e.nodeIsMissing(a))return s;var v=a.getStart(u),h=u.getLineAndCharacterOfPosition(v).line,D=h;a.decorators&&(D=u.getLineAndCharacterOfPosition(e.getNonDecoratorTokenPosOfNode(a,u)).line);var S=-1;if(p&&e.rangeContainsRange(r,c)&&-1!==(S=function(r,n,i,a,o){if(e.rangeOverlapsWithStartEnd(a,r,n)||e.rangeContainsStartEnd(a,r,n)){if(-1!==o)return o}else {var s=u.getLineAndCharacterOfPosition(r).line,c=e.getLineStartPositionForPosition(r,u),l=t.SmartIndenter.findFirstNonWhitespaceColumn(c,r,u,y);if(s!==i||r===l){var _=t.SmartIndenter.getBaseIndentation(y);return _>l?_:l}}return -1}(v,a.end,_,r,s))&&(s=S),!e.rangeOverlapsWithStartEnd(r,a.pos,a.end))return a.end<r.pos&&o.skipToEndOf(a),s;if(0===a.getFullWidth())return s;for(;o.isOnToken()&&o.getStartPos()<r.end;){if((T=o.readTokenInfo(i)).token.end>r.end)return s;if(T.token.end>v){T.token.pos>v&&o.skipToStartOf(a);break}b(T,i,l,i);}if(!o.isOnToken()||o.getStartPos()>=r.end)return s;if(e.isToken(a)){var T=o.readTokenInfo(a);if(11!==a.kind)return e.Debug.assert(T.token.end===a.end,"Token end is child end"),b(T,i,l,a),s}var C=165===a.kind?h:d,k=function(e,r,n,i,a,o){var s=t.SmartIndenter.shouldIndentChildNode(y,e)?y.indentSize:0;return o===r?{indentation:r===m?x:a.getIndentation(),delta:Math.min(y.indentSize,a.getDelta(e)+s)}:-1===n?20===e.kind&&r===m?{indentation:x,delta:a.getDelta(e)}:t.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(i,e,r,u)||t.SmartIndenter.childIsUnindentedBranchOfConditionalExpression(i,e,r,u)||t.SmartIndenter.argumentStartsOnSameLineAsPreviousArgument(i,e,r,u)?{indentation:a.getIndentation(),delta:s}:{indentation:a.getIndentation()+a.getDelta(e),delta:s}:{indentation:n,delta:s}}(a,h,S,i,l,C);return n(a,g,h,D,k.indentation,k.delta),g=i,f&&204===c.kind&&-1===s&&(s=k.indentation),s}function b(t,n,i,a,s){e.Debug.assert(e.rangeContainsRange(n,t.token));var c=o.lastTrailingTriviaWasNewLine(),_=!1;t.leadingTrivia&&P(t.leadingTrivia,n,g,i);var p=0,f=e.rangeContainsRange(r,t.token),y=u.getLineAndCharacterOfPosition(t.token.pos);if(f){var v=l(t.token),h=d;if(p=w(t.token,y,n,g,i),!v)if(0===p){var b=h&&u.getLineAndCharacterOfPosition(h.end).line;_=c&&y.line!==b;}else _=1===p;}if(t.trailingTrivia&&P(t.trailingTrivia,n,g,i),_){var D=f&&!l(t.token)?i.getIndentationForToken(y.line,t.token.kind,a,!!s):-1,S=!0;if(t.leadingTrivia){var T=i.getIndentationForComment(t.token.kind,D,a);S=A(t.leadingTrivia,T,S,(function(e){return O(e.pos,T,!1)}));}-1!==D&&S&&(O(t.token.pos,D,1===p),m=y.line,x=D);}o.advance(),g=n;}}(n,n,S,T,i,a);}if(!o.isOnToken()){var C=t.SmartIndenter.nodeWillIndentChild(y,n,void 0,u,!1)?i+y.indentSize:i,k=o.getCurrentLeadingTrivia();k&&(A(k,C,!1,(function(e){return w(e,u.getLineAndCharacterOfPosition(e.pos),n,n,void 0)})),!1!==y.trimTrailingWhitespace&&function(t){for(var n=d?d.end:r.pos,i=0,a=t;i<a.length;i++){var o=a[i];e.isComment(o.kind)&&(n<o.pos&&B(n,o.pos-1,d),n=o.end+1);}n<r.end&&B(n,r.end,d);}(k));}if(d&&o.getStartPos()>=r.end){var E=o.isOnEOF()?o.readEOFTokenRange():o.isOnToken()?o.readTokenInfo(n).token:void 0;if(E){var N=(null===(_=e.findPrecedingToken(E.end,u,n))||void 0===_?void 0:_.parent)||f;I(E,u.getLineAndCharacterOfPosition(E.pos).line,N,d,g,f,N,void 0);}}return D;function F(r,n,i,a){return {getIndentationForComment:function(e,t,r){switch(e){case 19:case 23:case 21:return i+o(r)}return -1!==t?t:i},getIndentationForToken:function(t,a,s,c){return !c&&function(t,i,a){switch(i){case 18:case 19:case 21:case 91:case 115:case 59:return !1;case 43:case 31:switch(a.kind){case 280:case 281:case 279:case 228:return !1}break;case 22:case 23:if(195!==a.kind)return !1}return n!==t&&!(r.decorators&&i===function(t){if(t.modifiers&&t.modifiers.length)return t.modifiers[0].kind;switch(t.kind){case 257:return 84;case 258:return 118;case 256:return 98;case 260:return 260;case 172:return 136;case 173:return 149;case 169:if(t.asteriskToken)return 41;case 167:case 164:var r=e.getNameOfDeclaration(t);if(r)return r.kind}}(r))}(t,a,s)?i+o(s):i},getIndentation:function(){return i},getDelta:o,recomputeIndentation:function(e,n){t.SmartIndenter.shouldIndentChildNode(y,n,r,u)&&(i+=e?y.indentSize:-y.indentSize,a=t.SmartIndenter.shouldIndentChildNode(y,r)?y.indentSize:0);}};function o(e){return t.SmartIndenter.nodeWillIndentChild(y,r,e,u,!0)?a:0}}function A(t,n,i,a){for(var o=0,s=t;o<s.length;o++){var c=s[o],l=e.rangeContainsRange(r,c);switch(c.kind){case 3:l&&M(c,n,!i),i=!1;break;case 2:i&&l&&a(c),i=!1;break;case 4:i=!0;}}return i}function P(t,n,i,a){for(var o=0,s=t;o<s.length;o++){var c=s[o];e.isComment(c.kind)&&e.rangeContainsRange(r,c)&&w(c,u.getLineAndCharacterOfPosition(c.pos),n,i,a);}}function w(e,t,n,i,a){var o=0;return l(e)||(d?o=I(e,t.line,n,d,g,f,i,a):L(u.getLineAndCharacterOfPosition(r.pos).line,t.line)),d=e,f=n,g=t.line,o}function I(t,r,n,i,a,o,s,c){b.updateContext(i,o,t,n,s);var l=v(b),_=!1!==b.options.trimTrailingWhitespace,d=0;return l?e.forEachRight(l,(function(o){if(d=function(t,r,n,i,a){var o,s=a!==n;switch(t.action){case 1:return 0;case 16:if(r.end!==i.pos)return j(r.end,i.pos-r.end),s?2:0;break;case 32:j(r.pos,r.end-r.pos);break;case 8:if(1!==t.flags&&n!==a)return 0;if(1!=a-n)return J(r.end,i.pos-r.end,e.getNewLineOrDefaultFromHost(h,y)),s?0:1;break;case 4:if(1!==t.flags&&n!==a)return 0;if(1!=i.pos-r.end||32!==u.text.charCodeAt(r.end))return J(r.end,i.pos-r.end," "),s?2:0;break;case 64:o=r.end,D.push(e.createTextChangeFromStartLength(o,0,";"));}return 0}(o,i,a,t,r),c)switch(d){case 2:n.getStart(u)===t.pos&&c.recomputeIndentation(!1,s);break;case 1:n.getStart(u)===t.pos&&c.recomputeIndentation(!0,s);break;default:e.Debug.assert(0===d);}_=_&&!(16&o.action)&&1!==o.flags;})):_=_&&1!==t.kind,r!==a&&_&&L(a,r,i),d}function O(t,r,n){var i=p(r,y);if(n)J(t,0,i);else {var a=u.getLineAndCharacterOfPosition(t),o=e.getStartPositionOfLine(a.line,u);(r!==function(e,t){for(var r=0,n=0;n<t;n++)9===u.text.charCodeAt(e+n)?r+=y.tabSize-r%y.tabSize:r++;return r}(o,a.character)||function(e,t){return e!==u.text.substr(t,e.length)}(i,o))&&J(o,a.character,i);}}function M(r,n,i,a){void 0===a&&(a=!0);var o=u.getLineAndCharacterOfPosition(r.pos).line,s=u.getLineAndCharacterOfPosition(r.end).line;if(o!==s){for(var c=[],l=r.pos,_=o;_<s;_++){var d=e.getEndLinePosition(_,u);c.push({pos:l,end:d}),l=e.getStartPositionOfLine(_+1,u);}if(a&&c.push({pos:l,end:r.end}),0!==c.length){var f=e.getStartPositionOfLine(o,u),g=t.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(f,c[0].pos,u,y),m=0;i&&(m=1,o++);for(var v=n-g.column,h=m;h<c.length;h++,o++){var b=e.getStartPositionOfLine(o,u),x=0===h?g:t.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(c[h].pos,c[h].end,u,y),D=x.column+v;if(D>0){var S=p(D,y);J(b,x.character,S);}else j(b,x.character);}}}else i||O(r.pos,n,!1);}function L(t,r,n){for(var i=t;i<r;i++){var a=e.getStartPositionOfLine(i,u),o=e.getEndLinePosition(i,u);if(!(n&&(e.isComment(n.kind)||e.isStringOrRegularExpressionOrTemplateLiteral(n.kind))&&n.pos<=o&&n.end>o)){var s=R(a,o);-1!==s&&(e.Debug.assert(s===a||!e.isWhiteSpaceSingleLine(u.text.charCodeAt(s-1))),j(s,o+1-s));}}}function R(t,r){for(var n=r;n>=t&&e.isWhiteSpaceSingleLine(u.text.charCodeAt(n));)n--;return n!==r?n+1:-1}function B(e,t,r){L(u.getLineAndCharacterOfPosition(e).line,u.getLineAndCharacterOfPosition(t).line+1,r);}function j(t,r){r&&D.push(e.createTextChangeFromStartLength(t,r,""));}function J(t,r,n){(r||n)&&D.push(e.createTextChangeFromStartLength(t,r,n));}}function p(t,r){if((!i||i.tabSize!==r.tabSize||i.indentSize!==r.indentSize)&&(i={tabSize:r.tabSize,indentSize:r.indentSize},a=o=void 0),r.convertTabsToSpaces){var n=void 0,s=Math.floor(t/r.indentSize),c=t%r.indentSize;return o||(o=[]),void 0===o[s]?(n=e.repeatString(" ",r.indentSize*s),o[s]=n):n=o[s],c?n+e.repeatString(" ",c):n}var l=Math.floor(t/r.tabSize),u=t-l*r.tabSize,_=void 0;return a||(a=[]),void 0===a[l]?a[l]=_=e.repeatString("\t",l):_=a[l],u?_+e.repeatString(" ",u):_}t.createTextRangeWithKind=function(t,r,n){var i={pos:t,end:r,kind:n};return e.Debug.isDebugging&&Object.defineProperty(i,"__debugKind",{get:function(){return e.Debug.formatSyntaxKind(n)}}),i},function(e){e[e.Unknown=-1]="Unknown";}(r||(r={})),t.formatOnEnter=function(t,r,n){var i=r.getLineAndCharacterOfPosition(t).line;if(0===i)return [];for(var a=e.getEndLinePosition(i,r);e.isWhiteSpaceSingleLine(r.text.charCodeAt(a));)a--;return e.isLineBreak(r.text.charCodeAt(a))&&a--,_({pos:e.getStartPositionOfLine(i-1,r),end:a+1},r,n,2)},t.formatOnSemicolon=function(e,t,r){return u(c(s(e,26,t)),t,r,3)},t.formatOnOpeningCurly=function(t,r,n){var i=s(t,18,r);if(!i)return [];var a=c(i.parent);return _({pos:e.getLineStartPositionForPosition(a.getStart(r),r),end:t},r,n,4)},t.formatOnClosingCurly=function(e,t,r){return u(c(s(e,19,t)),t,r,5)},t.formatDocument=function(e,t){return _({pos:0,end:e.text.length},e,t,0)},t.formatSelection=function(t,r,n,i){return _({pos:e.getLineStartPositionForPosition(t,n),end:r},n,i,1)},t.formatNodeGivenIndentation=function(e,r,n,i,a,o){var s={pos:e.pos,end:e.end};return t.getFormattingScanner(r.text,n,s.pos,s.end,(function(t){return d(s,e,i,a,t,o,1,(function(e){return !1}),r)}))},function(e){e[e.None=0]="None",e[e.LineAdded=1]="LineAdded",e[e.LineRemoved=2]="LineRemoved";}(n||(n={})),t.getRangeOfEnclosingComment=function(t,r,n,i){void 0===i&&(i=e.getTokenAtPosition(t,r));var a=e.findAncestor(i,e.isJSDoc);if(a&&(i=a.parent),!(i.getStart(t)<=r&&r<i.getEnd())){var o=(n=null===n?void 0:void 0===n?e.findPrecedingToken(r,t):n)&&e.getTrailingCommentRanges(t.text,n.end),s=e.getLeadingCommentRangesOfNode(i,t),c=e.concatenate(o,s);return c&&e.find(c,(function(n){return e.rangeContainsPositionExclusive(n,r)||r===n.end&&(2===n.kind||r===t.getFullWidth())}))}},t.getIndentationString=p;}(e.formatting||(e.formatting={}));}(t),function(e){var t;(function(r){var n,i;function a(e){return e.baseIndentSize||0}function o(e,t,r,n,i,o,l){for(var f,g=e.parent;g;){var y=!0;if(r){var v=e.getStart(i);y=v<r.pos||v>r.end;}var h=s(g,e,i),b=h.line===t.line||d(g,e,t.line,i);if(y){var x=null===(f=p(e,i))||void 0===f?void 0:f[0],S=m(e,i,l,!!x&&u(x,i).line>h.line);if(-1!==S)return S+n;if(-1!==(S=c(e,g,t,b,i,l)))return S+n}D(l,g,e,i,o)&&!b&&(n+=l.indentSize);var T=_(g,e,t.line,i);g=(e=g).parent,t=T?i.getLineAndCharacterOfPosition(e.getStart(i)):h;}return n+a(l)}function s(e,t,r){var n=p(t,r),i=n?n.pos:e.getStart(r);return r.getLineAndCharacterOfPosition(i)}function c(t,r,n,i,a,o){return !e.isDeclaration(t)&&!e.isStatementButNotDeclaration(t)||305!==r.kind&&i?-1:v(n,a,o)}function l(t,r,n,i){var a=e.findNextToken(t,r,i);return a?18===a.kind?1:19===a.kind&&n===u(a,i).line?2:0:0}function u(e,t){return t.getLineAndCharacterOfPosition(e.getStart(t))}function _(t,r,n,i){if(!e.isCallExpression(t)||!e.contains(t.arguments,r))return !1;var a=t.expression.getEnd();return e.getLineAndCharacterOfPosition(i,a).line===n}function d(t,r,n,i){if(239===t.kind&&t.elseStatement===r){var a=e.findChildOfKind(t,91,i);return e.Debug.assert(void 0!==a),u(a,i).line===n}return !1}function p(e,t){return e.parent&&f(e.getStart(t),e.getEnd(),e.parent,t)}function f(t,r,n,i){switch(n.kind){case 178:return a(n.typeArguments);case 205:return a(n.properties);case 204:return a(n.elements);case 182:return a(n.members);case 256:case 213:case 214:case 169:case 168:case 174:case 171:case 180:case 175:return a(n.typeParameters)||a(n.parameters);case 172:return a(n.parameters);case 257:case 226:case 258:case 259:case 344:return a(n.typeParameters);case 209:case 208:return a(n.typeArguments)||a(n.arguments);case 255:return a(n.declarations);case 269:case 273:return a(n.elements);case 201:case 202:return a(n.elements)}function a(a){return a&&e.rangeContainsStartEnd(function(e,t,r){for(var n=e.getChildren(r),i=1;i<n.length-1;i++)if(n[i].pos===t.pos&&n[i].end===t.end)return {pos:n[i-1].end,end:n[i+1].getStart(r)};return t}(n,a,i),t,r)?a:void 0}}function g(e,t,r){return e?v(t.getLineAndCharacterOfPosition(e.pos),t,r):-1}function m(e,t,r,n){if(e.parent&&255===e.parent.kind)return -1;var i=p(e,t);if(i){var a=i.indexOf(e);if(-1!==a){var o=y(i,a,t,r);if(-1!==o)return o}return g(i,t,r)+(n?r.indentSize:0)}return -1}function y(t,r,n,i){e.Debug.assert(r>=0&&r<t.length);for(var a=u(t[r],n),o=r-1;o>=0;o--)if(27!==t[o].kind){if(n.getLineAndCharacterOfPosition(t[o].end).line!==a.line)return v(a,n,i);a=u(t[o],n);}return -1}function v(e,t,r){var n=t.getPositionOfLineAndCharacter(e.line,0);return b(n,n+e.character,t,r)}function h(t,r,n,i){for(var a=0,o=0,s=t;s<r;s++){var c=n.text.charCodeAt(s);if(!e.isWhiteSpaceSingleLine(c))break;9===c?o+=i.tabSize+o%i.tabSize:o++,a++;}return {column:o,character:a}}function b(e,t,r,n){return h(e,t,r,n).column}function x(t,r,n,i,a){var o=n?n.kind:0;switch(r.kind){case 238:case 257:case 226:case 258:case 260:case 259:case 204:case 235:case 262:case 205:case 182:case 195:case 184:case 263:case 290:case 289:case 212:case 206:case 208:case 209:case 237:case 271:case 247:case 222:case 202:case 201:case 280:case 283:case 279:case 288:case 168:case 174:case 175:case 164:case 179:case 180:case 191:case 210:case 218:case 273:case 269:case 275:case 270:case 167:return !0;case 254:case 296:case 221:if(!t.indentMultiLineObjectLiteralBeginningOnBlankLine&&i&&205===o)return S(i,n);if(221===r.kind&&i&&n&&278===o)return i.getLineAndCharacterOfPosition(e.skipTrivia(i.text,r.pos)).line!==i.getLineAndCharacterOfPosition(e.skipTrivia(i.text,n.pos)).line;if(221!==r.kind)return !0;break;case 240:case 241:case 243:case 244:case 242:case 239:case 256:case 213:case 169:case 171:case 172:case 173:return 235!==o;case 214:return i&&212===o?S(i,n):235!==o;case 272:return 273!==o;case 266:return 267!==o||!!n.namedBindings&&269!==n.namedBindings.kind;case 278:return 281!==o;case 282:return 284!==o;case 188:case 187:if(182===o||184===o)return !1}return a}function D(e,t,r,n,i){return void 0===i&&(i=!1),x(e,t,r,n,!1)&&!(i&&r&&function(e,t){switch(e){case 247:case 251:case 245:case 246:return 235!==t.kind;default:return !1}}(r.kind,t))}function S(t,r){var n=e.skipTrivia(t.text,r.pos);return t.getLineAndCharacterOfPosition(n).line===t.getLineAndCharacterOfPosition(r.end).line}!function(e){e[e.Unknown=-1]="Unknown";}(n||(n={})),r.getIndentation=function(r,n,i,s){if(void 0===s&&(s=!1),r>n.text.length)return a(i);if(i.indentStyle===e.IndentStyle.None)return 0;var c=e.findPrecedingToken(r,n,void 0,!0),_=t.getRangeOfEnclosingComment(n,r,c||null);if(_&&3===_.kind)return function(t,r,n,i){var a=e.getLineAndCharacterOfPosition(t,r).line-1,o=e.getLineAndCharacterOfPosition(t,i.pos).line;if(e.Debug.assert(o>=0),a<=o)return b(e.getStartPositionOfLine(o,t),r,t,n);var s=e.getStartPositionOfLine(a,t),c=h(s,r,t,n),l=c.column,u=c.character;return 0===l?l:42===t.text.charCodeAt(s+u)?l-1:l}(n,r,i,_);if(!c)return a(i);if(e.isStringOrRegularExpressionOrTemplateLiteral(c.kind)&&c.getStart(n)<=r&&r<c.end)return 0;var d=n.getLineAndCharacterOfPosition(r).line,p=e.getTokenAtPosition(n,r),v=18===p.kind&&205===p.parent.kind;if(i.indentStyle===e.IndentStyle.Block||v)return function(t,r,n){for(var i=r;i>0;){var a=t.text.charCodeAt(i);if(!e.isWhiteSpaceLike(a))break;i--;}return b(e.getLineStartPositionForPosition(i,t),i,t,n)}(n,r,i);if(27===c.kind&&221!==c.parent.kind){var x=function(t,r,n){var i=e.findListItemInfo(t);return i&&i.listItemIndex>0?y(i.list.getChildren(),i.listItemIndex-1,r,n):-1}(c,n,i);if(-1!==x)return x}var S=function(e,t,r){return t&&f(e,e,t,r)}(r,c.parent,n);if(S&&!e.rangeContainsRange(S,c)){var T=-1!==[213,214].indexOf(p.parent.kind)?0:i.indentSize;return g(S,n,i)+T}return function(t,r,n,i,s,c){for(var _,d=n;d;){if(e.positionBelongsToNode(d,r,t)&&D(c,d,_,t,!0)){var p=u(d,t),f=l(n,d,i,t);return o(d,p,void 0,0!==f?s&&2===f?c.indentSize:0:i!==p.line?c.indentSize:0,t,!0,c)}var g=m(d,t,c,!0);if(-1!==g)return g;_=d,d=d.parent;}return a(c)}(n,r,c,d,s,i)},r.getIndentationForNode=function(e,t,r,n){var i=r.getLineAndCharacterOfPosition(e.getStart(r));return o(e,i,t,0,r,!1,n)},r.getBaseIndentation=a,function(e){e[e.Unknown=0]="Unknown",e[e.OpenBrace=1]="OpenBrace",e[e.CloseBrace=2]="CloseBrace";}(i||(i={})),r.isArgumentAndStartLineOverlapsExpressionBeingCalled=_,r.childStartsOnTheSameLineWithElseInIfStatement=d,r.childIsUnindentedBranchOfConditionalExpression=function(t,r,n,i){if(e.isConditionalExpression(t)&&(r===t.whenTrue||r===t.whenFalse)){var a=e.getLineAndCharacterOfPosition(i,t.condition.end).line;if(r===t.whenTrue)return n===a;var o=u(t.whenTrue,i).line,s=e.getLineAndCharacterOfPosition(i,t.whenTrue.end).line;return a===o&&s===n}return !1},r.argumentStartsOnSameLineAsPreviousArgument=function(t,r,n,i){if(e.isCallOrNewExpression(t)){if(!t.arguments)return !1;var a=e.find(t.arguments,(function(e){return e.pos===r.pos}));if(!a)return !1;var o=t.arguments.indexOf(a);if(0===o)return !1;var s=t.arguments[o-1];if(n===e.getLineAndCharacterOfPosition(i,s.getEnd()).line)return !0}return !1},r.getContainingList=p,r.findFirstNonWhitespaceCharacterAndColumn=h,r.findFirstNonWhitespaceColumn=b,r.nodeWillIndentChild=x,r.shouldIndentChildNode=D;})((t=e.formatting||(e.formatting={})).SmartIndenter||(t.SmartIndenter={}));}(t),function(e){!function(t){function r(t){var r=t.__pos;return e.Debug.assert("number"==typeof r),r}function a(t,r){e.Debug.assert("number"==typeof r),t.__pos=r;}function o(t){var r=t.__end;return e.Debug.assert("number"==typeof r),r}function s(t,r){e.Debug.assert("number"==typeof r),t.__end=r;}var c,l;function u(t,r){return e.skipTrivia(t,r,!1,!0)}!function(e){e[e.Exclude=0]="Exclude",e[e.IncludeAll=1]="IncludeAll",e[e.JSDoc=2]="JSDoc",e[e.StartLine=3]="StartLine";}(c=t.LeadingTriviaOption||(t.LeadingTriviaOption={})),function(e){e[e.Exclude=0]="Exclude",e[e.ExcludeWhitespace=1]="ExcludeWhitespace",e[e.Include=2]="Include";}(l=t.TrailingTriviaOption||(t.TrailingTriviaOption={}));var _,d={leadingTriviaOption:c.Exclude,trailingTriviaOption:l.Exclude};function p(e,t,r,n){return {pos:f(e,t,n),end:m(e,r,n)}}function f(t,r,n,i){var a,o;void 0===i&&(i=!1);var s=n.leadingTriviaOption;if(s===c.Exclude)return r.getStart(t);if(s===c.StartLine){var l=r.getStart(t),_=e.getLineStartPositionForPosition(l,t);return e.rangeContainsPosition(r,_)?_:l}if(s===c.JSDoc){var d=e.getJSDocCommentRanges(r,t.text);if(null==d?void 0:d.length)return e.getLineStartPositionForPosition(d[0].pos,t)}var p=r.getFullStart(),f=r.getStart(t);if(p===f)return f;var g=e.getLineStartPositionForPosition(p,t);if(e.getLineStartPositionForPosition(f,t)===g)return s===c.IncludeAll?p:f;if(i){var m=(null===(a=e.getLeadingCommentRanges(t.text,p))||void 0===a?void 0:a[0])||(null===(o=e.getTrailingCommentRanges(t.text,p))||void 0===o?void 0:o[0]);if(m)return e.skipTrivia(t.text,m.end,!0,!0)}var y=p>0?1:0,v=e.getStartPositionOfLine(e.getLineOfLocalPosition(t,g)+y,t);return v=u(t.text,v),e.getStartPositionOfLine(e.getLineOfLocalPosition(t,v),t)}function g(t,r,n){var i=r.end;if(n.trailingTriviaOption===l.Include){var a=e.getTrailingCommentRanges(t.text,i);if(a)for(var o=e.getLineOfLocalPosition(t,r.end),s=0,c=a;s<c.length;s++){var u=c[s];if(2===u.kind||e.getLineOfLocalPosition(t,u.pos)>o)break;if(e.getLineOfLocalPosition(t,u.end)>o)return e.skipTrivia(t.text,u.end,!0,!0)}}}function m(t,r,n){var i,a=r.end,o=n.trailingTriviaOption;if(o===l.Exclude)return a;if(o===l.ExcludeWhitespace){var s=e.concatenate(e.getTrailingCommentRanges(t.text,a),e.getLeadingCommentRanges(t.text,a));return (null===(i=null==s?void 0:s[s.length-1])||void 0===i?void 0:i.end)||a}var c=g(t,r,n);if(c)return c;var u=e.skipTrivia(t.text,a,!0);return u===a||o!==l.Include&&!e.isLineBreak(t.text.charCodeAt(u-1))?a:u}function y(e,t){return !!t&&!!e.parent&&(27===t.kind||26===t.kind&&205===e.parent.kind)}!function(e){e[e.Remove=0]="Remove",e[e.ReplaceWithSingleNode=1]="ReplaceWithSingleNode",e[e.ReplaceWithMultipleNodes=2]="ReplaceWithMultipleNodes",e[e.Text=3]="Text";}(_||(_={})),t.isThisTypeAnnotatable=function(t){return e.isFunctionExpression(t)||e.isFunctionDeclaration(t)};var v,h=function(){function t(t,r){this.newLineCharacter=t,this.formatContext=r,this.changes=[],this.newFiles=[],this.classesWithNodesInsertedAtStart=new e.Map,this.deletedNodes=[];}return t.fromContext=function(r){return new t(e.getNewLineOrDefaultFromHost(r.host,r.formatContext.options),r.formatContext)},t.with=function(e,r){var n=t.fromContext(e);return r(n),n.getChanges()},t.prototype.pushRaw=function(t,r){e.Debug.assertEqual(t.fileName,r.fileName);for(var n=0,i=r.textChanges;n<i.length;n++){var a=i[n];this.changes.push({kind:_.Text,sourceFile:t,text:a.newText,range:e.createTextRangeFromSpan(a.span)});}},t.prototype.deleteRange=function(e,t){this.changes.push({kind:_.Remove,sourceFile:e,range:t});},t.prototype.delete=function(e,t){this.deletedNodes.push({sourceFile:e,node:t});},t.prototype.deleteNode=function(e,t,r){void 0===r&&(r={leadingTriviaOption:c.IncludeAll}),this.deleteRange(e,p(e,t,t,r));},t.prototype.deleteNodes=function(e,t,r,n){void 0===r&&(r={leadingTriviaOption:c.IncludeAll});for(var i=0,a=t;i<a.length;i++){var o=a[i],s=f(e,o,r,n),l=m(e,o,r);this.deleteRange(e,{pos:s,end:l}),n=!!g(e,o,r);}},t.prototype.deleteModifier=function(t,r){this.deleteRange(t,{pos:r.getStart(t),end:e.skipTrivia(t.text,r.end,!0)});},t.prototype.deleteNodeRange=function(e,t,r,n){void 0===n&&(n={leadingTriviaOption:c.IncludeAll});var i=f(e,t,n),a=m(e,r,n);this.deleteRange(e,{pos:i,end:a});},t.prototype.deleteNodeRangeExcludingEnd=function(e,t,r,n){void 0===n&&(n={leadingTriviaOption:c.IncludeAll});var i=f(e,t,n),a=void 0===r?e.text.length:f(e,r,n);this.deleteRange(e,{pos:i,end:a});},t.prototype.replaceRange=function(e,t,r,n){void 0===n&&(n={}),this.changes.push({kind:_.ReplaceWithSingleNode,sourceFile:e,range:t,options:n,node:r});},t.prototype.replaceNode=function(e,t,r,n){void 0===n&&(n=d),this.replaceRange(e,p(e,t,t,n),r,n);},t.prototype.replaceNodeRange=function(e,t,r,n,i){void 0===i&&(i=d),this.replaceRange(e,p(e,t,r,i),n,i);},t.prototype.replaceRangeWithNodes=function(e,t,r,n){void 0===n&&(n={}),this.changes.push({kind:_.ReplaceWithMultipleNodes,sourceFile:e,range:t,options:n,nodes:r});},t.prototype.replaceNodeWithNodes=function(e,t,r,n){void 0===n&&(n=d),this.replaceRangeWithNodes(e,p(e,t,t,n),r,n);},t.prototype.replaceNodeWithText=function(e,t,r){this.replaceRangeWithText(e,p(e,t,t,d),r);},t.prototype.replaceNodeRangeWithNodes=function(e,t,r,n,i){void 0===i&&(i=d),this.replaceRangeWithNodes(e,p(e,t,r,i),n,i);},t.prototype.nodeHasTrailingComment=function(e,t,r){return void 0===r&&(r=d),!!g(e,t,r)},t.prototype.nextCommaToken=function(t,r){var n=e.findNextToken(r,r.parent,t);return n&&27===n.kind?n:void 0},t.prototype.replacePropertyAssignment=function(e,t,r){var n=this.nextCommaToken(e,t)?"":","+this.newLineCharacter;this.replaceNode(e,t,r,{suffix:n});},t.prototype.insertNodeAt=function(t,r,n,i){void 0===i&&(i={}),this.replaceRange(t,e.createRange(r),n,i);},t.prototype.insertNodesAt=function(t,r,n,i){void 0===i&&(i={}),this.replaceRangeWithNodes(t,e.createRange(r),n,i);},t.prototype.insertNodeAtTopOfFile=function(e,t,r){this.insertAtTopOfFile(e,t,r);},t.prototype.insertNodesAtTopOfFile=function(e,t,r){this.insertAtTopOfFile(e,t,r);},t.prototype.insertAtTopOfFile=function(t,r,n){var i=function(t){for(var r,n=0,i=t.statements;n<i.length;n++){var a=i[n];if(!e.isPrologueDirective(a))break;r=a;}var o=0,s=t.text;if(r)return o=r.end,g(),o;var c=e.getShebang(s);void 0!==c&&(o=c.length,g());var l,u,_=e.getLeadingCommentRanges(s,o);if(!_)return o;for(var d=0,p=_;d<p.length;d++){var f=p[d];if(3===f.kind){if(e.isPinnedComment(s,f.pos)){l={range:f,pinnedOrTripleSlash:!0};continue}}else if(e.isRecognizedTripleSlashComment(s,f.pos,f.end)){l={range:f,pinnedOrTripleSlash:!0};continue}if(l){if(l.pinnedOrTripleSlash)break;if(t.getLineAndCharacterOfPosition(f.pos).line>=t.getLineAndCharacterOfPosition(l.range.end).line+2)break}if(t.statements.length&&(void 0===u&&(u=t.getLineAndCharacterOfPosition(t.statements[0].getStart()).line),u<t.getLineAndCharacterOfPosition(f.end).line+2))break;l={range:f,pinnedOrTripleSlash:!1};}return l&&(o=l.range.end,g()),o;function g(){if(o<s.length){var t=s.charCodeAt(o);e.isLineBreak(t)&&++o<s.length&&13===t&&10===s.charCodeAt(o)&&o++;}}}(t),a={prefix:0===i?void 0:this.newLineCharacter,suffix:(e.isLineBreak(t.text.charCodeAt(i))?"":this.newLineCharacter)+(n?this.newLineCharacter:"")};e.isArray(r)?this.insertNodesAt(t,i,r,a):this.insertNodeAt(t,i,r,a);},t.prototype.insertFirstParameter=function(t,r,n){var i=e.firstOrUndefined(r);i?this.insertNodeBefore(t,i,n):this.insertNodeAt(t,r.pos,n);},t.prototype.insertNodeBefore=function(e,t,r,n,i){void 0===n&&(n=!1),void 0===i&&(i={}),this.insertNodeAt(e,f(e,t,i),r,this.getOptionsForInsertNodeBefore(t,r,n));},t.prototype.insertModifierAt=function(t,r,n,i){void 0===i&&(i={}),this.insertNodeAt(t,r,e.factory.createToken(n),i);},t.prototype.insertModifierBefore=function(e,t,r){return this.insertModifierAt(e,r.getStart(e),t,{suffix:" "})},t.prototype.insertCommentBeforeLine=function(t,r,n,i){var a=e.getStartPositionOfLine(r,t),o=e.getFirstNonSpaceCharacterPosition(t.text,a),s=N(t,o),c=e.getTouchingToken(t,s?o:n),l=t.text.slice(a,o),u="".concat(s?"":this.newLineCharacter,"//").concat(i).concat(this.newLineCharacter).concat(l);this.insertText(t,c.getStart(t),u);},t.prototype.insertJsdocCommentBefore=function(t,r,n){var i=r.getStart(t);if(r.jsDoc)for(var a=0,o=r.jsDoc;a<o.length;a++){var s=o[a];this.deleteRange(t,{pos:e.getLineStartPositionForPosition(s.getStart(t),t),end:m(t,s,{})});}var c=e.getPrecedingNonSpaceCharacterPosition(t.text,i-1),l=t.text.slice(c,i);this.insertNodeAt(t,i,n,{suffix:this.newLineCharacter+l});},t.prototype.createJSDocText=function(t,r){var n=e.flatMap(r.jsDoc,(function(t){return e.isString(t.comment)?e.factory.createJSDocText(t.comment):t.comment})),i=e.singleOrUndefined(r.jsDoc);return i&&e.positionsAreOnSameLine(i.pos,i.end,t)&&0===e.length(n)?void 0:e.factory.createNodeArray(e.intersperse(n,e.factory.createJSDocText("\n")))},t.prototype.replaceJSDocComment=function(t,r,n){this.insertJsdocCommentBefore(t,function(e){if(214!==e.kind)return e;var t=167===e.parent.kind?e.parent:e.parent.parent;return t.jsDoc=e.jsDoc,t.jsDocCache=e.jsDocCache,t}(r),e.factory.createJSDocComment(this.createJSDocText(t,r),e.factory.createNodeArray(n)));},t.prototype.addJSDocTags=function(t,r,i){var a=e.flatMapToMutable(r.jsDoc,(function(e){return e.tags})),o=i.filter((function(t){return !a.some((function(r,n){var i=function(t,r){if(t.kind===r.kind)switch(t.kind){case 340:var n=t,i=r;return e.isIdentifier(n.name)&&e.isIdentifier(i.name)&&n.name.escapedText===i.name.escapedText?e.factory.createJSDocParameterTag(void 0,i.name,!1,i.typeExpression,i.isNameFirst,n.comment):void 0;case 341:return e.factory.createJSDocReturnTag(void 0,r.typeExpression,t.comment);case 343:return e.factory.createJSDocTypeTag(void 0,r.typeExpression,t.comment)}}(r,t);return i&&(a[n]=i),!!i}))}));this.replaceJSDocComment(t,r,n$4(n$4([],a,!0),o,!0));},t.prototype.filterJSDocTags=function(t,r,n){this.replaceJSDocComment(t,r,e.filter(e.flatMapToMutable(r.jsDoc,(function(e){return e.tags})),n));},t.prototype.replaceRangeWithText=function(e,t,r){this.changes.push({kind:_.Text,sourceFile:e,range:t,text:r});},t.prototype.insertText=function(t,r,n){this.replaceRangeWithText(t,e.createRange(r),n);},t.prototype.tryInsertTypeAnnotation=function(t,r,n){var i,a;if(e.isFunctionLike(r)){if(!(a=e.findChildOfKind(r,21,t))){if(!e.isArrowFunction(r))return !1;a=e.first(r.parameters);}}else a=null!==(i=254===r.kind?r.exclamationToken:r.questionToken)&&void 0!==i?i:r.name;return this.insertNodeAt(t,a.end,n,{prefix:": "}),!0},t.prototype.tryInsertThisTypeAnnotation=function(t,r,n){var i=e.findChildOfKind(r,20,t).getStart(t)+1,a=r.parameters.length?", ":"";this.insertNodeAt(t,i,n,{prefix:"this: ",suffix:a});},t.prototype.insertTypeParameters=function(t,r,n){var i=(e.findChildOfKind(r,20,t)||e.first(r.parameters)).getStart(t);this.insertNodesAt(t,i,n,{prefix:"<",suffix:">",joiner:", "});},t.prototype.getOptionsForInsertNodeBefore=function(t,r,n){return e.isStatement(t)||e.isClassElement(t)?{suffix:n?this.newLineCharacter+this.newLineCharacter:this.newLineCharacter}:e.isVariableDeclaration(t)?{suffix:", "}:e.isParameter(t)?e.isParameter(r)?{suffix:", "}:{}:e.isStringLiteral(t)&&e.isImportDeclaration(t.parent)||e.isNamedImports(t)?{suffix:", "}:e.isImportSpecifier(t)?{suffix:","+(n?this.newLineCharacter:" ")}:e.Debug.failBadSyntaxKind(t)},t.prototype.insertNodeAtConstructorStart=function(t,r,i){var a=e.firstOrUndefined(r.body.statements);a&&r.body.multiLine?this.insertNodeBefore(t,a,i):this.replaceConstructorBody(t,r,n$4([i],r.body.statements,!0));},t.prototype.insertNodeAtConstructorStartAfterSuperCall=function(t,r,i){var a=e.find(r.body.statements,(function(t){return e.isExpressionStatement(t)&&e.isSuperCall(t.expression)}));a&&r.body.multiLine?this.insertNodeAfter(t,a,i):this.replaceConstructorBody(t,r,n$4(n$4([],r.body.statements,!0),[i],!1));},t.prototype.insertNodeAtConstructorEnd=function(t,r,i){var a=e.lastOrUndefined(r.body.statements);a&&r.body.multiLine?this.insertNodeAfter(t,a,i):this.replaceConstructorBody(t,r,n$4(n$4([],r.body.statements,!0),[i],!1));},t.prototype.replaceConstructorBody=function(t,r,n){this.replaceNode(t,r.body,e.factory.createBlock(n,!0));},t.prototype.insertNodeAtEndOfScope=function(t,r,n){var i=f(t,r.getLastToken(),{});this.insertNodeAt(t,i,n,{prefix:e.isLineBreak(t.text.charCodeAt(r.getLastToken().pos))?this.newLineCharacter:this.newLineCharacter+this.newLineCharacter,suffix:this.newLineCharacter});},t.prototype.insertMemberAtStart=function(e,t,r){this.insertNodeAtStartWorker(e,t,r);},t.prototype.insertNodeAtObjectStart=function(e,t,r){this.insertNodeAtStartWorker(e,t,r);},t.prototype.insertNodeAtStartWorker=function(e,t,r){var n,i=null!==(n=this.guessIndentationFromExistingMembers(e,t))&&void 0!==n?n:this.computeIndentationForNewMember(e,t);this.insertNodeAt(e,x(t).pos,r,this.getInsertNodeAtStartInsertOptions(e,t,i));},t.prototype.guessIndentationFromExistingMembers=function(t,r){for(var n,i=r,a=0,o=x(r);a<o.length;a++){var s=o[a];if(e.rangeStartPositionsAreOnSameLine(i,s,t))return;var c=s.getStart(t),l=e.formatting.SmartIndenter.findFirstNonWhitespaceColumn(e.getLineStartPositionForPosition(c,t),c,t,this.formatContext.options);if(void 0===n)n=l;else if(l!==n)return;i=s;}return n},t.prototype.computeIndentationForNewMember=function(t,r){var n,i=r.getStart(t);return e.formatting.SmartIndenter.findFirstNonWhitespaceColumn(e.getLineStartPositionForPosition(i,t),i,t,this.formatContext.options)+(null!==(n=this.formatContext.options.indentSize)&&void 0!==n?n:4)},t.prototype.getInsertNodeAtStartInsertOptions=function(t,r,n){var i=0===x(r).length,a=e.addToSeen(this.classesWithNodesInsertedAtStart,e.getNodeId(r),{node:r,sourceFile:t}),o=e.isObjectLiteralExpression(r)&&(!e.isJsonSourceFile(t)||!i);return {indentation:n,prefix:(e.isObjectLiteralExpression(r)&&e.isJsonSourceFile(t)&&i&&!a?",":"")+this.newLineCharacter,suffix:o?",":""}},t.prototype.insertNodeAfterComma=function(e,t,r){var n=this.insertNodeAfterWorker(e,this.nextCommaToken(e,t)||t,r);this.insertNodeAt(e,n,r,this.getInsertNodeAfterOptions(e,t));},t.prototype.insertNodeAfter=function(e,t,r){var n=this.insertNodeAfterWorker(e,t,r);this.insertNodeAt(e,n,r,this.getInsertNodeAfterOptions(e,t));},t.prototype.insertNodeAtEndOfList=function(e,t,r){this.insertNodeAt(e,t.end,r,{prefix:", "});},t.prototype.insertNodesAfter=function(t,r,n){var i=this.insertNodeAfterWorker(t,r,e.first(n));this.insertNodesAt(t,i,n,this.getInsertNodeAfterOptions(t,r));},t.prototype.insertNodeAfterWorker=function(t,r,n){var i,a;return i=r,a=n,((e.isPropertySignature(i)||e.isPropertyDeclaration(i))&&e.isClassOrTypeElement(a)&&162===a.name.kind||e.isStatementButNotDeclaration(i)&&e.isStatementButNotDeclaration(a))&&59!==t.text.charCodeAt(r.end-1)&&this.replaceRange(t,e.createRange(r.end),e.factory.createToken(26)),m(t,r,{})},t.prototype.getInsertNodeAfterOptions=function(t,r){var n=this.getInsertNodeAfterOptionsWorker(r);return i$1(i$1({},n),{prefix:r.end===t.end&&e.isStatement(r)?n.prefix?"\n".concat(n.prefix):"\n":n.prefix})},t.prototype.getInsertNodeAfterOptionsWorker=function(t){switch(t.kind){case 257:case 261:return {prefix:this.newLineCharacter,suffix:this.newLineCharacter};case 254:case 10:case 79:return {prefix:", "};case 296:return {suffix:","+this.newLineCharacter};case 93:return {prefix:" "};case 164:return {};default:return e.Debug.assert(e.isStatement(t)||e.isClassOrTypeElement(t)),{suffix:this.newLineCharacter}}},t.prototype.insertName=function(t,r,n){if(e.Debug.assert(!r.name),214===r.kind){var i=e.findChildOfKind(r,38,t),a=e.findChildOfKind(r,20,t);a?(this.insertNodesAt(t,a.getStart(t),[e.factory.createToken(98),e.factory.createIdentifier(n)],{joiner:" "}),F(this,t,i)):(this.insertText(t,e.first(r.parameters).getStart(t),"function ".concat(n,"(")),this.replaceRange(t,i,e.factory.createToken(21))),235!==r.body.kind&&(this.insertNodesAt(t,r.body.getStart(t),[e.factory.createToken(18),e.factory.createToken(105)],{joiner:" ",suffix:" "}),this.insertNodesAt(t,r.body.end,[e.factory.createToken(26),e.factory.createToken(19)],{joiner:" "}));}else {var o=e.findChildOfKind(r,213===r.kind?98:84,t).end;this.insertNodeAt(t,o,e.factory.createIdentifier(n),{prefix:" "});}},t.prototype.insertExportModifier=function(e,t){this.insertText(e,t.getStart(e),"export ");},t.prototype.insertImportSpecifierAtIndex=function(t,r,n,i){var a=n.elements[i-1];a?this.insertNodeInListAfter(t,a,r):this.insertNodeBefore(t,n.elements[0],r,!e.positionsAreOnSameLine(n.elements[0].getStart(),n.parent.parent.getStart(),t));},t.prototype.insertNodeInListAfter=function(t,r,n,i){if(void 0===i&&(i=e.formatting.SmartIndenter.getContainingList(r,t)),i){var a=e.indexOfNode(i,r);if(!(a<0)){var o=r.getEnd();if(a!==i.length-1){var s=e.getTokenAtPosition(t,r.end);if(s&&y(r,s)){var c=i[a+1],l=u(t.text,c.getFullStart()),_="".concat(e.tokenToString(s.kind)).concat(t.text.substring(s.end,l));this.insertNodesAt(t,l,[n],{suffix:_});}}else {var d=r.getStart(t),p=e.getLineStartPositionForPosition(d,t),f=void 0,g=!1;if(1===i.length)f=27;else {var m=e.findPrecedingToken(r.pos,t);f=y(r,m)?m.kind:27,g=e.getLineStartPositionForPosition(i[a-1].getStart(t),t)!==p;}if(function(t,r){for(var n=r;n<t.length;){var i=t.charCodeAt(n);if(!e.isWhiteSpaceSingleLine(i))return 47===i;n++;}return !1}(t.text,r.end)&&(g=!0),g){this.replaceRange(t,e.createRange(o),e.factory.createToken(f));for(var v=e.formatting.SmartIndenter.findFirstNonWhitespaceColumn(p,d,t,this.formatContext.options),h=e.skipTrivia(t.text,o,!0,!1);h!==o&&e.isLineBreak(t.text.charCodeAt(h-1));)h--;this.replaceRange(t,e.createRange(h),n,{indentation:v,prefix:this.newLineCharacter});}else this.replaceRange(t,e.createRange(o),n,{prefix:"".concat(e.tokenToString(f)," ")});}}}else e.Debug.fail("node is not a list element");},t.prototype.parenthesizeExpression=function(t,r){this.replaceRange(t,e.rangeOfNode(r),e.factory.createParenthesizedExpression(r));},t.prototype.finishClassesWithNodesInsertedAtStart=function(){var t=this;this.classesWithNodesInsertedAtStart.forEach((function(r){var n=r.node,i=r.sourceFile,a=function(t,r){var n=e.findChildOfKind(t,18,r),i=e.findChildOfKind(t,19,r);return [null==n?void 0:n.end,null==i?void 0:i.end]}(n,i),o=a[0],s=a[1];if(void 0!==o&&void 0!==s){var c=0===x(n).length,l=e.positionsAreOnSameLine(o,s,i);c&&l&&o!==s-1&&t.deleteRange(i,e.createRange(o,s-1)),l&&t.insertText(i,s-1,t.newLineCharacter);}}));},t.prototype.finishDeleteDeclarations=function(){for(var t=this,r=new e.Set,n=function(t,n){i.deletedNodes.some((function(r){return r.sourceFile===t&&e.rangeContainsRangeExclusive(r.node,n)}))||(e.isArray(n)?i.deleteRange(t,e.rangeOfTypeParameters(t,n)):S.deleteDeclaration(i,r,t,n));},i=this,a=0,o=this.deletedNodes;a<o.length;a++){var s=o[a];n(s.sourceFile,s.node);}r.forEach((function(n){var i=n.getSourceFile(),a=e.formatting.SmartIndenter.getContainingList(n,i);if(n===e.last(a)){var o=e.findLastIndex(a,(function(e){return !r.has(e)}),a.length-2);-1!==o&&t.deleteRange(i,{pos:a[o].end,end:b(i,a[o+1])});}}));},t.prototype.getChanges=function(e){this.finishDeleteDeclarations(),this.finishClassesWithNodesInsertedAtStart();for(var t=v.getTextChangesFromChanges(this.changes,this.newLineCharacter,this.formatContext,e),r=0,n=this.newFiles;r<n.length;r++){var i=n[r],a=i.oldFile,o=i.fileName,s=i.statements;t.push(v.newFileChanges(a,o,s,this.newLineCharacter,this.formatContext));}return t},t.prototype.createNewFile=function(e,t,r){this.newFiles.push({oldFile:e,fileName:t,statements:r});},t}();function b(t,r){return e.skipTrivia(t.text,f(t,r,{leadingTriviaOption:c.IncludeAll}),!1,!0)}function x(t){return e.isObjectLiteralExpression(t)?t.properties:t.members}function D(t,r){for(var n=r.length-1;n>=0;n--){var i=r[n],a=i.span,o=i.newText;t="".concat(t.substring(0,a.start)).concat(o).concat(t.substring(e.textSpanEnd(a)));}return t}t.ChangeTracker=h,t.getNewFileText=function(e,t,r,n){return v.newFileChangesWorker(void 0,t,e,r,n)},function(t){function r(t,r,i,a,o){var s=i.map((function(e){return 4===e?"":n(e,t,a).text})).join(a),c=e.createSourceFile("any file name",s,99,!0,r);return D(s,e.formatting.formatDocument(c,o))+a}function n(t,r,n){var i=E(n),a=e.getNewLineKind(n);return e.createPrinter({newLine:a,neverAsciiEscape:!0,preserveSourceNewlines:!0,terminateUnterminatedLiterals:!0},i).writeNode(4,t,r,i),{text:i.getText(),node:C(t)}}t.getTextChangesFromChanges=function(t,r,a,o){return e.mapDefined(e.group(t,(function(e){return e.sourceFile.path})),(function(t){for(var s=t[0].sourceFile,c=e.stableSort(t,(function(e,t){return e.range.pos-t.range.pos||e.range.end-t.range.end})),l=function(t){e.Debug.assert(c[t].range.end<=c[t+1].range.pos,"Changes overlap",(function(){return "".concat(JSON.stringify(c[t].range)," and ").concat(JSON.stringify(c[t+1].range))}));},u=0;u<c.length-1;u++)l(u);var d=e.mapDefined(c,(function(t){var c=e.createTextSpanFromRange(t.range),l=function(t,r,a,o,s){var c;if(t.kind===_.Remove)return "";if(t.kind===_.Text)return t.text;var l=t.options,u=void 0===l?{}:l,d=t.range.pos,p=function(t){return function(t,r,a,o,s,c,l){var u=o.indentation,_=o.prefix,d=o.delta,p=n(t,r,s),f=p.node,g=p.text;l&&l(f,g);var m=e.getFormatCodeSettingsForWriting(c,r),y=void 0!==u?u:e.formatting.SmartIndenter.getIndentation(a,r,m,_===s||e.getLineStartPositionForPosition(a,r)===a);void 0===d&&(d=e.formatting.SmartIndenter.shouldIndentChildNode(m,t)&&m.indentSize||0);var v={text:g,getLineAndCharacterOfPosition:function(t){return e.getLineAndCharacterOfPosition(this,t)}};return D(g,e.formatting.formatNodeGivenIndentation(f,v,r.languageVariant,y,d,i$1(i$1({},c),{options:m})))}(t,r,d,u,a,o,s)},f=t.kind===_.ReplaceWithMultipleNodes?t.nodes.map((function(t){return e.removeSuffix(p(t),a)})).join((null===(c=t.options)||void 0===c?void 0:c.joiner)||a):p(t.node),g=void 0!==u.indentation||e.getLineStartPositionForPosition(d,r)===d?f:f.replace(/^\s+/,"");return (u.prefix||"")+g+(!u.suffix||e.endsWith(g,u.suffix)?"":u.suffix)}(t,s,r,a,o);if(c.length!==l.length||!e.stringContainsAt(s.text,l,c.start))return e.createTextChange(c,l)}));return d.length>0?{fileName:s.fileName,textChanges:d}:void 0}))},t.newFileChanges=function(t,n,i,a,o){var s=r(t,e.getScriptKindFromFileName(n),i,a,o);return {fileName:n,textChanges:[e.createTextChange(e.createTextSpan(0,0),s)],isNewFile:!0}},t.newFileChangesWorker=r,t.getNonformattedText=n;}(v||(v={})),t.applyChanges=D;var S,T=i$1(i$1({},e.nullTransformationContext),{factory:e.createNodeFactory(1|e.nullTransformationContext.factory.flags,e.nullTransformationContext.factory.baseFactory)});function C(t){var n=e.visitEachChild(t,C,T,k,C),i=e.nodeIsSynthesized(n)?n:Object.create(n);return e.setTextRangePosEnd(i,r(t),o(t)),i}function k(t,n,i,a,s){var c=e.visitNodes(t,n,i,a,s);if(!c)return c;var l=c===t?e.factory.createNodeArray(c.slice(0)):c;return e.setTextRangePosEnd(l,r(t),o(t)),l}function E(t){var r=0,n=e.createTextWriter(t);function i(t,i){if(i||!function(t){return e.skipTrivia(t,0)===t.length}(t)){r=n.getTextPos();for(var a=0;e.isWhiteSpaceLike(t.charCodeAt(t.length-a-1));)a++;r-=a;}}return {onBeforeEmitNode:function(e){e&&a(e,r);},onAfterEmitNode:function(e){e&&s(e,r);},onBeforeEmitNodeArray:function(e){e&&a(e,r);},onAfterEmitNodeArray:function(e){e&&s(e,r);},onBeforeEmitToken:function(e){e&&a(e,r);},onAfterEmitToken:function(e){e&&s(e,r);},write:function(e){n.write(e),i(e,!1);},writeComment:function(e){n.writeComment(e);},writeKeyword:function(e){n.writeKeyword(e),i(e,!1);},writeOperator:function(e){n.writeOperator(e),i(e,!1);},writePunctuation:function(e){n.writePunctuation(e),i(e,!1);},writeTrailingSemicolon:function(e){n.writeTrailingSemicolon(e),i(e,!1);},writeParameter:function(e){n.writeParameter(e),i(e,!1);},writeProperty:function(e){n.writeProperty(e),i(e,!1);},writeSpace:function(e){n.writeSpace(e),i(e,!1);},writeStringLiteral:function(e){n.writeStringLiteral(e),i(e,!1);},writeSymbol:function(e,t){n.writeSymbol(e,t),i(e,!1);},writeLine:function(e){n.writeLine(e);},increaseIndent:function(){n.increaseIndent();},decreaseIndent:function(){n.decreaseIndent();},getText:function(){return n.getText()},rawWrite:function(e){n.rawWrite(e),i(e,!1);},writeLiteral:function(e){n.writeLiteral(e),i(e,!0);},getTextPos:function(){return n.getTextPos()},getLine:function(){return n.getLine()},getColumn:function(){return n.getColumn()},getIndent:function(){return n.getIndent()},isAtStartOfLine:function(){return n.isAtStartOfLine()},hasTrailingComment:function(){return n.hasTrailingComment()},hasTrailingWhitespace:function(){return n.hasTrailingWhitespace()},clear:function(){n.clear(),r=0;}}}function N(t,r){return !(e.isInComment(t,r)||e.isInString(t,r)||e.isInTemplateString(t,r)||e.isInJSXText(t,r))}function F(e,t,r,n){void 0===n&&(n={leadingTriviaOption:c.IncludeAll});var i=f(t,r,n),a=m(t,r,n);e.deleteRange(t,{pos:i,end:a});}function A(t,r,n,i){var a=e.Debug.checkDefined(e.formatting.SmartIndenter.getContainingList(i,n)),o=e.indexOfNode(a,i);e.Debug.assert(-1!==o),1!==a.length?(e.Debug.assert(!r.has(i),"Deleting a node twice"),r.add(i),t.deleteRange(n,{pos:b(n,i),end:o===a.length-1?m(n,i,{}):b(n,a[o+1])})):F(t,n,i);}t.assignPositionsToNode=C,t.createWriter=E,t.isValidLocationToAddComment=N,function(t){function r(t,r,n){if(n.parent.name){var i=e.Debug.checkDefined(e.getTokenAtPosition(r,n.pos-1));t.deleteRange(r,{pos:i.getStart(r),end:n.end});}else F(t,r,e.getAncestor(n,266));}t.deleteDeclaration=function(t,n,i,a){switch(a.kind){case 164:var o=a.parent;e.isArrowFunction(o)&&1===o.parameters.length&&!e.findChildOfKind(o,20,i)?t.replaceNodeWithText(i,a,"()"):A(t,n,i,a);break;case 266:case 265:F(t,i,a,{leadingTriviaOption:i.imports.length&&a===e.first(i.imports).parent||a===e.find(i.statements,e.isAnyImportSyntax)?c.Exclude:e.hasJSDocNodes(a)?c.JSDoc:c.StartLine});break;case 203:var s=a.parent;202===s.kind&&a!==e.last(s.elements)?F(t,i,a):A(t,n,i,a);break;case 254:!function(t,r,n,i){var a=i.parent;if(292!==a.kind)if(1===a.declarations.length){var o=a.parent;switch(o.kind){case 244:case 243:t.replaceNode(n,i,e.factory.createObjectLiteralExpression());break;case 242:F(t,n,a);break;case 237:F(t,n,o,{leadingTriviaOption:e.hasJSDocNodes(o)?c.JSDoc:c.StartLine});break;default:e.Debug.assertNever(o);}}else A(t,r,n,i);else t.deleteNodeRange(n,e.findChildOfKind(a,20,n),e.findChildOfKind(a,21,n));}(t,n,i,a);break;case 163:A(t,n,i,a);break;case 270:var u=a.parent;1===u.elements.length?r(t,i,u):A(t,n,i,a);break;case 268:r(t,i,a);break;case 26:F(t,i,a,{trailingTriviaOption:l.Exclude});break;case 98:F(t,i,a,{leadingTriviaOption:c.Exclude});break;case 257:case 256:F(t,i,a,{leadingTriviaOption:e.hasJSDocNodes(a)?c.JSDoc:c.StartLine});break;default:a.parent?e.isImportClause(a.parent)&&a.parent.name===a?function(t,r,n){if(n.namedBindings){var i=n.name.getStart(r),a=e.getTokenAtPosition(r,n.name.end);if(a&&27===a.kind){var o=e.skipTrivia(r.text,a.end,!1,!0);t.deleteRange(r,{pos:i,end:o});}else F(t,r,n.name);}else F(t,r,n.parent);}(t,i,a.parent):e.isCallExpression(a.parent)&&e.contains(a.parent.arguments,a)?A(t,n,i,a):F(t,i,a):F(t,i,a);}};}(S||(S={})),t.deleteNode=F;}(e.textChanges||(e.textChanges={}));}(t),function(e){!function(t){var r=e.createMultiMap(),a=new e.Map;function o(e,t,r,n,i,a){return {fixName:e,description:t,changes:r,fixId:n,fixAllDescription:i,commands:a?[a]:void 0}}function c(e,t){return {changes:e,commands:t}}function l(t,r,n){for(var i=0,a=u(t);i<a.length;i++){var o=a[i];e.contains(r,o.code)&&n(o);}}function u(t){var r=t.program,i=t.sourceFile,a=t.cancellationToken;return n$4(n$4(n$4([],r.getSemanticDiagnostics(i,a),!0),r.getSyntacticDiagnostics(i,a),!0),e.computeSuggestionDiagnostics(i,r,a),!0)}t.createCodeFixActionWithoutFixAll=function(t,r,n){return o(t,e.diagnosticToString(n),r,void 0,void 0)},t.createCodeFixAction=function(t,r,n,i,a,s){return o(t,e.diagnosticToString(n),r,i,e.diagnosticToString(a),s)},t.createCodeFixActionMaybeFixAll=function(t,r,n,i,a,s){return o(t,e.diagnosticToString(n),r,i,a&&e.diagnosticToString(a),s)},t.registerCodeFix=function(t){for(var n=0,i=t.errorCodes;n<i.length;n++){var o=i[n];r.add(String(o),t);}if(t.fixIds)for(var s=0,c=t.fixIds;s<c.length;s++){var l=c[s];e.Debug.assert(!a.has(l)),a.set(l,t);}},t.getSupportedErrorCodes=function(){return e.arrayFrom(r.keys())},t.getFixes=function(t){var n=u(t),a=r.get(String(t.errorCode));return e.flatMap(a,(function(r){return e.map(r.getCodeActions(t),function(t,r){for(var n=t.errorCodes,a=0,o=0,c=r;o<c.length;o++){var l=c[o];if(e.contains(n,l.code)&&a++,a>1)break}var u=a<2;return function(e){var t=e.fixId,r=e.fixAllDescription,n=s(e,["fixId","fixAllDescription"]);return u?n:i$1(i$1({},n),{fixId:t,fixAllDescription:r})}}(r,n))}))},t.getAllFixes=function(t){return a.get(e.cast(t.fixId,e.isString)).getAllCodeActions(t)},t.createCombinedCodeActions=c,t.createFileTextChanges=function(e,t){return {fileName:e,textChanges:t}},t.codeFixAll=function(t,r,n){var i=[];return c(e.textChanges.ChangeTracker.with(t,(function(e){return l(t,r,(function(t){return n(e,t,i)}))})),0===i.length?void 0:i)},t.eachDiagnostic=l;}(e.codefix||(e.codefix={}));}(t),function(e){var t,r;t=e.refactor||(e.refactor={}),r=new e.Map,t.registerRefactor=function(e,t){r.set(e,t);},t.getApplicableRefactors=function(n){return e.arrayFrom(e.flatMapIterator(r.values(),(function(e){var r;return n.cancellationToken&&n.cancellationToken.isCancellationRequested()||!(null===(r=e.kinds)||void 0===r?void 0:r.some((function(e){return t.refactorKindBeginsWith(e,n.kind)})))?void 0:e.getAvailableActions(n)})))},t.getEditsForRefactor=function(e,t,n){var i=r.get(t);return i&&i.getEditsForAction(e,n)};}(t),function(e){!function(t){var r="addConvertToUnknownForNonOverlappingTypes",n=[e.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code];function i(t,r,n){var i=e.isAsExpression(n)?e.factory.createAsExpression(n.expression,e.factory.createKeywordTypeNode(155)):e.factory.createTypeAssertion(e.factory.createKeywordTypeNode(155),n.expression);t.replaceNode(r,n.expression,i);}function a(t,r){if(!e.isInJSFile(t))return e.findAncestor(e.getTokenAtPosition(t,r),(function(t){return e.isAsExpression(t)||e.isTypeAssertionExpression(t)}))}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=a(n.sourceFile,n.span.start);if(void 0!==o){var s=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,o)}));return [t.createCodeFixAction(r,s,e.Diagnostics.Add_unknown_conversion_for_non_overlapping_types,r,e.Diagnostics.Add_unknown_to_all_conversions_of_non_overlapping_types)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){var r=a(t.file,t.start);r&&i(e,t.file,r);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){var t;(t=e.codefix||(e.codefix={})).registerCodeFix({errorCodes:[e.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,e.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code],getCodeActions:function(r){var n=r.sourceFile,i=e.textChanges.ChangeTracker.with(r,(function(t){var r=e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports([]),void 0);t.insertNodeAtEndOfScope(n,n,r);}));return [t.createCodeFixActionWithoutFixAll("addEmptyExportDeclaration",i,e.Diagnostics.Add_export_to_make_this_file_into_a_module)]}});}(t),function(e){!function(t){var r="addMissingAsync",n=[e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,e.Diagnostics.Type_0_is_not_assignable_to_type_1.code,e.Diagnostics.Type_0_is_not_comparable_to_type_1.code];function i(n,i,a,o){var s=a((function(t){return function(t,r,n,i){if(!i||!i.has(e.getNodeId(n))){null==i||i.add(e.getNodeId(n));var a=e.factory.updateModifiers(e.getSynthesizedDeepClone(n,!0),e.factory.createNodeArray(e.factory.createModifiersFromModifierFlags(256|e.getSyntacticModifierFlags(n))));t.replaceNode(r,n,a);}}(t,n.sourceFile,i,o)}));return t.createCodeFixAction(r,s,e.Diagnostics.Add_async_modifier_to_containing_function,r,e.Diagnostics.Add_all_missing_async_modifiers)}function a(t,r){if(r){var n=e.getTokenAtPosition(t,r.start);return e.findAncestor(n,(function(n){return n.getStart(t)<r.start||n.getEnd()>e.textSpanEnd(r)?"quit":(e.isArrowFunction(n)||e.isMethodDeclaration(n)||e.isFunctionExpression(n)||e.isFunctionDeclaration(n))&&e.textSpansEqual(r,e.createTextSpanFromNode(n,t))}))}}t.registerCodeFix({fixIds:[r],errorCodes:n,getCodeActions:function(t){var r=t.sourceFile,n=t.errorCode,o=t.cancellationToken,s=t.program,c=t.span,l=e.find(s.getTypeChecker().getDiagnostics(r,o),function(t,r){return function(n){var i=n.start,a=n.length,o=n.relatedInformation,s=n.code;return e.isNumber(i)&&e.isNumber(a)&&e.textSpansEqual({start:i,length:a},t)&&s===r&&!!o&&e.some(o,(function(t){return t.code===e.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code}))}}(c,n)),u=a(r,l&&l.relatedInformation&&e.find(l.relatedInformation,(function(t){return t.code===e.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code})));if(u)return [i(t,u,(function(r){return e.textChanges.ChangeTracker.with(t,r)}))]},getAllCodeActions:function(r){var o=r.sourceFile,s=new e.Set;return t.codeFixAll(r,n,(function(t,n){var c=n.relatedInformation&&e.find(n.relatedInformation,(function(t){return t.code===e.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code})),l=a(o,c);if(l)return i(r,l,(function(e){return e(t),[]}),s)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addMissingAwait",i=e.Diagnostics.Property_0_does_not_exist_on_type_1.code,a=[e.Diagnostics.This_expression_is_not_callable.code,e.Diagnostics.This_expression_is_not_constructable.code],o=n$4([e.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type.code,e.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code,e.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code,e.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code,e.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code,e.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code,e.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code,e.Diagnostics.Type_0_is_not_an_array_type.code,e.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code,e.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code,e.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,e.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,e.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code,e.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator.code,e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,i],a,!0);function s(t,r,n,i,a){var o=e.getFixableErrorSpanExpression(t,n);return o&&function(t,r,n,i,a){var o=a.getTypeChecker().getDiagnostics(t,i);return e.some(o,(function(t){var i=t.start,a=t.length,o=t.relatedInformation,s=t.code;return e.isNumber(i)&&e.isNumber(a)&&e.textSpansEqual({start:i,length:a},n)&&s===r&&!!o&&e.some(o,(function(t){return t.code===e.Diagnostics.Did_you_forget_to_use_await.code}))}))}(t,r,n,i,a)&&u(o)?o:void 0}function c(r,n,i,a,s,c){var l=r.sourceFile,d=r.program,p=r.cancellationToken,f=function(t,r,n,i,a){var s=function(t,r){if(e.isPropertyAccessExpression(t.parent)&&e.isIdentifier(t.parent.expression))return {identifiers:[t.parent.expression],isCompleteFix:!0};if(e.isIdentifier(t))return {identifiers:[t],isCompleteFix:!0};if(e.isBinaryExpression(t)){for(var n=void 0,i=!0,a=0,o=[t.left,t.right];a<o.length;a++){var s=o[a],c=r.getTypeAtLocation(s);if(r.getPromisedTypeOfPromise(c)){if(!e.isIdentifier(s)){i=!1;continue}(n||(n=[])).push(s);}}return n&&{identifiers:n,isCompleteFix:i}}}(t,a);if(s){for(var c,l=s.isCompleteFix,_=function(t){var s=a.getSymbolAtLocation(t);if(!s)return "continue";var _=e.tryCast(s.valueDeclaration,e.isVariableDeclaration),d=_&&e.tryCast(_.name,e.isIdentifier),p=e.getAncestor(_,237);if(!_||!p||_.type||!_.initializer||p.getSourceFile()!==r||e.hasSyntacticModifier(p,1)||!d||!u(_.initializer))return l=!1,"continue";var f=i.getSemanticDiagnostics(r,n);if(e.FindAllReferences.Core.eachSymbolReferenceInFile(d,a,r,(function(n){return t!==n&&!function(t,r,n,i){var a=e.isPropertyAccessExpression(t.parent)?t.parent.name:e.isBinaryExpression(t.parent)?t.parent:t,s=e.find(r,(function(e){return e.start===a.getStart(n)&&e.start+e.length===a.getEnd()}));return s&&e.contains(o,s.code)||1&i.getTypeAtLocation(a).flags}(n,f,r,a)})))return l=!1,"continue";(c||(c=[])).push({expression:_.initializer,declarationSymbol:s});},d=0,p=s.identifiers;d<p.length;d++)_(p[d]);return c&&{initializers:c,needsSecondPassForFixAll:!l}}}(n,l,p,d,a);if(f){var g=s((function(t){e.forEach(f.initializers,(function(e){var r=e.expression;return _(t,i,l,a,r,c)})),c&&f.needsSecondPassForFixAll&&_(t,i,l,a,n,c);}));return t.createCodeFixActionWithoutFixAll("addMissingAwaitToInitializer",g,1===f.initializers.length?[e.Diagnostics.Add_await_to_initializer_for_0,f.initializers[0].declarationSymbol.name]:e.Diagnostics.Add_await_to_initializers)}}function l(n,i,a,o,s,c){var l=s((function(e){return _(e,a,n.sourceFile,o,i,c)}));return t.createCodeFixAction(r,l,e.Diagnostics.Add_await,r,e.Diagnostics.Fix_all_expressions_possibly_missing_await)}function u(t){return 32768&t.kind||!!e.findAncestor(t,(function(t){return t.parent&&e.isArrowFunction(t.parent)&&t.parent.body===t||e.isBlock(t)&&(256===t.parent.kind||213===t.parent.kind||214===t.parent.kind||169===t.parent.kind)}))}function _(t,r,n,o,s,c){if(e.isBinaryExpression(s))for(var l=0,u=[s.left,s.right];l<u.length;l++){var _=u[l];if(!(c&&e.isIdentifier(_)&&(g=o.getSymbolAtLocation(_))&&c.has(e.getSymbolId(g)))){var p=o.getTypeAtLocation(_),f=o.getPromisedTypeOfPromise(p)?e.factory.createAwaitExpression(_):_;t.replaceNode(n,_,f);}}else if(r===i&&e.isPropertyAccessExpression(s.parent)){if(c&&e.isIdentifier(s.parent.expression)&&(g=o.getSymbolAtLocation(s.parent.expression))&&c.has(e.getSymbolId(g)))return;t.replaceNode(n,s.parent.expression,e.factory.createParenthesizedExpression(e.factory.createAwaitExpression(s.parent.expression))),d(t,s.parent.expression,n);}else if(e.contains(a,r)&&e.isCallOrNewExpression(s.parent)){if(c&&e.isIdentifier(s)&&(g=o.getSymbolAtLocation(s))&&c.has(e.getSymbolId(g)))return;t.replaceNode(n,s,e.factory.createParenthesizedExpression(e.factory.createAwaitExpression(s))),d(t,s,n);}else {var g;if(c&&e.isVariableDeclaration(s.parent)&&e.isIdentifier(s.parent.name)&&(g=o.getSymbolAtLocation(s.parent.name))&&!e.tryAddToSet(c,e.getSymbolId(g)))return;t.replaceNode(n,s,e.factory.createAwaitExpression(s));}}function d(t,r,n){var i=e.findPrecedingToken(r.pos,n);i&&e.positionIsASICandidate(i.end,i.parent,n)&&t.insertText(n,r.getStart(n),";");}t.registerCodeFix({fixIds:[r],errorCodes:o,getCodeActions:function(t){var r=t.sourceFile,n=t.errorCode,i=s(r,n,t.span,t.cancellationToken,t.program);if(i){var a=t.program.getTypeChecker(),o=function(r){return e.textChanges.ChangeTracker.with(t,r)};return e.compact([c(t,i,n,a,o),l(t,i,n,a,o)])}},getAllCodeActions:function(r){var n=r.sourceFile,i=r.program,a=r.cancellationToken,u=r.program.getTypeChecker(),_=new e.Set;return t.codeFixAll(r,o,(function(e,t){var o=s(n,t.code,t,a,i);if(o){var d=function(t){return t(e),[]};return c(r,o,t.code,u,d,_)||l(r,o,t.code,u,d,_)}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addMissingConst",n=[e.Diagnostics.Cannot_find_name_0.code,e.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code];function i(t,r,n,i,s){var c=e.getTokenAtPosition(r,n),l=e.findAncestor(c,(function(t){return e.isForInOrOfStatement(t.parent)?t.parent.initializer===t:!function(e){switch(e.kind){case 79:case 204:case 205:case 296:case 297:return !0;default:return !1}}(t)&&"quit"}));if(l)return a(t,l,r,s);var u=c.parent;if(e.isBinaryExpression(u)&&63===u.operatorToken.kind&&e.isExpressionStatement(u.parent))return a(t,c,r,s);if(e.isArrayLiteralExpression(u)){var _=i.getTypeChecker();if(!e.every(u.elements,(function(t){return r=t,n=_,!!(i=e.isIdentifier(r)?r:e.isAssignmentExpression(r,!0)&&e.isIdentifier(r.left)?r.left:void 0)&&!n.getSymbolAtLocation(i);var r,n,i;})))return;return a(t,u,r,s)}var d=e.findAncestor(c,(function(t){return !!e.isExpressionStatement(t.parent)||!function(e){switch(e.kind){case 79:case 221:case 27:return !0;default:return !1}}(t)&&"quit"}));if(d){if(!o(d,i.getTypeChecker()))return;return a(t,d,r,s)}}function a(t,r,n,i){i&&!e.tryAddToSet(i,r)||t.insertModifierBefore(n,85,r);}function o(t,r){return !!e.isBinaryExpression(t)&&(27===t.operatorToken.kind?e.every([t.left,t.right],(function(e){return o(e,r)})):63===t.operatorToken.kind&&e.isIdentifier(t.left)&&!r.getSymbolAtLocation(t.left))}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span.start,n.program)}));if(a.length>0)return [t.createCodeFixAction(r,a,e.Diagnostics.Add_const_to_unresolved_variable,r,e.Diagnostics.Add_const_to_all_unresolved_variables)]},fixIds:[r],getAllCodeActions:function(r){var a=new e.Set;return t.codeFixAll(r,n,(function(e,t){return i(e,t.file,t.start,r.program,a)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addMissingDeclareProperty",n=[e.Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration.code];function i(t,r,n,i){var a=e.getTokenAtPosition(r,n);if(e.isIdentifier(a)){var o=a.parent;167!==o.kind||i&&!e.tryAddToSet(i,o)||t.insertModifierBefore(r,135,o);}}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span.start)}));if(a.length>0)return [t.createCodeFixAction(r,a,e.Diagnostics.Prefix_with_declare,r,e.Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)]},fixIds:[r],getAllCodeActions:function(r){var a=new e.Set;return t.codeFixAll(r,n,(function(e,t){return i(e,t.file,t.start,a)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addMissingInvocationForDecorator",n=[e.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code];function i(t,r,n){var i=e.getTokenAtPosition(r,n),a=e.findAncestor(i,e.isDecorator);e.Debug.assert(!!a,"Expected position to be owned by a decorator.");var o=e.factory.createCallExpression(a.expression,void 0,void 0);t.replaceNode(r,a.expression,o);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span.start)}));return [t.createCodeFixAction(r,a,e.Diagnostics.Call_decorator_expression,r,e.Diagnostics.Add_to_all_uncalled_decorators)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){return i(e,t.file,t.start)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addNameToNamelessParameter",n=[e.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];function i(t,r,n){var i=e.getTokenAtPosition(r,n),a=i.parent;if(!e.isParameter(a))return e.Debug.fail("Tried to add a parameter name to a non-parameter: "+e.Debug.formatSyntaxKind(i.kind));var o=a.parent.parameters.indexOf(a);e.Debug.assert(!a.type,"Tried to add a parameter name to a parameter that already had one."),e.Debug.assert(o>-1,"Parameter not found in parent parameter list.");var s=e.factory.createTypeReferenceNode(a.name,void 0),c=e.factory.createParameterDeclaration(void 0,a.modifiers,a.dotDotDotToken,"arg"+o,a.questionToken,a.dotDotDotToken?e.factory.createArrayTypeNode(s):s,a.initializer);t.replaceNode(r,a,c);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span.start)}));return [t.createCodeFixAction(r,a,e.Diagnostics.Add_parameter_name,r,e.Diagnostics.Add_names_to_all_parameters_without_names)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){return i(e,t.file,t.start)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addOptionalPropertyUndefined",i=[e.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target.code,e.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code];function a(t,r){var n;if(t){if(e.isBinaryExpression(t.parent)&&63===t.parent.operatorToken.kind)return {source:t.parent.right,target:t.parent.left};if(e.isVariableDeclaration(t.parent)&&t.parent.initializer)return {source:t.parent.initializer,target:t.parent.name};if(e.isCallExpression(t.parent)){var i=r.getSymbolAtLocation(t.parent.expression);if(!(null==i?void 0:i.valueDeclaration)||!e.isFunctionLikeKind(i.valueDeclaration.kind))return;if(!e.isExpression(t))return;var o=t.parent.arguments.indexOf(t);if(-1===o)return;var s=i.valueDeclaration.parameters[o].name;if(e.isIdentifier(s))return {source:t,target:s}}else if(e.isPropertyAssignment(t.parent)&&e.isIdentifier(t.parent.name)||e.isShorthandPropertyAssignment(t.parent)){var c=a(t.parent.parent,r);if(!c)return;var l=r.getPropertyOfType(r.getTypeAtLocation(c.target),t.parent.name.text),u=null===(n=null==l?void 0:l.declarations)||void 0===n?void 0:n[0];if(!u)return;return {source:e.isPropertyAssignment(t.parent)?t.parent.initializer:t.parent.name,target:u}}}}t.registerCodeFix({errorCodes:i,getCodeActions:function(i){var o=i.program.getTypeChecker(),s=function(t,r,n){var i,o,s=a(e.getFixableErrorSpanExpression(t,r),n);if(!s)return e.emptyArray;var c=s.source,l=s.target,u=function(t,r,n){return e.isPropertyAccessExpression(r)&&!!n.getExactOptionalProperties(n.getTypeAtLocation(r.expression)).length&&n.getTypeAtLocation(t)===n.getUndefinedType()}(c,l,n)?n.getTypeAtLocation(l.expression):n.getTypeAtLocation(l);return (null===(o=null===(i=u.symbol)||void 0===i?void 0:i.declarations)||void 0===o?void 0:o.some((function(t){return e.getSourceFileOfNode(t).fileName.match(/\.d\.ts$/)})))?e.emptyArray:n.getExactOptionalProperties(u)}(i.sourceFile,i.span,o);if(s.length){var c=e.textChanges.ChangeTracker.with(i,(function(t){return function(t,r){for(var i=0,a=r;i<a.length;i++){var o=a[i].valueDeclaration;if(o&&(e.isPropertySignature(o)||e.isPropertyDeclaration(o))&&o.type){var s=e.factory.createUnionTypeNode(n$4(n$4([],187===o.type.kind?o.type.types:[o.type],!0),[e.factory.createTypeReferenceNode("undefined")],!1));t.replaceNode(o.getSourceFile(),o.type,s);}}}(t,s)}));return [t.createCodeFixActionWithoutFixAll(r,c,e.Diagnostics.Add_undefined_to_optional_property_type)]}},fixIds:[r]});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="annotateWithTypeFromJSDoc",n=[e.Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types.code];function i(t,r){var n=e.getTokenAtPosition(t,r);return e.tryCast(e.isParameter(n.parent)?n.parent.parent:n.parent,a)}function a(t){return function(t){return e.isFunctionLikeDeclaration(t)||254===t.kind||166===t.kind||167===t.kind}(t)&&o(t)}function o(t){return e.isFunctionLikeDeclaration(t)?t.parameters.some(o)||!t.type&&!!e.getJSDocReturnType(t):!t.type&&!!e.getJSDocType(t)}function s(t,r,n){if(e.isFunctionLikeDeclaration(n)&&(e.getJSDocReturnType(n)||n.parameters.some((function(t){return !!e.getJSDocType(t)})))){if(!n.typeParameters){var i=e.getJSDocTypeParameterDeclarations(n);i.length&&t.insertTypeParameters(r,n,i);}var a=e.isArrowFunction(n)&&!e.findChildOfKind(n,20,r);a&&t.insertNodeBefore(r,e.first(n.parameters),e.factory.createToken(20));for(var o=0,s=n.parameters;o<s.length;o++){var l=s[o];if(!l.type){var u=e.getJSDocType(l);u&&t.tryInsertTypeAnnotation(r,l,c(u));}}if(a&&t.insertNodeAfter(r,e.last(n.parameters),e.factory.createToken(21)),!n.type){var _=e.getJSDocReturnType(n);_&&t.tryInsertTypeAnnotation(r,n,c(_));}}else {var d=e.Debug.checkDefined(e.getJSDocType(n),"A JSDocType for this declaration should exist");e.Debug.assert(!n.type,"The JSDocType decl should have a type"),t.tryInsertTypeAnnotation(r,n,c(d));}}function c(t){switch(t.kind){case 312:case 313:return e.factory.createTypeReferenceNode("any",e.emptyArray);case 316:return function(t){return e.factory.createUnionTypeNode([e.visitNode(t.type,c),e.factory.createTypeReferenceNode("undefined",e.emptyArray)])}(t);case 315:return c(t.type);case 314:return function(t){return e.factory.createUnionTypeNode([e.visitNode(t.type,c),e.factory.createTypeReferenceNode("null",e.emptyArray)])}(t);case 318:return function(t){return e.factory.createArrayTypeNode(e.visitNode(t.type,c))}(t);case 317:return function(t){var r;return e.factory.createFunctionTypeNode(e.emptyArray,t.parameters.map(l),null!==(r=t.type)&&void 0!==r?r:e.factory.createKeywordTypeNode(130))}(t);case 178:return function(t){var r=t.typeName,n=t.typeArguments;if(e.isIdentifier(t.typeName)){if(e.isJSDocIndexSignature(t))return function(t){var r=e.factory.createParameterDeclaration(void 0,void 0,void 0,147===t.typeArguments[0].kind?"n":"s",void 0,e.factory.createTypeReferenceNode(147===t.typeArguments[0].kind?"number":"string",[]),void 0),n=e.factory.createTypeLiteralNode([e.factory.createIndexSignature(void 0,void 0,[r],t.typeArguments[1])]);return e.setEmitFlags(n,1),n}(t);var i=t.typeName.text;switch(t.typeName.text){case"String":case"Boolean":case"Object":case"Number":i=i.toLowerCase();break;case"array":case"date":case"promise":i=i[0].toUpperCase()+i.slice(1);}r=e.factory.createIdentifier(i),n="Array"!==i&&"Promise"!==i||t.typeArguments?e.visitNodes(t.typeArguments,c):e.factory.createNodeArray([e.factory.createTypeReferenceNode("any",e.emptyArray)]);}return e.factory.createTypeReferenceNode(r,n)}(t);default:var r=e.visitEachChild(t,c,e.nullTransformationContext);return e.setEmitFlags(r,1),r}}function l(t){var r=t.parent.parameters.indexOf(t),n=318===t.type.kind&&r===t.parent.parameters.length-1,i=t.name||(n?"rest":"arg"+r),a=n?e.factory.createToken(25):t.dotDotDotToken;return e.factory.createParameterDeclaration(t.decorators,t.modifiers,a,i,t.questionToken,e.visitNode(t.type,c),t.initializer)}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=i(n.sourceFile,n.span.start);if(a){var o=e.textChanges.ChangeTracker.with(n,(function(e){return s(e,n.sourceFile,a)}));return [t.createCodeFixAction(r,o,e.Diagnostics.Annotate_with_type_from_JSDoc,r,e.Diagnostics.Annotate_everything_with_types_from_JSDoc)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){var r=i(t.file,t.start);r&&s(e,t.file,r);}))}}),t.parameterShouldGetTypeFromJSDoc=a;}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="convertFunctionToEs6Class",n=[e.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration.code];function i(t,r,n,i,s,c){var l=i.getSymbolAtLocation(e.getTokenAtPosition(r,n));if(l&&l.valueDeclaration&&19&l.flags){var u=l.valueDeclaration;if(e.isFunctionDeclaration(u))t.replaceNode(r,u,function(t){var r=p(l);t.body&&r.unshift(e.factory.createConstructorDeclaration(void 0,void 0,t.parameters,t.body));var n=a(t,93);return e.factory.createClassDeclaration(void 0,n,t.name,void 0,void 0,r)}(u));else if(e.isVariableDeclaration(u)){var _=function(t){var r=t.initializer;if(r&&e.isFunctionExpression(r)&&e.isIdentifier(t.name)){var n=p(t.symbol);r.body&&n.unshift(e.factory.createConstructorDeclaration(void 0,void 0,r.parameters,r.body));var i=a(t.parent.parent,93);return e.factory.createClassDeclaration(void 0,i,t.name,void 0,void 0,n)}}(u);if(!_)return;var d=u.parent.parent;e.isVariableDeclarationList(u.parent)&&u.parent.declarations.length>1?(t.delete(r,u),t.insertNodeAfter(r,d,_)):t.replaceNode(r,d,_);}}function p(n){var i=[];return n.exports&&n.exports.forEach((function(t){if("prototype"===t.name&&t.declarations){var r=t.declarations[0];1===t.declarations.length&&e.isPropertyAccessExpression(r)&&e.isBinaryExpression(r.parent)&&63===r.parent.operatorToken.kind&&e.isObjectLiteralExpression(r.parent.right)&&l(r.parent.right.symbol,void 0,i);}else l(t,[e.factory.createToken(124)],i);})),n.members&&n.members.forEach((function(a,s){var c,u,_,d;if("constructor"===s&&a.valueDeclaration){var p=null===(d=null===(_=null===(u=null===(c=n.exports)||void 0===c?void 0:c.get("prototype"))||void 0===u?void 0:u.declarations)||void 0===_?void 0:_[0])||void 0===d?void 0:d.parent;p&&e.isBinaryExpression(p)&&e.isObjectLiteralExpression(p.right)&&e.some(p.right.properties,o)||t.delete(r,a.valueDeclaration.parent);}else l(a,void 0,i);})),i;function l(n,i,l){if(8192&n.flags||4096&n.flags){var u,_,d=n.valueDeclaration,p=d.parent,f=p.right;if(u=d,_=f,(e.isAccessExpression(u)?e.isPropertyAccessExpression(u)&&o(u)||e.isFunctionLike(_):e.every(u.properties,(function(t){return !!(e.isMethodDeclaration(t)||e.isGetOrSetAccessorDeclaration(t)||e.isPropertyAssignment(t)&&e.isFunctionExpression(t.initializer)&&t.name||o(t))})))&&!e.some(l,(function(t){var r=e.getNameOfDeclaration(t);return !(!r||!e.isIdentifier(r)||e.idText(r)!==e.symbolName(n))}))){var g=p.parent&&238===p.parent.kind?p.parent:p;if(t.delete(r,g),f){if(e.isAccessExpression(d)&&(e.isFunctionExpression(f)||e.isArrowFunction(f))){var m=e.getQuotePreference(r,s),y=function(t,r,n){if(e.isPropertyAccessExpression(t))return t.name;var i=t.argumentExpression;return e.isNumericLiteral(i)?i:e.isStringLiteralLike(i)?e.isIdentifierText(i.text,e.getEmitScriptTarget(r))?e.factory.createIdentifier(i.text):e.isNoSubstitutionTemplateLiteral(i)?e.factory.createStringLiteral(i.text,0===n):i:void 0}(d,c,m);y&&h(l,f,y);}else if(e.isObjectLiteralExpression(f))e.forEach(f.properties,(function(t){(e.isMethodDeclaration(t)||e.isGetOrSetAccessorDeclaration(t))&&l.push(t),e.isPropertyAssignment(t)&&e.isFunctionExpression(t.initializer)&&h(l,t.initializer,t.name),o(t);}));else if(!e.isSourceFileJS(r)&&e.isPropertyAccessExpression(d)){var v=e.factory.createPropertyDeclaration(void 0,i,d.name,void 0,void 0,f);return e.copyLeadingComments(p.parent,v,r),void l.push(v)}}else l.push(e.factory.createPropertyDeclaration([],i,n.name,void 0,void 0,void 0));}}function h(t,n,o){return e.isFunctionExpression(n)?function(t,n,o){var s=e.concatenate(i,a(n,131)),c=e.factory.createMethodDeclaration(void 0,s,void 0,o,void 0,void 0,n.parameters,void 0,n.body);return e.copyLeadingComments(p,c,r),void t.push(c)}(t,n,o):function(t,n,o){var s,c=n.body;s=235===c.kind?c:e.factory.createBlock([e.factory.createReturnStatement(c)]);var l=e.concatenate(i,a(n,131)),u=e.factory.createMethodDeclaration(void 0,l,void 0,o,void 0,void 0,n.parameters,void 0,s);e.copyLeadingComments(p,u,r),t.push(u);}(t,n,o)}}}}function a(t,r){return e.filter(t.modifiers,(function(e){return e.kind===r}))}function o(t){return !!t.name&&!(!e.isIdentifier(t.name)||"constructor"!==t.name.text)}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span.start,n.program.getTypeChecker(),n.preferences,n.program.getCompilerOptions())}));return [t.createCodeFixAction(r,a,e.Diagnostics.Convert_function_to_an_ES2015_class,r,e.Diagnostics.Convert_all_constructor_functions_to_classes)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){return i(t,r.file,r.start,e.program.getTypeChecker(),e.preferences,e.program.getCompilerOptions())}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r,i="convertToAsyncFunction",a=[e.Diagnostics.This_may_be_converted_to_an_async_function.code],o=!0;function s(t,r,n,i){var a,o=e.getTokenAtPosition(r,n);if(a=e.isIdentifier(o)&&e.isVariableDeclaration(o.parent)&&o.parent.initializer&&e.isFunctionLikeDeclaration(o.parent.initializer)?o.parent.initializer:e.tryCast(e.getContainingFunction(e.getTokenAtPosition(r,n)),e.canBeConvertedToAsync)){var s=new e.Map,l=e.isInJSFile(a),u=function(t,r){if(!t.body)return new e.Set;var n=new e.Set;return e.forEachChild(t.body,(function t(i){c(i,r,"then")?(n.add(e.getNodeId(i)),e.forEach(i.arguments,t)):c(i,r,"catch")||c(i,r,"finally")?(n.add(e.getNodeId(i)),e.forEachChild(i,t)):_(i,r)?n.add(e.getNodeId(i)):e.forEachChild(i,t);})),n}(a,i),f=function(t,r,n){var i=new e.Map,a=e.createMultiMap();return e.forEachChild(t,(function t(o){if(e.isIdentifier(o)){var s=r.getSymbolAtLocation(o);if(s){var c=T(r.getTypeAtLocation(o),r),l=e.getSymbolId(s).toString();if(!c||e.isParameter(o.parent)||e.isFunctionLikeDeclaration(o.parent)||n.has(l)){if(o.parent&&(e.isParameter(o.parent)||e.isVariableDeclaration(o.parent)||e.isBindingElement(o.parent))){var u=o.text,_=a.get(u);if(_&&_.some((function(e){return e!==s}))){var p=d(o,a);i.set(l,p.identifier),n.set(l,p),a.add(u,s);}else {var f=e.getSynthesizedDeepClone(o);n.set(l,N(f)),a.add(u,s);}}}else {var g=e.firstOrUndefined(c.parameters),m=(null==g?void 0:g.valueDeclaration)&&e.isParameter(g.valueDeclaration)&&e.tryCast(g.valueDeclaration.name,e.isIdentifier)||e.factory.createUniqueName("result",16),y=d(m,a);n.set(l,y),a.add(m.text,s);}}}else e.forEachChild(o,t);})),e.getSynthesizedDeepCloneWithReplacements(t,!0,(function(t){if(e.isBindingElement(t)&&e.isIdentifier(t.name)&&e.isObjectBindingPattern(t.parent)){if((a=(n=r.getSymbolAtLocation(t.name))&&i.get(String(e.getSymbolId(n))))&&a.text!==(t.name||t.propertyName).getText())return e.factory.createBindingElement(t.dotDotDotToken,t.propertyName||t.name,a,t.initializer)}else if(e.isIdentifier(t)){var n,a;if(a=(n=r.getSymbolAtLocation(t))&&i.get(String(e.getSymbolId(n))))return e.factory.createIdentifier(a.text)}}))}(a,i,s);if(e.returnsPromise(f,i)){var m=f.body&&e.isBlock(f.body)?function(t,r){var n=[];return e.forEachReturnStatement(t,(function(t){e.isReturnStatementWithFixablePromiseHandler(t,r)&&n.push(t);})),n}(f.body,i):e.emptyArray,y={checker:i,synthNamesMap:s,setOfExpressionsToReturn:u,isInJSFile:l};if(m.length){var v=a.modifiers?a.modifiers.end:a.decorators?e.skipTrivia(r.text,a.decorators.end):a.getStart(r),h=a.modifiers?{prefix:" "}:{suffix:" "};t.insertModifierAt(r,v,131,h);for(var b=function(n){if(e.forEachChild(n,(function i(a){if(e.isCallExpression(a)){var o=g(a,a,y,!1);if(p())return !0;t.replaceNodeWithNodes(r,n,o);}else if(!e.isFunctionLike(a)&&(e.forEachChild(a,i),p()))return !0})),p())return {value:void 0}},x=0,D=m;x<D.length;x++){var S=b(D[x]);if("object"==typeof S)return S.value}}}}}function c(t,r,n){if(!e.isCallExpression(t))return !1;var i=e.hasPropertyAccessExpressionWithName(t,n)&&r.getTypeAtLocation(t);return !(!i||!r.getPromisedTypeOfPromise(i))}function l(t,r){return 0!=(4&e.getObjectFlags(t))&&t.target===r}function u(t,r,n){if("finally"!==t.expression.name.escapedText){var i=n.getTypeAtLocation(t.expression.expression);if(l(i,n.getPromiseType())||l(i,n.getPromiseLikeType())){if("then"!==t.expression.name.escapedText)return e.elementAt(t.typeArguments,0);if(r===e.elementAt(t.arguments,0))return e.elementAt(t.typeArguments,0);if(r===e.elementAt(t.arguments,1))return e.elementAt(t.typeArguments,1)}}}function _(t,r){return !!e.isExpression(t)&&!!r.getPromisedTypeOfPromise(r.getTypeAtLocation(t))}function d(t,r){var n=(r.get(t.text)||e.emptyArray).length;return N(0===n?t:e.factory.createIdentifier(t.text+"_"+n))}function p(){return !o}function f(){return o=!1,e.emptyArray}function g(t,r,n,i,a){if(c(r,n.checker,"then"))return function(t,r,n,i,a,o){if(!r||m(i,r))return h(t,n,i,a,o);if(n&&!m(i,n))return f();var s=k(r,i),c=g(t.expression.expression,t.expression.expression,i,!0,s);if(p())return f();var l=D(r,a,o,s,t,i);return p()?f():e.concatenate(c,l)}(r,e.elementAt(r.arguments,0),e.elementAt(r.arguments,1),n,i,a);if(c(r,n.checker,"catch"))return h(r,e.elementAt(r.arguments,0),n,i,a);if(c(r,n.checker,"finally"))return function(t,r,n,i,a){if(!r||m(n,r))return g(t,t.expression.expression,n,i,a);var o=y(t,n,a),s=g(t,t.expression.expression,n,!0,o);if(p())return f();var c=D(r,i,void 0,void 0,t,n);if(p())return f();var l=e.factory.createBlock(s),u=e.factory.createBlock(c);return v(t,n,e.factory.createTryStatement(l,void 0,u),o,a)}(r,e.elementAt(r.arguments,0),n,i,a);if(e.isPropertyAccessExpression(r))return g(t,r.expression,n,i,a);var o=n.checker.getTypeAtLocation(r);return o&&n.checker.getPromisedTypeOfPromise(o)?(e.Debug.assertNode(e.getOriginalNode(r).parent,e.isPropertyAccessExpression),function(t,r,n,i,a){if(O(t,n)){var o=e.getSynthesizedDeepClone(r);return i&&(o=e.factory.createAwaitExpression(o)),[e.factory.createReturnStatement(o)]}return b(a,e.factory.createAwaitExpression(r),void 0)}(t,r,n,i,a)):f()}function m(t,r){var n=t.checker;if(104===r.kind)return !0;if(e.isIdentifier(r)&&!e.isGeneratedIdentifier(r)&&"undefined"===e.idText(r)){var i=n.getSymbolAtLocation(r);return !i||n.isUndefinedSymbol(i)}return !1}function y(t,r,n){var i;return n&&!O(t,r)&&(I(n)?(i=n,r.synthNamesMap.forEach((function(t,i){if(t.identifier.text===n.identifier.text){var a=(o=n,N(e.factory.createUniqueName(o.identifier.text,16)));r.synthNamesMap.set(i,a);}var o;}))):i=N(e.factory.createUniqueName("result",16),n.types),w(i)),i}function v(t,r,n,i,a){var o,s=[];if(i&&!O(t,r)){o=e.getSynthesizedDeepClone(w(i));var c=i.types,l=r.checker.getUnionType(c,2),u=r.isInJSFile?void 0:r.checker.typeToTypeNode(l,void 0,void 0),_=[e.factory.createVariableDeclaration(o,void 0,u)],d=e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList(_,1));s.push(d);}return s.push(n),a&&o&&1===a.kind&&s.push(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(e.getSynthesizedDeepClone(P(a)),void 0,void 0,o)],2))),s}function h(t,r,n,i,a){if(!r||m(n,r))return g(t,t.expression.expression,n,i,a);var o=k(r,n),s=y(t,n,a),c=g(t,t.expression.expression,n,!0,s);if(p())return f();var l=D(r,i,s,o,t,n);if(p())return f();var u=e.factory.createBlock(c),_=e.factory.createCatchClause(o&&e.getSynthesizedDeepClone(A(o)),e.factory.createBlock(l));return v(t,n,e.factory.createTryStatement(u,_,void 0),s,a)}function b(t,r,n){return !t||E(t)?[e.factory.createExpressionStatement(r)]:I(t)&&t.hasBeenDeclared?[e.factory.createExpressionStatement(e.factory.createAssignment(e.getSynthesizedDeepClone(F(t)),r))]:[e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(e.getSynthesizedDeepClone(A(t)),void 0,n,r)],2))]}function x(t,r){if(r&&t){var i=e.factory.createUniqueName("result",16);return n$4(n$4([],b(N(i),t,r),!0),[e.factory.createReturnStatement(i)],!1)}return [e.factory.createReturnStatement(t)]}function D(t,r,n,i,a,o){var s;switch(t.kind){case 104:break;case 206:case 79:if(!i)break;var c=e.factory.createCallExpression(e.getSynthesizedDeepClone(t),void 0,I(i)?[F(i)]:[]);if(O(a,o))return x(c,u(a,t,o.checker));var l=o.checker.getTypeAtLocation(t),d=o.checker.getSignaturesOfType(l,0);if(!d.length)return f();var p=d[0].getReturnType(),g=b(n,e.factory.createAwaitExpression(c),u(a,t,o.checker));return n&&n.types.push(o.checker.getAwaitedType(p)||p),g;case 213:case 214:var m=t.body,y=null===(s=T(o.checker.getTypeAtLocation(t),o.checker))||void 0===s?void 0:s.getReturnType();if(e.isBlock(m)){for(var v=[],h=!1,D=0,k=m.statements;D<k.length;D++){var E=k[D];if(e.isReturnStatement(E))if(h=!0,e.isReturnStatementWithFixablePromiseHandler(E,o.checker))v=v.concat(C(o,E,r,n));else {var N=y&&E.expression?S(o.checker,y,E.expression):E.expression;v.push.apply(v,x(N,u(a,t,o.checker)));}else {if(r&&e.forEachReturnStatement(E,e.returnTrue))return f();v.push(E);}}return O(a,o)?v.map((function(t){return e.getSynthesizedDeepClone(t)})):function(t,r,n,i){for(var a=[],o=0,s=t;o<s.length;o++){var c=s[o];if(e.isReturnStatement(c)){if(c.expression){var l=_(c.expression,n.checker)?e.factory.createAwaitExpression(c.expression):c.expression;void 0===r?a.push(e.factory.createExpressionStatement(l)):I(r)&&r.hasBeenDeclared?a.push(e.factory.createExpressionStatement(e.factory.createAssignment(F(r),l))):a.push(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(A(r),void 0,void 0,l)],2)));}}else a.push(e.getSynthesizedDeepClone(c));}return i||void 0===r||a.push(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(A(r),void 0,void 0,e.factory.createIdentifier("undefined"))],2))),a}(v,n,o,h)}var P=e.isFixablePromiseHandler(m,o.checker)?C(o,e.factory.createReturnStatement(m),r,n):e.emptyArray;if(P.length>0)return P;if(y){if(N=S(o.checker,y,m),O(a,o))return x(N,u(a,t,o.checker));var w=b(n,N,void 0);return n&&n.types.push(o.checker.getAwaitedType(y)||y),w}return f();default:return f()}return e.emptyArray}function S(t,r,n){var i=e.getSynthesizedDeepClone(n);return t.getPromisedTypeOfPromise(r)?e.factory.createAwaitExpression(i):i}function T(t,r){var n=r.getSignaturesOfType(t,0);return e.lastOrUndefined(n)}function C(t,r,n,i){var a=[];return e.forEachChild(r,(function r(o){if(e.isCallExpression(o)){var s=g(o,o,t,n,i);if((a=a.concat(s)).length>0)return}else e.isFunctionLike(o)||e.forEachChild(o,r);})),a}function k(t,r){var n,i=[];if(e.isFunctionLikeDeclaration(t)?t.parameters.length>0&&(n=function t(r){return e.isIdentifier(r)?a(r):function(t,r,n){return void 0===r&&(r=e.emptyArray),void 0===n&&(n=[]),{kind:1,bindingPattern:t,elements:r,types:n}}(r,e.flatMap(r.elements,(function(r){return e.isOmittedExpression(r)?[]:[t(r.name)]})))}(t.parameters[0].name)):e.isIdentifier(t)?n=a(t):e.isPropertyAccessExpression(t)&&e.isIdentifier(t.name)&&(n=a(t.name)),n&&(!("identifier"in n)||"undefined"!==n.identifier.text))return n;function a(t){var n,a=function(e){return e.symbol?e.symbol:r.checker.getSymbolAtLocation(e)}((n=t).original?n.original:n);return a&&r.synthNamesMap.get(e.getSymbolId(a).toString())||N(t,i)}}function E(t){return !t||(I(t)?!t.identifier.text:e.every(t.elements,E))}function N(e,t){return void 0===t&&(t=[]),{kind:0,identifier:e,types:t,hasBeenDeclared:!1,hasBeenReferenced:!1}}function F(e){return e.hasBeenReferenced=!0,e.identifier}function A(e){return I(e)?w(e):P(e)}function P(e){for(var t=0,r=e.elements;t<r.length;t++)A(r[t]);return e.bindingPattern}function w(e){return e.hasBeenDeclared=!0,e.identifier}function I(e){return 0===e.kind}function O(t,r){return !!t.original&&r.setOfExpressionsToReturn.has(e.getNodeId(t.original))}t.registerCodeFix({errorCodes:a,getCodeActions:function(r){o=!0;var n=e.textChanges.ChangeTracker.with(r,(function(e){return s(e,r.sourceFile,r.span.start,r.program.getTypeChecker())}));return o?[t.createCodeFixAction(i,n,e.Diagnostics.Convert_to_async_function,i,e.Diagnostics.Convert_all_to_async_functions)]:[]},fixIds:[i],getAllCodeActions:function(e){return t.codeFixAll(e,a,(function(t,r){return s(t,r.file,r.start,e.program.getTypeChecker())}))}}),function(e){e[e.Identifier=0]="Identifier",e[e.BindingPattern=1]="BindingPattern";}(r||(r={}));}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){function r(t,r,n,i){for(var a=0,o=t.imports;a<o.length;a++){var s=o[a],c=e.getResolvedModule(t,s.text,e.getModeForUsageLocation(t,s));if(c&&c.resolvedFileName===r.fileName){var l=e.importFromModuleSpecifier(s);switch(l.kind){case 265:n.replaceNode(t,l,e.makeImport(l.name,void 0,s,i));break;case 208:e.isRequireCall(l,!1)&&n.replaceNode(t,l,e.factory.createPropertyAccessExpression(e.getSynthesizedDeepClone(l),"default"));}}}}function n(t,r){t.forEachChild((function n(i){if(e.isPropertyAccessExpression(i)&&e.isExportsOrModuleExportsOrAlias(t,i.expression)&&e.isIdentifier(i.name)){var a=i.parent;r(i,e.isBinaryExpression(a)&&a.left===i&&63===a.operatorToken.kind);}i.forEachChild(n);}));}function i(t,r,n,i,l,u,_,p,f){switch(r.kind){case 237:return a(t,r,i,n,l,u,f),!1;case 238:var y=r.expression;switch(y.kind){case 208:return e.isRequireCall(y,!0)&&i.replaceNode(t,r,e.makeImport(void 0,void 0,y.arguments[0],f)),!1;case 221:return 63===y.operatorToken.kind&&function(t,r,n,i,a,l){var u=n.left,_=n.right;if(!e.isPropertyAccessExpression(u))return !1;if(e.isExportsOrModuleExportsOrAlias(t,u)){if(!e.isExportsOrModuleExportsOrAlias(t,_)){var p=e.isObjectLiteralExpression(_)?function(t,r){var n=e.mapAllOrFail(t.properties,(function(t){switch(t.kind){case 172:case 173:case 297:case 298:return;case 296:return e.isIdentifier(t.name)?function(t,r,n){var i=[e.factory.createToken(93)];switch(r.kind){case 213:var a=r.name;if(a&&a.text!==t)return o();case 214:return d(t,i,r,n);case 226:return function(t,r,n,i){return e.factory.createClassDeclaration(e.getSynthesizedDeepClones(n.decorators),e.concatenate(r,e.getSynthesizedDeepClones(n.modifiers)),t,e.getSynthesizedDeepClones(n.typeParameters),e.getSynthesizedDeepClones(n.heritageClauses),c(n.members,i))}(t,i,r,n);default:return o()}function o(){return g(i,e.factory.createIdentifier(t),c(r,n))}}(t.name.text,t.initializer,r):void 0;case 169:return e.isIdentifier(t.name)?d(t.name.text,[e.factory.createToken(93)],t,r):void 0;default:e.Debug.assertNever(t,"Convert to ES6 got invalid prop kind ".concat(t.kind));}}));return n&&[n,!1]}(_,l):e.isRequireCall(_,!0)?function(t,r){var n=t.text,i=r.getSymbolAtLocation(t),a=i?i.exports:e.emptyMap;return a.has("export=")?[[s(n)],!0]:a.has("default")?a.size>1?[[o(n),s(n)],!0]:[[s(n)],!0]:[[o(n)],!1]}(_.arguments[0],r):void 0;return p?(i.replaceNodeWithNodes(t,n.parent,p[0]),p[1]):(i.replaceRangeWithText(t,e.createRange(u.getStart(t),_.pos),"export default"),!0)}i.delete(t,n.parent);}else e.isExportsOrModuleExportsOrAlias(t,u.expression)&&function(t,r,n,i){var a=r.left.name.text,o=i.get(a);if(void 0!==o){var s=[g(void 0,o,r.right),m([e.factory.createExportSpecifier(!1,o,a)])];n.replaceNodeWithNodes(t,r.parent,s);}else !function(t,r,n){var i=t.left,a=t.right,o=t.parent,s=i.name.text;if(!(e.isFunctionExpression(a)||e.isArrowFunction(a)||e.isClassExpression(a))||a.name&&a.name.text!==s)n.replaceNodeRangeWithNodes(r,i.expression,e.findChildOfKind(i,24,r),[e.factory.createToken(93),e.factory.createToken(85)],{joiner:" ",suffix:" "});else {n.replaceRange(r,{pos:i.getStart(r),end:a.getStart(r)},e.factory.createToken(93),{suffix:" "}),a.name||n.insertName(r,a,s);var c=e.findChildOfKind(o,26,r);c&&n.delete(r,c);}}(r,t,n);}(t,n,i,a);return !1}(t,n,y,i,_,p)}default:return !1}}function a(r,n,i,a,o,s,c){var u,_=n.declarationList,d=!1,m=e.map(_.declarations,(function(n){var i=n.name,u=n.initializer;if(u){if(e.isExportsOrModuleExportsOrAlias(r,u))return d=!0,y([]);if(e.isRequireCall(u,!0))return d=!0,function(r,n,i,a,o,s){switch(r.kind){case 201:var c=e.mapAllOrFail(r.elements,(function(t){return t.dotDotDotToken||t.initializer||t.propertyName&&!e.isIdentifier(t.propertyName)||!e.isIdentifier(t.name)?void 0:f(t.propertyName&&t.propertyName.text,t.name.text)}));if(c)return y([e.makeImport(void 0,c,n,s)]);case 202:var u=l(t.moduleSpecifierToValidIdentifier(n.text,o),a);return y([e.makeImport(e.factory.createIdentifier(u),void 0,n,s),g(void 0,e.getSynthesizedDeepClone(r),e.factory.createIdentifier(u))]);case 79:return function(t,r,n,i,a){for(var o,s=n.getSymbolAtLocation(t),c=new e.Map,u=!1,_=0,d=i.original.get(t.text);_<d.length;_++){var p=d[_];if(n.getSymbolAtLocation(p)===s&&p!==t){var f=p.parent;if(e.isPropertyAccessExpression(f)){var g=f.name.text;if("default"===g){u=!0;var m=p.getText();(null!=o?o:o=new e.Map).set(f,e.factory.createIdentifier(m));}else {e.Debug.assert(f.expression===p,"Didn't expect expression === use");var v=c.get(g);void 0===v&&(v=l(g,i),c.set(g,v)),(null!=o?o:o=new e.Map).set(f,e.factory.createIdentifier(v));}}else u=!0;}}var h=0===c.size?void 0:e.arrayFrom(e.mapIterator(c.entries(),(function(t){var r=t[0],n=t[1];return e.factory.createImportSpecifier(!1,r===n?void 0:e.factory.createIdentifier(r),e.factory.createIdentifier(n))})));return h||(u=!0),y([e.makeImport(u?e.getSynthesizedDeepClone(t):void 0,h,r,a)],o)}(r,n,i,a,s);default:return e.Debug.assertNever(r,"Convert to ES module got invalid name kind ".concat(r.kind))}}(i,u.arguments[0],a,o,s,c);if(e.isPropertyAccessExpression(u)&&e.isRequireCall(u.expression,!0))return d=!0,function(t,r,n,i,a){switch(t.kind){case 201:case 202:var o=l(r,i);return y([p(o,r,n,a),g(void 0,t,e.factory.createIdentifier(o))]);case 79:return y([p(t.text,r,n,a)]);default:return e.Debug.assertNever(t,"Convert to ES module got invalid syntax form ".concat(t.kind))}}(i,u.name.text,u.expression.arguments[0],o,c)}return y([e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([n],_.flags))])}));if(d)return i.replaceNodeWithNodes(r,n,e.flatMap(m,(function(e){return e.newImports}))),e.forEach(m,(function(t){t.useSitesToUnqualify&&e.copyEntries(t.useSitesToUnqualify,null!=u?u:u=new e.Map);})),u}function o(e){return m(void 0,e)}function s(t){return m([e.factory.createExportSpecifier(!1,void 0,"default")],t)}function c(t,r){return r&&e.some(e.arrayFrom(r.keys()),(function(r){return e.rangeContainsRange(t,r)}))?e.isArray(t)?e.getSynthesizedDeepClonesWithReplacements(t,!0,n):e.getSynthesizedDeepCloneWithReplacements(t,!0,n):t;function n(e){if(206===e.kind){var t=r.get(e);return r.delete(e),t}}}function l(e,t){for(;t.original.has(e)||t.additional.has(e);)e="_".concat(e);return t.additional.add(e),e}function u(t){var r=e.createMultiMap();return _(t,(function(e){return r.add(e.text,e)})),r}function _(t,r){e.isIdentifier(t)&&function(e){var t=e.parent;switch(t.kind){case 206:return t.name!==e;case 203:case 270:return t.propertyName!==e;default:return !0}}(t)&&r(t),t.forEachChild((function(e){return _(e,r)}));}function d(t,r,n,i){return e.factory.createFunctionDeclaration(e.getSynthesizedDeepClones(n.decorators),e.concatenate(r,e.getSynthesizedDeepClones(n.modifiers)),e.getSynthesizedDeepClone(n.asteriskToken),t,e.getSynthesizedDeepClones(n.typeParameters),e.getSynthesizedDeepClones(n.parameters),e.getSynthesizedDeepClone(n.type),e.factory.converters.convertToFunctionBlock(c(n.body,i)))}function p(t,r,n,i){return "default"===r?e.makeImport(e.factory.createIdentifier(t),void 0,n,i):e.makeImport(void 0,[f(r,t)],n,i)}function f(t,r){return e.factory.createImportSpecifier(!1,void 0!==t&&t!==r?e.factory.createIdentifier(t):void 0,e.factory.createIdentifier(r))}function g(t,r,n){return e.factory.createVariableStatement(t,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(r,void 0,void 0,n)],2))}function m(t,r){return e.factory.createExportDeclaration(void 0,void 0,!1,t&&e.factory.createNamedExports(t),void 0===r?void 0:e.factory.createStringLiteral(r))}function y(e,t){return {newImports:e,useSitesToUnqualify:t}}t.registerCodeFix({errorCodes:[e.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],getCodeActions:function(o){var s=o.sourceFile,c=o.program,_=o.preferences,d=e.textChanges.ChangeTracker.with(o,(function(t){if(function(t,r,o,s,c){var _={original:u(t),additional:new e.Set},d=function(t,r,i){var a=new e.Map;return n(t,(function(t){var n=t.name,o=n.text,s=n.originalKeywordKind;!a.has(o)&&(void 0!==s&&e.isNonContextualKeyword(s)||r.resolveName(o,t,111551,!0))&&a.set(o,l("_".concat(o),i));})),a}(t,r,_);!function(t,r,i){n(t,(function(n,a){if(!a){var o=n.name.text;i.replaceNode(t,n,e.factory.createIdentifier(r.get(o)||o));}}));}(t,d,o);for(var p,f=!1,g=0,m=e.filter(t.statements,e.isVariableStatement);g<m.length;g++){var y=m[g],v=a(t,y,o,r,_,s,c);v&&e.copyEntries(v,null!=p?p:p=new e.Map);}for(var h=0,b=e.filter(t.statements,(function(t){return !e.isVariableStatement(t)}));h<b.length;h++){y=b[h];var x=i(t,y,r,o,_,s,d,p,c);f=f||x;}return null==p||p.forEach((function(e,r){o.replaceNode(t,r,e);})),f}(s,c.getTypeChecker(),t,e.getEmitScriptTarget(c.getCompilerOptions()),e.getQuotePreference(s,_)))for(var o=0,d=c.getSourceFiles();o<d.length;o++){var p=d[o];r(p,s,t,e.getQuotePreference(p,_));}}));return [t.createCodeFixActionWithoutFixAll("convertToEsModule",d,e.Diagnostics.Convert_to_ES_module)]}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="correctQualifiedNameToIndexedAccessType",n=[e.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code];function i(t,r){var n=e.findAncestor(e.getTokenAtPosition(t,r),e.isQualifiedName);return e.Debug.assert(!!n,"Expected position to be owned by a qualified name."),e.isIdentifier(n.left)?n:void 0}function a(t,r,n){var i=n.right.text,a=e.factory.createIndexedAccessTypeNode(e.factory.createTypeReferenceNode(n.left,void 0),e.factory.createLiteralTypeNode(e.factory.createStringLiteral(i)));t.replaceNode(r,n,a);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=i(n.sourceFile,n.span.start);if(o){var s=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,n.sourceFile,o)})),c="".concat(o.left.text,'["').concat(o.right.text,'"]');return [t.createCodeFixAction(r,s,[e.Diagnostics.Rewrite_as_the_indexed_access_type_0,c],r,e.Diagnostics.Rewrite_all_as_indexed_access_types)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){var r=i(t.file,t.start);r&&a(e,t.file,r);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r=[e.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type.code],n="convertToTypeOnlyExport";function i(t,r){return e.tryCast(e.getTokenAtPosition(r,t.start).parent,e.isExportSpecifier)}function a(t,n,i){if(n){var a=n.parent,o=a.parent,s=function(t,n){var i=t.parent;if(1===i.elements.length)return i.elements;var a=e.getDiagnosticsWithinSpan(e.createTextSpanFromNode(i),n.program.getSemanticDiagnostics(n.sourceFile,n.cancellationToken));return e.filter(i.elements,(function(n){var i;return n===t||(null===(i=e.findDiagnosticForNode(n,a))||void 0===i?void 0:i.code)===r[0]}))}(n,i);if(s.length===a.elements.length)t.insertModifierBefore(i.sourceFile,152,a);else {var c=e.factory.updateExportDeclaration(o,o.decorators,o.modifiers,!1,e.factory.updateNamedExports(a,e.filter(a.elements,(function(t){return !e.contains(s,t)}))),o.moduleSpecifier,void 0),l=e.factory.createExportDeclaration(void 0,void 0,!0,e.factory.createNamedExports(s),o.moduleSpecifier,void 0);t.replaceNode(i.sourceFile,o,c,{leadingTriviaOption:e.textChanges.LeadingTriviaOption.IncludeAll,trailingTriviaOption:e.textChanges.TrailingTriviaOption.Exclude}),t.insertNodeAfter(i.sourceFile,o,l);}}}t.registerCodeFix({errorCodes:r,getCodeActions:function(r){var o=e.textChanges.ChangeTracker.with(r,(function(e){return a(e,i(r.span,r.sourceFile),r)}));if(o.length)return [t.createCodeFixAction(n,o,e.Diagnostics.Convert_to_type_only_export,n,e.Diagnostics.Convert_all_re_exported_types_to_type_only_exports)]},fixIds:[n],getAllCodeActions:function(n){var o=new e.Map;return t.codeFixAll(n,r,(function(t,r){var s=i(r,n.sourceFile);s&&e.addToSeen(o,e.getNodeId(s.parent.parent))&&a(t,s,n);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r=[e.Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code],n="convertToTypeOnlyImport";function i(t,r){return e.tryCast(e.getTokenAtPosition(r,t.start).parent,e.isImportDeclaration)}function a(t,r,n){if(null==r?void 0:r.importClause){var i=r.importClause;t.insertText(n.sourceFile,r.getStart()+"import".length," type"),i.name&&i.namedBindings&&(t.deleteNodeRangeExcludingEnd(n.sourceFile,i.name,r.importClause.namedBindings),t.insertNodeBefore(n.sourceFile,r,e.factory.updateImportDeclaration(r,void 0,void 0,e.factory.createImportClause(!0,i.name,void 0),r.moduleSpecifier,void 0)));}}t.registerCodeFix({errorCodes:r,getCodeActions:function(r){var o=e.textChanges.ChangeTracker.with(r,(function(e){a(e,i(r.span,r.sourceFile),r);}));if(o.length)return [t.createCodeFixAction(n,o,e.Diagnostics.Convert_to_type_only_import,n,e.Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)]},fixIds:[n],getAllCodeActions:function(e){return t.codeFixAll(e,r,(function(t,r){a(t,i(r,e.sourceFile),e);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="convertLiteralTypeToMappedType",n=[e.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code];function i(t,r){var n=e.getTokenAtPosition(t,r);if(e.isIdentifier(n)){var i=e.cast(n.parent.parent,e.isPropertySignature),a=n.getText(t);return {container:e.cast(i.parent,e.isTypeLiteralNode),typeNode:i.type,constraint:a,name:"K"===a?"P":"K"}}}function a(t,r,n){var i=n.container,a=n.typeNode,o=n.constraint,s=n.name;t.replaceNode(r,i,e.factory.createMappedTypeNode(void 0,e.factory.createTypeParameterDeclaration(void 0,s,e.factory.createTypeReferenceNode(o)),void 0,void 0,a,void 0));}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.span,c=i(o,s.start);if(c){var l=c.name,u=c.constraint,_=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,c)}));return [t.createCodeFixAction(r,_,[e.Diagnostics.Convert_0_to_1_in_0,u,l],r,e.Diagnostics.Convert_all_type_literals_to_mapped_type)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){var r=i(t.file,t.start);r&&a(e,t.file,r);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r=[e.Diagnostics.Class_0_incorrectly_implements_interface_1.code,e.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code],n="fixClassIncorrectlyImplementsInterface";function i(t,r){return e.Debug.checkDefined(e.getContainingClass(e.getTokenAtPosition(t,r)),"There should be a containing class")}function a(t){return !(t.valueDeclaration&&8&e.getEffectiveModifierFlags(t.valueDeclaration))}function o(r,n,i,o,s,c){var l=r.program.getTypeChecker(),u=function(t,r){var n=e.getEffectiveBaseTypeNode(t);if(!n)return e.createSymbolTable();var i=r.getTypeAtLocation(n),o=r.getPropertiesOfType(i);return e.createSymbolTable(o.filter(a))}(o,l),_=l.getTypeAtLocation(n),d=l.getPropertiesOfType(_).filter(e.and(a,(function(e){return !u.has(e.escapedName)}))),p=l.getTypeAtLocation(o),f=e.find(o.members,(function(t){return e.isConstructorDeclaration(t)}));p.getNumberIndexType()||m(_,1),p.getStringIndexType()||m(_,0);var g=t.createImportAdder(i,r.program,c,r.host);function m(e,n){var a=l.getIndexInfoOfType(e,n);a&&y(i,o,l.indexInfoToIndexSignatureDeclaration(a,o,void 0,t.getNoopSymbolTrackerWithResolver(r)));}function y(e,t,r){f?s.insertNodeAfter(e,f,r):s.insertMemberAtStart(e,t,r);}t.createMissingMemberNodes(o,d,i,r,c,g,(function(e){return y(i,o,e)})),g.writeFixes(s);}t.registerCodeFix({errorCodes:r,getCodeActions:function(r){var a=r.sourceFile,s=r.span,c=i(a,s.start);return e.mapDefined(e.getEffectiveImplementsTypeNodes(c),(function(i){var s=e.textChanges.ChangeTracker.with(r,(function(e){return o(r,i,a,c,e,r.preferences)}));return 0===s.length?void 0:t.createCodeFixAction(n,s,[e.Diagnostics.Implement_interface_0,i.getText(a)],n,e.Diagnostics.Implement_all_unimplemented_interfaces)}))},fixIds:[n],getAllCodeActions:function(n){var a=new e.Map;return t.codeFixAll(n,r,(function(t,r){var s=i(r.file,r.start);if(e.addToSeen(a,e.getNodeId(s)))for(var c=0,l=e.getEffectiveImplementsTypeNodes(s);c<l.length;c++){var u=l[c];o(n,u,r.file,s,t,n.preferences);}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){t.importFixName="import";var r,a,o="fixMissingImport",s=[e.Diagnostics.Cannot_find_name_0.code,e.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,e.Diagnostics.Cannot_find_namespace_0.code,e.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,e.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,e.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,e.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code];function c(t,r,n,i,a){var o=r.getCompilerOptions(),s=[],c=[],u=new e.Map,_=new e.Map;return {addImportFromDiagnostic:function(e,t){var r=y(t,e.code,e.start,n);r&&r.fixes.length&&p(r);},addImportFromExportedSymbol:function(s,c){var u=e.Debug.checkDefined(s.parent),_=e.getNameForExportedSymbol(s,e.getEmitScriptTarget(o)),f=r.getTypeChecker(),g=f.getMergedSymbol(e.skipAlias(s,f)),y=d(t,g,u,_,!1,a,r,i,n),v=m(t,r),h=l(t,y,u,r,void 0,!!c,v,a,i);h&&p({fixes:[h],symbolName:_,errorIdentifierText:void 0});},writeFixes:function(r){for(var n,a=e.getQuotePreference(t,i),l=0,d=s;l<d.length;l++){var p=d[l];N(r,t,p);}for(var f=0,g=c;f<g.length;f++)p=g[f],F(r,t,p,a);u.forEach((function(n){var i=n.importClauseOrBindingPattern,a=n.defaultImport,s=n.namedImports;E(r,t,i,a,e.arrayFrom(s.entries(),(function(e){var t=e[0];return {addAsTypeOnly:e[1],name:t}})),o);})),_.forEach((function(t,r){var i=t.useRequire,o=t.defaultImport,s=t.namedImports,c=t.namespaceLikeImport,l=(i?I:w)(r.slice(2),a,o,s&&e.arrayFrom(s.entries(),(function(e){var t=e[0];return {addAsTypeOnly:e[1],name:t}})),c);n=e.combine(n,l);})),n&&e.insertImports(r,t,n,!0);},hasFixes:function(){return s.length>0||c.length>0||u.size>0||_.size>0}};function p(t){var r,n,i=t.fixes,a=t.symbolName,o=e.first(i);switch(o.kind){case 0:s.push(o);break;case 1:c.push(o);break;case 2:var l=o.importClauseOrBindingPattern,d=o.importKind,p=o.addAsTypeOnly,f=String(e.getNodeId(l));if((v=u.get(f))||u.set(f,v={importClauseOrBindingPattern:l,defaultImport:void 0,namedImports:new e.Map}),0===d){var g=null==v?void 0:v.namedImports.get(a);v.namedImports.set(a,h(g,p));}else e.Debug.assert(void 0===v.defaultImport||v.defaultImport.name===a,"(Add to Existing) Default import should be missing or match symbolName"),v.defaultImport={name:a,addAsTypeOnly:h(null===(r=v.defaultImport)||void 0===r?void 0:r.addAsTypeOnly,p)};break;case 3:var m=o.moduleSpecifier,y=(d=o.importKind,o.useRequire),v=function(e,t,r,n){var i=b(e,!0),a=b(e,!1),o=_.get(i),s=_.get(a),c={defaultImport:void 0,namedImports:void 0,namespaceLikeImport:void 0,useRequire:r};return 1===t&&2===n?o||(_.set(i,c),c):1===n&&(o||s)?o||s:s||(_.set(a,c),c)}(m,d,y,p=o.addAsTypeOnly);switch(e.Debug.assert(v.useRequire===y,"(Add new) Tried to add an `import` and a `require` for the same module"),d){case 1:e.Debug.assert(void 0===v.defaultImport||v.defaultImport.name===a,"(Add new) Default import should be missing or match symbolName"),v.defaultImport={name:a,addAsTypeOnly:h(null===(n=v.defaultImport)||void 0===n?void 0:n.addAsTypeOnly,p)};break;case 0:g=(v.namedImports||(v.namedImports=new e.Map)).get(a),v.namedImports.set(a,h(g,p));break;case 3:case 2:e.Debug.assert(void 0===v.namespaceLikeImport||v.namespaceLikeImport.name===a,"Namespacelike import shoudl be missing or match symbolName"),v.namespaceLikeImport={importKind:d,name:a,addAsTypeOnly:p};}break;case 4:break;default:e.Debug.assertNever(o,"fix wasn't never - got kind ".concat(o.kind));}function h(e,t){return Math.max(null!=e?e:0,t)}function b(e,t){return "".concat(t?1:0,"|").concat(e)}}}function l(t,r,n,i,a,o,s,c,l){e.Debug.assert(r.some((function(e){return e.moduleSymbol===n||e.symbol.parent===n})),"Some exportInfo should match the specified moduleSymbol");var u=e.createPackageJsonImportFilter(t,l,c);return h(p(r,a,o,s,i,t,c,l).fixes,t,i,u,c)}function u(e){return {description:e.description,changes:e.changes,commands:e.commands}}function _(t,r,n,i){var a,o,s=n.getCompilerOptions(),c=u(n.getTypeChecker(),!1);if(c)return c;var l=null===(o=null===(a=i.getPackageJsonAutoImportProvider)||void 0===a?void 0:a.call(i))||void 0===o?void 0:o.getTypeChecker();return e.Debug.checkDefined(l&&u(l,!0),"Could not find symbol in specified module for code actions");function u(n,i){var a=e.getDefaultLikeExportInfo(r,n,s);if(a&&e.skipAlias(a.symbol,n)===t)return {symbol:a.symbol,moduleSymbol:r,moduleFileName:void 0,exportKind:a.exportKind,targetFlags:e.skipAlias(t,n).flags,isFromPackageJson:i};var o=n.tryGetMemberInModuleExportsAndProperties(t.name,r);return o&&e.skipAlias(o,n)===t?{symbol:o,moduleSymbol:r,moduleFileName:void 0,exportKind:0,targetFlags:e.skipAlias(t,n).flags,isFromPackageJson:i}:void 0}}function d(t,r,n,i,a,o,s,c,l){var u=[],_=s.getCompilerOptions(),d=e.memoizeOne((function(t){return e.createModuleSpecifierResolutionHost(t?o.getPackageJsonAutoImportProvider():s,o)}));return e.forEachExternalModuleToImportFrom(s,o,l,(function(o,s,c,l){var d=c.getTypeChecker();if(!s||o===n||!e.startsWith(t.fileName,e.getDirectoryPath(s.fileName))){var f=e.getDefaultLikeExportInfo(o,d,_);f&&(f.name===i||L(o,e.getEmitScriptTarget(_),a)===i)&&e.skipAlias(f.symbol,d)===r&&p(c,s,l)&&u.push({symbol:f.symbol,moduleSymbol:o,moduleFileName:null==s?void 0:s.fileName,exportKind:f.exportKind,targetFlags:e.skipAlias(f.symbol,d).flags,isFromPackageJson:l});for(var g=0,m=d.getExportsAndPropertiesOfModule(o);g<m.length;g++){var y=m[g];y.name===i&&d.getMergedSymbol(e.skipAlias(y,d))===r&&p(c,s,l)&&u.push({symbol:y,moduleSymbol:o,moduleFileName:null==s?void 0:s.fileName,exportKind:0,targetFlags:e.skipAlias(y,d).flags,isFromPackageJson:l});}}})),u;function p(r,n,i){var a;return !n||e.isImportableFile(r,t,n,c,void 0,d(i),null===(a=o.getModuleSpecifierCache)||void 0===a?void 0:a.call(o))}}function p(t,r,i,a,o,s,c,l,u,_){void 0===u&&(u=g(o.getTypeChecker(),s,o.getCompilerOptions()));var d=o.getTypeChecker(),p=e.flatMap(t,u.getImportsForExportInfo),m=r&&function(t,r,n,i){return e.firstDefined(t,(function(t){var a,o=t.declaration,s=function(t){var r,n,i;switch(t.kind){case 254:return null===(r=e.tryCast(t.name,e.isIdentifier))||void 0===r?void 0:r.text;case 265:return t.name.text;case 266:return null===(i=e.tryCast(null===(n=t.importClause)||void 0===n?void 0:n.namedBindings,e.isNamespaceImport))||void 0===i?void 0:i.name.text;default:return e.Debug.assertNever(t)}}(o),c=null===(a=e.tryGetModuleSpecifierFromDeclaration(o))||void 0===a?void 0:a.text;if(s&&c){var l=function(t,r){var n;switch(t.kind){case 254:return r.resolveExternalModuleName(t.initializer.arguments[0]);case 265:return r.getAliasedSymbol(t.symbol);case 266:var i=e.tryCast(null===(n=t.importClause)||void 0===n?void 0:n.namedBindings,e.isNamespaceImport);return i&&r.getAliasedSymbol(i.symbol);default:return e.Debug.assertNever(t)}}(o,i);if(l&&l.exports.has(e.escapeLeadingUnderscores(r)))return {kind:0,namespacePrefix:s,position:n,moduleSpecifier:c}}}))}(p,r.symbolName,r.position,d),y=function(t,r,n,i){return e.firstDefined(t,(function(t){var a=t.declaration,o=t.importKind,s=t.symbol,c=t.targetFlags;if(3!==o&&2!==o&&265!==a.kind){if(254===a.kind)return 0!==o&&1!==o||201!==a.name.kind?void 0:{kind:2,importClauseOrBindingPattern:a.name,importKind:o,moduleSpecifier:a.initializer.arguments[0].text,addAsTypeOnly:4};var l=a.importClause;if(l&&e.isStringLiteralLike(a.moduleSpecifier)){var u=l.name,_=l.namedBindings;if(!l.isTypeOnly||0===o&&_){var d=f(r,!1,s,c,n,i);if(!(1===o&&(u||2===d&&_)||0===o&&268===(null==_?void 0:_.kind)))return {kind:2,importClauseOrBindingPattern:l,importKind:o,moduleSpecifier:a.moduleSpecifier.text,addAsTypeOnly:d}}}}}))}(p,i,d,o.getCompilerOptions());if(y)return {computedWithoutCacheCount:0,fixes:n$4(n$4([],m?[m]:e.emptyArray,!0),[y],!1)};var v=function(t,r,n,i,a,o,s,c,l,u){var _=e.firstDefined(r,(function(t){return function(t,r,n,i,a){var o,s=t.declaration,c=t.importKind,l=t.symbol,u=t.targetFlags,_=null===(o=e.tryGetModuleSpecifierFromDeclaration(s))||void 0===o?void 0:o.text;if(_)return {kind:3,moduleSpecifier:_,importKind:c,addAsTypeOnly:n?4:f(r,!0,l,u,i,a),useRequire:n}}(t,o,s,n.getTypeChecker(),n.getCompilerOptions())}));return _?{fixes:[_]}:function(t,r,n,i,a,o,s,c,l){var u=e.isSourceFileJS(r),_=t.getCompilerOptions(),d=e.createModuleSpecifierResolutionHost(t,s),p=e.memoizeOne((function(e){return e?s.getPackageJsonAutoImportProvider().getTypeChecker():t.getTypeChecker()})),g=e.moduleResolutionUsesNodeModules(e.getEmitModuleResolutionKind(_)),m=l?function(t){return {moduleSpecifiers:e.moduleSpecifiers.tryGetModuleSpecifiersFromCache(t,r,d,c),computedWithoutCache:!1}}:function(t,n){return e.moduleSpecifiers.getModuleSpecifiersWithCacheInfo(t,n,_,r,d,c)},y=0,v=e.flatMap(o,(function(t,o){var s=p(t.isFromPackageJson),c=m(t.moduleSymbol,s),l=c.computedWithoutCache,d=c.moduleSpecifiers,v=!!(111551&t.targetFlags),h=f(i,!0,t.symbol,t.targetFlags,s,_);return y+=l?1:0,e.mapDefined(d,(function(i){return g&&e.pathContainsNodeModules(i)?void 0:!v&&u&&void 0!==n?{kind:1,moduleSpecifier:i,position:n,exportInfo:t,isReExport:o>0}:{kind:3,moduleSpecifier:i,importKind:D(r,t.exportKind,_),useRequire:a,addAsTypeOnly:h,exportInfo:t,isReExport:o>0}}))}));return {computedWithoutCacheCount:y,fixes:v}}(n,i,a,o,s,t,c,l,u)}(t,p,o,s,null==r?void 0:r.position,i,a,c,l,_),h=v.fixes,b=v.computedWithoutCacheCount;return {computedWithoutCacheCount:void 0===b?0:b,fixes:n$4(n$4([],m?[m]:e.emptyArray,!0),h,!0)}}function f(e,t,r,n,i,a){return e?t&&2===a.importsNotUsedAsValues?2:!a.isolatedModules||!a.preserveValueImports||111551&n&&!i.getTypeOnlyAliasDeclaration(r)?1:2:4}function g(t,r,n){for(var i,a=0,o=r.imports;a<o.length;a++){var s=o[a],c=e.importFromModuleSpecifier(s);if(e.isVariableDeclarationInitializedToRequire(c.parent))(l=t.resolveExternalModuleName(s))&&(i||(i=e.createMultiMap())).add(e.getSymbolId(l),c.parent);else if(266===c.kind||265===c.kind){var l;(l=t.getSymbolAtLocation(s))&&(i||(i=e.createMultiMap())).add(e.getSymbolId(l),c);}}return {getImportsForExportInfo:function(t){var a=t.moduleSymbol,o=t.exportKind,s=t.targetFlags,c=t.symbol;if(!(111551&s)&&e.isSourceFileJS(r))return e.emptyArray;var l=null==i?void 0:i.get(e.getSymbolId(a));if(!l)return e.emptyArray;var u=D(r,o,n);return l.map((function(e){return {declaration:e,importKind:u,symbol:c,targetFlags:s}}))}}}function m(t,r){if(!e.isSourceFileJS(t))return !1;if(t.commonJsModuleIndicator&&!t.externalModuleIndicator)return !0;if(t.externalModuleIndicator&&!t.commonJsModuleIndicator)return !1;var n=r.getCompilerOptions();if(n.configFile)return e.getEmitModuleKind(n)<e.ModuleKind.ES2015;for(var i=0,a=r.getSourceFiles();i<a.length;i++){var o=a[i];if(o!==t&&e.isSourceFileJS(o)&&!r.isSourceFileFromExternalLibrary(o)){if(o.commonJsModuleIndicator&&!o.externalModuleIndicator)return !0;if(o.externalModuleIndicator&&!o.commonJsModuleIndicator)return !1}}return !0}function y(t,r,n,a){var o,s=e.getTokenAtPosition(t.sourceFile,n);if(r===e.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code)o=function(t,r){var n,i=t.sourceFile,a=t.program,o=t.host,s=t.preferences,c=a.getTypeChecker(),l=function(t,r){var n=e.isIdentifier(t)?r.getSymbolAtLocation(t):void 0;if(e.isUMDExportSymbol(n))return n;var i=t.parent;return e.isJsxOpeningLikeElement(i)&&i.tagName===t||e.isJsxOpeningFragment(i)?e.tryCast(r.resolveName(r.getJsxNamespace(i),e.isJsxOpeningLikeElement(i)?t:i,111551,!1),e.isUMDExportSymbol):void 0}(r,c);if(l){var u=c.getAliasedSymbol(l),_=l.name,d=[{symbol:l,moduleSymbol:u,moduleFileName:void 0,exportKind:3,targetFlags:u.flags,isFromPackageJson:!1}],f=m(i,a),g=e.isIdentifier(r)?r.getStart(i):void 0;return {fixes:p(d,g?{position:g,symbolName:_}:void 0,!1,f,a,i,o,s).fixes,symbolName:_,errorIdentifierText:null===(n=e.tryCast(r,e.isIdentifier))||void 0===n?void 0:n.text}}}(t,s);else {if(!e.isIdentifier(s))return;if(r===e.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code){var c=T(t.sourceFile,t.program.getTypeChecker(),s,t.program.getCompilerOptions()),l=S(t.sourceFile,s,c,t.program);return l&&{fixes:[l],symbolName:c,errorIdentifierText:s.text}}o=function(t,r,n){var i=t.sourceFile,a=t.program,o=t.cancellationToken,s=t.host,c=t.preferences,l=a.getTypeChecker(),u=a.getCompilerOptions(),_=T(i,l,r,u);if("default"!==_){var d=e.isValidTypeOnlyAliasUseSite(r),f=m(i,a),g=function(t,r,n,i,a,o,s,c,l){var u,_=e.createMultiMap(),d=e.createPackageJsonImportFilter(a,l,c),p=null===(u=c.getModuleSpecifierCache)||void 0===u?void 0:u.call(c),f=e.memoizeOne((function(t){return e.createModuleSpecifierResolutionHost(t?c.getPackageJsonAutoImportProvider():o,c)}));function g(t,r,n,i,o,s){var c=f(s);if(r&&e.isImportableFile(o,a,r,l,d,c,p)||!r&&d.allowsImportingAmbientModule(t,c)){var u=o.getTypeChecker();_.add(e.getUniqueSymbolId(n,u).toString(),{symbol:n,moduleSymbol:t,moduleFileName:null==r?void 0:r.fileName,exportKind:i,targetFlags:e.skipAlias(n,u).flags,isFromPackageJson:s});}}return e.forEachExternalModuleToImportFrom(o,c,s,(function(a,o,s,c){var l=s.getTypeChecker();i.throwIfCancellationRequested();var u=s.getCompilerOptions(),_=e.getDefaultLikeExportInfo(a,l,u);_&&(_.name===t||L(a,e.getEmitScriptTarget(u),r)===t)&&M(_.symbolForMeaning,n)&&g(a,o,_.symbol,_.exportKind,s,c);var d=l.tryGetMemberInModuleExportsAndProperties(t,a);d&&M(d,n)&&g(a,o,d,0,s,c);})),_}(_,e.isJSXTagName(r),e.getMeaningFromLocation(r),o,i,a,n,s,c);return {fixes:e.arrayFrom(e.flatMapIterator(g.entries(),(function(e){return p(e[1],{symbolName:_,position:r.getStart(i)},d,f,a,i,s,c).fixes}))),symbolName:_,errorIdentifierText:r.text}}}(t,s,a);}var u=e.createPackageJsonImportFilter(t.sourceFile,t.preferences,t.host);return o&&i$1(i$1({},o),{fixes:v(o.fixes,t.sourceFile,t.program,u,t.host)})}function v(t,r,n,i,a){var o=function(t){return e.toPath(t,a.getCurrentDirectory(),e.hostGetCanonicalFileName(a))};return e.sort(t,(function(t,a){return e.compareValues(t.kind,a.kind)||b(t,a,r,n,i.allowsImportingSpecifier,o)}))}function h(t,r,n,i,a){if(e.some(t))return 0===t[0].kind||2===t[0].kind?t[0]:t.reduce((function(t,o){return -1===b(o,t,r,n,i.allowsImportingSpecifier,(function(t){return e.toPath(t,a.getCurrentDirectory(),e.hostGetCanonicalFileName(a))}))?o:t}))}function b(t,r,n,i,a,o){return 0!==t.kind&&0!==r.kind?e.compareBooleans(a(r.moduleSpecifier),a(t.moduleSpecifier))||function(t,r,n,i){return e.startsWith(t,"node:")&&!e.startsWith(r,"node:")?e.shouldUseUriStyleNodeCoreModules(n,i)?-1:1:e.startsWith(r,"node:")&&!e.startsWith(t,"node:")?e.shouldUseUriStyleNodeCoreModules(n,i)?1:-1:0}(t.moduleSpecifier,r.moduleSpecifier,n,i)||e.compareBooleans(x(t,n,i.getCompilerOptions(),o),x(r,n,i.getCompilerOptions(),o))||e.compareNumberOfDirectorySeparators(t.moduleSpecifier,r.moduleSpecifier):0}function x(t,r,n,i){var a,o;if(t.isReExport&&(null===(a=t.exportInfo)||void 0===a?void 0:a.moduleFileName)&&e.getEmitModuleResolutionKind(n)===e.ModuleResolutionKind.NodeJs&&(o=t.exportInfo.moduleFileName,"index"===e.getBaseFileName(o,[".js",".jsx",".d.ts",".ts",".tsx"],!0))){var s=i(e.getDirectoryPath(t.exportInfo.moduleFileName));return e.startsWith(r.path,s)}return !1}function D(t,r,n,i){switch(r){case 0:return 0;case 1:return 1;case 2:return function(t,r,n){var i=e.getAllowSyntheticDefaultImports(r),a=e.isInJSFile(t);if(!a&&e.getEmitModuleKind(r)>=e.ModuleKind.ES2015)return i?1:2;if(a)return e.isExternalModule(t)||n?i?1:2:3;for(var o=0,s=t.statements;o<s.length;o++){var c=s[o];if(e.isImportEqualsDeclaration(c)&&!e.nodeIsMissing(c.moduleReference))return 3}return i?1:3}(t,n,!!i);case 3:return function(t,r,n){if(e.getAllowSyntheticDefaultImports(r))return 1;var i=e.getEmitModuleKind(r);switch(i){case e.ModuleKind.AMD:case e.ModuleKind.CommonJS:case e.ModuleKind.UMD:return e.isInJSFile(t)&&(e.isExternalModule(t)||n)?2:3;case e.ModuleKind.System:case e.ModuleKind.ES2015:case e.ModuleKind.ES2020:case e.ModuleKind.ES2022:case e.ModuleKind.ESNext:case e.ModuleKind.None:return 2;case e.ModuleKind.Node16:case e.ModuleKind.NodeNext:return t.impliedNodeFormat===e.ModuleKind.ESNext?2:3;default:return e.Debug.assertNever(i,"Unexpected moduleKind ".concat(i))}}(t,n,!!i);default:return e.Debug.assertNever(r)}}function S(t,r,n,i){var a=i.getTypeChecker(),o=a.resolveName(n,r,111551,!0);if(o){var s=a.getTypeOnlyAliasDeclaration(o);if(s&&e.getSourceFileOfNode(s)===t)return {kind:4,typeOnlyAliasDeclaration:s}}}function T(t,r,n,i){var a=n.parent;if((e.isJsxOpeningLikeElement(a)||e.isJsxClosingElement(a))&&a.tagName===n&&e.jsxModeNeedsExplicitImport(i.jsx)){var o=r.getJsxNamespace(t);if(function(t,r,n){if(e.isIntrinsicJsxName(r.text))return !0;var i=n.resolveName(t,r,111551,!0);return !i||e.some(i.declarations,e.isTypeOnlyImportOrExportDeclaration)&&!(111551&i.flags)}(o,n,r))return o}return n.text}function C(r,n,i,a,s,c,l){var u,_=e.textChanges.ChangeTracker.with(r,(function(t){u=function(t,r,n,i,a,o,s){switch(i.kind){case 0:return N(t,r,i),[e.Diagnostics.Change_0_to_1,n,"".concat(i.namespacePrefix,".").concat(n)];case 1:return F(t,r,i,o),[e.Diagnostics.Change_0_to_1,n,A(i.moduleSpecifier,o)+n];case 2:var c=i.importClauseOrBindingPattern,l=i.importKind,u=i.addAsTypeOnly,_=i.moduleSpecifier;E(t,r,c,1===l?{name:n,addAsTypeOnly:u}:void 0,0===l?[{name:n,addAsTypeOnly:u}]:e.emptyArray,s);var d=e.stripQuotes(_);return a?[e.Diagnostics.Import_0_from_1,n,d]:[e.Diagnostics.Update_import_from_0,d];case 3:l=i.importKind,_=i.moduleSpecifier,u=i.addAsTypeOnly;var p=i.useRequire?I:w,f=1===l?{name:n,addAsTypeOnly:u}:void 0,g=0===l?[{name:n,addAsTypeOnly:u}]:void 0,m=2===l||3===l?{importKind:l,name:n,addAsTypeOnly:u}:void 0;return e.insertImports(t,r,p(_,o,f,g,m),!0),a?[e.Diagnostics.Import_0_from_1,n,_]:[e.Diagnostics.Add_import_from_0,_];case 4:var y=function(t,r,n,i){var a=n.preserveValueImports&&n.isolatedModules;switch(r.kind){case 270:if(r.isTypeOnly){if(r.parent.elements.length>1&&e.OrganizeImports.importSpecifiersAreSorted(r.parent.elements)){t.delete(i,r);var o=e.factory.updateImportSpecifier(r,!1,r.propertyName,r.name),s=e.OrganizeImports.getImportSpecifierInsertionIndex(r.parent.elements,o);t.insertImportSpecifierAtIndex(i,o,r.parent,s);}else t.deleteRange(i,r.getFirstToken());return r}return e.Debug.assert(r.parent.parent.isTypeOnly),c(r.parent.parent),r.parent.parent;case 267:return c(r),r;case 268:return c(r.parent),r.parent;case 265:return t.deleteRange(i,r.getChildAt(1)),r;default:e.Debug.failBadSyntaxKind(r);}function c(n){if(t.delete(i,e.getTypeKeywordOfTypeOnlyImport(n,i)),a){var o=e.tryCast(n.namedBindings,e.isNamedImports);if(o&&o.elements.length>1){e.OrganizeImports.importSpecifiersAreSorted(o.elements)&&270===r.kind&&0!==o.elements.indexOf(r)&&(t.delete(i,r),t.insertImportSpecifierAtIndex(i,r,o,0));for(var s=0,c=o.elements;s<c.length;s++){var l=c[s];l===r||l.isTypeOnly||t.insertModifierBefore(i,152,l);}}}}}(t,i.typeOnlyAliasDeclaration,s,r);return 270===y.kind?[e.Diagnostics.Remove_type_from_import_of_0_from_1,n,k(y.parent.parent)]:[e.Diagnostics.Remove_type_from_import_declaration_from_0,k(y)];default:return e.Debug.assertNever(i,"Unexpected fix kind ".concat(i.kind))}}(t,n,i,a,s,c,l);}));return t.createCodeFixAction(t.importFixName,_,u,o,e.Diagnostics.Add_all_missing_imports)}function k(t){var r,n;return 265===t.kind?(null===(n=e.tryCast(null===(r=e.tryCast(t.moduleReference,e.isExternalModuleReference))||void 0===r?void 0:r.expression,e.isStringLiteralLike))||void 0===n?void 0:n.text)||t.moduleReference.getText():e.cast(t.parent.moduleSpecifier,e.isStringLiteral).text}function E(t,r,i,a,o,s){var c;if(201!==i.kind){var l=i.isTypeOnly&&e.some(n$4([a],o,!0),(function(e){return 4===(null==e?void 0:e.addAsTypeOnly)})),u=i.namedBindings&&(null===(c=e.tryCast(i.namedBindings,e.isNamedImports))||void 0===c?void 0:c.elements),_=l&&s.preserveValueImports&&s.isolatedModules;if(a&&(e.Debug.assert(!i.name,"Cannot add a default import to an import clause that already has one"),t.insertNodeAt(r,i.getStart(r),e.factory.createIdentifier(a.name),{suffix:", "})),o.length){var d=e.stableSort(o.map((function(t){return e.factory.createImportSpecifier((!i.isTypeOnly||l)&&P(t),void 0,e.factory.createIdentifier(t.name))})),e.OrganizeImports.compareImportOrExportSpecifiers);if((null==u?void 0:u.length)&&e.OrganizeImports.importSpecifiersAreSorted(u))for(var p=0,f=d;p<f.length;p++){var g=f[p],m=_&&!g.isTypeOnly?0:e.OrganizeImports.getImportSpecifierInsertionIndex(u,g);t.insertImportSpecifierAtIndex(r,g,i.namedBindings,m);}else if(null==u?void 0:u.length)for(var y=0,v=d;y<v.length;y++)g=v[y],t.insertNodeInListAfter(r,e.last(u),g,u);else if(d.length){var h=e.factory.createNamedImports(d);i.namedBindings?t.replaceNode(r,i.namedBindings,h):t.insertNodeAfter(r,e.Debug.checkDefined(i.name,"Import clause must have either named imports or a default import"),h);}}if(l&&(t.delete(r,e.getTypeKeywordOfTypeOnlyImport(i,r)),_&&u))for(var b=0,x=u;b<x.length;b++)T=x[b],t.insertModifierBefore(r,152,T);}else {a&&C(i,a.name,"default");for(var D=0,S=o;D<S.length;D++){var T=S[D];C(i,T.name,void 0);}}function C(n,i,a){var o=e.factory.createBindingElement(void 0,a,i);n.elements.length?t.insertNodeInListAfter(r,e.last(n.elements),o):t.replaceNode(r,n,e.factory.createObjectBindingPattern([o]));}}function N(e,t,r){var n=r.namespacePrefix,i=r.position;e.insertText(t,i,n+".");}function F(e,t,r,n){var i=r.moduleSpecifier,a=r.position;e.insertText(t,a,A(i,n));}function A(t,r){var n=e.getQuoteFromPreference(r);return "import(".concat(n).concat(t).concat(n,").")}function P(e){return 2===e.addAsTypeOnly}function w(t,r,n,i,a){var o,s=e.makeStringLiteral(t,r);if(void 0!==n||(null==i?void 0:i.length)){var c=(!n||P(n))&&e.every(i,P);o=e.combine(o,e.makeImport(n&&e.factory.createIdentifier(n.name),null==i?void 0:i.map((function(t){var r=t.addAsTypeOnly,n=t.name;return e.factory.createImportSpecifier(!c&&2===r,void 0,e.factory.createIdentifier(n))})),t,r,c));}if(a){var l=3===a.importKind?e.factory.createImportEqualsDeclaration(void 0,void 0,P(a),e.factory.createIdentifier(a.name),e.factory.createExternalModuleReference(s)):e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(P(a),void 0,e.factory.createNamespaceImport(e.factory.createIdentifier(a.name))),s,void 0);o=e.combine(o,l);}return e.Debug.checkDefined(o)}function I(t,r,n,i,a){var o,s=e.makeStringLiteral(t,r);if(n||(null==i?void 0:i.length)){var c=(null==i?void 0:i.map((function(t){var r=t.name;return e.factory.createBindingElement(void 0,void 0,r)})))||[];n&&c.unshift(e.factory.createBindingElement(void 0,"default",n.name));var l=O(e.factory.createObjectBindingPattern(c),s);o=e.combine(o,l);}return a&&(l=O(a.name,s),o=e.combine(o,l)),e.Debug.checkDefined(o)}function O(t,r){return e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration("string"==typeof t?e.factory.createIdentifier(t):t,void 0,void 0,e.factory.createCallExpression(e.factory.createIdentifier("require"),void 0,[r]))],2))}function M(t,r){var n=t.declarations;return e.some(n,(function(t){return !!(e.getMeaningFromDeclaration(t)&r)}))}function L(t,r,n){return R(e.removeFileExtension(e.stripQuotes(t.name)),r,n)}function R(t,r,n){var i=e.getBaseFileName(e.removeSuffix(t,"/index")),a="",o=!0,s=i.charCodeAt(0);e.isIdentifierStart(s,r)?(a+=String.fromCharCode(s),n&&(a=a.toUpperCase())):o=!1;for(var c=1;c<i.length;c++){var l=i.charCodeAt(c),u=e.isIdentifierPart(l,r);if(u){var _=String.fromCharCode(l);o||(_=_.toUpperCase()),a+=_;}o=u;}return e.isStringANonContextualKeyword(a)?"_".concat(a):a||"_"}t.registerCodeFix({errorCodes:s,getCodeActions:function(t){var r=t.errorCode,n=t.preferences,i=t.sourceFile,a=t.span,o=t.program,s=y(t,r,a.start,!0);if(s){var c=s.fixes,l=s.symbolName,u=s.errorIdentifierText,_=e.getQuotePreference(i,n);return c.map((function(e){return C(t,i,l,e,l!==u,_,o.getCompilerOptions())}))}},fixIds:[o],getAllCodeActions:function(r){var n=c(r.sourceFile,r.program,!0,r.preferences,r.host);return t.eachDiagnostic(r,s,(function(e){return n.addImportFromDiagnostic(e,r)})),t.createCombinedCodeActions(e.textChanges.ChangeTracker.with(r,n.writeFixes))}}),t.createImportAdder=function(e,t,r,n){return c(e,t,!1,r,n)},t.createImportSpecifierResolver=function(t,r,n,a){var o=e.createPackageJsonImportFilter(t,a,n),s=g(r.getTypeChecker(),t,r.getCompilerOptions());return {getModuleSpecifierForBestExportInfo:function(e,c,l,u,_){var d=p(e,{symbolName:c,position:l},u,!1,r,t,n,a,s,_),f=d.fixes,g=d.computedWithoutCacheCount,m=h(f,t,r,o,n);return m&&i$1(i$1({},m),{computedWithoutCacheCount:g})}}},function(e){e[e.UseNamespace=0]="UseNamespace",e[e.JsdocTypeImport=1]="JsdocTypeImport",e[e.AddToExisting=2]="AddToExisting",e[e.AddNew=3]="AddNew",e[e.PromoteTypeOnly=4]="PromoteTypeOnly";}(r||(r={})),function(e){e[e.Allowed=1]="Allowed",e[e.Required=2]="Required",e[e.NotAllowed=4]="NotAllowed";}(a||(a={})),t.getImportCompletionAction=function(t,r,n,i,a,o,s,c,p,f){var g=s.getCompilerOptions(),y=e.pathIsBareSpecifier(e.stripQuotes(r.name))?[_(t,r,s,o)]:d(n,t,r,i,a,o,s,f,!0),v=m(n,s),h=e.isValidTypeOnlyAliasUseSite(e.getTokenAtPosition(n,p)),b=e.Debug.checkDefined(l(n,y,r,s,{symbolName:i,position:p},h,v,o,f));return {moduleSpecifier:b.moduleSpecifier,codeAction:u(C({host:o,formatContext:c,preferences:f},n,i,b,!1,e.getQuotePreference(n,f),g))}},t.getPromoteTypeOnlyCompletionAction=function(e,t,r,n,i,a){var o=r.getCompilerOptions(),s=T(e,r.getTypeChecker(),t,o),c=S(e,t,s,r),l=s!==t.text;return c&&u(C({host:n,formatContext:i,preferences:a},e,s,c,l,1,o))},t.getImportKind=D,t.moduleSymbolToValidIdentifier=L,t.moduleSpecifierToValidIdentifier=R;}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r,n="fixOverrideModifier",i="fixAddOverrideModifier",a="fixRemoveOverrideModifier",o=[e.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code,e.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code,e.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code,e.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code,e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code,e.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code,e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code],s=((r={})[e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code]={descriptions:e.Diagnostics.Add_override_modifier,fixId:i,fixAllDescriptions:e.Diagnostics.Add_all_missing_override_modifiers},r[e.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code]={descriptions:e.Diagnostics.Add_override_modifier,fixId:i,fixAllDescriptions:e.Diagnostics.Add_all_missing_override_modifiers},r[e.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]={descriptions:e.Diagnostics.Remove_override_modifier,fixId:a,fixAllDescriptions:e.Diagnostics.Remove_all_unnecessary_override_modifiers},r[e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code]={descriptions:e.Diagnostics.Remove_override_modifier,fixId:a,fixAllDescriptions:e.Diagnostics.Remove_override_modifier},r[e.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code]={descriptions:e.Diagnostics.Add_override_modifier,fixId:i,fixAllDescriptions:e.Diagnostics.Add_all_missing_override_modifiers},r[e.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code]={descriptions:e.Diagnostics.Add_override_modifier,fixId:i,fixAllDescriptions:e.Diagnostics.Add_all_missing_override_modifiers},r[e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code]={descriptions:e.Diagnostics.Add_override_modifier,fixId:i,fixAllDescriptions:e.Diagnostics.Remove_all_unnecessary_override_modifiers},r[e.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]={descriptions:e.Diagnostics.Remove_override_modifier,fixId:a,fixAllDescriptions:e.Diagnostics.Remove_all_unnecessary_override_modifiers},r[e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code]={descriptions:e.Diagnostics.Remove_override_modifier,fixId:a,fixAllDescriptions:e.Diagnostics.Remove_all_unnecessary_override_modifiers},r);function c(t,r,n,i){switch(n){case e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code:case e.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code:case e.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code:case e.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code:case e.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code:return function(t,r,n){var i=u(r,n);if(e.isSourceFileJS(r))t.addJSDocTags(r,i,[e.factory.createJSDocOverrideTag(e.factory.createIdentifier("override"))]);else {var a=i.modifiers||e.emptyArray,o=e.find(a,e.isStaticModifier),s=e.find(a,e.isAbstractModifier),c=e.find(a,(function(t){return e.isAccessibilityModifier(t.kind)})),l=s?s.end:o?o.end:c?c.end:i.decorators?e.skipTrivia(r.text,i.decorators.end):i.getStart(r),_=c||o||s?{prefix:" "}:{suffix:" "};t.insertModifierAt(r,l,159,_);}}(t,r.sourceFile,i);case e.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code:case e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code:case e.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code:case e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code:return function(t,r,n){var i=u(r,n);if(e.isSourceFileJS(r))t.filterJSDocTags(r,i,e.not(e.isJSDocOverrideTag));else {var a=i.modifiers&&e.find(i.modifiers,(function(e){return 159===e.kind}));e.Debug.assertIsDefined(a),t.deleteModifier(r,a);}}(t,r.sourceFile,i);default:e.Debug.fail("Unexpected error code: "+n);}}function l(t){switch(t.kind){case 171:case 167:case 169:case 172:case 173:return !0;case 164:return e.isParameterPropertyDeclaration(t,t.parent);default:return !1}}function u(t,r){var n=e.getTokenAtPosition(t,r),i=e.findAncestor(n,(function(t){return e.isClassLike(t)?"quit":l(t)}));return e.Debug.assert(i&&l(i)),i}t.registerCodeFix({errorCodes:o,getCodeActions:function(r){var i=r.errorCode,a=r.span,o=s[i];if(!o)return e.emptyArray;var l=o.descriptions,u=o.fixId,_=o.fixAllDescriptions,d=e.textChanges.ChangeTracker.with(r,(function(e){return c(e,r,i,a.start)}));return [t.createCodeFixActionMaybeFixAll(n,d,l,u,_)]},fixIds:[n,i,a],getAllCodeActions:function(e){return t.codeFixAll(e,o,(function(t,r){var n=r.code,i=r.start,a=s[n];a&&a.fixId===e.fixId&&c(t,e,n,i);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixNoPropertyAccessFromIndexSignature",n=[e.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code];function i(t,r,n,i){var a=e.getQuotePreference(r,i),o=e.factory.createStringLiteral(n.name.text,0===a);t.replaceNode(r,n,e.isPropertyAccessChain(n)?e.factory.createElementAccessChain(n.expression,n.questionDotToken,o):e.factory.createElementAccessExpression(n.expression,o));}function a(t,r){return e.cast(e.getTokenAtPosition(t,r).parent,e.isPropertyAccessExpression)}t.registerCodeFix({errorCodes:n,fixIds:[r],getCodeActions:function(n){var o=n.sourceFile,s=n.span,c=n.preferences,l=a(o,s.start),u=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,l,c)}));return [t.createCodeFixAction(r,u,[e.Diagnostics.Use_element_access_for_0,l.name.text],r,e.Diagnostics.Use_element_access_for_all_undeclared_properties)]},getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){return i(t,r.file,a(r.file,r.start),e.preferences)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixImplicitThis",n=[e.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];function i(t,r,n,i){var a=e.getTokenAtPosition(r,n);if(e.isThis(a)){var o=e.getThisContainer(a,!1);if((e.isFunctionDeclaration(o)||e.isFunctionExpression(o))&&!e.isSourceFile(e.getThisContainer(o,!1))){var s=e.Debug.checkDefined(e.findChildOfKind(o,98,r)),c=o.name,l=e.Debug.checkDefined(o.body);if(e.isFunctionExpression(o)){if(c&&e.FindAllReferences.Core.isSymbolReferencedInFile(c,i,r,l))return;return t.delete(r,s),c&&t.delete(r,c),t.insertText(r,l.pos," =>"),[e.Diagnostics.Convert_function_expression_0_to_arrow_function,c?c.text:e.ANONYMOUS]}return t.replaceNode(r,s,e.factory.createToken(85)),t.insertText(r,c.end," = "),t.insertText(r,l.pos," =>"),[e.Diagnostics.Convert_function_declaration_0_to_arrow_function,c.text]}}}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a,o=n.sourceFile,s=n.program,c=n.span,l=e.textChanges.ChangeTracker.with(n,(function(e){a=i(e,o,c.start,s.getTypeChecker());}));return a?[t.createCodeFixAction(r,l,a,r,e.Diagnostics.Fix_all_implicit_this_errors)]:e.emptyArray},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){i(t,r.file,r.start,e.program.getTypeChecker());}))}});}(e.codefix||(e.codefix={}));}(t),function(e){var t,r,n;t=e.codefix||(e.codefix={}),r="fixIncorrectNamedTupleSyntax",n=[e.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type.code,e.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code],t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var i=n.sourceFile,a=n.span,o=function(t,r){var n=e.getTokenAtPosition(t,r);return e.findAncestor(n,(function(e){return 197===e.kind}))}(i,a.start),s=e.textChanges.ChangeTracker.with(n,(function(t){return function(t,r,n){if(n){for(var i=n.type,a=!1,o=!1;185===i.kind||186===i.kind||191===i.kind;)185===i.kind?a=!0:186===i.kind&&(o=!0),i=i.type;var s=e.factory.updateNamedTupleMember(n,n.dotDotDotToken||(o?e.factory.createToken(25):void 0),n.name,n.questionToken||(a?e.factory.createToken(57):void 0),i);s!==n&&t.replaceNode(r,n,s);}}(t,i,o)}));return [t.createCodeFixAction(r,s,e.Diagnostics.Move_labeled_tuple_element_modifiers_to_labels,r,e.Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]},fixIds:[r]});}(t),function(e){!function(t){var r="fixSpelling",n=[e.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,e.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,e.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,e.Diagnostics.Could_not_find_name_0_Did_you_mean_1.code,e.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,e.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,e.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,e.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,e.Diagnostics.No_overload_matches_this_call.code,e.Diagnostics.Type_0_is_not_assignable_to_type_1.code];function i(t,r,n,i){var a=e.getTokenAtPosition(t,r),o=a.parent;if(i!==e.Diagnostics.No_overload_matches_this_call.code&&i!==e.Diagnostics.Type_0_is_not_assignable_to_type_1.code||e.isJsxAttribute(o)){var s,c=n.program.getTypeChecker();if(e.isPropertyAccessExpression(o)&&o.name===a){e.Debug.assert(e.isMemberName(a),"Expected an identifier for spelling (property access)");var l=c.getTypeAtLocation(o.expression);32&o.flags&&(l=c.getNonNullableType(l)),s=c.getSuggestedSymbolForNonexistentProperty(a,l);}else if(e.isBinaryExpression(o)&&101===o.operatorToken.kind&&o.left===a&&e.isPrivateIdentifier(a)){var u=c.getTypeAtLocation(o.right);s=c.getSuggestedSymbolForNonexistentProperty(a,u);}else if(e.isQualifiedName(o)&&o.right===a){var _=c.getSymbolAtLocation(o.left);_&&1536&_.flags&&(s=c.getSuggestedSymbolForNonexistentModule(o.right,_));}else if(e.isImportSpecifier(o)&&o.name===a){e.Debug.assertNode(a,e.isIdentifier,"Expected an identifier for spelling (import)");var d=function(t,r,n){if(n&&e.isStringLiteralLike(n.moduleSpecifier)){var i=e.getResolvedModule(t,n.moduleSpecifier.text,e.getModeForUsageLocation(t,n.moduleSpecifier));return i?r.program.getSourceFile(i.resolvedFileName):void 0}}(t,n,e.findAncestor(a,e.isImportDeclaration));d&&d.symbol&&(s=c.getSuggestedSymbolForNonexistentModule(a,d.symbol));}else if(e.isJsxAttribute(o)&&o.name===a){e.Debug.assertNode(a,e.isIdentifier,"Expected an identifier for JSX attribute");var p=e.findAncestor(a,e.isJsxOpeningLikeElement),f=c.getContextualTypeForArgumentAtIndex(p,0);s=c.getSuggestedSymbolForNonexistentJSXAttribute(a,f);}else if(e.hasSyntacticModifier(o,16384)&&e.isClassElement(o)&&o.name===a){var g=e.findAncestor(a,e.isClassLike),m=g?e.getEffectiveBaseTypeNode(g):void 0,y=m?c.getTypeAtLocation(m):void 0;y&&(s=c.getSuggestedSymbolForNonexistentClassMember(e.getTextOfNode(a),y));}else {var v=e.getMeaningFromLocation(a),h=e.getTextOfNode(a);e.Debug.assert(void 0!==h,"name should be defined"),s=c.getSuggestedSymbolForNonexistentSymbol(a,h,function(e){var t=0;return 4&e&&(t|=1920),2&e&&(t|=788968),1&e&&(t|=111551),t}(v));}return void 0===s?void 0:{node:a,suggestedSymbol:s}}}function a(t,r,n,i,a){var o=e.symbolName(i);if(!e.isIdentifierText(o,a)&&e.isPropertyAccessExpression(n.parent)){var s=i.valueDeclaration;s&&e.isNamedDeclaration(s)&&e.isPrivateIdentifier(s.name)?t.replaceNode(r,n,e.factory.createIdentifier(o)):t.replaceNode(r,n.parent,e.factory.createElementAccessExpression(n.parent.expression,e.factory.createStringLiteral(o)));}else t.replaceNode(r,n,e.factory.createIdentifier(o));}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.errorCode,c=i(o,n.span.start,n,s);if(c){var l=c.node,u=c.suggestedSymbol,_=e.getEmitScriptTarget(n.host.getCompilationSettings()),d=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,l,u,_)}));return [t.createCodeFixAction("spelling",d,[e.Diagnostics.Change_spelling_to_0,e.symbolName(u)],r,e.Diagnostics.Fix_all_detected_spelling_errors)]}},fixIds:[r],getAllCodeActions:function(r){return t.codeFixAll(r,n,(function(t,n){var o=i(n.file,n.start,r,n.code),s=e.getEmitScriptTarget(r.host.getCompilationSettings());o&&a(t,r.sourceFile,o.node,o.suggestedSymbol,s);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r,n="returnValueCorrect",i="fixAddReturnStatement",a="fixRemoveBracesFromArrowFunctionBody",o="fixWrapTheBlockWithParen",s=[e.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,e.Diagnostics.Type_0_is_not_assignable_to_type_1.code,e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code];function c(t,r,n){var i=t.createSymbol(4,r.escapedText);i.type=t.getTypeAtLocation(n);var a=e.createSymbolTable([i]);return t.createAnonymousType(void 0,a,[],[],[])}function l(t,n,i,a){if(n.body&&e.isBlock(n.body)&&1===e.length(n.body.statements)){var o=e.first(n.body.statements);if(e.isExpressionStatement(o)&&u(t,n,t.getTypeAtLocation(o.expression),i,a))return {declaration:n,kind:r.MissingReturnStatement,expression:o.expression,statement:o,commentSource:o.expression};if(e.isLabeledStatement(o)&&e.isExpressionStatement(o.statement)){var s=e.factory.createObjectLiteralExpression([e.factory.createPropertyAssignment(o.label,o.statement.expression)]);if(u(t,n,c(t,o.label,o.statement.expression),i,a))return e.isArrowFunction(n)?{declaration:n,kind:r.MissingParentheses,expression:s,statement:o,commentSource:o.statement.expression}:{declaration:n,kind:r.MissingReturnStatement,expression:s,statement:o,commentSource:o.statement.expression}}else if(e.isBlock(o)&&1===e.length(o.statements)){var l=e.first(o.statements);if(e.isLabeledStatement(l)&&e.isExpressionStatement(l.statement)&&(s=e.factory.createObjectLiteralExpression([e.factory.createPropertyAssignment(l.label,l.statement.expression)]),u(t,n,c(t,l.label,l.statement.expression),i,a)))return {declaration:n,kind:r.MissingReturnStatement,expression:s,statement:o,commentSource:l}}}}function u(t,r,n,i,a){if(a){var o=t.getSignatureFromDeclaration(r);if(o){e.hasSyntacticModifier(r,256)&&(n=t.createPromiseType(n));var s=t.createSignature(r,o.typeParameters,o.thisParameter,o.parameters,n,void 0,o.minArgumentCount,o.flags);n=t.createAnonymousType(void 0,e.createSymbolTable(),[s],[],[]);}else n=t.getAnyType();}return t.isTypeAssignableTo(n,i)}function _(t,r,n,i){var a=e.getTokenAtPosition(r,n);if(a.parent){var o=e.findAncestor(a.parent,e.isFunctionLikeDeclaration);switch(i){case e.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code:if(!(o&&o.body&&o.type&&e.rangeContainsRange(o.type,a)))return;return l(t,o,t.getTypeFromTypeNode(o.type),!1);case e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code:if(!o||!e.isCallExpression(o.parent)||!o.body)return;var s=o.parent.arguments.indexOf(o),c=t.getContextualTypeForArgumentAtIndex(o.parent,s);if(!c)return;return l(t,o,c,!0);case e.Diagnostics.Type_0_is_not_assignable_to_type_1.code:if(!e.isDeclarationName(a)||!e.isVariableLike(a.parent)&&!e.isJsxAttribute(a.parent))return;var u=function(t){switch(t.kind){case 254:case 164:case 203:case 167:case 296:return t.initializer;case 285:return t.initializer&&(e.isJsxExpression(t.initializer)?t.initializer.expression:void 0);case 297:case 166:case 299:case 347:case 340:return}}(a.parent);if(!u||!e.isFunctionLikeDeclaration(u)||!u.body)return;return l(t,u,t.getTypeAtLocation(a.parent),!0)}}}function d(t,r,n,i){e.suppressLeadingAndTrailingTrivia(n);var a=e.probablyUsesSemicolons(r);t.replaceNode(r,i,e.factory.createReturnStatement(n),{leadingTriviaOption:e.textChanges.LeadingTriviaOption.Exclude,trailingTriviaOption:e.textChanges.TrailingTriviaOption.Exclude,suffix:a?";":void 0});}function p(t,r,n,i,a,o){var s=o||e.needsParentheses(i)?e.factory.createParenthesizedExpression(i):i;e.suppressLeadingAndTrailingTrivia(a),e.copyComments(a,s),t.replaceNode(r,n.body,s);}function f(t,r,n,i){t.replaceNode(r,n.body,e.factory.createParenthesizedExpression(i));}function g(r,a,o){var s=e.textChanges.ChangeTracker.with(r,(function(e){return d(e,r.sourceFile,a,o)}));return t.createCodeFixAction(n,s,e.Diagnostics.Add_a_return_statement,i,e.Diagnostics.Add_all_missing_return_statement)}function m(r,i,a){var s=e.textChanges.ChangeTracker.with(r,(function(e){return f(e,r.sourceFile,i,a)}));return t.createCodeFixAction(n,s,e.Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal,o,e.Diagnostics.Wrap_all_object_literal_with_parentheses)}!function(e){e[e.MissingReturnStatement=0]="MissingReturnStatement",e[e.MissingParentheses=1]="MissingParentheses";}(r||(r={})),t.registerCodeFix({errorCodes:s,fixIds:[i,a,o],getCodeActions:function(i){var o=i.program,s=i.sourceFile,c=i.span.start,l=i.errorCode,u=_(o.getTypeChecker(),s,c,l);if(u)return u.kind===r.MissingReturnStatement?e.append([g(i,u.expression,u.statement)],e.isArrowFunction(u.declaration)?function(r,i,o,s){var c=e.textChanges.ChangeTracker.with(r,(function(e){return p(e,r.sourceFile,i,o,s,!1)}));return t.createCodeFixAction(n,c,e.Diagnostics.Remove_braces_from_arrow_function_body,a,e.Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues)}(i,u.declaration,u.expression,u.commentSource):void 0):[m(i,u.declaration,u.expression)]},getAllCodeActions:function(r){return t.codeFixAll(r,s,(function(t,n){var s=_(r.program.getTypeChecker(),n.file,n.start,n.code);if(s)switch(r.fixId){case i:d(t,n.file,s.expression,s.statement);break;case a:if(!e.isArrowFunction(s.declaration))return;p(t,n.file,s.declaration,s.expression,s.commentSource,!1);break;case o:if(!e.isArrowFunction(s.declaration))return;f(t,n.file,s.declaration,s.expression);break;default:e.Debug.fail(JSON.stringify(r.fixId));}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r,i="fixMissingMember",a="fixMissingProperties",o="fixMissingAttributes",s="fixMissingFunctionDeclaration",c=[e.Diagnostics.Property_0_does_not_exist_on_type_1.code,e.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,e.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code,e.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2.code,e.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more.code,e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,e.Diagnostics.Cannot_find_name_0.code];function l(t,r,n,i,a){var o=e.getTokenAtPosition(t,r),s=o.parent;if(n===e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code){if(18!==o.kind||!e.isObjectLiteralExpression(s)||!e.isCallExpression(s.parent))return;var c=e.findIndex(s.parent.arguments,(function(e){return e===s}));if(c<0)return;var l=e.singleOrUndefined(i.getSignaturesOfType(i.getTypeAtLocation(s.parent.expression),0));if(!(l&&l.declaration&&l.parameters[c]))return;var _=l.parameters[c].valueDeclaration;if(!(_&&e.isParameter(_)&&e.isIdentifier(_.name)))return;var d=e.arrayFrom(i.getUnmatchedProperties(i.getTypeAtLocation(s),i.getParameterType(l,c),!1,!1));if(!e.length(d))return;return {kind:3,token:_.name,properties:d,parentDeclaration:s}}if(e.isMemberName(o)){if(e.isIdentifier(o)&&e.hasInitializer(s)&&s.initializer&&e.isObjectLiteralExpression(s.initializer)){if(d=e.arrayFrom(i.getUnmatchedProperties(i.getTypeAtLocation(s.initializer),i.getTypeAtLocation(o),!1,!1)),!e.length(d))return;return {kind:3,token:o,properties:d,parentDeclaration:s.initializer}}if(e.isIdentifier(o)&&e.isJsxOpeningLikeElement(o.parent)){var p=function(t,r,n){var i=t.getContextualType(n.attributes);if(void 0===i)return e.emptyArray;var a=i.getProperties();if(!e.length(a))return e.emptyArray;for(var o=new e.Set,s=0,c=n.attributes.properties;s<c.length;s++){var l=c[s];if(e.isJsxAttribute(l)&&o.add(l.name.escapedText),e.isJsxSpreadAttribute(l))for(var u=0,_=t.getTypeAtLocation(l.expression).getProperties();u<_.length;u++){var d=_[u];o.add(d.escapedName);}}return e.filter(a,(function(t){return e.isIdentifierText(t.name,r,1)&&!(16777216&t.flags||48&e.getCheckFlags(t)||o.has(t.escapedName))}))}(i,e.getEmitScriptTarget(a.getCompilerOptions()),o.parent);if(!e.length(p))return;return {kind:4,token:o,attributes:p,parentDeclaration:o.parent}}if(e.isIdentifier(o)&&e.isCallExpression(s))return {kind:2,token:o,call:s,sourceFile:t,modifierFlags:0,parentDeclaration:t};if(e.isPropertyAccessExpression(s)){var f=e.skipConstraint(i.getTypeAtLocation(s.expression)),g=f.symbol;if(g&&g.declarations){if(e.isIdentifier(o)&&e.isCallExpression(s.parent)){var m=e.find(g.declarations,e.isModuleDeclaration),y=null==m?void 0:m.getSourceFile();if(m&&y&&!u(a,y))return {kind:2,token:o,call:s.parent,sourceFile:t,modifierFlags:1,parentDeclaration:m};var v=e.find(g.declarations,e.isSourceFile);if(t.commonJsModuleIndicator)return;if(v&&!u(a,v))return {kind:2,token:o,call:s.parent,sourceFile:v,modifierFlags:1,parentDeclaration:v}}var h=e.find(g.declarations,e.isClassLike);if(h||!e.isPrivateIdentifier(o)){var b=h||e.find(g.declarations,(function(t){return e.isInterfaceDeclaration(t)||e.isTypeLiteralNode(t)}));if(b&&!u(a,b.getSourceFile())){var x=!e.isTypeLiteralNode(b)&&(f.target||f)!==i.getDeclaredTypeOfSymbol(g);if(x&&(e.isPrivateIdentifier(o)||e.isInterfaceDeclaration(b)))return;var D=b.getSourceFile(),S=e.isTypeLiteralNode(b)?0:(x?32:0)|(e.startsWithUnderscore(o.text)?8:0),T=e.isSourceFileJS(D);return {kind:0,token:o,call:e.tryCast(s.parent,e.isCallExpression),modifierFlags:S,parentDeclaration:b,declSourceFile:D,isJSFile:T}}var C=e.find(g.declarations,e.isEnumDeclaration);return !C||e.isPrivateIdentifier(o)||u(a,C.getSourceFile())?void 0:{kind:1,token:o,parentDeclaration:C}}}}}}function u(e,t){return e.isSourceFileFromExternalLibrary(t)||e.isSourceFileDefaultLibrary(t)}function _(t,r,n,i,a){var o=i.text;if(a){if(226===n.kind)return;var s=n.name.getText(),c=d(e.factory.createIdentifier(s),o);t.insertNodeAfter(r,n,c);}else if(e.isPrivateIdentifier(i)){var l=e.factory.createPropertyDeclaration(void 0,void 0,o,void 0,void 0,void 0),u=g(n);u?t.insertNodeAfter(r,u,l):t.insertMemberAtStart(r,n,l);}else {var _=e.getFirstConstructorWithBody(n);if(!_)return;var p=d(e.factory.createThis(),o);t.insertNodeAtConstructorEnd(r,_,p);}}function d(t,r){return e.factory.createExpressionStatement(e.factory.createAssignment(e.factory.createPropertyAccessExpression(t,r),D()))}function p(t,r,n){var i;if(221===n.parent.parent.kind){var a=n.parent.parent,o=n.parent===a.left?a.right:a.left,s=t.getWidenedType(t.getBaseTypeOfLiteralType(t.getTypeAtLocation(o)));i=t.typeToTypeNode(s,r,1);}else {var c=t.getContextualType(n.parent);i=c?t.typeToTypeNode(c,void 0,1):void 0;}return i||e.factory.createKeywordTypeNode(130)}function f(t,r,n,i,a,o){var s=o?e.factory.createNodeArray(e.factory.createModifiersFromModifierFlags(o)):void 0,c=e.isClassLike(n)?e.factory.createPropertyDeclaration(void 0,s,i,void 0,a,void 0):e.factory.createPropertySignature(void 0,i,void 0,a),l=g(n);l?t.insertNodeAfter(r,l,c):t.insertMemberAtStart(r,n,c);}function g(t){for(var r,n=0,i=t.members;n<i.length;n++){var a=i[n];if(!e.isPropertyDeclaration(a))break;r=a;}return r}function m(r,n,i,a,o,s,c){var l=t.createImportAdder(c,r.program,r.preferences,r.host),u=e.isClassLike(s)?169:168,_=t.createSignatureDeclarationFromCallExpression(u,r,l,i,a,o,s),d=function(t,r){if(!e.isTypeLiteralNode(t)){var n=e.findAncestor(r,(function(t){return e.isMethodDeclaration(t)||e.isConstructorDeclaration(t)}));return n&&n.parent===t?n:void 0}}(s,i);d?n.insertNodeAfter(c,d,_):n.insertMemberAtStart(c,s,_),l.writeFixes(n);}function y(t,r,n){var i=n.token,a=n.parentDeclaration,o=e.some(a.members,(function(e){var t=r.getTypeAtLocation(e);return !!(t&&402653316&t.flags)})),s=e.factory.createEnumMember(i,o?e.factory.createStringLiteral(i.text):void 0);t.replaceNode(a.getSourceFile(),a,e.factory.updateEnumDeclaration(a,a.decorators,a.modifiers,a.name,e.concatenate(a.members,e.singleElementArray(s))),{leadingTriviaOption:e.textChanges.LeadingTriviaOption.IncludeAll,trailingTriviaOption:e.textChanges.TrailingTriviaOption.Exclude});}function v(r,n,i){var a=t.createImportAdder(n.sourceFile,n.program,n.preferences,n.host),o=t.createSignatureDeclarationFromCallExpression(256,n,a,i.call,e.idText(i.token),i.modifierFlags,i.parentDeclaration);r.insertNodeAtEndOfScope(i.sourceFile,i.parentDeclaration,o);}function h(r,i,a){var o=t.createImportAdder(i.sourceFile,i.program,i.preferences,i.host),s=e.getQuotePreference(i.sourceFile,i.preferences),c=i.program.getTypeChecker(),l=a.parentDeclaration.attributes,u=e.some(l.properties,e.isJsxSpreadAttribute),_=e.map(a.attributes,(function(t){var r=x(i,c,o,s,c.getTypeOfSymbol(t)),n=e.factory.createIdentifier(t.name),a=e.factory.createJsxAttribute(n,e.factory.createJsxExpression(void 0,r));return e.setParent(n,a),a})),d=e.factory.createJsxAttributes(u?n$4(n$4([],_,!0),l.properties,!0):n$4(n$4([],l.properties,!0),_,!0)),p={prefix:l.pos===l.end?" ":void 0};r.replaceNode(i.sourceFile,l,d,p);}function b(r,i,a){var o=t.createImportAdder(i.sourceFile,i.program,i.preferences,i.host),s=e.getQuotePreference(i.sourceFile,i.preferences),c=e.getEmitScriptTarget(i.program.getCompilerOptions()),l=i.program.getTypeChecker(),u=e.map(a.properties,(function(t){var r=x(i,l,o,s,l.getTypeOfSymbol(t));return e.factory.createPropertyAssignment(e.createPropertyNameNodeForIdentifierOrLiteral(t.name,c,0===s),r)})),_={leadingTriviaOption:e.textChanges.LeadingTriviaOption.Exclude,trailingTriviaOption:e.textChanges.TrailingTriviaOption.Exclude,indentation:a.indentation};r.replaceNode(i.sourceFile,a.parentDeclaration,e.factory.createObjectLiteralExpression(n$4(n$4([],a.parentDeclaration.properties,!0),u,!0),!0),_);}function x(r,n,i,a,o){if(3&o.flags)return D();if(134217732&o.flags)return e.factory.createStringLiteral("",0===a);if(8&o.flags)return e.factory.createNumericLiteral(0);if(64&o.flags)return e.factory.createBigIntLiteral("0n");if(16&o.flags)return e.factory.createFalse();if(1056&o.flags){var s=o.symbol.exports?e.firstOrUndefined(e.arrayFrom(o.symbol.exports.values())):o.symbol,c=n.symbolToExpression(o.symbol.parent?o.symbol.parent:o.symbol,111551,void 0,void 0);return void 0===s||void 0===c?e.factory.createNumericLiteral(0):e.factory.createPropertyAccessExpression(c,n.symbolToString(s))}if(256&o.flags)return e.factory.createNumericLiteral(o.value);if(2048&o.flags)return e.factory.createBigIntLiteral(o.value);if(128&o.flags)return e.factory.createStringLiteral(o.value,0===a);if(512&o.flags)return o===n.getFalseType()||o===n.getFalseType(!0)?e.factory.createFalse():e.factory.createTrue();if(65536&o.flags)return e.factory.createNull();if(1048576&o.flags){var l=e.firstDefined(o.types,(function(e){return x(r,n,i,a,e)}));return null!=l?l:D()}if(n.isArrayLikeType(o))return e.factory.createArrayLiteralExpression();if(function(t){return 524288&t.flags&&(128&e.getObjectFlags(t)||t.symbol&&e.tryCast(e.singleOrUndefined(t.symbol.declarations),e.isTypeLiteralNode))}(o)){var u=e.map(n.getPropertiesOfType(o),(function(t){var o=t.valueDeclaration?x(r,n,i,a,n.getTypeAtLocation(t.valueDeclaration)):D();return e.factory.createPropertyAssignment(t.name,o)}));return e.factory.createObjectLiteralExpression(u,!0)}if(16&e.getObjectFlags(o)){if(void 0===e.find(o.symbol.declarations||e.emptyArray,e.or(e.isFunctionTypeNode,e.isMethodSignature,e.isMethodDeclaration)))return D();var _=n.getSignaturesOfType(o,0);if(void 0===_)return D();var d=t.createSignatureDeclarationFromSignature(213,r,a,_[0],t.createStubbedBody(e.Diagnostics.Function_not_implemented.message,a),void 0,void 0,void 0,void 0,i);return null!=d?d:D()}if(1&e.getObjectFlags(o)){var p=e.getClassLikeDeclarationOfSymbol(o.symbol);if(void 0===p||e.hasAbstractModifier(p))return D();var f=e.getFirstConstructorWithBody(p);return f&&e.length(f.parameters)?D():e.factory.createNewExpression(e.factory.createIdentifier(o.symbol.name),void 0,void 0)}return D()}function D(){return e.factory.createIdentifier("undefined")}t.registerCodeFix({errorCodes:c,getCodeActions:function(r){var n=r.program.getTypeChecker(),c=l(r.sourceFile,r.span.start,r.errorCode,n,r.program);if(c){if(3===c.kind){var u=e.textChanges.ChangeTracker.with(r,(function(e){return b(e,r,c)}));return [t.createCodeFixAction(a,u,e.Diagnostics.Add_missing_properties,a,e.Diagnostics.Add_all_missing_properties)]}return 4===c.kind?(u=e.textChanges.ChangeTracker.with(r,(function(e){return h(e,r,c)})),[t.createCodeFixAction(o,u,e.Diagnostics.Add_missing_attributes,o,e.Diagnostics.Add_all_missing_attributes)]):2===c.kind?(u=e.textChanges.ChangeTracker.with(r,(function(e){return v(e,r,c)})),[t.createCodeFixAction(s,u,[e.Diagnostics.Add_missing_function_declaration_0,c.token.text],s,e.Diagnostics.Add_all_missing_function_declarations)]):1===c.kind?(u=e.textChanges.ChangeTracker.with(r,(function(e){return y(e,r.program.getTypeChecker(),c)})),[t.createCodeFixAction(i,u,[e.Diagnostics.Add_missing_enum_member_0,c.token.text],i,e.Diagnostics.Add_all_missing_members)]):e.concatenate(function(r,n){var a=n.parentDeclaration,o=n.declSourceFile,s=n.modifierFlags,c=n.token,l=n.call;if(void 0!==l&&!e.isPrivateIdentifier(c)){var u=c.text,_=function(t){return e.textChanges.ChangeTracker.with(r,(function(e){return m(r,e,l,c,t,a,o)}))},d=[t.createCodeFixAction(i,_(32&s),[32&s?e.Diagnostics.Declare_static_method_0:e.Diagnostics.Declare_method_0,u],i,e.Diagnostics.Add_all_missing_members)];return 8&s&&d.unshift(t.createCodeFixActionWithoutFixAll(i,_(8),[e.Diagnostics.Declare_private_method_0,u])),d}}(r,c),function(r,n){return n.isJSFile?e.singleElementArray(function(r,n){var a=n.parentDeclaration,o=n.declSourceFile,s=n.modifierFlags,c=n.token;if(!e.isInterfaceDeclaration(a)&&!e.isTypeLiteralNode(a)){var l=e.textChanges.ChangeTracker.with(r,(function(e){return _(e,o,a,c,!!(32&s))}));if(0!==l.length){var u=32&s?e.Diagnostics.Initialize_static_property_0:e.isPrivateIdentifier(c)?e.Diagnostics.Declare_a_private_field_named_0:e.Diagnostics.Initialize_property_0_in_the_constructor;return t.createCodeFixAction(i,l,[u,c.text],i,e.Diagnostics.Add_all_missing_members)}}}(r,n)):function(r,n){var a=n.parentDeclaration,o=n.declSourceFile,s=n.modifierFlags,c=n.token,l=c.text,u=32&s,_=p(r.program.getTypeChecker(),a,c),d=function(t){return e.textChanges.ChangeTracker.with(r,(function(e){return f(e,o,a,l,_,t)}))},g=[t.createCodeFixAction(i,d(32&s),[u?e.Diagnostics.Declare_static_property_0:e.Diagnostics.Declare_property_0,l],i,e.Diagnostics.Add_all_missing_members)];return u||e.isPrivateIdentifier(c)||(8&s&&g.unshift(t.createCodeFixActionWithoutFixAll(i,d(8),[e.Diagnostics.Declare_private_property_0,l])),g.push(function(r,n,a,o,s){var c=e.factory.createKeywordTypeNode(150),l=e.factory.createParameterDeclaration(void 0,void 0,void 0,"x",void 0,c,void 0),u=e.factory.createIndexSignature(void 0,void 0,[l],s),_=e.textChanges.ChangeTracker.with(r,(function(e){return e.insertMemberAtStart(n,a,u)}));return t.createCodeFixActionWithoutFixAll(i,_,[e.Diagnostics.Add_index_signature_for_property_0,o])}(r,o,a,c.text,_))),g}(r,n)}(r,c))}},fixIds:[i,s,a,o],getAllCodeActions:function(r){var n=r.program,i=r.fixId,u=n.getTypeChecker(),d=new e.Map,g=new e.Map;return t.createCombinedCodeActions(e.textChanges.ChangeTracker.with(r,(function(n){t.eachDiagnostic(r,c,(function(t){var c=l(t.file,t.start,t.code,u,r.program);if(c&&e.addToSeen(d,e.getNodeId(c.parentDeclaration)+"#"+c.token.text))if(i===s&&2===c.kind)v(n,r,c);else if(i===a&&3===c.kind)b(n,r,c);else if(i===o&&4===c.kind)h(n,r,c);else if(1===c.kind&&y(n,u,c),0===c.kind){var _=c.parentDeclaration,p=c.token,f=e.getOrUpdate(g,_,(function(){return []}));f.some((function(e){return e.token.text===p.text}))||f.push(c);}})),g.forEach((function(i,a){for(var o=e.isTypeLiteralNode(a)?void 0:t.getAllSupers(a,u),s=function(t){if(null==o?void 0:o.some((function(e){var r=g.get(e);return !!r&&r.some((function(e){return e.token.text===t.token.text}))})))return "continue";var i=t.parentDeclaration,a=t.declSourceFile,s=t.modifierFlags,c=t.token,l=t.call,d=t.isJSFile;if(l&&!e.isPrivateIdentifier(c))m(r,n,l,c,32&s,i,a);else if(!d||e.isInterfaceDeclaration(i)||e.isTypeLiteralNode(i)){var y=p(u,i,c);f(n,a,i,c.text,y,32&s);}else _(n,a,i,c,!!(32&s));},c=0,l=i;c<l.length;c++)s(l[c]);}));})))}}),function(e){e[e.TypeLikeDeclaration=0]="TypeLikeDeclaration",e[e.Enum=1]="Enum",e[e.Function=2]="Function",e[e.ObjectLiteral=3]="ObjectLiteral",e[e.JsxAttributes=4]="JsxAttributes";}(r||(r={}));}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addMissingNewOperator",n=[e.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];function i(t,r,n){var i=e.cast(function(t,r){for(var n=e.getTokenAtPosition(t,r.start),i=e.textSpanEnd(r);n.end<i;)n=n.parent;return n}(r,n),e.isCallExpression),a=e.factory.createNewExpression(i.expression,i.typeArguments,i.arguments);t.replaceNode(r,i,a);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=n.sourceFile,o=n.span,s=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,a,o)}));return [t.createCodeFixAction(r,s,e.Diagnostics.Add_missing_new_operator_to_call,r,e.Diagnostics.Add_missing_new_operator_to_all_calls)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){return i(t,e.sourceFile,r)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="installTypesPackage",n=e.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code,i=[n,e.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code];function a(e,t){return {type:"install package",file:e,packageName:t}}function o(t,r){var n=e.tryCast(e.getTokenAtPosition(t,r),e.isStringLiteral);if(n){var i=n.text,a=e.parsePackageName(i).packageName;return e.isExternalModuleNameRelative(a)?void 0:a}}function s(t,r,i){var a;return i===n?e.JsTyping.nodeCoreModules.has(t)?"@types/node":void 0:(null===(a=r.isKnownTypesPackageName)||void 0===a?void 0:a.call(r,t))?e.getTypesPackageName(t):void 0}t.registerCodeFix({errorCodes:i,getCodeActions:function(n){var i=n.host,c=n.sourceFile,l=o(c,n.span.start);if(void 0!==l){var u=s(l,i,n.errorCode);return void 0===u?[]:[t.createCodeFixAction("fixCannotFindModule",[],[e.Diagnostics.Install_0,u],r,e.Diagnostics.Install_all_missing_types_packages,a(c.fileName,u))]}},fixIds:[r],getAllCodeActions:function(n){return t.codeFixAll(n,i,(function(t,i,c){var l=o(i.file,i.start);if(void 0!==l)switch(n.fixId){case r:var u=s(l,n.host,i.code);u&&c.push(a(i.file.fileName,u));break;default:e.Debug.fail("Bad fixId: ".concat(n.fixId));}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r=[e.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,e.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code],n="fixClassDoesntImplementInheritedAbstractMember";function i(t,r){var n=e.getTokenAtPosition(t,r);return e.cast(n.parent,e.isClassLike)}function a(r,n,i,a,s){var c=e.getEffectiveBaseTypeNode(r),l=i.program.getTypeChecker(),u=l.getTypeAtLocation(c),_=l.getPropertiesOfType(u).filter(o),d=t.createImportAdder(n,i.program,s,i.host);t.createMissingMemberNodes(r,_,n,i,s,d,(function(e){return a.insertMemberAtStart(n,r,e)})),d.writeFixes(a);}function o(t){var r=e.getSyntacticModifierFlags(e.first(t.getDeclarations()));return !(8&r||!(128&r))}t.registerCodeFix({errorCodes:r,getCodeActions:function(r){var o=r.sourceFile,s=r.span,c=e.textChanges.ChangeTracker.with(r,(function(e){return a(i(o,s.start),o,r,e,r.preferences)}));return 0===c.length?void 0:[t.createCodeFixAction(n,c,e.Diagnostics.Implement_inherited_abstract_class,n,e.Diagnostics.Implement_all_inherited_abstract_classes)]},fixIds:[n],getAllCodeActions:function(n){var o=new e.Map;return t.codeFixAll(n,r,(function(t,r){var s=i(r.file,r.start);e.addToSeen(o,e.getNodeId(s))&&a(s,n.sourceFile,n,t,n.preferences);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="classSuperMustPrecedeThisAccess",n=[e.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];function i(e,t,r,n){e.insertNodeAtConstructorStart(t,r,n),e.delete(t,n);}function a(t,r){var n=e.getTokenAtPosition(t,r);if(108===n.kind){var i=e.getContainingFunction(n),a=o(i.body);return a&&!a.expression.arguments.some((function(t){return e.isPropertyAccessExpression(t)&&t.expression===n}))?{constructor:i,superCall:a}:void 0}}function o(t){return e.isExpressionStatement(t)&&e.isSuperCall(t.expression)?t:e.isFunctionLike(t)?void 0:e.forEachChild(t,o)}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.span,c=a(o,s.start);if(c){var l=c.constructor,u=c.superCall,_=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,o,l,u)}));return [t.createCodeFixAction(r,_,e.Diagnostics.Make_super_call_the_first_statement_in_the_constructor,r,e.Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]}},fixIds:[r],getAllCodeActions:function(r){var o=r.sourceFile,s=new e.Map;return t.codeFixAll(r,n,(function(t,r){var n=a(r.file,r.start);if(n){var c=n.constructor,l=n.superCall;e.addToSeen(s,e.getNodeId(c.parent))&&i(t,o,c,l);}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="constructorForDerivedNeedSuperCall",n=[e.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];function i(t,r){var n=e.getTokenAtPosition(t,r);return e.Debug.assert(e.isConstructorDeclaration(n.parent),"token should be at the constructor declaration"),n.parent}function a(t,r,n){var i=e.factory.createExpressionStatement(e.factory.createCallExpression(e.factory.createSuper(),void 0,e.emptyArray));t.insertNodeAtConstructorStart(r,n,i);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.span,c=i(o,s.start),l=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,c)}));return [t.createCodeFixAction(r,l,e.Diagnostics.Add_missing_super_call,r,e.Diagnostics.Add_all_missing_super_calls)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){return a(t,e.sourceFile,i(r.file,r.start))}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="enableExperimentalDecorators",n=[e.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code];function i(r,n){t.setJsonCompilerOptionValue(r,n,"experimentalDecorators",e.factory.createTrue());}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=n.program.getCompilerOptions().configFile;if(void 0!==a){var o=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,a)}));return [t.createCodeFixActionWithoutFixAll(r,o,e.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t){var r=e.program.getCompilerOptions().configFile;void 0!==r&&i(t,r);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixEnableJsxFlag",n=[e.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];function i(r,n){t.setJsonCompilerOptionValue(r,n,"jsx",e.factory.createStringLiteral("react"));}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=n.program.getCompilerOptions().configFile;if(void 0!==a){var o=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,a)}));return [t.createCodeFixActionWithoutFixAll(r,o,e.Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t){var r=e.program.getCompilerOptions().configFile;void 0!==r&&i(t,r);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){var t;(t=e.codefix||(e.codefix={})).registerCodeFix({errorCodes:[e.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,e.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code],getCodeActions:function(r){var n=r.program.getCompilerOptions(),i=n.configFile;if(void 0!==i){var a=[],o=e.getEmitModuleKind(n);if(o>=e.ModuleKind.ES2015&&o<e.ModuleKind.ESNext){var s=e.textChanges.ChangeTracker.with(r,(function(r){t.setJsonCompilerOptionValue(r,i,"module",e.factory.createStringLiteral("esnext"));}));a.push(t.createCodeFixActionWithoutFixAll("fixModuleOption",s,[e.Diagnostics.Set_the_module_option_in_your_configuration_file_to_0,"esnext"]));}var c=e.getEmitScriptTarget(n);return (c<4||c>99)&&(s=e.textChanges.ChangeTracker.with(r,(function(r){if(e.getTsConfigObjectLiteralExpression(i)){var n=[["target",e.factory.createStringLiteral("es2017")]];o===e.ModuleKind.CommonJS&&n.push(["module",e.factory.createStringLiteral("commonjs")]),t.setJsonCompilerOptionValues(r,i,n);}})),a.push(t.createCodeFixActionWithoutFixAll("fixTargetOption",s,[e.Diagnostics.Set_the_target_option_in_your_configuration_file_to_0,"es2017"]))),a.length?a:void 0}}});}(t),function(e){!function(t){var r="fixPropertyAssignment",n=[e.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code];function i(t,r,n){t.replaceNode(r,n,e.factory.createPropertyAssignment(n.name,n.objectAssignmentInitializer));}function a(t,r){return e.cast(e.getTokenAtPosition(t,r).parent,e.isShorthandPropertyAssignment)}t.registerCodeFix({errorCodes:n,fixIds:[r],getCodeActions:function(n){var o=a(n.sourceFile,n.span.start),s=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,o)}));return [t.createCodeFixAction(r,s,[e.Diagnostics.Change_0_to_1,"=",":"],r,[e.Diagnostics.Switch_each_misused_0_to_1,"=",":"])]},getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){return i(e,t.file,a(t.file,t.start))}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="extendsInterfaceBecomesImplements",n=[e.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];function i(t,r){var n=e.getTokenAtPosition(t,r),i=e.getContainingClass(n).heritageClauses,a=i[0].getFirstToken();return 94===a.kind?{extendsToken:a,heritageClauses:i}:void 0}function a(t,r,n,i){if(t.replaceNode(r,n,e.factory.createToken(117)),2===i.length&&94===i[0].token&&117===i[1].token){var a=i[1].getFirstToken(),o=a.getFullStart();t.replaceRange(r,{pos:o,end:o},e.factory.createToken(27));for(var s=r.text,c=a.end;c<s.length&&e.isWhiteSpaceSingleLine(s.charCodeAt(c));)c++;t.deleteRange(r,{pos:a.getStart(),end:c});}}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=i(o,n.span.start);if(s){var c=s.extendsToken,l=s.heritageClauses,u=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,c,l)}));return [t.createCodeFixAction(r,u,e.Diagnostics.Change_extends_to_implements,r,e.Diagnostics.Change_all_extended_interfaces_to_implements)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){var r=i(t.file,t.start);r&&a(e,t.file,r.extendsToken,r.heritageClauses);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="forgottenThisPropertyAccess",n=e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,i=[e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,e.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,n];function a(t,r,i){var a=e.getTokenAtPosition(t,r);if(e.isIdentifier(a)||e.isPrivateIdentifier(a))return {node:a,className:i===n?e.getContainingClass(a).name.text:void 0}}function o(t,r,n){var i=n.node,a=n.className;e.suppressLeadingAndTrailingTrivia(i),t.replaceNode(r,i,e.factory.createPropertyAccessExpression(a?e.factory.createIdentifier(a):e.factory.createThis(),i));}t.registerCodeFix({errorCodes:i,getCodeActions:function(n){var i=n.sourceFile,s=a(i,n.span.start,n.errorCode);if(s){var c=e.textChanges.ChangeTracker.with(n,(function(e){return o(e,i,s)}));return [t.createCodeFixAction(r,c,[e.Diagnostics.Add_0_to_unresolved_variable,s.className||"this"],r,e.Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,i,(function(t,r){var n=a(r.file,r.start,r.code);n&&o(t,e.sourceFile,n);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixInvalidJsxCharacters_expression",n="fixInvalidJsxCharacters_htmlEntity",i=[e.Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,e.Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code];t.registerCodeFix({errorCodes:i,fixIds:[r,n],getCodeActions:function(i){var a=i.sourceFile,s=i.preferences,c=i.span,l=e.textChanges.ChangeTracker.with(i,(function(e){return o(e,s,a,c.start,!1)})),u=e.textChanges.ChangeTracker.with(i,(function(e){return o(e,s,a,c.start,!0)}));return [t.createCodeFixAction(r,l,e.Diagnostics.Wrap_invalid_character_in_an_expression_container,r,e.Diagnostics.Wrap_all_invalid_characters_in_an_expression_container),t.createCodeFixAction(n,u,e.Diagnostics.Convert_invalid_character_to_its_html_entity_code,n,e.Diagnostics.Convert_all_invalid_characters_to_HTML_entity_code)]},getAllCodeActions:function(e){return t.codeFixAll(e,i,(function(t,r){return o(t,e.preferences,r.file,r.start,e.fixId===n)}))}});var a={">":"&gt;","}":"&rbrace;"};function o(t,r,n,i,o){var s=n.getText()[i];if(function(t){return e.hasProperty(a,t)}(s)){var c=o?a[s]:"{".concat(e.quote(n,r,s),"}");t.replaceRangeWithText(n,{pos:i,end:i+1},c);}}}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="deleteUnmatchedParameter",n="renameUnmatchedParameter",i=[e.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code];function a(t,r){var n=e.getTokenAtPosition(t,r);if(n.parent&&e.isJSDocParameterTag(n.parent)&&e.isIdentifier(n.parent.name)){var i=n.parent,a=e.getHostSignatureFromJSDoc(i);if(a)return {signature:a,name:n.parent.name,jsDocParameterTag:i}}}t.registerCodeFix({fixIds:[r,n],errorCodes:i,getCodeActions:function(i){var o=[],s=a(i.sourceFile,i.span.start);if(s)return e.append(o,function(n,i){var a=i.name,o=i.signature,s=i.jsDocParameterTag,c=e.textChanges.ChangeTracker.with(n,(function(e){return e.filterJSDocTags(n.sourceFile,o,(function(e){return e!==s}))}));return t.createCodeFixAction(r,c,[e.Diagnostics.Delete_unused_param_tag_0,a.getText(n.sourceFile)],r,e.Diagnostics.Delete_all_unused_param_tags)}(i,s)),e.append(o,function(r,i){var a=i.name,o=i.signature,s=i.jsDocParameterTag;if(e.length(o.parameters)){for(var c=r.sourceFile,l=e.getJSDocTags(o),u=new e.Set,_=0,d=l;_<d.length;_++){var p=d[_];e.isJSDocParameterTag(p)&&e.isIdentifier(p.name)&&u.add(p.name.escapedText);}var f=e.firstDefined(o.parameters,(function(t){return e.isIdentifier(t.name)&&!u.has(t.name.escapedText)?t.name.getText(c):void 0}));if(void 0!==f){var g=e.factory.updateJSDocParameterTag(s,s.tagName,e.factory.createIdentifier(f),s.isBracketed,s.typeExpression,s.isNameFirst,s.comment),m=e.textChanges.ChangeTracker.with(r,(function(t){return t.replaceJSDocComment(c,o,e.map(l,(function(e){return e===s?g:e})))}));return t.createCodeFixActionWithoutFixAll(n,m,[e.Diagnostics.Rename_param_tag_name_0_to_1,a.getText(c),f])}}}(i,s)),o},getAllCodeActions:function(n){var o=new e.Map;return t.createCombinedCodeActions(e.textChanges.ChangeTracker.with(n,(function(s){t.eachDiagnostic(n,i,(function(t){var r=a(t.file,t.start);r&&o.set(r.signature,e.append(o.get(r.signature),r.jsDocParameterTag));})),o.forEach((function(t,i){if(n.fixId===r){var a=new e.Set(t);s.filterJSDocTags(i.getSourceFile(),i,(function(e){return !a.has(e)}));}}));})))}});}(e.codefix||(e.codefix={}));}(t),function(e){var t,r,n;t=e.codefix||(e.codefix={}),r="fixUnreferenceableDecoratorMetadata",n=[e.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code],t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var i=function(t,r,n){var i=e.tryCast(e.getTokenAtPosition(t,n),e.isIdentifier);if(i&&178===i.parent.kind){var a=r.getTypeChecker().getSymbolAtLocation(i);return e.find((null==a?void 0:a.declarations)||e.emptyArray,e.or(e.isImportClause,e.isImportSpecifier,e.isImportEqualsDeclaration))}}(n.sourceFile,n.program,n.span.start);if(i){var a,o=e.textChanges.ChangeTracker.with(n,(function(t){return 270===i.kind&&function(t,r,n,i){e.refactor.doChangeNamedToNamespaceOrDefault(r,i,t,n.parent);}(t,n.sourceFile,i,n.program)})),s=e.textChanges.ChangeTracker.with(n,(function(t){return function(t,r,n,i){if(265!==n.kind){var a=267===n.kind?n:n.parent.parent;if(!a.name||!a.namedBindings){var o=i.getTypeChecker();e.forEachImportClauseDeclaration(a,(function(t){if(111551&e.skipAlias(t.symbol,o).flags)return !0}))||t.insertModifierBefore(r,152,a);}}else t.insertModifierBefore(r,152,n.name);}(t,n.sourceFile,i,n.program)}));return o.length&&(a=e.append(a,t.createCodeFixActionWithoutFixAll(r,o,e.Diagnostics.Convert_named_imports_to_namespace_import))),s.length&&(a=e.append(a,t.createCodeFixActionWithoutFixAll(r,s,e.Diagnostics.Convert_to_type_only_import))),a}},fixIds:[r]});}(t),function(e){!function(t){var r="unusedIdentifier",n="unusedIdentifier_prefix",i="unusedIdentifier_delete",a="unusedIdentifier_deleteImports",o="unusedIdentifier_infer",s=[e.Diagnostics._0_is_declared_but_its_value_is_never_read.code,e.Diagnostics._0_is_declared_but_never_used.code,e.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,e.Diagnostics.All_imports_in_import_declaration_are_unused.code,e.Diagnostics.All_destructured_elements_are_unused.code,e.Diagnostics.All_variables_are_unused.code,e.Diagnostics.All_type_parameters_are_unused.code];function c(t,r,n){t.replaceNode(r,n.parent,e.factory.createKeywordTypeNode(155));}function l(n,a){return t.createCodeFixAction(r,n,a,i,e.Diagnostics.Delete_all_unused_declarations)}function u(t,r,n){t.delete(r,e.Debug.checkDefined(e.cast(n.parent,e.isDeclarationWithTypeParameterChildren).typeParameters,"The type parameter to delete should exist"));}function _(e){return 100===e.kind||79===e.kind&&(270===e.parent.kind||267===e.parent.kind)}function d(t){return 100===t.kind?e.tryCast(t.parent,e.isImportDeclaration):void 0}function p(t,r){return e.isVariableDeclarationList(r.parent)&&e.first(r.parent.getChildren(t))===r}function f(e,t,r){e.delete(t,237===r.parent.kind?r.parent:r);}function g(t,r,n,i){r!==e.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code&&(137===i.kind&&(i=e.cast(i.parent,e.isInferTypeNode).typeParameter.name),e.isIdentifier(i)&&function(e){switch(e.parent.kind){case 164:case 163:return !0;case 254:switch(e.parent.parent.parent.kind){case 244:case 243:return !0}}return !1}(i)&&(t.replaceNode(n,i,e.factory.createIdentifier("_".concat(i.text))),e.isParameter(i.parent)&&e.getJSDocParameterTags(i.parent).forEach((function(r){e.isIdentifier(r.name)&&t.replaceNode(n,r.name,e.factory.createIdentifier("_".concat(r.name.text)));}))));}function m(t,r,n,i,a,o,s,c){!function(t,r,n,i,a,o,s,c){var l=t.parent;if(e.isParameter(l))!function(t,r,n,i,a,o,s,c){void 0===c&&(c=!1),function(t,r,n,i,a,o,s){var c=n.parent;switch(c.kind){case 169:case 171:var l=c.parameters.indexOf(n),u=e.isMethodDeclaration(c)?c.name:c,_=e.FindAllReferences.Core.getReferencedSymbolsForNode(c.pos,u,a,i,o);if(_)for(var d=0,p=_;d<p.length;d++)for(var f=0,g=p[d].references;f<g.length;f++){var m=g[f];if(1===m.kind){var y=e.isSuperKeyword(m.node)&&e.isCallExpression(m.node.parent)&&m.node.parent.arguments.length>l,h=e.isPropertyAccessExpression(m.node.parent)&&e.isSuperKeyword(m.node.parent.expression)&&e.isCallExpression(m.node.parent.parent)&&m.node.parent.parent.arguments.length>l,b=(e.isMethodDeclaration(m.node.parent)||e.isMethodSignature(m.node.parent))&&m.node.parent!==n.parent&&m.node.parent.parameters.length>l;if(y||h||b)return !1}}return !0;case 256:return !c.name||!function(t,r,n){return !!e.FindAllReferences.Core.eachSymbolReferenceInFile(n,t,r,(function(t){return e.isIdentifier(t)&&e.isCallExpression(t.parent)&&t.parent.arguments.indexOf(t)>=0}))}(t,r,c.name)||v(c,n,s);case 213:case 214:return v(c,n,s);case 173:return !1;case 172:return !0;default:return e.Debug.failBadSyntaxKind(c)}}(i,r,n,a,o,s,c)&&(n.modifiers&&n.modifiers.length>0&&(!e.isIdentifier(n.name)||e.FindAllReferences.Core.isSymbolReferencedInFile(n.name,i,r))?n.modifiers.forEach((function(e){return t.deleteModifier(r,e)})):!n.initializer&&y(n,i,a)&&t.delete(r,n));}(r,n,l,i,a,o,s,c);else if(!(c&&e.isIdentifier(t)&&e.FindAllReferences.Core.isSymbolReferencedInFile(t,i,n))){var u=e.isImportClause(l)?t:e.isComputedPropertyName(l)?l.parent:l;e.Debug.assert(u!==n,"should not delete whole source file"),r.delete(n,u);}}(r,n,t,i,a,o,s,c),e.isIdentifier(r)&&e.FindAllReferences.Core.eachSymbolReferenceInFile(r,i,t,(function(r){var i;e.isPropertyAccessExpression(r.parent)&&r.parent.name===r&&(r=r.parent),!c&&(i=r,(e.isBinaryExpression(i.parent)&&i.parent.left===i||(e.isPostfixUnaryExpression(i.parent)||e.isPrefixUnaryExpression(i.parent))&&i.parent.operand===i)&&e.isExpressionStatement(i.parent.parent))&&n.delete(t,r.parent.parent);}));}function y(t,r,n){var i=t.parent.parameters.indexOf(t);return !e.FindAllReferences.Core.someSignatureUsage(t.parent,n,r,(function(e,t){return !t||t.arguments.length>i}))}function v(t,r,n){var i=t.parameters,a=i.indexOf(r);return e.Debug.assert(-1!==a,"The parameter should already be in the list"),n?i.slice(a+1).every((function(t){return e.isIdentifier(t.name)&&!t.symbol.isReferenced})):a===i.length-1}t.registerCodeFix({errorCodes:s,getCodeActions:function(i){var s=i.errorCode,y=i.sourceFile,v=i.program,h=i.cancellationToken,b=v.getTypeChecker(),x=v.getSourceFiles(),D=e.getTokenAtPosition(y,i.span.start);if(e.isJSDocTemplateTag(D))return [l(e.textChanges.ChangeTracker.with(i,(function(e){return e.delete(y,D)})),e.Diagnostics.Remove_template_tag)];if(29===D.kind)return [l(T=e.textChanges.ChangeTracker.with(i,(function(e){return u(e,y,D)})),e.Diagnostics.Remove_type_parameters)];var S=d(D);if(S){var T=e.textChanges.ChangeTracker.with(i,(function(e){return e.delete(y,S)}));return [t.createCodeFixAction(r,T,[e.Diagnostics.Remove_import_from_0,e.showModuleSpecifier(S)],a,e.Diagnostics.Delete_all_unused_imports)]}if(_(D)&&(F=e.textChanges.ChangeTracker.with(i,(function(e){return m(y,D,e,b,x,v,h,!1)}))).length)return [t.createCodeFixAction(r,F,[e.Diagnostics.Remove_unused_declaration_for_Colon_0,D.getText(y)],a,e.Diagnostics.Delete_all_unused_imports)];if(e.isObjectBindingPattern(D.parent)||e.isArrayBindingPattern(D.parent)){if(e.isParameter(D.parent.parent)){var C=D.parent.elements,k=[C.length>1?e.Diagnostics.Remove_unused_declarations_for_Colon_0:e.Diagnostics.Remove_unused_declaration_for_Colon_0,e.map(C,(function(e){return e.getText(y)})).join(", ")];return [l(e.textChanges.ChangeTracker.with(i,(function(t){return function(t,r,n){e.forEach(n.elements,(function(e){return t.delete(r,e)}));}(t,y,D.parent)})),k)]}return [l(e.textChanges.ChangeTracker.with(i,(function(e){return e.delete(y,D.parent.parent)})),e.Diagnostics.Remove_unused_destructuring_declaration)]}if(p(y,D))return [l(e.textChanges.ChangeTracker.with(i,(function(e){return f(e,y,D.parent)})),e.Diagnostics.Remove_variable_statement)];var E=[];if(137===D.kind){T=e.textChanges.ChangeTracker.with(i,(function(e){return c(e,y,D)}));var N=e.cast(D.parent,e.isInferTypeNode).typeParameter.name.text;E.push(t.createCodeFixAction(r,T,[e.Diagnostics.Replace_infer_0_with_unknown,N],o,e.Diagnostics.Replace_all_unused_infer_with_unknown));}else {var F;(F=e.textChanges.ChangeTracker.with(i,(function(e){return m(y,D,e,b,x,v,h,!1)}))).length&&(N=e.isComputedPropertyName(D.parent)?D.parent:D,E.push(l(F,[e.Diagnostics.Remove_unused_declaration_for_Colon_0,N.getText(y)])));}var A=e.textChanges.ChangeTracker.with(i,(function(e){return g(e,s,y,D)}));return A.length&&E.push(t.createCodeFixAction(r,A,[e.Diagnostics.Prefix_0_with_an_underscore,D.getText(y)],n,e.Diagnostics.Prefix_all_unused_declarations_with_where_possible)),E},fixIds:[n,i,a,o],getAllCodeActions:function(r){var l=r.sourceFile,v=r.program,h=r.cancellationToken,b=v.getTypeChecker(),x=v.getSourceFiles();return t.codeFixAll(r,s,(function(t,s){var D=e.getTokenAtPosition(l,s.start);switch(r.fixId){case n:g(t,s.code,l,D);break;case a:var S=d(D);S?t.delete(l,S):_(D)&&m(l,D,t,b,x,v,h,!0);break;case i:if(137===D.kind||_(D))break;if(e.isJSDocTemplateTag(D))t.delete(l,D);else if(29===D.kind)u(t,l,D);else if(e.isObjectBindingPattern(D.parent)){if(D.parent.parent.initializer)break;e.isParameter(D.parent.parent)&&!y(D.parent.parent,b,x)||t.delete(l,D.parent.parent);}else {if(e.isArrayBindingPattern(D.parent.parent)&&D.parent.parent.parent.initializer)break;p(l,D)?f(t,l,D.parent):m(l,D,t,b,x,v,h,!0);}break;case o:137===D.kind&&c(t,l,D);break;default:e.Debug.fail(JSON.stringify(r.fixId));}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixUnreachableCode",n=[e.Diagnostics.Unreachable_code_detected.code];function i(t,r,n,i,a){var o=e.getTokenAtPosition(r,n),s=e.findAncestor(o,e.isStatement);if(s.getStart(r)!==o.getStart(r)){var c=JSON.stringify({statementKind:e.Debug.formatSyntaxKind(s.kind),tokenKind:e.Debug.formatSyntaxKind(o.kind),errorCode:a,start:n,length:i});e.Debug.fail("Token and statement should start at the same point. "+c);}var l=(e.isBlock(s.parent)?s.parent:s).parent;if(!e.isBlock(s.parent)||s===e.first(s.parent.statements))switch(l.kind){case 239:if(l.elseStatement){if(e.isBlock(s.parent))break;return void t.replaceNode(r,s,e.factory.createBlock(e.emptyArray))}case 241:case 242:return void t.delete(r,l)}if(e.isBlock(s.parent)){var u=n+i,_=e.Debug.checkDefined(function(e,t){for(var r,n=0,i=e;n<i.length;n++){var a=i[n];if(!(a.pos<u))break;r=a;}return r}(e.sliceAfter(s.parent.statements,s)),"Some statement should be last");t.deleteNodeRange(r,s,_);}else t.delete(r,s);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){if(!n.program.getSyntacticDiagnostics(n.sourceFile,n.cancellationToken).length){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span.start,n.span.length,n.errorCode)}));return [t.createCodeFixAction(r,a,e.Diagnostics.Remove_unreachable_code,r,e.Diagnostics.Remove_all_unreachable_code)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){return i(e,t.file,t.start,t.length,t.code)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixUnusedLabel",n=[e.Diagnostics.Unused_label.code];function i(t,r,n){var i=e.getTokenAtPosition(r,n),a=e.cast(i.parent,e.isLabeledStatement),o=i.getStart(r),s=a.statement.getStart(r),c=e.positionsAreOnSameLine(o,s,r)?s:e.skipTrivia(r.text,e.findChildOfKind(a,58,r).end,!0);t.deleteRange(r,{pos:o,end:c});}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span.start)}));return [t.createCodeFixAction(r,a,e.Diagnostics.Remove_unused_label,r,e.Diagnostics.Remove_all_unused_labels)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){return i(e,t.file,t.start)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixJSDocTypes_plain",n="fixJSDocTypes_nullable",i=[e.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code];function a(e,t,r,n,i){e.replaceNode(t,r,i.typeToTypeNode(n,r,void 0));}function o(t,r,n){var i=e.findAncestor(e.getTokenAtPosition(t,r),s),a=i&&i.type;return a&&{typeNode:a,type:n.getTypeFromTypeNode(a)}}function s(e){switch(e.kind){case 229:case 174:case 175:case 256:case 172:case 176:case 195:case 169:case 168:case 164:case 167:case 166:case 173:case 259:case 211:case 254:return !0;default:return !1}}t.registerCodeFix({errorCodes:i,getCodeActions:function(i){var s=i.sourceFile,c=i.program.getTypeChecker(),l=o(s,i.span.start,c);if(l){var u=l.typeNode,_=l.type,d=u.getText(s),p=[f(_,r,e.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];return 314===u.kind&&p.push(f(c.getNullableType(_,32768),n,e.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)),p}function f(r,n,o){var l=e.textChanges.ChangeTracker.with(i,(function(e){return a(e,s,u,r,c)}));return t.createCodeFixAction("jdocTypes",l,[e.Diagnostics.Change_0_to_1,d,c.typeToString(r)],n,o)}},fixIds:[r,n],getAllCodeActions:function(e){var r=e.fixId,s=e.program,c=e.sourceFile,l=s.getTypeChecker();return t.codeFixAll(e,i,(function(e,t){var i=o(t.file,t.start,l);if(i){var s=i.typeNode,u=i.type,_=314===s.kind&&r===n?l.getNullableType(u,32768):u;a(e,c,s,_,l);}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixMissingCallParentheses",n=[e.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code];function i(e,t,r){e.replaceNodeWithText(t,r,"".concat(r.text,"()"));}function a(t,r){var n=e.getTokenAtPosition(t,r);if(e.isPropertyAccessExpression(n.parent)){for(var i=n.parent;e.isPropertyAccessExpression(i.parent);)i=i.parent;return i.name}if(e.isIdentifier(n))return n}t.registerCodeFix({errorCodes:n,fixIds:[r],getCodeActions:function(n){var o=a(n.sourceFile,n.span.start);if(o){var s=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,o)}));return [t.createCodeFixAction(r,s,e.Diagnostics.Add_missing_call_parentheses,r,e.Diagnostics.Add_all_missing_call_parentheses)]}},getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){var r=a(t.file,t.start);r&&i(e,t.file,r);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixAwaitInSyncFunction",n=[e.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,e.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,e.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code];function i(t,r){var n=e.getTokenAtPosition(t,r),i=e.getContainingFunction(n);if(i){var a,o;switch(i.kind){case 169:a=i.name;break;case 256:case 213:a=e.findChildOfKind(i,98,t);break;case 214:var s=i.typeParameters?29:20;a=e.findChildOfKind(i,s,t)||e.first(i.parameters);break;default:return}return a&&{insertBefore:a,returnType:(o=i,o.type?o.type:e.isVariableDeclaration(o.parent)&&o.parent.type&&e.isFunctionTypeNode(o.parent.type)?o.parent.type.type:void 0)}}}function a(t,r,n){var i=n.insertBefore,a=n.returnType;if(a){var o=e.getEntityNameFromTypeNode(a);o&&79===o.kind&&"Promise"===o.text||t.replaceNode(r,a,e.factory.createTypeReferenceNode("Promise",e.factory.createNodeArray([a])));}t.insertModifierBefore(r,131,i);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.span,c=i(o,s.start);if(c){var l=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,c)}));return [t.createCodeFixAction(r,l,e.Diagnostics.Add_async_modifier_to_containing_function,r,e.Diagnostics.Add_all_missing_async_modifiers)]}},fixIds:[r],getAllCodeActions:function(r){var o=new e.Map;return t.codeFixAll(r,n,(function(t,n){var s=i(n.file,n.start);s&&e.addToSeen(o,e.getNodeId(s.insertBefore))&&a(t,r.sourceFile,s);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r=[e.Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,e.Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code],n="fixPropertyOverrideAccessor";function i(r,n,i,a,o){var s,c;if(a===e.Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code)s=n,c=n+i;else if(a===e.Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code){var l=o.program.getTypeChecker(),u=e.getTokenAtPosition(r,n).parent;e.Debug.assert(e.isAccessor(u),"error span of fixPropertyOverrideAccessor should only be on an accessor");var _=u.parent;e.Debug.assert(e.isClassLike(_),"erroneous accessors should only be inside classes");var d=e.singleOrUndefined(t.getAllSupers(_,l));if(!d)return [];var p=e.unescapeLeadingUnderscores(e.getTextOfPropertyName(u.name)),f=l.getPropertyOfType(l.getTypeAtLocation(d),p);if(!f||!f.valueDeclaration)return [];s=f.valueDeclaration.pos,c=f.valueDeclaration.end,r=e.getSourceFileOfNode(f.valueDeclaration);}else e.Debug.fail("fixPropertyOverrideAccessor codefix got unexpected error code "+a);return t.generateAccessorFromProperty(r,o.program,s,c,o,e.Diagnostics.Generate_get_and_set_accessors.message)}t.registerCodeFix({errorCodes:r,getCodeActions:function(r){var a=i(r.sourceFile,r.span.start,r.span.length,r.errorCode,r);if(a)return [t.createCodeFixAction(n,a,e.Diagnostics.Generate_get_and_set_accessors,n,e.Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]},fixIds:[n],getAllCodeActions:function(e){return t.codeFixAll(e,r,(function(t,r){var n=i(r.file,r.start,r.length,r.code,e);if(n)for(var a=0,o=n;a<o.length;a++){var s=o[a];t.pushRaw(e.sourceFile,s);}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="inferFromUsage",i=[e.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,e.Diagnostics.Variable_0_implicitly_has_an_1_type.code,e.Diagnostics.Parameter_0_implicitly_has_an_1_type.code,e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code,e.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code,e.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code,e.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code,e.Diagnostics.Member_0_implicitly_has_an_1_type.code,e.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage.code,e.Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code,e.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code,e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code,e.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage.code,e.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage.code,e.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage.code,e.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code,e.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];function a(t,r){switch(t){case e.Diagnostics.Parameter_0_implicitly_has_an_1_type.code:case e.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:return e.isSetAccessorDeclaration(e.getContainingFunction(r))?e.Diagnostics.Infer_type_of_0_from_usage:e.Diagnostics.Infer_parameter_types_from_usage;case e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:case e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code:return e.Diagnostics.Infer_parameter_types_from_usage;case e.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code:return e.Diagnostics.Infer_this_type_of_0_from_usage;default:return e.Diagnostics.Infer_type_of_0_from_usage}}function o(r,n,i,a,o,_,g,m,y){if(e.isParameterPropertyModifier(i.kind)||79===i.kind||25===i.kind||108===i.kind){var v=i.parent,h=t.createImportAdder(n,o,y,m);switch(a=function(t){switch(t){case e.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage.code:return e.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code;case e.Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:return e.Diagnostics.Variable_0_implicitly_has_an_1_type.code;case e.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:return e.Diagnostics.Parameter_0_implicitly_has_an_1_type.code;case e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code:return e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code;case e.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage.code:return e.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code;case e.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage.code:return e.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code;case e.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage.code:return e.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code;case e.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code:return e.Diagnostics.Member_0_implicitly_has_an_1_type.code}return t}(a)){case e.Diagnostics.Member_0_implicitly_has_an_1_type.code:case e.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code:if(e.isVariableDeclaration(v)&&g(v)||e.isPropertyDeclaration(v)||e.isPropertySignature(v))return s(r,h,n,v,o,m,_),h.writeFixes(r),v;if(e.isPropertyAccessExpression(v)){var b=d(v.name,o,_),x=e.getTypeNodeIfAccessible(b,v,o,m);if(x){var D=e.factory.createJSDocTypeTag(void 0,e.factory.createJSDocTypeExpression(x),void 0);r.addJSDocTags(n,e.cast(v.parent.parent,e.isExpressionStatement),[D]);}return h.writeFixes(r),v}return;case e.Diagnostics.Variable_0_implicitly_has_an_1_type.code:var S=o.getTypeChecker().getSymbolAtLocation(i);return S&&S.valueDeclaration&&e.isVariableDeclaration(S.valueDeclaration)&&g(S.valueDeclaration)?(s(r,h,e.getSourceFileOfNode(S.valueDeclaration),S.valueDeclaration,o,m,_),h.writeFixes(r),S.valueDeclaration):void 0}var T=e.getContainingFunction(i);if(void 0!==T){var C;switch(a){case e.Diagnostics.Parameter_0_implicitly_has_an_1_type.code:if(e.isSetAccessorDeclaration(T)){c(r,h,n,T,o,m,_),C=T;break}case e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code:if(g(T)){var k=e.cast(v,e.isParameter);!function(t,r,n,i,a,o,s,c){if(e.isIdentifier(i.name)){var _=function(t,r,n,i){var a=p(t,r,n,i);return a&&f(n,a,i).parameters(t)||t.parameters.map((function(t){return {declaration:t,type:e.isIdentifier(t.name)?d(t.name,n,i):n.getTypeChecker().getAnyType()}}))}(a,n,o,c);if(e.Debug.assert(a.parameters.length===_.length,"Parameter count and inference count should match"),e.isInJSFile(a))u(t,n,_,o,s);else {var g=e.isArrowFunction(a)&&!e.findChildOfKind(a,20,n);g&&t.insertNodeBefore(n,e.first(a.parameters),e.factory.createToken(20));for(var m=0,y=_;m<y.length;m++){var v=y[m],h=v.declaration,b=v.type;!h||h.type||h.initializer||l(t,r,n,h,b,o,s);}g&&t.insertNodeAfter(n,e.last(a.parameters),e.factory.createToken(21));}}}(r,h,n,k,T,o,m,_),C=k;}break;case e.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code:case e.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code:e.isGetAccessorDeclaration(T)&&e.isIdentifier(T.name)&&(l(r,h,n,T,d(T.name,o,_),o,m),C=T);break;case e.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code:e.isSetAccessorDeclaration(T)&&(c(r,h,n,T,o,m,_),C=T);break;case e.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code:e.textChanges.isThisTypeAnnotatable(T)&&g(T)&&(function(t,r,n,i,a,o){var s=p(n,r,i,o);if(s&&s.length){var c=f(i,s,o).thisParameter(),l=e.getTypeNodeIfAccessible(c,n,i,a);l&&(e.isInJSFile(n)?function(t,r,n,i){t.addJSDocTags(r,n,[e.factory.createJSDocThisTag(void 0,e.factory.createJSDocTypeExpression(i))]);}(t,r,n,l):t.tryInsertThisTypeAnnotation(r,n,l));}}(r,n,T,o,m,_),C=T);break;default:return e.Debug.fail(String(a))}return h.writeFixes(r),C}}}function s(t,r,n,i,a,o,s){e.isIdentifier(i.name)&&l(t,r,n,i,d(i.name,a,s),a,o);}function c(t,r,n,i,a,o,s){var c=e.firstOrUndefined(i.parameters);if(c&&e.isIdentifier(i.name)&&e.isIdentifier(c.name)){var _=d(i.name,a,s);_===a.getTypeChecker().getAnyType()&&(_=d(c.name,a,s)),e.isInJSFile(i)?u(t,n,[{declaration:c,type:_}],a,o):l(t,r,n,c,_,a,o);}}function l(r,n,i,a,o,s,c){var l=e.getTypeNodeIfAccessible(o,a,s,c);if(l)if(e.isInJSFile(i)&&166!==a.kind){var u=e.isVariableDeclaration(a)?e.tryCast(a.parent.parent,e.isVariableStatement):a;if(!u)return;var _=e.factory.createJSDocTypeExpression(l),d=e.isGetAccessorDeclaration(a)?e.factory.createJSDocReturnTag(void 0,_,void 0):e.factory.createJSDocTypeTag(void 0,_,void 0);r.addJSDocTags(i,u,[d]);}else (function(r,n,i,a,o,s){var c=t.tryGetAutoImportableReferenceFromTypeNode(r,s);return !(!c||!a.tryInsertTypeAnnotation(i,n,c.typeNode))&&(e.forEach(c.symbols,(function(e){return o.addImportFromExportedSymbol(e,!0)})),!0)})(l,a,i,r,n,e.getEmitScriptTarget(s.getCompilerOptions()))||r.tryInsertTypeAnnotation(i,a,l);}function u(t,r,n,i,a){var o=n.length&&n[0].declaration.parent;if(o){var s=e.mapDefined(n,(function(t){var r=t.declaration;if(!r.initializer&&!e.getJSDocType(r)&&e.isIdentifier(r.name)){var n=t.type&&e.getTypeNodeIfAccessible(t.type,r,i,a);if(n){var o=e.factory.cloneNode(r.name);return e.setEmitFlags(o,3584),{name:e.factory.cloneNode(r.name),param:r,isOptional:!!t.isOptional,typeNode:n}}}}));if(s.length)if(e.isArrowFunction(o)||e.isFunctionExpression(o)){var c=e.isArrowFunction(o)&&!e.findChildOfKind(o,20,r);c&&t.insertNodeBefore(r,e.first(o.parameters),e.factory.createToken(20)),e.forEach(s,(function(n){var i=n.typeNode,a=n.param,o=e.factory.createJSDocTypeTag(void 0,e.factory.createJSDocTypeExpression(i)),s=e.factory.createJSDocComment(void 0,[o]);t.insertNodeAt(r,a.getStart(r),s,{suffix:" "});})),c&&t.insertNodeAfter(r,e.last(o.parameters),e.factory.createToken(21));}else {var l=e.map(s,(function(t){var r=t.name,n=t.typeNode,i=t.isOptional;return e.factory.createJSDocParameterTag(void 0,r,!!i,e.factory.createJSDocTypeExpression(n),!1,void 0)}));t.addJSDocTags(r,o,l);}}}function _(t,r,n){return e.mapDefined(e.FindAllReferences.getReferenceEntriesForNode(-1,t,r,r.getSourceFiles(),n),(function(t){return 0!==t.kind?e.tryCast(t.node,e.isIdentifier):void 0}))}function d(e,t,r){return f(t,_(e,t,r),r).single()}function p(t,r,n,i){var a;switch(t.kind){case 171:a=e.findChildOfKind(t,134,r);break;case 214:case 213:var o=t.parent;a=(e.isVariableDeclaration(o)||e.isPropertyDeclaration(o))&&e.isIdentifier(o.name)?o.name:t.name;break;case 256:case 169:case 168:a=t.name;}if(a)return _(a,n,i)}function f(t,r,i){var a=t.getTypeChecker(),o={string:function(){return a.getStringType()},number:function(){return a.getNumberType()},Array:function(e){return a.createArrayType(e)},Promise:function(e){return a.createPromiseType(e)}},s=[a.getStringType(),a.getNumberType(),a.createArrayType(a.getAnyType()),a.createPromiseType(a.getAnyType())];return {single:function(){return f(l(r))},parameters:function(o){if(0!==r.length&&o.parameters){for(var s={isNumber:void 0,isString:void 0,isNumberOrString:void 0,candidateTypes:void 0,properties:void 0,calls:void 0,constructs:void 0,numberIndex:void 0,stringIndex:void 0,candidateThisTypes:void 0,inferredTypes:void 0},c=0,d=r;c<d.length;c++){var p=d[c];i.throwIfCancellationRequested(),u(p,s);}var g=n$4(n$4([],s.constructs||[],!0),s.calls||[],!0);return o.parameters.map((function(r,n){for(var s=[],c=e.isRestParameter(r),u=!1,d=0,p=g;d<p.length;d++){var m=p[d];if(m.argumentTypes.length<=n)u=e.isInJSFile(o),s.push(a.getUndefinedType());else if(c)for(var y=n;y<m.argumentTypes.length;y++)s.push(a.getBaseTypeOfLiteralType(m.argumentTypes[y]));else s.push(a.getBaseTypeOfLiteralType(m.argumentTypes[n]));}if(e.isIdentifier(r.name)){var v=l(_(r.name,t,i));s.push.apply(s,c?e.mapDefined(v,a.getElementTypeOfArrayType):v);}var h=f(s);return {type:c?a.createArrayType(h):h,isOptional:u&&!c,declaration:r}}))}},thisParameter:function(){for(var t={isNumber:void 0,isString:void 0,isNumberOrString:void 0,candidateTypes:void 0,properties:void 0,calls:void 0,constructs:void 0,numberIndex:void 0,stringIndex:void 0,candidateThisTypes:void 0,inferredTypes:void 0},n=0,a=r;n<a.length;n++){var o=a[n];i.throwIfCancellationRequested(),u(o,t);}return f(t.candidateThisTypes||e.emptyArray)}};function c(t){for(var r=new e.Map,n=0,i=t;n<i.length;n++){var a=i[n];a.properties&&a.properties.forEach((function(e,t){r.has(t)||r.set(t,[]),r.get(t).push(e);}));}var o=new e.Map;return r.forEach((function(e,t){o.set(t,c(e));})),{isNumber:t.some((function(e){return e.isNumber})),isString:t.some((function(e){return e.isString})),isNumberOrString:t.some((function(e){return e.isNumberOrString})),candidateTypes:e.flatMap(t,(function(e){return e.candidateTypes})),properties:o,calls:e.flatMap(t,(function(e){return e.calls})),constructs:e.flatMap(t,(function(e){return e.constructs})),numberIndex:e.forEach(t,(function(e){return e.numberIndex})),stringIndex:e.forEach(t,(function(e){return e.stringIndex})),candidateThisTypes:e.flatMap(t,(function(e){return e.candidateThisTypes})),inferredTypes:void 0}}function l(e){for(var t={isNumber:void 0,isString:void 0,isNumberOrString:void 0,candidateTypes:void 0,properties:void 0,calls:void 0,constructs:void 0,numberIndex:void 0,stringIndex:void 0,candidateThisTypes:void 0,inferredTypes:void 0},r=0,n=e;r<n.length;r++){var a=n[r];i.throwIfCancellationRequested(),u(a,t);}return g(t)}function u(t,r){for(;e.isRightSideOfQualifiedNameOrPropertyAccess(t);)t=t.parent;switch(t.parent.kind){case 238:!function(t,r){h(r,e.isCallExpression(t)?a.getVoidType():a.getAnyType());}(t,r);break;case 220:r.isNumber=!0;break;case 219:!function(e,t){switch(e.operator){case 45:case 46:case 40:case 54:t.isNumber=!0;break;case 39:t.isNumberOrString=!0;}}(t.parent,r);break;case 221:!function(t,r,n){switch(r.operatorToken.kind){case 42:case 41:case 43:case 44:case 47:case 48:case 49:case 50:case 51:case 52:case 65:case 67:case 66:case 68:case 69:case 73:case 74:case 78:case 70:case 72:case 71:case 40:case 29:case 32:case 31:case 33:var i=a.getTypeAtLocation(r.left===t?r.right:r.left);1056&i.flags?h(n,i):n.isNumber=!0;break;case 64:case 39:var o=a.getTypeAtLocation(r.left===t?r.right:r.left);1056&o.flags?h(n,o):296&o.flags?n.isNumber=!0:402653316&o.flags?n.isString=!0:1&o.flags||(n.isNumberOrString=!0);break;case 63:case 34:case 36:case 37:case 35:h(n,a.getTypeAtLocation(r.left===t?r.right:r.left));break;case 101:t===r.left&&(n.isString=!0);break;case 56:case 60:t!==r.left||254!==t.parent.parent.kind&&!e.isAssignmentExpression(t.parent.parent,!0)||h(n,a.getTypeAtLocation(r.right));}}(t,t.parent,r);break;case 289:case 290:!function(e,t){h(t,a.getTypeAtLocation(e.parent.parent.expression));}(t.parent,r);break;case 208:case 209:t.parent.expression===t?function(e,t){var r={argumentTypes:[],return_:{isNumber:void 0,isString:void 0,isNumberOrString:void 0,candidateTypes:void 0,properties:void 0,calls:void 0,constructs:void 0,numberIndex:void 0,stringIndex:void 0,candidateThisTypes:void 0,inferredTypes:void 0}};if(e.arguments)for(var n=0,i=e.arguments;n<i.length;n++){var o=i[n];r.argumentTypes.push(a.getTypeAtLocation(o));}u(e,r.return_),208===e.kind?(t.calls||(t.calls=[])).push(r):(t.constructs||(t.constructs=[])).push(r);}(t.parent,r):d(t,r);break;case 206:!function(t,r){var n=e.escapeLeadingUnderscores(t.name.text);r.properties||(r.properties=new e.Map);var i=r.properties.get(n)||{isNumber:void 0,isString:void 0,isNumberOrString:void 0,candidateTypes:void 0,properties:void 0,calls:void 0,constructs:void 0,numberIndex:void 0,stringIndex:void 0,candidateThisTypes:void 0,inferredTypes:void 0};u(t,i),r.properties.set(n,i);}(t.parent,r);break;case 207:!function(e,t,r){if(t!==e.argumentExpression){var n=a.getTypeAtLocation(e.argumentExpression),i={isNumber:void 0,isString:void 0,isNumberOrString:void 0,candidateTypes:void 0,properties:void 0,calls:void 0,constructs:void 0,numberIndex:void 0,stringIndex:void 0,candidateThisTypes:void 0,inferredTypes:void 0};u(e,i),296&n.flags?r.numberIndex=i:r.stringIndex=i;}else r.isNumberOrString=!0;}(t.parent,t,r);break;case 296:case 297:!function(t,r){var n=e.isVariableDeclaration(t.parent.parent)?t.parent.parent:t.parent;b(r,a.getTypeAtLocation(n));}(t.parent,r);break;case 167:!function(e,t){b(t,a.getTypeAtLocation(e.parent));}(t.parent,r);break;case 254:var n=t.parent,i=n.name,o=n.initializer;if(t===i){o&&h(r,a.getTypeAtLocation(o));break}default:return d(t,r)}}function d(t,r){e.isExpressionNode(t)&&h(r,a.getContextualType(t));}function p(e){return f(g(e))}function f(t){if(!t.length)return a.getAnyType();var r=a.getUnionType([a.getStringType(),a.getNumberType()]),n=function(t,r){for(var n=[],i=0,a=t;i<a.length;i++)for(var o=a[i],s=0,c=r;s<c.length;s++){var l=c[s],u=l.high,_=l.low;u(o)&&(e.Debug.assert(!_(o),"Priority can't have both low and high"),n.push(_));}return t.filter((function(e){return n.every((function(t){return !t(e)}))}))}(t,[{high:function(e){return e===a.getStringType()||e===a.getNumberType()},low:function(e){return e===r}},{high:function(e){return !(16385&e.flags)},low:function(e){return !!(16385&e.flags)}},{high:function(t){return !(114689&t.flags||16&e.getObjectFlags(t))},low:function(t){return !!(16&e.getObjectFlags(t))}}]),i=n.filter((function(t){return 16&e.getObjectFlags(t)}));return i.length&&(n=n.filter((function(t){return !(16&e.getObjectFlags(t))}))).push(function(t){if(1===t.length)return t[0];for(var r=[],n=[],i=[],o=[],s=!1,c=!1,l=e.createMultiMap(),u=0,_=t;u<_.length;u++){for(var d=_[u],p=0,f=a.getPropertiesOfType(d);p<f.length;p++){var g=f[p];l.add(g.name,g.valueDeclaration?a.getTypeOfSymbolAtLocation(g,g.valueDeclaration):a.getAnyType());}r.push.apply(r,a.getSignaturesOfType(d,0)),n.push.apply(n,a.getSignaturesOfType(d,1));var m=a.getIndexInfoOfType(d,0);m&&(i.push(m.type),s=s||m.isReadonly);var y=a.getIndexInfoOfType(d,1);y&&(o.push(y.type),c=c||y.isReadonly);}var v=e.mapEntries(l,(function(e,r){var n=r.length<t.length?16777216:0,i=a.createSymbol(4|n,e);return i.type=a.getUnionType(r),[e,i]})),h=[];return i.length&&h.push(a.createIndexInfo(a.getStringType(),a.getUnionType(i),s)),o.length&&h.push(a.createIndexInfo(a.getNumberType(),a.getUnionType(o),c)),a.createAnonymousType(t[0].symbol,v,r,n,h)}(i)),a.getWidenedType(a.getUnionType(n.map(a.getBaseTypeOfLiteralType),2))}function g(t){var r,i,c,l=[];t.isNumber&&l.push(a.getNumberType()),t.isString&&l.push(a.getStringType()),t.isNumberOrString&&l.push(a.getUnionType([a.getStringType(),a.getNumberType()])),t.numberIndex&&l.push(a.createArrayType(p(t.numberIndex))),((null===(r=t.properties)||void 0===r?void 0:r.size)||(null===(i=t.constructs)||void 0===i?void 0:i.length)||t.stringIndex)&&l.push(m(t));var u=(t.candidateTypes||[]).map((function(e){return a.getBaseTypeOfLiteralType(e)})),_=(null===(c=t.calls)||void 0===c?void 0:c.length)?m(t):void 0;return _&&u?l.push(a.getUnionType(n$4([_],u,!0),2)):(_&&l.push(_),e.length(u)&&l.push.apply(l,u)),l.push.apply(l,function(t){if(!t.properties||!t.properties.size)return [];var r=s.filter((function(r){return function(t,r){return !!r.properties&&!e.forEachEntry(r.properties,(function(r,n){var i,o=a.getTypeOfPropertyOfType(t,n);return !(o&&(r.calls?a.getSignaturesOfType(o,0).length&&a.isTypeAssignableTo(o,(i=r.calls,a.createAnonymousType(void 0,e.createSymbolTable(),[v(i)],e.emptyArray,e.emptyArray))):a.isTypeAssignableTo(o,p(r))))}))}(r,t)}));return 0<r.length&&r.length<3?r.map((function(r){return function(t,r){if(!(4&e.getObjectFlags(t)&&r.properties))return t;var n=t.target,i=e.singleOrUndefined(n.typeParameters);if(!i)return t;var s=[];return r.properties.forEach((function(t,r){var o=a.getTypeOfPropertyOfType(n,r);e.Debug.assert(!!o,"generic should have all the properties of its reference."),s.push.apply(s,y(o,p(t),i));})),o[t.symbol.escapedName](f(s))}(r,t)})):[]}(t)),l}function m(t){var r=new e.Map;t.properties&&t.properties.forEach((function(e,t){var n=a.createSymbol(4,t);n.type=p(e),r.set(t,n);}));var n=t.calls?[v(t.calls)]:[],i=t.constructs?[v(t.constructs)]:[],o=t.stringIndex?[a.createIndexInfo(a.getStringType(),p(t.stringIndex),!1)]:[];return a.createAnonymousType(void 0,r,n,i,o)}function y(t,r,n){if(t===n)return [r];if(3145728&t.flags)return e.flatMap(t.types,(function(e){return y(e,r,n)}));if(4&e.getObjectFlags(t)&&4&e.getObjectFlags(r)){var i=a.getTypeArguments(t),o=a.getTypeArguments(r),s=[];if(i&&o)for(var c=0;c<i.length;c++)o[c]&&s.push.apply(s,y(i[c],o[c],n));return s}var l=a.getSignaturesOfType(t,0),u=a.getSignaturesOfType(r,0);return 1===l.length&&1===u.length?function(t,r,n){for(var i=[],o=0;o<t.parameters.length;o++){var s=t.parameters[o],c=r.parameters[o],l=t.declaration&&e.isRestParameter(t.declaration.parameters[o]);if(!c)break;var u=s.valueDeclaration?a.getTypeOfSymbolAtLocation(s,s.valueDeclaration):a.getAnyType(),_=l&&a.getElementTypeOfArrayType(u);_&&(u=_);var d=c.type||(c.valueDeclaration?a.getTypeOfSymbolAtLocation(c,c.valueDeclaration):a.getAnyType());i.push.apply(i,y(u,d,n));}var p=a.getReturnTypeOfSignature(t),f=a.getReturnTypeOfSignature(r);return i.push.apply(i,y(p,f,n)),i}(l[0],u[0],n):[]}function v(t){for(var r=[],n=Math.max.apply(Math,t.map((function(e){return e.argumentTypes.length}))),i=function(n){var i=a.createSymbol(1,e.escapeLeadingUnderscores("arg".concat(n)));i.type=f(t.map((function(e){return e.argumentTypes[n]||a.getUndefinedType()}))),t.some((function(e){return void 0===e.argumentTypes[n]}))&&(i.flags|=16777216),r.push(i);},o=0;o<n;o++)i(o);var s=p(c(t.map((function(e){return e.return_}))));return a.createSignature(void 0,void 0,void 0,r,s,void 0,n,0)}function h(e,t){!t||1&t.flags||131072&t.flags||(e.candidateTypes||(e.candidateTypes=[])).push(t);}function b(e,t){!t||1&t.flags||131072&t.flags||(e.candidateThisTypes||(e.candidateThisTypes=[])).push(t);}}t.registerCodeFix({errorCodes:i,getCodeActions:function(n){var i,s=n.sourceFile,c=n.program,l=n.span.start,u=n.errorCode,_=n.cancellationToken,d=n.host,p=n.preferences,f=e.getTokenAtPosition(s,l),g=e.textChanges.ChangeTracker.with(n,(function(t){i=o(t,s,f,u,c,_,e.returnTrue,d,p);})),m=i&&e.getNameOfDeclaration(i);return m&&0!==g.length?[t.createCodeFixAction(r,g,[a(u,f),e.getTextOfNode(m)],r,e.Diagnostics.Infer_all_types_from_usage)]:void 0},fixIds:[r],getAllCodeActions:function(r){var n=r.sourceFile,a=r.program,s=r.cancellationToken,c=r.host,l=r.preferences,u=e.nodeSeenTracker();return t.codeFixAll(r,i,(function(t,r){o(t,n,e.getTokenAtPosition(r.file,r.start),r.code,a,s,u,c,l);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixReturnTypeInAsyncFunction",n=[e.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0.code];function i(t,r,n){if(!e.isInJSFile(t)){var i=e.getTokenAtPosition(t,n),a=e.findAncestor(i,e.isFunctionLikeDeclaration),o=null==a?void 0:a.type;if(o){var s=r.getTypeFromTypeNode(o),c=r.getAwaitedType(s)||r.getVoidType(),l=r.typeToTypeNode(c,o,void 0);return l?{returnTypeNode:o,returnType:s,promisedTypeNode:l,promisedType:c}:void 0}}}function a(t,r,n,i){t.replaceNode(r,n,e.factory.createTypeReferenceNode("Promise",[i]));}t.registerCodeFix({errorCodes:n,fixIds:[r],getCodeActions:function(n){var o=n.sourceFile,s=n.program,c=n.span,l=s.getTypeChecker(),u=i(o,s.getTypeChecker(),c.start);if(u){var _=u.returnTypeNode,d=u.returnType,p=u.promisedTypeNode,f=u.promisedType,g=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,_,p)}));return [t.createCodeFixAction(r,g,[e.Diagnostics.Replace_0_with_Promise_1,l.typeToString(d),l.typeToString(f)],r,e.Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions)]}},getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){var n=i(r.file,e.program.getTypeChecker(),r.start);n&&a(t,r.file,n.returnTypeNode,n.promisedTypeNode);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="disableJsDiagnostics",n="disableJsDiagnostics",i=e.mapDefined(Object.keys(e.Diagnostics),(function(t){var r=e.Diagnostics[t];return r.category===e.DiagnosticCategory.Error?r.code:void 0}));function a(t,r,n,i){var a=e.getLineAndCharacterOfPosition(r,n).line;i&&!e.tryAddToSet(i,a)||t.insertCommentBeforeLine(r,a,n," @ts-ignore");}t.registerCodeFix({errorCodes:i,getCodeActions:function(i){var o=i.sourceFile,s=i.program,c=i.span,l=i.host,u=i.formatContext;if(e.isInJSFile(o)&&e.isCheckJsEnabledForFile(o,s.getCompilerOptions())){var _=o.checkJsDirective?"":e.getNewLineOrDefaultFromHost(l,u.options),d=[t.createCodeFixActionWithoutFixAll(r,[t.createFileTextChanges(o.fileName,[e.createTextChange(o.checkJsDirective?e.createTextSpanFromBounds(o.checkJsDirective.pos,o.checkJsDirective.end):e.createTextSpan(0,0),"// @ts-nocheck".concat(_))])],e.Diagnostics.Disable_checking_for_this_file)];return e.textChanges.isValidLocationToAddComment(o,c.start)&&d.unshift(t.createCodeFixAction(r,e.textChanges.ChangeTracker.with(i,(function(e){return a(e,o,c.start)})),e.Diagnostics.Ignore_this_error_message,n,e.Diagnostics.Add_ts_ignore_to_all_error_messages)),d}},fixIds:[n],getAllCodeActions:function(r){var n=new e.Set;return t.codeFixAll(r,i,(function(t,r){e.textChanges.isValidLocationToAddComment(r.file,r.start)&&a(t,r.file,r.start,n);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){function r(t){return {trackSymbol:function(){return !1},moduleResolverHost:e.getModuleSpecifierResolverHost(t.program,t.host)}}function n(t,n,a,c,l,u,_,p,g,m){void 0===g&&(g=3),void 0===m&&(m=!1);var y=t.getDeclarations();if(y&&y.length){var v=c.program.getTypeChecker(),h=e.getEmitScriptTarget(c.program.getCompilerOptions()),b=y[0],x=e.getSynthesizedDeepClone(e.getNameOfDeclaration(b),!1),D=function(t){return 4&t?e.factory.createToken(123):16&t?e.factory.createToken(122):void 0}(e.getEffectiveModifierFlags(b)),S=D?e.factory.createNodeArray([D]):void 0,T=v.getWidenedType(v.getTypeOfSymbolAtLocation(t,n)),C=!!(16777216&t.flags),k=!!(16777216&n.flags)||m,E=e.getQuotePreference(a,l);switch(b.kind){case 166:case 167:var N=0===E?268435456:void 0,F=v.typeToTypeNode(T,n,N,r(c));u&&(A=d(F,h))&&(F=A.typeNode,f(u,A.symbols)),_(e.factory.createPropertyDeclaration(void 0,S,x,C&&2&g?e.factory.createToken(57):void 0,F,void 0));break;case 172:case 173:var A,P=v.typeToTypeNode(T,n,void 0,r(c)),w=e.getAllAccessorDeclarations(y,b),I=w.secondAccessor?[w.firstAccessor,w.secondAccessor]:[w.firstAccessor];u&&(A=d(P,h))&&(P=A.typeNode,f(u,A.symbols));for(var O=0,M=I;O<M.length;O++){var L=M[O];if(e.isGetAccessorDeclaration(L))_(e.factory.createGetAccessorDeclaration(void 0,S,x,e.emptyArray,P,k?void 0:p||s(E)));else {e.Debug.assertNode(L,e.isSetAccessorDeclaration,"The counterpart to a getter should be a setter");var R=e.getSetAccessorValueParameter(L),B=R&&e.isIdentifier(R.name)?e.idText(R.name):void 0;_(e.factory.createSetAccessorDeclaration(void 0,S,x,o(1,[B],[P],1,!1),k?void 0:p||s(E)));}}break;case 168:case 169:var j=v.getSignaturesOfType(T,0);if(!e.some(j))break;if(1===y.length){e.Debug.assert(1===j.length,"One declaration implies one signature"),K(E,j[0],S,x,k?void 0:p||s(E));break}for(var J=0,z=j;J<z.length;J++)K(E,z[J],e.getSynthesizedDeepClones(S,!1),e.getSynthesizedDeepClone(x,!1));k||(y.length>j.length?K(E,v.getSignatureFromDeclaration(y[y.length-1]),S,x,p||s(E)):(e.Debug.assert(y.length===j.length,"Declarations and signatures should match count"),_(function(t,n,i,a,c,l,u,_,d){for(var p=a[0],f=a[0].minArgumentCount,g=!1,m=0,y=a;m<y.length;m++){var v=y[m];f=Math.min(v.minArgumentCount,f),e.signatureHasRestParameter(v)&&(g=!0),v.parameters.length>=p.parameters.length&&(!e.signatureHasRestParameter(v)||e.signatureHasRestParameter(p))&&(p=v);}var h=p.parameters.length-(e.signatureHasRestParameter(p)?1:0),b=p.parameters.map((function(e){return e.name})),x=o(h,b,void 0,f,!1);if(g){var D=e.factory.createParameterDeclaration(void 0,void 0,e.factory.createToken(25),b[h]||"rest",h>=f?e.factory.createToken(57):void 0,e.factory.createArrayTypeNode(e.factory.createKeywordTypeNode(155)),void 0);x.push(D);}return function(t,r,n,i,a,o,c,l){return e.factory.createMethodDeclaration(void 0,t,void 0,r,n?e.factory.createToken(57):void 0,void 0,a,o,l||s(c))}(u,c,l,0,x,function(t,n,i,a){if(e.length(t)){var o=n.getUnionType(e.map(t,n.getReturnTypeOfSignature));return n.typeToTypeNode(o,a,void 0,r(i))}}(a,t,n,i),_,d)}(v,c,n,j,x,C&&!!(1&g),S,E,p))));}}function K(e,t,r,a,o){var s=i(169,c,e,t,o,a,r,C&&!!(1&g),n,u);s&&_(s);}}function i(t,n,i,a,o,s,c,l,u,_){var p=n.program,g=p.getTypeChecker(),m=e.getEmitScriptTarget(p.getCompilerOptions()),y=524545|(0===i?268435456:0),v=g.signatureToSignatureDeclaration(a,t,u,y,r(n));if(v){var h=v.typeParameters,b=v.parameters,x=v.type;if(_){if(h){var D=e.sameMap(h,(function(t){var r,n=t.constraint,i=t.default;return n&&(r=d(n,m))&&(n=r.typeNode,f(_,r.symbols)),i&&(r=d(i,m))&&(i=r.typeNode,f(_,r.symbols)),e.factory.updateTypeParameterDeclaration(t,t.modifiers,t.name,n,i)}));h!==D&&(h=e.setTextRange(e.factory.createNodeArray(D,h.hasTrailingComma),h));}var S=e.sameMap(b,(function(t){var r=d(t.type,m),n=t.type;return r&&(n=r.typeNode,f(_,r.symbols)),e.factory.updateParameterDeclaration(t,t.decorators,t.modifiers,t.dotDotDotToken,t.name,t.questionToken,n,t.initializer)}));if(b!==S&&(b=e.setTextRange(e.factory.createNodeArray(S,b.hasTrailingComma),b)),x){var T=d(x,m);T&&(x=T.typeNode,f(_,T.symbols));}}var C=l?e.factory.createToken(57):void 0,k=v.asteriskToken;return e.isFunctionExpression(v)?e.factory.updateFunctionExpression(v,c,v.asteriskToken,e.tryCast(s,e.isIdentifier),h,b,x,null!=o?o:v.body):e.isArrowFunction(v)?e.factory.updateArrowFunction(v,c,h,b,x,v.equalsGreaterThanToken,null!=o?o:v.body):e.isMethodDeclaration(v)?e.factory.updateMethodDeclaration(v,void 0,c,k,null!=s?s:e.factory.createIdentifier(""),C,h,b,x,o):void 0}}function a(t,r,n,i,a,o,s){var c=t.typeToTypeNode(n,i,o,s);if(c&&e.isImportTypeNode(c)){var l=d(c,a);l&&(f(r,l.symbols),c=l.typeNode);}return e.getSynthesizedDeepClone(c)}function o(t,r,n,i,a){for(var o=[],s=0;s<t;s++){var c=e.factory.createParameterDeclaration(void 0,void 0,void 0,r&&r[s]||"arg".concat(s),void 0!==i&&s>=i?e.factory.createToken(57):void 0,a?void 0:n&&n[s]||e.factory.createKeywordTypeNode(155),void 0);o.push(c);}return o}function s(t){return c(e.Diagnostics.Method_not_implemented.message,t)}function c(t,r){return e.factory.createBlock([e.factory.createThrowStatement(e.factory.createNewExpression(e.factory.createIdentifier("Error"),void 0,[e.factory.createStringLiteral(t,0===r)]))],!0)}function l(t,r,n){var i=e.getTsConfigObjectLiteralExpression(r);if(i){var a=_(i,"compilerOptions");if(void 0!==a){var o=a.initializer;if(e.isObjectLiteralExpression(o))for(var s=0,c=n;s<c.length;s++){var l=c[s],d=l[0],p=l[1],f=_(o,d);void 0===f?t.insertNodeAtObjectStart(r,o,u(d,p)):t.replaceNode(r,f.initializer,p);}}else t.insertNodeAtObjectStart(r,i,u("compilerOptions",e.factory.createObjectLiteralExpression(n.map((function(e){return u(e[0],e[1])})),!0)));}}function u(t,r){return e.factory.createPropertyAssignment(e.factory.createStringLiteral(t),r)}function _(t,r){return e.find(t.properties,(function(t){return e.isPropertyAssignment(t)&&!!t.name&&e.isStringLiteral(t.name)&&t.name.text===r}))}function d(t,r){var n,i=e.visitNode(t,(function t(i){var a;if(e.isLiteralImportTypeNode(i)&&i.qualifier){var o=e.getFirstIdentifier(i.qualifier),s=e.getNameForExportedSymbol(o.symbol,r),c=s!==o.text?p(i.qualifier,e.factory.createIdentifier(s)):i.qualifier;n=e.append(n,o.symbol);var l=null===(a=i.typeArguments)||void 0===a?void 0:a.map(t);return e.factory.createTypeReferenceNode(c,l)}return e.visitEachChild(i,t,e.nullTransformationContext)}));if(n&&i)return {typeNode:i,symbols:n}}function p(t,r){return 79===t.kind?r:e.factory.createQualifiedName(p(t.left,r),t.right)}function f(e,t){t.forEach((function(t){return e.addImportFromExportedSymbol(t,!0)}));}var g;t.createMissingMemberNodes=function(e,t,r,i,a,o,s){for(var c=e.symbol.members,l=0,u=t;l<u.length;l++){var _=u[l];c.has(_.escapedName)||n(_,e,r,i,a,o,s,void 0);}},t.getNoopSymbolTrackerWithResolver=r,(g=t.PreserveOptionalFlags||(t.PreserveOptionalFlags={}))[g.Method=1]="Method",g[g.Property=2]="Property",g[g.All=3]="All",t.addNewNodeForMemberSymbol=n,t.createSignatureDeclarationFromSignature=i,t.createSignatureDeclarationFromCallExpression=function(t,n,i,l,u,_,d){var p=e.getQuotePreference(n.sourceFile,n.preferences),f=e.getEmitScriptTarget(n.program.getCompilerOptions()),g=r(n),m=n.program.getTypeChecker(),y=e.isInJSFile(d),v=l.typeArguments,h=l.arguments,b=l.parent,x=y?void 0:m.getContextualType(l),D=e.map(h,(function(t){return e.isIdentifier(t)?t.text:e.isPropertyAccessExpression(t)&&e.isIdentifier(t.name)?t.name.text:void 0})),S=y?[]:e.map(h,(function(e){return a(m,i,m.getBaseTypeOfLiteralType(m.getTypeAtLocation(e)),d,f,void 0,g)})),T=_?e.factory.createNodeArray(e.factory.createModifiersFromModifierFlags(_)):void 0,C=e.isYieldExpression(b)?e.factory.createToken(41):void 0,k=y||void 0===v?void 0:e.map(v,(function(t,r){return e.factory.createTypeParameterDeclaration(void 0,84+v.length-1<=90?String.fromCharCode(84+r):"T".concat(r))})),E=o(h.length,D,S,void 0,y),N=y||void 0===x?void 0:m.typeToTypeNode(x,d,void 0,g);switch(t){case 169:return e.factory.createMethodDeclaration(void 0,T,C,u,void 0,k,E,N,s(p));case 168:return e.factory.createMethodSignature(T,u,void 0,k,E,N);case 256:return e.factory.createFunctionDeclaration(void 0,T,C,u,k,E,N,c(e.Diagnostics.Function_not_implemented.message,p));default:e.Debug.fail("Unexpected kind");}},t.typeToAutoImportableTypeNode=a,t.createStubbedBody=c,t.setJsonCompilerOptionValues=l,t.setJsonCompilerOptionValue=function(e,t,r,n){l(e,t,[[r,n]]);},t.createJsonPropertyAssignment=u,t.findJsonProperty=_,t.tryGetAutoImportableReferenceFromTypeNode=d,t.importSymbols=f;}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){function r(t){return e.isParameterPropertyDeclaration(t,t.parent)||e.isPropertyDeclaration(t)||e.isPropertyAssignment(t)}function i(t,r){return e.isIdentifier(r)?e.factory.createIdentifier(t):e.factory.createStringLiteral(t)}function a(t,r,n){var i=r?n.name:e.factory.createThis();return e.isIdentifier(t)?e.factory.createPropertyAccessExpression(i,t):e.factory.createElementAccessExpression(i,e.factory.createStringLiteralFromNode(t))}function o(t,n,a,o,s){void 0===s&&(s=!0);var l=e.getTokenAtPosition(t,a),u=a===o&&s,_=e.findAncestor(l.parent,r);if(!_||!e.nodeOverlapsWithStartEnd(_.name,t,a,o)&&!u)return {error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_property_for_which_to_generate_accessor)};if(!function(t){return e.isIdentifier(t)||e.isStringLiteral(t)}(_.name))return {error:e.getLocaleSpecificMessage(e.Diagnostics.Name_is_not_valid)};if(124!=(124|e.getEffectiveModifierFlags(_)))return {error:e.getLocaleSpecificMessage(e.Diagnostics.Can_only_convert_property_with_modifier)};var d=_.name.text,p=e.startsWithUnderscore(d),f=i(p?d:e.getUniqueName("_".concat(d),t),_.name),g=i(p?e.getUniqueName(d.substring(1),t):d,_.name);return {isStatic:e.hasStaticModifier(_),isReadonly:e.hasEffectiveReadonlyModifier(_),type:c(_,n),container:164===_.kind?_.parent.parent:_.parent,originalName:_.name.text,declaration:_,fieldName:f,accessorName:g,renameAccessor:p}}function s(t,r,n,i,a){e.isParameterPropertyDeclaration(i,i.parent)?t.insertMemberAtStart(r,a,n):e.isPropertyAssignment(i)?t.insertNodeAfterComma(r,i,n):t.insertNodeAfter(r,i,n);}function c(t,r){var i=e.getTypeAnnotationNode(t);if(e.isPropertyDeclaration(t)&&i&&t.questionToken){var a=r.getTypeChecker(),o=a.getTypeFromTypeNode(i);if(!a.isTypeAssignableTo(a.getUndefinedType(),o)){var s=e.isUnionTypeNode(i)?i.types:[i];return e.factory.createUnionTypeNode(n$4(n$4([],s,!0),[e.factory.createKeywordTypeNode(153)],!1))}}return i}t.generateAccessorFromProperty=function(t,r,n,i,c,l){var u=o(t,r,n,i);if(u&&!e.refactor.isRefactorErrorInfo(u)){var _,d,p=e.textChanges.ChangeTracker.fromContext(c),f=u.isStatic,g=u.isReadonly,m=u.fieldName,y=u.accessorName,v=u.originalName,h=u.type,b=u.container,x=u.declaration;if(e.suppressLeadingAndTrailingTrivia(m),e.suppressLeadingAndTrailingTrivia(y),e.suppressLeadingAndTrailingTrivia(x),e.suppressLeadingAndTrailingTrivia(b),e.isClassLike(b)){var D=e.getEffectiveModifierFlags(x);if(e.isSourceFileJS(t)){var S=e.createModifiers(D);_=S,d=S;}else _=e.createModifiers(function(e){return e&=-65,16&(e&=-9)||(e|=4),e}(D)),d=e.createModifiers(function(e){return e&=-5,8|(e&=-17)}(D));}!function(t,r,n,i,a,o){e.isPropertyDeclaration(n)?function(t,r,n,i,a,o){var s=e.factory.updatePropertyDeclaration(n,n.decorators,o,a,n.questionToken||n.exclamationToken,i,n.initializer);t.replaceNode(r,n,s);}(t,r,n,i,a,o):e.isPropertyAssignment(n)?function(t,r,n,i){var a=e.factory.updatePropertyAssignment(n,i,n.initializer);t.replacePropertyAssignment(r,n,a);}(t,r,n,a):t.replaceNode(r,n,e.factory.updateParameterDeclaration(n,n.decorators,o,n.dotDotDotToken,e.cast(a,e.isIdentifier),n.questionToken,n.type,n.initializer));}(p,t,x,h,m,d);var T=function(t,r,n,i,o,s){return e.factory.createGetAccessorDeclaration(void 0,i,r,void 0,n,e.factory.createBlock([e.factory.createReturnStatement(a(t,o,s))],!0))}(m,y,h,_,f,b);if(e.suppressLeadingAndTrailingTrivia(T),s(p,t,T,x,b),g){var C=e.getFirstConstructorWithBody(b);C&&function(t,r,n,i,a){n.body&&n.body.forEachChild((function n(o){e.isElementAccessExpression(o)&&108===o.expression.kind&&e.isStringLiteral(o.argumentExpression)&&o.argumentExpression.text===a&&e.isWriteAccess(o)&&t.replaceNode(r,o.argumentExpression,e.factory.createStringLiteral(i)),e.isPropertyAccessExpression(o)&&108===o.expression.kind&&o.name.text===a&&e.isWriteAccess(o)&&t.replaceNode(r,o.name,e.factory.createIdentifier(i)),e.isFunctionLike(o)||e.isClassLike(o)||o.forEachChild(n);}));}(p,t,C,m.text,v);}else {var k=function(t,r,n,i,o,s){return e.factory.createSetAccessorDeclaration(void 0,i,r,[e.factory.createParameterDeclaration(void 0,void 0,void 0,e.factory.createIdentifier("value"),void 0,n)],e.factory.createBlock([e.factory.createExpressionStatement(e.factory.createAssignment(a(t,o,s),e.factory.createIdentifier("value")))],!0))}(m,y,h,_,f,b);e.suppressLeadingAndTrailingTrivia(k),s(p,t,k,x,b);}return p.getChanges()}},t.getAccessorConvertiblePropertyAtPosition=o,t.getAllSupers=function(t,r){for(var n=[];t;){var i=e.getClassExtendsHeritageElement(t),a=i&&r.getSymbolAtLocation(i.expression);if(!a)break;var o=2097152&a.flags?r.getAliasedSymbol(a):a,s=o.declarations&&e.find(o.declarations,e.isClassLike);if(!s)break;n.push(s),t=s;}return n};}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="invalidImportSyntax";function n(n,i,a,o){var s=e.textChanges.ChangeTracker.with(n,(function(e){return e.replaceNode(i,a,o)}));return t.createCodeFixActionWithoutFixAll(r,s,[e.Diagnostics.Replace_import_with_0,s[0].textChanges[0].newText])}function i(i,a){var o=i.program.getTypeChecker().getTypeAtLocation(a);if(!o.symbol||!o.symbol.originatingImport)return [];var s=[],c=o.symbol.originatingImport;if(e.isImportCall(c)||e.addRange(s,function(t,r){var i=e.getSourceFileOfNode(r),a=e.getNamespaceDeclarationNode(r),o=t.program.getCompilerOptions(),s=[];return s.push(n(t,i,r,e.makeImport(a.name,void 0,r.moduleSpecifier,e.getQuotePreference(i,t.preferences)))),e.getEmitModuleKind(o)===e.ModuleKind.CommonJS&&s.push(n(t,i,r,e.factory.createImportEqualsDeclaration(void 0,void 0,!1,a.name,e.factory.createExternalModuleReference(r.moduleSpecifier)))),s}(i,c)),e.isExpression(a)&&(!e.isNamedDeclaration(a.parent)||a.parent.name!==a)){var l=i.sourceFile,u=e.textChanges.ChangeTracker.with(i,(function(t){return t.replaceNode(l,a,e.factory.createPropertyAccessExpression(a,"default"),{})}));s.push(t.createCodeFixActionWithoutFixAll(r,u,e.Diagnostics.Use_synthetic_default_member));}return s}t.registerCodeFix({errorCodes:[e.Diagnostics.This_expression_is_not_callable.code,e.Diagnostics.This_expression_is_not_constructable.code],getCodeActions:function(t){var r=t.sourceFile,n=e.Diagnostics.This_expression_is_not_callable.code===t.errorCode?208:209,a=e.findAncestor(e.getTokenAtPosition(r,t.span.start),(function(e){return e.kind===n}));return a?i(t,a.expression):[]}}),t.registerCodeFix({errorCodes:[e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,e.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,e.Diagnostics.Type_0_is_not_assignable_to_type_1.code,e.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated.code,e.Diagnostics.Type_predicate_0_is_not_assignable_to_1.code,e.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3.code,e.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3.code,e.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2.code,e.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,e.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property.code,e.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1.code],getCodeActions:function(t){var r=t.sourceFile,n=e.findAncestor(e.getTokenAtPosition(r,t.span.start),(function(e){return e.getStart()===t.span.start&&e.getEnd()===t.span.start+t.span.length}));return n?i(t,n):[]}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="strictClassInitialization",n="addMissingPropertyDefiniteAssignmentAssertions",i="addMissingPropertyUndefinedType",a="addMissingPropertyInitializer",o=[e.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];function s(t,r){var n=e.getTokenAtPosition(t,r);if(e.isIdentifier(n)&&e.isPropertyDeclaration(n.parent)){var i=e.getEffectiveTypeAnnotationNode(n.parent);if(i)return {type:i,prop:n.parent,isJs:e.isInJSFile(n.parent)}}}function c(t,r,n){e.suppressLeadingAndTrailingTrivia(n);var i=e.factory.updatePropertyDeclaration(n,n.decorators,n.modifiers,n.name,e.factory.createToken(53),n.type,n.initializer);t.replaceNode(r,n,i);}function l(t,r,n){var i=e.factory.createKeywordTypeNode(153),a=e.isUnionTypeNode(n.type)?n.type.types.concat(i):[n.type,i],o=e.factory.createUnionTypeNode(a);n.isJs?t.addJSDocTags(r,n.prop,[e.factory.createJSDocTypeTag(void 0,e.factory.createJSDocTypeExpression(o))]):t.replaceNode(r,n.type,o);}function u(t,r,n,i){e.suppressLeadingAndTrailingTrivia(n);var a=e.factory.updatePropertyDeclaration(n,n.decorators,n.modifiers,n.name,n.questionToken,n.type,i);t.replaceNode(r,n,a);}function _(e,t){return d(e,e.getTypeFromTypeNode(t.type))}function d(t,r){if(512&r.flags)return r===t.getFalseType()||r===t.getFalseType(!0)?e.factory.createFalse():e.factory.createTrue();if(r.isStringLiteral())return e.factory.createStringLiteral(r.value);if(r.isNumberLiteral())return e.factory.createNumericLiteral(r.value);if(2048&r.flags)return e.factory.createBigIntLiteral(r.value);if(r.isUnion())return e.firstDefined(r.types,(function(e){return d(t,e)}));if(r.isClass()){var n=e.getClassLikeDeclarationOfSymbol(r.symbol);if(!n||e.hasSyntacticModifier(n,128))return;var i=e.getFirstConstructorWithBody(n);if(i&&i.parameters.length)return;return e.factory.createNewExpression(e.factory.createIdentifier(r.symbol.name),void 0,void 0)}return t.isArrayLikeType(r)?e.factory.createArrayLiteralExpression():void 0}t.registerCodeFix({errorCodes:o,getCodeActions:function(o){var d=s(o.sourceFile,o.span.start);if(d){var p=[];return e.append(p,function(n,a){var o=e.textChanges.ChangeTracker.with(n,(function(e){return l(e,n.sourceFile,a)}));return t.createCodeFixAction(r,o,[e.Diagnostics.Add_undefined_type_to_property_0,a.prop.name.getText()],i,e.Diagnostics.Add_undefined_type_to_all_uninitialized_properties)}(o,d)),e.append(p,function(i,a){if(!a.isJs){var o=e.textChanges.ChangeTracker.with(i,(function(e){return c(e,i.sourceFile,a.prop)}));return t.createCodeFixAction(r,o,[e.Diagnostics.Add_definite_assignment_assertion_to_property_0,a.prop.getText()],n,e.Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties)}}(o,d)),e.append(p,function(n,i){if(!i.isJs){var o=_(n.program.getTypeChecker(),i.prop);if(o){var s=e.textChanges.ChangeTracker.with(n,(function(e){return u(e,n.sourceFile,i.prop,o)}));return t.createCodeFixAction(r,s,[e.Diagnostics.Add_initializer_to_property_0,i.prop.name.getText()],a,e.Diagnostics.Add_initializers_to_all_uninitialized_properties)}}}(o,d)),p}},fixIds:[n,i,a],getAllCodeActions:function(r){return t.codeFixAll(r,o,(function(t,o){var d=s(o.file,o.start);if(d)switch(r.fixId){case n:c(t,o.file,d.prop);break;case i:l(t,o.file,d);break;case a:var p=_(r.program.getTypeChecker(),d.prop);if(!p)return;u(t,o.file,d.prop,p);break;default:e.Debug.fail(JSON.stringify(r.fixId));}}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="requireInTs",n=[e.Diagnostics.require_call_may_be_converted_to_an_import.code];function i(t,r,n){var i=n.allowSyntheticDefaults,a=n.defaultImportName,o=n.namedImports,s=n.statement,c=n.required;t.replaceNode(r,s,a&&!i?e.factory.createImportEqualsDeclaration(void 0,void 0,!1,a,e.factory.createExternalModuleReference(c)):e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,a,o),c,void 0));}function a(t,r,n){var i=e.getTokenAtPosition(t,n).parent;if(!e.isRequireCall(i,!0))throw e.Debug.failBadSyntaxKind(i);var a=e.cast(i.parent,e.isVariableDeclaration),o=e.tryCast(a.name,e.isIdentifier),s=e.isObjectBindingPattern(a.name)?function(t){for(var r=[],n=0,i=t.elements;n<i.length;n++){var a=i[n];if(!e.isIdentifier(a.name)||a.initializer)return;r.push(e.factory.createImportSpecifier(!1,e.tryCast(a.propertyName,e.isIdentifier),a.name));}if(r.length)return e.factory.createNamedImports(r)}(a.name):void 0;if(o||s)return {allowSyntheticDefaults:e.getAllowSyntheticDefaultImports(r.getCompilerOptions()),defaultImportName:o,namedImports:s,statement:e.cast(a.parent.parent,e.isVariableStatement),required:e.first(i.arguments)}}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=a(n.sourceFile,n.program,n.span.start);if(o){var s=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,o)}));return [t.createCodeFixAction(r,s,e.Diagnostics.Convert_require_to_import,r,e.Diagnostics.Convert_all_require_to_import)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){var n=a(r.file,e.program,r.start);n&&i(t,e.sourceFile,n);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="useDefaultImport",n=[e.Diagnostics.Import_may_be_converted_to_a_default_import.code];function i(t,r){var n=e.getTokenAtPosition(t,r);if(e.isIdentifier(n)){var i=n.parent;if(e.isImportEqualsDeclaration(i)&&e.isExternalModuleReference(i.moduleReference))return {importNode:i,name:n,moduleSpecifier:i.moduleReference.expression};if(e.isNamespaceImport(i)){var a=i.parent.parent;return {importNode:a,name:n,moduleSpecifier:a.moduleSpecifier}}}}function a(t,r,n,i){t.replaceNode(r,n.importNode,e.makeImport(n.name,void 0,n.moduleSpecifier,e.getQuotePreference(r,i)));}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.span.start,c=i(o,s);if(c){var l=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,c,n.preferences)}));return [t.createCodeFixAction(r,l,e.Diagnostics.Convert_to_default_import,r,e.Diagnostics.Convert_all_to_default_imports)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){var n=i(r.file,r.start);n&&a(t,r.file,n,e.preferences);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="useBigintLiteral",n=[e.Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code];function i(t,r,n){var i=e.tryCast(e.getTokenAtPosition(r,n.start),e.isNumericLiteral);if(i){var a=i.getText(r)+"n";t.replaceNode(r,i,e.factory.createBigIntLiteral(a));}}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span)}));if(a.length>0)return [t.createCodeFixAction(r,a,e.Diagnostics.Convert_to_a_bigint_numeric_literal,r,e.Diagnostics.Convert_all_to_bigint_numeric_literals)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){return i(e,t.file,t)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixAddModuleReferTypeMissingTypeof",n=[e.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];function i(t,r){var n=e.getTokenAtPosition(t,r);return e.Debug.assert(100===n.kind,"This token should be an ImportKeyword"),e.Debug.assert(200===n.parent.kind,"Token parent should be an ImportType"),n.parent}function a(t,r,n){var i=e.factory.updateImportTypeNode(n,n.argument,n.qualifier,n.typeArguments,!0);t.replaceNode(r,n,i);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.span,c=i(o,s.start),l=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,c)}));return [t.createCodeFixAction(r,l,e.Diagnostics.Add_missing_typeof,r,e.Diagnostics.Add_missing_typeof)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){return a(t,e.sourceFile,i(r.file,r.start))}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="wrapJsxInFragment",n=[e.Diagnostics.JSX_expressions_must_have_one_parent_element.code];function i(t,r){var n=e.getTokenAtPosition(t,r).parent.parent;if((e.isBinaryExpression(n)||(n=n.parent,e.isBinaryExpression(n)))&&e.nodeIsMissing(n.operatorToken))return n}function a(t,r,n){var i=function(t){for(var r=[],n=t;;){if(e.isBinaryExpression(n)&&e.nodeIsMissing(n.operatorToken)&&27===n.operatorToken.kind){if(r.push(n.left),e.isJsxChild(n.right))return r.push(n.right),r;if(e.isBinaryExpression(n.right)){n=n.right;continue}return}return}}(n);i&&t.replaceNode(r,n,e.factory.createJsxFragment(e.factory.createJsxOpeningFragment(),i,e.factory.createJsxJsxClosingFragment()));}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=n.span,c=i(o,s.start);if(c){var l=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,c)}));return [t.createCodeFixAction(r,l,e.Diagnostics.Wrap_in_JSX_fragment,r,e.Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){var n=i(e.sourceFile,r.start);n&&a(t,e.sourceFile,n);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="fixConvertToMappedObjectType",i=[e.Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];function a(t,r){var n=e.getTokenAtPosition(t,r),i=e.tryCast(n.parent.parent,e.isIndexSignatureDeclaration);if(i){var a=e.isInterfaceDeclaration(i.parent)?i.parent:e.tryCast(i.parent.parent,e.isTypeAliasDeclaration);if(a)return {indexSignature:i,container:a}}}function o(t,r,i){var a,o,s=i.indexSignature,c=i.container,l=(e.isInterfaceDeclaration(c)?c.members:c.type.members).filter((function(t){return !e.isIndexSignatureDeclaration(t)})),u=e.first(s.parameters),_=e.factory.createTypeParameterDeclaration(void 0,e.cast(u.name,e.isIdentifier),u.type),d=e.factory.createMappedTypeNode(e.hasEffectiveReadonlyModifier(s)?e.factory.createModifier(145):void 0,_,void 0,s.questionToken,s.type,void 0),p=e.factory.createIntersectionTypeNode(n$4(n$4(n$4([],e.getAllSuperTypeNodes(c),!0),[d],!1),l.length?[e.factory.createTypeLiteralNode(l)]:e.emptyArray,!0));t.replaceNode(r,c,(a=c,o=p,e.factory.createTypeAliasDeclaration(a.decorators,a.modifiers,a.name,a.typeParameters,o)));}t.registerCodeFix({errorCodes:i,getCodeActions:function(n){var i=n.sourceFile,s=n.span,c=a(i,s.start);if(c){var l=e.textChanges.ChangeTracker.with(n,(function(e){return o(e,i,c)})),u=e.idText(c.container.name);return [t.createCodeFixAction(r,l,[e.Diagnostics.Convert_0_to_mapped_object_type,u],r,[e.Diagnostics.Convert_0_to_mapped_object_type,u])]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,i,(function(e,t){var r=a(t.file,t.start);r&&o(e,t.file,r);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){var t,r,n;t=e.codefix||(e.codefix={}),r="removeAccidentalCallParentheses",n=[e.Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code],t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var i=e.findAncestor(e.getTokenAtPosition(n.sourceFile,n.span.start),e.isCallExpression);if(i){var a=e.textChanges.ChangeTracker.with(n,(function(e){e.deleteRange(n.sourceFile,{pos:i.expression.end,end:i.end});}));return [t.createCodeFixActionWithoutFixAll(r,a,e.Diagnostics.Remove_parentheses)]}},fixIds:[r]});}(t),function(e){!function(t){var r="removeUnnecessaryAwait",n=[e.Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code];function i(t,r,n){var i=e.tryCast(e.getTokenAtPosition(r,n.start),(function(e){return 132===e.kind})),a=i&&e.tryCast(i.parent,e.isAwaitExpression);if(a){var o=a;if(e.isParenthesizedExpression(a.parent)){var s=e.getLeftmostExpression(a.expression,!1);if(e.isIdentifier(s)){var c=e.findPrecedingToken(a.parent.pos,r);c&&103!==c.kind&&(o=a.parent);}}t.replaceNode(r,o,a.expression);}}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span)}));if(a.length>0)return [t.createCodeFixAction(r,a,e.Diagnostics.Remove_unnecessary_await,r,e.Diagnostics.Remove_all_unnecessary_uses_of_await)]},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(e,t){return i(e,t.file,t)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r=[e.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code],n="splitTypeOnlyImport";function i(t,r){return e.findAncestor(e.getTokenAtPosition(t,r.start),e.isImportDeclaration)}function a(t,r,n){if(r){var i=e.Debug.checkDefined(r.importClause);t.replaceNode(n.sourceFile,r,e.factory.updateImportDeclaration(r,r.decorators,r.modifiers,e.factory.updateImportClause(i,i.isTypeOnly,i.name,void 0),r.moduleSpecifier,r.assertClause)),t.insertNodeAfter(n.sourceFile,r,e.factory.createImportDeclaration(void 0,void 0,e.factory.updateImportClause(i,i.isTypeOnly,void 0,i.namedBindings),r.moduleSpecifier,r.assertClause));}}t.registerCodeFix({errorCodes:r,fixIds:[n],getCodeActions:function(r){var o=e.textChanges.ChangeTracker.with(r,(function(e){return a(e,i(r.sourceFile,r.span),r)}));if(o.length)return [t.createCodeFixAction(n,o,e.Diagnostics.Split_into_two_separate_import_declarations,n,e.Diagnostics.Split_all_invalid_type_only_imports)]},getAllCodeActions:function(e){return t.codeFixAll(e,r,(function(t,r){a(t,i(e.sourceFile,r),e);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){var t,r,n;t=e.codefix||(e.codefix={}),r="fixConvertConstToLet",n=[e.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code],t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var i=n.sourceFile,a=n.span,o=n.program,s=function(t,r,n){var i,a=n.getTypeChecker().getSymbolAtLocation(e.getTokenAtPosition(t,r)),o=e.tryCast(null===(i=null==a?void 0:a.valueDeclaration)||void 0===i?void 0:i.parent,e.isVariableDeclarationList);if(void 0!==o){var s=e.findChildOfKind(o,85,t);if(void 0!==s)return e.createRange(s.pos,s.end)}}(i,a.start,o);if(void 0!==s){var c=e.textChanges.ChangeTracker.with(n,(function(e){return function(e,t,r){e.replaceRangeWithText(t,r,"let");}(e,i,s)}));return [t.createCodeFixAction(r,c,e.Diagnostics.Convert_const_to_let,r,e.Diagnostics.Convert_const_to_let)]}},fixIds:[r]});}(t),function(e){!function(t){var r="fixExpectedComma",n=[e.Diagnostics._0_expected.code];function i(t,r,n){var i=e.getTokenAtPosition(t,r);return 26===i.kind&&i.parent&&(e.isObjectLiteralExpression(i.parent)||e.isArrayLiteralExpression(i.parent))?{node:i}:void 0}function a(t,r,n){var i=n.node,a=e.factory.createToken(27);t.replaceNode(r,i,a);}t.registerCodeFix({errorCodes:n,getCodeActions:function(n){var o=n.sourceFile,s=i(o,n.span.start);if(s){var c=e.textChanges.ChangeTracker.with(n,(function(e){return a(e,o,s)}));return [t.createCodeFixAction(r,c,[e.Diagnostics.Change_0_to_1,";",","],r,[e.Diagnostics.Change_0_to_1,";",","])]}},fixIds:[r],getAllCodeActions:function(e){return t.codeFixAll(e,n,(function(t,r){var n=i(r.file,r.start);n&&a(t,e.sourceFile,n);}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="addVoidToPromise",n=[e.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,e.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code];function i(t,r,n,i,a){var o=e.getTokenAtPosition(r,n.start);if(e.isIdentifier(o)&&e.isCallExpression(o.parent)&&o.parent.expression===o&&0===o.parent.arguments.length){var s=i.getTypeChecker(),c=s.getSymbolAtLocation(o),l=null==c?void 0:c.valueDeclaration;if(l&&e.isParameter(l)&&e.isNewExpression(l.parent.parent)&&!(null==a?void 0:a.has(l))){null==a||a.add(l);var u=function(t){var r;if(!e.isInJSFile(t))return t.typeArguments;if(e.isParenthesizedExpression(t.parent)){var n=null===(r=e.getJSDocTypeTag(t.parent))||void 0===r?void 0:r.typeExpression.type;if(n&&e.isTypeReferenceNode(n)&&e.isIdentifier(n.typeName)&&"Promise"===e.idText(n.typeName))return n.typeArguments}}(l.parent.parent);if(e.some(u)){var _=u[0],d=!e.isUnionTypeNode(_)&&!e.isParenthesizedTypeNode(_)&&e.isParenthesizedTypeNode(e.factory.createUnionTypeNode([_,e.factory.createKeywordTypeNode(114)]).types[0]);d&&t.insertText(r,_.pos,"("),t.insertText(r,_.end,d?") | void":" | void");}else {var p=s.getResolvedSignature(o.parent),f=null==p?void 0:p.parameters[0],g=f&&s.getTypeOfSymbolAtLocation(f,l.parent.parent);e.isInJSFile(l)?(!g||3&g.flags)&&(t.insertText(r,l.parent.parent.end,")"),t.insertText(r,e.skipTrivia(r.text,l.parent.parent.pos),"/** @type {Promise<void>} */(")):(!g||2&g.flags)&&t.insertText(r,l.parent.parent.expression.end,"<void>");}}}}t.registerCodeFix({errorCodes:n,fixIds:[r],getCodeActions:function(n){var a=e.textChanges.ChangeTracker.with(n,(function(e){return i(e,n.sourceFile,n.span,n.program)}));if(a.length>0)return [t.createCodeFixAction("addVoidToPromise",a,e.Diagnostics.Add_void_to_Promise_resolved_without_a_value,r,e.Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)]},getAllCodeActions:function(r){return t.codeFixAll(r,n,(function(t,n){return i(t,n.file,n,r.program,new e.Set)}))}});}(e.codefix||(e.codefix={}));}(t),function(e){!function(t){var r="Convert export",n={name:"Convert default export to named export",description:e.Diagnostics.Convert_default_export_to_named_export.message,kind:"refactor.rewrite.export.named"},a={name:"Convert named export to default export",description:e.Diagnostics.Convert_named_export_to_default_export.message,kind:"refactor.rewrite.export.default"};function o(t,r){void 0===r&&(r=!0);var n=t.file,i=t.program,a=e.getRefactorContextSpan(t),o=e.getTokenAtPosition(n,a.start),s=o.parent&&1&e.getSyntacticModifierFlags(o.parent)&&r?o.parent:e.getParentNodeInSpan(o,n,a);if(!s||!(e.isSourceFile(s.parent)||e.isModuleBlock(s.parent)&&e.isAmbientModule(s.parent.parent)))return {error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_export_statement)};var c=e.isSourceFile(s.parent)?s.parent.symbol:s.parent.parent.symbol,l=e.getSyntacticModifierFlags(s)||(e.isExportAssignment(s)&&!s.isExportEquals?513:0),u=!!(512&l);if(!(1&l)||!u&&c.exports.has("default"))return {error:e.getLocaleSpecificMessage(e.Diagnostics.This_file_already_has_a_default_export)};var _=i.getTypeChecker(),d=function(t){return e.isIdentifier(t)&&_.getSymbolAtLocation(t)?void 0:{error:e.getLocaleSpecificMessage(e.Diagnostics.Can_only_convert_named_export)}};switch(s.kind){case 256:case 257:case 258:case 260:case 259:case 261:if(!(g=s).name)return;return d(g.name)||{exportNode:g,exportName:g.name,wasDefault:u,exportingModuleSymbol:c};case 237:var p=s;if(!(2&p.declarationList.flags)||1!==p.declarationList.declarations.length)return;var f=e.first(p.declarationList.declarations);if(!f.initializer)return;return e.Debug.assert(!u,"Can't have a default flag here"),d(f.name)||{exportNode:p,exportName:f.name,wasDefault:u,exportingModuleSymbol:c};case 271:var g;if((g=s).isExportEquals)return;return d(g.expression)||{exportNode:g,exportName:g.expression,wasDefault:u,exportingModuleSymbol:c};default:return}}function s(t,r){return e.factory.createImportSpecifier(!1,t===r?void 0:e.factory.createIdentifier(t),e.factory.createIdentifier(r))}function c(t,r){return e.factory.createExportSpecifier(!1,t===r?void 0:e.factory.createIdentifier(t),e.factory.createIdentifier(r))}t.registerRefactor(r,{kinds:[n.kind,a.kind],getAvailableActions:function(s){var c=o(s,"invoked"===s.triggerReason);if(!c)return e.emptyArray;if(!t.isRefactorErrorInfo(c)){var l=c.wasDefault?n:a;return [{name:r,description:l.description,actions:[l]}]}return s.preferences.provideRefactorNotApplicableReason?[{name:r,description:e.Diagnostics.Convert_default_export_to_named_export.message,actions:[i$1(i$1({},n),{notApplicableReason:c.error}),i$1(i$1({},a),{notApplicableReason:c.error})]}]:e.emptyArray},getEditsForAction:function(r,i){e.Debug.assert(i===n.name||i===a.name,"Unexpected action name");var l=o(r);return e.Debug.assert(l&&!t.isRefactorErrorInfo(l),"Expected applicable refactor info"),{edits:e.textChanges.ChangeTracker.with(r,(function(t){return function(t,r,n,i,a){(function(t,r,n,i){var a=r.wasDefault,o=r.exportNode,s=r.exportName;if(a)if(e.isExportAssignment(o)&&!o.isExportEquals){var l=o.expression,u=c(l.text,l.text);n.replaceNode(t,o,e.factory.createExportDeclaration(void 0,void 0,!1,e.factory.createNamedExports([u])));}else n.delete(t,e.Debug.checkDefined(e.findModifier(o,88),"Should find a default keyword in modifier list"));else {var _=e.Debug.checkDefined(e.findModifier(o,93),"Should find an export keyword in modifier list");switch(o.kind){case 256:case 257:case 258:n.insertNodeAfter(t,_,e.factory.createToken(88));break;case 237:var d=e.first(o.declarationList.declarations);if(!e.FindAllReferences.Core.isSymbolReferencedInFile(s,i,t)&&!d.type){n.replaceNode(t,o,e.factory.createExportDefault(e.Debug.checkDefined(d.initializer,"Initializer was previously known to be present")));break}case 260:case 259:case 261:n.deleteModifier(t,_),n.insertNodeAfter(t,o,e.factory.createExportDefault(e.factory.createIdentifier(s.text)));break;default:e.Debug.fail("Unexpected exportNode kind ".concat(o.kind));}}})(t,n,i,r.getTypeChecker()),function(t,r,n,i){var a=r.wasDefault,o=r.exportName,l=r.exportingModuleSymbol,u=t.getTypeChecker(),_=e.Debug.checkDefined(u.getSymbolAtLocation(o),"Export name should resolve to a symbol");e.FindAllReferences.Core.eachExportReference(t.getSourceFiles(),u,i,_,l,o.text,a,(function(t){var r=t.getSourceFile();a?function(t,r,n,i){var a=r.parent;switch(a.kind){case 206:n.replaceNode(t,r,e.factory.createIdentifier(i));break;case 270:case 275:var o=a;n.replaceNode(t,o,s(i,o.name.text));break;case 267:var c=a;e.Debug.assert(c.name===r,"Import clause name should match provided ref"),o=s(i,r.text);var l=c.namedBindings;if(l)if(268===l.kind){n.deleteRange(t,{pos:r.getStart(t),end:l.getStart(t)});var u=e.isStringLiteral(c.parent.moduleSpecifier)?e.quotePreferenceFromString(c.parent.moduleSpecifier,t):1,_=e.makeImport(void 0,[s(i,r.text)],c.parent.moduleSpecifier,u);n.insertNodeAfter(t,c.parent,_);}else n.delete(t,r),n.insertNodeAtEndOfList(t,l.elements,o);else n.replaceNode(t,r,e.factory.createNamedImports([o]));break;case 200:var d=a;n.replaceNode(t,a,e.factory.createImportTypeNode(d.argument,e.factory.createIdentifier(i),d.typeArguments,d.isTypeOf));break;default:e.Debug.failBadSyntaxKind(a);}}(r,t,n,o.text):function(t,r,n){var i=r.parent;switch(i.kind){case 206:n.replaceNode(t,r,e.factory.createIdentifier("default"));break;case 270:var a=e.factory.createIdentifier(i.name.text);1===i.parent.elements.length?n.replaceNode(t,i.parent,a):(n.delete(t,i),n.insertNodeBefore(t,i.parent,a));break;case 275:n.replaceNode(t,i,c("default",i.name.text));break;default:e.Debug.assertNever(i,"Unexpected parent kind ".concat(i.kind));}}(r,t,n);}));}(r,n,i,a);}(r.file,r.program,l,t,r.cancellationToken)})),renameFilename:void 0,renameLocation:void 0}}});}(e.refactor||(e.refactor={}));}(t),function(e){!function(t){var r,n="Convert import",a=((r={})[0]={name:"Convert namespace import to named imports",description:e.Diagnostics.Convert_namespace_import_to_named_imports.message,kind:"refactor.rewrite.import.named"},r[2]={name:"Convert named imports to namespace import",description:e.Diagnostics.Convert_named_imports_to_namespace_import.message,kind:"refactor.rewrite.import.namespace"},r[1]={name:"Convert named imports to default import",description:e.Diagnostics.Convert_named_imports_to_default_import.message,kind:"refactor.rewrite.import.default"},r);function o(t,r){void 0===r&&(r=!0);var n=t.file,i=e.getRefactorContextSpan(t),a=e.getTokenAtPosition(n,i.start),o=r?e.findAncestor(a,e.isImportDeclaration):e.getParentNodeInSpan(a,n,i);if(!o||!e.isImportDeclaration(o))return {error:"Selection is not an import declaration."};var c=i.start+i.length,l=e.findNextToken(o,o.parent,n);if(!(l&&c>l.getStart())){var u=o.importClause;return u?u.namedBindings?268===u.namedBindings.kind?{convertTo:0,import:u.namedBindings}:s(t.program,u)?{convertTo:1,import:u.namedBindings}:{convertTo:2,import:u.namedBindings}:{error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_namespace_import_or_named_imports)}:{error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_import_clause)}}}function s(t,r){return e.getAllowSyntheticDefaultImports(t.getCompilerOptions())&&(n=r.parent.moduleSpecifier,i=t.getTypeChecker(),!!(a=i.resolveExternalModuleName(n))&&a!==i.resolveExternalModuleSymbol(a));var n,i,a;}function c(t){return e.isPropertyAccessExpression(t)?t.name:t.right}function l(t,r,n,i,a){void 0===a&&(a=s(r,i.parent));var o=r.getTypeChecker(),c=i.parent.parent,l=c.moduleSpecifier,_=new e.Set;i.elements.forEach((function(e){var t=o.getSymbolAtLocation(e.name);t&&_.add(t);}));for(var d=l&&e.isStringLiteral(l)?e.codefix.moduleSpecifierToValidIdentifier(l.text,99):"module",p=i.elements.some((function(r){return !!e.FindAllReferences.Core.eachSymbolReferenceInFile(r.name,o,t,(function(t){var r=o.resolveName(d,t,67108863,!0);return !!r&&(!_.has(r)||e.isExportSpecifier(t.parent))}))}))?e.getUniqueName(d,t):d,f=new e.Set,g=function(r){var i=(r.propertyName||r.name).text;e.FindAllReferences.Core.eachSymbolReferenceInFile(r.name,o,t,(function(a){var o=e.factory.createPropertyAccessExpression(e.factory.createIdentifier(p),i);e.isShorthandPropertyAssignment(a.parent)?n.replaceNode(t,a.parent,e.factory.createPropertyAssignment(a.text,o)):e.isExportSpecifier(a.parent)?f.add(r):n.replaceNode(t,a,o);}));},m=0,y=i.elements;m<y.length;m++)g(y[m]);if(n.replaceNode(t,i,a?e.factory.createIdentifier(p):e.factory.createNamespaceImport(e.factory.createIdentifier(p))),f.size){var v=e.arrayFrom(f.values()).map((function(t){return e.factory.createImportSpecifier(t.isTypeOnly,t.propertyName&&e.factory.createIdentifier(t.propertyName.text),e.factory.createIdentifier(t.name.text))}));n.insertNodeAfter(t,i.parent.parent,u(c,void 0,v));}}function u(t,r,n){return e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,r,n&&n.length?e.factory.createNamedImports(n):void 0),t.moduleSpecifier,void 0)}t.registerRefactor(n,{kinds:e.getOwnValues(a).map((function(e){return e.kind})),getAvailableActions:function(r){var s=o(r,"invoked"===r.triggerReason);if(!s)return e.emptyArray;if(!t.isRefactorErrorInfo(s)){var c=a[s.convertTo];return [{name:n,description:c.description,actions:[c]}]}return r.preferences.provideRefactorNotApplicableReason?e.getOwnValues(a).map((function(e){return {name:n,description:e.description,actions:[i$1(i$1({},e),{notApplicableReason:s.error})]}})):e.emptyArray},getEditsForAction:function(r,n){e.Debug.assert(e.some(e.getOwnValues(a),(function(e){return e.name===n})),"Unexpected action name");var i=o(r);return e.Debug.assert(i&&!t.isRefactorErrorInfo(i),"Expected applicable refactor info"),{edits:e.textChanges.ChangeTracker.with(r,(function(t){return function(t,r,n,i){var a=r.getTypeChecker();0===i.convertTo?function(t,r,n,i,a){var o=!1,s=[],l=new e.Map;e.FindAllReferences.Core.eachSymbolReferenceInFile(i.name,r,t,(function(t){if(e.isPropertyAccessOrQualifiedName(t.parent)){var n=c(t.parent).text;r.resolveName(n,t,67108863,!0)&&l.set(n,!0),e.Debug.assert(function(t){return e.isPropertyAccessExpression(t)?t.expression:t.left}(t.parent)===t,"Parent expression should match id"),s.push(t.parent);}else o=!0;}));for(var _=new e.Map,d=0,p=s;d<p.length;d++){var f=p[d],g=c(f).text,m=_.get(g);void 0===m&&_.set(g,m=l.has(g)?e.getUniqueName(g,t):g),n.replaceNode(t,f,e.factory.createIdentifier(m));}var y=[];_.forEach((function(t,r){y.push(e.factory.createImportSpecifier(!1,t===r?void 0:e.factory.createIdentifier(r),e.factory.createIdentifier(t)));}));var v=i.parent.parent;o&&!a?n.insertNodeAfter(t,v,u(v,void 0,y)):n.replaceNode(t,v,u(v,o?e.factory.createIdentifier(i.name.text):void 0,y));}(t,a,n,i.import,e.getAllowSyntheticDefaultImports(r.getCompilerOptions())):l(t,r,n,i.import,1===i.convertTo);}(r.file,r.program,t,i)})),renameFilename:void 0,renameLocation:void 0}}}),t.doChangeNamedToNamespaceOrDefault=l;}(e.refactor||(e.refactor={}));}(t),function(e){var t;(function(r){var n="Convert to optional chain expression",a=e.getLocaleSpecificMessage(e.Diagnostics.Convert_to_optional_chain_expression),o={name:n,description:a,kind:"refactor.rewrite.expression.optionalChain"};function s(t){return e.isBinaryExpression(t)||e.isConditionalExpression(t)}function c(t){return s(t)||function(t){return e.isExpressionStatement(t)||e.isReturnStatement(t)||e.isVariableStatement(t)}(t)}function l(t,r){void 0===r&&(r=!0);var n=t.file,i=t.program,a=e.getRefactorContextSpan(t),o=0===a.length;if(!o||r){var l=e.getTokenAtPosition(n,a.start),d=e.findTokenOnLeftOfPosition(n,a.start+a.length),f=e.createTextSpanFromBounds(l.pos,d&&d.end>=l.pos?d.getEnd():l.getEnd()),g=o?function(e){for(;e.parent;){if(c(e)&&!c(e.parent))return e;e=e.parent;}}(l):function(e,t){for(;e.parent;){if(c(e)&&0!==t.length&&e.end>=t.start+t.length)return e;e=e.parent;}}(l,f),m=g&&c(g)?function(t){if(s(t))return t;if(e.isVariableStatement(t)){var r=e.getSingleVariableOfVariableStatement(t),n=null==r?void 0:r.initializer;return n&&s(n)?n:void 0}return t.expression&&s(t.expression)?t.expression:void 0}(g):void 0;if(!m)return {error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_convertible_access_expression)};var y=i.getTypeChecker();return e.isConditionalExpression(m)?function(t,r){var n=t.condition,i=p(t.whenTrue);if(!i||r.isNullableType(r.getTypeAtLocation(i)))return {error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_convertible_access_expression)};if((e.isPropertyAccessExpression(n)||e.isIdentifier(n))&&_(n,i.expression))return {finalExpression:i,occurrences:[n],expression:t};if(e.isBinaryExpression(n)){var a=u(i.expression,n);return a?{finalExpression:i,occurrences:a,expression:t}:{error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_matching_access_expressions)}}}(m,y):function(t){if(55!==t.operatorToken.kind)return {error:e.getLocaleSpecificMessage(e.Diagnostics.Can_only_convert_logical_AND_access_chains)};var r=p(t.right);if(!r)return {error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_convertible_access_expression)};var n=u(r.expression,t.left);return n?{finalExpression:r,occurrences:n,expression:t}:{error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_matching_access_expressions)}}(m)}}function u(t,r){for(var n=[];e.isBinaryExpression(r)&&55===r.operatorToken.kind;){var i=_(e.skipParentheses(t),e.skipParentheses(r.right));if(!i)break;n.push(i),t=i,r=r.left;}var a=_(t,r);return a&&n.push(a),n.length>0?n:void 0}function _(t,r){if(e.isIdentifier(r)||e.isPropertyAccessExpression(r)||e.isElementAccessExpression(r))return function(t,r){for(;(e.isCallExpression(t)||e.isPropertyAccessExpression(t)||e.isElementAccessExpression(t))&&d(t)!==d(r);)t=t.expression;for(;e.isPropertyAccessExpression(t)&&e.isPropertyAccessExpression(r)||e.isElementAccessExpression(t)&&e.isElementAccessExpression(r);){if(d(t)!==d(r))return !1;t=t.expression,r=r.expression;}return e.isIdentifier(t)&&e.isIdentifier(r)&&t.getText()===r.getText()}(t,r)?r:void 0}function d(t){return e.isIdentifier(t)||e.isStringOrNumericLiteralLike(t)?t.getText():e.isPropertyAccessExpression(t)?d(t.name):e.isElementAccessExpression(t)?d(t.argumentExpression):void 0}function p(t){return t=e.skipParentheses(t),e.isBinaryExpression(t)?p(t.left):(e.isPropertyAccessExpression(t)||e.isElementAccessExpression(t)||e.isCallExpression(t))&&!e.isOptionalChain(t)?t:void 0}function f(t,r,n){if(e.isPropertyAccessExpression(r)||e.isElementAccessExpression(r)||e.isCallExpression(r)){var i=f(t,r.expression,n),a=n.length>0?n[n.length-1]:void 0,o=(null==a?void 0:a.getText())===r.expression.getText();if(o&&n.pop(),e.isCallExpression(r))return o?e.factory.createCallChain(i,e.factory.createToken(28),r.typeArguments,r.arguments):e.factory.createCallChain(i,r.questionDotToken,r.typeArguments,r.arguments);if(e.isPropertyAccessExpression(r))return o?e.factory.createPropertyAccessChain(i,e.factory.createToken(28),r.name):e.factory.createPropertyAccessChain(i,r.questionDotToken,r.name);if(e.isElementAccessExpression(r))return o?e.factory.createElementAccessChain(i,e.factory.createToken(28),r.argumentExpression):e.factory.createElementAccessChain(i,r.questionDotToken,r.argumentExpression)}return r}t.registerRefactor(n,{kinds:[o.kind],getEditsForAction:function(r,n){var i=l(r);return e.Debug.assert(i&&!t.isRefactorErrorInfo(i),"Expected applicable refactor info"),{edits:e.textChanges.ChangeTracker.with(r,(function(t){return function(t,r,n,i,a){var o=i.finalExpression,s=i.occurrences,c=i.expression,l=s[s.length-1],u=f(r,o,s);u&&(e.isPropertyAccessExpression(u)||e.isElementAccessExpression(u)||e.isCallExpression(u))&&(e.isBinaryExpression(c)?n.replaceNodeRange(t,l,o,u):e.isConditionalExpression(c)&&n.replaceNode(t,c,e.factory.createBinaryExpression(u,e.factory.createToken(60),c.whenFalse)));}(r.file,r.program.getTypeChecker(),t,i)})),renameFilename:void 0,renameLocation:void 0}},getAvailableActions:function(r){var s=l(r,"invoked"===r.triggerReason);return s?t.isRefactorErrorInfo(s)?r.preferences.provideRefactorNotApplicableReason?[{name:n,description:a,actions:[i$1(i$1({},o),{notApplicableReason:s.error})]}]:e.emptyArray:[{name:n,description:a,actions:[o]}]:e.emptyArray}});})((t=e.refactor||(e.refactor={})).convertToOptionalChainExpression||(t.convertToOptionalChainExpression={}));}(t),function(e){var t;(function(r){var n="Convert overload list to single signature",i=e.Diagnostics.Convert_overload_list_to_single_signature.message,a={name:n,description:i,kind:"refactor.rewrite.function.overloadList"};function o(e){switch(e.kind){case 168:case 169:case 174:case 171:case 175:case 256:return !0}return !1}function s(t,r,n){var i=e.getTokenAtPosition(t,r),a=e.findAncestor(i,o);if(a){var s=n.getTypeChecker(),c=a.symbol;if(c){var l=c.declarations;if(!(e.length(l)<=1)&&e.every(l,(function(r){return e.getSourceFileOfNode(r)===t}))&&o(l[0])){var u=l[0].kind;if(e.every(l,(function(e){return e.kind===u}))){var _=l;if(!e.some(_,(function(t){return !!t.typeParameters||e.some(t.parameters,(function(t){return !!t.decorators||!!t.modifiers||!e.isIdentifier(t.name)}))}))){var d=e.mapDefined(_,(function(e){return s.getSignatureFromDeclaration(e)}));if(e.length(d)===e.length(l)){var p=s.getReturnTypeOfSignature(d[0]);if(e.every(d,(function(e){return s.getReturnTypeOfSignature(e)===p})))return _}}}}}}}t.registerRefactor(n,{kinds:[a.kind],getEditsForAction:function(t){var r=t.file,n=t.startPosition,i=t.program,a=s(r,n,i);if(a){var o=i.getTypeChecker(),c=a[a.length-1],l=c;switch(c.kind){case 168:l=e.factory.updateMethodSignature(c,c.modifiers,c.name,c.questionToken,c.typeParameters,u(a),c.type);break;case 169:l=e.factory.updateMethodDeclaration(c,c.decorators,c.modifiers,c.asteriskToken,c.name,c.questionToken,c.typeParameters,u(a),c.type,c.body);break;case 174:l=e.factory.updateCallSignature(c,c.typeParameters,u(a),c.type);break;case 171:l=e.factory.updateConstructorDeclaration(c,c.decorators,c.modifiers,u(a),c.body);break;case 175:l=e.factory.updateConstructSignature(c,c.typeParameters,u(a),c.type);break;case 256:l=e.factory.updateFunctionDeclaration(c,c.decorators,c.modifiers,c.asteriskToken,c.name,c.typeParameters,u(a),c.type,c.body);break;default:return e.Debug.failBadSyntaxKind(c,"Unhandled signature kind in overload list conversion refactoring")}if(l!==c)return {renameFilename:void 0,renameLocation:void 0,edits:e.textChanges.ChangeTracker.with(t,(function(e){e.replaceNodeRange(r,a[0],a[a.length-1],l);}))}}function u(t){var r=t[t.length-1];return e.isFunctionLikeDeclaration(r)&&r.body&&(t=t.slice(0,t.length-1)),e.factory.createNodeArray([e.factory.createParameterDeclaration(void 0,void 0,e.factory.createToken(25),"args",void 0,e.factory.createUnionTypeNode(e.map(t,_)))])}function _(t){var r=e.map(t.parameters,d);return e.setEmitFlags(e.factory.createTupleTypeNode(r),e.some(r,(function(t){return !!e.length(e.getSyntheticLeadingComments(t))}))?0:1)}function d(t){e.Debug.assert(e.isIdentifier(t.name));var r=e.setTextRange(e.factory.createNamedTupleMember(t.dotDotDotToken,t.name,t.questionToken,t.type||e.factory.createKeywordTypeNode(130)),t),n=t.symbol&&t.symbol.getDocumentationComment(o);if(n){var i=e.displayPartsToString(n);i.length&&e.setSyntheticLeadingComments(r,[{text:"*\n".concat(i.split("\n").map((function(e){return " * ".concat(e)})).join("\n"),"\n "),kind:3,pos:-1,end:-1,hasTrailingNewLine:!0,hasLeadingNewline:!0}]);}return r}},getAvailableActions:function(t){return s(t.file,t.startPosition,t.program)?[{name:n,description:i,actions:[a]}]:e.emptyArray}});})((t=e.refactor||(e.refactor={})).addOrRemoveBracesToArrowFunction||(t.addOrRemoveBracesToArrowFunction={}));}(t),function(e){var t;(function(r){var n,a,o,s,c="Extract Symbol",l={name:"Extract Constant",description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_constant),kind:"refactor.extract.constant"},u={name:"Extract Function",description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_function),kind:"refactor.extract.function"};function _(r){var n=r.kind,a=p(r.file,e.getRefactorContextSpan(r),"invoked"===r.triggerReason),o=a.targetRange;if(void 0===o){if(!a.errors||0===a.errors.length||!r.preferences.provideRefactorNotApplicableReason)return e.emptyArray;var s=[];return t.refactorKindBeginsWith(u.kind,n)&&s.push({name:c,description:u.description,actions:[i$1(i$1({},u),{notApplicableReason:F(a.errors)})]}),t.refactorKindBeginsWith(l.kind,n)&&s.push({name:c,description:l.description,actions:[i$1(i$1({},l),{notApplicableReason:F(a.errors)})]}),s}var _=function(t,r){var n=m(t,r),i=n.scopes,a=n.readsAndWrites,o=a.functionErrorsPerScope,s=a.constantErrorsPerScope;return i.map((function(t,r){var n,i,a=function(t){return e.isFunctionLikeDeclaration(t)?"inner function":e.isClassLike(t)?"method":"function"}(t),c=function(t){return e.isClassLike(t)?"readonly field":"constant"}(t),l=e.isFunctionLikeDeclaration(t)?function(t){switch(t.kind){case 171:return "constructor";case 213:case 256:return t.name?"function '".concat(t.name.text,"'"):e.ANONYMOUS;case 214:return "arrow function";case 169:return "method '".concat(t.name.getText(),"'");case 172:return "'get ".concat(t.name.getText(),"'");case 173:return "'set ".concat(t.name.getText(),"'");default:throw e.Debug.assertNever(t,"Unexpected scope kind ".concat(t.kind))}}(t):e.isClassLike(t)?function(e){return 257===e.kind?e.name?"class '".concat(e.name.text,"'"):"anonymous class declaration":e.name?"class expression '".concat(e.name.text,"'"):"anonymous class expression"}(t):function(e){return 262===e.kind?"namespace '".concat(e.parent.name.getText(),"'"):e.externalModuleIndicator?0:1}(t);return 1===l?(n=e.formatStringFromArgs(e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_0_in_1_scope),[a,"global"]),i=e.formatStringFromArgs(e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_0_in_1_scope),[c,"global"])):0===l?(n=e.formatStringFromArgs(e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_0_in_1_scope),[a,"module"]),i=e.formatStringFromArgs(e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_0_in_1_scope),[c,"module"])):(n=e.formatStringFromArgs(e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_0_in_1),[a,l]),i=e.formatStringFromArgs(e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_0_in_1),[c,l])),0!==r||e.isClassLike(t)||(i=e.formatStringFromArgs(e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_0_in_enclosing_scope),[c])),{functionExtraction:{description:n,errors:o[r]},constantExtraction:{description:i,errors:s[r]}}}))}(o,r);if(void 0===_)return e.emptyArray;for(var d,f,g=[],y=new e.Map,v=[],h=new e.Map,b=0,x=0,D=_;x<D.length;x++){var S=D[x],T=S.functionExtraction,C=S.constantExtraction,k=T.description;if(t.refactorKindBeginsWith(u.kind,n)&&(0===T.errors.length?y.has(k)||(y.set(k,!0),g.push({description:k,name:"function_scope_".concat(b),kind:u.kind})):d||(d={description:k,name:"function_scope_".concat(b),notApplicableReason:F(T.errors),kind:u.kind})),t.refactorKindBeginsWith(l.kind,n))if(0===C.errors.length){var E=C.description;h.has(E)||(h.set(E,!0),v.push({description:E,name:"constant_scope_".concat(b),kind:l.kind}));}else f||(f={description:k,name:"constant_scope_".concat(b),notApplicableReason:F(C.errors),kind:l.kind});b++;}var N=[];return g.length?N.push({name:c,description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_function),actions:g}):r.preferences.provideRefactorNotApplicableReason&&d&&N.push({name:c,description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_function),actions:[d]}),v.length?N.push({name:c,description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_constant),actions:v}):r.preferences.provideRefactorNotApplicableReason&&f&&N.push({name:c,description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_constant),actions:[f]}),N.length?N:e.emptyArray;function F(e){var t=e[0].messageText;return "string"!=typeof t&&(t=t.messageText),t}}function d(t,r){var n=p(t.file,e.getRefactorContextSpan(t)).targetRange,i=/^function_scope_(\d+)$/.exec(r);if(i){var o=+i[1];return e.Debug.assert(isFinite(o),"Expected to parse a finite number from the function scope index"),function(t,r,n){var i=m(t,r),o=i.scopes,s=i.readsAndWrites,c=s.target,l=s.usagesPerScope,u=s.functionErrorsPerScope,_=s.exposedVariableDeclarations;return e.Debug.assert(!u[n].length,"The extraction went missing? How?"),r.cancellationToken.throwIfCancellationRequested(),function(t,r,n,i,o,s){var c,l,u=n.usages,_=n.typeParameterUsages,d=n.substitutions,p=s.program.getTypeChecker(),f=e.getEmitScriptTarget(s.program.getCompilerOptions()),g=e.codefix.createImportAdder(s.file,s.program,s.preferences,s.host),m=r.getSourceFile(),x=e.getUniqueName(e.isClassLike(r)?"newMethod":"newFunction",m),D=e.isInJSFile(r),T=e.factory.createIdentifier(x),C=[],k=[];u.forEach((function(t,n){var i;if(!D){var a=p.getTypeOfSymbolAtLocation(t.symbol,t.node);a=p.getBaseTypeOfLiteralType(a),i=e.codefix.typeToAutoImportableTypeNode(p,g,a,r,f,1);}var o=e.factory.createParameterDeclaration(void 0,void 0,void 0,n,void 0,i);C.push(o),2===t.usage&&(l||(l=[])).push(t),k.push(e.factory.createIdentifier(n));}));var E=e.arrayFrom(_.values()).map((function(e){return {type:e,declaration:y(e)}})).sort(v),N=0===E.length?void 0:E.map((function(e){return e.declaration})),F=void 0!==N?N.map((function(t){return e.factory.createTypeReferenceNode(t.name,void 0)})):void 0;if(e.isExpression(t)&&!D){var A=p.getContextualType(t);c=p.typeToTypeNode(A,r,1);}var P,w=function(t,r,n,i,a){var o,s=void 0!==n||r.length>0;if(e.isBlock(t)&&!s&&0===i.size)return {body:e.factory.createBlock(t.statements,!0),returnValueProperty:void 0};var c=!1,l=e.factory.createNodeArray(e.isBlock(t)?t.statements.slice(0):[e.isStatement(t)?t:e.factory.createReturnStatement(e.skipParentheses(t))]);if(s||i.size){var u=e.visitNodes(l,(function t(a){if(!c&&e.isReturnStatement(a)&&s){var l=h(r,n);return a.expression&&(o||(o="__return"),l.unshift(e.factory.createPropertyAssignment(o,e.visitNode(a.expression,t)))),1===l.length?e.factory.createReturnStatement(l[0].name):e.factory.createReturnStatement(e.factory.createObjectLiteralExpression(l))}var u=c;c=c||e.isFunctionLikeDeclaration(a)||e.isClassLike(a);var _=i.get(e.getNodeId(a).toString()),d=_?e.getSynthesizedDeepClone(_):e.visitEachChild(a,t,e.nullTransformationContext);return c=u,d})).slice();if(s&&!a&&e.isStatement(t)){var _=h(r,n);1===_.length?u.push(e.factory.createReturnStatement(_[0].name)):u.push(e.factory.createReturnStatement(e.factory.createObjectLiteralExpression(_)));}return {body:e.factory.createBlock(u,!0),returnValueProperty:o}}return {body:e.factory.createBlock(l,!0),returnValueProperty:void 0}}(t,i,l,d,!!(o.facts&a.HasReturn)),I=w.body,O=w.returnValueProperty;e.suppressLeadingAndTrailingTrivia(I);var M=!!(o.facts&a.UsesThisInFunction);if(e.isClassLike(r)){var L=D?[]:[e.factory.createModifier(121)];o.facts&a.InStaticRegion&&L.push(e.factory.createModifier(124)),o.facts&a.IsAsyncFunction&&L.push(e.factory.createModifier(131)),P=e.factory.createMethodDeclaration(void 0,L.length?L:void 0,o.facts&a.IsGenerator?e.factory.createToken(41):void 0,T,void 0,N,C,c,I);}else M&&C.unshift(e.factory.createParameterDeclaration(void 0,void 0,void 0,"this",void 0,p.typeToTypeNode(p.getTypeAtLocation(o.thisNode),r,1),void 0)),P=e.factory.createFunctionDeclaration(void 0,o.facts&a.IsAsyncFunction?[e.factory.createToken(131)]:void 0,o.facts&a.IsGenerator?e.factory.createToken(41):void 0,T,N,C,c,I);var R=e.textChanges.ChangeTracker.fromContext(s),B=function(t,r){return e.find(function(t){if(e.isFunctionLikeDeclaration(t)){var r=t.body;if(e.isBlock(r))return r.statements}else {if(e.isModuleBlock(t)||e.isSourceFile(t))return t.statements;if(e.isClassLike(t))return t.members;e.assertType(t);}return e.emptyArray}(r),(function(r){return r.pos>=t&&e.isFunctionLikeDeclaration(r)&&!e.isConstructorDeclaration(r)}))}((b(o.range)?e.last(o.range):o.range).end,r);B?R.insertNodeBefore(s.file,B,P,!0):R.insertNodeAtEndOfScope(s.file,r,P),g.writeFixes(R);var j=[],J=function(t,r,n){var i=e.factory.createIdentifier(n);if(e.isClassLike(t)){var o=r.facts&a.InStaticRegion?e.factory.createIdentifier(t.name.text):e.factory.createThis();return e.factory.createPropertyAccessExpression(o,i)}return i}(r,o,x);M&&k.unshift(e.factory.createIdentifier("this"));var z=e.factory.createCallExpression(M?e.factory.createPropertyAccessExpression(J,"call"):J,F,k);if(o.facts&a.IsGenerator&&(z=e.factory.createYieldExpression(e.factory.createToken(41),z)),o.facts&a.IsAsyncFunction&&(z=e.factory.createAwaitExpression(z)),S(t)&&(z=e.factory.createJsxExpression(void 0,z)),i.length&&!l)if(e.Debug.assert(!O,"Expected no returnValueProperty"),e.Debug.assert(!(o.facts&a.HasReturn),"Expected RangeFacts.HasReturn flag to be unset"),1===i.length){var K=i[0];j.push(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(e.getSynthesizedDeepClone(K.name),void 0,e.getSynthesizedDeepClone(K.type),z)],K.parent.flags)));}else {for(var U=[],V=[],q=i[0].parent.flags,W=!1,H=0,G=i;H<G.length;H++){K=G[H],U.push(e.factory.createBindingElement(void 0,void 0,e.getSynthesizedDeepClone(K.name)));var Q=p.typeToTypeNode(p.getBaseTypeOfLiteralType(p.getTypeAtLocation(K)),r,1);V.push(e.factory.createPropertySignature(void 0,K.symbol.name,void 0,Q)),W=W||void 0!==K.type,q&=K.parent.flags;}var X=W?e.factory.createTypeLiteralNode(V):void 0;X&&e.setEmitFlags(X,1),j.push(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(e.factory.createObjectBindingPattern(U),void 0,X,z)],q)));}else if(i.length||l){if(i.length)for(var Y=0,Z=i;Y<Z.length;Y++){var $=(K=Z[Y]).parent.flags;2&$&&($=-3&$|1),j.push(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(K.symbol.name,void 0,ne(K.type))],$)));}O&&j.push(e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(O,void 0,ne(c))],1)));var ee=h(i,l);O&&ee.unshift(e.factory.createShorthandPropertyAssignment(O)),1===ee.length?(e.Debug.assert(!O,"Shouldn't have returnValueProperty here"),j.push(e.factory.createExpressionStatement(e.factory.createAssignment(ee[0].name,z))),o.facts&a.HasReturn&&j.push(e.factory.createReturnStatement())):(j.push(e.factory.createExpressionStatement(e.factory.createAssignment(e.factory.createObjectLiteralExpression(ee),z))),O&&j.push(e.factory.createReturnStatement(e.factory.createIdentifier(O))));}else o.facts&a.HasReturn?j.push(e.factory.createReturnStatement(z)):b(o.range)?j.push(e.factory.createExpressionStatement(z)):j.push(z);b(o.range)?R.replaceNodeRangeWithNodes(s.file,e.first(o.range),e.last(o.range),j):R.replaceNodeWithNodes(s.file,o.range,j);var te=R.getChanges(),re=(b(o.range)?e.first(o.range):o.range).getSourceFile().fileName;return {renameFilename:re,renameLocation:e.getRenameLocation(te,re,x,!1),edits:te};function ne(t){if(void 0!==t){for(var r=e.getSynthesizedDeepClone(t),n=r;e.isParenthesizedTypeNode(n);)n=n.type;return e.isUnionTypeNode(n)&&e.find(n.types,(function(e){return 153===e.kind}))?r:e.factory.createUnionTypeNode([r,e.factory.createKeywordTypeNode(153)])}}}(c,o[n],l[n],_,t,r)}(n,t,o)}var s=/^constant_scope_(\d+)$/.exec(r);if(s)return o=+s[1],e.Debug.assert(isFinite(o),"Expected to parse a finite number from the constant scope index"),function(t,r,n){var i=m(t,r),o=i.scopes,s=i.readsAndWrites,c=s.target,l=s.usagesPerScope,u=s.constantErrorsPerScope,_=s.exposedVariableDeclarations;return e.Debug.assert(!u[n].length,"The extraction went missing? How?"),e.Debug.assert(0===_.length,"Extract constant accepted a range containing a variable declaration?"),r.cancellationToken.throwIfCancellationRequested(),function(t,r,n,i,o){var s,c=n.substitutions,l=o.program.getTypeChecker(),u=r.getSourceFile(),_=!e.isPropertyAccessExpression(t)||e.isClassLike(r)||l.resolveName(t.name.text,t,111551,!1)||e.isPrivateIdentifier(t.name)||e.isKeyword(t.name.originalKeywordKind)?e.getUniqueName(e.isClassLike(r)?"newProperty":"newLocal",u):t.name.text,d=e.isInJSFile(r),p=d||!l.isContextSensitive(t)?void 0:l.typeToTypeNode(l.getContextualType(t),r,1),f=function(t,r){return r.size?function t(n){var i=r.get(e.getNodeId(n).toString());return i?e.getSynthesizedDeepClone(i):e.visitEachChild(n,t,e.nullTransformationContext)}(t):t}(e.skipParentheses(t),c);s=function(n,i){if(void 0===n)return {variableType:n,initializer:i};if(!e.isFunctionExpression(i)&&!e.isArrowFunction(i)||i.typeParameters)return {variableType:n,initializer:i};var a=l.getTypeAtLocation(t),o=e.singleOrUndefined(l.getSignaturesOfType(a,0));if(!o)return {variableType:n,initializer:i};if(o.getTypeParameters())return {variableType:n,initializer:i};for(var s=[],c=!1,u=0,_=i.parameters;u<_.length;u++){var d=_[u];if(d.type)s.push(d);else {var p=l.getTypeAtLocation(d);p===l.getAnyType()&&(c=!0),s.push(e.factory.updateParameterDeclaration(d,d.decorators,d.modifiers,d.dotDotDotToken,d.name,d.questionToken,d.type||l.typeToTypeNode(p,r,1),d.initializer));}}if(c)return {variableType:n,initializer:i};if(n=void 0,e.isArrowFunction(i))i=e.factory.updateArrowFunction(i,t.modifiers,i.typeParameters,s,i.type||l.typeToTypeNode(o.getReturnType(),r,1),i.equalsGreaterThanToken,i.body);else {if(o&&o.thisParameter){var f=e.firstOrUndefined(s);if(!f||e.isIdentifier(f.name)&&"this"!==f.name.escapedText){var g=l.getTypeOfSymbolAtLocation(o.thisParameter,t);s.splice(0,0,e.factory.createParameterDeclaration(void 0,void 0,void 0,"this",void 0,l.typeToTypeNode(g,r,1)));}}i=e.factory.updateFunctionExpression(i,t.modifiers,i.asteriskToken,i.name,i.typeParameters,s,i.type||l.typeToTypeNode(o.getReturnType(),r,1),i.body);}return {variableType:n,initializer:i}}(p,f),p=s.variableType,f=s.initializer,e.suppressLeadingAndTrailingTrivia(f);var m=e.textChanges.ChangeTracker.fromContext(o);if(e.isClassLike(r)){e.Debug.assert(!d,"Cannot extract to a JS class");var y=[];y.push(e.factory.createModifier(121)),i&a.InStaticRegion&&y.push(e.factory.createModifier(124)),y.push(e.factory.createModifier(145));var v=e.factory.createPropertyDeclaration(void 0,y,_,void 0,p,f),h=e.factory.createPropertyAccessExpression(i&a.InStaticRegion?e.factory.createIdentifier(r.name.getText()):e.factory.createThis(),e.factory.createIdentifier(_));S(t)&&(h=e.factory.createJsxExpression(void 0,h));var b=function(t,r){var n,i=r.members;e.Debug.assert(i.length>0,"Found no members");for(var a=!0,o=0,s=i;o<s.length;o++){var c=s[o];if(c.pos>t)return n||i[0];if(a&&!e.isPropertyDeclaration(c)){if(void 0!==n)return c;a=!1;}n=c;}return void 0===n?e.Debug.fail():n}(t.pos,r);m.insertNodeBefore(o.file,b,v,!0),m.replaceNode(o.file,t,h);}else {var x=e.factory.createVariableDeclaration(_,void 0,p,f),T=function(t,r){for(var n;void 0!==t&&t!==r;){if(e.isVariableDeclaration(t)&&t.initializer===n&&e.isVariableDeclarationList(t.parent)&&t.parent.declarations.length>1)return t;n=t,t=t.parent;}}(t,r);if(T)m.insertNodeBefore(o.file,T,x),h=e.factory.createIdentifier(_),m.replaceNode(o.file,t,h);else if(238===t.parent.kind&&r===e.findAncestor(t,g)){var C=e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([x],2));m.replaceNode(o.file,t.parent,C);}else C=e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([x],2)),0===(b=function(t,r){var n;e.Debug.assert(!e.isClassLike(r));for(var i=t;i!==r;i=i.parent)g(i)&&(n=i);for(i=(n||t).parent;;i=i.parent){if(D(i)){for(var a=void 0,o=0,s=i.statements;o<s.length;o++){var c=s[o];if(c.pos>t.pos)break;a=c;}return !a&&e.isCaseClause(i)?(e.Debug.assert(e.isSwitchStatement(i.parent.parent),"Grandparent isn't a switch statement"),i.parent.parent):e.Debug.checkDefined(a,"prevStatement failed to get set")}e.Debug.assert(i!==r,"Didn't encounter a block-like before encountering scope");}}(t,r)).pos?m.insertNodeAtTopOfFile(o.file,C,!1):m.insertNodeBefore(o.file,b,C,!1),238===t.parent.kind?m.delete(o.file,t.parent):(h=e.factory.createIdentifier(_),S(t)&&(h=e.factory.createJsxExpression(void 0,h)),m.replaceNode(o.file,t,h));}var k=m.getChanges(),E=t.getSourceFile().fileName;return {renameFilename:E,renameLocation:e.getRenameLocation(k,E,_,!0),edits:k}}(e.isExpression(c)?c:c.statements[0].expression,o[n],l[n],t.facts,r)}(n,t,o);e.Debug.fail("Unrecognized action name");}function p(t,r,i){void 0===i&&(i=!0);var o=r.length;if(0===o&&!i)return {errors:[e.createFileDiagnostic(t,r.start,o,n.cannotExtractEmpty)]};var s,c=0===o&&i,l=e.findFirstNonJsxWhitespaceToken(t,r.start),u=e.findTokenOnLeftOfPosition(t,e.textSpanEnd(r)),_=l&&u&&i?function(e,t,r){var n=e.getStart(r),i=t.getEnd();return 59===r.text.charCodeAt(i)&&i++,{start:n,length:i-n}}(l,u,t):r,d=c?function(t){return e.findAncestor(t,(function(t){return t.parent&&x(t)&&!e.isBinaryExpression(t.parent)}))}(l):e.getParentNodeInSpan(l,t,_),p=c?d:e.getParentNodeInSpan(u,t,_),g=[],m=a.None;if(!d||!p)return {errors:[e.createFileDiagnostic(t,r.start,o,n.cannotExtractRange)]};if(8388608&d.flags)return {errors:[e.createFileDiagnostic(t,r.start,o,n.cannotExtractJSDoc)]};if(d.parent!==p.parent)return {errors:[e.createFileDiagnostic(t,r.start,o,n.cannotExtractRange)]};if(d!==p){if(!D(d.parent))return {errors:[e.createFileDiagnostic(t,r.start,o,n.cannotExtractRange)]};for(var y=[],v=0,h=d.parent.statements;v<h.length;v++){var b=h[v];if(b===d||y.length){var S=E(b);if(S)return {errors:S};y.push(b);}if(b===p)break}return y.length?{targetRange:{range:y,facts:m,declarations:g,thisNode:s}}:{errors:[e.createFileDiagnostic(t,r.start,o,n.cannotExtractRange)]}}if(e.isReturnStatement(d)&&!d.expression)return {errors:[e.createFileDiagnostic(t,r.start,o,n.cannotExtractRange)]};var C=function(t){if(e.isReturnStatement(t)){if(t.expression)return t.expression}else if(e.isVariableStatement(t)||e.isVariableDeclarationList(t)){for(var r=0,n=void 0,i=0,a=e.isVariableStatement(t)?t.declarationList.declarations:t.declarations;i<a.length;i++){var o=a[i];o.initializer&&(r++,n=o.initializer);}if(1===r)return n}else if(e.isVariableDeclaration(t)&&t.initializer)return t.initializer;return t}(d),k=function(t){if(e.isIdentifier(e.isExpressionStatement(t)?t.expression:t))return [e.createDiagnosticForNode(t,n.cannotExtractIdentifier)]}(C)||E(C);return k?{errors:k}:{targetRange:{range:f(C),facts:m,declarations:g,thisNode:s}};function E(t){var i;if(function(e){e[e.None=0]="None",e[e.Break=1]="Break",e[e.Continue=2]="Continue",e[e.Return=4]="Return";}(i||(i={})),e.Debug.assert(t.pos<=t.end,"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)"),e.Debug.assert(!e.positionIsSynthesized(t.pos),"This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)"),!(e.isStatement(t)||e.isExpressionNode(t)&&x(t)||T(t)))return [e.createDiagnosticForNode(t,n.statementOrExpressionExpected)];if(16777216&t.flags)return [e.createDiagnosticForNode(t,n.cannotExtractAmbientBlock)];var o,c=e.getContainingClass(t);c&&function(t,r){for(var n=t;n!==r;){if(167===n.kind){e.isStatic(n)&&(m|=a.InStaticRegion);break}if(164===n.kind){171===e.getContainingFunction(n).kind&&(m|=a.InStaticRegion);break}169===n.kind&&e.isStatic(n)&&(m|=a.InStaticRegion),n=n.parent;}}(t,c);var l,u=4;if(function t(i){if(o)return !0;if(e.isDeclaration(i)){var c=254===i.kind?i.parent.parent:i;if(e.hasSyntacticModifier(c,1))return (o||(o=[])).push(e.createDiagnosticForNode(i,n.cannotExtractExportedEntity)),!0;g.push(i.symbol);}switch(i.kind){case 266:return (o||(o=[])).push(e.createDiagnosticForNode(i,n.cannotExtractImport)),!0;case 271:return (o||(o=[])).push(e.createDiagnosticForNode(i,n.cannotExtractExportedEntity)),!0;case 106:if(208===i.parent.kind){var _=e.getContainingClass(i);if(void 0===_||_.pos<r.start||_.end>=r.start+r.length)return (o||(o=[])).push(e.createDiagnosticForNode(i,n.cannotExtractSuper)),!0}else m|=a.UsesThis,s=i;break;case 214:e.forEachChild(i,(function t(r){if(e.isThis(r))m|=a.UsesThis,s=i;else {if(e.isClassLike(r)||e.isFunctionLike(r)&&!e.isArrowFunction(r))return !1;e.forEachChild(r,t);}}));case 257:case 256:e.isSourceFile(i.parent)&&void 0===i.parent.externalModuleIndicator&&(o||(o=[])).push(e.createDiagnosticForNode(i,n.functionWillNotBeVisibleInTheNewScope));case 226:case 213:case 169:case 171:case 172:case 173:return !1}var d=u;switch(i.kind){case 239:case 252:u=0;break;case 235:i.parent&&252===i.parent.kind&&i.parent.finallyBlock===i&&(u=4);break;case 290:case 289:u|=1;break;default:e.isIterationStatement(i,!1)&&(u|=3);}switch(i.kind){case 192:case 108:m|=a.UsesThis,s=i;break;case 250:var p=i.label;(l||(l=[])).push(p.escapedText),e.forEachChild(i,t),l.pop();break;case 246:case 245:(p=i.label)?e.contains(l,p.escapedText)||(o||(o=[])).push(e.createDiagnosticForNode(i,n.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)):u&(246===i.kind?1:2)||(o||(o=[])).push(e.createDiagnosticForNode(i,n.cannotExtractRangeContainingConditionalBreakOrContinueStatements));break;case 218:m|=a.IsAsyncFunction;break;case 224:m|=a.IsGenerator;break;case 247:4&u?m|=a.HasReturn:(o||(o=[])).push(e.createDiagnosticForNode(i,n.cannotExtractRangeContainingConditionalReturnStatement));break;default:e.forEachChild(i,t);}u=d;}(t),m&a.UsesThis){var _=e.getThisContainer(t,!1);(256===_.kind||169===_.kind&&205===_.parent.kind||213===_.kind)&&(m|=a.UsesThisInFunction);}return o}}function f(t){return e.isStatement(t)?[t]:e.isExpressionNode(t)?e.isExpressionStatement(t.parent)?[t.parent]:t:T(t)?t:void 0}function g(t){return e.isArrowFunction(t)?e.isFunctionBody(t.body):e.isFunctionLikeDeclaration(t)||e.isSourceFile(t)||e.isModuleBlock(t)||e.isClassLike(t)}function m(t,r){var i=r.file,o=function(t){var r=b(t.range)?e.first(t.range):t.range;if(t.facts&a.UsesThis&&!(t.facts&a.UsesThisInFunction)){var n=e.getContainingClass(r);if(n){var i=e.findAncestor(r,e.isFunctionLikeDeclaration);return i?[i,n]:[n]}}for(var o=[];;)if(164===(r=r.parent).kind&&(r=e.findAncestor(r,(function(t){return e.isFunctionLikeDeclaration(t)})).parent),g(r)&&(o.push(r),305===r.kind))return o}(t);return {scopes:o,readsAndWrites:function(t,r,i,o,s,c){var l,u,_=new e.Map,d=[],p=[],f=[],g=[],m=[],y=new e.Map,v=[],h=b(t.range)?1===t.range.length&&e.isExpressionStatement(t.range[0])?t.range[0].expression:void 0:t.range;if(void 0===h){var x=t.range,D=e.first(x).getStart(),S=e.last(x).end;u=e.createFileDiagnostic(o,D,S-D,n.expressionExpected);}else 147456&s.getTypeAtLocation(h).flags&&(u=e.createDiagnosticForNode(h,n.uselessConstantType));for(var T=0,C=r;T<C.length;T++){var k=C[T];d.push({usages:new e.Map,typeParameterUsages:new e.Map,substitutions:new e.Map}),p.push(new e.Map),f.push([]);var E=[];u&&E.push(u),e.isClassLike(k)&&e.isInJSFile(k)&&E.push(e.createDiagnosticForNode(k,n.cannotExtractToJSClass)),e.isArrowFunction(k)&&!e.isBlock(k.body)&&E.push(e.createDiagnosticForNode(k,n.cannotExtractToExpressionArrowFunction)),g.push(E);}var N,F=new e.Map,A=b(t.range)?e.factory.createBlock(t.range):t.range,P=b(t.range)?e.first(t.range):t.range,w=(N=P,!!e.findAncestor(N,(function(t){return e.isDeclarationWithTypeParameters(t)&&0!==e.getEffectiveTypeParameterDeclarations(t).length})));if(function c(l,u){if(void 0===u&&(u=1),w&&U(s.getTypeAtLocation(l)),e.isDeclaration(l)&&l.symbol&&m.push(l),e.isAssignmentExpression(l))c(l.left,2),c(l.right);else if(e.isUnaryExpressionWithWrite(l))c(l.operand,2);else if(e.isPropertyAccessExpression(l)||e.isElementAccessExpression(l))e.forEachChild(l,c);else if(e.isIdentifier(l)){if(!l.parent)return;if(e.isQualifiedName(l.parent)&&l!==l.parent.left)return;if(e.isPropertyAccessExpression(l.parent)&&l!==l.parent.expression)return;!function(c,l,u){var _=function(c,l,u){var _=V(c);if(_){var m=e.getSymbolId(_).toString(),y=F.get(m);if(y&&y>=l)return m;if(F.set(m,l),y){for(var v=0,h=d;v<h.length;v++){var b=h[v];b.usages.get(c.text)&&b.usages.set(c.text,{usage:l,symbol:_,node:c});}return m}var x=_.getDeclarations(),D=x&&e.find(x,(function(e){return e.getSourceFile()===o}));if(D&&!e.rangeContainsStartEnd(i,D.getStart(),D.end)){if(t.facts&a.IsGenerator&&2===l){for(var S=e.createDiagnosticForNode(c,n.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators),T=0,C=f;T<C.length;T++)C[T].push(S);for(var k=0,E=g;k<E.length;k++)E[k].push(S);}for(var N=0;N<r.length;N++){var A=r[N];if(s.resolveName(_.name,A,_.flags,!1)!==_&&!p[N].has(m)){var P=q(_.exportSymbol||_,A,u);P?p[N].set(m,P):u?262144&_.flags||(S=e.createDiagnosticForNode(c,n.typeWillNotBeVisibleInTheNewScope),f[N].push(S),g[N].push(S)):d[N].usages.set(c.text,{usage:l,symbol:_,node:c});}}return m}}}(c,l,u);if(_)for(var m=0;m<r.length;m++){var y=p[m].get(_);y&&d[m].substitutions.set(e.getNodeId(c).toString(),y);}}(l,u,e.isPartOfTypeNode(l));}else e.forEachChild(l,c);}(A),!w||b(t.range)||e.isJsxAttribute(t.range)||U(s.getContextualType(t.range)),_.size>0){for(var I=new e.Map,O=0,M=P;void 0!==M&&O<r.length;M=M.parent)if(M===r[O]&&(I.forEach((function(e,t){d[O].typeParameterUsages.set(t,e);})),O++),e.isDeclarationWithTypeParameters(M))for(var L=0,R=e.getEffectiveTypeParameterDeclarations(M);L<R.length;L++){var B=R[L],j=s.getTypeAtLocation(B);_.has(j.id.toString())&&I.set(j.id.toString(),j);}e.Debug.assert(O===r.length,"Should have iterated all scopes");}if(m.length){var J=e.isBlockScope(r[0],r[0].parent)?r[0]:e.getEnclosingBlockScopeContainer(r[0]);e.forEachChild(J,(function r(n){if(!(n===t.range||b(t.range)&&t.range.indexOf(n)>=0)){var i=e.isIdentifier(n)?V(n):s.getSymbolAtLocation(n);if(i){var a=e.find(m,(function(e){return e.symbol===i}));if(a)if(e.isVariableDeclaration(a)){var o=a.symbol.id.toString();y.has(o)||(v.push(a),y.set(o,!0));}else l=l||a;}e.forEachChild(n,r);}}));}for(var z=function(i){var o=d[i];if(i>0&&(o.usages.size>0||o.typeParameterUsages.size>0)){var s=b(t.range)?t.range[0]:t.range;g[i].push(e.createDiagnosticForNode(s,n.cannotAccessVariablesFromNestedScopes));}t.facts&a.UsesThisInFunction&&e.isClassLike(r[i])&&f[i].push(e.createDiagnosticForNode(t.thisNode,n.cannotExtractFunctionsContainingThisToMethod));var c,u=!1;if(d[i].usages.forEach((function(t){2===t.usage&&(u=!0,106500&t.symbol.flags&&t.symbol.valueDeclaration&&e.hasEffectiveModifier(t.symbol.valueDeclaration,64)&&(c=t.symbol.valueDeclaration));})),e.Debug.assert(b(t.range)||0===v.length,"No variable declarations expected if something was extracted"),u&&!b(t.range)){var _=e.createDiagnosticForNode(t.range,n.cannotWriteInExpression);f[i].push(_),g[i].push(_);}else c&&i>0?(_=e.createDiagnosticForNode(c,n.cannotExtractReadonlyPropertyInitializerOutsideConstructor),f[i].push(_),g[i].push(_)):l&&(_=e.createDiagnosticForNode(l,n.cannotExtractExportedEntity),f[i].push(_),g[i].push(_));},K=0;K<r.length;K++)z(K);return {target:A,usagesPerScope:d,functionErrorsPerScope:f,constantErrorsPerScope:g,exposedVariableDeclarations:v};function U(e){for(var t=0,r=s.getSymbolWalker((function(){return c.throwIfCancellationRequested(),!0})).walkType(e).visitedTypes;t<r.length;t++){var n=r[t];n.isTypeParameter()&&_.set(n.id.toString(),n);}}function V(t){return t.parent&&e.isShorthandPropertyAssignment(t.parent)&&t.parent.name===t?s.getShorthandAssignmentValueSymbol(t.parent):s.getSymbolAtLocation(t)}function q(t,r,n){if(t){var i=t.getDeclarations();if(i&&i.some((function(e){return e.parent===r})))return e.factory.createIdentifier(t.name);var a=q(t.parent,r,n);if(void 0!==a)return n?e.factory.createQualifiedName(a,e.factory.createIdentifier(t.name)):e.factory.createPropertyAccessExpression(a,t.name)}}}(t,o,function(t,r){return b(t.range)?{pos:e.first(t.range).getStart(r),end:e.last(t.range).getEnd()}:t.range}(t,i),i,r.program.getTypeChecker(),r.cancellationToken)}}function y(e){var t,r=e.symbol;if(r&&r.declarations)for(var n=0,i=r.declarations;n<i.length;n++){var a=i[n];(void 0===t||a.pos<t.pos)&&(t=a);}return t}function v(t,r){var n=t.type,i=t.declaration,a=r.type,o=r.declaration;return e.compareProperties(i,o,"pos",e.compareValues)||e.compareStringsCaseSensitive(n.symbol?n.symbol.getName():"",a.symbol?a.symbol.getName():"")||e.compareValues(n.id,a.id)}function h(t,r){var n=e.map(t,(function(t){return e.factory.createShorthandPropertyAssignment(t.symbol.name)})),i=e.map(r,(function(t){return e.factory.createShorthandPropertyAssignment(t.symbol.name)}));return void 0===n?i:void 0===i?n:n.concat(i)}function b(t){return e.isArray(t)}function x(e){var t=e.parent;switch(t.kind){case 299:return !1}switch(e.kind){case 10:return 266!==t.kind&&270!==t.kind;case 225:case 201:case 203:return !1;case 79:return 203!==t.kind&&270!==t.kind&&275!==t.kind}return !0}function D(e){switch(e.kind){case 235:case 305:case 262:case 289:return !0;default:return !1}}function S(t){return T(t)||(e.isJsxElement(t)||e.isJsxSelfClosingElement(t)||e.isJsxFragment(t))&&(e.isJsxElement(t.parent)||e.isJsxFragment(t.parent))}function T(t){return e.isStringLiteral(t)&&t.parent&&e.isJsxAttribute(t.parent)}t.registerRefactor(c,{kinds:[l.kind,u.kind],getEditsForAction:d,getAvailableActions:_}),r.getRefactorActionsToExtractSymbol=_,r.getRefactorEditsToExtractSymbol=d,function(t){function r(t){return {message:t,code:0,category:e.DiagnosticCategory.Message,key:t}}t.cannotExtractRange=r("Cannot extract range."),t.cannotExtractImport=r("Cannot extract import statement."),t.cannotExtractSuper=r("Cannot extract super call."),t.cannotExtractJSDoc=r("Cannot extract JSDoc."),t.cannotExtractEmpty=r("Cannot extract empty range."),t.expressionExpected=r("expression expected."),t.uselessConstantType=r("No reason to extract constant of type."),t.statementOrExpressionExpected=r("Statement or expression expected."),t.cannotExtractRangeContainingConditionalBreakOrContinueStatements=r("Cannot extract range containing conditional break or continue statements."),t.cannotExtractRangeContainingConditionalReturnStatement=r("Cannot extract range containing conditional return statement."),t.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange=r("Cannot extract range containing labeled break or continue with target outside of the range."),t.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators=r("Cannot extract range containing writes to references located outside of the target range in generators."),t.typeWillNotBeVisibleInTheNewScope=r("Type will not visible in the new scope."),t.functionWillNotBeVisibleInTheNewScope=r("Function will not visible in the new scope."),t.cannotExtractIdentifier=r("Select more than a single identifier."),t.cannotExtractExportedEntity=r("Cannot extract exported declaration"),t.cannotWriteInExpression=r("Cannot write back side-effects when extracting an expression"),t.cannotExtractReadonlyPropertyInitializerOutsideConstructor=r("Cannot move initialization of read-only class property outside of the constructor"),t.cannotExtractAmbientBlock=r("Cannot extract code from ambient contexts"),t.cannotAccessVariablesFromNestedScopes=r("Cannot access variables from nested scopes"),t.cannotExtractToJSClass=r("Cannot extract constant to a class scope in JS"),t.cannotExtractToExpressionArrowFunction=r("Cannot extract constant to an arrow function without a block"),t.cannotExtractFunctionsContainingThisToMethod=r("Cannot extract functions containing this to method");}(n=r.Messages||(r.Messages={})),function(e){e[e.None=0]="None",e[e.HasReturn=1]="HasReturn",e[e.IsGenerator=2]="IsGenerator",e[e.IsAsyncFunction=4]="IsAsyncFunction",e[e.UsesThis=8]="UsesThis",e[e.UsesThisInFunction=16]="UsesThisInFunction",e[e.InStaticRegion=32]="InStaticRegion";}(a||(a={})),r.getRangeToExtract=p,function(e){e[e.Module=0]="Module",e[e.Global=1]="Global";}(o||(o={})),function(e){e[e.Read=1]="Read",e[e.Write=2]="Write";}(s||(s={}));})((t=e.refactor||(e.refactor={})).extractSymbol||(t.extractSymbol={}));}(t),function(e){!function(t){var r="Extract type",n={name:"Extract to type alias",description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_type_alias),kind:"refactor.extract.type"},a={name:"Extract to interface",description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_interface),kind:"refactor.extract.interface"},o={name:"Extract to typedef",description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_to_typedef),kind:"refactor.extract.typedef"};function s(t,r){void 0===r&&(r=!0);var n=t.file,i=t.startPosition,a=e.isSourceFileJS(n),o=e.getTokenAtPosition(n,i),s=e.createTextRangeFromSpan(e.getRefactorContextSpan(t)),u=s.pos===s.end&&r,_=e.findAncestor(o,(function(t){return t.parent&&e.isTypeNode(t)&&!l(s,t.parent,n)&&(u||e.nodeOverlapsWithStartEnd(o,n,s.pos,s.end))}));if(!_||!e.isTypeNode(_))return {error:e.getLocaleSpecificMessage(e.Diagnostics.Selection_is_not_a_valid_type_node)};var d=t.program.getTypeChecker(),p=e.Debug.checkDefined(e.findAncestor(_,e.isStatement),"Should find a statement"),f=function(t,r,n,i){var a=[];return function o(s){if(e.isTypeReferenceNode(s)){if(e.isIdentifier(s.typeName))for(var c=s.typeName,u=0,_=(null==(g=t.resolveName(c.text,c,262144,!0))?void 0:g.declarations)||e.emptyArray;u<_.length;u++){var d=_[u];if(e.isTypeParameterDeclaration(d)&&d.getSourceFile()===i){if(d.name.escapedText===c.escapedText&&l(d,r,i))return !0;if(l(n,d,i)&&!l(r,d,i)){e.pushIfUnique(a,d);break}}}}else if(e.isInferTypeNode(s)){var p=e.findAncestor(s,(function(t){return e.isConditionalTypeNode(t)&&l(t.extendsType,s,i)}));if(!p||!l(r,p,i))return !0}else if(e.isTypePredicateNode(s)||e.isThisTypeNode(s)){var f=e.findAncestor(s.parent,e.isFunctionLike);if(f&&f.type&&l(f.type,s,i)&&!l(r,f,i))return !0}else if(e.isTypeQueryNode(s)){var g;if(e.isIdentifier(s.exprName)){if((null==(g=t.resolveName(s.exprName.text,s.exprName,111551,!1))?void 0:g.valueDeclaration)&&l(n,g.valueDeclaration,i)&&!l(r,g.valueDeclaration,i))return !0}else if(e.isThisIdentifier(s.exprName.left)&&!l(r,s.parent,i))return !0}return i&&e.isTupleTypeNode(s)&&e.getLineAndCharacterOfPosition(i,s.pos).line===e.getLineAndCharacterOfPosition(i,s.end).line&&e.setEmitFlags(s,1),e.forEachChild(s,o)}(r)?void 0:a}(d,_,p,n);return f?{isJS:a,selection:_,firstStatement:p,typeParameters:f,typeElements:c(d,_)}:{error:e.getLocaleSpecificMessage(e.Diagnostics.No_type_could_be_extracted_from_this_type_node)}}function c(t,r){if(r){if(e.isIntersectionTypeNode(r)){for(var n=[],i=new e.Map,a=0,o=r.types;a<o.length;a++){var s=c(t,o[a]);if(!s||!s.every((function(t){return t.name&&e.addToSeen(i,e.getNameFromPropertyName(t.name))})))return;e.addRange(n,s);}return n}return e.isParenthesizedTypeNode(r)?c(t,r.type):e.isTypeLiteralNode(r)?r.members:void 0}}function l(t,r,n){return e.rangeContainsStartEnd(t,e.skipTrivia(n.text,r.pos),r.end)}t.registerRefactor(r,{kinds:[n.kind,a.kind,o.kind],getAvailableActions:function(c){var l=s(c,"invoked"===c.triggerReason);return l?t.isRefactorErrorInfo(l)?c.preferences.provideRefactorNotApplicableReason?[{name:r,description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_type),actions:[i$1(i$1({},o),{notApplicableReason:l.error}),i$1(i$1({},n),{notApplicableReason:l.error}),i$1(i$1({},a),{notApplicableReason:l.error})]}]:e.emptyArray:[{name:r,description:e.getLocaleSpecificMessage(e.Diagnostics.Extract_type),actions:l.isJS?[o]:e.append([n],l.typeElements&&a)}]:e.emptyArray},getEditsForAction:function(r,i){var c=r.file,l=s(r);e.Debug.assert(l&&!t.isRefactorErrorInfo(l),"Expected to find a range to extract");var u=e.getUniqueName("NewType",c),_=e.textChanges.ChangeTracker.with(r,(function(t){switch(i){case n.name:return e.Debug.assert(!l.isJS,"Invalid actionName/JS combo"),function(t,r,n,i){var a=i.firstStatement,o=i.selection,s=i.typeParameters,c=e.factory.createTypeAliasDeclaration(void 0,void 0,n,s.map((function(t){return e.factory.updateTypeParameterDeclaration(t,t.modifiers,t.name,t.constraint,void 0)})),o);t.insertNodeBefore(r,a,e.ignoreSourceNewlines(c),!0),t.replaceNode(r,o,e.factory.createTypeReferenceNode(n,s.map((function(t){return e.factory.createTypeReferenceNode(t.name,void 0)}))),{leadingTriviaOption:e.textChanges.LeadingTriviaOption.Exclude,trailingTriviaOption:e.textChanges.TrailingTriviaOption.ExcludeWhitespace});}(t,c,u,l);case o.name:return e.Debug.assert(l.isJS,"Invalid actionName/JS combo"),function(t,r,n,i){var a=i.firstStatement,o=i.selection,s=i.typeParameters;e.setEmitFlags(o,3584);var c=e.factory.createJSDocTypedefTag(e.factory.createIdentifier("typedef"),e.factory.createJSDocTypeExpression(o),e.factory.createIdentifier(n)),l=[];e.forEach(s,(function(t){var r=e.getEffectiveConstraintOfTypeParameter(t),n=e.factory.createTypeParameterDeclaration(void 0,t.name),i=e.factory.createJSDocTemplateTag(e.factory.createIdentifier("template"),r&&e.cast(r,e.isJSDocTypeExpression),[n]);l.push(i);})),t.insertNodeBefore(r,a,e.factory.createJSDocComment(void 0,e.factory.createNodeArray(e.concatenate(l,[c]))),!0),t.replaceNode(r,o,e.factory.createTypeReferenceNode(n,s.map((function(t){return e.factory.createTypeReferenceNode(t.name,void 0)}))));}(t,c,u,l);case a.name:return e.Debug.assert(!l.isJS&&!!l.typeElements,"Invalid actionName/JS combo"),function(t,r,n,i){var a,o=i.firstStatement,s=i.selection,c=i.typeParameters,l=i.typeElements,u=e.factory.createInterfaceDeclaration(void 0,void 0,n,c,void 0,l);e.setTextRange(u,null===(a=l[0])||void 0===a?void 0:a.parent),t.insertNodeBefore(r,o,e.ignoreSourceNewlines(u),!0),t.replaceNode(r,s,e.factory.createTypeReferenceNode(n,c.map((function(t){return e.factory.createTypeReferenceNode(t.name,void 0)}))),{leadingTriviaOption:e.textChanges.LeadingTriviaOption.Exclude,trailingTriviaOption:e.textChanges.TrailingTriviaOption.ExcludeWhitespace});}(t,c,u,l);default:e.Debug.fail("Unexpected action name");}})),d=c.fileName;return {edits:_,renameFilename:d,renameLocation:e.getRenameLocation(_,d,u,!1)}}});}(e.refactor||(e.refactor={}));}(t),function(e){var t,r,n,a;(t=e.refactor||(e.refactor={})).generateGetAccessorAndSetAccessor||(t.generateGetAccessorAndSetAccessor={}),r="Generate 'get' and 'set' accessors",n=e.Diagnostics.Generate_get_and_set_accessors.message,a={name:r,description:n,kind:"refactor.rewrite.property.generateAccessors"},t.registerRefactor(r,{kinds:[a.kind],getEditsForAction:function(r,n){if(r.endPosition){var i=e.codefix.getAccessorConvertiblePropertyAtPosition(r.file,r.program,r.startPosition,r.endPosition);e.Debug.assert(i&&!t.isRefactorErrorInfo(i),"Expected applicable refactor info");var a=e.codefix.generateAccessorFromProperty(r.file,r.program,r.startPosition,r.endPosition,r,n);if(a){var o=r.file.fileName,s=i.renameAccessor?i.accessorName:i.fieldName;return {renameFilename:o,renameLocation:(e.isIdentifier(s)?0:-1)+e.getRenameLocation(a,o,s.text,e.isParameter(i.declaration)),edits:a}}}},getAvailableActions:function(o){if(!o.endPosition)return e.emptyArray;var s=e.codefix.getAccessorConvertiblePropertyAtPosition(o.file,o.program,o.startPosition,o.endPosition,"invoked"===o.triggerReason);return s?t.isRefactorErrorInfo(s)?o.preferences.provideRefactorNotApplicableReason?[{name:r,description:n,actions:[i$1(i$1({},a),{notApplicableReason:s.error})]}]:e.emptyArray:[{name:r,description:n,actions:[a]}]:e.emptyArray}});}(t),function(e){var t;(t=e.refactor||(e.refactor={})).isRefactorErrorInfo=function(e){return void 0!==e.error},t.refactorKindBeginsWith=function(e,t){return !t||e.substr(0,t.length)===t};}(t),function(e){!function(t){var r="Move to a new file",a=e.getLocaleSpecificMessage(e.Diagnostics.Move_to_a_new_file),o={name:r,description:a,kind:"refactor.move.newFile"};function s(t){var r=function(t){var r=t.file,n=e.createTextRangeFromSpan(e.getRefactorContextSpan(t)),i=r.statements,a=e.findIndex(i,(function(e){return e.end>n.pos}));if(-1!==a){var o=i[a];if(e.isNamedDeclaration(o)&&o.name&&e.rangeContainsRange(o.name,n))return {toMove:[i[a]],afterLast:i[a+1]};if(!(n.pos>o.getStart(r))){var s=e.findIndex(i,(function(e){return e.end>n.end}),a);if(-1===s||!(0===s||i[s].getStart(r)<n.end))return {toMove:i.slice(a,-1===s?i.length:s),afterLast:-1===s?void 0:i[s]}}}}(t);if(void 0!==r){var n=[],i=[],a=r.toMove,o=r.afterLast;return e.getRangesWhere(a,c,(function(e,t){for(var r=e;r<t;r++)n.push(a[r]);i.push({first:a[e],afterLast:o});})),0===n.length?void 0:{all:n,ranges:i}}}function c(t){return !function(t){switch(t.kind){case 266:return !0;case 265:return !e.hasSyntacticModifier(t,1);case 237:return t.declarationList.declarations.every((function(t){return !!t.initializer&&e.isRequireCall(t.initializer,!0)}));default:return !1}}(t)&&!e.isPrologueDirective(t)}function l(e,t,r){for(var n=0,i=t;n<i.length;n++){var a=i[n],o=a.first,s=a.afterLast;r.deleteNodeRangeExcludingEnd(e,o,s);}}function u(e){return 266===e.kind?e.moduleSpecifier:265===e.kind?e.moduleReference.expression:e.initializer.arguments[0]}function _(t,r){if(e.isImportDeclaration(t))e.isStringLiteral(t.moduleSpecifier)&&r(t);else if(e.isImportEqualsDeclaration(t))e.isExternalModuleReference(t.moduleReference)&&e.isStringLiteralLike(t.moduleReference.expression)&&r(t);else if(e.isVariableStatement(t))for(var n=0,i=t.declarationList.declarations;n<i.length;n++){var a=i[n];a.initializer&&e.isRequireCall(a.initializer,!0)&&r(a);}}function d(t,r,n,i,a){if(n=e.ensurePathIsNonModuleName(n),i){var o=r.map((function(t){return e.factory.createImportSpecifier(!1,void 0,e.factory.createIdentifier(t))}));return e.makeImportIfNecessary(t,o,n,a)}e.Debug.assert(!t,"No default import should exist");var s=r.map((function(t){return e.factory.createBindingElement(void 0,void 0,t)}));return s.length?p(e.factory.createObjectBindingPattern(s),void 0,f(e.factory.createStringLiteral(n))):void 0}function p(t,r,n,i){return void 0===i&&(i=2),e.factory.createVariableStatement(void 0,e.factory.createVariableDeclarationList([e.factory.createVariableDeclaration(t,void 0,r,n)],i))}function f(t){return e.factory.createCallExpression(e.factory.createIdentifier("require"),void 0,[t])}function g(t,r,n,i){switch(r.kind){case 266:!function(t,r,n,i){if(r.importClause){var a=r.importClause,o=a.name,s=a.namedBindings,c=!o||i(o),l=!s||(268===s.kind?i(s.name):0!==s.elements.length&&s.elements.every((function(e){return i(e.name)})));if(c&&l)n.delete(t,r);else if(o&&c&&n.delete(t,o),s)if(l)n.replaceNode(t,r.importClause,e.factory.updateImportClause(r.importClause,r.importClause.isTypeOnly,o,void 0));else if(269===s.kind)for(var u=0,_=s.elements;u<_.length;u++){var d=_[u];i(d.name)&&n.delete(t,d);}}}(t,r,n,i);break;case 265:i(r.name)&&n.delete(t,r);break;case 254:!function(t,r,n,i){var a=r.name;switch(a.kind){case 79:i(a)&&n.delete(t,a);break;case 202:break;case 201:if(a.elements.every((function(t){return e.isIdentifier(t.name)&&i(t.name)})))n.delete(t,e.isVariableDeclarationList(r.parent)&&1===r.parent.declarations.length?r.parent.parent:r);else for(var o=0,s=a.elements;o<s.length;o++){var c=s[o];e.isIdentifier(c.name)&&i(c.name)&&n.delete(t,c.name);}}}(t,r,n,i);break;default:e.Debug.assertNever(r,"Unexpected import decl kind ".concat(r.kind));}}function m(t){switch(t.kind){case 265:case 270:case 267:case 268:return !0;case 254:return y(t);case 203:return e.isVariableDeclaration(t.parent.parent)&&y(t.parent.parent);default:return !1}}function y(t){return e.isSourceFile(t.parent.parent.parent)&&!!t.initializer&&e.isRequireCall(t.initializer,!0)}function v(t,r,n){switch(t.kind){case 266:var i=t.importClause;if(!i)return;var a=i.name&&n(i.name)?i.name:void 0,o=i.namedBindings&&function(t,r){if(268===t.kind)return r(t.name)?t:void 0;var n=t.elements.filter((function(e){return r(e.name)}));return n.length?e.factory.createNamedImports(n):void 0}(i.namedBindings,n);return a||o?e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,a,o),r,void 0):void 0;case 265:return n(t.name)?t:void 0;case 254:var s=function(t,r){switch(t.kind){case 79:return r(t)?t:void 0;case 202:return t;case 201:var n=t.elements.filter((function(t){return t.propertyName||!e.isIdentifier(t.name)||r(t.name)}));return n.length?e.factory.createObjectBindingPattern(n):void 0}}(t.name,n);return s?p(s,t.type,f(r),t.parent.flags):void 0;default:return e.Debug.assertNever(t,"Unexpected import kind ".concat(t.kind))}}function h(t,r,n){t.forEachChild((function t(i){if(e.isIdentifier(i)&&!e.isDeclarationName(i)){var a=r.getSymbolAtLocation(i);a&&n(a);}else i.forEachChild(t);}));}t.registerRefactor(r,{kinds:[o.kind],getAvailableActions:function(t){var n=s(t);return t.preferences.allowTextChangesInNewFiles&&n?[{name:r,description:a,actions:[o]}]:t.preferences.provideRefactorNotApplicableReason?[{name:r,description:a,actions:[i$1(i$1({},o),{notApplicableReason:e.getLocaleSpecificMessage(e.Diagnostics.Selection_is_not_a_valid_statement_or_statements)})]}]:e.emptyArray},getEditsForAction:function(t,i){e.Debug.assert(i===r,"Wrong refactor invoked");var a=e.Debug.checkDefined(s(t));return {edits:e.textChanges.ChangeTracker.with(t,(function(r){return i=t.file,o=t.program,s=a,c=r,p=t.host,y=t.preferences,T=o.getTypeChecker(),P=function(t,r,n){var i=new b,a=new b,o=new b,s=function(t){if(void 0!==t){var r=n.getJsxNamespace(t),i=n.resolveName(r,t,1920,!0);return i&&e.some(i.declarations,m)?i:void 0}}(e.find(r,(function(e){return !!(2&e.transformFlags)})));s&&a.add(s);for(var c=0,l=r;c<l.length;c++)S(y=l[c],(function(t){i.add(e.Debug.checkDefined(e.isExpressionStatement(t)?n.getSymbolAtLocation(t.expression.left):t.symbol,"Need a symbol here"));}));for(var u=0,_=r;u<_.length;u++)h(y=_[u],n,(function(r){if(r.declarations)for(var n=0,s=r.declarations;n<s.length;n++){var c=s[n];m(c)?a.add(r):x(c)&&(l=c,(e.isVariableDeclaration(l)?l.parent.parent.parent:l.parent)===t)&&!i.has(r)&&o.add(r);}var l;}));for(var d=a.clone(),p=new b,f=0,g=t.statements;f<g.length;f++){var y=g[f];e.contains(r,y)||(s&&2&y.transformFlags&&d.delete(s),h(y,n,(function(e){i.has(e)&&p.add(e),d.delete(e);})));}return {movedSymbols:i,newFileImportsFromOldFile:o,oldFileImportsFromNewFile:p,oldImportsNeededByNewFile:a,unusedImportsFromOldFile:d}}(i,s.all,T),w=e.getDirectoryPath(i.fileName),I=e.extensionFromPath(i.fileName),M=(O=function(t,r,n,i){for(var a=t,o=1;;o++){var s=e.combinePaths(n,a+r);if(!i.fileExists(s))return a;a="".concat(t,".").concat(o);}}(P.movedSymbols.forEachEntry(e.symbolNameNoDefault)||"newFile",I,w,p))+I,c.createNewFile(i,e.combinePaths(w,M),function(t,r,i,a,o,s,c){var p=o.getTypeChecker(),m=e.takeWhile(t.statements,e.isPrologueDirective);if(!t.externalModuleIndicator&&!t.commonJsModuleIndicator)return l(t,a.ranges,i),n$4(n$4([],m,!0),a.all,!0);var y=!!t.externalModuleIndicator,h=e.getQuotePreference(t,c),b=function(t,r,n,i){var a,o=[];return t.forEach((function(t){"default"===t.escapedName?a=e.factory.createIdentifier(e.symbolNameNoDefault(t)):o.push(t.name);})),d(a,o,r,n,i)}(r.oldFileImportsFromNewFile,s,y,h);b&&e.insertImports(i,t,b,!0),function(t,r,n,i,a){for(var o=0,s=t.statements;o<s.length;o++){var c=s[o];e.contains(r,c)||_(c,(function(e){return g(t,e,n,(function(e){return i.has(a.getSymbolAtLocation(e))}))}));}}(t,a.all,i,r.unusedImportsFromOldFile,p),l(t,a.ranges,i),function(t,r,n,i,a){for(var o=r.getTypeChecker(),s=function(r){if(r===n)return "continue";for(var s=function(s){_(s,(function(c){if(o.getSymbolAtLocation(u(c))===n.symbol){var l=function(t){var r=e.isBindingElement(t.parent)?e.getPropertySymbolFromBindingElement(o,t.parent):e.skipAlias(o.getSymbolAtLocation(t),o);return !!r&&i.has(r)};g(r,c,t,l);var _=e.combinePaths(e.getDirectoryPath(u(c).text),a),d=v(c,e.factory.createStringLiteral(_),l);d&&t.insertNodeAfter(r,s,d);var p=function(t){switch(t.kind){case 266:return t.importClause&&t.importClause.namedBindings&&268===t.importClause.namedBindings.kind?t.importClause.namedBindings.name:void 0;case 265:return t.name;case 254:return e.tryCast(t.name,e.isIdentifier);default:return e.Debug.assertNever(t,"Unexpected node kind ".concat(t.kind))}}(c);p&&function(t,r,n,i,a,o,s,c){var l=e.codefix.moduleSpecifierToValidIdentifier(a,99),u=!1,_=[];if(e.FindAllReferences.Core.eachSymbolReferenceInFile(s,n,r,(function(t){e.isPropertyAccessExpression(t.parent)&&(u=u||!!n.resolveName(l,t,67108863,!0),i.has(n.getSymbolAtLocation(t.parent.name))&&_.push(t));})),_.length){for(var d=u?e.getUniqueName(l,r):l,p=0,g=_;p<g.length;p++){var m=g[p];t.replaceNode(r,m,e.factory.createIdentifier(d));}t.insertNodeAfter(r,c,function(t,r,n){var i=e.factory.createIdentifier(r),a=e.factory.createStringLiteral(n);switch(t.kind){case 266:return e.factory.createImportDeclaration(void 0,void 0,e.factory.createImportClause(!1,void 0,e.factory.createNamespaceImport(i)),a,void 0);case 265:return e.factory.createImportEqualsDeclaration(void 0,void 0,!1,i,e.factory.createExternalModuleReference(a));case 254:return e.factory.createVariableDeclaration(i,void 0,void 0,f(a));default:return e.Debug.assertNever(t,"Unexpected node kind ".concat(t.kind))}}(c,a,o));}}(t,r,o,i,a,_,p,c);}}));},c=0,l=r.statements;c<l.length;c++)s(l[c]);},c=0,l=r.getSourceFiles();c<l.length;c++)s(l[c]);}(i,o,t,r.movedSymbols,s);var T=function(t,r,n,i,a,o,s){for(var c,l=[],p=0,f=t.statements;p<f.length;p++)_(f[p],(function(t){e.append(l,v(t,u(t),(function(e){return r.has(a.getSymbolAtLocation(e))})));}));var g=[],m=e.nodeSeenTracker();return n.forEach((function(r){if(r.declarations)for(var n=0,a=r.declarations;n<a.length;n++){var s=a[n];if(x(s)){var l=(_=s,e.isExpressionStatement(_)?e.tryCast(_.expression.left.name,e.isIdentifier):e.tryCast(_.name,e.isIdentifier));if(l){var u=C(s);m(u)&&k(t,u,l,i,o),e.hasSyntacticModifier(s,512)?c=l:g.push(l.text);}}}var _;})),e.append(l,d(c,g,e.removeFileExtension(e.getBaseFileName(t.fileName)),o,s)),l}(t,r.oldImportsNeededByNewFile,r.newFileImportsFromOldFile,i,p,y,h),P=function(t,r,i,a){return e.flatMap(r,(function(r){if(s=r,e.Debug.assert(e.isSourceFile(s.parent),"Node parent should be a SourceFile"),(D(s)||e.isVariableStatement(s))&&!E(t,r,a)&&S(r,(function(t){return i.has(e.Debug.checkDefined(t.symbol))}))){var o=function(e,t){return t?[N(e)]:function(e){return n$4([e],F(e).map(A),!0)}(e)}(r,a);if(o)return o}var s;return r}))}(t,a.all,r.oldFileImportsFromNewFile,y);return T.length&&P.length?n$4(n$4(n$4(n$4([],m,!0),T,!0),[4],!1),P,!0):n$4(n$4(n$4([],m,!0),T,!0),P,!0)}(i,P,c,s,o,O,y)),void function(t,r,n,i,a){var o=t.getCompilerOptions().configFile;if(o){var s=e.normalizePath(e.combinePaths(n,"..",i)),c=e.getRelativePathFromFile(o.fileName,s,a),l=o.statements[0]&&e.tryCast(o.statements[0].expression,e.isObjectLiteralExpression),u=l&&e.find(l.properties,(function(t){return e.isPropertyAssignment(t)&&e.isStringLiteral(t.name)&&"files"===t.name.text}));u&&e.isArrayLiteralExpression(u.initializer)&&r.insertNodeInListAfter(o,e.last(u.initializer.elements),e.factory.createStringLiteral(c),u.initializer.elements);}}(o,c,i.fileName,M,e.hostGetCanonicalFileName(p));var i,o,s,c,p,y,T,P,w,I,O,M;})),renameFilename:void 0,renameLocation:void 0}}});var b=function(){function t(){this.map=new e.Map;}return t.prototype.add=function(t){this.map.set(String(e.getSymbolId(t)),t);},t.prototype.has=function(t){return this.map.has(String(e.getSymbolId(t)))},t.prototype.delete=function(t){this.map.delete(String(e.getSymbolId(t)));},t.prototype.forEach=function(e){this.map.forEach(e);},t.prototype.forEachEntry=function(t){return e.forEachEntry(this.map,t)},t.prototype.clone=function(){var r=new t;return e.copyEntries(this.map,r.map),r},t}();function x(t){return D(t)&&e.isSourceFile(t.parent)||e.isVariableDeclaration(t)&&e.isSourceFile(t.parent.parent.parent)}function D(e){switch(e.kind){case 256:case 257:case 261:case 260:case 259:case 258:case 265:return !0;default:return !1}}function S(t,r){switch(t.kind){case 256:case 257:case 261:case 260:case 259:case 258:case 265:return r(t);case 237:return e.firstDefined(t.declarationList.declarations,(function(e){return T(e.name,r)}));case 238:var n=t.expression;return e.isBinaryExpression(n)&&1===e.getAssignmentDeclarationKind(n)?r(t):void 0}}function T(t,r){switch(t.kind){case 79:return r(e.cast(t.parent,(function(t){return e.isVariableDeclaration(t)||e.isBindingElement(t)})));case 202:case 201:return e.firstDefined(t.elements,(function(t){return e.isOmittedExpression(t)?void 0:T(t.name,r)}));default:return e.Debug.assertNever(t,"Unexpected name kind ".concat(t.kind))}}function C(t){switch(t.kind){case 254:return t.parent.parent;case 203:return C(e.cast(t.parent.parent,(function(t){return e.isVariableDeclaration(t)||e.isBindingElement(t)})));default:return t}}function k(t,r,n,i,a){if(!E(t,r,a,n))if(a)e.isExpressionStatement(r)||i.insertExportModifier(t,r);else {var o=F(r);0!==o.length&&i.insertNodesAfter(t,r,o.map(A));}}function E(t,r,n,i){var a;return n?!e.isExpressionStatement(r)&&e.hasSyntacticModifier(r,1)||!(!i||!(null===(a=t.symbol.exports)||void 0===a?void 0:a.has(i.escapedText))):F(r).some((function(r){return t.symbol.exports.has(e.escapeLeadingUnderscores(r))}))}function N(t){var r=e.concatenate([e.factory.createModifier(93)],t.modifiers);switch(t.kind){case 256:return e.factory.updateFunctionDeclaration(t,t.decorators,r,t.asteriskToken,t.name,t.typeParameters,t.parameters,t.type,t.body);case 257:return e.factory.updateClassDeclaration(t,t.decorators,r,t.name,t.typeParameters,t.heritageClauses,t.members);case 237:return e.factory.updateVariableStatement(t,r,t.declarationList);case 261:return e.factory.updateModuleDeclaration(t,t.decorators,r,t.name,t.body);case 260:return e.factory.updateEnumDeclaration(t,t.decorators,r,t.name,t.members);case 259:return e.factory.updateTypeAliasDeclaration(t,t.decorators,r,t.name,t.typeParameters,t.type);case 258:return e.factory.updateInterfaceDeclaration(t,t.decorators,r,t.name,t.typeParameters,t.heritageClauses,t.members);case 265:return e.factory.updateImportEqualsDeclaration(t,t.decorators,r,t.isTypeOnly,t.name,t.moduleReference);case 238:return e.Debug.fail();default:return e.Debug.assertNever(t,"Unexpected declaration kind ".concat(t.kind))}}function F(t){switch(t.kind){case 256:case 257:return [t.name.text];case 237:return e.mapDefined(t.declarationList.declarations,(function(t){return e.isIdentifier(t.name)?t.name.text:void 0}));case 261:case 260:case 259:case 258:case 265:return e.emptyArray;case 238:return e.Debug.fail("Can't export an ExpressionStatement");default:return e.Debug.assertNever(t,"Unexpected decl kind ".concat(t.kind))}}function A(t){return e.factory.createExpressionStatement(e.factory.createBinaryExpression(e.factory.createPropertyAccessExpression(e.factory.createIdentifier("exports"),e.factory.createIdentifier(t)),63,e.factory.createIdentifier(t)))}}(e.refactor||(e.refactor={}));}(t),function(e){var t;(function(r){var n="Add or remove braces in an arrow function",a=e.Diagnostics.Add_or_remove_braces_in_an_arrow_function.message,o={name:"Add braces to arrow function",description:e.Diagnostics.Add_braces_to_arrow_function.message,kind:"refactor.rewrite.arrow.braces.add"},s={name:"Remove braces from arrow function",description:e.Diagnostics.Remove_braces_from_arrow_function.message,kind:"refactor.rewrite.arrow.braces.remove"};function c(r,n,i,a){void 0===i&&(i=!0);var c=e.getTokenAtPosition(r,n),l=e.getContainingFunction(c);if(!l)return {error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_find_a_containing_arrow_function)};if(!e.isArrowFunction(l))return {error:e.getLocaleSpecificMessage(e.Diagnostics.Containing_function_is_not_an_arrow_function)};if(e.rangeContainsRange(l,c)&&(!e.rangeContainsRange(l.body,c)||i)){if(t.refactorKindBeginsWith(o.kind,a)&&e.isExpression(l.body))return {func:l,addBraces:!0,expression:l.body};if(t.refactorKindBeginsWith(s.kind,a)&&e.isBlock(l.body)&&1===l.body.statements.length){var u=e.first(l.body.statements);if(e.isReturnStatement(u))return {func:l,addBraces:!1,expression:u.expression,returnStatement:u}}}}t.registerRefactor(n,{kinds:[s.kind],getEditsForAction:function(r,n){var i=r.file,a=r.startPosition,l=c(i,a);e.Debug.assert(l&&!t.isRefactorErrorInfo(l),"Expected applicable refactor info");var u,_=l.expression,d=l.returnStatement,p=l.func;if(n===o.name){var f=e.factory.createReturnStatement(_);u=e.factory.createBlock([f],!0),e.copyLeadingComments(_,f,i,3,!0);}else if(n===s.name&&d){var g=_||e.factory.createVoidZero();u=e.needsParentheses(g)?e.factory.createParenthesizedExpression(g):g,e.copyTrailingAsLeadingComments(d,u,i,3,!1),e.copyLeadingComments(d,u,i,3,!1),e.copyTrailingComments(d,u,i,3,!1);}else e.Debug.fail("invalid action");return {renameFilename:void 0,renameLocation:void 0,edits:e.textChanges.ChangeTracker.with(r,(function(e){e.replaceNode(i,p.body,u);}))}},getAvailableActions:function(r){var l=c(r.file,r.startPosition,"invoked"===r.triggerReason);return l?t.isRefactorErrorInfo(l)?r.preferences.provideRefactorNotApplicableReason?[{name:n,description:a,actions:[i$1(i$1({},o),{notApplicableReason:l.error}),i$1(i$1({},s),{notApplicableReason:l.error})]}]:e.emptyArray:[{name:n,description:a,actions:[l.addBraces?o:s]}]:e.emptyArray}});})((t=e.refactor||(e.refactor={})).addOrRemoveBracesToArrowFunction||(t.addOrRemoveBracesToArrowFunction={}));}(t),function(e){var t;(function(r){var i="Convert parameters to destructured object",a=e.getLocaleSpecificMessage(e.Diagnostics.Convert_parameters_to_destructured_object),o={name:i,description:a,kind:"refactor.rewrite.parameters.toDestructured"};function s(t,r){var n=e.getContainingObjectLiteralElement(t);if(n){var i=r.getContextualTypeForObjectLiteralElement(n),a=null==i?void 0:i.getSymbol();if(a&&!(6&e.getCheckFlags(a)))return a}}function c(t){var r=t.node;return e.isImportSpecifier(r.parent)||e.isImportClause(r.parent)||e.isImportEqualsDeclaration(r.parent)||e.isNamespaceImport(r.parent)||e.isExportSpecifier(r.parent)||e.isExportAssignment(r.parent)?r:void 0}function l(t){if(e.isDeclaration(t.node.parent))return t.node}function u(t){if(t.node.parent){var r=t.node,n=r.parent;switch(n.kind){case 208:case 209:var i=e.tryCast(n,e.isCallOrNewExpression);if(i&&i.expression===r)return i;break;case 206:var a=e.tryCast(n,e.isPropertyAccessExpression);if(a&&a.parent&&a.name===r){var o=e.tryCast(a.parent,e.isCallOrNewExpression);if(o&&o.expression===a)return o}break;case 207:var s=e.tryCast(n,e.isElementAccessExpression);if(s&&s.parent&&s.argumentExpression===r){var c=e.tryCast(s.parent,e.isCallOrNewExpression);if(c&&c.expression===s)return c}}}}function _(t){if(t.node.parent){var r=t.node,n=r.parent;switch(n.kind){case 206:var i=e.tryCast(n,e.isPropertyAccessExpression);if(i&&i.expression===r)return i;break;case 207:var a=e.tryCast(n,e.isElementAccessExpression);if(a&&a.expression===r)return a}}}function d(t){var r=t.node;if(2===e.getMeaningFromLocation(r)||e.isExpressionWithTypeArgumentsInClassExtendsClause(r.parent))return r}function p(t,r,n){var i=e.getTouchingToken(t,r),a=e.getContainingFunctionDeclaration(i);if(!function(t){var r=e.findAncestor(t,e.isJSDocNode);if(r){var n=e.findAncestor(r,(function(t){return !e.isJSDocNode(t)}));return !!n&&e.isFunctionLikeDeclaration(n)}return !1}(i))return !(a&&function(t,r){var n;if(!function(t,r){return function(e){return y(e)?e.length-1:e.length}(t)>=1&&e.every(t,(function(t){return function(t,r){if(e.isRestParameter(t)){var n=r.getTypeAtLocation(t);if(!r.isArrayType(n)&&!r.isTupleType(n))return !1}return !t.modifiers&&!t.decorators&&e.isIdentifier(t.name)}(t,r)}))}(t.parameters,r))return !1;switch(t.kind){case 256:return g(t)&&f(t,r);case 169:if(e.isObjectLiteralExpression(t.parent)){var i=s(t.name,r);return 1===(null===(n=null==i?void 0:i.declarations)||void 0===n?void 0:n.length)&&f(t,r)}return f(t,r);case 171:return e.isClassDeclaration(t.parent)?g(t.parent)&&f(t,r):m(t.parent.parent)&&f(t,r);case 213:case 214:return m(t.parent)}return !1}(a,n)&&e.rangeContainsRange(a,i))||a.body&&e.rangeContainsRange(a.body,i)?void 0:a}function f(e,t){return !!e.body&&!t.isImplementationOfOverload(e)}function g(t){return !!t.name||!!e.findModifier(t,88)}function m(t){return e.isVariableDeclaration(t)&&e.isVarConst(t)&&e.isIdentifier(t.name)&&!t.type}function y(t){return t.length>0&&e.isThis(t[0].name)}function v(t){return y(t)&&(t=e.factory.createNodeArray(t.slice(1),t.hasTrailingComma)),t}function h(t,r){var n=v(t.parameters),i=e.isRestParameter(e.last(n)),a=i?r.slice(0,n.length-1):r,o=e.map(a,(function(t,r){var i,a,o=(i=x(n[r]),a=t,e.isIdentifier(a)&&e.getTextOfIdentifierOrLiteral(a)===i?e.factory.createShorthandPropertyAssignment(i):e.factory.createPropertyAssignment(i,a));return e.suppressLeadingAndTrailingTrivia(o.name),e.isPropertyAssignment(o)&&e.suppressLeadingAndTrailingTrivia(o.initializer),e.copyComments(t,o),o}));if(i&&r.length>=n.length){var s=r.slice(n.length-1),c=e.factory.createPropertyAssignment(x(e.last(n)),e.factory.createArrayLiteralExpression(s));o.push(c);}return e.factory.createObjectLiteralExpression(o,!1)}function b(t,r,n){var i,a,o,s=r.getTypeChecker(),c=v(t.parameters),l=e.map(c,(function(t){var r=e.factory.createBindingElement(void 0,void 0,x(t),e.isRestParameter(t)&&g(t)?e.factory.createArrayLiteralExpression():t.initializer);return e.suppressLeadingAndTrailingTrivia(r),t.initializer&&r.initializer&&e.copyComments(t.initializer,r.initializer),r})),u=e.factory.createObjectBindingPattern(l),_=(i=c,a=e.map(i,(function(t){var i,a,o=t.type;o||!t.initializer&&!e.isRestParameter(t)||(i=t,a=s.getTypeAtLocation(i),o=e.getTypeNodeIfAccessible(a,i,r,n));var c=e.factory.createPropertySignature(void 0,x(t),g(t)?e.factory.createToken(57):t.questionToken,o);return e.suppressLeadingAndTrailingTrivia(c),e.copyComments(t.name,c.name),t.type&&c.type&&e.copyComments(t.type,c.type),c})),e.addEmitFlags(e.factory.createTypeLiteralNode(a),1));e.every(c,g)&&(o=e.factory.createObjectLiteralExpression());var d=e.factory.createParameterDeclaration(void 0,void 0,void 0,u,void 0,_,o);if(y(t.parameters)){var p=t.parameters[0],f=e.factory.createParameterDeclaration(void 0,void 0,void 0,p.name,void 0,p.type);return e.suppressLeadingAndTrailingTrivia(f.name),e.copyComments(p.name,f.name),p.type&&(e.suppressLeadingAndTrailingTrivia(f.type),e.copyComments(p.type,f.type)),e.factory.createNodeArray([f,d])}return e.factory.createNodeArray([d]);function g(t){if(e.isRestParameter(t)){var r=s.getTypeAtLocation(t);return !s.isTupleType(r)}return s.isOptionalParameter(t)}}function x(t){return e.getTextOfIdentifierOrLiteral(t.name)}t.registerRefactor(i,{kinds:[o.kind],getEditsForAction:function(t,r){e.Debug.assert(r===i,"Unexpected action name");var a=t.file,o=t.startPosition,f=t.program,g=t.cancellationToken,m=t.host,y=p(a,o,f.getTypeChecker());if(y&&g){var v=function(t,r,i){var a=function(t){switch(t.kind){case 256:return t.name?[t.name]:[e.Debug.checkDefined(e.findModifier(t,88),"Nameless function declaration should be a default export")];case 169:return [t.name];case 171:var r=e.Debug.checkDefined(e.findChildOfKind(t,134,t.getSourceFile()),"Constructor declaration should have constructor keyword");return 226===t.parent.kind?[t.parent.parent.name,r]:[r];case 214:return [t.parent.name];case 213:return t.name?[t.name,t.parent.name]:[t.parent.name];default:return e.Debug.assertNever(t,"Unexpected function declaration kind ".concat(t.kind))}}(t),o=e.isConstructorDeclaration(t)?function(t){switch(t.parent.kind){case 257:var r=t.parent;return r.name?[r.name]:[e.Debug.checkDefined(e.findModifier(r,88),"Nameless class declaration should be a default export")];case 226:var n=t.parent,i=t.parent.parent,a=n.name;return a?[a,i.name]:[i.name]}}(t):[],p=e.deduplicate(n$4(n$4([],a,!0),o,!0),e.equateValues),f=r.getTypeChecker(),g=function(r){for(var n={accessExpressions:[],typeUsages:[]},i={functionCalls:[],declarations:[],classReferences:n,valid:!0},p=e.map(a,m),g=e.map(o,m),y=e.isConstructorDeclaration(t),v=e.map(a,(function(e){return s(e,f)})),h=0,b=r;h<b.length;h++){var x=b[h];if(0!==x.kind){if(e.contains(v,m(x.node))){if(E=x.node.parent,e.isMethodSignature(E)&&(e.isInterfaceDeclaration(E.parent)||e.isTypeLiteralNode(E.parent))){i.signature=x.node.parent;continue}if(S=u(x)){i.functionCalls.push(S);continue}}var D=s(x.node,f);if(D&&e.contains(v,D)&&(T=l(x))){i.declarations.push(T);continue}if(e.contains(p,m(x.node))||e.isNewExpressionTarget(x.node)){var S;if(c(x))continue;if(T=l(x)){i.declarations.push(T);continue}if(S=u(x)){i.functionCalls.push(S);continue}}if(y&&e.contains(g,m(x.node))){var T;if(c(x))continue;if(T=l(x)){i.declarations.push(T);continue}var C=_(x);if(C){n.accessExpressions.push(C);continue}if(e.isClassDeclaration(t.parent)){var k=d(x);if(k){n.typeUsages.push(k);continue}}}i.valid=!1;}else i.valid=!1;}var E;return i}(e.flatMap(p,(function(t){return e.FindAllReferences.getReferenceEntriesForNode(-1,t,r,r.getSourceFiles(),i)})));return e.every(g.declarations,(function(t){return e.contains(p,t)}))||(g.valid=!1),g;function m(t){var r=f.getSymbolAtLocation(t);return r&&e.getSymbolTarget(r,f)}}(y,f,g);return v.valid?{renameFilename:void 0,renameLocation:void 0,edits:e.textChanges.ChangeTracker.with(t,(function(t){return function(t,r,n,i,a,o){var s=o.signature,c=e.map(b(a,r,n),(function(t){return e.getSynthesizedDeepClone(t)}));s&&p(s,e.map(b(s,r,n),(function(t){return e.getSynthesizedDeepClone(t)}))),p(a,c);for(var l=0,u=e.sortAndDeduplicate(o.functionCalls,(function(t,r){return e.compareValues(t.pos,r.pos)}));l<u.length;l++){var _=u[l];if(_.arguments&&_.arguments.length){var d=e.getSynthesizedDeepClone(h(a,_.arguments),!0);i.replaceNodeRange(e.getSourceFileOfNode(_),e.first(_.arguments),e.last(_.arguments),d,{leadingTriviaOption:e.textChanges.LeadingTriviaOption.IncludeAll,trailingTriviaOption:e.textChanges.TrailingTriviaOption.Include});}}function p(r,n){i.replaceNodeRangeWithNodes(t,e.first(r.parameters),e.last(r.parameters),n,{joiner:", ",indentation:0,leadingTriviaOption:e.textChanges.LeadingTriviaOption.IncludeAll,trailingTriviaOption:e.textChanges.TrailingTriviaOption.Include});}}(a,f,m,t,y,v)}))}:{edits:[]}}},getAvailableActions:function(t){var r=t.file,n=t.startPosition;return e.isSourceFileJS(r)?e.emptyArray:p(r,n,t.program.getTypeChecker())?[{name:i,description:a,actions:[o]}]:e.emptyArray}});})((t=e.refactor||(e.refactor={})).convertParamsToDestructuredObject||(t.convertParamsToDestructuredObject={}));}(t),function(e){var t;(function(r){var n="Convert to template string",a=e.getLocaleSpecificMessage(e.Diagnostics.Convert_to_template_string),o={name:n,description:a,kind:"refactor.rewrite.string"};function s(t,r){var n=e.getTokenAtPosition(t,r),i=l(n);return !u(i).isValidConcatenation&&e.isParenthesizedExpression(i.parent)&&e.isBinaryExpression(i.parent.parent)?i.parent.parent:n}function c(t,r){var n=l(r),i=t.file,a=function(t,r){var n=t.nodes,i=function(t,r){return function(n,i){n<t.length&&e.copyTrailingComments(t[n],i,r,3,!1);}}(t.operators,r),a=function(t,r,n){return function(i,a){for(;i.length>0;){var o=i.shift();e.copyTrailingComments(t[o],a,r,3,!1),n(o,a);}}}(n,r,i),o=d(0,n),s=o[0],c=o[1],l=o[2],u=o[3];if(s===n.length){var f=e.factory.createNoSubstitutionTemplateLiteral(c,l);return a(u,f),f}var g=[],m=e.factory.createTemplateHead(c,l);a(u,m);for(var y,v=function(t){var r=function(t){return e.isParenthesizedExpression(t)&&(p(t),t=t.expression),t}(n[t]);i(t,r);var o=d(t+1,n),s=o[0],c=o[1],l=o[2],u=o[3],f=(t=s-1)==n.length-1;if(e.isTemplateExpression(r)){var m=e.map(r.templateSpans,(function(t,n){p(t);var i=n===r.templateSpans.length-1,a=t.literal.text+(i?c:""),o=_(t.literal)+(i?l:"");return e.factory.createTemplateSpan(t.expression,f&&i?e.factory.createTemplateTail(a,o):e.factory.createTemplateMiddle(a,o))}));g.push.apply(g,m);}else {var v=f?e.factory.createTemplateTail(c,l):e.factory.createTemplateMiddle(c,l);a(u,v),g.push(e.factory.createTemplateSpan(r,v));}y=t;},h=s;h<n.length;h++)v(h),h=y;return e.factory.createTemplateExpression(m,g)}(u(n),i),o=e.getTrailingCommentRanges(i.text,n.end);if(o){var s=o[o.length-1],c={pos:o[0].pos,end:s.end};return e.textChanges.ChangeTracker.with(t,(function(e){e.deleteRange(i,c),e.replaceNode(i,n,a);}))}return e.textChanges.ChangeTracker.with(t,(function(e){return e.replaceNode(i,n,a)}))}function l(t){return e.findAncestor(t.parent,(function(t){switch(t.kind){case 206:case 207:return !1;case 223:case 221:return !(e.isBinaryExpression(t.parent)&&(r=t.parent,63!==r.operatorToken.kind));default:return "quit"}var r;}))||t}function u(t){var r=function(t){if(!e.isBinaryExpression(t))return {nodes:[t],operators:[],validOperators:!0,hasString:e.isStringLiteral(t)||e.isNoSubstitutionTemplateLiteral(t)};var n=r(t.left),i=n.nodes,a=n.operators,o=n.hasString,s=n.validOperators;if(!(o||e.isStringLiteral(t.right)||e.isTemplateExpression(t.right)))return {nodes:[t],operators:[],hasString:!1,validOperators:!0};var c=39===t.operatorToken.kind,l=s&&c;return i.push(t.right),a.push(t.operatorToken),{nodes:i,operators:a,hasString:!0,validOperators:l}},n=r(t),i=n.nodes,a=n.operators,o=n.validOperators,s=n.hasString;return {nodes:i,operators:a,isValidConcatenation:o&&s}}function _(t){var r=e.isTemplateHead(t)||e.isTemplateMiddle(t)?-2:-1;return e.getTextOfNode(t).slice(1,r)}function d(t,r){for(var n=[],i="",a="";t<r.length;){var o=r[t];if(!e.isStringLiteralLike(o)){if(e.isTemplateExpression(o)){i+=o.head.text,a+=_(o.head);break}break}i+=o.text,a+=e.getTextOfNode(o).slice(1,-1).replace(/\\.|[$`]/g,(function(e){return "\\"===e[0]?e:"\\"+e})),n.push(t),t++;}return [t,i,a,n]}function p(t){var r=t.getSourceFile();e.copyTrailingComments(t,t.expression,r,3,!1),e.copyTrailingAsLeadingComments(t.expression,t.expression,r,3,!1);}t.registerRefactor(n,{kinds:[o.kind],getEditsForAction:function(t,r){var n=s(t.file,t.startPosition);switch(r){case a:return {edits:c(t,n)};default:return e.Debug.fail("invalid action")}},getAvailableActions:function(t){var r=l(s(t.file,t.startPosition)),c={name:n,description:a,actions:[]};return e.isBinaryExpression(r)&&u(r).isValidConcatenation?(c.actions.push(o),[c]):t.preferences.provideRefactorNotApplicableReason?(c.actions.push(i$1(i$1({},o),{notApplicableReason:e.getLocaleSpecificMessage(e.Diagnostics.Can_only_convert_string_concatenation)})),[c]):e.emptyArray}});})((t=e.refactor||(e.refactor={})).convertStringOrTemplateLiteral||(t.convertStringOrTemplateLiteral={}));}(t),function(e){var t;(function(r){var n="Convert arrow function or function expression",a=e.getLocaleSpecificMessage(e.Diagnostics.Convert_arrow_function_or_function_expression),o={name:"Convert to anonymous function",description:e.getLocaleSpecificMessage(e.Diagnostics.Convert_to_anonymous_function),kind:"refactor.rewrite.function.anonymous"},s={name:"Convert to named function",description:e.getLocaleSpecificMessage(e.Diagnostics.Convert_to_named_function),kind:"refactor.rewrite.function.named"},c={name:"Convert to arrow function",description:e.getLocaleSpecificMessage(e.Diagnostics.Convert_to_arrow_function),kind:"refactor.rewrite.function.arrow"};function l(t){var r=!1;return t.forEachChild((function t(n){e.isThis(n)?r=!0:e.isClassLike(n)||e.isFunctionDeclaration(n)||e.isFunctionExpression(n)||e.forEachChild(n,t);})),r}function u(t,r,n){var i=e.getTokenAtPosition(t,r),a=n.getTypeChecker(),o=function(t,r,n){if(function(t){return e.isVariableDeclaration(t)||e.isVariableDeclarationList(t)&&1===t.declarations.length}(n)){var i=(e.isVariableDeclaration(n)?n:e.first(n.declarations)).initializer;return i&&(e.isArrowFunction(i)||e.isFunctionExpression(i)&&!d(t,r,i))?i:void 0}}(t,a,i.parent);if(o&&!l(o.body)&&!a.containsArgumentsReference(o))return {selectedVariableDeclaration:!0,func:o};var s=e.getContainingFunction(i);if(s&&(e.isFunctionExpression(s)||e.isArrowFunction(s))&&!e.rangeContainsRange(s.body,i)&&!l(s.body)&&!a.containsArgumentsReference(s)){if(e.isFunctionExpression(s)&&d(t,a,s))return;return {selectedVariableDeclaration:!1,func:s}}}function _(t){if(e.isExpression(t)){var r=e.factory.createReturnStatement(t),n=t.getSourceFile();return e.suppressLeadingAndTrailingTrivia(r),e.copyTrailingAsLeadingComments(t,r,n,void 0,!0),e.factory.createBlock([r],!0)}return t}function d(t,r,n){return !!n.name&&e.FindAllReferences.Core.isSymbolReferencedInFile(n.name,r,t)}t.registerRefactor(n,{kinds:[o.kind,s.kind,c.kind],getEditsForAction:function(t,r){var n=u(t.file,t.startPosition,t.program);if(n){var i=n.func,a=[];switch(r){case o.name:a.push.apply(a,function(t,r){var n=t.file,i=_(r.body),a=e.factory.createFunctionExpression(r.modifiers,r.asteriskToken,void 0,r.typeParameters,r.parameters,r.type,i);return e.textChanges.ChangeTracker.with(t,(function(e){return e.replaceNode(n,r,a)}))}(t,i));break;case s.name:var l=function(t){var r=t.parent;if(e.isVariableDeclaration(r)&&e.isVariableDeclarationInVariableStatement(r)){var n=r.parent,i=n.parent;return e.isVariableDeclarationList(n)&&e.isVariableStatement(i)&&e.isIdentifier(r.name)?{variableDeclaration:r,variableDeclarationList:n,statement:i,name:r.name}:void 0}}(i);if(!l)return;a.push.apply(a,function(t,r,n){var i=t.file,a=_(r.body),o=n.variableDeclaration,s=n.variableDeclarationList,c=n.statement,l=n.name;e.suppressLeadingTrivia(c);var u=1&e.getCombinedModifierFlags(o)|e.getEffectiveModifierFlags(r),d=e.factory.createModifiersFromModifierFlags(u),p=e.factory.createFunctionDeclaration(r.decorators,e.length(d)?d:void 0,r.asteriskToken,l,r.typeParameters,r.parameters,r.type,a);return 1===s.declarations.length?e.textChanges.ChangeTracker.with(t,(function(e){return e.replaceNode(i,c,p)})):e.textChanges.ChangeTracker.with(t,(function(e){e.delete(i,o),e.insertNodeAfter(i,c,p);}))}(t,i,l));break;case c.name:if(!e.isFunctionExpression(i))return;a.push.apply(a,function(t,r){var n,i=t.file,a=r.body.statements[0];!function(t,r){return 1===t.statements.length&&e.isReturnStatement(r)&&!!r.expression}(r.body,a)?n=r.body:(n=a.expression,e.suppressLeadingAndTrailingTrivia(n),e.copyComments(a,n));var o=e.factory.createArrowFunction(r.modifiers,r.typeParameters,r.parameters,r.type,e.factory.createToken(38),n);return e.textChanges.ChangeTracker.with(t,(function(e){return e.replaceNode(i,r,o)}))}(t,i));break;default:return e.Debug.fail("invalid action")}return {renameFilename:void 0,renameLocation:void 0,edits:a}}},getAvailableActions:function(r){var l=r.file,_=r.startPosition,d=r.program,p=r.kind,f=u(l,_,d);if(!f)return e.emptyArray;var g,m=f.selectedVariableDeclaration,y=f.func,v=[],h=[];return t.refactorKindBeginsWith(s.kind,p)&&((g=m||e.isArrowFunction(y)&&e.isVariableDeclaration(y.parent)?void 0:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_convert_to_named_function))?h.push(i$1(i$1({},s),{notApplicableReason:g})):v.push(s)),t.refactorKindBeginsWith(o.kind,p)&&((g=!m&&e.isArrowFunction(y)?void 0:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_convert_to_anonymous_function))?h.push(i$1(i$1({},o),{notApplicableReason:g})):v.push(o)),t.refactorKindBeginsWith(c.kind,p)&&((g=e.isFunctionExpression(y)?void 0:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_convert_to_arrow_function))?h.push(i$1(i$1({},c),{notApplicableReason:g})):v.push(c)),[{name:n,description:a,actions:0===v.length&&r.preferences.provideRefactorNotApplicableReason?h:v}]}});})((t=e.refactor||(e.refactor={})).convertArrowFunctionOrFunctionExpression||(t.convertArrowFunctionOrFunctionExpression={}));}(t),function(e){var t;(function(r){var n="Infer function return type",a=e.Diagnostics.Infer_function_return_type.message,o={name:n,description:a,kind:"refactor.rewrite.function.returnType"};function s(r){if(!e.isInJSFile(r.file)&&t.refactorKindBeginsWith(o.kind,r.kind)){var n=e.getTokenAtPosition(r.file,r.startPosition),i=e.findAncestor(n,(function(t){return e.isBlock(t)||t.parent&&e.isArrowFunction(t.parent)&&(38===t.kind||t.parent.body===t)?"quit":function(e){switch(e.kind){case 256:case 213:case 214:case 169:return !0;default:return !1}}(t)}));if(!i||!i.body||i.type)return {error:e.getLocaleSpecificMessage(e.Diagnostics.Return_type_must_be_inferred_from_a_function)};var a=r.program.getTypeChecker(),s=function(t,r){if(t.isImplementationOfOverload(r)){var n=t.getTypeAtLocation(r).getCallSignatures();if(n.length>1)return t.getUnionType(e.mapDefined(n,(function(e){return e.getReturnType()})))}var i=t.getSignatureFromDeclaration(r);if(i)return t.getReturnTypeOfSignature(i)}(a,i);if(!s)return {error:e.getLocaleSpecificMessage(e.Diagnostics.Could_not_determine_function_return_type)};var c=a.typeToTypeNode(s,i,1);return c?{declaration:i,returnTypeNode:c}:void 0}}t.registerRefactor(n,{kinds:[o.kind],getEditsForAction:function(r){var n=s(r);if(n&&!t.isRefactorErrorInfo(n))return {renameFilename:void 0,renameLocation:void 0,edits:e.textChanges.ChangeTracker.with(r,(function(t){return i=r.file,a=t,o=n.declaration,s=n.returnTypeNode,c=e.findChildOfKind(o,21,i),void((u=(l=e.isArrowFunction(o)&&void 0===c)?e.first(o.parameters):c)&&(l&&(a.insertNodeBefore(i,u,e.factory.createToken(20)),a.insertNodeAfter(i,u,e.factory.createToken(21))),a.insertNodeAt(i,u.end,s,{prefix:": "})));var i,a,o,s,c,l,u;}))}},getAvailableActions:function(r){var c=s(r);return c?t.isRefactorErrorInfo(c)?r.preferences.provideRefactorNotApplicableReason?[{name:n,description:a,actions:[i$1(i$1({},o),{notApplicableReason:c.error})]}]:e.emptyArray:[{name:n,description:a,actions:[o]}]:e.emptyArray}});})((t=e.refactor||(e.refactor={})).inferFunctionReturnType||(t.inferFunctionReturnType={}));}(t),function(e){function t(t,n,i,a){var o=e.isNodeKind(t)?new r(t,n,i):79===t?new u(79,n,i):80===t?new _(80,n,i):new l(t,n,i);return o.parent=a,o.flags=50720768&a.flags,o}e.servicesVersion="0.8";var r=function(){function r(e,t,r){this.pos=t,this.end=r,this.flags=0,this.modifierFlagsCache=0,this.transformFlags=0,this.parent=void 0,this.kind=e;}return r.prototype.assertHasRealPosition=function(t){e.Debug.assert(!e.positionIsSynthesized(this.pos)&&!e.positionIsSynthesized(this.end),t||"Node must have a real position for this operation");},r.prototype.getSourceFile=function(){return e.getSourceFileOfNode(this)},r.prototype.getStart=function(t,r){return this.assertHasRealPosition(),e.getTokenPosOfNode(this,t,r)},r.prototype.getFullStart=function(){return this.assertHasRealPosition(),this.pos},r.prototype.getEnd=function(){return this.assertHasRealPosition(),this.end},r.prototype.getWidth=function(e){return this.assertHasRealPosition(),this.getEnd()-this.getStart(e)},r.prototype.getFullWidth=function(){return this.assertHasRealPosition(),this.end-this.pos},r.prototype.getLeadingTriviaWidth=function(e){return this.assertHasRealPosition(),this.getStart(e)-this.pos},r.prototype.getFullText=function(e){return this.assertHasRealPosition(),(e||this.getSourceFile()).text.substring(this.pos,this.end)},r.prototype.getText=function(e){return this.assertHasRealPosition(),e||(e=this.getSourceFile()),e.text.substring(this.getStart(e),this.getEnd())},r.prototype.getChildCount=function(e){return this.getChildren(e).length},r.prototype.getChildAt=function(e,t){return this.getChildren(t)[e]},r.prototype.getChildren=function(r){return this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"),this._children||(this._children=function(r,n){if(!e.isNodeKind(r.kind))return e.emptyArray;var i=[];if(e.isJSDocCommentContainingNode(r))return r.forEachChild((function(e){i.push(e);})),i;e.scanner.setText((n||r.getSourceFile()).text);var o=r.pos,s=function(e){a(i,o,e.pos,r),i.push(e),o=e.end;};return e.forEach(r.jsDoc,s),o=r.pos,r.forEachChild(s,(function(e){a(i,o,e.pos,r),i.push(function(e,r){var n=t(348,e.pos,e.end,r);n._children=[];for(var i=e.pos,o=0,s=e;o<s.length;o++){var c=s[o];a(n._children,i,c.pos,r),n._children.push(c),i=c.end;}return a(n._children,i,e.end,r),n}(e,r)),o=e.end;})),a(i,o,r.end,r),e.scanner.setText(void 0),i}(this,r))},r.prototype.getFirstToken=function(t){this.assertHasRealPosition();var r=this.getChildren(t);if(r.length){var n=e.find(r,(function(e){return e.kind<309||e.kind>347}));return n.kind<161?n:n.getFirstToken(t)}},r.prototype.getLastToken=function(t){this.assertHasRealPosition();var r=this.getChildren(t),n=e.lastOrUndefined(r);if(n)return n.kind<161?n:n.getLastToken(t)},r.prototype.forEachChild=function(t,r){return e.forEachChild(this,t,r)},r}();function a(r,n,i,a){for(e.scanner.setTextPos(n);n<i;){var o=e.scanner.scan(),s=e.scanner.getTextPos();if(s<=i&&(79===o&&e.Debug.fail("Did not expect ".concat(e.Debug.formatSyntaxKind(a.kind)," to have an Identifier in its trivia")),r.push(t(o,n,s,a))),n=s,1===o)break}}var o=function(){function t(e,t){this.pos=e,this.end=t,this.flags=0,this.modifierFlagsCache=0,this.transformFlags=0,this.parent=void 0;}return t.prototype.getSourceFile=function(){return e.getSourceFileOfNode(this)},t.prototype.getStart=function(t,r){return e.getTokenPosOfNode(this,t,r)},t.prototype.getFullStart=function(){return this.pos},t.prototype.getEnd=function(){return this.end},t.prototype.getWidth=function(e){return this.getEnd()-this.getStart(e)},t.prototype.getFullWidth=function(){return this.end-this.pos},t.prototype.getLeadingTriviaWidth=function(e){return this.getStart(e)-this.pos},t.prototype.getFullText=function(e){return (e||this.getSourceFile()).text.substring(this.pos,this.end)},t.prototype.getText=function(e){return e||(e=this.getSourceFile()),e.text.substring(this.getStart(e),this.getEnd())},t.prototype.getChildCount=function(){return this.getChildren().length},t.prototype.getChildAt=function(e){return this.getChildren()[e]},t.prototype.getChildren=function(){return 1===this.kind&&this.jsDoc||e.emptyArray},t.prototype.getFirstToken=function(){},t.prototype.getLastToken=function(){},t.prototype.forEachChild=function(){},t}(),s=function(){function t(e,t){this.flags=e,this.escapedName=t;}return t.prototype.getFlags=function(){return this.flags},Object.defineProperty(t.prototype,"name",{get:function(){return e.symbolName(this)},enumerable:!1,configurable:!0}),t.prototype.getEscapedName=function(){return this.escapedName},t.prototype.getName=function(){return this.name},t.prototype.getDeclarations=function(){return this.declarations},t.prototype.getDocumentationComment=function(t){if(!this.documentationComment)if(this.documentationComment=e.emptyArray,!this.declarations&&this.target&&this.target.tupleLabelDeclaration){var r=this.target.tupleLabelDeclaration;this.documentationComment=m([r],t);}else this.documentationComment=m(this.declarations,t);return this.documentationComment},t.prototype.getContextualDocumentationComment=function(t,r){switch(null==t?void 0:t.kind){case 172:return this.contextualGetAccessorDocumentationComment||(this.contextualGetAccessorDocumentationComment=m(e.filter(this.declarations,e.isGetAccessor),r)),this.contextualGetAccessorDocumentationComment;case 173:return this.contextualSetAccessorDocumentationComment||(this.contextualSetAccessorDocumentationComment=m(e.filter(this.declarations,e.isSetAccessor),r)),this.contextualSetAccessorDocumentationComment;default:return this.getDocumentationComment(r)}},t.prototype.getJsDocTags=function(e){return void 0===this.tags&&(this.tags=g(this.declarations,e)),this.tags},t.prototype.getContextualJsDocTags=function(t,r){switch(null==t?void 0:t.kind){case 172:return this.contextualGetAccessorTags||(this.contextualGetAccessorTags=g(e.filter(this.declarations,e.isGetAccessor),r)),this.contextualGetAccessorTags;case 173:return this.contextualSetAccessorTags||(this.contextualSetAccessorTags=g(e.filter(this.declarations,e.isSetAccessor),r)),this.contextualSetAccessorTags;default:return this.getJsDocTags(r)}},t}(),l=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i.kind=t,i}return c(t,e),t}(o),u=function(t){function r(e,r,n){var i=t.call(this,r,n)||this;return i.kind=79,i}return c(r,t),Object.defineProperty(r.prototype,"text",{get:function(){return e.idText(this)},enumerable:!1,configurable:!0}),r}(o);u.prototype.kind=79;var _=function(t){function r(e,r,n){return t.call(this,r,n)||this}return c(r,t),Object.defineProperty(r.prototype,"text",{get:function(){return e.idText(this)},enumerable:!1,configurable:!0}),r}(o);_.prototype.kind=80;var d=function(){function t(e,t){this.checker=e,this.flags=t;}return t.prototype.getFlags=function(){return this.flags},t.prototype.getSymbol=function(){return this.symbol},t.prototype.getProperties=function(){return this.checker.getPropertiesOfType(this)},t.prototype.getProperty=function(e){return this.checker.getPropertyOfType(this,e)},t.prototype.getApparentProperties=function(){return this.checker.getAugmentedPropertiesOfType(this)},t.prototype.getCallSignatures=function(){return this.checker.getSignaturesOfType(this,0)},t.prototype.getConstructSignatures=function(){return this.checker.getSignaturesOfType(this,1)},t.prototype.getStringIndexType=function(){return this.checker.getIndexTypeOfType(this,0)},t.prototype.getNumberIndexType=function(){return this.checker.getIndexTypeOfType(this,1)},t.prototype.getBaseTypes=function(){return this.isClassOrInterface()?this.checker.getBaseTypes(this):void 0},t.prototype.isNullableType=function(){return this.checker.isNullableType(this)},t.prototype.getNonNullableType=function(){return this.checker.getNonNullableType(this)},t.prototype.getNonOptionalType=function(){return this.checker.getNonOptionalType(this)},t.prototype.getConstraint=function(){return this.checker.getBaseConstraintOfType(this)},t.prototype.getDefault=function(){return this.checker.getDefaultFromTypeParameter(this)},t.prototype.isUnion=function(){return !!(1048576&this.flags)},t.prototype.isIntersection=function(){return !!(2097152&this.flags)},t.prototype.isUnionOrIntersection=function(){return !!(3145728&this.flags)},t.prototype.isLiteral=function(){return !!(384&this.flags)},t.prototype.isStringLiteral=function(){return !!(128&this.flags)},t.prototype.isNumberLiteral=function(){return !!(256&this.flags)},t.prototype.isTypeParameter=function(){return !!(262144&this.flags)},t.prototype.isClassOrInterface=function(){return !!(3&e.getObjectFlags(this))},t.prototype.isClass=function(){return !!(1&e.getObjectFlags(this))},t.prototype.isIndexType=function(){return !!(4194304&this.flags)},Object.defineProperty(t.prototype,"typeArguments",{get:function(){if(4&e.getObjectFlags(this))return this.checker.getTypeArguments(this)},enumerable:!1,configurable:!0}),t}(),p=function(){function t(e,t){this.checker=e,this.flags=t;}return t.prototype.getDeclaration=function(){return this.declaration},t.prototype.getTypeParameters=function(){return this.typeParameters},t.prototype.getParameters=function(){return this.parameters},t.prototype.getReturnType=function(){return this.checker.getReturnTypeOfSignature(this)},t.prototype.getTypeParameterAtPosition=function(t){var r=this.checker.getParameterType(this,t);if(r.isIndexType()&&e.isThisTypeParameter(r.type)){var n=r.type.getConstraint();if(n)return this.checker.getIndexType(n)}return r},t.prototype.getDocumentationComment=function(){return this.documentationComment||(this.documentationComment=m(e.singleElementArray(this.declaration),this.checker))},t.prototype.getJsDocTags=function(){return this.jsDocTags||(this.jsDocTags=g(e.singleElementArray(this.declaration),this.checker))},t}();function f(t){return e.getJSDocTags(t).some((function(e){return "inheritDoc"===e.tagName.text}))}function g(t,r){if(!t)return e.emptyArray;var i=e.JsDoc.getJsDocTagsFromDeclarations(t,r);if(r&&(0===i.length||t.some(f)))for(var a=new e.Set,o=function(e){var t=y(r,e,(function(t){var n;if(!a.has(t))return a.add(t),172===e.kind||173===e.kind?t.getContextualJsDocTags(e,r):1===(null===(n=t.declarations)||void 0===n?void 0:n.length)?t.getJsDocTags():void 0}));t&&(i=n$4(n$4([],t,!0),i,!0));},s=0,c=t;s<c.length;s++)o(c[s]);return i}function m(t,r){if(!t)return e.emptyArray;var n=e.JsDoc.getJsDocCommentsFromDeclarations(t,r);if(r&&(0===n.length||t.some(f)))for(var i=new e.Set,a=function(t){var a=y(r,t,(function(e){if(!i.has(e))return i.add(e),172===t.kind||173===t.kind?e.getContextualDocumentationComment(t,r):e.getDocumentationComment(r)}));a&&(n=0===n.length?a.slice():a.concat(e.lineBreakPart(),n));},o=0,s=t;o<s.length;o++)a(s[o]);return n}function y(t,r,n){var i;if(!e.hasStaticModifier(r)){var a=171===(null===(i=r.parent)||void 0===i?void 0:i.kind)?r.parent.parent:r.parent;if(a)return e.firstDefined(e.getAllSuperTypeNodes(a),(function(e){var i=t.getPropertyOfType(t.getTypeAtLocation(e),r.symbol.name);return i?n(i):void 0}))}}var v=function(t){function r(e,r,n){var i=t.call(this,e,r,n)||this;return i.kind=305,i}return c(r,t),r.prototype.update=function(t,r){return e.updateSourceFile(this,t,r)},r.prototype.getLineAndCharacterOfPosition=function(t){return e.getLineAndCharacterOfPosition(this,t)},r.prototype.getLineStarts=function(){return e.getLineStarts(this)},r.prototype.getPositionOfLineAndCharacter=function(t,r,n){return e.computePositionOfLineAndCharacter(e.getLineStarts(this),t,r,this.text,n)},r.prototype.getLineEndOfPosition=function(e){var t,r=this.getLineAndCharacterOfPosition(e).line,n=this.getLineStarts();r+1>=n.length&&(t=this.getEnd()),t||(t=n[r+1]-1);var i=this.getFullText();return "\n"===i[t]&&"\r"===i[t-1]?t-1:t},r.prototype.getNamedDeclarations=function(){return this.namedDeclarations||(this.namedDeclarations=this.computeNamedDeclarations()),this.namedDeclarations},r.prototype.computeNamedDeclarations=function(){var t=e.createMultiMap();return this.forEachChild((function i(a){switch(a.kind){case 256:case 213:case 169:case 168:var o=a,s=n(o);if(s){var c=function(e){var r=t.get(e);return r||t.set(e,r=[]),r}(s),l=e.lastOrUndefined(c);l&&o.parent===l.parent&&o.symbol===l.symbol?o.body&&!l.body&&(c[c.length-1]=o):c.push(o);}e.forEachChild(a,i);break;case 257:case 226:case 258:case 259:case 260:case 261:case 265:case 275:case 270:case 267:case 268:case 172:case 173:case 182:r(a),e.forEachChild(a,i);break;case 164:if(!e.hasSyntacticModifier(a,16476))break;case 254:case 203:var u=a;if(e.isBindingPattern(u.name)){e.forEachChild(u.name,i);break}u.initializer&&i(u.initializer);case 299:case 167:case 166:r(a);break;case 272:var _=a;_.exportClause&&(e.isNamedExports(_.exportClause)?e.forEach(_.exportClause.elements,i):i(_.exportClause.name));break;case 266:var d=a.importClause;d&&(d.name&&r(d.name),d.namedBindings&&(268===d.namedBindings.kind?r(d.namedBindings):e.forEach(d.namedBindings.elements,i)));break;case 221:0!==e.getAssignmentDeclarationKind(a)&&r(a);default:e.forEachChild(a,i);}})),t;function r(e){var r=n(e);r&&t.add(r,e);}function n(t){var r=e.getNonAssignedNameOfDeclaration(t);return r&&(e.isComputedPropertyName(r)&&e.isPropertyAccessExpression(r.expression)?r.expression.name.text:e.isPropertyName(r)?e.getNameFromPropertyName(r):void 0)}},r}(r),h=function(){function t(e,t,r){this.fileName=e,this.text=t,this.skipTrivia=r;}return t.prototype.getLineAndCharacterOfPosition=function(t){return e.getLineAndCharacterOfPosition(this,t)},t}();function b(t){var r=!0;for(var n in t)if(e.hasProperty(t,n)&&!x(n)){r=!1;break}if(r)return t;var i={};for(var n in t)e.hasProperty(t,n)&&(i[x(n)?n:n.charAt(0).toLowerCase()+n.substr(1)]=t[n]);return i}function x(e){return !e.length||e.charAt(0)===e.charAt(0).toLowerCase()}e.toEditorSettings=b,e.displayPartsToString=function(t){return t?e.map(t,(function(e){return e.text})).join(""):""},e.getDefaultCompilerOptions=function(){return {target:1,jsx:1}},e.getSupportedCodeFixes=function(){return e.codefix.getSupportedErrorCodes()};var D=function(){function t(t,r){this.host=t,this.currentDirectory=t.getCurrentDirectory(),this.fileNameToEntry=new e.Map;var n=t.getScriptFileNames();null===e.tracing||void 0===e.tracing||e.tracing.push("session","initializeHostCache",{count:n.length});for(var i=0,a=n;i<a.length;i++){var o=a[i];this.createEntry(o,e.toPath(o,this.currentDirectory,r));}null===e.tracing||void 0===e.tracing||e.tracing.pop();}return t.prototype.createEntry=function(t,r){var n,i=this.host.getScriptSnapshot(t);return n=i?{hostFileName:t,version:this.host.getScriptVersion(t),scriptSnapshot:i,scriptKind:e.getScriptKind(t,this.host)}:t,this.fileNameToEntry.set(r,n),n},t.prototype.getEntryByPath=function(e){return this.fileNameToEntry.get(e)},t.prototype.getHostFileInformation=function(t){var r=this.fileNameToEntry.get(t);return e.isString(r)?void 0:r},t.prototype.getOrCreateEntryByPath=function(t,r){var n=this.getEntryByPath(r)||this.createEntry(t,r);return e.isString(n)?void 0:n},t.prototype.getRootFileNames=function(){var t=[];return this.fileNameToEntry.forEach((function(r){e.isString(r)?t.push(r):t.push(r.hostFileName);})),t},t.prototype.getScriptSnapshot=function(e){var t=this.getHostFileInformation(e);return t&&t.scriptSnapshot},t}(),S=function(){function t(e){this.host=e;}return t.prototype.getCurrentSourceFile=function(t){var r,n,i,a,o,s,c,l,u=this.host.getScriptSnapshot(t);if(!u)throw new Error("Could not find file: '"+t+"'.");var _,d=e.getScriptKind(t,this.host),p=this.host.getScriptVersion(t);if(this.currentFileName!==t)_=C(t,u,{languageVersion:99,impliedNodeFormat:e.getImpliedNodeFormatForFile(e.toPath(t,this.host.getCurrentDirectory(),(null===(i=null===(n=(r=this.host).getCompilerHost)||void 0===n?void 0:n.call(r))||void 0===i?void 0:i.getCanonicalFileName)||e.hostGetCanonicalFileName(this.host)),null===(l=null===(c=null===(s=null===(o=(a=this.host).getCompilerHost)||void 0===o?void 0:o.call(a))||void 0===s?void 0:s.getModuleResolutionCache)||void 0===c?void 0:c.call(s))||void 0===l?void 0:l.getPackageJsonInfoCache(),this.host,this.host.getCompilationSettings()),setExternalModuleIndicator:e.getSetExternalModuleIndicator(this.host.getCompilationSettings())},p,!0,d);else if(this.currentFileVersion!==p){var f=u.getChangeRange(this.currentFileScriptSnapshot);_=k(this.currentSourceFile,u,p,f);}return _&&(this.currentFileVersion=p,this.currentFileName=t,this.currentFileScriptSnapshot=u,this.currentSourceFile=_),this.currentSourceFile},t}();function T(e,t,r){e.version=r,e.scriptSnapshot=t;}function C(t,r,n,i,a,o){var s=e.createSourceFile(t,e.getSnapshotText(r),n,a,o);return T(s,r,i),s}function k(t,r,n,i,a){if(i&&n!==t.version){var o=void 0,s=0!==i.span.start?t.text.substr(0,i.span.start):"",c=e.textSpanEnd(i.span)!==t.text.length?t.text.substr(e.textSpanEnd(i.span)):"";if(0===i.newLength)o=s&&c?s+c:s||c;else {var l=r.getText(i.span.start,i.span.start+i.newLength);o=s&&c?s+l+c:s?s+l:l+c;}var u=e.updateSourceFile(t,o,i,a);return T(u,r,n),u.nameTable=void 0,t!==u&&t.scriptSnapshot&&(t.scriptSnapshot.dispose&&t.scriptSnapshot.dispose(),t.scriptSnapshot=void 0),u}var _={languageVersion:t.languageVersion,impliedNodeFormat:t.impliedNodeFormat,setExternalModuleIndicator:t.setExternalModuleIndicator};return C(t.fileName,r,_,n,!0,t.scriptKind)}e.createLanguageServiceSourceFile=C,e.updateLanguageServiceSourceFile=k;var E={isCancellationRequested:e.returnFalse,throwIfCancellationRequested:e.noop},N=function(){function t(e){this.cancellationToken=e;}return t.prototype.isCancellationRequested=function(){return this.cancellationToken.isCancellationRequested()},t.prototype.throwIfCancellationRequested=function(){if(this.isCancellationRequested())throw null===e.tracing||void 0===e.tracing||e.tracing.instant("session","cancellationThrown",{kind:"CancellationTokenObject"}),new e.OperationCanceledException},t}(),F=function(){function t(e,t){void 0===t&&(t=20),this.hostCancellationToken=e,this.throttleWaitMilliseconds=t,this.lastCancellationCheckTime=0;}return t.prototype.isCancellationRequested=function(){var t=e.timestamp();return Math.abs(t-this.lastCancellationCheckTime)>=this.throttleWaitMilliseconds&&(this.lastCancellationCheckTime=t,this.hostCancellationToken.isCancellationRequested())},t.prototype.throwIfCancellationRequested=function(){if(this.isCancellationRequested())throw null===e.tracing||void 0===e.tracing||e.tracing.instant("session","cancellationThrown",{kind:"ThrottledCancellationToken"}),new e.OperationCanceledException},t}();e.ThrottledCancellationToken=F;var A=["getSemanticDiagnostics","getSuggestionDiagnostics","getCompilerOptionsDiagnostics","getSemanticClassifications","getEncodedSemanticClassifications","getCodeFixesAtPosition","getCombinedCodeFix","applyCodeActionCommand","organizeImports","getEditsForFileRename","getEmitOutput","getApplicableRefactors","getEditsForRefactor","prepareCallHierarchy","provideCallHierarchyIncomingCalls","provideCallHierarchyOutgoingCalls","provideInlayHints"],P=n$4(n$4([],A,!0),["getCompletionsAtPosition","getCompletionEntryDetails","getCompletionEntrySymbol","getSignatureHelpItems","getQuickInfoAtPosition","getDefinitionAtPosition","getDefinitionAndBoundSpan","getImplementationAtPosition","getTypeDefinitionAtPosition","getReferencesAtPosition","findReferences","getOccurrencesAtPosition","getDocumentHighlights","getNavigateToItems","getRenameInfo","findRenameLocations","getApplicableRefactors"],!1);function w(t){var r=function(t){switch(t.kind){case 10:case 14:case 8:if(162===t.parent.kind)return e.isObjectLiteralElement(t.parent.parent)?t.parent.parent:void 0;case 79:return !e.isObjectLiteralElement(t.parent)||205!==t.parent.parent.kind&&286!==t.parent.parent.kind||t.parent.name!==t?void 0:t.parent}}(t);return r&&(e.isObjectLiteralExpression(r.parent)||e.isJsxAttributes(r.parent))?r:void 0}function I(t,r,n,i){var a=e.getNameFromPropertyName(t.name);if(!a)return e.emptyArray;if(!n.isUnion())return (o=n.getProperty(a))?[o]:e.emptyArray;var o,s=e.mapDefined(n.types,(function(n){return (e.isObjectLiteralExpression(t.parent)||e.isJsxAttributes(t.parent))&&r.isTypeInvalidDueToUnionDiscriminant(n,t.parent)?void 0:n.getProperty(a)}));return i&&(0===s.length||s.length===n.types.length)&&(o=n.getProperty(a))?[o]:0===s.length?e.mapDefined(n.types,(function(e){return e.getProperty(a)})):s}e.createLanguageService=function(t,r,a){var o,s,c;void 0===r&&(r=e.createDocumentRegistry(t.useCaseSensitiveFileNames&&t.useCaseSensitiveFileNames(),t.getCurrentDirectory())),c=void 0===a?e.LanguageServiceMode.Semantic:"boolean"==typeof a?a?e.LanguageServiceMode.Syntactic:e.LanguageServiceMode.Semantic:a;var l,u,_=new S(t),d=0,p=t.getCancellationToken?new N(t.getCancellationToken()):E,f=t.getCurrentDirectory();function g(e){t.log&&t.log(e);}e.maybeSetLocalizedDiagnosticMessages(null===(s=t.getLocalizedDiagnosticMessages)||void 0===s?void 0:s.bind(t));var m=e.hostUsesCaseSensitiveFileNames(t),y=e.createGetCanonicalFileName(m),v=e.getSourceMapper({useCaseSensitiveFileNames:function(){return m},getCurrentDirectory:function(){return f},getProgram:T,fileExists:e.maybeBind(t,t.fileExists),readFile:e.maybeBind(t,t.readFile),getDocumentPositionMapper:e.maybeBind(t,t.getDocumentPositionMapper),getSourceFileLike:e.maybeBind(t,t.getSourceFileLike),log:g});function h(e){var t=l.getSourceFile(e);if(!t){var r=new Error("Could not find source file: '".concat(e,"'."));throw r.ProgramFiles=l.getSourceFiles().map((function(e){return e.fileName})),r}return t}function x(){var n,i,a;if(e.Debug.assert(c!==e.LanguageServiceMode.Syntactic),t.getProjectVersion){var o=t.getProjectVersion();if(o){if(u===o&&!(null===(n=t.hasChangedAutomaticTypeDirectiveNames)||void 0===n?void 0:n.call(t)))return;u=o;}}var s=t.getTypeRootsVersion?t.getTypeRootsVersion():0;d!==s&&(g("TypeRoots version has changed; provide new program"),l=void 0,d=s);var _,h=new D(t,y),b=h.getRootFileNames(),x=t.getCompilationSettings()||{target:1,jsx:1},S=t.hasInvalidatedResolution||e.returnFalse,T=e.maybeBind(t,t.hasChangedAutomaticTypeDirectiveNames),C=null===(i=t.getProjectReferences)||void 0===i?void 0:i.call(t),k={useCaseSensitiveFileNames:m,fileExists:P,readFile:w,readDirectory:I,trace:e.maybeBind(t,t.trace),getCurrentDirectory:function(){return f},onUnRecoverableConfigFileDiagnostic:e.noop};if(!e.isProgramUptoDate(l,b,x,(function(e,r){return t.getScriptVersion(r)}),P,S,T,A,C)){var E={getSourceFile:M,getSourceFileByPath:L,getCancellationToken:function(){return p},getCanonicalFileName:y,useCaseSensitiveFileNames:function(){return m},getNewLine:function(){return e.getNewLineCharacter(x,(function(){return e.getNewLineOrDefaultFromHost(t)}))},getDefaultLibFileName:function(e){return t.getDefaultLibFileName(e)},writeFile:e.noop,getCurrentDirectory:function(){return f},fileExists:P,readFile:w,getSymlinkCache:e.maybeBind(t,t.getSymlinkCache),realpath:e.maybeBind(t,t.realpath),directoryExists:function(r){return e.directoryProbablyExists(r,t)},getDirectories:function(e){return t.getDirectories?t.getDirectories(e):[]},readDirectory:I,onReleaseOldSourceFile:O,onReleaseParsedCommandLine:function(e,r,n){var i;t.getParsedCommandLine?null===(i=t.onReleaseParsedCommandLine)||void 0===i||i.call(t,e,r,n):r&&O(r.sourceFile,n);},hasInvalidatedResolution:S,hasChangedAutomaticTypeDirectiveNames:T,trace:k.trace,resolveModuleNames:e.maybeBind(t,t.resolveModuleNames),getModuleResolutionCache:e.maybeBind(t,t.getModuleResolutionCache),resolveTypeReferenceDirectives:e.maybeBind(t,t.resolveTypeReferenceDirectives),useSourceOfProjectReferenceRedirect:e.maybeBind(t,t.useSourceOfProjectReferenceRedirect),getParsedCommandLine:A};null===(a=t.setCompilerHost)||void 0===a||a.call(t,E);var N=r.getKeyForCompilationSettings(x),F={rootNames:b,options:x,host:E,oldProgram:l,projectReferences:C};return l=e.createProgram(F),h=void 0,_=void 0,v.clearCache(),void l.getTypeChecker()}function A(r){var n=e.toPath(r,f,y),i=null==_?void 0:_.get(n);if(void 0!==i)return i||void 0;var a=t.getParsedCommandLine?t.getParsedCommandLine(r):function(t){var r=M(t);return r?(r.path=e.toPath(t,f,y),r.resolvedPath=r.path,r.originalFileName=r.fileName,e.parseJsonSourceFileConfigFileContent(r,k,e.getNormalizedAbsolutePath(e.getDirectoryPath(t),f),void 0,e.getNormalizedAbsolutePath(t,f))):void 0}(r);return (_||(_=new e.Map)).set(n,a||!1),a}function P(r){var n=e.toPath(r,f,y),i=h&&h.getEntryByPath(n);return i?!e.isString(i):!!t.fileExists&&t.fileExists(r)}function w(r){var n=e.toPath(r,f,y),i=h&&h.getEntryByPath(n);return i?e.isString(i)?void 0:e.getSnapshotText(i.scriptSnapshot):t.readFile&&t.readFile(r)}function I(r,n,i,a,o){return e.Debug.checkDefined(t.readDirectory,"'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'"),t.readDirectory(r,n,i,a,o)}function O(e,t){var n=r.getKeyForCompilationSettings(t);r.releaseDocumentWithKey(e.resolvedPath,n,e.scriptKind);}function M(t,r,n,i){return L(t,e.toPath(t,f,y),0,0,i)}function L(n,i,a,o,s){e.Debug.assert(void 0!==h,"getOrCreateSourceFileByPath called after typical CompilerHost lifetime, check the callstack something with a reference to an old host.");var c=h&&h.getOrCreateEntryByPath(n,i);if(c){if(!s){var u=l&&l.getSourceFileByPath(i);if(u){if(c.scriptKind===u.scriptKind)return r.updateDocumentWithKey(n,i,t,N,c.scriptSnapshot,c.version,c.scriptKind);r.releaseDocumentWithKey(u.resolvedPath,r.getKeyForCompilationSettings(l.getCompilerOptions()),u.scriptKind);}}return r.acquireDocumentWithKey(n,i,t,N,c.scriptSnapshot,c.version,c.scriptKind)}}}function T(){if(c!==e.LanguageServiceMode.Syntactic)return x(),l;e.Debug.assert(void 0===l);}function C(t,r,n){var i=e.normalizePath(t);e.Debug.assert(n.some((function(t){return e.normalizePath(t)===i}))),x();var a=e.mapDefined(n,(function(e){return l.getSourceFile(e)})),o=h(t);return e.DocumentHighlights.getDocumentHighlights(l,p,o,r,a)}function k(t,r,n,i){x();var a=n&&2===n.use?l.getSourceFiles().filter((function(e){return !l.isSourceFileDefaultLibrary(e)})):l.getSourceFiles();return e.FindAllReferences.findReferenceOrRenameEntries(l,p,a,t,r,n,i)}var F=new e.Map(e.getEntries(((o={})[18]=19,o[20]=21,o[22]=23,o[31]=29,o)));function O(r){var n;return e.Debug.assertEqual(r.type,"install package"),t.installPackage?t.installPackage({fileName:(n=r.file,e.toPath(n,f,y)),packageName:r.packageName}):Promise.reject("Host does not implement `installPackage`")}function M(e,t){return {lineStarts:e.getLineStarts(),firstLine:e.getLineAndCharacterOfPosition(t.pos).line,lastLine:e.getLineAndCharacterOfPosition(t.end).line}}function L(t,r,n){for(var i=_.getCurrentSourceFile(t),a=[],o=M(i,r),s=o.lineStarts,c=o.firstLine,l=o.lastLine,u=n||!1,d=Number.MAX_VALUE,p=new e.Map,f=new RegExp(/\S/),g=e.isInsideJsxElement(i,s[c]),m=g?"{/*":"//",y=c;y<=l;y++){var v=i.text.substring(s[y],i.getLineEndOfPosition(s[y])),h=f.exec(v);h&&(d=Math.min(d,h.index),p.set(y.toString(),h.index),v.substr(h.index,m.length)!==m&&(u=void 0===n||n));}for(y=c;y<=l;y++)if(c===l||s[y]!==r.end){var b=p.get(y.toString());void 0!==b&&(g?a.push.apply(a,R(t,{pos:s[y]+d,end:i.getLineEndOfPosition(s[y])},u,g)):u?a.push({newText:m,span:{length:0,start:s[y]+d}}):i.text.substr(s[y]+b,m.length)===m&&a.push({newText:"",span:{length:m.length,start:s[y]+b}}));}return a}function R(t,r,n,i){for(var a,o=_.getCurrentSourceFile(t),s=[],c=o.text,l=!1,u=n||!1,d=[],p=r.pos,f=void 0!==i?i:e.isInsideJsxElement(o,p),g=f?"{/*":"/*",m=f?"*/}":"*/",y=f?"\\{\\/\\*":"\\/\\*",v=f?"\\*\\/\\}":"\\*\\/";p<=r.end;){var h=c.substr(p,g.length)===g?g.length:0,b=e.isInComment(o,p+h);if(b)f&&(b.pos--,b.end++),d.push(b.pos),3===b.kind&&d.push(b.end),l=!0,p=b.end+1;else {var x=c.substring(p,r.end).search("(".concat(y,")|(").concat(v,")"));u=void 0!==n?n:u||!e.isTextWhiteSpaceLike(c,p,-1===x?r.end:p+x),p=-1===x?r.end+1:p+x+m.length;}}if(u||!l){2!==(null===(a=e.isInComment(o,r.pos))||void 0===a?void 0:a.kind)&&e.insertSorted(d,r.pos,e.compareValues),e.insertSorted(d,r.end,e.compareValues);var D=d[0];c.substr(D,g.length)!==g&&s.push({newText:g,span:{length:0,start:D}});for(var S=1;S<d.length-1;S++)c.substr(d[S]-m.length,m.length)!==m&&s.push({newText:m,span:{length:0,start:d[S]}}),c.substr(d[S],g.length)!==g&&s.push({newText:g,span:{length:0,start:d[S]}});s.length%2!=0&&s.push({newText:m,span:{length:0,start:d[d.length-1]}});}else for(var T=0,C=d;T<C.length;T++){var k=C[T],E=k-m.length>0?k-m.length:0;h=c.substr(E,m.length)===m?m.length:0,s.push({newText:"",span:{length:g.length,start:k-h}});}return s}function B(t){var r=t.openingElement,n=t.closingElement,i=t.parent;return !e.tagNamesAreEquivalent(r.tagName,n.tagName)||e.isJsxElement(i)&&e.tagNamesAreEquivalent(r.tagName,i.openingElement.tagName)&&B(i)}function j(t){var r=t.closingFragment,n=t.parent;return !!(131072&r.flags)||e.isJsxFragment(n)&&j(n)}function J(r,n,i,a,o,s){var c="number"==typeof n?[n,void 0]:[n.pos,n.end];return {file:r,startPosition:c[0],endPosition:c[1],program:T(),host:t,formatContext:e.formatting.getFormatContext(a,t),cancellationToken:p,preferences:i,triggerReason:o,kind:s}}F.forEach((function(e,t){return F.set(e.toString(),Number(t))}));var z={dispose:function(){if(l){var n=r.getKeyForCompilationSettings(l.getCompilerOptions());e.forEach(l.getSourceFiles(),(function(e){return r.releaseDocumentWithKey(e.resolvedPath,n,e.scriptKind)})),l=void 0;}t=void 0;},cleanupSemanticCache:function(){l=void 0;},getSyntacticDiagnostics:function(e){return x(),l.getSyntacticDiagnostics(h(e),p).slice()},getSemanticDiagnostics:function(t){x();var r=h(t),i=l.getSemanticDiagnostics(r,p);if(!e.getEmitDeclarations(l.getCompilerOptions()))return i.slice();var a=l.getDeclarationDiagnostics(r,p);return n$4(n$4([],i,!0),a,!0)},getSuggestionDiagnostics:function(t){return x(),e.computeSuggestionDiagnostics(h(t),l,p)},getCompilerOptionsDiagnostics:function(){return x(),n$4(n$4([],l.getOptionsDiagnostics(p),!0),l.getGlobalDiagnostics(p),!0)},getSyntacticClassifications:function(t,r){return e.getSyntacticClassifications(p,_.getCurrentSourceFile(t),r)},getSemanticClassifications:function(t,r,n){return x(),"2020"===(n||"original")?e.classifier.v2020.getSemanticClassifications(l,p,h(t),r):e.getSemanticClassifications(l.getTypeChecker(),p,h(t),l.getClassifiableNames(),r)},getEncodedSyntacticClassifications:function(t,r){return e.getEncodedSyntacticClassifications(p,_.getCurrentSourceFile(t),r)},getEncodedSemanticClassifications:function(t,r,n){return x(),"original"===(n||"original")?e.getEncodedSemanticClassifications(l.getTypeChecker(),p,h(t),l.getClassifiableNames(),r):e.classifier.v2020.getEncodedSemanticClassifications(l,p,h(t),r)},getCompletionsAtPosition:function(r,n,a,o){void 0===a&&(a=e.emptyOptions);var s=i$1(i$1({},e.identity(a)),{includeCompletionsForModuleExports:a.includeCompletionsForModuleExports||a.includeExternalModuleExports,includeCompletionsWithInsertText:a.includeCompletionsWithInsertText||a.includeInsertTextCompletions});return x(),e.Completions.getCompletionsAtPosition(t,l,g,h(r),n,s,a.triggerCharacter,a.triggerKind,p,o&&e.formatting.getFormatContext(o,t))},getCompletionEntryDetails:function(r,n,i,a,o,s,c){return void 0===s&&(s=e.emptyOptions),x(),e.Completions.getCompletionEntryDetails(l,g,h(r),n,{name:i,source:o,data:c},t,a&&e.formatting.getFormatContext(a,t),s,p)},getCompletionEntrySymbol:function(r,n,i,a,o){return void 0===o&&(o=e.emptyOptions),x(),e.Completions.getCompletionEntrySymbol(l,g,h(r),n,{name:i,source:a},t,o)},getSignatureHelpItems:function(t,r,n){var i=(void 0===n?e.emptyOptions:n).triggerReason;x();var a=h(t);return e.SignatureHelp.getSignatureHelpItems(l,a,r,i,p)},getQuickInfoAtPosition:function(t,r){x();var n=h(t),i=e.getTouchingPropertyName(n,r);if(i!==n){var a=l.getTypeChecker(),o=function(t){return e.isNewExpression(t.parent)&&t.pos===t.parent.pos?t.parent.expression:e.isNamedTupleMember(t.parent)&&t.pos===t.parent.pos||e.isImportMeta(t.parent)&&t.parent.name===t?t.parent:t}(i),s=function(t,r){var n=w(t);if(n){var i=r.getContextualType(n.parent),a=i&&I(n,r,i,!1);if(a&&1===a.length)return e.first(a)}return r.getSymbolAtLocation(t)}(o,a);if(!s||a.isUnknownSymbol(s)){var c=function(t,r,n){switch(r.kind){case 79:return !e.isLabelName(r)&&!e.isTagName(r)&&!e.isConstTypeReference(r.parent);case 206:case 161:return !e.isInComment(t,n);case 108:case 192:case 106:case 197:return !0;case 231:return e.isImportMeta(r);default:return !1}}(n,o,r)?a.getTypeAtLocation(o):void 0;return c&&{kind:"",kindModifiers:"",textSpan:e.createTextSpanFromNode(o,n),displayParts:a.runWithCancellationToken(p,(function(t){return e.typeToDisplayParts(t,c,e.getContainerNode(o))})),documentation:c.symbol?c.symbol.getDocumentationComment(a):void 0,tags:c.symbol?c.symbol.getJsDocTags(a):void 0}}var u=a.runWithCancellationToken(p,(function(t){return e.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(t,s,n,e.getContainerNode(o),o)})),_=u.symbolKind,d=u.displayParts,f=u.documentation,g=u.tags;return {kind:_,kindModifiers:e.SymbolDisplay.getSymbolModifiers(a,s),textSpan:e.createTextSpanFromNode(o,n),displayParts:d,documentation:f,tags:g}}},getDefinitionAtPosition:function(t,r,n,i){return x(),e.GoToDefinition.getDefinitionAtPosition(l,h(t),r,n,i)},getDefinitionAndBoundSpan:function(t,r){return x(),e.GoToDefinition.getDefinitionAndBoundSpan(l,h(t),r)},getImplementationAtPosition:function(t,r){return x(),e.FindAllReferences.getImplementationsAtPosition(l,p,l.getSourceFiles(),h(t),r)},getTypeDefinitionAtPosition:function(t,r){return x(),e.GoToDefinition.getTypeDefinitionAtPosition(l.getTypeChecker(),h(t),r)},getReferencesAtPosition:function(t,r){return x(),k(e.getTouchingPropertyName(h(t),r),r,{use:1},e.FindAllReferences.toReferenceEntry)},findReferences:function(t,r){return x(),e.FindAllReferences.findReferencedSymbols(l,p,l.getSourceFiles(),h(t),r)},getFileReferences:function(t){return x(),e.FindAllReferences.Core.getReferencesForFileName(t,l,l.getSourceFiles()).map(e.FindAllReferences.toReferenceEntry)},getOccurrencesAtPosition:function(t,r){return e.flatMap(C(t,r,[t]),(function(e){return e.highlightSpans.map((function(t){return i$1(i$1({fileName:e.fileName,textSpan:t.textSpan,isWriteAccess:"writtenReference"===t.kind},t.isInString&&{isInString:!0}),t.contextSpan&&{contextSpan:t.contextSpan})}))}))},getDocumentHighlights:C,getNameOrDottedNameSpan:function(t,r,n){var i=_.getCurrentSourceFile(t),a=e.getTouchingPropertyName(i,r);if(a!==i){switch(a.kind){case 206:case 161:case 10:case 95:case 110:case 104:case 106:case 108:case 192:case 79:break;default:return}for(var o=a;;)if(e.isRightSideOfPropertyAccess(o)||e.isRightSideOfQualifiedName(o))o=o.parent;else {if(!e.isNameOfModuleDeclaration(o))break;if(261!==o.parent.parent.kind||o.parent.parent.body!==o.parent)break;o=o.parent.parent.name;}return e.createTextSpanFromBounds(o.getStart(),a.getEnd())}},getBreakpointStatementAtPosition:function(t,r){var n=_.getCurrentSourceFile(t);return e.BreakpointResolver.spanInSourceFileAtLocation(n,r)},getNavigateToItems:function(t,r,n,i){void 0===i&&(i=!1),x();var a=n?[h(n)]:l.getSourceFiles();return e.NavigateTo.getNavigateToItems(a,l.getTypeChecker(),p,t,r,i)},getRenameInfo:function(t,r,n){return x(),e.Rename.getRenameInfo(l,h(t),r,n)},getSmartSelectionRange:function(t,r){return e.SmartSelectionRange.getSmartSelectionRange(r,_.getCurrentSourceFile(t))},findRenameLocations:function(t,r,n,a,o){x();var s=h(t),c=e.getAdjustedRenameLocation(e.getTouchingPropertyName(s,r));if(e.Rename.nodeIsEligibleForRename(c)){if(e.isIdentifier(c)&&(e.isJsxOpeningElement(c.parent)||e.isJsxClosingElement(c.parent))&&e.isIntrinsicJsxName(c.escapedText)){var l=c.parent.parent;return [l.openingElement,l.closingElement].map((function(t){var r=e.createTextSpanFromNode(t.tagName,s);return i$1({fileName:s.fileName,textSpan:r},e.FindAllReferences.toContextSpan(r,s,t.parent))}))}return k(c,r,{findInStrings:n,findInComments:a,providePrefixAndSuffixTextForRename:o,use:2},(function(t,r,n){return e.FindAllReferences.toRenameLocation(t,r,n,o||!1)}))}},getNavigationBarItems:function(t){return e.NavigationBar.getNavigationBarItems(_.getCurrentSourceFile(t),p)},getNavigationTree:function(t){return e.NavigationBar.getNavigationTree(_.getCurrentSourceFile(t),p)},getOutliningSpans:function(t){var r=_.getCurrentSourceFile(t);return e.OutliningElementsCollector.collectElements(r,p)},getTodoComments:function(t,r){x();var n=h(t);p.throwIfCancellationRequested();var i,a,o=n.text,s=[];if(r.length>0&&(a=n.fileName,!e.stringContains(a,"/node_modules/")))for(var c=function(){var t="("+/(?:^(?:\s|\*)*)/.source+"|"+/(?:\/\/+\s*)/.source+"|"+/(?:\/\*+\s*)/.source+")",n="(?:"+e.map(r,(function(e){return "("+e.text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")+")"})).join("|")+")";return new RegExp(t+"("+n+/(?:.*?)/.source+")"+/(?:$|\*\/)/.source,"gim")}(),l=void 0;l=c.exec(o);){p.throwIfCancellationRequested(),e.Debug.assert(l.length===r.length+3);var u=l[1],_=l.index+u.length;if(e.isInComment(n,_)){for(var d=void 0,f=0;f<r.length;f++)l[f+3]&&(d=r[f]);if(void 0===d)return e.Debug.fail();if(!((i=o.charCodeAt(_+d.text.length))>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57)){var g=l[2];s.push({descriptor:d,message:g,position:_});}}}return s},getBraceMatchingAtPosition:function(t,r){var n=_.getCurrentSourceFile(t),i=e.getTouchingToken(n,r),a=i.getStart(n)===r?F.get(i.kind.toString()):void 0,o=a&&e.findChildOfKind(i.parent,a,n);return o?[e.createTextSpanFromNode(i,n),e.createTextSpanFromNode(o,n)].sort((function(e,t){return e.start-t.start})):e.emptyArray},getIndentationAtPosition:function(t,r,n){var i=e.timestamp(),a=b(n),o=_.getCurrentSourceFile(t);g("getIndentationAtPosition: getCurrentSourceFile: "+(e.timestamp()-i)),i=e.timestamp();var s=e.formatting.SmartIndenter.getIndentation(r,o,a);return g("getIndentationAtPosition: computeIndentation : "+(e.timestamp()-i)),s},getFormattingEditsForRange:function(r,n,i,a){var o=_.getCurrentSourceFile(r);return e.formatting.formatSelection(n,i,o,e.formatting.getFormatContext(b(a),t))},getFormattingEditsForDocument:function(r,n){return e.formatting.formatDocument(_.getCurrentSourceFile(r),e.formatting.getFormatContext(b(n),t))},getFormattingEditsAfterKeystroke:function(r,n,i,a){var o=_.getCurrentSourceFile(r),s=e.formatting.getFormatContext(b(a),t);if(!e.isInComment(o,n))switch(i){case"{":return e.formatting.formatOnOpeningCurly(n,o,s);case"}":return e.formatting.formatOnClosingCurly(n,o,s);case";":return e.formatting.formatOnSemicolon(n,o,s);case"\n":return e.formatting.formatOnEnter(n,o,s)}return []},getDocCommentTemplateAtPosition:function(r,n,i){return e.JsDoc.getDocCommentTemplateAtPosition(e.getNewLineOrDefaultFromHost(t),_.getCurrentSourceFile(r),n,i)},isValidBraceCompletionAtPosition:function(t,r,n){if(60===n)return !1;var i=_.getCurrentSourceFile(t);if(e.isInString(i,r))return !1;if(e.isInsideJsxElementOrAttribute(i,r))return 123===n;if(e.isInTemplateString(i,r))return !1;switch(n){case 39:case 34:case 96:return !e.isInComment(i,r)}return !0},getJsxClosingTagAtPosition:function(t,r){var n=_.getCurrentSourceFile(t),i=e.findPrecedingToken(r,n);if(i){var a=31===i.kind&&e.isJsxOpeningElement(i.parent)?i.parent.parent:e.isJsxText(i)&&e.isJsxElement(i.parent)?i.parent:void 0;if(a&&B(a))return {newText:"</".concat(a.openingElement.tagName.getText(n),">")};var o=31===i.kind&&e.isJsxOpeningFragment(i.parent)?i.parent.parent:e.isJsxText(i)&&e.isJsxFragment(i.parent)?i.parent:void 0;return o&&j(o)?{newText:"</>"}:void 0}},getSpanOfEnclosingComment:function(t,r,n){var i=_.getCurrentSourceFile(t),a=e.formatting.getRangeOfEnclosingComment(i,r);return !a||n&&3!==a.kind?void 0:e.createTextSpanFromRange(a)},getCodeFixesAtPosition:function(r,n,i,a,o,s){void 0===s&&(s=e.emptyOptions),x();var c=h(r),u=e.createTextSpanFromBounds(n,i),_=e.formatting.getFormatContext(o,t);return e.flatMap(e.deduplicate(a,e.equateValues,e.compareValues),(function(r){return p.throwIfCancellationRequested(),e.codefix.getFixes({errorCode:r,sourceFile:c,span:u,program:l,host:t,cancellationToken:p,formatContext:_,preferences:s})}))},getCombinedCodeFix:function(r,n,i,a){void 0===a&&(a=e.emptyOptions),x(),e.Debug.assert("file"===r.type);var o=h(r.fileName),s=e.formatting.getFormatContext(i,t);return e.codefix.getAllFixes({fixId:n,sourceFile:o,program:l,host:t,cancellationToken:p,formatContext:s,preferences:a})},applyCodeActionCommand:function(t,r){var n="string"==typeof t?r:t;return e.isArray(n)?Promise.all(n.map((function(e){return O(e)}))):O(n)},organizeImports:function(r,n,i){void 0===i&&(i=e.emptyOptions),x(),e.Debug.assert("file"===r.type);var a=h(r.fileName),o=e.formatting.getFormatContext(n,t);return e.OrganizeImports.organizeImports(a,o,t,l,i,r.skipDestructiveCodeActions)},getEditsForFileRename:function(r,n,i,a){return void 0===a&&(a=e.emptyOptions),e.getEditsForFileRename(T(),r,n,t,e.formatting.getFormatContext(i,t),a,v)},getEmitOutput:function(r,n,i){x();var a=h(r),o=t.getCustomTransformers&&t.getCustomTransformers();return e.getFileEmitOutput(l,a,!!n,p,o,i)},getNonBoundSourceFile:function(e){return _.getCurrentSourceFile(e)},getProgram:T,getAutoImportProvider:function(){var e;return null===(e=t.getPackageJsonAutoImportProvider)||void 0===e?void 0:e.call(t)},getApplicableRefactors:function(t,r,n,i,a){void 0===n&&(n=e.emptyOptions),x();var o=h(t);return e.refactor.getApplicableRefactors(J(o,r,n,e.emptyOptions,i,a))},getEditsForRefactor:function(t,r,n,i,a,o){void 0===o&&(o=e.emptyOptions),x();var s=h(t);return e.refactor.getEditsForRefactor(J(s,n,o,r),i,a)},toLineColumnOffset:function(e,t){return 0===t?{line:0,character:0}:v.toLineColumnOffset(e,t)},getSourceMapper:function(){return v},clearSourceMapperCache:function(){return v.clearCache()},prepareCallHierarchy:function(t,r){x();var n=e.CallHierarchy.resolveCallHierarchyDeclaration(l,e.getTouchingPropertyName(h(t),r));return n&&e.mapOneOrMany(n,(function(t){return e.CallHierarchy.createCallHierarchyItem(l,t)}))},provideCallHierarchyIncomingCalls:function(t,r){x();var n=h(t),i=e.firstOrOnly(e.CallHierarchy.resolveCallHierarchyDeclaration(l,0===r?n:e.getTouchingPropertyName(n,r)));return i?e.CallHierarchy.getIncomingCalls(l,i,p):[]},provideCallHierarchyOutgoingCalls:function(t,r){x();var n=h(t),i=e.firstOrOnly(e.CallHierarchy.resolveCallHierarchyDeclaration(l,0===r?n:e.getTouchingPropertyName(n,r)));return i?e.CallHierarchy.getOutgoingCalls(l,i):[]},toggleLineComment:L,toggleMultilineComment:R,commentSelection:function(e,t){var r=M(_.getCurrentSourceFile(e),t);return r.firstLine===r.lastLine&&t.pos!==t.end?R(e,t,!0):L(e,t,!0)},uncommentSelection:function(t,r){var n=_.getCurrentSourceFile(t),i=[],a=r.pos,o=r.end;a===o&&(o+=e.isInsideJsxElement(n,a)?2:1);for(var s=a;s<=o;s++){var c=e.isInComment(n,s);if(c){switch(c.kind){case 2:i.push.apply(i,L(t,{end:c.end,pos:c.pos+1},!1));break;case 3:i.push.apply(i,R(t,{end:c.end,pos:c.pos+1},!1));}s=c.end+1;}}return i},provideInlayHints:function(r,n,i){void 0===i&&(i=e.emptyOptions),x();var a=h(r);return e.InlayHints.provideInlayHints(function(e,r,n){return {file:e,program:T(),host:t,span:r,preferences:n,cancellationToken:p}}(a,n,i))}};switch(c){case e.LanguageServiceMode.Semantic:break;case e.LanguageServiceMode.PartialSemantic:A.forEach((function(e){return z[e]=function(){throw new Error("LanguageService Operation: ".concat(e," not allowed in LanguageServiceMode.PartialSemantic"))}}));break;case e.LanguageServiceMode.Syntactic:P.forEach((function(e){return z[e]=function(){throw new Error("LanguageService Operation: ".concat(e," not allowed in LanguageServiceMode.Syntactic"))}}));break;default:e.Debug.assertNever(c);}return z},e.getNameTable=function(t){return t.nameTable||function(t){var r=t.nameTable=new e.Map;t.forEachChild((function t(n){if(e.isIdentifier(n)&&!e.isTagName(n)&&n.escapedText||e.isStringOrNumericLiteralLike(n)&&function(t){return e.isDeclarationName(t)||277===t.parent.kind||function(e){return e&&e.parent&&207===e.parent.kind&&e.parent.argumentExpression===e}(t)||e.isLiteralComputedPropertyDeclarationName(t)}(n)){var i=e.getEscapedTextOfIdentifierOrLiteral(n);r.set(i,void 0===r.get(i)?n.pos:-1);}else e.isPrivateIdentifier(n)&&(i=n.escapedText,r.set(i,void 0===r.get(i)?n.pos:-1));if(e.forEachChild(n,t),e.hasJSDocNodes(n))for(var a=0,o=n.jsDoc;a<o.length;a++){var s=o[a];e.forEachChild(s,t);}}));}(t),t.nameTable},e.getContainingObjectLiteralElement=w,e.getPropertySymbolsFromContextualType=I,e.setObjectAllocator({getNodeConstructor:function(){return r},getTokenConstructor:function(){return l},getIdentifierConstructor:function(){return u},getPrivateIdentifierConstructor:function(){return _},getSourceFileConstructor:function(){return v},getSymbolConstructor:function(){return s},getTypeConstructor:function(){return d},getSignatureConstructor:function(){return p},getSourceMapSourceConstructor:function(){return h}});}(t),function(e){(e.BreakpointResolver||(e.BreakpointResolver={})).spanInSourceFileAtLocation=function(t,r){if(!t.isDeclarationFile){var n=e.getTokenAtPosition(t,r),i=t.getLineAndCharacterOfPosition(r).line;if(t.getLineAndCharacterOfPosition(n.getStart(t)).line>i){var a=e.findPrecedingToken(n.pos,t);if(!a||t.getLineAndCharacterOfPosition(a.getEnd()).line!==i)return;n=a;}if(!(16777216&n.flags))return _(n)}function o(r,n){var i=r.decorators?e.skipTrivia(t.text,r.decorators.end):r.getStart(t);return e.createTextSpanFromBounds(i,(n||r).getEnd())}function s(r,n){return o(r,e.findNextToken(n,n.parent,t))}function c(e,r){return e&&i===t.getLineAndCharacterOfPosition(e.getStart(t)).line?_(e):_(r)}function l(r){return _(e.findPrecedingToken(r.pos,t))}function u(r){return _(e.findNextToken(r,r.parent,t))}function _(r){if(r){var n=r.parent;switch(r.kind){case 237:return x(r.declarationList.declarations[0]);case 254:case 167:case 166:return x(r);case 164:return function t(r){if(e.isBindingPattern(r.name))return C(r.name);if(function(t){return !!t.initializer||void 0!==t.dotDotDotToken||e.hasSyntacticModifier(t,12)}(r))return o(r);var n=r.parent,i=n.parameters.indexOf(r);return e.Debug.assert(-1!==i),0!==i?t(n.parameters[i-1]):_(n.body)}(r);case 256:case 169:case 168:case 172:case 173:case 171:case 213:case 214:return function(e){if(e.body)return D(e)?o(e):_(e.body)}(r);case 235:if(e.isFunctionBlock(r))return v=(y=r).statements.length?y.statements[0]:y.getLastToken(),D(y.parent)?c(y.parent,v):_(v);case 262:return S(r);case 292:return S(r.block);case 238:return o(r.expression);case 247:return o(r.getChildAt(0),r.expression);case 241:return s(r,r.expression);case 240:return _(r.statement);case 253:return o(r.getChildAt(0));case 239:return s(r,r.expression);case 250:return _(r.statement);case 246:case 245:return o(r.getChildAt(0),r.label);case 242:return (m=r).initializer?T(m):m.condition?o(m.condition):m.incrementor?o(m.incrementor):void 0;case 243:return s(r,r.expression);case 244:return T(r);case 249:return s(r,r.expression);case 289:case 290:return _(r.statements[0]);case 252:return S(r.tryBlock);case 251:case 271:return o(r,r.expression);case 265:return o(r,r.moduleReference);case 266:case 272:return o(r,r.moduleSpecifier);case 261:if(1!==e.getModuleInstanceState(r))return;case 257:case 260:case 299:case 203:return o(r);case 248:return _(r.statement);case 165:return h=n.decorators,e.createTextSpanFromBounds(e.skipTrivia(t.text,h.pos),h.end);case 201:case 202:return C(r);case 258:case 259:return;case 26:case 1:return c(e.findPrecedingToken(r.pos,t));case 27:return l(r);case 18:return function(r){switch(r.parent.kind){case 260:var n=r.parent;return c(e.findPrecedingToken(r.pos,t,r.parent),n.members.length?n.members[0]:n.getLastToken(t));case 257:var i=r.parent;return c(e.findPrecedingToken(r.pos,t,r.parent),i.members.length?i.members[0]:i.getLastToken(t));case 263:return c(r.parent.parent,r.parent.clauses[0])}return _(r.parent)}(r);case 19:return function(t){switch(t.parent.kind){case 262:if(1!==e.getModuleInstanceState(t.parent.parent))return;case 260:case 257:return o(t);case 235:if(e.isFunctionBlock(t.parent))return o(t);case 292:return _(e.lastOrUndefined(t.parent.statements));case 263:var r=t.parent,n=e.lastOrUndefined(r.clauses);return n?_(e.lastOrUndefined(n.statements)):void 0;case 201:var i=t.parent;return _(e.lastOrUndefined(i.elements)||i);default:if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(t.parent)){var a=t.parent;return o(e.lastOrUndefined(a.properties)||a)}return _(t.parent)}}(r);case 23:return function(t){switch(t.parent.kind){case 202:var r=t.parent;return o(e.lastOrUndefined(r.elements)||r);default:if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(t.parent)){var n=t.parent;return o(e.lastOrUndefined(n.elements)||n)}return _(t.parent)}}(r);case 20:return function(e){return 240===e.parent.kind||208===e.parent.kind||209===e.parent.kind?l(e):212===e.parent.kind?u(e):_(e.parent)}(r);case 21:return function(e){switch(e.parent.kind){case 213:case 256:case 214:case 169:case 168:case 172:case 173:case 171:case 241:case 240:case 242:case 244:case 208:case 209:case 212:return l(e);default:return _(e.parent)}}(r);case 58:return function(t){return e.isFunctionLike(t.parent)||296===t.parent.kind||164===t.parent.kind?l(t):_(t.parent)}(r);case 31:case 29:return function(e){return 211===e.parent.kind?u(e):_(e.parent)}(r);case 115:return function(e){return 240===e.parent.kind?s(e,e.parent.expression):_(e.parent)}(r);case 91:case 83:case 96:return u(r);case 160:return function(e){return 244===e.parent.kind?u(e):_(e.parent)}(r);default:if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(r))return k(r);if((79===r.kind||225===r.kind||296===r.kind||297===r.kind)&&e.isArrayLiteralOrObjectLiteralDestructuringPattern(n))return o(r);if(221===r.kind){var i=r,a=i.left,d=i.operatorToken;if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(a))return k(a);if(63===d.kind&&e.isArrayLiteralOrObjectLiteralDestructuringPattern(r.parent))return o(r);if(27===d.kind)return _(a)}if(e.isExpressionNode(r))switch(n.kind){case 240:return l(r);case 165:return _(r.parent);case 242:case 244:return o(r);case 221:if(27===r.parent.operatorToken.kind)return o(r);break;case 214:if(r.parent.body===r)return o(r)}switch(r.parent.kind){case 296:if(r.parent.name===r&&!e.isArrayLiteralOrObjectLiteralDestructuringPattern(r.parent.parent))return _(r.parent.initializer);break;case 211:if(r.parent.type===r)return u(r.parent.type);break;case 254:case 164:var p=r.parent,f=p.initializer,g=p.type;if(f===r||g===r||e.isAssignmentOperator(r.kind))return l(r);break;case 221:if(a=r.parent.left,e.isArrayLiteralOrObjectLiteralDestructuringPattern(a)&&r!==a)return l(r);break;default:if(e.isFunctionLike(r.parent)&&r.parent.type===r)return l(r)}return _(r.parent)}}var m,y,v,h;function b(r){return e.isVariableDeclarationList(r.parent)&&r.parent.declarations[0]===r?o(e.findPrecedingToken(r.pos,t,r.parent),r):o(r)}function x(r){if(243===r.parent.parent.kind)return _(r.parent.parent);var n=r.parent;return e.isBindingPattern(r.name)?C(r.name):r.initializer||e.hasSyntacticModifier(r,1)||244===n.parent.kind?b(r):e.isVariableDeclarationList(r.parent)&&r.parent.declarations[0]!==r?_(e.findPrecedingToken(r.pos,t,r.parent)):void 0}function D(t){return e.hasSyntacticModifier(t,1)||257===t.parent.kind&&171!==t.kind}function S(r){switch(r.parent.kind){case 261:if(1!==e.getModuleInstanceState(r.parent))return;case 241:case 239:case 243:return c(r.parent,r.statements[0]);case 242:case 244:return c(e.findPrecedingToken(r.pos,t,r.parent),r.statements[0])}return _(r.statements[0])}function T(e){if(255!==e.initializer.kind)return _(e.initializer);var t=e.initializer;return t.declarations.length>0?_(t.declarations[0]):void 0}function C(t){var r=e.forEach(t.elements,(function(e){return 227!==e.kind?e:void 0}));return r?_(r):203===t.parent.kind?o(t.parent):b(t.parent)}function k(t){e.Debug.assert(202!==t.kind&&201!==t.kind);var r=204===t.kind?t.elements:t.properties,n=e.forEach(r,(function(e){return 227!==e.kind?e:void 0}));return n?_(n):o(221===t.parent.kind?t.parent:t)}}};}(t),function(e){e.transform=function(t,r,n){var i=[];n=e.fixupCompilerOptions(n,i);var a=e.isArray(t)?t:[t],o=e.transformNodes(void 0,void 0,e.factory,n,a,r,!0);return o.diagnostics=e.concatenate(o.diagnostics,i),o};}(t);var l=function(){return this}();!function(e){function t(e,t){e&&e.log("*INTERNAL ERROR* - Exception in typescript services: "+t.message);}var r=function(){function t(e){this.scriptSnapshotShim=e;}return t.prototype.getText=function(e,t){return this.scriptSnapshotShim.getText(e,t)},t.prototype.getLength=function(){return this.scriptSnapshotShim.getLength()},t.prototype.getChangeRange=function(t){var r=t,n=this.scriptSnapshotShim.getChangeRange(r.scriptSnapshotShim);if(null===n)return null;var i=JSON.parse(n);return e.createTextChangeRange(e.createTextSpan(i.span.start,i.span.length),i.newLength)},t.prototype.dispose=function(){"dispose"in this.scriptSnapshotShim&&this.scriptSnapshotShim.dispose();},t}(),a=function(){function t(t){var r=this;this.shimHost=t,this.loggingEnabled=!1,this.tracingEnabled=!1,"getModuleResolutionsForFile"in this.shimHost&&(this.resolveModuleNames=function(t,n){var i=JSON.parse(r.shimHost.getModuleResolutionsForFile(n));return e.map(t,(function(t){var r=e.getProperty(i,t);return r?{resolvedFileName:r,extension:e.extensionFromPath(r),isExternalLibraryImport:!1}:void 0}))}),"directoryExists"in this.shimHost&&(this.directoryExists=function(e){return r.shimHost.directoryExists(e)}),"getTypeReferenceDirectiveResolutionsForFile"in this.shimHost&&(this.resolveTypeReferenceDirectives=function(t,n){var i=JSON.parse(r.shimHost.getTypeReferenceDirectiveResolutionsForFile(n));return e.map(t,(function(t){return e.getProperty(i,e.isString(t)?t:t.fileName.toLowerCase())}))});}return t.prototype.log=function(e){this.loggingEnabled&&this.shimHost.log(e);},t.prototype.trace=function(e){this.tracingEnabled&&this.shimHost.trace(e);},t.prototype.error=function(e){this.shimHost.error(e);},t.prototype.getProjectVersion=function(){if(this.shimHost.getProjectVersion)return this.shimHost.getProjectVersion()},t.prototype.getTypeRootsVersion=function(){return this.shimHost.getTypeRootsVersion?this.shimHost.getTypeRootsVersion():0},t.prototype.useCaseSensitiveFileNames=function(){return !!this.shimHost.useCaseSensitiveFileNames&&this.shimHost.useCaseSensitiveFileNames()},t.prototype.getCompilationSettings=function(){var e=this.shimHost.getCompilationSettings();if(null===e||""===e)throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");var t=JSON.parse(e);return t.allowNonTsExtensions=!0,t},t.prototype.getScriptFileNames=function(){var e=this.shimHost.getScriptFileNames();return JSON.parse(e)},t.prototype.getScriptSnapshot=function(e){var t=this.shimHost.getScriptSnapshot(e);return t&&new r(t)},t.prototype.getScriptKind=function(e){return "getScriptKind"in this.shimHost?this.shimHost.getScriptKind(e):0},t.prototype.getScriptVersion=function(e){return this.shimHost.getScriptVersion(e)},t.prototype.getLocalizedDiagnosticMessages=function(){var e=this.shimHost.getLocalizedDiagnosticMessages();if(null===e||""===e)return null;try{return JSON.parse(e)}catch(e){return this.log(e.description||"diagnosticMessages.generated.json has invalid JSON format"),null}},t.prototype.getCancellationToken=function(){var t=this.shimHost.getCancellationToken();return new e.ThrottledCancellationToken(t)},t.prototype.getCurrentDirectory=function(){return this.shimHost.getCurrentDirectory()},t.prototype.getDirectories=function(e){return JSON.parse(this.shimHost.getDirectories(e))},t.prototype.getDefaultLibFileName=function(e){return this.shimHost.getDefaultLibFileName(JSON.stringify(e))},t.prototype.readDirectory=function(t,r,n,i,a){var o=e.getFileMatcherPatterns(t,n,i,this.shimHost.useCaseSensitiveFileNames(),this.shimHost.getCurrentDirectory());return JSON.parse(this.shimHost.readDirectory(t,JSON.stringify(r),JSON.stringify(o.basePaths),o.excludePattern,o.includeFilePattern,o.includeDirectoryPattern,a))},t.prototype.readFile=function(e,t){return this.shimHost.readFile(e,t)},t.prototype.fileExists=function(e){return this.shimHost.fileExists(e)},t}();e.LanguageServiceShimHostAdapter=a;var o=function(){function t(e){var t=this;this.shimHost=e,this.useCaseSensitiveFileNames=!!this.shimHost.useCaseSensitiveFileNames&&this.shimHost.useCaseSensitiveFileNames(),"directoryExists"in this.shimHost?this.directoryExists=function(e){return t.shimHost.directoryExists(e)}:this.directoryExists=void 0,"realpath"in this.shimHost?this.realpath=function(e){return t.shimHost.realpath(e)}:this.realpath=void 0;}return t.prototype.readDirectory=function(t,r,n,i,a){var o=e.getFileMatcherPatterns(t,n,i,this.shimHost.useCaseSensitiveFileNames(),this.shimHost.getCurrentDirectory());return JSON.parse(this.shimHost.readDirectory(t,JSON.stringify(r),JSON.stringify(o.basePaths),o.excludePattern,o.includeFilePattern,o.includeDirectoryPattern,a))},t.prototype.fileExists=function(e){return this.shimHost.fileExists(e)},t.prototype.readFile=function(e){return this.shimHost.readFile(e)},t.prototype.getDirectories=function(e){return JSON.parse(this.shimHost.getDirectories(e))},t}();function u(e,t,r,n){return _(e,t,!0,r,n)}function _(r,n,i,a,o){try{var s=function(t,r,n,i){var a;i&&(t.log(r),a=e.timestamp());var o=n();if(i){var s=e.timestamp();if(t.log("".concat(r," completed in ").concat(s-a," msec")),e.isString(o)){var c=o;c.length>128&&(c=c.substring(0,128)+"..."),t.log(" result.length=".concat(c.length,", result='").concat(JSON.stringify(c),"'"));}}return o}(r,n,a,o);return i?JSON.stringify({result:s}):s}catch(i){return i instanceof e.OperationCanceledException?JSON.stringify({canceled:!0}):(t(r,i),i.description=n,JSON.stringify({error:i}))}}e.CoreServicesShimHostAdapter=o;var d=function(){function e(e){this.factory=e,e.registerShim(this);}return e.prototype.dispose=function(e){this.factory.unregisterShim(this);},e}();function p(t,r){return t.map((function(t){return function(t,r){return {message:e.flattenDiagnosticMessageText(t.messageText,r),start:t.start,length:t.length,category:e.diagnosticCategoryName(t),code:t.code,reportsUnnecessary:t.reportsUnnecessary,reportsDeprecated:t.reportsDeprecated}}(t,r)}))}e.realizeDiagnostics=p;var f=function(t){function r(e,r,n){var i=t.call(this,e)||this;return i.host=r,i.languageService=n,i.logPerformance=!1,i.logger=i.host,i}return c(r,t),r.prototype.forwardJSONCall=function(e,t){return u(this.logger,e,t,this.logPerformance)},r.prototype.dispose=function(e){this.logger.log("dispose()"),this.languageService.dispose(),this.languageService=null,l&&l.CollectGarbage&&(l.CollectGarbage(),this.logger.log("CollectGarbage()")),this.logger=null,t.prototype.dispose.call(this,e);},r.prototype.refresh=function(e){this.forwardJSONCall("refresh(".concat(e,")"),(function(){return null}));},r.prototype.cleanupSemanticCache=function(){var e=this;this.forwardJSONCall("cleanupSemanticCache()",(function(){return e.languageService.cleanupSemanticCache(),null}));},r.prototype.realizeDiagnostics=function(t){return p(t,e.getNewLineOrDefaultFromHost(this.host))},r.prototype.getSyntacticClassifications=function(t,r,n){var i=this;return this.forwardJSONCall("getSyntacticClassifications('".concat(t,"', ").concat(r,", ").concat(n,")"),(function(){return i.languageService.getSyntacticClassifications(t,e.createTextSpan(r,n))}))},r.prototype.getSemanticClassifications=function(t,r,n){var i=this;return this.forwardJSONCall("getSemanticClassifications('".concat(t,"', ").concat(r,", ").concat(n,")"),(function(){return i.languageService.getSemanticClassifications(t,e.createTextSpan(r,n))}))},r.prototype.getEncodedSyntacticClassifications=function(t,r,n){var i=this;return this.forwardJSONCall("getEncodedSyntacticClassifications('".concat(t,"', ").concat(r,", ").concat(n,")"),(function(){return g(i.languageService.getEncodedSyntacticClassifications(t,e.createTextSpan(r,n)))}))},r.prototype.getEncodedSemanticClassifications=function(t,r,n){var i=this;return this.forwardJSONCall("getEncodedSemanticClassifications('".concat(t,"', ").concat(r,", ").concat(n,")"),(function(){return g(i.languageService.getEncodedSemanticClassifications(t,e.createTextSpan(r,n)))}))},r.prototype.getSyntacticDiagnostics=function(e){var t=this;return this.forwardJSONCall("getSyntacticDiagnostics('".concat(e,"')"),(function(){var r=t.languageService.getSyntacticDiagnostics(e);return t.realizeDiagnostics(r)}))},r.prototype.getSemanticDiagnostics=function(e){var t=this;return this.forwardJSONCall("getSemanticDiagnostics('".concat(e,"')"),(function(){var r=t.languageService.getSemanticDiagnostics(e);return t.realizeDiagnostics(r)}))},r.prototype.getSuggestionDiagnostics=function(e){var t=this;return this.forwardJSONCall("getSuggestionDiagnostics('".concat(e,"')"),(function(){return t.realizeDiagnostics(t.languageService.getSuggestionDiagnostics(e))}))},r.prototype.getCompilerOptionsDiagnostics=function(){var e=this;return this.forwardJSONCall("getCompilerOptionsDiagnostics()",(function(){var t=e.languageService.getCompilerOptionsDiagnostics();return e.realizeDiagnostics(t)}))},r.prototype.getQuickInfoAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getQuickInfoAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getQuickInfoAtPosition(e,t)}))},r.prototype.getNameOrDottedNameSpan=function(e,t,r){var n=this;return this.forwardJSONCall("getNameOrDottedNameSpan('".concat(e,"', ").concat(t,", ").concat(r,")"),(function(){return n.languageService.getNameOrDottedNameSpan(e,t,r)}))},r.prototype.getBreakpointStatementAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getBreakpointStatementAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getBreakpointStatementAtPosition(e,t)}))},r.prototype.getSignatureHelpItems=function(e,t,r){var n=this;return this.forwardJSONCall("getSignatureHelpItems('".concat(e,"', ").concat(t,")"),(function(){return n.languageService.getSignatureHelpItems(e,t,r)}))},r.prototype.getDefinitionAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getDefinitionAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getDefinitionAtPosition(e,t)}))},r.prototype.getDefinitionAndBoundSpan=function(e,t){var r=this;return this.forwardJSONCall("getDefinitionAndBoundSpan('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getDefinitionAndBoundSpan(e,t)}))},r.prototype.getTypeDefinitionAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getTypeDefinitionAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getTypeDefinitionAtPosition(e,t)}))},r.prototype.getImplementationAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getImplementationAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getImplementationAtPosition(e,t)}))},r.prototype.getRenameInfo=function(e,t,r){var n=this;return this.forwardJSONCall("getRenameInfo('".concat(e,"', ").concat(t,")"),(function(){return n.languageService.getRenameInfo(e,t,r)}))},r.prototype.getSmartSelectionRange=function(e,t){var r=this;return this.forwardJSONCall("getSmartSelectionRange('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getSmartSelectionRange(e,t)}))},r.prototype.findRenameLocations=function(e,t,r,n,i){var a=this;return this.forwardJSONCall("findRenameLocations('".concat(e,"', ").concat(t,", ").concat(r,", ").concat(n,", ").concat(i,")"),(function(){return a.languageService.findRenameLocations(e,t,r,n,i)}))},r.prototype.getBraceMatchingAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getBraceMatchingAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getBraceMatchingAtPosition(e,t)}))},r.prototype.isValidBraceCompletionAtPosition=function(e,t,r){var n=this;return this.forwardJSONCall("isValidBraceCompletionAtPosition('".concat(e,"', ").concat(t,", ").concat(r,")"),(function(){return n.languageService.isValidBraceCompletionAtPosition(e,t,r)}))},r.prototype.getSpanOfEnclosingComment=function(e,t,r){var n=this;return this.forwardJSONCall("getSpanOfEnclosingComment('".concat(e,"', ").concat(t,")"),(function(){return n.languageService.getSpanOfEnclosingComment(e,t,r)}))},r.prototype.getIndentationAtPosition=function(e,t,r){var n=this;return this.forwardJSONCall("getIndentationAtPosition('".concat(e,"', ").concat(t,")"),(function(){var i=JSON.parse(r);return n.languageService.getIndentationAtPosition(e,t,i)}))},r.prototype.getReferencesAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getReferencesAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getReferencesAtPosition(e,t)}))},r.prototype.findReferences=function(e,t){var r=this;return this.forwardJSONCall("findReferences('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.findReferences(e,t)}))},r.prototype.getFileReferences=function(e){var t=this;return this.forwardJSONCall("getFileReferences('".concat(e,")"),(function(){return t.languageService.getFileReferences(e)}))},r.prototype.getOccurrencesAtPosition=function(e,t){var r=this;return this.forwardJSONCall("getOccurrencesAtPosition('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.getOccurrencesAtPosition(e,t)}))},r.prototype.getDocumentHighlights=function(t,r,n){var i=this;return this.forwardJSONCall("getDocumentHighlights('".concat(t,"', ").concat(r,")"),(function(){var a=i.languageService.getDocumentHighlights(t,r,JSON.parse(n)),o=e.toFileNameLowerCase(e.normalizeSlashes(t));return e.filter(a,(function(t){return e.toFileNameLowerCase(e.normalizeSlashes(t.fileName))===o}))}))},r.prototype.getCompletionsAtPosition=function(e,t,r,n){var i=this;return this.forwardJSONCall("getCompletionsAtPosition('".concat(e,"', ").concat(t,", ").concat(r,", ").concat(n,")"),(function(){return i.languageService.getCompletionsAtPosition(e,t,r,n)}))},r.prototype.getCompletionEntryDetails=function(e,t,r,n,i,a,o){var s=this;return this.forwardJSONCall("getCompletionEntryDetails('".concat(e,"', ").concat(t,", '").concat(r,"')"),(function(){var c=void 0===n?void 0:JSON.parse(n);return s.languageService.getCompletionEntryDetails(e,t,r,c,i,a,o)}))},r.prototype.getFormattingEditsForRange=function(e,t,r,n){var i=this;return this.forwardJSONCall("getFormattingEditsForRange('".concat(e,"', ").concat(t,", ").concat(r,")"),(function(){var a=JSON.parse(n);return i.languageService.getFormattingEditsForRange(e,t,r,a)}))},r.prototype.getFormattingEditsForDocument=function(e,t){var r=this;return this.forwardJSONCall("getFormattingEditsForDocument('".concat(e,"')"),(function(){var n=JSON.parse(t);return r.languageService.getFormattingEditsForDocument(e,n)}))},r.prototype.getFormattingEditsAfterKeystroke=function(e,t,r,n){var i=this;return this.forwardJSONCall("getFormattingEditsAfterKeystroke('".concat(e,"', ").concat(t,", '").concat(r,"')"),(function(){var a=JSON.parse(n);return i.languageService.getFormattingEditsAfterKeystroke(e,t,r,a)}))},r.prototype.getDocCommentTemplateAtPosition=function(e,t,r){var n=this;return this.forwardJSONCall("getDocCommentTemplateAtPosition('".concat(e,"', ").concat(t,")"),(function(){return n.languageService.getDocCommentTemplateAtPosition(e,t,r)}))},r.prototype.getNavigateToItems=function(e,t,r){var n=this;return this.forwardJSONCall("getNavigateToItems('".concat(e,"', ").concat(t,", ").concat(r,")"),(function(){return n.languageService.getNavigateToItems(e,t,r)}))},r.prototype.getNavigationBarItems=function(e){var t=this;return this.forwardJSONCall("getNavigationBarItems('".concat(e,"')"),(function(){return t.languageService.getNavigationBarItems(e)}))},r.prototype.getNavigationTree=function(e){var t=this;return this.forwardJSONCall("getNavigationTree('".concat(e,"')"),(function(){return t.languageService.getNavigationTree(e)}))},r.prototype.getOutliningSpans=function(e){var t=this;return this.forwardJSONCall("getOutliningSpans('".concat(e,"')"),(function(){return t.languageService.getOutliningSpans(e)}))},r.prototype.getTodoComments=function(e,t){var r=this;return this.forwardJSONCall("getTodoComments('".concat(e,"')"),(function(){return r.languageService.getTodoComments(e,JSON.parse(t))}))},r.prototype.prepareCallHierarchy=function(e,t){var r=this;return this.forwardJSONCall("prepareCallHierarchy('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.prepareCallHierarchy(e,t)}))},r.prototype.provideCallHierarchyIncomingCalls=function(e,t){var r=this;return this.forwardJSONCall("provideCallHierarchyIncomingCalls('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.provideCallHierarchyIncomingCalls(e,t)}))},r.prototype.provideCallHierarchyOutgoingCalls=function(e,t){var r=this;return this.forwardJSONCall("provideCallHierarchyOutgoingCalls('".concat(e,"', ").concat(t,")"),(function(){return r.languageService.provideCallHierarchyOutgoingCalls(e,t)}))},r.prototype.provideInlayHints=function(e,t,r){var n=this;return this.forwardJSONCall("provideInlayHints('".concat(e,"', '").concat(JSON.stringify(t),"', ").concat(JSON.stringify(r),")"),(function(){return n.languageService.provideInlayHints(e,t,r)}))},r.prototype.getEmitOutput=function(e){var t=this;return this.forwardJSONCall("getEmitOutput('".concat(e,"')"),(function(){var r=t.languageService.getEmitOutput(e),n=r.diagnostics,a=s(r,["diagnostics"]);return i$1(i$1({},a),{diagnostics:t.realizeDiagnostics(n)})}))},r.prototype.getEmitOutputObject=function(e){var t=this;return _(this.logger,"getEmitOutput('".concat(e,"')"),!1,(function(){return t.languageService.getEmitOutput(e)}),this.logPerformance)},r.prototype.toggleLineComment=function(e,t){var r=this;return this.forwardJSONCall("toggleLineComment('".concat(e,"', '").concat(JSON.stringify(t),"')"),(function(){return r.languageService.toggleLineComment(e,t)}))},r.prototype.toggleMultilineComment=function(e,t){var r=this;return this.forwardJSONCall("toggleMultilineComment('".concat(e,"', '").concat(JSON.stringify(t),"')"),(function(){return r.languageService.toggleMultilineComment(e,t)}))},r.prototype.commentSelection=function(e,t){var r=this;return this.forwardJSONCall("commentSelection('".concat(e,"', '").concat(JSON.stringify(t),"')"),(function(){return r.languageService.commentSelection(e,t)}))},r.prototype.uncommentSelection=function(e,t){var r=this;return this.forwardJSONCall("uncommentSelection('".concat(e,"', '").concat(JSON.stringify(t),"')"),(function(){return r.languageService.uncommentSelection(e,t)}))},r}(d);function g(e){return {spans:e.spans.join(","),endOfLineState:e.endOfLineState}}var m=function(t){function r(r,n){var i=t.call(this,r)||this;return i.logger=n,i.logPerformance=!1,i.classifier=e.createClassifier(),i}return c(r,t),r.prototype.getEncodedLexicalClassifications=function(e,t,r){var n=this;return void 0===r&&(r=!1),u(this.logger,"getEncodedLexicalClassifications",(function(){return g(n.classifier.getEncodedLexicalClassifications(e,t,r))}),this.logPerformance)},r.prototype.getClassificationsForLine=function(e,t,r){void 0===r&&(r=!1);for(var n=this.classifier.getClassificationsForLine(e,t,r),i="",a=0,o=n.entries;a<o.length;a++){var s=o[a];i+=s.length+"\n",i+=s.classification+"\n";}return i+n.finalLexState},r}(d),y=function(t){function r(e,r,n){var i=t.call(this,e)||this;return i.logger=r,i.host=n,i.logPerformance=!1,i}return c(r,t),r.prototype.forwardJSONCall=function(e,t){return u(this.logger,e,t,this.logPerformance)},r.prototype.resolveModuleName=function(t,r,n){var i=this;return this.forwardJSONCall("resolveModuleName('".concat(t,"')"),(function(){var a=JSON.parse(n),o=e.resolveModuleName(r,e.normalizeSlashes(t),a,i.host),s=o.resolvedModule?o.resolvedModule.resolvedFileName:void 0;return o.resolvedModule&&".ts"!==o.resolvedModule.extension&&".tsx"!==o.resolvedModule.extension&&".d.ts"!==o.resolvedModule.extension&&(s=void 0),{resolvedFileName:s,failedLookupLocations:o.failedLookupLocations}}))},r.prototype.resolveTypeReferenceDirective=function(t,r,n){var i=this;return this.forwardJSONCall("resolveTypeReferenceDirective(".concat(t,")"),(function(){var a=JSON.parse(n),o=e.resolveTypeReferenceDirective(r,e.normalizeSlashes(t),a,i.host);return {resolvedFileName:o.resolvedTypeReferenceDirective?o.resolvedTypeReferenceDirective.resolvedFileName:void 0,primary:!o.resolvedTypeReferenceDirective||o.resolvedTypeReferenceDirective.primary,failedLookupLocations:o.failedLookupLocations}}))},r.prototype.getPreProcessedFileInfo=function(t,r){var n=this;return this.forwardJSONCall("getPreProcessedFileInfo('".concat(t,"')"),(function(){var t=e.preProcessFile(e.getSnapshotText(r),!0,!0);return {referencedFiles:n.convertFileReferences(t.referencedFiles),importedFiles:n.convertFileReferences(t.importedFiles),ambientExternalModules:t.ambientExternalModules,isLibFile:t.isLibFile,typeReferenceDirectives:n.convertFileReferences(t.typeReferenceDirectives),libReferenceDirectives:n.convertFileReferences(t.libReferenceDirectives)}}))},r.prototype.getAutomaticTypeDirectiveNames=function(t){var r=this;return this.forwardJSONCall("getAutomaticTypeDirectiveNames('".concat(t,"')"),(function(){var n=JSON.parse(t);return e.getAutomaticTypeDirectiveNames(n,r.host)}))},r.prototype.convertFileReferences=function(t){if(t){for(var r=[],n=0,i=t;n<i.length;n++){var a=i[n];r.push({path:e.normalizeSlashes(a.fileName),position:a.pos,length:a.end-a.pos});}return r}},r.prototype.getTSConfigFileInfo=function(t,r){var i=this;return this.forwardJSONCall("getTSConfigFileInfo('".concat(t,"')"),(function(){var a=e.parseJsonText(t,e.getSnapshotText(r)),o=e.normalizeSlashes(t),s=e.parseJsonSourceFileConfigFileContent(a,i.host,e.getDirectoryPath(o),{},o);return {options:s.options,typeAcquisition:s.typeAcquisition,files:s.fileNames,raw:s.raw,errors:p(n$4(n$4([],a.parseDiagnostics,!0),s.errors,!0),"\r\n")}}))},r.prototype.getDefaultCompilationSettings=function(){return this.forwardJSONCall("getDefaultCompilationSettings()",(function(){return e.getDefaultCompilerOptions()}))},r.prototype.discoverTypings=function(t){var r=this,n=e.createGetCanonicalFileName(!1);return this.forwardJSONCall("discoverTypings()",(function(){var i=JSON.parse(t);return void 0===r.safeList&&(r.safeList=e.JsTyping.loadSafeList(r.host,e.toPath(i.safeListPath,i.safeListPath,n))),e.JsTyping.discoverTypings(r.host,(function(e){return r.logger.log(e)}),i.fileNames,e.toPath(i.projectRootPath,i.projectRootPath,n),r.safeList,i.packageNameToTypingLocation,i.typeAcquisition,i.unresolvedImports,i.typesRegistry)}))},r}(d),v=function(){function r(){this._shims=[];}return r.prototype.getServicesVersion=function(){return e.servicesVersion},r.prototype.createLanguageServiceShim=function(r){try{void 0===this.documentRegistry&&(this.documentRegistry=e.createDocumentRegistry(r.useCaseSensitiveFileNames&&r.useCaseSensitiveFileNames(),r.getCurrentDirectory()));var n=new a(r),i=e.createLanguageService(n,this.documentRegistry,!1);return new f(this,r,i)}catch(e){throw t(r,e),e}},r.prototype.createClassifierShim=function(e){try{return new m(this,e)}catch(r){throw t(e,r),r}},r.prototype.createCoreServicesShim=function(e){try{var r=new o(e);return new y(this,e,r)}catch(r){throw t(e,r),r}},r.prototype.close=function(){e.clear(this._shims),this.documentRegistry=void 0;},r.prototype.registerShim=function(e){this._shims.push(e);},r.prototype.unregisterShim=function(e){for(var t=0;t<this._shims.length;t++)if(this._shims[t]===e)return void delete this._shims[t];throw new Error("Invalid operation")},r}();e.TypeScriptServicesFactory=v;}(t),function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,"undefined"==typeof globalThis&&(window.globalThis=window),delete Object.prototype.__magic__;}catch(e){window.globalThis=window;}}(),("undefined"==typeof process||process.browser)&&(globalThis.TypeScript=globalThis.TypeScript||{},globalThis.TypeScript.Services=globalThis.TypeScript.Services||{},globalThis.TypeScript.Services.TypeScriptServicesFactory=t.TypeScriptServicesFactory,globalThis.toolsVersion=t.versionMajorMinor),"undefined"!=typeof module&&module.exports&&(module.exports=t),function(e){var t={since:"4.0",warnAfter:"4.1",message:"Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead."};e.createNodeArray=e.Debug.deprecate(e.factory.createNodeArray,t),e.createNumericLiteral=e.Debug.deprecate(e.factory.createNumericLiteral,t),e.createBigIntLiteral=e.Debug.deprecate(e.factory.createBigIntLiteral,t),e.createStringLiteral=e.Debug.deprecate(e.factory.createStringLiteral,t),e.createStringLiteralFromNode=e.Debug.deprecate(e.factory.createStringLiteralFromNode,t),e.createRegularExpressionLiteral=e.Debug.deprecate(e.factory.createRegularExpressionLiteral,t),e.createLoopVariable=e.Debug.deprecate(e.factory.createLoopVariable,t),e.createUniqueName=e.Debug.deprecate(e.factory.createUniqueName,t),e.createPrivateIdentifier=e.Debug.deprecate(e.factory.createPrivateIdentifier,t),e.createSuper=e.Debug.deprecate(e.factory.createSuper,t),e.createThis=e.Debug.deprecate(e.factory.createThis,t),e.createNull=e.Debug.deprecate(e.factory.createNull,t),e.createTrue=e.Debug.deprecate(e.factory.createTrue,t),e.createFalse=e.Debug.deprecate(e.factory.createFalse,t),e.createModifier=e.Debug.deprecate(e.factory.createModifier,t),e.createModifiersFromModifierFlags=e.Debug.deprecate(e.factory.createModifiersFromModifierFlags,t),e.createQualifiedName=e.Debug.deprecate(e.factory.createQualifiedName,t),e.updateQualifiedName=e.Debug.deprecate(e.factory.updateQualifiedName,t),e.createComputedPropertyName=e.Debug.deprecate(e.factory.createComputedPropertyName,t),e.updateComputedPropertyName=e.Debug.deprecate(e.factory.updateComputedPropertyName,t),e.createTypeParameterDeclaration=e.Debug.deprecate(e.factory.createTypeParameterDeclaration,t),e.updateTypeParameterDeclaration=e.Debug.deprecate(e.factory.updateTypeParameterDeclaration,t),e.createParameter=e.Debug.deprecate(e.factory.createParameterDeclaration,t),e.updateParameter=e.Debug.deprecate(e.factory.updateParameterDeclaration,t),e.createDecorator=e.Debug.deprecate(e.factory.createDecorator,t),e.updateDecorator=e.Debug.deprecate(e.factory.updateDecorator,t),e.createProperty=e.Debug.deprecate(e.factory.createPropertyDeclaration,t),e.updateProperty=e.Debug.deprecate(e.factory.updatePropertyDeclaration,t),e.createMethod=e.Debug.deprecate(e.factory.createMethodDeclaration,t),e.updateMethod=e.Debug.deprecate(e.factory.updateMethodDeclaration,t),e.createConstructor=e.Debug.deprecate(e.factory.createConstructorDeclaration,t),e.updateConstructor=e.Debug.deprecate(e.factory.updateConstructorDeclaration,t),e.createGetAccessor=e.Debug.deprecate(e.factory.createGetAccessorDeclaration,t),e.updateGetAccessor=e.Debug.deprecate(e.factory.updateGetAccessorDeclaration,t),e.createSetAccessor=e.Debug.deprecate(e.factory.createSetAccessorDeclaration,t),e.updateSetAccessor=e.Debug.deprecate(e.factory.updateSetAccessorDeclaration,t),e.createCallSignature=e.Debug.deprecate(e.factory.createCallSignature,t),e.updateCallSignature=e.Debug.deprecate(e.factory.updateCallSignature,t),e.createConstructSignature=e.Debug.deprecate(e.factory.createConstructSignature,t),e.updateConstructSignature=e.Debug.deprecate(e.factory.updateConstructSignature,t),e.updateIndexSignature=e.Debug.deprecate(e.factory.updateIndexSignature,t),e.createKeywordTypeNode=e.Debug.deprecate(e.factory.createKeywordTypeNode,t),e.createTypePredicateNodeWithModifier=e.Debug.deprecate(e.factory.createTypePredicateNode,t),e.updateTypePredicateNodeWithModifier=e.Debug.deprecate(e.factory.updateTypePredicateNode,t),e.createTypeReferenceNode=e.Debug.deprecate(e.factory.createTypeReferenceNode,t),e.updateTypeReferenceNode=e.Debug.deprecate(e.factory.updateTypeReferenceNode,t),e.createFunctionTypeNode=e.Debug.deprecate(e.factory.createFunctionTypeNode,t),e.updateFunctionTypeNode=e.Debug.deprecate(e.factory.updateFunctionTypeNode,t),e.createConstructorTypeNode=e.Debug.deprecate((function(t,r,n){return e.factory.createConstructorTypeNode(void 0,t,r,n)}),t),e.updateConstructorTypeNode=e.Debug.deprecate((function(t,r,n,i){return e.factory.updateConstructorTypeNode(t,t.modifiers,r,n,i)}),t),e.createTypeQueryNode=e.Debug.deprecate(e.factory.createTypeQueryNode,t),e.updateTypeQueryNode=e.Debug.deprecate(e.factory.updateTypeQueryNode,t),e.createTypeLiteralNode=e.Debug.deprecate(e.factory.createTypeLiteralNode,t),e.updateTypeLiteralNode=e.Debug.deprecate(e.factory.updateTypeLiteralNode,t),e.createArrayTypeNode=e.Debug.deprecate(e.factory.createArrayTypeNode,t),e.updateArrayTypeNode=e.Debug.deprecate(e.factory.updateArrayTypeNode,t),e.createTupleTypeNode=e.Debug.deprecate(e.factory.createTupleTypeNode,t),e.updateTupleTypeNode=e.Debug.deprecate(e.factory.updateTupleTypeNode,t),e.createOptionalTypeNode=e.Debug.deprecate(e.factory.createOptionalTypeNode,t),e.updateOptionalTypeNode=e.Debug.deprecate(e.factory.updateOptionalTypeNode,t),e.createRestTypeNode=e.Debug.deprecate(e.factory.createRestTypeNode,t),e.updateRestTypeNode=e.Debug.deprecate(e.factory.updateRestTypeNode,t),e.createUnionTypeNode=e.Debug.deprecate(e.factory.createUnionTypeNode,t),e.updateUnionTypeNode=e.Debug.deprecate(e.factory.updateUnionTypeNode,t),e.createIntersectionTypeNode=e.Debug.deprecate(e.factory.createIntersectionTypeNode,t),e.updateIntersectionTypeNode=e.Debug.deprecate(e.factory.updateIntersectionTypeNode,t),e.createConditionalTypeNode=e.Debug.deprecate(e.factory.createConditionalTypeNode,t),e.updateConditionalTypeNode=e.Debug.deprecate(e.factory.updateConditionalTypeNode,t),e.createInferTypeNode=e.Debug.deprecate(e.factory.createInferTypeNode,t),e.updateInferTypeNode=e.Debug.deprecate(e.factory.updateInferTypeNode,t),e.createImportTypeNode=e.Debug.deprecate(e.factory.createImportTypeNode,t),e.updateImportTypeNode=e.Debug.deprecate(e.factory.updateImportTypeNode,t),e.createParenthesizedType=e.Debug.deprecate(e.factory.createParenthesizedType,t),e.updateParenthesizedType=e.Debug.deprecate(e.factory.updateParenthesizedType,t),e.createThisTypeNode=e.Debug.deprecate(e.factory.createThisTypeNode,t),e.updateTypeOperatorNode=e.Debug.deprecate(e.factory.updateTypeOperatorNode,t),e.createIndexedAccessTypeNode=e.Debug.deprecate(e.factory.createIndexedAccessTypeNode,t),e.updateIndexedAccessTypeNode=e.Debug.deprecate(e.factory.updateIndexedAccessTypeNode,t),e.createMappedTypeNode=e.Debug.deprecate(e.factory.createMappedTypeNode,t),e.updateMappedTypeNode=e.Debug.deprecate(e.factory.updateMappedTypeNode,t),e.createLiteralTypeNode=e.Debug.deprecate(e.factory.createLiteralTypeNode,t),e.updateLiteralTypeNode=e.Debug.deprecate(e.factory.updateLiteralTypeNode,t),e.createObjectBindingPattern=e.Debug.deprecate(e.factory.createObjectBindingPattern,t),e.updateObjectBindingPattern=e.Debug.deprecate(e.factory.updateObjectBindingPattern,t),e.createArrayBindingPattern=e.Debug.deprecate(e.factory.createArrayBindingPattern,t),e.updateArrayBindingPattern=e.Debug.deprecate(e.factory.updateArrayBindingPattern,t),e.createBindingElement=e.Debug.deprecate(e.factory.createBindingElement,t),e.updateBindingElement=e.Debug.deprecate(e.factory.updateBindingElement,t),e.createArrayLiteral=e.Debug.deprecate(e.factory.createArrayLiteralExpression,t),e.updateArrayLiteral=e.Debug.deprecate(e.factory.updateArrayLiteralExpression,t),e.createObjectLiteral=e.Debug.deprecate(e.factory.createObjectLiteralExpression,t),e.updateObjectLiteral=e.Debug.deprecate(e.factory.updateObjectLiteralExpression,t),e.createPropertyAccess=e.Debug.deprecate(e.factory.createPropertyAccessExpression,t),e.updatePropertyAccess=e.Debug.deprecate(e.factory.updatePropertyAccessExpression,t),e.createPropertyAccessChain=e.Debug.deprecate(e.factory.createPropertyAccessChain,t),e.updatePropertyAccessChain=e.Debug.deprecate(e.factory.updatePropertyAccessChain,t),e.createElementAccess=e.Debug.deprecate(e.factory.createElementAccessExpression,t),e.updateElementAccess=e.Debug.deprecate(e.factory.updateElementAccessExpression,t),e.createElementAccessChain=e.Debug.deprecate(e.factory.createElementAccessChain,t),e.updateElementAccessChain=e.Debug.deprecate(e.factory.updateElementAccessChain,t),e.createCall=e.Debug.deprecate(e.factory.createCallExpression,t),e.updateCall=e.Debug.deprecate(e.factory.updateCallExpression,t),e.createCallChain=e.Debug.deprecate(e.factory.createCallChain,t),e.updateCallChain=e.Debug.deprecate(e.factory.updateCallChain,t),e.createNew=e.Debug.deprecate(e.factory.createNewExpression,t),e.updateNew=e.Debug.deprecate(e.factory.updateNewExpression,t),e.createTypeAssertion=e.Debug.deprecate(e.factory.createTypeAssertion,t),e.updateTypeAssertion=e.Debug.deprecate(e.factory.updateTypeAssertion,t),e.createParen=e.Debug.deprecate(e.factory.createParenthesizedExpression,t),e.updateParen=e.Debug.deprecate(e.factory.updateParenthesizedExpression,t),e.createFunctionExpression=e.Debug.deprecate(e.factory.createFunctionExpression,t),e.updateFunctionExpression=e.Debug.deprecate(e.factory.updateFunctionExpression,t),e.createDelete=e.Debug.deprecate(e.factory.createDeleteExpression,t),e.updateDelete=e.Debug.deprecate(e.factory.updateDeleteExpression,t),e.createTypeOf=e.Debug.deprecate(e.factory.createTypeOfExpression,t),e.updateTypeOf=e.Debug.deprecate(e.factory.updateTypeOfExpression,t),e.createVoid=e.Debug.deprecate(e.factory.createVoidExpression,t),e.updateVoid=e.Debug.deprecate(e.factory.updateVoidExpression,t),e.createAwait=e.Debug.deprecate(e.factory.createAwaitExpression,t),e.updateAwait=e.Debug.deprecate(e.factory.updateAwaitExpression,t),e.createPrefix=e.Debug.deprecate(e.factory.createPrefixUnaryExpression,t),e.updatePrefix=e.Debug.deprecate(e.factory.updatePrefixUnaryExpression,t),e.createPostfix=e.Debug.deprecate(e.factory.createPostfixUnaryExpression,t),e.updatePostfix=e.Debug.deprecate(e.factory.updatePostfixUnaryExpression,t),e.createBinary=e.Debug.deprecate(e.factory.createBinaryExpression,t),e.updateConditional=e.Debug.deprecate(e.factory.updateConditionalExpression,t),e.createTemplateExpression=e.Debug.deprecate(e.factory.createTemplateExpression,t),e.updateTemplateExpression=e.Debug.deprecate(e.factory.updateTemplateExpression,t),e.createTemplateHead=e.Debug.deprecate(e.factory.createTemplateHead,t),e.createTemplateMiddle=e.Debug.deprecate(e.factory.createTemplateMiddle,t),e.createTemplateTail=e.Debug.deprecate(e.factory.createTemplateTail,t),e.createNoSubstitutionTemplateLiteral=e.Debug.deprecate(e.factory.createNoSubstitutionTemplateLiteral,t),e.updateYield=e.Debug.deprecate(e.factory.updateYieldExpression,t),e.createSpread=e.Debug.deprecate(e.factory.createSpreadElement,t),e.updateSpread=e.Debug.deprecate(e.factory.updateSpreadElement,t),e.createOmittedExpression=e.Debug.deprecate(e.factory.createOmittedExpression,t),e.createAsExpression=e.Debug.deprecate(e.factory.createAsExpression,t),e.updateAsExpression=e.Debug.deprecate(e.factory.updateAsExpression,t),e.createNonNullExpression=e.Debug.deprecate(e.factory.createNonNullExpression,t),e.updateNonNullExpression=e.Debug.deprecate(e.factory.updateNonNullExpression,t),e.createNonNullChain=e.Debug.deprecate(e.factory.createNonNullChain,t),e.updateNonNullChain=e.Debug.deprecate(e.factory.updateNonNullChain,t),e.createMetaProperty=e.Debug.deprecate(e.factory.createMetaProperty,t),e.updateMetaProperty=e.Debug.deprecate(e.factory.updateMetaProperty,t),e.createTemplateSpan=e.Debug.deprecate(e.factory.createTemplateSpan,t),e.updateTemplateSpan=e.Debug.deprecate(e.factory.updateTemplateSpan,t),e.createSemicolonClassElement=e.Debug.deprecate(e.factory.createSemicolonClassElement,t),e.createBlock=e.Debug.deprecate(e.factory.createBlock,t),e.updateBlock=e.Debug.deprecate(e.factory.updateBlock,t),e.createVariableStatement=e.Debug.deprecate(e.factory.createVariableStatement,t),e.updateVariableStatement=e.Debug.deprecate(e.factory.updateVariableStatement,t),e.createEmptyStatement=e.Debug.deprecate(e.factory.createEmptyStatement,t),e.createExpressionStatement=e.Debug.deprecate(e.factory.createExpressionStatement,t),e.updateExpressionStatement=e.Debug.deprecate(e.factory.updateExpressionStatement,t),e.createStatement=e.Debug.deprecate(e.factory.createExpressionStatement,t),e.updateStatement=e.Debug.deprecate(e.factory.updateExpressionStatement,t),e.createIf=e.Debug.deprecate(e.factory.createIfStatement,t),e.updateIf=e.Debug.deprecate(e.factory.updateIfStatement,t),e.createDo=e.Debug.deprecate(e.factory.createDoStatement,t),e.updateDo=e.Debug.deprecate(e.factory.updateDoStatement,t),e.createWhile=e.Debug.deprecate(e.factory.createWhileStatement,t),e.updateWhile=e.Debug.deprecate(e.factory.updateWhileStatement,t),e.createFor=e.Debug.deprecate(e.factory.createForStatement,t),e.updateFor=e.Debug.deprecate(e.factory.updateForStatement,t),e.createForIn=e.Debug.deprecate(e.factory.createForInStatement,t),e.updateForIn=e.Debug.deprecate(e.factory.updateForInStatement,t),e.createForOf=e.Debug.deprecate(e.factory.createForOfStatement,t),e.updateForOf=e.Debug.deprecate(e.factory.updateForOfStatement,t),e.createContinue=e.Debug.deprecate(e.factory.createContinueStatement,t),e.updateContinue=e.Debug.deprecate(e.factory.updateContinueStatement,t),e.createBreak=e.Debug.deprecate(e.factory.createBreakStatement,t),e.updateBreak=e.Debug.deprecate(e.factory.updateBreakStatement,t),e.createReturn=e.Debug.deprecate(e.factory.createReturnStatement,t),e.updateReturn=e.Debug.deprecate(e.factory.updateReturnStatement,t),e.createWith=e.Debug.deprecate(e.factory.createWithStatement,t),e.updateWith=e.Debug.deprecate(e.factory.updateWithStatement,t),e.createSwitch=e.Debug.deprecate(e.factory.createSwitchStatement,t),e.updateSwitch=e.Debug.deprecate(e.factory.updateSwitchStatement,t),e.createLabel=e.Debug.deprecate(e.factory.createLabeledStatement,t),e.updateLabel=e.Debug.deprecate(e.factory.updateLabeledStatement,t),e.createThrow=e.Debug.deprecate(e.factory.createThrowStatement,t),e.updateThrow=e.Debug.deprecate(e.factory.updateThrowStatement,t),e.createTry=e.Debug.deprecate(e.factory.createTryStatement,t),e.updateTry=e.Debug.deprecate(e.factory.updateTryStatement,t),e.createDebuggerStatement=e.Debug.deprecate(e.factory.createDebuggerStatement,t),e.createVariableDeclarationList=e.Debug.deprecate(e.factory.createVariableDeclarationList,t),e.updateVariableDeclarationList=e.Debug.deprecate(e.factory.updateVariableDeclarationList,t),e.createFunctionDeclaration=e.Debug.deprecate(e.factory.createFunctionDeclaration,t),e.updateFunctionDeclaration=e.Debug.deprecate(e.factory.updateFunctionDeclaration,t),e.createClassDeclaration=e.Debug.deprecate(e.factory.createClassDeclaration,t),e.updateClassDeclaration=e.Debug.deprecate(e.factory.updateClassDeclaration,t),e.createInterfaceDeclaration=e.Debug.deprecate(e.factory.createInterfaceDeclaration,t),e.updateInterfaceDeclaration=e.Debug.deprecate(e.factory.updateInterfaceDeclaration,t),e.createTypeAliasDeclaration=e.Debug.deprecate(e.factory.createTypeAliasDeclaration,t),e.updateTypeAliasDeclaration=e.Debug.deprecate(e.factory.updateTypeAliasDeclaration,t),e.createEnumDeclaration=e.Debug.deprecate(e.factory.createEnumDeclaration,t),e.updateEnumDeclaration=e.Debug.deprecate(e.factory.updateEnumDeclaration,t),e.createModuleDeclaration=e.Debug.deprecate(e.factory.createModuleDeclaration,t),e.updateModuleDeclaration=e.Debug.deprecate(e.factory.updateModuleDeclaration,t),e.createModuleBlock=e.Debug.deprecate(e.factory.createModuleBlock,t),e.updateModuleBlock=e.Debug.deprecate(e.factory.updateModuleBlock,t),e.createCaseBlock=e.Debug.deprecate(e.factory.createCaseBlock,t),e.updateCaseBlock=e.Debug.deprecate(e.factory.updateCaseBlock,t),e.createNamespaceExportDeclaration=e.Debug.deprecate(e.factory.createNamespaceExportDeclaration,t),e.updateNamespaceExportDeclaration=e.Debug.deprecate(e.factory.updateNamespaceExportDeclaration,t),e.createImportEqualsDeclaration=e.Debug.deprecate(e.factory.createImportEqualsDeclaration,t),e.updateImportEqualsDeclaration=e.Debug.deprecate(e.factory.updateImportEqualsDeclaration,t),e.createImportDeclaration=e.Debug.deprecate(e.factory.createImportDeclaration,t),e.updateImportDeclaration=e.Debug.deprecate(e.factory.updateImportDeclaration,t),e.createNamespaceImport=e.Debug.deprecate(e.factory.createNamespaceImport,t),e.updateNamespaceImport=e.Debug.deprecate(e.factory.updateNamespaceImport,t),e.createNamedImports=e.Debug.deprecate(e.factory.createNamedImports,t),e.updateNamedImports=e.Debug.deprecate(e.factory.updateNamedImports,t),e.createImportSpecifier=e.Debug.deprecate(e.factory.createImportSpecifier,t),e.updateImportSpecifier=e.Debug.deprecate(e.factory.updateImportSpecifier,t),e.createExportAssignment=e.Debug.deprecate(e.factory.createExportAssignment,t),e.updateExportAssignment=e.Debug.deprecate(e.factory.updateExportAssignment,t),e.createNamedExports=e.Debug.deprecate(e.factory.createNamedExports,t),e.updateNamedExports=e.Debug.deprecate(e.factory.updateNamedExports,t),e.createExportSpecifier=e.Debug.deprecate(e.factory.createExportSpecifier,t),e.updateExportSpecifier=e.Debug.deprecate(e.factory.updateExportSpecifier,t),e.createExternalModuleReference=e.Debug.deprecate(e.factory.createExternalModuleReference,t),e.updateExternalModuleReference=e.Debug.deprecate(e.factory.updateExternalModuleReference,t),e.createJSDocTypeExpression=e.Debug.deprecate(e.factory.createJSDocTypeExpression,t),e.createJSDocTypeTag=e.Debug.deprecate(e.factory.createJSDocTypeTag,t),e.createJSDocReturnTag=e.Debug.deprecate(e.factory.createJSDocReturnTag,t),e.createJSDocThisTag=e.Debug.deprecate(e.factory.createJSDocThisTag,t),e.createJSDocComment=e.Debug.deprecate(e.factory.createJSDocComment,t),e.createJSDocParameterTag=e.Debug.deprecate(e.factory.createJSDocParameterTag,t),e.createJSDocClassTag=e.Debug.deprecate(e.factory.createJSDocClassTag,t),e.createJSDocAugmentsTag=e.Debug.deprecate(e.factory.createJSDocAugmentsTag,t),e.createJSDocEnumTag=e.Debug.deprecate(e.factory.createJSDocEnumTag,t),e.createJSDocTemplateTag=e.Debug.deprecate(e.factory.createJSDocTemplateTag,t),e.createJSDocTypedefTag=e.Debug.deprecate(e.factory.createJSDocTypedefTag,t),e.createJSDocCallbackTag=e.Debug.deprecate(e.factory.createJSDocCallbackTag,t),e.createJSDocSignature=e.Debug.deprecate(e.factory.createJSDocSignature,t),e.createJSDocPropertyTag=e.Debug.deprecate(e.factory.createJSDocPropertyTag,t),e.createJSDocTypeLiteral=e.Debug.deprecate(e.factory.createJSDocTypeLiteral,t),e.createJSDocImplementsTag=e.Debug.deprecate(e.factory.createJSDocImplementsTag,t),e.createJSDocAuthorTag=e.Debug.deprecate(e.factory.createJSDocAuthorTag,t),e.createJSDocPublicTag=e.Debug.deprecate(e.factory.createJSDocPublicTag,t),e.createJSDocPrivateTag=e.Debug.deprecate(e.factory.createJSDocPrivateTag,t),e.createJSDocProtectedTag=e.Debug.deprecate(e.factory.createJSDocProtectedTag,t),e.createJSDocReadonlyTag=e.Debug.deprecate(e.factory.createJSDocReadonlyTag,t),e.createJSDocTag=e.Debug.deprecate(e.factory.createJSDocUnknownTag,t),e.createJsxElement=e.Debug.deprecate(e.factory.createJsxElement,t),e.updateJsxElement=e.Debug.deprecate(e.factory.updateJsxElement,t),e.createJsxSelfClosingElement=e.Debug.deprecate(e.factory.createJsxSelfClosingElement,t),e.updateJsxSelfClosingElement=e.Debug.deprecate(e.factory.updateJsxSelfClosingElement,t),e.createJsxOpeningElement=e.Debug.deprecate(e.factory.createJsxOpeningElement,t),e.updateJsxOpeningElement=e.Debug.deprecate(e.factory.updateJsxOpeningElement,t),e.createJsxClosingElement=e.Debug.deprecate(e.factory.createJsxClosingElement,t),e.updateJsxClosingElement=e.Debug.deprecate(e.factory.updateJsxClosingElement,t),e.createJsxFragment=e.Debug.deprecate(e.factory.createJsxFragment,t),e.createJsxText=e.Debug.deprecate(e.factory.createJsxText,t),e.updateJsxText=e.Debug.deprecate(e.factory.updateJsxText,t),e.createJsxOpeningFragment=e.Debug.deprecate(e.factory.createJsxOpeningFragment,t),e.createJsxJsxClosingFragment=e.Debug.deprecate(e.factory.createJsxJsxClosingFragment,t),e.updateJsxFragment=e.Debug.deprecate(e.factory.updateJsxFragment,t),e.createJsxAttribute=e.Debug.deprecate(e.factory.createJsxAttribute,t),e.updateJsxAttribute=e.Debug.deprecate(e.factory.updateJsxAttribute,t),e.createJsxAttributes=e.Debug.deprecate(e.factory.createJsxAttributes,t),e.updateJsxAttributes=e.Debug.deprecate(e.factory.updateJsxAttributes,t),e.createJsxSpreadAttribute=e.Debug.deprecate(e.factory.createJsxSpreadAttribute,t),e.updateJsxSpreadAttribute=e.Debug.deprecate(e.factory.updateJsxSpreadAttribute,t),e.createJsxExpression=e.Debug.deprecate(e.factory.createJsxExpression,t),e.updateJsxExpression=e.Debug.deprecate(e.factory.updateJsxExpression,t),e.createCaseClause=e.Debug.deprecate(e.factory.createCaseClause,t),e.updateCaseClause=e.Debug.deprecate(e.factory.updateCaseClause,t),e.createDefaultClause=e.Debug.deprecate(e.factory.createDefaultClause,t),e.updateDefaultClause=e.Debug.deprecate(e.factory.updateDefaultClause,t),e.createHeritageClause=e.Debug.deprecate(e.factory.createHeritageClause,t),e.updateHeritageClause=e.Debug.deprecate(e.factory.updateHeritageClause,t),e.createCatchClause=e.Debug.deprecate(e.factory.createCatchClause,t),e.updateCatchClause=e.Debug.deprecate(e.factory.updateCatchClause,t),e.createPropertyAssignment=e.Debug.deprecate(e.factory.createPropertyAssignment,t),e.updatePropertyAssignment=e.Debug.deprecate(e.factory.updatePropertyAssignment,t),e.createShorthandPropertyAssignment=e.Debug.deprecate(e.factory.createShorthandPropertyAssignment,t),e.updateShorthandPropertyAssignment=e.Debug.deprecate(e.factory.updateShorthandPropertyAssignment,t),e.createSpreadAssignment=e.Debug.deprecate(e.factory.createSpreadAssignment,t),e.updateSpreadAssignment=e.Debug.deprecate(e.factory.updateSpreadAssignment,t),e.createEnumMember=e.Debug.deprecate(e.factory.createEnumMember,t),e.updateEnumMember=e.Debug.deprecate(e.factory.updateEnumMember,t),e.updateSourceFileNode=e.Debug.deprecate(e.factory.updateSourceFile,t),e.createNotEmittedStatement=e.Debug.deprecate(e.factory.createNotEmittedStatement,t),e.createPartiallyEmittedExpression=e.Debug.deprecate(e.factory.createPartiallyEmittedExpression,t),e.updatePartiallyEmittedExpression=e.Debug.deprecate(e.factory.updatePartiallyEmittedExpression,t),e.createCommaList=e.Debug.deprecate(e.factory.createCommaListExpression,t),e.updateCommaList=e.Debug.deprecate(e.factory.updateCommaListExpression,t),e.createBundle=e.Debug.deprecate(e.factory.createBundle,t),e.updateBundle=e.Debug.deprecate(e.factory.updateBundle,t),e.createImmediatelyInvokedFunctionExpression=e.Debug.deprecate(e.factory.createImmediatelyInvokedFunctionExpression,t),e.createImmediatelyInvokedArrowFunction=e.Debug.deprecate(e.factory.createImmediatelyInvokedArrowFunction,t),e.createVoidZero=e.Debug.deprecate(e.factory.createVoidZero,t),e.createExportDefault=e.Debug.deprecate(e.factory.createExportDefault,t),e.createExternalModuleExport=e.Debug.deprecate(e.factory.createExternalModuleExport,t),e.createNamespaceExport=e.Debug.deprecate(e.factory.createNamespaceExport,t),e.updateNamespaceExport=e.Debug.deprecate(e.factory.updateNamespaceExport,t),e.createToken=e.Debug.deprecate((function(t){return e.factory.createToken(t)}),t),e.createIdentifier=e.Debug.deprecate((function(t){return e.factory.createIdentifier(t,void 0,void 0)}),t),e.createTempVariable=e.Debug.deprecate((function(t){return e.factory.createTempVariable(t,void 0)}),t),e.getGeneratedNameForNode=e.Debug.deprecate((function(t){return e.factory.getGeneratedNameForNode(t,void 0)}),t),e.createOptimisticUniqueName=e.Debug.deprecate((function(t){return e.factory.createUniqueName(t,16)}),t),e.createFileLevelUniqueName=e.Debug.deprecate((function(t){return e.factory.createUniqueName(t,48)}),t),e.createIndexSignature=e.Debug.deprecate((function(t,r,n,i){return e.factory.createIndexSignature(t,r,n,i)}),t),e.createTypePredicateNode=e.Debug.deprecate((function(t,r){return e.factory.createTypePredicateNode(void 0,t,r)}),t),e.updateTypePredicateNode=e.Debug.deprecate((function(t,r,n){return e.factory.updateTypePredicateNode(t,void 0,r,n)}),t),e.createLiteral=e.Debug.deprecate((function(t){return "number"==typeof t?e.factory.createNumericLiteral(t):"object"==typeof t&&"base10Value"in t?e.factory.createBigIntLiteral(t):"boolean"==typeof t?t?e.factory.createTrue():e.factory.createFalse():"string"==typeof t?e.factory.createStringLiteral(t,void 0):e.factory.createStringLiteralFromNode(t)}),{since:"4.0",warnAfter:"4.1",message:"Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead."}),e.createMethodSignature=e.Debug.deprecate((function(t,r,n,i,a){return e.factory.createMethodSignature(void 0,i,a,t,r,n)}),t),e.updateMethodSignature=e.Debug.deprecate((function(t,r,n,i,a,o){return e.factory.updateMethodSignature(t,t.modifiers,a,o,r,n,i)}),t),e.createTypeOperatorNode=e.Debug.deprecate((function(t,r){var n;return r?n=t:(r=t,n=140),e.factory.createTypeOperatorNode(n,r)}),t),e.createTaggedTemplate=e.Debug.deprecate((function(t,r,n){var i;return n?i=r:n=r,e.factory.createTaggedTemplateExpression(t,i,n)}),t),e.updateTaggedTemplate=e.Debug.deprecate((function(t,r,n,i){var a;return i?a=n:i=n,e.factory.updateTaggedTemplateExpression(t,r,a,i)}),t),e.updateBinary=e.Debug.deprecate((function(t,r,n,i){return void 0===i&&(i=t.operatorToken),"number"==typeof i&&(i=i===t.operatorToken.kind?t.operatorToken:e.factory.createToken(i)),e.factory.updateBinaryExpression(t,r,i,n)}),t),e.createConditional=e.Debug.deprecate((function(t,r,n,i,a){return 5===arguments.length?e.factory.createConditionalExpression(t,r,n,i,a):3===arguments.length?e.factory.createConditionalExpression(t,e.factory.createToken(57),r,e.factory.createToken(58),n):e.Debug.fail("Argument count mismatch")}),t),e.createYield=e.Debug.deprecate((function(t,r){var n;return r?n=t:r=t,e.factory.createYieldExpression(n,r)}),t),e.createClassExpression=e.Debug.deprecate((function(t,r,n,i,a){return e.factory.createClassExpression(void 0,t,r,n,i,a)}),t),e.updateClassExpression=e.Debug.deprecate((function(t,r,n,i,a,o){return e.factory.updateClassExpression(t,void 0,r,n,i,a,o)}),t),e.createPropertySignature=e.Debug.deprecate((function(t,r,n,i,a){var o=e.factory.createPropertySignature(t,r,n,i);return o.initializer=a,o}),t),e.updatePropertySignature=e.Debug.deprecate((function(t,r,n,i,a,o){var s=e.factory.updatePropertySignature(t,r,n,i,a);return t.initializer!==o&&(s===t&&(s=e.factory.cloneNode(t)),s.initializer=o),s}),t),e.createExpressionWithTypeArguments=e.Debug.deprecate((function(t,r){return e.factory.createExpressionWithTypeArguments(r,t)}),t),e.updateExpressionWithTypeArguments=e.Debug.deprecate((function(t,r,n){return e.factory.updateExpressionWithTypeArguments(t,n,r)}),t),e.createArrowFunction=e.Debug.deprecate((function(t,r,n,i,a,o){return 6===arguments.length?e.factory.createArrowFunction(t,r,n,i,a,o):5===arguments.length?e.factory.createArrowFunction(t,r,n,i,void 0,a):e.Debug.fail("Argument count mismatch")}),t),e.updateArrowFunction=e.Debug.deprecate((function(t,r,n,i,a,o,s){return 7===arguments.length?e.factory.updateArrowFunction(t,r,n,i,a,o,s):6===arguments.length?e.factory.updateArrowFunction(t,r,n,i,a,t.equalsGreaterThanToken,o):e.Debug.fail("Argument count mismatch")}),t),e.createVariableDeclaration=e.Debug.deprecate((function(t,r,n,i){return 4===arguments.length?e.factory.createVariableDeclaration(t,r,n,i):arguments.length>=1&&arguments.length<=3?e.factory.createVariableDeclaration(t,void 0,r,n):e.Debug.fail("Argument count mismatch")}),t),e.updateVariableDeclaration=e.Debug.deprecate((function(t,r,n,i,a){return 5===arguments.length?e.factory.updateVariableDeclaration(t,r,n,i,a):4===arguments.length?e.factory.updateVariableDeclaration(t,r,t.exclamationToken,n,i):e.Debug.fail("Argument count mismatch")}),t),e.createImportClause=e.Debug.deprecate((function(t,r,n){return void 0===n&&(n=!1),e.factory.createImportClause(n,t,r)}),t),e.updateImportClause=e.Debug.deprecate((function(t,r,n,i){return e.factory.updateImportClause(t,i,r,n)}),t),e.createExportDeclaration=e.Debug.deprecate((function(t,r,n,i,a){return void 0===a&&(a=!1),e.factory.createExportDeclaration(t,r,a,n,i)}),t),e.updateExportDeclaration=e.Debug.deprecate((function(t,r,n,i,a,o){return e.factory.updateExportDeclaration(t,r,n,o,i,a,t.assertClause)}),t),e.createJSDocParamTag=e.Debug.deprecate((function(t,r,n,i){return e.factory.createJSDocParameterTag(void 0,t,r,n,!1,i?e.factory.createNodeArray([e.factory.createJSDocText(i)]):void 0)}),t),e.createComma=e.Debug.deprecate((function(t,r){return e.factory.createComma(t,r)}),t),e.createLessThan=e.Debug.deprecate((function(t,r){return e.factory.createLessThan(t,r)}),t),e.createAssignment=e.Debug.deprecate((function(t,r){return e.factory.createAssignment(t,r)}),t),e.createStrictEquality=e.Debug.deprecate((function(t,r){return e.factory.createStrictEquality(t,r)}),t),e.createStrictInequality=e.Debug.deprecate((function(t,r){return e.factory.createStrictInequality(t,r)}),t),e.createAdd=e.Debug.deprecate((function(t,r){return e.factory.createAdd(t,r)}),t),e.createSubtract=e.Debug.deprecate((function(t,r){return e.factory.createSubtract(t,r)}),t),e.createLogicalAnd=e.Debug.deprecate((function(t,r){return e.factory.createLogicalAnd(t,r)}),t),e.createLogicalOr=e.Debug.deprecate((function(t,r){return e.factory.createLogicalOr(t,r)}),t),e.createPostfixIncrement=e.Debug.deprecate((function(t){return e.factory.createPostfixIncrement(t)}),t),e.createLogicalNot=e.Debug.deprecate((function(t){return e.factory.createLogicalNot(t)}),t),e.createNode=e.Debug.deprecate((function(t,r,n){return void 0===r&&(r=0),void 0===n&&(n=0),e.setTextRangePosEnd(305===t?e.parseBaseNodeFactory.createBaseSourceFileNode(t):79===t?e.parseBaseNodeFactory.createBaseIdentifierNode(t):80===t?e.parseBaseNodeFactory.createBasePrivateIdentifierNode(t):e.isNodeKind(t)?e.parseBaseNodeFactory.createBaseNode(t):e.parseBaseNodeFactory.createBaseTokenNode(t),r,n)}),{since:"4.0",warnAfter:"4.1",message:"Use an appropriate `factory` method instead."}),e.getMutableClone=e.Debug.deprecate((function(t){var r=e.factory.cloneNode(t);return e.setTextRange(r,t),e.setParent(r,t.parent),r}),{since:"4.0",warnAfter:"4.1",message:"Use an appropriate `factory.update...` method instead, use `setCommentRange` or `setSourceMapRange`, and avoid setting `parent`."}),e.isTypeAssertion=e.Debug.deprecate((function(e){return 211===e.kind}),{since:"4.0",warnAfter:"4.1",message:"Use `isTypeAssertionExpression` instead."}),e.isIdentifierOrPrivateIdentifier=e.Debug.deprecate((function(t){return e.isMemberName(t)}),{since:"4.2",warnAfter:"4.3",message:"Use `isMemberName` instead."});}(t);
  53. /**
  54. * Used to learn the size of a string in bytes.
  55. *
  56. * @param str The string to measure
  57. * @returns number
  58. */
  59. const byteSize = (str) => Buffer.byteLength(str, 'utf8');
  60. /**
  61. * Default style mode id
  62. */
  63. const DEFAULT_STYLE_MODE = '$';
  64. /**
  65. * File names and value
  66. */
  67. const COLLECTION_MANIFEST_FILE_NAME = 'collection-manifest.json';
  68. /**
  69. * Transform metadata about a component from the compiler to a compact form for
  70. * use at runtime.
  71. *
  72. * @param compilerMeta component metadata gathered during compilation
  73. * @param includeMethods include methods in the component's members or not
  74. * @returns a compact format for component metadata, intended for runtime use
  75. */
  76. const formatComponentRuntimeMeta = (compilerMeta, includeMethods) => {
  77. let flags = 0;
  78. if (compilerMeta.encapsulation === 'shadow') {
  79. flags |= 1 /* CMP_FLAGS.shadowDomEncapsulation */;
  80. if (compilerMeta.shadowDelegatesFocus) {
  81. flags |= 16 /* CMP_FLAGS.shadowDelegatesFocus */;
  82. }
  83. }
  84. else if (compilerMeta.encapsulation === 'scoped') {
  85. flags |= 2 /* CMP_FLAGS.scopedCssEncapsulation */;
  86. }
  87. if (compilerMeta.encapsulation !== 'shadow' && compilerMeta.htmlTagNames.includes('slot')) {
  88. flags |= 4 /* CMP_FLAGS.hasSlotRelocation */;
  89. }
  90. if (compilerMeta.hasMode) {
  91. flags |= 32 /* CMP_FLAGS.hasMode */;
  92. }
  93. const members = formatComponentRuntimeMembers(compilerMeta, includeMethods);
  94. const hostListeners = formatHostListeners(compilerMeta);
  95. return trimFalsy([
  96. flags,
  97. compilerMeta.tagName,
  98. Object.keys(members).length > 0 ? members : undefined,
  99. hostListeners.length > 0 ? hostListeners : undefined,
  100. ]);
  101. };
  102. const stringifyRuntimeData = (data) => {
  103. const json = JSON.stringify(data);
  104. if (json.length > 10000) {
  105. // JSON metadata is big, JSON.parse() is faster
  106. // https://twitter.com/mathias/status/1143551692732030979
  107. return `JSON.parse(${JSON.stringify(json)})`;
  108. }
  109. return json;
  110. };
  111. const formatComponentRuntimeMembers = (compilerMeta, includeMethods = true) => {
  112. return {
  113. ...formatPropertiesRuntimeMember(compilerMeta.properties),
  114. ...formatStatesRuntimeMember(compilerMeta.states),
  115. ...(includeMethods ? formatMethodsRuntimeMember(compilerMeta.methods) : {}),
  116. };
  117. };
  118. const formatPropertiesRuntimeMember = (properties) => {
  119. const runtimeMembers = {};
  120. properties.forEach((member) => {
  121. runtimeMembers[member.name] = trimFalsy([
  122. /**
  123. * [0] member type
  124. */
  125. formatFlags(member),
  126. formatAttrName(member),
  127. ]);
  128. });
  129. return runtimeMembers;
  130. };
  131. const formatFlags = (compilerProperty) => {
  132. let type = formatPropType(compilerProperty.type);
  133. if (compilerProperty.mutable) {
  134. type |= 1024 /* MEMBER_FLAGS.Mutable */;
  135. }
  136. if (compilerProperty.reflect) {
  137. type |= 512 /* MEMBER_FLAGS.ReflectAttr */;
  138. }
  139. return type;
  140. };
  141. const formatAttrName = (compilerProperty) => {
  142. if (typeof compilerProperty.attribute === 'string') {
  143. // string attr name means we should observe this attribute
  144. if (compilerProperty.name === compilerProperty.attribute) {
  145. // property name and attribute name are the exact same
  146. // true value means to use the property name for the attribute name
  147. return undefined;
  148. }
  149. // property name and attribute name are not the same
  150. // so we need to return the actual string value
  151. // example: "multiWord" !== "multi-word"
  152. return compilerProperty.attribute;
  153. }
  154. // we shouldn't even observe an attribute for this property
  155. return undefined;
  156. };
  157. const formatPropType = (type) => {
  158. if (type === 'string') {
  159. return 1 /* MEMBER_FLAGS.String */;
  160. }
  161. if (type === 'number') {
  162. return 2 /* MEMBER_FLAGS.Number */;
  163. }
  164. if (type === 'boolean') {
  165. return 4 /* MEMBER_FLAGS.Boolean */;
  166. }
  167. if (type === 'any') {
  168. return 8 /* MEMBER_FLAGS.Any */;
  169. }
  170. return 16 /* MEMBER_FLAGS.Unknown */;
  171. };
  172. const formatStatesRuntimeMember = (states) => {
  173. const runtimeMembers = {};
  174. states.forEach((member) => {
  175. runtimeMembers[member.name] = [
  176. 32 /* MEMBER_FLAGS.State */,
  177. ];
  178. });
  179. return runtimeMembers;
  180. };
  181. const formatMethodsRuntimeMember = (methods) => {
  182. const runtimeMembers = {};
  183. methods.forEach((member) => {
  184. runtimeMembers[member.name] = [
  185. 64 /* MEMBER_FLAGS.Method */,
  186. ];
  187. });
  188. return runtimeMembers;
  189. };
  190. const formatHostListeners = (compilerMeta) => {
  191. return compilerMeta.listeners.map((compilerListener) => {
  192. const hostListener = [
  193. computeListenerFlags(compilerListener),
  194. compilerListener.name,
  195. compilerListener.method,
  196. ];
  197. return hostListener;
  198. });
  199. };
  200. const computeListenerFlags = (listener) => {
  201. let flags = 0;
  202. if (listener.capture) {
  203. flags |= 2 /* LISTENER_FLAGS.Capture */;
  204. }
  205. if (listener.passive) {
  206. flags |= 1 /* LISTENER_FLAGS.Passive */;
  207. }
  208. switch (listener.target) {
  209. case 'document':
  210. flags |= 4 /* LISTENER_FLAGS.TargetDocument */;
  211. break;
  212. case 'window':
  213. flags |= 8 /* LISTENER_FLAGS.TargetWindow */;
  214. break;
  215. case 'body':
  216. flags |= 16 /* LISTENER_FLAGS.TargetBody */;
  217. break;
  218. case 'parent':
  219. flags |= 32 /* LISTENER_FLAGS.TargetParent */;
  220. break;
  221. }
  222. return flags;
  223. };
  224. const trimFalsy = (data) => {
  225. const arr = data;
  226. for (let i = arr.length - 1; i >= 0; i--) {
  227. if (arr[i]) {
  228. break;
  229. }
  230. // if falsy, safe to pop()
  231. arr.pop();
  232. }
  233. return arr;
  234. };
  235. /**
  236. * Convert a string from PascalCase to dash-case
  237. *
  238. * @param str the string to convert
  239. * @returns a converted string
  240. */
  241. const toDashCase = (str) => str
  242. .replace(/([A-Z0-9])/g, (match) => ` ${match[0]}`)
  243. .trim()
  244. .split(' ')
  245. .join('-')
  246. .toLowerCase();
  247. /**
  248. * Convert a string from dash-case / kebab-case to PascalCase (or CamelCase,
  249. * or whatever you call it!)
  250. *
  251. * @param str a string to convert
  252. * @returns a converted string
  253. */
  254. const dashToPascalCase$1 = (str) => str
  255. .toLowerCase()
  256. .split('-')
  257. .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
  258. .join('');
  259. const toTitleCase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
  260. const noop$1 = () => {
  261. /* noop*/
  262. };
  263. const sortBy = (array, prop) => {
  264. return array.slice().sort((a, b) => {
  265. const nameA = prop(a);
  266. const nameB = prop(b);
  267. if (nameA < nameB)
  268. return -1;
  269. if (nameA > nameB)
  270. return 1;
  271. return 0;
  272. });
  273. };
  274. const flatOne = (array) => {
  275. if (array.flat) {
  276. return array.flat(1);
  277. }
  278. return array.reduce((result, item) => {
  279. result.push(...item);
  280. return result;
  281. }, []);
  282. };
  283. const unique = (array, predicate = (i) => i) => {
  284. const set = new Set();
  285. return array.filter((item) => {
  286. const key = predicate(item);
  287. if (key == null) {
  288. return true;
  289. }
  290. if (set.has(key)) {
  291. return false;
  292. }
  293. set.add(key);
  294. return true;
  295. });
  296. };
  297. const fromEntries = (entries) => {
  298. const object = {};
  299. for (const [key, value] of entries) {
  300. object[key] = value;
  301. }
  302. return object;
  303. };
  304. const pluck = (obj, keys) => {
  305. return keys.reduce((final, key) => {
  306. if (obj[key]) {
  307. final[key] = obj[key];
  308. }
  309. return final;
  310. }, {});
  311. };
  312. const isDefined = (v) => v !== null && v !== undefined;
  313. const isBoolean$1 = (v) => typeof v === 'boolean';
  314. const isFunction = (v) => typeof v === 'function';
  315. const isNumber$1 = (v) => typeof v === 'number';
  316. const isObject$5 = (val) => val != null && typeof val === 'object' && Array.isArray(val) === false;
  317. const isString$1 = (v) => typeof v === 'string';
  318. const isIterable = (v) => isDefined(v) && isFunction(v[Symbol.iterator]);
  319. const isPromise = (v) => !!v && (typeof v === 'object' || typeof v === 'function') && typeof v.then === 'function';
  320. const isGlob = (str) => {
  321. const chars = { '{': '}', '(': ')', '[': ']' };
  322. /* eslint-disable-next-line max-len */
  323. const regex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
  324. if (str === '') {
  325. return false;
  326. }
  327. let match;
  328. while ((match = regex.exec(str))) {
  329. if (match[2])
  330. return true;
  331. let idx = match.index + match[0].length;
  332. // if an open bracket/brace/paren is escaped,
  333. // set the index to the next closing character
  334. const open = match[1];
  335. const close = open ? chars[open] : null;
  336. if (open && close) {
  337. const n = str.indexOf(close, idx);
  338. if (n !== -1) {
  339. idx = n + 1;
  340. }
  341. }
  342. str = str.slice(idx);
  343. }
  344. return false;
  345. };
  346. /**
  347. * Checks if the path is the Operating System (OS) root path, such as "/" or "C:\". This function does not take the OS
  348. * the code is running on into account when performing this evaluation.
  349. * @param p the path to check
  350. * @returns `true` if the path is an OS root path, `false` otherwise
  351. */
  352. const isRootPath = (p) => p === '/' || windowsPathRegex.test(p);
  353. // https://github.com/nodejs/node/blob/5883a59b21a97e8b7339f435c977155a2c29ba8d/lib/path.js#L43
  354. const windowsPathRegex = /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?[\\/]$/;
  355. /**
  356. * Builds a template `Diagnostic` entity for a build error. The created `Diagnostic` is returned, and have little
  357. * detail attached to it regarding the specifics of the error - it is the responsibility of the caller of this method
  358. * to attach the specifics of the error message.
  359. *
  360. * The created `Diagnostic` is pushed to the `diagnostics` argument as a side effect of calling this method.
  361. *
  362. * @param diagnostics the existing diagnostics that the created template `Diagnostic` should be added to
  363. * @returns the created `Diagnostic`
  364. */
  365. const buildError = (diagnostics) => {
  366. const diagnostic = {
  367. level: 'error',
  368. type: 'build',
  369. header: 'Build Error',
  370. messageText: 'build error',
  371. relFilePath: null,
  372. absFilePath: null,
  373. lines: [],
  374. };
  375. if (diagnostics) {
  376. diagnostics.push(diagnostic);
  377. }
  378. return diagnostic;
  379. };
  380. /**
  381. * Builds a template `Diagnostic` entity for a build warning. The created `Diagnostic` is returned, and have little
  382. * detail attached to it regarding the specifics of the warning - it is the responsibility of the caller of this method
  383. * to attach the specifics of the warning message.
  384. *
  385. * The created `Diagnostic` is pushed to the `diagnostics` argument as a side effect of calling this method.
  386. *
  387. * @param diagnostics the existing diagnostics that the created template `Diagnostic` should be added to
  388. * @returns the created `Diagnostic`
  389. */
  390. const buildWarn = (diagnostics) => {
  391. const diagnostic = {
  392. level: 'warn',
  393. type: 'build',
  394. header: 'Build Warn',
  395. messageText: 'build warn',
  396. relFilePath: null,
  397. absFilePath: null,
  398. lines: [],
  399. };
  400. diagnostics.push(diagnostic);
  401. return diagnostic;
  402. };
  403. /**
  404. * Create a diagnostic message suited for representing an error in a JSON
  405. * file. This includes information about the exact lines in the JSON file which
  406. * caused the error and the path to the file.
  407. *
  408. * @param compilerCtx the current compiler context
  409. * @param diagnostics a list of diagnostics used as a return param
  410. * @param jsonFilePath the path to the JSON file where the error occurred
  411. * @param msg the error message
  412. * @param jsonField the key for the field which caused the error, used for finding
  413. * the error line in the original JSON file
  414. * @returns a reference to the newly-created diagnostic
  415. */
  416. const buildJsonFileError = (compilerCtx, diagnostics, jsonFilePath, msg, jsonField) => {
  417. const err = buildError(diagnostics);
  418. err.messageText = msg;
  419. err.absFilePath = jsonFilePath;
  420. if (typeof jsonField === 'string') {
  421. try {
  422. const jsonStr = compilerCtx.fs.readFileSync(jsonFilePath);
  423. const lines = jsonStr.replace(/\r/g, '\n').split('\n');
  424. for (let i = 0; i < lines.length; i++) {
  425. const txtLine = lines[i];
  426. const txtIndex = txtLine.indexOf(jsonField);
  427. if (txtIndex > -1) {
  428. const warnLine = {
  429. lineIndex: i,
  430. lineNumber: i + 1,
  431. text: txtLine,
  432. errorCharStart: txtIndex,
  433. errorLength: jsonField.length,
  434. };
  435. err.lineNumber = warnLine.lineNumber;
  436. err.columnNumber = txtIndex + 1;
  437. err.lines.push(warnLine);
  438. if (i >= 0) {
  439. const beforeWarnLine = {
  440. lineIndex: warnLine.lineIndex - 1,
  441. lineNumber: warnLine.lineNumber - 1,
  442. text: lines[i - 1],
  443. errorCharStart: -1,
  444. errorLength: -1,
  445. };
  446. err.lines.unshift(beforeWarnLine);
  447. }
  448. if (i < lines.length) {
  449. const afterWarnLine = {
  450. lineIndex: warnLine.lineIndex + 1,
  451. lineNumber: warnLine.lineNumber + 1,
  452. text: lines[i + 1],
  453. errorCharStart: -1,
  454. errorLength: -1,
  455. };
  456. err.lines.push(afterWarnLine);
  457. }
  458. break;
  459. }
  460. }
  461. }
  462. catch (e) { }
  463. }
  464. return err;
  465. };
  466. /**
  467. * Builds a diagnostic from an `Error`, appends it to the `diagnostics` parameter, and returns the created diagnostic
  468. * @param diagnostics the series of diagnostics the newly created diagnostics should be added to
  469. * @param err the error to derive information from in generating the diagnostic
  470. * @param msg an optional message to use in place of `err` to generate the diagnostic
  471. * @returns the generated diagnostic
  472. */
  473. const catchError = (diagnostics, err, msg) => {
  474. const diagnostic = {
  475. level: 'error',
  476. type: 'build',
  477. header: 'Build Error',
  478. messageText: 'build error',
  479. relFilePath: null,
  480. absFilePath: null,
  481. lines: [],
  482. };
  483. if (isString$1(msg)) {
  484. diagnostic.messageText = msg.length ? msg : 'UNKNOWN ERROR';
  485. }
  486. else if (err != null) {
  487. if (err.stack != null) {
  488. diagnostic.messageText = err.stack.toString();
  489. }
  490. else {
  491. if (err.message != null) {
  492. diagnostic.messageText = err.message.length ? err.message : 'UNKNOWN ERROR';
  493. }
  494. else {
  495. diagnostic.messageText = err.toString();
  496. }
  497. }
  498. }
  499. if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
  500. diagnostics.push(diagnostic);
  501. }
  502. return diagnostic;
  503. };
  504. /**
  505. * Determine if the provided diagnostics have any build errors
  506. * @param diagnostics the diagnostics to inspect
  507. * @returns true if any of the diagnostics in the list provided are errors that did not occur at runtime. false
  508. * otherwise.
  509. */
  510. const hasError = (diagnostics) => {
  511. if (diagnostics == null || diagnostics.length === 0) {
  512. return false;
  513. }
  514. return diagnostics.some((d) => d.level === 'error' && d.type !== 'runtime');
  515. };
  516. /**
  517. * Determine if the provided diagnostics have any warnings
  518. * @param diagnostics the diagnostics to inspect
  519. * @returns true if any of the diagnostics in the list provided are warnings. false otherwise.
  520. */
  521. const hasWarning = (diagnostics) => {
  522. if (diagnostics == null || diagnostics.length === 0) {
  523. return false;
  524. }
  525. return diagnostics.some((d) => d.level === 'warn');
  526. };
  527. const shouldIgnoreError = (msg) => {
  528. return msg === TASK_CANCELED_MSG;
  529. };
  530. const TASK_CANCELED_MSG = `task canceled`;
  531. /**
  532. * Iterate through a series of diagnostics to provide minor fix-ups for various edge cases, deduplicate messages, etc.
  533. * @param compilerCtx the current compiler context
  534. * @param diagnostics the diagnostics to normalize
  535. * @returns the normalize documents
  536. */
  537. const normalizeDiagnostics = (compilerCtx, diagnostics) => {
  538. const maxErrorsToNormalize = 25;
  539. const normalizedErrors = [];
  540. const normalizedOthers = [];
  541. const dups = new Set();
  542. for (let i = 0; i < diagnostics.length; i++) {
  543. const d = normalizeDiagnostic(compilerCtx, diagnostics[i]);
  544. const key = d.absFilePath + d.code + d.messageText + d.type;
  545. if (dups.has(key)) {
  546. continue;
  547. }
  548. dups.add(key);
  549. const total = normalizedErrors.length + normalizedOthers.length;
  550. if (d.level === 'error') {
  551. normalizedErrors.push(d);
  552. }
  553. else if (total < maxErrorsToNormalize) {
  554. normalizedOthers.push(d);
  555. }
  556. }
  557. return [...normalizedErrors, ...normalizedOthers];
  558. };
  559. /**
  560. * Perform post-processing on a `Diagnostic` to handle a few message edge cases, massaging error message text and
  561. * updating build failure contexts
  562. * @param compilerCtx the current compiler
  563. * @param diagnostic the diagnostic to normalize
  564. * @returns the altered diagnostic
  565. */
  566. const normalizeDiagnostic = (compilerCtx, diagnostic) => {
  567. if (diagnostic.messageText) {
  568. if (typeof diagnostic.messageText.message === 'string') {
  569. diagnostic.messageText = diagnostic.messageText.message;
  570. }
  571. else if (typeof diagnostic.messageText === 'string' && diagnostic.messageText.indexOf('Error: ') === 0) {
  572. diagnostic.messageText = diagnostic.messageText.slice(7);
  573. }
  574. }
  575. if (diagnostic.messageText) {
  576. if (diagnostic.messageText.includes(`Cannot find name 'h'`)) {
  577. diagnostic.header = `Missing "h" import for JSX types`;
  578. diagnostic.messageText = `In order to load accurate JSX types for components, the "h" function must be imported from "@stencil/core" by each component using JSX. For example: import { Component, h } from '@stencil/core';`;
  579. try {
  580. const sourceText = compilerCtx.fs.readFileSync(diagnostic.absFilePath);
  581. const srcLines = splitLineBreaks(sourceText);
  582. for (let i = 0; i < srcLines.length; i++) {
  583. const srcLine = srcLines[i];
  584. if (srcLine.includes('@stencil/core')) {
  585. const msgLines = [];
  586. const beforeLineIndex = i - 1;
  587. if (beforeLineIndex > -1) {
  588. const beforeLine = {
  589. lineIndex: beforeLineIndex,
  590. lineNumber: beforeLineIndex + 1,
  591. text: srcLines[beforeLineIndex],
  592. errorCharStart: -1,
  593. errorLength: -1,
  594. };
  595. msgLines.push(beforeLine);
  596. }
  597. const errorLine = {
  598. lineIndex: i,
  599. lineNumber: i + 1,
  600. text: srcLine,
  601. errorCharStart: 0,
  602. errorLength: -1,
  603. };
  604. msgLines.push(errorLine);
  605. diagnostic.lineNumber = errorLine.lineNumber;
  606. diagnostic.columnNumber = srcLine.indexOf('}');
  607. const afterLineIndex = i + 1;
  608. if (afterLineIndex < srcLines.length) {
  609. const afterLine = {
  610. lineIndex: afterLineIndex,
  611. lineNumber: afterLineIndex + 1,
  612. text: srcLines[afterLineIndex],
  613. errorCharStart: -1,
  614. errorLength: -1,
  615. };
  616. msgLines.push(afterLine);
  617. }
  618. diagnostic.lines = msgLines;
  619. break;
  620. }
  621. }
  622. }
  623. catch (e) { }
  624. }
  625. }
  626. return diagnostic;
  627. };
  628. /**
  629. * Split a corpus by newlines. Carriage returns are treated a newlines.
  630. * @param sourceText the corpus to split
  631. * @returns the split text
  632. */
  633. const splitLineBreaks = (sourceText) => {
  634. if (typeof sourceText !== 'string')
  635. return [];
  636. sourceText = sourceText.replace(/\\r/g, '\n');
  637. return sourceText.split('\n');
  638. };
  639. const escapeHtml = (unsafe) => {
  640. if (unsafe === undefined)
  641. return 'undefined';
  642. if (unsafe === null)
  643. return 'null';
  644. if (typeof unsafe !== 'string') {
  645. unsafe = unsafe.toString();
  646. }
  647. return unsafe
  648. .replace(/&/g, '&amp;')
  649. .replace(/</g, '&lt;')
  650. .replace(/>/g, '&gt;')
  651. .replace(/"/g, '&quot;')
  652. .replace(/'/g, '&#039;');
  653. };
  654. const loadRollupDiagnostics = (config, compilerCtx, buildCtx, rollupError) => {
  655. const formattedCode = formatErrorCode(rollupError.code);
  656. const diagnostic = {
  657. level: 'error',
  658. type: 'bundling',
  659. language: 'javascript',
  660. code: rollupError.code,
  661. header: `Rollup${formattedCode.length > 0 ? ': ' + formattedCode : ''}`,
  662. messageText: formattedCode,
  663. relFilePath: null,
  664. absFilePath: null,
  665. lines: [],
  666. };
  667. if (config.logLevel === 'debug' && rollupError.stack) {
  668. diagnostic.messageText = rollupError.stack;
  669. }
  670. else if (rollupError.message) {
  671. diagnostic.messageText = rollupError.message;
  672. }
  673. if (rollupError.plugin) {
  674. diagnostic.messageText += ` (plugin: ${rollupError.plugin}${rollupError.hook ? `, ${rollupError.hook}` : ''})`;
  675. }
  676. const loc = rollupError.loc;
  677. if (loc != null) {
  678. const srcFile = loc.file || rollupError.id;
  679. if (isString$1(srcFile)) {
  680. try {
  681. const sourceText = compilerCtx.fs.readFileSync(srcFile);
  682. if (sourceText) {
  683. diagnostic.absFilePath = srcFile;
  684. try {
  685. const srcLines = splitLineBreaks(sourceText);
  686. const errorLine = {
  687. lineIndex: loc.line - 1,
  688. lineNumber: loc.line,
  689. text: srcLines[loc.line - 1],
  690. errorCharStart: loc.column,
  691. errorLength: 0,
  692. };
  693. diagnostic.lineNumber = errorLine.lineNumber;
  694. diagnostic.columnNumber = errorLine.errorCharStart;
  695. const highlightLine = errorLine.text.slice(loc.column);
  696. for (let i = 0; i < highlightLine.length; i++) {
  697. if (charBreak.has(highlightLine.charAt(i))) {
  698. break;
  699. }
  700. errorLine.errorLength++;
  701. }
  702. diagnostic.lines.push(errorLine);
  703. if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
  704. errorLine.errorLength = 1;
  705. errorLine.errorCharStart--;
  706. }
  707. if (errorLine.lineIndex > 0) {
  708. const previousLine = {
  709. lineIndex: errorLine.lineIndex - 1,
  710. lineNumber: errorLine.lineNumber - 1,
  711. text: srcLines[errorLine.lineIndex - 1],
  712. errorCharStart: -1,
  713. errorLength: -1,
  714. };
  715. diagnostic.lines.unshift(previousLine);
  716. }
  717. if (errorLine.lineIndex + 1 < srcLines.length) {
  718. const nextLine = {
  719. lineIndex: errorLine.lineIndex + 1,
  720. lineNumber: errorLine.lineNumber + 1,
  721. text: srcLines[errorLine.lineIndex + 1],
  722. errorCharStart: -1,
  723. errorLength: -1,
  724. };
  725. diagnostic.lines.push(nextLine);
  726. }
  727. }
  728. catch (e) {
  729. diagnostic.messageText += `\nError parsing: ${diagnostic.absFilePath}, line: ${loc.line}, column: ${loc.column}`;
  730. diagnostic.debugText = sourceText;
  731. }
  732. }
  733. else if (typeof rollupError.frame === 'string') {
  734. diagnostic.messageText += '\n' + rollupError.frame;
  735. }
  736. }
  737. catch (e) { }
  738. }
  739. }
  740. buildCtx.diagnostics.push(diagnostic);
  741. };
  742. const createOnWarnFn = (diagnostics, bundleModulesFiles) => {
  743. const previousWarns = new Set();
  744. return function onWarningMessage(warning) {
  745. if (warning == null || ignoreWarnCodes.has(warning.code) || previousWarns.has(warning.message)) {
  746. return;
  747. }
  748. previousWarns.add(warning.message);
  749. let label = '';
  750. if (bundleModulesFiles) {
  751. label = bundleModulesFiles
  752. .reduce((cmps, m) => {
  753. cmps.push(...m.cmps);
  754. return cmps;
  755. }, [])
  756. .join(', ')
  757. .trim();
  758. if (label.length) {
  759. label += ': ';
  760. }
  761. }
  762. const diagnostic = buildWarn(diagnostics);
  763. diagnostic.header = `Bundling Warning ${warning.code}`;
  764. diagnostic.messageText = label + (warning.message || warning);
  765. };
  766. };
  767. const ignoreWarnCodes = new Set([
  768. 'THIS_IS_UNDEFINED',
  769. 'NON_EXISTENT_EXPORT',
  770. 'CIRCULAR_DEPENDENCY',
  771. 'EMPTY_BUNDLE',
  772. 'UNUSED_EXTERNAL_IMPORT',
  773. ]);
  774. const charBreak = new Set([' ', '=', '.', ',', '?', ':', ';', '(', ')', '{', '}', '[', ']', '|', `'`, `"`, '`']);
  775. const formatErrorCode = (errorCode) => {
  776. if (typeof errorCode === 'string') {
  777. return errorCode
  778. .split('_')
  779. .map((c) => {
  780. return toTitleCase(c.toLowerCase());
  781. })
  782. .join(' ');
  783. }
  784. return (errorCode || '').trim();
  785. };
  786. /**
  787. * Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar
  788. * Forward-slash paths can be used in Windows as long as they're not
  789. * extended-length paths and don't contain any non-ascii characters.
  790. * This was created since the path methods in Node.js outputs \\ paths on Windows.
  791. * @param path the Windows-based path to convert
  792. * @returns the converted path
  793. */
  794. const normalizePath$1 = (path) => {
  795. if (typeof path !== 'string') {
  796. throw new Error(`invalid path to normalize`);
  797. }
  798. path = normalizeSlashes(path.trim());
  799. const components = pathComponents(path, getRootLength(path));
  800. const reducedComponents = reducePathComponents(components);
  801. const rootPart = reducedComponents[0];
  802. const secondPart = reducedComponents[1];
  803. const normalized = rootPart + reducedComponents.slice(1).join('/');
  804. if (normalized === '') {
  805. return '.';
  806. }
  807. if (rootPart === '' &&
  808. secondPart &&
  809. path.includes('/') &&
  810. !secondPart.startsWith('.') &&
  811. !secondPart.startsWith('@')) {
  812. return './' + normalized;
  813. }
  814. return normalized;
  815. };
  816. const normalizeSlashes = (path) => path.replace(backslashRegExp, '/');
  817. const altDirectorySeparator = '\\';
  818. const urlSchemeSeparator = '://';
  819. const backslashRegExp = /\\/g;
  820. const reducePathComponents = (components) => {
  821. if (!Array.isArray(components) || components.length === 0) {
  822. return [];
  823. }
  824. const reduced = [components[0]];
  825. for (let i = 1; i < components.length; i++) {
  826. const component = components[i];
  827. if (!component)
  828. continue;
  829. if (component === '.')
  830. continue;
  831. if (component === '..') {
  832. if (reduced.length > 1) {
  833. if (reduced[reduced.length - 1] !== '..') {
  834. reduced.pop();
  835. continue;
  836. }
  837. }
  838. else if (reduced[0])
  839. continue;
  840. }
  841. reduced.push(component);
  842. }
  843. return reduced;
  844. };
  845. const getRootLength = (path) => {
  846. const rootLength = getEncodedRootLength(path);
  847. return rootLength < 0 ? ~rootLength : rootLength;
  848. };
  849. const getEncodedRootLength = (path) => {
  850. if (!path)
  851. return 0;
  852. const ch0 = path.charCodeAt(0);
  853. // POSIX or UNC
  854. if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
  855. if (path.charCodeAt(1) !== ch0)
  856. return 1; // POSIX: "/" (or non-normalized "\")
  857. const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? '/' : altDirectorySeparator, 2);
  858. if (p1 < 0)
  859. return path.length; // UNC: "//server" or "\\server"
  860. return p1 + 1; // UNC: "//server/" or "\\server\"
  861. }
  862. // DOS
  863. if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
  864. const ch2 = path.charCodeAt(2);
  865. if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
  866. return 3; // DOS: "c:/" or "c:\"
  867. if (path.length === 2)
  868. return 2; // DOS: "c:" (but not "c:d")
  869. }
  870. // URL
  871. const schemeEnd = path.indexOf(urlSchemeSeparator);
  872. if (schemeEnd !== -1) {
  873. const authorityStart = schemeEnd + urlSchemeSeparator.length;
  874. const authorityEnd = path.indexOf('/', authorityStart);
  875. if (authorityEnd !== -1) {
  876. // URL: "file:///", "file://server/", "file://server/path"
  877. // For local "file" URLs, include the leading DOS volume (if present).
  878. // Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a
  879. // special case interpreted as "the machine from which the URL is being interpreted".
  880. const scheme = path.slice(0, schemeEnd);
  881. const authority = path.slice(authorityStart, authorityEnd);
  882. if (scheme === 'file' &&
  883. (authority === '' || authority === 'localhost') &&
  884. isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
  885. const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
  886. if (volumeSeparatorEnd !== -1) {
  887. if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
  888. // URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
  889. return ~(volumeSeparatorEnd + 1);
  890. }
  891. if (volumeSeparatorEnd === path.length) {
  892. // URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a"
  893. // but not "file:///c:d" or "file:///c%3ad"
  894. return ~volumeSeparatorEnd;
  895. }
  896. }
  897. }
  898. return ~(authorityEnd + 1); // URL: "file://server/", "http://server/"
  899. }
  900. return ~path.length; // URL: "file://server", "http://server"
  901. }
  902. // relative
  903. return 0;
  904. };
  905. const isVolumeCharacter = (charCode) => (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
  906. (charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */);
  907. const getFileUrlVolumeSeparatorEnd = (url, start) => {
  908. const ch0 = url.charCodeAt(start);
  909. if (ch0 === 58 /* CharacterCodes.colon */)
  910. return start + 1;
  911. if (ch0 === 37 /* CharacterCodes.percent */ && url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
  912. const ch2 = url.charCodeAt(start + 2);
  913. if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
  914. return start + 3;
  915. }
  916. return -1;
  917. };
  918. const pathComponents = (path, rootLength) => {
  919. const root = path.substring(0, rootLength);
  920. const rest = path.substring(rootLength).split('/');
  921. const restLen = rest.length;
  922. if (restLen > 0 && !rest[restLen - 1]) {
  923. rest.pop();
  924. }
  925. return [root, ...rest];
  926. };
  927. /**
  928. * Same as normalizePath(), expect it'll also strip any query strings
  929. * from the path name. So /dir/file.css?tag=cmp-a becomes /dir/file.css
  930. * @param p the path to normalize
  931. * @returns the normalized path, sans any query strings
  932. */
  933. const normalizeFsPath = (p) => normalizePath$1(p.split('?')[0].replace(/\0/g, ''));
  934. const normalizeFsPathQuery = (importPath) => {
  935. const pathParts = importPath.split('?');
  936. const filePath = normalizePath$1(pathParts[0]);
  937. const ext = filePath.split('.').pop().toLowerCase();
  938. const params = pathParts.length > 1 ? new URLSearchParams(pathParts[1]) : null;
  939. const format = params ? params.get('format') : null;
  940. return {
  941. filePath,
  942. ext,
  943. params,
  944. format,
  945. };
  946. };
  947. /**
  948. * Augment a `Diagnostic` with information from a `Node` in the AST to provide richer error information
  949. * @param d the diagnostic to augment
  950. * @param node the node to augment with additional information
  951. * @returns the augmented diagnostic
  952. */
  953. const augmentDiagnosticWithNode = (d, node) => {
  954. if (!node) {
  955. return d;
  956. }
  957. const sourceFile = node.getSourceFile();
  958. if (!sourceFile) {
  959. return d;
  960. }
  961. d.absFilePath = normalizePath$1(sourceFile.fileName);
  962. const sourceText = sourceFile.text;
  963. const srcLines = splitLineBreaks(sourceText);
  964. const start = node.getStart();
  965. const end = node.getEnd();
  966. const posStart = sourceFile.getLineAndCharacterOfPosition(start);
  967. const errorLine = {
  968. lineIndex: posStart.line,
  969. lineNumber: posStart.line + 1,
  970. text: srcLines[posStart.line],
  971. errorCharStart: posStart.character,
  972. errorLength: Math.max(end - start, 1),
  973. };
  974. // store metadata for line number and character index where the error occurred
  975. d.lineNumber = errorLine.lineNumber;
  976. d.columnNumber = errorLine.errorCharStart + 1;
  977. d.lines.push(errorLine);
  978. if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
  979. errorLine.errorLength = 1;
  980. errorLine.errorCharStart--;
  981. }
  982. // if the error did not occur on the first line of the file, add metadata for the line of code preceding the line
  983. // where the error was detected to provide the user with additional context
  984. if (errorLine.lineIndex > 0) {
  985. const previousLine = {
  986. lineIndex: errorLine.lineIndex - 1,
  987. lineNumber: errorLine.lineNumber - 1,
  988. text: srcLines[errorLine.lineIndex - 1],
  989. errorCharStart: -1,
  990. errorLength: -1,
  991. };
  992. d.lines.unshift(previousLine);
  993. }
  994. // if the error did not occur on the last line of the file, add metadata for the line of code following the line
  995. // where the error was detected to provide the user with additional context
  996. if (errorLine.lineIndex + 1 < srcLines.length) {
  997. const nextLine = {
  998. lineIndex: errorLine.lineIndex + 1,
  999. lineNumber: errorLine.lineNumber + 1,
  1000. text: srcLines[errorLine.lineIndex + 1],
  1001. errorCharStart: -1,
  1002. errorLength: -1,
  1003. };
  1004. d.lines.push(nextLine);
  1005. }
  1006. return d;
  1007. };
  1008. /**
  1009. * Ok, so formatting overkill, we know. But whatever, it makes for great
  1010. * error reporting within a terminal. So, yeah, let's code it up, shall we?
  1011. */
  1012. const loadTypeScriptDiagnostics = (tsDiagnostics) => {
  1013. const diagnostics = [];
  1014. const maxErrors = Math.min(tsDiagnostics.length, 50);
  1015. for (let i = 0; i < maxErrors; i++) {
  1016. diagnostics.push(loadTypeScriptDiagnostic(tsDiagnostics[i]));
  1017. }
  1018. return diagnostics;
  1019. };
  1020. /**
  1021. * Convert a TypeScript diagnostic object into our internal, Stencil-specific
  1022. * diagnostic format
  1023. *
  1024. * @param tsDiagnostic a TypeScript diagnostic message record
  1025. * @returns a Stencil diagnostic, suitable for showing an error to the user
  1026. */
  1027. const loadTypeScriptDiagnostic = (tsDiagnostic) => {
  1028. const d = {
  1029. level: 'warn',
  1030. type: 'typescript',
  1031. language: 'typescript',
  1032. header: 'TypeScript',
  1033. code: tsDiagnostic.code.toString(),
  1034. messageText: flattenDiagnosticMessageText(tsDiagnostic, tsDiagnostic.messageText),
  1035. relFilePath: null,
  1036. absFilePath: null,
  1037. lines: [],
  1038. };
  1039. if (tsDiagnostic.category === 1) {
  1040. d.level = 'error';
  1041. }
  1042. if (tsDiagnostic.file) {
  1043. d.absFilePath = tsDiagnostic.file.fileName;
  1044. const sourceText = tsDiagnostic.file.text;
  1045. const srcLines = splitLineBreaks(sourceText);
  1046. const posData = tsDiagnostic.file.getLineAndCharacterOfPosition(tsDiagnostic.start);
  1047. const errorLine = {
  1048. lineIndex: posData.line,
  1049. lineNumber: posData.line + 1,
  1050. text: srcLines[posData.line],
  1051. errorCharStart: posData.character,
  1052. errorLength: Math.max(tsDiagnostic.length, 1),
  1053. };
  1054. d.lineNumber = errorLine.lineNumber;
  1055. d.columnNumber = errorLine.errorCharStart + 1;
  1056. d.lines.push(errorLine);
  1057. if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
  1058. errorLine.errorLength = 1;
  1059. errorLine.errorCharStart--;
  1060. }
  1061. if (errorLine.lineIndex > 0) {
  1062. const previousLine = {
  1063. lineIndex: errorLine.lineIndex - 1,
  1064. lineNumber: errorLine.lineNumber - 1,
  1065. text: srcLines[errorLine.lineIndex - 1],
  1066. errorCharStart: -1,
  1067. errorLength: -1,
  1068. };
  1069. d.lines.unshift(previousLine);
  1070. }
  1071. if (errorLine.lineIndex + 1 < srcLines.length) {
  1072. const nextLine = {
  1073. lineIndex: errorLine.lineIndex + 1,
  1074. lineNumber: errorLine.lineNumber + 1,
  1075. text: srcLines[errorLine.lineIndex + 1],
  1076. errorCharStart: -1,
  1077. errorLength: -1,
  1078. };
  1079. d.lines.push(nextLine);
  1080. }
  1081. }
  1082. return d;
  1083. };
  1084. /**
  1085. * Flatten a TypeScript diagnostic object into a string which can be easily
  1086. * included in a Stencil diagnostic record.
  1087. *
  1088. * @param tsDiagnostic a TypeScript diagnostic record
  1089. * @param diag a {@link DiagnosticMessageChain} or a string with further info
  1090. * @returns a string with the relevant error message
  1091. */
  1092. const flattenDiagnosticMessageText = (tsDiagnostic, diag) => {
  1093. var _a, _b;
  1094. if (typeof diag === 'string') {
  1095. return diag;
  1096. }
  1097. else if (diag === undefined) {
  1098. return '';
  1099. }
  1100. const ignoreCodes = [];
  1101. // `tsDiagnostic.file` can be `undefined`, so we need to be a little careful here
  1102. const isStencilConfig = ((_b = (_a = tsDiagnostic.file) === null || _a === void 0 ? void 0 : _a.fileName) !== null && _b !== void 0 ? _b : '').includes('stencil.config');
  1103. if (isStencilConfig) {
  1104. ignoreCodes.push(2322);
  1105. }
  1106. let result = '';
  1107. if (!ignoreCodes.includes(diag.code)) {
  1108. result = diag.messageText;
  1109. if (isIterable(diag.next)) {
  1110. for (const kid of diag.next) {
  1111. result += flattenDiagnosticMessageText(tsDiagnostic, kid);
  1112. }
  1113. }
  1114. }
  1115. if (isStencilConfig) {
  1116. result = result.replace(`type 'StencilConfig'`, `Stencil Config`);
  1117. result = result.replace(`Object literal may only specify known properties, but `, ``);
  1118. result = result.replace(`Object literal may only specify known properties, and `, ``);
  1119. }
  1120. return result.trim();
  1121. };
  1122. /**
  1123. * Converts a rollup provided source map to one that Stencil can easily understand
  1124. * @param rollupSourceMap the sourcemap to transform
  1125. * @returns the transformed sourcemap
  1126. */
  1127. const rollupToStencilSourceMap = (rollupSourceMap) => {
  1128. if (!rollupSourceMap) {
  1129. return null;
  1130. }
  1131. return {
  1132. file: rollupSourceMap.file,
  1133. mappings: rollupSourceMap.mappings,
  1134. names: rollupSourceMap.names,
  1135. sources: rollupSourceMap.sources,
  1136. sourcesContent: rollupSourceMap.sourcesContent,
  1137. version: rollupSourceMap.version,
  1138. };
  1139. };
  1140. /**
  1141. * A JavaScript formatted string used to link generated code back to the original. This string follows the guidelines
  1142. * found in the [Linking generated code to source maps](https://sourcemaps.info/spec.html#h.lmz475t4mvbx) section of
  1143. * the Sourcemaps V3 specification proposal.
  1144. */
  1145. const JS_SOURCE_MAPPING_URL_LINKER = '//# sourceMappingURL=';
  1146. /**
  1147. * Generates an RFC-3986 compliant string for the given input.
  1148. * More information about RFC-3986 can be found [here](https://datatracker.ietf.org/doc/html/rfc3986)
  1149. * This function's original source is derived from
  1150. * [MDN's encodeURIComponent documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#description)
  1151. * @param filename the filename to encode
  1152. * @returns the encoded URI
  1153. */
  1154. const encodeToRfc3986 = (filename) => {
  1155. const encodedUri = encodeURIComponent(filename);
  1156. // replace all '!', single quotes, '(', ')', and '*' with their hexadecimal values (UTF-16)
  1157. return encodedUri.replace(/[!'()*]/g, (matchedCharacter) => {
  1158. return '%' + matchedCharacter.charCodeAt(0).toString(16);
  1159. });
  1160. };
  1161. /**
  1162. * Generates a string used to link generated code with the original source, to be placed at the end of the generated
  1163. * code.
  1164. * @param url the url of the source map
  1165. * @returns a linker string, of the format {@link JS_SOURCE_MAPPING_URL_LINKER}=<url>
  1166. */
  1167. const getSourceMappingUrlLinker = (url) => {
  1168. return `${JS_SOURCE_MAPPING_URL_LINKER}${encodeToRfc3986(url)}`;
  1169. };
  1170. /**
  1171. * Generates a string used to link generated code with the original source, to be placed at the end of the generated
  1172. * code as an inline source map.
  1173. * @param sourceMapContents the sourceMapContents of the source map
  1174. * @returns a linker string, of the format {@link JS_SOURCE_MAPPING_URL_LINKER}<dataUriPrefixAndMime><sourceMapContents>
  1175. */
  1176. const getInlineSourceMappingUrlLinker = (sourceMapContents) => {
  1177. const mapBase64 = Buffer.from(sourceMapContents, 'utf8').toString('base64');
  1178. // do not RFC-3986 encode an already valid base64 string. the sourcemaps will not resolve correctly when there is an
  1179. // allowed base64 character is encoded (because it is a disallowed RFC-3986 character)
  1180. return `${JS_SOURCE_MAPPING_URL_LINKER}data:application/json;charset=utf-8;base64,${mapBase64}`;
  1181. };
  1182. /**
  1183. * Generates a string used to link generated code with the original source, to be placed at the end of the generated
  1184. * code. This function prepends a newline to the string.
  1185. * @param url the url of the source map
  1186. * @returns a linker string, of the format {@link JS_SOURCE_MAPPING_URL_LINKER}=<url>.map, prepended with a newline
  1187. */
  1188. const getSourceMappingUrlForEndOfFile = (url) => {
  1189. return `\n${getSourceMappingUrlLinker(url)}.map`;
  1190. };
  1191. /**
  1192. * Determines whether a string should be considered a remote url or not.
  1193. *
  1194. * This helper only checks the provided string to evaluate is one of a few pre-defined schemes, and should not be
  1195. * considered all-encompassing
  1196. *
  1197. * @param p the string to evaluate
  1198. * @returns `true` if the provided string is a remote url, `false` otherwise
  1199. */
  1200. const isRemoteUrl = (p) => {
  1201. if (isString$1(p)) {
  1202. p = p.toLowerCase();
  1203. return p.startsWith('https://') || p.startsWith('http://');
  1204. }
  1205. return false;
  1206. };
  1207. const createJsVarName = (fileName) => {
  1208. if (isString$1(fileName)) {
  1209. fileName = fileName.split('?')[0];
  1210. fileName = fileName.split('#')[0];
  1211. fileName = fileName.split('&')[0];
  1212. fileName = fileName.split('=')[0];
  1213. fileName = toDashCase(fileName);
  1214. fileName = fileName.replace(/[|;$%@"<>()+,.{}_\!\/\\]/g, '-');
  1215. fileName = dashToPascalCase$1(fileName);
  1216. if (fileName.length > 1) {
  1217. fileName = fileName[0].toLowerCase() + fileName.slice(1);
  1218. }
  1219. else {
  1220. fileName = fileName.toLowerCase();
  1221. }
  1222. if (fileName.length > 0 && !isNaN(fileName[0])) {
  1223. fileName = '_' + fileName;
  1224. }
  1225. }
  1226. return fileName;
  1227. };
  1228. /**
  1229. * Determines if a given file path points to a type declaration file (ending in .d.ts) or not. This function is
  1230. * case-insensitive in its heuristics.
  1231. * @param filePath the path to check
  1232. * @returns `true` if the given `filePath` points to a type declaration file, `false` otherwise
  1233. */
  1234. const isDtsFile$1 = (filePath) => {
  1235. const parts = filePath.toLowerCase().split('.');
  1236. if (parts.length > 2) {
  1237. return parts[parts.length - 2] === 'd' && parts[parts.length - 1] === 'ts';
  1238. }
  1239. return false;
  1240. };
  1241. /**
  1242. * Generate the preamble to be placed atop the main file of the build
  1243. * @param config the Stencil configuration file
  1244. * @returns the generated preamble
  1245. */
  1246. const generatePreamble = (config) => {
  1247. const { preamble } = config;
  1248. if (!preamble) {
  1249. return '';
  1250. }
  1251. // generate the body of the JSDoc-style comment
  1252. const preambleComment = preamble.split('\n').map((l) => ` * ${l}`);
  1253. preambleComment.unshift(`/*!`);
  1254. preambleComment.push(` */`);
  1255. return preambleComment.join('\n');
  1256. };
  1257. const lineBreakRegex = /\r?\n|\r/g;
  1258. function getTextDocs(docs) {
  1259. if (docs == null) {
  1260. return '';
  1261. }
  1262. return `${docs.text.replace(lineBreakRegex, ' ')}
  1263. ${docs.tags
  1264. .filter((tag) => tag.name !== 'internal')
  1265. .map((tag) => `@${tag.name} ${(tag.text || '').replace(lineBreakRegex, ' ')}`)
  1266. .join('\n')}`.trim();
  1267. }
  1268. /**
  1269. * Retrieve a project's dependencies from the current build context
  1270. * @param buildCtx the current build context to query for a specific package
  1271. * @returns a list of package names the project is dependent on
  1272. */
  1273. const getDependencies = (buildCtx) => {
  1274. if (buildCtx.packageJson != null && buildCtx.packageJson.dependencies != null) {
  1275. return Object.keys(buildCtx.packageJson.dependencies).filter((pkgName) => !SKIP_DEPS.includes(pkgName));
  1276. }
  1277. return [];
  1278. };
  1279. /**
  1280. * Utility to determine whether a project has a dependency on a package
  1281. * @param buildCtx the current build context to query for a specific package
  1282. * @param depName the name of the dependency/package
  1283. * @returns `true` if the project has a dependency a packaged with the provided name, `false` otherwise
  1284. */
  1285. const hasDependency = (buildCtx, depName) => {
  1286. return getDependencies(buildCtx).includes(depName);
  1287. };
  1288. const getDynamicImportFunction$1 = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
  1289. const readPackageJson = async (config, compilerCtx, buildCtx) => {
  1290. try {
  1291. const pkgJson = await compilerCtx.fs.readFile(config.packageJsonFilePath);
  1292. if (pkgJson) {
  1293. const parseResults = parsePackageJson(pkgJson, config.packageJsonFilePath);
  1294. if (parseResults.diagnostic) {
  1295. buildCtx.diagnostics.push(parseResults.diagnostic);
  1296. }
  1297. else {
  1298. buildCtx.packageJson = parseResults.data;
  1299. }
  1300. }
  1301. }
  1302. catch (e) {
  1303. if (!config.outputTargets.some((o) => o.type.includes('dist'))) {
  1304. const diagnostic = buildError(buildCtx.diagnostics);
  1305. diagnostic.header = `Missing "package.json"`;
  1306. diagnostic.messageText = `Valid "package.json" file is required for distribution: ${config.packageJsonFilePath}`;
  1307. }
  1308. }
  1309. };
  1310. /**
  1311. * Parse a string read from a `package.json` file
  1312. * @param pkgJsonStr the string read from a `package.json` file
  1313. * @param pkgJsonFilePath the path to the already read `package.json` file
  1314. * @returns the results of parsing the provided contents of the `package.json` file
  1315. */
  1316. const parsePackageJson = (pkgJsonStr, pkgJsonFilePath) => {
  1317. const parseResult = {
  1318. diagnostic: null,
  1319. data: null,
  1320. filePath: pkgJsonFilePath,
  1321. };
  1322. try {
  1323. parseResult.data = JSON.parse(pkgJsonStr);
  1324. }
  1325. catch (e) {
  1326. parseResult.diagnostic = buildError();
  1327. parseResult.diagnostic.absFilePath = isString$1(pkgJsonFilePath) ? pkgJsonFilePath : undefined;
  1328. parseResult.diagnostic.header = `Error Parsing JSON`;
  1329. if (e instanceof Error) {
  1330. parseResult.diagnostic.messageText = e.message;
  1331. }
  1332. }
  1333. return parseResult;
  1334. };
  1335. const SKIP_DEPS = ['@stencil/core'];
  1336. /**
  1337. * Check whether a string is a member of a ReadonlyArray<string>
  1338. *
  1339. * We need a little helper for this because unfortunately `includes` is typed
  1340. * on `ReadonlyArray<T>` as `(el: T): boolean` so a `string` cannot be passed
  1341. * to `includes` on a `ReadonlyArray` 😢 thus we have a little helper function
  1342. * where we do the type coercion just once.
  1343. *
  1344. * see microsoft/TypeScript#31018 for some discussion of this
  1345. *
  1346. * @param readOnlyArray the array we're checking
  1347. * @param maybeMember a value which is possibly a member of the array
  1348. * @returns whether the array contains the member or not
  1349. */
  1350. const readOnlyArrayHasStringMember = (readOnlyArray, maybeMember) => readOnlyArray.includes(maybeMember);
  1351. /**
  1352. * Validates that a component tag meets required naming conventions to be used for a web component
  1353. * @param tag the tag to validate
  1354. * @returns an error message if the tag has an invalid name, undefined if the tag name passes all checks
  1355. */
  1356. const validateComponentTag = (tag) => {
  1357. // we want to check this first since we call some String.prototype methods below
  1358. if (typeof tag !== 'string') {
  1359. return `Tag "${tag}" must be a string type`;
  1360. }
  1361. if (tag !== tag.trim()) {
  1362. return `Tag can not contain white spaces`;
  1363. }
  1364. if (tag !== tag.toLowerCase()) {
  1365. return `Tag can not contain upper case characters`;
  1366. }
  1367. if (tag.length === 0) {
  1368. return `Received empty tag value`;
  1369. }
  1370. if (tag.indexOf(' ') > -1) {
  1371. return `"${tag}" tag cannot contain a space`;
  1372. }
  1373. if (tag.indexOf(',') > -1) {
  1374. return `"${tag}" tag cannot be used for multiple tags`;
  1375. }
  1376. const invalidChars = tag.replace(/\w|-/g, '');
  1377. if (invalidChars !== '') {
  1378. return `"${tag}" tag contains invalid characters: ${invalidChars}`;
  1379. }
  1380. if (tag.indexOf('-') === -1) {
  1381. return `"${tag}" tag must contain a dash (-) to work as a valid web component`;
  1382. }
  1383. if (tag.indexOf('--') > -1) {
  1384. return `"${tag}" tag cannot contain multiple dashes (--) next to each other`;
  1385. }
  1386. if (tag.indexOf('-') === 0) {
  1387. return `"${tag}" tag cannot start with a dash (-)`;
  1388. }
  1389. if (tag.lastIndexOf('-') === tag.length - 1) {
  1390. return `"${tag}" tag cannot end with a dash (-)`;
  1391. }
  1392. return undefined;
  1393. };
  1394. const EOL = '\n';
  1395. const platform = () => OS_PLATFORM;
  1396. const os$2 = {
  1397. EOL,
  1398. platform,
  1399. };
  1400. const os$3 = {
  1401. __proto__: null,
  1402. EOL: EOL,
  1403. platform: platform,
  1404. 'default': os$2
  1405. };
  1406. // 'path' module extracted from Node.js v8.11.1 (only the posix part)
  1407. function assertPath(path) {
  1408. if (typeof path !== 'string') {
  1409. throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
  1410. }
  1411. }
  1412. // Resolves . and .. elements in a path with directory names
  1413. function normalizeStringPosix(path, allowAboveRoot) {
  1414. var res = '';
  1415. var lastSegmentLength = 0;
  1416. var lastSlash = -1;
  1417. var dots = 0;
  1418. var code;
  1419. for (var i = 0; i <= path.length; ++i) {
  1420. if (i < path.length)
  1421. code = path.charCodeAt(i);
  1422. else if (code === 47 /*/*/)
  1423. break;
  1424. else
  1425. code = 47 /*/*/;
  1426. if (code === 47 /*/*/) {
  1427. if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) {
  1428. if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
  1429. if (res.length > 2) {
  1430. var lastSlashIndex = res.lastIndexOf('/');
  1431. if (lastSlashIndex !== res.length - 1) {
  1432. if (lastSlashIndex === -1) {
  1433. res = '';
  1434. lastSegmentLength = 0;
  1435. } else {
  1436. res = res.slice(0, lastSlashIndex);
  1437. lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
  1438. }
  1439. lastSlash = i;
  1440. dots = 0;
  1441. continue;
  1442. }
  1443. } else if (res.length === 2 || res.length === 1) {
  1444. res = '';
  1445. lastSegmentLength = 0;
  1446. lastSlash = i;
  1447. dots = 0;
  1448. continue;
  1449. }
  1450. }
  1451. if (allowAboveRoot) {
  1452. if (res.length > 0)
  1453. res += '/..';
  1454. else
  1455. res = '..';
  1456. lastSegmentLength = 2;
  1457. }
  1458. } else {
  1459. if (res.length > 0)
  1460. res += '/' + path.slice(lastSlash + 1, i);
  1461. else
  1462. res = path.slice(lastSlash + 1, i);
  1463. lastSegmentLength = i - lastSlash - 1;
  1464. }
  1465. lastSlash = i;
  1466. dots = 0;
  1467. } else if (code === 46 /*.*/ && dots !== -1) {
  1468. ++dots;
  1469. } else {
  1470. dots = -1;
  1471. }
  1472. }
  1473. return res;
  1474. }
  1475. function _format(sep, pathObject) {
  1476. var dir = pathObject.dir || pathObject.root;
  1477. var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
  1478. if (!dir) {
  1479. return base;
  1480. }
  1481. if (dir === pathObject.root) {
  1482. return dir + base;
  1483. }
  1484. return dir + sep + base;
  1485. }
  1486. var posix$2 = {
  1487. // path.resolve([from ...], to)
  1488. resolve: function resolve() {
  1489. var resolvedPath = '';
  1490. var resolvedAbsolute = false;
  1491. var cwd;
  1492. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  1493. var path;
  1494. if (i >= 0)
  1495. path = arguments[i];
  1496. else {
  1497. if (cwd === undefined)
  1498. cwd = process.cwd();
  1499. path = cwd;
  1500. }
  1501. assertPath(path);
  1502. // Skip empty entries
  1503. if (path.length === 0) {
  1504. continue;
  1505. }
  1506. resolvedPath = path + '/' + resolvedPath;
  1507. resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
  1508. }
  1509. // At this point the path should be resolved to a full absolute path, but
  1510. // handle relative paths to be safe (might happen when process.cwd() fails)
  1511. // Normalize the path
  1512. resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
  1513. if (resolvedAbsolute) {
  1514. if (resolvedPath.length > 0)
  1515. return '/' + resolvedPath;
  1516. else
  1517. return '/';
  1518. } else if (resolvedPath.length > 0) {
  1519. return resolvedPath;
  1520. } else {
  1521. return '.';
  1522. }
  1523. },
  1524. normalize: function normalize(path) {
  1525. assertPath(path);
  1526. if (path.length === 0) return '.';
  1527. var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
  1528. var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
  1529. // Normalize the path
  1530. path = normalizeStringPosix(path, !isAbsolute);
  1531. if (path.length === 0 && !isAbsolute) path = '.';
  1532. if (path.length > 0 && trailingSeparator) path += '/';
  1533. if (isAbsolute) return '/' + path;
  1534. return path;
  1535. },
  1536. isAbsolute: function isAbsolute(path) {
  1537. assertPath(path);
  1538. return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
  1539. },
  1540. join: function join() {
  1541. if (arguments.length === 0)
  1542. return '.';
  1543. var joined;
  1544. for (var i = 0; i < arguments.length; ++i) {
  1545. var arg = arguments[i];
  1546. assertPath(arg);
  1547. if (arg.length > 0) {
  1548. if (joined === undefined)
  1549. joined = arg;
  1550. else
  1551. joined += '/' + arg;
  1552. }
  1553. }
  1554. if (joined === undefined)
  1555. return '.';
  1556. return posix$2.normalize(joined);
  1557. },
  1558. relative: function relative(from, to) {
  1559. assertPath(from);
  1560. assertPath(to);
  1561. if (from === to) return '';
  1562. from = posix$2.resolve(from);
  1563. to = posix$2.resolve(to);
  1564. if (from === to) return '';
  1565. // Trim any leading backslashes
  1566. var fromStart = 1;
  1567. for (; fromStart < from.length; ++fromStart) {
  1568. if (from.charCodeAt(fromStart) !== 47 /*/*/)
  1569. break;
  1570. }
  1571. var fromEnd = from.length;
  1572. var fromLen = fromEnd - fromStart;
  1573. // Trim any leading backslashes
  1574. var toStart = 1;
  1575. for (; toStart < to.length; ++toStart) {
  1576. if (to.charCodeAt(toStart) !== 47 /*/*/)
  1577. break;
  1578. }
  1579. var toEnd = to.length;
  1580. var toLen = toEnd - toStart;
  1581. // Compare paths to find the longest common path from root
  1582. var length = fromLen < toLen ? fromLen : toLen;
  1583. var lastCommonSep = -1;
  1584. var i = 0;
  1585. for (; i <= length; ++i) {
  1586. if (i === length) {
  1587. if (toLen > length) {
  1588. if (to.charCodeAt(toStart + i) === 47 /*/*/) {
  1589. // We get here if `from` is the exact base path for `to`.
  1590. // For example: from='/foo/bar'; to='/foo/bar/baz'
  1591. return to.slice(toStart + i + 1);
  1592. } else if (i === 0) {
  1593. // We get here if `from` is the root
  1594. // For example: from='/'; to='/foo'
  1595. return to.slice(toStart + i);
  1596. }
  1597. } else if (fromLen > length) {
  1598. if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
  1599. // We get here if `to` is the exact base path for `from`.
  1600. // For example: from='/foo/bar/baz'; to='/foo/bar'
  1601. lastCommonSep = i;
  1602. } else if (i === 0) {
  1603. // We get here if `to` is the root.
  1604. // For example: from='/foo'; to='/'
  1605. lastCommonSep = 0;
  1606. }
  1607. }
  1608. break;
  1609. }
  1610. var fromCode = from.charCodeAt(fromStart + i);
  1611. var toCode = to.charCodeAt(toStart + i);
  1612. if (fromCode !== toCode)
  1613. break;
  1614. else if (fromCode === 47 /*/*/)
  1615. lastCommonSep = i;
  1616. }
  1617. var out = '';
  1618. // Generate the relative path based on the path difference between `to`
  1619. // and `from`
  1620. for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
  1621. if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
  1622. if (out.length === 0)
  1623. out += '..';
  1624. else
  1625. out += '/..';
  1626. }
  1627. }
  1628. // Lastly, append the rest of the destination (`to`) path that comes after
  1629. // the common path parts
  1630. if (out.length > 0)
  1631. return out + to.slice(toStart + lastCommonSep);
  1632. else {
  1633. toStart += lastCommonSep;
  1634. if (to.charCodeAt(toStart) === 47 /*/*/)
  1635. ++toStart;
  1636. return to.slice(toStart);
  1637. }
  1638. },
  1639. _makeLong: function _makeLong(path) {
  1640. return path;
  1641. },
  1642. dirname: function dirname(path) {
  1643. assertPath(path);
  1644. if (path.length === 0) return '.';
  1645. var code = path.charCodeAt(0);
  1646. var hasRoot = code === 47 /*/*/;
  1647. var end = -1;
  1648. var matchedSlash = true;
  1649. for (var i = path.length - 1; i >= 1; --i) {
  1650. code = path.charCodeAt(i);
  1651. if (code === 47 /*/*/) {
  1652. if (!matchedSlash) {
  1653. end = i;
  1654. break;
  1655. }
  1656. } else {
  1657. // We saw the first non-path separator
  1658. matchedSlash = false;
  1659. }
  1660. }
  1661. if (end === -1) return hasRoot ? '/' : '.';
  1662. if (hasRoot && end === 1) return '//';
  1663. return path.slice(0, end);
  1664. },
  1665. basename: function basename(path, ext) {
  1666. if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
  1667. assertPath(path);
  1668. var start = 0;
  1669. var end = -1;
  1670. var matchedSlash = true;
  1671. var i;
  1672. if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
  1673. if (ext.length === path.length && ext === path) return '';
  1674. var extIdx = ext.length - 1;
  1675. var firstNonSlashEnd = -1;
  1676. for (i = path.length - 1; i >= 0; --i) {
  1677. var code = path.charCodeAt(i);
  1678. if (code === 47 /*/*/) {
  1679. // If we reached a path separator that was not part of a set of path
  1680. // separators at the end of the string, stop now
  1681. if (!matchedSlash) {
  1682. start = i + 1;
  1683. break;
  1684. }
  1685. } else {
  1686. if (firstNonSlashEnd === -1) {
  1687. // We saw the first non-path separator, remember this index in case
  1688. // we need it if the extension ends up not matching
  1689. matchedSlash = false;
  1690. firstNonSlashEnd = i + 1;
  1691. }
  1692. if (extIdx >= 0) {
  1693. // Try to match the explicit extension
  1694. if (code === ext.charCodeAt(extIdx)) {
  1695. if (--extIdx === -1) {
  1696. // We matched the extension, so mark this as the end of our path
  1697. // component
  1698. end = i;
  1699. }
  1700. } else {
  1701. // Extension does not match, so our result is the entire path
  1702. // component
  1703. extIdx = -1;
  1704. end = firstNonSlashEnd;
  1705. }
  1706. }
  1707. }
  1708. }
  1709. if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
  1710. return path.slice(start, end);
  1711. } else {
  1712. for (i = path.length - 1; i >= 0; --i) {
  1713. if (path.charCodeAt(i) === 47 /*/*/) {
  1714. // If we reached a path separator that was not part of a set of path
  1715. // separators at the end of the string, stop now
  1716. if (!matchedSlash) {
  1717. start = i + 1;
  1718. break;
  1719. }
  1720. } else if (end === -1) {
  1721. // We saw the first non-path separator, mark this as the end of our
  1722. // path component
  1723. matchedSlash = false;
  1724. end = i + 1;
  1725. }
  1726. }
  1727. if (end === -1) return '';
  1728. return path.slice(start, end);
  1729. }
  1730. },
  1731. extname: function extname(path) {
  1732. assertPath(path);
  1733. var startDot = -1;
  1734. var startPart = 0;
  1735. var end = -1;
  1736. var matchedSlash = true;
  1737. // Track the state of characters (if any) we see before our first dot and
  1738. // after any path separator we find
  1739. var preDotState = 0;
  1740. for (var i = path.length - 1; i >= 0; --i) {
  1741. var code = path.charCodeAt(i);
  1742. if (code === 47 /*/*/) {
  1743. // If we reached a path separator that was not part of a set of path
  1744. // separators at the end of the string, stop now
  1745. if (!matchedSlash) {
  1746. startPart = i + 1;
  1747. break;
  1748. }
  1749. continue;
  1750. }
  1751. if (end === -1) {
  1752. // We saw the first non-path separator, mark this as the end of our
  1753. // extension
  1754. matchedSlash = false;
  1755. end = i + 1;
  1756. }
  1757. if (code === 46 /*.*/) {
  1758. // If this is our first dot, mark it as the start of our extension
  1759. if (startDot === -1)
  1760. startDot = i;
  1761. else if (preDotState !== 1)
  1762. preDotState = 1;
  1763. } else if (startDot !== -1) {
  1764. // We saw a non-dot and non-path separator before our dot, so we should
  1765. // have a good chance at having a non-empty extension
  1766. preDotState = -1;
  1767. }
  1768. }
  1769. if (startDot === -1 || end === -1 ||
  1770. // We saw a non-dot character immediately before the dot
  1771. preDotState === 0 ||
  1772. // The (right-most) trimmed path component is exactly '..'
  1773. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  1774. return '';
  1775. }
  1776. return path.slice(startDot, end);
  1777. },
  1778. format: function format(pathObject) {
  1779. if (pathObject === null || typeof pathObject !== 'object') {
  1780. throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
  1781. }
  1782. return _format('/', pathObject);
  1783. },
  1784. parse: function parse(path) {
  1785. assertPath(path);
  1786. var ret = { root: '', dir: '', base: '', ext: '', name: '' };
  1787. if (path.length === 0) return ret;
  1788. var code = path.charCodeAt(0);
  1789. var isAbsolute = code === 47 /*/*/;
  1790. var start;
  1791. if (isAbsolute) {
  1792. ret.root = '/';
  1793. start = 1;
  1794. } else {
  1795. start = 0;
  1796. }
  1797. var startDot = -1;
  1798. var startPart = 0;
  1799. var end = -1;
  1800. var matchedSlash = true;
  1801. var i = path.length - 1;
  1802. // Track the state of characters (if any) we see before our first dot and
  1803. // after any path separator we find
  1804. var preDotState = 0;
  1805. // Get non-dir info
  1806. for (; i >= start; --i) {
  1807. code = path.charCodeAt(i);
  1808. if (code === 47 /*/*/) {
  1809. // If we reached a path separator that was not part of a set of path
  1810. // separators at the end of the string, stop now
  1811. if (!matchedSlash) {
  1812. startPart = i + 1;
  1813. break;
  1814. }
  1815. continue;
  1816. }
  1817. if (end === -1) {
  1818. // We saw the first non-path separator, mark this as the end of our
  1819. // extension
  1820. matchedSlash = false;
  1821. end = i + 1;
  1822. }
  1823. if (code === 46 /*.*/) {
  1824. // If this is our first dot, mark it as the start of our extension
  1825. if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
  1826. } else if (startDot !== -1) {
  1827. // We saw a non-dot and non-path separator before our dot, so we should
  1828. // have a good chance at having a non-empty extension
  1829. preDotState = -1;
  1830. }
  1831. }
  1832. if (startDot === -1 || end === -1 ||
  1833. // We saw a non-dot character immediately before the dot
  1834. preDotState === 0 ||
  1835. // The (right-most) trimmed path component is exactly '..'
  1836. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  1837. if (end !== -1) {
  1838. if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
  1839. }
  1840. } else {
  1841. if (startPart === 0 && isAbsolute) {
  1842. ret.name = path.slice(1, startDot);
  1843. ret.base = path.slice(1, end);
  1844. } else {
  1845. ret.name = path.slice(startPart, startDot);
  1846. ret.base = path.slice(startPart, end);
  1847. }
  1848. ret.ext = path.slice(startDot, end);
  1849. }
  1850. if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
  1851. return ret;
  1852. },
  1853. sep: '/',
  1854. delimiter: ':',
  1855. win32: null,
  1856. posix: null
  1857. };
  1858. posix$2.posix = posix$2;
  1859. var pathBrowserify = posix$2;
  1860. let basename;
  1861. let dirname;
  1862. let extname$1;
  1863. let isAbsolute$1;
  1864. let join;
  1865. let normalize$1;
  1866. let parse$7;
  1867. let relative$1;
  1868. let resolve$1;
  1869. let sep;
  1870. let delimiter;
  1871. let posix$1;
  1872. let win32$1;
  1873. const path$5 = {};
  1874. const setPlatformPath = (platformPath) => {
  1875. if (!platformPath) {
  1876. platformPath = pathBrowserify;
  1877. }
  1878. Object.assign(path$5, platformPath);
  1879. const normalizeOrg = path$5.normalize;
  1880. const joinOrg = path$5.join;
  1881. const relativeOrg = path$5.relative;
  1882. const resolveOrg = path$5.resolve;
  1883. normalize$1 = path$5.normalize = (...args) => normalizePath$1(normalizeOrg.apply(path$5, args));
  1884. join = path$5.join = (...args) => normalizePath$1(joinOrg.apply(path$5, args));
  1885. relative$1 = path$5.relative = (...args) => normalizePath$1(relativeOrg.apply(path$5, args));
  1886. resolve$1 = path$5.resolve = (...args) => normalizePath$1(resolveOrg.apply(path$5, args));
  1887. basename = path$5.basename;
  1888. dirname = path$5.dirname;
  1889. extname$1 = path$5.extname;
  1890. isAbsolute$1 = path$5.isAbsolute;
  1891. parse$7 = path$5.parse;
  1892. sep = path$5.sep;
  1893. delimiter = path$5.delimiter;
  1894. posix$1 = path$5.posix;
  1895. if (path$5.win32) {
  1896. win32$1 = path$5.win32;
  1897. }
  1898. else {
  1899. win32$1 = { ...posix$1 };
  1900. win32$1.sep = '\\';
  1901. }
  1902. };
  1903. setPlatformPath(IS_NODE_ENV ? requireFunc('path') : pathBrowserify);
  1904. const path$6 = {
  1905. __proto__: null,
  1906. get basename () { return basename; },
  1907. get dirname () { return dirname; },
  1908. get extname () { return extname$1; },
  1909. get isAbsolute () { return isAbsolute$1; },
  1910. get join () { return join; },
  1911. get normalize () { return normalize$1; },
  1912. get parse () { return parse$7; },
  1913. get relative () { return relative$1; },
  1914. get resolve () { return resolve$1; },
  1915. get sep () { return sep; },
  1916. get delimiter () { return delimiter; },
  1917. get posix () { return posix$1; },
  1918. get win32 () { return win32$1; },
  1919. path: path$5,
  1920. setPlatformPath: setPlatformPath,
  1921. 'default': path$5
  1922. };
  1923. var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  1924. function createCommonjsModule$1(fn, basedir, module) {
  1925. return module = {
  1926. path: basedir,
  1927. exports: {},
  1928. require: function (path, base) {
  1929. return commonjsRequire$1();
  1930. }
  1931. }, fn(module, module.exports), module.exports;
  1932. }
  1933. function getAugmentedNamespace$1(n) {
  1934. if (n.__esModule) return n;
  1935. var a = Object.defineProperty({}, '__esModule', {value: true});
  1936. Object.keys(n).forEach(function (k) {
  1937. var d = Object.getOwnPropertyDescriptor(n, k);
  1938. Object.defineProperty(a, k, d.get ? d : {
  1939. enumerable: true,
  1940. get: function () {
  1941. return n[k];
  1942. }
  1943. });
  1944. });
  1945. return a;
  1946. }
  1947. function commonjsRequire$1 () {
  1948. throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
  1949. }
  1950. // for now just expose the builtin process global from node.js
  1951. var process_1 = commonjsGlobal$1.process;
  1952. const process$3 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), process_1, {
  1953. 'default': process_1
  1954. });
  1955. const buildId = '20221003165302';
  1956. const minfyJsId = 'terser5.6.1_7';
  1957. const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.13_7';
  1958. const parse5Version = '6.0.1';
  1959. const rollupVersion = '2.42.3';
  1960. const sizzleVersion = '2.42.3';
  1961. const terserVersion = '5.6.1';
  1962. const typescriptVersion = '4.7.4';
  1963. const vermoji = '😛';
  1964. const version$3 = '2.18.1';
  1965. const versions = {
  1966. stencil: version$3,
  1967. parse5: parse5Version,
  1968. rollup: rollupVersion,
  1969. sizzle: sizzleVersion,
  1970. terser: terserVersion,
  1971. typescript: typescriptVersion,
  1972. };
  1973. const buildEvents = () => {
  1974. const evCallbacks = [];
  1975. const off = (callback) => {
  1976. const index = evCallbacks.findIndex((ev) => ev.callback === callback);
  1977. if (index > -1) {
  1978. evCallbacks.splice(index, 1);
  1979. return true;
  1980. }
  1981. return false;
  1982. };
  1983. const on = (arg0, arg1) => {
  1984. if (typeof arg0 === 'function') {
  1985. const eventName = null;
  1986. const callback = arg0;
  1987. evCallbacks.push({
  1988. eventName,
  1989. callback,
  1990. });
  1991. return () => off(callback);
  1992. }
  1993. else if (typeof arg0 === 'string' && typeof arg1 === 'function') {
  1994. const eventName = arg0.toLowerCase().trim();
  1995. const callback = arg1;
  1996. evCallbacks.push({
  1997. eventName,
  1998. callback,
  1999. });
  2000. return () => off(callback);
  2001. }
  2002. return () => false;
  2003. };
  2004. const emit = (eventName, data) => {
  2005. const normalizedEventName = eventName.toLowerCase().trim();
  2006. const callbacks = evCallbacks.slice();
  2007. for (const ev of callbacks) {
  2008. if (ev.eventName == null) {
  2009. try {
  2010. ev.callback(eventName, data);
  2011. }
  2012. catch (e) {
  2013. console.error(e);
  2014. }
  2015. }
  2016. else if (ev.eventName === normalizedEventName) {
  2017. try {
  2018. ev.callback(data);
  2019. }
  2020. catch (e) {
  2021. console.error(e);
  2022. }
  2023. }
  2024. }
  2025. };
  2026. const unsubscribeAll = () => {
  2027. evCallbacks.length = 0;
  2028. };
  2029. return {
  2030. emit,
  2031. on,
  2032. unsubscribeAll,
  2033. };
  2034. };
  2035. /**
  2036. * Creates an instance of a logger
  2037. * @returns the new logger instance
  2038. */
  2039. const createLogger = () => {
  2040. let useColors = IS_BROWSER_ENV;
  2041. let level = 'info';
  2042. return {
  2043. enableColors: (uc) => (useColors = uc),
  2044. getLevel: () => level,
  2045. setLevel: (l) => (level = l),
  2046. emoji: (e) => e,
  2047. info: console.log.bind(console),
  2048. warn: console.warn.bind(console),
  2049. error: console.error.bind(console),
  2050. debug: console.debug.bind(console),
  2051. red: (msg) => msg,
  2052. green: (msg) => msg,
  2053. yellow: (msg) => msg,
  2054. blue: (msg) => msg,
  2055. magenta: (msg) => msg,
  2056. cyan: (msg) => msg,
  2057. gray: (msg) => msg,
  2058. bold: (msg) => msg,
  2059. dim: (msg) => msg,
  2060. bgRed: (msg) => msg,
  2061. createTimeSpan: (_startMsg, _debug = false) => ({
  2062. duration: () => 0,
  2063. finish: () => 0,
  2064. }),
  2065. printDiagnostics(diagnostics) {
  2066. diagnostics.forEach((diagnostic) => logDiagnostic(diagnostic, useColors));
  2067. },
  2068. };
  2069. };
  2070. const logDiagnostic = (diagnostic, useColors) => {
  2071. let color = BLUE;
  2072. let prefix = 'Build';
  2073. let msg = '';
  2074. if (diagnostic.level === 'error') {
  2075. color = RED;
  2076. prefix = 'Error';
  2077. }
  2078. else if (diagnostic.level === 'warn') {
  2079. color = YELLOW;
  2080. prefix = 'Warning';
  2081. }
  2082. if (diagnostic.header) {
  2083. prefix = diagnostic.header;
  2084. }
  2085. const filePath = diagnostic.relFilePath || diagnostic.absFilePath;
  2086. if (filePath) {
  2087. msg += filePath;
  2088. if (typeof diagnostic.lineNumber === 'number' && diagnostic.lineNumber > 0) {
  2089. msg += ', line ' + diagnostic.lineNumber;
  2090. if (typeof diagnostic.columnNumber === 'number' && diagnostic.columnNumber > 0) {
  2091. msg += ', column ' + diagnostic.columnNumber;
  2092. }
  2093. }
  2094. msg += '\n';
  2095. }
  2096. msg += diagnostic.messageText;
  2097. if (diagnostic.lines && diagnostic.lines.length > 0) {
  2098. diagnostic.lines.forEach((l) => {
  2099. msg += '\n' + l.lineNumber + ': ' + l.text;
  2100. });
  2101. msg += '\n';
  2102. }
  2103. if (useColors) {
  2104. const styledPrefix = [
  2105. '%c' + prefix,
  2106. `background: ${color}; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;`,
  2107. ];
  2108. console.log(...styledPrefix, msg);
  2109. }
  2110. else if (diagnostic.level === 'error') {
  2111. console.error(msg);
  2112. }
  2113. else if (diagnostic.level === 'warn') {
  2114. console.warn(msg);
  2115. }
  2116. else {
  2117. console.log(msg);
  2118. }
  2119. };
  2120. const YELLOW = `#f39c12`;
  2121. const RED = `#c0392b`;
  2122. const BLUE = `#3498db`;
  2123. const inherits$3 = (ctor, superCtor) => {
  2124. if (superCtor) {
  2125. ctor.super_ = superCtor;
  2126. ctor.prototype = Object.create(superCtor.prototype, {
  2127. constructor: {
  2128. value: ctor,
  2129. enumerable: false,
  2130. writable: true,
  2131. configurable: true,
  2132. },
  2133. });
  2134. }
  2135. };
  2136. const inspect = (...args) => args.forEach((arg) => console.log(arg));
  2137. const promisify = (fn) => {
  2138. if (typeof fn[promisify.custom] === 'function') {
  2139. // https://nodejs.org/api/util.html#util_custom_promisified_functions
  2140. return function (...args) {
  2141. return fn[promisify.custom].apply(this, args);
  2142. };
  2143. }
  2144. return function (...args) {
  2145. return new Promise((resolve, reject) => {
  2146. args.push((err, result) => {
  2147. if (err != null) {
  2148. reject(err);
  2149. }
  2150. else {
  2151. resolve(result);
  2152. }
  2153. });
  2154. fn.apply(this, args);
  2155. });
  2156. };
  2157. };
  2158. promisify.custom = Symbol('promisify.custom');
  2159. const require$$0$1 = {
  2160. inherits: inherits$3,
  2161. inspect,
  2162. promisify,
  2163. };
  2164. const util$4 = {
  2165. __proto__: null,
  2166. inherits: inherits$3,
  2167. inspect: inspect,
  2168. promisify: promisify,
  2169. 'default': require$$0$1
  2170. };
  2171. class FsError extends Error {
  2172. constructor(syscall, path, code = 'ENOENT', errno = -2) {
  2173. super(`ENOENT: no such file or directory, ${syscall} '${path}'`);
  2174. this.syscall = syscall;
  2175. this.path = path;
  2176. this.code = code;
  2177. this.errno = errno;
  2178. }
  2179. }
  2180. const fs$3 = {
  2181. __sys: {},
  2182. };
  2183. const exists$1 = (fs$3.exists = (p, cb) => {
  2184. fs$3.__sys
  2185. .access(p)
  2186. .then(cb)
  2187. .catch(() => cb(false));
  2188. });
  2189. // https://nodejs.org/api/util.html#util_custom_promisified_functions
  2190. exists$1[promisify.custom] = (p) => fs$3.__sys.access(p);
  2191. const existsSync = (fs$3.existsSync = (p) => {
  2192. // https://nodejs.org/api/fs.html#fs_fs_existssync_path
  2193. return fs$3.__sys.accessSync(p);
  2194. });
  2195. const mkdir = (fs$3.mkdir = (p, opts, cb) => {
  2196. cb = typeof cb === 'function' ? cb : typeof opts === 'function' ? opts : null;
  2197. opts = typeof opts === 'function' ? undefined : opts;
  2198. fs$3.__sys
  2199. .createDir(p, opts)
  2200. .then((results) => {
  2201. if (cb) {
  2202. if (results.error) {
  2203. cb(new FsError('mkdir', p));
  2204. }
  2205. else {
  2206. cb(null);
  2207. }
  2208. }
  2209. })
  2210. .catch((e) => {
  2211. cb && cb(e);
  2212. });
  2213. });
  2214. const mkdirSync = (fs$3.mkdirSync = (p, opts) => {
  2215. const results = fs$3.__sys.createDirSync(p, opts);
  2216. if (results.error) {
  2217. throw new FsError('mkdir', p);
  2218. }
  2219. });
  2220. const readdirSync = (fs$3.readdirSync = (p) => {
  2221. // sys.readdirSync includes full paths
  2222. // but if fs.readdirSync was called, the expected
  2223. // nodejs results are of just the basename for each dir item
  2224. const dirItems = fs$3.__sys.readDirSync(p);
  2225. return dirItems.map((dirItem) => basename(dirItem));
  2226. });
  2227. const readFile$2 = (fs$3.readFile = async (p, opts, cb) => {
  2228. const encoding = typeof opts === 'object' ? opts.encoding : typeof opts === 'string' ? opts : 'utf-8';
  2229. cb = typeof cb === 'function' ? cb : typeof opts === 'function' ? opts : null;
  2230. fs$3.__sys
  2231. .readFile(p, encoding)
  2232. .then((data) => {
  2233. if (cb) {
  2234. if (typeof data === 'string') {
  2235. cb(null, data);
  2236. }
  2237. else {
  2238. cb(new FsError('open', p), data);
  2239. }
  2240. }
  2241. })
  2242. .catch((e) => {
  2243. cb && cb(e);
  2244. });
  2245. });
  2246. const readFileSync = (fs$3.readFileSync = (p, opts) => {
  2247. const encoding = typeof opts === 'object' ? opts.encoding : typeof opts === 'string' ? opts : 'utf-8';
  2248. const data = fs$3.__sys.readFileSync(p, encoding);
  2249. if (typeof data !== 'string') {
  2250. throw new FsError('open', p);
  2251. }
  2252. return data;
  2253. });
  2254. const realpath$3 = (fs$3.realpath = (p, opts, cb) => {
  2255. cb = typeof cb === 'function' ? cb : typeof opts === 'function' ? opts : null;
  2256. fs$3.__sys
  2257. .realpath(p)
  2258. .then((results) => {
  2259. cb && cb(results.error, results.path);
  2260. })
  2261. .catch((e) => {
  2262. cb && cb(e);
  2263. });
  2264. });
  2265. const realpathSync$2 = (fs$3.realpathSync = (p) => {
  2266. const results = fs$3.__sys.realpathSync(p);
  2267. if (results.error) {
  2268. throw results.error;
  2269. }
  2270. return normalizePath$1(results.path);
  2271. });
  2272. const statSync = (fs$3.statSync = (p) => {
  2273. const fsStats = fs$3.__sys.statSync(p);
  2274. if (fsStats.error) {
  2275. throw new FsError('statSync', p);
  2276. }
  2277. return {
  2278. isDirectory: () => fsStats.isDirectory,
  2279. isFile: () => fsStats.isFile,
  2280. isSymbolicLink: () => fsStats.isSymbolicLink,
  2281. size: fsStats.size,
  2282. mtimeMs: fsStats.mtimeMs,
  2283. };
  2284. });
  2285. const lstatSync = (fs$3.lstatSync = statSync);
  2286. const stat$1 = (fs$3.stat = (p, opts, cb) => {
  2287. cb = typeof cb === 'function' ? cb : typeof opts === 'function' ? opts : null;
  2288. fs$3.__sys
  2289. .stat(p)
  2290. .then((fsStats) => {
  2291. if (cb) {
  2292. if (fsStats.error) {
  2293. cb(new FsError('stat', p));
  2294. }
  2295. else {
  2296. cb({
  2297. isDirectory: () => fsStats.isDirectory,
  2298. isFile: () => fsStats.isFile,
  2299. isSymbolicLink: () => fsStats.isSymbolicLink,
  2300. size: fsStats.size,
  2301. mtimeMs: fsStats.mtimeMs,
  2302. });
  2303. }
  2304. }
  2305. })
  2306. .catch((e) => {
  2307. cb && cb(e);
  2308. });
  2309. });
  2310. const watch = (fs$3.watch = () => {
  2311. throw new Error(`fs.watch() not implemented`);
  2312. });
  2313. const writeFile$1 = (fs$3.writeFile = (p, data, opts, cb) => {
  2314. cb = typeof cb === 'function' ? cb : typeof opts === 'function' ? opts : null;
  2315. fs$3.__sys
  2316. .writeFile(p, data)
  2317. .then((writeResults) => {
  2318. if (cb) {
  2319. if (writeResults.error) {
  2320. cb(new FsError('writeFile', p));
  2321. }
  2322. else {
  2323. cb(null);
  2324. }
  2325. }
  2326. })
  2327. .catch((e) => {
  2328. cb && cb(e);
  2329. });
  2330. });
  2331. const fs$4 = {
  2332. __proto__: null,
  2333. exists: exists$1,
  2334. existsSync: existsSync,
  2335. mkdir: mkdir,
  2336. mkdirSync: mkdirSync,
  2337. readdirSync: readdirSync,
  2338. readFile: readFile$2,
  2339. readFileSync: readFileSync,
  2340. realpath: realpath$3,
  2341. realpathSync: realpathSync$2,
  2342. statSync: statSync,
  2343. lstatSync: lstatSync,
  2344. stat: stat$1,
  2345. watch: watch,
  2346. writeFile: writeFile$1,
  2347. 'default': fs$3
  2348. };
  2349. var caller = function () {
  2350. // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
  2351. var origPrepareStackTrace = Error.prepareStackTrace;
  2352. Error.prepareStackTrace = function (_, stack) { return stack; };
  2353. var stack = (new Error()).stack;
  2354. Error.prepareStackTrace = origPrepareStackTrace;
  2355. return stack[2].getFileName();
  2356. };
  2357. var pathParse = createCommonjsModule$1(function (module) {
  2358. var isWindows = process.platform === 'win32';
  2359. // Regex to split a windows path into into [dir, root, basename, name, ext]
  2360. var splitWindowsRe =
  2361. /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
  2362. var win32 = {};
  2363. function win32SplitPath(filename) {
  2364. return splitWindowsRe.exec(filename).slice(1);
  2365. }
  2366. win32.parse = function(pathString) {
  2367. if (typeof pathString !== 'string') {
  2368. throw new TypeError(
  2369. "Parameter 'pathString' must be a string, not " + typeof pathString
  2370. );
  2371. }
  2372. var allParts = win32SplitPath(pathString);
  2373. if (!allParts || allParts.length !== 5) {
  2374. throw new TypeError("Invalid path '" + pathString + "'");
  2375. }
  2376. return {
  2377. root: allParts[1],
  2378. dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
  2379. base: allParts[2],
  2380. ext: allParts[4],
  2381. name: allParts[3]
  2382. };
  2383. };
  2384. // Split a filename into [dir, root, basename, name, ext], unix version
  2385. // 'root' is just a slash, or nothing.
  2386. var splitPathRe =
  2387. /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
  2388. var posix = {};
  2389. function posixSplitPath(filename) {
  2390. return splitPathRe.exec(filename).slice(1);
  2391. }
  2392. posix.parse = function(pathString) {
  2393. if (typeof pathString !== 'string') {
  2394. throw new TypeError(
  2395. "Parameter 'pathString' must be a string, not " + typeof pathString
  2396. );
  2397. }
  2398. var allParts = posixSplitPath(pathString);
  2399. if (!allParts || allParts.length !== 5) {
  2400. throw new TypeError("Invalid path '" + pathString + "'");
  2401. }
  2402. return {
  2403. root: allParts[1],
  2404. dir: allParts[0].slice(0, -1),
  2405. base: allParts[2],
  2406. ext: allParts[4],
  2407. name: allParts[3],
  2408. };
  2409. };
  2410. if (isWindows)
  2411. module.exports = win32.parse;
  2412. else /* posix */
  2413. module.exports = posix.parse;
  2414. module.exports.posix = posix.parse;
  2415. module.exports.win32 = win32.parse;
  2416. });
  2417. const path$4 = /*@__PURE__*/getAugmentedNamespace$1(path$6);
  2418. var parse$6 = path$4.parse || pathParse;
  2419. var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
  2420. var prefix = '/';
  2421. if ((/^([A-Za-z]:)/).test(absoluteStart)) {
  2422. prefix = '';
  2423. } else if ((/^\\\\/).test(absoluteStart)) {
  2424. prefix = '\\\\';
  2425. }
  2426. var paths = [absoluteStart];
  2427. var parsed = parse$6(absoluteStart);
  2428. while (parsed.dir !== paths[paths.length - 1]) {
  2429. paths.push(parsed.dir);
  2430. parsed = parse$6(parsed.dir);
  2431. }
  2432. return paths.reduce(function (dirs, aPath) {
  2433. return dirs.concat(modules.map(function (moduleDir) {
  2434. return path$4.resolve(prefix, aPath, moduleDir);
  2435. }));
  2436. }, []);
  2437. };
  2438. var nodeModulesPaths = function nodeModulesPaths(start, opts, request) {
  2439. var modules = opts && opts.moduleDirectory
  2440. ? [].concat(opts.moduleDirectory)
  2441. : ['node_modules'];
  2442. if (opts && typeof opts.paths === 'function') {
  2443. return opts.paths(
  2444. request,
  2445. start,
  2446. function () { return getNodeModulesDirs(start, modules); },
  2447. opts
  2448. );
  2449. }
  2450. var dirs = getNodeModulesDirs(start, modules);
  2451. return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
  2452. };
  2453. var normalizeOptions = function (x, opts) {
  2454. /**
  2455. * This file is purposefully a passthrough. It's expected that third-party
  2456. * environments will override it at runtime in order to inject special logic
  2457. * into `resolve` (by manipulating the options). One such example is the PnP
  2458. * code path in Yarn.
  2459. */
  2460. return opts || {};
  2461. };
  2462. /* eslint no-invalid-this: 1 */
  2463. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  2464. var slice$1 = Array.prototype.slice;
  2465. var toStr = Object.prototype.toString;
  2466. var funcType = '[object Function]';
  2467. var implementation = function bind(that) {
  2468. var target = this;
  2469. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  2470. throw new TypeError(ERROR_MESSAGE + target);
  2471. }
  2472. var args = slice$1.call(arguments, 1);
  2473. var bound;
  2474. var binder = function () {
  2475. if (this instanceof bound) {
  2476. var result = target.apply(
  2477. this,
  2478. args.concat(slice$1.call(arguments))
  2479. );
  2480. if (Object(result) === result) {
  2481. return result;
  2482. }
  2483. return this;
  2484. } else {
  2485. return target.apply(
  2486. that,
  2487. args.concat(slice$1.call(arguments))
  2488. );
  2489. }
  2490. };
  2491. var boundLength = Math.max(0, target.length - args.length);
  2492. var boundArgs = [];
  2493. for (var i = 0; i < boundLength; i++) {
  2494. boundArgs.push('$' + i);
  2495. }
  2496. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  2497. if (target.prototype) {
  2498. var Empty = function Empty() {};
  2499. Empty.prototype = target.prototype;
  2500. bound.prototype = new Empty();
  2501. Empty.prototype = null;
  2502. }
  2503. return bound;
  2504. };
  2505. var functionBind = Function.prototype.bind || implementation;
  2506. var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
  2507. const assert$2 = true;
  2508. const async_hooks$1 = ">= 8";
  2509. const buffer_ieee754$1 = "< 0.9.7";
  2510. const buffer$1 = true;
  2511. const child_process$1 = true;
  2512. const cluster$1 = true;
  2513. const console$2 = true;
  2514. const constants$2 = true;
  2515. const crypto$2 = true;
  2516. const _debug_agent$1 = ">= 1 && < 8";
  2517. const _debugger$1 = "< 8";
  2518. const dgram$1 = true;
  2519. const diagnostics_channel$1 = ">= 15.1";
  2520. const dns$1 = true;
  2521. const domain$1 = ">= 0.7.12";
  2522. const events$2 = true;
  2523. const freelist$1 = "< 6";
  2524. const fs$2 = true;
  2525. const _http_agent$1 = ">= 0.11.1";
  2526. const _http_client$1 = ">= 0.11.1";
  2527. const _http_common$1 = ">= 0.11.1";
  2528. const _http_incoming$1 = ">= 0.11.1";
  2529. const _http_outgoing$1 = ">= 0.11.1";
  2530. const _http_server$1 = ">= 0.11.1";
  2531. const http$1 = true;
  2532. const http2$1 = ">= 8.8";
  2533. const https$1 = true;
  2534. const inspector$1 = ">= 8.0.0";
  2535. const _linklist$1 = "< 8";
  2536. const module$2 = true;
  2537. const net$1 = true;
  2538. const os$1 = true;
  2539. const path$3 = true;
  2540. const perf_hooks$1 = ">= 8.5";
  2541. const process$2 = ">= 1";
  2542. const punycode$1 = true;
  2543. const querystring$1 = true;
  2544. const readline$1 = true;
  2545. const repl$1 = true;
  2546. const smalloc$1 = ">= 0.11.5 && < 3";
  2547. const _stream_duplex$1 = ">= 0.9.4";
  2548. const _stream_transform$1 = ">= 0.9.4";
  2549. const _stream_wrap$1 = ">= 1.4.1";
  2550. const _stream_passthrough$1 = ">= 0.9.4";
  2551. const _stream_readable$1 = ">= 0.9.4";
  2552. const _stream_writable$1 = ">= 0.9.4";
  2553. const stream$1 = true;
  2554. const string_decoder$1 = true;
  2555. const sys$1 = [
  2556. ">= 0.6 && < 0.7",
  2557. ">= 0.8"
  2558. ];
  2559. const timers$2 = true;
  2560. const _tls_common$1 = ">= 0.11.13";
  2561. const _tls_legacy$1 = ">= 0.11.3 && < 10";
  2562. const _tls_wrap$1 = ">= 0.11.3";
  2563. const tls$1 = true;
  2564. const trace_events$1 = ">= 10";
  2565. const tty$1 = true;
  2566. const url$1 = true;
  2567. const util$3 = true;
  2568. const v8$1 = ">= 1";
  2569. const vm$1 = true;
  2570. const wasi$1 = ">= 13.4 && < 13.5";
  2571. const worker_threads$1 = ">= 11.7";
  2572. const zlib$1 = true;
  2573. const data$2 = {
  2574. assert: assert$2,
  2575. "assert/strict": ">= 15",
  2576. async_hooks: async_hooks$1,
  2577. buffer_ieee754: buffer_ieee754$1,
  2578. buffer: buffer$1,
  2579. child_process: child_process$1,
  2580. cluster: cluster$1,
  2581. console: console$2,
  2582. constants: constants$2,
  2583. crypto: crypto$2,
  2584. _debug_agent: _debug_agent$1,
  2585. _debugger: _debugger$1,
  2586. dgram: dgram$1,
  2587. diagnostics_channel: diagnostics_channel$1,
  2588. dns: dns$1,
  2589. "dns/promises": ">= 15",
  2590. domain: domain$1,
  2591. events: events$2,
  2592. freelist: freelist$1,
  2593. fs: fs$2,
  2594. "fs/promises": [
  2595. ">= 10 && < 10.1",
  2596. ">= 14"
  2597. ],
  2598. _http_agent: _http_agent$1,
  2599. _http_client: _http_client$1,
  2600. _http_common: _http_common$1,
  2601. _http_incoming: _http_incoming$1,
  2602. _http_outgoing: _http_outgoing$1,
  2603. _http_server: _http_server$1,
  2604. http: http$1,
  2605. http2: http2$1,
  2606. https: https$1,
  2607. inspector: inspector$1,
  2608. _linklist: _linklist$1,
  2609. module: module$2,
  2610. net: net$1,
  2611. "node-inspect/lib/_inspect": ">= 7.6.0 && < 12",
  2612. "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12",
  2613. "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12",
  2614. os: os$1,
  2615. path: path$3,
  2616. "path/posix": ">= 15.3",
  2617. "path/win32": ">= 15.3",
  2618. perf_hooks: perf_hooks$1,
  2619. process: process$2,
  2620. punycode: punycode$1,
  2621. querystring: querystring$1,
  2622. readline: readline$1,
  2623. repl: repl$1,
  2624. smalloc: smalloc$1,
  2625. _stream_duplex: _stream_duplex$1,
  2626. _stream_transform: _stream_transform$1,
  2627. _stream_wrap: _stream_wrap$1,
  2628. _stream_passthrough: _stream_passthrough$1,
  2629. _stream_readable: _stream_readable$1,
  2630. _stream_writable: _stream_writable$1,
  2631. stream: stream$1,
  2632. "stream/promises": ">= 15",
  2633. string_decoder: string_decoder$1,
  2634. sys: sys$1,
  2635. timers: timers$2,
  2636. "timers/promises": ">= 15",
  2637. _tls_common: _tls_common$1,
  2638. _tls_legacy: _tls_legacy$1,
  2639. _tls_wrap: _tls_wrap$1,
  2640. tls: tls$1,
  2641. trace_events: trace_events$1,
  2642. tty: tty$1,
  2643. url: url$1,
  2644. util: util$3,
  2645. "util/types": ">= 15.3",
  2646. "v8/tools/arguments": ">= 10 && < 12",
  2647. "v8/tools/codemap": [
  2648. ">= 4.4.0 && < 5",
  2649. ">= 5.2.0 && < 12"
  2650. ],
  2651. "v8/tools/consarray": [
  2652. ">= 4.4.0 && < 5",
  2653. ">= 5.2.0 && < 12"
  2654. ],
  2655. "v8/tools/csvparser": [
  2656. ">= 4.4.0 && < 5",
  2657. ">= 5.2.0 && < 12"
  2658. ],
  2659. "v8/tools/logreader": [
  2660. ">= 4.4.0 && < 5",
  2661. ">= 5.2.0 && < 12"
  2662. ],
  2663. "v8/tools/profile_view": [
  2664. ">= 4.4.0 && < 5",
  2665. ">= 5.2.0 && < 12"
  2666. ],
  2667. "v8/tools/splaytree": [
  2668. ">= 4.4.0 && < 5",
  2669. ">= 5.2.0 && < 12"
  2670. ],
  2671. v8: v8$1,
  2672. vm: vm$1,
  2673. wasi: wasi$1,
  2674. worker_threads: worker_threads$1,
  2675. zlib: zlib$1
  2676. };
  2677. function specifierIncluded$1(current, specifier) {
  2678. var nodeParts = current.split('.');
  2679. var parts = specifier.split(' ');
  2680. var op = parts.length > 1 ? parts[0] : '=';
  2681. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
  2682. for (var i = 0; i < 3; ++i) {
  2683. var cur = parseInt(nodeParts[i] || 0, 10);
  2684. var ver = parseInt(versionParts[i] || 0, 10);
  2685. if (cur === ver) {
  2686. continue; // eslint-disable-line no-restricted-syntax, no-continue
  2687. }
  2688. if (op === '<') {
  2689. return cur < ver;
  2690. }
  2691. if (op === '>=') {
  2692. return cur >= ver;
  2693. }
  2694. return false;
  2695. }
  2696. return op === '>=';
  2697. }
  2698. function matchesRange$1(current, range) {
  2699. var specifiers = range.split(/ ?&& ?/);
  2700. if (specifiers.length === 0) {
  2701. return false;
  2702. }
  2703. for (var i = 0; i < specifiers.length; ++i) {
  2704. if (!specifierIncluded$1(current, specifiers[i])) {
  2705. return false;
  2706. }
  2707. }
  2708. return true;
  2709. }
  2710. function versionIncluded$1(nodeVersion, specifierValue) {
  2711. if (typeof specifierValue === 'boolean') {
  2712. return specifierValue;
  2713. }
  2714. var current = typeof nodeVersion === 'undefined'
  2715. ? process.versions && process.versions.node && process.versions.node
  2716. : nodeVersion;
  2717. if (typeof current !== 'string') {
  2718. throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required');
  2719. }
  2720. if (specifierValue && typeof specifierValue === 'object') {
  2721. for (var i = 0; i < specifierValue.length; ++i) {
  2722. if (matchesRange$1(current, specifierValue[i])) {
  2723. return true;
  2724. }
  2725. }
  2726. return false;
  2727. }
  2728. return matchesRange$1(current, specifierValue);
  2729. }
  2730. var isCoreModule = function isCore(x, nodeVersion) {
  2731. return src(data$2, x) && versionIncluded$1(nodeVersion, data$2[x]);
  2732. };
  2733. const fs$1 = /*@__PURE__*/getAugmentedNamespace$1(fs$4);
  2734. var realpathFS$1 = fs$1.realpath && typeof fs$1.realpath.native === 'function' ? fs$1.realpath.native : fs$1.realpath;
  2735. var defaultIsFile$1 = function isFile(file, cb) {
  2736. fs$1.stat(file, function (err, stat) {
  2737. if (!err) {
  2738. return cb(null, stat.isFile() || stat.isFIFO());
  2739. }
  2740. if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
  2741. return cb(err);
  2742. });
  2743. };
  2744. var defaultIsDir$1 = function isDirectory(dir, cb) {
  2745. fs$1.stat(dir, function (err, stat) {
  2746. if (!err) {
  2747. return cb(null, stat.isDirectory());
  2748. }
  2749. if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
  2750. return cb(err);
  2751. });
  2752. };
  2753. var defaultRealpath = function realpath(x, cb) {
  2754. realpathFS$1(x, function (realpathErr, realPath) {
  2755. if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr);
  2756. else cb(null, realpathErr ? x : realPath);
  2757. });
  2758. };
  2759. var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
  2760. if (opts && opts.preserveSymlinks === false) {
  2761. realpath(x, cb);
  2762. } else {
  2763. cb(null, x);
  2764. }
  2765. };
  2766. var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) {
  2767. readFile(pkgfile, function (readFileErr, body) {
  2768. if (readFileErr) cb(readFileErr);
  2769. else {
  2770. try {
  2771. var pkg = JSON.parse(body);
  2772. cb(null, pkg);
  2773. } catch (jsonErr) {
  2774. cb(null);
  2775. }
  2776. }
  2777. });
  2778. };
  2779. var getPackageCandidates$1 = function getPackageCandidates(x, start, opts) {
  2780. var dirs = nodeModulesPaths(start, opts, x);
  2781. for (var i = 0; i < dirs.length; i++) {
  2782. dirs[i] = path$4.join(dirs[i], x);
  2783. }
  2784. return dirs;
  2785. };
  2786. var async = function resolve(x, options, callback) {
  2787. var cb = callback;
  2788. var opts = options;
  2789. if (typeof options === 'function') {
  2790. cb = opts;
  2791. opts = {};
  2792. }
  2793. if (typeof x !== 'string') {
  2794. var err = new TypeError('Path must be a string.');
  2795. return process.nextTick(function () {
  2796. cb(err);
  2797. });
  2798. }
  2799. opts = normalizeOptions(x, opts);
  2800. var isFile = opts.isFile || defaultIsFile$1;
  2801. var isDirectory = opts.isDirectory || defaultIsDir$1;
  2802. var readFile = opts.readFile || fs$1.readFile;
  2803. var realpath = opts.realpath || defaultRealpath;
  2804. var readPackage = opts.readPackage || defaultReadPackage;
  2805. if (opts.readFile && opts.readPackage) {
  2806. var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.');
  2807. return process.nextTick(function () {
  2808. cb(conflictErr);
  2809. });
  2810. }
  2811. var packageIterator = opts.packageIterator;
  2812. var extensions = opts.extensions || ['.js'];
  2813. var includeCoreModules = opts.includeCoreModules !== false;
  2814. var basedir = opts.basedir || path$4.dirname(caller());
  2815. var parent = opts.filename || basedir;
  2816. opts.paths = opts.paths || [];
  2817. // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
  2818. var absoluteStart = path$4.resolve(basedir);
  2819. maybeRealpath(
  2820. realpath,
  2821. absoluteStart,
  2822. opts,
  2823. function (err, realStart) {
  2824. if (err) cb(err);
  2825. else init(realStart);
  2826. }
  2827. );
  2828. var res;
  2829. function init(basedir) {
  2830. if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
  2831. res = path$4.resolve(basedir, x);
  2832. if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
  2833. if ((/\/$/).test(x) && res === basedir) {
  2834. loadAsDirectory(res, opts.package, onfile);
  2835. } else loadAsFile(res, opts.package, onfile);
  2836. } else if (includeCoreModules && isCoreModule(x)) {
  2837. return cb(null, x);
  2838. } else loadNodeModules(x, basedir, function (err, n, pkg) {
  2839. if (err) cb(err);
  2840. else if (n) {
  2841. return maybeRealpath(realpath, n, opts, function (err, realN) {
  2842. if (err) {
  2843. cb(err);
  2844. } else {
  2845. cb(null, realN, pkg);
  2846. }
  2847. });
  2848. } else {
  2849. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  2850. moduleError.code = 'MODULE_NOT_FOUND';
  2851. cb(moduleError);
  2852. }
  2853. });
  2854. }
  2855. function onfile(err, m, pkg) {
  2856. if (err) cb(err);
  2857. else if (m) cb(null, m, pkg);
  2858. else loadAsDirectory(res, function (err, d, pkg) {
  2859. if (err) cb(err);
  2860. else if (d) {
  2861. maybeRealpath(realpath, d, opts, function (err, realD) {
  2862. if (err) {
  2863. cb(err);
  2864. } else {
  2865. cb(null, realD, pkg);
  2866. }
  2867. });
  2868. } else {
  2869. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  2870. moduleError.code = 'MODULE_NOT_FOUND';
  2871. cb(moduleError);
  2872. }
  2873. });
  2874. }
  2875. function loadAsFile(x, thePackage, callback) {
  2876. var loadAsFilePackage = thePackage;
  2877. var cb = callback;
  2878. if (typeof loadAsFilePackage === 'function') {
  2879. cb = loadAsFilePackage;
  2880. loadAsFilePackage = undefined;
  2881. }
  2882. var exts = [''].concat(extensions);
  2883. load(exts, x, loadAsFilePackage);
  2884. function load(exts, x, loadPackage) {
  2885. if (exts.length === 0) return cb(null, undefined, loadPackage);
  2886. var file = x + exts[0];
  2887. var pkg = loadPackage;
  2888. if (pkg) onpkg(null, pkg);
  2889. else loadpkg(path$4.dirname(file), onpkg);
  2890. function onpkg(err, pkg_, dir) {
  2891. pkg = pkg_;
  2892. if (err) return cb(err);
  2893. if (dir && pkg && opts.pathFilter) {
  2894. var rfile = path$4.relative(dir, file);
  2895. var rel = rfile.slice(0, rfile.length - exts[0].length);
  2896. var r = opts.pathFilter(pkg, x, rel);
  2897. if (r) return load(
  2898. [''].concat(extensions.slice()),
  2899. path$4.resolve(dir, r),
  2900. pkg
  2901. );
  2902. }
  2903. isFile(file, onex);
  2904. }
  2905. function onex(err, ex) {
  2906. if (err) return cb(err);
  2907. if (ex) return cb(null, file, pkg);
  2908. load(exts.slice(1), x, pkg);
  2909. }
  2910. }
  2911. }
  2912. function loadpkg(dir, cb) {
  2913. if (dir === '' || dir === '/') return cb(null);
  2914. if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
  2915. return cb(null);
  2916. }
  2917. if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null);
  2918. maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) {
  2919. if (unwrapErr) return loadpkg(path$4.dirname(dir), cb);
  2920. var pkgfile = path$4.join(pkgdir, 'package.json');
  2921. isFile(pkgfile, function (err, ex) {
  2922. // on err, ex is false
  2923. if (!ex) return loadpkg(path$4.dirname(dir), cb);
  2924. readPackage(readFile, pkgfile, function (err, pkgParam) {
  2925. if (err) cb(err);
  2926. var pkg = pkgParam;
  2927. if (pkg && opts.packageFilter) {
  2928. pkg = opts.packageFilter(pkg, pkgfile);
  2929. }
  2930. cb(null, pkg, dir);
  2931. });
  2932. });
  2933. });
  2934. }
  2935. function loadAsDirectory(x, loadAsDirectoryPackage, callback) {
  2936. var cb = callback;
  2937. var fpkg = loadAsDirectoryPackage;
  2938. if (typeof fpkg === 'function') {
  2939. cb = fpkg;
  2940. fpkg = opts.package;
  2941. }
  2942. maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) {
  2943. if (unwrapErr) return cb(unwrapErr);
  2944. var pkgfile = path$4.join(pkgdir, 'package.json');
  2945. isFile(pkgfile, function (err, ex) {
  2946. if (err) return cb(err);
  2947. if (!ex) return loadAsFile(path$4.join(x, 'index'), fpkg, cb);
  2948. readPackage(readFile, pkgfile, function (err, pkgParam) {
  2949. if (err) return cb(err);
  2950. var pkg = pkgParam;
  2951. if (pkg && opts.packageFilter) {
  2952. pkg = opts.packageFilter(pkg, pkgfile);
  2953. }
  2954. if (pkg && pkg.main) {
  2955. if (typeof pkg.main !== 'string') {
  2956. var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
  2957. mainError.code = 'INVALID_PACKAGE_MAIN';
  2958. return cb(mainError);
  2959. }
  2960. if (pkg.main === '.' || pkg.main === './') {
  2961. pkg.main = 'index';
  2962. }
  2963. loadAsFile(path$4.resolve(x, pkg.main), pkg, function (err, m, pkg) {
  2964. if (err) return cb(err);
  2965. if (m) return cb(null, m, pkg);
  2966. if (!pkg) return loadAsFile(path$4.join(x, 'index'), pkg, cb);
  2967. var dir = path$4.resolve(x, pkg.main);
  2968. loadAsDirectory(dir, pkg, function (err, n, pkg) {
  2969. if (err) return cb(err);
  2970. if (n) return cb(null, n, pkg);
  2971. loadAsFile(path$4.join(x, 'index'), pkg, cb);
  2972. });
  2973. });
  2974. return;
  2975. }
  2976. loadAsFile(path$4.join(x, '/index'), pkg, cb);
  2977. });
  2978. });
  2979. });
  2980. }
  2981. function processDirs(cb, dirs) {
  2982. if (dirs.length === 0) return cb(null, undefined);
  2983. var dir = dirs[0];
  2984. isDirectory(path$4.dirname(dir), isdir);
  2985. function isdir(err, isdir) {
  2986. if (err) return cb(err);
  2987. if (!isdir) return processDirs(cb, dirs.slice(1));
  2988. loadAsFile(dir, opts.package, onfile);
  2989. }
  2990. function onfile(err, m, pkg) {
  2991. if (err) return cb(err);
  2992. if (m) return cb(null, m, pkg);
  2993. loadAsDirectory(dir, opts.package, ondir);
  2994. }
  2995. function ondir(err, n, pkg) {
  2996. if (err) return cb(err);
  2997. if (n) return cb(null, n, pkg);
  2998. processDirs(cb, dirs.slice(1));
  2999. }
  3000. }
  3001. function loadNodeModules(x, start, cb) {
  3002. var thunk = function () { return getPackageCandidates$1(x, start, opts); };
  3003. processDirs(
  3004. cb,
  3005. packageIterator ? packageIterator(x, start, thunk, opts) : thunk()
  3006. );
  3007. }
  3008. };
  3009. const assert$1 = true;
  3010. const async_hooks = ">= 8";
  3011. const buffer_ieee754 = "< 0.9.7";
  3012. const buffer = true;
  3013. const child_process = true;
  3014. const cluster = true;
  3015. const console$1 = true;
  3016. const constants$1 = true;
  3017. const crypto$1 = true;
  3018. const _debug_agent = ">= 1 && < 8";
  3019. const _debugger = "< 8";
  3020. const dgram = true;
  3021. const diagnostics_channel = ">= 15.1";
  3022. const dns = true;
  3023. const domain = ">= 0.7.12";
  3024. const events$1 = true;
  3025. const freelist = "< 6";
  3026. const fs = true;
  3027. const _http_agent = ">= 0.11.1";
  3028. const _http_client = ">= 0.11.1";
  3029. const _http_common = ">= 0.11.1";
  3030. const _http_incoming = ">= 0.11.1";
  3031. const _http_outgoing = ">= 0.11.1";
  3032. const _http_server = ">= 0.11.1";
  3033. const http = true;
  3034. const http2 = ">= 8.8";
  3035. const https = true;
  3036. const inspector = ">= 8.0.0";
  3037. const _linklist = "< 8";
  3038. const module$1 = true;
  3039. const net = true;
  3040. const os = true;
  3041. const path$2 = true;
  3042. const perf_hooks = ">= 8.5";
  3043. const process$1 = ">= 1";
  3044. const punycode = true;
  3045. const querystring = true;
  3046. const readline = true;
  3047. const repl = true;
  3048. const smalloc = ">= 0.11.5 && < 3";
  3049. const _stream_duplex = ">= 0.9.4";
  3050. const _stream_transform = ">= 0.9.4";
  3051. const _stream_wrap = ">= 1.4.1";
  3052. const _stream_passthrough = ">= 0.9.4";
  3053. const _stream_readable = ">= 0.9.4";
  3054. const _stream_writable = ">= 0.9.4";
  3055. const stream = true;
  3056. const string_decoder = true;
  3057. const sys = [
  3058. ">= 0.6 && < 0.7",
  3059. ">= 0.8"
  3060. ];
  3061. const timers$1 = true;
  3062. const _tls_common = ">= 0.11.13";
  3063. const _tls_legacy = ">= 0.11.3 && < 10";
  3064. const _tls_wrap = ">= 0.11.3";
  3065. const tls = true;
  3066. const trace_events = ">= 10";
  3067. const tty = true;
  3068. const url = true;
  3069. const util$2 = true;
  3070. const v8 = ">= 1";
  3071. const vm = true;
  3072. const wasi = ">= 13.4 && < 13.5";
  3073. const worker_threads = ">= 11.7";
  3074. const zlib = true;
  3075. const data$1 = {
  3076. assert: assert$1,
  3077. "assert/strict": ">= 15",
  3078. async_hooks: async_hooks,
  3079. buffer_ieee754: buffer_ieee754,
  3080. buffer: buffer,
  3081. child_process: child_process,
  3082. cluster: cluster,
  3083. console: console$1,
  3084. constants: constants$1,
  3085. crypto: crypto$1,
  3086. _debug_agent: _debug_agent,
  3087. _debugger: _debugger,
  3088. dgram: dgram,
  3089. diagnostics_channel: diagnostics_channel,
  3090. dns: dns,
  3091. "dns/promises": ">= 15",
  3092. domain: domain,
  3093. events: events$1,
  3094. freelist: freelist,
  3095. fs: fs,
  3096. "fs/promises": [
  3097. ">= 10 && < 10.1",
  3098. ">= 14"
  3099. ],
  3100. _http_agent: _http_agent,
  3101. _http_client: _http_client,
  3102. _http_common: _http_common,
  3103. _http_incoming: _http_incoming,
  3104. _http_outgoing: _http_outgoing,
  3105. _http_server: _http_server,
  3106. http: http,
  3107. http2: http2,
  3108. https: https,
  3109. inspector: inspector,
  3110. _linklist: _linklist,
  3111. module: module$1,
  3112. net: net,
  3113. "node-inspect/lib/_inspect": ">= 7.6.0 && < 12",
  3114. "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12",
  3115. "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12",
  3116. os: os,
  3117. path: path$2,
  3118. "path/posix": ">= 15.3",
  3119. "path/win32": ">= 15.3",
  3120. perf_hooks: perf_hooks,
  3121. process: process$1,
  3122. punycode: punycode,
  3123. querystring: querystring,
  3124. readline: readline,
  3125. repl: repl,
  3126. smalloc: smalloc,
  3127. _stream_duplex: _stream_duplex,
  3128. _stream_transform: _stream_transform,
  3129. _stream_wrap: _stream_wrap,
  3130. _stream_passthrough: _stream_passthrough,
  3131. _stream_readable: _stream_readable,
  3132. _stream_writable: _stream_writable,
  3133. stream: stream,
  3134. "stream/promises": ">= 15",
  3135. string_decoder: string_decoder,
  3136. sys: sys,
  3137. timers: timers$1,
  3138. "timers/promises": ">= 15",
  3139. _tls_common: _tls_common,
  3140. _tls_legacy: _tls_legacy,
  3141. _tls_wrap: _tls_wrap,
  3142. tls: tls,
  3143. trace_events: trace_events,
  3144. tty: tty,
  3145. url: url,
  3146. util: util$2,
  3147. "util/types": ">= 15.3",
  3148. "v8/tools/arguments": ">= 10 && < 12",
  3149. "v8/tools/codemap": [
  3150. ">= 4.4.0 && < 5",
  3151. ">= 5.2.0 && < 12"
  3152. ],
  3153. "v8/tools/consarray": [
  3154. ">= 4.4.0 && < 5",
  3155. ">= 5.2.0 && < 12"
  3156. ],
  3157. "v8/tools/csvparser": [
  3158. ">= 4.4.0 && < 5",
  3159. ">= 5.2.0 && < 12"
  3160. ],
  3161. "v8/tools/logreader": [
  3162. ">= 4.4.0 && < 5",
  3163. ">= 5.2.0 && < 12"
  3164. ],
  3165. "v8/tools/profile_view": [
  3166. ">= 4.4.0 && < 5",
  3167. ">= 5.2.0 && < 12"
  3168. ],
  3169. "v8/tools/splaytree": [
  3170. ">= 4.4.0 && < 5",
  3171. ">= 5.2.0 && < 12"
  3172. ],
  3173. v8: v8,
  3174. vm: vm,
  3175. wasi: wasi,
  3176. worker_threads: worker_threads,
  3177. zlib: zlib
  3178. };
  3179. var current = (process.versions && process.versions.node && process.versions.node.split('.')) || [];
  3180. function specifierIncluded(specifier) {
  3181. var parts = specifier.split(' ');
  3182. var op = parts.length > 1 ? parts[0] : '=';
  3183. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
  3184. for (var i = 0; i < 3; ++i) {
  3185. var cur = parseInt(current[i] || 0, 10);
  3186. var ver = parseInt(versionParts[i] || 0, 10);
  3187. if (cur === ver) {
  3188. continue; // eslint-disable-line no-restricted-syntax, no-continue
  3189. }
  3190. if (op === '<') {
  3191. return cur < ver;
  3192. } else if (op === '>=') {
  3193. return cur >= ver;
  3194. } else {
  3195. return false;
  3196. }
  3197. }
  3198. return op === '>=';
  3199. }
  3200. function matchesRange(range) {
  3201. var specifiers = range.split(/ ?&& ?/);
  3202. if (specifiers.length === 0) { return false; }
  3203. for (var i = 0; i < specifiers.length; ++i) {
  3204. if (!specifierIncluded(specifiers[i])) { return false; }
  3205. }
  3206. return true;
  3207. }
  3208. function versionIncluded(specifierValue) {
  3209. if (typeof specifierValue === 'boolean') { return specifierValue; }
  3210. if (specifierValue && typeof specifierValue === 'object') {
  3211. for (var i = 0; i < specifierValue.length; ++i) {
  3212. if (matchesRange(specifierValue[i])) { return true; }
  3213. }
  3214. return false;
  3215. }
  3216. return matchesRange(specifierValue);
  3217. }
  3218. var core = {};
  3219. for (var mod in data$1) { // eslint-disable-line no-restricted-syntax
  3220. if (Object.prototype.hasOwnProperty.call(data$1, mod)) {
  3221. core[mod] = versionIncluded(data$1[mod]);
  3222. }
  3223. }
  3224. var core_1 = core;
  3225. var isCore = function isCore(x) {
  3226. return isCoreModule(x);
  3227. };
  3228. var realpathFS = fs$1.realpathSync && typeof fs$1.realpathSync.native === 'function' ? fs$1.realpathSync.native : fs$1.realpathSync;
  3229. var defaultIsFile = function isFile(file) {
  3230. try {
  3231. var stat = fs$1.statSync(file);
  3232. } catch (e) {
  3233. if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
  3234. throw e;
  3235. }
  3236. return stat.isFile() || stat.isFIFO();
  3237. };
  3238. var defaultIsDir = function isDirectory(dir) {
  3239. try {
  3240. var stat = fs$1.statSync(dir);
  3241. } catch (e) {
  3242. if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
  3243. throw e;
  3244. }
  3245. return stat.isDirectory();
  3246. };
  3247. var defaultRealpathSync = function realpathSync(x) {
  3248. try {
  3249. return realpathFS(x);
  3250. } catch (realpathErr) {
  3251. if (realpathErr.code !== 'ENOENT') {
  3252. throw realpathErr;
  3253. }
  3254. }
  3255. return x;
  3256. };
  3257. var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) {
  3258. if (opts && opts.preserveSymlinks === false) {
  3259. return realpathSync(x);
  3260. }
  3261. return x;
  3262. };
  3263. var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) {
  3264. var body = readFileSync(pkgfile);
  3265. try {
  3266. var pkg = JSON.parse(body);
  3267. return pkg;
  3268. } catch (jsonErr) {}
  3269. };
  3270. var getPackageCandidates = function getPackageCandidates(x, start, opts) {
  3271. var dirs = nodeModulesPaths(start, opts, x);
  3272. for (var i = 0; i < dirs.length; i++) {
  3273. dirs[i] = path$4.join(dirs[i], x);
  3274. }
  3275. return dirs;
  3276. };
  3277. var sync$1 = function resolveSync(x, options) {
  3278. if (typeof x !== 'string') {
  3279. throw new TypeError('Path must be a string.');
  3280. }
  3281. var opts = normalizeOptions(x, options);
  3282. var isFile = opts.isFile || defaultIsFile;
  3283. var readFileSync = opts.readFileSync || fs$1.readFileSync;
  3284. var isDirectory = opts.isDirectory || defaultIsDir;
  3285. var realpathSync = opts.realpathSync || defaultRealpathSync;
  3286. var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
  3287. if (opts.readFileSync && opts.readPackageSync) {
  3288. throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.');
  3289. }
  3290. var packageIterator = opts.packageIterator;
  3291. var extensions = opts.extensions || ['.js'];
  3292. var includeCoreModules = opts.includeCoreModules !== false;
  3293. var basedir = opts.basedir || path$4.dirname(caller());
  3294. var parent = opts.filename || basedir;
  3295. opts.paths = opts.paths || [];
  3296. // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
  3297. var absoluteStart = maybeRealpathSync(realpathSync, path$4.resolve(basedir), opts);
  3298. if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
  3299. var res = path$4.resolve(absoluteStart, x);
  3300. if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
  3301. var m = loadAsFileSync(res) || loadAsDirectorySync(res);
  3302. if (m) return maybeRealpathSync(realpathSync, m, opts);
  3303. } else if (includeCoreModules && isCoreModule(x)) {
  3304. return x;
  3305. } else {
  3306. var n = loadNodeModulesSync(x, absoluteStart);
  3307. if (n) return maybeRealpathSync(realpathSync, n, opts);
  3308. }
  3309. var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  3310. err.code = 'MODULE_NOT_FOUND';
  3311. throw err;
  3312. function loadAsFileSync(x) {
  3313. var pkg = loadpkg(path$4.dirname(x));
  3314. if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
  3315. var rfile = path$4.relative(pkg.dir, x);
  3316. var r = opts.pathFilter(pkg.pkg, x, rfile);
  3317. if (r) {
  3318. x = path$4.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign
  3319. }
  3320. }
  3321. if (isFile(x)) {
  3322. return x;
  3323. }
  3324. for (var i = 0; i < extensions.length; i++) {
  3325. var file = x + extensions[i];
  3326. if (isFile(file)) {
  3327. return file;
  3328. }
  3329. }
  3330. }
  3331. function loadpkg(dir) {
  3332. if (dir === '' || dir === '/') return;
  3333. if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
  3334. return;
  3335. }
  3336. if ((/[/\\]node_modules[/\\]*$/).test(dir)) return;
  3337. var pkgfile = path$4.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json');
  3338. if (!isFile(pkgfile)) {
  3339. return loadpkg(path$4.dirname(dir));
  3340. }
  3341. var pkg = readPackageSync(readFileSync, pkgfile);
  3342. if (pkg && opts.packageFilter) {
  3343. // v2 will pass pkgfile
  3344. pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment
  3345. }
  3346. return { pkg: pkg, dir: dir };
  3347. }
  3348. function loadAsDirectorySync(x) {
  3349. var pkgfile = path$4.join(maybeRealpathSync(realpathSync, x, opts), '/package.json');
  3350. if (isFile(pkgfile)) {
  3351. try {
  3352. var pkg = readPackageSync(readFileSync, pkgfile);
  3353. } catch (e) {}
  3354. if (pkg && opts.packageFilter) {
  3355. // v2 will pass pkgfile
  3356. pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment
  3357. }
  3358. if (pkg && pkg.main) {
  3359. if (typeof pkg.main !== 'string') {
  3360. var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
  3361. mainError.code = 'INVALID_PACKAGE_MAIN';
  3362. throw mainError;
  3363. }
  3364. if (pkg.main === '.' || pkg.main === './') {
  3365. pkg.main = 'index';
  3366. }
  3367. try {
  3368. var m = loadAsFileSync(path$4.resolve(x, pkg.main));
  3369. if (m) return m;
  3370. var n = loadAsDirectorySync(path$4.resolve(x, pkg.main));
  3371. if (n) return n;
  3372. } catch (e) {}
  3373. }
  3374. }
  3375. return loadAsFileSync(path$4.join(x, '/index'));
  3376. }
  3377. function loadNodeModulesSync(x, start) {
  3378. var thunk = function () { return getPackageCandidates(x, start, opts); };
  3379. var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk();
  3380. for (var i = 0; i < dirs.length; i++) {
  3381. var dir = dirs[i];
  3382. if (isDirectory(path$4.dirname(dir))) {
  3383. var m = loadAsFileSync(dir);
  3384. if (m) return m;
  3385. var n = loadAsDirectorySync(dir);
  3386. if (n) return n;
  3387. }
  3388. }
  3389. }
  3390. };
  3391. async.core = core_1;
  3392. async.isCore = isCore;
  3393. async.sync = sync$1;
  3394. var resolve = async;
  3395. const COMMON_DIR_MODULE_EXTS = ['.tsx', '.ts', '.mjs', '.js', '.jsx', '.json', '.md'];
  3396. const COMMON_DIR_FILENAMES = ['package.json', 'index.js', 'index.mjs'];
  3397. /**
  3398. * Determine if a stringified file path is a TypeScript declaration file based on the extension at the end of the path.
  3399. * @param p the path to evaluate
  3400. * @returns `true` if the path ends in `.d.ts` (case-sensitive), `false` otherwise.
  3401. */
  3402. const isDtsFile = (p) => p.endsWith('.d.ts');
  3403. /**
  3404. * Determine if a stringified file path is a TypeScript file based on the extension at the end of the path. This
  3405. * function does _not_ consider type declaration files (`.d.ts` files) to be TypeScript files.
  3406. * @param p the path to evaluate
  3407. * @returns `true` if the path ends in `.ts` (case-sensitive) but does _not_ end in `.d.ts`, `false` otherwise.
  3408. */
  3409. const isTsFile = (p) => !isDtsFile(p) && p.endsWith('.ts');
  3410. /**
  3411. * Determine if a stringified file path is a TSX file based on the extension at the end of the path
  3412. * @param p the path to evaluate
  3413. * @returns `true` if the path ends in `.tsx` (case-sensitive), `false` otherwise.
  3414. */
  3415. const isTsxFile = (p) => p.endsWith('.tsx');
  3416. /**
  3417. * Determine if a stringified file path is a JSX file based on the extension at the end of the path
  3418. * @param p the path to evaluate
  3419. * @returns `true` if the path ends in `.jsx` (case-sensitive), `false` otherwise.
  3420. */
  3421. const isJsxFile = (p) => p.endsWith('.jsx');
  3422. /**
  3423. * Determine if a stringified file path is a JavaScript file based on the extension at the end of the path
  3424. * @param p the path to evaluate
  3425. * @returns `true` if the path ends in `.js` (case-sensitive), `false` otherwise.
  3426. */
  3427. const isJsFile = (p) => p.endsWith('.js');
  3428. const isJsonFile = (p) => p.endsWith('.json');
  3429. const getCommonDirName = (dirPath, fileName) => dirPath + '/' + fileName;
  3430. const isCommonDirModuleFile = (p) => COMMON_DIR_MODULE_EXTS.some((ext) => p.endsWith(ext));
  3431. const setPackageVersion = (pkgVersions, pkgName, pkgVersion) => {
  3432. pkgVersions.set(pkgName, pkgVersion);
  3433. };
  3434. const setPackageVersionByContent = (pkgVersions, pkgContent) => {
  3435. try {
  3436. const pkg = JSON.parse(pkgContent);
  3437. if (pkg.name && pkg.version) {
  3438. setPackageVersion(pkgVersions, pkg.name, pkg.version);
  3439. }
  3440. }
  3441. catch (e) { }
  3442. };
  3443. const isLocalModule = (p) => p.startsWith('.') || p.startsWith('/');
  3444. const isStencilCoreImport = (p) => p.startsWith('@stencil/core');
  3445. const shouldFetchModule = (p) => IS_FETCH_ENV && IS_BROWSER_ENV && isNodeModulePath(p);
  3446. const isNodeModulePath = (p) => normalizePath$1(p).split('/').includes('node_modules');
  3447. const getModuleId = (orgImport) => {
  3448. if (orgImport.startsWith('~')) {
  3449. orgImport = orgImport.substring(1);
  3450. }
  3451. const splt = orgImport.split('/');
  3452. const m = {
  3453. moduleId: null,
  3454. filePath: null,
  3455. scope: null,
  3456. scopeSubModuleId: null,
  3457. };
  3458. if (orgImport.startsWith('@') && splt.length > 1) {
  3459. m.moduleId = splt.slice(0, 2).join('/');
  3460. m.filePath = splt.slice(2).join('/');
  3461. m.scope = splt[0];
  3462. m.scopeSubModuleId = splt[1];
  3463. }
  3464. else {
  3465. m.moduleId = splt[0];
  3466. m.filePath = splt.slice(1).join('/');
  3467. }
  3468. return m;
  3469. };
  3470. const getPackageDirPath = (p, moduleId) => {
  3471. const parts = normalizePath$1(p).split('/');
  3472. const m = getModuleId(moduleId);
  3473. for (let i = parts.length - 1; i >= 1; i--) {
  3474. if (parts[i - 1] === 'node_modules') {
  3475. if (m.scope) {
  3476. if (parts[i] === m.scope && parts[i + 1] === m.scopeSubModuleId) {
  3477. return parts.slice(0, i + 2).join('/');
  3478. }
  3479. }
  3480. else if (parts[i] === m.moduleId) {
  3481. return parts.slice(0, i + 1).join('/');
  3482. }
  3483. }
  3484. }
  3485. return null;
  3486. };
  3487. /**
  3488. * A fetch wrapper which dispatches to `sys.fetch` if present, and otherwise
  3489. * uses `global.fetch`.
  3490. *
  3491. * @param sys a compiler system object
  3492. * @param input a `RequestInfo` object
  3493. * @param init an optional `RequestInit` object
  3494. * @returns a Promise wrapping a response
  3495. */
  3496. const httpFetch = (sys, input, init) => {
  3497. if (sys && isFunction(sys.fetch)) {
  3498. return sys.fetch(input, init);
  3499. }
  3500. return fetch(input, init);
  3501. };
  3502. const packageVersions = new Map();
  3503. const known404Urls = new Set();
  3504. /**
  3505. * Get the URL for a Stencil module given the path to the compiler
  3506. *
  3507. * @param compilerExe the path to the compiler executable
  3508. * @param path the path to the module or file in question
  3509. * @returns a URL for the file of interest
  3510. */
  3511. const getStencilModuleUrl = (compilerExe, path) => {
  3512. path = normalizePath$1(path);
  3513. let parts = path.split('/');
  3514. const nmIndex = parts.lastIndexOf('node_modules');
  3515. if (nmIndex > -1 && nmIndex < parts.length - 1) {
  3516. parts = parts.slice(nmIndex + 1);
  3517. if (parts[0].startsWith('@')) {
  3518. parts = parts.slice(2);
  3519. }
  3520. else {
  3521. parts = parts.slice(1);
  3522. }
  3523. path = parts.join('/');
  3524. }
  3525. const stencilRootUrl = new URL('../', compilerExe).href;
  3526. return new URL('./' + path, stencilRootUrl).href;
  3527. };
  3528. const getCommonDirUrl = (sys, pkgVersions, dirPath, fileName) => getNodeModuleFetchUrl(sys, pkgVersions, dirPath) + '/' + fileName;
  3529. const getNodeModuleFetchUrl = (sys, pkgVersions, filePath) => {
  3530. // /node_modules/lodash/package.json
  3531. filePath = normalizePath$1(filePath);
  3532. // ["node_modules", "lodash", "package.json"]
  3533. let pathParts = filePath.split('/').filter((p) => p.length);
  3534. const nmIndex = pathParts.lastIndexOf('node_modules');
  3535. if (nmIndex > -1 && nmIndex < pathParts.length - 1) {
  3536. pathParts = pathParts.slice(nmIndex + 1);
  3537. }
  3538. let moduleId = pathParts.shift();
  3539. if (moduleId.startsWith('@')) {
  3540. moduleId += '/' + pathParts.shift();
  3541. }
  3542. const path = pathParts.join('/');
  3543. if (moduleId === '@stencil/core') {
  3544. const compilerExe = sys.getCompilerExecutingPath();
  3545. return getStencilModuleUrl(compilerExe, path);
  3546. }
  3547. return sys.getRemoteModuleUrl({
  3548. moduleId,
  3549. version: pkgVersions.get(moduleId),
  3550. path,
  3551. });
  3552. };
  3553. const skipFilePathFetch = (filePath) => {
  3554. if (isTsFile(filePath) || isTsxFile(filePath)) {
  3555. // don't bother trying to resolve node_module packages w/ typescript files
  3556. // they should already be .js files
  3557. return true;
  3558. }
  3559. const pathParts = filePath.split('/');
  3560. const secondToLast = pathParts[pathParts.length - 2];
  3561. const lastPart = pathParts[pathParts.length - 1];
  3562. if (secondToLast === 'node_modules' && isCommonDirModuleFile(lastPart)) {
  3563. // /node_modules/index.js
  3564. // /node_modules/lodash.js
  3565. // we just already know this is bogus, so don't bother
  3566. return true;
  3567. }
  3568. return false;
  3569. };
  3570. const skipUrlFetch = (url) =>
  3571. // files we just already know not to try to resolve request
  3572. knownUrlSkips.some((knownSkip) => url.endsWith(knownSkip));
  3573. const knownUrlSkips = [
  3574. '/@stencil/core/internal.js',
  3575. '/@stencil/core/internal.json',
  3576. '/@stencil/core/internal.mjs',
  3577. '/@stencil/core/internal/stencil-core.js/index.json',
  3578. '/@stencil/core/internal/stencil-core.js.json',
  3579. '/@stencil/core/internal/stencil-core.js/package.json',
  3580. '/@stencil/core.js',
  3581. '/@stencil/core.json',
  3582. '/@stencil/core.mjs',
  3583. '/@stencil/core.css',
  3584. '/@stencil/core/index.js',
  3585. '/@stencil/core/index.json',
  3586. '/@stencil/core/index.mjs',
  3587. '/@stencil/core/index.css',
  3588. '/@stencil/package.json',
  3589. ];
  3590. const writeFetchSuccessSync = (sys, inMemoryFs, url, filePath, content, pkgVersions) => {
  3591. if (url.endsWith('package.json')) {
  3592. setPackageVersionByContent(pkgVersions, content);
  3593. }
  3594. let dir = dirname(filePath);
  3595. while (dir !== '/' && dir !== '') {
  3596. if (inMemoryFs) {
  3597. inMemoryFs.clearFileCache(dir);
  3598. inMemoryFs.sys.createDirSync(dir);
  3599. }
  3600. else {
  3601. sys.createDirSync(dir);
  3602. }
  3603. dir = dirname(dir);
  3604. }
  3605. if (inMemoryFs) {
  3606. inMemoryFs.clearFileCache(filePath);
  3607. inMemoryFs.sys.writeFileSync(filePath, content);
  3608. }
  3609. else {
  3610. sys.writeFileSync(filePath, content);
  3611. }
  3612. };
  3613. const writeFetchSuccessAsync = async (sys, inMemoryFs, url, filePath, content, pkgVersions) => {
  3614. if (url.endsWith('package.json')) {
  3615. setPackageVersionByContent(pkgVersions, content);
  3616. }
  3617. let dir = dirname(filePath);
  3618. while (dir !== '/' && dir !== '') {
  3619. if (inMemoryFs) {
  3620. inMemoryFs.clearFileCache(dir);
  3621. await inMemoryFs.sys.createDir(dir);
  3622. }
  3623. else {
  3624. await sys.createDir(dir);
  3625. }
  3626. dir = dirname(dir);
  3627. }
  3628. if (inMemoryFs) {
  3629. inMemoryFs.clearFileCache(filePath);
  3630. await inMemoryFs.sys.writeFile(filePath, content);
  3631. }
  3632. else {
  3633. await sys.writeFile(filePath, content);
  3634. }
  3635. };
  3636. const fetchModuleAsync = async (sys, inMemoryFs, pkgVersions, url, filePath) => {
  3637. if (skipFilePathFetch(filePath) || known404Urls.has(url) || skipUrlFetch(url)) {
  3638. return undefined;
  3639. }
  3640. try {
  3641. const rsp = await httpFetch(sys, url);
  3642. if (rsp) {
  3643. if (rsp.ok) {
  3644. const content = await rsp.clone().text();
  3645. await writeFetchSuccessAsync(sys, inMemoryFs, url, filePath, content, pkgVersions);
  3646. return content;
  3647. }
  3648. if (rsp.status === 404) {
  3649. known404Urls.add(url);
  3650. }
  3651. }
  3652. }
  3653. catch (e) {
  3654. console.error(e);
  3655. }
  3656. return undefined;
  3657. };
  3658. const resolveModuleIdAsync = (sys, inMemoryFs, opts) => {
  3659. const resolverOpts = createCustomResolverAsync(sys, inMemoryFs, opts.exts);
  3660. resolverOpts.basedir = dirname(normalizeFsPath(opts.containingFile));
  3661. if (opts.packageFilter) {
  3662. resolverOpts.packageFilter = opts.packageFilter;
  3663. }
  3664. else if (opts.packageFilter !== null) {
  3665. resolverOpts.packageFilter = (pkg) => {
  3666. if (!isString$1(pkg.main) || pkg.main === '') {
  3667. pkg.main = 'package.json';
  3668. }
  3669. return pkg;
  3670. };
  3671. }
  3672. return new Promise((resolvePromise, rejectPromise) => {
  3673. resolve(opts.moduleId, resolverOpts, (err, resolveId, pkgData) => {
  3674. if (err) {
  3675. rejectPromise(err);
  3676. }
  3677. else {
  3678. resolveId = normalizePath$1(resolveId);
  3679. const results = {
  3680. moduleId: opts.moduleId,
  3681. resolveId,
  3682. pkgData,
  3683. pkgDirPath: getPackageDirPath(resolveId, opts.moduleId),
  3684. };
  3685. resolvePromise(results);
  3686. }
  3687. });
  3688. });
  3689. };
  3690. const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
  3691. return {
  3692. async isFile(filePath, cb) {
  3693. const fsFilePath = normalizeFsPath(filePath);
  3694. const stat = await inMemoryFs.stat(fsFilePath);
  3695. if (stat.isFile) {
  3696. cb(null, true);
  3697. return;
  3698. }
  3699. if (shouldFetchModule(fsFilePath)) {
  3700. const endsWithExt = exts.some((ext) => fsFilePath.endsWith(ext));
  3701. if (endsWithExt) {
  3702. const url = getNodeModuleFetchUrl(sys, packageVersions, fsFilePath);
  3703. const content = await fetchModuleAsync(sys, inMemoryFs, packageVersions, url, fsFilePath);
  3704. const checkFileExists = typeof content === 'string';
  3705. cb(null, checkFileExists);
  3706. return;
  3707. }
  3708. }
  3709. cb(null, false);
  3710. },
  3711. async isDirectory(dirPath, cb) {
  3712. const fsDirPath = normalizeFsPath(dirPath);
  3713. const stat = await inMemoryFs.stat(fsDirPath);
  3714. if (stat.isDirectory) {
  3715. cb(null, true);
  3716. return;
  3717. }
  3718. if (shouldFetchModule(fsDirPath)) {
  3719. if (basename(fsDirPath) === 'node_modules') {
  3720. // just the /node_modules directory
  3721. inMemoryFs.sys.createDirSync(fsDirPath);
  3722. inMemoryFs.clearFileCache(fsDirPath);
  3723. cb(null, true);
  3724. return;
  3725. }
  3726. if (isCommonDirModuleFile(fsDirPath)) {
  3727. // don't bother seeing if it's a directory if it has a common file extension
  3728. cb(null, false);
  3729. return;
  3730. }
  3731. for (const fileName of COMMON_DIR_FILENAMES) {
  3732. const url = getCommonDirUrl(sys, packageVersions, fsDirPath, fileName);
  3733. const filePath = getCommonDirName(fsDirPath, fileName);
  3734. const content = await fetchModuleAsync(sys, inMemoryFs, packageVersions, url, filePath);
  3735. if (isString$1(content)) {
  3736. cb(null, true);
  3737. return;
  3738. }
  3739. }
  3740. }
  3741. cb(null, false);
  3742. },
  3743. async readFile(p, cb) {
  3744. const fsFilePath = normalizeFsPath(p);
  3745. const data = await inMemoryFs.readFile(fsFilePath);
  3746. if (isString$1(data)) {
  3747. return cb(null, data);
  3748. }
  3749. return cb(`readFile not found: ${p}`);
  3750. },
  3751. async realpath(p, cb) {
  3752. const fsFilePath = normalizeFsPath(p);
  3753. const results = await sys.realpath(fsFilePath);
  3754. if (results.error && results.error.code !== 'ENOENT') {
  3755. cb(results.error);
  3756. }
  3757. else {
  3758. cb(null, results.error ? fsFilePath : results.path);
  3759. }
  3760. },
  3761. extensions: exts,
  3762. };
  3763. };
  3764. const createWebWorkerMainController = (sys, maxConcurrentWorkers) => {
  3765. let msgIds = 0;
  3766. let isDestroyed = false;
  3767. let isQueued = false;
  3768. let workerIds = 0;
  3769. let workerBlob;
  3770. const tasks = new Map();
  3771. const queuedSendMsgs = [];
  3772. const workers = [];
  3773. const maxWorkers = Math.max(Math.min(maxConcurrentWorkers, sys.hardwareConcurrency), 2) - 1;
  3774. const tick = Promise.resolve();
  3775. const onMsgsFromWorker = (worker, ev) => {
  3776. if (!isDestroyed) {
  3777. const msgsFromWorker = ev.data;
  3778. if (Array.isArray(msgsFromWorker)) {
  3779. for (const msgFromWorker of msgsFromWorker) {
  3780. if (msgFromWorker) {
  3781. const task = tasks.get(msgFromWorker.stencilId);
  3782. if (task) {
  3783. tasks.delete(msgFromWorker.stencilId);
  3784. if (msgFromWorker.stencilRtnError) {
  3785. task.reject(msgFromWorker.stencilRtnError);
  3786. }
  3787. else {
  3788. task.resolve(msgFromWorker.stencilRtnValue);
  3789. }
  3790. worker.activeTasks--;
  3791. if (worker.activeTasks < 0 || worker.activeTasks > 50) {
  3792. worker.activeTasks = 0;
  3793. }
  3794. }
  3795. else if (msgFromWorker.stencilRtnError) {
  3796. console.error(msgFromWorker.stencilRtnError);
  3797. }
  3798. }
  3799. }
  3800. }
  3801. }
  3802. };
  3803. const onWorkerError = (e) => console.error(e);
  3804. const createWorkerMain = () => {
  3805. let worker = null;
  3806. const workerUrl = sys.getCompilerExecutingPath();
  3807. const workerOpts = {
  3808. name: `stencil.worker.${workerIds++}`,
  3809. };
  3810. try {
  3811. // first try directly starting the worker with the URL
  3812. worker = new Worker(workerUrl, workerOpts);
  3813. }
  3814. catch (e) {
  3815. // probably a cross-origin issue, try using a Blob instead
  3816. if (workerBlob == null) {
  3817. workerBlob = new Blob([`importScripts('${workerUrl}');`], { type: 'application/javascript' });
  3818. }
  3819. worker = new Worker(URL.createObjectURL(workerBlob), workerOpts);
  3820. }
  3821. const workerChild = {
  3822. worker,
  3823. activeTasks: 0,
  3824. sendQueue: [],
  3825. };
  3826. worker.onerror = onWorkerError;
  3827. worker.onmessage = (ev) => onMsgsFromWorker(workerChild, ev);
  3828. return workerChild;
  3829. };
  3830. const sendMsgsToWorkers = (w) => {
  3831. if (w.sendQueue.length > 0) {
  3832. w.worker.postMessage(w.sendQueue);
  3833. w.sendQueue.length = 0;
  3834. }
  3835. };
  3836. const queueMsgToWorker = (msg) => {
  3837. let theChosenOne;
  3838. if (workers.length > 0) {
  3839. theChosenOne = workers[0];
  3840. if (maxWorkers > 1) {
  3841. for (const worker of workers) {
  3842. if (worker.activeTasks < theChosenOne.activeTasks) {
  3843. theChosenOne = worker;
  3844. }
  3845. }
  3846. if (theChosenOne.activeTasks > 0 && workers.length < maxWorkers) {
  3847. theChosenOne = createWorkerMain();
  3848. workers.push(theChosenOne);
  3849. }
  3850. }
  3851. }
  3852. else {
  3853. theChosenOne = createWorkerMain();
  3854. workers.push(theChosenOne);
  3855. }
  3856. theChosenOne.activeTasks++;
  3857. theChosenOne.sendQueue.push(msg);
  3858. };
  3859. const flushSendQueue = () => {
  3860. isQueued = false;
  3861. queuedSendMsgs.forEach(queueMsgToWorker);
  3862. queuedSendMsgs.length = 0;
  3863. workers.forEach(sendMsgsToWorkers);
  3864. };
  3865. const send = (...args) => new Promise((resolve, reject) => {
  3866. if (isDestroyed) {
  3867. reject(TASK_CANCELED_MSG);
  3868. }
  3869. else {
  3870. const msg = {
  3871. stencilId: msgIds++,
  3872. args,
  3873. };
  3874. queuedSendMsgs.push(msg);
  3875. tasks.set(msg.stencilId, {
  3876. resolve,
  3877. reject,
  3878. });
  3879. if (!isQueued) {
  3880. isQueued = true;
  3881. tick.then(flushSendQueue);
  3882. }
  3883. }
  3884. });
  3885. const destroy = () => {
  3886. isDestroyed = true;
  3887. tasks.forEach((t) => t.reject(TASK_CANCELED_MSG));
  3888. tasks.clear();
  3889. workers.forEach((w) => w.worker.terminate());
  3890. workers.length = 0;
  3891. };
  3892. const handler = (name) => {
  3893. return function (...args) {
  3894. return send(name, ...args);
  3895. };
  3896. };
  3897. return {
  3898. send,
  3899. destroy,
  3900. handler,
  3901. maxWorkers,
  3902. };
  3903. };
  3904. const createSystem = (c) => {
  3905. const logger = c && c.logger ? c.logger : createLogger();
  3906. const items = new Map();
  3907. const destroys = new Set();
  3908. const addDestory = (cb) => destroys.add(cb);
  3909. const removeDestory = (cb) => destroys.delete(cb);
  3910. const events = buildEvents();
  3911. const hardwareConcurrency = (IS_BROWSER_ENV && navigator.hardwareConcurrency) || 1;
  3912. const destroy = async () => {
  3913. const waits = [];
  3914. destroys.forEach((cb) => {
  3915. try {
  3916. const rtn = cb();
  3917. if (rtn && rtn.then) {
  3918. waits.push(rtn);
  3919. }
  3920. }
  3921. catch (e) {
  3922. logger.error(`stencil sys destroy: ${e}`);
  3923. }
  3924. });
  3925. await Promise.all(waits);
  3926. destroys.clear();
  3927. };
  3928. const normalize = (p) => {
  3929. if (p === '/' || p === '') {
  3930. return '/';
  3931. }
  3932. const dir = dirname(p);
  3933. const base = basename(p);
  3934. if (dir.endsWith('/')) {
  3935. return normalizePath$1(`${dir}${base}`);
  3936. }
  3937. return normalizePath$1(`${dir}/${base}`);
  3938. };
  3939. const accessSync = (p) => {
  3940. const item = items.get(normalize(p));
  3941. return !!(item && (item.isDirectory || (item.isFile && typeof item.data === 'string')));
  3942. };
  3943. const access = async (p) => accessSync(p);
  3944. const copyFile = async (src, dest) => {
  3945. writeFileSync(dest, readFileSync(src));
  3946. return true;
  3947. };
  3948. const isTTY = () => {
  3949. var _a;
  3950. return !!((_a = process$3 === null || process$3 === void 0 ? void 0 : process_1.stdout) === null || _a === void 0 ? void 0 : _a.isTTY);
  3951. };
  3952. const homeDir = () => {
  3953. return undefined();
  3954. };
  3955. const createDirSync = (p, opts) => {
  3956. p = normalize(p);
  3957. const results = {
  3958. basename: basename(p),
  3959. dirname: dirname(p),
  3960. path: p,
  3961. newDirs: [],
  3962. error: null,
  3963. };
  3964. createDirRecursiveSync(p, opts, results);
  3965. return results;
  3966. };
  3967. const createDirRecursiveSync = (p, opts, results) => {
  3968. const parentDir = dirname(p);
  3969. if (opts && opts.recursive && !isRootPath(parentDir)) {
  3970. createDirRecursiveSync(parentDir, opts, results);
  3971. }
  3972. const item = items.get(p);
  3973. if (!item) {
  3974. items.set(p, {
  3975. basename: basename(p),
  3976. dirname: parentDir,
  3977. isDirectory: true,
  3978. isFile: false,
  3979. watcherCallbacks: null,
  3980. data: undefined,
  3981. });
  3982. results.newDirs.push(p);
  3983. emitDirectoryWatch(p, new Set());
  3984. }
  3985. else {
  3986. item.isDirectory = true;
  3987. item.isFile = false;
  3988. }
  3989. };
  3990. const createDir = async (p, opts) => createDirSync(p, opts);
  3991. const encodeToBase64 = (str) => btoa(unescape(encodeURIComponent(str)));
  3992. const getCurrentDirectory = () => '/';
  3993. const getCompilerExecutingPath = () => {
  3994. if (IS_WEB_WORKER_ENV) {
  3995. return location.href;
  3996. }
  3997. return sys.getRemoteModuleUrl({ moduleId: '@stencil/core', path: 'compiler/stencil.min.js' });
  3998. };
  3999. const isSymbolicLink = async (_p) => false;
  4000. const readDirSync = (p) => {
  4001. p = normalize(p);
  4002. const dirItems = [];
  4003. const dir = items.get(p);
  4004. if (dir && dir.isDirectory) {
  4005. items.forEach((item, itemPath) => {
  4006. if (itemPath !== '/' && (item.isDirectory || (item.isFile && typeof item.data === 'string'))) {
  4007. if (p.endsWith('/') && `${p}${item.basename}` === itemPath) {
  4008. dirItems.push(itemPath);
  4009. }
  4010. else if (`${p}/${item.basename}` === itemPath) {
  4011. dirItems.push(itemPath);
  4012. }
  4013. }
  4014. });
  4015. }
  4016. return dirItems.sort();
  4017. };
  4018. const readDir = async (p) => readDirSync(p);
  4019. const readFileSync = (p) => {
  4020. p = normalize(p);
  4021. const item = items.get(p);
  4022. if (item && item.isFile) {
  4023. return item.data;
  4024. }
  4025. return undefined;
  4026. };
  4027. const readFile = async (p) => readFileSync(p);
  4028. const realpathSync = (p) => {
  4029. const results = {
  4030. path: normalize(p),
  4031. error: null,
  4032. };
  4033. return results;
  4034. };
  4035. const realpath = async (p) => realpathSync(p);
  4036. const rename = async (oldPath, newPath) => {
  4037. oldPath = normalizePath$1(oldPath);
  4038. newPath = normalizePath$1(newPath);
  4039. const results = {
  4040. oldPath,
  4041. newPath,
  4042. renamed: [],
  4043. oldDirs: [],
  4044. oldFiles: [],
  4045. newDirs: [],
  4046. newFiles: [],
  4047. isFile: false,
  4048. isDirectory: false,
  4049. error: null,
  4050. };
  4051. const stats = statSync(oldPath);
  4052. if (!stats.error) {
  4053. if (stats.isFile) {
  4054. results.isFile = true;
  4055. }
  4056. else if (stats.isDirectory) {
  4057. results.isDirectory = true;
  4058. }
  4059. renameNewRecursiveSync(oldPath, newPath, results);
  4060. if (!results.error) {
  4061. if (results.isDirectory) {
  4062. const rmdirResults = removeDirSync(oldPath, { recursive: true });
  4063. if (rmdirResults.error) {
  4064. results.error = rmdirResults.error;
  4065. }
  4066. else {
  4067. results.oldDirs.push(...rmdirResults.removedDirs);
  4068. results.oldFiles.push(...rmdirResults.removedFiles);
  4069. }
  4070. }
  4071. else if (results.isFile) {
  4072. const removeFileResults = removeFileSync(oldPath);
  4073. if (removeFileResults.error) {
  4074. results.error = removeFileResults.error;
  4075. }
  4076. else {
  4077. results.oldFiles.push(oldPath);
  4078. }
  4079. }
  4080. }
  4081. }
  4082. else {
  4083. results.error = `${oldPath} does not exist`;
  4084. }
  4085. return results;
  4086. };
  4087. const renameNewRecursiveSync = (oldPath, newPath, results) => {
  4088. const itemStat = statSync(oldPath);
  4089. if (!itemStat.error && !results.error) {
  4090. if (itemStat.isFile) {
  4091. const newFileParentDir = dirname(newPath);
  4092. const createDirResults = createDirSync(newFileParentDir, { recursive: true });
  4093. const fileContent = items.get(oldPath).data;
  4094. const writeResults = writeFileSync(newPath, fileContent);
  4095. results.newDirs.push(...createDirResults.newDirs);
  4096. results.renamed.push({
  4097. oldPath,
  4098. newPath,
  4099. isDirectory: false,
  4100. isFile: true,
  4101. });
  4102. if (writeResults.error) {
  4103. results.error = writeResults.error;
  4104. }
  4105. else {
  4106. results.newFiles.push(newPath);
  4107. }
  4108. }
  4109. else if (itemStat.isDirectory) {
  4110. const oldDirItemChildPaths = readDirSync(oldPath);
  4111. const createDirResults = createDirSync(newPath, { recursive: true });
  4112. results.newDirs.push(...createDirResults.newDirs);
  4113. results.renamed.push({
  4114. oldPath,
  4115. newPath,
  4116. isDirectory: true,
  4117. isFile: false,
  4118. });
  4119. for (const oldDirItemChildPath of oldDirItemChildPaths) {
  4120. const newDirItemChildPath = oldDirItemChildPath.replace(oldPath, newPath);
  4121. renameNewRecursiveSync(oldDirItemChildPath, newDirItemChildPath, results);
  4122. }
  4123. }
  4124. }
  4125. };
  4126. const resolvePath = (p) => normalize(p);
  4127. const removeDirSync = (p, opts = {}) => {
  4128. const results = {
  4129. basename: basename(p),
  4130. dirname: dirname(p),
  4131. path: p,
  4132. removedDirs: [],
  4133. removedFiles: [],
  4134. error: null,
  4135. };
  4136. remoreDirSyncRecursive(p, opts, results);
  4137. return results;
  4138. };
  4139. const remoreDirSyncRecursive = (p, opts, results) => {
  4140. if (!results.error) {
  4141. p = normalize(p);
  4142. const dirItemPaths = readDirSync(p);
  4143. if (opts && opts.recursive) {
  4144. for (const dirItemPath of dirItemPaths) {
  4145. const item = items.get(dirItemPath);
  4146. if (item) {
  4147. if (item.isDirectory) {
  4148. remoreDirSyncRecursive(dirItemPath, opts, results);
  4149. }
  4150. else if (item.isFile) {
  4151. const removeFileResults = removeFileSync(dirItemPath);
  4152. if (removeFileResults.error) {
  4153. results.error = removeFileResults.error;
  4154. }
  4155. else {
  4156. results.removedFiles.push(dirItemPath);
  4157. }
  4158. }
  4159. }
  4160. }
  4161. }
  4162. else {
  4163. if (dirItemPaths.length > 0) {
  4164. results.error = `cannot delete directory that contains files/subdirectories`;
  4165. return;
  4166. }
  4167. }
  4168. items.delete(p);
  4169. emitDirectoryWatch(p, new Set());
  4170. results.removedDirs.push(p);
  4171. }
  4172. };
  4173. const removeDir = async (p, opts = {}) => removeDirSync(p, opts);
  4174. const statSync = (p) => {
  4175. p = normalize(p);
  4176. const item = items.get(p);
  4177. if (item && (item.isDirectory || (item.isFile && typeof item.data === 'string'))) {
  4178. return {
  4179. isDirectory: item.isDirectory,
  4180. isFile: item.isFile,
  4181. isSymbolicLink: false,
  4182. size: item.isFile && item.data ? item.data.length : 0,
  4183. error: null,
  4184. };
  4185. }
  4186. return {
  4187. isDirectory: false,
  4188. isFile: false,
  4189. isSymbolicLink: false,
  4190. size: 0,
  4191. error: `ENOENT: no such file or directory, statSync '${p}'`,
  4192. };
  4193. };
  4194. const stat = async (p) => statSync(p);
  4195. const removeFileSync = (p) => {
  4196. p = normalize(p);
  4197. const results = {
  4198. basename: basename(p),
  4199. dirname: dirname(p),
  4200. path: p,
  4201. error: null,
  4202. };
  4203. const item = items.get(p);
  4204. if (item) {
  4205. if (item.watcherCallbacks) {
  4206. for (const watcherCallback of item.watcherCallbacks) {
  4207. watcherCallback(p, 'fileDelete');
  4208. }
  4209. }
  4210. items.delete(p);
  4211. emitDirectoryWatch(p, new Set());
  4212. }
  4213. return results;
  4214. };
  4215. const removeFile = async (p) => removeFileSync(p);
  4216. const watchDirectory = (p, dirWatcherCallback) => {
  4217. p = normalize(p);
  4218. const item = items.get(p);
  4219. const close = () => {
  4220. const closeItem = items.get(p);
  4221. if (closeItem && closeItem.watcherCallbacks) {
  4222. const index = closeItem.watcherCallbacks.indexOf(dirWatcherCallback);
  4223. if (index > -1) {
  4224. closeItem.watcherCallbacks.splice(index, 1);
  4225. }
  4226. }
  4227. };
  4228. addDestory(close);
  4229. if (item) {
  4230. item.isDirectory = true;
  4231. item.isFile = false;
  4232. item.watcherCallbacks = item.watcherCallbacks || [];
  4233. item.watcherCallbacks.push(dirWatcherCallback);
  4234. }
  4235. else {
  4236. items.set(p, {
  4237. basename: basename(p),
  4238. dirname: dirname(p),
  4239. isDirectory: true,
  4240. isFile: false,
  4241. watcherCallbacks: [dirWatcherCallback],
  4242. data: undefined,
  4243. });
  4244. }
  4245. return {
  4246. close() {
  4247. removeDestory(close);
  4248. close();
  4249. },
  4250. };
  4251. };
  4252. const watchFile = (p, fileWatcherCallback) => {
  4253. p = normalize(p);
  4254. const item = items.get(p);
  4255. const close = () => {
  4256. const closeItem = items.get(p);
  4257. if (closeItem && closeItem.watcherCallbacks) {
  4258. const index = closeItem.watcherCallbacks.indexOf(fileWatcherCallback);
  4259. if (index > -1) {
  4260. closeItem.watcherCallbacks.splice(index, 1);
  4261. }
  4262. }
  4263. };
  4264. addDestory(close);
  4265. if (item) {
  4266. item.isDirectory = false;
  4267. item.isFile = true;
  4268. item.watcherCallbacks = item.watcherCallbacks || [];
  4269. item.watcherCallbacks.push(fileWatcherCallback);
  4270. }
  4271. else {
  4272. items.set(p, {
  4273. basename: basename(p),
  4274. dirname: dirname(p),
  4275. isDirectory: false,
  4276. isFile: true,
  4277. watcherCallbacks: [fileWatcherCallback],
  4278. data: undefined,
  4279. });
  4280. }
  4281. return {
  4282. close() {
  4283. removeDestory(close);
  4284. close();
  4285. },
  4286. };
  4287. };
  4288. const emitDirectoryWatch = (p, emitted) => {
  4289. const parentDir = normalize(dirname(p));
  4290. const dirItem = items.get(parentDir);
  4291. if (dirItem && dirItem.isDirectory && dirItem.watcherCallbacks) {
  4292. for (const watcherCallback of dirItem.watcherCallbacks) {
  4293. watcherCallback(p, null);
  4294. }
  4295. }
  4296. if (!emitted.has(parentDir)) {
  4297. emitted.add(parentDir);
  4298. emitDirectoryWatch(parentDir, emitted);
  4299. }
  4300. };
  4301. const writeFileSync = (p, data) => {
  4302. p = normalize(p);
  4303. const results = {
  4304. path: p,
  4305. error: null,
  4306. };
  4307. const item = items.get(p);
  4308. if (item) {
  4309. const hasChanged = item.data !== data;
  4310. item.data = data;
  4311. if (hasChanged && item.watcherCallbacks) {
  4312. for (const watcherCallback of item.watcherCallbacks) {
  4313. watcherCallback(p, 'fileUpdate');
  4314. }
  4315. }
  4316. }
  4317. else {
  4318. items.set(p, {
  4319. basename: basename(p),
  4320. dirname: dirname(p),
  4321. isDirectory: false,
  4322. isFile: true,
  4323. watcherCallbacks: null,
  4324. data,
  4325. });
  4326. emitDirectoryWatch(p, new Set());
  4327. }
  4328. return results;
  4329. };
  4330. /**
  4331. * `self` is the global namespace object used within a web worker.
  4332. * `window` is the browser's global namespace object (I reorganized this to check the reference on that second)
  4333. * `global` is Node's global namespace object. https://nodejs.org/api/globals.html#globals_global
  4334. *
  4335. * loading in this order should allow workers, which are most common, then browser,
  4336. * then Node to grab the reference to fetch correctly.
  4337. */
  4338. const fetch = typeof self !== 'undefined'
  4339. ? self === null || self === void 0 ? void 0 : self.fetch
  4340. : typeof window !== 'undefined'
  4341. ? window === null || window === void 0 ? void 0 : window.fetch
  4342. : typeof global !== 'undefined'
  4343. ? global === null || global === void 0 ? void 0 : global.fetch
  4344. : undefined;
  4345. const writeFile = async (p, data) => writeFileSync(p, data);
  4346. const tmpDirSync = () => '/.tmp';
  4347. const tick = Promise.resolve();
  4348. const nextTick = (cb) => tick.then(cb);
  4349. const generateContentHash = async (content, hashLength) => {
  4350. const arrayBuffer = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(content));
  4351. const hashArray = Array.from(new Uint8Array(arrayBuffer)); // convert buffer to byte array
  4352. let hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
  4353. if (typeof hashLength === 'number') {
  4354. hashHex = hashHex.slice(0, hashLength);
  4355. }
  4356. return hashHex;
  4357. };
  4358. const copy = async (copyTasks, srcDir) => {
  4359. const results = {
  4360. diagnostics: [],
  4361. dirPaths: [],
  4362. filePaths: [],
  4363. };
  4364. logger.info('todo, copy task', copyTasks.length, srcDir);
  4365. return results;
  4366. };
  4367. const getEnvironmentVar = (key) => {
  4368. return process$3 === null || process$3 === void 0 ? void 0 : process_1.env[key];
  4369. };
  4370. const getLocalModulePath = (opts) => join(opts.rootDir, 'node_modules', opts.moduleId, opts.path);
  4371. const getRemoteModuleUrl = (opts) => {
  4372. const npmBaseUrl = 'https://cdn.jsdelivr.net/npm/';
  4373. const path = `${opts.moduleId}${opts.version ? '@' + opts.version : ''}/${opts.path}`;
  4374. return new URL(path, npmBaseUrl).href;
  4375. };
  4376. const fileWatchTimeout = 32;
  4377. createDirSync('/');
  4378. const sys = {
  4379. name: 'in-memory',
  4380. version: version$3,
  4381. events,
  4382. access,
  4383. accessSync,
  4384. addDestory,
  4385. copyFile,
  4386. createDir,
  4387. createDirSync,
  4388. homeDir,
  4389. isTTY,
  4390. getEnvironmentVar,
  4391. destroy,
  4392. encodeToBase64,
  4393. exit: async (exitCode) => logger.warn(`exit ${exitCode}`),
  4394. getCurrentDirectory,
  4395. getCompilerExecutingPath,
  4396. getLocalModulePath,
  4397. getRemoteModuleUrl,
  4398. hardwareConcurrency,
  4399. isSymbolicLink,
  4400. nextTick,
  4401. normalizePath: normalize,
  4402. platformPath: pathBrowserify,
  4403. readDir,
  4404. readDirSync,
  4405. readFile,
  4406. readFileSync,
  4407. realpath,
  4408. realpathSync,
  4409. removeDestory,
  4410. rename,
  4411. fetch,
  4412. resolvePath,
  4413. removeDir,
  4414. removeDirSync,
  4415. stat,
  4416. statSync,
  4417. tmpDirSync,
  4418. removeFile,
  4419. removeFileSync,
  4420. watchDirectory,
  4421. watchFile,
  4422. watchTimeout: fileWatchTimeout,
  4423. writeFile,
  4424. writeFileSync,
  4425. generateContentHash,
  4426. createWorkerController: HAS_WEB_WORKER
  4427. ? (maxConcurrentWorkers) => createWebWorkerMainController(sys, maxConcurrentWorkers)
  4428. : null,
  4429. details: {
  4430. cpuModel: '',
  4431. freemem: () => 0,
  4432. platform: '',
  4433. release: '',
  4434. totalmem: 0,
  4435. },
  4436. copy,
  4437. };
  4438. sys.resolveModuleId = (opts) => resolveModuleIdAsync(sys, null, opts);
  4439. return sys;
  4440. };
  4441. const initWebWorkerThread = (msgHandler) => {
  4442. let isQueued = false;
  4443. const tick = Promise.resolve();
  4444. const msgsFromWorkerQueue = [];
  4445. const drainMsgQueueFromWorkerToMain = () => {
  4446. isQueued = false;
  4447. self.postMessage(msgsFromWorkerQueue);
  4448. msgsFromWorkerQueue.length = 0;
  4449. };
  4450. const queueMsgFromWorkerToMain = (msgFromWorkerToMain) => {
  4451. msgsFromWorkerQueue.push(msgFromWorkerToMain);
  4452. if (!isQueued) {
  4453. isQueued = true;
  4454. tick.then(drainMsgQueueFromWorkerToMain);
  4455. }
  4456. };
  4457. const error = (stencilMsgId, err) => {
  4458. const errMsgFromWorkerToMain = {
  4459. stencilId: stencilMsgId,
  4460. stencilRtnValue: null,
  4461. stencilRtnError: 'Error',
  4462. };
  4463. if (isString$1(err)) {
  4464. errMsgFromWorkerToMain.stencilRtnError += ': ' + err;
  4465. }
  4466. else if (err) {
  4467. if (err.stack) {
  4468. errMsgFromWorkerToMain.stencilRtnError += ': ' + err.stack;
  4469. }
  4470. else if (err.message) {
  4471. errMsgFromWorkerToMain.stencilRtnError += ': ' + err.message;
  4472. }
  4473. }
  4474. queueMsgFromWorkerToMain(errMsgFromWorkerToMain);
  4475. };
  4476. const receiveMsgFromMainToWorker = async (msgToWorker) => {
  4477. if (msgToWorker && isNumber$1(msgToWorker.stencilId)) {
  4478. try {
  4479. // run the handler to get the data
  4480. const msgFromWorkerToMain = {
  4481. stencilId: msgToWorker.stencilId,
  4482. stencilRtnValue: await msgHandler(msgToWorker),
  4483. stencilRtnError: null,
  4484. };
  4485. queueMsgFromWorkerToMain(msgFromWorkerToMain);
  4486. }
  4487. catch (e) {
  4488. // error occurred while running the task
  4489. error(msgToWorker.stencilId, e);
  4490. }
  4491. }
  4492. };
  4493. self.onmessage = (ev) => {
  4494. // message from the main thread
  4495. const msgsFromMainToWorker = ev.data;
  4496. if (Array.isArray(msgsFromMainToWorker)) {
  4497. for (const msgFromMainToWorker of msgsFromMainToWorker) {
  4498. receiveMsgFromMainToWorker(msgFromMainToWorker);
  4499. }
  4500. }
  4501. };
  4502. self.onerror = (e) => {
  4503. // uncaught error occurred on the worker thread
  4504. error(-1, e);
  4505. };
  4506. };
  4507. let cssProcessor;
  4508. /**
  4509. * Autoprefix a CSS string, adding vendor prefixes to make sure that what
  4510. * is written in the CSS will render correctly in our range of supported browsers.
  4511. * This function uses PostCSS in compbination with the Autoprefix plugin to
  4512. * automatically add vendor prefixes based on a list of browsers which we want
  4513. * to support.
  4514. *
  4515. * @param cssText the text to be prefixed
  4516. * @param opts an optional param with options for Autoprefixer
  4517. * @returns a Promise wrapping some prefixed CSS as well as diagnostics
  4518. */
  4519. const autoprefixCss = async (cssText, opts) => {
  4520. const output = {
  4521. output: cssText,
  4522. diagnostics: [],
  4523. };
  4524. if (!IS_NODE_ENV) {
  4525. return output;
  4526. }
  4527. try {
  4528. const autoprefixerOpts = opts != null && typeof opts === 'object' ? opts : DEFAULT_AUTOPREFIX_OPTIONS;
  4529. const processor = getProcessor(autoprefixerOpts);
  4530. const result = await processor.process(cssText, { map: null });
  4531. result.warnings().forEach((warning) => {
  4532. output.diagnostics.push({
  4533. header: `Autoprefix CSS: ${warning.plugin}`,
  4534. messageText: warning.text,
  4535. level: 'warn',
  4536. type: 'css',
  4537. });
  4538. });
  4539. output.output = result.css;
  4540. }
  4541. catch (e) {
  4542. const diagnostic = {
  4543. header: `Autoprefix CSS`,
  4544. messageText: `CSS Error` + e,
  4545. level: `error`,
  4546. type: `css`,
  4547. };
  4548. if (typeof e.name === 'string') {
  4549. diagnostic.header = e.name;
  4550. }
  4551. if (typeof e.reason === 'string') {
  4552. diagnostic.messageText = e.reason;
  4553. }
  4554. if (typeof e.source === 'string' && typeof e.line === 'number') {
  4555. const lines = e.source.replace(/\r/g, '\n').split('\n');
  4556. if (lines.length > 0) {
  4557. const addLine = (lineNumber) => {
  4558. const line = lines[lineNumber];
  4559. if (typeof line === 'string') {
  4560. const printLine = {
  4561. lineIndex: -1,
  4562. lineNumber: -1,
  4563. text: line,
  4564. errorCharStart: -1,
  4565. errorLength: -1,
  4566. };
  4567. diagnostic.lines = diagnostic.lines || [];
  4568. diagnostic.lines.push(printLine);
  4569. }
  4570. };
  4571. addLine(e.line - 3);
  4572. addLine(e.line - 2);
  4573. addLine(e.line - 1);
  4574. addLine(e.line);
  4575. addLine(e.line + 1);
  4576. addLine(e.line + 2);
  4577. addLine(e.line + 3);
  4578. }
  4579. }
  4580. output.diagnostics.push(diagnostic);
  4581. }
  4582. return output;
  4583. };
  4584. /**
  4585. * Get the processor for PostCSS and the Autoprefixer plugin
  4586. *
  4587. * @param autoprefixerOpts Options for Autoprefixer
  4588. * @returns postCSS with the Autoprefixer plugin applied
  4589. */
  4590. const getProcessor = (autoprefixerOpts) => {
  4591. const { postcss, autoprefixer } = requireFunc('../sys/node/autoprefixer.js');
  4592. if (!cssProcessor) {
  4593. cssProcessor = postcss([autoprefixer(autoprefixerOpts)]);
  4594. }
  4595. return cssProcessor;
  4596. };
  4597. /**
  4598. * Default options for the Autoprefixer PostCSS plugin. See the documentation:
  4599. * https://github.com/postcss/autoprefixer#options for a complete list.
  4600. *
  4601. * This default option set will:
  4602. *
  4603. * - override the default browser list (`overrideBrowserslist`)
  4604. * - turn off the visual cascade (`cascade`)
  4605. * - disable auto-removing outdated prefixes (`remove`)
  4606. * - set `flexbox` to `"no-2009"`, which limits prefixing for flexbox to the
  4607. * final and IE 10 versions of the specification
  4608. */
  4609. const DEFAULT_AUTOPREFIX_OPTIONS = {
  4610. overrideBrowserslist: ['last 2 versions', 'iOS >= 9', 'Android >= 4.4', 'Explorer >= 11', 'ExplorerMobile >= 11'],
  4611. cascade: false,
  4612. remove: false,
  4613. flexbox: 'no-2009',
  4614. };
  4615. const parseCss = (css, filePath) => {
  4616. let lineno = 1;
  4617. let column = 1;
  4618. const diagnostics = [];
  4619. const updatePosition = (str) => {
  4620. const lines = str.match(/\n/g);
  4621. if (lines)
  4622. lineno += lines.length;
  4623. const i = str.lastIndexOf('\n');
  4624. column = ~i ? str.length - i : column + str.length;
  4625. };
  4626. const position = () => {
  4627. const start = { line: lineno, column: column };
  4628. return (node) => {
  4629. node.position = new ParsePosition(start);
  4630. whitespace();
  4631. return node;
  4632. };
  4633. };
  4634. const error = (msg) => {
  4635. const srcLines = css.split('\n');
  4636. const d = {
  4637. level: 'error',
  4638. type: 'css',
  4639. language: 'css',
  4640. header: 'CSS Parse',
  4641. messageText: msg,
  4642. absFilePath: filePath,
  4643. lines: [
  4644. {
  4645. lineIndex: lineno - 1,
  4646. lineNumber: lineno,
  4647. errorCharStart: column,
  4648. text: css[lineno - 1],
  4649. },
  4650. ],
  4651. };
  4652. if (lineno > 1) {
  4653. const previousLine = {
  4654. lineIndex: lineno - 1,
  4655. lineNumber: lineno - 1,
  4656. text: css[lineno - 2],
  4657. errorCharStart: -1,
  4658. errorLength: -1,
  4659. };
  4660. d.lines.unshift(previousLine);
  4661. }
  4662. if (lineno + 2 < srcLines.length) {
  4663. const nextLine = {
  4664. lineIndex: lineno,
  4665. lineNumber: lineno + 1,
  4666. text: srcLines[lineno],
  4667. errorCharStart: -1,
  4668. errorLength: -1,
  4669. };
  4670. d.lines.push(nextLine);
  4671. }
  4672. diagnostics.push(d);
  4673. return null;
  4674. };
  4675. const stylesheet = () => {
  4676. const rulesList = rules();
  4677. return {
  4678. type: 14 /* CssNodeType.StyleSheet */,
  4679. stylesheet: {
  4680. source: filePath,
  4681. rules: rulesList,
  4682. },
  4683. };
  4684. };
  4685. const open = () => match(/^{\s*/);
  4686. const close = () => match(/^}/);
  4687. const match = (re) => {
  4688. const m = re.exec(css);
  4689. if (!m)
  4690. return;
  4691. const str = m[0];
  4692. updatePosition(str);
  4693. css = css.slice(str.length);
  4694. return m;
  4695. };
  4696. const rules = () => {
  4697. let node;
  4698. const rules = [];
  4699. whitespace();
  4700. comments(rules);
  4701. while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {
  4702. if (node !== false) {
  4703. rules.push(node);
  4704. comments(rules);
  4705. }
  4706. }
  4707. return rules;
  4708. };
  4709. /**
  4710. * Parse whitespace.
  4711. */
  4712. const whitespace = () => match(/^\s*/);
  4713. const comments = (rules) => {
  4714. let c;
  4715. rules = rules || [];
  4716. while ((c = comment())) {
  4717. if (c !== false) {
  4718. rules.push(c);
  4719. }
  4720. }
  4721. return rules;
  4722. };
  4723. const comment = () => {
  4724. const pos = position();
  4725. if ('/' !== css.charAt(0) || '*' !== css.charAt(1))
  4726. return null;
  4727. let i = 2;
  4728. while ('' !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1)))
  4729. ++i;
  4730. i += 2;
  4731. if ('' === css.charAt(i - 1)) {
  4732. return error('End of comment missing');
  4733. }
  4734. const comment = css.slice(2, i - 2);
  4735. column += 2;
  4736. updatePosition(comment);
  4737. css = css.slice(i);
  4738. column += 2;
  4739. return pos({
  4740. type: 1 /* CssNodeType.Comment */,
  4741. comment,
  4742. });
  4743. };
  4744. const selector = () => {
  4745. const m = match(/^([^{]+)/);
  4746. if (!m)
  4747. return null;
  4748. return trim(m[0])
  4749. .replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '')
  4750. .replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) {
  4751. return m.replace(/,/g, '\u200C');
  4752. })
  4753. .split(/\s*(?![^(]*\)),\s*/)
  4754. .map(function (s) {
  4755. return s.replace(/\u200C/g, ',');
  4756. });
  4757. };
  4758. const declaration = () => {
  4759. const pos = position();
  4760. // prop
  4761. let prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
  4762. if (!prop)
  4763. return null;
  4764. prop = trim(prop[0]);
  4765. // :
  4766. if (!match(/^:\s*/))
  4767. return error(`property missing ':'`);
  4768. // val
  4769. const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
  4770. const ret = pos({
  4771. type: 4 /* CssNodeType.Declaration */,
  4772. property: prop.replace(commentre, ''),
  4773. value: val ? trim(val[0]).replace(commentre, '') : '',
  4774. });
  4775. match(/^[;\s]*/);
  4776. return ret;
  4777. };
  4778. const declarations = () => {
  4779. const decls = [];
  4780. if (!open())
  4781. return error(`missing '{'`);
  4782. comments(decls);
  4783. // declarations
  4784. let decl;
  4785. while ((decl = declaration())) {
  4786. if (decl !== false) {
  4787. decls.push(decl);
  4788. comments(decls);
  4789. }
  4790. }
  4791. if (!close())
  4792. return error(`missing '}'`);
  4793. return decls;
  4794. };
  4795. const keyframe = () => {
  4796. let m;
  4797. const values = [];
  4798. const pos = position();
  4799. while ((m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/))) {
  4800. values.push(m[1]);
  4801. match(/^,\s*/);
  4802. }
  4803. if (!values.length)
  4804. return null;
  4805. return pos({
  4806. type: 9 /* CssNodeType.KeyFrame */,
  4807. values,
  4808. declarations: declarations(),
  4809. });
  4810. };
  4811. const atkeyframes = () => {
  4812. const pos = position();
  4813. let m = match(/^@([-\w]+)?keyframes\s*/);
  4814. if (!m)
  4815. return null;
  4816. const vendor = m[1];
  4817. // identifier
  4818. m = match(/^([-\w]+)\s*/);
  4819. if (!m)
  4820. return error(`@keyframes missing name`);
  4821. const name = m[1];
  4822. if (!open())
  4823. return error(`@keyframes missing '{'`);
  4824. let frame;
  4825. let frames = comments();
  4826. while ((frame = keyframe())) {
  4827. frames.push(frame);
  4828. frames = frames.concat(comments());
  4829. }
  4830. if (!close())
  4831. return error(`@keyframes missing '}'`);
  4832. return pos({
  4833. type: 8 /* CssNodeType.KeyFrames */,
  4834. name: name,
  4835. vendor: vendor,
  4836. keyframes: frames,
  4837. });
  4838. };
  4839. const atsupports = () => {
  4840. const pos = position();
  4841. const m = match(/^@supports *([^{]+)/);
  4842. if (!m)
  4843. return null;
  4844. const supports = trim(m[1]);
  4845. if (!open())
  4846. return error(`@supports missing '{'`);
  4847. const style = comments().concat(rules());
  4848. if (!close())
  4849. return error(`@supports missing '}'`);
  4850. return pos({
  4851. type: 15 /* CssNodeType.Supports */,
  4852. supports: supports,
  4853. rules: style,
  4854. });
  4855. };
  4856. const athost = () => {
  4857. const pos = position();
  4858. const m = match(/^@host\s*/);
  4859. if (!m)
  4860. return null;
  4861. if (!open())
  4862. return error(`@host missing '{'`);
  4863. const style = comments().concat(rules());
  4864. if (!close())
  4865. return error(`@host missing '}'`);
  4866. return pos({
  4867. type: 6 /* CssNodeType.Host */,
  4868. rules: style,
  4869. });
  4870. };
  4871. const atmedia = () => {
  4872. const pos = position();
  4873. const m = match(/^@media *([^{]+)/);
  4874. if (!m)
  4875. return null;
  4876. const media = trim(m[1]);
  4877. if (!open())
  4878. return error(`@media missing '{'`);
  4879. const style = comments().concat(rules());
  4880. if (!close())
  4881. return error(`@media missing '}'`);
  4882. return pos({
  4883. type: 10 /* CssNodeType.Media */,
  4884. media: media,
  4885. rules: style,
  4886. });
  4887. };
  4888. const atcustommedia = () => {
  4889. const pos = position();
  4890. const m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
  4891. if (!m)
  4892. return null;
  4893. return pos({
  4894. type: 2 /* CssNodeType.CustomMedia */,
  4895. name: trim(m[1]),
  4896. media: trim(m[2]),
  4897. });
  4898. };
  4899. const atpage = () => {
  4900. const pos = position();
  4901. const m = match(/^@page */);
  4902. if (!m)
  4903. return null;
  4904. const sel = selector() || [];
  4905. if (!open())
  4906. return error(`@page missing '{'`);
  4907. let decls = comments();
  4908. let decl;
  4909. while ((decl = declaration())) {
  4910. decls.push(decl);
  4911. decls = decls.concat(comments());
  4912. }
  4913. if (!close())
  4914. return error(`@page missing '}'`);
  4915. return pos({
  4916. type: 12 /* CssNodeType.Page */,
  4917. selectors: sel,
  4918. declarations: decls,
  4919. });
  4920. };
  4921. const atdocument = () => {
  4922. const pos = position();
  4923. const m = match(/^@([-\w]+)?document *([^{]+)/);
  4924. if (!m)
  4925. return null;
  4926. const vendor = trim(m[1]);
  4927. const doc = trim(m[2]);
  4928. if (!open())
  4929. return error(`@document missing '{'`);
  4930. const style = comments().concat(rules());
  4931. if (!close())
  4932. return error(`@document missing '}'`);
  4933. return pos({
  4934. type: 3 /* CssNodeType.Document */,
  4935. document: doc,
  4936. vendor: vendor,
  4937. rules: style,
  4938. });
  4939. };
  4940. const atfontface = () => {
  4941. const pos = position();
  4942. const m = match(/^@font-face\s*/);
  4943. if (!m)
  4944. return null;
  4945. if (!open())
  4946. return error(`@font-face missing '{'`);
  4947. let decls = comments();
  4948. let decl;
  4949. while ((decl = declaration())) {
  4950. decls.push(decl);
  4951. decls = decls.concat(comments());
  4952. }
  4953. if (!close())
  4954. return error(`@font-face missing '}'`);
  4955. return pos({
  4956. type: 5 /* CssNodeType.FontFace */,
  4957. declarations: decls,
  4958. });
  4959. };
  4960. const compileAtrule = (nodeName, nodeType) => {
  4961. const re = new RegExp('^@' + nodeName + '\\s*([^;]+);');
  4962. return () => {
  4963. const pos = position();
  4964. const m = match(re);
  4965. if (!m)
  4966. return null;
  4967. const node = {
  4968. type: nodeType,
  4969. };
  4970. node[nodeName] = m[1].trim();
  4971. return pos(node);
  4972. };
  4973. };
  4974. const atimport = compileAtrule('import', 7 /* CssNodeType.Import */);
  4975. const atcharset = compileAtrule('charset', 0 /* CssNodeType.Charset */);
  4976. const atnamespace = compileAtrule('namespace', 11 /* CssNodeType.Namespace */);
  4977. const atrule = () => {
  4978. if (css[0] !== '@')
  4979. return null;
  4980. return (atkeyframes() ||
  4981. atmedia() ||
  4982. atcustommedia() ||
  4983. atsupports() ||
  4984. atimport() ||
  4985. atcharset() ||
  4986. atnamespace() ||
  4987. atdocument() ||
  4988. atpage() ||
  4989. athost() ||
  4990. atfontface());
  4991. };
  4992. const rule = () => {
  4993. const pos = position();
  4994. const sel = selector();
  4995. if (!sel)
  4996. return error('selector missing');
  4997. comments();
  4998. return pos({
  4999. type: 13 /* CssNodeType.Rule */,
  5000. selectors: sel,
  5001. declarations: declarations(),
  5002. });
  5003. };
  5004. class ParsePosition {
  5005. constructor(start) {
  5006. this.start = start;
  5007. this.end = { line: lineno, column: column };
  5008. this.source = filePath;
  5009. }
  5010. }
  5011. ParsePosition.prototype.content = css;
  5012. return {
  5013. diagnostics,
  5014. ...addParent(stylesheet()),
  5015. };
  5016. };
  5017. const trim = (str) => (str ? str.trim() : '');
  5018. /**
  5019. * Adds non-enumerable parent node reference to each node.
  5020. */
  5021. const addParent = (obj, parent) => {
  5022. const isNode = obj && typeof obj.type === 'string';
  5023. const childParent = isNode ? obj : parent;
  5024. for (const k in obj) {
  5025. const value = obj[k];
  5026. if (Array.isArray(value)) {
  5027. value.forEach(function (v) {
  5028. addParent(v, childParent);
  5029. });
  5030. }
  5031. else if (value && typeof value === 'object') {
  5032. addParent(value, childParent);
  5033. }
  5034. }
  5035. if (isNode) {
  5036. Object.defineProperty(obj, 'parent', {
  5037. configurable: true,
  5038. writable: true,
  5039. enumerable: false,
  5040. value: parent || null,
  5041. });
  5042. }
  5043. return obj;
  5044. };
  5045. // http://www.w3.org/TR/CSS21/grammar.html
  5046. // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
  5047. const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
  5048. const getCssSelectors = (sel) => {
  5049. // reusing global SELECTORS since this is a synchronous operation
  5050. SELECTORS.all.length =
  5051. SELECTORS.tags.length =
  5052. SELECTORS.classNames.length =
  5053. SELECTORS.ids.length =
  5054. SELECTORS.attrs.length =
  5055. 0;
  5056. sel = sel
  5057. .replace(/\./g, ' .')
  5058. .replace(/\#/g, ' #')
  5059. .replace(/\[/g, ' [')
  5060. .replace(/\>/g, ' > ')
  5061. .replace(/\+/g, ' + ')
  5062. .replace(/\~/g, ' ~ ')
  5063. .replace(/\*/g, ' * ')
  5064. .replace(/\:not\((.*?)\)/g, ' ');
  5065. const items = sel.split(' ');
  5066. for (let i = 0, l = items.length; i < l; i++) {
  5067. items[i] = items[i].split(':')[0];
  5068. if (items[i].length === 0)
  5069. continue;
  5070. if (items[i].charAt(0) === '.') {
  5071. SELECTORS.classNames.push(items[i].slice(1));
  5072. }
  5073. else if (items[i].charAt(0) === '#') {
  5074. SELECTORS.ids.push(items[i].slice(1));
  5075. }
  5076. else if (items[i].charAt(0) === '[') {
  5077. items[i] = items[i].slice(1).split('=')[0].split(']')[0].trim();
  5078. SELECTORS.attrs.push(items[i].toLowerCase());
  5079. }
  5080. else if (/[a-z]/g.test(items[i].charAt(0))) {
  5081. SELECTORS.tags.push(items[i].toLowerCase());
  5082. }
  5083. }
  5084. SELECTORS.classNames = SELECTORS.classNames.sort((a, b) => {
  5085. if (a.length < b.length)
  5086. return -1;
  5087. if (a.length > b.length)
  5088. return 1;
  5089. return 0;
  5090. });
  5091. return SELECTORS;
  5092. };
  5093. const SELECTORS = {
  5094. all: [],
  5095. tags: [],
  5096. classNames: [],
  5097. ids: [],
  5098. attrs: [],
  5099. };
  5100. const serializeCss = (stylesheet, serializeOpts) => {
  5101. const usedSelectors = serializeOpts.usedSelectors || null;
  5102. const opts = {
  5103. usedSelectors: usedSelectors || null,
  5104. hasUsedAttrs: !!usedSelectors && usedSelectors.attrs.size > 0,
  5105. hasUsedClassNames: !!usedSelectors && usedSelectors.classNames.size > 0,
  5106. hasUsedIds: !!usedSelectors && usedSelectors.ids.size > 0,
  5107. hasUsedTags: !!usedSelectors && usedSelectors.tags.size > 0,
  5108. };
  5109. const rules = stylesheet.rules;
  5110. if (!rules) {
  5111. return '';
  5112. }
  5113. const rulesLen = rules.length;
  5114. const out = [];
  5115. for (let i = 0; i < rulesLen; i++) {
  5116. out.push(serializeCssVisitNode(opts, rules[i], i, rulesLen));
  5117. }
  5118. return out.join('');
  5119. };
  5120. const serializeCssVisitNode = (opts, node, index, len) => {
  5121. const nodeType = node.type;
  5122. if (nodeType === 4 /* CssNodeType.Declaration */) {
  5123. return serializeCssDeclaration(node, index, len);
  5124. }
  5125. if (nodeType === 13 /* CssNodeType.Rule */) {
  5126. return serializeCssRule(opts, node);
  5127. }
  5128. if (nodeType === 1 /* CssNodeType.Comment */) {
  5129. if (node.comment[0] === '!') {
  5130. return `/*${node.comment}*/`;
  5131. }
  5132. else {
  5133. return '';
  5134. }
  5135. }
  5136. if (nodeType === 10 /* CssNodeType.Media */) {
  5137. return serializeCssMedia(opts, node);
  5138. }
  5139. if (nodeType === 8 /* CssNodeType.KeyFrames */) {
  5140. return serializeCssKeyframes(opts, node);
  5141. }
  5142. if (nodeType === 9 /* CssNodeType.KeyFrame */) {
  5143. return serializeCssKeyframe(opts, node);
  5144. }
  5145. if (nodeType === 5 /* CssNodeType.FontFace */) {
  5146. return serializeCssFontFace(opts, node);
  5147. }
  5148. if (nodeType === 15 /* CssNodeType.Supports */) {
  5149. return serializeCssSupports(opts, node);
  5150. }
  5151. if (nodeType === 7 /* CssNodeType.Import */) {
  5152. return '@import ' + node.import + ';';
  5153. }
  5154. if (nodeType === 0 /* CssNodeType.Charset */) {
  5155. return '@charset ' + node.charset + ';';
  5156. }
  5157. if (nodeType === 12 /* CssNodeType.Page */) {
  5158. return serializeCssPage(opts, node);
  5159. }
  5160. if (nodeType === 6 /* CssNodeType.Host */) {
  5161. return '@host{' + serializeCssMapVisit(opts, node.rules) + '}';
  5162. }
  5163. if (nodeType === 2 /* CssNodeType.CustomMedia */) {
  5164. return '@custom-media ' + node.name + ' ' + node.media + ';';
  5165. }
  5166. if (nodeType === 3 /* CssNodeType.Document */) {
  5167. return serializeCssDocument(opts, node);
  5168. }
  5169. if (nodeType === 11 /* CssNodeType.Namespace */) {
  5170. return '@namespace ' + node.namespace + ';';
  5171. }
  5172. return '';
  5173. };
  5174. const serializeCssRule = (opts, node) => {
  5175. const decls = node.declarations;
  5176. const usedSelectors = opts.usedSelectors;
  5177. const selectors = node.selectors.slice();
  5178. if (decls == null || decls.length === 0) {
  5179. return '';
  5180. }
  5181. if (usedSelectors) {
  5182. let i;
  5183. let j;
  5184. let include = true;
  5185. for (i = selectors.length - 1; i >= 0; i--) {
  5186. const sel = getCssSelectors(selectors[i]);
  5187. include = true;
  5188. // classes
  5189. let jlen = sel.classNames.length;
  5190. if (jlen > 0 && opts.hasUsedClassNames) {
  5191. for (j = 0; j < jlen; j++) {
  5192. if (!usedSelectors.classNames.has(sel.classNames[j])) {
  5193. include = false;
  5194. break;
  5195. }
  5196. }
  5197. }
  5198. // tags
  5199. if (include && opts.hasUsedTags) {
  5200. jlen = sel.tags.length;
  5201. if (jlen > 0) {
  5202. for (j = 0; j < jlen; j++) {
  5203. if (!usedSelectors.tags.has(sel.tags[j])) {
  5204. include = false;
  5205. break;
  5206. }
  5207. }
  5208. }
  5209. }
  5210. // attrs
  5211. if (include && opts.hasUsedAttrs) {
  5212. jlen = sel.attrs.length;
  5213. if (jlen > 0) {
  5214. for (j = 0; j < jlen; j++) {
  5215. if (!usedSelectors.attrs.has(sel.attrs[j])) {
  5216. include = false;
  5217. break;
  5218. }
  5219. }
  5220. }
  5221. }
  5222. // ids
  5223. if (include && opts.hasUsedIds) {
  5224. jlen = sel.ids.length;
  5225. if (jlen > 0) {
  5226. for (j = 0; j < jlen; j++) {
  5227. if (!usedSelectors.ids.has(sel.ids[j])) {
  5228. include = false;
  5229. break;
  5230. }
  5231. }
  5232. }
  5233. }
  5234. if (!include) {
  5235. selectors.splice(i, 1);
  5236. }
  5237. }
  5238. }
  5239. if (selectors.length === 0) {
  5240. return '';
  5241. }
  5242. const cleanedSelectors = [];
  5243. let cleanedSelector = '';
  5244. for (const selector of node.selectors) {
  5245. cleanedSelector = removeSelectorWhitespace(selector);
  5246. if (!cleanedSelectors.includes(cleanedSelector)) {
  5247. cleanedSelectors.push(cleanedSelector);
  5248. }
  5249. }
  5250. return `${cleanedSelectors}{${serializeCssMapVisit(opts, decls)}}`;
  5251. };
  5252. const serializeCssDeclaration = (node, index, len) => {
  5253. if (node.value === '') {
  5254. return '';
  5255. }
  5256. if (len - 1 === index) {
  5257. return node.property + ':' + node.value;
  5258. }
  5259. return node.property + ':' + node.value + ';';
  5260. };
  5261. const serializeCssMedia = (opts, node) => {
  5262. const mediaCss = serializeCssMapVisit(opts, node.rules);
  5263. if (mediaCss === '') {
  5264. return '';
  5265. }
  5266. return '@media ' + removeMediaWhitespace(node.media) + '{' + mediaCss + '}';
  5267. };
  5268. const serializeCssKeyframes = (opts, node) => {
  5269. const keyframesCss = serializeCssMapVisit(opts, node.keyframes);
  5270. if (keyframesCss === '') {
  5271. return '';
  5272. }
  5273. return '@' + (node.vendor || '') + 'keyframes ' + node.name + '{' + keyframesCss + '}';
  5274. };
  5275. const serializeCssKeyframe = (opts, node) => {
  5276. return node.values.join(',') + '{' + serializeCssMapVisit(opts, node.declarations) + '}';
  5277. };
  5278. const serializeCssFontFace = (opts, node) => {
  5279. const fontCss = serializeCssMapVisit(opts, node.declarations);
  5280. if (fontCss === '') {
  5281. return '';
  5282. }
  5283. return '@font-face{' + fontCss + '}';
  5284. };
  5285. const serializeCssSupports = (opts, node) => {
  5286. const supportsCss = serializeCssMapVisit(opts, node.rules);
  5287. if (supportsCss === '') {
  5288. return '';
  5289. }
  5290. return '@supports ' + node.supports + '{' + supportsCss + '}';
  5291. };
  5292. const serializeCssPage = (opts, node) => {
  5293. const sel = node.selectors.join(', ');
  5294. return '@page ' + sel + '{' + serializeCssMapVisit(opts, node.declarations) + '}';
  5295. };
  5296. const serializeCssDocument = (opts, node) => {
  5297. const documentCss = serializeCssMapVisit(opts, node.rules);
  5298. const doc = '@' + (node.vendor || '') + 'document ' + node.document;
  5299. if (documentCss === '') {
  5300. return '';
  5301. }
  5302. return doc + '{' + documentCss + '}';
  5303. };
  5304. const serializeCssMapVisit = (opts, nodes) => {
  5305. let rtn = '';
  5306. if (nodes) {
  5307. for (let i = 0, len = nodes.length; i < len; i++) {
  5308. rtn += serializeCssVisitNode(opts, nodes[i], i, len);
  5309. }
  5310. }
  5311. return rtn;
  5312. };
  5313. const removeSelectorWhitespace = (selector) => {
  5314. let rtn = '';
  5315. let char = '';
  5316. let inAttr = false;
  5317. selector = selector.trim();
  5318. for (let i = 0, l = selector.length; i < l; i++) {
  5319. char = selector[i];
  5320. if (char === '[' && rtn[rtn.length - 1] !== '\\') {
  5321. inAttr = true;
  5322. }
  5323. else if (char === ']' && rtn[rtn.length - 1] !== '\\') {
  5324. inAttr = false;
  5325. }
  5326. if (!inAttr && CSS_WS_REG.test(char)) {
  5327. if (CSS_NEXT_CHAR_REG.test(selector[i + 1])) {
  5328. continue;
  5329. }
  5330. if (CSS_PREV_CHAR_REG.test(rtn[rtn.length - 1])) {
  5331. continue;
  5332. }
  5333. rtn += ' ';
  5334. }
  5335. else {
  5336. rtn += char;
  5337. }
  5338. }
  5339. return rtn;
  5340. };
  5341. const removeMediaWhitespace = (media) => {
  5342. let rtn = '';
  5343. let char = '';
  5344. media = media.trim();
  5345. for (let i = 0, l = media.length; i < l; i++) {
  5346. char = media[i];
  5347. if (CSS_WS_REG.test(char)) {
  5348. if (CSS_WS_REG.test(rtn[rtn.length - 1])) {
  5349. continue;
  5350. }
  5351. rtn += ' ';
  5352. }
  5353. else {
  5354. rtn += char;
  5355. }
  5356. }
  5357. return rtn;
  5358. };
  5359. const CSS_WS_REG = /\s/;
  5360. const CSS_NEXT_CHAR_REG = /[>\(\)\~\,\+\s]/;
  5361. const CSS_PREV_CHAR_REG = /[>\(\~\,\+]/;
  5362. const minifyCss = async (input) => {
  5363. const parseResults = parseCss(input.css);
  5364. if (hasError(parseResults.diagnostics)) {
  5365. return input.css;
  5366. }
  5367. if (isFunction(input.resolveUrl) && parseResults.stylesheet && Array.isArray(parseResults.stylesheet.rules)) {
  5368. await resolveStylesheetUrl(parseResults.stylesheet.rules, input.resolveUrl);
  5369. }
  5370. return serializeCss(parseResults.stylesheet, {});
  5371. };
  5372. const resolveStylesheetUrl = async (nodes, resolveUrl, resolved) => {
  5373. for (const node of nodes) {
  5374. if (node.type === 4 /* CssNodeType.Declaration */ && isString$1(node.value) && node.value.includes('url(')) {
  5375. const urlSplt = node.value.split(',').map((n) => n.trim());
  5376. for (let i = 0; i < urlSplt.length; i++) {
  5377. const r = /url\((.*?)\)/.exec(urlSplt[i]);
  5378. if (r) {
  5379. try {
  5380. const orgUrl = r[1].replace(/(\'|\")/g, '');
  5381. const newUrl = await resolveUrl(orgUrl);
  5382. urlSplt[i] = urlSplt[i].replace(orgUrl, newUrl);
  5383. }
  5384. catch (e) { }
  5385. }
  5386. }
  5387. node.value = urlSplt.join(',');
  5388. }
  5389. if (Array.isArray(node.declarations)) {
  5390. await resolveStylesheetUrl(node.declarations, resolveUrl);
  5391. }
  5392. if (Array.isArray(node.rules)) {
  5393. await resolveStylesheetUrl(node.rules, resolveUrl);
  5394. }
  5395. if (Array.isArray(node.keyframes)) {
  5396. await resolveStylesheetUrl(node.keyframes, resolveUrl);
  5397. }
  5398. }
  5399. };
  5400. /**
  5401. * Optimize a CSS file, optionally running an autoprefixer and a minifier
  5402. * depending on the options set on the input options argument.
  5403. *
  5404. * @param inputOpts input CSS options
  5405. * @returns a promise wrapping the optimized output
  5406. */
  5407. const optimizeCss$1 = async (inputOpts) => {
  5408. let result = {
  5409. output: inputOpts.input,
  5410. diagnostics: [],
  5411. };
  5412. if (inputOpts.autoprefixer !== false && inputOpts.autoprefixer !== null) {
  5413. result = await autoprefixCss(inputOpts.input, inputOpts.autoprefixer);
  5414. if (hasError(result.diagnostics)) {
  5415. return result;
  5416. }
  5417. }
  5418. if (inputOpts.minify !== false) {
  5419. result.output = await minifyCss({
  5420. css: result.output,
  5421. resolveUrl: inputOpts.resolveUrl,
  5422. });
  5423. }
  5424. return result;
  5425. };
  5426. /* -*- Mode: js; js-indent-level: 2; -*- */
  5427. /*
  5428. * Copyright 2011 Mozilla Foundation and contributors
  5429. * Licensed under the New BSD license. See LICENSE or:
  5430. * http://opensource.org/licenses/BSD-3-Clause
  5431. */
  5432. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  5433. /**
  5434. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  5435. */
  5436. var encode$4 = function (number) {
  5437. if (0 <= number && number < intToCharMap.length) {
  5438. return intToCharMap[number];
  5439. }
  5440. throw new TypeError("Must be between 0 and 63: " + number);
  5441. };
  5442. /**
  5443. * Decode a single base 64 character code digit to an integer. Returns -1 on
  5444. * failure.
  5445. */
  5446. var decode$2 = function (charCode) {
  5447. var bigA = 65; // 'A'
  5448. var bigZ = 90; // 'Z'
  5449. var littleA = 97; // 'a'
  5450. var littleZ = 122; // 'z'
  5451. var zero = 48; // '0'
  5452. var nine = 57; // '9'
  5453. var plus = 43; // '+'
  5454. var slash = 47; // '/'
  5455. var littleOffset = 26;
  5456. var numberOffset = 52;
  5457. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  5458. if (bigA <= charCode && charCode <= bigZ) {
  5459. return (charCode - bigA);
  5460. }
  5461. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  5462. if (littleA <= charCode && charCode <= littleZ) {
  5463. return (charCode - littleA + littleOffset);
  5464. }
  5465. // 52 - 61: 0123456789
  5466. if (zero <= charCode && charCode <= nine) {
  5467. return (charCode - zero + numberOffset);
  5468. }
  5469. // 62: +
  5470. if (charCode == plus) {
  5471. return 62;
  5472. }
  5473. // 63: /
  5474. if (charCode == slash) {
  5475. return 63;
  5476. }
  5477. // Invalid base64 digit.
  5478. return -1;
  5479. };
  5480. var base64 = {
  5481. encode: encode$4,
  5482. decode: decode$2
  5483. };
  5484. /* -*- Mode: js; js-indent-level: 2; -*- */
  5485. /*
  5486. * Copyright 2011 Mozilla Foundation and contributors
  5487. * Licensed under the New BSD license. See LICENSE or:
  5488. * http://opensource.org/licenses/BSD-3-Clause
  5489. *
  5490. * Based on the Base 64 VLQ implementation in Closure Compiler:
  5491. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  5492. *
  5493. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  5494. * Redistribution and use in source and binary forms, with or without
  5495. * modification, are permitted provided that the following conditions are
  5496. * met:
  5497. *
  5498. * * Redistributions of source code must retain the above copyright
  5499. * notice, this list of conditions and the following disclaimer.
  5500. * * Redistributions in binary form must reproduce the above
  5501. * copyright notice, this list of conditions and the following
  5502. * disclaimer in the documentation and/or other materials provided
  5503. * with the distribution.
  5504. * * Neither the name of Google Inc. nor the names of its
  5505. * contributors may be used to endorse or promote products derived
  5506. * from this software without specific prior written permission.
  5507. *
  5508. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  5509. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5510. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  5511. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  5512. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  5513. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  5514. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  5515. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  5516. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  5517. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  5518. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5519. */
  5520. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  5521. // length quantities we use in the source map spec, the first bit is the sign,
  5522. // the next four bits are the actual value, and the 6th bit is the
  5523. // continuation bit. The continuation bit tells us whether there are more
  5524. // digits in this value following this digit.
  5525. //
  5526. // Continuation
  5527. // | Sign
  5528. // | |
  5529. // V V
  5530. // 101011
  5531. var VLQ_BASE_SHIFT = 5;
  5532. // binary: 100000
  5533. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  5534. // binary: 011111
  5535. var VLQ_BASE_MASK = VLQ_BASE - 1;
  5536. // binary: 100000
  5537. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  5538. /**
  5539. * Converts from a two-complement value to a value where the sign bit is
  5540. * placed in the least significant bit. For example, as decimals:
  5541. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  5542. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  5543. */
  5544. function toVLQSigned(aValue) {
  5545. return aValue < 0
  5546. ? ((-aValue) << 1) + 1
  5547. : (aValue << 1) + 0;
  5548. }
  5549. /**
  5550. * Converts to a two-complement value from a value where the sign bit is
  5551. * placed in the least significant bit. For example, as decimals:
  5552. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  5553. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  5554. */
  5555. function fromVLQSigned(aValue) {
  5556. var isNegative = (aValue & 1) === 1;
  5557. var shifted = aValue >> 1;
  5558. return isNegative
  5559. ? -shifted
  5560. : shifted;
  5561. }
  5562. /**
  5563. * Returns the base 64 VLQ encoded value.
  5564. */
  5565. var encode$3 = function base64VLQ_encode(aValue) {
  5566. var encoded = "";
  5567. var digit;
  5568. var vlq = toVLQSigned(aValue);
  5569. do {
  5570. digit = vlq & VLQ_BASE_MASK;
  5571. vlq >>>= VLQ_BASE_SHIFT;
  5572. if (vlq > 0) {
  5573. // There are still more digits in this value, so we must make sure the
  5574. // continuation bit is marked.
  5575. digit |= VLQ_CONTINUATION_BIT;
  5576. }
  5577. encoded += base64.encode(digit);
  5578. } while (vlq > 0);
  5579. return encoded;
  5580. };
  5581. /**
  5582. * Decodes the next base 64 VLQ value from the given string and returns the
  5583. * value and the rest of the string via the out parameter.
  5584. */
  5585. var decode$1 = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  5586. var strLen = aStr.length;
  5587. var result = 0;
  5588. var shift = 0;
  5589. var continuation, digit;
  5590. do {
  5591. if (aIndex >= strLen) {
  5592. throw new Error("Expected more digits in base 64 VLQ value.");
  5593. }
  5594. digit = base64.decode(aStr.charCodeAt(aIndex++));
  5595. if (digit === -1) {
  5596. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  5597. }
  5598. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  5599. digit &= VLQ_BASE_MASK;
  5600. result = result + (digit << shift);
  5601. shift += VLQ_BASE_SHIFT;
  5602. } while (continuation);
  5603. aOutParam.value = fromVLQSigned(result);
  5604. aOutParam.rest = aIndex;
  5605. };
  5606. var base64Vlq = {
  5607. encode: encode$3,
  5608. decode: decode$1
  5609. };
  5610. var util$1 = createCommonjsModule$1(function (module, exports) {
  5611. /* -*- Mode: js; js-indent-level: 2; -*- */
  5612. /*
  5613. * Copyright 2011 Mozilla Foundation and contributors
  5614. * Licensed under the New BSD license. See LICENSE or:
  5615. * http://opensource.org/licenses/BSD-3-Clause
  5616. */
  5617. /**
  5618. * This is a helper function for getting values from parameter/options
  5619. * objects.
  5620. *
  5621. * @param args The object we are extracting values from
  5622. * @param name The name of the property we are getting.
  5623. * @param defaultValue An optional value to return if the property is missing
  5624. * from the object. If this is not specified and the property is missing, an
  5625. * error will be thrown.
  5626. */
  5627. function getArg(aArgs, aName, aDefaultValue) {
  5628. if (aName in aArgs) {
  5629. return aArgs[aName];
  5630. } else if (arguments.length === 3) {
  5631. return aDefaultValue;
  5632. } else {
  5633. throw new Error('"' + aName + '" is a required argument.');
  5634. }
  5635. }
  5636. exports.getArg = getArg;
  5637. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  5638. var dataUrlRegexp = /^data:.+\,.+$/;
  5639. function urlParse(aUrl) {
  5640. var match = aUrl.match(urlRegexp);
  5641. if (!match) {
  5642. return null;
  5643. }
  5644. return {
  5645. scheme: match[1],
  5646. auth: match[2],
  5647. host: match[3],
  5648. port: match[4],
  5649. path: match[5]
  5650. };
  5651. }
  5652. exports.urlParse = urlParse;
  5653. function urlGenerate(aParsedUrl) {
  5654. var url = '';
  5655. if (aParsedUrl.scheme) {
  5656. url += aParsedUrl.scheme + ':';
  5657. }
  5658. url += '//';
  5659. if (aParsedUrl.auth) {
  5660. url += aParsedUrl.auth + '@';
  5661. }
  5662. if (aParsedUrl.host) {
  5663. url += aParsedUrl.host;
  5664. }
  5665. if (aParsedUrl.port) {
  5666. url += ":" + aParsedUrl.port;
  5667. }
  5668. if (aParsedUrl.path) {
  5669. url += aParsedUrl.path;
  5670. }
  5671. return url;
  5672. }
  5673. exports.urlGenerate = urlGenerate;
  5674. /**
  5675. * Normalizes a path, or the path portion of a URL:
  5676. *
  5677. * - Replaces consecutive slashes with one slash.
  5678. * - Removes unnecessary '.' parts.
  5679. * - Removes unnecessary '<dir>/..' parts.
  5680. *
  5681. * Based on code in the Node.js 'path' core module.
  5682. *
  5683. * @param aPath The path or url to normalize.
  5684. */
  5685. function normalize(aPath) {
  5686. var path = aPath;
  5687. var url = urlParse(aPath);
  5688. if (url) {
  5689. if (!url.path) {
  5690. return aPath;
  5691. }
  5692. path = url.path;
  5693. }
  5694. var isAbsolute = exports.isAbsolute(path);
  5695. var parts = path.split(/\/+/);
  5696. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  5697. part = parts[i];
  5698. if (part === '.') {
  5699. parts.splice(i, 1);
  5700. } else if (part === '..') {
  5701. up++;
  5702. } else if (up > 0) {
  5703. if (part === '') {
  5704. // The first part is blank if the path is absolute. Trying to go
  5705. // above the root is a no-op. Therefore we can remove all '..' parts
  5706. // directly after the root.
  5707. parts.splice(i + 1, up);
  5708. up = 0;
  5709. } else {
  5710. parts.splice(i, 2);
  5711. up--;
  5712. }
  5713. }
  5714. }
  5715. path = parts.join('/');
  5716. if (path === '') {
  5717. path = isAbsolute ? '/' : '.';
  5718. }
  5719. if (url) {
  5720. url.path = path;
  5721. return urlGenerate(url);
  5722. }
  5723. return path;
  5724. }
  5725. exports.normalize = normalize;
  5726. /**
  5727. * Joins two paths/URLs.
  5728. *
  5729. * @param aRoot The root path or URL.
  5730. * @param aPath The path or URL to be joined with the root.
  5731. *
  5732. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  5733. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  5734. * first.
  5735. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  5736. * is updated with the result and aRoot is returned. Otherwise the result
  5737. * is returned.
  5738. * - If aPath is absolute, the result is aPath.
  5739. * - Otherwise the two paths are joined with a slash.
  5740. * - Joining for example 'http://' and 'www.example.com' is also supported.
  5741. */
  5742. function join(aRoot, aPath) {
  5743. if (aRoot === "") {
  5744. aRoot = ".";
  5745. }
  5746. if (aPath === "") {
  5747. aPath = ".";
  5748. }
  5749. var aPathUrl = urlParse(aPath);
  5750. var aRootUrl = urlParse(aRoot);
  5751. if (aRootUrl) {
  5752. aRoot = aRootUrl.path || '/';
  5753. }
  5754. // `join(foo, '//www.example.org')`
  5755. if (aPathUrl && !aPathUrl.scheme) {
  5756. if (aRootUrl) {
  5757. aPathUrl.scheme = aRootUrl.scheme;
  5758. }
  5759. return urlGenerate(aPathUrl);
  5760. }
  5761. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  5762. return aPath;
  5763. }
  5764. // `join('http://', 'www.example.com')`
  5765. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  5766. aRootUrl.host = aPath;
  5767. return urlGenerate(aRootUrl);
  5768. }
  5769. var joined = aPath.charAt(0) === '/'
  5770. ? aPath
  5771. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  5772. if (aRootUrl) {
  5773. aRootUrl.path = joined;
  5774. return urlGenerate(aRootUrl);
  5775. }
  5776. return joined;
  5777. }
  5778. exports.join = join;
  5779. exports.isAbsolute = function (aPath) {
  5780. return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  5781. };
  5782. /**
  5783. * Make a path relative to a URL or another path.
  5784. *
  5785. * @param aRoot The root path or URL.
  5786. * @param aPath The path or URL to be made relative to aRoot.
  5787. */
  5788. function relative(aRoot, aPath) {
  5789. if (aRoot === "") {
  5790. aRoot = ".";
  5791. }
  5792. aRoot = aRoot.replace(/\/$/, '');
  5793. // It is possible for the path to be above the root. In this case, simply
  5794. // checking whether the root is a prefix of the path won't work. Instead, we
  5795. // need to remove components from the root one by one, until either we find
  5796. // a prefix that fits, or we run out of components to remove.
  5797. var level = 0;
  5798. while (aPath.indexOf(aRoot + '/') !== 0) {
  5799. var index = aRoot.lastIndexOf("/");
  5800. if (index < 0) {
  5801. return aPath;
  5802. }
  5803. // If the only part of the root that is left is the scheme (i.e. http://,
  5804. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  5805. // have exhausted all components, so the path is not relative to the root.
  5806. aRoot = aRoot.slice(0, index);
  5807. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  5808. return aPath;
  5809. }
  5810. ++level;
  5811. }
  5812. // Make sure we add a "../" for each component we removed from the root.
  5813. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  5814. }
  5815. exports.relative = relative;
  5816. var supportsNullProto = (function () {
  5817. var obj = Object.create(null);
  5818. return !('__proto__' in obj);
  5819. }());
  5820. function identity (s) {
  5821. return s;
  5822. }
  5823. /**
  5824. * Because behavior goes wacky when you set `__proto__` on objects, we
  5825. * have to prefix all the strings in our set with an arbitrary character.
  5826. *
  5827. * See https://github.com/mozilla/source-map/pull/31 and
  5828. * https://github.com/mozilla/source-map/issues/30
  5829. *
  5830. * @param String aStr
  5831. */
  5832. function toSetString(aStr) {
  5833. if (isProtoString(aStr)) {
  5834. return '$' + aStr;
  5835. }
  5836. return aStr;
  5837. }
  5838. exports.toSetString = supportsNullProto ? identity : toSetString;
  5839. function fromSetString(aStr) {
  5840. if (isProtoString(aStr)) {
  5841. return aStr.slice(1);
  5842. }
  5843. return aStr;
  5844. }
  5845. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  5846. function isProtoString(s) {
  5847. if (!s) {
  5848. return false;
  5849. }
  5850. var length = s.length;
  5851. if (length < 9 /* "__proto__".length */) {
  5852. return false;
  5853. }
  5854. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  5855. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  5856. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  5857. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  5858. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  5859. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  5860. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  5861. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  5862. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  5863. return false;
  5864. }
  5865. for (var i = length - 10; i >= 0; i--) {
  5866. if (s.charCodeAt(i) !== 36 /* '$' */) {
  5867. return false;
  5868. }
  5869. }
  5870. return true;
  5871. }
  5872. /**
  5873. * Comparator between two mappings where the original positions are compared.
  5874. *
  5875. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  5876. * mappings with the same original source/line/column, but different generated
  5877. * line and column the same. Useful when searching for a mapping with a
  5878. * stubbed out mapping.
  5879. */
  5880. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  5881. var cmp = strcmp(mappingA.source, mappingB.source);
  5882. if (cmp !== 0) {
  5883. return cmp;
  5884. }
  5885. cmp = mappingA.originalLine - mappingB.originalLine;
  5886. if (cmp !== 0) {
  5887. return cmp;
  5888. }
  5889. cmp = mappingA.originalColumn - mappingB.originalColumn;
  5890. if (cmp !== 0 || onlyCompareOriginal) {
  5891. return cmp;
  5892. }
  5893. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  5894. if (cmp !== 0) {
  5895. return cmp;
  5896. }
  5897. cmp = mappingA.generatedLine - mappingB.generatedLine;
  5898. if (cmp !== 0) {
  5899. return cmp;
  5900. }
  5901. return strcmp(mappingA.name, mappingB.name);
  5902. }
  5903. exports.compareByOriginalPositions = compareByOriginalPositions;
  5904. /**
  5905. * Comparator between two mappings with deflated source and name indices where
  5906. * the generated positions are compared.
  5907. *
  5908. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  5909. * mappings with the same generated line and column, but different
  5910. * source/name/original line and column the same. Useful when searching for a
  5911. * mapping with a stubbed out mapping.
  5912. */
  5913. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  5914. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  5915. if (cmp !== 0) {
  5916. return cmp;
  5917. }
  5918. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  5919. if (cmp !== 0 || onlyCompareGenerated) {
  5920. return cmp;
  5921. }
  5922. cmp = strcmp(mappingA.source, mappingB.source);
  5923. if (cmp !== 0) {
  5924. return cmp;
  5925. }
  5926. cmp = mappingA.originalLine - mappingB.originalLine;
  5927. if (cmp !== 0) {
  5928. return cmp;
  5929. }
  5930. cmp = mappingA.originalColumn - mappingB.originalColumn;
  5931. if (cmp !== 0) {
  5932. return cmp;
  5933. }
  5934. return strcmp(mappingA.name, mappingB.name);
  5935. }
  5936. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  5937. function strcmp(aStr1, aStr2) {
  5938. if (aStr1 === aStr2) {
  5939. return 0;
  5940. }
  5941. if (aStr1 === null) {
  5942. return 1; // aStr2 !== null
  5943. }
  5944. if (aStr2 === null) {
  5945. return -1; // aStr1 !== null
  5946. }
  5947. if (aStr1 > aStr2) {
  5948. return 1;
  5949. }
  5950. return -1;
  5951. }
  5952. /**
  5953. * Comparator between two mappings with inflated source and name strings where
  5954. * the generated positions are compared.
  5955. */
  5956. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  5957. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  5958. if (cmp !== 0) {
  5959. return cmp;
  5960. }
  5961. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  5962. if (cmp !== 0) {
  5963. return cmp;
  5964. }
  5965. cmp = strcmp(mappingA.source, mappingB.source);
  5966. if (cmp !== 0) {
  5967. return cmp;
  5968. }
  5969. cmp = mappingA.originalLine - mappingB.originalLine;
  5970. if (cmp !== 0) {
  5971. return cmp;
  5972. }
  5973. cmp = mappingA.originalColumn - mappingB.originalColumn;
  5974. if (cmp !== 0) {
  5975. return cmp;
  5976. }
  5977. return strcmp(mappingA.name, mappingB.name);
  5978. }
  5979. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  5980. /**
  5981. * Strip any JSON XSSI avoidance prefix from the string (as documented
  5982. * in the source maps specification), and then parse the string as
  5983. * JSON.
  5984. */
  5985. function parseSourceMapInput(str) {
  5986. return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  5987. }
  5988. exports.parseSourceMapInput = parseSourceMapInput;
  5989. /**
  5990. * Compute the URL of a source given the the source root, the source's
  5991. * URL, and the source map's URL.
  5992. */
  5993. function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  5994. sourceURL = sourceURL || '';
  5995. if (sourceRoot) {
  5996. // This follows what Chrome does.
  5997. if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  5998. sourceRoot += '/';
  5999. }
  6000. // The spec says:
  6001. // Line 4: An optional source root, useful for relocating source
  6002. // files on a server or removing repeated values in the
  6003. // “sources” entry. This value is prepended to the individual
  6004. // entries in the “source” field.
  6005. sourceURL = sourceRoot + sourceURL;
  6006. }
  6007. // Historically, SourceMapConsumer did not take the sourceMapURL as
  6008. // a parameter. This mode is still somewhat supported, which is why
  6009. // this code block is conditional. However, it's preferable to pass
  6010. // the source map URL to SourceMapConsumer, so that this function
  6011. // can implement the source URL resolution algorithm as outlined in
  6012. // the spec. This block is basically the equivalent of:
  6013. // new URL(sourceURL, sourceMapURL).toString()
  6014. // ... except it avoids using URL, which wasn't available in the
  6015. // older releases of node still supported by this library.
  6016. //
  6017. // The spec says:
  6018. // If the sources are not absolute URLs after prepending of the
  6019. // “sourceRoot”, the sources are resolved relative to the
  6020. // SourceMap (like resolving script src in a html document).
  6021. if (sourceMapURL) {
  6022. var parsed = urlParse(sourceMapURL);
  6023. if (!parsed) {
  6024. throw new Error("sourceMapURL could not be parsed");
  6025. }
  6026. if (parsed.path) {
  6027. // Strip the last path component, but keep the "/".
  6028. var index = parsed.path.lastIndexOf('/');
  6029. if (index >= 0) {
  6030. parsed.path = parsed.path.substring(0, index + 1);
  6031. }
  6032. }
  6033. sourceURL = join(urlGenerate(parsed), sourceURL);
  6034. }
  6035. return normalize(sourceURL);
  6036. }
  6037. exports.computeSourceURL = computeSourceURL;
  6038. });
  6039. /* -*- Mode: js; js-indent-level: 2; -*- */
  6040. /*
  6041. * Copyright 2011 Mozilla Foundation and contributors
  6042. * Licensed under the New BSD license. See LICENSE or:
  6043. * http://opensource.org/licenses/BSD-3-Clause
  6044. */
  6045. var has$1 = Object.prototype.hasOwnProperty;
  6046. var hasNativeMap = typeof Map !== "undefined";
  6047. /**
  6048. * A data structure which is a combination of an array and a set. Adding a new
  6049. * member is O(1), testing for membership is O(1), and finding the index of an
  6050. * element is O(1). Removing elements from the set is not supported. Only
  6051. * strings are supported for membership.
  6052. */
  6053. function ArraySet$2() {
  6054. this._array = [];
  6055. this._set = hasNativeMap ? new Map() : Object.create(null);
  6056. }
  6057. /**
  6058. * Static method for creating ArraySet instances from an existing array.
  6059. */
  6060. ArraySet$2.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  6061. var set = new ArraySet$2();
  6062. for (var i = 0, len = aArray.length; i < len; i++) {
  6063. set.add(aArray[i], aAllowDuplicates);
  6064. }
  6065. return set;
  6066. };
  6067. /**
  6068. * Return how many unique items are in this ArraySet. If duplicates have been
  6069. * added, than those do not count towards the size.
  6070. *
  6071. * @returns Number
  6072. */
  6073. ArraySet$2.prototype.size = function ArraySet_size() {
  6074. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  6075. };
  6076. /**
  6077. * Add the given string to this set.
  6078. *
  6079. * @param String aStr
  6080. */
  6081. ArraySet$2.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  6082. var sStr = hasNativeMap ? aStr : util$1.toSetString(aStr);
  6083. var isDuplicate = hasNativeMap ? this.has(aStr) : has$1.call(this._set, sStr);
  6084. var idx = this._array.length;
  6085. if (!isDuplicate || aAllowDuplicates) {
  6086. this._array.push(aStr);
  6087. }
  6088. if (!isDuplicate) {
  6089. if (hasNativeMap) {
  6090. this._set.set(aStr, idx);
  6091. } else {
  6092. this._set[sStr] = idx;
  6093. }
  6094. }
  6095. };
  6096. /**
  6097. * Is the given string a member of this set?
  6098. *
  6099. * @param String aStr
  6100. */
  6101. ArraySet$2.prototype.has = function ArraySet_has(aStr) {
  6102. if (hasNativeMap) {
  6103. return this._set.has(aStr);
  6104. } else {
  6105. var sStr = util$1.toSetString(aStr);
  6106. return has$1.call(this._set, sStr);
  6107. }
  6108. };
  6109. /**
  6110. * What is the index of the given string in the array?
  6111. *
  6112. * @param String aStr
  6113. */
  6114. ArraySet$2.prototype.indexOf = function ArraySet_indexOf(aStr) {
  6115. if (hasNativeMap) {
  6116. var idx = this._set.get(aStr);
  6117. if (idx >= 0) {
  6118. return idx;
  6119. }
  6120. } else {
  6121. var sStr = util$1.toSetString(aStr);
  6122. if (has$1.call(this._set, sStr)) {
  6123. return this._set[sStr];
  6124. }
  6125. }
  6126. throw new Error('"' + aStr + '" is not in the set.');
  6127. };
  6128. /**
  6129. * What is the element at the given index?
  6130. *
  6131. * @param Number aIdx
  6132. */
  6133. ArraySet$2.prototype.at = function ArraySet_at(aIdx) {
  6134. if (aIdx >= 0 && aIdx < this._array.length) {
  6135. return this._array[aIdx];
  6136. }
  6137. throw new Error('No element indexed by ' + aIdx);
  6138. };
  6139. /**
  6140. * Returns the array representation of this set (which has the proper indices
  6141. * indicated by indexOf). Note that this is a copy of the internal array used
  6142. * for storing the members so that no one can mess with internal state.
  6143. */
  6144. ArraySet$2.prototype.toArray = function ArraySet_toArray() {
  6145. return this._array.slice();
  6146. };
  6147. var ArraySet_1 = ArraySet$2;
  6148. var arraySet = {
  6149. ArraySet: ArraySet_1
  6150. };
  6151. /* -*- Mode: js; js-indent-level: 2; -*- */
  6152. /*
  6153. * Copyright 2014 Mozilla Foundation and contributors
  6154. * Licensed under the New BSD license. See LICENSE or:
  6155. * http://opensource.org/licenses/BSD-3-Clause
  6156. */
  6157. /**
  6158. * Determine whether mappingB is after mappingA with respect to generated
  6159. * position.
  6160. */
  6161. function generatedPositionAfter(mappingA, mappingB) {
  6162. // Optimized for most common case
  6163. var lineA = mappingA.generatedLine;
  6164. var lineB = mappingB.generatedLine;
  6165. var columnA = mappingA.generatedColumn;
  6166. var columnB = mappingB.generatedColumn;
  6167. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  6168. util$1.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  6169. }
  6170. /**
  6171. * A data structure to provide a sorted view of accumulated mappings in a
  6172. * performance conscious manner. It trades a neglibable overhead in general
  6173. * case for a large speedup in case of mappings being added in order.
  6174. */
  6175. function MappingList$1() {
  6176. this._array = [];
  6177. this._sorted = true;
  6178. // Serves as infimum
  6179. this._last = {generatedLine: -1, generatedColumn: 0};
  6180. }
  6181. /**
  6182. * Iterate through internal items. This method takes the same arguments that
  6183. * `Array.prototype.forEach` takes.
  6184. *
  6185. * NOTE: The order of the mappings is NOT guaranteed.
  6186. */
  6187. MappingList$1.prototype.unsortedForEach =
  6188. function MappingList_forEach(aCallback, aThisArg) {
  6189. this._array.forEach(aCallback, aThisArg);
  6190. };
  6191. /**
  6192. * Add the given source mapping.
  6193. *
  6194. * @param Object aMapping
  6195. */
  6196. MappingList$1.prototype.add = function MappingList_add(aMapping) {
  6197. if (generatedPositionAfter(this._last, aMapping)) {
  6198. this._last = aMapping;
  6199. this._array.push(aMapping);
  6200. } else {
  6201. this._sorted = false;
  6202. this._array.push(aMapping);
  6203. }
  6204. };
  6205. /**
  6206. * Returns the flat, sorted array of mappings. The mappings are sorted by
  6207. * generated position.
  6208. *
  6209. * WARNING: This method returns internal data without copying, for
  6210. * performance. The return value must NOT be mutated, and should be treated as
  6211. * an immutable borrow. If you want to take ownership, you must make your own
  6212. * copy.
  6213. */
  6214. MappingList$1.prototype.toArray = function MappingList_toArray() {
  6215. if (!this._sorted) {
  6216. this._array.sort(util$1.compareByGeneratedPositionsInflated);
  6217. this._sorted = true;
  6218. }
  6219. return this._array;
  6220. };
  6221. var MappingList_1 = MappingList$1;
  6222. var mappingList = {
  6223. MappingList: MappingList_1
  6224. };
  6225. /* -*- Mode: js; js-indent-level: 2; -*- */
  6226. /*
  6227. * Copyright 2011 Mozilla Foundation and contributors
  6228. * Licensed under the New BSD license. See LICENSE or:
  6229. * http://opensource.org/licenses/BSD-3-Clause
  6230. */
  6231. var ArraySet$1 = arraySet.ArraySet;
  6232. var MappingList = mappingList.MappingList;
  6233. /**
  6234. * An instance of the SourceMapGenerator represents a source map which is
  6235. * being built incrementally. You may pass an object with the following
  6236. * properties:
  6237. *
  6238. * - file: The filename of the generated source.
  6239. * - sourceRoot: A root for all relative URLs in this source map.
  6240. */
  6241. function SourceMapGenerator$3(aArgs) {
  6242. if (!aArgs) {
  6243. aArgs = {};
  6244. }
  6245. this._file = util$1.getArg(aArgs, 'file', null);
  6246. this._sourceRoot = util$1.getArg(aArgs, 'sourceRoot', null);
  6247. this._skipValidation = util$1.getArg(aArgs, 'skipValidation', false);
  6248. this._sources = new ArraySet$1();
  6249. this._names = new ArraySet$1();
  6250. this._mappings = new MappingList();
  6251. this._sourcesContents = null;
  6252. }
  6253. SourceMapGenerator$3.prototype._version = 3;
  6254. /**
  6255. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  6256. *
  6257. * @param aSourceMapConsumer The SourceMap.
  6258. */
  6259. SourceMapGenerator$3.fromSourceMap =
  6260. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  6261. var sourceRoot = aSourceMapConsumer.sourceRoot;
  6262. var generator = new SourceMapGenerator$3({
  6263. file: aSourceMapConsumer.file,
  6264. sourceRoot: sourceRoot
  6265. });
  6266. aSourceMapConsumer.eachMapping(function (mapping) {
  6267. var newMapping = {
  6268. generated: {
  6269. line: mapping.generatedLine,
  6270. column: mapping.generatedColumn
  6271. }
  6272. };
  6273. if (mapping.source != null) {
  6274. newMapping.source = mapping.source;
  6275. if (sourceRoot != null) {
  6276. newMapping.source = util$1.relative(sourceRoot, newMapping.source);
  6277. }
  6278. newMapping.original = {
  6279. line: mapping.originalLine,
  6280. column: mapping.originalColumn
  6281. };
  6282. if (mapping.name != null) {
  6283. newMapping.name = mapping.name;
  6284. }
  6285. }
  6286. generator.addMapping(newMapping);
  6287. });
  6288. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  6289. var sourceRelative = sourceFile;
  6290. if (sourceRoot !== null) {
  6291. sourceRelative = util$1.relative(sourceRoot, sourceFile);
  6292. }
  6293. if (!generator._sources.has(sourceRelative)) {
  6294. generator._sources.add(sourceRelative);
  6295. }
  6296. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  6297. if (content != null) {
  6298. generator.setSourceContent(sourceFile, content);
  6299. }
  6300. });
  6301. return generator;
  6302. };
  6303. /**
  6304. * Add a single mapping from original source line and column to the generated
  6305. * source's line and column for this source map being created. The mapping
  6306. * object should have the following properties:
  6307. *
  6308. * - generated: An object with the generated line and column positions.
  6309. * - original: An object with the original line and column positions.
  6310. * - source: The original source file (relative to the sourceRoot).
  6311. * - name: An optional original token name for this mapping.
  6312. */
  6313. SourceMapGenerator$3.prototype.addMapping =
  6314. function SourceMapGenerator_addMapping(aArgs) {
  6315. var generated = util$1.getArg(aArgs, 'generated');
  6316. var original = util$1.getArg(aArgs, 'original', null);
  6317. var source = util$1.getArg(aArgs, 'source', null);
  6318. var name = util$1.getArg(aArgs, 'name', null);
  6319. if (!this._skipValidation) {
  6320. this._validateMapping(generated, original, source, name);
  6321. }
  6322. if (source != null) {
  6323. source = String(source);
  6324. if (!this._sources.has(source)) {
  6325. this._sources.add(source);
  6326. }
  6327. }
  6328. if (name != null) {
  6329. name = String(name);
  6330. if (!this._names.has(name)) {
  6331. this._names.add(name);
  6332. }
  6333. }
  6334. this._mappings.add({
  6335. generatedLine: generated.line,
  6336. generatedColumn: generated.column,
  6337. originalLine: original != null && original.line,
  6338. originalColumn: original != null && original.column,
  6339. source: source,
  6340. name: name
  6341. });
  6342. };
  6343. /**
  6344. * Set the source content for a source file.
  6345. */
  6346. SourceMapGenerator$3.prototype.setSourceContent =
  6347. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  6348. var source = aSourceFile;
  6349. if (this._sourceRoot != null) {
  6350. source = util$1.relative(this._sourceRoot, source);
  6351. }
  6352. if (aSourceContent != null) {
  6353. // Add the source content to the _sourcesContents map.
  6354. // Create a new _sourcesContents map if the property is null.
  6355. if (!this._sourcesContents) {
  6356. this._sourcesContents = Object.create(null);
  6357. }
  6358. this._sourcesContents[util$1.toSetString(source)] = aSourceContent;
  6359. } else if (this._sourcesContents) {
  6360. // Remove the source file from the _sourcesContents map.
  6361. // If the _sourcesContents map is empty, set the property to null.
  6362. delete this._sourcesContents[util$1.toSetString(source)];
  6363. if (Object.keys(this._sourcesContents).length === 0) {
  6364. this._sourcesContents = null;
  6365. }
  6366. }
  6367. };
  6368. /**
  6369. * Applies the mappings of a sub-source-map for a specific source file to the
  6370. * source map being generated. Each mapping to the supplied source file is
  6371. * rewritten using the supplied source map. Note: The resolution for the
  6372. * resulting mappings is the minimium of this map and the supplied map.
  6373. *
  6374. * @param aSourceMapConsumer The source map to be applied.
  6375. * @param aSourceFile Optional. The filename of the source file.
  6376. * If omitted, SourceMapConsumer's file property will be used.
  6377. * @param aSourceMapPath Optional. The dirname of the path to the source map
  6378. * to be applied. If relative, it is relative to the SourceMapConsumer.
  6379. * This parameter is needed when the two source maps aren't in the same
  6380. * directory, and the source map to be applied contains relative source
  6381. * paths. If so, those relative source paths need to be rewritten
  6382. * relative to the SourceMapGenerator.
  6383. */
  6384. SourceMapGenerator$3.prototype.applySourceMap =
  6385. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  6386. var sourceFile = aSourceFile;
  6387. // If aSourceFile is omitted, we will use the file property of the SourceMap
  6388. if (aSourceFile == null) {
  6389. if (aSourceMapConsumer.file == null) {
  6390. throw new Error(
  6391. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  6392. 'or the source map\'s "file" property. Both were omitted.'
  6393. );
  6394. }
  6395. sourceFile = aSourceMapConsumer.file;
  6396. }
  6397. var sourceRoot = this._sourceRoot;
  6398. // Make "sourceFile" relative if an absolute Url is passed.
  6399. if (sourceRoot != null) {
  6400. sourceFile = util$1.relative(sourceRoot, sourceFile);
  6401. }
  6402. // Applying the SourceMap can add and remove items from the sources and
  6403. // the names array.
  6404. var newSources = new ArraySet$1();
  6405. var newNames = new ArraySet$1();
  6406. // Find mappings for the "sourceFile"
  6407. this._mappings.unsortedForEach(function (mapping) {
  6408. if (mapping.source === sourceFile && mapping.originalLine != null) {
  6409. // Check if it can be mapped by the source map, then update the mapping.
  6410. var original = aSourceMapConsumer.originalPositionFor({
  6411. line: mapping.originalLine,
  6412. column: mapping.originalColumn
  6413. });
  6414. if (original.source != null) {
  6415. // Copy mapping
  6416. mapping.source = original.source;
  6417. if (aSourceMapPath != null) {
  6418. mapping.source = util$1.join(aSourceMapPath, mapping.source);
  6419. }
  6420. if (sourceRoot != null) {
  6421. mapping.source = util$1.relative(sourceRoot, mapping.source);
  6422. }
  6423. mapping.originalLine = original.line;
  6424. mapping.originalColumn = original.column;
  6425. if (original.name != null) {
  6426. mapping.name = original.name;
  6427. }
  6428. }
  6429. }
  6430. var source = mapping.source;
  6431. if (source != null && !newSources.has(source)) {
  6432. newSources.add(source);
  6433. }
  6434. var name = mapping.name;
  6435. if (name != null && !newNames.has(name)) {
  6436. newNames.add(name);
  6437. }
  6438. }, this);
  6439. this._sources = newSources;
  6440. this._names = newNames;
  6441. // Copy sourcesContents of applied map.
  6442. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  6443. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  6444. if (content != null) {
  6445. if (aSourceMapPath != null) {
  6446. sourceFile = util$1.join(aSourceMapPath, sourceFile);
  6447. }
  6448. if (sourceRoot != null) {
  6449. sourceFile = util$1.relative(sourceRoot, sourceFile);
  6450. }
  6451. this.setSourceContent(sourceFile, content);
  6452. }
  6453. }, this);
  6454. };
  6455. /**
  6456. * A mapping can have one of the three levels of data:
  6457. *
  6458. * 1. Just the generated position.
  6459. * 2. The Generated position, original position, and original source.
  6460. * 3. Generated and original position, original source, as well as a name
  6461. * token.
  6462. *
  6463. * To maintain consistency, we validate that any new mapping being added falls
  6464. * in to one of these categories.
  6465. */
  6466. SourceMapGenerator$3.prototype._validateMapping =
  6467. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  6468. aName) {
  6469. // When aOriginal is truthy but has empty values for .line and .column,
  6470. // it is most likely a programmer error. In this case we throw a very
  6471. // specific error message to try to guide them the right way.
  6472. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  6473. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  6474. throw new Error(
  6475. 'original.line and original.column are not numbers -- you probably meant to omit ' +
  6476. 'the original mapping entirely and only map the generated position. If so, pass ' +
  6477. 'null for the original mapping instead of an object with empty or null values.'
  6478. );
  6479. }
  6480. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  6481. && aGenerated.line > 0 && aGenerated.column >= 0
  6482. && !aOriginal && !aSource && !aName) {
  6483. // Case 1.
  6484. return;
  6485. }
  6486. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  6487. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  6488. && aGenerated.line > 0 && aGenerated.column >= 0
  6489. && aOriginal.line > 0 && aOriginal.column >= 0
  6490. && aSource) {
  6491. // Cases 2 and 3.
  6492. return;
  6493. }
  6494. else {
  6495. throw new Error('Invalid mapping: ' + JSON.stringify({
  6496. generated: aGenerated,
  6497. source: aSource,
  6498. original: aOriginal,
  6499. name: aName
  6500. }));
  6501. }
  6502. };
  6503. /**
  6504. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  6505. * specified by the source map format.
  6506. */
  6507. SourceMapGenerator$3.prototype._serializeMappings =
  6508. function SourceMapGenerator_serializeMappings() {
  6509. var previousGeneratedColumn = 0;
  6510. var previousGeneratedLine = 1;
  6511. var previousOriginalColumn = 0;
  6512. var previousOriginalLine = 0;
  6513. var previousName = 0;
  6514. var previousSource = 0;
  6515. var result = '';
  6516. var next;
  6517. var mapping;
  6518. var nameIdx;
  6519. var sourceIdx;
  6520. var mappings = this._mappings.toArray();
  6521. for (var i = 0, len = mappings.length; i < len; i++) {
  6522. mapping = mappings[i];
  6523. next = '';
  6524. if (mapping.generatedLine !== previousGeneratedLine) {
  6525. previousGeneratedColumn = 0;
  6526. while (mapping.generatedLine !== previousGeneratedLine) {
  6527. next += ';';
  6528. previousGeneratedLine++;
  6529. }
  6530. }
  6531. else {
  6532. if (i > 0) {
  6533. if (!util$1.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  6534. continue;
  6535. }
  6536. next += ',';
  6537. }
  6538. }
  6539. next += base64Vlq.encode(mapping.generatedColumn
  6540. - previousGeneratedColumn);
  6541. previousGeneratedColumn = mapping.generatedColumn;
  6542. if (mapping.source != null) {
  6543. sourceIdx = this._sources.indexOf(mapping.source);
  6544. next += base64Vlq.encode(sourceIdx - previousSource);
  6545. previousSource = sourceIdx;
  6546. // lines are stored 0-based in SourceMap spec version 3
  6547. next += base64Vlq.encode(mapping.originalLine - 1
  6548. - previousOriginalLine);
  6549. previousOriginalLine = mapping.originalLine - 1;
  6550. next += base64Vlq.encode(mapping.originalColumn
  6551. - previousOriginalColumn);
  6552. previousOriginalColumn = mapping.originalColumn;
  6553. if (mapping.name != null) {
  6554. nameIdx = this._names.indexOf(mapping.name);
  6555. next += base64Vlq.encode(nameIdx - previousName);
  6556. previousName = nameIdx;
  6557. }
  6558. }
  6559. result += next;
  6560. }
  6561. return result;
  6562. };
  6563. SourceMapGenerator$3.prototype._generateSourcesContent =
  6564. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  6565. return aSources.map(function (source) {
  6566. if (!this._sourcesContents) {
  6567. return null;
  6568. }
  6569. if (aSourceRoot != null) {
  6570. source = util$1.relative(aSourceRoot, source);
  6571. }
  6572. var key = util$1.toSetString(source);
  6573. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  6574. ? this._sourcesContents[key]
  6575. : null;
  6576. }, this);
  6577. };
  6578. /**
  6579. * Externalize the source map.
  6580. */
  6581. SourceMapGenerator$3.prototype.toJSON =
  6582. function SourceMapGenerator_toJSON() {
  6583. var map = {
  6584. version: this._version,
  6585. sources: this._sources.toArray(),
  6586. names: this._names.toArray(),
  6587. mappings: this._serializeMappings()
  6588. };
  6589. if (this._file != null) {
  6590. map.file = this._file;
  6591. }
  6592. if (this._sourceRoot != null) {
  6593. map.sourceRoot = this._sourceRoot;
  6594. }
  6595. if (this._sourcesContents) {
  6596. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  6597. }
  6598. return map;
  6599. };
  6600. /**
  6601. * Render the source map being generated to a string.
  6602. */
  6603. SourceMapGenerator$3.prototype.toString =
  6604. function SourceMapGenerator_toString() {
  6605. return JSON.stringify(this.toJSON());
  6606. };
  6607. var SourceMapGenerator_1 = SourceMapGenerator$3;
  6608. var sourceMapGenerator = {
  6609. SourceMapGenerator: SourceMapGenerator_1
  6610. };
  6611. var binarySearch = createCommonjsModule$1(function (module, exports) {
  6612. /* -*- Mode: js; js-indent-level: 2; -*- */
  6613. /*
  6614. * Copyright 2011 Mozilla Foundation and contributors
  6615. * Licensed under the New BSD license. See LICENSE or:
  6616. * http://opensource.org/licenses/BSD-3-Clause
  6617. */
  6618. exports.GREATEST_LOWER_BOUND = 1;
  6619. exports.LEAST_UPPER_BOUND = 2;
  6620. /**
  6621. * Recursive implementation of binary search.
  6622. *
  6623. * @param aLow Indices here and lower do not contain the needle.
  6624. * @param aHigh Indices here and higher do not contain the needle.
  6625. * @param aNeedle The element being searched for.
  6626. * @param aHaystack The non-empty array being searched.
  6627. * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  6628. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  6629. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  6630. * closest element that is smaller than or greater than the one we are
  6631. * searching for, respectively, if the exact element cannot be found.
  6632. */
  6633. function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  6634. // This function terminates when one of the following is true:
  6635. //
  6636. // 1. We find the exact element we are looking for.
  6637. //
  6638. // 2. We did not find the exact element, but we can return the index of
  6639. // the next-closest element.
  6640. //
  6641. // 3. We did not find the exact element, and there is no next-closest
  6642. // element than the one we are searching for, so we return -1.
  6643. var mid = Math.floor((aHigh - aLow) / 2) + aLow;
  6644. var cmp = aCompare(aNeedle, aHaystack[mid], true);
  6645. if (cmp === 0) {
  6646. // Found the element we are looking for.
  6647. return mid;
  6648. }
  6649. else if (cmp > 0) {
  6650. // Our needle is greater than aHaystack[mid].
  6651. if (aHigh - mid > 1) {
  6652. // The element is in the upper half.
  6653. return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  6654. }
  6655. // The exact needle element was not found in this haystack. Determine if
  6656. // we are in termination case (3) or (2) and return the appropriate thing.
  6657. if (aBias == exports.LEAST_UPPER_BOUND) {
  6658. return aHigh < aHaystack.length ? aHigh : -1;
  6659. } else {
  6660. return mid;
  6661. }
  6662. }
  6663. else {
  6664. // Our needle is less than aHaystack[mid].
  6665. if (mid - aLow > 1) {
  6666. // The element is in the lower half.
  6667. return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  6668. }
  6669. // we are in termination case (3) or (2) and return the appropriate thing.
  6670. if (aBias == exports.LEAST_UPPER_BOUND) {
  6671. return mid;
  6672. } else {
  6673. return aLow < 0 ? -1 : aLow;
  6674. }
  6675. }
  6676. }
  6677. /**
  6678. * This is an implementation of binary search which will always try and return
  6679. * the index of the closest element if there is no exact hit. This is because
  6680. * mappings between original and generated line/col pairs are single points,
  6681. * and there is an implicit region between each of them, so a miss just means
  6682. * that you aren't on the very start of a region.
  6683. *
  6684. * @param aNeedle The element you are looking for.
  6685. * @param aHaystack The array that is being searched.
  6686. * @param aCompare A function which takes the needle and an element in the
  6687. * array and returns -1, 0, or 1 depending on whether the needle is less
  6688. * than, equal to, or greater than the element, respectively.
  6689. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  6690. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  6691. * closest element that is smaller than or greater than the one we are
  6692. * searching for, respectively, if the exact element cannot be found.
  6693. * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  6694. */
  6695. exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  6696. if (aHaystack.length === 0) {
  6697. return -1;
  6698. }
  6699. var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
  6700. aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  6701. if (index < 0) {
  6702. return -1;
  6703. }
  6704. // We have found either the exact element, or the next-closest element than
  6705. // the one we are searching for. However, there may be more than one such
  6706. // element. Make sure we always return the smallest of these.
  6707. while (index - 1 >= 0) {
  6708. if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  6709. break;
  6710. }
  6711. --index;
  6712. }
  6713. return index;
  6714. };
  6715. });
  6716. /* -*- Mode: js; js-indent-level: 2; -*- */
  6717. /*
  6718. * Copyright 2011 Mozilla Foundation and contributors
  6719. * Licensed under the New BSD license. See LICENSE or:
  6720. * http://opensource.org/licenses/BSD-3-Clause
  6721. */
  6722. // It turns out that some (most?) JavaScript engines don't self-host
  6723. // `Array.prototype.sort`. This makes sense because C++ will likely remain
  6724. // faster than JS when doing raw CPU-intensive sorting. However, when using a
  6725. // custom comparator function, calling back and forth between the VM's C++ and
  6726. // JIT'd JS is rather slow *and* loses JIT type information, resulting in
  6727. // worse generated code for the comparator function than would be optimal. In
  6728. // fact, when sorting with a comparator, these costs outweigh the benefits of
  6729. // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
  6730. // a ~3500ms mean speed-up in `bench/bench.html`.
  6731. /**
  6732. * Swap the elements indexed by `x` and `y` in the array `ary`.
  6733. *
  6734. * @param {Array} ary
  6735. * The array.
  6736. * @param {Number} x
  6737. * The index of the first item.
  6738. * @param {Number} y
  6739. * The index of the second item.
  6740. */
  6741. function swap(ary, x, y) {
  6742. var temp = ary[x];
  6743. ary[x] = ary[y];
  6744. ary[y] = temp;
  6745. }
  6746. /**
  6747. * Returns a random integer within the range `low .. high` inclusive.
  6748. *
  6749. * @param {Number} low
  6750. * The lower bound on the range.
  6751. * @param {Number} high
  6752. * The upper bound on the range.
  6753. */
  6754. function randomIntInRange(low, high) {
  6755. return Math.round(low + (Math.random() * (high - low)));
  6756. }
  6757. /**
  6758. * The Quick Sort algorithm.
  6759. *
  6760. * @param {Array} ary
  6761. * An array to sort.
  6762. * @param {function} comparator
  6763. * Function to use to compare two items.
  6764. * @param {Number} p
  6765. * Start index of the array
  6766. * @param {Number} r
  6767. * End index of the array
  6768. */
  6769. function doQuickSort(ary, comparator, p, r) {
  6770. // If our lower bound is less than our upper bound, we (1) partition the
  6771. // array into two pieces and (2) recurse on each half. If it is not, this is
  6772. // the empty array and our base case.
  6773. if (p < r) {
  6774. // (1) Partitioning.
  6775. //
  6776. // The partitioning chooses a pivot between `p` and `r` and moves all
  6777. // elements that are less than or equal to the pivot to the before it, and
  6778. // all the elements that are greater than it after it. The effect is that
  6779. // once partition is done, the pivot is in the exact place it will be when
  6780. // the array is put in sorted order, and it will not need to be moved
  6781. // again. This runs in O(n) time.
  6782. // Always choose a random pivot so that an input array which is reverse
  6783. // sorted does not cause O(n^2) running time.
  6784. var pivotIndex = randomIntInRange(p, r);
  6785. var i = p - 1;
  6786. swap(ary, pivotIndex, r);
  6787. var pivot = ary[r];
  6788. // Immediately after `j` is incremented in this loop, the following hold
  6789. // true:
  6790. //
  6791. // * Every element in `ary[p .. i]` is less than or equal to the pivot.
  6792. //
  6793. // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
  6794. for (var j = p; j < r; j++) {
  6795. if (comparator(ary[j], pivot) <= 0) {
  6796. i += 1;
  6797. swap(ary, i, j);
  6798. }
  6799. }
  6800. swap(ary, i + 1, j);
  6801. var q = i + 1;
  6802. // (2) Recurse on each half.
  6803. doQuickSort(ary, comparator, p, q - 1);
  6804. doQuickSort(ary, comparator, q + 1, r);
  6805. }
  6806. }
  6807. /**
  6808. * Sort the given array in-place with the given comparator function.
  6809. *
  6810. * @param {Array} ary
  6811. * An array to sort.
  6812. * @param {function} comparator
  6813. * Function to use to compare two items.
  6814. */
  6815. var quickSort_1 = function (ary, comparator) {
  6816. doQuickSort(ary, comparator, 0, ary.length - 1);
  6817. };
  6818. var quickSort$1 = {
  6819. quickSort: quickSort_1
  6820. };
  6821. /* -*- Mode: js; js-indent-level: 2; -*- */
  6822. /*
  6823. * Copyright 2011 Mozilla Foundation and contributors
  6824. * Licensed under the New BSD license. See LICENSE or:
  6825. * http://opensource.org/licenses/BSD-3-Clause
  6826. */
  6827. var ArraySet = arraySet.ArraySet;
  6828. var quickSort = quickSort$1.quickSort;
  6829. function SourceMapConsumer$2(aSourceMap, aSourceMapURL) {
  6830. var sourceMap = aSourceMap;
  6831. if (typeof aSourceMap === 'string') {
  6832. sourceMap = util$1.parseSourceMapInput(aSourceMap);
  6833. }
  6834. return sourceMap.sections != null
  6835. ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
  6836. : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
  6837. }
  6838. SourceMapConsumer$2.fromSourceMap = function(aSourceMap, aSourceMapURL) {
  6839. return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
  6840. };
  6841. /**
  6842. * The version of the source mapping spec that we are consuming.
  6843. */
  6844. SourceMapConsumer$2.prototype._version = 3;
  6845. // `__generatedMappings` and `__originalMappings` are arrays that hold the
  6846. // parsed mapping coordinates from the source map's "mappings" attribute. They
  6847. // are lazily instantiated, accessed via the `_generatedMappings` and
  6848. // `_originalMappings` getters respectively, and we only parse the mappings
  6849. // and create these arrays once queried for a source location. We jump through
  6850. // these hoops because there can be many thousands of mappings, and parsing
  6851. // them is expensive, so we only want to do it if we must.
  6852. //
  6853. // Each object in the arrays is of the form:
  6854. //
  6855. // {
  6856. // generatedLine: The line number in the generated code,
  6857. // generatedColumn: The column number in the generated code,
  6858. // source: The path to the original source file that generated this
  6859. // chunk of code,
  6860. // originalLine: The line number in the original source that
  6861. // corresponds to this chunk of generated code,
  6862. // originalColumn: The column number in the original source that
  6863. // corresponds to this chunk of generated code,
  6864. // name: The name of the original symbol which generated this chunk of
  6865. // code.
  6866. // }
  6867. //
  6868. // All properties except for `generatedLine` and `generatedColumn` can be
  6869. // `null`.
  6870. //
  6871. // `_generatedMappings` is ordered by the generated positions.
  6872. //
  6873. // `_originalMappings` is ordered by the original positions.
  6874. SourceMapConsumer$2.prototype.__generatedMappings = null;
  6875. Object.defineProperty(SourceMapConsumer$2.prototype, '_generatedMappings', {
  6876. configurable: true,
  6877. enumerable: true,
  6878. get: function () {
  6879. if (!this.__generatedMappings) {
  6880. this._parseMappings(this._mappings, this.sourceRoot);
  6881. }
  6882. return this.__generatedMappings;
  6883. }
  6884. });
  6885. SourceMapConsumer$2.prototype.__originalMappings = null;
  6886. Object.defineProperty(SourceMapConsumer$2.prototype, '_originalMappings', {
  6887. configurable: true,
  6888. enumerable: true,
  6889. get: function () {
  6890. if (!this.__originalMappings) {
  6891. this._parseMappings(this._mappings, this.sourceRoot);
  6892. }
  6893. return this.__originalMappings;
  6894. }
  6895. });
  6896. SourceMapConsumer$2.prototype._charIsMappingSeparator =
  6897. function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
  6898. var c = aStr.charAt(index);
  6899. return c === ";" || c === ",";
  6900. };
  6901. /**
  6902. * Parse the mappings in a string in to a data structure which we can easily
  6903. * query (the ordered arrays in the `this.__generatedMappings` and
  6904. * `this.__originalMappings` properties).
  6905. */
  6906. SourceMapConsumer$2.prototype._parseMappings =
  6907. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  6908. throw new Error("Subclasses must implement _parseMappings");
  6909. };
  6910. SourceMapConsumer$2.GENERATED_ORDER = 1;
  6911. SourceMapConsumer$2.ORIGINAL_ORDER = 2;
  6912. SourceMapConsumer$2.GREATEST_LOWER_BOUND = 1;
  6913. SourceMapConsumer$2.LEAST_UPPER_BOUND = 2;
  6914. /**
  6915. * Iterate over each mapping between an original source/line/column and a
  6916. * generated line/column in this source map.
  6917. *
  6918. * @param Function aCallback
  6919. * The function that is called with each mapping.
  6920. * @param Object aContext
  6921. * Optional. If specified, this object will be the value of `this` every
  6922. * time that `aCallback` is called.
  6923. * @param aOrder
  6924. * Either `SourceMapConsumer.GENERATED_ORDER` or
  6925. * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
  6926. * iterate over the mappings sorted by the generated file's line/column
  6927. * order or the original's source/line/column order, respectively. Defaults to
  6928. * `SourceMapConsumer.GENERATED_ORDER`.
  6929. */
  6930. SourceMapConsumer$2.prototype.eachMapping =
  6931. function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
  6932. var context = aContext || null;
  6933. var order = aOrder || SourceMapConsumer$2.GENERATED_ORDER;
  6934. var mappings;
  6935. switch (order) {
  6936. case SourceMapConsumer$2.GENERATED_ORDER:
  6937. mappings = this._generatedMappings;
  6938. break;
  6939. case SourceMapConsumer$2.ORIGINAL_ORDER:
  6940. mappings = this._originalMappings;
  6941. break;
  6942. default:
  6943. throw new Error("Unknown order of iteration.");
  6944. }
  6945. var sourceRoot = this.sourceRoot;
  6946. mappings.map(function (mapping) {
  6947. var source = mapping.source === null ? null : this._sources.at(mapping.source);
  6948. source = util$1.computeSourceURL(sourceRoot, source, this._sourceMapURL);
  6949. return {
  6950. source: source,
  6951. generatedLine: mapping.generatedLine,
  6952. generatedColumn: mapping.generatedColumn,
  6953. originalLine: mapping.originalLine,
  6954. originalColumn: mapping.originalColumn,
  6955. name: mapping.name === null ? null : this._names.at(mapping.name)
  6956. };
  6957. }, this).forEach(aCallback, context);
  6958. };
  6959. /**
  6960. * Returns all generated line and column information for the original source,
  6961. * line, and column provided. If no column is provided, returns all mappings
  6962. * corresponding to a either the line we are searching for or the next
  6963. * closest line that has any mappings. Otherwise, returns all mappings
  6964. * corresponding to the given line and either the column we are searching for
  6965. * or the next closest column that has any offsets.
  6966. *
  6967. * The only argument is an object with the following properties:
  6968. *
  6969. * - source: The filename of the original source.
  6970. * - line: The line number in the original source. The line number is 1-based.
  6971. * - column: Optional. the column number in the original source.
  6972. * The column number is 0-based.
  6973. *
  6974. * and an array of objects is returned, each with the following properties:
  6975. *
  6976. * - line: The line number in the generated source, or null. The
  6977. * line number is 1-based.
  6978. * - column: The column number in the generated source, or null.
  6979. * The column number is 0-based.
  6980. */
  6981. SourceMapConsumer$2.prototype.allGeneratedPositionsFor =
  6982. function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
  6983. var line = util$1.getArg(aArgs, 'line');
  6984. // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
  6985. // returns the index of the closest mapping less than the needle. By
  6986. // setting needle.originalColumn to 0, we thus find the last mapping for
  6987. // the given line, provided such a mapping exists.
  6988. var needle = {
  6989. source: util$1.getArg(aArgs, 'source'),
  6990. originalLine: line,
  6991. originalColumn: util$1.getArg(aArgs, 'column', 0)
  6992. };
  6993. needle.source = this._findSourceIndex(needle.source);
  6994. if (needle.source < 0) {
  6995. return [];
  6996. }
  6997. var mappings = [];
  6998. var index = this._findMapping(needle,
  6999. this._originalMappings,
  7000. "originalLine",
  7001. "originalColumn",
  7002. util$1.compareByOriginalPositions,
  7003. binarySearch.LEAST_UPPER_BOUND);
  7004. if (index >= 0) {
  7005. var mapping = this._originalMappings[index];
  7006. if (aArgs.column === undefined) {
  7007. var originalLine = mapping.originalLine;
  7008. // Iterate until either we run out of mappings, or we run into
  7009. // a mapping for a different line than the one we found. Since
  7010. // mappings are sorted, this is guaranteed to find all mappings for
  7011. // the line we found.
  7012. while (mapping && mapping.originalLine === originalLine) {
  7013. mappings.push({
  7014. line: util$1.getArg(mapping, 'generatedLine', null),
  7015. column: util$1.getArg(mapping, 'generatedColumn', null),
  7016. lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
  7017. });
  7018. mapping = this._originalMappings[++index];
  7019. }
  7020. } else {
  7021. var originalColumn = mapping.originalColumn;
  7022. // Iterate until either we run out of mappings, or we run into
  7023. // a mapping for a different line than the one we were searching for.
  7024. // Since mappings are sorted, this is guaranteed to find all mappings for
  7025. // the line we are searching for.
  7026. while (mapping &&
  7027. mapping.originalLine === line &&
  7028. mapping.originalColumn == originalColumn) {
  7029. mappings.push({
  7030. line: util$1.getArg(mapping, 'generatedLine', null),
  7031. column: util$1.getArg(mapping, 'generatedColumn', null),
  7032. lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
  7033. });
  7034. mapping = this._originalMappings[++index];
  7035. }
  7036. }
  7037. }
  7038. return mappings;
  7039. };
  7040. var SourceMapConsumer_1 = SourceMapConsumer$2;
  7041. /**
  7042. * A BasicSourceMapConsumer instance represents a parsed source map which we can
  7043. * query for information about the original file positions by giving it a file
  7044. * position in the generated source.
  7045. *
  7046. * The first parameter is the raw source map (either as a JSON string, or
  7047. * already parsed to an object). According to the spec, source maps have the
  7048. * following attributes:
  7049. *
  7050. * - version: Which version of the source map spec this map is following.
  7051. * - sources: An array of URLs to the original source files.
  7052. * - names: An array of identifiers which can be referrenced by individual mappings.
  7053. * - sourceRoot: Optional. The URL root from which all sources are relative.
  7054. * - sourcesContent: Optional. An array of contents of the original source files.
  7055. * - mappings: A string of base64 VLQs which contain the actual mappings.
  7056. * - file: Optional. The generated file this source map is associated with.
  7057. *
  7058. * Here is an example source map, taken from the source map spec[0]:
  7059. *
  7060. * {
  7061. * version : 3,
  7062. * file: "out.js",
  7063. * sourceRoot : "",
  7064. * sources: ["foo.js", "bar.js"],
  7065. * names: ["src", "maps", "are", "fun"],
  7066. * mappings: "AA,AB;;ABCDE;"
  7067. * }
  7068. *
  7069. * The second parameter, if given, is a string whose value is the URL
  7070. * at which the source map was found. This URL is used to compute the
  7071. * sources array.
  7072. *
  7073. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
  7074. */
  7075. function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
  7076. var sourceMap = aSourceMap;
  7077. if (typeof aSourceMap === 'string') {
  7078. sourceMap = util$1.parseSourceMapInput(aSourceMap);
  7079. }
  7080. var version = util$1.getArg(sourceMap, 'version');
  7081. var sources = util$1.getArg(sourceMap, 'sources');
  7082. // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  7083. // requires the array) to play nice here.
  7084. var names = util$1.getArg(sourceMap, 'names', []);
  7085. var sourceRoot = util$1.getArg(sourceMap, 'sourceRoot', null);
  7086. var sourcesContent = util$1.getArg(sourceMap, 'sourcesContent', null);
  7087. var mappings = util$1.getArg(sourceMap, 'mappings');
  7088. var file = util$1.getArg(sourceMap, 'file', null);
  7089. // Once again, Sass deviates from the spec and supplies the version as a
  7090. // string rather than a number, so we use loose equality checking here.
  7091. if (version != this._version) {
  7092. throw new Error('Unsupported version: ' + version);
  7093. }
  7094. if (sourceRoot) {
  7095. sourceRoot = util$1.normalize(sourceRoot);
  7096. }
  7097. sources = sources
  7098. .map(String)
  7099. // Some source maps produce relative source paths like "./foo.js" instead of
  7100. // "foo.js". Normalize these first so that future comparisons will succeed.
  7101. // See bugzil.la/1090768.
  7102. .map(util$1.normalize)
  7103. // Always ensure that absolute sources are internally stored relative to
  7104. // the source root, if the source root is absolute. Not doing this would
  7105. // be particularly problematic when the source root is a prefix of the
  7106. // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  7107. .map(function (source) {
  7108. return sourceRoot && util$1.isAbsolute(sourceRoot) && util$1.isAbsolute(source)
  7109. ? util$1.relative(sourceRoot, source)
  7110. : source;
  7111. });
  7112. // Pass `true` below to allow duplicate names and sources. While source maps
  7113. // are intended to be compressed and deduplicated, the TypeScript compiler
  7114. // sometimes generates source maps with duplicates in them. See Github issue
  7115. // #72 and bugzil.la/889492.
  7116. this._names = ArraySet.fromArray(names.map(String), true);
  7117. this._sources = ArraySet.fromArray(sources, true);
  7118. this._absoluteSources = this._sources.toArray().map(function (s) {
  7119. return util$1.computeSourceURL(sourceRoot, s, aSourceMapURL);
  7120. });
  7121. this.sourceRoot = sourceRoot;
  7122. this.sourcesContent = sourcesContent;
  7123. this._mappings = mappings;
  7124. this._sourceMapURL = aSourceMapURL;
  7125. this.file = file;
  7126. }
  7127. BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer$2.prototype);
  7128. BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$2;
  7129. /**
  7130. * Utility function to find the index of a source. Returns -1 if not
  7131. * found.
  7132. */
  7133. BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
  7134. var relativeSource = aSource;
  7135. if (this.sourceRoot != null) {
  7136. relativeSource = util$1.relative(this.sourceRoot, relativeSource);
  7137. }
  7138. if (this._sources.has(relativeSource)) {
  7139. return this._sources.indexOf(relativeSource);
  7140. }
  7141. // Maybe aSource is an absolute URL as returned by |sources|. In
  7142. // this case we can't simply undo the transform.
  7143. var i;
  7144. for (i = 0; i < this._absoluteSources.length; ++i) {
  7145. if (this._absoluteSources[i] == aSource) {
  7146. return i;
  7147. }
  7148. }
  7149. return -1;
  7150. };
  7151. /**
  7152. * Create a BasicSourceMapConsumer from a SourceMapGenerator.
  7153. *
  7154. * @param SourceMapGenerator aSourceMap
  7155. * The source map that will be consumed.
  7156. * @param String aSourceMapURL
  7157. * The URL at which the source map can be found (optional)
  7158. * @returns BasicSourceMapConsumer
  7159. */
  7160. BasicSourceMapConsumer.fromSourceMap =
  7161. function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
  7162. var smc = Object.create(BasicSourceMapConsumer.prototype);
  7163. var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
  7164. var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
  7165. smc.sourceRoot = aSourceMap._sourceRoot;
  7166. smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
  7167. smc.sourceRoot);
  7168. smc.file = aSourceMap._file;
  7169. smc._sourceMapURL = aSourceMapURL;
  7170. smc._absoluteSources = smc._sources.toArray().map(function (s) {
  7171. return util$1.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
  7172. });
  7173. // Because we are modifying the entries (by converting string sources and
  7174. // names to indices into the sources and names ArraySets), we have to make
  7175. // a copy of the entry or else bad things happen. Shared mutable state
  7176. // strikes again! See github issue #191.
  7177. var generatedMappings = aSourceMap._mappings.toArray().slice();
  7178. var destGeneratedMappings = smc.__generatedMappings = [];
  7179. var destOriginalMappings = smc.__originalMappings = [];
  7180. for (var i = 0, length = generatedMappings.length; i < length; i++) {
  7181. var srcMapping = generatedMappings[i];
  7182. var destMapping = new Mapping;
  7183. destMapping.generatedLine = srcMapping.generatedLine;
  7184. destMapping.generatedColumn = srcMapping.generatedColumn;
  7185. if (srcMapping.source) {
  7186. destMapping.source = sources.indexOf(srcMapping.source);
  7187. destMapping.originalLine = srcMapping.originalLine;
  7188. destMapping.originalColumn = srcMapping.originalColumn;
  7189. if (srcMapping.name) {
  7190. destMapping.name = names.indexOf(srcMapping.name);
  7191. }
  7192. destOriginalMappings.push(destMapping);
  7193. }
  7194. destGeneratedMappings.push(destMapping);
  7195. }
  7196. quickSort(smc.__originalMappings, util$1.compareByOriginalPositions);
  7197. return smc;
  7198. };
  7199. /**
  7200. * The version of the source mapping spec that we are consuming.
  7201. */
  7202. BasicSourceMapConsumer.prototype._version = 3;
  7203. /**
  7204. * The list of original sources.
  7205. */
  7206. Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
  7207. get: function () {
  7208. return this._absoluteSources.slice();
  7209. }
  7210. });
  7211. /**
  7212. * Provide the JIT with a nice shape / hidden class.
  7213. */
  7214. function Mapping() {
  7215. this.generatedLine = 0;
  7216. this.generatedColumn = 0;
  7217. this.source = null;
  7218. this.originalLine = null;
  7219. this.originalColumn = null;
  7220. this.name = null;
  7221. }
  7222. /**
  7223. * Parse the mappings in a string in to a data structure which we can easily
  7224. * query (the ordered arrays in the `this.__generatedMappings` and
  7225. * `this.__originalMappings` properties).
  7226. */
  7227. BasicSourceMapConsumer.prototype._parseMappings =
  7228. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  7229. var generatedLine = 1;
  7230. var previousGeneratedColumn = 0;
  7231. var previousOriginalLine = 0;
  7232. var previousOriginalColumn = 0;
  7233. var previousSource = 0;
  7234. var previousName = 0;
  7235. var length = aStr.length;
  7236. var index = 0;
  7237. var cachedSegments = {};
  7238. var temp = {};
  7239. var originalMappings = [];
  7240. var generatedMappings = [];
  7241. var mapping, str, segment, end, value;
  7242. while (index < length) {
  7243. if (aStr.charAt(index) === ';') {
  7244. generatedLine++;
  7245. index++;
  7246. previousGeneratedColumn = 0;
  7247. }
  7248. else if (aStr.charAt(index) === ',') {
  7249. index++;
  7250. }
  7251. else {
  7252. mapping = new Mapping();
  7253. mapping.generatedLine = generatedLine;
  7254. // Because each offset is encoded relative to the previous one,
  7255. // many segments often have the same encoding. We can exploit this
  7256. // fact by caching the parsed variable length fields of each segment,
  7257. // allowing us to avoid a second parse if we encounter the same
  7258. // segment again.
  7259. for (end = index; end < length; end++) {
  7260. if (this._charIsMappingSeparator(aStr, end)) {
  7261. break;
  7262. }
  7263. }
  7264. str = aStr.slice(index, end);
  7265. segment = cachedSegments[str];
  7266. if (segment) {
  7267. index += str.length;
  7268. } else {
  7269. segment = [];
  7270. while (index < end) {
  7271. base64Vlq.decode(aStr, index, temp);
  7272. value = temp.value;
  7273. index = temp.rest;
  7274. segment.push(value);
  7275. }
  7276. if (segment.length === 2) {
  7277. throw new Error('Found a source, but no line and column');
  7278. }
  7279. if (segment.length === 3) {
  7280. throw new Error('Found a source and line, but no column');
  7281. }
  7282. cachedSegments[str] = segment;
  7283. }
  7284. // Generated column.
  7285. mapping.generatedColumn = previousGeneratedColumn + segment[0];
  7286. previousGeneratedColumn = mapping.generatedColumn;
  7287. if (segment.length > 1) {
  7288. // Original source.
  7289. mapping.source = previousSource + segment[1];
  7290. previousSource += segment[1];
  7291. // Original line.
  7292. mapping.originalLine = previousOriginalLine + segment[2];
  7293. previousOriginalLine = mapping.originalLine;
  7294. // Lines are stored 0-based
  7295. mapping.originalLine += 1;
  7296. // Original column.
  7297. mapping.originalColumn = previousOriginalColumn + segment[3];
  7298. previousOriginalColumn = mapping.originalColumn;
  7299. if (segment.length > 4) {
  7300. // Original name.
  7301. mapping.name = previousName + segment[4];
  7302. previousName += segment[4];
  7303. }
  7304. }
  7305. generatedMappings.push(mapping);
  7306. if (typeof mapping.originalLine === 'number') {
  7307. originalMappings.push(mapping);
  7308. }
  7309. }
  7310. }
  7311. quickSort(generatedMappings, util$1.compareByGeneratedPositionsDeflated);
  7312. this.__generatedMappings = generatedMappings;
  7313. quickSort(originalMappings, util$1.compareByOriginalPositions);
  7314. this.__originalMappings = originalMappings;
  7315. };
  7316. /**
  7317. * Find the mapping that best matches the hypothetical "needle" mapping that
  7318. * we are searching for in the given "haystack" of mappings.
  7319. */
  7320. BasicSourceMapConsumer.prototype._findMapping =
  7321. function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
  7322. aColumnName, aComparator, aBias) {
  7323. // To return the position we are searching for, we must first find the
  7324. // mapping for the given position and then return the opposite position it
  7325. // points to. Because the mappings are sorted, we can use binary search to
  7326. // find the best mapping.
  7327. if (aNeedle[aLineName] <= 0) {
  7328. throw new TypeError('Line must be greater than or equal to 1, got '
  7329. + aNeedle[aLineName]);
  7330. }
  7331. if (aNeedle[aColumnName] < 0) {
  7332. throw new TypeError('Column must be greater than or equal to 0, got '
  7333. + aNeedle[aColumnName]);
  7334. }
  7335. return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
  7336. };
  7337. /**
  7338. * Compute the last column for each generated mapping. The last column is
  7339. * inclusive.
  7340. */
  7341. BasicSourceMapConsumer.prototype.computeColumnSpans =
  7342. function SourceMapConsumer_computeColumnSpans() {
  7343. for (var index = 0; index < this._generatedMappings.length; ++index) {
  7344. var mapping = this._generatedMappings[index];
  7345. // Mappings do not contain a field for the last generated columnt. We
  7346. // can come up with an optimistic estimate, however, by assuming that
  7347. // mappings are contiguous (i.e. given two consecutive mappings, the
  7348. // first mapping ends where the second one starts).
  7349. if (index + 1 < this._generatedMappings.length) {
  7350. var nextMapping = this._generatedMappings[index + 1];
  7351. if (mapping.generatedLine === nextMapping.generatedLine) {
  7352. mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
  7353. continue;
  7354. }
  7355. }
  7356. // The last mapping for each line spans the entire line.
  7357. mapping.lastGeneratedColumn = Infinity;
  7358. }
  7359. };
  7360. /**
  7361. * Returns the original source, line, and column information for the generated
  7362. * source's line and column positions provided. The only argument is an object
  7363. * with the following properties:
  7364. *
  7365. * - line: The line number in the generated source. The line number
  7366. * is 1-based.
  7367. * - column: The column number in the generated source. The column
  7368. * number is 0-based.
  7369. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  7370. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  7371. * closest element that is smaller than or greater than the one we are
  7372. * searching for, respectively, if the exact element cannot be found.
  7373. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  7374. *
  7375. * and an object is returned with the following properties:
  7376. *
  7377. * - source: The original source file, or null.
  7378. * - line: The line number in the original source, or null. The
  7379. * line number is 1-based.
  7380. * - column: The column number in the original source, or null. The
  7381. * column number is 0-based.
  7382. * - name: The original identifier, or null.
  7383. */
  7384. BasicSourceMapConsumer.prototype.originalPositionFor =
  7385. function SourceMapConsumer_originalPositionFor(aArgs) {
  7386. var needle = {
  7387. generatedLine: util$1.getArg(aArgs, 'line'),
  7388. generatedColumn: util$1.getArg(aArgs, 'column')
  7389. };
  7390. var index = this._findMapping(
  7391. needle,
  7392. this._generatedMappings,
  7393. "generatedLine",
  7394. "generatedColumn",
  7395. util$1.compareByGeneratedPositionsDeflated,
  7396. util$1.getArg(aArgs, 'bias', SourceMapConsumer$2.GREATEST_LOWER_BOUND)
  7397. );
  7398. if (index >= 0) {
  7399. var mapping = this._generatedMappings[index];
  7400. if (mapping.generatedLine === needle.generatedLine) {
  7401. var source = util$1.getArg(mapping, 'source', null);
  7402. if (source !== null) {
  7403. source = this._sources.at(source);
  7404. source = util$1.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
  7405. }
  7406. var name = util$1.getArg(mapping, 'name', null);
  7407. if (name !== null) {
  7408. name = this._names.at(name);
  7409. }
  7410. return {
  7411. source: source,
  7412. line: util$1.getArg(mapping, 'originalLine', null),
  7413. column: util$1.getArg(mapping, 'originalColumn', null),
  7414. name: name
  7415. };
  7416. }
  7417. }
  7418. return {
  7419. source: null,
  7420. line: null,
  7421. column: null,
  7422. name: null
  7423. };
  7424. };
  7425. /**
  7426. * Return true if we have the source content for every source in the source
  7427. * map, false otherwise.
  7428. */
  7429. BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
  7430. function BasicSourceMapConsumer_hasContentsOfAllSources() {
  7431. if (!this.sourcesContent) {
  7432. return false;
  7433. }
  7434. return this.sourcesContent.length >= this._sources.size() &&
  7435. !this.sourcesContent.some(function (sc) { return sc == null; });
  7436. };
  7437. /**
  7438. * Returns the original source content. The only argument is the url of the
  7439. * original source file. Returns null if no original source content is
  7440. * available.
  7441. */
  7442. BasicSourceMapConsumer.prototype.sourceContentFor =
  7443. function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  7444. if (!this.sourcesContent) {
  7445. return null;
  7446. }
  7447. var index = this._findSourceIndex(aSource);
  7448. if (index >= 0) {
  7449. return this.sourcesContent[index];
  7450. }
  7451. var relativeSource = aSource;
  7452. if (this.sourceRoot != null) {
  7453. relativeSource = util$1.relative(this.sourceRoot, relativeSource);
  7454. }
  7455. var url;
  7456. if (this.sourceRoot != null
  7457. && (url = util$1.urlParse(this.sourceRoot))) {
  7458. // XXX: file:// URIs and absolute paths lead to unexpected behavior for
  7459. // many users. We can help them out when they expect file:// URIs to
  7460. // behave like it would if they were running a local HTTP server. See
  7461. // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
  7462. var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
  7463. if (url.scheme == "file"
  7464. && this._sources.has(fileUriAbsPath)) {
  7465. return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
  7466. }
  7467. if ((!url.path || url.path == "/")
  7468. && this._sources.has("/" + relativeSource)) {
  7469. return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
  7470. }
  7471. }
  7472. // This function is used recursively from
  7473. // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
  7474. // don't want to throw if we can't find the source - we just want to
  7475. // return null, so we provide a flag to exit gracefully.
  7476. if (nullOnMissing) {
  7477. return null;
  7478. }
  7479. else {
  7480. throw new Error('"' + relativeSource + '" is not in the SourceMap.');
  7481. }
  7482. };
  7483. /**
  7484. * Returns the generated line and column information for the original source,
  7485. * line, and column positions provided. The only argument is an object with
  7486. * the following properties:
  7487. *
  7488. * - source: The filename of the original source.
  7489. * - line: The line number in the original source. The line number
  7490. * is 1-based.
  7491. * - column: The column number in the original source. The column
  7492. * number is 0-based.
  7493. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  7494. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  7495. * closest element that is smaller than or greater than the one we are
  7496. * searching for, respectively, if the exact element cannot be found.
  7497. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  7498. *
  7499. * and an object is returned with the following properties:
  7500. *
  7501. * - line: The line number in the generated source, or null. The
  7502. * line number is 1-based.
  7503. * - column: The column number in the generated source, or null.
  7504. * The column number is 0-based.
  7505. */
  7506. BasicSourceMapConsumer.prototype.generatedPositionFor =
  7507. function SourceMapConsumer_generatedPositionFor(aArgs) {
  7508. var source = util$1.getArg(aArgs, 'source');
  7509. source = this._findSourceIndex(source);
  7510. if (source < 0) {
  7511. return {
  7512. line: null,
  7513. column: null,
  7514. lastColumn: null
  7515. };
  7516. }
  7517. var needle = {
  7518. source: source,
  7519. originalLine: util$1.getArg(aArgs, 'line'),
  7520. originalColumn: util$1.getArg(aArgs, 'column')
  7521. };
  7522. var index = this._findMapping(
  7523. needle,
  7524. this._originalMappings,
  7525. "originalLine",
  7526. "originalColumn",
  7527. util$1.compareByOriginalPositions,
  7528. util$1.getArg(aArgs, 'bias', SourceMapConsumer$2.GREATEST_LOWER_BOUND)
  7529. );
  7530. if (index >= 0) {
  7531. var mapping = this._originalMappings[index];
  7532. if (mapping.source === needle.source) {
  7533. return {
  7534. line: util$1.getArg(mapping, 'generatedLine', null),
  7535. column: util$1.getArg(mapping, 'generatedColumn', null),
  7536. lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
  7537. };
  7538. }
  7539. }
  7540. return {
  7541. line: null,
  7542. column: null,
  7543. lastColumn: null
  7544. };
  7545. };
  7546. var BasicSourceMapConsumer_1 = BasicSourceMapConsumer;
  7547. /**
  7548. * An IndexedSourceMapConsumer instance represents a parsed source map which
  7549. * we can query for information. It differs from BasicSourceMapConsumer in
  7550. * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
  7551. * input.
  7552. *
  7553. * The first parameter is a raw source map (either as a JSON string, or already
  7554. * parsed to an object). According to the spec for indexed source maps, they
  7555. * have the following attributes:
  7556. *
  7557. * - version: Which version of the source map spec this map is following.
  7558. * - file: Optional. The generated file this source map is associated with.
  7559. * - sections: A list of section definitions.
  7560. *
  7561. * Each value under the "sections" field has two fields:
  7562. * - offset: The offset into the original specified at which this section
  7563. * begins to apply, defined as an object with a "line" and "column"
  7564. * field.
  7565. * - map: A source map definition. This source map could also be indexed,
  7566. * but doesn't have to be.
  7567. *
  7568. * Instead of the "map" field, it's also possible to have a "url" field
  7569. * specifying a URL to retrieve a source map from, but that's currently
  7570. * unsupported.
  7571. *
  7572. * Here's an example source map, taken from the source map spec[0], but
  7573. * modified to omit a section which uses the "url" field.
  7574. *
  7575. * {
  7576. * version : 3,
  7577. * file: "app.js",
  7578. * sections: [{
  7579. * offset: {line:100, column:10},
  7580. * map: {
  7581. * version : 3,
  7582. * file: "section.js",
  7583. * sources: ["foo.js", "bar.js"],
  7584. * names: ["src", "maps", "are", "fun"],
  7585. * mappings: "AAAA,E;;ABCDE;"
  7586. * }
  7587. * }],
  7588. * }
  7589. *
  7590. * The second parameter, if given, is a string whose value is the URL
  7591. * at which the source map was found. This URL is used to compute the
  7592. * sources array.
  7593. *
  7594. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
  7595. */
  7596. function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
  7597. var sourceMap = aSourceMap;
  7598. if (typeof aSourceMap === 'string') {
  7599. sourceMap = util$1.parseSourceMapInput(aSourceMap);
  7600. }
  7601. var version = util$1.getArg(sourceMap, 'version');
  7602. var sections = util$1.getArg(sourceMap, 'sections');
  7603. if (version != this._version) {
  7604. throw new Error('Unsupported version: ' + version);
  7605. }
  7606. this._sources = new ArraySet();
  7607. this._names = new ArraySet();
  7608. var lastOffset = {
  7609. line: -1,
  7610. column: 0
  7611. };
  7612. this._sections = sections.map(function (s) {
  7613. if (s.url) {
  7614. // The url field will require support for asynchronicity.
  7615. // See https://github.com/mozilla/source-map/issues/16
  7616. throw new Error('Support for url field in sections not implemented.');
  7617. }
  7618. var offset = util$1.getArg(s, 'offset');
  7619. var offsetLine = util$1.getArg(offset, 'line');
  7620. var offsetColumn = util$1.getArg(offset, 'column');
  7621. if (offsetLine < lastOffset.line ||
  7622. (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
  7623. throw new Error('Section offsets must be ordered and non-overlapping.');
  7624. }
  7625. lastOffset = offset;
  7626. return {
  7627. generatedOffset: {
  7628. // The offset fields are 0-based, but we use 1-based indices when
  7629. // encoding/decoding from VLQ.
  7630. generatedLine: offsetLine + 1,
  7631. generatedColumn: offsetColumn + 1
  7632. },
  7633. consumer: new SourceMapConsumer$2(util$1.getArg(s, 'map'), aSourceMapURL)
  7634. }
  7635. });
  7636. }
  7637. IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer$2.prototype);
  7638. IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer$2;
  7639. /**
  7640. * The version of the source mapping spec that we are consuming.
  7641. */
  7642. IndexedSourceMapConsumer.prototype._version = 3;
  7643. /**
  7644. * The list of original sources.
  7645. */
  7646. Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
  7647. get: function () {
  7648. var sources = [];
  7649. for (var i = 0; i < this._sections.length; i++) {
  7650. for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
  7651. sources.push(this._sections[i].consumer.sources[j]);
  7652. }
  7653. }
  7654. return sources;
  7655. }
  7656. });
  7657. /**
  7658. * Returns the original source, line, and column information for the generated
  7659. * source's line and column positions provided. The only argument is an object
  7660. * with the following properties:
  7661. *
  7662. * - line: The line number in the generated source. The line number
  7663. * is 1-based.
  7664. * - column: The column number in the generated source. The column
  7665. * number is 0-based.
  7666. *
  7667. * and an object is returned with the following properties:
  7668. *
  7669. * - source: The original source file, or null.
  7670. * - line: The line number in the original source, or null. The
  7671. * line number is 1-based.
  7672. * - column: The column number in the original source, or null. The
  7673. * column number is 0-based.
  7674. * - name: The original identifier, or null.
  7675. */
  7676. IndexedSourceMapConsumer.prototype.originalPositionFor =
  7677. function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
  7678. var needle = {
  7679. generatedLine: util$1.getArg(aArgs, 'line'),
  7680. generatedColumn: util$1.getArg(aArgs, 'column')
  7681. };
  7682. // Find the section containing the generated position we're trying to map
  7683. // to an original position.
  7684. var sectionIndex = binarySearch.search(needle, this._sections,
  7685. function(needle, section) {
  7686. var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
  7687. if (cmp) {
  7688. return cmp;
  7689. }
  7690. return (needle.generatedColumn -
  7691. section.generatedOffset.generatedColumn);
  7692. });
  7693. var section = this._sections[sectionIndex];
  7694. if (!section) {
  7695. return {
  7696. source: null,
  7697. line: null,
  7698. column: null,
  7699. name: null
  7700. };
  7701. }
  7702. return section.consumer.originalPositionFor({
  7703. line: needle.generatedLine -
  7704. (section.generatedOffset.generatedLine - 1),
  7705. column: needle.generatedColumn -
  7706. (section.generatedOffset.generatedLine === needle.generatedLine
  7707. ? section.generatedOffset.generatedColumn - 1
  7708. : 0),
  7709. bias: aArgs.bias
  7710. });
  7711. };
  7712. /**
  7713. * Return true if we have the source content for every source in the source
  7714. * map, false otherwise.
  7715. */
  7716. IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
  7717. function IndexedSourceMapConsumer_hasContentsOfAllSources() {
  7718. return this._sections.every(function (s) {
  7719. return s.consumer.hasContentsOfAllSources();
  7720. });
  7721. };
  7722. /**
  7723. * Returns the original source content. The only argument is the url of the
  7724. * original source file. Returns null if no original source content is
  7725. * available.
  7726. */
  7727. IndexedSourceMapConsumer.prototype.sourceContentFor =
  7728. function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  7729. for (var i = 0; i < this._sections.length; i++) {
  7730. var section = this._sections[i];
  7731. var content = section.consumer.sourceContentFor(aSource, true);
  7732. if (content) {
  7733. return content;
  7734. }
  7735. }
  7736. if (nullOnMissing) {
  7737. return null;
  7738. }
  7739. else {
  7740. throw new Error('"' + aSource + '" is not in the SourceMap.');
  7741. }
  7742. };
  7743. /**
  7744. * Returns the generated line and column information for the original source,
  7745. * line, and column positions provided. The only argument is an object with
  7746. * the following properties:
  7747. *
  7748. * - source: The filename of the original source.
  7749. * - line: The line number in the original source. The line number
  7750. * is 1-based.
  7751. * - column: The column number in the original source. The column
  7752. * number is 0-based.
  7753. *
  7754. * and an object is returned with the following properties:
  7755. *
  7756. * - line: The line number in the generated source, or null. The
  7757. * line number is 1-based.
  7758. * - column: The column number in the generated source, or null.
  7759. * The column number is 0-based.
  7760. */
  7761. IndexedSourceMapConsumer.prototype.generatedPositionFor =
  7762. function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
  7763. for (var i = 0; i < this._sections.length; i++) {
  7764. var section = this._sections[i];
  7765. // Only consider this section if the requested source is in the list of
  7766. // sources of the consumer.
  7767. if (section.consumer._findSourceIndex(util$1.getArg(aArgs, 'source')) === -1) {
  7768. continue;
  7769. }
  7770. var generatedPosition = section.consumer.generatedPositionFor(aArgs);
  7771. if (generatedPosition) {
  7772. var ret = {
  7773. line: generatedPosition.line +
  7774. (section.generatedOffset.generatedLine - 1),
  7775. column: generatedPosition.column +
  7776. (section.generatedOffset.generatedLine === generatedPosition.line
  7777. ? section.generatedOffset.generatedColumn - 1
  7778. : 0)
  7779. };
  7780. return ret;
  7781. }
  7782. }
  7783. return {
  7784. line: null,
  7785. column: null
  7786. };
  7787. };
  7788. /**
  7789. * Parse the mappings in a string in to a data structure which we can easily
  7790. * query (the ordered arrays in the `this.__generatedMappings` and
  7791. * `this.__originalMappings` properties).
  7792. */
  7793. IndexedSourceMapConsumer.prototype._parseMappings =
  7794. function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  7795. this.__generatedMappings = [];
  7796. this.__originalMappings = [];
  7797. for (var i = 0; i < this._sections.length; i++) {
  7798. var section = this._sections[i];
  7799. var sectionMappings = section.consumer._generatedMappings;
  7800. for (var j = 0; j < sectionMappings.length; j++) {
  7801. var mapping = sectionMappings[j];
  7802. var source = section.consumer._sources.at(mapping.source);
  7803. source = util$1.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
  7804. this._sources.add(source);
  7805. source = this._sources.indexOf(source);
  7806. var name = null;
  7807. if (mapping.name) {
  7808. name = section.consumer._names.at(mapping.name);
  7809. this._names.add(name);
  7810. name = this._names.indexOf(name);
  7811. }
  7812. // The mappings coming from the consumer for the section have
  7813. // generated positions relative to the start of the section, so we
  7814. // need to offset them to be relative to the start of the concatenated
  7815. // generated file.
  7816. var adjustedMapping = {
  7817. source: source,
  7818. generatedLine: mapping.generatedLine +
  7819. (section.generatedOffset.generatedLine - 1),
  7820. generatedColumn: mapping.generatedColumn +
  7821. (section.generatedOffset.generatedLine === mapping.generatedLine
  7822. ? section.generatedOffset.generatedColumn - 1
  7823. : 0),
  7824. originalLine: mapping.originalLine,
  7825. originalColumn: mapping.originalColumn,
  7826. name: name
  7827. };
  7828. this.__generatedMappings.push(adjustedMapping);
  7829. if (typeof adjustedMapping.originalLine === 'number') {
  7830. this.__originalMappings.push(adjustedMapping);
  7831. }
  7832. }
  7833. }
  7834. quickSort(this.__generatedMappings, util$1.compareByGeneratedPositionsDeflated);
  7835. quickSort(this.__originalMappings, util$1.compareByOriginalPositions);
  7836. };
  7837. var IndexedSourceMapConsumer_1 = IndexedSourceMapConsumer;
  7838. var sourceMapConsumer = {
  7839. SourceMapConsumer: SourceMapConsumer_1,
  7840. BasicSourceMapConsumer: BasicSourceMapConsumer_1,
  7841. IndexedSourceMapConsumer: IndexedSourceMapConsumer_1
  7842. };
  7843. /* -*- Mode: js; js-indent-level: 2; -*- */
  7844. /*
  7845. * Copyright 2011 Mozilla Foundation and contributors
  7846. * Licensed under the New BSD license. See LICENSE or:
  7847. * http://opensource.org/licenses/BSD-3-Clause
  7848. */
  7849. var SourceMapGenerator$2 = sourceMapGenerator.SourceMapGenerator;
  7850. // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
  7851. // operating systems these days (capturing the result).
  7852. var REGEX_NEWLINE = /(\r?\n)/;
  7853. // Newline character code for charCodeAt() comparisons
  7854. var NEWLINE_CODE = 10;
  7855. // Private symbol for identifying `SourceNode`s when multiple versions of
  7856. // the source-map library are loaded. This MUST NOT CHANGE across
  7857. // versions!
  7858. var isSourceNode = "$$$isSourceNode$$$";
  7859. /**
  7860. * SourceNodes provide a way to abstract over interpolating/concatenating
  7861. * snippets of generated JavaScript source code while maintaining the line and
  7862. * column information associated with the original source code.
  7863. *
  7864. * @param aLine The original line number.
  7865. * @param aColumn The original column number.
  7866. * @param aSource The original source's filename.
  7867. * @param aChunks Optional. An array of strings which are snippets of
  7868. * generated JS, or other SourceNodes.
  7869. * @param aName The original identifier.
  7870. */
  7871. function SourceNode$1(aLine, aColumn, aSource, aChunks, aName) {
  7872. this.children = [];
  7873. this.sourceContents = {};
  7874. this.line = aLine == null ? null : aLine;
  7875. this.column = aColumn == null ? null : aColumn;
  7876. this.source = aSource == null ? null : aSource;
  7877. this.name = aName == null ? null : aName;
  7878. this[isSourceNode] = true;
  7879. if (aChunks != null) this.add(aChunks);
  7880. }
  7881. /**
  7882. * Creates a SourceNode from generated code and a SourceMapConsumer.
  7883. *
  7884. * @param aGeneratedCode The generated code
  7885. * @param aSourceMapConsumer The SourceMap for the generated code
  7886. * @param aRelativePath Optional. The path that relative sources in the
  7887. * SourceMapConsumer should be relative to.
  7888. */
  7889. SourceNode$1.fromStringWithSourceMap =
  7890. function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
  7891. // The SourceNode we want to fill with the generated code
  7892. // and the SourceMap
  7893. var node = new SourceNode$1();
  7894. // All even indices of this array are one line of the generated code,
  7895. // while all odd indices are the newlines between two adjacent lines
  7896. // (since `REGEX_NEWLINE` captures its match).
  7897. // Processed fragments are accessed by calling `shiftNextLine`.
  7898. var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
  7899. var remainingLinesIndex = 0;
  7900. var shiftNextLine = function() {
  7901. var lineContents = getNextLine();
  7902. // The last line of a file might not have a newline.
  7903. var newLine = getNextLine() || "";
  7904. return lineContents + newLine;
  7905. function getNextLine() {
  7906. return remainingLinesIndex < remainingLines.length ?
  7907. remainingLines[remainingLinesIndex++] : undefined;
  7908. }
  7909. };
  7910. // We need to remember the position of "remainingLines"
  7911. var lastGeneratedLine = 1, lastGeneratedColumn = 0;
  7912. // The generate SourceNodes we need a code range.
  7913. // To extract it current and last mapping is used.
  7914. // Here we store the last mapping.
  7915. var lastMapping = null;
  7916. aSourceMapConsumer.eachMapping(function (mapping) {
  7917. if (lastMapping !== null) {
  7918. // We add the code from "lastMapping" to "mapping":
  7919. // First check if there is a new line in between.
  7920. if (lastGeneratedLine < mapping.generatedLine) {
  7921. // Associate first line with "lastMapping"
  7922. addMappingWithCode(lastMapping, shiftNextLine());
  7923. lastGeneratedLine++;
  7924. lastGeneratedColumn = 0;
  7925. // The remaining code is added without mapping
  7926. } else {
  7927. // There is no new line in between.
  7928. // Associate the code between "lastGeneratedColumn" and
  7929. // "mapping.generatedColumn" with "lastMapping"
  7930. var nextLine = remainingLines[remainingLinesIndex] || '';
  7931. var code = nextLine.substr(0, mapping.generatedColumn -
  7932. lastGeneratedColumn);
  7933. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
  7934. lastGeneratedColumn);
  7935. lastGeneratedColumn = mapping.generatedColumn;
  7936. addMappingWithCode(lastMapping, code);
  7937. // No more remaining code, continue
  7938. lastMapping = mapping;
  7939. return;
  7940. }
  7941. }
  7942. // We add the generated code until the first mapping
  7943. // to the SourceNode without any mapping.
  7944. // Each line is added as separate string.
  7945. while (lastGeneratedLine < mapping.generatedLine) {
  7946. node.add(shiftNextLine());
  7947. lastGeneratedLine++;
  7948. }
  7949. if (lastGeneratedColumn < mapping.generatedColumn) {
  7950. var nextLine = remainingLines[remainingLinesIndex] || '';
  7951. node.add(nextLine.substr(0, mapping.generatedColumn));
  7952. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
  7953. lastGeneratedColumn = mapping.generatedColumn;
  7954. }
  7955. lastMapping = mapping;
  7956. }, this);
  7957. // We have processed all mappings.
  7958. if (remainingLinesIndex < remainingLines.length) {
  7959. if (lastMapping) {
  7960. // Associate the remaining code in the current line with "lastMapping"
  7961. addMappingWithCode(lastMapping, shiftNextLine());
  7962. }
  7963. // and add the remaining lines without any mapping
  7964. node.add(remainingLines.splice(remainingLinesIndex).join(""));
  7965. }
  7966. // Copy sourcesContent into SourceNode
  7967. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  7968. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  7969. if (content != null) {
  7970. if (aRelativePath != null) {
  7971. sourceFile = util$1.join(aRelativePath, sourceFile);
  7972. }
  7973. node.setSourceContent(sourceFile, content);
  7974. }
  7975. });
  7976. return node;
  7977. function addMappingWithCode(mapping, code) {
  7978. if (mapping === null || mapping.source === undefined) {
  7979. node.add(code);
  7980. } else {
  7981. var source = aRelativePath
  7982. ? util$1.join(aRelativePath, mapping.source)
  7983. : mapping.source;
  7984. node.add(new SourceNode$1(mapping.originalLine,
  7985. mapping.originalColumn,
  7986. source,
  7987. code,
  7988. mapping.name));
  7989. }
  7990. }
  7991. };
  7992. /**
  7993. * Add a chunk of generated JS to this source node.
  7994. *
  7995. * @param aChunk A string snippet of generated JS code, another instance of
  7996. * SourceNode, or an array where each member is one of those things.
  7997. */
  7998. SourceNode$1.prototype.add = function SourceNode_add(aChunk) {
  7999. if (Array.isArray(aChunk)) {
  8000. aChunk.forEach(function (chunk) {
  8001. this.add(chunk);
  8002. }, this);
  8003. }
  8004. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  8005. if (aChunk) {
  8006. this.children.push(aChunk);
  8007. }
  8008. }
  8009. else {
  8010. throw new TypeError(
  8011. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  8012. );
  8013. }
  8014. return this;
  8015. };
  8016. /**
  8017. * Add a chunk of generated JS to the beginning of this source node.
  8018. *
  8019. * @param aChunk A string snippet of generated JS code, another instance of
  8020. * SourceNode, or an array where each member is one of those things.
  8021. */
  8022. SourceNode$1.prototype.prepend = function SourceNode_prepend(aChunk) {
  8023. if (Array.isArray(aChunk)) {
  8024. for (var i = aChunk.length-1; i >= 0; i--) {
  8025. this.prepend(aChunk[i]);
  8026. }
  8027. }
  8028. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  8029. this.children.unshift(aChunk);
  8030. }
  8031. else {
  8032. throw new TypeError(
  8033. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  8034. );
  8035. }
  8036. return this;
  8037. };
  8038. /**
  8039. * Walk over the tree of JS snippets in this node and its children. The
  8040. * walking function is called once for each snippet of JS and is passed that
  8041. * snippet and the its original associated source's line/column location.
  8042. *
  8043. * @param aFn The traversal function.
  8044. */
  8045. SourceNode$1.prototype.walk = function SourceNode_walk(aFn) {
  8046. var chunk;
  8047. for (var i = 0, len = this.children.length; i < len; i++) {
  8048. chunk = this.children[i];
  8049. if (chunk[isSourceNode]) {
  8050. chunk.walk(aFn);
  8051. }
  8052. else {
  8053. if (chunk !== '') {
  8054. aFn(chunk, { source: this.source,
  8055. line: this.line,
  8056. column: this.column,
  8057. name: this.name });
  8058. }
  8059. }
  8060. }
  8061. };
  8062. /**
  8063. * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
  8064. * each of `this.children`.
  8065. *
  8066. * @param aSep The separator.
  8067. */
  8068. SourceNode$1.prototype.join = function SourceNode_join(aSep) {
  8069. var newChildren;
  8070. var i;
  8071. var len = this.children.length;
  8072. if (len > 0) {
  8073. newChildren = [];
  8074. for (i = 0; i < len-1; i++) {
  8075. newChildren.push(this.children[i]);
  8076. newChildren.push(aSep);
  8077. }
  8078. newChildren.push(this.children[i]);
  8079. this.children = newChildren;
  8080. }
  8081. return this;
  8082. };
  8083. /**
  8084. * Call String.prototype.replace on the very right-most source snippet. Useful
  8085. * for trimming whitespace from the end of a source node, etc.
  8086. *
  8087. * @param aPattern The pattern to replace.
  8088. * @param aReplacement The thing to replace the pattern with.
  8089. */
  8090. SourceNode$1.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
  8091. var lastChild = this.children[this.children.length - 1];
  8092. if (lastChild[isSourceNode]) {
  8093. lastChild.replaceRight(aPattern, aReplacement);
  8094. }
  8095. else if (typeof lastChild === 'string') {
  8096. this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
  8097. }
  8098. else {
  8099. this.children.push(''.replace(aPattern, aReplacement));
  8100. }
  8101. return this;
  8102. };
  8103. /**
  8104. * Set the source content for a source file. This will be added to the SourceMapGenerator
  8105. * in the sourcesContent field.
  8106. *
  8107. * @param aSourceFile The filename of the source file
  8108. * @param aSourceContent The content of the source file
  8109. */
  8110. SourceNode$1.prototype.setSourceContent =
  8111. function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
  8112. this.sourceContents[util$1.toSetString(aSourceFile)] = aSourceContent;
  8113. };
  8114. /**
  8115. * Walk over the tree of SourceNodes. The walking function is called for each
  8116. * source file content and is passed the filename and source content.
  8117. *
  8118. * @param aFn The traversal function.
  8119. */
  8120. SourceNode$1.prototype.walkSourceContents =
  8121. function SourceNode_walkSourceContents(aFn) {
  8122. for (var i = 0, len = this.children.length; i < len; i++) {
  8123. if (this.children[i][isSourceNode]) {
  8124. this.children[i].walkSourceContents(aFn);
  8125. }
  8126. }
  8127. var sources = Object.keys(this.sourceContents);
  8128. for (var i = 0, len = sources.length; i < len; i++) {
  8129. aFn(util$1.fromSetString(sources[i]), this.sourceContents[sources[i]]);
  8130. }
  8131. };
  8132. /**
  8133. * Return the string representation of this source node. Walks over the tree
  8134. * and concatenates all the various snippets together to one string.
  8135. */
  8136. SourceNode$1.prototype.toString = function SourceNode_toString() {
  8137. var str = "";
  8138. this.walk(function (chunk) {
  8139. str += chunk;
  8140. });
  8141. return str;
  8142. };
  8143. /**
  8144. * Returns the string representation of this source node along with a source
  8145. * map.
  8146. */
  8147. SourceNode$1.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
  8148. var generated = {
  8149. code: "",
  8150. line: 1,
  8151. column: 0
  8152. };
  8153. var map = new SourceMapGenerator$2(aArgs);
  8154. var sourceMappingActive = false;
  8155. var lastOriginalSource = null;
  8156. var lastOriginalLine = null;
  8157. var lastOriginalColumn = null;
  8158. var lastOriginalName = null;
  8159. this.walk(function (chunk, original) {
  8160. generated.code += chunk;
  8161. if (original.source !== null
  8162. && original.line !== null
  8163. && original.column !== null) {
  8164. if(lastOriginalSource !== original.source
  8165. || lastOriginalLine !== original.line
  8166. || lastOriginalColumn !== original.column
  8167. || lastOriginalName !== original.name) {
  8168. map.addMapping({
  8169. source: original.source,
  8170. original: {
  8171. line: original.line,
  8172. column: original.column
  8173. },
  8174. generated: {
  8175. line: generated.line,
  8176. column: generated.column
  8177. },
  8178. name: original.name
  8179. });
  8180. }
  8181. lastOriginalSource = original.source;
  8182. lastOriginalLine = original.line;
  8183. lastOriginalColumn = original.column;
  8184. lastOriginalName = original.name;
  8185. sourceMappingActive = true;
  8186. } else if (sourceMappingActive) {
  8187. map.addMapping({
  8188. generated: {
  8189. line: generated.line,
  8190. column: generated.column
  8191. }
  8192. });
  8193. lastOriginalSource = null;
  8194. sourceMappingActive = false;
  8195. }
  8196. for (var idx = 0, length = chunk.length; idx < length; idx++) {
  8197. if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
  8198. generated.line++;
  8199. generated.column = 0;
  8200. // Mappings end at eol
  8201. if (idx + 1 === length) {
  8202. lastOriginalSource = null;
  8203. sourceMappingActive = false;
  8204. } else if (sourceMappingActive) {
  8205. map.addMapping({
  8206. source: original.source,
  8207. original: {
  8208. line: original.line,
  8209. column: original.column
  8210. },
  8211. generated: {
  8212. line: generated.line,
  8213. column: generated.column
  8214. },
  8215. name: original.name
  8216. });
  8217. }
  8218. } else {
  8219. generated.column++;
  8220. }
  8221. }
  8222. });
  8223. this.walkSourceContents(function (sourceFile, sourceContent) {
  8224. map.setSourceContent(sourceFile, sourceContent);
  8225. });
  8226. return { code: generated.code, map: map };
  8227. };
  8228. var SourceNode_1 = SourceNode$1;
  8229. var sourceNode = {
  8230. SourceNode: SourceNode_1
  8231. };
  8232. /*
  8233. * Copyright 2009-2011 Mozilla Foundation and contributors
  8234. * Licensed under the New BSD license. See LICENSE.txt or:
  8235. * http://opensource.org/licenses/BSD-3-Clause
  8236. */
  8237. var SourceMapGenerator$1 = sourceMapGenerator.SourceMapGenerator;
  8238. var SourceMapConsumer$1 = sourceMapConsumer.SourceMapConsumer;
  8239. var SourceNode = sourceNode.SourceNode;
  8240. var sourceMap = {
  8241. SourceMapGenerator: SourceMapGenerator$1,
  8242. SourceMapConsumer: SourceMapConsumer$1,
  8243. SourceNode: SourceNode
  8244. };
  8245. var SourceMapConsumer = sourceMap.SourceMapConsumer;
  8246. var SourceMapGenerator = sourceMap.SourceMapGenerator;
  8247. var mergeSourceMap = merge;
  8248. /**
  8249. * Merge old source map and new source map and return merged.
  8250. * If old or new source map value is falsy, return another one as it is.
  8251. *
  8252. * @param {object|string} [oldMap] old source map object
  8253. * @param {object|string} [newmap] new source map object
  8254. * @return {object|undefined} merged source map object, or undefined when both old and new source map are undefined
  8255. */
  8256. function merge(oldMap, newMap) {
  8257. if (!oldMap) return newMap
  8258. if (!newMap) return oldMap
  8259. var oldMapConsumer = new SourceMapConsumer(oldMap);
  8260. var newMapConsumer = new SourceMapConsumer(newMap);
  8261. var mergedMapGenerator = new SourceMapGenerator();
  8262. // iterate on new map and overwrite original position of new map with one of old map
  8263. newMapConsumer.eachMapping(function(m) {
  8264. // pass when `originalLine` is null.
  8265. // It occurs in case that the node does not have origin in original code.
  8266. if (m.originalLine == null) return
  8267. var origPosInOldMap = oldMapConsumer.originalPositionFor({
  8268. line: m.originalLine,
  8269. column: m.originalColumn
  8270. });
  8271. if (origPosInOldMap.source == null) return
  8272. mergedMapGenerator.addMapping({
  8273. original: {
  8274. line: origPosInOldMap.line,
  8275. column: origPosInOldMap.column
  8276. },
  8277. generated: {
  8278. line: m.generatedLine,
  8279. column: m.generatedColumn
  8280. },
  8281. source: origPosInOldMap.source,
  8282. name: origPosInOldMap.name
  8283. });
  8284. });
  8285. var consumers = [oldMapConsumer, newMapConsumer];
  8286. consumers.forEach(function(consumer) {
  8287. consumer.sources.forEach(function(sourceFile) {
  8288. mergedMapGenerator._sources.add(sourceFile);
  8289. var sourceContent = consumer.sourceContentFor(sourceFile);
  8290. if (sourceContent != null) {
  8291. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  8292. }
  8293. });
  8294. });
  8295. mergedMapGenerator._sourceRoot = oldMap.sourceRoot;
  8296. mergedMapGenerator._file = oldMap.file;
  8297. return JSON.parse(mergedMapGenerator.toString())
  8298. }
  8299. // Terser 5.6.1
  8300. function characters(e){return e.split("")}function member(e,t){return t.includes(e)}class DefaultsError extends Error{constructor(e,t){super(),this.name="DefaultsError",this.message=e,this.defs=t;}}function defaults$1(e,t,n){!0===e&&(e={}),null!=e&&"object"==typeof e&&(e=Object.assign({},e));const o=e||{};if(n)for(const e in o)if(HOP(o,e)&&!HOP(t,e))throw new DefaultsError("`"+e+"` is not a supported option",t);for(const n in t)if(HOP(t,n))if(e&&HOP(e,n))if("ecma"===n){let t=0|e[n];t>5&&t<2015&&(t+=2009),o[n]=t;}else o[n]=e&&HOP(e,n)?e[n]:t[n];else o[n]=t[n];return o}function noop(){}function return_false(){return !1}function return_true(){return !0}function return_this(){return this}function return_null(){return null}var MAP=function(){function e(e,r,a){var s,u=[],l=[];function _(){var _=r(e[s],s),c=_ instanceof i;return c&&(_=_.v),_ instanceof n?(_=_.v)instanceof o?l.push.apply(l,a?_.v.slice().reverse():_.v):l.push(_):_!==t&&(_ instanceof o?u.push.apply(u,a?_.v.slice().reverse():_.v):u.push(_)),c}if(Array.isArray(e))if(a){for(s=e.length;--s>=0&&!_(););u.reverse(),l.reverse();}else for(s=0;s<e.length&&!_();++s);else for(s in e)if(HOP(e,s)&&_())break;return l.concat(u)}e.at_top=function(e){return new n(e)},e.splice=function(e){return new o(e)},e.last=function(e){return new i(e)};var t=e.skip={};function n(e){this.v=e;}function o(e){this.v=e;}function i(e){this.v=e;}return e}();function make_node(e,t,n){return n||(n={}),t&&(n.start||(n.start=t.start),n.end||(n.end=t.end)),new e(n)}function push_uniq(e,t){e.includes(t)||e.push(t);}function string_template(e,t){return e.replace(/{(.+?)}/g,(function(e,n){return t&&t[n]}))}function remove$1(e,t){for(var n=e.length;--n>=0;)e[n]===t&&e.splice(n,1);}function mergeSort(e,t){return e.length<2?e.slice():function e(n){if(n.length<=1)return n;var o=Math.floor(n.length/2),i=n.slice(0,o),r=n.slice(o);return function(e,n){for(var o=[],i=0,r=0,a=0;i<e.length&&r<n.length;)t(e[i],n[r])<=0?o[a++]=e[i++]:o[a++]=n[r++];return i<e.length&&o.push.apply(o,e.slice(i)),r<n.length&&o.push.apply(o,n.slice(r)),o}(i=e(i),r=e(r))}(e)}function makePredicate(e){return Array.isArray(e)||(e=e.split(" ")),new Set(e)}function map_add(e,t,n){e.has(t)?e.get(t).push(n):e.set(t,[n]);}function map_from_object(e){var t=new Map;for(var n in e)HOP(e,n)&&"$"===n.charAt(0)&&t.set(n.substr(1),e[n]);return t}function map_to_object(e){var t=Object.create(null);return e.forEach((function(e,n){t["$"+n]=e;})),t}function HOP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function keep_name(e,t){return !0===e||e instanceof RegExp&&e.test(t)}var lineTerminatorEscape={"\0":"0","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function regexp_source_fix(e){return e.replace(/[\0\n\r\u2028\u2029]/g,(function(t,n){return ("\\"!=e[n-1]||"\\"==e[n-2]&&!/(?:^|[^\\])(?:\\{2})*$/.test(e.slice(0,n-1))?"\\":"")+lineTerminatorEscape[t]}))}function sort_regexp_flags(e){const t=new Set(e.split(""));let n="";for(const e of "gimuy")t.has(e)&&(n+=e,t.delete(e));return t.size&&t.forEach((e=>{n+=e;})),n}function has_annotation(e,t){return e._annotations&t}function set_annotation(e,t){e._annotations|=t;}var LATEST_RAW="",LATEST_TEMPLATE_END=!0,KEYWORDS="break case catch class const continue debugger default delete do else export extends finally for function if in instanceof let new return switch throw try typeof var void while with",KEYWORDS_ATOM="false null true",RESERVED_WORDS="enum implements import interface package private protected public static super this "+KEYWORDS_ATOM+" "+KEYWORDS,KEYWORDS_BEFORE_EXPRESSION="return new delete throw else case yield await";KEYWORDS=makePredicate(KEYWORDS),RESERVED_WORDS=makePredicate(RESERVED_WORDS),KEYWORDS_BEFORE_EXPRESSION=makePredicate(KEYWORDS_BEFORE_EXPRESSION),KEYWORDS_ATOM=makePredicate(KEYWORDS_ATOM);var OPERATOR_CHARS=makePredicate(characters("+-*&%=<>!?|~^")),RE_NUM_LITERAL=/[0-9a-f]/i,RE_HEX_NUMBER=/^0x[0-9a-f]+$/i,RE_OCT_NUMBER=/^0[0-7]+$/,RE_ES6_OCT_NUMBER=/^0o[0-7]+$/i,RE_BIN_NUMBER=/^0b[01]+$/i,RE_DEC_NUMBER=/^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i,RE_BIG_INT=/^(0[xob])?[0-9a-f]+n$/i,OPERATORS=makePredicate(["in","instanceof","typeof","new","void","delete","++","--","+","-","!","~","&","|","^","*","**","/","%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","=","+=","-=","||=","&&=","??=","/=","*=","**=","%=",">>=","<<=",">>>=","|=","^=","&=","&&","??","||"]),WHITESPACE_CHARS=makePredicate(characters("  \n\r\t\f\v​           \u2028\u2029   \ufeff")),NEWLINE_CHARS=makePredicate(characters("\n\r\u2028\u2029")),PUNC_AFTER_EXPRESSION=makePredicate(characters(";]),:")),PUNC_BEFORE_EXPRESSION=makePredicate(characters("[{(,;:")),PUNC_CHARS=makePredicate(characters("[]{}(),;:")),UNICODE={ID_Start:/[$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/(?:[$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF])+/};function get_full_char(e,t){if(is_surrogate_pair_head(e.charCodeAt(t))){if(is_surrogate_pair_tail(e.charCodeAt(t+1)))return e.charAt(t)+e.charAt(t+1)}else if(is_surrogate_pair_tail(e.charCodeAt(t))&&is_surrogate_pair_head(e.charCodeAt(t-1)))return e.charAt(t-1)+e.charAt(t);return e.charAt(t)}function get_full_char_code(e,t){return is_surrogate_pair_head(e.charCodeAt(t))?65536+(e.charCodeAt(t)-55296<<10)+e.charCodeAt(t+1)-56320:e.charCodeAt(t)}function get_full_char_length(e){for(var t=0,n=0;n<e.length;n++)is_surrogate_pair_head(e.charCodeAt(n))&&is_surrogate_pair_tail(e.charCodeAt(n+1))&&(t++,n++);return e.length-t}function from_char_code(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function is_surrogate_pair_head(e){return e>=55296&&e<=56319}function is_surrogate_pair_tail(e){return e>=56320&&e<=57343}function is_digit(e){return e>=48&&e<=57}function is_identifier_start(e){return UNICODE.ID_Start.test(e)}function is_identifier_char(e){return UNICODE.ID_Continue.test(e)}const BASIC_IDENT=/^[a-z_$][a-z0-9_$]*$/i;function is_basic_identifier_string(e){return BASIC_IDENT.test(e)}function is_identifier_string(e,t){if(BASIC_IDENT.test(e))return !0;if(!t&&/[\ud800-\udfff]/.test(e))return !1;var n=UNICODE.ID_Start.exec(e);return !(!n||0!==n.index||(e=e.slice(n[0].length))&&(!(n=UNICODE.ID_Continue.exec(e))||n[0].length!==e.length))}function parse_js_number(e,t=!0){if(!t&&e.includes("e"))return NaN;if(RE_HEX_NUMBER.test(e))return parseInt(e.substr(2),16);if(RE_OCT_NUMBER.test(e))return parseInt(e.substr(1),8);if(RE_ES6_OCT_NUMBER.test(e))return parseInt(e.substr(2),8);if(RE_BIN_NUMBER.test(e))return parseInt(e.substr(2),2);if(RE_DEC_NUMBER.test(e))return parseFloat(e);var n=parseFloat(e);return n==e?n:void 0}class JS_Parse_Error extends Error{constructor(e,t,n,o,i){super(),this.name="SyntaxError",this.message=e,this.filename=t,this.line=n,this.col=o,this.pos=i;}}function js_error(e,t,n,o,i){throw new JS_Parse_Error(e,t,n,o,i)}function is_token(e,t,n){return e.type==t&&(null==n||e.value==n)}var EX_EOF={};function tokenizer$1(e,t,n,o){var i={text:e,filename:t,pos:0,tokpos:0,line:1,tokline:0,col:0,tokcol:0,newline_before:!1,regex_allowed:!1,brace_counter:0,template_braces:[],comments_before:[],directives:{},directive_stack:[]};function r(){return get_full_char(i.text,i.pos)}function a(){if(46!==i.text.charCodeAt(i.pos+1))return !1;const e=i.text.charCodeAt(i.pos+2);return e<48||e>57}function s(e,t){var n=get_full_char(i.text,i.pos++);if(e&&!n)throw EX_EOF;return NEWLINE_CHARS.has(n)?(i.newline_before=i.newline_before||!t,++i.line,i.col=0,"\r"==n&&"\n"==r()&&(++i.pos,n="\n")):(n.length>1&&(++i.pos,++i.col),++i.col),n}function u(e){for(;e--;)s();}function l(e){return i.text.substr(i.pos,e.length)==e}function _(e,t){var n=i.text.indexOf(e,i.pos);if(t&&-1==n)throw EX_EOF;return n}function c(){i.tokline=i.line,i.tokcol=i.col,i.tokpos=i.pos;}var f=!1,p=null;function d(e,n,o){i.regex_allowed="operator"==e&&!UNARY_POSTFIX.has(n)||"keyword"==e&&KEYWORDS_BEFORE_EXPRESSION.has(n)||"punc"==e&&PUNC_BEFORE_EXPRESSION.has(n)||"arrow"==e,"punc"!=e||"."!=n&&"?."!=n?o||(f=!1):f=!0;const r=i.tokline,a=i.tokcol,s=i.tokpos,u=i.newline_before,l=t;let _=[],c=[];o||(_=i.comments_before,c=i.comments_before=[]),i.newline_before=!1;const d=new AST_Token(e,n,r,a,s,u,_,c,l);return o||(p=d),d}function S(){for(;WHITESPACE_CHARS.has(r());)s();}function m(e){js_error(e,t,i.tokline,i.tokcol,i.tokpos);}function A(e){var t=!1,n=!1,o=!1,i="."==e,a=!1,u=!1,l=function(e){for(var t,n="",o=0;(t=r())&&e(t,o++);)n+=s();return n}((function(r,s){if(a)return !1;switch(r.charCodeAt(0)){case 95:return u=!0;case 98:case 66:return o=!0;case 111:case 79:case 120:case 88:return !o&&(o=!0);case 101:case 69:return !!o||!t&&(t=n=!0);case 45:return n||0==s&&!e;case 43:return n;case n=!1,46:return !(i||o||t)&&(i=!0)}return "n"===r?(a=!0,!0):RE_NUM_LITERAL.test(r)}));if(e&&(l=e+l),LATEST_RAW=l,RE_OCT_NUMBER.test(l)&&F.has_directive("use strict")&&m("Legacy octal literals are not allowed in strict mode"),u&&(l.endsWith("_")?m("Numeric separators are not allowed at the end of numeric literals"):l.includes("__")&&m("Only one underscore is allowed as numeric separator"),l=l.replace(/_/g,"")),l.endsWith("n")){const e=l.slice(0,-1),t=parse_js_number(e,RE_HEX_NUMBER.test(e));if(!i&&RE_BIG_INT.test(l)&&!isNaN(t))return d("big_int",e);m("Invalid or unexpected token");}var _=parse_js_number(l);if(!isNaN(_))return d("num",_);m("Invalid syntax: "+l);}function T(e){return e>="0"&&e<="7"}function h(e,t,n){var o=s(!0,e);switch(o.charCodeAt(0)){case 110:return "\n";case 114:return "\r";case 116:return "\t";case 98:return "\b";case 118:return "\v";case 102:return "\f";case 120:return String.fromCharCode(E(2,t));case 117:if("{"==r()){for(s(!0),"}"===r()&&m("Expecting hex-character between {}");"0"==r();)s(!0);var a,u=_("}",!0)-i.pos;return (u>6||(a=E(u,t))>1114111)&&m("Unicode reference out of bounds"),s(!0),from_char_code(a)}return String.fromCharCode(E(4,t));case 10:return "";case 13:if("\n"==r())return s(!0,e),""}return T(o)?(n&&t&&("0"===o&&!T(r())||m("Octal escape sequences are not allowed in template strings")),function(e,t){var n=r();return n>="0"&&n<="7"&&(e+=s(!0))[0]<="3"&&(n=r())>="0"&&n<="7"&&(e+=s(!0)),"0"===e?"\0":(e.length>0&&F.has_directive("use strict")&&t&&m("Legacy octal escape sequences are not allowed in strict mode"),String.fromCharCode(parseInt(e,8)))}(o,t)):o}function E(e,t){for(var n=0;e>0;--e){if(!t&&isNaN(parseInt(r(),16)))return parseInt(n,16)||"";var o=s(!0);isNaN(parseInt(o,16))&&m("Invalid hex-character pattern in string"),n+=o;}return parseInt(n,16)}var g=O("Unterminated string constant",(function(){const e=i.pos;for(var t=s(),n=[];;){var o=s(!0,!0);if("\\"==o)o=h(!0,!0);else if("\r"==o||"\n"==o)m("Unterminated string constant");else if(o==t)break;n.push(o);}var r=d("string",n.join(""));return LATEST_RAW=i.text.slice(e,i.pos),r.quote=t,r})),D=O("Unterminated template",(function(e){e&&i.template_braces.push(i.brace_counter);var t,n,o="",a="";for(s(!0,!0);"`"!=(t=s(!0,!0));){if("\r"==t)"\n"==r()&&++i.pos,t="\n";else if("$"==t&&"{"==r())return s(!0,!0),i.brace_counter++,n=d(e?"template_head":"template_substitution",o),LATEST_RAW=a,LATEST_TEMPLATE_END=!1,n;if(a+=t,"\\"==t){var u=i.pos;t=h(!0,!(p&&("name"===p.type||"punc"===p.type&&(")"===p.value||"]"===p.value))),!0),a+=i.text.substr(u,i.pos-u);}o+=t;}return i.template_braces.pop(),n=d(e?"template_head":"template_substitution",o),LATEST_RAW=a,LATEST_TEMPLATE_END=!0,n}));function b(e){var t,n=i.regex_allowed,o=function(){for(var e=i.text,t=i.pos,n=i.text.length;t<n;++t){var o=e[t];if(NEWLINE_CHARS.has(o))return t}return -1}();return -1==o?(t=i.text.substr(i.pos),i.pos=i.text.length):(t=i.text.substring(i.pos,o),i.pos=o),i.col=i.tokcol+(i.pos-i.tokpos),i.comments_before.push(d(e,t,!0)),i.regex_allowed=n,F}var y=O("Unterminated multiline comment",(function(){var e=i.regex_allowed,t=_("*/",!0),n=i.text.substring(i.pos,t).replace(/\r\n|\r|\u2028|\u2029/g,"\n");return u(get_full_char_length(n)+2),i.comments_before.push(d("comment2",n,!0)),i.newline_before=i.newline_before||n.includes("\n"),i.regex_allowed=e,F})),v=O("Unterminated identifier name",(function(){var e,t=[],n=!1,o=function(){return n=!0,s(),"u"!==r()&&m("Expecting UnicodeEscapeSequence -- uXXXX or u{XXXX}"),h(!1,!0)};if("\\"===(e=r()))is_identifier_start(e=o())||m("First identifier char is an invalid identifier char");else {if(!is_identifier_start(e))return "";s();}for(t.push(e);null!=(e=r());){if("\\"===(e=r()))is_identifier_char(e=o())||m("Invalid escaped identifier char");else {if(!is_identifier_char(e))break;s();}t.push(e);}const i=t.join("");return RESERVED_WORDS.has(i)&&n&&m("Escaped characters are not allowed in keywords"),i})),C=O("Unterminated regular expression",(function(e){for(var t,n=!1,o=!1;t=s(!0);)if(NEWLINE_CHARS.has(t))m("Unexpected line terminator");else if(n)e+="\\"+t,n=!1;else if("["==t)o=!0,e+=t;else if("]"==t&&o)o=!1,e+=t;else {if("/"==t&&!o)break;"\\"==t?n=!0:e+=t;}return d("regexp","/"+e+"/"+v())}));function R(e){return d("operator",function e(t){if(!r())return t;var n=t+r();return OPERATORS.has(n)?(s(),e(n)):t}(e||s()))}function k(){switch(s(),r()){case"/":return s(),b("comment1");case"*":return s(),y()}return i.regex_allowed?C(""):R("/")}function O(e,t){return function(n){try{return t(n)}catch(t){if(t!==EX_EOF)throw t;m(e);}}}function F(e){if(null!=e)return C(e);for(o&&0==i.pos&&l("#!")&&(c(),u(2),b("comment5"));;){if(S(),c(),n){if(l("\x3c!--")){u(4),b("comment3");continue}if(l("--\x3e")&&i.newline_before){u(3),b("comment4");continue}}var t=r();if(!t)return d("eof");var _=t.charCodeAt(0);switch(_){case 34:case 39:return g();case 46:return s(),is_digit(r().charCodeAt(0))?A("."):"."===r()?(s(),s(),d("expand","...")):d("punc",".");case 47:var p=k();if(p===F)continue;return p;case 61:return s(),">"===r()?(s(),d("arrow","=>")):R("=");case 63:if(!a())break;return s(),s(),d("punc","?.");case 96:return D(!0);case 123:i.brace_counter++;break;case 125:if(i.brace_counter--,i.template_braces.length>0&&i.template_braces[i.template_braces.length-1]===i.brace_counter)return D(!1)}if(is_digit(_))return A();if(PUNC_CHARS.has(t))return d("punc",s());if(OPERATOR_CHARS.has(t))return R();if(92==_||is_identifier_start(t))return T=v(),f?d("name",T):KEYWORDS_ATOM.has(T)?d("atom",T):KEYWORDS.has(T)?OPERATORS.has(T)?d("operator",T):d("keyword",T):d("name",T);if(35==_)return s(),d("privatename",v());break}var T;m("Unexpected character '"+t+"'");}return F.next=s,F.peek=r,F.context=function(e){return e&&(i=e),i},F.add_directive=function(e){i.directive_stack[i.directive_stack.length-1].push(e),void 0===i.directives[e]?i.directives[e]=1:i.directives[e]++;},F.push_directives_stack=function(){i.directive_stack.push([]);},F.pop_directives_stack=function(){for(var e=i.directive_stack[i.directive_stack.length-1],t=0;t<e.length;t++)i.directives[e[t]]--;i.directive_stack.pop();},F.has_directive=function(e){return i.directives[e]>0},F}var UNARY_PREFIX=makePredicate(["typeof","void","delete","--","++","!","~","-","+"]),UNARY_POSTFIX=makePredicate(["--","++"]),ASSIGNMENT=makePredicate(["=","+=","-=","??=","&&=","||=","/=","*=","**=","%=",">>=","<<=",">>>=","|=","^=","&="]),LOGICAL_ASSIGNMENT=makePredicate(["??=","&&=","||="]),PRECEDENCE=function(e,t){for(var n=0;n<e.length;++n)for(var o=e[n],i=0;i<o.length;++i)t[o[i]]=n+1;return t}([["||"],["??"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],{}),ATOMIC_START_TOKEN=makePredicate(["atom","num","big_int","string","regexp","name"]);function parse$5(e,t){const n=new WeakMap;t=defaults$1(t,{bare_returns:!1,ecma:null,expression:!1,filename:null,html5_comments:!0,module:!1,shebang:!0,strict:!1,toplevel:null},!0);var o={input:"string"==typeof e?tokenizer$1(e,t.filename,t.html5_comments,t.shebang):e,token:null,prev:null,peeked:null,in_function:0,in_async:-1,in_generator:-1,in_directives:!0,in_loop:0,labels:[]};function i(e,t){return is_token(o.token,e,t)}function r(){return o.peeked||(o.peeked=o.input())}function a(){return o.prev=o.token,o.peeked||r(),o.token=o.peeked,o.peeked=null,o.in_directives=o.in_directives&&("string"==o.token.type||i("punc",";")),o.token}function s(){return o.prev}function u(e,t,n,i){var r=o.input.context();js_error(e,r.filename,null!=t?t:r.tokline,null!=n?n:r.tokcol,null!=i?i:r.tokpos);}function l(e,t){u(t,e.line,e.col);}function _(e){null==e&&(e=o.token),l(e,"Unexpected token: "+e.type+" ("+e.value+")");}function c(e,t){if(i(e,t))return a();l(o.token,"Unexpected token "+o.token.type+" «"+o.token.value+"», expected "+e+" «"+t+"»");}function f(e){return c("punc",e)}function p(e){return e.nlb||!e.comments_before.every((e=>!e.nlb))}function d(){return !t.strict&&(i("eof")||i("punc","}")||p(o.token))}function S(){return o.in_generator===o.in_function}function m(){return o.in_async===o.in_function||0===o.in_function&&o.input.has_directive("use strict")}function A(e){i("punc",";")?a():e||d()||_();}function T(){f("(");var e=Se(!0);return f(")"),e}function h(e){return function(...t){const n=o.token,i=e(...t);return i.start=n,i.end=s(),i}}function E(){(i("operator","/")||i("operator","/="))&&(o.peeked=null,o.token=o.input(o.token.value.substr(1)));}o.token=a();var g=h((function e(n,S,h){switch(E(),o.token.type){case"string":if(o.in_directives){var g=r();!LATEST_RAW.includes("\\")&&(is_token(g,"punc",";")||is_token(g,"punc","}")||p(g)||is_token(g,"eof"))?o.input.add_directive(o.token.value):o.in_directives=!1;}var k=o.in_directives,F=b();return k&&F.body instanceof AST_String?new AST_Directive(F.body):F;case"template_head":case"num":case"big_int":case"regexp":case"operator":case"atom":return b();case"name":if("async"==o.token.value&&is_token(r(),"keyword","function"))return a(),a(),S&&u("functions are not allowed as the body of a loop"),O(AST_Defun,!1,!0,n);if("import"==o.token.value&&!is_token(r(),"punc","(")&&!is_token(r(),"punc",".")){a();var M=function(){var e,t,n=s();i("name")&&(e=re(AST_SymbolImport)),i("punc",",")&&a(),((t=J(!0))||e)&&c("name","from");var r=o.token;return "string"!==r.type&&_(),a(),new AST_Import({start:n,imported_name:e,imported_names:t,module_name:new AST_String({start:r,value:r.value,quote:r.quote,end:r}),end:o.token})}();return A(),M}return is_token(r(),"punc",":")?D():b();case"punc":switch(o.token.value){case"{":return new AST_BlockStatement({start:o.token,body:w(),end:s()});case"[":case"(":return b();case";":return o.in_directives=!1,a(),new AST_EmptyStatement;default:_();}case"keyword":switch(o.token.value){case"break":return a(),y(AST_Break);case"continue":return a(),y(AST_Continue);case"debugger":return a(),A(),new AST_Debugger;case"do":a();var I=me(e);c("keyword","while");var B=T();return A(!0),new AST_Do({body:I,condition:B});case"while":return a(),new AST_While({condition:T(),body:me((function(){return e(!1,!0)}))});case"for":return a(),function(){var e="`for await` invalid in this context",t=o.token;"name"==t.type&&"await"==t.value?(m()||l(t,e),a()):t=!1,f("(");var n=null;if(i("punc",";"))t&&l(t,e);else {n=i("keyword","var")?(a(),L(!0)):i("keyword","let")?(a(),V(!0)):i("keyword","const")?(a(),U(!0)):Se(!0,!0);var r=i("operator","in"),s=i("name","of");if(t&&!s&&l(t,e),r||s)return n instanceof AST_Definitions?n.definitions.length>1&&l(n.start,"Only one variable declaration allowed in for..in loop"):fe(n)||(n=pe(n))instanceof AST_Destructuring||l(n.start,"Invalid left-hand side in for..in loop"),a(),r?R(n):C(n,!!t)}return v(n)}();case"class":return a(),S&&u("classes are not allowed as the body of a loop"),h&&u("classes are not allowed as the body of an if"),j(AST_DefClass);case"function":return a(),S&&u("functions are not allowed as the body of a loop"),O(AST_Defun,!1,!1,n);case"if":return a(),x();case"return":0!=o.in_function||t.bare_returns||u("'return' outside of function"),a();var K=null;return i("punc",";")?a():d()||(K=Se(!0),A()),new AST_Return({value:K});case"switch":return a(),new AST_Switch({expression:T(),body:me(P)});case"throw":return a(),p(o.token)&&u("Illegal newline after 'throw'"),K=Se(!0),A(),new AST_Throw({value:K});case"try":return a(),function(){var e=w(),t=null,n=null;if(i("keyword","catch")){var r=o.token;if(a(),i("punc","{"))var l=null;else f("("),l=N(void 0,AST_SymbolCatch),f(")");t=new AST_Catch({start:r,argname:l,body:w(),end:s()});}return i("keyword","finally")&&(r=o.token,a(),n=new AST_Finally({start:r,body:w(),end:s()})),t||n||u("Missing catch/finally blocks"),new AST_Try({body:e,bcatch:t,bfinally:n})}();case"var":return a(),M=L(),A(),M;case"let":return a(),M=V(),A(),M;case"const":return a(),M=U(),A(),M;case"with":return o.input.has_directive("use strict")&&u("Strict mode may not include a with statement"),a(),new AST_With({expression:T(),body:e()});case"export":if(!is_token(r(),"punc","("))return a(),M=ee(),i("punc",";")&&A(),M}}_();}));function D(){var e=re(AST_Label);"await"===e.name&&o.in_async===o.in_function&&l(o.prev,"await cannot be used as label inside async function"),o.labels.some((t=>t.name===e.name))&&u("Label "+e.name+" defined twice"),f(":"),o.labels.push(e);var t=g();return o.labels.pop(),t instanceof AST_IterationStatement||e.references.forEach((function(t){t instanceof AST_Continue&&(t=t.label.start,u("Continue label `"+e.name+"` refers to non-IterationStatement.",t.line,t.col,t.pos));})),new AST_LabeledStatement({body:t,label:e})}function b(e){return new AST_SimpleStatement({body:(e=Se(!0),A(),e)})}function y(e){var t,n=null;d()||(n=re(AST_LabelRef,!0)),null!=n?((t=o.labels.find((e=>e.name===n.name)))||u("Undefined label "+n.name),n.thedef=t):0==o.in_loop&&u(e.TYPE+" not inside a loop or switch"),A();var i=new e({label:n});return t&&t.references.push(i),i}function v(e){f(";");var t=i("punc",";")?null:Se(!0);f(";");var n=i("punc",")")?null:Se(!0);return f(")"),new AST_For({init:e,condition:t,step:n,body:me((function(){return g(!1,!0)}))})}function C(e,t){var n=e instanceof AST_Definitions?e.definitions[0].name:null,o=Se(!0);return f(")"),new AST_ForOf({await:t,init:e,name:n,object:o,body:me((function(){return g(!1,!0)}))})}function R(e){var t=Se(!0);return f(")"),new AST_ForIn({init:e,object:t,body:me((function(){return g(!1,!0)}))})}var k=function(e,t,n){p(o.token)&&u("Unexpected newline before arrow (=>)"),c("arrow","=>");var r=I(i("punc","{"),!1,n),a=r instanceof Array&&r.length?r[r.length-1].end:r instanceof Array?e:r.end;return new AST_Arrow({start:e,end:a,async:n,argnames:t,body:r})},O=function(e,t,n,o){var r=e===AST_Defun,u=i("operator","*");u&&a();var l=i("name")?re(r?AST_SymbolDefun:AST_SymbolLambda):null;r&&!l&&(o?e=AST_Function:_()),!l||e===AST_Accessor||l instanceof AST_SymbolDeclaration||_(s());var c=[],f=I(!0,u||t,n,l,c);return new e({start:c.start,end:f.end,is_generator:u,async:n,name:l,argnames:c,body:f})};function F(e,t){var n=new Set,o=!1,i=!1,r=!1,a=!!t,s={add_parameter:function(t){if(n.has(t.value))!1===o&&(o=t),s.check_strict();else if(n.add(t.value),e)switch(t.value){case"arguments":case"eval":case"yield":a&&l(t,"Unexpected "+t.value+" identifier as parameter inside strict mode");break;default:RESERVED_WORDS.has(t.value)&&_();}},mark_default_assignment:function(e){!1===i&&(i=e);},mark_spread:function(e){!1===r&&(r=e);},mark_strict_mode:function(){a=!0;},is_strict:function(){return !1!==i||!1!==r||a},check_strict:function(){s.is_strict()&&!1!==o&&l(o,"Parameter "+o.value+" was used already");}};return s}function N(e,t){var n,r=!1;return void 0===e&&(e=F(!0,o.input.has_directive("use strict"))),i("expand","...")&&(r=o.token,e.mark_spread(o.token),a()),n=M(e,t),i("operator","=")&&!1===r&&(e.mark_default_assignment(o.token),a(),n=new AST_DefaultAssign({start:n.start,left:n,operator:"=",right:Se(!1),end:o.token})),!1!==r&&(i("punc",")")||_(),n=new AST_Expansion({start:r,expression:n,end:r})),e.check_strict(),n}function M(e,t){var n,l=[],c=!0,p=!1,d=o.token;if(void 0===e&&(e=F(!1,o.input.has_directive("use strict"))),t=void 0===t?AST_SymbolFunarg:t,i("punc","[")){for(a();!i("punc","]");){if(c?c=!1:f(","),i("expand","...")&&(p=!0,n=o.token,e.mark_spread(o.token),a()),i("punc"))switch(o.token.value){case",":l.push(new AST_Hole({start:o.token,end:o.token}));continue;case"]":break;case"[":case"{":l.push(M(e,t));break;default:_();}else i("name")?(e.add_parameter(o.token),l.push(re(t))):u("Invalid function parameter");i("operator","=")&&!1===p&&(e.mark_default_assignment(o.token),a(),l[l.length-1]=new AST_DefaultAssign({start:l[l.length-1].start,left:l[l.length-1],operator:"=",right:Se(!1),end:o.token})),p&&(i("punc","]")||u("Rest element must be last element"),l[l.length-1]=new AST_Expansion({start:n,expression:l[l.length-1],end:n}));}return f("]"),e.check_strict(),new AST_Destructuring({start:d,names:l,is_array:!0,end:s()})}if(i("punc","{")){for(a();!i("punc","}");){if(c?c=!1:f(","),i("expand","...")&&(p=!0,n=o.token,e.mark_spread(o.token),a()),i("name")&&(is_token(r(),"punc")||is_token(r(),"operator"))&&[",","}","="].includes(r().value)){e.add_parameter(o.token);var S=s(),m=re(t);p?l.push(new AST_Expansion({start:n,expression:m,end:m.end})):l.push(new AST_ObjectKeyVal({start:S,key:m.name,value:m,end:m.end}));}else {if(i("punc","}"))continue;var A=o.token,T=te();null===T?_(s()):"name"!==s().type||i("punc",":")?(f(":"),l.push(new AST_ObjectKeyVal({start:A,quote:A.quote,key:T,value:M(e,t),end:s()}))):l.push(new AST_ObjectKeyVal({start:s(),key:T,value:new t({start:s(),name:T,end:s()}),end:s()}));}p?i("punc","}")||u("Rest element must be last element"):i("operator","=")&&(e.mark_default_assignment(o.token),a(),l[l.length-1].value=new AST_DefaultAssign({start:l[l.length-1].value.start,left:l[l.length-1].value,operator:"=",right:Se(!1),end:o.token}));}return f("}"),e.check_strict(),new AST_Destructuring({start:d,names:l,is_array:!1,end:s()})}if(i("name"))return e.add_parameter(o.token),re(t);u("Invalid function parameter");}function I(e,t,n,r,s){var u=o.in_loop,l=o.labels,_=o.in_generator,c=o.in_async;if(++o.in_function,t&&(o.in_generator=o.in_function),n&&(o.in_async=o.in_function),s&&function(e){var t=F(!0,o.input.has_directive("use strict"));for(f("(");!i("punc",")");){var n=N(t);if(e.push(n),i("punc",")")||f(","),n instanceof AST_Expansion)break}a();}(s),e&&(o.in_directives=!0),o.in_loop=0,o.labels=[],e){o.input.push_directives_stack();var p=w();r&&ie(r),s&&s.forEach(ie),o.input.pop_directives_stack();}else p=[new AST_Return({start:o.token,value:Se(!1),end:o.token})];return --o.in_function,o.in_loop=u,o.labels=l,o.in_generator=_,o.in_async=c,p}function x(){var e=T(),t=g(!1,!1,!0),n=null;return i("keyword","else")&&(a(),n=g(!1,!1,!0)),new AST_If({condition:e,body:t,alternative:n})}function w(){f("{");for(var e=[];!i("punc","}");)i("eof")&&_(),e.push(g());return a(),e}function P(){f("{");for(var e,t=[],n=null,r=null;!i("punc","}");)i("eof")&&_(),i("keyword","case")?(r&&(r.end=s()),n=[],r=new AST_Case({start:(e=o.token,a(),e),expression:Se(!0),body:n}),t.push(r),f(":")):i("keyword","default")?(r&&(r.end=s()),n=[],r=new AST_Default({start:(e=o.token,a(),f(":"),e),body:n}),t.push(r)):(n||_(),n.push(g()));return r&&(r.end=s()),a(),t}function B(e,t){for(var n,r=[];;){var l="var"===t?AST_SymbolVar:"const"===t?AST_SymbolConst:"let"===t?AST_SymbolLet:null;if(i("punc","{")||i("punc","[")?n=new AST_VarDef({start:o.token,name:M(void 0,l),value:i("operator","=")?(c("operator","="),Se(!1,e)):null,end:s()}):"import"==(n=new AST_VarDef({start:o.token,name:re(l),value:i("operator","=")?(a(),Se(!1,e)):e||"const"!==t?null:u("Missing initializer in const declaration"),end:s()})).name.name&&u("Unexpected token: import"),r.push(n),!i("punc",","))break;a();}return r}var L=function(e){return new AST_Var({start:s(),definitions:B(e,"var"),end:s()})},V=function(e){return new AST_Let({start:s(),definitions:B(e,"let"),end:s()})},U=function(e){return new AST_Const({start:s(),definitions:B(e,"const"),end:s()})};function K(){var e,t=o.token;switch(t.type){case"name":e=oe(AST_SymbolRef);break;case"num":e=new AST_Number({start:t,end:t,value:t.value,raw:LATEST_RAW});break;case"big_int":e=new AST_BigInt({start:t,end:t,value:t.value});break;case"string":e=new AST_String({start:t,end:t,value:t.value,quote:t.quote});break;case"regexp":const[n,o,i]=t.value.match(/^\/(.*)\/(\w*)$/);e=new AST_RegExp({start:t,end:t,value:{source:o,flags:i}});break;case"atom":switch(t.value){case"false":e=new AST_False({start:t,end:t});break;case"true":e=new AST_True({start:t,end:t});break;case"null":e=new AST_Null({start:t,end:t});}}return a(),e}function G(e,t){var n=function(e,t){return t?new AST_DefaultAssign({start:e.start,left:e,operator:"=",right:t,end:t.end}):e};return e instanceof AST_Object?n(new AST_Destructuring({start:e.start,end:e.end,is_array:!1,names:e.properties.map((e=>G(e)))}),t):e instanceof AST_ObjectKeyVal?(e.value=G(e.value),n(e,t)):e instanceof AST_Hole?e:e instanceof AST_Destructuring?(e.names=e.names.map((e=>G(e))),n(e,t)):e instanceof AST_SymbolRef?n(new AST_SymbolFunarg({name:e.name,start:e.start,end:e.end}),t):e instanceof AST_Expansion?(e.expression=G(e.expression),n(e,t)):e instanceof AST_Array?n(new AST_Destructuring({start:e.start,end:e.end,is_array:!0,names:e.elements.map((e=>G(e)))}),t):e instanceof AST_Assign?n(G(e.left,e.right),t):e instanceof AST_DefaultAssign?(e.left=G(e.left),e):void u("Invalid function parameter",e.start.line,e.start.col)}var H=function(e,t){if(i("operator","new"))return function(e){var t=o.token;if(c("operator","new"),i("punc","."))return a(),c("name","target"),se(new AST_NewTarget({start:t,end:s()}),e);var n,r=H(!1);i("punc","(")?(a(),n=z(")",!0)):n=[];var u=new AST_New({start:t,expression:r,args:n,end:s()});return ae(u),se(u,e)}(e);if(i("operator","import"))return function(){var e=o.token;return c("operator","import"),c("punc","."),c("name","meta"),se(new AST_ImportMeta({start:e,end:s()}),!1)}();var u,l=o.token,p=i("name","async")&&"["!=(u=r()).value&&"arrow"!=u.type&&K();if(i("punc")){switch(o.token.value){case"(":if(p&&!e)break;var d=function(e,t){var n,r,u,l=[];for(f("(");!i("punc",")");)n&&_(n),i("expand","...")?(n=o.token,t&&(r=o.token),a(),l.push(new AST_Expansion({start:s(),expression:Se(),end:o.token}))):l.push(Se()),i("punc",")")||(f(","),i("punc",")")&&(u=s(),t&&(r=u)));return f(")"),e&&i("arrow","=>")?n&&u&&_(u):r&&_(r),l}(t,!p);if(t&&i("arrow","=>"))return k(l,d.map((e=>G(e))),!!p);var S=p?new AST_Call({expression:p,args:d}):1==d.length?d[0]:new AST_Sequence({expressions:d});if(S.start){const e=l.comments_before.length;if(n.set(l,e),S.start.comments_before.unshift(...l.comments_before),l.comments_before=S.start.comments_before,0==e&&l.comments_before.length>0){var m=l.comments_before[0];m.nlb||(m.nlb=l.nlb,l.nlb=!1);}l.comments_after=S.start.comments_after;}S.start=l;var A=s();return S.end&&(A.comments_before=S.end.comments_before,S.end.comments_after.push(...A.comments_after),A.comments_after=S.end.comments_after),S.end=A,S instanceof AST_Call&&ae(S),se(S,e);case"[":return se(W(),e);case"{":return se(Y(),e)}p||_();}if(t&&i("name")&&is_token(r(),"arrow")){var T=new AST_SymbolFunarg({name:o.token.value,start:l,end:l});return a(),k(l,[T],!!p)}if(i("keyword","function")){a();var h=O(AST_Function,!1,!!p);return h.start=l,h.end=s(),se(h,e)}if(p)return se(p,e);if(i("keyword","class")){a();var E=j(AST_ClassExpression);return E.start=l,E.end=s(),se(E,e)}return i("template_head")?se(X(),e):ATOMIC_START_TOKEN.has(o.token.type)?se(K(),e):void _()};function X(){var e=[],t=o.token;for(e.push(new AST_TemplateSegment({start:o.token,raw:LATEST_RAW,value:o.token.value,end:o.token}));!LATEST_TEMPLATE_END;)a(),E(),e.push(Se(!0)),e.push(new AST_TemplateSegment({start:o.token,raw:LATEST_RAW,value:o.token.value,end:o.token}));return a(),new AST_TemplateString({start:t,segments:e,end:o.token})}function z(e,t,n){for(var r=!0,u=[];!i("punc",e)&&(r?r=!1:f(","),!t||!i("punc",e));)i("punc",",")&&n?u.push(new AST_Hole({start:o.token,end:o.token})):i("expand","...")?(a(),u.push(new AST_Expansion({start:s(),expression:Se(),end:o.token}))):u.push(Se(!1));return a(),u}var W=h((function(){return f("["),new AST_Array({elements:z("]",!t.strict,!0)})})),q=h(((e,t)=>O(AST_Accessor,e,t))),Y=h((function(){var e=o.token,n=!0,r=[];for(f("{");!i("punc","}")&&(n?n=!1:f(","),t.strict||!i("punc","}"));)if("expand"!=(e=o.token).type){var u,l=te();if(i("punc",":"))null===l?_(s()):(a(),u=Se(!1));else {var c=$(l,e);if(c){r.push(c);continue}u=new AST_SymbolRef({start:s(),name:l,end:s()});}i("operator","=")&&(a(),u=new AST_Assign({start:e,left:u,operator:"=",right:Se(!1),logical:!1,end:s()})),r.push(new AST_ObjectKeyVal({start:e,quote:e.quote,key:l instanceof AST_Node?l:""+l,value:u,end:s()}));}else a(),r.push(new AST_Expansion({start:e,expression:Se(!1),end:s()}));return a(),new AST_Object({properties:r})}));function j(e){var t,n,r,u,l=[];for(o.input.push_directives_stack(),o.input.add_directive("use strict"),"name"==o.token.type&&"extends"!=o.token.value&&(r=re(e===AST_DefClass?AST_SymbolDefClass:AST_SymbolClass)),e!==AST_DefClass||r||_(),"extends"==o.token.value&&(a(),u=Se(!0)),f("{");i("punc",";");)a();for(;!i("punc","}");)for(t=o.token,(n=$(te(),t,!0))||_(),l.push(n);i("punc",";");)a();return o.input.pop_directives_stack(),a(),new e({start:t,name:r,extends:u,properties:l,end:s()})}function $(e,t,n){var r=function(e,t){return "string"==typeof e||"number"==typeof e?new AST_SymbolMethod({start:t,name:""+e,end:s()}):(null===e&&_(),e)},u="privatename"==t.type,l=!1,c=!1,f=!1,p=t;if(n&&"static"===e&&!i("punc","(")&&(c=!0,u="privatename"==(p=o.token).type,e=te()),"async"!==e||i("punc","(")||i("punc",",")||i("punc","}")||i("operator","=")||(l=!0,u="privatename"==(p=o.token).type,e=te()),null===e&&(f=!0,u="privatename"==(p=o.token).type,null===(e=te())&&_()),i("punc","("))return e=r(e,t),new(u?AST_PrivateMethod:AST_ConciseMethod)({start:t,static:c,is_generator:f,async:l,key:e,quote:e instanceof AST_SymbolMethod?p.quote:void 0,value:q(f,l),end:s()});const d=o.token;if(("get"===e||"set"===e)&&"privatename"===d.type)return a(),new("get"===e?AST_PrivateGetter:AST_PrivateSetter)({start:t,static:c,key:r(d.value,t),value:q(),end:s()});if("get"==e){if(!i("punc")||i("punc","["))return e=r(te(),t),new AST_ObjectGetter({start:t,static:c,key:e,quote:e instanceof AST_SymbolMethod?d.quote:void 0,value:q(),end:s()})}else if("set"==e&&(!i("punc")||i("punc","[")))return e=r(te(),t),new AST_ObjectSetter({start:t,static:c,key:e,quote:e instanceof AST_SymbolMethod?d.quote:void 0,value:q(),end:s()});if(n){const n=(e=>"string"==typeof e||"number"==typeof e?new AST_SymbolClassProperty({start:p,end:p,name:""+e}):(null===e&&_(),e))(e),o=n instanceof AST_SymbolClassProperty?p.quote:void 0,r=u?AST_ClassPrivateProperty:AST_ClassProperty;if(i("operator","="))return a(),new r({start:t,static:c,quote:o,key:n,value:Se(!1),end:s()});if(i("name")||i("privatename")||i("operator","*")||i("punc",";")||i("punc","}"))return new r({start:t,static:c,quote:o,key:n,end:s()})}}function Z(e){function t(e){return new e({name:te(),start:s(),end:s()})}var n,r,u=e?AST_SymbolImportForeign:AST_SymbolExportForeign,l=e?AST_SymbolImport:AST_SymbolExport,_=o.token;return e?n=t(u):r=t(l),i("name","as")?(a(),e?r=t(l):n=t(u)):e?r=new l(n):n=new u(r),new AST_NameMapping({start:_,foreign_name:n,name:r,end:s()})}function Q(e,t){var n,i=e?AST_SymbolImportForeign:AST_SymbolExportForeign,r=e?AST_SymbolImport:AST_SymbolExport,a=o.token,u=s();return t=t||new r({name:"*",start:a,end:u}),n=new i({name:"*",start:a,end:u}),new AST_NameMapping({start:a,foreign_name:n,name:t,end:u})}function J(e){var t;if(i("punc","{")){for(a(),t=[];!i("punc","}");)t.push(Z(e)),i("punc",",")&&a();a();}else if(i("operator","*")){var n;a(),e&&i("name","as")&&(a(),n=re(e?AST_SymbolImport:AST_SymbolExportForeign)),t=[Q(e,n)];}return t}function ee(){var e,t,n,u,l,c=o.token;if(i("keyword","default"))e=!0,a();else if(t=J(!1)){if(i("name","from")){a();var f=o.token;return "string"!==f.type&&_(),a(),new AST_Export({start:c,is_default:e,exported_names:t,module_name:new AST_String({start:f,value:f.value,quote:f.quote,end:f}),end:s()})}return new AST_Export({start:c,is_default:e,exported_names:t,end:s()})}return i("punc","{")||e&&(i("keyword","class")||i("keyword","function"))&&is_token(r(),"punc")?(u=Se(!1),A()):(n=g(e))instanceof AST_Definitions&&e?_(n.start):n instanceof AST_Definitions||n instanceof AST_Lambda||n instanceof AST_DefClass?l=n:n instanceof AST_SimpleStatement?u=n.body:_(n.start),new AST_Export({start:c,is_default:e,exported_value:u,exported_definition:l,end:s()})}function te(){var e=o.token;switch(e.type){case"punc":if("["===e.value){a();var t=Se(!1);return f("]"),t}_(e);case"operator":if("*"===e.value)return a(),null;["delete","in","instanceof","new","typeof","void"].includes(e.value)||_(e);case"name":case"privatename":case"string":case"num":case"big_int":case"keyword":case"atom":return a(),e.value;default:_(e);}}function ne(){var e=o.token;return "name"!=e.type&&"privatename"!=e.type&&_(),a(),e.value}function oe(e){var t=o.token.value;return new("this"==t?AST_This:"super"==t?AST_Super:e)({name:String(t),start:o.token,end:o.token})}function ie(e){var t=e.name;S()&&"yield"==t&&l(e.start,"Yield cannot be used as identifier inside generators"),o.input.has_directive("use strict")&&("yield"==t&&l(e.start,"Unexpected yield identifier inside strict mode"),e instanceof AST_SymbolDeclaration&&("arguments"==t||"eval"==t)&&l(e.start,"Unexpected "+t+" in strict mode"));}function re(e,t){if(!i("name"))return t||u("Name expected"),null;var n=oe(e);return ie(n),a(),n}function ae(e){var t=e.start,o=t.comments_before;const i=n.get(t);for(var r=null!=i?i:o.length;--r>=0;){var a=o[r];if(/[@#]__/.test(a.value)){if(/[@#]__PURE__/.test(a.value)){set_annotation(e,_PURE);break}if(/[@#]__INLINE__/.test(a.value)){set_annotation(e,_INLINE);break}if(/[@#]__NOINLINE__/.test(a.value)){set_annotation(e,_NOINLINE);break}}}}var se=function(e,t,n){var o=e.start;if(i("punc",".")){a();const r=i("privatename")?AST_DotHash:AST_Dot;return se(new r({start:o,expression:e,optional:!1,property:ne(),end:s()}),t,n)}if(i("punc","[")){a();var r=Se(!0);return f("]"),se(new AST_Sub({start:o,expression:e,optional:!1,property:r,end:s()}),t,n)}if(t&&i("punc","(")){a();var u=new AST_Call({start:o,expression:e,optional:!1,args:ue(),end:s()});return ae(u),se(u,!0,n)}if(i("punc","?.")){let n;if(a(),t&&i("punc","(")){a();const t=new AST_Call({start:o,optional:!0,expression:e,args:ue(),end:s()});ae(t),n=se(t,!0,!0);}else if(i("name")||i("privatename")){const r=i("privatename")?AST_DotHash:AST_Dot;n=se(new r({start:o,expression:e,optional:!0,property:ne(),end:s()}),t,!0);}else if(i("punc","[")){a();const i=Se(!0);f("]"),n=se(new AST_Sub({start:o,expression:e,optional:!0,property:i,end:s()}),t,!0);}return n||_(),n instanceof AST_Chain?n:new AST_Chain({start:o,expression:n,end:s()})}return i("template_head")?(n&&_(),se(new AST_PrefixedTemplateString({start:o,prefix:e,template_string:X(),end:s()}),t)):e};function ue(){for(var e=[];!i("punc",")");)i("expand","...")?(a(),e.push(new AST_Expansion({start:s(),expression:Se(!1),end:s()}))):e.push(Se(!1)),i("punc",")")||f(",");return a(),e}var le=function(e,t){var n=o.token;if("name"==n.type&&"await"==n.value&&m())return a(),m()||u("Unexpected await expression outside async function",o.prev.line,o.prev.col,o.prev.pos),new AST_Await({start:s(),end:o.token,expression:le(!0)});if(i("operator")&&UNARY_PREFIX.has(n.value)){a(),E();var r=_e(AST_UnaryPrefix,n,le(e));return r.start=n,r.end=s(),r}for(var l=H(e,t);i("operator")&&UNARY_POSTFIX.has(o.token.value)&&!p(o.token);)l instanceof AST_Arrow&&_(),(l=_e(AST_UnaryPostfix,o.token,l)).start=n,l.end=o.token,a();return l};function _e(e,t,n){var i=t.value;switch(i){case"++":case"--":fe(n)||u("Invalid use of "+i+" operator",t.line,t.col,t.pos);break;case"delete":n instanceof AST_SymbolRef&&o.input.has_directive("use strict")&&u("Calling delete on expression not allowed in strict mode",n.start.line,n.start.col,n.start.pos);}return new e({operator:i,expression:n})}var ce=function(e,t,n){var r=i("operator")?o.token.value:null;"in"==r&&n&&(r=null),"**"==r&&e instanceof AST_UnaryPrefix&&!is_token(e.start,"punc","(")&&"--"!==e.operator&&"++"!==e.operator&&_(e.start);var s=null!=r?PRECEDENCE[r]:null;if(null!=s&&(s>t||"**"===r&&t===s)){a();var u=ce(le(!0),s,n);return ce(new AST_Binary({start:e.start,left:e,operator:r,right:u,end:u.end}),t,n)}return e};function fe(e){return e instanceof AST_PropAccess||e instanceof AST_SymbolRef}function pe(e){if(e instanceof AST_Object)e=new AST_Destructuring({start:e.start,names:e.properties.map(pe),is_array:!1,end:e.end});else if(e instanceof AST_Array){for(var t=[],n=0;n<e.elements.length;n++)e.elements[n]instanceof AST_Expansion&&(n+1!==e.elements.length&&l(e.elements[n].start,"Spread must the be last element in destructuring array"),e.elements[n].expression=pe(e.elements[n].expression)),t.push(pe(e.elements[n]));e=new AST_Destructuring({start:e.start,names:t,is_array:!0,end:e.end});}else e instanceof AST_ObjectProperty?e.value=pe(e.value):e instanceof AST_Assign&&(e=new AST_DefaultAssign({start:e.start,left:e.left,operator:"=",right:e.right,end:e.end}));return e}var de=function(e){E();var t=o.token;if("name"==t.type&&"yield"==t.value){if(S())return a(),function(){S()||u("Unexpected yield expression outside generator function",o.prev.line,o.prev.col,o.prev.pos);var e=o.token,t=!1,n=!0;return d()||i("punc")&&PUNC_AFTER_EXPRESSION.has(o.token.value)?n=!1:i("operator","*")&&(t=!0,a()),new AST_Yield({start:e,is_star:t,expression:n?Se():null,end:s()})}();o.input.has_directive("use strict")&&l(o.token,"Unexpected yield identifier inside strict mode");}var n=function(e){var t=o.token,n=function(e){return ce(le(!0,!0),0,e)}(e);if(i("operator","?")){a();var r=Se(!1);return f(":"),new AST_Conditional({start:t,condition:n,consequent:r,alternative:Se(!1,e),end:s()})}return n}(e),r=o.token.value;if(i("operator")&&ASSIGNMENT.has(r)){if(fe(n)||(n=pe(n))instanceof AST_Destructuring)return a(),new AST_Assign({start:t,left:n,operator:r,right:de(e),logical:LOGICAL_ASSIGNMENT.has(r),end:s()});u("Invalid assignment");}return n},Se=function(e,t){for(var n=o.token,s=[];s.push(de(t)),e&&i("punc",",");)a(),e=!0;return 1==s.length?s[0]:new AST_Sequence({start:n,expressions:s,end:r()})};function me(e){++o.in_loop;var t=e();return --o.in_loop,t}return t.expression?Se(!0):function(){var e=o.token,n=[];for(o.input.push_directives_stack(),t.module&&o.input.add_directive("use strict");!i("eof");)n.push(g());o.input.pop_directives_stack();var r=s(),a=t.toplevel;return a?(a.body=a.body.concat(n),a.end=r):a=new AST_Toplevel({start:e,body:n,end:r}),a}()}function DEFNODE(e,t,n,o=AST_Node){var i=t=t?t.split(/\s+/):[];o&&o.PROPS&&(t=t.concat(o.PROPS));for(var r="return function AST_"+e+"(props){ if (props) { ",a=t.length;--a>=0;)r+="this."+t[a]+" = props."+t[a]+";";const s=o&&Object.create(o.prototype);(s&&s.initialize||n&&n.initialize)&&(r+="this.initialize();"),r+="}",r+="this.flags = 0;",r+="}";var u=new Function(r)();if(s&&(u.prototype=s,u.BASE=o),o&&o.SUBCLASSES.push(u),u.prototype.CTOR=u,u.prototype.constructor=u,u.PROPS=t||null,u.SELF_PROPS=i,u.SUBCLASSES=[],e&&(u.prototype.TYPE=u.TYPE=e),n)for(a in n)HOP(n,a)&&("$"===a[0]?u[a.substr(1)]=n[a]:u.prototype[a]=n[a]);return u.DEFMETHOD=function(e,t){this.prototype[e]=t;},u}const has_tok_flag=(e,t)=>Boolean(e.flags&t),set_tok_flag=(e,t,n)=>{n?e.flags|=t:e.flags&=~t;};class AST_Token{constructor(e,t,n,o,i,r,a,s,u){this.flags=r?1:0,this.type=e,this.value=t,this.line=n,this.col=o,this.pos=i,this.comments_before=a,this.comments_after=s,this.file=u,Object.seal(this);}get nlb(){return has_tok_flag(this,1)}set nlb(e){set_tok_flag(this,1,e);}get quote(){return has_tok_flag(this,4)?has_tok_flag(this,2)?"'":'"':""}set quote(e){set_tok_flag(this,2,"'"===e),set_tok_flag(this,4,!!e);}}var AST_Node=DEFNODE("Node","start end",{_clone:function(e){if(e){var t=this.clone();return t.transform(new TreeTransformer((function(e){if(e!==t)return e.clone(!0)})))}return new this.CTOR(this)},clone:function(e){return this._clone(e)},$documentation:"Base class of all AST nodes",$propdoc:{start:"[AST_Token] The first token of this node",end:"[AST_Token] The last token of this node"},_walk:function(e){return e._visit(this)},walk:function(e){return this._walk(e)},_children_backwards:()=>{}},null),AST_Statement=DEFNODE("Statement",null,{$documentation:"Base class of all statements"}),AST_Debugger=DEFNODE("Debugger",null,{$documentation:"Represents a debugger statement"},AST_Statement),AST_Directive=DEFNODE("Directive","value quote",{$documentation:'Represents a directive, like "use strict";',$propdoc:{value:"[string] The value of this directive as a plain string (it's not an AST_String!)",quote:"[string] the original quote character"}},AST_Statement),AST_SimpleStatement=DEFNODE("SimpleStatement","body",{$documentation:"A statement consisting of an expression, i.e. a = 1 + 2",$propdoc:{body:"[AST_Node] an expression node (should not be instanceof AST_Statement)"},_walk:function(e){return e._visit(this,(function(){this.body._walk(e);}))},_children_backwards(e){e(this.body);}},AST_Statement);function walk_body(e,t){const n=e.body;for(var o=0,i=n.length;o<i;o++)n[o]._walk(t);}function clone_block_scope(e){var t=this._clone(e);return this.block_scope&&(t.block_scope=this.block_scope.clone()),t}var AST_Block=DEFNODE("Block","body block_scope",{$documentation:"A body of statements (usually braced)",$propdoc:{body:"[AST_Statement*] an array of statements",block_scope:"[AST_Scope] the block scope"},_walk:function(e){return e._visit(this,(function(){walk_body(this,e);}))},_children_backwards(e){let t=this.body.length;for(;t--;)e(this.body[t]);},clone:clone_block_scope},AST_Statement),AST_BlockStatement=DEFNODE("BlockStatement",null,{$documentation:"A block statement"},AST_Block),AST_EmptyStatement=DEFNODE("EmptyStatement",null,{$documentation:"The empty statement (empty block or simply a semicolon)"},AST_Statement),AST_StatementWithBody=DEFNODE("StatementWithBody","body",{$documentation:"Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`",$propdoc:{body:"[AST_Statement] the body; this should always be present, even if it's an AST_EmptyStatement"}},AST_Statement),AST_LabeledStatement=DEFNODE("LabeledStatement","label",{$documentation:"Statement with a label",$propdoc:{label:"[AST_Label] a label definition"},_walk:function(e){return e._visit(this,(function(){this.label._walk(e),this.body._walk(e);}))},_children_backwards(e){e(this.body),e(this.label);},clone:function(e){var t=this._clone(e);if(e){var n=t.label,o=this.label;t.walk(new TreeWalker((function(e){e instanceof AST_LoopControl&&e.label&&e.label.thedef===o&&(e.label.thedef=n,n.references.push(e));})));}return t}},AST_StatementWithBody),AST_IterationStatement=DEFNODE("IterationStatement","block_scope",{$documentation:"Internal class. All loops inherit from it.",$propdoc:{block_scope:"[AST_Scope] the block scope for this iteration statement."},clone:clone_block_scope},AST_StatementWithBody),AST_DWLoop=DEFNODE("DWLoop","condition",{$documentation:"Base class for do/while statements",$propdoc:{condition:"[AST_Node] the loop condition. Should not be instanceof AST_Statement"}},AST_IterationStatement),AST_Do=DEFNODE("Do",null,{$documentation:"A `do` statement",_walk:function(e){return e._visit(this,(function(){this.body._walk(e),this.condition._walk(e);}))},_children_backwards(e){e(this.condition),e(this.body);}},AST_DWLoop),AST_While=DEFNODE("While",null,{$documentation:"A `while` statement",_walk:function(e){return e._visit(this,(function(){this.condition._walk(e),this.body._walk(e);}))},_children_backwards(e){e(this.body),e(this.condition);}},AST_DWLoop),AST_For=DEFNODE("For","init condition step",{$documentation:"A `for` statement",$propdoc:{init:"[AST_Node?] the `for` initialization code, or null if empty",condition:"[AST_Node?] the `for` termination clause, or null if empty",step:"[AST_Node?] the `for` update clause, or null if empty"},_walk:function(e){return e._visit(this,(function(){this.init&&this.init._walk(e),this.condition&&this.condition._walk(e),this.step&&this.step._walk(e),this.body._walk(e);}))},_children_backwards(e){e(this.body),this.step&&e(this.step),this.condition&&e(this.condition),this.init&&e(this.init);}},AST_IterationStatement),AST_ForIn=DEFNODE("ForIn","init object",{$documentation:"A `for ... in` statement",$propdoc:{init:"[AST_Node] the `for/in` initialization code",object:"[AST_Node] the object that we're looping through"},_walk:function(e){return e._visit(this,(function(){this.init._walk(e),this.object._walk(e),this.body._walk(e);}))},_children_backwards(e){e(this.body),this.object&&e(this.object),this.init&&e(this.init);}},AST_IterationStatement),AST_ForOf=DEFNODE("ForOf","await",{$documentation:"A `for ... of` statement"},AST_ForIn),AST_With=DEFNODE("With","expression",{$documentation:"A `with` statement",$propdoc:{expression:"[AST_Node] the `with` expression"},_walk:function(e){return e._visit(this,(function(){this.expression._walk(e),this.body._walk(e);}))},_children_backwards(e){e(this.body),e(this.expression);}},AST_StatementWithBody),AST_Scope=DEFNODE("Scope","variables functions uses_with uses_eval parent_scope enclosed cname",{$documentation:"Base class for all statements introducing a lexical scope",$propdoc:{variables:"[Map/S] a map of name -> SymbolDef for all variables/functions defined in this scope",functions:"[Map/S] like `variables`, but only lists function declarations",uses_with:"[boolean/S] tells whether this scope uses the `with` statement",uses_eval:"[boolean/S] tells whether this scope contains a direct call to the global `eval`",parent_scope:"[AST_Scope?/S] link to the parent scope",enclosed:"[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",cname:"[integer/S] current index for mangling variables (used internally by the mangler)"},get_defun_scope:function(){for(var e=this;e.is_block_scope();)e=e.parent_scope;return e},clone:function(e,t){var n=this._clone(e);return e&&this.variables&&t&&!this._block_scope?n.figure_out_scope({},{toplevel:t,parent_scope:this.parent_scope}):(this.variables&&(n.variables=new Map(this.variables)),this.functions&&(n.functions=new Map(this.functions)),this.enclosed&&(n.enclosed=this.enclosed.slice()),this._block_scope&&(n._block_scope=this._block_scope)),n},pinned:function(){return this.uses_eval||this.uses_with}},AST_Block),AST_Toplevel=DEFNODE("Toplevel","globals",{$documentation:"The toplevel scope",$propdoc:{globals:"[Map/S] a map of name -> SymbolDef for all undeclared names"},wrap_commonjs:function(e){var t=this.body,n="(function(exports){'$ORIG';})(typeof "+e+"=='undefined'?("+e+"={}):"+e+");";return (n=parse$5(n)).transform(new TreeTransformer((function(e){if(e instanceof AST_Directive&&"$ORIG"==e.value)return MAP.splice(t)})))},wrap_enclose:function(e){"string"!=typeof e&&(e="");var t=e.indexOf(":");t<0&&(t=e.length);var n=this.body;return parse$5(["(function(",e.slice(0,t),'){"$ORIG"})(',e.slice(t+1),")"].join("")).transform(new TreeTransformer((function(e){if(e instanceof AST_Directive&&"$ORIG"==e.value)return MAP.splice(n)})))}},AST_Scope),AST_Expansion=DEFNODE("Expansion","expression",{$documentation:"An expandible argument, such as ...rest, a splat, such as [1,2,...all], or an expansion in a variable declaration, such as var [first, ...rest] = list",$propdoc:{expression:"[AST_Node] the thing to be expanded"},_walk:function(e){return e._visit(this,(function(){this.expression.walk(e);}))},_children_backwards(e){e(this.expression);}}),AST_Lambda=DEFNODE("Lambda","name argnames uses_arguments is_generator async",{$documentation:"Base class for functions",$propdoc:{name:"[AST_SymbolDeclaration?] the name of this function",argnames:"[AST_SymbolFunarg|AST_Destructuring|AST_Expansion|AST_DefaultAssign*] array of function arguments, destructurings, or expanding arguments",uses_arguments:"[boolean/S] tells whether this function accesses the arguments array",is_generator:"[boolean] is this a generator method",async:"[boolean] is this method async"},args_as_names:function(){for(var e=[],t=0;t<this.argnames.length;t++)this.argnames[t]instanceof AST_Destructuring?e.push(...this.argnames[t].all_symbols()):e.push(this.argnames[t]);return e},_walk:function(e){return e._visit(this,(function(){this.name&&this.name._walk(e);for(var t=this.argnames,n=0,o=t.length;n<o;n++)t[n]._walk(e);walk_body(this,e);}))},_children_backwards(e){let t=this.body.length;for(;t--;)e(this.body[t]);for(t=this.argnames.length;t--;)e(this.argnames[t]);this.name&&e(this.name);},is_braceless(){return this.body[0]instanceof AST_Return&&this.body[0].value}},AST_Scope),AST_Accessor=DEFNODE("Accessor",null,{$documentation:"A setter/getter function. The `name` property is always null."},AST_Lambda),AST_Function=DEFNODE("Function",null,{$documentation:"A function expression"},AST_Lambda),AST_Arrow=DEFNODE("Arrow",null,{$documentation:"An ES6 Arrow function ((a) => b)"},AST_Lambda),AST_Defun=DEFNODE("Defun",null,{$documentation:"A function definition"},AST_Lambda),AST_Destructuring=DEFNODE("Destructuring","names is_array",{$documentation:"A destructuring of several names. Used in destructuring assignment and with destructuring function argument names",$propdoc:{names:"[AST_Node*] Array of properties or elements",is_array:"[Boolean] Whether the destructuring represents an object or array"},_walk:function(e){return e._visit(this,(function(){this.names.forEach((function(t){t._walk(e);}));}))},_children_backwards(e){let t=this.names.length;for(;t--;)e(this.names[t]);},all_symbols:function(){var e=[];return this.walk(new TreeWalker((function(t){t instanceof AST_Symbol&&e.push(t);}))),e}}),AST_PrefixedTemplateString=DEFNODE("PrefixedTemplateString","template_string prefix",{$documentation:"A templatestring with a prefix, such as String.raw`foobarbaz`",$propdoc:{template_string:"[AST_TemplateString] The template string",prefix:"[AST_Node] The prefix, which will get called."},_walk:function(e){return e._visit(this,(function(){this.prefix._walk(e),this.template_string._walk(e);}))},_children_backwards(e){e(this.template_string),e(this.prefix);}}),AST_TemplateString=DEFNODE("TemplateString","segments",{$documentation:"A template string literal",$propdoc:{segments:"[AST_Node*] One or more segments, starting with AST_TemplateSegment. AST_Node may follow AST_TemplateSegment, but each AST_Node must be followed by AST_TemplateSegment."},_walk:function(e){return e._visit(this,(function(){this.segments.forEach((function(t){t._walk(e);}));}))},_children_backwards(e){let t=this.segments.length;for(;t--;)e(this.segments[t]);}}),AST_TemplateSegment=DEFNODE("TemplateSegment","value raw",{$documentation:"A segment of a template string literal",$propdoc:{value:"Content of the segment",raw:"Raw source of the segment"}}),AST_Jump=DEFNODE("Jump",null,{$documentation:"Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"},AST_Statement),AST_Exit=DEFNODE("Exit","value",{$documentation:"Base class for “exits” (`return` and `throw`)",$propdoc:{value:"[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"},_walk:function(e){return e._visit(this,this.value&&function(){this.value._walk(e);})},_children_backwards(e){this.value&&e(this.value);}},AST_Jump),AST_Return=DEFNODE("Return",null,{$documentation:"A `return` statement"},AST_Exit),AST_Throw=DEFNODE("Throw",null,{$documentation:"A `throw` statement"},AST_Exit),AST_LoopControl=DEFNODE("LoopControl","label",{$documentation:"Base class for loop control statements (`break` and `continue`)",$propdoc:{label:"[AST_LabelRef?] the label, or null if none"},_walk:function(e){return e._visit(this,this.label&&function(){this.label._walk(e);})},_children_backwards(e){this.label&&e(this.label);}},AST_Jump),AST_Break=DEFNODE("Break",null,{$documentation:"A `break` statement"},AST_LoopControl),AST_Continue=DEFNODE("Continue",null,{$documentation:"A `continue` statement"},AST_LoopControl),AST_Await=DEFNODE("Await","expression",{$documentation:"An `await` statement",$propdoc:{expression:"[AST_Node] the mandatory expression being awaited"},_walk:function(e){return e._visit(this,(function(){this.expression._walk(e);}))},_children_backwards(e){e(this.expression);}}),AST_Yield=DEFNODE("Yield","expression is_star",{$documentation:"A `yield` statement",$propdoc:{expression:"[AST_Node?] the value returned or thrown by this statement; could be null (representing undefined) but only when is_star is set to false",is_star:"[Boolean] Whether this is a yield or yield* statement"},_walk:function(e){return e._visit(this,this.expression&&function(){this.expression._walk(e);})},_children_backwards(e){this.expression&&e(this.expression);}}),AST_If=DEFNODE("If","condition alternative",{$documentation:"A `if` statement",$propdoc:{condition:"[AST_Node] the `if` condition",alternative:"[AST_Statement?] the `else` part, or null if not present"},_walk:function(e){return e._visit(this,(function(){this.condition._walk(e),this.body._walk(e),this.alternative&&this.alternative._walk(e);}))},_children_backwards(e){this.alternative&&e(this.alternative),e(this.body),e(this.condition);}},AST_StatementWithBody),AST_Switch=DEFNODE("Switch","expression",{$documentation:"A `switch` statement",$propdoc:{expression:"[AST_Node] the `switch` “discriminant”"},_walk:function(e){return e._visit(this,(function(){this.expression._walk(e),walk_body(this,e);}))},_children_backwards(e){let t=this.body.length;for(;t--;)e(this.body[t]);e(this.expression);}},AST_Block),AST_SwitchBranch=DEFNODE("SwitchBranch",null,{$documentation:"Base class for `switch` branches"},AST_Block),AST_Default=DEFNODE("Default",null,{$documentation:"A `default` switch branch"},AST_SwitchBranch),AST_Case=DEFNODE("Case","expression",{$documentation:"A `case` switch branch",$propdoc:{expression:"[AST_Node] the `case` expression"},_walk:function(e){return e._visit(this,(function(){this.expression._walk(e),walk_body(this,e);}))},_children_backwards(e){let t=this.body.length;for(;t--;)e(this.body[t]);e(this.expression);}},AST_SwitchBranch),AST_Try=DEFNODE("Try","bcatch bfinally",{$documentation:"A `try` statement",$propdoc:{bcatch:"[AST_Catch?] the catch block, or null if not present",bfinally:"[AST_Finally?] the finally block, or null if not present"},_walk:function(e){return e._visit(this,(function(){walk_body(this,e),this.bcatch&&this.bcatch._walk(e),this.bfinally&&this.bfinally._walk(e);}))},_children_backwards(e){this.bfinally&&e(this.bfinally),this.bcatch&&e(this.bcatch);let t=this.body.length;for(;t--;)e(this.body[t]);}},AST_Block),AST_Catch=DEFNODE("Catch","argname",{$documentation:"A `catch` node; only makes sense as part of a `try` statement",$propdoc:{argname:"[AST_SymbolCatch|AST_Destructuring|AST_Expansion|AST_DefaultAssign] symbol for the exception"},_walk:function(e){return e._visit(this,(function(){this.argname&&this.argname._walk(e),walk_body(this,e);}))},_children_backwards(e){let t=this.body.length;for(;t--;)e(this.body[t]);this.argname&&e(this.argname);}},AST_Block),AST_Finally=DEFNODE("Finally",null,{$documentation:"A `finally` node; only makes sense as part of a `try` statement"},AST_Block),AST_Definitions=DEFNODE("Definitions","definitions",{$documentation:"Base class for `var` or `const` nodes (variable declarations/initializations)",$propdoc:{definitions:"[AST_VarDef*] array of variable definitions"},_walk:function(e){return e._visit(this,(function(){for(var t=this.definitions,n=0,o=t.length;n<o;n++)t[n]._walk(e);}))},_children_backwards(e){let t=this.definitions.length;for(;t--;)e(this.definitions[t]);}},AST_Statement),AST_Var=DEFNODE("Var",null,{$documentation:"A `var` statement"},AST_Definitions),AST_Let=DEFNODE("Let",null,{$documentation:"A `let` statement"},AST_Definitions),AST_Const=DEFNODE("Const",null,{$documentation:"A `const` statement"},AST_Definitions),AST_VarDef=DEFNODE("VarDef","name value",{$documentation:"A variable declaration; only appears in a AST_Definitions node",$propdoc:{name:"[AST_Destructuring|AST_SymbolConst|AST_SymbolLet|AST_SymbolVar] name of the variable",value:"[AST_Node?] initializer, or null of there's no initializer"},_walk:function(e){return e._visit(this,(function(){this.name._walk(e),this.value&&this.value._walk(e);}))},_children_backwards(e){this.value&&e(this.value),e(this.name);}}),AST_NameMapping=DEFNODE("NameMapping","foreign_name name",{$documentation:"The part of the export/import statement that declare names from a module.",$propdoc:{foreign_name:"[AST_SymbolExportForeign|AST_SymbolImportForeign] The name being exported/imported (as specified in the module)",name:"[AST_SymbolExport|AST_SymbolImport] The name as it is visible to this module."},_walk:function(e){return e._visit(this,(function(){this.foreign_name._walk(e),this.name._walk(e);}))},_children_backwards(e){e(this.name),e(this.foreign_name);}}),AST_Import=DEFNODE("Import","imported_name imported_names module_name",{$documentation:"An `import` statement",$propdoc:{imported_name:"[AST_SymbolImport] The name of the variable holding the module's default export.",imported_names:"[AST_NameMapping*] The names of non-default imported variables",module_name:"[AST_String] String literal describing where this module came from"},_walk:function(e){return e._visit(this,(function(){this.imported_name&&this.imported_name._walk(e),this.imported_names&&this.imported_names.forEach((function(t){t._walk(e);})),this.module_name._walk(e);}))},_children_backwards(e){if(e(this.module_name),this.imported_names){let t=this.imported_names.length;for(;t--;)e(this.imported_names[t]);}this.imported_name&&e(this.imported_name);}}),AST_ImportMeta=DEFNODE("ImportMeta",null,{$documentation:"A reference to import.meta"}),AST_Export=DEFNODE("Export","exported_definition exported_value is_default exported_names module_name",{$documentation:"An `export` statement",$propdoc:{exported_definition:"[AST_Defun|AST_Definitions|AST_DefClass?] An exported definition",exported_value:"[AST_Node?] An exported value",exported_names:"[AST_NameMapping*?] List of exported names",module_name:"[AST_String?] Name of the file to load exports from",is_default:"[Boolean] Whether this is the default exported value of this module"},_walk:function(e){return e._visit(this,(function(){this.exported_definition&&this.exported_definition._walk(e),this.exported_value&&this.exported_value._walk(e),this.exported_names&&this.exported_names.forEach((function(t){t._walk(e);})),this.module_name&&this.module_name._walk(e);}))},_children_backwards(e){if(this.module_name&&e(this.module_name),this.exported_names){let t=this.exported_names.length;for(;t--;)e(this.exported_names[t]);}this.exported_value&&e(this.exported_value),this.exported_definition&&e(this.exported_definition);}},AST_Statement),AST_Call=DEFNODE("Call","expression args optional _annotations",{$documentation:"A function call expression",$propdoc:{expression:"[AST_Node] expression to invoke as function",args:"[AST_Node*] array of arguments",optional:"[boolean] whether this is an optional call (IE ?.() )",_annotations:"[number] bitfield containing information about the call"},initialize(){null==this._annotations&&(this._annotations=0);},_walk(e){return e._visit(this,(function(){for(var t=this.args,n=0,o=t.length;n<o;n++)t[n]._walk(e);this.expression._walk(e);}))},_children_backwards(e){let t=this.args.length;for(;t--;)e(this.args[t]);e(this.expression);}}),AST_New=DEFNODE("New",null,{$documentation:"An object instantiation. Derives from a function call since it has exactly the same properties"},AST_Call),AST_Sequence=DEFNODE("Sequence","expressions",{$documentation:"A sequence expression (comma-separated expressions)",$propdoc:{expressions:"[AST_Node*] array of expressions (at least two)"},_walk:function(e){return e._visit(this,(function(){this.expressions.forEach((function(t){t._walk(e);}));}))},_children_backwards(e){let t=this.expressions.length;for(;t--;)e(this.expressions[t]);}}),AST_PropAccess=DEFNODE("PropAccess","expression property optional",{$documentation:'Base class for property access expressions, i.e. `a.foo` or `a["foo"]`',$propdoc:{expression:"[AST_Node] the “container” expression",property:"[AST_Node|string] the property to access. For AST_Dot & AST_DotHash this is always a plain string, while for AST_Sub it's an arbitrary AST_Node",optional:"[boolean] whether this is an optional property access (IE ?.)"}}),AST_Dot=DEFNODE("Dot","quote",{$documentation:"A dotted property access expression",$propdoc:{quote:"[string] the original quote character when transformed from AST_Sub"},_walk:function(e){return e._visit(this,(function(){this.expression._walk(e);}))},_children_backwards(e){e(this.expression);}},AST_PropAccess),AST_DotHash=DEFNODE("DotHash","",{$documentation:"A dotted property access to a private property",_walk:function(e){return e._visit(this,(function(){this.expression._walk(e);}))},_children_backwards(e){e(this.expression);}},AST_PropAccess),AST_Sub=DEFNODE("Sub",null,{$documentation:'Index-style property access, i.e. `a["foo"]`',_walk:function(e){return e._visit(this,(function(){this.expression._walk(e),this.property._walk(e);}))},_children_backwards(e){e(this.property),e(this.expression);}},AST_PropAccess),AST_Chain=DEFNODE("Chain","expression",{$documentation:"A chain expression like a?.b?.(c)?.[d]",$propdoc:{expression:"[AST_Call|AST_Dot|AST_DotHash|AST_Sub] chain element."},_walk:function(e){return e._visit(this,(function(){this.expression._walk(e);}))},_children_backwards(e){e(this.expression);}}),AST_Unary=DEFNODE("Unary","operator expression",{$documentation:"Base class for unary expressions",$propdoc:{operator:"[string] the operator",expression:"[AST_Node] expression that this unary operator applies to"},_walk:function(e){return e._visit(this,(function(){this.expression._walk(e);}))},_children_backwards(e){e(this.expression);}}),AST_UnaryPrefix=DEFNODE("UnaryPrefix",null,{$documentation:"Unary prefix expression, i.e. `typeof i` or `++i`"},AST_Unary),AST_UnaryPostfix=DEFNODE("UnaryPostfix",null,{$documentation:"Unary postfix expression, i.e. `i++`"},AST_Unary),AST_Binary=DEFNODE("Binary","operator left right",{$documentation:"Binary expression, i.e. `a + b`",$propdoc:{left:"[AST_Node] left-hand side expression",operator:"[string] the operator",right:"[AST_Node] right-hand side expression"},_walk:function(e){return e._visit(this,(function(){this.left._walk(e),this.right._walk(e);}))},_children_backwards(e){e(this.right),e(this.left);}}),AST_Conditional=DEFNODE("Conditional","condition consequent alternative",{$documentation:"Conditional expression using the ternary operator, i.e. `a ? b : c`",$propdoc:{condition:"[AST_Node]",consequent:"[AST_Node]",alternative:"[AST_Node]"},_walk:function(e){return e._visit(this,(function(){this.condition._walk(e),this.consequent._walk(e),this.alternative._walk(e);}))},_children_backwards(e){e(this.alternative),e(this.consequent),e(this.condition);}}),AST_Assign=DEFNODE("Assign","logical",{$documentation:"An assignment expression — `a = b + 5`",$propdoc:{logical:"Whether it's a logical assignment"}},AST_Binary),AST_DefaultAssign=DEFNODE("DefaultAssign",null,{$documentation:"A default assignment expression like in `(a = 3) => a`"},AST_Binary),AST_Array=DEFNODE("Array","elements",{$documentation:"An array literal",$propdoc:{elements:"[AST_Node*] array of elements"},_walk:function(e){return e._visit(this,(function(){for(var t=this.elements,n=0,o=t.length;n<o;n++)t[n]._walk(e);}))},_children_backwards(e){let t=this.elements.length;for(;t--;)e(this.elements[t]);}}),AST_Object=DEFNODE("Object","properties",{$documentation:"An object literal",$propdoc:{properties:"[AST_ObjectProperty*] array of properties"},_walk:function(e){return e._visit(this,(function(){for(var t=this.properties,n=0,o=t.length;n<o;n++)t[n]._walk(e);}))},_children_backwards(e){let t=this.properties.length;for(;t--;)e(this.properties[t]);}}),AST_ObjectProperty=DEFNODE("ObjectProperty","key value",{$documentation:"Base class for literal object properties",$propdoc:{key:"[string|AST_Node] property name. For ObjectKeyVal this is a string. For getters, setters and computed property this is an AST_Node.",value:"[AST_Node] property value. For getters and setters this is an AST_Accessor."},_walk:function(e){return e._visit(this,(function(){this.key instanceof AST_Node&&this.key._walk(e),this.value._walk(e);}))},_children_backwards(e){e(this.value),this.key instanceof AST_Node&&e(this.key);}}),AST_ObjectKeyVal=DEFNODE("ObjectKeyVal","quote",{$documentation:"A key: value object property",$propdoc:{quote:"[string] the original quote character"},computed_key(){return this.key instanceof AST_Node}},AST_ObjectProperty),AST_PrivateSetter=DEFNODE("PrivateSetter","static",{$propdoc:{static:"[boolean] whether this is a static private setter"},$documentation:"A private setter property",computed_key:()=>!1},AST_ObjectProperty),AST_PrivateGetter=DEFNODE("PrivateGetter","static",{$propdoc:{static:"[boolean] whether this is a static private getter"},$documentation:"A private getter property",computed_key:()=>!1},AST_ObjectProperty),AST_ObjectSetter=DEFNODE("ObjectSetter","quote static",{$propdoc:{quote:"[string|undefined] the original quote character, if any",static:"[boolean] whether this is a static setter (classes only)"},$documentation:"An object setter property",computed_key(){return !(this.key instanceof AST_SymbolMethod)}},AST_ObjectProperty),AST_ObjectGetter=DEFNODE("ObjectGetter","quote static",{$propdoc:{quote:"[string|undefined] the original quote character, if any",static:"[boolean] whether this is a static getter (classes only)"},$documentation:"An object getter property",computed_key(){return !(this.key instanceof AST_SymbolMethod)}},AST_ObjectProperty),AST_ConciseMethod=DEFNODE("ConciseMethod","quote static is_generator async",{$propdoc:{quote:"[string|undefined] the original quote character, if any",static:"[boolean] is this method static (classes only)",is_generator:"[boolean] is this a generator method",async:"[boolean] is this method async"},$documentation:"An ES6 concise method inside an object or class",computed_key(){return !(this.key instanceof AST_SymbolMethod)}},AST_ObjectProperty),AST_PrivateMethod=DEFNODE("PrivateMethod","",{$documentation:"A private class method inside a class"},AST_ConciseMethod),AST_Class=DEFNODE("Class","name extends properties",{$propdoc:{name:"[AST_SymbolClass|AST_SymbolDefClass?] optional class name.",extends:"[AST_Node]? optional parent class",properties:"[AST_ObjectProperty*] array of properties"},$documentation:"An ES6 class",_walk:function(e){return e._visit(this,(function(){this.name&&this.name._walk(e),this.extends&&this.extends._walk(e),this.properties.forEach((t=>t._walk(e)));}))},_children_backwards(e){let t=this.properties.length;for(;t--;)e(this.properties[t]);this.extends&&e(this.extends),this.name&&e(this.name);}},AST_Scope),AST_ClassProperty=DEFNODE("ClassProperty","static quote",{$documentation:"A class property",$propdoc:{static:"[boolean] whether this is a static key",quote:"[string] which quote is being used"},_walk:function(e){return e._visit(this,(function(){this.key instanceof AST_Node&&this.key._walk(e),this.value instanceof AST_Node&&this.value._walk(e);}))},_children_backwards(e){this.value instanceof AST_Node&&e(this.value),this.key instanceof AST_Node&&e(this.key);},computed_key(){return !(this.key instanceof AST_SymbolClassProperty)}},AST_ObjectProperty),AST_ClassPrivateProperty=DEFNODE("ClassProperty","",{$documentation:"A class property for a private property"},AST_ClassProperty),AST_DefClass=DEFNODE("DefClass",null,{$documentation:"A class definition"},AST_Class),AST_ClassExpression=DEFNODE("ClassExpression",null,{$documentation:"A class expression."},AST_Class),AST_Symbol=DEFNODE("Symbol","scope name thedef",{$propdoc:{name:"[string] name of this symbol",scope:"[AST_Scope/S] the current scope (not necessarily the definition scope)",thedef:"[SymbolDef/S] the definition of this symbol"},$documentation:"Base class for all symbols"}),AST_NewTarget=DEFNODE("NewTarget",null,{$documentation:"A reference to new.target"}),AST_SymbolDeclaration=DEFNODE("SymbolDeclaration","init",{$documentation:"A declaration symbol (symbol in var/const, function name or argument, symbol in catch)"},AST_Symbol),AST_SymbolVar=DEFNODE("SymbolVar",null,{$documentation:"Symbol defining a variable"},AST_SymbolDeclaration),AST_SymbolBlockDeclaration=DEFNODE("SymbolBlockDeclaration",null,{$documentation:"Base class for block-scoped declaration symbols"},AST_SymbolDeclaration),AST_SymbolConst=DEFNODE("SymbolConst",null,{$documentation:"A constant declaration"},AST_SymbolBlockDeclaration),AST_SymbolLet=DEFNODE("SymbolLet",null,{$documentation:"A block-scoped `let` declaration"},AST_SymbolBlockDeclaration),AST_SymbolFunarg=DEFNODE("SymbolFunarg",null,{$documentation:"Symbol naming a function argument"},AST_SymbolVar),AST_SymbolDefun=DEFNODE("SymbolDefun",null,{$documentation:"Symbol defining a function"},AST_SymbolDeclaration),AST_SymbolMethod=DEFNODE("SymbolMethod",null,{$documentation:"Symbol in an object defining a method"},AST_Symbol),AST_SymbolClassProperty=DEFNODE("SymbolClassProperty",null,{$documentation:"Symbol for a class property"},AST_Symbol),AST_SymbolLambda=DEFNODE("SymbolLambda",null,{$documentation:"Symbol naming a function expression"},AST_SymbolDeclaration),AST_SymbolDefClass=DEFNODE("SymbolDefClass",null,{$documentation:"Symbol naming a class's name in a class declaration. Lexically scoped to its containing scope, and accessible within the class."},AST_SymbolBlockDeclaration),AST_SymbolClass=DEFNODE("SymbolClass",null,{$documentation:"Symbol naming a class's name. Lexically scoped to the class."},AST_SymbolDeclaration),AST_SymbolCatch=DEFNODE("SymbolCatch",null,{$documentation:"Symbol naming the exception in catch"},AST_SymbolBlockDeclaration),AST_SymbolImport=DEFNODE("SymbolImport",null,{$documentation:"Symbol referring to an imported name"},AST_SymbolBlockDeclaration),AST_SymbolImportForeign=DEFNODE("SymbolImportForeign",null,{$documentation:"A symbol imported from a module, but it is defined in the other module, and its real name is irrelevant for this module's purposes"},AST_Symbol),AST_Label=DEFNODE("Label","references",{$documentation:"Symbol naming a label (declaration)",$propdoc:{references:"[AST_LoopControl*] a list of nodes referring to this label"},initialize:function(){this.references=[],this.thedef=this;}},AST_Symbol),AST_SymbolRef=DEFNODE("SymbolRef",null,{$documentation:"Reference to some symbol (not definition/declaration)"},AST_Symbol),AST_SymbolExport=DEFNODE("SymbolExport",null,{$documentation:"Symbol referring to a name to export"},AST_SymbolRef),AST_SymbolExportForeign=DEFNODE("SymbolExportForeign",null,{$documentation:"A symbol exported from this module, but it is used in the other module, and its real name is irrelevant for this module's purposes"},AST_Symbol),AST_LabelRef=DEFNODE("LabelRef",null,{$documentation:"Reference to a label symbol"},AST_Symbol),AST_This=DEFNODE("This",null,{$documentation:"The `this` symbol"},AST_Symbol),AST_Super=DEFNODE("Super",null,{$documentation:"The `super` symbol"},AST_This),AST_Constant=DEFNODE("Constant",null,{$documentation:"Base class for all constants",getValue:function(){return this.value}}),AST_String=DEFNODE("String","value quote",{$documentation:"A string literal",$propdoc:{value:"[string] the contents of this string",quote:"[string] the original quote character"}},AST_Constant),AST_Number=DEFNODE("Number","value raw",{$documentation:"A number literal",$propdoc:{value:"[number] the numeric value",raw:"[string] numeric value as string"}},AST_Constant),AST_BigInt=DEFNODE("BigInt","value",{$documentation:"A big int literal",$propdoc:{value:"[string] big int value"}},AST_Constant),AST_RegExp=DEFNODE("RegExp","value",{$documentation:"A regexp literal",$propdoc:{value:"[RegExp] the actual regexp"}},AST_Constant),AST_Atom=DEFNODE("Atom",null,{$documentation:"Base class for atoms"},AST_Constant),AST_Null=DEFNODE("Null",null,{$documentation:"The `null` atom",value:null},AST_Atom),AST_NaN=DEFNODE("NaN",null,{$documentation:"The impossible value",value:NaN},AST_Atom),AST_Undefined=DEFNODE("Undefined",null,{$documentation:"The `undefined` value",value:void 0},AST_Atom),AST_Hole=DEFNODE("Hole",null,{$documentation:"A hole in an array",value:void 0},AST_Atom),AST_Infinity=DEFNODE("Infinity",null,{$documentation:"The `Infinity` value",value:1/0},AST_Atom),AST_Boolean=DEFNODE("Boolean",null,{$documentation:"Base class for booleans"},AST_Atom),AST_False=DEFNODE("False",null,{$documentation:"The `false` atom",value:!1},AST_Boolean),AST_True=DEFNODE("True",null,{$documentation:"The `true` atom",value:!0},AST_Boolean);function walk$3(e,t,n=[e]){const o=n.push.bind(n);for(;n.length;){const e=n.pop(),i=t(e,n);if(i){if(i===walk_abort)return !0}else e._children_backwards(o);}return !1}function walk_parent(e,t,n){const o=[e],i=o.push.bind(o),r=n?n.slice():[],a=[];let s;const u={parent:(e=0)=>-1===e?s:n&&e>=r.length?(e-=r.length,n[n.length-(e+1)]):r[r.length-(1+e)]};for(;o.length;){for(s=o.pop();a.length&&o.length==a[a.length-1];)r.pop(),a.pop();const e=t(s,u);if(e){if(e===walk_abort)return !0;continue}const n=o.length;s._children_backwards(i),o.length>n&&(r.push(s),a.push(n-1));}return !1}const walk_abort=Symbol("abort walk");class TreeWalker{constructor(e){this.visit=e,this.stack=[],this.directives=Object.create(null);}_visit(e,t){this.push(e);var n=this.visit(e,t?function(){t.call(e);}:noop);return !n&&t&&t.call(e),this.pop(),n}parent(e){return this.stack[this.stack.length-2-(e||0)]}push(e){e instanceof AST_Lambda?this.directives=Object.create(this.directives):e instanceof AST_Directive&&!this.directives[e.value]?this.directives[e.value]=e:e instanceof AST_Class&&(this.directives=Object.create(this.directives),this.directives["use strict"]||(this.directives["use strict"]=e)),this.stack.push(e);}pop(){var e=this.stack.pop();(e instanceof AST_Lambda||e instanceof AST_Class)&&(this.directives=Object.getPrototypeOf(this.directives));}self(){return this.stack[this.stack.length-1]}find_parent(e){for(var t=this.stack,n=t.length;--n>=0;){var o=t[n];if(o instanceof e)return o}}has_directive(e){var t=this.directives[e];if(t)return t;var n=this.stack[this.stack.length-1];if(n instanceof AST_Scope&&n.body)for(var o=0;o<n.body.length;++o){var i=n.body[o];if(!(i instanceof AST_Directive))break;if(i.value==e)return i}}loopcontrol_target(e){var t=this.stack;if(e.label){for(var n=t.length;--n>=0;)if((o=t[n])instanceof AST_LabeledStatement&&o.label.name==e.label.name)return o.body}else for(n=t.length;--n>=0;){var o;if((o=t[n])instanceof AST_IterationStatement||e instanceof AST_Break&&o instanceof AST_Switch)return o}}}class TreeTransformer extends TreeWalker{constructor(e,t){super(),this.before=e,this.after=t;}}const _PURE=1,_INLINE=2,_NOINLINE=4,ast=Object.freeze({__proto__:null,AST_Accessor,AST_Array,AST_Arrow,AST_Assign,AST_Atom,AST_Await,AST_BigInt,AST_Binary,AST_Block,AST_BlockStatement,AST_Boolean,AST_Break,AST_Call,AST_Case,AST_Catch,AST_Chain,AST_Class,AST_ClassExpression,AST_ClassPrivateProperty,AST_ClassProperty,AST_ConciseMethod,AST_Conditional,AST_Const,AST_Constant,AST_Continue,AST_Debugger,AST_Default,AST_DefaultAssign,AST_DefClass,AST_Definitions,AST_Defun,AST_Destructuring,AST_Directive,AST_Do,AST_Dot,AST_DotHash,AST_DWLoop,AST_EmptyStatement,AST_Exit,AST_Expansion,AST_Export,AST_False,AST_Finally,AST_For,AST_ForIn,AST_ForOf,AST_Function,AST_Hole,AST_If,AST_Import,AST_ImportMeta,AST_Infinity,AST_IterationStatement,AST_Jump,AST_Label,AST_LabeledStatement,AST_LabelRef,AST_Lambda,AST_Let,AST_LoopControl,AST_NameMapping,AST_NaN,AST_New,AST_NewTarget,AST_Node,AST_Null,AST_Number,AST_Object,AST_ObjectGetter,AST_ObjectKeyVal,AST_ObjectProperty,AST_ObjectSetter,AST_PrefixedTemplateString,AST_PrivateGetter,AST_PrivateMethod,AST_PrivateSetter,AST_PropAccess,AST_RegExp,AST_Return,AST_Scope,AST_Sequence,AST_SimpleStatement,AST_Statement,AST_StatementWithBody,AST_String,AST_Sub,AST_Super,AST_Switch,AST_SwitchBranch,AST_Symbol,AST_SymbolBlockDeclaration,AST_SymbolCatch,AST_SymbolClass,AST_SymbolClassProperty,AST_SymbolConst,AST_SymbolDeclaration,AST_SymbolDefClass,AST_SymbolDefun,AST_SymbolExport,AST_SymbolExportForeign,AST_SymbolFunarg,AST_SymbolImport,AST_SymbolImportForeign,AST_SymbolLambda,AST_SymbolLet,AST_SymbolMethod,AST_SymbolRef,AST_SymbolVar,AST_TemplateSegment,AST_TemplateString,AST_This,AST_Throw,AST_Token,AST_Toplevel,AST_True,AST_Try,AST_Unary,AST_UnaryPostfix,AST_UnaryPrefix,AST_Undefined,AST_Var,AST_VarDef,AST_While,AST_With,AST_Yield,TreeTransformer,TreeWalker,walk: walk$3,walk_abort,walk_body,walk_parent,_INLINE,_NOINLINE,_PURE});function def_transform(e,t){e.DEFMETHOD("transform",(function(e,n){let o;if(e.push(this),e.before&&(o=e.before(this,t,n)),void 0===o&&(o=this,t(o,e),e.after)){const t=e.after(o,n);void 0!==t&&(o=t);}return e.pop(),o}));}function do_list(e,t){return MAP(e,(function(e){return e.transform(t,!0)}))}function first_in_statement(e){let t=e.parent(-1);for(let n,o=0;n=e.parent(o);o++){if(n instanceof AST_Statement&&n.body===t)return !0;if(!(n instanceof AST_Sequence&&n.expressions[0]===t||"Call"===n.TYPE&&n.expression===t||n instanceof AST_PrefixedTemplateString&&n.prefix===t||n instanceof AST_Dot&&n.expression===t||n instanceof AST_Sub&&n.expression===t||n instanceof AST_Conditional&&n.condition===t||n instanceof AST_Binary&&n.left===t||n instanceof AST_UnaryPostfix&&n.expression===t))return !1;t=n;}}function left_is_object(e){return e instanceof AST_Object||(e instanceof AST_Sequence?left_is_object(e.expressions[0]):"Call"===e.TYPE?left_is_object(e.expression):e instanceof AST_PrefixedTemplateString?left_is_object(e.prefix):e instanceof AST_Dot||e instanceof AST_Sub?left_is_object(e.expression):e instanceof AST_Conditional?left_is_object(e.condition):e instanceof AST_Binary?left_is_object(e.left):e instanceof AST_UnaryPostfix&&left_is_object(e.expression))}def_transform(AST_Node,noop),def_transform(AST_LabeledStatement,(function(e,t){e.label=e.label.transform(t),e.body=e.body.transform(t);})),def_transform(AST_SimpleStatement,(function(e,t){e.body=e.body.transform(t);})),def_transform(AST_Block,(function(e,t){e.body=do_list(e.body,t);})),def_transform(AST_Do,(function(e,t){e.body=e.body.transform(t),e.condition=e.condition.transform(t);})),def_transform(AST_While,(function(e,t){e.condition=e.condition.transform(t),e.body=e.body.transform(t);})),def_transform(AST_For,(function(e,t){e.init&&(e.init=e.init.transform(t)),e.condition&&(e.condition=e.condition.transform(t)),e.step&&(e.step=e.step.transform(t)),e.body=e.body.transform(t);})),def_transform(AST_ForIn,(function(e,t){e.init=e.init.transform(t),e.object=e.object.transform(t),e.body=e.body.transform(t);})),def_transform(AST_With,(function(e,t){e.expression=e.expression.transform(t),e.body=e.body.transform(t);})),def_transform(AST_Exit,(function(e,t){e.value&&(e.value=e.value.transform(t));})),def_transform(AST_LoopControl,(function(e,t){e.label&&(e.label=e.label.transform(t));})),def_transform(AST_If,(function(e,t){e.condition=e.condition.transform(t),e.body=e.body.transform(t),e.alternative&&(e.alternative=e.alternative.transform(t));})),def_transform(AST_Switch,(function(e,t){e.expression=e.expression.transform(t),e.body=do_list(e.body,t);})),def_transform(AST_Case,(function(e,t){e.expression=e.expression.transform(t),e.body=do_list(e.body,t);})),def_transform(AST_Try,(function(e,t){e.body=do_list(e.body,t),e.bcatch&&(e.bcatch=e.bcatch.transform(t)),e.bfinally&&(e.bfinally=e.bfinally.transform(t));})),def_transform(AST_Catch,(function(e,t){e.argname&&(e.argname=e.argname.transform(t)),e.body=do_list(e.body,t);})),def_transform(AST_Definitions,(function(e,t){e.definitions=do_list(e.definitions,t);})),def_transform(AST_VarDef,(function(e,t){e.name=e.name.transform(t),e.value&&(e.value=e.value.transform(t));})),def_transform(AST_Destructuring,(function(e,t){e.names=do_list(e.names,t);})),def_transform(AST_Lambda,(function(e,t){e.name&&(e.name=e.name.transform(t)),e.argnames=do_list(e.argnames,t),e.body instanceof AST_Node?e.body=e.body.transform(t):e.body=do_list(e.body,t);})),def_transform(AST_Call,(function(e,t){e.expression=e.expression.transform(t),e.args=do_list(e.args,t);})),def_transform(AST_Sequence,(function(e,t){const n=do_list(e.expressions,t);e.expressions=n.length?n:[new AST_Number({value:0})];})),def_transform(AST_Dot,(function(e,t){e.expression=e.expression.transform(t);})),def_transform(AST_Sub,(function(e,t){e.expression=e.expression.transform(t),e.property=e.property.transform(t);})),def_transform(AST_Chain,(function(e,t){e.expression=e.expression.transform(t);})),def_transform(AST_Yield,(function(e,t){e.expression&&(e.expression=e.expression.transform(t));})),def_transform(AST_Await,(function(e,t){e.expression=e.expression.transform(t);})),def_transform(AST_Unary,(function(e,t){e.expression=e.expression.transform(t);})),def_transform(AST_Binary,(function(e,t){e.left=e.left.transform(t),e.right=e.right.transform(t);})),def_transform(AST_Conditional,(function(e,t){e.condition=e.condition.transform(t),e.consequent=e.consequent.transform(t),e.alternative=e.alternative.transform(t);})),def_transform(AST_Array,(function(e,t){e.elements=do_list(e.elements,t);})),def_transform(AST_Object,(function(e,t){e.properties=do_list(e.properties,t);})),def_transform(AST_ObjectProperty,(function(e,t){e.key instanceof AST_Node&&(e.key=e.key.transform(t)),e.value&&(e.value=e.value.transform(t));})),def_transform(AST_Class,(function(e,t){e.name&&(e.name=e.name.transform(t)),e.extends&&(e.extends=e.extends.transform(t)),e.properties=do_list(e.properties,t);})),def_transform(AST_Expansion,(function(e,t){e.expression=e.expression.transform(t);})),def_transform(AST_NameMapping,(function(e,t){e.foreign_name=e.foreign_name.transform(t),e.name=e.name.transform(t);})),def_transform(AST_Import,(function(e,t){e.imported_name&&(e.imported_name=e.imported_name.transform(t)),e.imported_names&&do_list(e.imported_names,t),e.module_name=e.module_name.transform(t);})),def_transform(AST_Export,(function(e,t){e.exported_definition&&(e.exported_definition=e.exported_definition.transform(t)),e.exported_value&&(e.exported_value=e.exported_value.transform(t)),e.exported_names&&do_list(e.exported_names,t),e.module_name&&(e.module_name=e.module_name.transform(t));})),def_transform(AST_TemplateString,(function(e,t){e.segments=do_list(e.segments,t);})),def_transform(AST_PrefixedTemplateString,(function(e,t){e.prefix=e.prefix.transform(t),e.template_string=e.template_string.transform(t);})),function(){var e=function(e){for(var t=!0,n=0;n<e.length;n++)t&&e[n]instanceof AST_Statement&&e[n].body instanceof AST_String?e[n]=new AST_Directive({start:e[n].start,end:e[n].end,value:e[n].body.value}):!t||e[n]instanceof AST_Statement&&e[n].body instanceof AST_String||(t=!1);return e},t={Program:function(t){return new AST_Toplevel({start:n(t),end:o(t),body:e(t.body.map(a))})},ArrayPattern:function(e){return new AST_Destructuring({start:n(e),end:o(e),names:e.elements.map((function(e){return null===e?new AST_Hole:a(e)})),is_array:!0})},ObjectPattern:function(e){return new AST_Destructuring({start:n(e),end:o(e),names:e.properties.map(a),is_array:!1})},AssignmentPattern:function(e){return new AST_DefaultAssign({start:n(e),end:o(e),left:a(e.left),operator:"=",right:a(e.right)})},SpreadElement:function(e){return new AST_Expansion({start:n(e),end:o(e),expression:a(e.argument)})},RestElement:function(e){return new AST_Expansion({start:n(e),end:o(e),expression:a(e.argument)})},TemplateElement:function(e){return new AST_TemplateSegment({start:n(e),end:o(e),value:e.value.cooked,raw:e.value.raw})},TemplateLiteral:function(e){for(var t=[],i=0;i<e.quasis.length;i++)t.push(a(e.quasis[i])),e.expressions[i]&&t.push(a(e.expressions[i]));return new AST_TemplateString({start:n(e),end:o(e),segments:t})},TaggedTemplateExpression:function(e){return new AST_PrefixedTemplateString({start:n(e),end:o(e),template_string:a(e.quasi),prefix:a(e.tag)})},FunctionDeclaration:function(t){return new AST_Defun({start:n(t),end:o(t),name:a(t.id),argnames:t.params.map(a),is_generator:t.generator,async:t.async,body:e(a(t.body).body)})},FunctionExpression:function(t){return new AST_Function({start:n(t),end:o(t),name:a(t.id),argnames:t.params.map(a),is_generator:t.generator,async:t.async,body:e(a(t.body).body)})},ArrowFunctionExpression:function(e){const t="BlockStatement"===e.body.type?a(e.body).body:[make_node(AST_Return,{},{value:a(e.body)})];return new AST_Arrow({start:n(e),end:o(e),argnames:e.params.map(a),body:t,async:e.async})},ExpressionStatement:function(e){return new AST_SimpleStatement({start:n(e),end:o(e),body:a(e.expression)})},TryStatement:function(e){var t=e.handlers||[e.handler];if(t.length>1||e.guardedHandlers&&e.guardedHandlers.length)throw new Error("Multiple catch clauses are not supported.");return new AST_Try({start:n(e),end:o(e),body:a(e.block).body,bcatch:a(t[0]),bfinally:e.finalizer?new AST_Finally(a(e.finalizer)):null})},Property:function(e){var t=e.key,i={start:n(t||e.value),end:o(e.value),key:"Identifier"==t.type?t.name:t.value,value:a(e.value)};return e.computed&&(i.key=a(e.key)),e.method?(i.is_generator=e.value.generator,i.async=e.value.async,e.computed?i.key=a(e.key):i.key=new AST_SymbolMethod({name:i.key}),new AST_ConciseMethod(i)):"init"==e.kind?("Identifier"!=t.type&&"Literal"!=t.type&&(i.key=a(t)),new AST_ObjectKeyVal(i)):("string"!=typeof i.key&&"number"!=typeof i.key||(i.key=new AST_SymbolMethod({name:i.key})),i.value=new AST_Accessor(i.value),"get"==e.kind?new AST_ObjectGetter(i):"set"==e.kind?new AST_ObjectSetter(i):"method"==e.kind?(i.async=e.value.async,i.is_generator=e.value.generator,i.quote=e.computed?'"':null,new AST_ConciseMethod(i)):void 0)},MethodDefinition:function(e){var t={start:n(e),end:o(e),key:e.computed?a(e.key):new AST_SymbolMethod({name:e.key.name||e.key.value}),value:a(e.value),static:e.static};return "get"==e.kind?new AST_ObjectGetter(t):"set"==e.kind?new AST_ObjectSetter(t):(t.is_generator=e.value.generator,t.async=e.value.async,new AST_ConciseMethod(t))},FieldDefinition:function(e){let t;if(e.computed)t=a(e.key);else {if("Identifier"!==e.key.type)throw new Error("Non-Identifier key in FieldDefinition");t=a(e.key);}return new AST_ClassProperty({start:n(e),end:o(e),key:t,value:a(e.value),static:e.static})},PropertyDefinition:function(e){let t;if(e.computed)t=a(e.key);else {if("Identifier"!==e.key.type)throw new Error("Non-Identifier key in PropertyDefinition");t=a(e.key);}return new AST_ClassProperty({start:n(e),end:o(e),key:t,value:a(e.value),static:e.static})},ArrayExpression:function(e){return new AST_Array({start:n(e),end:o(e),elements:e.elements.map((function(e){return null===e?new AST_Hole:a(e)}))})},ObjectExpression:function(e){return new AST_Object({start:n(e),end:o(e),properties:e.properties.map((function(e){return "SpreadElement"===e.type||(e.type="Property"),a(e)}))})},SequenceExpression:function(e){return new AST_Sequence({start:n(e),end:o(e),expressions:e.expressions.map(a)})},MemberExpression:function(e){return new(e.computed?AST_Sub:AST_Dot)({start:n(e),end:o(e),property:e.computed?a(e.property):e.property.name,expression:a(e.object),optional:e.optional||!1})},ChainExpression:function(e){return new AST_Chain({start:n(e),end:o(e),expression:a(e.expression)})},SwitchCase:function(e){return new(e.test?AST_Case:AST_Default)({start:n(e),end:o(e),expression:a(e.test),body:e.consequent.map(a)})},VariableDeclaration:function(e){return new("const"===e.kind?AST_Const:"let"===e.kind?AST_Let:AST_Var)({start:n(e),end:o(e),definitions:e.declarations.map(a)})},ImportDeclaration:function(e){var t=null,i=null;return e.specifiers.forEach((function(e){"ImportSpecifier"===e.type?(i||(i=[]),i.push(new AST_NameMapping({start:n(e),end:o(e),foreign_name:a(e.imported),name:a(e.local)}))):"ImportDefaultSpecifier"===e.type?t=a(e.local):"ImportNamespaceSpecifier"===e.type&&(i||(i=[]),i.push(new AST_NameMapping({start:n(e),end:o(e),foreign_name:new AST_SymbolImportForeign({name:"*"}),name:a(e.local)})));})),new AST_Import({start:n(e),end:o(e),imported_name:t,imported_names:i,module_name:a(e.source)})},ExportAllDeclaration:function(e){return new AST_Export({start:n(e),end:o(e),exported_names:[new AST_NameMapping({name:new AST_SymbolExportForeign({name:"*"}),foreign_name:new AST_SymbolExportForeign({name:"*"})})],module_name:a(e.source)})},ExportNamedDeclaration:function(e){return new AST_Export({start:n(e),end:o(e),exported_definition:a(e.declaration),exported_names:e.specifiers&&e.specifiers.length?e.specifiers.map((function(e){return new AST_NameMapping({foreign_name:a(e.exported),name:a(e.local)})})):null,module_name:a(e.source)})},ExportDefaultDeclaration:function(e){return new AST_Export({start:n(e),end:o(e),exported_value:a(e.declaration),is_default:!0})},Literal:function(e){var t=e.value,i={start:n(e),end:o(e)},r=e.regex;if(r&&r.pattern)return i.value={source:r.pattern,flags:r.flags},new AST_RegExp(i);if(r){const n=e.raw||t,o=n.match(/^\/(.*)\/(\w*)$/);if(!o)throw new Error("Invalid regex source "+n);const[r,a,s]=o;return i.value={source:a,flags:s},new AST_RegExp(i)}if(null===t)return new AST_Null(i);switch(typeof t){case"string":return i.value=t,new AST_String(i);case"number":return i.value=t,i.raw=e.raw||t.toString(),new AST_Number(i);case"boolean":return new(t?AST_True:AST_False)(i)}},MetaProperty:function(e){return "new"===e.meta.name&&"target"===e.property.name?new AST_NewTarget({start:n(e),end:o(e)}):"import"===e.meta.name&&"meta"===e.property.name?new AST_ImportMeta({start:n(e),end:o(e)}):void 0},Identifier:function(e){var t=r[r.length-2];return new("LabeledStatement"==t.type?AST_Label:"VariableDeclarator"==t.type&&t.id===e?"const"==t.kind?AST_SymbolConst:"let"==t.kind?AST_SymbolLet:AST_SymbolVar:/Import.*Specifier/.test(t.type)?t.local===e?AST_SymbolImport:AST_SymbolImportForeign:"ExportSpecifier"==t.type?t.local===e?AST_SymbolExport:AST_SymbolExportForeign:"FunctionExpression"==t.type?t.id===e?AST_SymbolLambda:AST_SymbolFunarg:"FunctionDeclaration"==t.type?t.id===e?AST_SymbolDefun:AST_SymbolFunarg:"ArrowFunctionExpression"==t.type?t.params.includes(e)?AST_SymbolFunarg:AST_SymbolRef:"ClassExpression"==t.type?t.id===e?AST_SymbolClass:AST_SymbolRef:"Property"==t.type?t.key===e&&t.computed||t.value===e?AST_SymbolRef:AST_SymbolMethod:"PropertyDefinition"==t.type||"FieldDefinition"===t.type?t.key===e&&t.computed||t.value===e?AST_SymbolRef:AST_SymbolClassProperty:"ClassDeclaration"==t.type?t.id===e?AST_SymbolDefClass:AST_SymbolRef:"MethodDefinition"==t.type?t.computed?AST_SymbolRef:AST_SymbolMethod:"CatchClause"==t.type?AST_SymbolCatch:"BreakStatement"==t.type||"ContinueStatement"==t.type?AST_LabelRef:AST_SymbolRef)({start:n(e),end:o(e),name:e.name})},BigIntLiteral:e=>new AST_BigInt({start:n(e),end:o(e),value:e.value})};function n(e){var t=e.loc,n=t&&t.start,o=e.range;return new AST_Token("","",n&&n.line||0,n&&n.column||0,o?o[0]:e.start,!1,[],[],t&&t.source)}function o(e){var t=e.loc,n=t&&t.end,o=e.range;return new AST_Token("","",n&&n.line||0,n&&n.column||0,o?o[0]:e.end,!1,[],[],t&&t.source)}function i(e,i,r){var u="function From_Moz_"+e+"(M){\n";u+="return new U2."+i.name+"({\nstart: my_start_token(M),\nend: my_end_token(M)";var _="function To_Moz_"+e+"(M){\n";_+="return {\ntype: "+JSON.stringify(e),r&&r.split(/\s*,\s*/).forEach((function(e){var t=/([a-z0-9$_]+)([=@>%])([a-z0-9$_]+)/i.exec(e);if(!t)throw new Error("Can't understand property map: "+e);var n=t[1],o=t[2],i=t[3];switch(u+=",\n"+i+": ",_+=",\n"+n+": ",o){case"@":u+="M."+n+".map(from_moz)",_+="M."+i+".map(to_moz)";break;case">":u+="from_moz(M."+n+")",_+="to_moz(M."+i+")";break;case"=":u+="M."+n,_+="M."+i;break;case"%":u+="from_moz(M."+n+").body",_+="to_moz_block(M)";break;default:throw new Error("Can't understand operator in propmap: "+e)}})),u+="\n})\n}",_+="\n}\n}",u=new Function("U2","my_start_token","my_end_token","from_moz","return("+u+")")(ast,n,o,a),_=new Function("to_moz","to_moz_block","to_moz_scope","return("+_+")")(l,c,f),t[e]=u,s(i,_);}t.UpdateExpression=t.UnaryExpression=function(e){return new(("prefix"in e?e.prefix:"UnaryExpression"==e.type)?AST_UnaryPrefix:AST_UnaryPostfix)({start:n(e),end:o(e),operator:e.operator,expression:a(e.argument)})},t.ClassDeclaration=t.ClassExpression=function(e){return new("ClassDeclaration"===e.type?AST_DefClass:AST_ClassExpression)({start:n(e),end:o(e),name:a(e.id),extends:a(e.superClass),properties:e.body.body.map(a)})},i("EmptyStatement",AST_EmptyStatement),i("BlockStatement",AST_BlockStatement,"body@body"),i("IfStatement",AST_If,"test>condition, consequent>body, alternate>alternative"),i("LabeledStatement",AST_LabeledStatement,"label>label, body>body"),i("BreakStatement",AST_Break,"label>label"),i("ContinueStatement",AST_Continue,"label>label"),i("WithStatement",AST_With,"object>expression, body>body"),i("SwitchStatement",AST_Switch,"discriminant>expression, cases@body"),i("ReturnStatement",AST_Return,"argument>value"),i("ThrowStatement",AST_Throw,"argument>value"),i("WhileStatement",AST_While,"test>condition, body>body"),i("DoWhileStatement",AST_Do,"test>condition, body>body"),i("ForStatement",AST_For,"init>init, test>condition, update>step, body>body"),i("ForInStatement",AST_ForIn,"left>init, right>object, body>body"),i("ForOfStatement",AST_ForOf,"left>init, right>object, body>body, await=await"),i("AwaitExpression",AST_Await,"argument>expression"),i("YieldExpression",AST_Yield,"argument>expression, delegate=is_star"),i("DebuggerStatement",AST_Debugger),i("VariableDeclarator",AST_VarDef,"id>name, init>value"),i("CatchClause",AST_Catch,"param>argname, body%body"),i("ThisExpression",AST_This),i("Super",AST_Super),i("BinaryExpression",AST_Binary,"operator=operator, left>left, right>right"),i("LogicalExpression",AST_Binary,"operator=operator, left>left, right>right"),i("AssignmentExpression",AST_Assign,"operator=operator, left>left, right>right"),i("ConditionalExpression",AST_Conditional,"test>condition, consequent>consequent, alternate>alternative"),i("NewExpression",AST_New,"callee>expression, arguments@args"),i("CallExpression",AST_Call,"callee>expression, optional=optional, arguments@args"),s(AST_Toplevel,(function(e){return f("Program",e)})),s(AST_Expansion,(function(e){return {type:_()?"RestElement":"SpreadElement",argument:l(e.expression)}})),s(AST_PrefixedTemplateString,(function(e){return {type:"TaggedTemplateExpression",tag:l(e.prefix),quasi:l(e.template_string)}})),s(AST_TemplateString,(function(e){for(var t=[],n=[],o=0;o<e.segments.length;o++)o%2!=0?n.push(l(e.segments[o])):t.push({type:"TemplateElement",value:{raw:e.segments[o].raw,cooked:e.segments[o].value},tail:o===e.segments.length-1});return {type:"TemplateLiteral",quasis:t,expressions:n}})),s(AST_Defun,(function(e){return {type:"FunctionDeclaration",id:l(e.name),params:e.argnames.map(l),generator:e.is_generator,async:e.async,body:f("BlockStatement",e)}})),s(AST_Function,(function(e,t){var n=void 0!==t.is_generator?t.is_generator:e.is_generator;return {type:"FunctionExpression",id:l(e.name),params:e.argnames.map(l),generator:n,async:e.async,body:f("BlockStatement",e)}})),s(AST_Arrow,(function(e){var t={type:"BlockStatement",body:e.body.map(l)};return {type:"ArrowFunctionExpression",params:e.argnames.map(l),async:e.async,body:t}})),s(AST_Destructuring,(function(e){return e.is_array?{type:"ArrayPattern",elements:e.names.map(l)}:{type:"ObjectPattern",properties:e.names.map(l)}})),s(AST_Directive,(function(e){return {type:"ExpressionStatement",expression:{type:"Literal",value:e.value,raw:e.print_to_string()},directive:e.value}})),s(AST_SimpleStatement,(function(e){return {type:"ExpressionStatement",expression:l(e.body)}})),s(AST_SwitchBranch,(function(e){return {type:"SwitchCase",test:l(e.expression),consequent:e.body.map(l)}})),s(AST_Try,(function(e){return {type:"TryStatement",block:c(e),handler:l(e.bcatch),guardedHandlers:[],finalizer:l(e.bfinally)}})),s(AST_Catch,(function(e){return {type:"CatchClause",param:l(e.argname),guard:null,body:c(e)}})),s(AST_Definitions,(function(e){return {type:"VariableDeclaration",kind:e instanceof AST_Const?"const":e instanceof AST_Let?"let":"var",declarations:e.definitions.map(l)}})),s(AST_Export,(function(e){return e.exported_names?"*"===e.exported_names[0].name.name?{type:"ExportAllDeclaration",source:l(e.module_name)}:{type:"ExportNamedDeclaration",specifiers:e.exported_names.map((function(e){return {type:"ExportSpecifier",exported:l(e.foreign_name),local:l(e.name)}})),declaration:l(e.exported_definition),source:l(e.module_name)}:{type:e.is_default?"ExportDefaultDeclaration":"ExportNamedDeclaration",declaration:l(e.exported_value||e.exported_definition)}})),s(AST_Import,(function(e){var t=[];return e.imported_name&&t.push({type:"ImportDefaultSpecifier",local:l(e.imported_name)}),e.imported_names&&"*"===e.imported_names[0].foreign_name.name?t.push({type:"ImportNamespaceSpecifier",local:l(e.imported_names[0].name)}):e.imported_names&&e.imported_names.forEach((function(e){t.push({type:"ImportSpecifier",local:l(e.name),imported:l(e.foreign_name)});})),{type:"ImportDeclaration",specifiers:t,source:l(e.module_name)}})),s(AST_ImportMeta,(function(){return {type:"MetaProperty",meta:{type:"Identifier",name:"import"},property:{type:"Identifier",name:"meta"}}})),s(AST_Sequence,(function(e){return {type:"SequenceExpression",expressions:e.expressions.map(l)}})),s(AST_DotHash,(function(e){return {type:"MemberExpression",object:l(e.expression),computed:!1,property:{type:"PrivateIdentifier",name:e.property},optional:e.optional}})),s(AST_PropAccess,(function(e){var t=e instanceof AST_Sub;return {type:"MemberExpression",object:l(e.expression),computed:t,property:t?l(e.property):{type:"Identifier",name:e.property},optional:e.optional}})),s(AST_Chain,(function(e){return {type:"ChainExpression",expression:l(e.expression)}})),s(AST_Unary,(function(e){return {type:"++"==e.operator||"--"==e.operator?"UpdateExpression":"UnaryExpression",operator:e.operator,prefix:e instanceof AST_UnaryPrefix,argument:l(e.expression)}})),s(AST_Binary,(function(e){return "="==e.operator&&_()?{type:"AssignmentPattern",left:l(e.left),right:l(e.right)}:{type:"&&"==e.operator||"||"==e.operator||"??"===e.operator?"LogicalExpression":"BinaryExpression",left:l(e.left),operator:e.operator,right:l(e.right)}})),s(AST_Array,(function(e){return {type:"ArrayExpression",elements:e.elements.map(l)}})),s(AST_Object,(function(e){return {type:"ObjectExpression",properties:e.properties.map(l)}})),s(AST_ObjectProperty,(function(e,t){var n,o=e.key instanceof AST_Node?l(e.key):{type:"Identifier",value:e.key};"number"==typeof e.key&&(o={type:"Literal",value:Number(e.key)}),"string"==typeof e.key&&(o={type:"Identifier",name:e.key});var i="string"==typeof e.key||"number"==typeof e.key,r=!i&&(!(e.key instanceof AST_Symbol)||e.key instanceof AST_SymbolRef);return e instanceof AST_ObjectKeyVal?(n="init",r=!i):e instanceof AST_ObjectGetter?n="get":e instanceof AST_ObjectSetter&&(n="set"),e instanceof AST_PrivateGetter||e instanceof AST_PrivateSetter?{type:"MethodDefinition",computed:!1,kind:e instanceof AST_PrivateGetter?"get":"set",static:e.static,key:{type:"PrivateIdentifier",name:e.key.name},value:l(e.value)}:e instanceof AST_ClassPrivateProperty?{type:"PropertyDefinition",key:{type:"PrivateIdentifier",name:e.key.name},value:l(e.value),computed:!1,static:e.static}:e instanceof AST_ClassProperty?{type:"PropertyDefinition",key:o,value:l(e.value),computed:r,static:e.static}:t instanceof AST_Class?{type:"MethodDefinition",computed:r,kind:n,static:e.static,key:l(e.key),value:l(e.value)}:{type:"Property",computed:r,kind:n,key:o,value:l(e.value)}})),s(AST_ConciseMethod,(function(e,t){if(t instanceof AST_Object)return {type:"Property",computed:!(e.key instanceof AST_Symbol)||e.key instanceof AST_SymbolRef,kind:"init",method:!0,shorthand:!1,key:l(e.key),value:l(e.value)};const n=e instanceof AST_PrivateMethod?{type:"PrivateIdentifier",name:e.key.name}:l(e.key);return {type:"MethodDefinition",kind:"constructor"===e.key?"constructor":"method",key:n,value:l(e.value),computed:!(e.key instanceof AST_Symbol)||e.key instanceof AST_SymbolRef,static:e.static}})),s(AST_Class,(function(e){return {type:e instanceof AST_ClassExpression?"ClassExpression":"ClassDeclaration",superClass:l(e.extends),id:e.name?l(e.name):null,body:{type:"ClassBody",body:e.properties.map(l)}}})),s(AST_NewTarget,(function(){return {type:"MetaProperty",meta:{type:"Identifier",name:"new"},property:{type:"Identifier",name:"target"}}})),s(AST_Symbol,(function(e,t){if(e instanceof AST_SymbolMethod&&t.quote)return {type:"Literal",value:e.name};var n=e.definition();return {type:"Identifier",name:n?n.mangled_name||n.name:e.name}})),s(AST_RegExp,(function(e){const t=e.value.source,n=e.value.flags;return {type:"Literal",value:null,raw:e.print_to_string(),regex:{pattern:t,flags:n}}})),s(AST_Constant,(function(e){return {type:"Literal",value:e.value,raw:e.raw||e.print_to_string()}})),s(AST_Atom,(function(e){return {type:"Identifier",name:String(e.value)}})),s(AST_BigInt,(e=>({type:"BigIntLiteral",value:e.value}))),AST_Boolean.DEFMETHOD("to_mozilla_ast",AST_Constant.prototype.to_mozilla_ast),AST_Null.DEFMETHOD("to_mozilla_ast",AST_Constant.prototype.to_mozilla_ast),AST_Hole.DEFMETHOD("to_mozilla_ast",(function(){return null})),AST_Block.DEFMETHOD("to_mozilla_ast",AST_BlockStatement.prototype.to_mozilla_ast),AST_Lambda.DEFMETHOD("to_mozilla_ast",AST_Function.prototype.to_mozilla_ast);var r=null;function a(e){r.push(e);var n=null!=e?t[e.type](e):null;return r.pop(),n}function s(e,t){e.DEFMETHOD("to_mozilla_ast",(function(e){return n=t(this,e),o=this.start,i=this.end,o&&i?(null!=o.pos&&null!=i.endpos&&(n.range=[o.pos,i.endpos]),o.line&&(n.loc={start:{line:o.line,column:o.col},end:i.endline?{line:i.endline,column:i.endcol}:null},o.file&&(n.loc.source=o.file)),n):n;var n,o,i;}));}AST_Node.from_mozilla_ast=function(e){var t=r;r=[];var n=a(e);return r=t,n};var u=null;function l(e){null===u&&(u=[]),u.push(e);var t=null!=e?e.to_mozilla_ast(u[u.length-2]):null;return u.pop(),0===u.length&&(u=null),t}function _(){for(var e=u.length;e--;)if(u[e]instanceof AST_Destructuring)return !0;return !1}function c(e){return {type:"BlockStatement",body:e.body.map(l)}}function f(e,t){var n=t.body.map(l);return t.body[0]instanceof AST_SimpleStatement&&t.body[0].body instanceof AST_String&&n.unshift(l(new AST_EmptyStatement(t.body[0]))),{type:e,body:n}}}();const EXPECT_DIRECTIVE=/^$|[;{][\s\n]*$/,r_annotation=/[@#]__(PURE|INLINE|NOINLINE)__/g;function is_some_comments(e){return ("comment2"===e.type||"comment1"===e.type)&&/@preserve|@lic|@cc_on|^\**!/i.test(e.value)}function OutputStream(e){var t=!e;void 0===(e=defaults$1(e,{ascii_only:!1,beautify:!1,braces:!1,comments:"some",ecma:5,ie8:!1,indent_level:4,indent_start:0,inline_script:!0,keep_numbers:!1,keep_quoted_props:!1,max_line_len:!1,preamble:null,preserve_annotations:!1,quote_keys:!1,quote_style:0,safari10:!1,semicolons:!0,shebang:!0,shorthand:void 0,source_map:null,webkit:!1,width:80,wrap_iife:!1,wrap_func_args:!0},!0)).shorthand&&(e.shorthand=e.ecma>5);var n=return_false;if(e.comments){let t=e.comments;if("string"==typeof e.comments&&/^\/.*\/[a-zA-Z]*$/.test(e.comments)){var o=e.comments.lastIndexOf("/");t=new RegExp(e.comments.substr(1,o-1),e.comments.substr(o+1));}n=t instanceof RegExp?function(e){return "comment5"!=e.type&&t.test(e.value)}:"function"==typeof t?function(e){return "comment5"!=e.type&&t(this,e)}:"some"===t?is_some_comments:return_true;}var i=0,r=0,a=1,s=0,u="";let l=new Set;var _=e.ascii_only?function(t,n){return e.ecma>=2015&&!e.safari10&&(t=t.replace(/[\ud800-\udbff][\udc00-\udfff]/g,(function(e){return "\\u{"+get_full_char_code(e,0).toString(16)+"}"}))),t.replace(/[\u0000-\u001f\u007f-\uffff]/g,(function(e){var t=e.charCodeAt(0).toString(16);if(t.length<=2&&!n){for(;t.length<2;)t="0"+t;return "\\x"+t}for(;t.length<4;)t="0"+t;return "\\u"+t}))}:function(e){return e.replace(/[\ud800-\udbff][\udc00-\udfff]|([\ud800-\udbff]|[\udc00-\udfff])/g,(function(e,t){return t?"\\u"+t.charCodeAt(0).toString(16):e}))};function c(t,n){var o=function(t,n){var o=0,i=0;function r(){return "'"+t.replace(/\x27/g,"\\'")+"'"}function a(){return '"'+t.replace(/\x22/g,'\\"')+'"'}if(t=t.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g,(function(n,r){switch(n){case'"':return ++o,'"';case"'":return ++i,"'";case"\\":return "\\\\";case"\n":return "\\n";case"\r":return "\\r";case"\t":return "\\t";case"\b":return "\\b";case"\f":return "\\f";case"\v":return e.ie8?"\\x0B":"\\v";case"\u2028":return "\\u2028";case"\u2029":return "\\u2029";case"\ufeff":return "\\ufeff";case"\0":return /[0-9]/.test(get_full_char(t,r+1))?"\\x00":"\\0"}return n})),t=_(t),"`"===n)return "`"+t.replace(/`/g,"\\`")+"`";switch(e.quote_style){case 1:return r();case 2:return a();case 3:return "'"==n?r():a();default:return o>i?r():a()}}(t,n);return e.inline_script&&(o=(o=(o=o.replace(/<\x2f(script)([>\/\t\n\f\r ])/gi,"<\\/$1$2")).replace(/\x3c!--/g,"\\x3c!--")).replace(/--\x3e/g,"--\\x3e")),o}var f,p,d=!1,S=!1,m=!1,A=0,T=!1,h=!1,E=-1,g="",D=e.source_map&&[],b=D?function(){D.forEach((function(t){try{e.source_map.add(t.token.file,t.line,t.col,t.token.line,t.token.col,t.name||"name"!=t.token.type?t.name:t.token.value);}catch(e){}})),D=[];}:noop,y=e.max_line_len?function(){if(r>e.max_line_len&&A){var t=u.slice(0,A),n=u.slice(A);if(D){var o=n.length-r;D.forEach((function(e){e.line++,e.col+=o;}));}u=t+"\n"+n,a++,s++,r=n.length;}A&&(A=0,b());}:noop,v=makePredicate("( [ + * / - , . `");function C(t){var n=get_full_char(t=String(t),0);T&&n&&(T=!1,"\n"!==n&&(C("\n"),k())),h&&n&&(h=!1,/[\s;})]/.test(n)||R()),E=-1;var o=g.charAt(g.length-1);m&&(m=!1,(":"!==o||"}"!==n)&&(n&&";}".includes(n)||";"===o)||(e.semicolons||v.has(n)?(u+=";",r++,s++):(y(),r>0&&(u+="\n",s++,a++,r=0),/^\s+$/.test(t)&&(m=!0)),e.beautify||(S=!1))),S&&((is_identifier_char(o)&&(is_identifier_char(n)||"\\"==n)||"/"==n&&n==o||("+"==n||"-"==n)&&n==g)&&(u+=" ",r++,s++),S=!1),f&&(D.push({token:f,name:p,line:a,col:r}),f=!1,A||b()),u+=t,d="("==t[t.length-1],s+=t.length;var i=t.split(/\r?\n/),l=i.length-1;a+=l,r+=i[0].length,l>0&&(y(),r=i[l].length),g=t;}var R=e.beautify?function(){C(" ");}:function(){S=!0;},k=e.beautify?function(t){var n;e.beautify&&C((n=t?.5:0," ".repeat(e.indent_start+i-n*e.indent_level)));}:noop,O=e.beautify?function(e,t){!0===e&&(e=I());var n=i;i=e;var o=t();return i=n,o}:function(e,t){return t()},F=e.beautify?function(){if(E<0)return C("\n");"\n"!=u[E]&&(u=u.slice(0,E)+"\n"+u.slice(E),s++,a++),E++;}:e.max_line_len?function(){y(),A=u.length;}:noop,N=e.beautify?function(){C(";");}:function(){m=!0;};function M(){m=!1,C(";");}function I(){return i+e.indent_level}function x(){return A&&y(),u}function w(){let e=u.length-1;for(;e>=0;){const t=u.charCodeAt(e);if(10===t)return !0;if(32!==t)return !1;e--;}return !0}function P(t){return e.preserve_annotations||(t=t.replace(r_annotation," ")),/^\s*$/.test(t)?"":t.replace(/(<\s*\/\s*)(script)/i,"<\\/$2")}var B=[];return {get:x,toString:x,indent:k,in_directive:!1,use_asm:null,active_scope:null,indentation:function(){return i},current_width:function(){return r-i},should_break:function(){return e.width&&this.current_width()>=e.width},has_parens:function(){return d},newline:F,print:C,star:function(){C("*");},space:R,comma:function(){C(","),R();},colon:function(){C(":"),R();},last:function(){return g},semicolon:N,force_semicolon:M,to_utf8:_,print_name:function(e){C(function(e){return e=e.toString(),_(e,!0)}(e));},print_string:function(e,t,n){var o=c(e,t);!0!==n||o.includes("\\")||(EXPECT_DIRECTIVE.test(u)||M(),M()),C(o);},print_template_string_chars:function(e){var t=c(e,"`").replace(/\${/g,"\\${");return C(t.substr(1,t.length-2))},encode_string:c,next_indent:I,with_indent:O,with_block:function(e){var t;return C("{"),F(),O(I(),(function(){t=e();})),k(),C("}"),t},with_parens:function(e){C("(");var t=e();return C(")"),t},with_square:function(e){C("[");var t=e();return C("]"),t},add_mapping:D?function(e,t){f=e,p=t;}:noop,option:function(t){return e[t]},printed_comments:l,prepend_comments:t?noop:function(t){var o=t.start;if(!o)return;var i=this.printed_comments;const r=t instanceof AST_Exit&&t.value;if(o.comments_before&&i.has(o.comments_before)){if(!r)return;o.comments_before=[];}var a=o.comments_before;if(a||(a=o.comments_before=[]),i.add(a),r){var u=new TreeWalker((function(e){var t=u.parent();if(!(t instanceof AST_Exit||t instanceof AST_Binary&&t.left===e||"Call"==t.TYPE&&t.expression===e||t instanceof AST_Conditional&&t.condition===e||t instanceof AST_Dot&&t.expression===e||t instanceof AST_Sequence&&t.expressions[0]===e||t instanceof AST_Sub&&t.expression===e||t instanceof AST_UnaryPostfix))return !0;if(e.start){var n=e.start.comments_before;n&&!i.has(n)&&(i.add(n),a=a.concat(n));}}));u.push(t),t.value.walk(u);}if(0==s){a.length>0&&e.shebang&&"comment5"===a[0].type&&!i.has(a[0])&&(C("#!"+a.shift().value+"\n"),k());var l=e.preamble;l&&C(l.replace(/\r\n?|[\n\u2028\u2029]|\s*$/g,"\n"));}if(0!=(a=a.filter(n,t).filter((e=>!i.has(e)))).length){var _=w();a.forEach((function(e,t){if(i.add(e),_||(e.nlb?(C("\n"),k(),_=!0):t>0&&R()),/comment[134]/.test(e.type))(n=P(e.value))&&(C("//"+n+"\n"),k()),_=!0;else if("comment2"==e.type){var n;(n=P(e.value))&&C("/*"+n+"*/"),_=!1;}})),_||(o.nlb?(C("\n"),k()):R());}},append_comments:t||n===return_false?noop:function(e,t){var o=e.end;if(o){var i=this.printed_comments,r=o[t?"comments_before":"comments_after"];if(r&&!i.has(r)&&(e instanceof AST_Statement||r.every((e=>!/comment[134]/.test(e.type))))){i.add(r);var a=u.length;r.filter(n,e).forEach((function(e,n){if(!i.has(e))if(i.add(e),h=!1,T?(C("\n"),k(),T=!1):e.nlb&&(n>0||!w())?(C("\n"),k()):(n>0||!t)&&R(),/comment[134]/.test(e.type)){const t=P(e.value);t&&C("//"+t),T=!0;}else if("comment2"==e.type){const t=P(e.value);t&&C("/*"+t+"*/"),h=!0;}})),u.length>a&&(E=a);}}},line:function(){return a},col:function(){return r},pos:function(){return s},push_node:function(e){B.push(e);},pop_node:function(){return B.pop()},parent:function(e){return B[B.length-2-(e||0)]}}}!function(){function e(e,t){e.DEFMETHOD("_codegen",t);}function t(e,n){Array.isArray(e)?e.forEach((function(e){t(e,n);})):e.DEFMETHOD("needs_parens",n);}function n(e,t,n,o){var i=e.length-1;n.in_directive=o,e.forEach((function(e,o){!0!==n.in_directive||e instanceof AST_Directive||e instanceof AST_EmptyStatement||e instanceof AST_SimpleStatement&&e.body instanceof AST_String||(n.in_directive=!1),e instanceof AST_EmptyStatement||(n.indent(),e.print(n),o==i&&t||(n.newline(),t&&n.newline())),!0===n.in_directive&&e instanceof AST_SimpleStatement&&e.body instanceof AST_String&&(n.in_directive=!1);})),n.in_directive=!1;}function o(e,t){t.print("{"),t.with_indent(t.next_indent(),(function(){t.append_comments(e,!0);})),t.print("}");}function i(e,t,i){e.body.length>0?t.with_block((function(){n(e.body,!1,t,i);})):o(e,t);}function r(e,t,n){var o=!1;n&&(o=walk$3(e,(e=>e instanceof AST_Scope||(e instanceof AST_Binary&&"in"==e.operator?walk_abort:void 0)))),e.print(t,o);}function a(e,t,n){return n.option("quote_keys")?n.print_string(e):""+ +e==e&&e>=0?n.option("keep_numbers")?n.print(e):n.print(_(e)):(RESERVED_WORDS.has(e)?n.option("ie8"):n.option("ecma")<2015||n.option("safari10")?!is_basic_identifier_string(e):!is_identifier_string(e,!0))||t&&n.option("keep_quoted_props")?n.print_string(e,t):n.print_name(e)}AST_Node.DEFMETHOD("print",(function(e,t){var n=this,o=n._codegen;function i(){e.prepend_comments(n),n.add_source_map(e),o(n,e),e.append_comments(n);}n instanceof AST_Scope?e.active_scope=n:!e.use_asm&&n instanceof AST_Directive&&"use asm"==n.value&&(e.use_asm=e.active_scope),e.push_node(n),t||n.needs_parens(e)?e.with_parens(i):i(),e.pop_node(),n===e.use_asm&&(e.use_asm=null);})),AST_Node.DEFMETHOD("_print",AST_Node.prototype.print),AST_Node.DEFMETHOD("print_to_string",(function(e){var t=OutputStream(e);return this.print(t),t.get()})),t(AST_Node,return_false),t(AST_Function,(function(e){return !(e.has_parens()||!first_in_statement(e))||(!!(e.option("webkit")&&(t=e.parent())instanceof AST_PropAccess&&t.expression===this)||(!!(e.option("wrap_iife")&&(t=e.parent())instanceof AST_Call&&t.expression===this)||!!(e.option("wrap_func_args")&&(t=e.parent())instanceof AST_Call&&t.args.includes(this))));var t;})),t(AST_Arrow,(function(e){var t=e.parent();return !!(e.option("wrap_func_args")&&t instanceof AST_Call&&t.args.includes(this))||t instanceof AST_PropAccess&&t.expression===this})),t(AST_Object,(function(e){return !e.has_parens()&&first_in_statement(e)})),t(AST_ClassExpression,first_in_statement),t(AST_Unary,(function(e){var t=e.parent();return t instanceof AST_PropAccess&&t.expression===this||t instanceof AST_Call&&t.expression===this||t instanceof AST_Binary&&"**"===t.operator&&this instanceof AST_UnaryPrefix&&t.left===this&&"++"!==this.operator&&"--"!==this.operator})),t(AST_Await,(function(e){var t=e.parent();return t instanceof AST_PropAccess&&t.expression===this||t instanceof AST_Call&&t.expression===this||t instanceof AST_Binary&&"**"===t.operator&&t.left===this||e.option("safari10")&&t instanceof AST_UnaryPrefix})),t(AST_Sequence,(function(e){var t=e.parent();return t instanceof AST_Call||t instanceof AST_Unary||t instanceof AST_Binary||t instanceof AST_VarDef||t instanceof AST_PropAccess||t instanceof AST_Array||t instanceof AST_ObjectProperty||t instanceof AST_Conditional||t instanceof AST_Arrow||t instanceof AST_DefaultAssign||t instanceof AST_Expansion||t instanceof AST_ForOf&&this===t.object||t instanceof AST_Yield||t instanceof AST_Export})),t(AST_Binary,(function(e){var t=e.parent();if(t instanceof AST_Call&&t.expression===this)return !0;if(t instanceof AST_Unary)return !0;if(t instanceof AST_PropAccess&&t.expression===this)return !0;if(t instanceof AST_Binary){const e=t.operator,n=this.operator;if("??"===n&&("||"===e||"&&"===e))return !0;if("??"===e&&("||"===n||"&&"===n))return !0;const o=PRECEDENCE[e],i=PRECEDENCE[n];if(o>i||o==i&&(this===t.right||"**"==e))return !0}})),t(AST_Yield,(function(e){var t=e.parent();return t instanceof AST_Binary&&"="!==t.operator||t instanceof AST_Call&&t.expression===this||t instanceof AST_Conditional&&t.condition===this||t instanceof AST_Unary||t instanceof AST_PropAccess&&t.expression===this||void 0})),t(AST_PropAccess,(function(e){var t=e.parent();if(t instanceof AST_New&&t.expression===this)return walk$3(this,(e=>e instanceof AST_Scope||(e instanceof AST_Call?walk_abort:void 0)))})),t(AST_Call,(function(e){var t,n=e.parent();return !!(n instanceof AST_New&&n.expression===this||n instanceof AST_Export&&n.is_default&&this.expression instanceof AST_Function)||this.expression instanceof AST_Function&&n instanceof AST_PropAccess&&n.expression===this&&(t=e.parent(1))instanceof AST_Assign&&t.left===n})),t(AST_New,(function(e){var t=e.parent();if(0===this.args.length&&(t instanceof AST_PropAccess||t instanceof AST_Call&&t.expression===this))return !0})),t(AST_Number,(function(e){var t=e.parent();if(t instanceof AST_PropAccess&&t.expression===this){var n=this.getValue();if(n<0||/^0/.test(_(n)))return !0}})),t(AST_BigInt,(function(e){var t=e.parent();if(t instanceof AST_PropAccess&&t.expression===this&&this.getValue().startsWith("-"))return !0})),t([AST_Assign,AST_Conditional],(function(e){var t=e.parent();return t instanceof AST_Unary||t instanceof AST_Binary&&!(t instanceof AST_Assign)||t instanceof AST_Call&&t.expression===this||t instanceof AST_Conditional&&t.condition===this||t instanceof AST_PropAccess&&t.expression===this||this instanceof AST_Assign&&this.left instanceof AST_Destructuring&&!1===this.left.is_array||void 0})),e(AST_Directive,(function(e,t){t.print_string(e.value,e.quote),t.semicolon();})),e(AST_Expansion,(function(e,t){t.print("..."),e.expression.print(t);})),e(AST_Destructuring,(function(e,t){t.print(e.is_array?"[":"{");var n=e.names.length;e.names.forEach((function(e,o){o>0&&t.comma(),e.print(t),o==n-1&&e instanceof AST_Hole&&t.comma();})),t.print(e.is_array?"]":"}");})),e(AST_Debugger,(function(e,t){t.print("debugger"),t.semicolon();})),AST_StatementWithBody.DEFMETHOD("_do_print_body",(function(e){l(this.body,e);})),e(AST_Statement,(function(e,t){e.body.print(t),t.semicolon();})),e(AST_Toplevel,(function(e,t){n(e.body,!0,t,!0),t.print("");})),e(AST_LabeledStatement,(function(e,t){e.label.print(t),t.colon(),e.body.print(t);})),e(AST_SimpleStatement,(function(e,t){e.body.print(t),t.semicolon();})),e(AST_BlockStatement,(function(e,t){i(e,t);})),e(AST_EmptyStatement,(function(e,t){t.semicolon();})),e(AST_Do,(function(e,t){t.print("do"),t.space(),c(e.body,t),t.space(),t.print("while"),t.space(),t.with_parens((function(){e.condition.print(t);})),t.semicolon();})),e(AST_While,(function(e,t){t.print("while"),t.space(),t.with_parens((function(){e.condition.print(t);})),t.space(),e._do_print_body(t);})),e(AST_For,(function(e,t){t.print("for"),t.space(),t.with_parens((function(){e.init?(e.init instanceof AST_Definitions?e.init.print(t):r(e.init,t,!0),t.print(";"),t.space()):t.print(";"),e.condition?(e.condition.print(t),t.print(";"),t.space()):t.print(";"),e.step&&e.step.print(t);})),t.space(),e._do_print_body(t);})),e(AST_ForIn,(function(e,t){t.print("for"),e.await&&(t.space(),t.print("await")),t.space(),t.with_parens((function(){e.init.print(t),t.space(),t.print(e instanceof AST_ForOf?"of":"in"),t.space(),e.object.print(t);})),t.space(),e._do_print_body(t);})),e(AST_With,(function(e,t){t.print("with"),t.space(),t.with_parens((function(){e.expression.print(t);})),t.space(),e._do_print_body(t);})),AST_Lambda.DEFMETHOD("_do_print",(function(e,t){var n=this;t||(n.async&&(e.print("async"),e.space()),e.print("function"),n.is_generator&&e.star(),n.name&&e.space()),n.name instanceof AST_Symbol?n.name.print(e):t&&n.name instanceof AST_Node&&e.with_square((function(){n.name.print(e);})),e.with_parens((function(){n.argnames.forEach((function(t,n){n&&e.comma(),t.print(e);}));})),e.space(),i(n,e,!0);})),e(AST_Lambda,(function(e,t){e._do_print(t);})),e(AST_PrefixedTemplateString,(function(e,t){var n=e.prefix,o=n instanceof AST_Lambda||n instanceof AST_Binary||n instanceof AST_Conditional||n instanceof AST_Sequence||n instanceof AST_Unary||n instanceof AST_Dot&&n.expression instanceof AST_Object;o&&t.print("("),e.prefix.print(t),o&&t.print(")"),e.template_string.print(t);})),e(AST_TemplateString,(function(e,t){var n=t.parent()instanceof AST_PrefixedTemplateString;t.print("`");for(var o=0;o<e.segments.length;o++)e.segments[o]instanceof AST_TemplateSegment?n?t.print(e.segments[o].raw):t.print_template_string_chars(e.segments[o].value):(t.print("${"),e.segments[o].print(t),t.print("}"));t.print("`");})),e(AST_TemplateSegment,(function(e,t){t.print_template_string_chars(e.value);})),AST_Arrow.DEFMETHOD("_do_print",(function(e){var t=this,n=e.parent(),o=n instanceof AST_Binary&&!(n instanceof AST_Assign)||n instanceof AST_Unary||n instanceof AST_Call&&t===n.expression;o&&e.print("("),t.async&&(e.print("async"),e.space()),1===t.argnames.length&&t.argnames[0]instanceof AST_Symbol?t.argnames[0].print(e):e.with_parens((function(){t.argnames.forEach((function(t,n){n&&e.comma(),t.print(e);}));})),e.space(),e.print("=>"),e.space();const r=t.body[0];if(1===t.body.length&&r instanceof AST_Return){const t=r.value;t?left_is_object(t)?(e.print("("),t.print(e),e.print(")")):t.print(e):e.print("{}");}else i(t,e);o&&e.print(")");})),AST_Exit.DEFMETHOD("_do_print",(function(e,t){if(e.print(t),this.value){e.space();const t=this.value.start.comments_before;t&&t.length&&!e.printed_comments.has(t)?(e.print("("),this.value.print(e),e.print(")")):this.value.print(e);}e.semicolon();})),e(AST_Return,(function(e,t){e._do_print(t,"return");})),e(AST_Throw,(function(e,t){e._do_print(t,"throw");})),e(AST_Yield,(function(e,t){var n=e.is_star?"*":"";t.print("yield"+n),e.expression&&(t.space(),e.expression.print(t));})),e(AST_Await,(function(e,t){t.print("await"),t.space();var n=e.expression,o=!(n instanceof AST_Call||n instanceof AST_SymbolRef||n instanceof AST_PropAccess||n instanceof AST_Unary||n instanceof AST_Constant||n instanceof AST_Await||n instanceof AST_Object);o&&t.print("("),e.expression.print(t),o&&t.print(")");})),AST_LoopControl.DEFMETHOD("_do_print",(function(e,t){e.print(t),this.label&&(e.space(),this.label.print(e)),e.semicolon();})),e(AST_Break,(function(e,t){e._do_print(t,"break");})),e(AST_Continue,(function(e,t){e._do_print(t,"continue");})),e(AST_If,(function(e,t){t.print("if"),t.space(),t.with_parens((function(){e.condition.print(t);})),t.space(),e.alternative?(function(e,t){var n=e.body;if(t.option("braces")||t.option("ie8")&&n instanceof AST_Do)return c(n,t);if(!n)return t.force_semicolon();for(;;)if(n instanceof AST_If){if(!n.alternative)return void c(e.body,t);n=n.alternative;}else {if(!(n instanceof AST_StatementWithBody))break;n=n.body;}l(e.body,t);}(e,t),t.space(),t.print("else"),t.space(),e.alternative instanceof AST_If?e.alternative.print(t):l(e.alternative,t)):e._do_print_body(t);})),e(AST_Switch,(function(e,t){t.print("switch"),t.space(),t.with_parens((function(){e.expression.print(t);})),t.space();var n=e.body.length-1;n<0?o(e,t):t.with_block((function(){e.body.forEach((function(e,o){t.indent(!0),e.print(t),o<n&&e.body.length>0&&t.newline();}));}));})),AST_SwitchBranch.DEFMETHOD("_do_print_body",(function(e){e.newline(),this.body.forEach((function(t){e.indent(),t.print(e),e.newline();}));})),e(AST_Default,(function(e,t){t.print("default:"),e._do_print_body(t);})),e(AST_Case,(function(e,t){t.print("case"),t.space(),e.expression.print(t),t.print(":"),e._do_print_body(t);})),e(AST_Try,(function(e,t){t.print("try"),t.space(),i(e,t),e.bcatch&&(t.space(),e.bcatch.print(t)),e.bfinally&&(t.space(),e.bfinally.print(t));})),e(AST_Catch,(function(e,t){t.print("catch"),e.argname&&(t.space(),t.with_parens((function(){e.argname.print(t);}))),t.space(),i(e,t);})),e(AST_Finally,(function(e,t){t.print("finally"),t.space(),i(e,t);})),AST_Definitions.DEFMETHOD("_do_print",(function(e,t){e.print(t),e.space(),this.definitions.forEach((function(t,n){n&&e.comma(),t.print(e);}));var n=e.parent();(!(n instanceof AST_For||n instanceof AST_ForIn)||n&&n.init!==this)&&e.semicolon();})),e(AST_Let,(function(e,t){e._do_print(t,"let");})),e(AST_Var,(function(e,t){e._do_print(t,"var");})),e(AST_Const,(function(e,t){e._do_print(t,"const");})),e(AST_Import,(function(e,t){t.print("import"),t.space(),e.imported_name&&e.imported_name.print(t),e.imported_name&&e.imported_names&&(t.print(","),t.space()),e.imported_names&&(1===e.imported_names.length&&"*"===e.imported_names[0].foreign_name.name?e.imported_names[0].print(t):(t.print("{"),e.imported_names.forEach((function(n,o){t.space(),n.print(t),o<e.imported_names.length-1&&t.print(",");})),t.space(),t.print("}"))),(e.imported_name||e.imported_names)&&(t.space(),t.print("from"),t.space()),e.module_name.print(t),t.semicolon();})),e(AST_ImportMeta,(function(e,t){t.print("import.meta");})),e(AST_NameMapping,(function(e,t){var n=t.parent()instanceof AST_Import,o=e.name.definition();(o&&o.mangled_name||e.name.name)!==e.foreign_name.name?(n?t.print(e.foreign_name.name):e.name.print(t),t.space(),t.print("as"),t.space(),n?e.name.print(t):t.print(e.foreign_name.name)):e.name.print(t);})),e(AST_Export,(function(e,t){if(t.print("export"),t.space(),e.is_default&&(t.print("default"),t.space()),e.exported_names)1===e.exported_names.length&&"*"===e.exported_names[0].name.name?e.exported_names[0].print(t):(t.print("{"),e.exported_names.forEach((function(n,o){t.space(),n.print(t),o<e.exported_names.length-1&&t.print(",");})),t.space(),t.print("}"));else if(e.exported_value)e.exported_value.print(t);else if(e.exported_definition&&(e.exported_definition.print(t),e.exported_definition instanceof AST_Definitions))return;e.module_name&&(t.space(),t.print("from"),t.space(),e.module_name.print(t)),(e.exported_value&&!(e.exported_value instanceof AST_Defun||e.exported_value instanceof AST_Function||e.exported_value instanceof AST_Class)||e.module_name||e.exported_names)&&t.semicolon();})),e(AST_VarDef,(function(e,t){if(e.name.print(t),e.value){t.space(),t.print("="),t.space();var n=t.parent(1),o=n instanceof AST_For||n instanceof AST_ForIn;r(e.value,t,o);}})),e(AST_Call,(function(e,t){e.expression.print(t),e instanceof AST_New&&0===e.args.length||((e.expression instanceof AST_Call||e.expression instanceof AST_Lambda)&&t.add_mapping(e.start),e.optional&&t.print("?."),t.with_parens((function(){e.args.forEach((function(e,n){n&&t.comma(),e.print(t);}));})));})),e(AST_New,(function(e,t){t.print("new"),t.space(),AST_Call.prototype._codegen(e,t);})),AST_Sequence.DEFMETHOD("_do_print",(function(e){this.expressions.forEach((function(t,n){n>0&&(e.comma(),e.should_break()&&(e.newline(),e.indent())),t.print(e);}));})),e(AST_Sequence,(function(e,t){e._do_print(t);})),e(AST_Dot,(function(e,t){var n=e.expression;n.print(t);var o=e.property,i=RESERVED_WORDS.has(o)?t.option("ie8"):!is_identifier_string(o,t.option("ecma")>=2015||t.option("safari10"));e.optional&&t.print("?."),i?(t.print("["),t.add_mapping(e.end),t.print_string(o),t.print("]")):(n instanceof AST_Number&&n.getValue()>=0&&(/[xa-f.)]/i.test(t.last())||t.print(".")),e.optional||t.print("."),t.add_mapping(e.end),t.print_name(o));})),e(AST_DotHash,(function(e,t){e.expression.print(t);var n=e.property;e.optional&&t.print("?"),t.print(".#"),t.print_name(n);})),e(AST_Sub,(function(e,t){e.expression.print(t),e.optional&&t.print("?."),t.print("["),e.property.print(t),t.print("]");})),e(AST_Chain,(function(e,t){e.expression.print(t);})),e(AST_UnaryPrefix,(function(e,t){var n=e.operator;t.print(n),(/^[a-z]/i.test(n)||/[+-]$/.test(n)&&e.expression instanceof AST_UnaryPrefix&&/^[+-]/.test(e.expression.operator))&&t.space(),e.expression.print(t);})),e(AST_UnaryPostfix,(function(e,t){e.expression.print(t),t.print(e.operator);})),e(AST_Binary,(function(e,t){var n=e.operator;e.left.print(t),">"==n[0]&&e.left instanceof AST_UnaryPostfix&&"--"==e.left.operator?t.print(" "):t.space(),t.print(n),("<"==n||"<<"==n)&&e.right instanceof AST_UnaryPrefix&&"!"==e.right.operator&&e.right.expression instanceof AST_UnaryPrefix&&"--"==e.right.expression.operator?t.print(" "):t.space(),e.right.print(t);})),e(AST_Conditional,(function(e,t){e.condition.print(t),t.space(),t.print("?"),t.space(),e.consequent.print(t),t.space(),t.colon(),e.alternative.print(t);})),e(AST_Array,(function(e,t){t.with_square((function(){var n=e.elements,o=n.length;o>0&&t.space(),n.forEach((function(e,n){n&&t.comma(),e.print(t),n===o-1&&e instanceof AST_Hole&&t.comma();})),o>0&&t.space();}));})),e(AST_Object,(function(e,t){e.properties.length>0?t.with_block((function(){e.properties.forEach((function(e,n){n&&(t.print(","),t.newline()),t.indent(),e.print(t);})),t.newline();})):o(e,t);})),e(AST_Class,(function(e,t){if(t.print("class"),t.space(),e.name&&(e.name.print(t),t.space()),e.extends){var n=!(e.extends instanceof AST_SymbolRef||e.extends instanceof AST_PropAccess||e.extends instanceof AST_ClassExpression||e.extends instanceof AST_Function);t.print("extends"),n?t.print("("):t.space(),e.extends.print(t),n?t.print(")"):t.space();}e.properties.length>0?t.with_block((function(){e.properties.forEach((function(e,n){n&&t.newline(),t.indent(),e.print(t);})),t.newline();})):t.print("{}");})),e(AST_NewTarget,(function(e,t){t.print("new.target");})),e(AST_ObjectKeyVal,(function(e,t){function n(e){var t=e.definition();return t?t.mangled_name||t.name:e.name}var o=t.option("shorthand");o&&e.value instanceof AST_Symbol&&is_identifier_string(e.key,t.option("ecma")>=2015||t.option("safari10"))&&n(e.value)===e.key&&!RESERVED_WORDS.has(e.key)?a(e.key,e.quote,t):o&&e.value instanceof AST_DefaultAssign&&e.value.left instanceof AST_Symbol&&is_identifier_string(e.key,t.option("ecma")>=2015||t.option("safari10"))&&n(e.value.left)===e.key?(a(e.key,e.quote,t),t.space(),t.print("="),t.space(),e.value.right.print(t)):(e.key instanceof AST_Node?t.with_square((function(){e.key.print(t);})):a(e.key,e.quote,t),t.colon(),e.value.print(t));})),e(AST_ClassPrivateProperty,((e,t)=>{e.static&&(t.print("static"),t.space()),t.print("#"),a(e.key.name,e.quote,t),e.value&&(t.print("="),e.value.print(t)),t.semicolon();})),e(AST_ClassProperty,((e,t)=>{e.static&&(t.print("static"),t.space()),e.key instanceof AST_SymbolClassProperty?a(e.key.name,e.quote,t):(t.print("["),e.key.print(t),t.print("]")),e.value&&(t.print("="),e.value.print(t)),t.semicolon();})),AST_ObjectProperty.DEFMETHOD("_print_getter_setter",(function(e,t,n){var o=this;o.static&&(n.print("static"),n.space()),e&&(n.print(e),n.space()),o.key instanceof AST_SymbolMethod?(t&&n.print("#"),a(o.key.name,o.quote,n)):n.with_square((function(){o.key.print(n);})),o.value._do_print(n,!0);})),e(AST_ObjectSetter,(function(e,t){e._print_getter_setter("set",!1,t);})),e(AST_ObjectGetter,(function(e,t){e._print_getter_setter("get",!1,t);})),e(AST_PrivateSetter,(function(e,t){e._print_getter_setter("set",!0,t);})),e(AST_PrivateGetter,(function(e,t){e._print_getter_setter("get",!0,t);})),e(AST_PrivateMethod,(function(e,t){var n;e.is_generator&&e.async?n="async*":e.is_generator?n="*":e.async&&(n="async"),e._print_getter_setter(n,!0,t);})),e(AST_ConciseMethod,(function(e,t){var n;e.is_generator&&e.async?n="async*":e.is_generator?n="*":e.async&&(n="async"),e._print_getter_setter(n,!1,t);})),AST_Symbol.DEFMETHOD("_do_print",(function(e){var t=this.definition();e.print_name(t?t.mangled_name||t.name:this.name);})),e(AST_Symbol,(function(e,t){e._do_print(t);})),e(AST_Hole,noop),e(AST_This,(function(e,t){t.print("this");})),e(AST_Super,(function(e,t){t.print("super");})),e(AST_Constant,(function(e,t){t.print(e.getValue());})),e(AST_String,(function(e,t){t.print_string(e.getValue(),e.quote,t.in_directive);})),e(AST_Number,(function(e,t){(t.option("keep_numbers")||t.use_asm)&&e.raw?t.print(e.raw):t.print(_(e.getValue()));})),e(AST_BigInt,(function(e,t){t.print(e.getValue()+"n");}));const s=/(<\s*\/\s*script)/i,u=(e,t)=>t.replace("/","\\/");function l(e,t){t.option("braces")?c(e,t):!e||e instanceof AST_EmptyStatement?t.force_semicolon():e.print(t);}function _(e){var t,n,o,i=e.toString(10).replace(/^0\./,".").replace("e+","e"),r=[i];return Math.floor(e)===e&&(e<0?r.push("-0x"+(-e).toString(16).toLowerCase()):r.push("0x"+e.toString(16).toLowerCase())),(t=/^\.0+/.exec(i))?(n=t[0].length,o=i.slice(n),r.push(o+"e-"+(o.length+n-1))):(t=/0+$/.exec(i))?(n=t[0].length,r.push(i.slice(0,-n)+"e"+n)):(t=/^(\d)\.(\d+)e(-?\d+)$/.exec(i))&&r.push(t[1]+t[2]+"e"+(t[3]-t[2].length)),function(e){for(var t=e[0],n=t.length,o=1;o<e.length;++o)e[o].length<n&&(n=(t=e[o]).length);return t}(r)}function c(e,t){!e||e instanceof AST_EmptyStatement?t.print("{}"):e instanceof AST_BlockStatement?e.print(t):t.with_block((function(){t.indent(),e.print(t),t.newline();}));}function f(e,t){e.forEach((function(e){e.DEFMETHOD("add_source_map",t);}));}e(AST_RegExp,(function(e,t){let{source:n,flags:o}=e.getValue();n=regexp_source_fix(n),o=o?sort_regexp_flags(o):"",n=n.replace(s,u),t.print(t.to_utf8(`/${n}/${o}`));const i=t.parent();i instanceof AST_Binary&&/^\w/.test(i.operator)&&i.left===e&&t.print(" ");})),f([AST_Node,AST_LabeledStatement,AST_Toplevel],noop),f([AST_Array,AST_BlockStatement,AST_Catch,AST_Class,AST_Constant,AST_Debugger,AST_Definitions,AST_Directive,AST_Finally,AST_Jump,AST_Lambda,AST_New,AST_Object,AST_StatementWithBody,AST_Symbol,AST_Switch,AST_SwitchBranch,AST_TemplateString,AST_TemplateSegment,AST_Try],(function(e){e.add_mapping(this.start);})),f([AST_ObjectGetter,AST_ObjectSetter],(function(e){e.add_mapping(this.start,this.key.name);})),f([AST_ObjectProperty],(function(e){e.add_mapping(this.start,this.key);}));}();const shallow_cmp=(e,t)=>null===e&&null===t||e.TYPE===t.TYPE&&e.shallow_cmp(t),equivalent_to=(e,t)=>{if(!shallow_cmp(e,t))return !1;const n=[e],o=[t],i=n.push.bind(n),r=o.push.bind(o);for(;n.length&&o.length;){const e=n.pop(),t=o.pop();if(!shallow_cmp(e,t))return !1;if(e._children_backwards(i),t._children_backwards(r),n.length!==o.length)return !1}return 0==n.length&&0==o.length},mkshallow=e=>{const t=Object.keys(e).map((t=>{if("eq"===e[t])return `this.${t} === other.${t}`;if("exist"===e[t])return `(this.${t} == null ? other.${t} == null : this.${t} === other.${t})`;throw new Error(`mkshallow: Unexpected instruction: ${e[t]}`)})).join(" && ");return new Function("other","return "+t)},pass_through=()=>!0;AST_Node.prototype.shallow_cmp=function(){throw new Error("did not find a shallow_cmp function for "+this.constructor.name)},AST_Debugger.prototype.shallow_cmp=pass_through,AST_Directive.prototype.shallow_cmp=mkshallow({value:"eq"}),AST_SimpleStatement.prototype.shallow_cmp=pass_through,AST_Block.prototype.shallow_cmp=pass_through,AST_EmptyStatement.prototype.shallow_cmp=pass_through,AST_LabeledStatement.prototype.shallow_cmp=mkshallow({"label.name":"eq"}),AST_Do.prototype.shallow_cmp=pass_through,AST_While.prototype.shallow_cmp=pass_through,AST_For.prototype.shallow_cmp=mkshallow({init:"exist",condition:"exist",step:"exist"}),AST_ForIn.prototype.shallow_cmp=pass_through,AST_ForOf.prototype.shallow_cmp=pass_through,AST_With.prototype.shallow_cmp=pass_through,AST_Toplevel.prototype.shallow_cmp=pass_through,AST_Expansion.prototype.shallow_cmp=pass_through,AST_Lambda.prototype.shallow_cmp=mkshallow({is_generator:"eq",async:"eq"}),AST_Destructuring.prototype.shallow_cmp=mkshallow({is_array:"eq"}),AST_PrefixedTemplateString.prototype.shallow_cmp=pass_through,AST_TemplateString.prototype.shallow_cmp=pass_through,AST_TemplateSegment.prototype.shallow_cmp=mkshallow({value:"eq"}),AST_Jump.prototype.shallow_cmp=pass_through,AST_LoopControl.prototype.shallow_cmp=pass_through,AST_Await.prototype.shallow_cmp=pass_through,AST_Yield.prototype.shallow_cmp=mkshallow({is_star:"eq"}),AST_If.prototype.shallow_cmp=mkshallow({alternative:"exist"}),AST_Switch.prototype.shallow_cmp=pass_through,AST_SwitchBranch.prototype.shallow_cmp=pass_through,AST_Try.prototype.shallow_cmp=mkshallow({bcatch:"exist",bfinally:"exist"}),AST_Catch.prototype.shallow_cmp=mkshallow({argname:"exist"}),AST_Finally.prototype.shallow_cmp=pass_through,AST_Definitions.prototype.shallow_cmp=pass_through,AST_VarDef.prototype.shallow_cmp=mkshallow({value:"exist"}),AST_NameMapping.prototype.shallow_cmp=pass_through,AST_Import.prototype.shallow_cmp=mkshallow({imported_name:"exist",imported_names:"exist"}),AST_ImportMeta.prototype.shallow_cmp=pass_through,AST_Export.prototype.shallow_cmp=mkshallow({exported_definition:"exist",exported_value:"exist",exported_names:"exist",module_name:"eq",is_default:"eq"}),AST_Call.prototype.shallow_cmp=pass_through,AST_Sequence.prototype.shallow_cmp=pass_through,AST_PropAccess.prototype.shallow_cmp=pass_through,AST_Chain.prototype.shallow_cmp=pass_through,AST_Dot.prototype.shallow_cmp=mkshallow({property:"eq"}),AST_Unary.prototype.shallow_cmp=mkshallow({operator:"eq"}),AST_Binary.prototype.shallow_cmp=mkshallow({operator:"eq"}),AST_Conditional.prototype.shallow_cmp=pass_through,AST_Array.prototype.shallow_cmp=pass_through,AST_Object.prototype.shallow_cmp=pass_through,AST_ObjectProperty.prototype.shallow_cmp=pass_through,AST_ObjectKeyVal.prototype.shallow_cmp=mkshallow({key:"eq"}),AST_ObjectSetter.prototype.shallow_cmp=mkshallow({static:"eq"}),AST_ObjectGetter.prototype.shallow_cmp=mkshallow({static:"eq"}),AST_ConciseMethod.prototype.shallow_cmp=mkshallow({static:"eq",is_generator:"eq",async:"eq"}),AST_Class.prototype.shallow_cmp=mkshallow({name:"exist",extends:"exist"}),AST_ClassProperty.prototype.shallow_cmp=mkshallow({static:"eq"}),AST_Symbol.prototype.shallow_cmp=mkshallow({name:"eq"}),AST_NewTarget.prototype.shallow_cmp=pass_through,AST_This.prototype.shallow_cmp=pass_through,AST_Super.prototype.shallow_cmp=pass_through,AST_String.prototype.shallow_cmp=mkshallow({value:"eq"}),AST_Number.prototype.shallow_cmp=mkshallow({value:"eq"}),AST_BigInt.prototype.shallow_cmp=mkshallow({value:"eq"}),AST_RegExp.prototype.shallow_cmp=function(e){return this.value.flags===e.value.flags&&this.value.source===e.value.source},AST_Atom.prototype.shallow_cmp=pass_through;let function_defs=null,unmangleable_names=null;class SymbolDef{constructor(e,t,n){this.name=t.name,this.orig=[t],this.init=n,this.eliminated=0,this.assignments=0,this.scope=e,this.replaced=0,this.global=!1,this.export=0,this.mangled_name=null,this.undeclared=!1,this.id=SymbolDef.next_id++,this.chained=!1,this.direct_access=!1,this.escaped=0,this.recursive_refs=0,this.references=[],this.should_replace=void 0,this.single_use=!1,this.fixed=!1,Object.seal(this);}fixed_value(){return !this.fixed||this.fixed instanceof AST_Node?this.fixed:this.fixed()}unmangleable(e){return e||(e={}),!!(function_defs&&function_defs.has(this.id)&&keep_name(e.keep_fnames,this.orig[0].name))||this.global&&!e.toplevel||1&this.export||this.undeclared||!e.eval&&this.scope.pinned()||(this.orig[0]instanceof AST_SymbolLambda||this.orig[0]instanceof AST_SymbolDefun)&&keep_name(e.keep_fnames,this.orig[0].name)||this.orig[0]instanceof AST_SymbolMethod||(this.orig[0]instanceof AST_SymbolClass||this.orig[0]instanceof AST_SymbolDefClass)&&keep_name(e.keep_classnames,this.orig[0].name)}mangle(e){const t=e.cache&&e.cache.props;if(this.global&&t&&t.has(this.name))this.mangled_name=t.get(this.name);else if(!this.mangled_name&&!this.unmangleable(e)){var n=this.scope,o=this.orig[0];e.ie8&&o instanceof AST_SymbolLambda&&(n=n.parent_scope);const i=redefined_catch_def(this);this.mangled_name=i?i.mangled_name||i.name:n.next_mangled(e,this),this.global&&t&&t.set(this.name,this.mangled_name);}}}function redefined_catch_def(e){if(e.orig[0]instanceof AST_SymbolCatch&&e.scope.is_block_scope())return e.scope.get_defun_scope().variables.get(e.name)}function find_scopes_visible_from(e){const t=new Set;for(const n of new Set(e))!function e(n){null==n||t.has(n)||(t.add(n),e(n.parent_scope));}(n);return [...t]}function next_mangled(e,t){var n=e.enclosed;e:for(;;){var o=base54(++e.cname);if(!RESERVED_WORDS.has(o)&&!(t.reserved.has(o)||unmangleable_names&&unmangleable_names.has(o))){for(let e=n.length;--e>=0;){const i=n[e];if(o==(i.mangled_name||i.unmangleable(t)&&i.name))continue e}return o}}}SymbolDef.next_id=1,AST_Scope.DEFMETHOD("figure_out_scope",(function(e,{parent_scope:t=null,toplevel:n=this}={}){if(e=defaults$1(e,{cache:null,ie8:!1,safari10:!1}),!(n instanceof AST_Toplevel))throw new Error("Invalid toplevel scope");var o=this.parent_scope=t,i=new Map,r=null,a=null,s=[],u=new TreeWalker(((t,n)=>{if(t.is_block_scope()){const i=o;t.block_scope=o=new AST_Scope(t),o._block_scope=!0;const r=t instanceof AST_Catch?i.parent_scope:i;if(o.init_scope_vars(r),o.uses_with=i.uses_with,o.uses_eval=i.uses_eval,e.safari10&&(t instanceof AST_For||t instanceof AST_ForIn)&&s.push(o),t instanceof AST_Switch){const e=o;o=i,t.expression.walk(u),o=e;for(let e=0;e<t.body.length;e++)t.body[e].walk(u);}else n();return o=i,!0}if(t instanceof AST_Destructuring){const e=a;return a=t,n(),a=e,!0}if(t instanceof AST_Scope){t.init_scope_vars(o);var _=o,c=r,f=i;return r=o=t,i=new Map,n(),o=_,r=c,i=f,!0}if(t instanceof AST_LabeledStatement){var p=t.label;if(i.has(p.name))throw new Error(string_template("Label {name} defined twice",p));return i.set(p.name,p),n(),i.delete(p.name),!0}if(t instanceof AST_With)for(var d=o;d;d=d.parent_scope)d.uses_with=!0;else {if(t instanceof AST_Symbol&&(t.scope=o),t instanceof AST_Label&&(t.thedef=t,t.references=[]),t instanceof AST_SymbolLambda)r.def_function(t,"arguments"==t.name?void 0:r);else if(t instanceof AST_SymbolDefun)l((t.scope=r.parent_scope.get_defun_scope()).def_function(t,r),1);else if(t instanceof AST_SymbolClass)l(r.def_variable(t,r),1);else if(t instanceof AST_SymbolImport)o.def_variable(t);else if(t instanceof AST_SymbolDefClass)l((t.scope=r.parent_scope).def_function(t,r),1);else if(t instanceof AST_SymbolVar||t instanceof AST_SymbolLet||t instanceof AST_SymbolConst||t instanceof AST_SymbolCatch){if((S=t instanceof AST_SymbolBlockDeclaration?o.def_variable(t,null):r.def_variable(t,"SymbolVar"==t.TYPE?null:void 0)).orig.every((e=>e===t||(t instanceof AST_SymbolBlockDeclaration?e instanceof AST_SymbolLambda:!(e instanceof AST_SymbolLet||e instanceof AST_SymbolConst))))||js_error(`"${t.name}" is redeclared`,t.start.file,t.start.line,t.start.col,t.start.pos),t instanceof AST_SymbolFunarg||l(S,2),r!==o){t.mark_enclosed();var S=o.find_variable(t);t.thedef!==S&&(t.thedef=S,t.reference());}}else if(t instanceof AST_LabelRef){var m=i.get(t.name);if(!m)throw new Error(string_template("Undefined label {name} [{line},{col}]",{name:t.name,line:t.start.line,col:t.start.col}));t.thedef=m;}o instanceof AST_Toplevel||!(t instanceof AST_Export||t instanceof AST_Import)||js_error(`"${t.TYPE}" statement may only appear at the top level`,t.start.file,t.start.line,t.start.col,t.start.pos);}}));function l(e,t){if(a){var n=0;do{t++;}while(u.parent(n++)!==a)}var o=u.parent(t);if(e.export=o instanceof AST_Export?1:0){var i=o.exported_definition;(i instanceof AST_Defun||i instanceof AST_DefClass)&&o.is_default&&(e.export=2);}}if(this.walk(u),this instanceof AST_Toplevel&&(this.globals=new Map),u=new TreeWalker((e=>{if(e instanceof AST_LoopControl&&e.label)return e.label.thedef.references.push(e),!0;if(e instanceof AST_SymbolRef){var t,o=e.name;if("eval"==o&&u.parent()instanceof AST_Call)for(var i=e.scope;i&&!i.uses_eval;i=i.parent_scope)i.uses_eval=!0;return u.parent()instanceof AST_NameMapping&&u.parent(1).module_name||!(t=e.scope.find_variable(o))?(t=n.def_global(e),e instanceof AST_SymbolExport&&(t.export=1)):t.scope instanceof AST_Lambda&&"arguments"==o&&(t.scope.uses_arguments=!0),e.thedef=t,e.reference(),!e.scope.is_block_scope()||t.orig[0]instanceof AST_SymbolBlockDeclaration||(e.scope=e.scope.get_defun_scope()),!0}var r;if(e instanceof AST_SymbolCatch&&(r=redefined_catch_def(e.definition())))for(i=e.scope;i&&(push_uniq(i.enclosed,r),i!==r.scope);)i=i.parent_scope;})),this.walk(u),(e.ie8||e.safari10)&&walk$3(this,(e=>{if(e instanceof AST_SymbolCatch){var t=e.name,o=e.thedef.references,i=e.scope.get_defun_scope(),r=i.find_variable(t)||n.globals.get(t)||i.def_variable(e);return o.forEach((function(e){e.thedef=r,e.reference();})),e.thedef=r,e.reference(),!0}})),e.safari10)for(const e of s)e.parent_scope.variables.forEach((function(t){push_uniq(e.enclosed,t);}));})),AST_Toplevel.DEFMETHOD("def_global",(function(e){var t=this.globals,n=e.name;if(t.has(n))return t.get(n);var o=new SymbolDef(this,e);return o.undeclared=!0,o.global=!0,t.set(n,o),o})),AST_Scope.DEFMETHOD("init_scope_vars",(function(e){this.variables=new Map,this.functions=new Map,this.uses_with=!1,this.uses_eval=!1,this.parent_scope=e,this.enclosed=[],this.cname=-1;})),AST_Scope.DEFMETHOD("conflicting_def",(function(e){return this.enclosed.find((t=>t.name===e))||this.variables.has(e)||this.parent_scope&&this.parent_scope.conflicting_def(e)})),AST_Scope.DEFMETHOD("conflicting_def_shallow",(function(e){return this.enclosed.find((t=>t.name===e))||this.variables.has(e)})),AST_Scope.DEFMETHOD("add_child_scope",(function(e){if(e.parent_scope===this)return;e.parent_scope=this;const t=(()=>{const e=[];let t=this;do{e.push(t);}while(t=t.parent_scope);return e.reverse(),e})(),n=new Set(e.enclosed),o=[];for(const e of t){o.forEach((t=>push_uniq(e.enclosed,t)));for(const t of e.variables.values())n.has(t)&&(push_uniq(o,t),push_uniq(e.enclosed,t));}})),AST_Scope.DEFMETHOD("create_symbol",(function(e,{source:t,tentative_name:n,scope:o,conflict_scopes:i=[o],init:r=null}={}){let a;if(i=find_scopes_visible_from(i),n){n=a=n.replace(/(?:^[^a-z_$]|[^a-z0-9_$])/gi,"_");let e=0;for(;i.find((e=>e.conflicting_def_shallow(a)));)a=n+"$"+e++;}if(!a)throw new Error("No symbol name could be generated in create_symbol()");const s=make_node(e,t,{name:a,scope:o});return this.def_variable(s,r||null),s.mark_enclosed(),s})),AST_Node.DEFMETHOD("is_block_scope",return_false),AST_Class.DEFMETHOD("is_block_scope",return_false),AST_Lambda.DEFMETHOD("is_block_scope",return_false),AST_Toplevel.DEFMETHOD("is_block_scope",return_false),AST_SwitchBranch.DEFMETHOD("is_block_scope",return_false),AST_Block.DEFMETHOD("is_block_scope",return_true),AST_Scope.DEFMETHOD("is_block_scope",(function(){return this._block_scope||!1})),AST_IterationStatement.DEFMETHOD("is_block_scope",return_true),AST_Lambda.DEFMETHOD("init_scope_vars",(function(){AST_Scope.prototype.init_scope_vars.apply(this,arguments),this.uses_arguments=!1,this.def_variable(new AST_SymbolFunarg({name:"arguments",start:this.start,end:this.end}));})),AST_Arrow.DEFMETHOD("init_scope_vars",(function(){AST_Scope.prototype.init_scope_vars.apply(this,arguments),this.uses_arguments=!1;})),AST_Symbol.DEFMETHOD("mark_enclosed",(function(){for(var e=this.definition(),t=this.scope;t&&(push_uniq(t.enclosed,e),t!==e.scope);)t=t.parent_scope;})),AST_Symbol.DEFMETHOD("reference",(function(){this.definition().references.push(this),this.mark_enclosed();})),AST_Scope.DEFMETHOD("find_variable",(function(e){return e instanceof AST_Symbol&&(e=e.name),this.variables.get(e)||this.parent_scope&&this.parent_scope.find_variable(e)})),AST_Scope.DEFMETHOD("def_function",(function(e,t){var n=this.def_variable(e,t);return (!n.init||n.init instanceof AST_Defun)&&(n.init=t),this.functions.set(e.name,n),n})),AST_Scope.DEFMETHOD("def_variable",(function(e,t){var n=this.variables.get(e.name);return n?(n.orig.push(e),n.init&&(n.scope!==e.scope||n.init instanceof AST_Function)&&(n.init=t)):(n=new SymbolDef(this,e,t),this.variables.set(e.name,n),n.global=!this.parent_scope),e.thedef=n})),AST_Scope.DEFMETHOD("next_mangled",(function(e){return next_mangled(this,e)})),AST_Toplevel.DEFMETHOD("next_mangled",(function(e){let t;const n=this.mangled_names;do{t=next_mangled(this,e);}while(n.has(t));return t})),AST_Function.DEFMETHOD("next_mangled",(function(e,t){for(var n=t.orig[0]instanceof AST_SymbolFunarg&&this.name&&this.name.definition(),o=n?n.mangled_name||n.name:null;;){var i=next_mangled(this,e);if(!o||o!=i)return i}})),AST_Symbol.DEFMETHOD("unmangleable",(function(e){var t=this.definition();return !t||t.unmangleable(e)})),AST_Label.DEFMETHOD("unmangleable",return_false),AST_Symbol.DEFMETHOD("unreferenced",(function(){return !this.definition().references.length&&!this.scope.pinned()})),AST_Symbol.DEFMETHOD("definition",(function(){return this.thedef})),AST_Symbol.DEFMETHOD("global",(function(){return this.thedef.global})),AST_Toplevel.DEFMETHOD("_default_mangler_options",(function(e){return (e=defaults$1(e,{eval:!1,ie8:!1,keep_classnames:!1,keep_fnames:!1,module:!1,reserved:[],toplevel:!1})).module&&(e.toplevel=!0),Array.isArray(e.reserved)||e.reserved instanceof Set||(e.reserved=[]),e.reserved=new Set(e.reserved),e.reserved.add("arguments"),e})),AST_Toplevel.DEFMETHOD("mangle_names",(function(e){e=this._default_mangler_options(e);var t=-1,n=[];e.keep_fnames&&(function_defs=new Set);const o=this.mangled_names=new Set;e.cache&&(this.globals.forEach(r),e.cache.props&&e.cache.props.forEach((function(e){o.add(e);})));var i=new TreeWalker((function(o,i){if(o instanceof AST_LabeledStatement){var a=t;return i(),t=a,!0}if(o instanceof AST_Scope)o.variables.forEach(r);else if(o.is_block_scope())o.block_scope.variables.forEach(r);else if(function_defs&&o instanceof AST_VarDef&&o.value instanceof AST_Lambda&&!o.value.name&&keep_name(e.keep_fnames,o.name.name))function_defs.add(o.name.definition().id);else {if(o instanceof AST_Label){let e;do{e=base54(++t);}while(RESERVED_WORDS.has(e));return o.mangled_name=e,!0}!e.ie8&&!e.safari10&&o instanceof AST_SymbolCatch&&n.push(o.definition());}}));function r(t){!(e.reserved.has(t.name)||1&t.export)&&n.push(t);}this.walk(i),(e.keep_fnames||e.keep_classnames)&&(unmangleable_names=new Set,n.forEach((t=>{t.name.length<6&&t.unmangleable(e)&&unmangleable_names.add(t.name);}))),n.forEach((t=>{t.mangle(e);})),function_defs=null,unmangleable_names=null;})),AST_Toplevel.DEFMETHOD("find_colliding_names",(function(e){const t=e.cache&&e.cache.props,n=new Set;return e.reserved.forEach(o),this.globals.forEach(i),this.walk(new TreeWalker((function(e){e instanceof AST_Scope&&e.variables.forEach(i),e instanceof AST_SymbolCatch&&i(e.definition());}))),n;function o(e){n.add(e);}function i(n){var i=n.name;if(n.global&&t&&t.has(i))i=t.get(i);else if(!n.unmangleable(e))return;o(i);}})),AST_Toplevel.DEFMETHOD("expand_names",(function(e){base54.reset(),base54.sort(),e=this._default_mangler_options(e);var t=this.find_colliding_names(e),n=0;function o(o){if(o.global&&e.cache)return;if(o.unmangleable(e))return;if(e.reserved.has(o.name))return;const i=redefined_catch_def(o),r=o.name=i?i.name:function(){var e;do{e=base54(n++);}while(t.has(e)||RESERVED_WORDS.has(e));return e}();o.orig.forEach((function(e){e.name=r;})),o.references.forEach((function(e){e.name=r;}));}this.globals.forEach(o),this.walk(new TreeWalker((function(e){e instanceof AST_Scope&&e.variables.forEach(o),e instanceof AST_SymbolCatch&&o(e.definition());})));})),AST_Node.DEFMETHOD("tail_node",return_this),AST_Sequence.DEFMETHOD("tail_node",(function(){return this.expressions[this.expressions.length-1]})),AST_Toplevel.DEFMETHOD("compute_char_frequency",(function(e){e=this._default_mangler_options(e);try{AST_Node.prototype.print=function(n,o){this._print(n,o),this instanceof AST_Symbol&&!this.unmangleable(e)?base54.consider(this.name,-1):e.properties&&(this instanceof AST_DotHash?base54.consider("#"+this.property,-1):this instanceof AST_Dot?base54.consider(this.property,-1):this instanceof AST_Sub&&t(this.property));},base54.consider(this.print_to_string(),1);}finally{AST_Node.prototype.print=AST_Node.prototype._print;}function t(e){e instanceof AST_String?base54.consider(e.value,-1):e instanceof AST_Conditional?(t(e.consequent),t(e.alternative)):e instanceof AST_Sequence&&t(e.tail_node());}base54.sort();}));const base54=(()=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_".split(""),t="0123456789".split("");let n,o;function i(){o=new Map,e.forEach((function(e){o.set(e,0);})),t.forEach((function(e){o.set(e,0);}));}function r(e,t){return o.get(t)-o.get(e)}function a(e){var t="",o=54;e++;do{e--,t+=n[e%o],e=Math.floor(e/o),o=64;}while(e>0);return t}return a.consider=function(e,t){for(var n=e.length;--n>=0;)o.set(e[n],o.get(e[n])+t);},a.sort=function(){n=mergeSort(e,r).concat(mergeSort(t,r));},a.reset=i,i(),a})();let mangle_options;AST_Node.prototype.size=function(e,t){mangle_options=e&&e.mangle_options;let n=0;return walk_parent(this,((e,t)=>{if(n+=e._size(t),e instanceof AST_Arrow&&e.is_braceless())return n+=e.body[0].value._size(t),!0}),t||e&&e.stack),mangle_options=void 0,n},AST_Node.prototype._size=()=>0,AST_Debugger.prototype._size=()=>8,AST_Directive.prototype._size=function(){return 2+this.value.length};const list_overhead=e=>e.length&&e.length-1;AST_Block.prototype._size=function(){return 2+list_overhead(this.body)},AST_Toplevel.prototype._size=function(){return list_overhead(this.body)},AST_EmptyStatement.prototype._size=()=>1,AST_LabeledStatement.prototype._size=()=>2,AST_Do.prototype._size=()=>9,AST_While.prototype._size=()=>7,AST_For.prototype._size=()=>8,AST_ForIn.prototype._size=()=>8,AST_With.prototype._size=()=>6,AST_Expansion.prototype._size=()=>3;const lambda_modifiers=e=>(e.is_generator?1:0)+(e.async?6:0);AST_Accessor.prototype._size=function(){return lambda_modifiers(this)+4+list_overhead(this.argnames)+list_overhead(this.body)},AST_Function.prototype._size=function(e){return 2*!!first_in_statement(e)+lambda_modifiers(this)+12+list_overhead(this.argnames)+list_overhead(this.body)},AST_Defun.prototype._size=function(){return lambda_modifiers(this)+13+list_overhead(this.argnames)+list_overhead(this.body)},AST_Arrow.prototype._size=function(){let e=2+list_overhead(this.argnames);1===this.argnames.length&&this.argnames[0]instanceof AST_Symbol||(e+=2);const t=this.is_braceless()?0:list_overhead(this.body)+2;return lambda_modifiers(this)+e+t},AST_Destructuring.prototype._size=()=>2,AST_TemplateString.prototype._size=function(){return 2+3*Math.floor(this.segments.length/2)},AST_TemplateSegment.prototype._size=function(){return this.value.length},AST_Return.prototype._size=function(){return this.value?7:6},AST_Throw.prototype._size=()=>6,AST_Break.prototype._size=function(){return this.label?6:5},AST_Continue.prototype._size=function(){return this.label?9:8},AST_If.prototype._size=()=>4,AST_Switch.prototype._size=function(){return 8+list_overhead(this.body)},AST_Case.prototype._size=function(){return 5+list_overhead(this.body)},AST_Default.prototype._size=function(){return 8+list_overhead(this.body)},AST_Try.prototype._size=function(){return 3+list_overhead(this.body)},AST_Catch.prototype._size=function(){let e=7+list_overhead(this.body);return this.argname&&(e+=2),e},AST_Finally.prototype._size=function(){return 7+list_overhead(this.body)};const def_size=(e,t)=>e+list_overhead(t.definitions);AST_Var.prototype._size=function(){return def_size(4,this)},AST_Let.prototype._size=function(){return def_size(4,this)},AST_Const.prototype._size=function(){return def_size(6,this)},AST_VarDef.prototype._size=function(){return this.value?1:0},AST_NameMapping.prototype._size=function(){return this.name?4:0},AST_Import.prototype._size=function(){let e=6;return this.imported_name&&(e+=1),(this.imported_name||this.imported_names)&&(e+=5),this.imported_names&&(e+=2+list_overhead(this.imported_names)),e},AST_ImportMeta.prototype._size=()=>11,AST_Export.prototype._size=function(){let e=7+(this.is_default?8:0);return this.exported_value&&(e+=this.exported_value._size()),this.exported_names&&(e+=2+list_overhead(this.exported_names)),this.module_name&&(e+=5),e},AST_Call.prototype._size=function(){return this.optional?4+list_overhead(this.args):2+list_overhead(this.args)},AST_New.prototype._size=function(){return 6+list_overhead(this.args)},AST_Sequence.prototype._size=function(){return list_overhead(this.expressions)},AST_Dot.prototype._size=function(){return this.optional?this.property.length+2:this.property.length+1},AST_DotHash.prototype._size=function(){return this.optional?this.property.length+3:this.property.length+2},AST_Sub.prototype._size=function(){return this.optional?4:2},AST_Unary.prototype._size=function(){return "typeof"===this.operator?7:"void"===this.operator?5:this.operator.length},AST_Binary.prototype._size=function(e){if("in"===this.operator)return 4;let t=this.operator.length;return ("+"===this.operator||"-"===this.operator)&&this.right instanceof AST_Unary&&this.right.operator===this.operator&&(t+=1),this.needs_parens(e)&&(t+=2),t},AST_Conditional.prototype._size=()=>3,AST_Array.prototype._size=function(){return 2+list_overhead(this.elements)},AST_Object.prototype._size=function(e){let t=2;return first_in_statement(e)&&(t+=2),t+list_overhead(this.properties)};const key_size=e=>"string"==typeof e?e.length:0;AST_ObjectKeyVal.prototype._size=function(){return key_size(this.key)+1};const static_size=e=>e?7:0;AST_ObjectGetter.prototype._size=function(){return 5+static_size(this.static)+key_size(this.key)},AST_ObjectSetter.prototype._size=function(){return 5+static_size(this.static)+key_size(this.key)},AST_ConciseMethod.prototype._size=function(){return static_size(this.static)+key_size(this.key)+lambda_modifiers(this)},AST_PrivateMethod.prototype._size=function(){return AST_ConciseMethod.prototype._size.call(this)+1},AST_PrivateGetter.prototype._size=AST_PrivateSetter.prototype._size=function(){return AST_ConciseMethod.prototype._size.call(this)+4},AST_Class.prototype._size=function(){return (this.name?8:7)+(this.extends?8:0)},AST_ClassProperty.prototype._size=function(){return static_size(this.static)+("string"==typeof this.key?this.key.length+2:0)+(this.value?1:0)},AST_ClassPrivateProperty.prototype._size=function(){return AST_ClassProperty.prototype._size.call(this)+1},AST_Symbol.prototype._size=function(){return !mangle_options||this.definition().unmangleable(mangle_options)?this.name.length:1},AST_SymbolClassProperty.prototype._size=function(){return this.name.length},AST_SymbolRef.prototype._size=AST_SymbolDeclaration.prototype._size=function(){const{name:e,thedef:t}=this;return t&&t.global?e.length:"arguments"===e?9:AST_Symbol.prototype._size.call(this)},AST_NewTarget.prototype._size=()=>10,AST_SymbolImportForeign.prototype._size=function(){return this.name.length},AST_SymbolExportForeign.prototype._size=function(){return this.name.length},AST_This.prototype._size=()=>4,AST_Super.prototype._size=()=>5,AST_String.prototype._size=function(){return this.value.length+2},AST_Number.prototype._size=function(){const{value:e}=this;return 0===e?1:e>0&&Math.floor(e)===e?Math.floor(Math.log10(e)+1):e.toString().length},AST_BigInt.prototype._size=function(){return this.value.length},AST_RegExp.prototype._size=function(){return this.value.toString().length},AST_Null.prototype._size=()=>4,AST_NaN.prototype._size=()=>3,AST_Undefined.prototype._size=()=>6,AST_Hole.prototype._size=()=>0,AST_Infinity.prototype._size=()=>8,AST_True.prototype._size=()=>4,AST_False.prototype._size=()=>5,AST_Await.prototype._size=()=>6,AST_Yield.prototype._size=()=>6;const TOP=1024,has_flag=(e,t)=>e.flags&t,set_flag=(e,t)=>{e.flags|=t;},clear_flag=(e,t)=>{e.flags&=~t;};class Compressor extends TreeWalker{constructor(e,{false_by_default:t=!1,mangle_options:n=!1}){super(),void 0===e.defaults||e.defaults||(t=!0),this.options=defaults$1(e,{arguments:!1,arrows:!t,booleans:!t,booleans_as_integers:!1,collapse_vars:!t,comparisons:!t,computed_props:!t,conditionals:!t,dead_code:!t,defaults:!0,directives:!t,drop_console:!1,drop_debugger:!t,ecma:5,evaluate:!t,expression:!1,global_defs:!1,hoist_funs:!1,hoist_props:!t,hoist_vars:!1,ie8:!1,if_return:!t,inline:!t,join_vars:!t,keep_classnames:!1,keep_fargs:!0,keep_fnames:!1,keep_infinity:!1,loops:!t,module:!1,negate_iife:!t,passes:1,properties:!t,pure_getters:!t&&"strict",pure_funcs:null,reduce_funcs:null,reduce_vars:!t,sequences:!t,side_effects:!t,switches:!t,top_retain:null,toplevel:!(!e||!e.top_retain),typeofs:!t,unsafe:!1,unsafe_arrows:!1,unsafe_comps:!1,unsafe_Function:!1,unsafe_math:!1,unsafe_symbols:!1,unsafe_methods:!1,unsafe_proto:!1,unsafe_regexp:!1,unsafe_undefined:!1,unused:!t,warnings:!1},!0);var o=this.options.global_defs;if("object"==typeof o)for(var i in o)"@"===i[0]&&HOP(o,i)&&(o[i.slice(1)]=parse$5(o[i],{expression:!0}));!0===this.options.inline&&(this.options.inline=3);var r=this.options.pure_funcs;this.pure_funcs="function"==typeof r?r:r?function(e){return !r.includes(e.expression.print_to_string())}:return_true;var a=this.options.top_retain;a instanceof RegExp?this.top_retain=function(e){return a.test(e.name)}:"function"==typeof a?this.top_retain=a:a&&("string"==typeof a&&(a=a.split(/,/)),this.top_retain=function(e){return a.includes(e.name)}),this.options.module&&(this.directives["use strict"]=!0,this.options.toplevel=!0);var s=this.options.toplevel;this.toplevel="string"==typeof s?{funcs:/funcs/.test(s),vars:/vars/.test(s)}:{funcs:s,vars:s};var u=this.options.sequences;this.sequences_limit=1==u?800:0|u,this.evaluated_regexps=new Map,this._toplevel=void 0,this.mangle_options=n;}option(e){return this.options[e]}exposed(e){if(e.export)return !0;if(e.global)for(var t=0,n=e.orig.length;t<n;t++)if(!this.toplevel[e.orig[t]instanceof AST_SymbolDefun?"funcs":"vars"])return !0;return !1}in_boolean_context(){if(!this.option("booleans"))return !1;for(var e,t=this.self(),n=0;e=this.parent(n);n++){if(e instanceof AST_SimpleStatement||e instanceof AST_Conditional&&e.condition===t||e instanceof AST_DWLoop&&e.condition===t||e instanceof AST_For&&e.condition===t||e instanceof AST_If&&e.condition===t||e instanceof AST_UnaryPrefix&&"!"==e.operator&&e.expression===t)return !0;if(!(e instanceof AST_Binary&&("&&"==e.operator||"||"==e.operator||"??"==e.operator)||e instanceof AST_Conditional||e.tail_node()===t))return !1;t=e;}}get_toplevel(){return this._toplevel}compress(e){e=e.resolve_defines(this),this._toplevel=e,this.option("expression")&&this._toplevel.process_expression(!0);for(var t=+this.options.passes||1,n=1/0,o=!1,i={ie8:this.option("ie8")},r=0;r<t;r++)if(this._toplevel.figure_out_scope(i),0===r&&this.option("drop_console")&&(this._toplevel=this._toplevel.drop_console()),(r>0||this.option("reduce_vars"))&&this._toplevel.reset_opt_flags(this),this._toplevel=this._toplevel.transform(this),t>1){let e=0;if(walk$3(this._toplevel,(()=>{e++;})),e<n)n=e,o=!1;else {if(o)break;o=!0;}}return this.option("expression")&&this._toplevel.process_expression(!1),e=this._toplevel,this._toplevel=void 0,e}before(e,t){if(has_flag(e,256))return e;var n=!1;e instanceof AST_Scope&&(e=(e=e.hoist_properties(this)).hoist_declarations(this),n=!0),t(e,this),t(e,this);var o=e.optimize(this);return n&&o instanceof AST_Scope&&(o.drop_unused(this),t(o,this)),o===e&&set_flag(o,256),o}}function def_optimize(e,t){e.DEFMETHOD("optimize",(function(e){var n=this;if(has_flag(n,512))return n;if(e.has_directive("use asm"))return n;var o=t(n,e);return set_flag(o,512),o}));}function read_property(e,t){if(!((t=get_value(t))instanceof AST_Node)){var n;if(e instanceof AST_Array){var o=e.elements;if("length"==t)return make_node_from_constant(o.length,e);"number"==typeof t&&t in o&&(n=o[t]);}else if(e instanceof AST_Object){t=""+t;for(var i=e.properties,r=i.length;--r>=0;){if(!(i[r]instanceof AST_ObjectKeyVal))return;n||i[r].key!==t||(n=i[r].value);}}return n instanceof AST_SymbolRef&&n.fixed_value()||n}}function is_modified(e,t,n,o,i,r){var a=t.parent(i),s=is_lhs(n,a);if(s)return s;if(!r&&a instanceof AST_Call&&a.expression===n&&!(o instanceof AST_Arrow)&&!(o instanceof AST_Class)&&!a.is_expr_pure(e)&&(!(o instanceof AST_Function)||!(a instanceof AST_New)&&o.contains_this()))return !0;if(a instanceof AST_Array)return is_modified(e,t,a,a,i+1);if(a instanceof AST_ObjectKeyVal&&n===a.value){var u=t.parent(i+1);return is_modified(e,t,u,u,i+2)}if(a instanceof AST_PropAccess&&a.expression===n){var l=read_property(o,a.property);return !r&&is_modified(e,t,a,l,i+1)}}function is_func_expr(e){return e instanceof AST_Arrow||e instanceof AST_Function}function is_lhs_read_only(e){if(e instanceof AST_This)return !0;if(e instanceof AST_SymbolRef)return e.definition().orig[0]instanceof AST_SymbolLambda;if(e instanceof AST_PropAccess){if((e=e.expression)instanceof AST_SymbolRef){if(e.is_immutable())return !1;e=e.fixed_value();}return !e||!(e instanceof AST_RegExp)&&(e instanceof AST_Constant||is_lhs_read_only(e))}return !1}function is_ref_of(e,t){if(!(e instanceof AST_SymbolRef))return !1;for(var n=e.definition().orig,o=n.length;--o>=0;)if(n[o]instanceof t)return !0}function find_scope(e){for(let t=0;;t++){const n=e.parent(t);if(n instanceof AST_Toplevel)return n;if(n instanceof AST_Lambda)return n;if(n.block_scope)return n.block_scope}}function find_variable(e,t){for(var n,o=0;(n=e.parent(o++))&&!(n instanceof AST_Scope);)if(n instanceof AST_Catch&&n.argname){n=n.argname.definition().scope;break}return n.find_variable(t)}function make_sequence(e,t){if(1==t.length)return t[0];if(0==t.length)throw new Error("trying to create a sequence with length zero!");return make_node(AST_Sequence,e,{expressions:t.reduce(merge_sequence,[])})}function make_node_from_constant(e,t){switch(typeof e){case"string":return make_node(AST_String,t,{value:e});case"number":return isNaN(e)?make_node(AST_NaN,t):isFinite(e)?1/e<0?make_node(AST_UnaryPrefix,t,{operator:"-",expression:make_node(AST_Number,t,{value:-e})}):make_node(AST_Number,t,{value:e}):e<0?make_node(AST_UnaryPrefix,t,{operator:"-",expression:make_node(AST_Infinity,t)}):make_node(AST_Infinity,t);case"boolean":return make_node(e?AST_True:AST_False,t);case"undefined":return make_node(AST_Undefined,t);default:if(null===e)return make_node(AST_Null,t,{value:null});if(e instanceof RegExp)return make_node(AST_RegExp,t,{value:{source:regexp_source_fix(e.source),flags:e.flags}});throw new Error(string_template("Can't handle constant of type: {type}",{type:typeof e}))}}function maintain_this_binding(e,t,n){return e instanceof AST_UnaryPrefix&&"delete"==e.operator||e instanceof AST_Call&&e.expression===t&&(n instanceof AST_PropAccess||n instanceof AST_SymbolRef&&"eval"==n.name)?make_sequence(t,[make_node(AST_Number,t,{value:0}),n]):n}function merge_sequence(e,t){return t instanceof AST_Sequence?e.push(...t.expressions):e.push(t),e}function as_statement_array(e){if(null===e)return [];if(e instanceof AST_BlockStatement)return e.body;if(e instanceof AST_EmptyStatement)return [];if(e instanceof AST_Statement)return [e];throw new Error("Can't convert thing to statement array")}function is_empty(e){return null===e||e instanceof AST_EmptyStatement||e instanceof AST_BlockStatement&&0==e.body.length}function can_be_evicted_from_block(e){return !(e instanceof AST_DefClass||e instanceof AST_Defun||e instanceof AST_Let||e instanceof AST_Const||e instanceof AST_Export||e instanceof AST_Import)}function loop_body(e){return e instanceof AST_IterationStatement&&e.body instanceof AST_BlockStatement?e.body:e}function is_iife_call(e){return "Call"==e.TYPE&&(e.expression instanceof AST_Function||is_iife_call(e.expression))}function is_undeclared_ref(e){return e instanceof AST_SymbolRef&&e.definition().undeclared}def_optimize(AST_Node,(function(e){return e})),AST_Toplevel.DEFMETHOD("drop_console",(function(){return this.transform(new TreeTransformer((function(e){if("Call"==e.TYPE){var t=e.expression;if(t instanceof AST_PropAccess){for(var n=t.expression;n.expression;)n=n.expression;if(is_undeclared_ref(n)&&"console"==n.name)return make_node(AST_Undefined,e)}}})))})),AST_Node.DEFMETHOD("equivalent_to",(function(e){return equivalent_to(this,e)})),AST_Scope.DEFMETHOD("process_expression",(function(e,t){var n=this,o=new TreeTransformer((function(i){if(e&&i instanceof AST_SimpleStatement)return make_node(AST_Return,i,{value:i.body});if(!e&&i instanceof AST_Return){if(t){var r=i.value&&i.value.drop_side_effect_free(t,!0);return r?make_node(AST_SimpleStatement,i,{body:r}):make_node(AST_EmptyStatement,i)}return make_node(AST_SimpleStatement,i,{body:i.value||make_node(AST_UnaryPrefix,i,{operator:"void",expression:make_node(AST_Number,i,{value:0})})})}if(i instanceof AST_Class||i instanceof AST_Lambda&&i!==n)return i;if(i instanceof AST_Block){var a=i.body.length-1;a>=0&&(i.body[a]=i.body[a].transform(o));}else i instanceof AST_If?(i.body=i.body.transform(o),i.alternative&&(i.alternative=i.alternative.transform(o))):i instanceof AST_With&&(i.body=i.body.transform(o));return i}));n.transform(o);})),function(e){function t(e,t){t.assignments=0,t.chained=!1,t.direct_access=!1,t.escaped=0,t.recursive_refs=0,t.references=[],t.single_use=void 0,t.scope.pinned()?t.fixed=!1:t.orig[0]instanceof AST_SymbolConst||!e.exposed(t)?t.fixed=t.init:t.fixed=!1;}function n(e,n,o){o.variables.forEach((function(o){t(n,o),null===o.fixed?(e.defs_to_safe_ids.set(o.id,e.safe_ids),a(e,o,!0)):o.fixed&&(e.loop_ids.set(o.id,e.in_loop),a(e,o,!0));}));}function o(e,n){n.block_scope&&n.block_scope.variables.forEach((n=>{t(e,n);}));}function i(e){e.safe_ids=Object.create(e.safe_ids);}function r(e){e.safe_ids=Object.getPrototypeOf(e.safe_ids);}function a(e,t,n){e.safe_ids[t.id]=n;}function s(e,t){if("m"==t.single_use)return !1;if(e.safe_ids[t.id]){if(null==t.fixed){var n=t.orig[0];if(n instanceof AST_SymbolFunarg||"arguments"==n.name)return !1;t.fixed=make_node(AST_Undefined,n);}return !0}return t.fixed instanceof AST_Defun}function u(e,t,n,o){if(void 0===t.fixed)return !0;let i;return null===t.fixed&&(i=e.defs_to_safe_ids.get(t.id))?(i[t.id]=!1,e.defs_to_safe_ids.delete(t.id),!0):!!HOP(e.safe_ids,t.id)&&!!s(e,t)&&!1!==t.fixed&&!(null!=t.fixed&&(!o||t.references.length>t.assignments))&&(t.fixed instanceof AST_Defun?o instanceof AST_Node&&t.fixed.parent_scope===n:t.orig.every((e=>!(e instanceof AST_SymbolConst||e instanceof AST_SymbolDefun||e instanceof AST_SymbolLambda))))}function l(e,t,n,o,i,r=0,a=1){var s=e.parent(r);if(i){if(i.is_constant())return;if(i instanceof AST_ClassExpression)return}if(s instanceof AST_Assign&&("="===s.operator||s.logical)&&o===s.right||s instanceof AST_Call&&(o!==s.expression||s instanceof AST_New)||s instanceof AST_Exit&&o===s.value&&o.scope!==t.scope||s instanceof AST_VarDef&&o===s.value||s instanceof AST_Yield&&o===s.value&&o.scope!==t.scope)return !(a>1)||i&&i.is_constant_expression(n)||(a=1),void((!t.escaped||t.escaped>a)&&(t.escaped=a));if(s instanceof AST_Array||s instanceof AST_Await||s instanceof AST_Binary&&lazy_op.has(s.operator)||s instanceof AST_Conditional&&o!==s.condition||s instanceof AST_Expansion||s instanceof AST_Sequence&&o===s.tail_node())l(e,t,n,s,s,r+1,a);else if(s instanceof AST_ObjectKeyVal&&o===s.value){var u=e.parent(r+1);l(e,t,n,u,u,r+2,a);}else if(s instanceof AST_PropAccess&&o===s.expression&&(l(e,t,n,s,i=read_property(i,s.property),r+1,a+1),i))return;r>0||s instanceof AST_Sequence&&o!==s.tail_node()||s instanceof AST_SimpleStatement||(t.direct_access=!0);}e(AST_Node,noop);const _=e=>walk$3(e,(e=>{if(e instanceof AST_Symbol){var t=e.definition();t&&(e instanceof AST_SymbolRef&&t.references.push(e),t.fixed=!1);}}));e(AST_Accessor,(function(e,t,o){return i(e),n(e,o,this),t(),r(e),!0})),e(AST_Assign,(function(e,t,n){var o=this;if(o.left instanceof AST_Destructuring)return void _(o.left);const s=()=>{if(o.logical)return o.left.walk(e),i(e),o.right.walk(e),r(e),!0};var c=o.left;if(!(c instanceof AST_SymbolRef))return s();var f=c.definition(),p=u(e,f,c.scope,o.right);if(f.assignments++,!p)return s();var d=f.fixed;if(!d&&"="!=o.operator&&!o.logical)return s();var S="="==o.operator,m=S?o.right:o;return is_modified(n,e,o,m,0)?s():(f.references.push(c),o.logical||(S||(f.chained=!0),f.fixed=S?function(){return o.right}:function(){return make_node(AST_Binary,o,{operator:o.operator.slice(0,-1),left:d instanceof AST_Node?d:d(),right:o.right})}),o.logical?(a(e,f,!1),i(e),o.right.walk(e),r(e),!0):(a(e,f,!1),o.right.walk(e),a(e,f,!0),l(e,f,c.scope,o,m,0,1),!0))})),e(AST_Binary,(function(e){if(lazy_op.has(this.operator))return this.left.walk(e),i(e),this.right.walk(e),r(e),!0})),e(AST_Block,(function(e,t,n){o(n,this);})),e(AST_Case,(function(e){return i(e),this.expression.walk(e),r(e),i(e),walk_body(this,e),r(e),!0})),e(AST_Class,(function(e,t){return clear_flag(this,16),i(e),t(),r(e),!0})),e(AST_Conditional,(function(e){return this.condition.walk(e),i(e),this.consequent.walk(e),r(e),i(e),this.alternative.walk(e),r(e),!0})),e(AST_Chain,(function(e,t){const n=e.safe_ids;return t(),e.safe_ids=n,!0})),e(AST_Call,(function(e){this.expression.walk(e),this.optional&&i(e);for(const t of this.args)t.walk(e);return !0})),e(AST_PropAccess,(function(e){if(this.optional)return this.expression.walk(e),i(e),this.property instanceof AST_Node&&this.property.walk(e),!0})),e(AST_Default,(function(e,t){return i(e),t(),r(e),!0})),e(AST_Lambda,(function(e,t,o){return clear_flag(this,16),i(e),n(e,o,this),this.uses_arguments?(t(),void r(e)):(!this.name&&(s=e.parent())instanceof AST_Call&&s.expression===this&&!s.args.some((e=>e instanceof AST_Expansion))&&this.argnames.every((e=>e instanceof AST_Symbol))&&this.argnames.forEach(((t,n)=>{if(t.definition){var o=t.definition();o.orig.length>1||(void 0!==o.fixed||this.uses_arguments&&!e.has_directive("use strict")?o.fixed=!1:(o.fixed=function(){return s.args[n]||make_node(AST_Undefined,s)},e.loop_ids.set(o.id,e.in_loop),a(e,o,!0)));}})),t(),r(e),!0);var s;})),e(AST_Do,(function(e,t,n){o(n,this);const a=e.in_loop;return e.in_loop=this,i(e),this.body.walk(e),has_break_or_continue(this)&&(r(e),i(e)),this.condition.walk(e),r(e),e.in_loop=a,!0})),e(AST_For,(function(e,t,n){o(n,this),this.init&&this.init.walk(e);const a=e.in_loop;return e.in_loop=this,i(e),this.condition&&this.condition.walk(e),this.body.walk(e),this.step&&(has_break_or_continue(this)&&(r(e),i(e)),this.step.walk(e)),r(e),e.in_loop=a,!0})),e(AST_ForIn,(function(e,t,n){o(n,this),_(this.init),this.object.walk(e);const a=e.in_loop;return e.in_loop=this,i(e),this.body.walk(e),r(e),e.in_loop=a,!0})),e(AST_If,(function(e){return this.condition.walk(e),i(e),this.body.walk(e),r(e),this.alternative&&(i(e),this.alternative.walk(e),r(e)),!0})),e(AST_LabeledStatement,(function(e){return i(e),this.body.walk(e),r(e),!0})),e(AST_SymbolCatch,(function(){this.definition().fixed=!1;})),e(AST_SymbolRef,(function(e,t,n){var o,i,r=this.definition();r.references.push(this),1==r.references.length&&!r.fixed&&r.orig[0]instanceof AST_SymbolDefun&&e.loop_ids.set(r.id,e.in_loop),void 0!==r.fixed&&s(e,r)?r.fixed&&((o=this.fixed_value())instanceof AST_Lambda&&recursive_ref(e,r)?r.recursive_refs++:o&&!n.exposed(r)&&function(e,t,n){return t.option("unused")&&!n.scope.pinned()&&n.references.length-n.recursive_refs==1&&e.loop_ids.get(n.id)===e.in_loop}(e,n,r)?r.single_use=o instanceof AST_Lambda&&!o.pinned()||o instanceof AST_Class||r.scope===this.scope&&o.is_constant_expression():r.single_use=!1,is_modified(n,e,this,o,0,!!(i=o)&&(i.is_constant()||i instanceof AST_Lambda||i instanceof AST_This))&&(r.single_use?r.single_use="m":r.fixed=!1)):r.fixed=!1,l(e,r,this.scope,this,o,0,1);})),e(AST_Toplevel,(function(e,o,i){this.globals.forEach((function(e){t(i,e);})),n(e,i,this);})),e(AST_Try,(function(e,t,n){return o(n,this),i(e),walk_body(this,e),r(e),this.bcatch&&(i(e),this.bcatch.walk(e),r(e)),this.bfinally&&this.bfinally.walk(e),!0})),e(AST_Unary,(function(e){var t=this;if("++"===t.operator||"--"===t.operator){var n=t.expression;if(n instanceof AST_SymbolRef){var o=n.definition(),i=u(e,o,n.scope,!0);if(o.assignments++,i){var r=o.fixed;if(r)return o.references.push(n),o.chained=!0,o.fixed=function(){return make_node(AST_Binary,t,{operator:t.operator.slice(0,-1),left:make_node(AST_UnaryPrefix,t,{operator:"+",expression:r instanceof AST_Node?r:r()}),right:make_node(AST_Number,t,{value:1})})},a(e,o,!0),!0}}}})),e(AST_VarDef,(function(e,t){var n=this;if(n.name instanceof AST_Destructuring)_(n.name);else {var o=n.name.definition();if(n.value){if(u(e,o,n.name.scope,n.value))return o.fixed=function(){return n.value},e.loop_ids.set(o.id,e.in_loop),a(e,o,!1),t(),a(e,o,!0),!0;o.fixed=!1;}}})),e(AST_While,(function(e,t,n){o(n,this);const a=e.in_loop;return e.in_loop=this,i(e),t(),r(e),e.in_loop=a,!0}));}((function(e,t){e.DEFMETHOD("reduce_vars",t);})),AST_Toplevel.DEFMETHOD("reset_opt_flags",(function(e){const t=this,n=e.option("reduce_vars"),o=new TreeWalker((function(i,r){if(clear_flag(i,1792),n)return e.top_retain&&i instanceof AST_Defun&&o.parent()===t&&set_flag(i,TOP),i.reduce_vars(o,r,e)}));o.safe_ids=Object.create(null),o.in_loop=null,o.loop_ids=new Map,o.defs_to_safe_ids=new Map,t.walk(o);})),AST_Symbol.DEFMETHOD("fixed_value",(function(){var e=this.thedef.fixed;return !e||e instanceof AST_Node?e:e()})),AST_SymbolRef.DEFMETHOD("is_immutable",(function(){var e=this.definition().orig;return 1==e.length&&e[0]instanceof AST_SymbolLambda}));var global_names=makePredicate("Array Boolean clearInterval clearTimeout console Date decodeURI decodeURIComponent encodeURI encodeURIComponent Error escape eval EvalError Function isFinite isNaN JSON Math Number parseFloat parseInt RangeError ReferenceError RegExp Object setInterval setTimeout String SyntaxError TypeError unescape URIError");AST_SymbolRef.DEFMETHOD("is_declared",(function(e){return !this.definition().undeclared||e.option("unsafe")&&global_names.has(this.name)}));var identifier_atom=makePredicate("Infinity NaN undefined");function is_identifier_atom(e){return e instanceof AST_Infinity||e instanceof AST_NaN||e instanceof AST_Undefined}function tighten_body(e,t){var n,o,i=t.find_parent(AST_Scope).get_defun_scope();!function(){var e=t.self(),r=0;do{if(e instanceof AST_Catch||e instanceof AST_Finally)r++;else if(e instanceof AST_IterationStatement)n=!0;else {if(e instanceof AST_Scope){i=e;break}e instanceof AST_Try&&(o=!0);}}while(e=t.parent(r++))}();var r,a=10;do{r=!1,u(e),t.option("dead_code")&&_(e,t),t.option("if_return")&&l(e,t),t.sequences_limit>0&&(f(e,t),d(e,t)),t.option("join_vars")&&m(e),t.option("collapse_vars")&&s(e,t);}while(r&&a-- >0);function s(e,t){if(i.pinned())return e;for(var a,s=[],u=e.length,l=new TreeTransformer((function(e){if(v)return e;if(!y)return e!==c[f]?e:++f<c.length?M(e):(y=!0,(S=P(e,0))===e&&(v=!0),e);var n,i=l.parent();if(e instanceof AST_Assign&&(e.logical||"="!=e.operator&&A.equivalent_to(e.left))||e instanceof AST_Await||e instanceof AST_Call&&A instanceof AST_PropAccess&&A.equivalent_to(e.expression)||e instanceof AST_Debugger||e instanceof AST_Destructuring||e instanceof AST_Expansion&&e.expression instanceof AST_Symbol&&(e.expression instanceof AST_This||e.expression.definition().references.length>1)||e instanceof AST_IterationStatement&&!(e instanceof AST_For)||e instanceof AST_LoopControl||e instanceof AST_Try||e instanceof AST_With||e instanceof AST_Yield||e instanceof AST_Export||e instanceof AST_Class||i instanceof AST_For&&e!==i.init||!g&&e instanceof AST_SymbolRef&&!e.is_declared(t)&&!pure_prop_access_globals.has(e)||e instanceof AST_SymbolRef&&i instanceof AST_Call&&has_annotation(i,_NOINLINE))return v=!0,e;if(m||h&&g||!(i instanceof AST_Binary&&lazy_op.has(i.operator)&&i.left!==e||i instanceof AST_Conditional&&i.condition!==e||i instanceof AST_If&&i.condition!==e)||(m=i),R&&!(e instanceof AST_SymbolDeclaration)&&A.equivalent_to(e)){if(m)return v=!0,e;if(is_lhs(e,i))return d&&C++,e;if(C++,d&&p instanceof AST_VarDef)return e;if(r=v=!0,p instanceof AST_UnaryPostfix)return make_node(AST_UnaryPrefix,p,p);if(p instanceof AST_VarDef){var a=p.name.definition(),s=p.value;return a.references.length-a.replaced!=1||t.exposed(a)?make_node(AST_Assign,p,{operator:"=",logical:!1,left:make_node(AST_SymbolRef,p.name,p.name),right:s}):(a.replaced++,b&&is_identifier_atom(s)?s.transform(t):maintain_this_binding(i,e,s))}return clear_flag(p,32),p}return (e instanceof AST_Call||e instanceof AST_Exit&&(E||A instanceof AST_PropAccess||H(A))||e instanceof AST_PropAccess&&(E||e.expression.may_throw_on_access(t))||e instanceof AST_SymbolRef&&(T.get(e.name)||E&&H(e))||e instanceof AST_VarDef&&e.value&&(T.has(e.name.name)||E&&H(e.name))||(n=is_lhs(e.left,e))&&(n instanceof AST_PropAccess||T.has(n.name))||D&&(o?e.has_side_effects(t):X(e)))&&(S=e,e instanceof AST_Scope&&(v=!0)),M(e)}),(function(e){v||(S===e&&(v=!0),m===e&&(m=null));})),_=new TreeTransformer((function(e){if(v)return e;if(!y){if(e!==c[f])return e;if(++f<c.length)return;return y=!0,e}return e instanceof AST_SymbolRef&&e.name==F.name?(--C||(v=!0),is_lhs(e,_.parent())?e:(F.replaced++,d.replaced--,p.value)):e instanceof AST_Default||e instanceof AST_Scope?e:void 0}));--u>=0;){0==u&&t.option("unused")&&x();var c=[];for(w(e[u]);s.length>0;){c=s.pop();var f=0,p=c[c.length-1],d=null,S=null,m=null,A=B(p);if(A&&!is_lhs_read_only(A)&&!A.has_side_effects(t)){var T=V(p),h=K(A);A instanceof AST_SymbolRef&&T.set(A.name,!1);var E=(N=p)instanceof AST_Unary?unary_side_effects.has(N.operator):L(N).has_side_effects(t),g=G(),D=p.may_throw(t),b=p.name instanceof AST_SymbolFunarg,y=b,v=!1,C=0,R=!a||!y;if(!R){for(var k=t.self().argnames.lastIndexOf(p.name)+1;!v&&k<a.length;k++)a[k].transform(l);R=!0;}for(var O=u;!v&&O<e.length;O++)e[O].transform(l);if(d){var F=p.name.definition();if(v&&F.references.length-F.replaced>C)C=!1;else {for(v=!1,f=0,y=b,O=u;!v&&O<e.length;O++)e[O].transform(_);d.single_use=!1;}}C&&!U(p)&&e.splice(u,1);}}}var N;function M(e){if(e instanceof AST_Scope)return e;if(e instanceof AST_Switch){e.expression=e.expression.transform(l);for(var t=0,n=e.body.length;!v&&t<n;t++){var o=e.body[t];if(o instanceof AST_Case){if(!y){if(o!==c[f])continue;f++;}if(o.expression=o.expression.transform(l),!g)break}}return v=!0,e}}function I(e,t,n){var o=!1,r=!(e instanceof AST_Arrow);return t.walk(new TreeWalker((function(t,a){if(o)return !0;if(t instanceof AST_SymbolRef&&(e.variables.has(t.name)||function(e,t){if(e.global)return !1;let n=e.scope;for(;n&&n!==t;){if(n.variables.has(e.name))return !0;n=n.parent_scope;}return !1}(t.definition(),e))){var s=t.definition().scope;if(s!==i)for(;s=s.parent_scope;)if(s===i)return !0;return o=!0}if((n||r)&&t instanceof AST_This)return o=!0;if(t instanceof AST_Scope&&!(t instanceof AST_Arrow)){var u=r;return r=!1,a(),r=u,!0}}))),o}function x(){var e,n=t.self();if(is_func_expr(n)&&!n.name&&!n.uses_arguments&&!n.pinned()&&(e=t.parent())instanceof AST_Call&&e.expression===n&&e.args.every((e=>!(e instanceof AST_Expansion)))){var o=t.has_directive("use strict");o&&!member(o,n.body)&&(o=!1);var i=n.argnames.length;a=e.args.slice(i);for(var r=new Set,u=i;--u>=0;){var l=n.argnames[u],_=e.args[u];const i=l.definition&&l.definition();if(!(i&&i.orig.length>1||(a.unshift(make_node(AST_VarDef,l,{name:l,value:_})),r.has(l.name))))if(r.add(l.name),l instanceof AST_Expansion){var c=e.args.slice(u);c.every((e=>!I(n,e,o)))&&s.unshift([make_node(AST_VarDef,l,{name:l.expression,value:make_node(AST_Array,e,{elements:c})})]);}else _?(_ instanceof AST_Lambda&&_.pinned()||I(n,_,o))&&(_=null):_=make_node(AST_Undefined,l).transform(t),_&&s.unshift([make_node(AST_VarDef,l,{name:l,value:_})]);}}}function w(e){if(c.push(e),e instanceof AST_Assign)e.left.has_side_effects(t)||s.push(c.slice()),w(e.right);else if(e instanceof AST_Binary)w(e.left),w(e.right);else if(e instanceof AST_Call&&!has_annotation(e,_NOINLINE))w(e.expression),e.args.forEach(w);else if(e instanceof AST_Case)w(e.expression);else if(e instanceof AST_Conditional)w(e.condition),w(e.consequent),w(e.alternative);else if(e instanceof AST_Definitions){var n=e.definitions.length,o=n-200;for(o<0&&(o=0);o<n;o++)w(e.definitions[o]);}else e instanceof AST_DWLoop?(w(e.condition),e.body instanceof AST_Block||w(e.body)):e instanceof AST_Exit?e.value&&w(e.value):e instanceof AST_For?(e.init&&w(e.init),e.condition&&w(e.condition),e.step&&w(e.step),e.body instanceof AST_Block||w(e.body)):e instanceof AST_ForIn?(w(e.object),e.body instanceof AST_Block||w(e.body)):e instanceof AST_If?(w(e.condition),e.body instanceof AST_Block||w(e.body),!e.alternative||e.alternative instanceof AST_Block||w(e.alternative)):e instanceof AST_Sequence?e.expressions.forEach(w):e instanceof AST_SimpleStatement?w(e.body):e instanceof AST_Switch?(w(e.expression),e.body.forEach(w)):e instanceof AST_Unary?"++"!=e.operator&&"--"!=e.operator||s.push(c.slice()):e instanceof AST_VarDef&&e.value&&(s.push(c.slice()),w(e.value));c.pop();}function P(e,t,n){var o=l.parent(t);return o instanceof AST_Assign?!n||o.logical||o.left instanceof AST_PropAccess||T.has(o.left.name)?e:P(o,t+1,n):o instanceof AST_Binary?!n||lazy_op.has(o.operator)&&o.left!==e?e:P(o,t+1,n):o instanceof AST_Call||o instanceof AST_Case?e:o instanceof AST_Conditional?n&&o.condition===e?P(o,t+1,n):e:o instanceof AST_Definitions?P(o,t+1,!0):o instanceof AST_Exit?n?P(o,t+1,n):e:o instanceof AST_If?n&&o.condition===e?P(o,t+1,n):e:o instanceof AST_IterationStatement?e:o instanceof AST_Sequence?P(o,t+1,o.tail_node()!==e):o instanceof AST_SimpleStatement?P(o,t+1,!0):o instanceof AST_Switch||o instanceof AST_VarDef?e:null}function B(e){if(e instanceof AST_Assign&&e.logical)return !1;if(!(e instanceof AST_VarDef&&e.name instanceof AST_SymbolDeclaration)){const t=e instanceof AST_Assign?e.left:e.expression;return !is_ref_of(t,AST_SymbolConst)&&!is_ref_of(t,AST_SymbolLet)&&t}var n=e.name.definition();if(member(e.name,n.orig)){var o=n.references.length-n.replaced;if(o)return n.orig.length-n.eliminated>1&&!(e.name instanceof AST_SymbolFunarg)||(o>1?function(e){var t=e.value;if(t instanceof AST_SymbolRef&&"arguments"!=t.name){var n=t.definition();if(!n.undeclared)return d=n}}(e):!t.exposed(n))?make_node(AST_SymbolRef,e.name,e.name):void 0}}function L(e){return e instanceof AST_Assign?e.right:e.value}function V(e){var n=new Map;if(e instanceof AST_Unary)return n;var o=new TreeWalker((function(e){for(var i=e;i instanceof AST_PropAccess;)i=i.expression;(i instanceof AST_SymbolRef||i instanceof AST_This)&&n.set(i.name,n.get(i.name)||is_modified(t,o,e,e,0));}));return L(e).walk(o),n}function U(n){if(n.name instanceof AST_SymbolFunarg){var o=t.parent(),i=t.self().argnames,r=i.indexOf(n.name);if(r<0)o.args.length=Math.min(o.args.length,i.length-1);else {var a=o.args;a[r]&&(a[r]=make_node(AST_Number,a[r],{value:0}));}return !0}var s=!1;return e[u].transform(new TreeTransformer((function(e,t,o){return s?e:e===n||e.body===n?(s=!0,e instanceof AST_VarDef?(e.value=e.name instanceof AST_SymbolConst?make_node(AST_Undefined,e.value):null,e):o?MAP.skip:null):void 0}),(function(e){if(e instanceof AST_Sequence)switch(e.expressions.length){case 0:return null;case 1:return e.expressions[0]}})))}function K(e){for(;e instanceof AST_PropAccess;)e=e.expression;return e instanceof AST_SymbolRef&&e.definition().scope===i&&!(n&&(T.has(e.name)||p instanceof AST_Unary||p instanceof AST_Assign&&!p.logical&&"="!=p.operator))}function G(){if(E)return !1;if(d)return !0;if(A instanceof AST_SymbolRef){var e=A.definition();if(e.references.length-e.replaced==(p instanceof AST_VarDef?1:2))return !0}return !1}function H(e){if(!e.definition)return !0;var t=e.definition();return !(1==t.orig.length&&t.orig[0]instanceof AST_SymbolDefun||t.scope.get_defun_scope()===i&&t.references.every((e=>{var t=e.scope.get_defun_scope();return "Scope"==t.TYPE&&(t=t.parent_scope),t===i})))}function X(e,t){if(e instanceof AST_Assign)return X(e.left,!0);if(e instanceof AST_Unary)return X(e.expression,!0);if(e instanceof AST_VarDef)return e.value&&X(e.value);if(t){if(e instanceof AST_Dot)return X(e.expression,!0);if(e instanceof AST_Sub)return X(e.expression,!0);if(e instanceof AST_SymbolRef)return e.definition().scope!==i}return !1}}function u(e){for(var t=[],n=0;n<e.length;){var o=e[n];o instanceof AST_BlockStatement&&o.body.every(can_be_evicted_from_block)?(r=!0,u(o.body),e.splice(n,1,...o.body),n+=o.body.length):o instanceof AST_EmptyStatement?(r=!0,e.splice(n,1)):o instanceof AST_Directive?t.indexOf(o.value)<0?(n++,t.push(o.value)):(r=!0,e.splice(n,1)):n++;}}function l(e,t){for(var n=t.self(),o=function(e){for(var t=0,n=e.length;--n>=0;){var o=e[n];if(o instanceof AST_If&&o.body instanceof AST_Return&&++t>1)return !0}return !1}(e),i=n instanceof AST_Lambda,a=e.length;--a>=0;){var s=e[a],u=T(a),l=e[u];if(i&&!l&&s instanceof AST_Return){if(!s.value){r=!0,e.splice(a,1);continue}if(s.value instanceof AST_UnaryPrefix&&"void"==s.value.operator){r=!0,e[a]=make_node(AST_SimpleStatement,s,{body:s.value.expression});continue}}if(s instanceof AST_If){var _;if(S(_=aborts(s.body))){_.label&&remove$1(_.label.thedef.references,_),r=!0,(s=s.clone()).condition=s.condition.negate(t);var f=A(s.body,_);s.body=make_node(AST_BlockStatement,s,{body:as_statement_array(s.alternative).concat(m())}),s.alternative=make_node(AST_BlockStatement,s,{body:f}),e[a]=s.transform(t);continue}if(S(_=aborts(s.alternative))){_.label&&remove$1(_.label.thedef.references,_),r=!0,(s=s.clone()).body=make_node(AST_BlockStatement,s.body,{body:as_statement_array(s.body).concat(m())}),f=A(s.alternative,_),s.alternative=make_node(AST_BlockStatement,s.alternative,{body:f}),e[a]=s.transform(t);continue}}if(s instanceof AST_If&&s.body instanceof AST_Return){var p=s.body.value;if(!p&&!s.alternative&&(i&&!l||l instanceof AST_Return&&!l.value)){r=!0,e[a]=make_node(AST_SimpleStatement,s.condition,{body:s.condition});continue}if(p&&!s.alternative&&l instanceof AST_Return&&l.value){r=!0,(s=s.clone()).alternative=l,e[a]=s.transform(t),e.splice(u,1);continue}if(p&&!s.alternative&&(!l&&i&&o||l instanceof AST_Return)){r=!0,(s=s.clone()).alternative=l||make_node(AST_Return,s,{value:null}),e[a]=s.transform(t),l&&e.splice(u,1);continue}var d=e[h(a)];if(t.option("sequences")&&i&&!s.alternative&&d instanceof AST_If&&d.body instanceof AST_Return&&T(u)==e.length&&l instanceof AST_SimpleStatement){r=!0,(s=s.clone()).alternative=make_node(AST_BlockStatement,l,{body:[l,make_node(AST_Return,l,{value:null})]}),e[a]=s.transform(t),e.splice(u,1);continue}}}function S(o){if(!o)return !1;for(var r=a+1,s=e.length;r<s;r++){var u=e[r];if(u instanceof AST_Const||u instanceof AST_Let)return !1}var l=o instanceof AST_LoopControl?t.loopcontrol_target(o):null;return o instanceof AST_Return&&i&&function(e){return !e||e instanceof AST_UnaryPrefix&&"void"==e.operator}(o.value)||o instanceof AST_Continue&&n===loop_body(l)||o instanceof AST_Break&&l instanceof AST_BlockStatement&&n===l}function m(){var t=e.slice(a+1);return e.length=a+1,t.filter((function(t){return !(t instanceof AST_Defun&&(e.push(t),1))}))}function A(e,t){var n=as_statement_array(e).slice(0,-1);return t.value&&n.push(make_node(AST_SimpleStatement,t.value,{body:t.value.expression})),n}function T(t){for(var n=t+1,o=e.length;n<o;n++){var i=e[n];if(!(i instanceof AST_Var&&c(i)))break}return n}function h(t){for(var n=t;--n>=0;){var o=e[n];if(!(o instanceof AST_Var&&c(o)))break}return n}}function _(e,t){for(var n,o=t.self(),i=0,a=0,s=e.length;i<s;i++){var u=e[i];if(u instanceof AST_LoopControl){var l=t.loopcontrol_target(u);u instanceof AST_Break&&!(l instanceof AST_IterationStatement)&&loop_body(l)===o||u instanceof AST_Continue&&loop_body(l)===o?u.label&&remove$1(u.label.thedef.references,u):e[a++]=u;}else e[a++]=u;if(aborts(u)){n=e.slice(i+1);break}}e.length=a,r=a!=s,n&&n.forEach((function(n){trim_unreachable_code(t,n,e);}));}function c(e){return e.definitions.every((e=>!e.value))}function f(e,t){if(!(e.length<2)){for(var n=[],o=0,i=0,a=e.length;i<a;i++){var s=e[i];if(s instanceof AST_SimpleStatement){n.length>=t.sequences_limit&&l();var u=s.body;n.length>0&&(u=u.drop_side_effect_free(t)),u&&merge_sequence(n,u);}else s instanceof AST_Definitions&&c(s)||s instanceof AST_Defun||l(),e[o++]=s;}l(),e.length=o,o!=a&&(r=!0);}function l(){if(n.length){var t=make_sequence(n[0],n);e[o++]=make_node(AST_SimpleStatement,t,{body:t}),n=[];}}}function p(e,t){if(!(e instanceof AST_BlockStatement))return e;for(var n=null,o=0,i=e.body.length;o<i;o++){var r=e.body[o];if(r instanceof AST_Var&&c(r))t.push(r);else {if(n)return !1;n=r;}}return n}function d(e,t){function n(e){i--,r=!0;var n=o.body;return make_sequence(n,[n,e]).transform(t)}for(var o,i=0,a=0;a<e.length;a++){var s=e[a];if(o&&(s instanceof AST_Exit?s.value=n(s.value||make_node(AST_Undefined,s).transform(t)):s instanceof AST_For?s.init instanceof AST_Definitions||walk$3(o.body,(e=>e instanceof AST_Scope||(e instanceof AST_Binary&&"in"===e.operator?walk_abort:void 0)))||(s.init?s.init=n(s.init):(s.init=o.body,i--,r=!0)):s instanceof AST_ForIn?s.init instanceof AST_Const||s.init instanceof AST_Let||(s.object=n(s.object)):s instanceof AST_If?s.condition=n(s.condition):(s instanceof AST_Switch||s instanceof AST_With)&&(s.expression=n(s.expression))),t.option("conditionals")&&s instanceof AST_If){var u=[],l=p(s.body,u),_=p(s.alternative,u);if(!1!==l&&!1!==_&&u.length>0){var c=u.length;u.push(make_node(AST_If,s,{condition:s.condition,body:l||make_node(AST_EmptyStatement,s.body),alternative:_})),u.unshift(i,1),[].splice.apply(e,u),a+=c,i+=c+1,o=null,r=!0;continue}}e[i++]=s,o=s instanceof AST_SimpleStatement?s:null;}e.length=i;}function S(e,n){if(e instanceof AST_Definitions){var o,r=e.definitions[e.definitions.length-1];if(r.value instanceof AST_Object&&(n instanceof AST_Assign&&!n.logical?o=[n]:n instanceof AST_Sequence&&(o=n.expressions.slice()),o)){var a=!1;do{var s=o[0];if(!(s instanceof AST_Assign))break;if("="!=s.operator)break;if(!(s.left instanceof AST_PropAccess))break;var u=s.left.expression;if(!(u instanceof AST_SymbolRef))break;if(r.name.name!=u.name)break;if(!s.right.is_constant_expression(i))break;var l=s.left.property;if(l instanceof AST_Node&&(l=l.evaluate(t)),l instanceof AST_Node)break;l=""+l;var _=t.option("ecma")<2015&&t.has_directive("use strict")?function(e){return e.key!=l&&e.key&&e.key.name!=l}:function(e){return e.key&&e.key.name!=l};if(!r.value.properties.every(_))break;var c=r.value.properties.filter((function(e){return e.key===l}))[0];c?c.value=new AST_Sequence({start:c.start,expressions:[c.value.clone(),s.right.clone()],end:c.end}):r.value.properties.push(make_node(AST_ObjectKeyVal,s,{key:l,value:s.right})),o.shift(),a=!0;}while(o.length);return a&&o}}}function m(e){for(var t,n=0,o=-1,i=e.length;n<i;n++){var a=e[n],s=e[o];if(a instanceof AST_Definitions)s&&s.TYPE==a.TYPE?(s.definitions=s.definitions.concat(a.definitions),r=!0):t&&t.TYPE==a.TYPE&&c(a)?(t.definitions=t.definitions.concat(a.definitions),r=!0):(e[++o]=a,t=a);else if(a instanceof AST_Exit)a.value=l(a.value);else if(a instanceof AST_For)(u=S(s,a.init))?(r=!0,a.init=u.length?make_sequence(a.init,u):null,e[++o]=a):s instanceof AST_Var&&(!a.init||a.init.TYPE==s.TYPE)?(a.init&&(s.definitions=s.definitions.concat(a.init.definitions)),a.init=s,e[o]=a,r=!0):t&&a.init&&t.TYPE==a.init.TYPE&&c(a.init)?(t.definitions=t.definitions.concat(a.init.definitions),a.init=null,e[++o]=a,r=!0):e[++o]=a;else if(a instanceof AST_ForIn)a.object=l(a.object);else if(a instanceof AST_If)a.condition=l(a.condition);else if(a instanceof AST_SimpleStatement){var u;if(u=S(s,a.body)){if(r=!0,!u.length)continue;a.body=make_sequence(a.body,u);}e[++o]=a;}else a instanceof AST_Switch||a instanceof AST_With?a.expression=l(a.expression):e[++o]=a;}function l(t){e[++o]=a;var n=S(s,t);return n?(r=!0,n.length?make_sequence(t,n):t instanceof AST_Sequence?t.tail_node().left:t.left):t}e.length=o+1;}}function trim_unreachable_code(e,t,n){walk$3(t,(o=>o instanceof AST_Var?(o.remove_initializers(),n.push(o),!0):o instanceof AST_Defun&&(o===t||!e.has_directive("use strict"))?(n.push(o===t?o:make_node(AST_Var,o,{definitions:[make_node(AST_VarDef,o,{name:make_node(AST_SymbolVar,o.name,o.name),value:null})]})),!0):o instanceof AST_Export||o instanceof AST_Import?(n.push(o),!0):o instanceof AST_Scope||void 0));}function get_value(e){return e instanceof AST_Constant?e.getValue():e instanceof AST_UnaryPrefix&&"void"==e.operator&&e.expression instanceof AST_Constant?void 0:e}function is_undefined(e,t){return has_flag(e,8)||e instanceof AST_Undefined||e instanceof AST_UnaryPrefix&&"void"==e.operator&&!e.expression.has_side_effects(t)}!function(e){function t(e){return /strict/.test(e.option("pure_getters"))}AST_Node.DEFMETHOD("may_throw_on_access",(function(e){return !e.option("pure_getters")||this._dot_throw(e)})),e(AST_Node,t),e(AST_Null,return_true),e(AST_Undefined,return_true),e(AST_Constant,return_false),e(AST_Array,return_false),e(AST_Object,(function(e){if(!t(e))return !1;for(var n=this.properties.length;--n>=0;)if(this.properties[n]._dot_throw(e))return !0;return !1})),e(AST_Class,return_false),e(AST_ObjectProperty,return_false),e(AST_ObjectGetter,return_true),e(AST_Expansion,(function(e){return this.expression._dot_throw(e)})),e(AST_Function,return_false),e(AST_Arrow,return_false),e(AST_UnaryPostfix,return_false),e(AST_UnaryPrefix,(function(){return "void"==this.operator})),e(AST_Binary,(function(e){return ("&&"==this.operator||"||"==this.operator||"??"==this.operator)&&(this.left._dot_throw(e)||this.right._dot_throw(e))})),e(AST_Assign,(function(e){return !!this.logical||"="==this.operator&&this.right._dot_throw(e)})),e(AST_Conditional,(function(e){return this.consequent._dot_throw(e)||this.alternative._dot_throw(e)})),e(AST_Dot,(function(e){return !(!t(e)||"prototype"==this.property&&(this.expression instanceof AST_Function||this.expression instanceof AST_Class))})),e(AST_Chain,(function(e){return this.expression._dot_throw(e)})),e(AST_Sequence,(function(e){return this.tail_node()._dot_throw(e)})),e(AST_SymbolRef,(function(e){if("arguments"===this.name)return !1;if(has_flag(this,8))return !0;if(!t(e))return !1;if(is_undeclared_ref(this)&&this.is_declared(e))return !1;if(this.is_immutable())return !1;var n=this.fixed_value();return !n||n._dot_throw(e)}));}((function(e,t){e.DEFMETHOD("_dot_throw",t);})),function(e){const t=makePredicate("! delete"),n=makePredicate("in instanceof == != === !== < <= >= >");e(AST_Node,return_false),e(AST_UnaryPrefix,(function(){return t.has(this.operator)})),e(AST_Binary,(function(){return n.has(this.operator)||lazy_op.has(this.operator)&&this.left.is_boolean()&&this.right.is_boolean()})),e(AST_Conditional,(function(){return this.consequent.is_boolean()&&this.alternative.is_boolean()})),e(AST_Assign,(function(){return "="==this.operator&&this.right.is_boolean()})),e(AST_Sequence,(function(){return this.tail_node().is_boolean()})),e(AST_True,return_true),e(AST_False,return_true);}((function(e,t){e.DEFMETHOD("is_boolean",t);})),function(e){e(AST_Node,return_false),e(AST_Number,return_true);var t=makePredicate("+ - ~ ++ --");e(AST_Unary,(function(){return t.has(this.operator)}));var n=makePredicate("- * / % & | ^ << >> >>>");e(AST_Binary,(function(e){return n.has(this.operator)||"+"==this.operator&&this.left.is_number(e)&&this.right.is_number(e)})),e(AST_Assign,(function(e){return n.has(this.operator.slice(0,-1))||"="==this.operator&&this.right.is_number(e)})),e(AST_Sequence,(function(e){return this.tail_node().is_number(e)})),e(AST_Conditional,(function(e){return this.consequent.is_number(e)&&this.alternative.is_number(e)}));}((function(e,t){e.DEFMETHOD("is_number",t);})),function(e){e(AST_Node,return_false),e(AST_String,return_true),e(AST_TemplateString,return_true),e(AST_UnaryPrefix,(function(){return "typeof"==this.operator})),e(AST_Binary,(function(e){return "+"==this.operator&&(this.left.is_string(e)||this.right.is_string(e))})),e(AST_Assign,(function(e){return ("="==this.operator||"+="==this.operator)&&this.right.is_string(e)})),e(AST_Sequence,(function(e){return this.tail_node().is_string(e)})),e(AST_Conditional,(function(e){return this.consequent.is_string(e)&&this.alternative.is_string(e)}));}((function(e,t){e.DEFMETHOD("is_string",t);}));var lazy_op=makePredicate("&& || ??"),unary_side_effects=makePredicate("delete ++ --");function is_lhs(e,t){return t instanceof AST_Unary&&unary_side_effects.has(t.operator)?t.expression:t instanceof AST_Assign&&t.left===e?e:void 0}function best_of_expression(e,t){return e.size()>t.size()?t:e}function best_of_statement(e,t){return best_of_expression(make_node(AST_SimpleStatement,e,{body:e}),make_node(AST_SimpleStatement,t,{body:t})).body}function best_of(e,t,n){return (first_in_statement(e)?best_of_statement:best_of_expression)(t,n)}function convert_to_predicate(e){const t=new Map;for(var n of Object.keys(e))t.set(n,makePredicate(e[n]));return t}!function(e){function t(e,n){if(e instanceof AST_Node)return make_node(e.CTOR,n,e);if(Array.isArray(e))return make_node(AST_Array,n,{elements:e.map((function(e){return t(e,n)}))});if(e&&"object"==typeof e){var o=[];for(var i in e)HOP(e,i)&&o.push(make_node(AST_ObjectKeyVal,n,{key:i,value:t(e[i],n)}));return make_node(AST_Object,n,{properties:o})}return make_node_from_constant(e,n)}AST_Toplevel.DEFMETHOD("resolve_defines",(function(e){return e.option("global_defs")?(this.figure_out_scope({ie8:e.option("ie8")}),this.transform(new TreeTransformer((function(t){var n=t._find_defs(e,"");if(n){for(var o,i=0,r=t;(o=this.parent(i++))&&o instanceof AST_PropAccess&&o.expression===r;)r=o;if(!is_lhs(r,o))return n}})))):this})),e(AST_Node,noop),e(AST_Chain,(function(e,t){return this.expression._find_defs(e,t)})),e(AST_Dot,(function(e,t){return this.expression._find_defs(e,"."+this.property+t)})),e(AST_SymbolDeclaration,(function(){this.global();})),e(AST_SymbolRef,(function(e,n){if(this.global()){var o=e.option("global_defs"),i=this.name+n;return HOP(o,i)?t(o[i],this):void 0}}));}((function(e,t){e.DEFMETHOD("_find_defs",t);}));var object_fns=["constructor","toString","valueOf"],native_fns=convert_to_predicate({Array:["indexOf","join","lastIndexOf","slice"].concat(object_fns),Boolean:object_fns,Function:object_fns,Number:["toExponential","toFixed","toPrecision"].concat(object_fns),Object:object_fns,RegExp:["test"].concat(object_fns),String:["charAt","charCodeAt","concat","indexOf","italics","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","trim"].concat(object_fns)}),static_fns=convert_to_predicate({Array:["isArray"],Math:["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","atan2","pow","max","min"],Number:["isFinite","isNaN"],Object:["create","getOwnPropertyDescriptor","getOwnPropertyNames","getPrototypeOf","isExtensible","isFrozen","isSealed","keys"],String:["fromCharCode"]});!function(e){AST_Node.DEFMETHOD("evaluate",(function(e){if(!e.option("evaluate"))return this;var t=this._eval(e,1);return !t||t instanceof RegExp?t:"function"==typeof t||"object"==typeof t?this:t}));var t=makePredicate("! ~ - + void");AST_Node.DEFMETHOD("is_constant",(function(){return this instanceof AST_Constant?!(this instanceof AST_RegExp):this instanceof AST_UnaryPrefix&&this.expression instanceof AST_Constant&&t.has(this.operator)})),e(AST_Statement,(function(){throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]",this.start))})),e(AST_Lambda,return_this),e(AST_Class,return_this),e(AST_Node,return_this),e(AST_Constant,(function(){return this.getValue()})),e(AST_BigInt,return_this),e(AST_RegExp,(function(e){let t=e.evaluated_regexps.get(this);if(void 0===t){try{t=(0,eval)(this.print_to_string());}catch(e){t=null;}e.evaluated_regexps.set(this,t);}return t||this})),e(AST_TemplateString,(function(){return 1!==this.segments.length?this:this.segments[0].value})),e(AST_Function,(function(e){if(e.option("unsafe")){var t=function(){};return t.node=this,t.toString=function(){return this.node.print_to_string()},t}return this})),e(AST_Array,(function(e,t){if(e.option("unsafe")){for(var n=[],o=0,i=this.elements.length;o<i;o++){var r=this.elements[o],a=r._eval(e,t);if(r===a)return this;n.push(a);}return n}return this})),e(AST_Object,(function(e,t){if(e.option("unsafe")){for(var n={},o=0,i=this.properties.length;o<i;o++){var r=this.properties[o];if(r instanceof AST_Expansion)return this;var a=r.key;if(a instanceof AST_Symbol)a=a.name;else if(a instanceof AST_Node&&(a=a._eval(e,t))===r.key)return this;if("function"==typeof Object.prototype[a])return this;if(!(r.value instanceof AST_Function)&&(n[a]=r.value._eval(e,t),n[a]===r.value))return this}return n}return this}));var n=makePredicate("! typeof void");e(AST_UnaryPrefix,(function(e,t){var o=this.expression;if(e.option("typeofs")&&"typeof"==this.operator&&(o instanceof AST_Lambda||o instanceof AST_SymbolRef&&o.fixed_value()instanceof AST_Lambda))return "function";if(n.has(this.operator)||t++,(o=o._eval(e,t))===this.expression)return this;switch(this.operator){case"!":return !o;case"typeof":return o instanceof RegExp?this:typeof o;case"void":return;case"~":return ~o;case"-":return -o;case"+":return +o}return this}));var o=makePredicate("&& || ?? === !==");const i=makePredicate("== != === !=="),r=e=>"object"==typeof e||"function"==typeof e||"symbol"==typeof e;e(AST_Binary,(function(e,t){o.has(this.operator)||t++;var n=this.left._eval(e,t);if(n===this.left)return this;var a,s=this.right._eval(e,t);if(s===this.right)return this;if(null!=n&&null!=s&&i.has(this.operator)&&r(n)&&r(s)&&typeof n==typeof s)return this;switch(this.operator){case"&&":a=n&&s;break;case"||":a=n||s;break;case"??":a=null!=n?n:s;break;case"|":a=n|s;break;case"&":a=n&s;break;case"^":a=n^s;break;case"+":a=n+s;break;case"*":a=n*s;break;case"**":a=Math.pow(n,s);break;case"/":a=n/s;break;case"%":a=n%s;break;case"-":a=n-s;break;case"<<":a=n<<s;break;case">>":a=n>>s;break;case">>>":a=n>>>s;break;case"==":a=n==s;break;case"===":a=n===s;break;case"!=":a=n!=s;break;case"!==":a=n!==s;break;case"<":a=n<s;break;case"<=":a=n<=s;break;case">":a=n>s;break;case">=":a=n>=s;break;default:return this}return isNaN(a)&&e.find_parent(AST_With)?this:a})),e(AST_Conditional,(function(e,t){var n=this.condition._eval(e,t);if(n===this.condition)return this;var o=n?this.consequent:this.alternative,i=o._eval(e,t);return i===o?this:i}));const a=new Set;e(AST_SymbolRef,(function(e,t){if(a.has(this))return this;var n=this.fixed_value();if(!n)return this;a.add(this);const o=n._eval(e,t);if(a.delete(this),o===n)return this;if(o&&"object"==typeof o){var i=this.definition().escaped;if(i&&t>i)return this}return o}));var s={Array,Math,Number,Object,String},u=convert_to_predicate({Math:["E","LN10","LN2","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"],Number:["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"]});e(AST_PropAccess,(function(e,t){if(!this.optional||null!=this.expression._eval(e,t)){if(e.option("unsafe")){var n=this.property;if(n instanceof AST_Node&&(n=n._eval(e,t))===this.property)return this;var o,i=this.expression;if(is_undeclared_ref(i)){var r,a="hasOwnProperty"===i.name&&"call"===n&&(r=e.parent()&&e.parent().args)&&r&&r[0]&&r[0].evaluate(e);if(null==(a=a instanceof AST_Dot?a.expression:a)||a.thedef&&a.thedef.undeclared)return this.clone();var l=u.get(i.name);if(!l||!l.has(n))return this;o=s[i.name];}else {if(!(o=i._eval(e,t+1))||o===i||!HOP(o,n))return this;if("function"==typeof o)switch(n){case"name":return o.node.name?o.node.name.name:"";case"length":return o.node.argnames.length;default:return this}}return o[n]}return this}})),e(AST_Chain,(function(e,t){const n=this.expression._eval(e,t);return n===this.expression?this:n})),e(AST_Call,(function(e,t){var n=this.expression;if(!this.optional||null!=this.expression._eval(e,t)){if(e.option("unsafe")&&n instanceof AST_PropAccess){var o,i=n.property;if(i instanceof AST_Node&&(i=i._eval(e,t))===n.property)return this;var r=n.expression;if(is_undeclared_ref(r)){var a="hasOwnProperty"===r.name&&"call"===i&&this.args[0]&&this.args[0].evaluate(e);if(null==(a=a instanceof AST_Dot?a.expression:a)||a.thedef&&a.thedef.undeclared)return this.clone();var u=static_fns.get(r.name);if(!u||!u.has(i))return this;o=s[r.name];}else {if((o=r._eval(e,t+1))===r||!o)return this;var l=native_fns.get(o.constructor.name);if(!l||!l.has(i))return this}for(var _=[],c=0,f=this.args.length;c<f;c++){var p=this.args[c],d=p._eval(e,t);if(p===d)return this;_.push(d);}try{return o[i].apply(o,_)}catch(e){}}return this}})),e(AST_New,return_this);}((function(e,t){e.DEFMETHOD("_eval",t);})),function(e){function t(e){return make_node(AST_UnaryPrefix,e,{operator:"!",expression:e})}function n(e,n,o){var i=t(e);if(o){var r=make_node(AST_SimpleStatement,n,{body:n});return best_of_expression(i,r)===r?n:i}return best_of_expression(i,n)}e(AST_Node,(function(){return t(this)})),e(AST_Statement,(function(){throw new Error("Cannot negate a statement")})),e(AST_Function,(function(){return t(this)})),e(AST_Arrow,(function(){return t(this)})),e(AST_UnaryPrefix,(function(){return "!"==this.operator?this.expression:t(this)})),e(AST_Sequence,(function(e){var t=this.expressions.slice();return t.push(t.pop().negate(e)),make_sequence(this,t)})),e(AST_Conditional,(function(e,t){var o=this.clone();return o.consequent=o.consequent.negate(e),o.alternative=o.alternative.negate(e),n(this,o,t)})),e(AST_Binary,(function(e,o){var i=this.clone(),r=this.operator;if(e.option("unsafe_comps"))switch(r){case"<=":return i.operator=">",i;case"<":return i.operator=">=",i;case">=":return i.operator="<",i;case">":return i.operator="<=",i}switch(r){case"==":return i.operator="!=",i;case"!=":return i.operator="==",i;case"===":return i.operator="!==",i;case"!==":return i.operator="===",i;case"&&":return i.operator="||",i.left=i.left.negate(e,o),i.right=i.right.negate(e),n(this,i,o);case"||":return i.operator="&&",i.left=i.left.negate(e,o),i.right=i.right.negate(e),n(this,i,o);case"??":return i.right=i.right.negate(e),n(this,i,o)}return t(this)}));}((function(e,t){e.DEFMETHOD("negate",(function(e,n){return t.call(this,e,n)}));}));var global_pure_fns=makePredicate("Boolean decodeURI decodeURIComponent Date encodeURI encodeURIComponent Error escape EvalError isFinite isNaN Number Object parseFloat parseInt RangeError ReferenceError String SyntaxError TypeError unescape URIError");AST_Call.DEFMETHOD("is_expr_pure",(function(e){if(e.option("unsafe")){var t=this.expression,n=this.args&&this.args[0]&&this.args[0].evaluate(e);if(t.expression&&"hasOwnProperty"===t.expression.name&&(null==n||n.thedef&&n.thedef.undeclared))return !1;if(is_undeclared_ref(t)&&global_pure_fns.has(t.name))return !0;let o;if(t instanceof AST_Dot&&is_undeclared_ref(t.expression)&&(o=static_fns.get(t.expression.name))&&o.has(t.property))return !0}return !!has_annotation(this,_PURE)||!e.pure_funcs(this)})),AST_Node.DEFMETHOD("is_call_pure",return_false),AST_Dot.DEFMETHOD("is_call_pure",(function(e){if(!e.option("unsafe"))return;const t=this.expression;let n;return t instanceof AST_Array?n=native_fns.get("Array"):t.is_boolean()?n=native_fns.get("Boolean"):t.is_number(e)?n=native_fns.get("Number"):t instanceof AST_RegExp?n=native_fns.get("RegExp"):t.is_string(e)?n=native_fns.get("String"):this.may_throw_on_access(e)||(n=native_fns.get("Object")),n&&n.has(this.property)}));const pure_prop_access_globals=new Set(["Number","String","Array","Object","Function","Promise"]);function aborts(e){return e&&e.aborts()}!function(e){function t(e,t){for(var n=e.length;--n>=0;)if(e[n].has_side_effects(t))return !0;return !1}e(AST_Node,return_true),e(AST_EmptyStatement,return_false),e(AST_Constant,return_false),e(AST_This,return_false),e(AST_Block,(function(e){return t(this.body,e)})),e(AST_Call,(function(e){return !(this.is_expr_pure(e)||this.expression.is_call_pure(e)&&!this.expression.has_side_effects(e))||t(this.args,e)})),e(AST_Switch,(function(e){return this.expression.has_side_effects(e)||t(this.body,e)})),e(AST_Case,(function(e){return this.expression.has_side_effects(e)||t(this.body,e)})),e(AST_Try,(function(e){return t(this.body,e)||this.bcatch&&this.bcatch.has_side_effects(e)||this.bfinally&&this.bfinally.has_side_effects(e)})),e(AST_If,(function(e){return this.condition.has_side_effects(e)||this.body&&this.body.has_side_effects(e)||this.alternative&&this.alternative.has_side_effects(e)})),e(AST_LabeledStatement,(function(e){return this.body.has_side_effects(e)})),e(AST_SimpleStatement,(function(e){return this.body.has_side_effects(e)})),e(AST_Lambda,return_false),e(AST_Class,(function(e){return !(!this.extends||!this.extends.has_side_effects(e))||t(this.properties,e)})),e(AST_Binary,(function(e){return this.left.has_side_effects(e)||this.right.has_side_effects(e)})),e(AST_Assign,return_true),e(AST_Conditional,(function(e){return this.condition.has_side_effects(e)||this.consequent.has_side_effects(e)||this.alternative.has_side_effects(e)})),e(AST_Unary,(function(e){return unary_side_effects.has(this.operator)||this.expression.has_side_effects(e)})),e(AST_SymbolRef,(function(e){return !this.is_declared(e)&&!pure_prop_access_globals.has(this.name)})),e(AST_SymbolClassProperty,return_false),e(AST_SymbolDeclaration,return_false),e(AST_Object,(function(e){return t(this.properties,e)})),e(AST_ObjectProperty,(function(e){return this.computed_key()&&this.key.has_side_effects(e)||this.value&&this.value.has_side_effects(e)})),e(AST_ClassProperty,(function(e){return this.computed_key()&&this.key.has_side_effects(e)||this.static&&this.value&&this.value.has_side_effects(e)})),e(AST_ConciseMethod,(function(e){return this.computed_key()&&this.key.has_side_effects(e)})),e(AST_ObjectGetter,(function(e){return this.computed_key()&&this.key.has_side_effects(e)})),e(AST_ObjectSetter,(function(e){return this.computed_key()&&this.key.has_side_effects(e)})),e(AST_Array,(function(e){return t(this.elements,e)})),e(AST_Dot,(function(e){return !this.optional&&this.expression.may_throw_on_access(e)||this.expression.has_side_effects(e)})),e(AST_Sub,(function(e){return (!this.optional||!is_nullish(this.expression))&&(!this.optional&&this.expression.may_throw_on_access(e)||this.expression.has_side_effects(e)||this.property.has_side_effects(e))})),e(AST_Chain,(function(e){return this.expression.has_side_effects(e)})),e(AST_Sequence,(function(e){return t(this.expressions,e)})),e(AST_Definitions,(function(e){return t(this.definitions,e)})),e(AST_VarDef,(function(){return this.value})),e(AST_TemplateSegment,return_false),e(AST_TemplateString,(function(e){return t(this.segments,e)}));}((function(e,t){e.DEFMETHOD("has_side_effects",t);})),function(e){function t(e,t){for(var n=e.length;--n>=0;)if(e[n].may_throw(t))return !0;return !1}e(AST_Node,return_true),e(AST_Constant,return_false),e(AST_EmptyStatement,return_false),e(AST_Lambda,return_false),e(AST_SymbolDeclaration,return_false),e(AST_This,return_false),e(AST_Class,(function(e){return !(!this.extends||!this.extends.may_throw(e))||t(this.properties,e)})),e(AST_Array,(function(e){return t(this.elements,e)})),e(AST_Assign,(function(e){return !!this.right.may_throw(e)||!(!e.has_directive("use strict")&&"="==this.operator&&this.left instanceof AST_SymbolRef)&&this.left.may_throw(e)})),e(AST_Binary,(function(e){return this.left.may_throw(e)||this.right.may_throw(e)})),e(AST_Block,(function(e){return t(this.body,e)})),e(AST_Call,(function(e){return (!this.optional||!is_nullish(this.expression))&&(!!t(this.args,e)||!this.is_expr_pure(e)&&(!!this.expression.may_throw(e)||!(this.expression instanceof AST_Lambda)||t(this.expression.body,e)))})),e(AST_Case,(function(e){return this.expression.may_throw(e)||t(this.body,e)})),e(AST_Conditional,(function(e){return this.condition.may_throw(e)||this.consequent.may_throw(e)||this.alternative.may_throw(e)})),e(AST_Definitions,(function(e){return t(this.definitions,e)})),e(AST_If,(function(e){return this.condition.may_throw(e)||this.body&&this.body.may_throw(e)||this.alternative&&this.alternative.may_throw(e)})),e(AST_LabeledStatement,(function(e){return this.body.may_throw(e)})),e(AST_Object,(function(e){return t(this.properties,e)})),e(AST_ObjectProperty,(function(e){return !!this.value&&this.value.may_throw(e)})),e(AST_ClassProperty,(function(e){return this.computed_key()&&this.key.may_throw(e)||this.static&&this.value&&this.value.may_throw(e)})),e(AST_ConciseMethod,(function(e){return this.computed_key()&&this.key.may_throw(e)})),e(AST_ObjectGetter,(function(e){return this.computed_key()&&this.key.may_throw(e)})),e(AST_ObjectSetter,(function(e){return this.computed_key()&&this.key.may_throw(e)})),e(AST_Return,(function(e){return this.value&&this.value.may_throw(e)})),e(AST_Sequence,(function(e){return t(this.expressions,e)})),e(AST_SimpleStatement,(function(e){return this.body.may_throw(e)})),e(AST_Dot,(function(e){return !this.optional&&this.expression.may_throw_on_access(e)||this.expression.may_throw(e)})),e(AST_Sub,(function(e){return (!this.optional||!is_nullish(this.expression))&&(!this.optional&&this.expression.may_throw_on_access(e)||this.expression.may_throw(e)||this.property.may_throw(e))})),e(AST_Chain,(function(e){return this.expression.may_throw(e)})),e(AST_Switch,(function(e){return this.expression.may_throw(e)||t(this.body,e)})),e(AST_SymbolRef,(function(e){return !this.is_declared(e)&&!pure_prop_access_globals.has(this.name)})),e(AST_SymbolClassProperty,return_false),e(AST_Try,(function(e){return this.bcatch?this.bcatch.may_throw(e):t(this.body,e)||this.bfinally&&this.bfinally.may_throw(e)})),e(AST_Unary,(function(e){return !("typeof"==this.operator&&this.expression instanceof AST_SymbolRef)&&this.expression.may_throw(e)})),e(AST_VarDef,(function(e){return !!this.value&&this.value.may_throw(e)}));}((function(e,t){e.DEFMETHOD("may_throw",t);})),function(e){function t(e){let t=!0;return walk$3(this,(n=>{if(n instanceof AST_SymbolRef){if(has_flag(this,16))return t=!1,walk_abort;var o=n.definition();if(member(o,this.enclosed)&&!this.variables.has(o.name)){if(e){var i=e.find_variable(n);if(o.undeclared?!i:i===o)return t="f",!0}return t=!1,walk_abort}return !0}if(n instanceof AST_This&&this instanceof AST_Arrow)return t=!1,walk_abort})),t}e(AST_Node,return_false),e(AST_Constant,return_true),e(AST_Class,(function(e){if(this.extends&&!this.extends.is_constant_expression(e))return !1;for(const t of this.properties){if(t.computed_key()&&!t.key.is_constant_expression(e))return !1;if(t.static&&t.value&&!t.value.is_constant_expression(e))return !1}return t.call(this,e)})),e(AST_Lambda,t),e(AST_Unary,(function(){return this.expression.is_constant_expression()})),e(AST_Binary,(function(){return this.left.is_constant_expression()&&this.right.is_constant_expression()})),e(AST_Array,(function(){return this.elements.every((e=>e.is_constant_expression()))})),e(AST_Object,(function(){return this.properties.every((e=>e.is_constant_expression()))})),e(AST_ObjectProperty,(function(){return !(this.key instanceof AST_Node||!this.value||!this.value.is_constant_expression())}));}((function(e,t){e.DEFMETHOD("is_constant_expression",t);})),function(e){function t(){for(var e=0;e<this.body.length;e++)if(aborts(this.body[e]))return this.body[e];return null}e(AST_Statement,return_null),e(AST_Jump,return_this),e(AST_Import,(function(){return null})),e(AST_BlockStatement,t),e(AST_SwitchBranch,t),e(AST_If,(function(){return this.alternative&&aborts(this.body)&&aborts(this.alternative)&&this}));}((function(e,t){e.DEFMETHOD("aborts",t);}));var directives=new Set(["use asm","use strict"]);function can_be_extracted_from_if_block(e){return !(e instanceof AST_Const||e instanceof AST_Let||e instanceof AST_Class)}function opt_AST_Lambda(e,t){return tighten_body(e.body,t),t.option("side_effects")&&1==e.body.length&&e.body[0]===t.has_directive("use strict")&&(e.body.length=0),e}def_optimize(AST_Directive,(function(e,t){return !t.option("directives")||directives.has(e.value)&&t.has_directive(e.value)===e?e:make_node(AST_EmptyStatement,e)})),def_optimize(AST_Debugger,(function(e,t){return t.option("drop_debugger")?make_node(AST_EmptyStatement,e):e})),def_optimize(AST_LabeledStatement,(function(e,t){return e.body instanceof AST_Break&&t.loopcontrol_target(e.body)===e.body?make_node(AST_EmptyStatement,e):0==e.label.references.length?e.body:e})),def_optimize(AST_Block,(function(e,t){return tighten_body(e.body,t),e})),def_optimize(AST_BlockStatement,(function(e,t){switch(tighten_body(e.body,t),e.body.length){case 1:if(!t.has_directive("use strict")&&t.parent()instanceof AST_If&&can_be_extracted_from_if_block(e.body[0])||can_be_evicted_from_block(e.body[0]))return e.body[0];break;case 0:return make_node(AST_EmptyStatement,e)}return e})),def_optimize(AST_Lambda,opt_AST_Lambda);const r_keep_assign=/keep_assign/;function has_break_or_continue(e,t){var n=!1,o=new TreeWalker((function(t){return !!(n||t instanceof AST_Scope)||(t instanceof AST_LoopControl&&o.loopcontrol_target(t)===e?n=!0:void 0)}));return t instanceof AST_LabeledStatement&&o.push(t),o.push(e),e.body.walk(o),n}function if_break_in_loop(e,t){var n=e.body instanceof AST_BlockStatement?e.body.body[0]:e.body;if(t.option("dead_code")&&i(n)){var o=[];return e.init instanceof AST_Statement?o.push(e.init):e.init&&o.push(make_node(AST_SimpleStatement,e.init,{body:e.init})),e.condition&&o.push(make_node(AST_SimpleStatement,e.condition,{body:e.condition})),trim_unreachable_code(t,e.body,o),make_node(AST_BlockStatement,e,{body:o})}return n instanceof AST_If&&(i(n.body)?(e.condition?e.condition=make_node(AST_Binary,e.condition,{left:e.condition,operator:"&&",right:n.condition.negate(t)}):e.condition=n.condition.negate(t),r(n.alternative)):i(n.alternative)&&(e.condition?e.condition=make_node(AST_Binary,e.condition,{left:e.condition,operator:"&&",right:n.condition}):e.condition=n.condition,r(n.body))),e;function i(e){return e instanceof AST_Break&&t.loopcontrol_target(e)===t.self()}function r(n){n=as_statement_array(n),e.body instanceof AST_BlockStatement?(e.body=e.body.clone(),e.body.body=n.concat(e.body.body.slice(1)),e.body=e.body.transform(t)):e.body=make_node(AST_BlockStatement,e.body,{body:n}).transform(t),e=if_break_in_loop(e,t);}}function retain_top_func(e,t){return t.top_retain&&e instanceof AST_Defun&&has_flag(e,TOP)&&e.name&&t.top_retain(e.name)}AST_Scope.DEFMETHOD("drop_unused",(function(e){if(!e.option("unused"))return;if(e.has_directive("use asm"))return;var t=this;if(t.pinned())return;var n=!(t instanceof AST_Toplevel)||e.toplevel.funcs,o=!(t instanceof AST_Toplevel)||e.toplevel.vars;const i=r_keep_assign.test(e.option("unused"))?return_false:function(e){return e instanceof AST_Assign&&!e.logical&&(has_flag(e,32)||"="==e.operator)?e.left:e instanceof AST_Unary&&has_flag(e,32)?e.expression:void 0};var r=new Map,a=new Map;t instanceof AST_Toplevel&&e.top_retain&&t.variables.forEach((function(t){e.top_retain(t)&&!r.has(t.id)&&r.set(t.id,t);}));var s=new Map,u=new Map,l=this,_=new TreeWalker((function(i,c){if(i instanceof AST_Lambda&&i.uses_arguments&&!_.has_directive("use strict")&&i.argnames.forEach((function(e){if(e instanceof AST_SymbolDeclaration){var t=e.definition();r.has(t.id)||r.set(t.id,t);}})),i!==t){if(i instanceof AST_Defun||i instanceof AST_DefClass){var p=i.name.definition();if((_.parent()instanceof AST_Export||!n&&l===t)&&p.global&&!r.has(p.id)&&r.set(p.id,p),i instanceof AST_DefClass){i.extends&&(i.extends.has_side_effects(e)||i.extends.may_throw(e))&&i.extends.walk(_);for(const t of i.properties)(t.has_side_effects(e)||t.may_throw(e))&&t.walk(_);}return map_add(u,p.id,i),!0}if(i instanceof AST_SymbolFunarg&&l===t&&map_add(s,i.definition().id,i),i instanceof AST_Definitions&&l===t){const t=_.parent()instanceof AST_Export;return i.definitions.forEach((function(n){if(n.name instanceof AST_SymbolVar&&map_add(s,n.name.definition().id,n),!t&&o||walk$3(n.name,(e=>{if(e instanceof AST_SymbolDeclaration){const n=e.definition();!t&&!n.global||r.has(n.id)||r.set(n.id,n);}})),n.value){if(n.name instanceof AST_Destructuring)n.walk(_);else {var i=n.name.definition();map_add(u,i.id,n.value),i.chained||n.name.fixed_value()!==n.value||a.set(i.id,n);}n.value.has_side_effects(e)&&n.value.walk(_);}})),!0}return f(i,c)}}));t.walk(_),_=new TreeWalker(f),r.forEach((function(e){var t=u.get(e.id);t&&t.forEach((function(e){e.walk(_);}));}));var c=new TreeTransformer((function(u,_,f){var p=c.parent();if(o){const e=i(u);if(e instanceof AST_SymbolRef){var d=e.definition(),S=r.has(d.id);if(u instanceof AST_Assign){if(!S||a.has(d.id)&&a.get(d.id)!==u)return maintain_this_binding(p,u,u.right.transform(c))}else if(!S)return f?MAP.skip:make_node(AST_Number,u,{value:0})}}if(l===t){if(u.name&&(u instanceof AST_ClassExpression&&!keep_name(e.option("keep_classnames"),(d=u.name.definition()).name)||u instanceof AST_Function&&!keep_name(e.option("keep_fnames"),(d=u.name.definition()).name))&&(!r.has(d.id)||d.orig.length>1)&&(u.name=null),u instanceof AST_Lambda&&!(u instanceof AST_Accessor))for(var m=!e.option("keep_fargs"),A=u.argnames,T=A.length;--T>=0;){var h=A[T];h instanceof AST_Expansion&&(h=h.expression),h instanceof AST_DefaultAssign&&(h=h.left),h instanceof AST_Destructuring||r.has(h.definition().id)?m=!1:(set_flag(h,1),m&&A.pop());}if((u instanceof AST_Defun||u instanceof AST_DefClass)&&u!==t){const t=u.name.definition();if(!(t.global&&!n||r.has(t.id))){if(t.eliminated++,u instanceof AST_DefClass){const t=u.drop_side_effect_free(e);if(t)return make_node(AST_SimpleStatement,u,{body:t})}return f?MAP.skip:make_node(AST_EmptyStatement,u)}}if(u instanceof AST_Definitions&&!(p instanceof AST_ForIn&&p.init===u)){var E=!(p instanceof AST_Toplevel||u instanceof AST_Var),g=[],D=[],b=[],y=[];switch(u.definitions.forEach((function(t){t.value&&(t.value=t.value.transform(c));var n=t.name instanceof AST_Destructuring,i=n?new SymbolDef(null,{name:"<destructure>"}):t.name.definition();if(E&&i.global)return b.push(t);if(!o&&!E||n&&(t.name.names.length||t.name.is_array||1!=e.option("pure_getters"))||r.has(i.id)){if(t.value&&a.has(i.id)&&a.get(i.id)!==t&&(t.value=t.value.drop_side_effect_free(e)),t.name instanceof AST_SymbolVar){var l=s.get(i.id);if(l.length>1&&(!t.value||i.orig.indexOf(t.name)>i.eliminated)){if(t.value){var _=make_node(AST_SymbolRef,t.name,t.name);i.references.push(_);var f=make_node(AST_Assign,t,{operator:"=",logical:!1,left:_,right:t.value});a.get(i.id)===t&&a.set(i.id,f),y.push(f.transform(c));}return remove$1(l,t),void i.eliminated++}}t.value?(y.length>0&&(b.length>0?(y.push(t.value),t.value=make_sequence(t.value,y)):g.push(make_node(AST_SimpleStatement,u,{body:make_sequence(u,y)})),y=[]),b.push(t)):D.push(t);}else if(i.orig[0]instanceof AST_SymbolCatch)(p=t.value&&t.value.drop_side_effect_free(e))&&y.push(p),t.value=null,D.push(t);else {var p;(p=t.value&&t.value.drop_side_effect_free(e))&&y.push(p),i.eliminated++;}})),(D.length>0||b.length>0)&&(u.definitions=D.concat(b),g.push(u)),y.length>0&&g.push(make_node(AST_SimpleStatement,u,{body:make_sequence(u,y)})),g.length){case 0:return f?MAP.skip:make_node(AST_EmptyStatement,u);case 1:return g[0];default:return f?MAP.splice(g):make_node(AST_BlockStatement,u,{body:g})}}if(u instanceof AST_For)return _(u,this),u.init instanceof AST_BlockStatement&&(v=u.init,u.init=v.body.pop(),v.body.push(u)),u.init instanceof AST_SimpleStatement?u.init=u.init.body:is_empty(u.init)&&(u.init=null),v?f?MAP.splice(v.body):v:u;if(u instanceof AST_LabeledStatement&&u.body instanceof AST_For){if(_(u,this),u.body instanceof AST_BlockStatement){var v=u.body;return u.body=v.body.pop(),v.body.push(u),f?MAP.splice(v.body):v}return u}if(u instanceof AST_BlockStatement)return _(u,this),f&&u.body.every(can_be_evicted_from_block)?MAP.splice(u.body):u;if(u instanceof AST_Scope){const e=l;return l=u,_(u,this),l=e,u}}}));function f(e,n){var o;const s=i(e);if(s instanceof AST_SymbolRef&&!is_ref_of(e.left,AST_SymbolBlockDeclaration)&&t.variables.get(s.name)===(o=s.definition()))return e instanceof AST_Assign&&(e.right.walk(_),o.chained||e.left.fixed_value()!==e.right||a.set(o.id,e)),!0;if(e instanceof AST_SymbolRef){if(o=e.definition(),!r.has(o.id)&&(r.set(o.id,o),o.orig[0]instanceof AST_SymbolCatch)){const e=o.scope.is_block_scope()&&o.scope.get_defun_scope().variables.get(o.name);e&&r.set(e.id,e);}return !0}if(e instanceof AST_Scope){var u=l;return l=e,n(),l=u,!0}}t.transform(c);})),AST_Scope.DEFMETHOD("hoist_declarations",(function(e){var t=this;if(e.has_directive("use asm"))return t;if(!Array.isArray(t.body))return t;var n=e.option("hoist_funs"),o=e.option("hoist_vars");if(n||o){var i=[],r=[],a=new Map,s=0,u=0;walk$3(t,(e=>e instanceof AST_Scope&&e!==t||(e instanceof AST_Var?(++u,!0):void 0))),o=o&&u>1;var l=new TreeTransformer((function(u){if(u!==t){if(u instanceof AST_Directive)return i.push(u),make_node(AST_EmptyStatement,u);if(n&&u instanceof AST_Defun&&!(l.parent()instanceof AST_Export)&&l.parent()===t)return r.push(u),make_node(AST_EmptyStatement,u);if(o&&u instanceof AST_Var&&!u.definitions.some((e=>e.name instanceof AST_Destructuring))){u.definitions.forEach((function(e){a.set(e.name.name,e),++s;}));var _=u.to_assignments(e),c=l.parent();if(c instanceof AST_ForIn&&c.init===u){if(null==_){var f=u.definitions[0].name;return make_node(AST_SymbolRef,f,f)}return _}return c instanceof AST_For&&c.init===u?_:_?make_node(AST_SimpleStatement,u,{body:_}):make_node(AST_EmptyStatement,u)}if(u instanceof AST_Scope)return u}}));if(t=t.transform(l),s>0){var _=[];const e=t instanceof AST_Lambda,n=e?t.args_as_names():null;if(a.forEach(((t,o)=>{e&&n.some((e=>e.name===t.name.name))?a.delete(o):((t=t.clone()).value=null,_.push(t),a.set(o,t));})),_.length>0){for(;0<t.body.length;){if(t.body[0]instanceof AST_SimpleStatement){var c,f,p=t.body[0].body;if(p instanceof AST_Assign&&"="==p.operator&&(c=p.left)instanceof AST_Symbol&&a.has(c.name)){if((d=a.get(c.name)).value)break;d.value=p.right,remove$1(_,d),_.push(d),t.body.splice(0,1);continue}if(p instanceof AST_Sequence&&(f=p.expressions[0])instanceof AST_Assign&&"="==f.operator&&(c=f.left)instanceof AST_Symbol&&a.has(c.name)){var d;if((d=a.get(c.name)).value)break;d.value=f.right,remove$1(_,d),_.push(d),t.body[0].body=make_sequence(p,p.expressions.slice(1));continue}}if(t.body[0]instanceof AST_EmptyStatement)t.body.splice(0,1);else {if(!(t.body[0]instanceof AST_BlockStatement))break;t.body.splice(0,1,...t.body[0].body);}}_=make_node(AST_Var,t,{definitions:_}),r.push(_);}}t.body=i.concat(r,t.body);}return t})),AST_Scope.DEFMETHOD("hoist_properties",(function(e){var t=this;if(!e.option("hoist_props")||e.has_directive("use asm"))return t;var n=t instanceof AST_Toplevel&&e.top_retain||return_false,o=new Map,i=new TreeTransformer((function(r,a){if(r instanceof AST_Definitions&&i.parent()instanceof AST_Export)return r;if(r instanceof AST_VarDef){const s=r.name;let u,l;if(s.scope===t&&1!=(u=s.definition()).escaped&&!u.assignments&&!u.direct_access&&!u.single_use&&!e.exposed(u)&&!n(u)&&(l=s.fixed_value())===r.value&&l instanceof AST_Object&&!l.properties.some((e=>e instanceof AST_Expansion||e.computed_key()))){a(r,this);const e=new Map,n=[];return l.properties.forEach((({key:o,value:a})=>{const u=find_scope(i),l=t.create_symbol(s.CTOR,{source:s,scope:u,conflict_scopes:new Set([u,...s.definition().references.map((e=>e.scope))]),tentative_name:s.name+"_"+o});e.set(String(o),l.definition()),n.push(make_node(AST_VarDef,r,{name:l,value:a}));})),o.set(u.id,e),MAP.splice(n)}}else if(r instanceof AST_PropAccess&&r.expression instanceof AST_SymbolRef){const e=o.get(r.expression.definition().id);if(e){const t=e.get(String(get_value(r.property))),n=make_node(AST_SymbolRef,r,{name:t.name,scope:r.expression.scope,thedef:t});return n.reference({}),n}}}));return t.transform(i)})),function(e){function t(e,t,n){var o=e.length;if(!o)return null;for(var i=[],r=!1,a=0;a<o;a++){var s=e[a].drop_side_effect_free(t,n);r|=s!==e[a],s&&(i.push(s),n=!1);}return r?i.length?i:null:e}e(AST_Node,return_this),e(AST_Constant,return_null),e(AST_This,return_null),e(AST_Call,(function(e,n){if(this.optional&&is_nullish(this.expression))return make_node(AST_Undefined,this);if(!this.is_expr_pure(e)){if(this.expression.is_call_pure(e)){var o=this.args.slice();return o.unshift(this.expression.expression),(o=t(o,e,n))&&make_sequence(this,o)}if(is_func_expr(this.expression)&&(!this.expression.name||!this.expression.name.definition().references.length)){var i=this.clone();return i.expression.process_expression(!1,e),i}return this}var r=t(this.args,e,n);return r&&make_sequence(this,r)})),e(AST_Accessor,return_null),e(AST_Function,return_null),e(AST_Arrow,return_null),e(AST_Class,(function(e){const t=[],n=this.extends&&this.extends.drop_side_effect_free(e);n&&t.push(n);for(const n of this.properties){const o=n.drop_side_effect_free(e);o&&t.push(o);}return t.length?make_sequence(this,t):null})),e(AST_Binary,(function(e,t){var n=this.right.drop_side_effect_free(e);if(!n)return this.left.drop_side_effect_free(e,t);if(lazy_op.has(this.operator)){if(n===this.right)return this;var o=this.clone();return o.right=n,o}var i=this.left.drop_side_effect_free(e,t);return i?make_sequence(this,[i,n]):this.right.drop_side_effect_free(e,t)})),e(AST_Assign,(function(e){if(this.logical)return this;var t=this.left;if(t.has_side_effects(e)||e.has_directive("use strict")&&t instanceof AST_PropAccess&&t.expression.is_constant())return this;for(set_flag(this,32);t instanceof AST_PropAccess;)t=t.expression;return t.is_constant_expression(e.find_parent(AST_Scope))?this.right.drop_side_effect_free(e):this})),e(AST_Conditional,(function(e){var t=this.consequent.drop_side_effect_free(e),n=this.alternative.drop_side_effect_free(e);if(t===this.consequent&&n===this.alternative)return this;if(!t)return n?make_node(AST_Binary,this,{operator:"||",left:this.condition,right:n}):this.condition.drop_side_effect_free(e);if(!n)return make_node(AST_Binary,this,{operator:"&&",left:this.condition,right:t});var o=this.clone();return o.consequent=t,o.alternative=n,o})),e(AST_Unary,(function(e,t){if(unary_side_effects.has(this.operator))return this.expression.has_side_effects(e)?clear_flag(this,32):set_flag(this,32),this;if("typeof"==this.operator&&this.expression instanceof AST_SymbolRef)return null;var n=this.expression.drop_side_effect_free(e,t);return t&&n&&is_iife_call(n)?n===this.expression&&"!"==this.operator?this:n.negate(e,t):n})),e(AST_SymbolRef,(function(e){return this.is_declared(e)||pure_prop_access_globals.has(this.name)?null:this})),e(AST_Object,(function(e,n){var o=t(this.properties,e,n);return o&&make_sequence(this,o)})),e(AST_ObjectProperty,(function(e,t){const n=this instanceof AST_ObjectKeyVal&&this.key instanceof AST_Node&&this.key.drop_side_effect_free(e,t),o=this.value&&this.value.drop_side_effect_free(e,t);return n&&o?make_sequence(this,[n,o]):n||o})),e(AST_ClassProperty,(function(e){const t=this.computed_key()&&this.key.drop_side_effect_free(e),n=this.static&&this.value&&this.value.drop_side_effect_free(e);return t&&n?make_sequence(this,[t,n]):t||n||null})),e(AST_ConciseMethod,(function(){return this.computed_key()?this.key:null})),e(AST_ObjectGetter,(function(){return this.computed_key()?this.key:null})),e(AST_ObjectSetter,(function(){return this.computed_key()?this.key:null})),e(AST_Array,(function(e,n){var o=t(this.elements,e,n);return o&&make_sequence(this,o)})),e(AST_Dot,(function(e,t){return this.optional?is_nullish(this.expression)?make_node(AST_Undefined,this):this:this.expression.may_throw_on_access(e)?this:this.expression.drop_side_effect_free(e,t)})),e(AST_Sub,(function(e,t){if(this.optional)return is_nullish(this.expression)?make_node(AST_Undefined,this):this;if(this.expression.may_throw_on_access(e))return this;var n=this.expression.drop_side_effect_free(e,t);if(!n)return this.property.drop_side_effect_free(e,t);var o=this.property.drop_side_effect_free(e);return o?make_sequence(this,[n,o]):n})),e(AST_Chain,(function(e,t){return this.expression.drop_side_effect_free(e,t)})),e(AST_Sequence,(function(e){var t=this.tail_node(),n=t.drop_side_effect_free(e);if(n===t)return this;var o=this.expressions.slice(0,-1);return n&&o.push(n),o.length?make_sequence(this,o):make_node(AST_Number,this,{value:0})})),e(AST_Expansion,(function(e,t){return this.expression.drop_side_effect_free(e,t)})),e(AST_TemplateSegment,return_null),e(AST_TemplateString,(function(e){var n=t(this.segments,e,first_in_statement);return n&&make_sequence(this,n)}));}((function(e,t){e.DEFMETHOD("drop_side_effect_free",t);})),def_optimize(AST_SimpleStatement,(function(e,t){if(t.option("side_effects")){var n=e.body,o=n.drop_side_effect_free(t,!0);if(!o)return make_node(AST_EmptyStatement,e);if(o!==n)return make_node(AST_SimpleStatement,e,{body:o})}return e})),def_optimize(AST_While,(function(e,t){return t.option("loops")?make_node(AST_For,e,e).optimize(t):e})),def_optimize(AST_Do,(function(e,t){if(!t.option("loops"))return e;var n=e.condition.tail_node().evaluate(t);if(!(n instanceof AST_Node)){if(n)return make_node(AST_For,e,{body:make_node(AST_BlockStatement,e.body,{body:[e.body,make_node(AST_SimpleStatement,e.condition,{body:e.condition})]})}).optimize(t);if(!has_break_or_continue(e,t.parent()))return make_node(AST_BlockStatement,e.body,{body:[e.body,make_node(AST_SimpleStatement,e.condition,{body:e.condition})]}).optimize(t)}return e})),def_optimize(AST_For,(function(e,t){if(!t.option("loops"))return e;if(t.option("side_effects")&&e.init&&(e.init=e.init.drop_side_effect_free(t)),e.condition){var n=e.condition.evaluate(t);if(!(n instanceof AST_Node))if(n)e.condition=null;else if(!t.option("dead_code")){var o=e.condition;e.condition=make_node_from_constant(n,e.condition),e.condition=best_of_expression(e.condition.transform(t),o);}if(t.option("dead_code")&&(n instanceof AST_Node&&(n=e.condition.tail_node().evaluate(t)),!n)){var i=[];return trim_unreachable_code(t,e.body,i),e.init instanceof AST_Statement?i.push(e.init):e.init&&i.push(make_node(AST_SimpleStatement,e.init,{body:e.init})),i.push(make_node(AST_SimpleStatement,e.condition,{body:e.condition})),make_node(AST_BlockStatement,e,{body:i}).optimize(t)}}return if_break_in_loop(e,t)})),def_optimize(AST_If,(function(e,t){if(is_empty(e.alternative)&&(e.alternative=null),!t.option("conditionals"))return e;var n=e.condition.evaluate(t);if(!(t.option("dead_code")||n instanceof AST_Node)){var o=e.condition;e.condition=make_node_from_constant(n,o),e.condition=best_of_expression(e.condition.transform(t),o);}if(t.option("dead_code")){if(n instanceof AST_Node&&(n=e.condition.tail_node().evaluate(t)),!n){var i=[];return trim_unreachable_code(t,e.body,i),i.push(make_node(AST_SimpleStatement,e.condition,{body:e.condition})),e.alternative&&i.push(e.alternative),make_node(AST_BlockStatement,e,{body:i}).optimize(t)}if(!(n instanceof AST_Node))return (i=[]).push(make_node(AST_SimpleStatement,e.condition,{body:e.condition})),i.push(e.body),e.alternative&&trim_unreachable_code(t,e.alternative,i),make_node(AST_BlockStatement,e,{body:i}).optimize(t)}var r=e.condition.negate(t),a=e.condition.size(),s=r.size(),u=s<a;if(e.alternative&&u){u=!1,e.condition=r;var l=e.body;e.body=e.alternative||make_node(AST_EmptyStatement,e),e.alternative=l;}if(is_empty(e.body)&&is_empty(e.alternative))return make_node(AST_SimpleStatement,e.condition,{body:e.condition.clone()}).optimize(t);if(e.body instanceof AST_SimpleStatement&&e.alternative instanceof AST_SimpleStatement)return make_node(AST_SimpleStatement,e,{body:make_node(AST_Conditional,e,{condition:e.condition,consequent:e.body.body,alternative:e.alternative.body})}).optimize(t);if(is_empty(e.alternative)&&e.body instanceof AST_SimpleStatement)return a===s&&!u&&e.condition instanceof AST_Binary&&"||"==e.condition.operator&&(u=!0),u?make_node(AST_SimpleStatement,e,{body:make_node(AST_Binary,e,{operator:"||",left:r,right:e.body.body})}).optimize(t):make_node(AST_SimpleStatement,e,{body:make_node(AST_Binary,e,{operator:"&&",left:e.condition,right:e.body.body})}).optimize(t);if(e.body instanceof AST_EmptyStatement&&e.alternative instanceof AST_SimpleStatement)return make_node(AST_SimpleStatement,e,{body:make_node(AST_Binary,e,{operator:"||",left:e.condition,right:e.alternative.body})}).optimize(t);if(e.body instanceof AST_Exit&&e.alternative instanceof AST_Exit&&e.body.TYPE==e.alternative.TYPE)return make_node(e.body.CTOR,e,{value:make_node(AST_Conditional,e,{condition:e.condition,consequent:e.body.value||make_node(AST_Undefined,e.body),alternative:e.alternative.value||make_node(AST_Undefined,e.alternative)}).transform(t)}).optimize(t);if(e.body instanceof AST_If&&!e.body.alternative&&!e.alternative&&(e=make_node(AST_If,e,{condition:make_node(AST_Binary,e.condition,{operator:"&&",left:e.condition,right:e.body.condition}),body:e.body.body,alternative:null})),aborts(e.body)&&e.alternative){var _=e.alternative;return e.alternative=null,make_node(AST_BlockStatement,e,{body:[e,_]}).optimize(t)}return aborts(e.alternative)?(i=e.body,e.body=e.alternative,e.condition=u?r:e.condition.negate(t),e.alternative=null,make_node(AST_BlockStatement,e,{body:[e,i]}).optimize(t)):e})),def_optimize(AST_Switch,(function(e,t){if(!t.option("switches"))return e;var n,o=e.expression.evaluate(t);if(!(o instanceof AST_Node)){var i=e.expression;e.expression=make_node_from_constant(o,i),e.expression=best_of_expression(e.expression.transform(t),i);}if(!t.option("dead_code"))return e;o instanceof AST_Node&&(o=e.expression.tail_node().evaluate(t));for(var r,a,s=[],u=[],l=0,_=e.body.length;l<_&&!a;l++){if((n=e.body[l])instanceof AST_Default)r?T(n,u[u.length-1]):r=n;else if(!(o instanceof AST_Node)){if(!((m=n.expression.evaluate(t))instanceof AST_Node)&&m!==o){T(n,u[u.length-1]);continue}if(m instanceof AST_Node&&(m=n.expression.tail_node().evaluate(t)),m===o&&(a=n,r)){var c=u.indexOf(r);u.splice(c,1),T(r,u[c-1]),r=null;}}if(aborts(n)){var f=u[u.length-1];aborts(f)&&f.body.length==n.body.length&&make_node(AST_BlockStatement,f,f).equivalent_to(make_node(AST_BlockStatement,n,n))&&(f.body=[]);}u.push(n);}for(;l<_;)T(e.body[l++],u[u.length-1]);for(u.length>0&&(u[0].body=s.concat(u[0].body)),e.body=u;n=u[u.length-1];){var p=n.body[n.body.length-1];if(p instanceof AST_Break&&t.loopcontrol_target(p)===e&&n.body.pop(),n.body.length||n instanceof AST_Case&&(r||n.expression.has_side_effects(t)))break;u.pop()===r&&(r=null);}if(0==u.length)return make_node(AST_BlockStatement,e,{body:s.concat(make_node(AST_SimpleStatement,e.expression,{body:e.expression}))}).optimize(t);if(1==u.length&&(u[0]===a||u[0]===r)){var d=!1,S=new TreeWalker((function(t){if(d||t instanceof AST_Lambda||t instanceof AST_SimpleStatement)return !0;t instanceof AST_Break&&S.loopcontrol_target(t)===e&&(d=!0);}));if(e.walk(S),!d){var m,A=u[0].body.slice();return (m=u[0].expression)&&A.unshift(make_node(AST_SimpleStatement,m,{body:m})),A.unshift(make_node(AST_SimpleStatement,e.expression,{body:e.expression})),make_node(AST_BlockStatement,e,{body:A}).optimize(t)}}return e;function T(e,n){n&&!aborts(n)?n.body=n.body.concat(e.body):trim_unreachable_code(t,e,s);}})),def_optimize(AST_Try,(function(e,t){if(tighten_body(e.body,t),e.bcatch&&e.bfinally&&e.bfinally.body.every(is_empty)&&(e.bfinally=null),t.option("dead_code")&&e.body.every(is_empty)){var n=[];return e.bcatch&&trim_unreachable_code(t,e.bcatch,n),e.bfinally&&n.push(...e.bfinally.body),make_node(AST_BlockStatement,e,{body:n}).optimize(t)}return e})),AST_Definitions.DEFMETHOD("remove_initializers",(function(){var e=[];this.definitions.forEach((function(t){t.name instanceof AST_SymbolDeclaration?(t.value=null,e.push(t)):walk$3(t.name,(n=>{n instanceof AST_SymbolDeclaration&&e.push(make_node(AST_VarDef,t,{name:n,value:null}));}));})),this.definitions=e;})),AST_Definitions.DEFMETHOD("to_assignments",(function(e){var t=e.option("reduce_vars"),n=[];for(const e of this.definitions){if(e.value){var o=make_node(AST_SymbolRef,e.name,e.name);n.push(make_node(AST_Assign,e,{operator:"=",logical:!1,left:o,right:e.value})),t&&(o.definition().fixed=!1);}else if(e.value){var i=make_node(AST_VarDef,e,{name:e.name,value:e.value}),r=make_node(AST_Var,e,{definitions:[i]});n.push(r);}const a=e.name.definition();a.eliminated++,a.replaced--;}return 0==n.length?null:make_sequence(this,n)})),def_optimize(AST_Definitions,(function(e){return 0==e.definitions.length?make_node(AST_EmptyStatement,e):e})),def_optimize(AST_VarDef,(function(e){return e.name instanceof AST_SymbolLet&&null!=e.value&&is_undefined(e.value)&&(e.value=null),e})),def_optimize(AST_Import,(function(e){return e})),def_optimize(AST_Call,(function(e,t){var n=e.expression,o=n;inline_array_like_spread(e.args);var i=e.args.every((e=>!(e instanceof AST_Expansion)));if(t.option("reduce_vars")&&o instanceof AST_SymbolRef&&!has_annotation(e,_NOINLINE)){const e=o.fixed_value();retain_top_func(e,t)||(o=e);}if(e.optional&&is_nullish(o))return make_node(AST_Undefined,e);var r=o instanceof AST_Lambda;if(r&&o.pinned())return e;if(t.option("unused")&&i&&r&&!o.uses_arguments){for(var a=0,s=0,u=0,l=e.args.length;u<l;u++){if(o.argnames[u]instanceof AST_Expansion){if(has_flag(o.argnames[u].expression,1))for(;u<l;)(d=e.args[u++].drop_side_effect_free(t))&&(e.args[a++]=d);else for(;u<l;)e.args[a++]=e.args[u++];s=a;break}var _=u>=o.argnames.length;if(_||has_flag(o.argnames[u],1)){if(d=e.args[u].drop_side_effect_free(t))e.args[a++]=d;else if(!_){e.args[a++]=make_node(AST_Number,e.args[u],{value:0});continue}}else e.args[a++]=e.args[u];s=a;}e.args.length=s;}if(t.option("unsafe"))if(is_undeclared_ref(n))switch(n.name){case"Array":if(1!=e.args.length)return make_node(AST_Array,e,{elements:e.args}).optimize(t);if(e.args[0]instanceof AST_Number&&e.args[0].value<=11){const t=[];for(let n=0;n<e.args[0].value;n++)t.push(new AST_Hole);return new AST_Array({elements:t})}break;case"Object":if(0==e.args.length)return make_node(AST_Object,e,{properties:[]});break;case"String":if(0==e.args.length)return make_node(AST_String,e,{value:""});if(e.args.length<=1)return make_node(AST_Binary,e,{left:e.args[0],operator:"+",right:make_node(AST_String,e,{value:""})}).optimize(t);break;case"Number":if(0==e.args.length)return make_node(AST_Number,e,{value:0});if(1==e.args.length&&t.option("unsafe_math"))return make_node(AST_UnaryPrefix,e,{expression:e.args[0],operator:"+"}).optimize(t);break;case"Symbol":1==e.args.length&&e.args[0]instanceof AST_String&&t.option("unsafe_symbols")&&(e.args.length=0);break;case"Boolean":if(0==e.args.length)return make_node(AST_False,e);if(1==e.args.length)return make_node(AST_UnaryPrefix,e,{expression:make_node(AST_UnaryPrefix,e,{expression:e.args[0],operator:"!"}),operator:"!"}).optimize(t);break;case"RegExp":var c=[];if(e.args.length>=1&&e.args.length<=2&&e.args.every((e=>{var n=e.evaluate(t);return c.push(n),e!==n}))){let[n,o]=c;n=regexp_source_fix(new RegExp(n).source);const i=make_node(AST_RegExp,e,{value:{source:n,flags:o}});if(i._eval(t)!==i)return i}}else if(n instanceof AST_Dot)switch(n.property){case"toString":if(0==e.args.length&&!n.expression.may_throw_on_access(t))return make_node(AST_Binary,e,{left:make_node(AST_String,e,{value:""}),operator:"+",right:n.expression}).optimize(t);break;case"join":if(n.expression instanceof AST_Array)e:{var f;if(!(e.args.length>0&&(f=e.args[0].evaluate(t))===e.args[0])){var p,d,S=[],m=[];for(u=0,l=n.expression.elements.length;u<l;u++){var A=n.expression.elements[u];if(A instanceof AST_Expansion)break e;var T=A.evaluate(t);T!==A?m.push(T):(m.length>0&&(S.push(make_node(AST_String,e,{value:m.join(f)})),m.length=0),S.push(A));}return m.length>0&&S.push(make_node(AST_String,e,{value:m.join(f)})),0==S.length?make_node(AST_String,e,{value:""}):1==S.length?S[0].is_string(t)?S[0]:make_node(AST_Binary,S[0],{operator:"+",left:make_node(AST_String,e,{value:""}),right:S[0]}):""==f?(p=S[0].is_string(t)||S[1].is_string(t)?S.shift():make_node(AST_String,e,{value:""}),S.reduce((function(e,t){return make_node(AST_Binary,t,{operator:"+",left:e,right:t})}),p).optimize(t)):((d=e.clone()).expression=d.expression.clone(),d.expression.expression=d.expression.expression.clone(),d.expression.expression.elements=S,best_of(t,e,d))}}break;case"charAt":if(n.expression.is_string(t)){var h=e.args[0],E=h?h.evaluate(t):0;if(E!==h)return make_node(AST_Sub,n,{expression:n.expression,property:make_node_from_constant(0|E,h||n)}).optimize(t)}break;case"apply":if(2==e.args.length&&e.args[1]instanceof AST_Array)return (I=e.args[1].elements.slice()).unshift(e.args[0]),make_node(AST_Call,e,{expression:make_node(AST_Dot,n,{expression:n.expression,optional:!1,property:"call"}),args:I}).optimize(t);break;case"call":var g=n.expression;if(g instanceof AST_SymbolRef&&(g=g.fixed_value()),g instanceof AST_Lambda&&!g.contains_this())return (e.args.length?make_sequence(this,[e.args[0],make_node(AST_Call,e,{expression:n.expression,args:e.args.slice(1)})]):make_node(AST_Call,e,{expression:n.expression,args:[]})).optimize(t)}if(t.option("unsafe_Function")&&is_undeclared_ref(n)&&"Function"==n.name){if(0==e.args.length)return make_node(AST_Function,e,{argnames:[],body:[]}).optimize(t);if(e.args.every((e=>e instanceof AST_String)))try{var D=parse$5(C="n(function("+e.args.slice(0,-1).map((function(e){return e.value})).join(",")+"){"+e.args[e.args.length-1].value+"})"),b={ie8:t.option("ie8")};D.figure_out_scope(b);var y,v=new Compressor(t.options,{mangle_options:t.mangle_options});(D=D.transform(v)).figure_out_scope(b),base54.reset(),D.compute_char_frequency(b),D.mangle_names(b),walk$3(D,(e=>{if(is_func_expr(e))return y=e,walk_abort}));var C=OutputStream();return AST_BlockStatement.prototype._codegen.call(y,y,C),e.args=[make_node(AST_String,e,{value:y.argnames.map((function(e){return e.print_to_string()})).join(",")}),make_node(AST_String,e.args[e.args.length-1],{value:C.get().replace(/^{|}$/g,"")})],e}catch(e){if(!(e instanceof JS_Parse_Error))throw e}}var R=r&&o.body[0],k=r&&!o.is_generator&&!o.async,O=k&&t.option("inline")&&!e.is_expr_pure(t);if(O&&R instanceof AST_Return){let n=R.value;if(!n||n.is_constant_expression()){n=n?n.clone(!0):make_node(AST_Undefined,e);const o=e.args.concat(n);return make_sequence(e,o).optimize(t)}if(1===o.argnames.length&&o.argnames[0]instanceof AST_SymbolFunarg&&e.args.length<2&&n instanceof AST_SymbolRef&&n.name===o.argnames[0].name){const n=(e.args[0]||make_node(AST_Undefined)).optimize(t);let o;return n instanceof AST_PropAccess&&(o=t.parent())instanceof AST_Call&&o.expression===e?make_sequence(e,[make_node(AST_Number,e,{value:0}),n]):n}}if(O){var F,N,M=-1;let r,a,s;if(i&&!o.uses_arguments&&!(t.parent()instanceof AST_Class)&&!(o.name&&o instanceof AST_Function)&&(a=function(e){var n=o.body,i=n.length;if(t.option("inline")<3)return 1==i&&w(e);e=null;for(var r=0;r<i;r++){var a=n[r];if(a instanceof AST_Var){if(e&&!a.definitions.every((e=>!e.value)))return !1}else {if(e)return !1;a instanceof AST_EmptyStatement||(e=a);}}return w(e)}(R))&&(n===o||has_annotation(e,_INLINE)||t.option("unused")&&1==(r=n.definition()).references.length&&!recursive_ref(t,r)&&o.is_constant_expression(n.scope))&&!has_annotation(e,_PURE|_NOINLINE)&&!o.contains_this()&&function(){var e=new Set;do{if((F=t.parent(++M)).is_block_scope()&&F.block_scope&&F.block_scope.variables.forEach((function(t){e.add(t.name);})),F instanceof AST_Catch)F.argname&&e.add(F.argname.name);else if(F instanceof AST_IterationStatement)N=[];else if(F instanceof AST_SymbolRef&&F.fixed_value()instanceof AST_Scope)return !1}while(!(F instanceof AST_Scope));var n=!(F instanceof AST_Toplevel)||t.toplevel.vars,i=t.option("inline");return !(!function(e,t){for(var n=o.body.length,i=0;i<n;i++){var r=o.body[i];if(r instanceof AST_Var){if(!t)return !1;for(var a=r.definitions.length;--a>=0;){var s=r.definitions[a].name;if(s instanceof AST_Destructuring||e.has(s.name)||identifier_atom.has(s.name)||F.conflicting_def(s.name))return !1;N&&N.push(s.definition());}}}return !0}(e,i>=3&&n)||!function(e,t){for(var n=0,i=o.argnames.length;n<i;n++){var r=o.argnames[n];if(r instanceof AST_DefaultAssign){if(has_flag(r.left,1))continue;return !1}if(r instanceof AST_Destructuring)return !1;if(r instanceof AST_Expansion){if(has_flag(r.expression,1))continue;return !1}if(!has_flag(r,1)){if(!t||e.has(r.name)||identifier_atom.has(r.name)||F.conflicting_def(r.name))return !1;N&&N.push(r.definition());}}return !0}(e,i>=2&&n)||N&&0!=N.length&&is_reachable(o,N))}()&&(s=find_scope(t))&&!scope_encloses_variables_in_this_scope(s,o)&&!function(){let e,n=0;for(;e=t.parent(n++);){if(e instanceof AST_DefaultAssign)return !0;if(e instanceof AST_Block)break}return !1}()&&!(F instanceof AST_Class))return set_flag(o,256),s.add_child_scope(o),make_sequence(e,function(n){var i=[],r=[];if(function(t,n){for(var i=o.argnames.length,r=e.args.length;--r>=i;)n.push(e.args[r]);for(r=i;--r>=0;){var a=o.argnames[r],s=e.args[r];if(has_flag(a,1)||!a.name||F.conflicting_def(a.name))s&&n.push(s);else {var u=make_node(AST_SymbolVar,a,a);a.definition().orig.push(u),!s&&N&&(s=make_node(AST_Undefined,e)),P(t,n,u,s);}}t.reverse(),n.reverse();}(i,r),function(e,t){for(var n=t.length,i=0,r=o.body.length;i<r;i++){var a=o.body[i];if(a instanceof AST_Var)for(var s=0,u=a.definitions.length;s<u;s++){var l=a.definitions[s],_=l.name;if(P(e,t,_,l.value),N&&o.argnames.every((e=>e.name!=_.name))){var c=o.variables.get(_.name),f=make_node(AST_SymbolRef,_,_);c.references.push(f),t.splice(n++,0,make_node(AST_Assign,l,{operator:"=",logical:!1,left:f,right:make_node(AST_Undefined,_)}));}}}}(i,r),r.push(n),i.length){const e=F.body.indexOf(t.parent(M-1))+1;F.body.splice(e,0,make_node(AST_Var,o,{definitions:i}));}return r.map((e=>e.clone(!0)))}(a)).optimize(t)}if(O&&has_annotation(e,_INLINE))return set_flag(o,256),(o=make_node(o.CTOR===AST_Defun?AST_Function:o.CTOR,o,o)).figure_out_scope({},{parent_scope:find_scope(t),toplevel:t.get_toplevel()}),make_node(AST_Call,e,{expression:o,args:e.args}).optimize(t);if(k&&t.option("side_effects")&&o.body.every(is_empty)){var I=e.args.concat(make_node(AST_Undefined,e));return make_sequence(e,I).optimize(t)}if(t.option("negate_iife")&&t.parent()instanceof AST_SimpleStatement&&is_iife_call(e))return e.negate(t,!0);var x=e.evaluate(t);return x!==e?(x=make_node_from_constant(x,e).optimize(t),best_of(t,x,e)):e;function w(t){return t?t instanceof AST_Return?t.value?t.value.clone(!0):make_node(AST_Undefined,e):t instanceof AST_SimpleStatement?make_node(AST_UnaryPrefix,t,{operator:"void",expression:t.body.clone(!0)}):void 0:make_node(AST_Undefined,e)}function P(t,n,o,i){var r=o.definition();F.variables.has(o.name)||(F.variables.set(o.name,r),F.enclosed.push(r),t.push(make_node(AST_VarDef,o,{name:o,value:null})));var a=make_node(AST_SymbolRef,o,o);r.references.push(a),i&&n.push(make_node(AST_Assign,e,{operator:"=",logical:!1,left:a,right:i.clone()}));}})),def_optimize(AST_New,(function(e,t){return t.option("unsafe")&&is_undeclared_ref(e.expression)&&["Object","RegExp","Function","Error","Array"].includes(e.expression.name)?make_node(AST_Call,e,e).transform(t):e})),def_optimize(AST_Sequence,(function(e,t){if(!t.option("side_effects"))return e;var n,o,i=[];n=first_in_statement(t),o=e.expressions.length-1,e.expressions.forEach((function(e,r){r<o&&(e=e.drop_side_effect_free(t,n)),e&&(merge_sequence(i,e),n=!1);}));var r=i.length-1;return function(){for(;r>0&&is_undefined(i[r],t);)r--;r<i.length-1&&(i[r]=make_node(AST_UnaryPrefix,e,{operator:"void",expression:i[r]}),i.length=r+1);}(),0==r?((e=maintain_this_binding(t.parent(),t.self(),i[0]))instanceof AST_Sequence||(e=e.optimize(t)),e):(e.expressions=i,e)})),AST_Unary.DEFMETHOD("lift_sequences",(function(e){if(e.option("sequences")&&this.expression instanceof AST_Sequence){var t=this.expression.expressions.slice(),n=this.clone();return n.expression=t.pop(),t.push(n),make_sequence(this,t).optimize(e)}return this})),def_optimize(AST_UnaryPostfix,(function(e,t){return e.lift_sequences(t)})),def_optimize(AST_UnaryPrefix,(function(e,t){var n=e.expression;if("delete"==e.operator&&!(n instanceof AST_SymbolRef||n instanceof AST_PropAccess||is_identifier_atom(n))){if(n instanceof AST_Sequence){const o=n.expressions.slice();return o.push(make_node(AST_True,e)),make_sequence(e,o).optimize(t)}return make_sequence(e,[n,make_node(AST_True,e)]).optimize(t)}var o=e.lift_sequences(t);if(o!==e)return o;if(t.option("side_effects")&&"void"==e.operator)return (n=n.drop_side_effect_free(t))?(e.expression=n,e):make_node(AST_Undefined,e).optimize(t);if(t.in_boolean_context())switch(e.operator){case"!":if(n instanceof AST_UnaryPrefix&&"!"==n.operator)return n.expression;n instanceof AST_Binary&&(e=best_of(t,e,n.negate(t,first_in_statement(t))));break;case"typeof":return (n instanceof AST_SymbolRef?make_node(AST_True,e):make_sequence(e,[n,make_node(AST_True,e)])).optimize(t)}if("-"==e.operator&&n instanceof AST_Infinity&&(n=n.transform(t)),n instanceof AST_Binary&&("+"==e.operator||"-"==e.operator)&&("*"==n.operator||"/"==n.operator||"%"==n.operator))return make_node(AST_Binary,e,{operator:n.operator,left:make_node(AST_UnaryPrefix,n.left,{operator:e.operator,expression:n.left}),right:n.right});if("-"!=e.operator||!(n instanceof AST_Number||n instanceof AST_Infinity||n instanceof AST_BigInt)){var i=e.evaluate(t);if(i!==e)return best_of(t,i=make_node_from_constant(i,e).optimize(t),e)}return e})),AST_Binary.DEFMETHOD("lift_sequences",(function(e){if(e.option("sequences")){if(this.left instanceof AST_Sequence){var t=this.left.expressions.slice();return (n=this.clone()).left=t.pop(),t.push(n),make_sequence(this,t).optimize(e)}if(this.right instanceof AST_Sequence&&!this.left.has_side_effects(e)){for(var n,o="="==this.operator&&this.left instanceof AST_SymbolRef,i=(t=this.right.expressions).length-1,r=0;r<i&&(o||!t[r].has_side_effects(e));r++);if(r==i)return t=t.slice(),(n=this.clone()).right=t.pop(),t.push(n),make_sequence(this,t).optimize(e);if(r>0)return (n=this.clone()).right=make_sequence(this.right,t.slice(r)),(t=t.slice(0,r)).push(n),make_sequence(this,t).optimize(e)}}return this}));var commutativeOperators=makePredicate("== === != !== * & | ^");function is_object(e){return e instanceof AST_Array||e instanceof AST_Lambda||e instanceof AST_Object||e instanceof AST_Class}function recursive_ref(e,t){for(var n,o=0;n=e.parent(o);o++)if(n instanceof AST_Lambda||n instanceof AST_Class){var i=n.name;if(i&&i.definition()===t)break}return n}function within_array_or_object_literal(e){for(var t,n=0;t=e.parent(n++);){if(t instanceof AST_Statement)return !1;if(t instanceof AST_Array||t instanceof AST_ObjectKeyVal||t instanceof AST_Object)return !0}return !1}function scope_encloses_variables_in_this_scope(e,t){for(const n of t.enclosed){if(t.variables.has(n.name))continue;const o=e.find_variable(n.name);if(o){if(o===n)continue;return !0}}return !1}function is_atomic(e,t){return e instanceof AST_SymbolRef||e.TYPE===t.TYPE}function is_reachable(e,t){const n=e=>{if(e instanceof AST_SymbolRef&&member(e.definition(),t))return walk_abort};return walk_parent(e,((t,o)=>{if(t instanceof AST_Scope&&t!==e){var i=o.parent();if(i instanceof AST_Call&&i.expression===t)return;return !walk$3(t,n)||walk_abort}}))}def_optimize(AST_Binary,(function(e,t){function n(){return e.left.is_constant()||e.right.is_constant()||!e.left.has_side_effects(t)&&!e.right.has_side_effects(t)}function o(t){if(n()){t&&(e.operator=t);var o=e.left;e.left=e.right,e.right=o;}}if(commutativeOperators.has(e.operator)&&e.right.is_constant()&&!e.left.is_constant()&&(e.left instanceof AST_Binary&&PRECEDENCE[e.left.operator]>=PRECEDENCE[e.operator]||o()),e=e.lift_sequences(t),t.option("comparisons"))switch(e.operator){case"===":case"!==":var i=!0;(e.left.is_string(t)&&e.right.is_string(t)||e.left.is_number(t)&&e.right.is_number(t)||e.left.is_boolean()&&e.right.is_boolean()||e.left.equivalent_to(e.right))&&(e.operator=e.operator.substr(0,2));case"==":case"!=":if(!i&&is_undefined(e.left,t))e.left=make_node(AST_Null,e.left);else if(t.option("typeofs")&&e.left instanceof AST_String&&"undefined"==e.left.value&&e.right instanceof AST_UnaryPrefix&&"typeof"==e.right.operator){var r=e.right.expression;(r instanceof AST_SymbolRef?!r.is_declared(t):r instanceof AST_PropAccess&&t.option("ie8"))||(e.right=r,e.left=make_node(AST_Undefined,e.left).optimize(t),2==e.operator.length&&(e.operator+="="));}else if(e.left instanceof AST_SymbolRef&&e.right instanceof AST_SymbolRef&&e.left.definition()===e.right.definition()&&is_object(e.left.fixed_value()))return make_node("="==e.operator[0]?AST_True:AST_False,e);break;case"&&":case"||":var a=e.left;if(a.operator==e.operator&&(a=a.right),a instanceof AST_Binary&&a.operator==("&&"==e.operator?"!==":"===")&&e.right instanceof AST_Binary&&a.operator==e.right.operator&&(is_undefined(a.left,t)&&e.right.left instanceof AST_Null||a.left instanceof AST_Null&&is_undefined(e.right.left,t))&&!a.right.has_side_effects(t)&&a.right.equivalent_to(e.right.right)){var s=make_node(AST_Binary,e,{operator:a.operator.slice(0,-1),left:make_node(AST_Null,e),right:a.right});return a!==e.left&&(s=make_node(AST_Binary,e,{operator:e.operator,left:e.left.left,right:s})),s}}if("+"==e.operator&&t.in_boolean_context()){var u=e.left.evaluate(t),l=e.right.evaluate(t);if(u&&"string"==typeof u)return make_sequence(e,[e.right,make_node(AST_True,e)]).optimize(t);if(l&&"string"==typeof l)return make_sequence(e,[e.left,make_node(AST_True,e)]).optimize(t)}if(t.option("comparisons")&&e.is_boolean()){if(!(t.parent()instanceof AST_Binary)||t.parent()instanceof AST_Assign){var _=make_node(AST_UnaryPrefix,e,{operator:"!",expression:e.negate(t,first_in_statement(t))});e=best_of(t,e,_);}if(t.option("unsafe_comps"))switch(e.operator){case"<":o(">");break;case"<=":o(">=");}}if("+"==e.operator){if(e.right instanceof AST_String&&""==e.right.getValue()&&e.left.is_string(t))return e.left;if(e.left instanceof AST_String&&""==e.left.getValue()&&e.right.is_string(t))return e.right;if(e.left instanceof AST_Binary&&"+"==e.left.operator&&e.left.left instanceof AST_String&&""==e.left.left.getValue()&&e.right.is_string(t))return e.left=e.left.right,e}if(t.option("evaluate")){switch(e.operator){case"&&":if(!(u=!!has_flag(e.left,2)||!has_flag(e.left,4)&&e.left.evaluate(t)))return maintain_this_binding(t.parent(),t.self(),e.left).optimize(t);if(!(u instanceof AST_Node))return make_sequence(e,[e.left,e.right]).optimize(t);if(l=e.right.evaluate(t)){if(!(l instanceof AST_Node)&&("&&"==(c=t.parent()).operator&&c.left===t.self()||t.in_boolean_context()))return e.left.optimize(t)}else {if(t.in_boolean_context())return make_sequence(e,[e.left,make_node(AST_False,e)]).optimize(t);set_flag(e,4);}if("||"==e.left.operator&&!(f=e.left.right.evaluate(t)))return make_node(AST_Conditional,e,{condition:e.left.left,consequent:e.right,alternative:e.left.right}).optimize(t);break;case"||":var c,f;if(!(u=!!has_flag(e.left,2)||!has_flag(e.left,4)&&e.left.evaluate(t)))return make_sequence(e,[e.left,e.right]).optimize(t);if(!(u instanceof AST_Node))return maintain_this_binding(t.parent(),t.self(),e.left).optimize(t);if(l=e.right.evaluate(t)){if(!(l instanceof AST_Node)){if(t.in_boolean_context())return make_sequence(e,[e.left,make_node(AST_True,e)]).optimize(t);set_flag(e,2);}}else if("||"==(c=t.parent()).operator&&c.left===t.self()||t.in_boolean_context())return e.left.optimize(t);if("&&"==e.left.operator&&(f=e.left.right.evaluate(t))&&!(f instanceof AST_Node))return make_node(AST_Conditional,e,{condition:e.left.left,consequent:e.left.right,alternative:e.right}).optimize(t);break;case"??":if(is_nullish(e.left))return e.right;if(!((u=e.left.evaluate(t))instanceof AST_Node))return null==u?e.right:e.left;if(t.in_boolean_context()){const n=e.right.evaluate(t);if(!(n instanceof AST_Node||n))return e.left}}var p=!0;switch(e.operator){case"+":if(e.right instanceof AST_Constant&&e.left instanceof AST_Binary&&"+"==e.left.operator&&e.left.is_string(t)){var d=(S=make_node(AST_Binary,e,{operator:"+",left:e.left.right,right:e.right})).optimize(t);S!==d&&(e=make_node(AST_Binary,e,{operator:"+",left:e.left.left,right:d}));}if(e.left instanceof AST_Binary&&"+"==e.left.operator&&e.left.is_string(t)&&e.right instanceof AST_Binary&&"+"==e.right.operator&&e.right.is_string(t)){var S,m=(S=make_node(AST_Binary,e,{operator:"+",left:e.left.right,right:e.right.left})).optimize(t);S!==m&&(e=make_node(AST_Binary,e,{operator:"+",left:make_node(AST_Binary,e.left,{operator:"+",left:e.left.left,right:m}),right:e.right.right}));}if(e.right instanceof AST_UnaryPrefix&&"-"==e.right.operator&&e.left.is_number(t)){e=make_node(AST_Binary,e,{operator:"-",left:e.left,right:e.right.expression});break}if(e.left instanceof AST_UnaryPrefix&&"-"==e.left.operator&&n()&&e.right.is_number(t)){e=make_node(AST_Binary,e,{operator:"-",left:e.right,right:e.left.expression});break}if(e.left instanceof AST_TemplateString){var A=e.left;if((d=e.right.evaluate(t))!=e.right)return A.segments[A.segments.length-1].value+=String(d),A}if(e.right instanceof AST_TemplateString&&(d=e.right,(A=e.left.evaluate(t))!=e.left))return d.segments[0].value=String(A)+d.segments[0].value,d;if(e.left instanceof AST_TemplateString&&e.right instanceof AST_TemplateString){var T=(A=e.left).segments;d=e.right,T[T.length-1].value+=d.segments[0].value;for(var h=1;h<d.segments.length;h++)T.push(d.segments[h]);return A}case"*":p=t.option("unsafe_math");case"&":case"|":case"^":if(e.left.is_number(t)&&e.right.is_number(t)&&n()&&!(e.left instanceof AST_Binary&&e.left.operator!=e.operator&&PRECEDENCE[e.left.operator]>=PRECEDENCE[e.operator])){var E=make_node(AST_Binary,e,{operator:e.operator,left:e.right,right:e.left});e=e.right instanceof AST_Constant&&!(e.left instanceof AST_Constant)?best_of(t,E,e):best_of(t,e,E);}p&&e.is_number(t)&&(e.right instanceof AST_Binary&&e.right.operator==e.operator&&(e=make_node(AST_Binary,e,{operator:e.operator,left:make_node(AST_Binary,e.left,{operator:e.operator,left:e.left,right:e.right.left,start:e.left.start,end:e.right.left.end}),right:e.right.right})),e.right instanceof AST_Constant&&e.left instanceof AST_Binary&&e.left.operator==e.operator&&(e.left.left instanceof AST_Constant?e=make_node(AST_Binary,e,{operator:e.operator,left:make_node(AST_Binary,e.left,{operator:e.operator,left:e.left.left,right:e.right,start:e.left.left.start,end:e.right.end}),right:e.left.right}):e.left.right instanceof AST_Constant&&(e=make_node(AST_Binary,e,{operator:e.operator,left:make_node(AST_Binary,e.left,{operator:e.operator,left:e.left.right,right:e.right,start:e.left.right.start,end:e.right.end}),right:e.left.left}))),e.left instanceof AST_Binary&&e.left.operator==e.operator&&e.left.right instanceof AST_Constant&&e.right instanceof AST_Binary&&e.right.operator==e.operator&&e.right.left instanceof AST_Constant&&(e=make_node(AST_Binary,e,{operator:e.operator,left:make_node(AST_Binary,e.left,{operator:e.operator,left:make_node(AST_Binary,e.left.left,{operator:e.operator,left:e.left.right,right:e.right.left,start:e.left.right.start,end:e.right.left.end}),right:e.left.left}),right:e.right.right})));}}if(e.right instanceof AST_Binary&&e.right.operator==e.operator&&(lazy_op.has(e.operator)||"+"==e.operator&&(e.right.left.is_string(t)||e.left.is_string(t)&&e.right.right.is_string(t))))return e.left=make_node(AST_Binary,e.left,{operator:e.operator,left:e.left.transform(t),right:e.right.left.transform(t)}),e.right=e.right.right.transform(t),e.transform(t);var g=e.evaluate(t);return g!==e?(g=make_node_from_constant(g,e).optimize(t),best_of(t,g,e)):e})),def_optimize(AST_SymbolExport,(function(e){return e})),def_optimize(AST_SymbolRef,(function(e,t){if(!t.option("ie8")&&is_undeclared_ref(e)&&!t.find_parent(AST_With))switch(e.name){case"undefined":return make_node(AST_Undefined,e).optimize(t);case"NaN":return make_node(AST_NaN,e).optimize(t);case"Infinity":return make_node(AST_Infinity,e).optimize(t)}const n=t.parent();if(t.option("reduce_vars")&&is_lhs(e,n)!==e){const r=e.definition(),a=find_scope(t);if(t.top_retain&&r.global&&t.top_retain(r))return r.fixed=!1,r.single_use=!1,e;let s=e.fixed_value(),u=r.single_use&&!(n instanceof AST_Call&&n.is_expr_pure(t)||has_annotation(n,_NOINLINE))&&!(n instanceof AST_Export&&s instanceof AST_Lambda&&s.name);if(u&&(s instanceof AST_Lambda||s instanceof AST_Class))if(retain_top_func(s,t))u=!1;else if(r.scope!==e.scope&&(1==r.escaped||has_flag(s,16)||within_array_or_object_literal(t)))u=!1;else if(recursive_ref(t,r))u=!1;else if((r.scope!==e.scope||r.orig[0]instanceof AST_SymbolFunarg)&&(u=s.is_constant_expression(e.scope),"f"==u)){var o=e.scope;do{(o instanceof AST_Defun||is_func_expr(o))&&set_flag(o,16);}while(o=o.parent_scope)}if(u&&s instanceof AST_Lambda&&(u=r.scope===e.scope&&!scope_encloses_variables_in_this_scope(a,s)||n instanceof AST_Call&&n.expression===e&&!scope_encloses_variables_in_this_scope(a,s)&&!(s.name&&s.name.definition().recursive_refs>0)),u&&s instanceof AST_Class&&(u=!(s.extends&&(s.extends.may_throw(t)||s.extends.has_side_effects(t))||s.properties.some((e=>e.may_throw(t)||e.has_side_effects(t))))),u&&s){if(s instanceof AST_DefClass&&(set_flag(s,256),s=make_node(AST_ClassExpression,s,s)),s instanceof AST_Defun&&(set_flag(s,256),s=make_node(AST_Function,s,s)),r.recursive_refs>0&&s.name instanceof AST_SymbolDefun){const e=s.name.definition();let t=s.variables.get(s.name.name),n=t&&t.orig[0];n instanceof AST_SymbolLambda||(n=make_node(AST_SymbolLambda,s.name,s.name),n.scope=s,s.name=n,t=s.def_function(n)),walk$3(s,(n=>{n instanceof AST_SymbolRef&&n.definition()===e&&(n.thedef=t,t.references.push(n));}));}return (s instanceof AST_Lambda||s instanceof AST_Class)&&s.parent_scope!==a&&(s=s.clone(!0,t.get_toplevel()),a.add_child_scope(s)),s.optimize(t)}if(s){let n;if(s instanceof AST_This)r.orig[0]instanceof AST_SymbolFunarg||!r.references.every((e=>r.scope===e.scope))||(n=s);else {var i=s.evaluate(t);i===s||!t.option("unsafe_regexp")&&i instanceof RegExp||(n=make_node_from_constant(i,s));}if(n){const o=e.size(t),i=n.size(t);let a=0;if(t.option("unused")&&!t.exposed(r)&&(a=(o+2+i)/(r.references.length-r.assignments)),i<=o+a)return n}}}return e})),def_optimize(AST_Undefined,(function(e,t){if(t.option("unsafe_undefined")){var n=find_variable(t,"undefined");if(n){var o=make_node(AST_SymbolRef,e,{name:"undefined",scope:n.scope,thedef:n});return set_flag(o,8),o}}var i=is_lhs(t.self(),t.parent());return i&&is_atomic(i,e)?e:make_node(AST_UnaryPrefix,e,{operator:"void",expression:make_node(AST_Number,e,{value:0})})})),def_optimize(AST_Infinity,(function(e,t){var n=is_lhs(t.self(),t.parent());return n&&is_atomic(n,e)?e:!t.option("keep_infinity")||n&&!is_atomic(n,e)||find_variable(t,"Infinity")?make_node(AST_Binary,e,{operator:"/",left:make_node(AST_Number,e,{value:1}),right:make_node(AST_Number,e,{value:0})}):e})),def_optimize(AST_NaN,(function(e,t){var n=is_lhs(t.self(),t.parent());return n&&!is_atomic(n,e)||find_variable(t,"NaN")?make_node(AST_Binary,e,{operator:"/",left:make_node(AST_Number,e,{value:0}),right:make_node(AST_Number,e,{value:0})}):e}));const ASSIGN_OPS=makePredicate("+ - / * % >> << >>> | ^ &"),ASSIGN_OPS_COMMUTATIVE=makePredicate("* | ^ &");function is_nullish(e){let t;return e instanceof AST_Null||is_undefined(e)||e instanceof AST_SymbolRef&&(t=e.definition().fixed)instanceof AST_Node&&is_nullish(t)||e instanceof AST_PropAccess&&e.optional&&is_nullish(e.expression)||e instanceof AST_Call&&e.optional&&is_nullish(e.expression)||e instanceof AST_Chain&&is_nullish(e.expression)}function is_nullish_check(e,t,n){if(t.may_throw(n))return !1;let o;if(e instanceof AST_Binary&&"=="===e.operator&&((o=is_nullish(e.left)&&e.left)||(o=is_nullish(e.right)&&e.right))&&(o===e.left?e.right:e.left).equivalent_to(t))return !0;if(e instanceof AST_Binary&&"||"===e.operator){let n,o;const i=e=>{if(!(e instanceof AST_Binary)||"==="!==e.operator&&"=="!==e.operator)return !1;let i,r=0;return e.left instanceof AST_Null&&(r++,n=e,i=e.right),e.right instanceof AST_Null&&(r++,n=e,i=e.left),is_undefined(e.left)&&(r++,o=e,i=e.right),is_undefined(e.right)&&(r++,o=e,i=e.left),1===r&&!!i.equivalent_to(t)};if(!i(e.left))return !1;if(!i(e.right))return !1;if(n&&o&&n!==o)return !0}return !1}function safe_to_flatten(e,t){return e instanceof AST_SymbolRef&&(e=e.fixed_value()),!!e&&(!(e instanceof AST_Lambda||e instanceof AST_Class)||!(e instanceof AST_Lambda&&e.contains_this())||t.parent()instanceof AST_New)}function literals_in_boolean_context(e,t){return t.in_boolean_context()?best_of(t,e,make_sequence(e,[e,make_node(AST_True,e)]).optimize(t)):e}function inline_array_like_spread(e){for(var t=0;t<e.length;t++){var n=e[t];if(n instanceof AST_Expansion){var o=n.expression;o instanceof AST_Array&&!o.elements.some((e=>e instanceof AST_Hole))&&(e.splice(t,1,...o.elements),t--);}}}function inline_object_prop_spread(e){for(var t=0;t<e.length;t++){var n=e[t];if(n instanceof AST_Expansion){const o=n.expression;o instanceof AST_Object&&o.properties.every((e=>e instanceof AST_ObjectKeyVal))?(e.splice(t,1,...o.properties),t--):o instanceof AST_Constant&&!(o instanceof AST_String)&&e.splice(t,1);}}}function lift_key(e,t){if(!t.option("computed_props"))return e;if(!(e.key instanceof AST_Constant))return e;if(e.key instanceof AST_String||e.key instanceof AST_Number){if("__proto__"===e.key.value)return e;if("constructor"==e.key.value&&t.parent()instanceof AST_Class)return e;e.key=e instanceof AST_ObjectKeyVal?e.key.value:make_node(e instanceof AST_ClassProperty?AST_SymbolClassProperty:AST_SymbolMethod,e.key,{name:e.key.value});}return e}async function SourceMap$4(e){var t;e=defaults$1(e,{file:null,root:null,orig:null,orig_line_diff:0,dest_line_diff:0});var n=new sourceMap.SourceMapGenerator({file:e.file,sourceRoot:e.root});return e.orig&&(t=await new sourceMap.SourceMapConsumer(e.orig)).sources.forEach((function(e){var o=t.sourceContentFor(e,!0);o&&n.setSourceContent(e,o);})),{add:function(o,i,r,a,s,u){if(t){var l=t.originalPositionFor({line:a,column:s});if(null===l.source)return;o=l.source,a=l.line,s=l.column,u=l.name||u;}n.addMapping({generated:{line:i+e.dest_line_diff,column:r},original:{line:a+e.orig_line_diff,column:s},source:o,name:u});},get:function(){return n},toString:function(){return n.toString()},destroy:function(){t&&t.destroy&&t.destroy();}}}def_optimize(AST_Assign,(function(e,t){if(e.logical)return e.lift_sequences(t);var n;if(t.option("dead_code")&&e.left instanceof AST_SymbolRef&&(n=e.left.definition()).scope===t.find_parent(AST_Lambda)){var o,i=0,r=e;do{if(o=r,(r=t.parent(i++))instanceof AST_Exit){if(a(i,r))break;if(is_reachable(n.scope,[n]))break;return "="==e.operator?e.right:(n.fixed=!1,make_node(AST_Binary,e,{operator:e.operator.slice(0,-1),left:e.left,right:e.right}).optimize(t))}}while(r instanceof AST_Binary&&r.right===o||r instanceof AST_Sequence&&r.tail_node()===o)}return "="==(e=e.lift_sequences(t)).operator&&e.left instanceof AST_SymbolRef&&e.right instanceof AST_Binary&&(e.right.left instanceof AST_SymbolRef&&e.right.left.name==e.left.name&&ASSIGN_OPS.has(e.right.operator)?(e.operator=e.right.operator+"=",e.right=e.right.right):e.right.right instanceof AST_SymbolRef&&e.right.right.name==e.left.name&&ASSIGN_OPS_COMMUTATIVE.has(e.right.operator)&&!e.right.left.has_side_effects(t)&&(e.operator=e.right.operator+"=",e.right=e.right.left)),e;function a(n,o){var i=e.right;e.right=make_node(AST_Null,i);var r=o.may_throw(t);e.right=i;for(var a,s=e.left.definition().scope;(a=t.parent(n++))!==s;)if(a instanceof AST_Try){if(a.bfinally)return !0;if(r&&a.bcatch)return !0}}})),def_optimize(AST_DefaultAssign,(function(e,t){if(!t.option("evaluate"))return e;var n=e.right.evaluate(t);return void 0===n?e=e.left:n!==e.right&&(n=make_node_from_constant(n,e.right),e.right=best_of_expression(n,e.right)),e})),def_optimize(AST_Conditional,(function(e,t){if(!t.option("conditionals"))return e;if(e.condition instanceof AST_Sequence){var n=e.condition.expressions.slice();return e.condition=n.pop(),n.push(e),make_sequence(e,n)}var o=e.condition.evaluate(t);if(o!==e.condition)return maintain_this_binding(t.parent(),t.self(),o?e.consequent:e.alternative);var i=o.negate(t,first_in_statement(t));best_of(t,o,i)===i&&(e=make_node(AST_Conditional,e,{condition:i,consequent:e.alternative,alternative:e.consequent}));var r,a=e.condition,s=e.consequent,u=e.alternative;if(a instanceof AST_SymbolRef&&s instanceof AST_SymbolRef&&a.definition()===s.definition())return make_node(AST_Binary,e,{operator:"||",left:a,right:u});if(s instanceof AST_Assign&&u instanceof AST_Assign&&s.operator===u.operator&&s.logical===u.logical&&s.left.equivalent_to(u.left)&&(!e.condition.has_side_effects(t)||"="==s.operator&&!s.left.has_side_effects(t)))return make_node(AST_Assign,e,{operator:s.operator,left:s.left,logical:s.logical,right:make_node(AST_Conditional,e,{condition:e.condition,consequent:s.right,alternative:u.right})});if(s instanceof AST_Call&&u.TYPE===s.TYPE&&s.args.length>0&&s.args.length==u.args.length&&s.expression.equivalent_to(u.expression)&&!e.condition.has_side_effects(t)&&!s.expression.has_side_effects(t)&&"number"==typeof(r=function(){for(var e=s.args,t=u.args,n=0,o=e.length;n<o;n++){if(e[n]instanceof AST_Expansion)return;if(!e[n].equivalent_to(t[n])){if(t[n]instanceof AST_Expansion)return;for(var i=n+1;i<o;i++){if(e[i]instanceof AST_Expansion)return;if(!e[i].equivalent_to(t[i]))return}return n}}}())){var l=s.clone();return l.args[r]=make_node(AST_Conditional,e,{condition:e.condition,consequent:s.args[r],alternative:u.args[r]}),l}if(u instanceof AST_Conditional&&s.equivalent_to(u.consequent))return make_node(AST_Conditional,e,{condition:make_node(AST_Binary,e,{operator:"||",left:a,right:u.condition}),consequent:s,alternative:u.alternative}).optimize(t);if(t.option("ecma")>=2020&&is_nullish_check(a,u,t))return make_node(AST_Binary,e,{operator:"??",left:u,right:s}).optimize(t);if(u instanceof AST_Sequence&&s.equivalent_to(u.expressions[u.expressions.length-1]))return make_sequence(e,[make_node(AST_Binary,e,{operator:"||",left:a,right:make_sequence(e,u.expressions.slice(0,-1))}),s]).optimize(t);if(u instanceof AST_Binary&&"&&"==u.operator&&s.equivalent_to(u.right))return make_node(AST_Binary,e,{operator:"&&",left:make_node(AST_Binary,e,{operator:"||",left:a,right:u.left}),right:s}).optimize(t);if(s instanceof AST_Conditional&&s.alternative.equivalent_to(u))return make_node(AST_Conditional,e,{condition:make_node(AST_Binary,e,{left:e.condition,operator:"&&",right:s.condition}),consequent:s.consequent,alternative:u});if(s.equivalent_to(u))return make_sequence(e,[e.condition,s]).optimize(t);if(s instanceof AST_Binary&&"||"==s.operator&&s.right.equivalent_to(u))return make_node(AST_Binary,e,{operator:"||",left:make_node(AST_Binary,e,{operator:"&&",left:e.condition,right:s.left}),right:u}).optimize(t);var _=t.in_boolean_context();return f(e.consequent)?p(e.alternative)?c(e.condition):make_node(AST_Binary,e,{operator:"||",left:c(e.condition),right:e.alternative}):p(e.consequent)?f(e.alternative)?c(e.condition.negate(t)):make_node(AST_Binary,e,{operator:"&&",left:c(e.condition.negate(t)),right:e.alternative}):f(e.alternative)?make_node(AST_Binary,e,{operator:"||",left:c(e.condition.negate(t)),right:e.consequent}):p(e.alternative)?make_node(AST_Binary,e,{operator:"&&",left:c(e.condition),right:e.consequent}):e;function c(e){return e.is_boolean()?e:make_node(AST_UnaryPrefix,e,{operator:"!",expression:e.negate(t)})}function f(e){return e instanceof AST_True||_&&e instanceof AST_Constant&&e.getValue()||e instanceof AST_UnaryPrefix&&"!"==e.operator&&e.expression instanceof AST_Constant&&!e.expression.getValue()}function p(e){return e instanceof AST_False||_&&e instanceof AST_Constant&&!e.getValue()||e instanceof AST_UnaryPrefix&&"!"==e.operator&&e.expression instanceof AST_Constant&&e.expression.getValue()}})),def_optimize(AST_Boolean,(function(e,t){if(t.in_boolean_context())return make_node(AST_Number,e,{value:+e.value});var n=t.parent();return t.option("booleans_as_integers")?(n instanceof AST_Binary&&("==="==n.operator||"!=="==n.operator)&&(n.operator=n.operator.replace(/=$/,"")),make_node(AST_Number,e,{value:+e.value})):t.option("booleans")?n instanceof AST_Binary&&("=="==n.operator||"!="==n.operator)?make_node(AST_Number,e,{value:+e.value}):make_node(AST_UnaryPrefix,e,{operator:"!",expression:make_node(AST_Number,e,{value:1-e.value})}):e})),AST_PropAccess.DEFMETHOD("flatten_object",(function(e,t){if(t.option("properties")){var n=t.option("unsafe_arrows")&&t.option("ecma")>=2015,o=this.expression;if(o instanceof AST_Object)for(var i=o.properties,r=i.length;--r>=0;){var a=i[r];if(""+(a instanceof AST_ConciseMethod?a.key.name:a.key)==e){if(!i.every((e=>e instanceof AST_ObjectKeyVal||n&&e instanceof AST_ConciseMethod&&!e.is_generator)))break;if(!safe_to_flatten(a.value,t))break;return make_node(AST_Sub,this,{expression:make_node(AST_Array,o,{elements:i.map((function(e){var t=e.value;t instanceof AST_Accessor&&(t=make_node(AST_Function,t,t));var n=e.key;return n instanceof AST_Node&&!(n instanceof AST_SymbolMethod)?make_sequence(e,[n,t]):t}))}),property:make_node(AST_Number,this,{value:r})})}}}})),def_optimize(AST_Sub,(function(e,t){var n,o=e.expression,i=e.property;if(t.option("properties")){var r=i.evaluate(t);if(r!==i){"string"==typeof r&&("undefined"==r?r=void 0:(g=parseFloat(r)).toString()==r&&(r=g)),i=e.property=best_of_expression(i,make_node_from_constant(r,i).transform(t));var a=""+r;if(is_basic_identifier_string(a)&&a.length<=i.size()+1)return make_node(AST_Dot,e,{expression:o,optional:e.optional,property:a,quote:i.quote}).optimize(t)}}e:if(t.option("arguments")&&o instanceof AST_SymbolRef&&"arguments"==o.name&&1==o.definition().orig.length&&(n=o.scope)instanceof AST_Lambda&&n.uses_arguments&&!(n instanceof AST_Arrow)&&i instanceof AST_Number){for(var s=i.getValue(),u=new Set,l=n.argnames,_=0;_<l.length;_++){if(!(l[_]instanceof AST_SymbolFunarg))break e;var c=l[_].name;if(u.has(c))break e;u.add(c);}var f=n.argnames[s];if(f&&t.has_directive("use strict")){var p=f.definition();(!t.option("reduce_vars")||p.assignments||p.orig.length>1)&&(f=null);}else if(!f&&!t.option("keep_fargs")&&s<n.argnames.length+5)for(;s>=n.argnames.length;)f=n.create_symbol(AST_SymbolFunarg,{source:n,scope:n,tentative_name:"argument_"+n.argnames.length}),n.argnames.push(f);if(f){var d=make_node(AST_SymbolRef,e,f);return d.reference({}),clear_flag(f,1),d}}if(is_lhs(e,t.parent()))return e;if(r!==i){var S=e.flatten_object(a,t);S&&(o=e.expression=S.expression,i=e.property=S.property);}if(t.option("properties")&&t.option("side_effects")&&i instanceof AST_Number&&o instanceof AST_Array){s=i.getValue();var m=o.elements,A=m[s];e:if(safe_to_flatten(A,t)){for(var T=!0,h=[],E=m.length;--E>s;)(g=m[E].drop_side_effect_free(t))&&(h.unshift(g),T&&g.has_side_effects(t)&&(T=!1));if(A instanceof AST_Expansion)break e;for(A=A instanceof AST_Hole?make_node(AST_Undefined,A):A,T||h.unshift(A);--E>=0;){var g;if((g=m[E])instanceof AST_Expansion)break e;(g=g.drop_side_effect_free(t))?h.unshift(g):s--;}return T?(h.push(A),make_sequence(e,h).optimize(t)):make_node(AST_Sub,e,{expression:make_node(AST_Array,o,{elements:h}),property:make_node(AST_Number,i,{value:s})})}}var D=e.evaluate(t);return D!==e?best_of(t,D=make_node_from_constant(D,e).optimize(t),e):e.optional&&is_nullish(e.expression)?make_node(AST_Undefined,e):e})),def_optimize(AST_Chain,(function(e,t){return e.expression=e.expression.optimize(t),e})),AST_Lambda.DEFMETHOD("contains_this",(function(){return walk$3(this,(e=>e instanceof AST_This?walk_abort:e!==this&&e instanceof AST_Scope&&!(e instanceof AST_Arrow)||void 0))})),def_optimize(AST_Dot,(function(e,t){const n=t.parent();if(is_lhs(e,n))return e;if(t.option("unsafe_proto")&&e.expression instanceof AST_Dot&&"prototype"==e.expression.property){var o=e.expression.expression;if(is_undeclared_ref(o))switch(o.name){case"Array":e.expression=make_node(AST_Array,e.expression,{elements:[]});break;case"Function":e.expression=make_node(AST_Function,e.expression,{argnames:[],body:[]});break;case"Number":e.expression=make_node(AST_Number,e.expression,{value:0});break;case"Object":e.expression=make_node(AST_Object,e.expression,{properties:[]});break;case"RegExp":e.expression=make_node(AST_RegExp,e.expression,{value:{source:"t",flags:""}});break;case"String":e.expression=make_node(AST_String,e.expression,{value:""});}}if(!(n instanceof AST_Call&&has_annotation(n,_NOINLINE))){const n=e.flatten_object(e.property,t);if(n)return n.optimize(t)}let i=e.evaluate(t);return i!==e?(i=make_node_from_constant(i,e).optimize(t),best_of(t,i,e)):e.optional&&is_nullish(e.expression)?make_node(AST_Undefined,e):e})),def_optimize(AST_Array,(function(e,t){var n=literals_in_boolean_context(e,t);return n!==e?n:(inline_array_like_spread(e.elements),e)})),def_optimize(AST_Object,(function(e,t){var n=literals_in_boolean_context(e,t);return n!==e?n:(inline_object_prop_spread(e.properties),e)})),def_optimize(AST_RegExp,literals_in_boolean_context),def_optimize(AST_Return,(function(e,t){return e.value&&is_undefined(e.value,t)&&(e.value=null),e})),def_optimize(AST_Arrow,opt_AST_Lambda),def_optimize(AST_Function,(function(e,t){return e=opt_AST_Lambda(e,t),!(t.option("unsafe_arrows")&&t.option("ecma")>=2015)||e.name||e.is_generator||e.uses_arguments||e.pinned()||walk$3(e,(e=>{if(e instanceof AST_This)return walk_abort}))?e:make_node(AST_Arrow,e,e).optimize(t)})),def_optimize(AST_Class,(function(e){return e})),def_optimize(AST_Yield,(function(e,t){return e.expression&&!e.is_star&&is_undefined(e.expression,t)&&(e.expression=null),e})),def_optimize(AST_TemplateString,(function(e,t){if(!t.option("evaluate")||t.parent()instanceof AST_PrefixedTemplateString)return e;for(var n=[],o=0;o<e.segments.length;o++){var i=e.segments[o];if(i instanceof AST_Node){var r=i.evaluate(t);if(r!==i&&(r+"").length<=i.size()+"${}".length){n[n.length-1].value=n[n.length-1].value+r+e.segments[++o].value;continue}if(i instanceof AST_TemplateString){var a=i.segments;n[n.length-1].value+=a[0].value;for(var s=1;s<a.length;s++)i=a[s],n.push(i);continue}}n.push(i);}if(e.segments=n,1==n.length)return make_node(AST_String,e,n[0]);if(3===n.length&&n[1]instanceof AST_Node&&(n[1].is_string(t)||n[1].is_number(t)||is_nullish(n[1])||t.option("unsafe"))){if(""===n[2].value)return make_node(AST_Binary,e,{operator:"+",left:make_node(AST_String,e,{value:n[0].value}),right:n[1]});if(""===n[0].value)return make_node(AST_Binary,e,{operator:"+",left:n[1],right:make_node(AST_String,e,{value:n[2].value})})}return e})),def_optimize(AST_PrefixedTemplateString,(function(e){return e})),def_optimize(AST_ObjectProperty,lift_key),def_optimize(AST_ConciseMethod,(function(e,t){if(lift_key(e,t),t.option("arrows")&&t.parent()instanceof AST_Object&&!e.is_generator&&!e.value.uses_arguments&&!e.value.pinned()&&1==e.value.body.length&&e.value.body[0]instanceof AST_Return&&e.value.body[0].value&&!e.value.contains_this()){var n=make_node(AST_Arrow,e.value,e.value);return n.async=e.async,n.is_generator=e.is_generator,make_node(AST_ObjectKeyVal,e,{key:e.key instanceof AST_SymbolMethod?e.key.name:e.key,value:n,quote:e.quote})}return e})),def_optimize(AST_ObjectKeyVal,(function(e,t){lift_key(e,t);var n=t.option("unsafe_methods");if(n&&t.option("ecma")>=2015&&(!(n instanceof RegExp)||n.test(e.key+""))){var o=e.key,i=e.value;if((i instanceof AST_Arrow&&Array.isArray(i.body)&&!i.contains_this()||i instanceof AST_Function)&&!i.name)return make_node(AST_ConciseMethod,e,{async:i.async,is_generator:i.is_generator,key:o instanceof AST_Node?o:make_node(AST_SymbolMethod,e,{name:o}),value:make_node(AST_Accessor,i,i),quote:e.quote})}return e})),def_optimize(AST_Destructuring,(function(e,t){if(1==t.option("pure_getters")&&t.option("unused")&&!e.is_array&&Array.isArray(e.names)&&!function(e){for(var t=[/^VarDef$/,/^(Const|Let|Var)$/,/^Export$/],n=0,o=0,i=t.length;n<i;o++){var r=e.parent(o);if(!r)return !1;if(0!==n||"Destructuring"!=r.TYPE){if(!t[n].test(r.TYPE))return !1;n++;}}return !0}(t)&&!(e.names[e.names.length-1]instanceof AST_Expansion)){for(var n=[],o=0;o<e.names.length;o++){var i=e.names[o];i instanceof AST_ObjectKeyVal&&"string"==typeof i.key&&i.value instanceof AST_SymbolDeclaration&&!r(t,i.value.definition())||n.push(i);}n.length!=e.names.length&&(e.names=n);}return e;function r(e,t){return !!t.references.length||!!t.global&&(!e.toplevel.vars||!!e.top_retain&&e.top_retain(t))}}));var domprops=["$&","$'","$*","$+","$1","$2","$3","$4","$5","$6","$7","$8","$9","$_","$`","$input","-moz-animation","-moz-animation-delay","-moz-animation-direction","-moz-animation-duration","-moz-animation-fill-mode","-moz-animation-iteration-count","-moz-animation-name","-moz-animation-play-state","-moz-animation-timing-function","-moz-appearance","-moz-backface-visibility","-moz-border-end","-moz-border-end-color","-moz-border-end-style","-moz-border-end-width","-moz-border-image","-moz-border-start","-moz-border-start-color","-moz-border-start-style","-moz-border-start-width","-moz-box-align","-moz-box-direction","-moz-box-flex","-moz-box-ordinal-group","-moz-box-orient","-moz-box-pack","-moz-box-sizing","-moz-float-edge","-moz-font-feature-settings","-moz-font-language-override","-moz-force-broken-image-icon","-moz-hyphens","-moz-image-region","-moz-margin-end","-moz-margin-start","-moz-orient","-moz-osx-font-smoothing","-moz-outline-radius","-moz-outline-radius-bottomleft","-moz-outline-radius-bottomright","-moz-outline-radius-topleft","-moz-outline-radius-topright","-moz-padding-end","-moz-padding-start","-moz-perspective","-moz-perspective-origin","-moz-tab-size","-moz-text-size-adjust","-moz-transform","-moz-transform-origin","-moz-transform-style","-moz-transition","-moz-transition-delay","-moz-transition-duration","-moz-transition-property","-moz-transition-timing-function","-moz-user-focus","-moz-user-input","-moz-user-modify","-moz-user-select","-moz-window-dragging","-webkit-align-content","-webkit-align-items","-webkit-align-self","-webkit-animation","-webkit-animation-delay","-webkit-animation-direction","-webkit-animation-duration","-webkit-animation-fill-mode","-webkit-animation-iteration-count","-webkit-animation-name","-webkit-animation-play-state","-webkit-animation-timing-function","-webkit-appearance","-webkit-backface-visibility","-webkit-background-clip","-webkit-background-origin","-webkit-background-size","-webkit-border-bottom-left-radius","-webkit-border-bottom-right-radius","-webkit-border-image","-webkit-border-radius","-webkit-border-top-left-radius","-webkit-border-top-right-radius","-webkit-box-align","-webkit-box-direction","-webkit-box-flex","-webkit-box-ordinal-group","-webkit-box-orient","-webkit-box-pack","-webkit-box-shadow","-webkit-box-sizing","-webkit-filter","-webkit-flex","-webkit-flex-basis","-webkit-flex-direction","-webkit-flex-flow","-webkit-flex-grow","-webkit-flex-shrink","-webkit-flex-wrap","-webkit-justify-content","-webkit-line-clamp","-webkit-mask","-webkit-mask-clip","-webkit-mask-composite","-webkit-mask-image","-webkit-mask-origin","-webkit-mask-position","-webkit-mask-position-x","-webkit-mask-position-y","-webkit-mask-repeat","-webkit-mask-size","-webkit-order","-webkit-perspective","-webkit-perspective-origin","-webkit-text-fill-color","-webkit-text-size-adjust","-webkit-text-stroke","-webkit-text-stroke-color","-webkit-text-stroke-width","-webkit-transform","-webkit-transform-origin","-webkit-transform-style","-webkit-transition","-webkit-transition-delay","-webkit-transition-duration","-webkit-transition-property","-webkit-transition-timing-function","-webkit-user-select","0","1","10","11","12","13","14","15","16","17","18","19","2","20","3","4","5","6","7","8","9","@@iterator","ABORT_ERR","ACTIVE","ACTIVE_ATTRIBUTES","ACTIVE_TEXTURE","ACTIVE_UNIFORMS","ACTIVE_UNIFORM_BLOCKS","ADDITION","ALIASED_LINE_WIDTH_RANGE","ALIASED_POINT_SIZE_RANGE","ALLOW_KEYBOARD_INPUT","ALLPASS","ALPHA","ALPHA_BITS","ALREADY_SIGNALED","ALT_MASK","ALWAYS","ANY_SAMPLES_PASSED","ANY_SAMPLES_PASSED_CONSERVATIVE","ANY_TYPE","ANY_UNORDERED_NODE_TYPE","ARRAY_BUFFER","ARRAY_BUFFER_BINDING","ATTACHED_SHADERS","ATTRIBUTE_NODE","AT_TARGET","AbortController","AbortSignal","AbsoluteOrientationSensor","AbstractRange","Accelerometer","AddSearchProvider","AggregateError","AnalyserNode","Animation","AnimationEffect","AnimationEvent","AnimationPlaybackEvent","AnimationTimeline","AnonXMLHttpRequest","Any","ApplicationCache","ApplicationCacheErrorEvent","Array","ArrayBuffer","ArrayType","Atomics","Attr","Audio","AudioBuffer","AudioBufferSourceNode","AudioContext","AudioDestinationNode","AudioListener","AudioNode","AudioParam","AudioParamMap","AudioProcessingEvent","AudioScheduledSourceNode","AudioStreamTrack","AudioWorklet","AudioWorkletNode","AuthenticatorAssertionResponse","AuthenticatorAttestationResponse","AuthenticatorResponse","AutocompleteErrorEvent","BACK","BAD_BOUNDARYPOINTS_ERR","BAD_REQUEST","BANDPASS","BLEND","BLEND_COLOR","BLEND_DST_ALPHA","BLEND_DST_RGB","BLEND_EQUATION","BLEND_EQUATION_ALPHA","BLEND_EQUATION_RGB","BLEND_SRC_ALPHA","BLEND_SRC_RGB","BLUE_BITS","BLUR","BOOL","BOOLEAN_TYPE","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","BOTH","BROWSER_DEFAULT_WEBGL","BUBBLING_PHASE","BUFFER_SIZE","BUFFER_USAGE","BYTE","BYTES_PER_ELEMENT","BackgroundFetchManager","BackgroundFetchRecord","BackgroundFetchRegistration","BarProp","BarcodeDetector","BaseAudioContext","BaseHref","BatteryManager","BeforeInstallPromptEvent","BeforeLoadEvent","BeforeUnloadEvent","BigInt","BigInt64Array","BigUint64Array","BiquadFilterNode","Blob","BlobEvent","Bluetooth","BluetoothCharacteristicProperties","BluetoothDevice","BluetoothRemoteGATTCharacteristic","BluetoothRemoteGATTDescriptor","BluetoothRemoteGATTServer","BluetoothRemoteGATTService","BluetoothUUID","Boolean","BroadcastChannel","ByteLengthQueuingStrategy","CAPTURING_PHASE","CCW","CDATASection","CDATA_SECTION_NODE","CHANGE","CHARSET_RULE","CHECKING","CLAMP_TO_EDGE","CLICK","CLOSED","CLOSING","COLOR","COLOR_ATTACHMENT0","COLOR_ATTACHMENT1","COLOR_ATTACHMENT10","COLOR_ATTACHMENT11","COLOR_ATTACHMENT12","COLOR_ATTACHMENT13","COLOR_ATTACHMENT14","COLOR_ATTACHMENT15","COLOR_ATTACHMENT2","COLOR_ATTACHMENT3","COLOR_ATTACHMENT4","COLOR_ATTACHMENT5","COLOR_ATTACHMENT6","COLOR_ATTACHMENT7","COLOR_ATTACHMENT8","COLOR_ATTACHMENT9","COLOR_BUFFER_BIT","COLOR_CLEAR_VALUE","COLOR_WRITEMASK","COMMENT_NODE","COMPARE_REF_TO_TEXTURE","COMPILE_STATUS","COMPRESSED_RGBA_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","COMPRESSED_RGB_S3TC_DXT1_EXT","COMPRESSED_TEXTURE_FORMATS","CONDITION_SATISFIED","CONFIGURATION_UNSUPPORTED","CONNECTING","CONSTANT_ALPHA","CONSTANT_COLOR","CONSTRAINT_ERR","CONTEXT_LOST_WEBGL","CONTROL_MASK","COPY_READ_BUFFER","COPY_READ_BUFFER_BINDING","COPY_WRITE_BUFFER","COPY_WRITE_BUFFER_BINDING","COUNTER_STYLE_RULE","CSS","CSS2Properties","CSSAnimation","CSSCharsetRule","CSSConditionRule","CSSCounterStyleRule","CSSFontFaceRule","CSSFontFeatureValuesRule","CSSGroupingRule","CSSImageValue","CSSImportRule","CSSKeyframeRule","CSSKeyframesRule","CSSKeywordValue","CSSMathInvert","CSSMathMax","CSSMathMin","CSSMathNegate","CSSMathProduct","CSSMathSum","CSSMathValue","CSSMatrixComponent","CSSMediaRule","CSSMozDocumentRule","CSSNameSpaceRule","CSSNamespaceRule","CSSNumericArray","CSSNumericValue","CSSPageRule","CSSPerspective","CSSPositionValue","CSSPrimitiveValue","CSSRotate","CSSRule","CSSRuleList","CSSScale","CSSSkew","CSSSkewX","CSSSkewY","CSSStyleDeclaration","CSSStyleRule","CSSStyleSheet","CSSStyleValue","CSSSupportsRule","CSSTransformComponent","CSSTransformValue","CSSTransition","CSSTranslate","CSSUnitValue","CSSUnknownRule","CSSUnparsedValue","CSSValue","CSSValueList","CSSVariableReferenceValue","CSSVariablesDeclaration","CSSVariablesRule","CSSViewportRule","CSS_ATTR","CSS_CM","CSS_COUNTER","CSS_CUSTOM","CSS_DEG","CSS_DIMENSION","CSS_EMS","CSS_EXS","CSS_FILTER_BLUR","CSS_FILTER_BRIGHTNESS","CSS_FILTER_CONTRAST","CSS_FILTER_CUSTOM","CSS_FILTER_DROP_SHADOW","CSS_FILTER_GRAYSCALE","CSS_FILTER_HUE_ROTATE","CSS_FILTER_INVERT","CSS_FILTER_OPACITY","CSS_FILTER_REFERENCE","CSS_FILTER_SATURATE","CSS_FILTER_SEPIA","CSS_GRAD","CSS_HZ","CSS_IDENT","CSS_IN","CSS_INHERIT","CSS_KHZ","CSS_MATRIX","CSS_MATRIX3D","CSS_MM","CSS_MS","CSS_NUMBER","CSS_PC","CSS_PERCENTAGE","CSS_PERSPECTIVE","CSS_PRIMITIVE_VALUE","CSS_PT","CSS_PX","CSS_RAD","CSS_RECT","CSS_RGBCOLOR","CSS_ROTATE","CSS_ROTATE3D","CSS_ROTATEX","CSS_ROTATEY","CSS_ROTATEZ","CSS_S","CSS_SCALE","CSS_SCALE3D","CSS_SCALEX","CSS_SCALEY","CSS_SCALEZ","CSS_SKEW","CSS_SKEWX","CSS_SKEWY","CSS_STRING","CSS_TRANSLATE","CSS_TRANSLATE3D","CSS_TRANSLATEX","CSS_TRANSLATEY","CSS_TRANSLATEZ","CSS_UNKNOWN","CSS_URI","CSS_VALUE_LIST","CSS_VH","CSS_VMAX","CSS_VMIN","CSS_VW","CULL_FACE","CULL_FACE_MODE","CURRENT_PROGRAM","CURRENT_QUERY","CURRENT_VERTEX_ATTRIB","CUSTOM","CW","Cache","CacheStorage","CanvasCaptureMediaStream","CanvasCaptureMediaStreamTrack","CanvasGradient","CanvasPattern","CanvasRenderingContext2D","CaretPosition","ChannelMergerNode","ChannelSplitterNode","CharacterData","ClientRect","ClientRectList","Clipboard","ClipboardEvent","ClipboardItem","CloseEvent","Collator","CommandEvent","Comment","CompileError","CompositionEvent","CompressionStream","Console","ConstantSourceNode","Controllers","ConvolverNode","CountQueuingStrategy","Counter","Credential","CredentialsContainer","Crypto","CryptoKey","CustomElementRegistry","CustomEvent","DATABASE_ERR","DATA_CLONE_ERR","DATA_ERR","DBLCLICK","DECR","DECR_WRAP","DELETE_STATUS","DEPTH","DEPTH24_STENCIL8","DEPTH32F_STENCIL8","DEPTH_ATTACHMENT","DEPTH_BITS","DEPTH_BUFFER_BIT","DEPTH_CLEAR_VALUE","DEPTH_COMPONENT","DEPTH_COMPONENT16","DEPTH_COMPONENT24","DEPTH_COMPONENT32F","DEPTH_FUNC","DEPTH_RANGE","DEPTH_STENCIL","DEPTH_STENCIL_ATTACHMENT","DEPTH_TEST","DEPTH_WRITEMASK","DEVICE_INELIGIBLE","DIRECTION_DOWN","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DISABLED","DISPATCH_REQUEST_ERR","DITHER","DOCUMENT_FRAGMENT_NODE","DOCUMENT_NODE","DOCUMENT_POSITION_CONTAINED_BY","DOCUMENT_POSITION_CONTAINS","DOCUMENT_POSITION_DISCONNECTED","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC","DOCUMENT_POSITION_PRECEDING","DOCUMENT_TYPE_NODE","DOMCursor","DOMError","DOMException","DOMImplementation","DOMImplementationLS","DOMMatrix","DOMMatrixReadOnly","DOMParser","DOMPoint","DOMPointReadOnly","DOMQuad","DOMRect","DOMRectList","DOMRectReadOnly","DOMRequest","DOMSTRING_SIZE_ERR","DOMSettableTokenList","DOMStringList","DOMStringMap","DOMTokenList","DOMTransactionEvent","DOM_DELTA_LINE","DOM_DELTA_PAGE","DOM_DELTA_PIXEL","DOM_INPUT_METHOD_DROP","DOM_INPUT_METHOD_HANDWRITING","DOM_INPUT_METHOD_IME","DOM_INPUT_METHOD_KEYBOARD","DOM_INPUT_METHOD_MULTIMODAL","DOM_INPUT_METHOD_OPTION","DOM_INPUT_METHOD_PASTE","DOM_INPUT_METHOD_SCRIPT","DOM_INPUT_METHOD_UNKNOWN","DOM_INPUT_METHOD_VOICE","DOM_KEY_LOCATION_JOYSTICK","DOM_KEY_LOCATION_LEFT","DOM_KEY_LOCATION_MOBILE","DOM_KEY_LOCATION_NUMPAD","DOM_KEY_LOCATION_RIGHT","DOM_KEY_LOCATION_STANDARD","DOM_VK_0","DOM_VK_1","DOM_VK_2","DOM_VK_3","DOM_VK_4","DOM_VK_5","DOM_VK_6","DOM_VK_7","DOM_VK_8","DOM_VK_9","DOM_VK_A","DOM_VK_ACCEPT","DOM_VK_ADD","DOM_VK_ALT","DOM_VK_ALTGR","DOM_VK_AMPERSAND","DOM_VK_ASTERISK","DOM_VK_AT","DOM_VK_ATTN","DOM_VK_B","DOM_VK_BACKSPACE","DOM_VK_BACK_QUOTE","DOM_VK_BACK_SLASH","DOM_VK_BACK_SPACE","DOM_VK_C","DOM_VK_CANCEL","DOM_VK_CAPS_LOCK","DOM_VK_CIRCUMFLEX","DOM_VK_CLEAR","DOM_VK_CLOSE_BRACKET","DOM_VK_CLOSE_CURLY_BRACKET","DOM_VK_CLOSE_PAREN","DOM_VK_COLON","DOM_VK_COMMA","DOM_VK_CONTEXT_MENU","DOM_VK_CONTROL","DOM_VK_CONVERT","DOM_VK_CRSEL","DOM_VK_CTRL","DOM_VK_D","DOM_VK_DECIMAL","DOM_VK_DELETE","DOM_VK_DIVIDE","DOM_VK_DOLLAR","DOM_VK_DOUBLE_QUOTE","DOM_VK_DOWN","DOM_VK_E","DOM_VK_EISU","DOM_VK_END","DOM_VK_ENTER","DOM_VK_EQUALS","DOM_VK_EREOF","DOM_VK_ESCAPE","DOM_VK_EXCLAMATION","DOM_VK_EXECUTE","DOM_VK_EXSEL","DOM_VK_F","DOM_VK_F1","DOM_VK_F10","DOM_VK_F11","DOM_VK_F12","DOM_VK_F13","DOM_VK_F14","DOM_VK_F15","DOM_VK_F16","DOM_VK_F17","DOM_VK_F18","DOM_VK_F19","DOM_VK_F2","DOM_VK_F20","DOM_VK_F21","DOM_VK_F22","DOM_VK_F23","DOM_VK_F24","DOM_VK_F25","DOM_VK_F26","DOM_VK_F27","DOM_VK_F28","DOM_VK_F29","DOM_VK_F3","DOM_VK_F30","DOM_VK_F31","DOM_VK_F32","DOM_VK_F33","DOM_VK_F34","DOM_VK_F35","DOM_VK_F36","DOM_VK_F4","DOM_VK_F5","DOM_VK_F6","DOM_VK_F7","DOM_VK_F8","DOM_VK_F9","DOM_VK_FINAL","DOM_VK_FRONT","DOM_VK_G","DOM_VK_GREATER_THAN","DOM_VK_H","DOM_VK_HANGUL","DOM_VK_HANJA","DOM_VK_HASH","DOM_VK_HELP","DOM_VK_HK_TOGGLE","DOM_VK_HOME","DOM_VK_HYPHEN_MINUS","DOM_VK_I","DOM_VK_INSERT","DOM_VK_J","DOM_VK_JUNJA","DOM_VK_K","DOM_VK_KANA","DOM_VK_KANJI","DOM_VK_L","DOM_VK_LEFT","DOM_VK_LEFT_TAB","DOM_VK_LESS_THAN","DOM_VK_M","DOM_VK_META","DOM_VK_MODECHANGE","DOM_VK_MULTIPLY","DOM_VK_N","DOM_VK_NONCONVERT","DOM_VK_NUMPAD0","DOM_VK_NUMPAD1","DOM_VK_NUMPAD2","DOM_VK_NUMPAD3","DOM_VK_NUMPAD4","DOM_VK_NUMPAD5","DOM_VK_NUMPAD6","DOM_VK_NUMPAD7","DOM_VK_NUMPAD8","DOM_VK_NUMPAD9","DOM_VK_NUM_LOCK","DOM_VK_O","DOM_VK_OEM_1","DOM_VK_OEM_102","DOM_VK_OEM_2","DOM_VK_OEM_3","DOM_VK_OEM_4","DOM_VK_OEM_5","DOM_VK_OEM_6","DOM_VK_OEM_7","DOM_VK_OEM_8","DOM_VK_OEM_COMMA","DOM_VK_OEM_MINUS","DOM_VK_OEM_PERIOD","DOM_VK_OEM_PLUS","DOM_VK_OPEN_BRACKET","DOM_VK_OPEN_CURLY_BRACKET","DOM_VK_OPEN_PAREN","DOM_VK_P","DOM_VK_PA1","DOM_VK_PAGEDOWN","DOM_VK_PAGEUP","DOM_VK_PAGE_DOWN","DOM_VK_PAGE_UP","DOM_VK_PAUSE","DOM_VK_PERCENT","DOM_VK_PERIOD","DOM_VK_PIPE","DOM_VK_PLAY","DOM_VK_PLUS","DOM_VK_PRINT","DOM_VK_PRINTSCREEN","DOM_VK_PROCESSKEY","DOM_VK_PROPERITES","DOM_VK_Q","DOM_VK_QUESTION_MARK","DOM_VK_QUOTE","DOM_VK_R","DOM_VK_REDO","DOM_VK_RETURN","DOM_VK_RIGHT","DOM_VK_S","DOM_VK_SCROLL_LOCK","DOM_VK_SELECT","DOM_VK_SEMICOLON","DOM_VK_SEPARATOR","DOM_VK_SHIFT","DOM_VK_SLASH","DOM_VK_SLEEP","DOM_VK_SPACE","DOM_VK_SUBTRACT","DOM_VK_T","DOM_VK_TAB","DOM_VK_TILDE","DOM_VK_U","DOM_VK_UNDERSCORE","DOM_VK_UNDO","DOM_VK_UNICODE","DOM_VK_UP","DOM_VK_V","DOM_VK_VOLUME_DOWN","DOM_VK_VOLUME_MUTE","DOM_VK_VOLUME_UP","DOM_VK_W","DOM_VK_WIN","DOM_VK_WINDOW","DOM_VK_WIN_ICO_00","DOM_VK_WIN_ICO_CLEAR","DOM_VK_WIN_ICO_HELP","DOM_VK_WIN_OEM_ATTN","DOM_VK_WIN_OEM_AUTO","DOM_VK_WIN_OEM_BACKTAB","DOM_VK_WIN_OEM_CLEAR","DOM_VK_WIN_OEM_COPY","DOM_VK_WIN_OEM_CUSEL","DOM_VK_WIN_OEM_ENLW","DOM_VK_WIN_OEM_FINISH","DOM_VK_WIN_OEM_FJ_JISHO","DOM_VK_WIN_OEM_FJ_LOYA","DOM_VK_WIN_OEM_FJ_MASSHOU","DOM_VK_WIN_OEM_FJ_ROYA","DOM_VK_WIN_OEM_FJ_TOUROKU","DOM_VK_WIN_OEM_JUMP","DOM_VK_WIN_OEM_PA1","DOM_VK_WIN_OEM_PA2","DOM_VK_WIN_OEM_PA3","DOM_VK_WIN_OEM_RESET","DOM_VK_WIN_OEM_WSCTRL","DOM_VK_X","DOM_VK_XF86XK_ADD_FAVORITE","DOM_VK_XF86XK_APPLICATION_LEFT","DOM_VK_XF86XK_APPLICATION_RIGHT","DOM_VK_XF86XK_AUDIO_CYCLE_TRACK","DOM_VK_XF86XK_AUDIO_FORWARD","DOM_VK_XF86XK_AUDIO_LOWER_VOLUME","DOM_VK_XF86XK_AUDIO_MEDIA","DOM_VK_XF86XK_AUDIO_MUTE","DOM_VK_XF86XK_AUDIO_NEXT","DOM_VK_XF86XK_AUDIO_PAUSE","DOM_VK_XF86XK_AUDIO_PLAY","DOM_VK_XF86XK_AUDIO_PREV","DOM_VK_XF86XK_AUDIO_RAISE_VOLUME","DOM_VK_XF86XK_AUDIO_RANDOM_PLAY","DOM_VK_XF86XK_AUDIO_RECORD","DOM_VK_XF86XK_AUDIO_REPEAT","DOM_VK_XF86XK_AUDIO_REWIND","DOM_VK_XF86XK_AUDIO_STOP","DOM_VK_XF86XK_AWAY","DOM_VK_XF86XK_BACK","DOM_VK_XF86XK_BACK_FORWARD","DOM_VK_XF86XK_BATTERY","DOM_VK_XF86XK_BLUE","DOM_VK_XF86XK_BLUETOOTH","DOM_VK_XF86XK_BOOK","DOM_VK_XF86XK_BRIGHTNESS_ADJUST","DOM_VK_XF86XK_CALCULATOR","DOM_VK_XF86XK_CALENDAR","DOM_VK_XF86XK_CD","DOM_VK_XF86XK_CLOSE","DOM_VK_XF86XK_COMMUNITY","DOM_VK_XF86XK_CONTRAST_ADJUST","DOM_VK_XF86XK_COPY","DOM_VK_XF86XK_CUT","DOM_VK_XF86XK_CYCLE_ANGLE","DOM_VK_XF86XK_DISPLAY","DOM_VK_XF86XK_DOCUMENTS","DOM_VK_XF86XK_DOS","DOM_VK_XF86XK_EJECT","DOM_VK_XF86XK_EXCEL","DOM_VK_XF86XK_EXPLORER","DOM_VK_XF86XK_FAVORITES","DOM_VK_XF86XK_FINANCE","DOM_VK_XF86XK_FORWARD","DOM_VK_XF86XK_FRAME_BACK","DOM_VK_XF86XK_FRAME_FORWARD","DOM_VK_XF86XK_GAME","DOM_VK_XF86XK_GO","DOM_VK_XF86XK_GREEN","DOM_VK_XF86XK_HIBERNATE","DOM_VK_XF86XK_HISTORY","DOM_VK_XF86XK_HOME_PAGE","DOM_VK_XF86XK_HOT_LINKS","DOM_VK_XF86XK_I_TOUCH","DOM_VK_XF86XK_KBD_BRIGHTNESS_DOWN","DOM_VK_XF86XK_KBD_BRIGHTNESS_UP","DOM_VK_XF86XK_KBD_LIGHT_ON_OFF","DOM_VK_XF86XK_LAUNCH0","DOM_VK_XF86XK_LAUNCH1","DOM_VK_XF86XK_LAUNCH2","DOM_VK_XF86XK_LAUNCH3","DOM_VK_XF86XK_LAUNCH4","DOM_VK_XF86XK_LAUNCH5","DOM_VK_XF86XK_LAUNCH6","DOM_VK_XF86XK_LAUNCH7","DOM_VK_XF86XK_LAUNCH8","DOM_VK_XF86XK_LAUNCH9","DOM_VK_XF86XK_LAUNCH_A","DOM_VK_XF86XK_LAUNCH_B","DOM_VK_XF86XK_LAUNCH_C","DOM_VK_XF86XK_LAUNCH_D","DOM_VK_XF86XK_LAUNCH_E","DOM_VK_XF86XK_LAUNCH_F","DOM_VK_XF86XK_LIGHT_BULB","DOM_VK_XF86XK_LOG_OFF","DOM_VK_XF86XK_MAIL","DOM_VK_XF86XK_MAIL_FORWARD","DOM_VK_XF86XK_MARKET","DOM_VK_XF86XK_MEETING","DOM_VK_XF86XK_MEMO","DOM_VK_XF86XK_MENU_KB","DOM_VK_XF86XK_MENU_PB","DOM_VK_XF86XK_MESSENGER","DOM_VK_XF86XK_MON_BRIGHTNESS_DOWN","DOM_VK_XF86XK_MON_BRIGHTNESS_UP","DOM_VK_XF86XK_MUSIC","DOM_VK_XF86XK_MY_COMPUTER","DOM_VK_XF86XK_MY_SITES","DOM_VK_XF86XK_NEW","DOM_VK_XF86XK_NEWS","DOM_VK_XF86XK_OFFICE_HOME","DOM_VK_XF86XK_OPEN","DOM_VK_XF86XK_OPEN_URL","DOM_VK_XF86XK_OPTION","DOM_VK_XF86XK_PASTE","DOM_VK_XF86XK_PHONE","DOM_VK_XF86XK_PICTURES","DOM_VK_XF86XK_POWER_DOWN","DOM_VK_XF86XK_POWER_OFF","DOM_VK_XF86XK_RED","DOM_VK_XF86XK_REFRESH","DOM_VK_XF86XK_RELOAD","DOM_VK_XF86XK_REPLY","DOM_VK_XF86XK_ROCKER_DOWN","DOM_VK_XF86XK_ROCKER_ENTER","DOM_VK_XF86XK_ROCKER_UP","DOM_VK_XF86XK_ROTATE_WINDOWS","DOM_VK_XF86XK_ROTATION_KB","DOM_VK_XF86XK_ROTATION_PB","DOM_VK_XF86XK_SAVE","DOM_VK_XF86XK_SCREEN_SAVER","DOM_VK_XF86XK_SCROLL_CLICK","DOM_VK_XF86XK_SCROLL_DOWN","DOM_VK_XF86XK_SCROLL_UP","DOM_VK_XF86XK_SEARCH","DOM_VK_XF86XK_SEND","DOM_VK_XF86XK_SHOP","DOM_VK_XF86XK_SPELL","DOM_VK_XF86XK_SPLIT_SCREEN","DOM_VK_XF86XK_STANDBY","DOM_VK_XF86XK_START","DOM_VK_XF86XK_STOP","DOM_VK_XF86XK_SUBTITLE","DOM_VK_XF86XK_SUPPORT","DOM_VK_XF86XK_SUSPEND","DOM_VK_XF86XK_TASK_PANE","DOM_VK_XF86XK_TERMINAL","DOM_VK_XF86XK_TIME","DOM_VK_XF86XK_TOOLS","DOM_VK_XF86XK_TOP_MENU","DOM_VK_XF86XK_TO_DO_LIST","DOM_VK_XF86XK_TRAVEL","DOM_VK_XF86XK_USER1KB","DOM_VK_XF86XK_USER2KB","DOM_VK_XF86XK_USER_PB","DOM_VK_XF86XK_UWB","DOM_VK_XF86XK_VENDOR_HOME","DOM_VK_XF86XK_VIDEO","DOM_VK_XF86XK_VIEW","DOM_VK_XF86XK_WAKE_UP","DOM_VK_XF86XK_WEB_CAM","DOM_VK_XF86XK_WHEEL_BUTTON","DOM_VK_XF86XK_WLAN","DOM_VK_XF86XK_WORD","DOM_VK_XF86XK_WWW","DOM_VK_XF86XK_XFER","DOM_VK_XF86XK_YELLOW","DOM_VK_XF86XK_ZOOM_IN","DOM_VK_XF86XK_ZOOM_OUT","DOM_VK_Y","DOM_VK_Z","DOM_VK_ZOOM","DONE","DONT_CARE","DOWNLOADING","DRAGDROP","DRAW_BUFFER0","DRAW_BUFFER1","DRAW_BUFFER10","DRAW_BUFFER11","DRAW_BUFFER12","DRAW_BUFFER13","DRAW_BUFFER14","DRAW_BUFFER15","DRAW_BUFFER2","DRAW_BUFFER3","DRAW_BUFFER4","DRAW_BUFFER5","DRAW_BUFFER6","DRAW_BUFFER7","DRAW_BUFFER8","DRAW_BUFFER9","DRAW_FRAMEBUFFER","DRAW_FRAMEBUFFER_BINDING","DST_ALPHA","DST_COLOR","DYNAMIC_COPY","DYNAMIC_DRAW","DYNAMIC_READ","DataChannel","DataTransfer","DataTransferItem","DataTransferItemList","DataView","Date","DateTimeFormat","DecompressionStream","DelayNode","DeprecationReportBody","DesktopNotification","DesktopNotificationCenter","DeviceLightEvent","DeviceMotionEvent","DeviceMotionEventAcceleration","DeviceMotionEventRotationRate","DeviceOrientationEvent","DeviceProximityEvent","DeviceStorage","DeviceStorageChangeEvent","Directory","DisplayNames","Document","DocumentFragment","DocumentTimeline","DocumentType","DragEvent","DynamicsCompressorNode","E","ELEMENT_ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER_BINDING","ELEMENT_NODE","EMPTY","ENCODING_ERR","ENDED","END_TO_END","END_TO_START","ENTITY_NODE","ENTITY_REFERENCE_NODE","EPSILON","EQUAL","EQUALPOWER","ERROR","EXPONENTIAL_DISTANCE","Element","ElementInternals","ElementQuery","EnterPictureInPictureEvent","Entity","EntityReference","Error","ErrorEvent","EvalError","Event","EventException","EventSource","EventTarget","External","FASTEST","FIDOSDK","FILTER_ACCEPT","FILTER_INTERRUPT","FILTER_REJECT","FILTER_SKIP","FINISHED_STATE","FIRST_ORDERED_NODE_TYPE","FLOAT","FLOAT_32_UNSIGNED_INT_24_8_REV","FLOAT_MAT2","FLOAT_MAT2x3","FLOAT_MAT2x4","FLOAT_MAT3","FLOAT_MAT3x2","FLOAT_MAT3x4","FLOAT_MAT4","FLOAT_MAT4x2","FLOAT_MAT4x3","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","FOCUS","FONT_FACE_RULE","FONT_FEATURE_VALUES_RULE","FRAGMENT_SHADER","FRAGMENT_SHADER_DERIVATIVE_HINT","FRAGMENT_SHADER_DERIVATIVE_HINT_OES","FRAMEBUFFER","FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE","FRAMEBUFFER_ATTACHMENT_BLUE_SIZE","FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING","FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE","FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE","FRAMEBUFFER_ATTACHMENT_GREEN_SIZE","FRAMEBUFFER_ATTACHMENT_OBJECT_NAME","FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE","FRAMEBUFFER_ATTACHMENT_RED_SIZE","FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE","FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE","FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER","FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL","FRAMEBUFFER_BINDING","FRAMEBUFFER_COMPLETE","FRAMEBUFFER_DEFAULT","FRAMEBUFFER_INCOMPLETE_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_DIMENSIONS","FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_MULTISAMPLE","FRAMEBUFFER_UNSUPPORTED","FRONT","FRONT_AND_BACK","FRONT_FACE","FUNC_ADD","FUNC_REVERSE_SUBTRACT","FUNC_SUBTRACT","FeaturePolicy","FeaturePolicyViolationReportBody","FederatedCredential","Feed","FeedEntry","File","FileError","FileList","FileReader","FileSystem","FileSystemDirectoryEntry","FileSystemDirectoryReader","FileSystemEntry","FileSystemFileEntry","FinalizationRegistry","FindInPage","Float32Array","Float64Array","FocusEvent","FontFace","FontFaceSet","FontFaceSetLoadEvent","FormData","FormDataEvent","FragmentDirective","Function","GENERATE_MIPMAP_HINT","GEQUAL","GREATER","GREEN_BITS","GainNode","Gamepad","GamepadAxisMoveEvent","GamepadButton","GamepadButtonEvent","GamepadEvent","GamepadHapticActuator","GamepadPose","Geolocation","GeolocationCoordinates","GeolocationPosition","GeolocationPositionError","GestureEvent","Global","Gyroscope","HALF_FLOAT","HAVE_CURRENT_DATA","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","HAVE_METADATA","HAVE_NOTHING","HEADERS_RECEIVED","HIDDEN","HIERARCHY_REQUEST_ERR","HIGHPASS","HIGHSHELF","HIGH_FLOAT","HIGH_INT","HORIZONTAL","HORIZONTAL_AXIS","HRTF","HTMLAllCollection","HTMLAnchorElement","HTMLAppletElement","HTMLAreaElement","HTMLAudioElement","HTMLBRElement","HTMLBaseElement","HTMLBaseFontElement","HTMLBlockquoteElement","HTMLBodyElement","HTMLButtonElement","HTMLCanvasElement","HTMLCollection","HTMLCommandElement","HTMLContentElement","HTMLDListElement","HTMLDataElement","HTMLDataListElement","HTMLDetailsElement","HTMLDialogElement","HTMLDirectoryElement","HTMLDivElement","HTMLDocument","HTMLElement","HTMLEmbedElement","HTMLFieldSetElement","HTMLFontElement","HTMLFormControlsCollection","HTMLFormElement","HTMLFrameElement","HTMLFrameSetElement","HTMLHRElement","HTMLHeadElement","HTMLHeadingElement","HTMLHtmlElement","HTMLIFrameElement","HTMLImageElement","HTMLInputElement","HTMLIsIndexElement","HTMLKeygenElement","HTMLLIElement","HTMLLabelElement","HTMLLegendElement","HTMLLinkElement","HTMLMapElement","HTMLMarqueeElement","HTMLMediaElement","HTMLMenuElement","HTMLMenuItemElement","HTMLMetaElement","HTMLMeterElement","HTMLModElement","HTMLOListElement","HTMLObjectElement","HTMLOptGroupElement","HTMLOptionElement","HTMLOptionsCollection","HTMLOutputElement","HTMLParagraphElement","HTMLParamElement","HTMLPictureElement","HTMLPreElement","HTMLProgressElement","HTMLPropertiesCollection","HTMLQuoteElement","HTMLScriptElement","HTMLSelectElement","HTMLShadowElement","HTMLSlotElement","HTMLSourceElement","HTMLSpanElement","HTMLStyleElement","HTMLTableCaptionElement","HTMLTableCellElement","HTMLTableColElement","HTMLTableElement","HTMLTableRowElement","HTMLTableSectionElement","HTMLTemplateElement","HTMLTextAreaElement","HTMLTimeElement","HTMLTitleElement","HTMLTrackElement","HTMLUListElement","HTMLUnknownElement","HTMLVideoElement","HashChangeEvent","Headers","History","Hz","ICE_CHECKING","ICE_CLOSED","ICE_COMPLETED","ICE_CONNECTED","ICE_FAILED","ICE_GATHERING","ICE_WAITING","IDBCursor","IDBCursorWithValue","IDBDatabase","IDBDatabaseException","IDBFactory","IDBFileHandle","IDBFileRequest","IDBIndex","IDBKeyRange","IDBMutableFile","IDBObjectStore","IDBOpenDBRequest","IDBRequest","IDBTransaction","IDBVersionChangeEvent","IDLE","IIRFilterNode","IMPLEMENTATION_COLOR_READ_FORMAT","IMPLEMENTATION_COLOR_READ_TYPE","IMPORT_RULE","INCR","INCR_WRAP","INDEX_SIZE_ERR","INT","INTERLEAVED_ATTRIBS","INT_2_10_10_10_REV","INT_SAMPLER_2D","INT_SAMPLER_2D_ARRAY","INT_SAMPLER_3D","INT_SAMPLER_CUBE","INT_VEC2","INT_VEC3","INT_VEC4","INUSE_ATTRIBUTE_ERR","INVALID_ACCESS_ERR","INVALID_CHARACTER_ERR","INVALID_ENUM","INVALID_EXPRESSION_ERR","INVALID_FRAMEBUFFER_OPERATION","INVALID_INDEX","INVALID_MODIFICATION_ERR","INVALID_NODE_TYPE_ERR","INVALID_OPERATION","INVALID_STATE_ERR","INVALID_VALUE","INVERSE_DISTANCE","INVERT","IceCandidate","IdleDeadline","Image","ImageBitmap","ImageBitmapRenderingContext","ImageCapture","ImageData","Infinity","InputDeviceCapabilities","InputDeviceInfo","InputEvent","InputMethodContext","InstallTrigger","InstallTriggerImpl","Instance","Int16Array","Int32Array","Int8Array","Intent","InternalError","IntersectionObserver","IntersectionObserverEntry","Intl","IsSearchProviderInstalled","Iterator","JSON","KEEP","KEYDOWN","KEYFRAMES_RULE","KEYFRAME_RULE","KEYPRESS","KEYUP","KeyEvent","Keyboard","KeyboardEvent","KeyboardLayoutMap","KeyframeEffect","LENGTHADJUST_SPACING","LENGTHADJUST_SPACINGANDGLYPHS","LENGTHADJUST_UNKNOWN","LEQUAL","LESS","LINEAR","LINEAR_DISTANCE","LINEAR_MIPMAP_LINEAR","LINEAR_MIPMAP_NEAREST","LINES","LINE_LOOP","LINE_STRIP","LINE_WIDTH","LINK_STATUS","LIVE","LN10","LN2","LOADED","LOADING","LOG10E","LOG2E","LOWPASS","LOWSHELF","LOW_FLOAT","LOW_INT","LSException","LSParserFilter","LUMINANCE","LUMINANCE_ALPHA","LargestContentfulPaint","LayoutShift","LayoutShiftAttribution","LinearAccelerationSensor","LinkError","ListFormat","LocalMediaStream","Locale","Location","Lock","LockManager","MAX","MAX_3D_TEXTURE_SIZE","MAX_ARRAY_TEXTURE_LAYERS","MAX_CLIENT_WAIT_TIMEOUT_WEBGL","MAX_COLOR_ATTACHMENTS","MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_COMBINED_UNIFORM_BLOCKS","MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_DRAW_BUFFERS","MAX_ELEMENTS_INDICES","MAX_ELEMENTS_VERTICES","MAX_ELEMENT_INDEX","MAX_FRAGMENT_INPUT_COMPONENTS","MAX_FRAGMENT_UNIFORM_BLOCKS","MAX_FRAGMENT_UNIFORM_COMPONENTS","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_PROGRAM_TEXEL_OFFSET","MAX_RENDERBUFFER_SIZE","MAX_SAFE_INTEGER","MAX_SAMPLES","MAX_SERVER_WAIT_TIMEOUT","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_LOD_BIAS","MAX_TEXTURE_MAX_ANISOTROPY_EXT","MAX_TEXTURE_SIZE","MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS","MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS","MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS","MAX_UNIFORM_BLOCK_SIZE","MAX_UNIFORM_BUFFER_BINDINGS","MAX_VALUE","MAX_VARYING_COMPONENTS","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_OUTPUT_COMPONENTS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_BLOCKS","MAX_VERTEX_UNIFORM_COMPONENTS","MAX_VERTEX_UNIFORM_VECTORS","MAX_VIEWPORT_DIMS","MEDIA_ERR_ABORTED","MEDIA_ERR_DECODE","MEDIA_ERR_ENCRYPTED","MEDIA_ERR_NETWORK","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_KEYERR_CLIENT","MEDIA_KEYERR_DOMAIN","MEDIA_KEYERR_HARDWARECHANGE","MEDIA_KEYERR_OUTPUT","MEDIA_KEYERR_SERVICE","MEDIA_KEYERR_UNKNOWN","MEDIA_RULE","MEDIUM_FLOAT","MEDIUM_INT","META_MASK","MIDIAccess","MIDIConnectionEvent","MIDIInput","MIDIInputMap","MIDIMessageEvent","MIDIOutput","MIDIOutputMap","MIDIPort","MIN","MIN_PROGRAM_TEXEL_OFFSET","MIN_SAFE_INTEGER","MIN_VALUE","MIRRORED_REPEAT","MODE_ASYNCHRONOUS","MODE_SYNCHRONOUS","MODIFICATION","MOUSEDOWN","MOUSEDRAG","MOUSEMOVE","MOUSEOUT","MOUSEOVER","MOUSEUP","MOZ_KEYFRAMES_RULE","MOZ_KEYFRAME_RULE","MOZ_SOURCE_CURSOR","MOZ_SOURCE_ERASER","MOZ_SOURCE_KEYBOARD","MOZ_SOURCE_MOUSE","MOZ_SOURCE_PEN","MOZ_SOURCE_TOUCH","MOZ_SOURCE_UNKNOWN","MSGESTURE_FLAG_BEGIN","MSGESTURE_FLAG_CANCEL","MSGESTURE_FLAG_END","MSGESTURE_FLAG_INERTIA","MSGESTURE_FLAG_NONE","MSPOINTER_TYPE_MOUSE","MSPOINTER_TYPE_PEN","MSPOINTER_TYPE_TOUCH","MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE","MS_ASYNC_CALLBACK_STATUS_CANCEL","MS_ASYNC_CALLBACK_STATUS_CHOOSEANY","MS_ASYNC_CALLBACK_STATUS_ERROR","MS_ASYNC_CALLBACK_STATUS_JOIN","MS_ASYNC_OP_STATUS_CANCELED","MS_ASYNC_OP_STATUS_ERROR","MS_ASYNC_OP_STATUS_SUCCESS","MS_MANIPULATION_STATE_ACTIVE","MS_MANIPULATION_STATE_CANCELLED","MS_MANIPULATION_STATE_COMMITTED","MS_MANIPULATION_STATE_DRAGGING","MS_MANIPULATION_STATE_INERTIA","MS_MANIPULATION_STATE_PRESELECT","MS_MANIPULATION_STATE_SELECTING","MS_MANIPULATION_STATE_STOPPED","MS_MEDIA_ERR_ENCRYPTED","MS_MEDIA_KEYERR_CLIENT","MS_MEDIA_KEYERR_DOMAIN","MS_MEDIA_KEYERR_HARDWARECHANGE","MS_MEDIA_KEYERR_OUTPUT","MS_MEDIA_KEYERR_SERVICE","MS_MEDIA_KEYERR_UNKNOWN","Map","Math","MathMLElement","MediaCapabilities","MediaCapabilitiesInfo","MediaController","MediaDeviceInfo","MediaDevices","MediaElementAudioSourceNode","MediaEncryptedEvent","MediaError","MediaKeyError","MediaKeyEvent","MediaKeyMessageEvent","MediaKeyNeededEvent","MediaKeySession","MediaKeyStatusMap","MediaKeySystemAccess","MediaKeys","MediaList","MediaMetadata","MediaQueryList","MediaQueryListEvent","MediaRecorder","MediaRecorderErrorEvent","MediaSession","MediaSettingsRange","MediaSource","MediaStream","MediaStreamAudioDestinationNode","MediaStreamAudioSourceNode","MediaStreamEvent","MediaStreamTrack","MediaStreamTrackAudioSourceNode","MediaStreamTrackEvent","Memory","MessageChannel","MessageEvent","MessagePort","Methods","MimeType","MimeTypeArray","Module","MouseEvent","MouseScrollEvent","MozAnimation","MozAnimationDelay","MozAnimationDirection","MozAnimationDuration","MozAnimationFillMode","MozAnimationIterationCount","MozAnimationName","MozAnimationPlayState","MozAnimationTimingFunction","MozAppearance","MozBackfaceVisibility","MozBinding","MozBorderBottomColors","MozBorderEnd","MozBorderEndColor","MozBorderEndStyle","MozBorderEndWidth","MozBorderImage","MozBorderLeftColors","MozBorderRightColors","MozBorderStart","MozBorderStartColor","MozBorderStartStyle","MozBorderStartWidth","MozBorderTopColors","MozBoxAlign","MozBoxDirection","MozBoxFlex","MozBoxOrdinalGroup","MozBoxOrient","MozBoxPack","MozBoxSizing","MozCSSKeyframeRule","MozCSSKeyframesRule","MozColumnCount","MozColumnFill","MozColumnGap","MozColumnRule","MozColumnRuleColor","MozColumnRuleStyle","MozColumnRuleWidth","MozColumnWidth","MozColumns","MozContactChangeEvent","MozFloatEdge","MozFontFeatureSettings","MozFontLanguageOverride","MozForceBrokenImageIcon","MozHyphens","MozImageRegion","MozMarginEnd","MozMarginStart","MozMmsEvent","MozMmsMessage","MozMobileMessageThread","MozOSXFontSmoothing","MozOrient","MozOsxFontSmoothing","MozOutlineRadius","MozOutlineRadiusBottomleft","MozOutlineRadiusBottomright","MozOutlineRadiusTopleft","MozOutlineRadiusTopright","MozPaddingEnd","MozPaddingStart","MozPerspective","MozPerspectiveOrigin","MozPowerManager","MozSettingsEvent","MozSmsEvent","MozSmsMessage","MozStackSizing","MozTabSize","MozTextAlignLast","MozTextDecorationColor","MozTextDecorationLine","MozTextDecorationStyle","MozTextSizeAdjust","MozTransform","MozTransformOrigin","MozTransformStyle","MozTransition","MozTransitionDelay","MozTransitionDuration","MozTransitionProperty","MozTransitionTimingFunction","MozUserFocus","MozUserInput","MozUserModify","MozUserSelect","MozWindowDragging","MozWindowShadow","MutationEvent","MutationObserver","MutationRecord","NAMESPACE_ERR","NAMESPACE_RULE","NEAREST","NEAREST_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","NEGATIVE_INFINITY","NETWORK_EMPTY","NETWORK_ERR","NETWORK_IDLE","NETWORK_LOADED","NETWORK_LOADING","NETWORK_NO_SOURCE","NEVER","NEW","NEXT","NEXT_NO_DUPLICATE","NICEST","NODE_AFTER","NODE_BEFORE","NODE_BEFORE_AND_AFTER","NODE_INSIDE","NONE","NON_TRANSIENT_ERR","NOTATION_NODE","NOTCH","NOTEQUAL","NOT_ALLOWED_ERR","NOT_FOUND_ERR","NOT_READABLE_ERR","NOT_SUPPORTED_ERR","NO_DATA_ALLOWED_ERR","NO_ERR","NO_ERROR","NO_MODIFICATION_ALLOWED_ERR","NUMBER_TYPE","NUM_COMPRESSED_TEXTURE_FORMATS","NaN","NamedNodeMap","NavigationPreloadManager","Navigator","NearbyLinks","NetworkInformation","Node","NodeFilter","NodeIterator","NodeList","Notation","Notification","NotifyPaintEvent","Number","NumberFormat","OBJECT_TYPE","OBSOLETE","OK","ONE","ONE_MINUS_CONSTANT_ALPHA","ONE_MINUS_CONSTANT_COLOR","ONE_MINUS_DST_ALPHA","ONE_MINUS_DST_COLOR","ONE_MINUS_SRC_ALPHA","ONE_MINUS_SRC_COLOR","OPEN","OPENED","OPENING","ORDERED_NODE_ITERATOR_TYPE","ORDERED_NODE_SNAPSHOT_TYPE","OTHER_ERROR","OUT_OF_MEMORY","Object","OfflineAudioCompletionEvent","OfflineAudioContext","OfflineResourceList","OffscreenCanvas","OffscreenCanvasRenderingContext2D","Option","OrientationSensor","OscillatorNode","OverconstrainedError","OverflowEvent","PACK_ALIGNMENT","PACK_ROW_LENGTH","PACK_SKIP_PIXELS","PACK_SKIP_ROWS","PAGE_RULE","PARSE_ERR","PATHSEG_ARC_ABS","PATHSEG_ARC_REL","PATHSEG_CLOSEPATH","PATHSEG_CURVETO_CUBIC_ABS","PATHSEG_CURVETO_CUBIC_REL","PATHSEG_CURVETO_CUBIC_SMOOTH_ABS","PATHSEG_CURVETO_CUBIC_SMOOTH_REL","PATHSEG_CURVETO_QUADRATIC_ABS","PATHSEG_CURVETO_QUADRATIC_REL","PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS","PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL","PATHSEG_LINETO_ABS","PATHSEG_LINETO_HORIZONTAL_ABS","PATHSEG_LINETO_HORIZONTAL_REL","PATHSEG_LINETO_REL","PATHSEG_LINETO_VERTICAL_ABS","PATHSEG_LINETO_VERTICAL_REL","PATHSEG_MOVETO_ABS","PATHSEG_MOVETO_REL","PATHSEG_UNKNOWN","PATH_EXISTS_ERR","PEAKING","PERMISSION_DENIED","PERSISTENT","PI","PIXEL_PACK_BUFFER","PIXEL_PACK_BUFFER_BINDING","PIXEL_UNPACK_BUFFER","PIXEL_UNPACK_BUFFER_BINDING","PLAYING_STATE","POINTS","POLYGON_OFFSET_FACTOR","POLYGON_OFFSET_FILL","POLYGON_OFFSET_UNITS","POSITION_UNAVAILABLE","POSITIVE_INFINITY","PREV","PREV_NO_DUPLICATE","PROCESSING_INSTRUCTION_NODE","PageChangeEvent","PageTransitionEvent","PaintRequest","PaintRequestList","PannerNode","PasswordCredential","Path2D","PaymentAddress","PaymentInstruments","PaymentManager","PaymentMethodChangeEvent","PaymentRequest","PaymentRequestUpdateEvent","PaymentResponse","Performance","PerformanceElementTiming","PerformanceEntry","PerformanceEventTiming","PerformanceLongTaskTiming","PerformanceMark","PerformanceMeasure","PerformanceNavigation","PerformanceNavigationTiming","PerformanceObserver","PerformanceObserverEntryList","PerformancePaintTiming","PerformanceResourceTiming","PerformanceServerTiming","PerformanceTiming","PeriodicSyncManager","PeriodicWave","PermissionStatus","Permissions","PhotoCapabilities","PictureInPictureWindow","Plugin","PluginArray","PluralRules","PointerEvent","PopStateEvent","PopupBlockedEvent","Presentation","PresentationAvailability","PresentationConnection","PresentationConnectionAvailableEvent","PresentationConnectionCloseEvent","PresentationConnectionList","PresentationReceiver","PresentationRequest","ProcessingInstruction","ProgressEvent","Promise","PromiseRejectionEvent","PropertyNodeList","Proxy","PublicKeyCredential","PushManager","PushSubscription","PushSubscriptionOptions","Q","QUERY_RESULT","QUERY_RESULT_AVAILABLE","QUOTA_ERR","QUOTA_EXCEEDED_ERR","QueryInterface","R11F_G11F_B10F","R16F","R16I","R16UI","R32F","R32I","R32UI","R8","R8I","R8UI","R8_SNORM","RASTERIZER_DISCARD","READ_BUFFER","READ_FRAMEBUFFER","READ_FRAMEBUFFER_BINDING","READ_ONLY","READ_ONLY_ERR","READ_WRITE","RED","RED_BITS","RED_INTEGER","REMOVAL","RENDERBUFFER","RENDERBUFFER_ALPHA_SIZE","RENDERBUFFER_BINDING","RENDERBUFFER_BLUE_SIZE","RENDERBUFFER_DEPTH_SIZE","RENDERBUFFER_GREEN_SIZE","RENDERBUFFER_HEIGHT","RENDERBUFFER_INTERNAL_FORMAT","RENDERBUFFER_RED_SIZE","RENDERBUFFER_SAMPLES","RENDERBUFFER_STENCIL_SIZE","RENDERBUFFER_WIDTH","RENDERER","RENDERING_INTENT_ABSOLUTE_COLORIMETRIC","RENDERING_INTENT_AUTO","RENDERING_INTENT_PERCEPTUAL","RENDERING_INTENT_RELATIVE_COLORIMETRIC","RENDERING_INTENT_SATURATION","RENDERING_INTENT_UNKNOWN","REPEAT","REPLACE","RG","RG16F","RG16I","RG16UI","RG32F","RG32I","RG32UI","RG8","RG8I","RG8UI","RG8_SNORM","RGB","RGB10_A2","RGB10_A2UI","RGB16F","RGB16I","RGB16UI","RGB32F","RGB32I","RGB32UI","RGB565","RGB5_A1","RGB8","RGB8I","RGB8UI","RGB8_SNORM","RGB9_E5","RGBA","RGBA16F","RGBA16I","RGBA16UI","RGBA32F","RGBA32I","RGBA32UI","RGBA4","RGBA8","RGBA8I","RGBA8UI","RGBA8_SNORM","RGBA_INTEGER","RGBColor","RGB_INTEGER","RG_INTEGER","ROTATION_CLOCKWISE","ROTATION_COUNTERCLOCKWISE","RTCCertificate","RTCDTMFSender","RTCDTMFToneChangeEvent","RTCDataChannel","RTCDataChannelEvent","RTCDtlsTransport","RTCError","RTCErrorEvent","RTCIceCandidate","RTCIceTransport","RTCPeerConnection","RTCPeerConnectionIceErrorEvent","RTCPeerConnectionIceEvent","RTCRtpReceiver","RTCRtpSender","RTCRtpTransceiver","RTCSctpTransport","RTCSessionDescription","RTCStatsReport","RTCTrackEvent","RadioNodeList","Range","RangeError","RangeException","ReadableStream","ReadableStreamDefaultReader","RecordErrorEvent","Rect","ReferenceError","Reflect","RegExp","RelativeOrientationSensor","RelativeTimeFormat","RemotePlayback","Report","ReportBody","ReportingObserver","Request","ResizeObserver","ResizeObserverEntry","ResizeObserverSize","Response","RuntimeError","SAMPLER_2D","SAMPLER_2D_ARRAY","SAMPLER_2D_ARRAY_SHADOW","SAMPLER_2D_SHADOW","SAMPLER_3D","SAMPLER_BINDING","SAMPLER_CUBE","SAMPLER_CUBE_SHADOW","SAMPLES","SAMPLE_ALPHA_TO_COVERAGE","SAMPLE_BUFFERS","SAMPLE_COVERAGE","SAMPLE_COVERAGE_INVERT","SAMPLE_COVERAGE_VALUE","SAWTOOTH","SCHEDULED_STATE","SCISSOR_BOX","SCISSOR_TEST","SCROLL_PAGE_DOWN","SCROLL_PAGE_UP","SDP_ANSWER","SDP_OFFER","SDP_PRANSWER","SECURITY_ERR","SELECT","SEPARATE_ATTRIBS","SERIALIZE_ERR","SEVERITY_ERROR","SEVERITY_FATAL_ERROR","SEVERITY_WARNING","SHADER_COMPILER","SHADER_TYPE","SHADING_LANGUAGE_VERSION","SHIFT_MASK","SHORT","SHOWING","SHOW_ALL","SHOW_ATTRIBUTE","SHOW_CDATA_SECTION","SHOW_COMMENT","SHOW_DOCUMENT","SHOW_DOCUMENT_FRAGMENT","SHOW_DOCUMENT_TYPE","SHOW_ELEMENT","SHOW_ENTITY","SHOW_ENTITY_REFERENCE","SHOW_NOTATION","SHOW_PROCESSING_INSTRUCTION","SHOW_TEXT","SIGNALED","SIGNED_NORMALIZED","SINE","SOUNDFIELD","SQLException","SQRT1_2","SQRT2","SQUARE","SRC_ALPHA","SRC_ALPHA_SATURATE","SRC_COLOR","SRGB","SRGB8","SRGB8_ALPHA8","START_TO_END","START_TO_START","STATIC_COPY","STATIC_DRAW","STATIC_READ","STENCIL","STENCIL_ATTACHMENT","STENCIL_BACK_FAIL","STENCIL_BACK_FUNC","STENCIL_BACK_PASS_DEPTH_FAIL","STENCIL_BACK_PASS_DEPTH_PASS","STENCIL_BACK_REF","STENCIL_BACK_VALUE_MASK","STENCIL_BACK_WRITEMASK","STENCIL_BITS","STENCIL_BUFFER_BIT","STENCIL_CLEAR_VALUE","STENCIL_FAIL","STENCIL_FUNC","STENCIL_INDEX","STENCIL_INDEX8","STENCIL_PASS_DEPTH_FAIL","STENCIL_PASS_DEPTH_PASS","STENCIL_REF","STENCIL_TEST","STENCIL_VALUE_MASK","STENCIL_WRITEMASK","STREAM_COPY","STREAM_DRAW","STREAM_READ","STRING_TYPE","STYLE_RULE","SUBPIXEL_BITS","SUPPORTS_RULE","SVGAElement","SVGAltGlyphDefElement","SVGAltGlyphElement","SVGAltGlyphItemElement","SVGAngle","SVGAnimateColorElement","SVGAnimateElement","SVGAnimateMotionElement","SVGAnimateTransformElement","SVGAnimatedAngle","SVGAnimatedBoolean","SVGAnimatedEnumeration","SVGAnimatedInteger","SVGAnimatedLength","SVGAnimatedLengthList","SVGAnimatedNumber","SVGAnimatedNumberList","SVGAnimatedPreserveAspectRatio","SVGAnimatedRect","SVGAnimatedString","SVGAnimatedTransformList","SVGAnimationElement","SVGCircleElement","SVGClipPathElement","SVGColor","SVGComponentTransferFunctionElement","SVGCursorElement","SVGDefsElement","SVGDescElement","SVGDiscardElement","SVGDocument","SVGElement","SVGElementInstance","SVGElementInstanceList","SVGEllipseElement","SVGException","SVGFEBlendElement","SVGFEColorMatrixElement","SVGFEComponentTransferElement","SVGFECompositeElement","SVGFEConvolveMatrixElement","SVGFEDiffuseLightingElement","SVGFEDisplacementMapElement","SVGFEDistantLightElement","SVGFEDropShadowElement","SVGFEFloodElement","SVGFEFuncAElement","SVGFEFuncBElement","SVGFEFuncGElement","SVGFEFuncRElement","SVGFEGaussianBlurElement","SVGFEImageElement","SVGFEMergeElement","SVGFEMergeNodeElement","SVGFEMorphologyElement","SVGFEOffsetElement","SVGFEPointLightElement","SVGFESpecularLightingElement","SVGFESpotLightElement","SVGFETileElement","SVGFETurbulenceElement","SVGFilterElement","SVGFontElement","SVGFontFaceElement","SVGFontFaceFormatElement","SVGFontFaceNameElement","SVGFontFaceSrcElement","SVGFontFaceUriElement","SVGForeignObjectElement","SVGGElement","SVGGeometryElement","SVGGlyphElement","SVGGlyphRefElement","SVGGradientElement","SVGGraphicsElement","SVGHKernElement","SVGImageElement","SVGLength","SVGLengthList","SVGLineElement","SVGLinearGradientElement","SVGMPathElement","SVGMarkerElement","SVGMaskElement","SVGMatrix","SVGMetadataElement","SVGMissingGlyphElement","SVGNumber","SVGNumberList","SVGPaint","SVGPathElement","SVGPathSeg","SVGPathSegArcAbs","SVGPathSegArcRel","SVGPathSegClosePath","SVGPathSegCurvetoCubicAbs","SVGPathSegCurvetoCubicRel","SVGPathSegCurvetoCubicSmoothAbs","SVGPathSegCurvetoCubicSmoothRel","SVGPathSegCurvetoQuadraticAbs","SVGPathSegCurvetoQuadraticRel","SVGPathSegCurvetoQuadraticSmoothAbs","SVGPathSegCurvetoQuadraticSmoothRel","SVGPathSegLinetoAbs","SVGPathSegLinetoHorizontalAbs","SVGPathSegLinetoHorizontalRel","SVGPathSegLinetoRel","SVGPathSegLinetoVerticalAbs","SVGPathSegLinetoVerticalRel","SVGPathSegList","SVGPathSegMovetoAbs","SVGPathSegMovetoRel","SVGPatternElement","SVGPoint","SVGPointList","SVGPolygonElement","SVGPolylineElement","SVGPreserveAspectRatio","SVGRadialGradientElement","SVGRect","SVGRectElement","SVGRenderingIntent","SVGSVGElement","SVGScriptElement","SVGSetElement","SVGStopElement","SVGStringList","SVGStyleElement","SVGSwitchElement","SVGSymbolElement","SVGTRefElement","SVGTSpanElement","SVGTextContentElement","SVGTextElement","SVGTextPathElement","SVGTextPositioningElement","SVGTitleElement","SVGTransform","SVGTransformList","SVGUnitTypes","SVGUseElement","SVGVKernElement","SVGViewElement","SVGViewSpec","SVGZoomAndPan","SVGZoomEvent","SVG_ANGLETYPE_DEG","SVG_ANGLETYPE_GRAD","SVG_ANGLETYPE_RAD","SVG_ANGLETYPE_UNKNOWN","SVG_ANGLETYPE_UNSPECIFIED","SVG_CHANNEL_A","SVG_CHANNEL_B","SVG_CHANNEL_G","SVG_CHANNEL_R","SVG_CHANNEL_UNKNOWN","SVG_COLORTYPE_CURRENTCOLOR","SVG_COLORTYPE_RGBCOLOR","SVG_COLORTYPE_RGBCOLOR_ICCCOLOR","SVG_COLORTYPE_UNKNOWN","SVG_EDGEMODE_DUPLICATE","SVG_EDGEMODE_NONE","SVG_EDGEMODE_UNKNOWN","SVG_EDGEMODE_WRAP","SVG_FEBLEND_MODE_COLOR","SVG_FEBLEND_MODE_COLOR_BURN","SVG_FEBLEND_MODE_COLOR_DODGE","SVG_FEBLEND_MODE_DARKEN","SVG_FEBLEND_MODE_DIFFERENCE","SVG_FEBLEND_MODE_EXCLUSION","SVG_FEBLEND_MODE_HARD_LIGHT","SVG_FEBLEND_MODE_HUE","SVG_FEBLEND_MODE_LIGHTEN","SVG_FEBLEND_MODE_LUMINOSITY","SVG_FEBLEND_MODE_MULTIPLY","SVG_FEBLEND_MODE_NORMAL","SVG_FEBLEND_MODE_OVERLAY","SVG_FEBLEND_MODE_SATURATION","SVG_FEBLEND_MODE_SCREEN","SVG_FEBLEND_MODE_SOFT_LIGHT","SVG_FEBLEND_MODE_UNKNOWN","SVG_FECOLORMATRIX_TYPE_HUEROTATE","SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA","SVG_FECOLORMATRIX_TYPE_MATRIX","SVG_FECOLORMATRIX_TYPE_SATURATE","SVG_FECOLORMATRIX_TYPE_UNKNOWN","SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE","SVG_FECOMPONENTTRANSFER_TYPE_GAMMA","SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY","SVG_FECOMPONENTTRANSFER_TYPE_LINEAR","SVG_FECOMPONENTTRANSFER_TYPE_TABLE","SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN","SVG_FECOMPOSITE_OPERATOR_ARITHMETIC","SVG_FECOMPOSITE_OPERATOR_ATOP","SVG_FECOMPOSITE_OPERATOR_IN","SVG_FECOMPOSITE_OPERATOR_OUT","SVG_FECOMPOSITE_OPERATOR_OVER","SVG_FECOMPOSITE_OPERATOR_UNKNOWN","SVG_FECOMPOSITE_OPERATOR_XOR","SVG_INVALID_VALUE_ERR","SVG_LENGTHTYPE_CM","SVG_LENGTHTYPE_EMS","SVG_LENGTHTYPE_EXS","SVG_LENGTHTYPE_IN","SVG_LENGTHTYPE_MM","SVG_LENGTHTYPE_NUMBER","SVG_LENGTHTYPE_PC","SVG_LENGTHTYPE_PERCENTAGE","SVG_LENGTHTYPE_PT","SVG_LENGTHTYPE_PX","SVG_LENGTHTYPE_UNKNOWN","SVG_MARKERUNITS_STROKEWIDTH","SVG_MARKERUNITS_UNKNOWN","SVG_MARKERUNITS_USERSPACEONUSE","SVG_MARKER_ORIENT_ANGLE","SVG_MARKER_ORIENT_AUTO","SVG_MARKER_ORIENT_UNKNOWN","SVG_MASKTYPE_ALPHA","SVG_MASKTYPE_LUMINANCE","SVG_MATRIX_NOT_INVERTABLE","SVG_MEETORSLICE_MEET","SVG_MEETORSLICE_SLICE","SVG_MEETORSLICE_UNKNOWN","SVG_MORPHOLOGY_OPERATOR_DILATE","SVG_MORPHOLOGY_OPERATOR_ERODE","SVG_MORPHOLOGY_OPERATOR_UNKNOWN","SVG_PAINTTYPE_CURRENTCOLOR","SVG_PAINTTYPE_NONE","SVG_PAINTTYPE_RGBCOLOR","SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR","SVG_PAINTTYPE_UNKNOWN","SVG_PAINTTYPE_URI","SVG_PAINTTYPE_URI_CURRENTCOLOR","SVG_PAINTTYPE_URI_NONE","SVG_PAINTTYPE_URI_RGBCOLOR","SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR","SVG_PRESERVEASPECTRATIO_NONE","SVG_PRESERVEASPECTRATIO_UNKNOWN","SVG_PRESERVEASPECTRATIO_XMAXYMAX","SVG_PRESERVEASPECTRATIO_XMAXYMID","SVG_PRESERVEASPECTRATIO_XMAXYMIN","SVG_PRESERVEASPECTRATIO_XMIDYMAX","SVG_PRESERVEASPECTRATIO_XMIDYMID","SVG_PRESERVEASPECTRATIO_XMIDYMIN","SVG_PRESERVEASPECTRATIO_XMINYMAX","SVG_PRESERVEASPECTRATIO_XMINYMID","SVG_PRESERVEASPECTRATIO_XMINYMIN","SVG_SPREADMETHOD_PAD","SVG_SPREADMETHOD_REFLECT","SVG_SPREADMETHOD_REPEAT","SVG_SPREADMETHOD_UNKNOWN","SVG_STITCHTYPE_NOSTITCH","SVG_STITCHTYPE_STITCH","SVG_STITCHTYPE_UNKNOWN","SVG_TRANSFORM_MATRIX","SVG_TRANSFORM_ROTATE","SVG_TRANSFORM_SCALE","SVG_TRANSFORM_SKEWX","SVG_TRANSFORM_SKEWY","SVG_TRANSFORM_TRANSLATE","SVG_TRANSFORM_UNKNOWN","SVG_TURBULENCE_TYPE_FRACTALNOISE","SVG_TURBULENCE_TYPE_TURBULENCE","SVG_TURBULENCE_TYPE_UNKNOWN","SVG_UNIT_TYPE_OBJECTBOUNDINGBOX","SVG_UNIT_TYPE_UNKNOWN","SVG_UNIT_TYPE_USERSPACEONUSE","SVG_WRONG_TYPE_ERR","SVG_ZOOMANDPAN_DISABLE","SVG_ZOOMANDPAN_MAGNIFY","SVG_ZOOMANDPAN_UNKNOWN","SYNC_CONDITION","SYNC_FENCE","SYNC_FLAGS","SYNC_FLUSH_COMMANDS_BIT","SYNC_GPU_COMMANDS_COMPLETE","SYNC_STATUS","SYNTAX_ERR","SavedPages","Screen","ScreenOrientation","Script","ScriptProcessorNode","ScrollAreaEvent","SecurityPolicyViolationEvent","Selection","Sensor","SensorErrorEvent","ServiceWorker","ServiceWorkerContainer","ServiceWorkerRegistration","SessionDescription","Set","ShadowRoot","SharedArrayBuffer","SharedWorker","SimpleGestureEvent","SourceBuffer","SourceBufferList","SpeechSynthesis","SpeechSynthesisErrorEvent","SpeechSynthesisEvent","SpeechSynthesisUtterance","SpeechSynthesisVoice","StaticRange","StereoPannerNode","StopIteration","Storage","StorageEvent","StorageManager","String","StructType","StylePropertyMap","StylePropertyMapReadOnly","StyleSheet","StyleSheetList","SubmitEvent","SubtleCrypto","Symbol","SyncManager","SyntaxError","TEMPORARY","TEXTPATH_METHODTYPE_ALIGN","TEXTPATH_METHODTYPE_STRETCH","TEXTPATH_METHODTYPE_UNKNOWN","TEXTPATH_SPACINGTYPE_AUTO","TEXTPATH_SPACINGTYPE_EXACT","TEXTPATH_SPACINGTYPE_UNKNOWN","TEXTURE","TEXTURE0","TEXTURE1","TEXTURE10","TEXTURE11","TEXTURE12","TEXTURE13","TEXTURE14","TEXTURE15","TEXTURE16","TEXTURE17","TEXTURE18","TEXTURE19","TEXTURE2","TEXTURE20","TEXTURE21","TEXTURE22","TEXTURE23","TEXTURE24","TEXTURE25","TEXTURE26","TEXTURE27","TEXTURE28","TEXTURE29","TEXTURE3","TEXTURE30","TEXTURE31","TEXTURE4","TEXTURE5","TEXTURE6","TEXTURE7","TEXTURE8","TEXTURE9","TEXTURE_2D","TEXTURE_2D_ARRAY","TEXTURE_3D","TEXTURE_BASE_LEVEL","TEXTURE_BINDING_2D","TEXTURE_BINDING_2D_ARRAY","TEXTURE_BINDING_3D","TEXTURE_BINDING_CUBE_MAP","TEXTURE_COMPARE_FUNC","TEXTURE_COMPARE_MODE","TEXTURE_CUBE_MAP","TEXTURE_CUBE_MAP_NEGATIVE_X","TEXTURE_CUBE_MAP_NEGATIVE_Y","TEXTURE_CUBE_MAP_NEGATIVE_Z","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP_POSITIVE_Y","TEXTURE_CUBE_MAP_POSITIVE_Z","TEXTURE_IMMUTABLE_FORMAT","TEXTURE_IMMUTABLE_LEVELS","TEXTURE_MAG_FILTER","TEXTURE_MAX_ANISOTROPY_EXT","TEXTURE_MAX_LEVEL","TEXTURE_MAX_LOD","TEXTURE_MIN_FILTER","TEXTURE_MIN_LOD","TEXTURE_WRAP_R","TEXTURE_WRAP_S","TEXTURE_WRAP_T","TEXT_NODE","TIMEOUT","TIMEOUT_ERR","TIMEOUT_EXPIRED","TIMEOUT_IGNORED","TOO_LARGE_ERR","TRANSACTION_INACTIVE_ERR","TRANSFORM_FEEDBACK","TRANSFORM_FEEDBACK_ACTIVE","TRANSFORM_FEEDBACK_BINDING","TRANSFORM_FEEDBACK_BUFFER","TRANSFORM_FEEDBACK_BUFFER_BINDING","TRANSFORM_FEEDBACK_BUFFER_MODE","TRANSFORM_FEEDBACK_BUFFER_SIZE","TRANSFORM_FEEDBACK_BUFFER_START","TRANSFORM_FEEDBACK_PAUSED","TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN","TRANSFORM_FEEDBACK_VARYINGS","TRIANGLE","TRIANGLES","TRIANGLE_FAN","TRIANGLE_STRIP","TYPE_BACK_FORWARD","TYPE_ERR","TYPE_MISMATCH_ERR","TYPE_NAVIGATE","TYPE_RELOAD","TYPE_RESERVED","Table","TaskAttributionTiming","Text","TextDecoder","TextDecoderStream","TextEncoder","TextEncoderStream","TextEvent","TextMetrics","TextTrack","TextTrackCue","TextTrackCueList","TextTrackList","TimeEvent","TimeRanges","Touch","TouchEvent","TouchList","TrackEvent","TransformStream","TransitionEvent","TreeWalker","TrustedHTML","TrustedScript","TrustedScriptURL","TrustedTypePolicy","TrustedTypePolicyFactory","TypeError","TypedObject","U2F","UIEvent","UNCACHED","UNIFORM_ARRAY_STRIDE","UNIFORM_BLOCK_ACTIVE_UNIFORMS","UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES","UNIFORM_BLOCK_BINDING","UNIFORM_BLOCK_DATA_SIZE","UNIFORM_BLOCK_INDEX","UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER","UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER","UNIFORM_BUFFER","UNIFORM_BUFFER_BINDING","UNIFORM_BUFFER_OFFSET_ALIGNMENT","UNIFORM_BUFFER_SIZE","UNIFORM_BUFFER_START","UNIFORM_IS_ROW_MAJOR","UNIFORM_MATRIX_STRIDE","UNIFORM_OFFSET","UNIFORM_SIZE","UNIFORM_TYPE","UNKNOWN_ERR","UNKNOWN_RULE","UNMASKED_RENDERER_WEBGL","UNMASKED_VENDOR_WEBGL","UNORDERED_NODE_ITERATOR_TYPE","UNORDERED_NODE_SNAPSHOT_TYPE","UNPACK_ALIGNMENT","UNPACK_COLORSPACE_CONVERSION_WEBGL","UNPACK_FLIP_Y_WEBGL","UNPACK_IMAGE_HEIGHT","UNPACK_PREMULTIPLY_ALPHA_WEBGL","UNPACK_ROW_LENGTH","UNPACK_SKIP_IMAGES","UNPACK_SKIP_PIXELS","UNPACK_SKIP_ROWS","UNSCHEDULED_STATE","UNSENT","UNSIGNALED","UNSIGNED_BYTE","UNSIGNED_INT","UNSIGNED_INT_10F_11F_11F_REV","UNSIGNED_INT_24_8","UNSIGNED_INT_2_10_10_10_REV","UNSIGNED_INT_5_9_9_9_REV","UNSIGNED_INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_3D","UNSIGNED_INT_SAMPLER_CUBE","UNSIGNED_INT_VEC2","UNSIGNED_INT_VEC3","UNSIGNED_INT_VEC4","UNSIGNED_NORMALIZED","UNSIGNED_SHORT","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","UNSIGNED_SHORT_5_6_5","UNSPECIFIED_EVENT_TYPE_ERR","UPDATEREADY","URIError","URL","URLSearchParams","URLUnencoded","URL_MISMATCH_ERR","USB","USBAlternateInterface","USBConfiguration","USBConnectionEvent","USBDevice","USBEndpoint","USBInTransferResult","USBInterface","USBIsochronousInTransferPacket","USBIsochronousInTransferResult","USBIsochronousOutTransferPacket","USBIsochronousOutTransferResult","USBOutTransferResult","UTC","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","UserActivation","UserMessageHandler","UserMessageHandlersNamespace","UserProximityEvent","VALIDATE_STATUS","VALIDATION_ERR","VARIABLES_RULE","VENDOR","VERSION","VERSION_CHANGE","VERSION_ERR","VERTEX_ARRAY_BINDING","VERTEX_ATTRIB_ARRAY_BUFFER_BINDING","VERTEX_ATTRIB_ARRAY_DIVISOR","VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE","VERTEX_ATTRIB_ARRAY_ENABLED","VERTEX_ATTRIB_ARRAY_INTEGER","VERTEX_ATTRIB_ARRAY_NORMALIZED","VERTEX_ATTRIB_ARRAY_POINTER","VERTEX_ATTRIB_ARRAY_SIZE","VERTEX_ATTRIB_ARRAY_STRIDE","VERTEX_ATTRIB_ARRAY_TYPE","VERTEX_SHADER","VERTICAL","VERTICAL_AXIS","VER_ERR","VIEWPORT","VIEWPORT_RULE","VRDisplay","VRDisplayCapabilities","VRDisplayEvent","VREyeParameters","VRFieldOfView","VRFrameData","VRPose","VRStageParameters","VTTCue","VTTRegion","ValidityState","VideoPlaybackQuality","VideoStreamTrack","VisualViewport","WAIT_FAILED","WEBKIT_FILTER_RULE","WEBKIT_KEYFRAMES_RULE","WEBKIT_KEYFRAME_RULE","WEBKIT_REGION_RULE","WRONG_DOCUMENT_ERR","WakeLock","WakeLockSentinel","WasmAnyRef","WaveShaperNode","WeakMap","WeakRef","WeakSet","WebAssembly","WebGL2RenderingContext","WebGLActiveInfo","WebGLBuffer","WebGLContextEvent","WebGLFramebuffer","WebGLProgram","WebGLQuery","WebGLRenderbuffer","WebGLRenderingContext","WebGLSampler","WebGLShader","WebGLShaderPrecisionFormat","WebGLSync","WebGLTexture","WebGLTransformFeedback","WebGLUniformLocation","WebGLVertexArray","WebGLVertexArrayObject","WebKitAnimationEvent","WebKitBlobBuilder","WebKitCSSFilterRule","WebKitCSSFilterValue","WebKitCSSKeyframeRule","WebKitCSSKeyframesRule","WebKitCSSMatrix","WebKitCSSRegionRule","WebKitCSSTransformValue","WebKitDataCue","WebKitGamepad","WebKitMediaKeyError","WebKitMediaKeyMessageEvent","WebKitMediaKeySession","WebKitMediaKeys","WebKitMediaSource","WebKitMutationObserver","WebKitNamespace","WebKitPlaybackTargetAvailabilityEvent","WebKitPoint","WebKitShadowRoot","WebKitSourceBuffer","WebKitSourceBufferList","WebKitTransitionEvent","WebSocket","WebkitAlignContent","WebkitAlignItems","WebkitAlignSelf","WebkitAnimation","WebkitAnimationDelay","WebkitAnimationDirection","WebkitAnimationDuration","WebkitAnimationFillMode","WebkitAnimationIterationCount","WebkitAnimationName","WebkitAnimationPlayState","WebkitAnimationTimingFunction","WebkitAppearance","WebkitBackfaceVisibility","WebkitBackgroundClip","WebkitBackgroundOrigin","WebkitBackgroundSize","WebkitBorderBottomLeftRadius","WebkitBorderBottomRightRadius","WebkitBorderImage","WebkitBorderRadius","WebkitBorderTopLeftRadius","WebkitBorderTopRightRadius","WebkitBoxAlign","WebkitBoxDirection","WebkitBoxFlex","WebkitBoxOrdinalGroup","WebkitBoxOrient","WebkitBoxPack","WebkitBoxShadow","WebkitBoxSizing","WebkitFilter","WebkitFlex","WebkitFlexBasis","WebkitFlexDirection","WebkitFlexFlow","WebkitFlexGrow","WebkitFlexShrink","WebkitFlexWrap","WebkitJustifyContent","WebkitLineClamp","WebkitMask","WebkitMaskClip","WebkitMaskComposite","WebkitMaskImage","WebkitMaskOrigin","WebkitMaskPosition","WebkitMaskPositionX","WebkitMaskPositionY","WebkitMaskRepeat","WebkitMaskSize","WebkitOrder","WebkitPerspective","WebkitPerspectiveOrigin","WebkitTextFillColor","WebkitTextSizeAdjust","WebkitTextStroke","WebkitTextStrokeColor","WebkitTextStrokeWidth","WebkitTransform","WebkitTransformOrigin","WebkitTransformStyle","WebkitTransition","WebkitTransitionDelay","WebkitTransitionDuration","WebkitTransitionProperty","WebkitTransitionTimingFunction","WebkitUserSelect","WheelEvent","Window","Worker","Worklet","WritableStream","WritableStreamDefaultWriter","XMLDocument","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestException","XMLHttpRequestProgressEvent","XMLHttpRequestUpload","XMLSerializer","XMLStylesheetProcessingInstruction","XPathEvaluator","XPathException","XPathExpression","XPathNSResolver","XPathResult","XRBoundedReferenceSpace","XRDOMOverlayState","XRFrame","XRHitTestResult","XRHitTestSource","XRInputSource","XRInputSourceArray","XRInputSourceEvent","XRInputSourcesChangeEvent","XRLayer","XRPose","XRRay","XRReferenceSpace","XRReferenceSpaceEvent","XRRenderState","XRRigidTransform","XRSession","XRSessionEvent","XRSpace","XRSystem","XRTransientInputHitTestResult","XRTransientInputHitTestSource","XRView","XRViewerPose","XRViewport","XRWebGLLayer","XSLTProcessor","ZERO","_XD0M_","_YD0M_","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__opera","__proto__","_browserjsran","a","aLink","abbr","abort","aborted","abs","absolute","acceleration","accelerationIncludingGravity","accelerator","accept","acceptCharset","acceptNode","accessKey","accessKeyLabel","accuracy","acos","acosh","action","actionURL","actions","activated","active","activeCues","activeElement","activeSourceBuffers","activeSourceCount","activeTexture","activeVRDisplays","actualBoundingBoxAscent","actualBoundingBoxDescent","actualBoundingBoxLeft","actualBoundingBoxRight","add","addAll","addBehavior","addCandidate","addColorStop","addCue","addElement","addEventListener","addFilter","addFromString","addFromUri","addIceCandidate","addImport","addListener","addModule","addNamed","addPageRule","addPath","addPointer","addRange","addRegion","addRule","addSearchEngine","addSourceBuffer","addStream","addTextTrack","addTrack","addTransceiver","addWakeLockListener","added","addedNodes","additionalName","additiveSymbols","addons","address","addressLine","adoptNode","adoptedStyleSheets","adr","advance","after","album","alert","algorithm","align","align-content","align-items","align-self","alignContent","alignItems","alignSelf","alignmentBaseline","alinkColor","all","allSettled","allow","allowFullscreen","allowPaymentRequest","allowedDirections","allowedFeatures","allowedToPlay","allowsFeature","alpha","alt","altGraphKey","altHtml","altKey","altLeft","alternate","alternateSetting","alternates","altitude","altitudeAccuracy","amplitude","ancestorOrigins","anchor","anchorNode","anchorOffset","anchors","and","angle","angularAcceleration","angularVelocity","animVal","animate","animatedInstanceRoot","animatedNormalizedPathSegList","animatedPathSegList","animatedPoints","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","animationDelay","animationDirection","animationDuration","animationFillMode","animationIterationCount","animationName","animationPlayState","animationStartTime","animationTimingFunction","animationsPaused","anniversary","antialias","anticipatedRemoval","any","app","appCodeName","appMinorVersion","appName","appNotifications","appVersion","appearance","append","appendBuffer","appendChild","appendData","appendItem","appendMedium","appendNamed","appendRule","appendStream","appendWindowEnd","appendWindowStart","applets","applicationCache","applicationServerKey","apply","applyConstraints","applyElement","arc","arcTo","archive","areas","arguments","ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRelevant","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText","arrayBuffer","artist","artwork","as","asIntN","asUintN","asin","asinh","assert","assign","assignedElements","assignedNodes","assignedSlot","async","asyncIterator","atEnd","atan","atan2","atanh","atob","attachEvent","attachInternals","attachShader","attachShadow","attachments","attack","attestationObject","attrChange","attrName","attributeFilter","attributeName","attributeNamespace","attributeOldValue","attributeStyleMap","attributes","attribution","audioBitsPerSecond","audioTracks","audioWorklet","authenticatedSignedWrites","authenticatorData","autoIncrement","autobuffer","autocapitalize","autocomplete","autocorrect","autofocus","automationRate","autoplay","availHeight","availLeft","availTop","availWidth","availability","available","aversion","ax","axes","axis","ay","azimuth","b","back","backface-visibility","backfaceVisibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","backgroundAttachment","backgroundBlendMode","backgroundClip","backgroundColor","backgroundFetch","backgroundImage","backgroundOrigin","backgroundPosition","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize","badInput","badge","balance","baseFrequencyX","baseFrequencyY","baseLatency","baseLayer","baseNode","baseOffset","baseURI","baseVal","baselineShift","battery","bday","before","beginElement","beginElementAt","beginPath","beginQuery","beginTransformFeedback","behavior","behaviorCookie","behaviorPart","behaviorUrns","beta","bezierCurveTo","bgColor","bgProperties","bias","big","bigint64","biguint64","binaryType","bind","bindAttribLocation","bindBuffer","bindBufferBase","bindBufferRange","bindFramebuffer","bindRenderbuffer","bindSampler","bindTexture","bindTransformFeedback","bindVertexArray","blendColor","blendEquation","blendEquationSeparate","blendFunc","blendFuncSeparate","blink","blitFramebuffer","blob","block-size","blockDirection","blockSize","blockedURI","blue","bluetooth","blur","body","bodyUsed","bold","bookmarks","booleanValue","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","borderBlock","borderBlockColor","borderBlockEnd","borderBlockEndColor","borderBlockEndStyle","borderBlockEndWidth","borderBlockStart","borderBlockStartColor","borderBlockStartStyle","borderBlockStartWidth","borderBlockStyle","borderBlockWidth","borderBottom","borderBottomColor","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStyle","borderBottomWidth","borderBoxSize","borderCollapse","borderColor","borderColorDark","borderColorLight","borderEndEndRadius","borderEndStartRadius","borderImage","borderImageOutset","borderImageRepeat","borderImageSlice","borderImageSource","borderImageWidth","borderInline","borderInlineColor","borderInlineEnd","borderInlineEndColor","borderInlineEndStyle","borderInlineEndWidth","borderInlineStart","borderInlineStartColor","borderInlineStartStyle","borderInlineStartWidth","borderInlineStyle","borderInlineWidth","borderLeft","borderLeftColor","borderLeftStyle","borderLeftWidth","borderRadius","borderRight","borderRightColor","borderRightStyle","borderRightWidth","borderSpacing","borderStartEndRadius","borderStartStartRadius","borderStyle","borderTop","borderTopColor","borderTopLeftRadius","borderTopRightRadius","borderTopStyle","borderTopWidth","borderWidth","bottom","bottomMargin","bound","boundElements","boundingClientRect","boundingHeight","boundingLeft","boundingTop","boundingWidth","bounds","boundsGeometry","box-decoration-break","box-shadow","box-sizing","boxDecorationBreak","boxShadow","boxSizing","break-after","break-before","break-inside","breakAfter","breakBefore","breakInside","broadcast","browserLanguage","btoa","bubbles","buffer","bufferData","bufferDepth","bufferSize","bufferSubData","buffered","bufferedAmount","bufferedAmountLowThreshold","buildID","buildNumber","button","buttonID","buttons","byteLength","byteOffset","bytesWritten","c","cache","caches","call","caller","canBeFormatted","canBeMounted","canBeShared","canHaveChildren","canHaveHTML","canInsertDTMF","canMakePayment","canPlayType","canPresent","canTrickleIceCandidates","cancel","cancelAndHoldAtTime","cancelAnimationFrame","cancelBubble","cancelIdleCallback","cancelScheduledValues","cancelVideoFrameCallback","cancelWatchAvailability","cancelable","candidate","canonicalUUID","canvas","capabilities","caption","caption-side","captionSide","capture","captureEvents","captureStackTrace","captureStream","caret-color","caretBidiLevel","caretColor","caretPositionFromPoint","caretRangeFromPoint","cast","catch","category","cbrt","cd","ceil","cellIndex","cellPadding","cellSpacing","cells","ch","chOff","chain","challenge","changeType","changedTouches","channel","channelCount","channelCountMode","channelInterpretation","char","charAt","charCode","charCodeAt","charIndex","charLength","characterData","characterDataOldValue","characterSet","characteristic","charging","chargingTime","charset","check","checkEnclosure","checkFramebufferStatus","checkIntersection","checkValidity","checked","childElementCount","childList","childNodes","children","chrome","ciphertext","cite","city","claimInterface","claimed","classList","className","classid","clear","clearAppBadge","clearAttributes","clearBufferfi","clearBufferfv","clearBufferiv","clearBufferuiv","clearColor","clearData","clearDepth","clearHalt","clearImmediate","clearInterval","clearLiveSeekableRange","clearMarks","clearMaxGCPauseAccumulator","clearMeasures","clearParameters","clearRect","clearResourceTimings","clearShadow","clearStencil","clearTimeout","clearWatch","click","clickCount","clientDataJSON","clientHeight","clientInformation","clientLeft","clientRect","clientRects","clientTop","clientWaitSync","clientWidth","clientX","clientY","clip","clip-path","clip-rule","clipBottom","clipLeft","clipPath","clipPathUnits","clipRight","clipRule","clipTop","clipboard","clipboardData","clone","cloneContents","cloneNode","cloneRange","close","closePath","closed","closest","clz","clz32","cm","cmp","code","codeBase","codePointAt","codeType","colSpan","collapse","collapseToEnd","collapseToStart","collapsed","collect","colno","color","color-adjust","color-interpolation","color-interpolation-filters","colorAdjust","colorDepth","colorInterpolation","colorInterpolationFilters","colorMask","colorType","cols","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columnCount","columnFill","columnGap","columnNumber","columnRule","columnRuleColor","columnRuleStyle","columnRuleWidth","columnSpan","columnWidth","columns","command","commit","commitPreferences","commitStyles","commonAncestorContainer","compact","compareBoundaryPoints","compareDocumentPosition","compareEndPoints","compareExchange","compareNode","comparePoint","compatMode","compatible","compile","compileShader","compileStreaming","complete","component","componentFromPoint","composed","composedPath","composite","compositionEndOffset","compositionStartOffset","compressedTexImage2D","compressedTexImage3D","compressedTexSubImage2D","compressedTexSubImage3D","computedStyleMap","concat","conditionText","coneInnerAngle","coneOuterAngle","coneOuterGain","configuration","configurationName","configurationValue","configurations","confirm","confirmComposition","confirmSiteSpecificTrackingException","confirmWebWideTrackingException","connect","connectEnd","connectShark","connectStart","connected","connection","connectionList","connectionSpeed","connectionState","connections","console","consolidate","constraint","constrictionActive","construct","constructor","contactID","contain","containerId","containerName","containerSrc","containerType","contains","containsNode","content","contentBoxSize","contentDocument","contentEditable","contentHint","contentOverflow","contentRect","contentScriptType","contentStyleType","contentType","contentWindow","context","contextMenu","contextmenu","continue","continuePrimaryKey","continuous","control","controlTransferIn","controlTransferOut","controller","controls","controlsList","convertPointFromNode","convertQuadFromNode","convertRectFromNode","convertToBlob","convertToSpecifiedUnits","cookie","cookieEnabled","coords","copyBufferSubData","copyFromChannel","copyTexImage2D","copyTexSubImage2D","copyTexSubImage3D","copyToChannel","copyWithin","correspondingElement","correspondingUseElement","corruptedVideoFrames","cos","cosh","count","countReset","counter-increment","counter-reset","counter-set","counterIncrement","counterReset","counterSet","country","cpuClass","cpuSleepAllowed","create","createAnalyser","createAnswer","createAttribute","createAttributeNS","createBiquadFilter","createBuffer","createBufferSource","createCDATASection","createCSSStyleSheet","createCaption","createChannelMerger","createChannelSplitter","createComment","createConstantSource","createContextualFragment","createControlRange","createConvolver","createDTMFSender","createDataChannel","createDelay","createDelayNode","createDocument","createDocumentFragment","createDocumentType","createDynamicsCompressor","createElement","createElementNS","createEntityReference","createEvent","createEventObject","createExpression","createFramebuffer","createFunction","createGain","createGainNode","createHTML","createHTMLDocument","createIIRFilter","createImageBitmap","createImageData","createIndex","createJavaScriptNode","createLinearGradient","createMediaElementSource","createMediaKeys","createMediaStreamDestination","createMediaStreamSource","createMediaStreamTrackSource","createMutableFile","createNSResolver","createNodeIterator","createNotification","createObjectStore","createObjectURL","createOffer","createOscillator","createPanner","createPattern","createPeriodicWave","createPolicy","createPopup","createProcessingInstruction","createProgram","createQuery","createRadialGradient","createRange","createRangeCollection","createReader","createRenderbuffer","createSVGAngle","createSVGLength","createSVGMatrix","createSVGNumber","createSVGPathSegArcAbs","createSVGPathSegArcRel","createSVGPathSegClosePath","createSVGPathSegCurvetoCubicAbs","createSVGPathSegCurvetoCubicRel","createSVGPathSegCurvetoCubicSmoothAbs","createSVGPathSegCurvetoCubicSmoothRel","createSVGPathSegCurvetoQuadraticAbs","createSVGPathSegCurvetoQuadraticRel","createSVGPathSegCurvetoQuadraticSmoothAbs","createSVGPathSegCurvetoQuadraticSmoothRel","createSVGPathSegLinetoAbs","createSVGPathSegLinetoHorizontalAbs","createSVGPathSegLinetoHorizontalRel","createSVGPathSegLinetoRel","createSVGPathSegLinetoVerticalAbs","createSVGPathSegLinetoVerticalRel","createSVGPathSegMovetoAbs","createSVGPathSegMovetoRel","createSVGPoint","createSVGRect","createSVGTransform","createSVGTransformFromMatrix","createSampler","createScript","createScriptProcessor","createScriptURL","createSession","createShader","createShadowRoot","createStereoPanner","createStyleSheet","createTBody","createTFoot","createTHead","createTextNode","createTextRange","createTexture","createTouch","createTouchList","createTransformFeedback","createTreeWalker","createVertexArray","createWaveShaper","creationTime","credentials","crossOrigin","crossOriginIsolated","crypto","csi","csp","cssFloat","cssRules","cssText","cssValueType","ctrlKey","ctrlLeft","cues","cullFace","currentDirection","currentLocalDescription","currentNode","currentPage","currentRect","currentRemoteDescription","currentScale","currentScript","currentSrc","currentState","currentStyle","currentTarget","currentTime","currentTranslate","currentView","cursor","curve","customElements","customError","cx","cy","d","data","dataFld","dataFormatAs","dataLoss","dataLossMessage","dataPageSize","dataSrc","dataTransfer","database","databases","dataset","dateTime","db","debug","debuggerEnabled","declare","decode","decodeAudioData","decodeURI","decodeURIComponent","decodedBodySize","decoding","decodingInfo","decrypt","default","defaultCharset","defaultChecked","defaultMuted","defaultPlaybackRate","defaultPolicy","defaultPrevented","defaultRequest","defaultSelected","defaultStatus","defaultURL","defaultValue","defaultView","defaultstatus","defer","define","defineMagicFunction","defineMagicVariable","defineProperties","defineProperty","deg","delay","delayTime","delegatesFocus","delete","deleteBuffer","deleteCaption","deleteCell","deleteContents","deleteData","deleteDatabase","deleteFramebuffer","deleteFromDocument","deleteIndex","deleteMedium","deleteObjectStore","deleteProgram","deleteProperty","deleteQuery","deleteRenderbuffer","deleteRow","deleteRule","deleteSampler","deleteShader","deleteSync","deleteTFoot","deleteTHead","deleteTexture","deleteTransformFeedback","deleteVertexArray","deliverChangeRecords","delivery","deliveryInfo","deliveryStatus","deliveryTimestamp","delta","deltaMode","deltaX","deltaY","deltaZ","dependentLocality","depthFar","depthFunc","depthMask","depthNear","depthRange","deref","deriveBits","deriveKey","description","deselectAll","designMode","desiredSize","destination","destinationURL","detach","detachEvent","detachShader","detail","details","detect","detune","device","deviceClass","deviceId","deviceMemory","devicePixelContentBoxSize","devicePixelRatio","deviceProtocol","deviceSubclass","deviceVersionMajor","deviceVersionMinor","deviceVersionSubminor","deviceXDPI","deviceYDPI","didTimeout","diffuseConstant","digest","dimensions","dir","dirName","direction","dirxml","disable","disablePictureInPicture","disableRemotePlayback","disableVertexAttribArray","disabled","dischargingTime","disconnect","disconnectShark","dispatchEvent","display","displayId","displayName","disposition","distanceModel","div","divisor","djsapi","djsproxy","doImport","doNotTrack","doScroll","doctype","document","documentElement","documentMode","documentURI","dolphin","dolphinGameCenter","dolphininfo","dolphinmeta","domComplete","domContentLoadedEventEnd","domContentLoadedEventStart","domInteractive","domLoading","domOverlayState","domain","domainLookupEnd","domainLookupStart","dominant-baseline","dominantBaseline","done","dopplerFactor","dotAll","downDegrees","downlink","download","downloadTotal","downloaded","dpcm","dpi","dppx","dragDrop","draggable","drawArrays","drawArraysInstanced","drawArraysInstancedANGLE","drawBuffers","drawCustomFocusRing","drawElements","drawElementsInstanced","drawElementsInstancedANGLE","drawFocusIfNeeded","drawImage","drawImageFromRect","drawRangeElements","drawSystemFocusRing","drawingBufferHeight","drawingBufferWidth","dropEffect","droppedVideoFrames","dropzone","dtmf","dump","dumpProfile","duplicate","durability","duration","dvname","dvnum","dx","dy","dynsrc","e","edgeMode","effect","effectAllowed","effectiveDirective","effectiveType","elapsedTime","element","elementFromPoint","elementTiming","elements","elementsFromPoint","elevation","ellipse","em","email","embeds","emma","empty","empty-cells","emptyCells","emptyHTML","emptyScript","emulatedPosition","enable","enableBackground","enableDelegations","enableStyleSheetsForSet","enableVertexAttribArray","enabled","enabledPlugin","encode","encodeInto","encodeURI","encodeURIComponent","encodedBodySize","encoding","encodingInfo","encrypt","enctype","end","endContainer","endElement","endElementAt","endOfStream","endOffset","endQuery","endTime","endTransformFeedback","ended","endpoint","endpointNumber","endpoints","endsWith","enterKeyHint","entities","entries","entryType","enumerate","enumerateDevices","enumerateEditable","environmentBlendMode","equals","error","errorCode","errorDetail","errorText","escape","estimate","eval","evaluate","event","eventPhase","every","ex","exception","exchange","exec","execCommand","execCommandShowHelp","execScript","exitFullscreen","exitPictureInPicture","exitPointerLock","exitPresent","exp","expand","expandEntityReferences","expando","expansion","expiration","expirationTime","expires","expiryDate","explicitOriginalTarget","expm1","exponent","exponentialRampToValueAtTime","exportKey","exports","extend","extensions","extentNode","extentOffset","external","externalResourcesRequired","extractContents","extractable","eye","f","face","factoryReset","failureReason","fallback","family","familyName","farthestViewportElement","fastSeek","fatal","featureId","featurePolicy","featureSettings","features","fenceSync","fetch","fetchStart","fftSize","fgColor","fieldOfView","file","fileCreatedDate","fileHandle","fileModifiedDate","fileName","fileSize","fileUpdatedDate","filename","files","filesystem","fill","fill-opacity","fill-rule","fillLightMode","fillOpacity","fillRect","fillRule","fillStyle","fillText","filter","filterResX","filterResY","filterUnits","filters","finally","find","findIndex","findRule","findText","finish","finished","fireEvent","firesTouchEvents","firstChild","firstElementChild","firstPage","fixed","flags","flat","flatMap","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","flexBasis","flexDirection","flexFlow","flexGrow","flexShrink","flexWrap","flipX","flipY","float","float32","float64","flood-color","flood-opacity","floodColor","floodOpacity","floor","flush","focus","focusNode","focusOffset","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","fontFamily","fontFeatureSettings","fontKerning","fontLanguageOverride","fontOpticalSizing","fontSize","fontSizeAdjust","fontSmoothingEnabled","fontStretch","fontStyle","fontSynthesis","fontVariant","fontVariantAlternates","fontVariantCaps","fontVariantEastAsian","fontVariantLigatures","fontVariantNumeric","fontVariantPosition","fontVariationSettings","fontWeight","fontcolor","fontfaces","fonts","fontsize","for","forEach","force","forceRedraw","form","formAction","formData","formEnctype","formMethod","formNoValidate","formTarget","format","formatToParts","forms","forward","forwardX","forwardY","forwardZ","foundation","fr","fragmentDirective","frame","frameBorder","frameElement","frameSpacing","framebuffer","framebufferHeight","framebufferRenderbuffer","framebufferTexture2D","framebufferTextureLayer","framebufferWidth","frames","freeSpace","freeze","frequency","frequencyBinCount","from","fromCharCode","fromCodePoint","fromElement","fromEntries","fromFloat32Array","fromFloat64Array","fromMatrix","fromPoint","fromQuad","fromRect","frontFace","fround","fullPath","fullScreen","fullscreen","fullscreenElement","fullscreenEnabled","fx","fy","gain","gamepad","gamma","gap","gatheringState","gatt","genderIdentity","generateCertificate","generateKey","generateMipmap","generateRequest","geolocation","gestureObject","get","getActiveAttrib","getActiveUniform","getActiveUniformBlockName","getActiveUniformBlockParameter","getActiveUniforms","getAdjacentText","getAll","getAllKeys","getAllResponseHeaders","getAllowlistForFeature","getAnimations","getAsFile","getAsString","getAttachedShaders","getAttribLocation","getAttribute","getAttributeNS","getAttributeNames","getAttributeNode","getAttributeNodeNS","getAttributeType","getAudioTracks","getAvailability","getBBox","getBattery","getBigInt64","getBigUint64","getBlob","getBookmark","getBoundingClientRect","getBounds","getBoxQuads","getBufferParameter","getBufferSubData","getByteFrequencyData","getByteTimeDomainData","getCSSCanvasContext","getCTM","getCandidateWindowClientRect","getCanonicalLocales","getCapabilities","getChannelData","getCharNumAtPosition","getCharacteristic","getCharacteristics","getClientExtensionResults","getClientRect","getClientRects","getCoalescedEvents","getCompositionAlternatives","getComputedStyle","getComputedTextLength","getComputedTiming","getConfiguration","getConstraints","getContext","getContextAttributes","getContributingSources","getCounterValue","getCueAsHTML","getCueById","getCurrentPosition","getCurrentTime","getData","getDatabaseNames","getDate","getDay","getDefaultComputedStyle","getDescriptor","getDescriptors","getDestinationInsertionPoints","getDevices","getDirectory","getDisplayMedia","getDistributedNodes","getEditable","getElementById","getElementsByClassName","getElementsByName","getElementsByTagName","getElementsByTagNameNS","getEnclosureList","getEndPositionOfChar","getEntries","getEntriesByName","getEntriesByType","getError","getExtension","getExtentOfChar","getEyeParameters","getFeature","getFile","getFiles","getFilesAndDirectories","getFingerprints","getFloat32","getFloat64","getFloatFrequencyData","getFloatTimeDomainData","getFloatValue","getFragDataLocation","getFrameData","getFramebufferAttachmentParameter","getFrequencyResponse","getFullYear","getGamepads","getHitTestResults","getHitTestResultsForTransientInput","getHours","getIdentityAssertion","getIds","getImageData","getIndexedParameter","getInstalledRelatedApps","getInt16","getInt32","getInt8","getInternalformatParameter","getIntersectionList","getItem","getItems","getKey","getKeyframes","getLayers","getLayoutMap","getLineDash","getLocalCandidates","getLocalParameters","getLocalStreams","getMarks","getMatchedCSSRules","getMaxGCPauseSinceClear","getMeasures","getMetadata","getMilliseconds","getMinutes","getModifierState","getMonth","getNamedItem","getNamedItemNS","getNativeFramebufferScaleFactor","getNotifications","getNotifier","getNumberOfChars","getOffsetReferenceSpace","getOutputTimestamp","getOverrideHistoryNavigationMode","getOverrideStyle","getOwnPropertyDescriptor","getOwnPropertyDescriptors","getOwnPropertyNames","getOwnPropertySymbols","getParameter","getParameters","getParent","getPathSegAtLength","getPhotoCapabilities","getPhotoSettings","getPointAtLength","getPose","getPredictedEvents","getPreference","getPreferenceDefault","getPresentationAttribute","getPreventDefault","getPrimaryService","getPrimaryServices","getProgramInfoLog","getProgramParameter","getPropertyCSSValue","getPropertyPriority","getPropertyShorthand","getPropertyType","getPropertyValue","getPrototypeOf","getQuery","getQueryParameter","getRGBColorValue","getRandomValues","getRangeAt","getReader","getReceivers","getRectValue","getRegistration","getRegistrations","getRemoteCandidates","getRemoteCertificates","getRemoteParameters","getRemoteStreams","getRenderbufferParameter","getResponseHeader","getRoot","getRootNode","getRotationOfChar","getSVGDocument","getSamplerParameter","getScreenCTM","getSeconds","getSelectedCandidatePair","getSelection","getSenders","getService","getSettings","getShaderInfoLog","getShaderParameter","getShaderPrecisionFormat","getShaderSource","getSimpleDuration","getSiteIcons","getSources","getSpeculativeParserUrls","getStartPositionOfChar","getStartTime","getState","getStats","getStatusForPolicy","getStorageUpdates","getStreamById","getStringValue","getSubStringLength","getSubscription","getSupportedConstraints","getSupportedExtensions","getSupportedFormats","getSyncParameter","getSynchronizationSources","getTags","getTargetRanges","getTexParameter","getTime","getTimezoneOffset","getTiming","getTotalLength","getTrackById","getTracks","getTransceivers","getTransform","getTransformFeedbackVarying","getTransformToElement","getTransports","getType","getTypeMapping","getUTCDate","getUTCDay","getUTCFullYear","getUTCHours","getUTCMilliseconds","getUTCMinutes","getUTCMonth","getUTCSeconds","getUint16","getUint32","getUint8","getUniform","getUniformBlockIndex","getUniformIndices","getUniformLocation","getUserMedia","getVRDisplays","getValues","getVarDate","getVariableValue","getVertexAttrib","getVertexAttribOffset","getVideoPlaybackQuality","getVideoTracks","getViewerPose","getViewport","getVoices","getWakeLockState","getWriter","getYear","givenName","global","globalAlpha","globalCompositeOperation","globalThis","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","go","grabFrame","grad","gradientTransform","gradientUnits","grammars","green","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","gridArea","gridAutoColumns","gridAutoFlow","gridAutoRows","gridColumn","gridColumnEnd","gridColumnGap","gridColumnStart","gridGap","gridRow","gridRowEnd","gridRowGap","gridRowStart","gridTemplate","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","gripSpace","group","groupCollapsed","groupEnd","groupId","hadRecentInput","hand","handedness","hapticActuators","hardwareConcurrency","has","hasAttribute","hasAttributeNS","hasAttributes","hasBeenActive","hasChildNodes","hasComposition","hasEnrolledInstrument","hasExtension","hasExternalDisplay","hasFeature","hasFocus","hasInstance","hasLayout","hasOrientation","hasOwnProperty","hasPointerCapture","hasPosition","hasReading","hasStorageAccess","hash","head","headers","heading","height","hidden","hide","hideFocus","high","highWaterMark","hint","history","honorificPrefix","honorificSuffix","horizontalOverflow","host","hostCandidate","hostname","href","hrefTranslate","hreflang","hspace","html5TagCheckInerface","htmlFor","htmlText","httpEquiv","httpRequestStatusCode","hwTimestamp","hyphens","hypot","iccId","iceConnectionState","iceGatheringState","iceTransport","icon","iconURL","id","identifier","identity","idpLoginUrl","ignoreBOM","ignoreCase","ignoreDepthValues","image-orientation","image-rendering","imageHeight","imageOrientation","imageRendering","imageSizes","imageSmoothingEnabled","imageSmoothingQuality","imageSrcset","imageWidth","images","ime-mode","imeMode","implementation","importKey","importNode","importStylesheet","imports","impp","imul","in","in1","in2","inBandMetadataTrackDispatchType","inRange","includes","incremental","indeterminate","index","indexNames","indexOf","indexedDB","indicate","inertiaDestinationX","inertiaDestinationY","info","init","initAnimationEvent","initBeforeLoadEvent","initClipboardEvent","initCloseEvent","initCommandEvent","initCompositionEvent","initCustomEvent","initData","initDataType","initDeviceMotionEvent","initDeviceOrientationEvent","initDragEvent","initErrorEvent","initEvent","initFocusEvent","initGestureEvent","initHashChangeEvent","initKeyEvent","initKeyboardEvent","initMSManipulationEvent","initMessageEvent","initMouseEvent","initMouseScrollEvent","initMouseWheelEvent","initMutationEvent","initNSMouseEvent","initOverflowEvent","initPageEvent","initPageTransitionEvent","initPointerEvent","initPopStateEvent","initProgressEvent","initScrollAreaEvent","initSimpleGestureEvent","initStorageEvent","initTextEvent","initTimeEvent","initTouchEvent","initTransitionEvent","initUIEvent","initWebKitAnimationEvent","initWebKitTransitionEvent","initWebKitWheelEvent","initWheelEvent","initialTime","initialize","initiatorType","inline-size","inlineSize","inlineVerticalFieldOfView","inner","innerHTML","innerHeight","innerText","innerWidth","input","inputBuffer","inputEncoding","inputMethod","inputMode","inputSource","inputSources","inputType","inputs","insertAdjacentElement","insertAdjacentHTML","insertAdjacentText","insertBefore","insertCell","insertDTMF","insertData","insertItemBefore","insertNode","insertRow","insertRule","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","insetBlock","insetBlockEnd","insetBlockStart","insetInline","insetInlineEnd","insetInlineStart","installing","instanceRoot","instantiate","instantiateStreaming","instruments","int16","int32","int8","integrity","interactionMode","intercept","interfaceClass","interfaceName","interfaceNumber","interfaceProtocol","interfaceSubclass","interfaces","interimResults","internalSubset","interpretation","intersectionRatio","intersectionRect","intersectsNode","interval","invalidIteratorState","invalidateFramebuffer","invalidateSubFramebuffer","inverse","invertSelf","is","is2D","isActive","isAlternate","isArray","isBingCurrentSearchDefault","isBuffer","isCandidateWindowVisible","isChar","isCollapsed","isComposing","isConcatSpreadable","isConnected","isContentEditable","isContentHandlerRegistered","isContextLost","isDefaultNamespace","isDirectory","isDisabled","isEnabled","isEqual","isEqualNode","isExtensible","isExternalCTAP2SecurityKeySupported","isFile","isFinite","isFramebuffer","isFrozen","isGenerator","isHTML","isHistoryNavigation","isId","isIdentity","isInjected","isInteger","isIntersecting","isLockFree","isMap","isMultiLine","isNaN","isOpen","isPointInFill","isPointInPath","isPointInRange","isPointInStroke","isPrefAlternate","isPresenting","isPrimary","isProgram","isPropertyImplicit","isProtocolHandlerRegistered","isPrototypeOf","isQuery","isRenderbuffer","isSafeInteger","isSameNode","isSampler","isScript","isScriptURL","isSealed","isSecureContext","isSessionSupported","isShader","isSupported","isSync","isTextEdit","isTexture","isTransformFeedback","isTrusted","isTypeSupported","isUserVerifyingPlatformAuthenticatorAvailable","isVertexArray","isView","isVisible","isochronousTransferIn","isochronousTransferOut","isolation","italics","item","itemId","itemProp","itemRef","itemScope","itemType","itemValue","items","iterateNext","iterationComposite","iterator","javaEnabled","jobTitle","join","json","justify-content","justify-items","justify-self","justifyContent","justifyItems","justifySelf","k1","k2","k3","k4","kHz","keepalive","kernelMatrix","kernelUnitLengthX","kernelUnitLengthY","kerning","key","keyCode","keyFor","keyIdentifier","keyLightEnabled","keyLocation","keyPath","keyStatuses","keySystem","keyText","keyUsage","keyboard","keys","keytype","kind","knee","label","labels","lang","language","languages","largeArcFlag","lastChild","lastElementChild","lastEventId","lastIndex","lastIndexOf","lastInputTime","lastMatch","lastMessageSubject","lastMessageType","lastModified","lastModifiedDate","lastPage","lastParen","lastState","lastStyleSheetSet","latitude","layerX","layerY","layoutFlow","layoutGrid","layoutGridChar","layoutGridLine","layoutGridMode","layoutGridType","lbound","left","leftContext","leftDegrees","leftMargin","leftProjectionMatrix","leftViewMatrix","length","lengthAdjust","lengthComputable","letter-spacing","letterSpacing","level","lighting-color","lightingColor","limitingConeAngle","line","line-break","line-height","lineAlign","lineBreak","lineCap","lineDashOffset","lineHeight","lineJoin","lineNumber","lineTo","lineWidth","linearAcceleration","linearRampToValueAtTime","linearVelocity","lineno","lines","link","linkColor","linkProgram","links","list","list-style","list-style-image","list-style-position","list-style-type","listStyle","listStyleImage","listStylePosition","listStyleType","listener","load","loadEventEnd","loadEventStart","loadTime","loadTimes","loaded","loading","localDescription","localName","localService","localStorage","locale","localeCompare","location","locationbar","lock","locked","lockedFile","locks","log","log10","log1p","log2","logicalXDPI","logicalYDPI","longDesc","longitude","lookupNamespaceURI","lookupPrefix","loop","loopEnd","loopStart","looping","low","lower","lowerBound","lowerOpen","lowsrc","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","makeXRCompatible","manifest","manufacturer","manufacturerName","map","mapping","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marginBlock","marginBlockEnd","marginBlockStart","marginBottom","marginHeight","marginInline","marginInlineEnd","marginInlineStart","marginLeft","marginRight","marginTop","marginWidth","mark","marker","marker-end","marker-mid","marker-offset","marker-start","markerEnd","markerHeight","markerMid","markerOffset","markerStart","markerUnits","markerWidth","marks","mask","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-position-x","mask-position-y","mask-repeat","mask-size","mask-type","maskClip","maskComposite","maskContentUnits","maskImage","maskMode","maskOrigin","maskPosition","maskPositionX","maskPositionY","maskRepeat","maskSize","maskType","maskUnits","match","matchAll","matchMedia","matchMedium","matches","matrix","matrixTransform","max","max-block-size","max-height","max-inline-size","max-width","maxActions","maxAlternatives","maxBlockSize","maxChannelCount","maxChannels","maxConnectionsPerServer","maxDecibels","maxDistance","maxHeight","maxInlineSize","maxLayers","maxLength","maxMessageSize","maxPacketLifeTime","maxRetransmits","maxTouchPoints","maxValue","maxWidth","measure","measureText","media","mediaCapabilities","mediaDevices","mediaElement","mediaGroup","mediaKeys","mediaSession","mediaStream","mediaText","meetOrSlice","memory","menubar","mergeAttributes","message","messageClass","messageHandlers","messageType","metaKey","metadata","method","methodDetails","methodName","mid","mimeType","mimeTypes","min","min-block-size","min-height","min-inline-size","min-width","minBlockSize","minDecibels","minHeight","minInlineSize","minLength","minValue","minWidth","miterLimit","mix-blend-mode","mixBlendMode","mm","mode","modify","mount","move","moveBy","moveEnd","moveFirst","moveFocusDown","moveFocusLeft","moveFocusRight","moveFocusUp","moveNext","moveRow","moveStart","moveTo","moveToBookmark","moveToElementText","moveToPoint","movementX","movementY","mozAdd","mozAnimationStartTime","mozAnon","mozApps","mozAudioCaptured","mozAudioChannelType","mozAutoplayEnabled","mozCancelAnimationFrame","mozCancelFullScreen","mozCancelRequestAnimationFrame","mozCaptureStream","mozCaptureStreamUntilEnded","mozClearDataAt","mozContact","mozContacts","mozCreateFileHandle","mozCurrentTransform","mozCurrentTransformInverse","mozCursor","mozDash","mozDashOffset","mozDecodedFrames","mozExitPointerLock","mozFillRule","mozFragmentEnd","mozFrameDelay","mozFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozGetAll","mozGetAllKeys","mozGetAsFile","mozGetDataAt","mozGetMetadata","mozGetUserMedia","mozHasAudio","mozHasItem","mozHidden","mozImageSmoothingEnabled","mozIndexedDB","mozInnerScreenX","mozInnerScreenY","mozInputSource","mozIsTextField","mozItem","mozItemCount","mozItems","mozLength","mozLockOrientation","mozMatchesSelector","mozMovementX","mozMovementY","mozOpaque","mozOrientation","mozPaintCount","mozPaintedFrames","mozParsedFrames","mozPay","mozPointerLockElement","mozPresentedFrames","mozPreservesPitch","mozPressure","mozPrintCallback","mozRTCIceCandidate","mozRTCPeerConnection","mozRTCSessionDescription","mozRemove","mozRequestAnimationFrame","mozRequestFullScreen","mozRequestPointerLock","mozSetDataAt","mozSetImageElement","mozSourceNode","mozSrcObject","mozSystem","mozTCPSocket","mozTextStyle","mozTypesAt","mozUnlockOrientation","mozUserCancelled","mozVisibilityState","ms","msAnimation","msAnimationDelay","msAnimationDirection","msAnimationDuration","msAnimationFillMode","msAnimationIterationCount","msAnimationName","msAnimationPlayState","msAnimationStartTime","msAnimationTimingFunction","msBackfaceVisibility","msBlockProgression","msCSSOMElementFloatMetrics","msCaching","msCachingEnabled","msCancelRequestAnimationFrame","msCapsLockWarningOff","msClearImmediate","msClose","msContentZoomChaining","msContentZoomFactor","msContentZoomLimit","msContentZoomLimitMax","msContentZoomLimitMin","msContentZoomSnap","msContentZoomSnapPoints","msContentZoomSnapType","msContentZooming","msConvertURL","msCrypto","msDoNotTrack","msElementsFromPoint","msElementsFromRect","msExitFullscreen","msExtendedCode","msFillRule","msFirstPaint","msFlex","msFlexAlign","msFlexDirection","msFlexFlow","msFlexItemAlign","msFlexLinePack","msFlexNegative","msFlexOrder","msFlexPack","msFlexPositive","msFlexPreferredSize","msFlexWrap","msFlowFrom","msFlowInto","msFontFeatureSettings","msFullscreenElement","msFullscreenEnabled","msGetInputContext","msGetRegionContent","msGetUntransformedBounds","msGraphicsTrustStatus","msGridColumn","msGridColumnAlign","msGridColumnSpan","msGridColumns","msGridRow","msGridRowAlign","msGridRowSpan","msGridRows","msHidden","msHighContrastAdjust","msHyphenateLimitChars","msHyphenateLimitLines","msHyphenateLimitZone","msHyphens","msImageSmoothingEnabled","msImeAlign","msIndexedDB","msInterpolationMode","msIsStaticHTML","msKeySystem","msKeys","msLaunchUri","msLockOrientation","msManipulationViewsEnabled","msMatchMedia","msMatchesSelector","msMaxTouchPoints","msOrientation","msOverflowStyle","msPerspective","msPerspectiveOrigin","msPlayToDisabled","msPlayToPreferredSourceUri","msPlayToPrimary","msPointerEnabled","msRegionOverflow","msReleasePointerCapture","msRequestAnimationFrame","msRequestFullscreen","msSaveBlob","msSaveOrOpenBlob","msScrollChaining","msScrollLimit","msScrollLimitXMax","msScrollLimitXMin","msScrollLimitYMax","msScrollLimitYMin","msScrollRails","msScrollSnapPointsX","msScrollSnapPointsY","msScrollSnapType","msScrollSnapX","msScrollSnapY","msScrollTranslation","msSetImmediate","msSetMediaKeys","msSetPointerCapture","msTextCombineHorizontal","msTextSizeAdjust","msToBlob","msTouchAction","msTouchSelect","msTraceAsyncCallbackCompleted","msTraceAsyncCallbackStarting","msTraceAsyncOperationCompleted","msTraceAsyncOperationStarting","msTransform","msTransformOrigin","msTransformStyle","msTransition","msTransitionDelay","msTransitionDuration","msTransitionProperty","msTransitionTimingFunction","msUnlockOrientation","msUpdateAsyncCallbackRelation","msUserSelect","msVisibilityState","msWrapFlow","msWrapMargin","msWrapThrough","msWriteProfilerMark","msZoom","msZoomTo","mt","mul","multiEntry","multiSelectionObj","multiline","multiple","multiply","multiplySelf","mutableFile","muted","n","name","nameProp","namedItem","namedRecordset","names","namespaceURI","namespaces","naturalHeight","naturalWidth","navigate","navigation","navigationMode","navigationPreload","navigationStart","navigator","near","nearestViewportElement","negative","negotiated","netscape","networkState","newScale","newTranslate","newURL","newValue","newValueSpecifiedUnits","newVersion","newhome","next","nextElementSibling","nextHopProtocol","nextNode","nextPage","nextSibling","nickname","noHref","noModule","noResize","noShade","noValidate","noWrap","node","nodeName","nodeType","nodeValue","nonce","normalize","normalizedPathSegList","notationName","notations","note","noteGrainOn","noteOff","noteOn","notify","now","numOctaves","number","numberOfChannels","numberOfInputs","numberOfItems","numberOfOutputs","numberValue","oMatchesSelector","object","object-fit","object-position","objectFit","objectPosition","objectStore","objectStoreNames","objectType","observe","of","offscreenBuffering","offset","offset-anchor","offset-distance","offset-path","offset-rotate","offsetAnchor","offsetDistance","offsetHeight","offsetLeft","offsetNode","offsetParent","offsetPath","offsetRotate","offsetTop","offsetWidth","offsetX","offsetY","ok","oldURL","oldValue","oldVersion","olderShadowRoot","onLine","onabort","onabsolutedeviceorientation","onactivate","onactive","onaddsourcebuffer","onaddstream","onaddtrack","onafterprint","onafterscriptexecute","onafterupdate","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onautocomplete","onautocompleteerror","onauxclick","onbeforeactivate","onbeforecopy","onbeforecut","onbeforedeactivate","onbeforeeditfocus","onbeforeinstallprompt","onbeforepaste","onbeforeprint","onbeforescriptexecute","onbeforeunload","onbeforeupdate","onbeforexrselect","onbegin","onblocked","onblur","onbounce","onboundary","onbufferedamountlow","oncached","oncancel","oncandidatewindowhide","oncandidatewindowshow","oncandidatewindowupdate","oncanplay","oncanplaythrough","once","oncellchange","onchange","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onchecking","onclick","onclose","onclosing","oncompassneedscalibration","oncomplete","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontextmenu","oncontrollerchange","oncontrolselect","oncopy","oncuechange","oncut","ondataavailable","ondatachannel","ondatasetchanged","ondatasetcomplete","ondblclick","ondeactivate","ondevicechange","ondevicelight","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondeviceproximity","ondischargingtimechange","ondisconnect","ondisplay","ondownloading","ondrag","ondragend","ondragenter","ondragexit","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onenter","onenterpictureinpicture","onerror","onerrorupdate","onexit","onfilterchange","onfinish","onfocus","onfocusin","onfocusout","onformdata","onfreeze","onfullscreenchange","onfullscreenerror","ongatheringstatechange","ongattserverdisconnected","ongesturechange","ongestureend","ongesturestart","ongotpointercapture","onhashchange","onhelp","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninactive","oninput","oninputsourceschange","oninvalid","onkeydown","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutcomplete","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlosecapture","onlostpointercapture","only","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onmove","onmoveend","onmovestart","onmozfullscreenchange","onmozfullscreenerror","onmozorientationchange","onmozpointerlockchange","onmozpointerlockerror","onmscontentzoom","onmsfullscreenchange","onmsfullscreenerror","onmsgesturechange","onmsgesturedoubletap","onmsgestureend","onmsgesturehold","onmsgesturestart","onmsgesturetap","onmsgotpointercapture","onmsinertiastart","onmslostpointercapture","onmsmanipulationstatechanged","onmsneedkey","onmsorientationchange","onmspointercancel","onmspointerdown","onmspointerenter","onmspointerhover","onmspointerleave","onmspointermove","onmspointerout","onmspointerover","onmspointerup","onmssitemodejumplistitemremoved","onmsthumbnailclick","onmute","onnegotiationneeded","onnomatch","onnoupdate","onobsolete","onoffline","ononline","onopen","onorientationchange","onpagechange","onpagehide","onpageshow","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onplay","onplaying","onpluginstreamstart","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onprocessorerror","onprogress","onpropertychange","onratechange","onreading","onreadystatechange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovestream","onremovetrack","onrepeat","onreset","onresize","onresizeend","onresizestart","onresourcetimingbufferfull","onresult","onresume","onrowenter","onrowexit","onrowsdelete","onrowsinserted","onscroll","onsearch","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsoundend","onsoundstart","onsourceclose","onsourceclosed","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstatechange","onstop","onstorage","onstoragecommit","onsubmit","onsuccess","onsuspend","onterminate","ontextinput","ontimeout","ontimeupdate","ontoggle","ontonechange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdateready","onupdatestart","onupgradeneeded","onuserproximity","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onvrdisplayactivate","onvrdisplayconnect","onvrdisplaydeactivate","onvrdisplaydisconnect","onvrdisplaypresentchange","onwaiting","onwaitingforkey","onwarning","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkitcurrentplaybacktargetiswirelesschanged","onwebkitfullscreenchange","onwebkitfullscreenerror","onwebkitkeyadded","onwebkitkeyerror","onwebkitkeymessage","onwebkitneedkey","onwebkitorientationchange","onwebkitplaybacktargetavailabilitychanged","onwebkitpointerlockchange","onwebkitpointerlockerror","onwebkitresourcetimingbufferfull","onwebkittransitionend","onwheel","onzoom","opacity","open","openCursor","openDatabase","openKeyCursor","opened","opener","opera","operationType","operator","opr","optimum","options","or","order","orderX","orderY","ordered","org","organization","orient","orientAngle","orientType","orientation","orientationX","orientationY","orientationZ","origin","originalPolicy","originalTarget","orphans","oscpu","outerHTML","outerHeight","outerText","outerWidth","outline","outline-color","outline-offset","outline-style","outline-width","outlineColor","outlineOffset","outlineStyle","outlineWidth","outputBuffer","outputLatency","outputs","overflow","overflow-anchor","overflow-block","overflow-inline","overflow-wrap","overflow-x","overflow-y","overflowAnchor","overflowBlock","overflowInline","overflowWrap","overflowX","overflowY","overrideMimeType","oversample","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","overscrollBehavior","overscrollBehaviorBlock","overscrollBehaviorInline","overscrollBehaviorX","overscrollBehaviorY","ownKeys","ownerDocument","ownerElement","ownerNode","ownerRule","ownerSVGElement","owningElement","p1","p2","p3","p4","packetSize","packets","pad","padEnd","padStart","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","paddingBlock","paddingBlockEnd","paddingBlockStart","paddingBottom","paddingInline","paddingInlineEnd","paddingInlineStart","paddingLeft","paddingRight","paddingTop","page","page-break-after","page-break-before","page-break-inside","pageBreakAfter","pageBreakBefore","pageBreakInside","pageCount","pageLeft","pageTop","pageX","pageXOffset","pageY","pageYOffset","pages","paint-order","paintOrder","paintRequests","paintType","paintWorklet","palette","pan","panningModel","parameters","parent","parentElement","parentNode","parentRule","parentStyleSheet","parentTextEdit","parentWindow","parse","parseAll","parseFloat","parseFromString","parseInt","part","participants","passive","password","pasteHTML","path","pathLength","pathSegList","pathSegType","pathSegTypeAsLetter","pathname","pattern","patternContentUnits","patternMismatch","patternTransform","patternUnits","pause","pauseAnimations","pauseOnExit","pauseProfilers","pauseTransformFeedback","paused","payerEmail","payerName","payerPhone","paymentManager","pc","peerIdentity","pending","pendingLocalDescription","pendingRemoteDescription","percent","performance","periodicSync","permission","permissionState","permissions","persist","persisted","personalbar","perspective","perspective-origin","perspectiveOrigin","phone","phoneticFamilyName","phoneticGivenName","photo","pictureInPictureElement","pictureInPictureEnabled","pictureInPictureWindow","ping","pipeThrough","pipeTo","pitch","pixelBottom","pixelDepth","pixelHeight","pixelLeft","pixelRight","pixelStorei","pixelTop","pixelUnitToMillimeterX","pixelUnitToMillimeterY","pixelWidth","place-content","place-items","place-self","placeContent","placeItems","placeSelf","placeholder","platform","platforms","play","playEffect","playState","playbackRate","playbackState","playbackTime","played","playoutDelayHint","playsInline","plugins","pluginspage","pname","pointer-events","pointerBeforeReferenceNode","pointerEnabled","pointerEvents","pointerId","pointerLockElement","pointerType","points","pointsAtX","pointsAtY","pointsAtZ","polygonOffset","pop","populateMatrix","popupWindowFeatures","popupWindowName","popupWindowURI","port","port1","port2","ports","posBottom","posHeight","posLeft","posRight","posTop","posWidth","pose","position","positionAlign","positionX","positionY","positionZ","postError","postMessage","postalCode","poster","pow","powerEfficient","powerOff","preMultiplySelf","precision","preferredStyleSheetSet","preferredStylesheetSet","prefix","preload","prepend","presentation","preserveAlpha","preserveAspectRatio","preserveAspectRatioString","pressed","pressure","prevValue","preventDefault","preventExtensions","preventSilentAccess","previousElementSibling","previousNode","previousPage","previousRect","previousScale","previousSibling","previousTranslate","primaryKey","primitiveType","primitiveUnits","principals","print","priority","privateKey","probablySupportsContext","process","processIceMessage","processingEnd","processingStart","product","productId","productName","productSub","profile","profileEnd","profiles","projectionMatrix","promise","prompt","properties","propertyIsEnumerable","propertyName","protocol","protocolLong","prototype","provider","pseudoClass","pseudoElement","pt","publicId","publicKey","published","pulse","push","pushManager","pushNotification","pushState","put","putImageData","px","quadraticCurveTo","qualifier","quaternion","query","queryCommandEnabled","queryCommandIndeterm","queryCommandState","queryCommandSupported","queryCommandText","queryCommandValue","querySelector","querySelectorAll","queueMicrotask","quote","quotes","r","r1","r2","race","rad","radiogroup","radiusX","radiusY","random","range","rangeCount","rangeMax","rangeMin","rangeOffset","rangeOverflow","rangeParent","rangeUnderflow","rate","ratio","raw","rawId","read","readAsArrayBuffer","readAsBinaryString","readAsBlob","readAsDataURL","readAsText","readBuffer","readEntries","readOnly","readPixels","readReportRequested","readText","readValue","readable","ready","readyState","reason","reboot","receivedAlert","receiver","receivers","recipient","reconnect","recordNumber","recordsAvailable","recordset","rect","red","redEyeReduction","redirect","redirectCount","redirectEnd","redirectStart","redirected","reduce","reduceRight","reduction","refDistance","refX","refY","referenceNode","referenceSpace","referrer","referrerPolicy","refresh","region","regionAnchorX","regionAnchorY","regionId","regions","register","registerContentHandler","registerElement","registerProperty","registerProtocolHandler","reject","rel","relList","relatedAddress","relatedNode","relatedPort","relatedTarget","release","releaseCapture","releaseEvents","releaseInterface","releaseLock","releasePointerCapture","releaseShaderCompiler","reliable","reliableWrite","reload","rem","remainingSpace","remote","remoteDescription","remove","removeAllRanges","removeAttribute","removeAttributeNS","removeAttributeNode","removeBehavior","removeChild","removeCue","removeEventListener","removeFilter","removeImport","removeItem","removeListener","removeNamedItem","removeNamedItemNS","removeNode","removeParameter","removeProperty","removeRange","removeRegion","removeRule","removeSiteSpecificTrackingException","removeSourceBuffer","removeStream","removeTrack","removeVariable","removeWakeLockListener","removeWebWideTrackingException","removed","removedNodes","renderHeight","renderState","renderTime","renderWidth","renderbufferStorage","renderbufferStorageMultisample","renderedBuffer","renderingMode","renotify","repeat","replace","replaceAdjacentText","replaceAll","replaceChild","replaceChildren","replaceData","replaceId","replaceItem","replaceNode","replaceState","replaceSync","replaceTrack","replaceWholeText","replaceWith","reportValidity","request","requestAnimationFrame","requestAutocomplete","requestData","requestDevice","requestFrame","requestFullscreen","requestHitTestSource","requestHitTestSourceForTransientInput","requestId","requestIdleCallback","requestMIDIAccess","requestMediaKeySystemAccess","requestPermission","requestPictureInPicture","requestPointerLock","requestPresent","requestReferenceSpace","requestSession","requestStart","requestStorageAccess","requestSubmit","requestVideoFrameCallback","requestingWindow","requireInteraction","required","requiredExtensions","requiredFeatures","reset","resetPose","resetTransform","resize","resizeBy","resizeTo","resolve","response","responseBody","responseEnd","responseReady","responseStart","responseText","responseType","responseURL","responseXML","restartIce","restore","result","resultIndex","resultType","results","resume","resumeProfilers","resumeTransformFeedback","retry","returnValue","rev","reverse","reversed","revocable","revokeObjectURL","rgbColor","right","rightContext","rightDegrees","rightMargin","rightProjectionMatrix","rightViewMatrix","role","rolloffFactor","root","rootBounds","rootElement","rootMargin","rotate","rotateAxisAngle","rotateAxisAngleSelf","rotateFromVector","rotateFromVectorSelf","rotateSelf","rotation","rotationAngle","rotationRate","round","row-gap","rowGap","rowIndex","rowSpan","rows","rtcpTransport","rtt","ruby-align","ruby-position","rubyAlign","rubyOverhang","rubyPosition","rules","runtime","runtimeStyle","rx","ry","s","safari","sample","sampleCoverage","sampleRate","samplerParameterf","samplerParameteri","sandbox","save","saveData","scale","scale3d","scale3dSelf","scaleNonUniform","scaleNonUniformSelf","scaleSelf","scheme","scissor","scope","scopeName","scoped","screen","screenBrightness","screenEnabled","screenLeft","screenPixelToMillimeterX","screenPixelToMillimeterY","screenTop","screenX","screenY","scriptURL","scripts","scroll","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","scrollAmount","scrollBehavior","scrollBy","scrollByLines","scrollByPages","scrollDelay","scrollHeight","scrollIntoView","scrollIntoViewIfNeeded","scrollLeft","scrollLeftMax","scrollMargin","scrollMarginBlock","scrollMarginBlockEnd","scrollMarginBlockStart","scrollMarginBottom","scrollMarginInline","scrollMarginInlineEnd","scrollMarginInlineStart","scrollMarginLeft","scrollMarginRight","scrollMarginTop","scrollMaxX","scrollMaxY","scrollPadding","scrollPaddingBlock","scrollPaddingBlockEnd","scrollPaddingBlockStart","scrollPaddingBottom","scrollPaddingInline","scrollPaddingInlineEnd","scrollPaddingInlineStart","scrollPaddingLeft","scrollPaddingRight","scrollPaddingTop","scrollRestoration","scrollSnapAlign","scrollSnapType","scrollTo","scrollTop","scrollTopMax","scrollWidth","scrollX","scrollY","scrollbar-color","scrollbar-width","scrollbar3dLightColor","scrollbarArrowColor","scrollbarBaseColor","scrollbarColor","scrollbarDarkShadowColor","scrollbarFaceColor","scrollbarHighlightColor","scrollbarShadowColor","scrollbarTrackColor","scrollbarWidth","scrollbars","scrolling","scrollingElement","sctp","sctpCauseCode","sdp","sdpLineNumber","sdpMLineIndex","sdpMid","seal","search","searchBox","searchBoxJavaBridge_","searchParams","sectionRowIndex","secureConnectionStart","security","seed","seekToNextFrame","seekable","seeking","select","selectAllChildren","selectAlternateInterface","selectConfiguration","selectNode","selectNodeContents","selectNodes","selectSingleNode","selectSubString","selected","selectedIndex","selectedOptions","selectedStyleSheetSet","selectedStylesheetSet","selection","selectionDirection","selectionEnd","selectionStart","selector","selectorText","self","send","sendAsBinary","sendBeacon","sender","sentAlert","sentTimestamp","separator","serialNumber","serializeToString","serverTiming","service","serviceWorker","session","sessionId","sessionStorage","set","setActionHandler","setActive","setAlpha","setAppBadge","setAttribute","setAttributeNS","setAttributeNode","setAttributeNodeNS","setBaseAndExtent","setBigInt64","setBigUint64","setBingCurrentSearchDefault","setCapture","setCodecPreferences","setColor","setCompositeOperation","setConfiguration","setCurrentTime","setCustomValidity","setData","setDate","setDragImage","setEnd","setEndAfter","setEndBefore","setEndPoint","setFillColor","setFilterRes","setFloat32","setFloat64","setFloatValue","setFormValue","setFullYear","setHeaderValue","setHours","setIdentityProvider","setImmediate","setInt16","setInt32","setInt8","setInterval","setItem","setKeyframes","setLineCap","setLineDash","setLineJoin","setLineWidth","setLiveSeekableRange","setLocalDescription","setMatrix","setMatrixValue","setMediaKeys","setMilliseconds","setMinutes","setMiterLimit","setMonth","setNamedItem","setNamedItemNS","setNonUserCodeExceptions","setOrientToAngle","setOrientToAuto","setOrientation","setOverrideHistoryNavigationMode","setPaint","setParameter","setParameters","setPeriodicWave","setPointerCapture","setPosition","setPositionState","setPreference","setProperty","setPrototypeOf","setRGBColor","setRGBColorICCColor","setRadius","setRangeText","setRemoteDescription","setRequestHeader","setResizable","setResourceTimingBufferSize","setRotate","setScale","setSeconds","setSelectionRange","setServerCertificate","setShadow","setSinkId","setSkewX","setSkewY","setStart","setStartAfter","setStartBefore","setStdDeviation","setStreams","setStringValue","setStrokeColor","setSuggestResult","setTargetAtTime","setTargetValueAtTime","setTime","setTimeout","setTransform","setTranslate","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setUint16","setUint32","setUint8","setUri","setValidity","setValueAtTime","setValueCurveAtTime","setVariable","setVelocity","setVersion","setYear","settingName","settingValue","sex","shaderSource","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","shadowRoot","shape","shape-image-threshold","shape-margin","shape-outside","shape-rendering","shapeImageThreshold","shapeMargin","shapeOutside","shapeRendering","sheet","shift","shiftKey","shiftLeft","shippingAddress","shippingOption","shippingType","show","showHelp","showModal","showModalDialog","showModelessDialog","showNotification","sidebar","sign","signal","signalingState","signature","silent","sin","singleNodeValue","sinh","sinkId","sittingToStandingTransform","size","sizeToContent","sizeX","sizeZ","sizes","skewX","skewXSelf","skewY","skewYSelf","slice","slope","slot","small","smil","smooth","smoothingTimeConstant","snapToLines","snapshotItem","snapshotLength","some","sort","sortingCode","source","sourceBuffer","sourceBuffers","sourceCapabilities","sourceFile","sourceIndex","sources","spacing","span","speak","speakAs","speaking","species","specified","specularConstant","specularExponent","speechSynthesis","speed","speedOfSound","spellcheck","splice","split","splitText","spreadMethod","sqrt","src","srcElement","srcFilter","srcObject","srcUrn","srcdoc","srclang","srcset","stack","stackTraceLimit","stacktrace","stageParameters","standalone","standby","start","startContainer","startIce","startMessages","startNotifications","startOffset","startProfiling","startRendering","startShark","startTime","startsWith","state","status","statusCode","statusMessage","statusText","statusbar","stdDeviationX","stdDeviationY","stencilFunc","stencilFuncSeparate","stencilMask","stencilMaskSeparate","stencilOp","stencilOpSeparate","step","stepDown","stepMismatch","stepUp","sticky","stitchTiles","stop","stop-color","stop-opacity","stopColor","stopImmediatePropagation","stopNotifications","stopOpacity","stopProfiling","stopPropagation","stopShark","stopped","storage","storageArea","storageName","storageStatus","store","storeSiteSpecificTrackingException","storeWebWideTrackingException","stpVersion","stream","streams","stretch","strike","string","stringValue","stringify","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeRect","strokeStyle","strokeText","strokeWidth","style","styleFloat","styleMap","styleMedia","styleSheet","styleSheetSets","styleSheets","sub","subarray","subject","submit","submitFrame","submitter","subscribe","substr","substring","substringData","subtle","subtree","suffix","suffixes","summary","sup","supported","supportedContentEncodings","supportedEntryTypes","supports","supportsSession","surfaceScale","surroundContents","suspend","suspendRedraw","swapCache","swapNode","sweepFlag","symbols","sync","sysexEnabled","system","systemCode","systemId","systemLanguage","systemXDPI","systemYDPI","tBodies","tFoot","tHead","tabIndex","table","table-layout","tableLayout","tableValues","tag","tagName","tagUrn","tags","taintEnabled","takePhoto","takeRecords","tan","tangentialPressure","tanh","target","targetElement","targetRayMode","targetRaySpace","targetTouches","targetX","targetY","tcpType","tee","tel","terminate","test","texImage2D","texImage3D","texParameterf","texParameteri","texStorage2D","texStorage3D","texSubImage2D","texSubImage3D","text","text-align","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-offset","text-underline-position","textAlign","textAlignLast","textAnchor","textAutospace","textBaseline","textCombineUpright","textContent","textDecoration","textDecorationBlink","textDecorationColor","textDecorationLine","textDecorationLineThrough","textDecorationNone","textDecorationOverline","textDecorationSkipInk","textDecorationStyle","textDecorationThickness","textDecorationUnderline","textEmphasis","textEmphasisColor","textEmphasisPosition","textEmphasisStyle","textIndent","textJustify","textJustifyTrim","textKashida","textKashidaSpace","textLength","textOrientation","textOverflow","textRendering","textShadow","textTracks","textTransform","textUnderlineOffset","textUnderlinePosition","then","threadId","threshold","thresholds","tiltX","tiltY","time","timeEnd","timeLog","timeOrigin","timeRemaining","timeStamp","timecode","timeline","timelineTime","timeout","timestamp","timestampOffset","timing","title","to","toArray","toBlob","toDataURL","toDateString","toElement","toExponential","toFixed","toFloat32Array","toFloat64Array","toGMTString","toISOString","toJSON","toLocaleDateString","toLocaleFormat","toLocaleLowerCase","toLocaleString","toLocaleTimeString","toLocaleUpperCase","toLowerCase","toMatrix","toMethod","toPrecision","toPrimitive","toSdp","toSource","toStaticHTML","toString","toStringTag","toSum","toTimeString","toUTCString","toUpperCase","toggle","toggleAttribute","toggleLongPressEnabled","tone","toneBuffer","tooLong","tooShort","toolbar","top","topMargin","total","totalFrameDelay","totalVideoFrames","touch-action","touchAction","touched","touches","trace","track","trackVisibility","transaction","transactions","transceiver","transferControlToOffscreen","transferFromImageBitmap","transferImageBitmap","transferIn","transferOut","transferSize","transferToImageBitmap","transform","transform-box","transform-origin","transform-style","transformBox","transformFeedbackVaryings","transformOrigin","transformPoint","transformString","transformStyle","transformToDocument","transformToFragment","transition","transition-delay","transition-duration","transition-property","transition-timing-function","transitionDelay","transitionDuration","transitionProperty","transitionTimingFunction","translate","translateSelf","translationX","translationY","transport","trim","trimEnd","trimLeft","trimRight","trimStart","trueSpeed","trunc","truncate","trustedTypes","turn","twist","type","typeDetail","typeMismatch","typeMustMatch","types","u2f","ubound","uint16","uint32","uint8","uint8Clamped","undefined","unescape","uneval","unicode","unicode-bidi","unicodeBidi","unicodeRange","uniform1f","uniform1fv","uniform1i","uniform1iv","uniform1ui","uniform1uiv","uniform2f","uniform2fv","uniform2i","uniform2iv","uniform2ui","uniform2uiv","uniform3f","uniform3fv","uniform3i","uniform3iv","uniform3ui","uniform3uiv","uniform4f","uniform4fv","uniform4i","uniform4iv","uniform4ui","uniform4uiv","uniformBlockBinding","uniformMatrix2fv","uniformMatrix2x3fv","uniformMatrix2x4fv","uniformMatrix3fv","uniformMatrix3x2fv","uniformMatrix3x4fv","uniformMatrix4fv","uniformMatrix4x2fv","uniformMatrix4x3fv","unique","uniqueID","uniqueNumber","unit","unitType","units","unloadEventEnd","unloadEventStart","unlock","unmount","unobserve","unpause","unpauseAnimations","unreadCount","unregister","unregisterContentHandler","unregisterProtocolHandler","unscopables","unselectable","unshift","unsubscribe","unsuspendRedraw","unsuspendRedrawAll","unwatch","unwrapKey","upDegrees","upX","upY","upZ","update","updateCommands","updateIce","updateInterval","updatePlaybackRate","updateRenderState","updateSettings","updateTiming","updateViaCache","updateWith","updated","updating","upgrade","upload","uploadTotal","uploaded","upper","upperBound","upperOpen","uri","url","urn","urns","usages","usb","usbVersionMajor","usbVersionMinor","usbVersionSubminor","useCurrentView","useMap","useProgram","usedSpace","user-select","userActivation","userAgent","userChoice","userHandle","userHint","userLanguage","userSelect","userVisibleOnly","username","usernameFragment","utterance","uuid","v8BreakIterator","vAlign","vLink","valid","validate","validateProgram","validationMessage","validity","value","valueAsDate","valueAsNumber","valueAsString","valueInSpecifiedUnits","valueMissing","valueOf","valueText","valueType","values","variable","variant","variationSettings","vector-effect","vectorEffect","velocityAngular","velocityExpansion","velocityX","velocityY","vendor","vendorId","vendorSub","verify","version","vertexAttrib1f","vertexAttrib1fv","vertexAttrib2f","vertexAttrib2fv","vertexAttrib3f","vertexAttrib3fv","vertexAttrib4f","vertexAttrib4fv","vertexAttribDivisor","vertexAttribDivisorANGLE","vertexAttribI4i","vertexAttribI4iv","vertexAttribI4ui","vertexAttribI4uiv","vertexAttribIPointer","vertexAttribPointer","vertical","vertical-align","verticalAlign","verticalOverflow","vh","vibrate","vibrationActuator","videoBitsPerSecond","videoHeight","videoTracks","videoWidth","view","viewBox","viewBoxString","viewTarget","viewTargetString","viewport","viewportAnchorX","viewportAnchorY","viewportElement","views","violatedDirective","visibility","visibilityState","visible","visualViewport","vlinkColor","vmax","vmin","voice","voiceURI","volume","vrml","vspace","vw","w","wait","waitSync","waiting","wake","wakeLock","wand","warn","wasClean","wasDiscarded","watch","watchAvailability","watchPosition","webdriver","webkitAddKey","webkitAlignContent","webkitAlignItems","webkitAlignSelf","webkitAnimation","webkitAnimationDelay","webkitAnimationDirection","webkitAnimationDuration","webkitAnimationFillMode","webkitAnimationIterationCount","webkitAnimationName","webkitAnimationPlayState","webkitAnimationTimingFunction","webkitAppearance","webkitAudioContext","webkitAudioDecodedByteCount","webkitAudioPannerNode","webkitBackfaceVisibility","webkitBackground","webkitBackgroundAttachment","webkitBackgroundClip","webkitBackgroundColor","webkitBackgroundImage","webkitBackgroundOrigin","webkitBackgroundPosition","webkitBackgroundPositionX","webkitBackgroundPositionY","webkitBackgroundRepeat","webkitBackgroundSize","webkitBackingStorePixelRatio","webkitBorderBottomLeftRadius","webkitBorderBottomRightRadius","webkitBorderImage","webkitBorderImageOutset","webkitBorderImageRepeat","webkitBorderImageSlice","webkitBorderImageSource","webkitBorderImageWidth","webkitBorderRadius","webkitBorderTopLeftRadius","webkitBorderTopRightRadius","webkitBoxAlign","webkitBoxDirection","webkitBoxFlex","webkitBoxOrdinalGroup","webkitBoxOrient","webkitBoxPack","webkitBoxShadow","webkitBoxSizing","webkitCancelAnimationFrame","webkitCancelFullScreen","webkitCancelKeyRequest","webkitCancelRequestAnimationFrame","webkitClearResourceTimings","webkitClosedCaptionsVisible","webkitConvertPointFromNodeToPage","webkitConvertPointFromPageToNode","webkitCreateShadowRoot","webkitCurrentFullScreenElement","webkitCurrentPlaybackTargetIsWireless","webkitDecodedFrameCount","webkitDirectionInvertedFromDevice","webkitDisplayingFullscreen","webkitDroppedFrameCount","webkitEnterFullScreen","webkitEnterFullscreen","webkitEntries","webkitExitFullScreen","webkitExitFullscreen","webkitExitPointerLock","webkitFilter","webkitFlex","webkitFlexBasis","webkitFlexDirection","webkitFlexFlow","webkitFlexGrow","webkitFlexShrink","webkitFlexWrap","webkitFullScreenKeyboardInputAllowed","webkitFullscreenElement","webkitFullscreenEnabled","webkitGenerateKeyRequest","webkitGetAsEntry","webkitGetDatabaseNames","webkitGetEntries","webkitGetEntriesByName","webkitGetEntriesByType","webkitGetFlowByName","webkitGetGamepads","webkitGetImageDataHD","webkitGetNamedFlows","webkitGetRegionFlowRanges","webkitGetUserMedia","webkitHasClosedCaptions","webkitHidden","webkitIDBCursor","webkitIDBDatabase","webkitIDBDatabaseError","webkitIDBDatabaseException","webkitIDBFactory","webkitIDBIndex","webkitIDBKeyRange","webkitIDBObjectStore","webkitIDBRequest","webkitIDBTransaction","webkitImageSmoothingEnabled","webkitIndexedDB","webkitInitMessageEvent","webkitIsFullScreen","webkitJustifyContent","webkitKeys","webkitLineClamp","webkitLineDashOffset","webkitLockOrientation","webkitMask","webkitMaskClip","webkitMaskComposite","webkitMaskImage","webkitMaskOrigin","webkitMaskPosition","webkitMaskPositionX","webkitMaskPositionY","webkitMaskRepeat","webkitMaskSize","webkitMatchesSelector","webkitMediaStream","webkitNotifications","webkitOfflineAudioContext","webkitOrder","webkitOrientation","webkitPeerConnection00","webkitPersistentStorage","webkitPerspective","webkitPerspectiveOrigin","webkitPointerLockElement","webkitPostMessage","webkitPreservesPitch","webkitPutImageDataHD","webkitRTCPeerConnection","webkitRegionOverset","webkitRelativePath","webkitRequestAnimationFrame","webkitRequestFileSystem","webkitRequestFullScreen","webkitRequestFullscreen","webkitRequestPointerLock","webkitResolveLocalFileSystemURL","webkitSetMediaKeys","webkitSetResourceTimingBufferSize","webkitShadowRoot","webkitShowPlaybackTargetPicker","webkitSlice","webkitSpeechGrammar","webkitSpeechGrammarList","webkitSpeechRecognition","webkitSpeechRecognitionError","webkitSpeechRecognitionEvent","webkitStorageInfo","webkitSupportsFullscreen","webkitTemporaryStorage","webkitTextFillColor","webkitTextSizeAdjust","webkitTextStroke","webkitTextStrokeColor","webkitTextStrokeWidth","webkitTransform","webkitTransformOrigin","webkitTransformStyle","webkitTransition","webkitTransitionDelay","webkitTransitionDuration","webkitTransitionProperty","webkitTransitionTimingFunction","webkitURL","webkitUnlockOrientation","webkitUserSelect","webkitVideoDecodedByteCount","webkitVisibilityState","webkitWirelessVideoPlaybackDisabled","webkitdirectory","webkitdropzone","webstore","weight","whatToShow","wheelDelta","wheelDeltaX","wheelDeltaY","whenDefined","which","white-space","whiteSpace","wholeText","widows","width","will-change","willChange","willValidate","window","withCredentials","word-break","word-spacing","word-wrap","wordBreak","wordSpacing","wordWrap","workerStart","wrap","wrapKey","writable","writableAuxiliaries","write","writeText","writeValue","writeWithoutResponse","writeln","writing-mode","writingMode","x","x1","x2","xChannelSelector","xmlEncoding","xmlStandalone","xmlVersion","xmlbase","xmllang","xmlspace","xor","xr","y","y1","y2","yChannelSelector","yandex","z","z-index","zIndex","zoom","zoomAndPan","zoomRectScreen"];function find_builtins(e){domprops.forEach(o);var t={},n="object"==typeof global?global:self;function o(t){e.add(t);}["Symbol","Map","Promise","Proxy","Reflect","Set","WeakMap","WeakSet"].forEach((function(e){t[e]=n[e]||new Function;})),["null","true","false","NaN","Infinity","-Infinity","undefined"].forEach(o),[Object,Array,Function,Number,String,Boolean,Error,Math,Date,RegExp,t.Symbol,ArrayBuffer,DataView,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,eval,EvalError,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,isFinite,isNaN,JSON,t.Map,parseFloat,parseInt,t.Promise,t.Proxy,RangeError,ReferenceError,t.Reflect,t.Set,SyntaxError,TypeError,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,URIError,t.WeakMap,t.WeakSet].forEach((function(e){Object.getOwnPropertyNames(e).map(o),e.prototype&&Object.getOwnPropertyNames(e.prototype).map(o);}));}function reserve_quoted_keys(e,t){function n(e){push_uniq(t,e);}e.walk(new TreeWalker((function(e){e instanceof AST_ObjectKeyVal&&e.quote?n(e.key):e instanceof AST_ObjectProperty&&e.quote?n(e.key.name):e instanceof AST_Sub&&addStrings(e.property,n);})));}function addStrings(e,t){e.walk(new TreeWalker((function(e){return e instanceof AST_Sequence?addStrings(e.tail_node(),t):e instanceof AST_String?t(e.value):e instanceof AST_Conditional&&(addStrings(e.consequent,t),addStrings(e.alternative,t)),!0})));}function mangle_properties(e,t){var n=(t=defaults$1(t,{builtins:!1,cache:null,debug:!1,keep_quoted:!1,only_cache:!1,regex:null,reserved:null,undeclared:!1},!0)).reserved;Array.isArray(n)||(n=[n]);var o=new Set(n);t.builtins||find_builtins(o);var i,r=-1,a=-1,s=new Map;t.cache?(i=t.cache.props).forEach((function(e){o.add(e);})):i=new Map;var u,l=t.regex&&new RegExp(t.regex),_=!1!==t.debug;_&&(u=!0===t.debug?"":t.debug);var c=new Set,f=new Set,p=new Set,d="strict"===t.keep_quoted;return e.walk(new TreeWalker((function(e){if(e instanceof AST_ClassPrivateProperty||e instanceof AST_PrivateMethod)p.add(e.key.name);else if(e instanceof AST_DotHash)p.add(e.property);else if(e instanceof AST_ObjectKeyVal)"string"!=typeof e.key||d&&e.quote||A(e.key);else if(e instanceof AST_ObjectProperty)d&&e.key.end.quote||A(e.key.name);else if(e instanceof AST_Dot){var n=!!t.undeclared;if(!n){for(var o=e;o.expression;)o=o.expression;n=!(o.thedef&&o.thedef.undeclared);}!n||d&&e.quote||A(e.property);}else e instanceof AST_Sub?d||addStrings(e.property,A):e instanceof AST_Call&&"Object.defineProperty"==e.expression.print_to_string()?addStrings(e.args[1],A):e instanceof AST_Binary&&"in"===e.operator&&addStrings(e.left,A);}))),e.transform(new TreeTransformer((function(e){e instanceof AST_ClassPrivateProperty||e instanceof AST_PrivateMethod?e.key.name=h(e.key.name):e instanceof AST_DotHash?e.property=h(e.property):e instanceof AST_ObjectKeyVal?"string"!=typeof e.key||d&&e.quote||(e.key=T(e.key)):e instanceof AST_ObjectProperty?d&&e.key.end.quote||(e.key.name=T(e.key.name)):e instanceof AST_Dot?d&&e.quote||(e.property=T(e.property)):!t.keep_quoted&&e instanceof AST_Sub?e.property=E(e.property):e instanceof AST_Call&&"Object.defineProperty"==e.expression.print_to_string()?e.args[1]=E(e.args[1]):e instanceof AST_Binary&&"in"===e.operator&&(e.left=E(e.left));})));function S(e){return !f.has(e)&&!o.has(e)&&(t.only_cache?i.has(e):!/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(e))}function m(e){return !(l&&!l.test(e))&&!o.has(e)&&(i.has(e)||c.has(e))}function A(e){S(e)&&c.add(e),m(e)||f.add(e);}function T(e){if(!m(e))return e;var t=i.get(e);if(!t){if(_){var n="_$"+e+"$"+u+"_";S(n)&&(t=n);}if(!t)do{t=base54(++r);}while(!S(t));i.set(e,t);}return t}function h(e){let t=s.get(e);return t||(t=base54(++a),s.set(e,t)),t}function E(e){return e.transform(new TreeTransformer((function(e){if(e instanceof AST_Sequence){var t=e.expressions.length-1;e.expressions[t]=E(e.expressions[t]);}else e instanceof AST_String?e.value=T(e.value):e instanceof AST_Conditional&&(e.consequent=E(e.consequent),e.alternative=E(e.alternative));return e})))}}var to_ascii="undefined"==typeof atob?function(e){return Buffer.from(e,"base64").toString()}:atob,to_base64="undefined"==typeof btoa?function(e){return Buffer.from(e).toString("base64")}:btoa;function read_source_map(e){var t=/(?:^|[^.])\/\/# sourceMappingURL=data:application\/json(;[\w=-]*)?;base64,([+/0-9A-Za-z]*=*)\s*$/.exec(e);return t?to_ascii(t[2]):(console.warn("inline source map not found"),null)}function set_shorthand(e,t,n){t[e]&&n.forEach((function(n){t[n]&&("object"!=typeof t[n]&&(t[n]={}),e in t[n]||(t[n][e]=t[e]));}));}function init_cache(e){e&&("props"in e?e.props instanceof Map||(e.props=map_from_object(e.props)):e.props=new Map);}function cache_to_json(e){return {props:map_to_object(e.props)}}async function minify(e,t){var n,o,i=(t=defaults$1(t,{compress:{},ecma:void 0,enclose:!1,ie8:!1,keep_classnames:void 0,keep_fnames:!1,mangle:{},module:!1,nameCache:null,output:null,format:null,parse:{},rename:void 0,safari10:!1,sourceMap:!1,timings:!1,toplevel:!1,warnings:!1,wrap:!1},!0)).timings&&{start:Date.now()};if(void 0===t.keep_classnames&&(t.keep_classnames=t.keep_fnames),void 0===t.rename&&(t.rename=t.compress&&t.mangle),t.output&&t.format)throw new Error("Please only specify either output or format option, preferrably format.");if(t.format=t.format||t.output||{},set_shorthand("ecma",t,["parse","compress","format"]),set_shorthand("ie8",t,["compress","mangle","format"]),set_shorthand("keep_classnames",t,["compress","mangle"]),set_shorthand("keep_fnames",t,["compress","mangle"]),set_shorthand("module",t,["parse","compress","mangle"]),set_shorthand("safari10",t,["mangle","format"]),set_shorthand("toplevel",t,["compress","mangle"]),set_shorthand("warnings",t,["compress"]),t.mangle&&(t.mangle=defaults$1(t.mangle,{cache:t.nameCache&&(t.nameCache.vars||{}),eval:!1,ie8:!1,keep_classnames:!1,keep_fnames:!1,module:!1,properties:!1,reserved:[],safari10:!1,toplevel:!1},!0),t.mangle.properties&&("object"!=typeof t.mangle.properties&&(t.mangle.properties={}),t.mangle.properties.keep_quoted&&(n=t.mangle.properties.reserved,Array.isArray(n)||(n=[]),t.mangle.properties.reserved=n),t.nameCache&&!("cache"in t.mangle.properties)&&(t.mangle.properties.cache=t.nameCache.props||{})),init_cache(t.mangle.cache),init_cache(t.mangle.properties.cache)),t.sourceMap&&(t.sourceMap=defaults$1(t.sourceMap,{asObject:!1,content:null,filename:null,includeSources:!1,root:null,url:null},!0)),i&&(i.parse=Date.now()),e instanceof AST_Toplevel)o=e;else {for(var r in "string"==typeof e&&(e=[e]),t.parse=t.parse||{},t.parse.toplevel=null,e)if(HOP(e,r)&&(t.parse.filename=r,t.parse.toplevel=parse$5(e[r],t.parse),t.sourceMap&&"inline"==t.sourceMap.content)){if(Object.keys(e).length>1)throw new Error("inline source map only works with singular input");t.sourceMap.content=read_source_map(e[r]);}o=t.parse.toplevel;}n&&"strict"!==t.mangle.properties.keep_quoted&&reserve_quoted_keys(o,n),t.wrap&&(o=o.wrap_commonjs(t.wrap)),t.enclose&&(o=o.wrap_enclose(t.enclose)),i&&(i.rename=Date.now()),i&&(i.compress=Date.now()),t.compress&&(o=new Compressor(t.compress,{mangle_options:t.mangle}).compress(o)),i&&(i.scope=Date.now()),t.mangle&&o.figure_out_scope(t.mangle),i&&(i.mangle=Date.now()),t.mangle&&(base54.reset(),o.compute_char_frequency(t.mangle),o.mangle_names(t.mangle)),i&&(i.properties=Date.now()),t.mangle&&t.mangle.properties&&(o=mangle_properties(o,t.mangle.properties)),i&&(i.format=Date.now());var a={};if(t.format.ast&&(a.ast=o),!HOP(t.format,"code")||t.format.code){if(t.sourceMap&&(t.format.source_map=await SourceMap$4({file:t.sourceMap.filename,orig:t.sourceMap.content,root:t.sourceMap.root}),t.sourceMap.includeSources)){if(e instanceof AST_Toplevel)throw new Error("original source content unavailable");for(var r in e)HOP(e,r)&&t.format.source_map.get().setSourceContent(r,e[r]);}delete t.format.ast,delete t.format.code;var s=OutputStream(t.format);if(o.print(s),a.code=s.get(),t.sourceMap)if(t.sourceMap.asObject?a.map=t.format.source_map.get().toJSON():a.map=t.format.source_map.toString(),"inline"==t.sourceMap.url){var u="object"==typeof a.map?JSON.stringify(a.map):a.map;a.code+="\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,"+to_base64(u);}else t.sourceMap.url&&(a.code+="\n//# sourceMappingURL="+t.sourceMap.url);}return t.nameCache&&t.mangle&&(t.mangle.cache&&(t.nameCache.vars=cache_to_json(t.mangle.cache)),t.mangle.properties&&t.mangle.properties.cache&&(t.nameCache.props=cache_to_json(t.mangle.properties.cache))),t.format&&t.format.source_map&&t.format.source_map.destroy(),i&&(i.end=Date.now(),a.timings={parse:.001*(i.rename-i.parse),rename:.001*(i.compress-i.rename),compress:.001*(i.scope-i.compress),scope:.001*(i.mangle-i.scope),mangle:.001*(i.properties-i.mangle),properties:.001*(i.format-i.properties),format:.001*(i.end-i.format),total:.001*(i.end-i.start)}),a}
  8301. /**
  8302. * Performs the minification of JavaScript source
  8303. * @param input the JavaScript source to minify
  8304. * @param opts the options used by the minifier
  8305. * @returns the resulting minified JavaScript
  8306. */
  8307. const minifyJs = async (input, opts) => {
  8308. const results = {
  8309. output: input,
  8310. sourceMap: null,
  8311. diagnostics: [],
  8312. };
  8313. if (opts) {
  8314. const mangle = opts.mangle;
  8315. if (mangle) {
  8316. const mangleProperties = mangle.properties;
  8317. if (mangleProperties && mangleProperties.regex) {
  8318. mangleProperties.regex = new RegExp(mangleProperties.regex);
  8319. }
  8320. }
  8321. if (opts.sourceMap) {
  8322. /**
  8323. * sourceMap, when used in conjunction with compress, can lead to sourcemaps that don't in every browser. despite
  8324. * there being a sourcemap spec, each browser has it's own tricks for trying to get sourcemaps to properly map
  8325. * minified JS back to its original form. for the most consistent results across all browsers, explicitly disable
  8326. * compress.
  8327. */
  8328. opts.compress = undefined;
  8329. }
  8330. }
  8331. try {
  8332. const minifyResults = await minify(input, opts);
  8333. results.output = minifyResults.code;
  8334. results.sourceMap = typeof minifyResults.map === 'string' ? JSON.parse(minifyResults.map) : minifyResults.map;
  8335. const compress = opts.compress;
  8336. if (compress && compress.module && results.output.endsWith('};')) {
  8337. // stripping the semicolon here _shouldn't_ be of significant consequence for the already generated sourcemap
  8338. results.output = results.output.substring(0, results.output.length - 1);
  8339. }
  8340. }
  8341. catch (e) {
  8342. if (e instanceof Error) {
  8343. console.log(e.stack);
  8344. }
  8345. loadMinifyJsDiagnostics(input, results.diagnostics, e);
  8346. }
  8347. return results;
  8348. };
  8349. const loadMinifyJsDiagnostics = (sourceText, diagnostics, error) => {
  8350. const d = {
  8351. level: 'error',
  8352. type: 'build',
  8353. language: 'javascript',
  8354. header: 'Minify JS',
  8355. code: '',
  8356. messageText: error.message,
  8357. absFilePath: null,
  8358. relFilePath: null,
  8359. lines: [],
  8360. };
  8361. const err = error;
  8362. if (typeof err.line === 'number' && err.line > -1) {
  8363. const srcLines = splitLineBreaks(sourceText);
  8364. const errorLine = {
  8365. lineIndex: err.line - 1,
  8366. lineNumber: err.line,
  8367. text: srcLines[err.line - 1],
  8368. errorCharStart: err.col,
  8369. errorLength: 0,
  8370. };
  8371. d.lineNumber = errorLine.lineNumber;
  8372. d.columnNumber = errorLine.errorCharStart;
  8373. const highlightLine = errorLine.text.slice(d.columnNumber);
  8374. for (let i = 0; i < highlightLine.length; i++) {
  8375. if (MINIFY_CHAR_BREAK.has(highlightLine.charAt(i))) {
  8376. break;
  8377. }
  8378. errorLine.errorLength++;
  8379. }
  8380. d.lines.push(errorLine);
  8381. if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
  8382. errorLine.errorLength = 1;
  8383. errorLine.errorCharStart--;
  8384. }
  8385. if (errorLine.lineIndex > 0) {
  8386. const previousLine = {
  8387. lineIndex: errorLine.lineIndex - 1,
  8388. lineNumber: errorLine.lineNumber - 1,
  8389. text: srcLines[errorLine.lineIndex - 1],
  8390. errorCharStart: -1,
  8391. errorLength: -1,
  8392. };
  8393. d.lines.unshift(previousLine);
  8394. }
  8395. if (errorLine.lineIndex + 1 < srcLines.length) {
  8396. const nextLine = {
  8397. lineIndex: errorLine.lineIndex + 1,
  8398. lineNumber: errorLine.lineNumber + 1,
  8399. text: srcLines[errorLine.lineIndex + 1],
  8400. errorCharStart: -1,
  8401. errorLength: -1,
  8402. };
  8403. d.lines.push(nextLine);
  8404. }
  8405. }
  8406. diagnostics.push(d);
  8407. };
  8408. const MINIFY_CHAR_BREAK = new Set([
  8409. ' ',
  8410. '=',
  8411. '.',
  8412. ',',
  8413. '?',
  8414. ':',
  8415. ';',
  8416. '(',
  8417. ')',
  8418. '{',
  8419. '}',
  8420. '[',
  8421. ']',
  8422. '|',
  8423. `'`,
  8424. `"`,
  8425. '`',
  8426. ]);
  8427. /**
  8428. * Begins the process of minifying a user's JavaScript
  8429. * @param config the Stencil configuration file that was provided as a part of the build step
  8430. * @param compilerCtx the current compiler context
  8431. * @param opts minification options that specify how the JavaScript ought to be minified
  8432. * @returns the minified JavaScript result
  8433. */
  8434. const optimizeModule = async (config, compilerCtx, opts) => {
  8435. if ((!opts.minify && opts.sourceTarget !== 'es5') || opts.input === '') {
  8436. return {
  8437. output: opts.input,
  8438. diagnostics: [],
  8439. sourceMap: opts.sourceMap,
  8440. };
  8441. }
  8442. const isDebug = config.logLevel === 'debug';
  8443. const cacheKey = await compilerCtx.cache.createKey('optimizeModule', minfyJsId, opts, isDebug);
  8444. const cachedContent = await compilerCtx.cache.get(cacheKey);
  8445. if (cachedContent != null) {
  8446. const cachedMap = await compilerCtx.cache.get(cacheKey + 'Map');
  8447. return {
  8448. output: cachedContent,
  8449. diagnostics: [],
  8450. sourceMap: cachedMap ? JSON.parse(cachedMap) : null,
  8451. };
  8452. }
  8453. let minifyOpts;
  8454. let code = opts.input;
  8455. if (opts.isCore) {
  8456. // IS_ESM_BUILD is replaced at build time so systemjs and esm builds have diff values
  8457. // not using the BUILD conditional since rollup would input the same value
  8458. code = code.replace(/\/\* IS_ESM_BUILD \*\//g, '&& false /* IS_SYSTEM_JS_BUILD */');
  8459. }
  8460. if (opts.sourceTarget === 'es5' || opts.minify) {
  8461. minifyOpts = getTerserOptions(config, opts.sourceTarget, isDebug);
  8462. if (config.sourceMap) {
  8463. minifyOpts.sourceMap = { content: opts.sourceMap };
  8464. }
  8465. const compressOpts = minifyOpts.compress;
  8466. const mangleOptions = minifyOpts.mangle;
  8467. if (opts.sourceTarget !== 'es5' && opts.isCore) {
  8468. if (!isDebug) {
  8469. compressOpts.passes = 2;
  8470. compressOpts.global_defs = {
  8471. supportsListenerOptions: true,
  8472. 'plt.$cssShim$': false,
  8473. };
  8474. compressOpts.pure_funcs = compressOpts.pure_funcs || [];
  8475. compressOpts.pure_funcs = ['getHostRef', ...compressOpts.pure_funcs];
  8476. }
  8477. mangleOptions.properties = {
  8478. regex: '^\\$.+\\$$',
  8479. debug: isDebug,
  8480. };
  8481. compressOpts.inline = 1;
  8482. compressOpts.unsafe = true;
  8483. compressOpts.unsafe_undefined = true;
  8484. }
  8485. }
  8486. const shouldTranspile = opts.sourceTarget === 'es5';
  8487. const results = await compilerCtx.worker.prepareModule(code, minifyOpts, shouldTranspile, opts.inlineHelpers);
  8488. if (results != null &&
  8489. typeof results.output === 'string' &&
  8490. results.diagnostics.length === 0 &&
  8491. compilerCtx != null) {
  8492. if (opts.isCore) {
  8493. results.output = results.output.replace(/disconnectedCallback\(\)\{\},/g, '');
  8494. }
  8495. await compilerCtx.cache.put(cacheKey, results.output);
  8496. if (results.sourceMap) {
  8497. await compilerCtx.cache.put(cacheKey + 'Map', JSON.stringify(results.sourceMap));
  8498. }
  8499. }
  8500. return results;
  8501. };
  8502. /**
  8503. * Builds a configuration object to be used by Terser for the purposes of minifying a user's JavaScript
  8504. * @param config the Stencil configuration file that was provided as a part of the build step
  8505. * @param sourceTarget the version of JavaScript being targeted (e.g. ES2017)
  8506. * @param prettyOutput if true, set the necessary flags to beautify the output of terser
  8507. * @returns the minification options
  8508. */
  8509. const getTerserOptions = (config, sourceTarget, prettyOutput) => {
  8510. const opts = {
  8511. ie8: false,
  8512. safari10: !!config.extras.safari10,
  8513. format: {},
  8514. sourceMap: config.sourceMap,
  8515. };
  8516. if (sourceTarget === 'es5') {
  8517. opts.ecma = opts.format.ecma = 5;
  8518. opts.compress = false;
  8519. opts.mangle = true;
  8520. }
  8521. else {
  8522. opts.mangle = {
  8523. properties: {
  8524. regex: '^\\$.+\\$$',
  8525. },
  8526. };
  8527. opts.compress = {
  8528. pure_getters: true,
  8529. keep_fargs: false,
  8530. passes: 2,
  8531. };
  8532. opts.ecma = opts.format.ecma = opts.compress.ecma = 2018;
  8533. opts.toplevel = true;
  8534. opts.module = true;
  8535. opts.mangle.toplevel = true;
  8536. opts.compress.arrows = true;
  8537. opts.compress.module = true;
  8538. opts.compress.toplevel = true;
  8539. }
  8540. if (prettyOutput) {
  8541. opts.mangle = { keep_fnames: true };
  8542. opts.compress = {};
  8543. opts.compress.drop_console = false;
  8544. opts.compress.drop_debugger = false;
  8545. opts.compress.pure_funcs = [];
  8546. opts.format.beautify = true;
  8547. opts.format.indent_level = 2;
  8548. opts.format.comments = 'all';
  8549. }
  8550. return opts;
  8551. };
  8552. /**
  8553. * This method is likely to be called by a worker on the compiler context, rather than directly.
  8554. * @param input the source code to minify
  8555. * @param minifyOpts options to be used by the minifier
  8556. * @param transpileToEs5 if true, use the TypeScript compiler to transpile the input to ES5 prior to minification
  8557. * @param inlineHelpers when true, emits less terse JavaScript by allowing global helpers created by the TypeScript
  8558. * compiler to be added directly to the transpiled source. Used only if `transpileToEs5` is true.
  8559. * @returns minified input, as JavaScript
  8560. */
  8561. const prepareModule = async (input, minifyOpts, transpileToEs5, inlineHelpers) => {
  8562. var _a;
  8563. const results = {
  8564. output: input,
  8565. diagnostics: [],
  8566. sourceMap: null,
  8567. };
  8568. if (transpileToEs5) {
  8569. const tsResults = t.transpileModule(input, {
  8570. fileName: 'module.ts',
  8571. compilerOptions: {
  8572. sourceMap: !!minifyOpts.sourceMap,
  8573. allowJs: true,
  8574. target: t.ScriptTarget.ES5,
  8575. module: t.ModuleKind.ESNext,
  8576. removeComments: false,
  8577. isolatedModules: true,
  8578. skipLibCheck: true,
  8579. noEmitHelpers: !inlineHelpers,
  8580. importHelpers: !inlineHelpers,
  8581. },
  8582. reportDiagnostics: false,
  8583. });
  8584. results.output = tsResults.outputText;
  8585. if (tsResults.sourceMapText) {
  8586. // need to merge sourcemaps at this point
  8587. const mergeMap = mergeSourceMap((_a = minifyOpts.sourceMap) === null || _a === void 0 ? void 0 : _a.content, JSON.parse(tsResults.sourceMapText));
  8588. minifyOpts.sourceMap = { content: mergeMap };
  8589. }
  8590. }
  8591. if (minifyOpts) {
  8592. return minifyJs(results.output, minifyOpts);
  8593. }
  8594. return results;
  8595. };
  8596. const crawlAnchorsForNextUrls = (prerenderConfig, diagnostics, baseUrl, currentUrl, parsedAnchors) => {
  8597. if (!Array.isArray(parsedAnchors) || parsedAnchors.length === 0) {
  8598. return [];
  8599. }
  8600. const basePathParts = baseUrl.pathname.split('/');
  8601. // filterAnchor(): filter which anchors to actually crawl
  8602. // normalizeUrl(): normalize href strings into URL objects
  8603. // filterUrl(): filter which urls to actually crawl
  8604. // normalizeHref(): normalize URL objects into href strings
  8605. return parsedAnchors
  8606. .filter((anchor) => {
  8607. // filter which anchors to actually crawl
  8608. if (typeof prerenderConfig.filterAnchor === 'function') {
  8609. // user filterAnchor()
  8610. try {
  8611. const userFilterAnchor = prerenderConfig.filterAnchor(anchor, currentUrl);
  8612. if (userFilterAnchor === false) {
  8613. return false;
  8614. }
  8615. }
  8616. catch (e) {
  8617. // user filterAnchor() error
  8618. catchError(diagnostics, e);
  8619. return false;
  8620. }
  8621. }
  8622. // standard filterAnchor()
  8623. return standardFilterAnchor(diagnostics, anchor);
  8624. })
  8625. .map((anchor) => {
  8626. // normalize href strings into URL objects
  8627. if (typeof prerenderConfig.normalizeUrl === 'function') {
  8628. try {
  8629. // user normalizeUrl()
  8630. const userNormalizedUrl = prerenderConfig.normalizeUrl(anchor.href, currentUrl);
  8631. // standard normalizeUrl(), after user normalized
  8632. return standardNormalizeUrl(diagnostics, userNormalizedUrl.href, currentUrl);
  8633. }
  8634. catch (e) {
  8635. // user normalizeUrl() error
  8636. catchError(diagnostics, e);
  8637. }
  8638. }
  8639. // standard normalizeUrl(), no user normalized
  8640. return standardNormalizeUrl(diagnostics, anchor.href, currentUrl);
  8641. })
  8642. .filter((url) => {
  8643. // filter which urls to actually crawl
  8644. if (typeof prerenderConfig.filterUrl === 'function') {
  8645. // user filterUrl()
  8646. try {
  8647. const userFilterUrl = prerenderConfig.filterUrl(url, currentUrl);
  8648. if (userFilterUrl === false) {
  8649. return false;
  8650. }
  8651. }
  8652. catch (e) {
  8653. // user filterUrl() error
  8654. catchError(diagnostics, e);
  8655. return false;
  8656. }
  8657. }
  8658. // standard filterUrl()
  8659. return standardFilterUrl(diagnostics, url, currentUrl, basePathParts);
  8660. })
  8661. .map((url) => {
  8662. // standard normalize href
  8663. // normalize URL objects into href strings
  8664. return standardNormalizeHref(prerenderConfig, diagnostics, url);
  8665. })
  8666. .reduce((hrefs, href) => {
  8667. // remove any duplicate hrefs from the array
  8668. if (!hrefs.includes(href)) {
  8669. hrefs.push(href);
  8670. }
  8671. return hrefs;
  8672. }, [])
  8673. .sort((a, b) => {
  8674. // sort the hrefs so the urls with the least amount
  8675. // of directories are first, then by alphabetical
  8676. const partsA = a.split('/').length;
  8677. const partsB = b.split('/').length;
  8678. if (partsA < partsB)
  8679. return -1;
  8680. if (partsA > partsB)
  8681. return 1;
  8682. if (a < b)
  8683. return -1;
  8684. if (a > b)
  8685. return 1;
  8686. return 0;
  8687. });
  8688. };
  8689. const standardFilterAnchor = (diagnostics, attrs, _base) => {
  8690. try {
  8691. let href = attrs.href;
  8692. if (typeof attrs.download === 'string') {
  8693. return false;
  8694. }
  8695. if (typeof href === 'string') {
  8696. href = href.trim();
  8697. if (href !== '' && !href.startsWith('#') && !href.startsWith('?')) {
  8698. const target = attrs.target;
  8699. if (typeof target === 'string' && attrs.target.trim().toLowerCase() !== '_self') {
  8700. return false;
  8701. }
  8702. return true;
  8703. }
  8704. }
  8705. }
  8706. catch (e) {
  8707. catchError(diagnostics, e);
  8708. }
  8709. return false;
  8710. };
  8711. const standardNormalizeUrl = (diagnostics, href, currentUrl) => {
  8712. if (typeof href === 'string') {
  8713. try {
  8714. const outputUrl = new URL(href, currentUrl.href);
  8715. outputUrl.protocol = currentUrl.href;
  8716. outputUrl.hash = '';
  8717. outputUrl.search = '';
  8718. const parts = outputUrl.pathname.split('/');
  8719. const lastPart = parts[parts.length - 1];
  8720. if (lastPart === 'index.html' || lastPart === 'index.htm') {
  8721. parts.pop();
  8722. outputUrl.pathname = parts.join('/');
  8723. }
  8724. return outputUrl;
  8725. }
  8726. catch (e) {
  8727. catchError(diagnostics, e);
  8728. }
  8729. }
  8730. return null;
  8731. };
  8732. const standardFilterUrl = (diagnostics, url, currentUrl, basePathParts) => {
  8733. try {
  8734. if (url.hostname != null && currentUrl.hostname != null && url.hostname !== currentUrl.hostname) {
  8735. return false;
  8736. }
  8737. if (shouldSkipExtension(url.pathname)) {
  8738. return false;
  8739. }
  8740. const inputPathParts = url.pathname.split('/');
  8741. if (inputPathParts.length < basePathParts.length) {
  8742. return false;
  8743. }
  8744. for (let i = 0; i < basePathParts.length; i++) {
  8745. const basePathPart = basePathParts[i];
  8746. const inputPathPart = inputPathParts[i];
  8747. if (basePathParts.length - 1 === i && basePathPart === '') {
  8748. break;
  8749. }
  8750. if (basePathPart !== inputPathPart) {
  8751. return false;
  8752. }
  8753. }
  8754. return true;
  8755. }
  8756. catch (e) {
  8757. catchError(diagnostics, e);
  8758. }
  8759. return false;
  8760. };
  8761. const standardNormalizeHref = (prerenderConfig, diagnostics, url) => {
  8762. try {
  8763. if (url != null && typeof url.href === 'string') {
  8764. let href = url.href.trim();
  8765. if (prerenderConfig.trailingSlash) {
  8766. // url should have a trailing slash
  8767. if (!href.endsWith('/')) {
  8768. const parts = url.pathname.split('/');
  8769. const lastPart = parts[parts.length - 1];
  8770. if (!lastPart.includes('.')) {
  8771. // does not end with a slash and last part does not have a dot
  8772. href += '/';
  8773. }
  8774. }
  8775. }
  8776. else {
  8777. // url should NOT have a trailing slash
  8778. if (href.endsWith('/') && url.pathname !== '/') {
  8779. // this has a trailing slash and it's not the root path
  8780. href = href.slice(0, -1);
  8781. }
  8782. }
  8783. return href;
  8784. }
  8785. }
  8786. catch (e) {
  8787. catchError(diagnostics, e);
  8788. }
  8789. return null;
  8790. };
  8791. const shouldSkipExtension = (filename) => SKIP_EXT.has(extname(filename).toLowerCase());
  8792. const extname = (str) => {
  8793. const parts = str.split('.');
  8794. return parts[parts.length - 1].toLowerCase();
  8795. };
  8796. const SKIP_EXT = new Set(['zip', 'rar', 'tar', 'gz', 'bz2', 'png', 'jpeg', 'jpg', 'gif', 'pdf', 'tiff', 'psd']);
  8797. const nodeRequire = (id) => {
  8798. const results = {
  8799. module: undefined,
  8800. id,
  8801. diagnostics: [],
  8802. };
  8803. if (IS_NODE_ENV) {
  8804. try {
  8805. const fs = require('fs');
  8806. const path = require('path');
  8807. results.id = path.resolve(id);
  8808. // ensure we cleared out node's internal require() cache for this file
  8809. delete require.cache[results.id];
  8810. // let's override node's require for a second
  8811. // don't worry, we'll revert this when we're done
  8812. require.extensions['.ts'] = (module, fileName) => {
  8813. let sourceText = fs.readFileSync(fileName, 'utf8');
  8814. if (fileName.endsWith('.ts')) {
  8815. // looks like we've got a typed config file
  8816. // let's transpile it to .js quick
  8817. const tsResults = t.transpileModule(sourceText, {
  8818. fileName,
  8819. compilerOptions: {
  8820. module: t.ModuleKind.CommonJS,
  8821. moduleResolution: t.ModuleResolutionKind.NodeJs,
  8822. esModuleInterop: true,
  8823. target: t.ScriptTarget.ES2017,
  8824. allowJs: true,
  8825. },
  8826. });
  8827. sourceText = tsResults.outputText;
  8828. results.diagnostics.push(...tsResults.diagnostics.map(loadTypeScriptDiagnostic));
  8829. }
  8830. else {
  8831. // quick hack to turn a modern es module
  8832. // into and old school commonjs module
  8833. sourceText = sourceText.replace(/export\s+\w+\s+(\w+)/gm, 'exports.$1');
  8834. }
  8835. try {
  8836. module._compile(sourceText, fileName);
  8837. }
  8838. catch (e) {
  8839. catchError(results.diagnostics, e);
  8840. }
  8841. };
  8842. // let's do this!
  8843. results.module = require(results.id);
  8844. // all set, let's go ahead and reset the require back to the default
  8845. require.extensions['.ts'] = undefined;
  8846. }
  8847. catch (e) {
  8848. catchError(results.diagnostics, e);
  8849. }
  8850. }
  8851. return results;
  8852. };
  8853. const getPrerenderConfig = (diagnostics, prerenderConfigPath) => {
  8854. const prerenderConfig = {};
  8855. if (isString$1(prerenderConfigPath)) {
  8856. const results = nodeRequire(prerenderConfigPath);
  8857. diagnostics.push(...results.diagnostics);
  8858. if (results.module != null && typeof results.module === 'object') {
  8859. if (results.module.config != null && typeof results.module.config === 'object') {
  8860. Object.assign(prerenderConfig, results.module.config);
  8861. }
  8862. else {
  8863. Object.assign(prerenderConfig, results.module);
  8864. }
  8865. }
  8866. }
  8867. return prerenderConfig;
  8868. };
  8869. const getHydrateOptions = (prerenderConfig, url, diagnostics) => {
  8870. const prerenderUrl = url.href;
  8871. const opts = {
  8872. url: prerenderUrl,
  8873. addModulePreloads: true,
  8874. approximateLineWidth: 100,
  8875. hashAssets: 'querystring',
  8876. inlineExternalStyleSheets: false,
  8877. minifyScriptElements: true,
  8878. minifyStyleElements: true,
  8879. removeAttributeQuotes: true,
  8880. removeBooleanAttributeQuotes: true,
  8881. removeEmptyAttributes: true,
  8882. removeHtmlComments: true,
  8883. };
  8884. if (prerenderConfig.canonicalUrl === null || prerenderConfig.canonicalUrl === false) {
  8885. opts.canonicalUrl = null;
  8886. }
  8887. else if (typeof prerenderConfig.canonicalUrl === 'function') {
  8888. try {
  8889. opts.canonicalUrl = prerenderConfig.canonicalUrl(url);
  8890. }
  8891. catch (e) {
  8892. catchError(diagnostics, e);
  8893. }
  8894. }
  8895. else {
  8896. opts.canonicalUrl = prerenderUrl;
  8897. }
  8898. if (typeof prerenderConfig.hydrateOptions === 'function') {
  8899. try {
  8900. const userOpts = prerenderConfig.hydrateOptions(url);
  8901. if (userOpts != null) {
  8902. if (userOpts.prettyHtml && typeof userOpts.removeAttributeQuotes !== 'boolean') {
  8903. opts.removeAttributeQuotes = false;
  8904. }
  8905. Object.assign(opts, userOpts);
  8906. }
  8907. }
  8908. catch (e) {
  8909. catchError(diagnostics, e);
  8910. }
  8911. }
  8912. return opts;
  8913. };
  8914. const getAbsoluteBuildDir = (outputTarget) => {
  8915. const relativeBuildDir = relative$1(outputTarget.dir, outputTarget.buildDir);
  8916. return join('/', relativeBuildDir) + '/';
  8917. };
  8918. const optimizeCriticalPath = (doc, criticalBundlers, outputTarget) => {
  8919. const buildDir = getAbsoluteBuildDir(outputTarget);
  8920. const paths = criticalBundlers.map((path) => join(buildDir, path));
  8921. injectModulePreloads(doc, paths);
  8922. };
  8923. const injectModulePreloads = (doc, paths) => {
  8924. const existingLinks = Array.from(doc.querySelectorAll('link[rel=modulepreload]')).map((link) => link.getAttribute('href'));
  8925. const addLinks = paths.filter((path) => !existingLinks.includes(path)).map((path) => createModulePreload(doc, path));
  8926. const head = doc.head;
  8927. const firstScript = head.querySelector('script');
  8928. if (firstScript) {
  8929. for (const link of addLinks) {
  8930. head.insertBefore(link, firstScript);
  8931. }
  8932. }
  8933. else {
  8934. for (const link of addLinks) {
  8935. head.appendChild(link);
  8936. }
  8937. }
  8938. };
  8939. const createModulePreload = (doc, href) => {
  8940. const link = doc.createElement('link');
  8941. link.setAttribute('rel', 'modulepreload');
  8942. link.setAttribute('href', href);
  8943. return link;
  8944. };
  8945. const optimizeJs = async (inputOpts) => {
  8946. const result = {
  8947. output: inputOpts.input,
  8948. diagnostics: [],
  8949. sourceMap: null,
  8950. };
  8951. try {
  8952. const prettyOutput = !!inputOpts.pretty;
  8953. const config = {
  8954. extras: {
  8955. safari10: true,
  8956. },
  8957. };
  8958. const sourceTarget = inputOpts.target === 'es5' ? 'es5' : 'latest';
  8959. const minifyOpts = getTerserOptions(config, sourceTarget, prettyOutput);
  8960. const minifyResults = await minifyJs(inputOpts.input, minifyOpts);
  8961. if (minifyResults.diagnostics.length > 0) {
  8962. result.diagnostics.push(...minifyResults.diagnostics);
  8963. }
  8964. else {
  8965. result.output = minifyResults.output;
  8966. result.sourceMap = minifyResults.sourceMap;
  8967. }
  8968. }
  8969. catch (e) {
  8970. catchError(result.diagnostics, e);
  8971. }
  8972. return result;
  8973. };
  8974. const getScopeId = (tagName, mode) => {
  8975. return 'sc-' + tagName + (mode && mode !== DEFAULT_STYLE_MODE ? '-' + mode : '');
  8976. };
  8977. const inlineExternalStyleSheets = async (sys, appDir, doc) => {
  8978. const documentLinks = Array.from(doc.querySelectorAll('link[rel=stylesheet]'));
  8979. if (documentLinks.length === 0) {
  8980. return;
  8981. }
  8982. await Promise.all(documentLinks.map(async (link) => {
  8983. const href = link.getAttribute('href');
  8984. if (!href.startsWith('/') || link.getAttribute('media') !== null) {
  8985. return;
  8986. }
  8987. const fsPath = join(appDir, href);
  8988. try {
  8989. let styles = await sys.readFile(fsPath);
  8990. const optimizeResults = await optimizeCss$1({
  8991. input: styles,
  8992. });
  8993. styles = optimizeResults.output;
  8994. // insert inline <style>
  8995. const inlinedStyles = doc.createElement('style');
  8996. inlinedStyles.innerHTML = styles;
  8997. link.parentNode.insertBefore(inlinedStyles, link);
  8998. link.remove();
  8999. // mark inlinedStyle as treeshakable
  9000. inlinedStyles.setAttribute('data-styles', '');
  9001. // since it's no longer a critical resource
  9002. link.setAttribute('media', '(max-width: 0px)');
  9003. link.setAttribute('importance', 'low');
  9004. link.setAttribute('onload', `this.media=''`);
  9005. // move <link rel="stylesheet"> to the end of <body>
  9006. doc.body.appendChild(link);
  9007. }
  9008. catch (e) { }
  9009. }));
  9010. };
  9011. const minifyScriptElements = async (doc, addMinifiedAttr) => {
  9012. const scriptElms = Array.from(doc.querySelectorAll('script')).filter((scriptElm) => {
  9013. if (scriptElm.hasAttribute('src') || scriptElm.hasAttribute(dataMinifiedAttr)) {
  9014. return false;
  9015. }
  9016. const scriptType = scriptElm.getAttribute('type');
  9017. if (typeof scriptType === 'string' && scriptType !== 'module' && scriptType !== 'text/javascript') {
  9018. return false;
  9019. }
  9020. return true;
  9021. });
  9022. if (scriptElms.length === 0) {
  9023. return;
  9024. }
  9025. await Promise.all(scriptElms.map(async (scriptElm) => {
  9026. const content = scriptElm.innerHTML.trim();
  9027. if (content.length > 0) {
  9028. const opts = {
  9029. input: content,
  9030. sourceMap: false,
  9031. target: 'latest',
  9032. };
  9033. if (scriptElm.getAttribute('type') !== 'module') {
  9034. opts.target = 'es5';
  9035. }
  9036. const optimizeResults = await optimizeJs(opts);
  9037. if (optimizeResults.diagnostics.length === 0) {
  9038. scriptElm.innerHTML = optimizeResults.output;
  9039. }
  9040. if (addMinifiedAttr) {
  9041. scriptElm.setAttribute(dataMinifiedAttr, '');
  9042. }
  9043. }
  9044. }));
  9045. };
  9046. const minifyStyleElements = async (sys, appDir, doc, currentUrl, addMinifiedAttr) => {
  9047. const styleElms = Array.from(doc.querySelectorAll('style')).filter((styleElm) => {
  9048. if (styleElm.hasAttribute(dataMinifiedAttr)) {
  9049. return false;
  9050. }
  9051. return true;
  9052. });
  9053. await Promise.all(styleElms.map(async (styleElm) => {
  9054. const content = styleElm.innerHTML.trim();
  9055. if (content.length > 0) {
  9056. const optimizeResults = await optimizeCss$1({
  9057. input: content,
  9058. minify: true,
  9059. async resolveUrl(urlProp) {
  9060. const assetUrl = new URL(urlProp, currentUrl);
  9061. const hash = await getAssetFileHash(sys, appDir, assetUrl);
  9062. assetUrl.searchParams.append('v', hash);
  9063. return assetUrl.pathname + assetUrl.search;
  9064. },
  9065. });
  9066. if (optimizeResults.diagnostics.length === 0) {
  9067. styleElm.innerHTML = optimizeResults.output;
  9068. }
  9069. if (addMinifiedAttr) {
  9070. styleElm.setAttribute(dataMinifiedAttr, '');
  9071. }
  9072. }
  9073. }));
  9074. };
  9075. const excludeStaticComponents = (doc, hydrateOpts, hydrateResults) => {
  9076. const staticComponents = hydrateOpts.staticComponents.filter((tag) => {
  9077. return hydrateResults.components.some((cmp) => cmp.tag === tag);
  9078. });
  9079. if (staticComponents.length > 0) {
  9080. const stencilScriptElm = doc.querySelector('script[data-stencil-namespace]');
  9081. if (stencilScriptElm) {
  9082. const namespace = stencilScriptElm.getAttribute('data-stencil-namespace');
  9083. let scriptContent = excludeComponentScript.replace('__NAMESPACE__', namespace);
  9084. scriptContent = scriptContent.replace('__EXCLUDE__', JSON.stringify(staticComponents));
  9085. const dataOptsScript = doc.createElement('script');
  9086. dataOptsScript.innerHTML = scriptContent;
  9087. dataOptsScript.setAttribute(dataMinifiedAttr, '');
  9088. stencilScriptElm.parentNode.insertBefore(dataOptsScript, stencilScriptElm.nextSibling);
  9089. }
  9090. }
  9091. };
  9092. const excludeComponentScript = `
  9093. (function(){
  9094. var s=document.querySelector('[data-stencil-namespace="__NAMESPACE__"]');
  9095. s&&((s['data-opts']=s['data-opts']||{}).exclude=__EXCLUDE__);
  9096. })();
  9097. `
  9098. .replace(/\n/g, '')
  9099. .trim();
  9100. const addModulePreloads = (doc, hydrateOpts, hydrateResults, componentGraph) => {
  9101. if (!componentGraph) {
  9102. return false;
  9103. }
  9104. const staticComponents = hydrateOpts.staticComponents || [];
  9105. const cmpTags = hydrateResults.components.filter((cmp) => !staticComponents.includes(cmp.tag));
  9106. const modulePreloads = unique(flatOne(cmpTags.map((cmp) => getScopeId(cmp.tag, cmp.mode)).map((scopeId) => componentGraph.get(scopeId) || [])));
  9107. injectModulePreloads(doc, modulePreloads);
  9108. return true;
  9109. };
  9110. const removeModulePreloads = (doc) => {
  9111. const links = doc.querySelectorAll('link[rel="modulepreload"]');
  9112. for (let i = links.length - 1; i >= 0; i--) {
  9113. const href = links[i].getAttribute('href');
  9114. if (href && href.includes('/p-')) {
  9115. links[i].remove();
  9116. }
  9117. }
  9118. };
  9119. const removeStencilScripts = (doc) => {
  9120. const stencilScripts = doc.querySelectorAll('script[data-stencil]');
  9121. for (let i = stencilScripts.length - 1; i >= 0; i--) {
  9122. stencilScripts[i].remove();
  9123. }
  9124. };
  9125. const hasStencilScript = (doc) => {
  9126. return !!doc.querySelector('script[data-stencil]');
  9127. };
  9128. const hashAssets = async (sys, prerenderCtx, diagnostics, hydrateOpts, appDir, doc, currentUrl) => {
  9129. // do one at a time to prevent too many opened files and memory usage issues
  9130. // hash id is cached in each worker, so shouldn't have to do this for every page
  9131. // update the stylesheet content first so the hash url()s are apart of the file's hash too
  9132. const links = Array.from(doc.querySelectorAll('link[rel=stylesheet][href]'));
  9133. for (const link of links) {
  9134. const href = link.getAttribute('href');
  9135. if (isString$1(href) && href.length > 0) {
  9136. const stylesheetUrl = new URL(href, currentUrl);
  9137. if (currentUrl.host === stylesheetUrl.host) {
  9138. try {
  9139. const filePath = join(appDir, stylesheetUrl.pathname);
  9140. if (prerenderCtx.hashedFile.has(filePath)) {
  9141. continue;
  9142. }
  9143. prerenderCtx.hashedFile.add(filePath);
  9144. let css = await sys.readFile(filePath);
  9145. if (isString$1(css) && css.length > 0) {
  9146. css = await minifyCss({
  9147. css,
  9148. async resolveUrl(urlProp) {
  9149. const assetUrl = new URL(urlProp, stylesheetUrl);
  9150. const hash = await getAssetFileHash(sys, appDir, assetUrl);
  9151. assetUrl.searchParams.append('v', hash);
  9152. return assetUrl.pathname + assetUrl.search;
  9153. },
  9154. });
  9155. sys.writeFileSync(filePath, css);
  9156. }
  9157. }
  9158. catch (e) {
  9159. catchError(diagnostics, e);
  9160. }
  9161. }
  9162. }
  9163. }
  9164. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'link[rel="stylesheet"]', ['href']);
  9165. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'link[rel="prefetch"]', ['href']);
  9166. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'link[rel="preload"]', ['href']);
  9167. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'link[rel="modulepreload"]', ['href']);
  9168. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'link[rel="icon"]', ['href']);
  9169. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'link[rel="apple-touch-icon"]', ['href']);
  9170. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'link[rel="manifest"]', ['href']);
  9171. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'script', ['src']);
  9172. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'img', ['src', 'srcset']);
  9173. await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'picture > source', ['srcset']);
  9174. const pageStates = Array.from(doc.querySelectorAll('script[data-stencil-static="page.state"][type="application/json"]'));
  9175. if (pageStates.length > 0) {
  9176. await Promise.all(pageStates.map(async (pageStateScript) => {
  9177. const pageState = JSON.parse(pageStateScript.textContent);
  9178. if (pageState && Array.isArray(pageState.ast)) {
  9179. for (const node of pageState.ast) {
  9180. if (Array.isArray(node)) {
  9181. await hashPageStateAstAssets(sys, hydrateOpts, appDir, currentUrl, pageStateScript, node);
  9182. }
  9183. }
  9184. pageStateScript.textContent = JSON.stringify(pageState);
  9185. }
  9186. }));
  9187. }
  9188. };
  9189. const hashAsset = async (sys, hydrateOpts, appDir, doc, currentUrl, selector, srcAttrs) => {
  9190. const elms = Array.from(doc.querySelectorAll(selector));
  9191. // do one at a time to prevent too many opened files and memory usage issues
  9192. for (const elm of elms) {
  9193. for (const attrName of srcAttrs) {
  9194. const srcValues = getAttrUrls(attrName, elm.getAttribute(attrName));
  9195. for (const srcValue of srcValues) {
  9196. const assetUrl = new URL(srcValue.src, currentUrl);
  9197. if (assetUrl.hostname === currentUrl.hostname) {
  9198. if (hydrateOpts.hashAssets === 'querystring' && !assetUrl.searchParams.has('v')) {
  9199. try {
  9200. const hash = await getAssetFileHash(sys, appDir, assetUrl);
  9201. if (isString$1(hash)) {
  9202. assetUrl.searchParams.append('v', hash);
  9203. const attrValue = setAttrUrls(assetUrl, srcValue.descriptor);
  9204. elm.setAttribute(attrName, attrValue);
  9205. }
  9206. }
  9207. catch (e) { }
  9208. }
  9209. }
  9210. }
  9211. }
  9212. }
  9213. };
  9214. const hashPageStateAstAssets = async (sys, hydrateOpts, appDir, currentUrl, pageStateScript, node) => {
  9215. const tagName = node[0];
  9216. const attrs = node[1];
  9217. if (isString$1(tagName)) {
  9218. if (attrs) {
  9219. if (tagName === 'img' || tagName === 'source') {
  9220. for (const attrName of ['src', 'srcset']) {
  9221. const srcValues = getAttrUrls(attrName, attrs[attrName]);
  9222. for (const srcValue of srcValues) {
  9223. const assetUrl = new URL(srcValue.src, currentUrl);
  9224. if (assetUrl.hostname === currentUrl.hostname) {
  9225. if (hydrateOpts.hashAssets === 'querystring' && !assetUrl.searchParams.has('v')) {
  9226. try {
  9227. const hash = await getAssetFileHash(sys, appDir, assetUrl);
  9228. if (isString$1(hash)) {
  9229. assetUrl.searchParams.append('v', hash);
  9230. const attrValue = setAttrUrls(assetUrl, srcValue.descriptor);
  9231. attrs[attrName] = attrValue;
  9232. }
  9233. }
  9234. catch (e) { }
  9235. }
  9236. }
  9237. }
  9238. }
  9239. }
  9240. }
  9241. for (let i = 2, l = node.length; i < l; i++) {
  9242. if (Array.isArray(node[i])) {
  9243. await hashPageStateAstAssets(sys, hydrateOpts, appDir, currentUrl, pageStateScript, node[i]);
  9244. }
  9245. }
  9246. }
  9247. };
  9248. const getAttrUrls = (attrName, attrValue) => {
  9249. const srcValues = [];
  9250. if (isString$1(attrValue)) {
  9251. if (attrName.toLowerCase() === 'srcset') {
  9252. attrValue
  9253. .split(',')
  9254. .map((a) => a.trim())
  9255. .filter((a) => a.length > 0)
  9256. .forEach((src) => {
  9257. const spaceSplt = src.split(' ');
  9258. if (spaceSplt[0].length > 0) {
  9259. srcValues.push({ src: spaceSplt[0], descriptor: spaceSplt[1] });
  9260. }
  9261. });
  9262. }
  9263. else {
  9264. srcValues.push({ src: attrValue });
  9265. }
  9266. }
  9267. return srcValues;
  9268. };
  9269. const setAttrUrls = (url, descriptor) => {
  9270. let src = url.pathname + url.search;
  9271. if (isString$1(descriptor)) {
  9272. src += ' ' + descriptor;
  9273. }
  9274. return src;
  9275. };
  9276. const hashedAssets = new Map();
  9277. const getAssetFileHash = async (sys, appDir, assetUrl) => {
  9278. let p = hashedAssets.get(assetUrl.pathname);
  9279. if (!p) {
  9280. const assetFilePath = join(appDir, assetUrl.pathname);
  9281. p = sys.generateFileHash(assetFilePath, 10);
  9282. hashedAssets.set(assetUrl.pathname, p);
  9283. }
  9284. return p;
  9285. };
  9286. const dataMinifiedAttr = 'data-m';
  9287. const prerenderCtx = {
  9288. buildId: null,
  9289. componentGraph: null,
  9290. prerenderConfig: null,
  9291. ensuredDirs: null,
  9292. templateHtml: null,
  9293. hashedFile: null,
  9294. };
  9295. const getPrerenderCtx = (prerenderRequest) => {
  9296. if (prerenderRequest.buildId !== prerenderCtx.buildId) {
  9297. prerenderCtx.buildId = prerenderRequest.buildId;
  9298. prerenderCtx.componentGraph = null;
  9299. prerenderCtx.prerenderConfig = null;
  9300. prerenderCtx.ensuredDirs = new Set();
  9301. prerenderCtx.templateHtml = null;
  9302. prerenderCtx.hashedFile = new Set();
  9303. }
  9304. return prerenderCtx;
  9305. };
  9306. const prerenderWorker = async (sys, prerenderRequest) => {
  9307. // worker thread!
  9308. const results = {
  9309. diagnostics: [],
  9310. anchorUrls: [],
  9311. filePath: prerenderRequest.writeToFilePath,
  9312. };
  9313. try {
  9314. const prerenderCtx = getPrerenderCtx(prerenderRequest);
  9315. const url = new URL(prerenderRequest.url, prerenderRequest.devServerHostUrl);
  9316. const baseUrl = new URL(prerenderRequest.baseUrl);
  9317. const componentGraph = getComponentGraph(sys, prerenderCtx, prerenderRequest.componentGraphPath);
  9318. // webpack work-around/hack
  9319. const hydrateApp = requireFunc(prerenderRequest.hydrateAppFilePath);
  9320. if (prerenderCtx.templateHtml == null) {
  9321. // cache template html in this process
  9322. prerenderCtx.templateHtml = sys.readFileSync(prerenderRequest.templateId);
  9323. }
  9324. // create a new window by cloning the cached parsed window
  9325. const win = hydrateApp.createWindowFromHtml(prerenderCtx.templateHtml, prerenderRequest.templateId);
  9326. const doc = win.document;
  9327. win.location.href = url.href;
  9328. // patch this new window
  9329. if (isFunction(sys.applyPrerenderGlobalPatch)) {
  9330. sys.applyPrerenderGlobalPatch({
  9331. devServerHostUrl: prerenderRequest.devServerHostUrl,
  9332. window: win,
  9333. });
  9334. }
  9335. if (prerenderCtx.prerenderConfig == null) {
  9336. prerenderCtx.prerenderConfig = getPrerenderConfig(results.diagnostics, prerenderRequest.prerenderConfigPath);
  9337. }
  9338. const prerenderConfig = prerenderCtx.prerenderConfig;
  9339. const hydrateOpts = getHydrateOptions(prerenderConfig, url, results.diagnostics);
  9340. if (prerenderRequest.staticSite || hydrateOpts.staticDocument) {
  9341. hydrateOpts.addModulePreloads = false;
  9342. hydrateOpts.clientHydrateAnnotations = false;
  9343. }
  9344. if (typeof hydrateOpts.buildId !== 'string') {
  9345. hydrateOpts.buildId = prerenderRequest.buildId;
  9346. }
  9347. if (typeof prerenderConfig.beforeHydrate === 'function') {
  9348. try {
  9349. const rtn = prerenderConfig.beforeHydrate(doc, url);
  9350. if (isPromise(rtn)) {
  9351. await rtn;
  9352. }
  9353. }
  9354. catch (e) {
  9355. catchError(results.diagnostics, e);
  9356. }
  9357. }
  9358. // parse the html to dom nodes, hydrate the components, then
  9359. // serialize the hydrated dom nodes back to into html
  9360. const hydrateResults = (await hydrateApp.hydrateDocument(doc, hydrateOpts));
  9361. results.diagnostics.push(...hydrateResults.diagnostics);
  9362. if (typeof prerenderConfig.filePath === 'function') {
  9363. try {
  9364. const userWriteToFilePath = prerenderConfig.filePath(url, results.filePath);
  9365. if (typeof userWriteToFilePath === 'string') {
  9366. results.filePath = userWriteToFilePath;
  9367. }
  9368. }
  9369. catch (e) {
  9370. catchError(results.diagnostics, e);
  9371. }
  9372. }
  9373. if (hydrateOpts.staticDocument) {
  9374. removeStencilScripts(doc);
  9375. removeModulePreloads(doc);
  9376. }
  9377. else {
  9378. if (Array.isArray(hydrateOpts.staticComponents)) {
  9379. excludeStaticComponents(doc, hydrateOpts, hydrateResults);
  9380. }
  9381. if (hydrateOpts.addModulePreloads) {
  9382. if (!prerenderRequest.isDebug) {
  9383. addModulePreloads(doc, hydrateOpts, hydrateResults, componentGraph);
  9384. }
  9385. }
  9386. else {
  9387. // remove module preloads
  9388. removeModulePreloads(doc);
  9389. }
  9390. }
  9391. const docPromises = [];
  9392. if (hydrateOpts.minifyStyleElements && !prerenderRequest.isDebug) {
  9393. docPromises.push(minifyStyleElements(sys, prerenderRequest.appDir, doc, url, false));
  9394. }
  9395. if (hydrateOpts.minifyScriptElements && !prerenderRequest.isDebug) {
  9396. docPromises.push(minifyScriptElements(doc, false));
  9397. }
  9398. if (hydrateOpts.hashAssets && !prerenderRequest.isDebug) {
  9399. try {
  9400. docPromises.push(hashAssets(sys, prerenderCtx, results.diagnostics, hydrateOpts, prerenderRequest.appDir, doc, url));
  9401. }
  9402. catch (e) {
  9403. catchError(results.diagnostics, e);
  9404. }
  9405. }
  9406. if (docPromises.length > 0) {
  9407. await Promise.all(docPromises);
  9408. }
  9409. if (prerenderConfig.crawlUrls !== false) {
  9410. results.anchorUrls = crawlAnchorsForNextUrls(prerenderConfig, results.diagnostics, baseUrl, url, hydrateResults.anchors);
  9411. }
  9412. if (typeof prerenderConfig.afterHydrate === 'function') {
  9413. try {
  9414. const rtn = prerenderConfig.afterHydrate(doc, url, results);
  9415. if (isPromise(rtn)) {
  9416. await rtn;
  9417. }
  9418. }
  9419. catch (e) {
  9420. catchError(results.diagnostics, e);
  9421. }
  9422. }
  9423. if (typeof hydrateResults.httpStatus === 'number' && hydrateResults.httpStatus >= 400) {
  9424. try {
  9425. win.close();
  9426. }
  9427. catch (e) { }
  9428. return results;
  9429. }
  9430. const html = hydrateApp.serializeDocumentToString(doc, hydrateOpts);
  9431. prerenderEnsureDir(sys, prerenderCtx, results.filePath);
  9432. const writePromise = sys.writeFile(results.filePath, html);
  9433. if (Array.isArray(hydrateResults.staticData) && hydrateResults.staticData.length > 0) {
  9434. const pageDir = dirname(results.filePath);
  9435. await Promise.all(hydrateResults.staticData.map(async (s) => {
  9436. if (s.type === 'application/json') {
  9437. const data = {
  9438. [s.id]: JSON.parse(s.content),
  9439. components: hydrateResults.components.map((c) => c.tag),
  9440. };
  9441. const dataFileName = `${s.id}.json`;
  9442. const dataFilePath = join(pageDir, dataFileName);
  9443. await sys.writeFile(dataFilePath, JSON.stringify(data));
  9444. }
  9445. else {
  9446. const contentFileName = `${s.id}.txt`;
  9447. const contentFilePath = join(pageDir, contentFileName);
  9448. await sys.writeFile(contentFilePath, s.content);
  9449. }
  9450. }));
  9451. }
  9452. await writePromise;
  9453. try {
  9454. win.close();
  9455. }
  9456. catch (e) { }
  9457. }
  9458. catch (e) {
  9459. // ahh man! what happened!
  9460. catchError(results.diagnostics, e);
  9461. }
  9462. return results;
  9463. };
  9464. const getComponentGraph = (sys, prerenderCtx, componentGraphPath) => {
  9465. if (componentGraphPath == null) {
  9466. return undefined;
  9467. }
  9468. if (prerenderCtx.componentGraph == null) {
  9469. const componentGraphJson = JSON.parse(sys.readFileSync(componentGraphPath));
  9470. prerenderCtx.componentGraph = new Map(Object.entries(componentGraphJson));
  9471. }
  9472. return prerenderCtx.componentGraph;
  9473. };
  9474. const prerenderEnsureDir = (sys, prerenderCtx, p) => {
  9475. const allDirs = [];
  9476. while (true) {
  9477. p = normalizePath$1(sys.platformPath.dirname(p));
  9478. if (typeof p === 'string' && p.length > 0 && !isRootPath(p)) {
  9479. allDirs.push(p);
  9480. }
  9481. else {
  9482. break;
  9483. }
  9484. }
  9485. allDirs.reverse();
  9486. for (let i = 0; i < allDirs.length; i++) {
  9487. const dir = allDirs[i];
  9488. if (!prerenderCtx.ensuredDirs.has(dir)) {
  9489. prerenderCtx.ensuredDirs.add(dir);
  9490. sys.createDirSync(dir);
  9491. }
  9492. }
  9493. };
  9494. var chars$3 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  9495. function encode$2(decoded) {
  9496. var sourceFileIndex = 0; // second field
  9497. var sourceCodeLine = 0; // third field
  9498. var sourceCodeColumn = 0; // fourth field
  9499. var nameIndex = 0; // fifth field
  9500. var mappings = '';
  9501. for (var i = 0; i < decoded.length; i++) {
  9502. var line = decoded[i];
  9503. if (i > 0)
  9504. mappings += ';';
  9505. if (line.length === 0)
  9506. continue;
  9507. var generatedCodeColumn = 0; // first field
  9508. var lineMappings = [];
  9509. for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
  9510. var segment = line_1[_i];
  9511. var segmentMappings = encodeInteger$2(segment[0] - generatedCodeColumn);
  9512. generatedCodeColumn = segment[0];
  9513. if (segment.length > 1) {
  9514. segmentMappings +=
  9515. encodeInteger$2(segment[1] - sourceFileIndex) +
  9516. encodeInteger$2(segment[2] - sourceCodeLine) +
  9517. encodeInteger$2(segment[3] - sourceCodeColumn);
  9518. sourceFileIndex = segment[1];
  9519. sourceCodeLine = segment[2];
  9520. sourceCodeColumn = segment[3];
  9521. }
  9522. if (segment.length === 5) {
  9523. segmentMappings += encodeInteger$2(segment[4] - nameIndex);
  9524. nameIndex = segment[4];
  9525. }
  9526. lineMappings.push(segmentMappings);
  9527. }
  9528. mappings += lineMappings.join(',');
  9529. }
  9530. return mappings;
  9531. }
  9532. function encodeInteger$2(num) {
  9533. var result = '';
  9534. num = num < 0 ? (-num << 1) | 1 : num << 1;
  9535. do {
  9536. var clamped = num & 31;
  9537. num >>>= 5;
  9538. if (num > 0) {
  9539. clamped |= 32;
  9540. }
  9541. result += chars$3[clamped];
  9542. } while (num > 0);
  9543. return result;
  9544. }
  9545. class BitSet$3 {
  9546. constructor(arg) {
  9547. this.bits = arg instanceof BitSet$3 ? arg.bits.slice() : [];
  9548. }
  9549. add(n) {
  9550. this.bits[n >> 5] |= 1 << (n & 31);
  9551. }
  9552. has(n) {
  9553. return !!(this.bits[n >> 5] & (1 << (n & 31)));
  9554. }
  9555. }
  9556. class Chunk$3 {
  9557. constructor(start, end, content) {
  9558. this.start = start;
  9559. this.end = end;
  9560. this.original = content;
  9561. this.intro = '';
  9562. this.outro = '';
  9563. this.content = content;
  9564. this.storeName = false;
  9565. this.edited = false;
  9566. // we make these non-enumerable, for sanity while debugging
  9567. Object.defineProperties(this, {
  9568. previous: { writable: true, value: null },
  9569. next: { writable: true, value: null },
  9570. });
  9571. }
  9572. appendLeft(content) {
  9573. this.outro += content;
  9574. }
  9575. appendRight(content) {
  9576. this.intro = this.intro + content;
  9577. }
  9578. clone() {
  9579. const chunk = new Chunk$3(this.start, this.end, this.original);
  9580. chunk.intro = this.intro;
  9581. chunk.outro = this.outro;
  9582. chunk.content = this.content;
  9583. chunk.storeName = this.storeName;
  9584. chunk.edited = this.edited;
  9585. return chunk;
  9586. }
  9587. contains(index) {
  9588. return this.start < index && index < this.end;
  9589. }
  9590. eachNext(fn) {
  9591. let chunk = this;
  9592. while (chunk) {
  9593. fn(chunk);
  9594. chunk = chunk.next;
  9595. }
  9596. }
  9597. eachPrevious(fn) {
  9598. let chunk = this;
  9599. while (chunk) {
  9600. fn(chunk);
  9601. chunk = chunk.previous;
  9602. }
  9603. }
  9604. edit(content, storeName, contentOnly) {
  9605. this.content = content;
  9606. if (!contentOnly) {
  9607. this.intro = '';
  9608. this.outro = '';
  9609. }
  9610. this.storeName = storeName;
  9611. this.edited = true;
  9612. return this;
  9613. }
  9614. prependLeft(content) {
  9615. this.outro = content + this.outro;
  9616. }
  9617. prependRight(content) {
  9618. this.intro = content + this.intro;
  9619. }
  9620. split(index) {
  9621. const sliceIndex = index - this.start;
  9622. const originalBefore = this.original.slice(0, sliceIndex);
  9623. const originalAfter = this.original.slice(sliceIndex);
  9624. this.original = originalBefore;
  9625. const newChunk = new Chunk$3(index, this.end, originalAfter);
  9626. newChunk.outro = this.outro;
  9627. this.outro = '';
  9628. this.end = index;
  9629. if (this.edited) {
  9630. // TODO is this block necessary?...
  9631. newChunk.edit('', false);
  9632. this.content = '';
  9633. } else {
  9634. this.content = originalBefore;
  9635. }
  9636. newChunk.next = this.next;
  9637. if (newChunk.next) newChunk.next.previous = newChunk;
  9638. newChunk.previous = this;
  9639. this.next = newChunk;
  9640. return newChunk;
  9641. }
  9642. toString() {
  9643. return this.intro + this.content + this.outro;
  9644. }
  9645. trimEnd(rx) {
  9646. this.outro = this.outro.replace(rx, '');
  9647. if (this.outro.length) return true;
  9648. const trimmed = this.content.replace(rx, '');
  9649. if (trimmed.length) {
  9650. if (trimmed !== this.content) {
  9651. this.split(this.start + trimmed.length).edit('', undefined, true);
  9652. }
  9653. return true;
  9654. } else {
  9655. this.edit('', undefined, true);
  9656. this.intro = this.intro.replace(rx, '');
  9657. if (this.intro.length) return true;
  9658. }
  9659. }
  9660. trimStart(rx) {
  9661. this.intro = this.intro.replace(rx, '');
  9662. if (this.intro.length) return true;
  9663. const trimmed = this.content.replace(rx, '');
  9664. if (trimmed.length) {
  9665. if (trimmed !== this.content) {
  9666. this.split(this.end - trimmed.length);
  9667. this.edit('', undefined, true);
  9668. }
  9669. return true;
  9670. } else {
  9671. this.edit('', undefined, true);
  9672. this.outro = this.outro.replace(rx, '');
  9673. if (this.outro.length) return true;
  9674. }
  9675. }
  9676. }
  9677. function getBtoa () {
  9678. if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
  9679. return (str) => window.btoa(unescape(encodeURIComponent(str)));
  9680. } else if (typeof Buffer === 'function') {
  9681. return (str) => Buffer.from(str, 'utf-8').toString('base64');
  9682. } else {
  9683. return () => {
  9684. throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
  9685. };
  9686. }
  9687. }
  9688. const btoa$3 = /*#__PURE__*/ getBtoa();
  9689. class SourceMap$3 {
  9690. constructor(properties) {
  9691. this.version = 3;
  9692. this.file = properties.file;
  9693. this.sources = properties.sources;
  9694. this.sourcesContent = properties.sourcesContent;
  9695. this.names = properties.names;
  9696. this.mappings = encode$2(properties.mappings);
  9697. }
  9698. toString() {
  9699. return JSON.stringify(this);
  9700. }
  9701. toUrl() {
  9702. return 'data:application/json;charset=utf-8;base64,' + btoa$3(this.toString());
  9703. }
  9704. }
  9705. function guessIndent$3(code) {
  9706. const lines = code.split('\n');
  9707. const tabbed = lines.filter((line) => /^\t+/.test(line));
  9708. const spaced = lines.filter((line) => /^ {2,}/.test(line));
  9709. if (tabbed.length === 0 && spaced.length === 0) {
  9710. return null;
  9711. }
  9712. // More lines tabbed than spaced? Assume tabs, and
  9713. // default to tabs in the case of a tie (or nothing
  9714. // to go on)
  9715. if (tabbed.length >= spaced.length) {
  9716. return '\t';
  9717. }
  9718. // Otherwise, we need to guess the multiple
  9719. const min = spaced.reduce((previous, current) => {
  9720. const numSpaces = /^ +/.exec(current)[0].length;
  9721. return Math.min(numSpaces, previous);
  9722. }, Infinity);
  9723. return new Array(min + 1).join(' ');
  9724. }
  9725. function getRelativePath$3(from, to) {
  9726. const fromParts = from.split(/[/\\]/);
  9727. const toParts = to.split(/[/\\]/);
  9728. fromParts.pop(); // get dirname
  9729. while (fromParts[0] === toParts[0]) {
  9730. fromParts.shift();
  9731. toParts.shift();
  9732. }
  9733. if (fromParts.length) {
  9734. let i = fromParts.length;
  9735. while (i--) fromParts[i] = '..';
  9736. }
  9737. return fromParts.concat(toParts).join('/');
  9738. }
  9739. const toString$3 = Object.prototype.toString;
  9740. function isObject$4(thing) {
  9741. return toString$3.call(thing) === '[object Object]';
  9742. }
  9743. function getLocator$3(source) {
  9744. const originalLines = source.split('\n');
  9745. const lineOffsets = [];
  9746. for (let i = 0, pos = 0; i < originalLines.length; i++) {
  9747. lineOffsets.push(pos);
  9748. pos += originalLines[i].length + 1;
  9749. }
  9750. return function locate(index) {
  9751. let i = 0;
  9752. let j = lineOffsets.length;
  9753. while (i < j) {
  9754. const m = (i + j) >> 1;
  9755. if (index < lineOffsets[m]) {
  9756. j = m;
  9757. } else {
  9758. i = m + 1;
  9759. }
  9760. }
  9761. const line = i - 1;
  9762. const column = index - lineOffsets[line];
  9763. return { line, column };
  9764. };
  9765. }
  9766. class Mappings$3 {
  9767. constructor(hires) {
  9768. this.hires = hires;
  9769. this.generatedCodeLine = 0;
  9770. this.generatedCodeColumn = 0;
  9771. this.raw = [];
  9772. this.rawSegments = this.raw[this.generatedCodeLine] = [];
  9773. this.pending = null;
  9774. }
  9775. addEdit(sourceIndex, content, loc, nameIndex) {
  9776. if (content.length) {
  9777. const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
  9778. if (nameIndex >= 0) {
  9779. segment.push(nameIndex);
  9780. }
  9781. this.rawSegments.push(segment);
  9782. } else if (this.pending) {
  9783. this.rawSegments.push(this.pending);
  9784. }
  9785. this.advance(content);
  9786. this.pending = null;
  9787. }
  9788. addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
  9789. let originalCharIndex = chunk.start;
  9790. let first = true;
  9791. while (originalCharIndex < chunk.end) {
  9792. if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
  9793. this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
  9794. }
  9795. if (original[originalCharIndex] === '\n') {
  9796. loc.line += 1;
  9797. loc.column = 0;
  9798. this.generatedCodeLine += 1;
  9799. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  9800. this.generatedCodeColumn = 0;
  9801. first = true;
  9802. } else {
  9803. loc.column += 1;
  9804. this.generatedCodeColumn += 1;
  9805. first = false;
  9806. }
  9807. originalCharIndex += 1;
  9808. }
  9809. this.pending = null;
  9810. }
  9811. advance(str) {
  9812. if (!str) return;
  9813. const lines = str.split('\n');
  9814. if (lines.length > 1) {
  9815. for (let i = 0; i < lines.length - 1; i++) {
  9816. this.generatedCodeLine++;
  9817. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  9818. }
  9819. this.generatedCodeColumn = 0;
  9820. }
  9821. this.generatedCodeColumn += lines[lines.length - 1].length;
  9822. }
  9823. }
  9824. const n$3 = '\n';
  9825. const warned$3 = {
  9826. insertLeft: false,
  9827. insertRight: false,
  9828. storeName: false,
  9829. };
  9830. class MagicString$3 {
  9831. constructor(string, options = {}) {
  9832. const chunk = new Chunk$3(0, string.length, string);
  9833. Object.defineProperties(this, {
  9834. original: { writable: true, value: string },
  9835. outro: { writable: true, value: '' },
  9836. intro: { writable: true, value: '' },
  9837. firstChunk: { writable: true, value: chunk },
  9838. lastChunk: { writable: true, value: chunk },
  9839. lastSearchedChunk: { writable: true, value: chunk },
  9840. byStart: { writable: true, value: {} },
  9841. byEnd: { writable: true, value: {} },
  9842. filename: { writable: true, value: options.filename },
  9843. indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
  9844. sourcemapLocations: { writable: true, value: new BitSet$3() },
  9845. storedNames: { writable: true, value: {} },
  9846. indentStr: { writable: true, value: undefined },
  9847. });
  9848. this.byStart[0] = chunk;
  9849. this.byEnd[string.length] = chunk;
  9850. }
  9851. addSourcemapLocation(char) {
  9852. this.sourcemapLocations.add(char);
  9853. }
  9854. append(content) {
  9855. if (typeof content !== 'string') throw new TypeError('outro content must be a string');
  9856. this.outro += content;
  9857. return this;
  9858. }
  9859. appendLeft(index, content) {
  9860. if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
  9861. this._split(index);
  9862. const chunk = this.byEnd[index];
  9863. if (chunk) {
  9864. chunk.appendLeft(content);
  9865. } else {
  9866. this.intro += content;
  9867. }
  9868. return this;
  9869. }
  9870. appendRight(index, content) {
  9871. if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
  9872. this._split(index);
  9873. const chunk = this.byStart[index];
  9874. if (chunk) {
  9875. chunk.appendRight(content);
  9876. } else {
  9877. this.outro += content;
  9878. }
  9879. return this;
  9880. }
  9881. clone() {
  9882. const cloned = new MagicString$3(this.original, { filename: this.filename });
  9883. let originalChunk = this.firstChunk;
  9884. let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
  9885. while (originalChunk) {
  9886. cloned.byStart[clonedChunk.start] = clonedChunk;
  9887. cloned.byEnd[clonedChunk.end] = clonedChunk;
  9888. const nextOriginalChunk = originalChunk.next;
  9889. const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
  9890. if (nextClonedChunk) {
  9891. clonedChunk.next = nextClonedChunk;
  9892. nextClonedChunk.previous = clonedChunk;
  9893. clonedChunk = nextClonedChunk;
  9894. }
  9895. originalChunk = nextOriginalChunk;
  9896. }
  9897. cloned.lastChunk = clonedChunk;
  9898. if (this.indentExclusionRanges) {
  9899. cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
  9900. }
  9901. cloned.sourcemapLocations = new BitSet$3(this.sourcemapLocations);
  9902. cloned.intro = this.intro;
  9903. cloned.outro = this.outro;
  9904. return cloned;
  9905. }
  9906. generateDecodedMap(options) {
  9907. options = options || {};
  9908. const sourceIndex = 0;
  9909. const names = Object.keys(this.storedNames);
  9910. const mappings = new Mappings$3(options.hires);
  9911. const locate = getLocator$3(this.original);
  9912. if (this.intro) {
  9913. mappings.advance(this.intro);
  9914. }
  9915. this.firstChunk.eachNext((chunk) => {
  9916. const loc = locate(chunk.start);
  9917. if (chunk.intro.length) mappings.advance(chunk.intro);
  9918. if (chunk.edited) {
  9919. mappings.addEdit(
  9920. sourceIndex,
  9921. chunk.content,
  9922. loc,
  9923. chunk.storeName ? names.indexOf(chunk.original) : -1
  9924. );
  9925. } else {
  9926. mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
  9927. }
  9928. if (chunk.outro.length) mappings.advance(chunk.outro);
  9929. });
  9930. return {
  9931. file: options.file ? options.file.split(/[/\\]/).pop() : null,
  9932. sources: [options.source ? getRelativePath$3(options.file || '', options.source) : null],
  9933. sourcesContent: options.includeContent ? [this.original] : [null],
  9934. names,
  9935. mappings: mappings.raw,
  9936. };
  9937. }
  9938. generateMap(options) {
  9939. return new SourceMap$3(this.generateDecodedMap(options));
  9940. }
  9941. _ensureindentStr() {
  9942. if (this.indentStr === undefined) {
  9943. this.indentStr = guessIndent$3(this.original);
  9944. }
  9945. }
  9946. _getRawIndentString() {
  9947. this._ensureindentStr();
  9948. return this.indentStr;
  9949. }
  9950. getIndentString() {
  9951. this._ensureindentStr();
  9952. return this.indentStr === null ? '\t' : this.indentStr;
  9953. }
  9954. indent(indentStr, options) {
  9955. const pattern = /^[^\r\n]/gm;
  9956. if (isObject$4(indentStr)) {
  9957. options = indentStr;
  9958. indentStr = undefined;
  9959. }
  9960. if (indentStr === undefined) {
  9961. this._ensureindentStr();
  9962. indentStr = this.indentStr || '\t';
  9963. }
  9964. if (indentStr === '') return this; // noop
  9965. options = options || {};
  9966. // Process exclusion ranges
  9967. const isExcluded = {};
  9968. if (options.exclude) {
  9969. const exclusions =
  9970. typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
  9971. exclusions.forEach((exclusion) => {
  9972. for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
  9973. isExcluded[i] = true;
  9974. }
  9975. });
  9976. }
  9977. let shouldIndentNextCharacter = options.indentStart !== false;
  9978. const replacer = (match) => {
  9979. if (shouldIndentNextCharacter) return `${indentStr}${match}`;
  9980. shouldIndentNextCharacter = true;
  9981. return match;
  9982. };
  9983. this.intro = this.intro.replace(pattern, replacer);
  9984. let charIndex = 0;
  9985. let chunk = this.firstChunk;
  9986. while (chunk) {
  9987. const end = chunk.end;
  9988. if (chunk.edited) {
  9989. if (!isExcluded[charIndex]) {
  9990. chunk.content = chunk.content.replace(pattern, replacer);
  9991. if (chunk.content.length) {
  9992. shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
  9993. }
  9994. }
  9995. } else {
  9996. charIndex = chunk.start;
  9997. while (charIndex < end) {
  9998. if (!isExcluded[charIndex]) {
  9999. const char = this.original[charIndex];
  10000. if (char === '\n') {
  10001. shouldIndentNextCharacter = true;
  10002. } else if (char !== '\r' && shouldIndentNextCharacter) {
  10003. shouldIndentNextCharacter = false;
  10004. if (charIndex === chunk.start) {
  10005. chunk.prependRight(indentStr);
  10006. } else {
  10007. this._splitChunk(chunk, charIndex);
  10008. chunk = chunk.next;
  10009. chunk.prependRight(indentStr);
  10010. }
  10011. }
  10012. }
  10013. charIndex += 1;
  10014. }
  10015. }
  10016. charIndex = chunk.end;
  10017. chunk = chunk.next;
  10018. }
  10019. this.outro = this.outro.replace(pattern, replacer);
  10020. return this;
  10021. }
  10022. insert() {
  10023. throw new Error(
  10024. 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
  10025. );
  10026. }
  10027. insertLeft(index, content) {
  10028. if (!warned$3.insertLeft) {
  10029. console.warn(
  10030. 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
  10031. ); // eslint-disable-line no-console
  10032. warned$3.insertLeft = true;
  10033. }
  10034. return this.appendLeft(index, content);
  10035. }
  10036. insertRight(index, content) {
  10037. if (!warned$3.insertRight) {
  10038. console.warn(
  10039. 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
  10040. ); // eslint-disable-line no-console
  10041. warned$3.insertRight = true;
  10042. }
  10043. return this.prependRight(index, content);
  10044. }
  10045. move(start, end, index) {
  10046. if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
  10047. this._split(start);
  10048. this._split(end);
  10049. this._split(index);
  10050. const first = this.byStart[start];
  10051. const last = this.byEnd[end];
  10052. const oldLeft = first.previous;
  10053. const oldRight = last.next;
  10054. const newRight = this.byStart[index];
  10055. if (!newRight && last === this.lastChunk) return this;
  10056. const newLeft = newRight ? newRight.previous : this.lastChunk;
  10057. if (oldLeft) oldLeft.next = oldRight;
  10058. if (oldRight) oldRight.previous = oldLeft;
  10059. if (newLeft) newLeft.next = first;
  10060. if (newRight) newRight.previous = last;
  10061. if (!first.previous) this.firstChunk = last.next;
  10062. if (!last.next) {
  10063. this.lastChunk = first.previous;
  10064. this.lastChunk.next = null;
  10065. }
  10066. first.previous = newLeft;
  10067. last.next = newRight || null;
  10068. if (!newLeft) this.firstChunk = first;
  10069. if (!newRight) this.lastChunk = last;
  10070. return this;
  10071. }
  10072. overwrite(start, end, content, options) {
  10073. if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
  10074. while (start < 0) start += this.original.length;
  10075. while (end < 0) end += this.original.length;
  10076. if (end > this.original.length) throw new Error('end is out of bounds');
  10077. if (start === end)
  10078. throw new Error(
  10079. 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
  10080. );
  10081. this._split(start);
  10082. this._split(end);
  10083. if (options === true) {
  10084. if (!warned$3.storeName) {
  10085. console.warn(
  10086. 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
  10087. ); // eslint-disable-line no-console
  10088. warned$3.storeName = true;
  10089. }
  10090. options = { storeName: true };
  10091. }
  10092. const storeName = options !== undefined ? options.storeName : false;
  10093. const contentOnly = options !== undefined ? options.contentOnly : false;
  10094. if (storeName) {
  10095. const original = this.original.slice(start, end);
  10096. Object.defineProperty(this.storedNames, original, {
  10097. writable: true,
  10098. value: true,
  10099. enumerable: true,
  10100. });
  10101. }
  10102. const first = this.byStart[start];
  10103. const last = this.byEnd[end];
  10104. if (first) {
  10105. let chunk = first;
  10106. while (chunk !== last) {
  10107. if (chunk.next !== this.byStart[chunk.end]) {
  10108. throw new Error('Cannot overwrite across a split point');
  10109. }
  10110. chunk = chunk.next;
  10111. chunk.edit('', false);
  10112. }
  10113. first.edit(content, storeName, contentOnly);
  10114. } else {
  10115. // must be inserting at the end
  10116. const newChunk = new Chunk$3(start, end, '').edit(content, storeName);
  10117. // TODO last chunk in the array may not be the last chunk, if it's moved...
  10118. last.next = newChunk;
  10119. newChunk.previous = last;
  10120. }
  10121. return this;
  10122. }
  10123. prepend(content) {
  10124. if (typeof content !== 'string') throw new TypeError('outro content must be a string');
  10125. this.intro = content + this.intro;
  10126. return this;
  10127. }
  10128. prependLeft(index, content) {
  10129. if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
  10130. this._split(index);
  10131. const chunk = this.byEnd[index];
  10132. if (chunk) {
  10133. chunk.prependLeft(content);
  10134. } else {
  10135. this.intro = content + this.intro;
  10136. }
  10137. return this;
  10138. }
  10139. prependRight(index, content) {
  10140. if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
  10141. this._split(index);
  10142. const chunk = this.byStart[index];
  10143. if (chunk) {
  10144. chunk.prependRight(content);
  10145. } else {
  10146. this.outro = content + this.outro;
  10147. }
  10148. return this;
  10149. }
  10150. remove(start, end) {
  10151. while (start < 0) start += this.original.length;
  10152. while (end < 0) end += this.original.length;
  10153. if (start === end) return this;
  10154. if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
  10155. if (start > end) throw new Error('end must be greater than start');
  10156. this._split(start);
  10157. this._split(end);
  10158. let chunk = this.byStart[start];
  10159. while (chunk) {
  10160. chunk.intro = '';
  10161. chunk.outro = '';
  10162. chunk.edit('');
  10163. chunk = end > chunk.end ? this.byStart[chunk.end] : null;
  10164. }
  10165. return this;
  10166. }
  10167. lastChar() {
  10168. if (this.outro.length) return this.outro[this.outro.length - 1];
  10169. let chunk = this.lastChunk;
  10170. do {
  10171. if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
  10172. if (chunk.content.length) return chunk.content[chunk.content.length - 1];
  10173. if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
  10174. } while ((chunk = chunk.previous));
  10175. if (this.intro.length) return this.intro[this.intro.length - 1];
  10176. return '';
  10177. }
  10178. lastLine() {
  10179. let lineIndex = this.outro.lastIndexOf(n$3);
  10180. if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
  10181. let lineStr = this.outro;
  10182. let chunk = this.lastChunk;
  10183. do {
  10184. if (chunk.outro.length > 0) {
  10185. lineIndex = chunk.outro.lastIndexOf(n$3);
  10186. if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
  10187. lineStr = chunk.outro + lineStr;
  10188. }
  10189. if (chunk.content.length > 0) {
  10190. lineIndex = chunk.content.lastIndexOf(n$3);
  10191. if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
  10192. lineStr = chunk.content + lineStr;
  10193. }
  10194. if (chunk.intro.length > 0) {
  10195. lineIndex = chunk.intro.lastIndexOf(n$3);
  10196. if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
  10197. lineStr = chunk.intro + lineStr;
  10198. }
  10199. } while ((chunk = chunk.previous));
  10200. lineIndex = this.intro.lastIndexOf(n$3);
  10201. if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
  10202. return this.intro + lineStr;
  10203. }
  10204. slice(start = 0, end = this.original.length) {
  10205. while (start < 0) start += this.original.length;
  10206. while (end < 0) end += this.original.length;
  10207. let result = '';
  10208. // find start chunk
  10209. let chunk = this.firstChunk;
  10210. while (chunk && (chunk.start > start || chunk.end <= start)) {
  10211. // found end chunk before start
  10212. if (chunk.start < end && chunk.end >= end) {
  10213. return result;
  10214. }
  10215. chunk = chunk.next;
  10216. }
  10217. if (chunk && chunk.edited && chunk.start !== start)
  10218. throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
  10219. const startChunk = chunk;
  10220. while (chunk) {
  10221. if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
  10222. result += chunk.intro;
  10223. }
  10224. const containsEnd = chunk.start < end && chunk.end >= end;
  10225. if (containsEnd && chunk.edited && chunk.end !== end)
  10226. throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
  10227. const sliceStart = startChunk === chunk ? start - chunk.start : 0;
  10228. const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
  10229. result += chunk.content.slice(sliceStart, sliceEnd);
  10230. if (chunk.outro && (!containsEnd || chunk.end === end)) {
  10231. result += chunk.outro;
  10232. }
  10233. if (containsEnd) {
  10234. break;
  10235. }
  10236. chunk = chunk.next;
  10237. }
  10238. return result;
  10239. }
  10240. // TODO deprecate this? not really very useful
  10241. snip(start, end) {
  10242. const clone = this.clone();
  10243. clone.remove(0, start);
  10244. clone.remove(end, clone.original.length);
  10245. return clone;
  10246. }
  10247. _split(index) {
  10248. if (this.byStart[index] || this.byEnd[index]) return;
  10249. let chunk = this.lastSearchedChunk;
  10250. const searchForward = index > chunk.end;
  10251. while (chunk) {
  10252. if (chunk.contains(index)) return this._splitChunk(chunk, index);
  10253. chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
  10254. }
  10255. }
  10256. _splitChunk(chunk, index) {
  10257. if (chunk.edited && chunk.content.length) {
  10258. // zero-length edited chunks are a special case (overlapping replacements)
  10259. const loc = getLocator$3(this.original)(index);
  10260. throw new Error(
  10261. `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
  10262. );
  10263. }
  10264. const newChunk = chunk.split(index);
  10265. this.byEnd[index] = chunk;
  10266. this.byStart[index] = newChunk;
  10267. this.byEnd[newChunk.end] = newChunk;
  10268. if (chunk === this.lastChunk) this.lastChunk = newChunk;
  10269. this.lastSearchedChunk = chunk;
  10270. return true;
  10271. }
  10272. toString() {
  10273. let str = this.intro;
  10274. let chunk = this.firstChunk;
  10275. while (chunk) {
  10276. str += chunk.toString();
  10277. chunk = chunk.next;
  10278. }
  10279. return str + this.outro;
  10280. }
  10281. isEmpty() {
  10282. let chunk = this.firstChunk;
  10283. do {
  10284. if (
  10285. (chunk.intro.length && chunk.intro.trim()) ||
  10286. (chunk.content.length && chunk.content.trim()) ||
  10287. (chunk.outro.length && chunk.outro.trim())
  10288. )
  10289. return false;
  10290. } while ((chunk = chunk.next));
  10291. return true;
  10292. }
  10293. length() {
  10294. let chunk = this.firstChunk;
  10295. let length = 0;
  10296. do {
  10297. length += chunk.intro.length + chunk.content.length + chunk.outro.length;
  10298. } while ((chunk = chunk.next));
  10299. return length;
  10300. }
  10301. trimLines() {
  10302. return this.trim('[\\r\\n]');
  10303. }
  10304. trim(charType) {
  10305. return this.trimStart(charType).trimEnd(charType);
  10306. }
  10307. trimEndAborted(charType) {
  10308. const rx = new RegExp((charType || '\\s') + '+$');
  10309. this.outro = this.outro.replace(rx, '');
  10310. if (this.outro.length) return true;
  10311. let chunk = this.lastChunk;
  10312. do {
  10313. const end = chunk.end;
  10314. const aborted = chunk.trimEnd(rx);
  10315. // if chunk was trimmed, we have a new lastChunk
  10316. if (chunk.end !== end) {
  10317. if (this.lastChunk === chunk) {
  10318. this.lastChunk = chunk.next;
  10319. }
  10320. this.byEnd[chunk.end] = chunk;
  10321. this.byStart[chunk.next.start] = chunk.next;
  10322. this.byEnd[chunk.next.end] = chunk.next;
  10323. }
  10324. if (aborted) return true;
  10325. chunk = chunk.previous;
  10326. } while (chunk);
  10327. return false;
  10328. }
  10329. trimEnd(charType) {
  10330. this.trimEndAborted(charType);
  10331. return this;
  10332. }
  10333. trimStartAborted(charType) {
  10334. const rx = new RegExp('^' + (charType || '\\s') + '+');
  10335. this.intro = this.intro.replace(rx, '');
  10336. if (this.intro.length) return true;
  10337. let chunk = this.firstChunk;
  10338. do {
  10339. const end = chunk.end;
  10340. const aborted = chunk.trimStart(rx);
  10341. if (chunk.end !== end) {
  10342. // special case...
  10343. if (chunk === this.lastChunk) this.lastChunk = chunk.next;
  10344. this.byEnd[chunk.end] = chunk;
  10345. this.byStart[chunk.next.start] = chunk.next;
  10346. this.byEnd[chunk.next.end] = chunk.next;
  10347. }
  10348. if (aborted) return true;
  10349. chunk = chunk.next;
  10350. } while (chunk);
  10351. return false;
  10352. }
  10353. trimStart(charType) {
  10354. this.trimStartAborted(charType);
  10355. return this;
  10356. }
  10357. hasChanged() {
  10358. return this.original !== this.toString();
  10359. }
  10360. replace(searchValue, replacement) {
  10361. function getReplacement(match, str) {
  10362. if (typeof replacement === 'string') {
  10363. return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
  10364. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
  10365. if (i === '$') return '$';
  10366. if (i === '&') return match[0];
  10367. const num = +i;
  10368. if (num < match.length) return match[+i];
  10369. return `$${i}`;
  10370. });
  10371. } else {
  10372. return replacement(...match, match.index, str, match.groups);
  10373. }
  10374. }
  10375. function matchAll(re, str) {
  10376. let match;
  10377. const matches = [];
  10378. while ((match = re.exec(str))) {
  10379. matches.push(match);
  10380. }
  10381. return matches;
  10382. }
  10383. if (typeof searchValue !== 'string' && searchValue.global) {
  10384. const matches = matchAll(searchValue, this.original);
  10385. matches.forEach((match) => {
  10386. if (match.index != null)
  10387. this.overwrite(
  10388. match.index,
  10389. match.index + match[0].length,
  10390. getReplacement(match, this.original)
  10391. );
  10392. });
  10393. } else {
  10394. const match = this.original.match(searchValue);
  10395. if (match && match.index != null)
  10396. this.overwrite(
  10397. match.index,
  10398. match.index + match[0].length,
  10399. getReplacement(match, this.original)
  10400. );
  10401. }
  10402. return this;
  10403. }
  10404. }
  10405. /**
  10406. * @license
  10407. * Copyright Google Inc. All Rights Reserved.
  10408. *
  10409. * Use of this source code is governed by an MIT-style license that can be
  10410. * found in the LICENSE file at https://angular.io/license
  10411. *
  10412. * This file is a port of shadowCSS from webcomponents.js to TypeScript.
  10413. * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
  10414. * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
  10415. */
  10416. const safeSelector = (selector) => {
  10417. const placeholders = [];
  10418. let index = 0;
  10419. // Replaces attribute selectors with placeholders.
  10420. // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
  10421. selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
  10422. const replaceBy = `__ph-${index}__`;
  10423. placeholders.push(keep);
  10424. index++;
  10425. return replaceBy;
  10426. });
  10427. // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
  10428. // WS and "+" would otherwise be interpreted as selector separators.
  10429. const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
  10430. const replaceBy = `__ph-${index}__`;
  10431. placeholders.push(exp);
  10432. index++;
  10433. return pseudo + replaceBy;
  10434. });
  10435. const ss = {
  10436. content,
  10437. placeholders,
  10438. };
  10439. return ss;
  10440. };
  10441. const restoreSafeSelector = (placeholders, content) => {
  10442. return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
  10443. };
  10444. const _polyfillHost = '-shadowcsshost';
  10445. const _polyfillSlotted = '-shadowcssslotted';
  10446. // note: :host-context pre-processed to -shadowcsshostcontext.
  10447. const _polyfillHostContext = '-shadowcsscontext';
  10448. const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
  10449. const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
  10450. const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
  10451. const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');
  10452. const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
  10453. const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
  10454. const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
  10455. const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
  10456. const _polyfillHostRe = /-shadowcsshost/gim;
  10457. const _colonHostRe = /:host/gim;
  10458. const _colonSlottedRe = /::slotted/gim;
  10459. const _colonHostContextRe = /:host-context/gim;
  10460. const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
  10461. const stripComments = (input) => {
  10462. return input.replace(_commentRe, '');
  10463. };
  10464. const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
  10465. const extractCommentsWithHash = (input) => {
  10466. return input.match(_commentWithHashRe) || [];
  10467. };
  10468. const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
  10469. const _curlyRe = /([{}])/g;
  10470. const _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
  10471. const OPEN_CURLY = '{';
  10472. const CLOSE_CURLY = '}';
  10473. const BLOCK_PLACEHOLDER = '%BLOCK%';
  10474. const processRules = (input, ruleCallback) => {
  10475. const inputWithEscapedBlocks = escapeBlocks(input);
  10476. let nextBlockIndex = 0;
  10477. return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
  10478. const selector = m[2];
  10479. let content = '';
  10480. let suffix = m[4];
  10481. let contentPrefix = '';
  10482. if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
  10483. content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
  10484. suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
  10485. contentPrefix = '{';
  10486. }
  10487. const cssRule = {
  10488. selector,
  10489. content,
  10490. };
  10491. const rule = ruleCallback(cssRule);
  10492. return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
  10493. });
  10494. };
  10495. const escapeBlocks = (input) => {
  10496. const inputParts = input.split(_curlyRe);
  10497. const resultParts = [];
  10498. const escapedBlocks = [];
  10499. let bracketCount = 0;
  10500. let currentBlockParts = [];
  10501. for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
  10502. const part = inputParts[partIndex];
  10503. if (part === CLOSE_CURLY) {
  10504. bracketCount--;
  10505. }
  10506. if (bracketCount > 0) {
  10507. currentBlockParts.push(part);
  10508. }
  10509. else {
  10510. if (currentBlockParts.length > 0) {
  10511. escapedBlocks.push(currentBlockParts.join(''));
  10512. resultParts.push(BLOCK_PLACEHOLDER);
  10513. currentBlockParts = [];
  10514. }
  10515. resultParts.push(part);
  10516. }
  10517. if (part === OPEN_CURLY) {
  10518. bracketCount++;
  10519. }
  10520. }
  10521. if (currentBlockParts.length > 0) {
  10522. escapedBlocks.push(currentBlockParts.join(''));
  10523. resultParts.push(BLOCK_PLACEHOLDER);
  10524. }
  10525. const strEscapedBlocks = {
  10526. escapedString: resultParts.join(''),
  10527. blocks: escapedBlocks,
  10528. };
  10529. return strEscapedBlocks;
  10530. };
  10531. const insertPolyfillHostInCssText = (selector) => {
  10532. selector = selector
  10533. .replace(_colonHostContextRe, _polyfillHostContext)
  10534. .replace(_colonHostRe, _polyfillHost)
  10535. .replace(_colonSlottedRe, _polyfillSlotted);
  10536. return selector;
  10537. };
  10538. const convertColonRule = (cssText, regExp, partReplacer) => {
  10539. // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
  10540. return cssText.replace(regExp, (...m) => {
  10541. if (m[2]) {
  10542. const parts = m[2].split(',');
  10543. const r = [];
  10544. for (let i = 0; i < parts.length; i++) {
  10545. const p = parts[i].trim();
  10546. if (!p)
  10547. break;
  10548. r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
  10549. }
  10550. return r.join(',');
  10551. }
  10552. else {
  10553. return _polyfillHostNoCombinator + m[3];
  10554. }
  10555. });
  10556. };
  10557. const colonHostPartReplacer = (host, part, suffix) => {
  10558. return host + part.replace(_polyfillHost, '') + suffix;
  10559. };
  10560. const convertColonHost = (cssText) => {
  10561. return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
  10562. };
  10563. const colonHostContextPartReplacer = (host, part, suffix) => {
  10564. if (part.indexOf(_polyfillHost) > -1) {
  10565. return colonHostPartReplacer(host, part, suffix);
  10566. }
  10567. else {
  10568. return host + part + suffix + ', ' + part + ' ' + host + suffix;
  10569. }
  10570. };
  10571. const convertColonSlotted = (cssText, slotScopeId) => {
  10572. const slotClass = '.' + slotScopeId + ' > ';
  10573. const selectors = [];
  10574. cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
  10575. if (m[2]) {
  10576. const compound = m[2].trim();
  10577. const suffix = m[3];
  10578. const slottedSelector = slotClass + compound + suffix;
  10579. let prefixSelector = '';
  10580. for (let i = m[4] - 1; i >= 0; i--) {
  10581. const char = m[5][i];
  10582. if (char === '}' || char === ',') {
  10583. break;
  10584. }
  10585. prefixSelector = char + prefixSelector;
  10586. }
  10587. const orgSelector = prefixSelector + slottedSelector;
  10588. const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`;
  10589. if (orgSelector.trim() !== addedSelector.trim()) {
  10590. const updatedSelector = `${addedSelector}, ${orgSelector}`;
  10591. selectors.push({
  10592. orgSelector,
  10593. updatedSelector,
  10594. });
  10595. }
  10596. return slottedSelector;
  10597. }
  10598. else {
  10599. return _polyfillHostNoCombinator + m[3];
  10600. }
  10601. });
  10602. return {
  10603. selectors,
  10604. cssText,
  10605. };
  10606. };
  10607. const convertColonHostContext = (cssText) => {
  10608. return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
  10609. };
  10610. const convertShadowDOMSelectors = (cssText) => {
  10611. return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
  10612. };
  10613. const makeScopeMatcher = (scopeSelector) => {
  10614. const lre = /\[/g;
  10615. const rre = /\]/g;
  10616. scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
  10617. return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
  10618. };
  10619. const selectorNeedsScoping = (selector, scopeSelector) => {
  10620. const re = makeScopeMatcher(scopeSelector);
  10621. return !re.test(selector);
  10622. };
  10623. const injectScopingSelector = (selector, scopingSelector) => {
  10624. return selector.replace(_selectorPartsRe, (_, before = '', _colonGroup, colon = '', after = '') => {
  10625. return before + scopingSelector + colon + after;
  10626. });
  10627. };
  10628. const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => {
  10629. // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
  10630. _polyfillHostRe.lastIndex = 0;
  10631. if (_polyfillHostRe.test(selector)) {
  10632. const replaceBy = `.${hostSelector}`;
  10633. return selector
  10634. .replace(_polyfillHostNoCombinatorRe, (_, selector) => injectScopingSelector(selector, replaceBy))
  10635. .replace(_polyfillHostRe, replaceBy + ' ');
  10636. }
  10637. return scopeSelector + ' ' + selector;
  10638. };
  10639. const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => {
  10640. const isRe = /\[is=([^\]]*)\]/g;
  10641. scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
  10642. const className = '.' + scopeSelector;
  10643. const _scopeSelectorPart = (p) => {
  10644. let scopedP = p.trim();
  10645. if (!scopedP) {
  10646. return '';
  10647. }
  10648. if (p.indexOf(_polyfillHostNoCombinator) > -1) {
  10649. scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);
  10650. }
  10651. else {
  10652. // remove :host since it should be unnecessary
  10653. const t = p.replace(_polyfillHostRe, '');
  10654. if (t.length > 0) {
  10655. scopedP = injectScopingSelector(t, className);
  10656. }
  10657. }
  10658. return scopedP;
  10659. };
  10660. const safeContent = safeSelector(selector);
  10661. selector = safeContent.content;
  10662. let scopedSelector = '';
  10663. let startIndex = 0;
  10664. let res;
  10665. const sep = /( |>|\+|~(?!=))\s*/g;
  10666. // If a selector appears before :host it should not be shimmed as it
  10667. // matches on ancestor elements and not on elements in the host's shadow
  10668. // `:host-context(div)` is transformed to
  10669. // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
  10670. // the `div` is not part of the component in the 2nd selectors and should not be scoped.
  10671. // Historically `component-tag:host` was matching the component so we also want to preserve
  10672. // this behavior to avoid breaking legacy apps (it should not match).
  10673. // The behavior should be:
  10674. // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
  10675. // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
  10676. // `:host-context(tag)`)
  10677. const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
  10678. // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
  10679. let shouldScope = !hasHost;
  10680. while ((res = sep.exec(selector)) !== null) {
  10681. const separator = res[1];
  10682. const part = selector.slice(startIndex, res.index).trim();
  10683. shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
  10684. const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
  10685. scopedSelector += `${scopedPart} ${separator} `;
  10686. startIndex = sep.lastIndex;
  10687. }
  10688. const part = selector.substring(startIndex);
  10689. shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
  10690. scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
  10691. // replace the placeholders with their original values
  10692. return restoreSafeSelector(safeContent.placeholders, scopedSelector);
  10693. };
  10694. const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
  10695. return selector
  10696. .split(',')
  10697. .map((shallowPart) => {
  10698. if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {
  10699. return shallowPart.trim();
  10700. }
  10701. if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
  10702. return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
  10703. }
  10704. else {
  10705. return shallowPart.trim();
  10706. }
  10707. })
  10708. .join(', ');
  10709. };
  10710. const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
  10711. return processRules(cssText, (rule) => {
  10712. let selector = rule.selector;
  10713. let content = rule.content;
  10714. if (rule.selector[0] !== '@') {
  10715. selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
  10716. }
  10717. else if (rule.selector.startsWith('@media') ||
  10718. rule.selector.startsWith('@supports') ||
  10719. rule.selector.startsWith('@page') ||
  10720. rule.selector.startsWith('@document')) {
  10721. content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
  10722. }
  10723. const cssRule = {
  10724. selector: selector.replace(/\s{2,}/g, ' ').trim(),
  10725. content,
  10726. };
  10727. return cssRule;
  10728. });
  10729. };
  10730. const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
  10731. cssText = insertPolyfillHostInCssText(cssText);
  10732. cssText = convertColonHost(cssText);
  10733. cssText = convertColonHostContext(cssText);
  10734. const slotted = convertColonSlotted(cssText, slotScopeId);
  10735. cssText = slotted.cssText;
  10736. cssText = convertShadowDOMSelectors(cssText);
  10737. if (scopeId) {
  10738. cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
  10739. }
  10740. cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
  10741. cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 ');
  10742. return {
  10743. cssText: cssText.trim(),
  10744. slottedSelectors: slotted.selectors,
  10745. };
  10746. };
  10747. const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
  10748. const hostScopeId = scopeId + '-h';
  10749. const slotScopeId = scopeId + '-s';
  10750. const commentsWithHash = extractCommentsWithHash(cssText);
  10751. cssText = stripComments(cssText);
  10752. const orgSelectors = [];
  10753. if (commentOriginalSelector) {
  10754. const processCommentedSelector = (rule) => {
  10755. const placeholder = `/*!@___${orgSelectors.length}___*/`;
  10756. const comment = `/*!@${rule.selector}*/`;
  10757. orgSelectors.push({ placeholder, comment });
  10758. rule.selector = placeholder + rule.selector;
  10759. return rule;
  10760. };
  10761. cssText = processRules(cssText, (rule) => {
  10762. if (rule.selector[0] !== '@') {
  10763. return processCommentedSelector(rule);
  10764. }
  10765. else if (rule.selector.startsWith('@media') ||
  10766. rule.selector.startsWith('@supports') ||
  10767. rule.selector.startsWith('@page') ||
  10768. rule.selector.startsWith('@document')) {
  10769. rule.content = processRules(rule.content, processCommentedSelector);
  10770. return rule;
  10771. }
  10772. return rule;
  10773. });
  10774. }
  10775. const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);
  10776. cssText = [scoped.cssText, ...commentsWithHash].join('\n');
  10777. if (commentOriginalSelector) {
  10778. orgSelectors.forEach(({ placeholder, comment }) => {
  10779. cssText = cssText.replace(placeholder, comment);
  10780. });
  10781. }
  10782. scoped.slottedSelectors.forEach((slottedSelector) => {
  10783. cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector);
  10784. });
  10785. return cssText;
  10786. };
  10787. /**
  10788. * Parse CSS docstrings that Stencil supports, as documented here:
  10789. * https://stenciljs.com/docs/docs-json#css-variables
  10790. *
  10791. * Docstrings found in the supplied style text will be added to the
  10792. * `styleDocs` param
  10793. *
  10794. * @param styleDocs the array to hold formatted CSS docstrings
  10795. * @param styleText the CSS text we're working with
  10796. */
  10797. function parseStyleDocs(styleDocs, styleText) {
  10798. if (typeof styleText !== 'string') {
  10799. return;
  10800. }
  10801. let startIndex;
  10802. while ((startIndex = styleText.indexOf(CSS_DOC_START)) > -1) {
  10803. styleText = styleText.substring(startIndex + CSS_DOC_START.length);
  10804. const endIndex = styleText.indexOf(CSS_DOC_END);
  10805. if (endIndex === -1) {
  10806. break;
  10807. }
  10808. const comment = styleText.substring(0, endIndex);
  10809. parseCssComment(styleDocs, comment);
  10810. styleText = styleText.substring(endIndex + CSS_DOC_END.length);
  10811. }
  10812. }
  10813. /**
  10814. * Parse a CSS comment string and insert it into the provided array of
  10815. * style docstrings.
  10816. *
  10817. * @param styleDocs an array which will be modified with the docstring
  10818. * @param comment the comment string
  10819. */
  10820. function parseCssComment(styleDocs, comment) {
  10821. /**
  10822. * @prop --max-width: Max width of the alert
  10823. */
  10824. // (the above is an example of what these comments might look like)
  10825. const lines = comment.split(/\r?\n/).map((line) => {
  10826. line = line.trim();
  10827. while (line.startsWith('*')) {
  10828. line = line.substring(1).trim();
  10829. }
  10830. return line;
  10831. });
  10832. comment = lines.join(' ').replace(/\t/g, ' ').trim();
  10833. while (comment.includes(' ')) {
  10834. comment = comment.replace(' ', ' ');
  10835. }
  10836. const docs = comment.split(CSS_PROP_ANNOTATION);
  10837. docs.forEach((d) => {
  10838. const doc = d.trim();
  10839. if (!doc.startsWith(`--`)) {
  10840. return;
  10841. }
  10842. const splt = doc.split(`:`);
  10843. const cssDoc = {
  10844. name: splt[0].trim(),
  10845. docs: (splt.shift() && splt.join(`:`)).trim(),
  10846. annotation: 'prop',
  10847. };
  10848. if (!styleDocs.some((c) => c.name === cssDoc.name && c.annotation === 'prop')) {
  10849. styleDocs.push(cssDoc);
  10850. }
  10851. });
  10852. }
  10853. /**
  10854. * Opening syntax for a CSS docstring
  10855. */
  10856. const CSS_DOC_START = '/**';
  10857. /**
  10858. * Closing syntax for a CSS docstring
  10859. */
  10860. const CSS_DOC_END = '*/';
  10861. /**
  10862. * The `@prop` annotation we support within CSS docstrings
  10863. */
  10864. const CSS_PROP_ANNOTATION = '@prop';
  10865. /**
  10866. * Serialize data about a style import to an annotated path, where
  10867. * the filename has a URL queryparams style string appended to it.
  10868. * This could look like:
  10869. *
  10870. * ```
  10871. * './some-file.CSS?tag=my-tag&mode=ios&encapsulation=scoped');
  10872. * ```
  10873. *
  10874. * @param data import data to be serialized
  10875. * @param styleImportData an argument which controls whether the import data
  10876. * will be added to the path (formatted as queryparams)
  10877. * @returns a formatted string
  10878. */
  10879. const serializeImportPath = (data, styleImportData) => {
  10880. let p = data.importeePath;
  10881. if (isString$1(p)) {
  10882. if (isString$1(data.importerPath) && isAbsolute$1(data.importeePath)) {
  10883. p = relative$1(dirname(data.importerPath), data.importeePath);
  10884. }
  10885. p = normalizePath$1(p);
  10886. if (!p.startsWith('.')) {
  10887. p = './' + p;
  10888. }
  10889. if (styleImportData === 'queryparams' || styleImportData === undefined) {
  10890. const paramData = {};
  10891. if (isString$1(data.tag)) {
  10892. paramData.tag = data.tag;
  10893. }
  10894. if (isString$1(data.mode) && data.mode !== DEFAULT_STYLE_MODE) {
  10895. paramData.mode = data.mode;
  10896. }
  10897. if (isString$1(data.encapsulation) && data.encapsulation !== 'none') {
  10898. paramData.encapsulation = data.encapsulation;
  10899. }
  10900. const paramEntries = Object.entries(paramData);
  10901. if (paramEntries.length > 0) {
  10902. const params = new URLSearchParams(paramEntries);
  10903. p += '?' + params.toString();
  10904. }
  10905. }
  10906. }
  10907. return p;
  10908. };
  10909. /**
  10910. * Parse import paths (filepaths possibly annotated w/ component metadata,
  10911. * formatted as URL queryparams) into a structured format.
  10912. *
  10913. * @param importPath an annotated import path to examine
  10914. * @returns formatted information about the import
  10915. */
  10916. const parseImportPath = (importPath) => {
  10917. const parsedPath = {
  10918. importPath,
  10919. basename: null,
  10920. ext: null,
  10921. data: null,
  10922. };
  10923. if (isString$1(importPath)) {
  10924. const pathParts = importPath.split('?');
  10925. parsedPath.basename = basename(pathParts[0].trim());
  10926. const extParts = parsedPath.basename.toLowerCase().split('.');
  10927. if (extParts.length > 1) {
  10928. parsedPath.ext = extParts[extParts.length - 1];
  10929. if (parsedPath.ext === 'ts' && extParts[extParts.length - 2] === 'd') {
  10930. parsedPath.ext = 'd.ts';
  10931. }
  10932. }
  10933. if (pathParts.length > 1) {
  10934. const params = pathParts[1];
  10935. const urlParams = new URLSearchParams(params);
  10936. const tag = urlParams.get('tag');
  10937. if (tag != null) {
  10938. parsedPath.data = {
  10939. tag,
  10940. encapsulation: urlParams.get('encapsulation') || 'none',
  10941. mode: urlParams.get('mode') || DEFAULT_STYLE_MODE,
  10942. };
  10943. }
  10944. }
  10945. else if (parsedPath.basename.endsWith('.css')) {
  10946. parsedPath.data = {
  10947. encapsulation: 'none',
  10948. };
  10949. }
  10950. }
  10951. return parsedPath;
  10952. };
  10953. /**
  10954. * Strip out comments from some CSS
  10955. *
  10956. * @param input the string we'd like to de-comment
  10957. * @returns de-commented CSS!
  10958. */
  10959. const stripCssComments = (input) => {
  10960. let isInsideString = null;
  10961. let currentCharacter = '';
  10962. let returnValue = '';
  10963. for (let i = 0; i < input.length; i++) {
  10964. currentCharacter = input[i];
  10965. if (input[i - 1] !== '\\') {
  10966. if (currentCharacter === '"' || currentCharacter === "'") {
  10967. if (isInsideString === currentCharacter) {
  10968. isInsideString = null;
  10969. }
  10970. else if (!isInsideString) {
  10971. isInsideString = currentCharacter;
  10972. }
  10973. }
  10974. }
  10975. // Find beginning of /* type comment
  10976. if (!isInsideString && currentCharacter === '/' && input[i + 1] === '*') {
  10977. // Ignore important comment when configured to preserve comments using important syntax: /*!
  10978. let j = i + 2;
  10979. // Iterate over comment
  10980. for (; j < input.length; j++) {
  10981. // Find end of comment
  10982. if (input[j] === '*' && input[j + 1] === '/') {
  10983. break;
  10984. }
  10985. }
  10986. // Resume iteration over CSS string from the end of the comment
  10987. i = j + 1;
  10988. continue;
  10989. }
  10990. returnValue += currentCharacter;
  10991. }
  10992. return returnValue;
  10993. };
  10994. /**
  10995. * A regular expression for matching CSS import statements
  10996. *
  10997. * According to https://developer.mozilla.org/en-US/docs/Web/CSS/@import
  10998. * the formal grammar for CSS import statements is:
  10999. *
  11000. * ```
  11001. * @import [ <url> | <string> ]
  11002. * [ supports( [ <supports-condition> | <declaration> ] ) ]?
  11003. * <media-query-list>? ;
  11004. * ```
  11005. *
  11006. * Thus the string literal `"@import"` will be followed by a `<url>` or a
  11007. * `<string>`, where a `<url>` may be a relative or absolute URL _or_ a `url()`
  11008. * function.
  11009. *
  11010. * Thus the regular expression needs to match:
  11011. *
  11012. * - the string `"@import
  11013. * - any amount of whitespace
  11014. * - a URL, comprised of:
  11015. * - an optional `url(` function opener
  11016. * - a non-greedy match on any characters (to match the argument to the URL
  11017. * function)
  11018. * - an optional `)` closing paren on the `url()` function
  11019. * - trailing characters after the URL, given by anything which doesn't match
  11020. * the line-terminator `;`
  11021. * - this can match media queries, support conditions, and so on
  11022. * - a line-terminating semicolon
  11023. *
  11024. * The regex has 4 capture groups:
  11025. *
  11026. * 1. `@import`
  11027. * 2. `url(`
  11028. * 3. characters after `url(`
  11029. * 4. all characters other than `;`, greedily matching
  11030. *
  11031. * We typically only care about group 4 here.
  11032. */
  11033. const CSS_IMPORT_RE = /(@import)\s+(url\()?\s?(.*?)\s?\)?([^;]*);?/gi;
  11034. /**
  11035. * Our main entry point to this module. This performs an async transformation
  11036. * of CSS input to ESM.
  11037. *
  11038. * @param input CSS input to be transformed to ESM
  11039. * @returns a promise wrapping transformed ESM output
  11040. */
  11041. const transformCssToEsm = async (input) => {
  11042. const results = transformCssToEsmModule(input);
  11043. const optimizeResults = await optimizeCss$1({
  11044. autoprefixer: input.autoprefixer,
  11045. input: results.styleText,
  11046. filePath: input.file,
  11047. minify: true,
  11048. sourceMap: input.sourceMap,
  11049. });
  11050. results.diagnostics.push(...optimizeResults.diagnostics);
  11051. if (hasError(optimizeResults.diagnostics)) {
  11052. return results;
  11053. }
  11054. results.styleText = optimizeResults.output;
  11055. return generateTransformCssToEsm(input, results);
  11056. };
  11057. /**
  11058. * A sync function for transforming input CSS to ESM
  11059. *
  11060. * @param input the input CSS we're going to transform
  11061. * @returns transformed ESM output
  11062. */
  11063. const transformCssToEsmSync = (input) => {
  11064. const results = transformCssToEsmModule(input);
  11065. return generateTransformCssToEsm(input, results);
  11066. };
  11067. /**
  11068. * Performs the actual transformation from CSS to ESM
  11069. *
  11070. * @param input input CSS to be transformed
  11071. * @returns ESM output
  11072. */
  11073. const transformCssToEsmModule = (input) => {
  11074. const results = {
  11075. styleText: input.input,
  11076. output: '',
  11077. map: null,
  11078. diagnostics: [],
  11079. imports: [],
  11080. defaultVarName: createCssVarName(input.file, input.mode),
  11081. styleDocs: [],
  11082. };
  11083. if (input.docs) {
  11084. parseStyleDocs(results.styleDocs, input.input);
  11085. }
  11086. try {
  11087. const varNames = new Set([results.defaultVarName]);
  11088. if (isString$1(input.tag)) {
  11089. if (input.encapsulation === 'scoped' || (input.encapsulation === 'shadow' && input.commentOriginalSelector)) {
  11090. const scopeId = getScopeId(input.tag, input.mode);
  11091. results.styleText = scopeCss(results.styleText, scopeId, input.commentOriginalSelector);
  11092. }
  11093. }
  11094. const cssImports = getCssToEsmImports(varNames, results.styleText, input.file, input.mode);
  11095. cssImports.forEach((cssImport) => {
  11096. // remove the original css @imports
  11097. results.styleText = results.styleText.replace(cssImport.srcImportText, '');
  11098. const importPath = serializeImportPath({
  11099. importeePath: cssImport.filePath,
  11100. importerPath: input.file,
  11101. tag: input.tag,
  11102. encapsulation: input.encapsulation,
  11103. mode: input.mode,
  11104. }, input.styleImportData);
  11105. // str.append(`import ${cssImport.varName} from '${importPath}';\n`);
  11106. results.imports.push({
  11107. varName: cssImport.varName,
  11108. importPath,
  11109. });
  11110. });
  11111. }
  11112. catch (e) {
  11113. catchError(results.diagnostics, e);
  11114. }
  11115. return results;
  11116. };
  11117. /**
  11118. * Updated the `output` property on `results` with appropriate import statements for
  11119. * the CSS import tree and the module type.
  11120. *
  11121. * @param input the CSS to ESM transform input
  11122. * @param results the corresponding output
  11123. * @returns the modified ESM output
  11124. */
  11125. const generateTransformCssToEsm = (input, results) => {
  11126. const s = new MagicString$3('');
  11127. if (input.module === 'cjs') {
  11128. // CommonJS
  11129. results.imports.forEach((cssImport) => {
  11130. s.append(`const ${cssImport.varName} = require('${cssImport.importPath}');\n`);
  11131. });
  11132. s.append(`const ${results.defaultVarName} = `);
  11133. results.imports.forEach((cssImport) => {
  11134. s.append(`${cssImport.varName} + `);
  11135. });
  11136. s.append(`${JSON.stringify(results.styleText)};\n`);
  11137. s.append(`module.exports = ${results.defaultVarName};`);
  11138. }
  11139. else {
  11140. // ESM
  11141. results.imports.forEach((cssImport) => {
  11142. s.append(`import ${cssImport.varName} from '${cssImport.importPath}';\n`);
  11143. });
  11144. s.append(`const ${results.defaultVarName} = `);
  11145. results.imports.forEach((cssImport) => {
  11146. s.append(`${cssImport.varName} + `);
  11147. });
  11148. s.append(`${JSON.stringify(results.styleText)};\n`);
  11149. s.append(`export default ${results.defaultVarName};`);
  11150. }
  11151. results.output = s.toString();
  11152. return results;
  11153. };
  11154. /**
  11155. * Get all of the CSS imports in a file
  11156. *
  11157. * @param varNames a set into which new names will be added
  11158. * @param cssText the CSS text in question
  11159. * @param filePath the file path to the file in question
  11160. * @param modeName the current mode name
  11161. * @returns an array of import objects
  11162. */
  11163. const getCssToEsmImports = (varNames, cssText, filePath, modeName) => {
  11164. const cssImports = [];
  11165. if (!cssText.includes('@import')) {
  11166. // no @import at all, so don't bother
  11167. return cssImports;
  11168. }
  11169. cssText = stripCssComments(cssText);
  11170. const dir = path$5.dirname(filePath);
  11171. let r;
  11172. while ((r = CSS_IMPORT_RE.exec(cssText))) {
  11173. const cssImportData = {
  11174. srcImportText: r[0],
  11175. url: r[4].replace(/[\"\'\)]/g, ''),
  11176. filePath: null,
  11177. varName: null,
  11178. };
  11179. if (!isLocalCssImport$1(cssImportData.srcImportText)) {
  11180. // do nothing for @import url(http://external.css)
  11181. continue;
  11182. }
  11183. else if (isCssNodeModule$1(cssImportData.url)) {
  11184. // do not resolve this path cuz it starts with node resolve id ~
  11185. continue;
  11186. }
  11187. else if (path$5.isAbsolute(cssImportData.url)) {
  11188. // absolute path already
  11189. cssImportData.filePath = normalizePath$1(cssImportData.url);
  11190. }
  11191. else {
  11192. // relative path
  11193. cssImportData.filePath = normalizePath$1(path$5.resolve(dir, cssImportData.url));
  11194. }
  11195. cssImportData.varName = createCssVarName(cssImportData.filePath, modeName);
  11196. if (varNames.has(cssImportData.varName)) {
  11197. cssImportData.varName += varNames.size;
  11198. }
  11199. varNames.add(cssImportData.varName);
  11200. cssImports.push(cssImportData);
  11201. }
  11202. return cssImports;
  11203. };
  11204. /**
  11205. * Check if a module URL is a css node module
  11206. *
  11207. * @param url to check
  11208. * @returns whether or not it's a Css node module
  11209. */
  11210. const isCssNodeModule$1 = (url) => {
  11211. return url.startsWith('~');
  11212. };
  11213. /**
  11214. * Check if a given import is a local import or not (i.e. check that it
  11215. * is not importing from some other domain)
  11216. *
  11217. * @param srcImport the import to check
  11218. * @returns whether it's local or not
  11219. */
  11220. const isLocalCssImport$1 = (srcImport) => {
  11221. srcImport = srcImport.toLowerCase();
  11222. if (srcImport.includes('url(')) {
  11223. srcImport = srcImport.replace(/\"/g, '');
  11224. srcImport = srcImport.replace(/\'/g, '');
  11225. srcImport = srcImport.replace(/\s/g, '');
  11226. if (srcImport.includes('url(http') || srcImport.includes('url(//')) {
  11227. return false;
  11228. }
  11229. }
  11230. return true;
  11231. };
  11232. /**
  11233. * Given a file path and a mode name, create an appropriate variable name
  11234. *
  11235. * @param filePath the path we want to use
  11236. * @param modeName the name for the current style mode (i.e. `md` or `ios` on Ionic)
  11237. * @returns an appropriate Css var name
  11238. */
  11239. const createCssVarName = (filePath, modeName) => {
  11240. let varName = path$5.basename(filePath);
  11241. if (modeName && modeName !== DEFAULT_STYLE_MODE && !varName.includes(modeName)) {
  11242. varName = modeName + '-' + varName;
  11243. }
  11244. return createJsVarName(varName);
  11245. };
  11246. const createWorkerContext = (sys) => ({
  11247. transformCssToEsm,
  11248. prepareModule,
  11249. optimizeCss: optimizeCss$1,
  11250. prerenderWorker: (prerenderRequest) => prerenderWorker(sys, prerenderRequest),
  11251. });
  11252. const createWorkerMessageHandler = (sys) => {
  11253. const workerCtx = createWorkerContext(sys);
  11254. return (msgToWorker) => {
  11255. const fnName = msgToWorker.args[0];
  11256. const fnArgs = msgToWorker.args.slice(1);
  11257. const fn = workerCtx[fnName];
  11258. if (typeof fn === 'function') {
  11259. return fn(...fnArgs);
  11260. }
  11261. };
  11262. };
  11263. /**
  11264. * The CompilerCtx is a persistent object that's reused throughout
  11265. * all builds and rebuilds. The data within this object is used
  11266. * for in-memory caching, and can be reset, but the object itself
  11267. * is always the same.
  11268. */
  11269. class CompilerContext {
  11270. constructor() {
  11271. this.version = 2;
  11272. this.activeBuildId = -1;
  11273. this.activeFilesAdded = [];
  11274. this.activeFilesDeleted = [];
  11275. this.activeFilesUpdated = [];
  11276. this.activeDirsAdded = [];
  11277. this.activeDirsDeleted = [];
  11278. this.addWatchDir = noop$1;
  11279. this.addWatchFile = noop$1;
  11280. this.cssModuleImports = new Map();
  11281. this.changedFiles = new Set();
  11282. this.changedModules = new Set();
  11283. this.collections = [];
  11284. this.compilerOptions = null;
  11285. this.events = buildEvents();
  11286. this.hasSuccessfulBuild = false;
  11287. this.isActivelyBuilding = false;
  11288. this.lastBuildResults = null;
  11289. this.moduleMap = new Map();
  11290. this.nodeMap = new WeakMap();
  11291. this.resolvedCollections = new Set();
  11292. this.rollupCache = new Map();
  11293. this.rollupCacheHydrate = null;
  11294. this.rollupCacheLazy = null;
  11295. this.rollupCacheNative = null;
  11296. this.styleModeNames = new Set();
  11297. this.worker = null;
  11298. }
  11299. reset() {
  11300. this.cache.clear();
  11301. this.cssModuleImports.clear();
  11302. this.cachedGlobalStyle = null;
  11303. this.collections.length = 0;
  11304. this.compilerOptions = null;
  11305. this.hasSuccessfulBuild = false;
  11306. this.rollupCacheHydrate = null;
  11307. this.rollupCacheLazy = null;
  11308. this.rollupCacheNative = null;
  11309. this.moduleMap.clear();
  11310. this.resolvedCollections.clear();
  11311. if (this.fs != null) {
  11312. this.fs.clearCache();
  11313. }
  11314. }
  11315. }
  11316. const getModuleLegacy = (_config, compilerCtx, sourceFilePath) => {
  11317. sourceFilePath = normalizePath$1(sourceFilePath);
  11318. const moduleFile = compilerCtx.moduleMap.get(sourceFilePath);
  11319. if (moduleFile != null) {
  11320. return moduleFile;
  11321. }
  11322. else {
  11323. const sourceFileDir = dirname(sourceFilePath);
  11324. const sourceFileExt = extname$1(sourceFilePath);
  11325. const sourceFileName = basename(sourceFilePath, sourceFileExt);
  11326. const jsFilePath = join(sourceFileDir, sourceFileName + '.js');
  11327. const moduleFile = {
  11328. sourceFilePath: sourceFilePath,
  11329. jsFilePath: jsFilePath,
  11330. cmps: [],
  11331. coreRuntimeApis: [],
  11332. collectionName: null,
  11333. dtsFilePath: null,
  11334. excludeFromCollection: false,
  11335. externalImports: [],
  11336. hasVdomAttribute: false,
  11337. hasVdomXlink: false,
  11338. hasVdomClass: false,
  11339. hasVdomFunctional: false,
  11340. hasVdomKey: false,
  11341. hasVdomListener: false,
  11342. hasVdomPropOrAttr: false,
  11343. hasVdomRef: false,
  11344. hasVdomRender: false,
  11345. hasVdomStyle: false,
  11346. hasVdomText: false,
  11347. htmlAttrNames: [],
  11348. htmlTagNames: [],
  11349. htmlParts: [],
  11350. isCollectionDependency: false,
  11351. isLegacy: false,
  11352. localImports: [],
  11353. originalCollectionComponentPath: null,
  11354. originalImports: [],
  11355. potentialCmpRefs: [],
  11356. staticSourceFile: null,
  11357. staticSourceFileText: '',
  11358. sourceMapPath: null,
  11359. sourceMapFileText: null,
  11360. };
  11361. compilerCtx.moduleMap.set(sourceFilePath, moduleFile);
  11362. return moduleFile;
  11363. }
  11364. };
  11365. const resetModuleLegacy = (moduleFile) => {
  11366. moduleFile.cmps.length = 0;
  11367. moduleFile.coreRuntimeApis.length = 0;
  11368. moduleFile.collectionName = null;
  11369. moduleFile.dtsFilePath = null;
  11370. moduleFile.excludeFromCollection = false;
  11371. moduleFile.externalImports.length = 0;
  11372. moduleFile.isCollectionDependency = false;
  11373. moduleFile.localImports.length = 0;
  11374. moduleFile.originalCollectionComponentPath = null;
  11375. moduleFile.originalImports.length = 0;
  11376. moduleFile.hasVdomXlink = false;
  11377. moduleFile.hasVdomAttribute = false;
  11378. moduleFile.hasVdomClass = false;
  11379. moduleFile.hasVdomFunctional = false;
  11380. moduleFile.hasVdomKey = false;
  11381. moduleFile.hasVdomListener = false;
  11382. moduleFile.hasVdomRef = false;
  11383. moduleFile.hasVdomRender = false;
  11384. moduleFile.hasVdomStyle = false;
  11385. moduleFile.hasVdomText = false;
  11386. moduleFile.htmlAttrNames.length = 0;
  11387. moduleFile.htmlTagNames.length = 0;
  11388. moduleFile.potentialCmpRefs.length = 0;
  11389. };
  11390. const relativeImport = (pathFrom, pathTo, ext, addPrefix = true) => {
  11391. let relativePath = relative$1(dirname(pathFrom), dirname(pathTo));
  11392. if (addPrefix) {
  11393. if (relativePath === '') {
  11394. relativePath = '.';
  11395. }
  11396. else if (relativePath[0] !== '.') {
  11397. relativePath = './' + relativePath;
  11398. }
  11399. }
  11400. return normalizePath$1(`${relativePath}/${basename(pathTo, ext)}`);
  11401. };
  11402. const getComponentsDtsSrcFilePath = (config) => join(config.srcDir, GENERATED_DTS$1);
  11403. const getComponentsDtsTypesFilePath = (outputTarget) => join(outputTarget.typesDir, GENERATED_DTS$1);
  11404. const isOutputTargetDist = (o) => o.type === DIST;
  11405. const isOutputTargetDistCollection = (o) => o.type === DIST_COLLECTION;
  11406. const isOutputTargetDistCustomElements = (o) => o.type === DIST_CUSTOM_ELEMENTS;
  11407. const isOutputTargetDistCustomElementsBundle = (o) => o.type === DIST_CUSTOM_ELEMENTS_BUNDLE;
  11408. const isOutputTargetCopy = (o) => o.type === COPY;
  11409. const isOutputTargetDistLazy = (o) => o.type === DIST_LAZY;
  11410. const isOutputTargetAngular = (o) => o.type === ANGULAR;
  11411. const isOutputTargetDistLazyLoader = (o) => o.type === DIST_LAZY_LOADER;
  11412. const isOutputTargetDistGlobalStyles = (o) => o.type === DIST_GLOBAL_STYLES;
  11413. const isOutputTargetHydrate = (o) => o.type === DIST_HYDRATE_SCRIPT;
  11414. const isOutputTargetCustom = (o) => o.type === CUSTOM;
  11415. const isOutputTargetDocs = (o) => o.type === DOCS_README || o.type === DOCS_JSON || o.type === DOCS_CUSTOM || o.type === DOCS_VSCODE;
  11416. const isOutputTargetDocsReadme = (o) => o.type === DOCS_README;
  11417. const isOutputTargetDocsJson = (o) => o.type === DOCS_JSON;
  11418. const isOutputTargetDocsCustom = (o) => o.type === DOCS_CUSTOM;
  11419. const isOutputTargetDocsVscode = (o) => o.type === DOCS_VSCODE;
  11420. const isOutputTargetWww = (o) => o.type === WWW;
  11421. const isOutputTargetStats = (o) => o.type === STATS;
  11422. const isOutputTargetDistTypes = (o) => o.type === DIST_TYPES;
  11423. const getComponentsFromModules = (moduleFiles) => sortBy(flatOne(moduleFiles.map((m) => m.cmps)), (c) => c.tagName);
  11424. const ANGULAR = 'angular';
  11425. const COPY = 'copy';
  11426. const CUSTOM = 'custom';
  11427. const DIST = 'dist';
  11428. const DIST_COLLECTION = 'dist-collection';
  11429. const DIST_CUSTOM_ELEMENTS = 'dist-custom-elements';
  11430. const DIST_CUSTOM_ELEMENTS_BUNDLE = 'dist-custom-elements-bundle';
  11431. const DIST_TYPES = 'dist-types';
  11432. const DIST_HYDRATE_SCRIPT = 'dist-hydrate-script';
  11433. const DIST_LAZY = 'dist-lazy';
  11434. const DIST_LAZY_LOADER = 'dist-lazy-loader';
  11435. const DIST_GLOBAL_STYLES = 'dist-global-styles';
  11436. const DOCS_CUSTOM = 'docs-custom';
  11437. const DOCS_JSON = 'docs-json';
  11438. const DOCS_README = 'docs-readme';
  11439. const DOCS_VSCODE = 'docs-vscode';
  11440. const STATS = 'stats';
  11441. const WWW = 'www';
  11442. /**
  11443. * Valid output targets to specify in a Stencil config.
  11444. *
  11445. * Note that there are some output targets (e.g. `DIST_TYPES`) which are
  11446. * programmatically set as output targets by the compiler when other output
  11447. * targets (in that case `DIST`) are set, but which are _not_ supported in a
  11448. * Stencil config. This is enforced in the output target validation code.
  11449. */
  11450. const VALID_CONFIG_OUTPUT_TARGETS = [
  11451. // DIST
  11452. WWW,
  11453. DIST,
  11454. DIST_COLLECTION,
  11455. DIST_CUSTOM_ELEMENTS,
  11456. DIST_CUSTOM_ELEMENTS_BUNDLE,
  11457. DIST_LAZY,
  11458. DIST_HYDRATE_SCRIPT,
  11459. // DOCS
  11460. DOCS_JSON,
  11461. DOCS_README,
  11462. DOCS_VSCODE,
  11463. DOCS_CUSTOM,
  11464. // MISC
  11465. ANGULAR,
  11466. COPY,
  11467. CUSTOM,
  11468. STATS,
  11469. ];
  11470. /**
  11471. * Check whether a given output target is a valid one to be set in a Stencil config
  11472. *
  11473. * @param targetType the type which we want to check
  11474. * @returns whether or not the targetType is a valid, configurable output target.
  11475. */
  11476. function isValidConfigOutputTarget(targetType) {
  11477. // unfortunately `includes` is typed on `ReadonlyArray<T>` as `(el: T):
  11478. // boolean` so a `string` cannot be passed to `includes` on a
  11479. // `ReadonlyArray` 😢 thus we `as any`
  11480. //
  11481. // see microsoft/TypeScript#31018 for some discussion of this
  11482. return VALID_CONFIG_OUTPUT_TARGETS.includes(targetType);
  11483. }
  11484. const GENERATED_DTS$1 = 'components.d.ts';
  11485. const getTsOptionsToExtend = (config) => {
  11486. const tsOptions = {
  11487. experimentalDecorators: true,
  11488. declaration: config.outputTargets.some(isOutputTargetDistTypes),
  11489. module: t.ModuleKind.ESNext,
  11490. moduleResolution: t.ModuleResolutionKind.NodeJs,
  11491. noEmitOnError: false,
  11492. outDir: config.cacheDir || config.sys.tmpDirSync(),
  11493. sourceMap: config.sourceMap,
  11494. inlineSources: config.sourceMap,
  11495. };
  11496. return tsOptions;
  11497. };
  11498. /**
  11499. * Create a TypeScript Program ({@link ts.Program}) to perform builds of a Stencil project using the provided
  11500. * `buildCallback` entity
  11501. * @param config a Stencil configuration to apply to a full build of a Stencil project
  11502. * @param buildCallback a callback that invokes the actual transpilation of a Stencil project
  11503. * @returns a Program that marries the TypeScript and Stencil compilers together.
  11504. */
  11505. const createTsBuildProgram = async (config, buildCallback) => {
  11506. let isBuildRunning = false;
  11507. let currentBuildTimeoutId;
  11508. const optionsToExtend = getTsOptionsToExtend(config);
  11509. /**
  11510. * Create a {@link ts.System}. The System is responsible for handling all interactions between the TypeScript compiler
  11511. * and the host operating system.
  11512. */
  11513. const tsWatchSys = {
  11514. ...t.sys,
  11515. /**
  11516. * Watch changes in source files, missing files needed to update the program or config file
  11517. * @returns a no-op file watcher
  11518. */
  11519. watchFile() {
  11520. return {
  11521. close() { },
  11522. };
  11523. },
  11524. /**
  11525. * Watch a resolved module's failed lookup locations, config file specs, type roots where auto type reference
  11526. * directives are added
  11527. * @returns a no-op file watcher
  11528. */
  11529. watchDirectory() {
  11530. return {
  11531. close() { },
  11532. };
  11533. },
  11534. /**
  11535. * Set delayed compilation, so that multiple changes in short span are compiled together
  11536. * @param callback a callback to invoke upon the completion of compilation. this function is provided to Stencil by
  11537. * the TypeScript compiler.
  11538. * @param timeoutMs the minimum time to wait (in milliseconds) before checking if compilation is complete or not
  11539. * @returns the identifier for the interval that's created
  11540. */
  11541. setTimeout(callback, timeoutMs) {
  11542. currentBuildTimeoutId = setInterval(() => {
  11543. if (!isBuildRunning) {
  11544. callback();
  11545. clearInterval(currentBuildTimeoutId);
  11546. }
  11547. }, config.sys.watchTimeout || timeoutMs);
  11548. return currentBuildTimeoutId;
  11549. },
  11550. /**
  11551. * Reset existing delayed compilation
  11552. * @param timeoutId the current build timeout identifier to clear
  11553. */
  11554. clearTimeout(timeoutId) {
  11555. clearInterval(timeoutId);
  11556. },
  11557. };
  11558. config.sys.addDestory(() => tsWatchSys.clearTimeout(currentBuildTimeoutId));
  11559. /**
  11560. * Create a {@link ts.WatchCompilerHost}. A CompilerHost allows a {@link ts.Program} to interact with the
  11561. * {@link ts.System}, by acting as an intermediary:
  11562. * ```
  11563. * ┌────────────┐ ┌──────────────────────┐ ┌───────────┐ ┌──────────────────┐
  11564. * │ ts.Program │<->│ ts.WatchCompilerHost │<->│ ts.System │<->│ Operating System │
  11565. * └────────────┘ └──────────────────────┘ └───────────┘ └──────────────────┘
  11566. * ```
  11567. *
  11568. * Strictly speaking, the created entity is a subclass of a WatchCompilerHost. The
  11569. * {@link ts.WatchCompilerHostOfConfigFile} class has the following features that makes it useful to Stencil (even
  11570. * when Stencil is performing a single, full build):
  11571. * - it provides the opportunity to extend/alter an existing tsconfig file, allowing users to override specific
  11572. * configuration options via {@link ts.WatchCompilerHostOfConfigFile#optionsToExtend}, which is a provided as an
  11573. * argument in the constructor
  11574. * - it includes the {@link ts.WatchCompilerHost#afterProgramCreate} function in its interface, which Stencil
  11575. * overrides to invoke a build callback (not as a part of this object's creation)
  11576. */
  11577. const tsWatchHost = t.createWatchCompilerHost(config.tsconfig, optionsToExtend, tsWatchSys, t.createEmitAndSemanticDiagnosticsBuilderProgram, (reportDiagnostic) => {
  11578. config.logger.debug('watch reportDiagnostic:' + reportDiagnostic.messageText);
  11579. }, (reportWatchStatus) => {
  11580. config.logger.debug(reportWatchStatus.messageText);
  11581. });
  11582. /**
  11583. * Override {@link ts.WatchCompilerHost#afterProgramCreate} to invoke the build callback that was provided as an
  11584. * argument to this function.
  11585. * @param tsBuilder a {@link ts.BuilderProgram} to manage the {@link ts.Program} in the provided build context
  11586. */
  11587. tsWatchHost.afterProgramCreate = async (tsBuilder) => {
  11588. isBuildRunning = true;
  11589. await buildCallback(tsBuilder);
  11590. isBuildRunning = false;
  11591. };
  11592. /**
  11593. * Create the initial {@link ts.Program} using Stencil's custom {@link ts.WatchCompilerHostOfConfigFile}. The Program
  11594. * represents the _TypeScript_ compiler context, that will work in tandem with Stencil's compiler context and build
  11595. * context
  11596. */
  11597. return t.createWatchProgram(tsWatchHost);
  11598. };
  11599. const CONTENT_REF_ID = 'r';
  11600. const ORG_LOCATION_ID = 'o';
  11601. const SLOT_NODE_ID = 's';
  11602. const TEXT_NODE_ID = 't';
  11603. const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
  11604. const XLINK_NS = 'http://www.w3.org/1999/xlink';
  11605. const attrHandler = {
  11606. get(obj, prop) {
  11607. if (prop in obj) {
  11608. return obj[prop];
  11609. }
  11610. if (typeof prop !== 'symbol' && !isNaN(prop)) {
  11611. return obj.__items[prop];
  11612. }
  11613. return undefined;
  11614. },
  11615. };
  11616. const createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
  11617. class MockAttributeMap {
  11618. constructor(caseInsensitive = false) {
  11619. this.caseInsensitive = caseInsensitive;
  11620. this.__items = [];
  11621. }
  11622. get length() {
  11623. return this.__items.length;
  11624. }
  11625. item(index) {
  11626. return this.__items[index] || null;
  11627. }
  11628. setNamedItem(attr) {
  11629. attr.namespaceURI = null;
  11630. this.setNamedItemNS(attr);
  11631. }
  11632. setNamedItemNS(attr) {
  11633. if (attr != null && attr.value != null) {
  11634. attr.value = String(attr.value);
  11635. }
  11636. const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
  11637. if (existingAttr != null) {
  11638. existingAttr.value = attr.value;
  11639. }
  11640. else {
  11641. this.__items.push(attr);
  11642. }
  11643. }
  11644. getNamedItem(attrName) {
  11645. if (this.caseInsensitive) {
  11646. attrName = attrName.toLowerCase();
  11647. }
  11648. return this.getNamedItemNS(null, attrName);
  11649. }
  11650. getNamedItemNS(namespaceURI, attrName) {
  11651. namespaceURI = getNamespaceURI(namespaceURI);
  11652. return (this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null);
  11653. }
  11654. removeNamedItem(attr) {
  11655. this.removeNamedItemNS(attr);
  11656. }
  11657. removeNamedItemNS(attr) {
  11658. for (let i = 0, ii = this.__items.length; i < ii; i++) {
  11659. if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
  11660. this.__items.splice(i, 1);
  11661. break;
  11662. }
  11663. }
  11664. }
  11665. [Symbol.iterator]() {
  11666. let i = 0;
  11667. return {
  11668. next: () => ({
  11669. done: i === this.length,
  11670. value: this.item(i++),
  11671. }),
  11672. };
  11673. }
  11674. get [Symbol.toStringTag]() {
  11675. return 'MockAttributeMap';
  11676. }
  11677. }
  11678. function getNamespaceURI(namespaceURI) {
  11679. return namespaceURI === XLINK_NS ? null : namespaceURI;
  11680. }
  11681. function cloneAttributes(srcAttrs, sortByName = false) {
  11682. const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
  11683. if (srcAttrs != null) {
  11684. const attrLen = srcAttrs.length;
  11685. if (sortByName && attrLen > 1) {
  11686. const sortedAttrs = [];
  11687. for (let i = 0; i < attrLen; i++) {
  11688. const srcAttr = srcAttrs.item(i);
  11689. const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
  11690. sortedAttrs.push(dstAttr);
  11691. }
  11692. sortedAttrs.sort(sortAttributes).forEach((attr) => {
  11693. dstAttrs.setNamedItemNS(attr);
  11694. });
  11695. }
  11696. else {
  11697. for (let i = 0; i < attrLen; i++) {
  11698. const srcAttr = srcAttrs.item(i);
  11699. const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
  11700. dstAttrs.setNamedItemNS(dstAttr);
  11701. }
  11702. }
  11703. }
  11704. return dstAttrs;
  11705. }
  11706. function sortAttributes(a, b) {
  11707. if (a.name < b.name)
  11708. return -1;
  11709. if (a.name > b.name)
  11710. return 1;
  11711. return 0;
  11712. }
  11713. class MockAttr {
  11714. constructor(attrName, attrValue, namespaceURI = null) {
  11715. this._name = attrName;
  11716. this._value = String(attrValue);
  11717. this._namespaceURI = namespaceURI;
  11718. }
  11719. get name() {
  11720. return this._name;
  11721. }
  11722. set name(value) {
  11723. this._name = value;
  11724. }
  11725. get value() {
  11726. return this._value;
  11727. }
  11728. set value(value) {
  11729. this._value = String(value);
  11730. }
  11731. get nodeName() {
  11732. return this._name;
  11733. }
  11734. set nodeName(value) {
  11735. this._name = value;
  11736. }
  11737. get nodeValue() {
  11738. return this._value;
  11739. }
  11740. set nodeValue(value) {
  11741. this._value = String(value);
  11742. }
  11743. get namespaceURI() {
  11744. return this._namespaceURI;
  11745. }
  11746. set namespaceURI(namespaceURI) {
  11747. this._namespaceURI = namespaceURI;
  11748. }
  11749. }
  11750. class MockClassList {
  11751. constructor(elm) {
  11752. this.elm = elm;
  11753. }
  11754. add(...classNames) {
  11755. const clsNames = getItems(this.elm);
  11756. let updated = false;
  11757. classNames.forEach((className) => {
  11758. className = String(className);
  11759. validateClass(className);
  11760. if (clsNames.includes(className) === false) {
  11761. clsNames.push(className);
  11762. updated = true;
  11763. }
  11764. });
  11765. if (updated) {
  11766. this.elm.setAttributeNS(null, 'class', clsNames.join(' '));
  11767. }
  11768. }
  11769. remove(...classNames) {
  11770. const clsNames = getItems(this.elm);
  11771. let updated = false;
  11772. classNames.forEach((className) => {
  11773. className = String(className);
  11774. validateClass(className);
  11775. const index = clsNames.indexOf(className);
  11776. if (index > -1) {
  11777. clsNames.splice(index, 1);
  11778. updated = true;
  11779. }
  11780. });
  11781. if (updated) {
  11782. this.elm.setAttributeNS(null, 'class', clsNames.filter((c) => c.length > 0).join(' '));
  11783. }
  11784. }
  11785. contains(className) {
  11786. className = String(className);
  11787. return getItems(this.elm).includes(className);
  11788. }
  11789. toggle(className) {
  11790. className = String(className);
  11791. if (this.contains(className) === true) {
  11792. this.remove(className);
  11793. }
  11794. else {
  11795. this.add(className);
  11796. }
  11797. }
  11798. get length() {
  11799. return getItems(this.elm).length;
  11800. }
  11801. item(index) {
  11802. return getItems(this.elm)[index];
  11803. }
  11804. toString() {
  11805. return getItems(this.elm).join(' ');
  11806. }
  11807. }
  11808. function validateClass(className) {
  11809. if (className === '') {
  11810. throw new Error('The token provided must not be empty.');
  11811. }
  11812. if (/\s/.test(className)) {
  11813. throw new Error(`The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`);
  11814. }
  11815. }
  11816. function getItems(elm) {
  11817. const className = elm.getAttribute('class');
  11818. if (typeof className === 'string' && className.length > 0) {
  11819. return className
  11820. .trim()
  11821. .split(' ')
  11822. .filter((c) => c.length > 0);
  11823. }
  11824. return [];
  11825. }
  11826. class MockCSSStyleDeclaration {
  11827. constructor() {
  11828. this._styles = new Map();
  11829. }
  11830. setProperty(prop, value) {
  11831. prop = jsCaseToCssCase(prop);
  11832. if (value == null || value === '') {
  11833. this._styles.delete(prop);
  11834. }
  11835. else {
  11836. this._styles.set(prop, String(value));
  11837. }
  11838. }
  11839. getPropertyValue(prop) {
  11840. prop = jsCaseToCssCase(prop);
  11841. return String(this._styles.get(prop) || '');
  11842. }
  11843. removeProperty(prop) {
  11844. prop = jsCaseToCssCase(prop);
  11845. this._styles.delete(prop);
  11846. }
  11847. get length() {
  11848. return this._styles.size;
  11849. }
  11850. get cssText() {
  11851. const cssText = [];
  11852. this._styles.forEach((value, prop) => {
  11853. cssText.push(`${prop}: ${value};`);
  11854. });
  11855. return cssText.join(' ').trim();
  11856. }
  11857. set cssText(cssText) {
  11858. if (cssText == null || cssText === '') {
  11859. this._styles.clear();
  11860. return;
  11861. }
  11862. cssText.split(';').forEach((rule) => {
  11863. rule = rule.trim();
  11864. if (rule.length > 0) {
  11865. const splt = rule.split(':');
  11866. if (splt.length > 1) {
  11867. const prop = splt[0].trim();
  11868. const value = splt.slice(1).join(':').trim();
  11869. if (prop !== '' && value !== '') {
  11870. this._styles.set(jsCaseToCssCase(prop), value);
  11871. }
  11872. }
  11873. }
  11874. });
  11875. }
  11876. }
  11877. function createCSSStyleDeclaration() {
  11878. return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
  11879. }
  11880. const cssProxyHandler = {
  11881. get(cssStyle, prop) {
  11882. if (prop in cssStyle) {
  11883. return cssStyle[prop];
  11884. }
  11885. prop = cssCaseToJsCase(prop);
  11886. return cssStyle.getPropertyValue(prop);
  11887. },
  11888. set(cssStyle, prop, value) {
  11889. if (prop in cssStyle) {
  11890. cssStyle[prop] = value;
  11891. }
  11892. else {
  11893. cssStyle.setProperty(prop, value);
  11894. }
  11895. return true;
  11896. },
  11897. };
  11898. function cssCaseToJsCase(str) {
  11899. // font-size to fontSize
  11900. if (str.length > 1 && str.includes('-') === true) {
  11901. str = str
  11902. .toLowerCase()
  11903. .split('-')
  11904. .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
  11905. .join('');
  11906. str = str.slice(0, 1).toLowerCase() + str.slice(1);
  11907. }
  11908. return str;
  11909. }
  11910. function jsCaseToCssCase(str) {
  11911. // fontSize to font-size
  11912. if (str.length > 1 && str.includes('-') === false && /[A-Z]/.test(str) === true) {
  11913. str = str
  11914. .replace(/([A-Z])/g, (g) => ' ' + g[0])
  11915. .trim()
  11916. .replace(/ /g, '-')
  11917. .toLowerCase();
  11918. }
  11919. return str;
  11920. }
  11921. class MockCustomElementRegistry {
  11922. constructor(win) {
  11923. this.win = win;
  11924. }
  11925. define(tagName, cstr, options) {
  11926. if (tagName.toLowerCase() !== tagName) {
  11927. throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`);
  11928. }
  11929. if (this.__registry == null) {
  11930. this.__registry = new Map();
  11931. }
  11932. this.__registry.set(tagName, { cstr, options });
  11933. if (this.__whenDefined != null) {
  11934. const whenDefinedResolveFns = this.__whenDefined.get(tagName);
  11935. if (whenDefinedResolveFns != null) {
  11936. whenDefinedResolveFns.forEach((whenDefinedResolveFn) => {
  11937. whenDefinedResolveFn();
  11938. });
  11939. whenDefinedResolveFns.length = 0;
  11940. this.__whenDefined.delete(tagName);
  11941. }
  11942. }
  11943. const doc = this.win.document;
  11944. if (doc != null) {
  11945. const hosts = doc.querySelectorAll(tagName);
  11946. hosts.forEach((host) => {
  11947. if (upgradedElements.has(host) === false) {
  11948. tempDisableCallbacks.add(doc);
  11949. const upgradedCmp = createCustomElement(this, doc, tagName);
  11950. for (let i = 0; i < host.childNodes.length; i++) {
  11951. const childNode = host.childNodes[i];
  11952. childNode.remove();
  11953. upgradedCmp.appendChild(childNode);
  11954. }
  11955. tempDisableCallbacks.delete(doc);
  11956. if (proxyElements.has(host)) {
  11957. proxyElements.set(host, upgradedCmp);
  11958. }
  11959. }
  11960. fireConnectedCallback(host);
  11961. });
  11962. }
  11963. }
  11964. get(tagName) {
  11965. if (this.__registry != null) {
  11966. const def = this.__registry.get(tagName.toLowerCase());
  11967. if (def != null) {
  11968. return def.cstr;
  11969. }
  11970. }
  11971. return undefined;
  11972. }
  11973. upgrade(_rootNode) {
  11974. //
  11975. }
  11976. clear() {
  11977. if (this.__registry != null) {
  11978. this.__registry.clear();
  11979. }
  11980. if (this.__whenDefined != null) {
  11981. this.__whenDefined.clear();
  11982. }
  11983. }
  11984. whenDefined(tagName) {
  11985. tagName = tagName.toLowerCase();
  11986. if (this.__registry != null && this.__registry.has(tagName) === true) {
  11987. return Promise.resolve(this.__registry.get(tagName).cstr);
  11988. }
  11989. return new Promise((resolve) => {
  11990. if (this.__whenDefined == null) {
  11991. this.__whenDefined = new Map();
  11992. }
  11993. let whenDefinedResolveFns = this.__whenDefined.get(tagName);
  11994. if (whenDefinedResolveFns == null) {
  11995. whenDefinedResolveFns = [];
  11996. this.__whenDefined.set(tagName, whenDefinedResolveFns);
  11997. }
  11998. whenDefinedResolveFns.push(resolve);
  11999. });
  12000. }
  12001. }
  12002. function createCustomElement(customElements, ownerDocument, tagName) {
  12003. const Cstr = customElements.get(tagName);
  12004. if (Cstr != null) {
  12005. const cmp = new Cstr(ownerDocument);
  12006. cmp.nodeName = tagName.toUpperCase();
  12007. upgradedElements.add(cmp);
  12008. return cmp;
  12009. }
  12010. const host = new Proxy({}, {
  12011. get(obj, prop) {
  12012. const elm = proxyElements.get(host);
  12013. if (elm != null) {
  12014. return elm[prop];
  12015. }
  12016. return obj[prop];
  12017. },
  12018. set(obj, prop, val) {
  12019. const elm = proxyElements.get(host);
  12020. if (elm != null) {
  12021. elm[prop] = val;
  12022. }
  12023. else {
  12024. obj[prop] = val;
  12025. }
  12026. return true;
  12027. },
  12028. has(obj, prop) {
  12029. const elm = proxyElements.get(host);
  12030. if (prop in elm) {
  12031. return true;
  12032. }
  12033. if (prop in obj) {
  12034. return true;
  12035. }
  12036. return false;
  12037. },
  12038. });
  12039. const elm = new MockHTMLElement(ownerDocument, tagName);
  12040. proxyElements.set(host, elm);
  12041. return host;
  12042. }
  12043. const proxyElements = new WeakMap();
  12044. const upgradedElements = new WeakSet();
  12045. function connectNode(ownerDocument, node) {
  12046. node.ownerDocument = ownerDocument;
  12047. if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  12048. if (ownerDocument != null && node.nodeName.includes('-')) {
  12049. const win = ownerDocument.defaultView;
  12050. if (win != null && typeof node.connectedCallback === 'function' && node.isConnected) {
  12051. fireConnectedCallback(node);
  12052. }
  12053. const shadowRoot = node.shadowRoot;
  12054. if (shadowRoot != null) {
  12055. shadowRoot.childNodes.forEach((childNode) => {
  12056. connectNode(ownerDocument, childNode);
  12057. });
  12058. }
  12059. }
  12060. node.childNodes.forEach((childNode) => {
  12061. connectNode(ownerDocument, childNode);
  12062. });
  12063. }
  12064. else {
  12065. node.childNodes.forEach((childNode) => {
  12066. childNode.ownerDocument = ownerDocument;
  12067. });
  12068. }
  12069. }
  12070. function fireConnectedCallback(node) {
  12071. if (typeof node.connectedCallback === 'function') {
  12072. if (tempDisableCallbacks.has(node.ownerDocument) === false) {
  12073. try {
  12074. node.connectedCallback();
  12075. }
  12076. catch (e) {
  12077. console.error(e);
  12078. }
  12079. }
  12080. }
  12081. }
  12082. function disconnectNode(node) {
  12083. if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  12084. if (node.nodeName.includes('-') === true && typeof node.disconnectedCallback === 'function') {
  12085. if (tempDisableCallbacks.has(node.ownerDocument) === false) {
  12086. try {
  12087. node.disconnectedCallback();
  12088. }
  12089. catch (e) {
  12090. console.error(e);
  12091. }
  12092. }
  12093. }
  12094. node.childNodes.forEach(disconnectNode);
  12095. }
  12096. }
  12097. function attributeChanged(node, attrName, oldValue, newValue) {
  12098. attrName = attrName.toLowerCase();
  12099. const observedAttributes = node.constructor.observedAttributes;
  12100. if (Array.isArray(observedAttributes) === true &&
  12101. observedAttributes.some((obs) => obs.toLowerCase() === attrName) === true) {
  12102. try {
  12103. node.attributeChangedCallback(attrName, oldValue, newValue);
  12104. }
  12105. catch (e) {
  12106. console.error(e);
  12107. }
  12108. }
  12109. }
  12110. function checkAttributeChanged(node) {
  12111. return node.nodeName.includes('-') === true && typeof node.attributeChangedCallback === 'function';
  12112. }
  12113. const tempDisableCallbacks = new Set();
  12114. function dataset(elm) {
  12115. const ds = {};
  12116. const attributes = elm.attributes;
  12117. const attrLen = attributes.length;
  12118. for (let i = 0; i < attrLen; i++) {
  12119. const attr = attributes.item(i);
  12120. const nodeName = attr.nodeName;
  12121. if (nodeName.startsWith('data-')) {
  12122. ds[dashToPascalCase(nodeName)] = attr.nodeValue;
  12123. }
  12124. }
  12125. return new Proxy(ds, {
  12126. get(_obj, camelCaseProp) {
  12127. return ds[camelCaseProp];
  12128. },
  12129. set(_obj, camelCaseProp, value) {
  12130. const dataAttr = toDataAttribute(camelCaseProp);
  12131. elm.setAttribute(dataAttr, value);
  12132. return true;
  12133. },
  12134. });
  12135. }
  12136. function toDataAttribute(str) {
  12137. return ('data-' +
  12138. String(str)
  12139. .replace(/([A-Z0-9])/g, (g) => ' ' + g[0])
  12140. .trim()
  12141. .replace(/ /g, '-')
  12142. .toLowerCase());
  12143. }
  12144. function dashToPascalCase(str) {
  12145. str = String(str).slice(5);
  12146. return str
  12147. .split('-')
  12148. .map((segment, index) => {
  12149. if (index === 0) {
  12150. return segment.charAt(0).toLowerCase() + segment.slice(1);
  12151. }
  12152. return segment.charAt(0).toUpperCase() + segment.slice(1);
  12153. })
  12154. .join('');
  12155. }
  12156. class MockEvent {
  12157. constructor(type, eventInitDict) {
  12158. this.bubbles = false;
  12159. this.cancelBubble = false;
  12160. this.cancelable = false;
  12161. this.composed = false;
  12162. this.currentTarget = null;
  12163. this.defaultPrevented = false;
  12164. this.srcElement = null;
  12165. this.target = null;
  12166. if (typeof type !== 'string') {
  12167. throw new Error(`Event type required`);
  12168. }
  12169. this.type = type;
  12170. this.timeStamp = Date.now();
  12171. if (eventInitDict != null) {
  12172. Object.assign(this, eventInitDict);
  12173. }
  12174. }
  12175. preventDefault() {
  12176. this.defaultPrevented = true;
  12177. }
  12178. stopPropagation() {
  12179. this.cancelBubble = true;
  12180. }
  12181. stopImmediatePropagation() {
  12182. this.cancelBubble = true;
  12183. }
  12184. composedPath() {
  12185. const composedPath = [];
  12186. let currentElement = this.target;
  12187. while (currentElement) {
  12188. composedPath.push(currentElement);
  12189. if (!currentElement.parentElement && currentElement.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
  12190. // the current element doesn't have a parent, but we've detected it's our root document node. push the window
  12191. // object associated with the document onto the path
  12192. composedPath.push(currentElement.defaultView);
  12193. break;
  12194. }
  12195. currentElement = currentElement.parentElement;
  12196. }
  12197. return composedPath;
  12198. }
  12199. }
  12200. class MockCustomEvent extends MockEvent {
  12201. constructor(type, customEventInitDic) {
  12202. super(type);
  12203. this.detail = null;
  12204. if (customEventInitDic != null) {
  12205. Object.assign(this, customEventInitDic);
  12206. }
  12207. }
  12208. }
  12209. class MockKeyboardEvent extends MockEvent {
  12210. constructor(type, keyboardEventInitDic) {
  12211. super(type);
  12212. this.code = '';
  12213. this.key = '';
  12214. this.altKey = false;
  12215. this.ctrlKey = false;
  12216. this.metaKey = false;
  12217. this.shiftKey = false;
  12218. this.location = 0;
  12219. this.repeat = false;
  12220. if (keyboardEventInitDic != null) {
  12221. Object.assign(this, keyboardEventInitDic);
  12222. }
  12223. }
  12224. }
  12225. class MockMouseEvent extends MockEvent {
  12226. constructor(type, mouseEventInitDic) {
  12227. super(type);
  12228. this.screenX = 0;
  12229. this.screenY = 0;
  12230. this.clientX = 0;
  12231. this.clientY = 0;
  12232. this.ctrlKey = false;
  12233. this.shiftKey = false;
  12234. this.altKey = false;
  12235. this.metaKey = false;
  12236. this.button = 0;
  12237. this.buttons = 0;
  12238. this.relatedTarget = null;
  12239. if (mouseEventInitDic != null) {
  12240. Object.assign(this, mouseEventInitDic);
  12241. }
  12242. }
  12243. }
  12244. class MockUIEvent extends MockEvent {
  12245. constructor(type, uiEventInitDic) {
  12246. super(type);
  12247. this.detail = null;
  12248. this.view = null;
  12249. if (uiEventInitDic != null) {
  12250. Object.assign(this, uiEventInitDic);
  12251. }
  12252. }
  12253. }
  12254. class MockFocusEvent extends MockUIEvent {
  12255. constructor(type, focusEventInitDic) {
  12256. super(type);
  12257. this.relatedTarget = null;
  12258. if (focusEventInitDic != null) {
  12259. Object.assign(this, focusEventInitDic);
  12260. }
  12261. }
  12262. }
  12263. class MockEventListener {
  12264. constructor(type, handler) {
  12265. this.type = type;
  12266. this.handler = handler;
  12267. }
  12268. }
  12269. function addEventListener(elm, type, handler) {
  12270. const target = elm;
  12271. if (target.__listeners == null) {
  12272. target.__listeners = [];
  12273. }
  12274. target.__listeners.push(new MockEventListener(type, handler));
  12275. }
  12276. function removeEventListener(elm, type, handler) {
  12277. const target = elm;
  12278. if (target != null && Array.isArray(target.__listeners) === true) {
  12279. const elmListener = target.__listeners.find((e) => e.type === type && e.handler === handler);
  12280. if (elmListener != null) {
  12281. const index = target.__listeners.indexOf(elmListener);
  12282. target.__listeners.splice(index, 1);
  12283. }
  12284. }
  12285. }
  12286. function resetEventListeners(target) {
  12287. if (target != null && target.__listeners != null) {
  12288. target.__listeners = null;
  12289. }
  12290. }
  12291. function triggerEventListener(elm, ev) {
  12292. if (elm == null || ev.cancelBubble === true) {
  12293. return;
  12294. }
  12295. const target = elm;
  12296. ev.currentTarget = elm;
  12297. if (Array.isArray(target.__listeners) === true) {
  12298. const listeners = target.__listeners.filter((e) => e.type === ev.type);
  12299. listeners.forEach((listener) => {
  12300. try {
  12301. listener.handler.call(target, ev);
  12302. }
  12303. catch (err) {
  12304. console.error(err);
  12305. }
  12306. });
  12307. }
  12308. if (ev.bubbles === false) {
  12309. return;
  12310. }
  12311. if (elm.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
  12312. triggerEventListener(elm.defaultView, ev);
  12313. }
  12314. else {
  12315. triggerEventListener(elm.parentElement, ev);
  12316. }
  12317. }
  12318. function dispatchEvent(currentTarget, ev) {
  12319. ev.target = currentTarget;
  12320. triggerEventListener(currentTarget, ev);
  12321. return true;
  12322. }
  12323. // Parse5 6.0.1
  12324. const e=function(e){const t=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];var n="�",s={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},r=function(e){return e>=55296&&e<=57343},i=function(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159},o=function(e){return e>=64976&&e<=65007||t.indexOf(e)>-1},a="unexpected-null-character",T="invalid-first-character-of-tag-name",E="missing-semicolon-after-character-reference",h="eof-before-tag-name",c="eof-in-tag",_="missing-whitespace-after-doctype-public-keyword",l="missing-whitespace-between-doctype-public-and-system-identifiers",m="missing-whitespace-after-doctype-system-keyword",p="missing-quote-before-doctype-public-identifier",A="missing-quote-before-doctype-system-identifier",u="missing-doctype-public-identifier",N="missing-doctype-system-identifier",d="abrupt-doctype-public-identifier",C="abrupt-doctype-system-identifier",O="eof-in-script-html-comment-like-text",f="eof-in-doctype",S="abrupt-closing-of-empty-comment",R="eof-in-comment",I="absence-of-digits-in-numeric-character-reference",L="end-tag-without-matching-open-element",k="misplaced-start-tag-for-head-element";const M=s;var g=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4e3,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,1e4,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13e3,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]);const P=s,H={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},D={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},F="DATA_STATE",U="RCDATA_STATE",G="RAWTEXT_STATE",B="SCRIPT_DATA_STATE",K="PLAINTEXT_STATE",b="TAG_OPEN_STATE",x="END_TAG_OPEN_STATE",y="TAG_NAME_STATE",v="RCDATA_LESS_THAN_SIGN_STATE",Y="RCDATA_END_TAG_OPEN_STATE",w="RCDATA_END_TAG_NAME_STATE",Q="RAWTEXT_LESS_THAN_SIGN_STATE",X="RAWTEXT_END_TAG_OPEN_STATE",W="RAWTEXT_END_TAG_NAME_STATE",V="SCRIPT_DATA_LESS_THAN_SIGN_STATE",j="SCRIPT_DATA_END_TAG_OPEN_STATE",z="SCRIPT_DATA_END_TAG_NAME_STATE",q="SCRIPT_DATA_ESCAPE_START_STATE",J="SCRIPT_DATA_ESCAPE_START_DASH_STATE",Z="SCRIPT_DATA_ESCAPED_STATE",$="SCRIPT_DATA_ESCAPED_DASH_STATE",ee="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE",te="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE",ne="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE",se="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE",re="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE",ie="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",oe="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",ae="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",Te="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",Ee="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",he="BEFORE_ATTRIBUTE_NAME_STATE",ce="ATTRIBUTE_NAME_STATE",_e="AFTER_ATTRIBUTE_NAME_STATE",le="BEFORE_ATTRIBUTE_VALUE_STATE",me="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",pe="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",Ae="ATTRIBUTE_VALUE_UNQUOTED_STATE",ue="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE",Ne="SELF_CLOSING_START_TAG_STATE",de="BOGUS_COMMENT_STATE",Ce="MARKUP_DECLARATION_OPEN_STATE",Oe="COMMENT_START_STATE",fe="COMMENT_START_DASH_STATE",Se="COMMENT_STATE",Re="COMMENT_LESS_THAN_SIGN_STATE",Ie="COMMENT_LESS_THAN_SIGN_BANG_STATE",Le="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE",ke="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE",Me="COMMENT_END_DASH_STATE",ge="COMMENT_END_STATE",Pe="COMMENT_END_BANG_STATE",He="DOCTYPE_STATE",De="BEFORE_DOCTYPE_NAME_STATE",Fe="DOCTYPE_NAME_STATE",Ue="AFTER_DOCTYPE_NAME_STATE",Ge="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE",Be="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE",Ke="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE",be="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE",xe="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE",ye="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE",ve="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE",Ye="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE",we="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE",Qe="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE",Xe="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE",We="BOGUS_DOCTYPE_STATE",Ve="CDATA_SECTION_STATE",je="CDATA_SECTION_BRACKET_STATE",ze="CDATA_SECTION_END_STATE",qe="CHARACTER_REFERENCE_STATE",Je="NAMED_CHARACTER_REFERENCE_STATE",Ze="AMBIGUOS_AMPERSAND_STATE",$e="NUMERIC_CHARACTER_REFERENCE_STATE",et="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE",tt="DECIMAL_CHARACTER_REFERENCE_START_STATE",nt="HEXADEMICAL_CHARACTER_REFERENCE_STATE",st="DECIMAL_CHARACTER_REFERENCE_STATE",rt="NUMERIC_CHARACTER_REFERENCE_END_STATE";function it(e){return e===P.SPACE||e===P.LINE_FEED||e===P.TABULATION||e===P.FORM_FEED}function ot(e){return e>=P.DIGIT_0&&e<=P.DIGIT_9}function at(e){return e>=P.LATIN_CAPITAL_A&&e<=P.LATIN_CAPITAL_Z}function Tt(e){return e>=P.LATIN_SMALL_A&&e<=P.LATIN_SMALL_Z}function Et(e){return Tt(e)||at(e)}function ht(e){return Et(e)||ot(e)}function ct(e){return e>=P.LATIN_CAPITAL_A&&e<=P.LATIN_CAPITAL_F}function _t(e){return e>=P.LATIN_SMALL_A&&e<=P.LATIN_SMALL_F}function lt(e){return e+32}function mt(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(e>>>10&1023|55296)+String.fromCharCode(56320|1023&e))}function pt(e){return String.fromCharCode(lt(e))}function At(e,t){const n=g[++e];let s=++e,r=s+n-1;for(;s<=r;){const e=s+r>>>1,i=g[e];if(i<t)s=e+1;else {if(!(i>t))return g[e+n];r=e-1;}}return -1}class ut{constructor(){this.preprocessor=new class{constructor(){this.html=null,this.pos=-1,this.lastGapPos=-1,this.lastCharPos=-1,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536;}_err(){}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos;}_processSurrogate(e){if(this.pos!==this.lastCharPos){const t=this.html.charCodeAt(this.pos+1);if(function(e){return e>=56320&&e<=57343}(t))return this.pos++,this._addGap(),1024*(e-55296)+9216+t}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,M.EOF;return this._err("surrogate-in-input-stream"),e}dropParsedChunk(){this.pos>this.bufferWaterline&&(this.lastCharPos-=this.pos,this.html=this.html.substring(this.pos),this.pos=0,this.lastGapPos=-1,this.gapStack=[]);}write(e,t){this.html?this.html+=e:this.html=e,this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1,this.lastChunkWritten=t;}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length),this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1;}advance(){if(this.pos++,this.pos>this.lastCharPos)return this.endOfChunkHit=!this.lastChunkWritten,M.EOF;let e=this.html.charCodeAt(this.pos);return this.skipNextNewLine&&e===M.LINE_FEED?(this.skipNextNewLine=!1,this._addGap(),this.advance()):e===M.CARRIAGE_RETURN?(this.skipNextNewLine=!0,M.LINE_FEED):(this.skipNextNewLine=!1,r(e)&&(e=this._processSurrogate(e)),e>31&&e<127||e===M.LINE_FEED||e===M.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){i(e)?this._err("control-character-in-input-stream"):o(e)&&this._err("noncharacter-in-input-stream");}retreat(){this.pos===this.lastGapPos&&(this.lastGapPos=this.gapStack.pop(),this.pos--),this.pos--;}},this.tokenQueue=[],this.allowCDATA=!1,this.state=F,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null;}_err(){}_errOnNextCodePoint(e){this._consume(),this._err(e),this._unconsume();}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this[this.state](e);}return this.tokenQueue.shift()}write(e,t){this.active=!0,this.preprocessor.write(e,t);}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e);}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:ut.HIBERNATION_TOKEN}),!0}return !1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat();}_reconsumeInState(e){this.state=e,this._unconsume();}_consumeSequenceIfMatch(e,t,n){let s=0,r=!0;const i=e.length;let o,a=0,T=t;for(;a<i;a++){if(a>0&&(T=this._consume(),s++),T===P.EOF){r=!1;break}if(o=e[a],T!==o&&(n||T!==lt(o))){r=!1;break}}if(!r)for(;s--;)this._unconsume();return r}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==H.SCRIPT_STRING.length)return !1;for(let e=0;e<this.tempBuff.length;e++)if(this.tempBuff[e]!==H.SCRIPT_STRING[e])return !1;return !0}_createStartTagToken(){this.currentToken={type:ut.START_TAG_TOKEN,tagName:"",selfClosing:!1,ackSelfClosing:!1,attrs:[]};}_createEndTagToken(){this.currentToken={type:ut.END_TAG_TOKEN,tagName:"",selfClosing:!1,attrs:[]};}_createCommentToken(){this.currentToken={type:ut.COMMENT_TOKEN,data:""};}_createDoctypeToken(e){this.currentToken={type:ut.DOCTYPE_TOKEN,name:e,forceQuirks:!1,publicId:null,systemId:null};}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t};}_createEOFToken(){this.currentToken={type:ut.EOF_TOKEN};}_createAttr(e){this.currentAttr={name:e,value:""};}_leaveAttrName(e){null===ut.getTokenAttr(this.currentToken,this.currentAttr.name)?this.currentToken.attrs.push(this.currentAttr):this._err("duplicate-attribute"),this.state=e;}_leaveAttrValue(e){this.state=e;}_emitCurrentToken(){this._emitCurrentCharacterToken();const e=this.currentToken;this.currentToken=null,e.type===ut.START_TAG_TOKEN?this.lastStartTagName=e.tagName:e.type===ut.END_TAG_TOKEN&&(e.attrs.length>0&&this._err("end-tag-with-attributes"),e.selfClosing&&this._err("end-tag-with-trailing-solidus")),this.tokenQueue.push(e);}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null);}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken();}_appendCharToCurrentCharacterToken(e,t){this.currentCharacterToken&&this.currentCharacterToken.type!==e&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=t:this._createCharacterToken(e,t);}_emitCodePoint(e){let t=ut.CHARACTER_TOKEN;it(e)?t=ut.WHITESPACE_CHARACTER_TOKEN:e===P.NULL&&(t=ut.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(t,mt(e));}_emitSeveralCodePoints(e){for(let t=0;t<e.length;t++)this._emitCodePoint(e[t]);}_emitChars(e){this._appendCharToCurrentCharacterToken(ut.CHARACTER_TOKEN,e);}_matchNamedCharacterReference(e){let t=null,n=1,s=At(0,e);for(this.tempBuff.push(e);s>-1;){const e=g[s],r=e<7;r&&1&e&&(t=2&e?[g[++s],g[++s]]:[g[++s]],n=0);const i=this._consume();if(this.tempBuff.push(i),n++,i===P.EOF)break;s=r?4&e?At(s,i):-1:i===e?++s:-1;}for(;n--;)this.tempBuff.pop(),this._unconsume();return t}_isCharacterReferenceInAttribute(){return this.returnState===me||this.returnState===pe||this.returnState===Ae}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){const e=this._consume();return this._unconsume(),e===P.EQUALS_SIGN||ht(e)}return !1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let e=0;e<this.tempBuff.length;e++)this.currentAttr.value+=mt(this.tempBuff[e]);else this._emitSeveralCodePoints(this.tempBuff);this.tempBuff=[];}[F](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=b:e===P.AMPERSAND?(this.returnState=F,this.state=qe):e===P.NULL?(this._err(a),this._emitCodePoint(e)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[U](e){this.preprocessor.dropParsedChunk(),e===P.AMPERSAND?(this.returnState=U,this.state=qe):e===P.LESS_THAN_SIGN?this.state=v:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[G](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=Q:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[B](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=V:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[K](e){this.preprocessor.dropParsedChunk(),e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[b](e){e===P.EXCLAMATION_MARK?this.state=Ce:e===P.SOLIDUS?this.state=x:Et(e)?(this._createStartTagToken(),this._reconsumeInState(y)):e===P.QUESTION_MARK?(this._err("unexpected-question-mark-instead-of-tag-name"),this._createCommentToken(),this._reconsumeInState(de)):e===P.EOF?(this._err(h),this._emitChars("<"),this._emitEOFToken()):(this._err(T),this._emitChars("<"),this._reconsumeInState(F));}[x](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(y)):e===P.GREATER_THAN_SIGN?(this._err("missing-end-tag-name"),this.state=F):e===P.EOF?(this._err(h),this._emitChars("</"),this._emitEOFToken()):(this._err(T),this._createCommentToken(),this._reconsumeInState(de));}[y](e){it(e)?this.state=he:e===P.SOLIDUS?this.state=Ne:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):at(e)?this.currentToken.tagName+=pt(e):e===P.NULL?(this._err(a),this.currentToken.tagName+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentToken.tagName+=mt(e);}[v](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=Y):(this._emitChars("<"),this._reconsumeInState(U));}[Y](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(w)):(this._emitChars("</"),this._reconsumeInState(U));}[w](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this.state=F,void this._emitCurrentToken()}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(U);}}[Q](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=X):(this._emitChars("<"),this._reconsumeInState(G));}[X](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(W)):(this._emitChars("</"),this._reconsumeInState(G));}[W](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(G);}}[V](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=j):e===P.EXCLAMATION_MARK?(this.state=q,this._emitChars("<!")):(this._emitChars("<"),this._reconsumeInState(B));}[j](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(z)):(this._emitChars("</"),this._reconsumeInState(B));}[z](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(B);}}[q](e){e===P.HYPHEN_MINUS?(this.state=J,this._emitChars("-")):this._reconsumeInState(B);}[J](e){e===P.HYPHEN_MINUS?(this.state=ee,this._emitChars("-")):this._reconsumeInState(B);}[Z](e){e===P.HYPHEN_MINUS?(this.state=$,this._emitChars("-")):e===P.LESS_THAN_SIGN?this.state=te:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):this._emitCodePoint(e);}[$](e){e===P.HYPHEN_MINUS?(this.state=ee,this._emitChars("-")):e===P.LESS_THAN_SIGN?this.state=te:e===P.NULL?(this._err(a),this.state=Z,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=Z,this._emitCodePoint(e));}[ee](e){e===P.HYPHEN_MINUS?this._emitChars("-"):e===P.LESS_THAN_SIGN?this.state=te:e===P.GREATER_THAN_SIGN?(this.state=B,this._emitChars(">")):e===P.NULL?(this._err(a),this.state=Z,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=Z,this._emitCodePoint(e));}[te](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=ne):Et(e)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState(re)):(this._emitChars("<"),this._reconsumeInState(Z));}[ne](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(se)):(this._emitChars("</"),this._reconsumeInState(Z));}[se](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(Z);}}[re](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?ie:Z,this._emitCodePoint(e)):at(e)?(this.tempBuff.push(lt(e)),this._emitCodePoint(e)):Tt(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(Z);}[ie](e){e===P.HYPHEN_MINUS?(this.state=oe,this._emitChars("-")):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):this._emitCodePoint(e);}[oe](e){e===P.HYPHEN_MINUS?(this.state=ae,this._emitChars("-")):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.NULL?(this._err(a),this.state=ie,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=ie,this._emitCodePoint(e));}[ae](e){e===P.HYPHEN_MINUS?this._emitChars("-"):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.GREATER_THAN_SIGN?(this.state=B,this._emitChars(">")):e===P.NULL?(this._err(a),this.state=ie,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=ie,this._emitCodePoint(e));}[Te](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=Ee,this._emitChars("/")):this._reconsumeInState(ie);}[Ee](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?Z:ie,this._emitCodePoint(e)):at(e)?(this.tempBuff.push(lt(e)),this._emitCodePoint(e)):Tt(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(ie);}[he](e){it(e)||(e===P.SOLIDUS||e===P.GREATER_THAN_SIGN||e===P.EOF?this._reconsumeInState(_e):e===P.EQUALS_SIGN?(this._err("unexpected-equals-sign-before-attribute-name"),this._createAttr("="),this.state=ce):(this._createAttr(""),this._reconsumeInState(ce)));}[ce](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN||e===P.EOF?(this._leaveAttrName(_e),this._unconsume()):e===P.EQUALS_SIGN?this._leaveAttrName(le):at(e)?this.currentAttr.name+=pt(e):e===P.QUOTATION_MARK||e===P.APOSTROPHE||e===P.LESS_THAN_SIGN?(this._err("unexpected-character-in-attribute-name"),this.currentAttr.name+=mt(e)):e===P.NULL?(this._err(a),this.currentAttr.name+=n):this.currentAttr.name+=mt(e);}[_e](e){it(e)||(e===P.SOLIDUS?this.state=Ne:e===P.EQUALS_SIGN?this.state=le:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState(ce)));}[le](e){it(e)||(e===P.QUOTATION_MARK?this.state=me:e===P.APOSTROPHE?this.state=pe:e===P.GREATER_THAN_SIGN?(this._err("missing-attribute-value"),this.state=F,this._emitCurrentToken()):this._reconsumeInState(Ae));}[me](e){e===P.QUOTATION_MARK?this.state=ue:e===P.AMPERSAND?(this.returnState=me,this.state=qe):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[pe](e){e===P.APOSTROPHE?this.state=ue:e===P.AMPERSAND?(this.returnState=pe,this.state=qe):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[Ae](e){it(e)?this._leaveAttrValue(he):e===P.AMPERSAND?(this.returnState=Ae,this.state=qe):e===P.GREATER_THAN_SIGN?(this._leaveAttrValue(F),this._emitCurrentToken()):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.QUOTATION_MARK||e===P.APOSTROPHE||e===P.LESS_THAN_SIGN||e===P.EQUALS_SIGN||e===P.GRAVE_ACCENT?(this._err("unexpected-character-in-unquoted-attribute-value"),this.currentAttr.value+=mt(e)):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[ue](e){it(e)?this._leaveAttrValue(he):e===P.SOLIDUS?this._leaveAttrValue(Ne):e===P.GREATER_THAN_SIGN?(this._leaveAttrValue(F),this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._err("missing-whitespace-between-attributes"),this._reconsumeInState(he));}[Ne](e){e===P.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._err("unexpected-solidus-in-tag"),this._reconsumeInState(he));}[de](e){e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._emitCurrentToken(),this._emitEOFToken()):e===P.NULL?(this._err(a),this.currentToken.data+=n):this.currentToken.data+=mt(e);}[Ce](e){this._consumeSequenceIfMatch(H.DASH_DASH_STRING,e,!0)?(this._createCommentToken(),this.state=Oe):this._consumeSequenceIfMatch(H.DOCTYPE_STRING,e,!1)?this.state=He:this._consumeSequenceIfMatch(H.CDATA_START_STRING,e,!0)?this.allowCDATA?this.state=Ve:(this._err("cdata-in-html-content"),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state=de):this._ensureHibernation()||(this._err("incorrectly-opened-comment"),this._createCommentToken(),this._reconsumeInState(de));}[Oe](e){e===P.HYPHEN_MINUS?this.state=fe:e===P.GREATER_THAN_SIGN?(this._err(S),this.state=F,this._emitCurrentToken()):this._reconsumeInState(Se);}[fe](e){e===P.HYPHEN_MINUS?this.state=ge:e===P.GREATER_THAN_SIGN?(this._err(S),this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Se));}[Se](e){e===P.HYPHEN_MINUS?this.state=Me:e===P.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state=Re):e===P.NULL?(this._err(a),this.currentToken.data+=n):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=mt(e);}[Re](e){e===P.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state=Ie):e===P.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState(Se);}[Ie](e){e===P.HYPHEN_MINUS?this.state=Le:this._reconsumeInState(Se);}[Le](e){e===P.HYPHEN_MINUS?this.state=ke:this._reconsumeInState(Me);}[ke](e){e!==P.GREATER_THAN_SIGN&&e!==P.EOF&&this._err("nested-comment"),this._reconsumeInState(ge);}[Me](e){e===P.HYPHEN_MINUS?this.state=ge:e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Se));}[ge](e){e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EXCLAMATION_MARK?this.state=Pe:e===P.HYPHEN_MINUS?this.currentToken.data+="-":e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState(Se));}[Pe](e){e===P.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state=Me):e===P.GREATER_THAN_SIGN?(this._err("incorrectly-closed-comment"),this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState(Se));}[He](e){it(e)?this.state=De:e===P.GREATER_THAN_SIGN?this._reconsumeInState(De):e===P.EOF?(this._err(f),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err("missing-whitespace-before-doctype-name"),this._reconsumeInState(De));}[De](e){it(e)||(at(e)?(this._createDoctypeToken(pt(e)),this.state=Fe):e===P.NULL?(this._err(a),this._createDoctypeToken(n),this.state=Fe):e===P.GREATER_THAN_SIGN?(this._err("missing-doctype-name"),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(mt(e)),this.state=Fe));}[Fe](e){it(e)?this.state=Ue:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):at(e)?this.currentToken.name+=pt(e):e===P.NULL?(this._err(a),this.currentToken.name+=n):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=mt(e);}[Ue](e){it(e)||(e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(H.PUBLIC_STRING,e,!1)?this.state=Ge:this._consumeSequenceIfMatch(H.SYSTEM_STRING,e,!1)?this.state=ve:this._ensureHibernation()||(this._err("invalid-character-sequence-after-doctype-name"),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[Ge](e){it(e)?this.state=Be:e===P.QUOTATION_MARK?(this._err(_),this.currentToken.publicId="",this.state=Ke):e===P.APOSTROPHE?(this._err(_),this.currentToken.publicId="",this.state=be):e===P.GREATER_THAN_SIGN?(this._err(u),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(p),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[Be](e){it(e)||(e===P.QUOTATION_MARK?(this.currentToken.publicId="",this.state=Ke):e===P.APOSTROPHE?(this.currentToken.publicId="",this.state=be):e===P.GREATER_THAN_SIGN?(this._err(u),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(p),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[Ke](e){e===P.QUOTATION_MARK?this.state=xe:e===P.NULL?(this._err(a),this.currentToken.publicId+=n):e===P.GREATER_THAN_SIGN?(this._err(d),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=mt(e);}[be](e){e===P.APOSTROPHE?this.state=xe:e===P.NULL?(this._err(a),this.currentToken.publicId+=n):e===P.GREATER_THAN_SIGN?(this._err(d),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=mt(e);}[xe](e){it(e)?this.state=ye:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.QUOTATION_MARK?(this._err(l),this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this._err(l),this.currentToken.systemId="",this.state=Qe):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[ye](e){it(e)||(e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.QUOTATION_MARK?(this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this.currentToken.systemId="",this.state=Qe):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[ve](e){it(e)?this.state=Ye:e===P.QUOTATION_MARK?(this._err(m),this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this._err(m),this.currentToken.systemId="",this.state=Qe):e===P.GREATER_THAN_SIGN?(this._err(N),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[Ye](e){it(e)||(e===P.QUOTATION_MARK?(this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this.currentToken.systemId="",this.state=Qe):e===P.GREATER_THAN_SIGN?(this._err(N),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[we](e){e===P.QUOTATION_MARK?this.state=Xe:e===P.NULL?(this._err(a),this.currentToken.systemId+=n):e===P.GREATER_THAN_SIGN?(this._err(C),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=mt(e);}[Qe](e){e===P.APOSTROPHE?this.state=Xe:e===P.NULL?(this._err(a),this.currentToken.systemId+=n):e===P.GREATER_THAN_SIGN?(this._err(C),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=mt(e);}[Xe](e){it(e)||(e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err("unexpected-character-after-doctype-system-identifier"),this._reconsumeInState(We)));}[We](e){e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.NULL?this._err(a):e===P.EOF&&(this._emitCurrentToken(),this._emitEOFToken());}[Ve](e){e===P.RIGHT_SQUARE_BRACKET?this.state=je:e===P.EOF?(this._err("eof-in-cdata"),this._emitEOFToken()):this._emitCodePoint(e);}[je](e){e===P.RIGHT_SQUARE_BRACKET?this.state=ze:(this._emitChars("]"),this._reconsumeInState(Ve));}[ze](e){e===P.GREATER_THAN_SIGN?this.state=F:e===P.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState(Ve));}[qe](e){this.tempBuff=[P.AMPERSAND],e===P.NUMBER_SIGN?(this.tempBuff.push(e),this.state=$e):ht(e)?this._reconsumeInState(Je):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState));}[Je](e){const t=this._matchNamedCharacterReference(e);if(this._ensureHibernation())this.tempBuff=[P.AMPERSAND];else if(t){const e=this.tempBuff[this.tempBuff.length-1]===P.SEMICOLON;this._isCharacterReferenceAttributeQuirk(e)||(e||this._errOnNextCodePoint(E),this.tempBuff=t),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState;}else this._flushCodePointsConsumedAsCharacterReference(),this.state=Ze;}[Ze](e){ht(e)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=mt(e):this._emitCodePoint(e):(e===P.SEMICOLON&&this._err("unknown-named-character-reference"),this._reconsumeInState(this.returnState));}[$e](e){this.charRefCode=0,e===P.LATIN_SMALL_X||e===P.LATIN_CAPITAL_X?(this.tempBuff.push(e),this.state=et):this._reconsumeInState(tt);}[et](e){!function(e){return ot(e)||ct(e)||_t(e)}(e)?(this._err(I),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState(nt);}[tt](e){ot(e)?this._reconsumeInState(st):(this._err(I),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState));}[nt](e){ct(e)?this.charRefCode=16*this.charRefCode+e-55:_t(e)?this.charRefCode=16*this.charRefCode+e-87:ot(e)?this.charRefCode=16*this.charRefCode+e-48:e===P.SEMICOLON?this.state=rt:(this._err(E),this._reconsumeInState(rt));}[st](e){ot(e)?this.charRefCode=10*this.charRefCode+e-48:e===P.SEMICOLON?this.state=rt:(this._err(E),this._reconsumeInState(rt));}[rt](){if(this.charRefCode===P.NULL)this._err("null-character-reference"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err("character-reference-outside-unicode-range"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(r(this.charRefCode))this._err("surrogate-character-reference"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(o(this.charRefCode))this._err("noncharacter-character-reference");else if(i(this.charRefCode)||this.charRefCode===P.CARRIAGE_RETURN){this._err("control-character-reference");const e=D[this.charRefCode];e&&(this.charRefCode=e);}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState);}}ut.CHARACTER_TOKEN="CHARACTER_TOKEN",ut.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",ut.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",ut.START_TAG_TOKEN="START_TAG_TOKEN",ut.END_TAG_TOKEN="END_TAG_TOKEN",ut.COMMENT_TOKEN="COMMENT_TOKEN",ut.DOCTYPE_TOKEN="DOCTYPE_TOKEN",ut.EOF_TOKEN="EOF_TOKEN",ut.HIBERNATION_TOKEN="HIBERNATION_TOKEN",ut.MODE={DATA:F,RCDATA:U,RAWTEXT:G,SCRIPT_DATA:B,PLAINTEXT:K},ut.getTokenAttr=function(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null};var Nt=ut;function dt(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}var Ct=dt((function(e,t){const n=t.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};t.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},t.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const s=t.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};t.SPECIAL_ELEMENTS={[n.HTML]:{[s.ADDRESS]:!0,[s.APPLET]:!0,[s.AREA]:!0,[s.ARTICLE]:!0,[s.ASIDE]:!0,[s.BASE]:!0,[s.BASEFONT]:!0,[s.BGSOUND]:!0,[s.BLOCKQUOTE]:!0,[s.BODY]:!0,[s.BR]:!0,[s.BUTTON]:!0,[s.CAPTION]:!0,[s.CENTER]:!0,[s.COL]:!0,[s.COLGROUP]:!0,[s.DD]:!0,[s.DETAILS]:!0,[s.DIR]:!0,[s.DIV]:!0,[s.DL]:!0,[s.DT]:!0,[s.EMBED]:!0,[s.FIELDSET]:!0,[s.FIGCAPTION]:!0,[s.FIGURE]:!0,[s.FOOTER]:!0,[s.FORM]:!0,[s.FRAME]:!0,[s.FRAMESET]:!0,[s.H1]:!0,[s.H2]:!0,[s.H3]:!0,[s.H4]:!0,[s.H5]:!0,[s.H6]:!0,[s.HEAD]:!0,[s.HEADER]:!0,[s.HGROUP]:!0,[s.HR]:!0,[s.HTML]:!0,[s.IFRAME]:!0,[s.IMG]:!0,[s.INPUT]:!0,[s.LI]:!0,[s.LINK]:!0,[s.LISTING]:!0,[s.MAIN]:!0,[s.MARQUEE]:!0,[s.MENU]:!0,[s.META]:!0,[s.NAV]:!0,[s.NOEMBED]:!0,[s.NOFRAMES]:!0,[s.NOSCRIPT]:!0,[s.OBJECT]:!0,[s.OL]:!0,[s.P]:!0,[s.PARAM]:!0,[s.PLAINTEXT]:!0,[s.PRE]:!0,[s.SCRIPT]:!0,[s.SECTION]:!0,[s.SELECT]:!0,[s.SOURCE]:!0,[s.STYLE]:!0,[s.SUMMARY]:!0,[s.TABLE]:!0,[s.TBODY]:!0,[s.TD]:!0,[s.TEMPLATE]:!0,[s.TEXTAREA]:!0,[s.TFOOT]:!0,[s.TH]:!0,[s.THEAD]:!0,[s.TITLE]:!0,[s.TR]:!0,[s.TRACK]:!0,[s.UL]:!0,[s.WBR]:!0,[s.XMP]:!0},[n.MATHML]:{[s.MI]:!0,[s.MO]:!0,[s.MN]:!0,[s.MS]:!0,[s.MTEXT]:!0,[s.ANNOTATION_XML]:!0},[n.SVG]:{[s.TITLE]:!0,[s.FOREIGN_OBJECT]:!0,[s.DESC]:!0}};}));const Ot=Ct.TAG_NAMES,ft=Ct.NAMESPACES;function St(e){switch(e.length){case 1:return e===Ot.P;case 2:return e===Ot.RB||e===Ot.RP||e===Ot.RT||e===Ot.DD||e===Ot.DT||e===Ot.LI;case 3:return e===Ot.RTC;case 6:return e===Ot.OPTION;case 8:return e===Ot.OPTGROUP}return !1}function Rt(e){switch(e.length){case 1:return e===Ot.P;case 2:return e===Ot.RB||e===Ot.RP||e===Ot.RT||e===Ot.DD||e===Ot.DT||e===Ot.LI||e===Ot.TD||e===Ot.TH||e===Ot.TR;case 3:return e===Ot.RTC;case 5:return e===Ot.TBODY||e===Ot.TFOOT||e===Ot.THEAD;case 6:return e===Ot.OPTION;case 7:return e===Ot.CAPTION;case 8:return e===Ot.OPTGROUP||e===Ot.COLGROUP}return !1}function It(e,t){switch(e.length){case 2:if(e===Ot.TD||e===Ot.TH)return t===ft.HTML;if(e===Ot.MI||e===Ot.MO||e===Ot.MN||e===Ot.MS)return t===ft.MATHML;break;case 4:if(e===Ot.HTML)return t===ft.HTML;if(e===Ot.DESC)return t===ft.SVG;break;case 5:if(e===Ot.TABLE)return t===ft.HTML;if(e===Ot.MTEXT)return t===ft.MATHML;if(e===Ot.TITLE)return t===ft.SVG;break;case 6:return (e===Ot.APPLET||e===Ot.OBJECT)&&t===ft.HTML;case 7:return (e===Ot.CAPTION||e===Ot.MARQUEE)&&t===ft.HTML;case 8:return e===Ot.TEMPLATE&&t===ft.HTML;case 13:return e===Ot.FOREIGN_OBJECT&&t===ft.SVG;case 14:return e===Ot.ANNOTATION_XML&&t===ft.MATHML}return !1}class Lt{constructor(e){this.length=0,this.entries=[],this.treeAdapter=e,this.bookmark=null;}_getNoahArkConditionCandidates(e){const t=[];if(this.length>=3){const n=this.treeAdapter.getAttrList(e).length,s=this.treeAdapter.getTagName(e),r=this.treeAdapter.getNamespaceURI(e);for(let e=this.length-1;e>=0;e--){const i=this.entries[e];if(i.type===Lt.MARKER_ENTRY)break;const o=i.element,a=this.treeAdapter.getAttrList(o);this.treeAdapter.getTagName(o)===s&&this.treeAdapter.getNamespaceURI(o)===r&&a.length===n&&t.push({idx:e,attrs:a});}}return t.length<3?[]:t}_ensureNoahArkCondition(e){const t=this._getNoahArkConditionCandidates(e);let n=t.length;if(n){const s=this.treeAdapter.getAttrList(e),r=s.length,i=Object.create(null);for(let e=0;e<r;e++){const t=s[e];i[t.name]=t.value;}for(let e=0;e<r;e++)for(let s=0;s<n;s++){const r=t[s].attrs[e];if(i[r.name]!==r.value&&(t.splice(s,1),n--),t.length<3)return}for(let e=n-1;e>=2;e--)this.entries.splice(t[e].idx,1),this.length--;}}insertMarker(){this.entries.push({type:Lt.MARKER_ENTRY}),this.length++;}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.push({type:Lt.ELEMENT_ENTRY,element:e,token:t}),this.length++;}insertElementAfterBookmark(e,t){let n=this.length-1;for(;n>=0&&this.entries[n]!==this.bookmark;n--);this.entries.splice(n+1,0,{type:Lt.ELEMENT_ENTRY,element:e,token:t}),this.length++;}removeEntry(e){for(let t=this.length-1;t>=0;t--)if(this.entries[t]===e){this.entries.splice(t,1),this.length--;break}}clearToLastMarker(){for(;this.length;){const e=this.entries.pop();if(this.length--,e.type===Lt.MARKER_ENTRY)break}}getElementEntryInScopeWithTagName(e){for(let t=this.length-1;t>=0;t--){const n=this.entries[t];if(n.type===Lt.MARKER_ENTRY)return null;if(this.treeAdapter.getTagName(n.element)===e)return n}return null}getElementEntry(e){for(let t=this.length-1;t>=0;t--){const n=this.entries[t];if(n.type===Lt.ELEMENT_ENTRY&&n.element===e)return n}return null}}Lt.MARKER_ENTRY="MARKER_ENTRY",Lt.ELEMENT_ENTRY="ELEMENT_ENTRY";var kt=Lt;class Mt{constructor(e){const t={},n=this._getOverriddenMethods(this,t);for(const s of Object.keys(n))"function"==typeof n[s]&&(t[s]=e[s],e[s]=n[s]);}_getOverriddenMethods(){throw new Error("Not implemented")}}Mt.install=function(e,t,n){e.__mixins||(e.__mixins=[]);for(let n=0;n<e.__mixins.length;n++)if(e.__mixins[n].constructor===t)return e.__mixins[n];const s=new t(e,n);return e.__mixins.push(s),s};var gt=Mt,Pt=class extends gt{constructor(e){super(e),this.preprocessor=e,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.offset=0,this.col=0,this.line=1;}_getOverriddenMethods(e,t){return {advance(){const n=this.pos+1,s=this.html[n];return e.isEol&&(e.isEol=!1,e.line++,e.lineStartPos=n),("\n"===s||"\r"===s&&"\n"!==this.html[n+1])&&(e.isEol=!0),e.col=n-e.lineStartPos+1,e.offset=e.droppedBufferSize+n,t.advance.call(this)},retreat(){t.retreat.call(this),e.isEol=!1,e.col=this.pos-e.lineStartPos+1;},dropParsedChunk(){const n=this.pos;t.dropParsedChunk.call(this);const s=n-this.pos;e.lineStartPos-=s,e.droppedBufferSize+=s,e.offset=e.droppedBufferSize+this.pos;}}}},Ht=class extends gt{constructor(e){super(e),this.tokenizer=e,this.posTracker=gt.install(e.preprocessor,Pt),this.currentAttrLocation=null,this.ctLoc=null;}_getCurrentLocation(){return {startLine:this.posTracker.line,startCol:this.posTracker.col,startOffset:this.posTracker.offset,endLine:-1,endCol:-1,endOffset:-1}}_attachCurrentAttrLocationInfo(){this.currentAttrLocation.endLine=this.posTracker.line,this.currentAttrLocation.endCol=this.posTracker.col,this.currentAttrLocation.endOffset=this.posTracker.offset;const e=this.tokenizer.currentToken,t=this.tokenizer.currentAttr;e.location.attrs||(e.location.attrs=Object.create(null)),e.location.attrs[t.name]=this.currentAttrLocation;}_getOverriddenMethods(e,t){const n={_createStartTagToken(){t._createStartTagToken.call(this),this.currentToken.location=e.ctLoc;},_createEndTagToken(){t._createEndTagToken.call(this),this.currentToken.location=e.ctLoc;},_createCommentToken(){t._createCommentToken.call(this),this.currentToken.location=e.ctLoc;},_createDoctypeToken(n){t._createDoctypeToken.call(this,n),this.currentToken.location=e.ctLoc;},_createCharacterToken(n,s){t._createCharacterToken.call(this,n,s),this.currentCharacterToken.location=e.ctLoc;},_createEOFToken(){t._createEOFToken.call(this),this.currentToken.location=e._getCurrentLocation();},_createAttr(n){t._createAttr.call(this,n),e.currentAttrLocation=e._getCurrentLocation();},_leaveAttrName(n){t._leaveAttrName.call(this,n),e._attachCurrentAttrLocationInfo();},_leaveAttrValue(n){t._leaveAttrValue.call(this,n),e._attachCurrentAttrLocationInfo();},_emitCurrentToken(){const n=this.currentToken.location;this.currentCharacterToken&&(this.currentCharacterToken.location.endLine=n.startLine,this.currentCharacterToken.location.endCol=n.startCol,this.currentCharacterToken.location.endOffset=n.startOffset),this.currentToken.type===Nt.EOF_TOKEN?(n.endLine=n.startLine,n.endCol=n.startCol,n.endOffset=n.startOffset):(n.endLine=e.posTracker.line,n.endCol=e.posTracker.col+1,n.endOffset=e.posTracker.offset+1),t._emitCurrentToken.call(this);},_emitCurrentCharacterToken(){const n=this.currentCharacterToken&&this.currentCharacterToken.location;n&&-1===n.endOffset&&(n.endLine=e.posTracker.line,n.endCol=e.posTracker.col,n.endOffset=e.posTracker.offset),t._emitCurrentCharacterToken.call(this);}};return Object.keys(Nt.MODE).forEach((s=>{const r=Nt.MODE[s];n[r]=function(n){e.ctLoc=e._getCurrentLocation(),t[r].call(this,n);};})),n}},Dt=class extends gt{constructor(e,t){super(e),this.onItemPop=t.onItemPop;}_getOverriddenMethods(e,t){return {pop(){e.onItemPop(this.current),t.pop.call(this);},popAllUpToHtmlElement(){for(let t=this.stackTop;t>0;t--)e.onItemPop(this.items[t]);t.popAllUpToHtmlElement.call(this);},remove(n){e.onItemPop(this.current),t.remove.call(this,n);}}}};const Ft=Ct.TAG_NAMES;var Ut=class extends gt{constructor(e){super(e),this.parser=e,this.treeAdapter=this.parser.treeAdapter,this.posTracker=null,this.lastStartTagToken=null,this.lastFosterParentingLocation=null,this.currentToken=null;}_setStartLocation(e){let t=null;this.lastStartTagToken&&(t=Object.assign({},this.lastStartTagToken.location),t.startTag=this.lastStartTagToken.location),this.treeAdapter.setNodeSourceCodeLocation(e,t);}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const n=t.location,s=this.treeAdapter.getTagName(e),r={};t.type===Nt.END_TAG_TOKEN&&s===t.tagName?(r.endTag=Object.assign({},n),r.endLine=n.endLine,r.endCol=n.endCol,r.endOffset=n.endOffset):(r.endLine=n.startLine,r.endCol=n.startCol,r.endOffset=n.startOffset),this.treeAdapter.updateNodeSourceCodeLocation(e,r);}}_getOverriddenMethods(e,t){return {_bootstrap(n,s){t._bootstrap.call(this,n,s),e.lastStartTagToken=null,e.lastFosterParentingLocation=null,e.currentToken=null;const r=gt.install(this.tokenizer,Ht);e.posTracker=r.posTracker,gt.install(this.openElements,Dt,{onItemPop:function(t){e._setEndLocation(t,e.currentToken);}});},_runParsingLoop(n){t._runParsingLoop.call(this,n);for(let t=this.openElements.stackTop;t>=0;t--)e._setEndLocation(this.openElements.items[t],e.currentToken);},_processTokenInForeignContent(n){e.currentToken=n,t._processTokenInForeignContent.call(this,n);},_processToken(n){if(e.currentToken=n,t._processToken.call(this,n),n.type===Nt.END_TAG_TOKEN&&(n.tagName===Ft.HTML||n.tagName===Ft.BODY&&this.openElements.hasInScope(Ft.BODY)))for(let t=this.openElements.stackTop;t>=0;t--){const s=this.openElements.items[t];if(this.treeAdapter.getTagName(s)===n.tagName){e._setEndLocation(s,n);break}}},_setDocumentType(e){t._setDocumentType.call(this,e);const n=this.treeAdapter.getChildNodes(this.document),s=n.length;for(let t=0;t<s;t++){const s=n[t];if(this.treeAdapter.isDocumentTypeNode(s)){this.treeAdapter.setNodeSourceCodeLocation(s,e.location);break}}},_attachElementToTree(n){e._setStartLocation(n),e.lastStartTagToken=null,t._attachElementToTree.call(this,n);},_appendElement(n,s){e.lastStartTagToken=n,t._appendElement.call(this,n,s);},_insertElement(n,s){e.lastStartTagToken=n,t._insertElement.call(this,n,s);},_insertTemplate(n){e.lastStartTagToken=n,t._insertTemplate.call(this,n);const s=this.treeAdapter.getTemplateContent(this.openElements.current);this.treeAdapter.setNodeSourceCodeLocation(s,null);},_insertFakeRootElement(){t._insertFakeRootElement.call(this),this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current,null);},_appendCommentNode(e,n){t._appendCommentNode.call(this,e,n);const s=this.treeAdapter.getChildNodes(n),r=s[s.length-1];this.treeAdapter.setNodeSourceCodeLocation(r,e.location);},_findFosterParentingLocation(){return e.lastFosterParentingLocation=t._findFosterParentingLocation.call(this),e.lastFosterParentingLocation},_insertCharacters(n){t._insertCharacters.call(this,n);const s=this._shouldFosterParentOnInsertion(),r=s&&e.lastFosterParentingLocation.parent||this.openElements.currentTmplContent||this.openElements.current,i=this.treeAdapter.getChildNodes(r),o=s&&e.lastFosterParentingLocation.beforeElement?i.indexOf(e.lastFosterParentingLocation.beforeElement)-1:i.length-1,a=i[o];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:e,endCol:t,endOffset:s}=n.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:e,endCol:t,endOffset:s});}else this.treeAdapter.setNodeSourceCodeLocation(a,n.location);}}}},Gt=class extends gt{constructor(e,t){super(e),this.posTracker=null,this.onParseError=t.onParseError;}_setErrorLocation(e){e.startLine=e.endLine=this.posTracker.line,e.startCol=e.endCol=this.posTracker.col,e.startOffset=e.endOffset=this.posTracker.offset;}_reportError(e){const t={code:e,startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1};this._setErrorLocation(t),this.onParseError(t);}_getOverriddenMethods(e){return {_err(t){e._reportError(t);}}}},Bt=class extends Gt{constructor(e,t){super(e,t),this.posTracker=gt.install(e,Pt),this.lastErrOffset=-1;}_reportError(e){this.lastErrOffset!==this.posTracker.offset&&(this.lastErrOffset=this.posTracker.offset,super._reportError(e));}},Kt=class extends Gt{constructor(e,t){super(e,t);const n=gt.install(e.preprocessor,Bt,t);this.posTracker=n.posTracker;}},bt=class extends Gt{constructor(e,t){super(e,t),this.opts=t,this.ctLoc=null,this.locBeforeToken=!1;}_setErrorLocation(e){this.ctLoc&&(e.startLine=this.ctLoc.startLine,e.startCol=this.ctLoc.startCol,e.startOffset=this.ctLoc.startOffset,e.endLine=this.locBeforeToken?this.ctLoc.startLine:this.ctLoc.endLine,e.endCol=this.locBeforeToken?this.ctLoc.startCol:this.ctLoc.endCol,e.endOffset=this.locBeforeToken?this.ctLoc.startOffset:this.ctLoc.endOffset);}_getOverriddenMethods(e,t){return {_bootstrap(n,s){t._bootstrap.call(this,n,s),gt.install(this.tokenizer,Kt,e.opts),gt.install(this.tokenizer,Ht);},_processInputToken(n){e.ctLoc=n.location,t._processInputToken.call(this,n);},_err(t,n){e.locBeforeToken=n&&n.beforeToken,e._reportError(t);}}}},xt=dt((function(e,t){const{DOCUMENT_MODE:n}=Ct;t.createDocument=function(){return {nodeName:"#document",mode:n.NO_QUIRKS,childNodes:[]}},t.createDocumentFragment=function(){return {nodeName:"#document-fragment",childNodes:[]}},t.createElement=function(e,t,n){return {nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},t.createCommentNode=function(e){return {nodeName:"#comment",data:e,parentNode:null}};const s=function(e){return {nodeName:"#text",value:e,parentNode:null}},r=t.appendChild=function(e,t){e.childNodes.push(t),t.parentNode=e;},i=t.insertBefore=function(e,t,n){const s=e.childNodes.indexOf(n);e.childNodes.splice(s,0,t),t.parentNode=e;};t.setTemplateContent=function(e,t){e.content=t;},t.getTemplateContent=function(e){return e.content},t.setDocumentType=function(e,t,n,s){let i=null;for(let t=0;t<e.childNodes.length;t++)if("#documentType"===e.childNodes[t].nodeName){i=e.childNodes[t];break}i?(i.name=t,i.publicId=n,i.systemId=s):r(e,{nodeName:"#documentType",name:t,publicId:n,systemId:s});},t.setDocumentMode=function(e,t){e.mode=t;},t.getDocumentMode=function(e){return e.mode},t.detachNode=function(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null;}},t.insertText=function(e,t){if(e.childNodes.length){const n=e.childNodes[e.childNodes.length-1];if("#text"===n.nodeName)return void(n.value+=t)}r(e,s(t));},t.insertTextBefore=function(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&"#text"===r.nodeName?r.value+=t:i(e,s(t),n);},t.adoptAttributes=function(e,t){const n=[];for(let t=0;t<e.attrs.length;t++)n.push(e.attrs[t].name);for(let s=0;s<t.length;s++)-1===n.indexOf(t[s].name)&&e.attrs.push(t[s]);},t.getFirstChild=function(e){return e.childNodes[0]},t.getChildNodes=function(e){return e.childNodes},t.getParentNode=function(e){return e.parentNode},t.getAttrList=function(e){return e.attrs},t.getTagName=function(e){return e.tagName},t.getNamespaceURI=function(e){return e.namespaceURI},t.getTextNodeContent=function(e){return e.value},t.getCommentNodeContent=function(e){return e.data},t.getDocumentTypeNodeName=function(e){return e.name},t.getDocumentTypeNodePublicId=function(e){return e.publicId},t.getDocumentTypeNodeSystemId=function(e){return e.systemId},t.isTextNode=function(e){return "#text"===e.nodeName},t.isCommentNode=function(e){return "#comment"===e.nodeName},t.isDocumentTypeNode=function(e){return "#documentType"===e.nodeName},t.isElementNode=function(e){return !!e.tagName},t.setNodeSourceCodeLocation=function(e,t){e.sourceCodeLocation=t;},t.getNodeSourceCodeLocation=function(e){return e.sourceCodeLocation},t.updateNodeSourceCodeLocation=function(e,t){e.sourceCodeLocation=Object.assign(e.sourceCodeLocation,t);};}));const{DOCUMENT_MODE:yt}=Ct,vt="html",Yt=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],wt=Yt.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]),Qt=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"],Xt=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],Wt=Xt.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function Vt(e,t){for(let n=0;n<t.length;n++)if(0===e.indexOf(t[n]))return !0;return !1}var jt=dt((function(e,t){const n=Ct.TAG_NAMES,s=Ct.NAMESPACES,r=Ct.ATTRS,i={attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},o={"xlink:actuate":{prefix:"xlink",name:"actuate",namespace:s.XLINK},"xlink:arcrole":{prefix:"xlink",name:"arcrole",namespace:s.XLINK},"xlink:href":{prefix:"xlink",name:"href",namespace:s.XLINK},"xlink:role":{prefix:"xlink",name:"role",namespace:s.XLINK},"xlink:show":{prefix:"xlink",name:"show",namespace:s.XLINK},"xlink:title":{prefix:"xlink",name:"title",namespace:s.XLINK},"xlink:type":{prefix:"xlink",name:"type",namespace:s.XLINK},"xml:base":{prefix:"xml",name:"base",namespace:s.XML},"xml:lang":{prefix:"xml",name:"lang",namespace:s.XML},"xml:space":{prefix:"xml",name:"space",namespace:s.XML},xmlns:{prefix:"",name:"xmlns",namespace:s.XMLNS},"xmlns:xlink":{prefix:"xmlns",name:"xlink",namespace:s.XMLNS}},a=t.SVG_TAG_NAMES_ADJUSTMENT_MAP={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"},T={[n.B]:!0,[n.BIG]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.CENTER]:!0,[n.CODE]:!0,[n.DD]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EM]:!0,[n.EMBED]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HR]:!0,[n.I]:!0,[n.IMG]:!0,[n.LI]:!0,[n.LISTING]:!0,[n.MENU]:!0,[n.META]:!0,[n.NOBR]:!0,[n.OL]:!0,[n.P]:!0,[n.PRE]:!0,[n.RUBY]:!0,[n.S]:!0,[n.SMALL]:!0,[n.SPAN]:!0,[n.STRONG]:!0,[n.STRIKE]:!0,[n.SUB]:!0,[n.SUP]:!0,[n.TABLE]:!0,[n.TT]:!0,[n.U]:!0,[n.UL]:!0,[n.VAR]:!0};t.causesExit=function(e){const t=e.tagName;return !(t!==n.FONT||null===Nt.getTokenAttr(e,r.COLOR)&&null===Nt.getTokenAttr(e,r.SIZE)&&null===Nt.getTokenAttr(e,r.FACE))||T[t]},t.adjustTokenMathMLAttrs=function(e){for(let t=0;t<e.attrs.length;t++)if("definitionurl"===e.attrs[t].name){e.attrs[t].name="definitionURL";break}},t.adjustTokenSVGAttrs=function(e){for(let t=0;t<e.attrs.length;t++){const n=i[e.attrs[t].name];n&&(e.attrs[t].name=n);}},t.adjustTokenXMLAttrs=function(e){for(let t=0;t<e.attrs.length;t++){const n=o[e.attrs[t].name];n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace);}},t.adjustTokenSVGTagName=function(e){const t=a[e.tagName];t&&(e.tagName=t);},t.isIntegrationPoint=function(e,t,i,o){return !(o&&o!==s.HTML||!function(e,t,i){if(t===s.MATHML&&e===n.ANNOTATION_XML)for(let e=0;e<i.length;e++)if(i[e].name===r.ENCODING){const t=i[e].value.toLowerCase();return "text/html"===t||"application/xhtml+xml"===t}return t===s.SVG&&(e===n.FOREIGN_OBJECT||e===n.DESC||e===n.TITLE)}(e,t,i))||!(o&&o!==s.MATHML||!function(e,t){return t===s.MATHML&&(e===n.MI||e===n.MO||e===n.MN||e===n.MS||e===n.MTEXT)}(e,t))};}));const zt=Ct.TAG_NAMES,qt=Ct.NAMESPACES,Jt=Ct.ATTRS,Zt={scriptingEnabled:!0,sourceCodeLocationInfo:!1,onParseError:null,treeAdapter:xt},$t="hidden",en="INITIAL_MODE",tn="BEFORE_HTML_MODE",nn="BEFORE_HEAD_MODE",sn="IN_HEAD_MODE",rn="IN_HEAD_NO_SCRIPT_MODE",on="AFTER_HEAD_MODE",an="IN_BODY_MODE",Tn="TEXT_MODE",En="IN_TABLE_MODE",hn="IN_TABLE_TEXT_MODE",cn="IN_CAPTION_MODE",_n="IN_COLUMN_GROUP_MODE",ln="IN_TABLE_BODY_MODE",mn="IN_ROW_MODE",pn="IN_CELL_MODE",An="IN_SELECT_MODE",un="IN_SELECT_IN_TABLE_MODE",Nn="IN_TEMPLATE_MODE",dn="AFTER_BODY_MODE",Cn="IN_FRAMESET_MODE",On="AFTER_FRAMESET_MODE",fn="AFTER_AFTER_BODY_MODE",Sn="AFTER_AFTER_FRAMESET_MODE",Rn={[zt.TR]:mn,[zt.TBODY]:ln,[zt.THEAD]:ln,[zt.TFOOT]:ln,[zt.CAPTION]:cn,[zt.COLGROUP]:_n,[zt.TABLE]:En,[zt.BODY]:an,[zt.FRAMESET]:Cn},In={[zt.CAPTION]:En,[zt.COLGROUP]:En,[zt.TBODY]:En,[zt.TFOOT]:En,[zt.THEAD]:En,[zt.COL]:_n,[zt.TR]:ln,[zt.TD]:mn,[zt.TH]:mn},Ln={[en]:{[Nt.CHARACTER_TOKEN]:vn,[Nt.NULL_CHARACTER_TOKEN]:vn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:function(e,t){e._setDocumentType(t);const n=t.forceQuirks?Ct.DOCUMENT_MODE.QUIRKS:function(e){if(e.name!==vt)return yt.QUIRKS;const t=e.systemId;if(t&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===t.toLowerCase())return yt.QUIRKS;let n=e.publicId;if(null!==n){if(n=n.toLowerCase(),Qt.indexOf(n)>-1)return yt.QUIRKS;let e=null===t?wt:Yt;if(Vt(n,e))return yt.QUIRKS;if(e=null===t?Xt:Wt,Vt(n,e))return yt.LIMITED_QUIRKS}return yt.NO_QUIRKS}(t);(function(e){return e.name===vt&&null===e.publicId&&(null===e.systemId||"about:legacy-compat"===e.systemId)})(t)||e._err("non-conforming-doctype"),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=tn;},[Nt.START_TAG_TOKEN]:vn,[Nt.END_TAG_TOKEN]:vn,[Nt.EOF_TOKEN]:vn},[tn]:{[Nt.CHARACTER_TOKEN]:Yn,[Nt.NULL_CHARACTER_TOKEN]:Yn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?(e._insertElement(t,qt.HTML),e.insertionMode=nn):Yn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n!==zt.HTML&&n!==zt.HEAD&&n!==zt.BODY&&n!==zt.BR||Yn(e,t);},[Nt.EOF_TOKEN]:Yn},[nn]:{[Nt.CHARACTER_TOKEN]:wn,[Nt.NULL_CHARACTER_TOKEN]:wn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.HEAD?(e._insertElement(t,qt.HTML),e.headElement=e.openElements.current,e.insertionMode=sn):wn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HEAD||n===zt.BODY||n===zt.HTML||n===zt.BR?wn(e,t):e._err(L);},[Nt.EOF_TOKEN]:wn},[sn]:{[Nt.CHARACTER_TOKEN]:Wn,[Nt.NULL_CHARACTER_TOKEN]:Wn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:Qn,[Nt.END_TAG_TOKEN]:Xn,[Nt.EOF_TOKEN]:Wn},[rn]:{[Nt.CHARACTER_TOKEN]:Vn,[Nt.NULL_CHARACTER_TOKEN]:Vn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BASEFONT||n===zt.BGSOUND||n===zt.HEAD||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.STYLE?Qn(e,t):n===zt.NOSCRIPT?e._err("nested-noscript-in-head"):Vn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.NOSCRIPT?(e.openElements.pop(),e.insertionMode=sn):n===zt.BR?Vn(e,t):e._err(L);},[Nt.EOF_TOKEN]:Vn},[on]:{[Nt.CHARACTER_TOKEN]:jn,[Nt.NULL_CHARACTER_TOKEN]:jn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BODY?(e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode=an):n===zt.FRAMESET?(e._insertElement(t,qt.HTML),e.insertionMode=Cn):n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.SCRIPT||n===zt.STYLE||n===zt.TEMPLATE||n===zt.TITLE?(e._err("abandoned-head-element-child"),e.openElements.push(e.headElement),Qn(e,t),e.openElements.remove(e.headElement)):n===zt.HEAD?e._err(k):jn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.BODY||n===zt.HTML||n===zt.BR?jn(e,t):n===zt.TEMPLATE?Xn(e,t):e._err(L);},[Nt.EOF_TOKEN]:jn},[an]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:as,[Nt.END_TAG_TOKEN]:cs,[Nt.EOF_TOKEN]:_s},[Tn]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:xn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Gn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:Gn,[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.SCRIPT&&(e.pendingScript=e.openElements.current),e.openElements.pop(),e.insertionMode=e.originalInsertionMode;},[Nt.EOF_TOKEN]:function(e,t){e._err("eof-in-element-that-can-contain-only-text"),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e._processToken(t);}},[En]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:ms,[Nt.END_TAG_TOKEN]:ps,[Nt.EOF_TOKEN]:_s},[hn]:{[Nt.CHARACTER_TOKEN]:function(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0;},[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:function(e,t){e.pendingCharacterTokens.push(t);},[Nt.COMMENT_TOKEN]:us,[Nt.DOCTYPE_TOKEN]:us,[Nt.START_TAG_TOKEN]:us,[Nt.END_TAG_TOKEN]:us,[Nt.EOF_TOKEN]:us},[cn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TD||n===zt.TFOOT||n===zt.TH||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(zt.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=En,e._processToken(t)):as(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE?e.openElements.hasInTableScope(zt.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=En,n===zt.TABLE&&e._processToken(t)):n!==zt.BODY&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&n!==zt.TBODY&&n!==zt.TD&&n!==zt.TFOOT&&n!==zt.TH&&n!==zt.THEAD&&n!==zt.TR&&cs(e,t);},[Nt.EOF_TOKEN]:_s},[_n]:{[Nt.CHARACTER_TOKEN]:Ns,[Nt.NULL_CHARACTER_TOKEN]:Ns,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.COL?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.TEMPLATE?Qn(e,t):Ns(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.COLGROUP?e.openElements.currentTagName===zt.COLGROUP&&(e.openElements.pop(),e.insertionMode=En):n===zt.TEMPLATE?Xn(e,t):n!==zt.COL&&Ns(e,t);},[Nt.EOF_TOKEN]:_s},[ln]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TR?(e.openElements.clearBackToTableBodyContext(),e._insertElement(t,qt.HTML),e.insertionMode=mn):n===zt.TH||n===zt.TD?(e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(zt.TR),e.insertionMode=mn,e._processToken(t)):n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En,e._processToken(t)):ms(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En):n===zt.TABLE?e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En,e._processToken(t)):(n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP||n!==zt.HTML&&n!==zt.TD&&n!==zt.TH&&n!==zt.TR)&&ps(e,t);},[Nt.EOF_TOKEN]:_s},[mn]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TH||n===zt.TD?(e.openElements.clearBackToTableRowContext(),e._insertElement(t,qt.HTML),e.insertionMode=pn,e.activeFormattingElements.insertMarker()):n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):ms(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TR?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln):n===zt.TABLE?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?(e.openElements.hasInTableScope(n)||e.openElements.hasInTableScope(zt.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):(n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP||n!==zt.HTML&&n!==zt.TD&&n!==zt.TH)&&ps(e,t);},[Nt.EOF_TOKEN]:_s},[pn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TD||n===zt.TFOOT||n===zt.TH||n===zt.THEAD||n===zt.TR?(e.openElements.hasInTableScope(zt.TD)||e.openElements.hasInTableScope(zt.TH))&&(e._closeTableCell(),e._processToken(t)):as(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TD||n===zt.TH?e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=mn):n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(n)&&(e._closeTableCell(),e._processToken(t)):n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&cs(e,t);},[Nt.EOF_TOKEN]:_s},[An]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:ds,[Nt.END_TAG_TOKEN]:Cs,[Nt.EOF_TOKEN]:_s},[un]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR||n===zt.TD||n===zt.TH?(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),e._processToken(t)):ds(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR||n===zt.TD||n===zt.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),e._processToken(t)):Cs(e,t);},[Nt.EOF_TOKEN]:_s},[Nn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;if(n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.SCRIPT||n===zt.STYLE||n===zt.TEMPLATE||n===zt.TITLE)Qn(e,t);else {const s=In[n]||an;e._popTmplInsertionMode(),e._pushTmplInsertionMode(s),e.insertionMode=s,e._processToken(t);}},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.TEMPLATE&&Xn(e,t);},[Nt.EOF_TOKEN]:Os},[dn]:{[Nt.CHARACTER_TOKEN]:fs,[Nt.NULL_CHARACTER_TOKEN]:fs,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:function(e,t){e._appendCommentNode(t,e.openElements.items[0]);},[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?as(e,t):fs(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?e.fragmentContext||(e.insertionMode=fn):fs(e,t);},[Nt.EOF_TOKEN]:yn},[Cn]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.FRAMESET?e._insertElement(t,qt.HTML):n===zt.FRAME?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName!==zt.FRAMESET||e.openElements.isRootHtmlElementCurrent()||(e.openElements.pop(),e.fragmentContext||e.openElements.currentTagName===zt.FRAMESET||(e.insertionMode=On));},[Nt.EOF_TOKEN]:yn},[On]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML&&(e.insertionMode=Sn);},[Nt.EOF_TOKEN]:yn},[fn]:{[Nt.CHARACTER_TOKEN]:Ss,[Nt.NULL_CHARACTER_TOKEN]:Ss,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:bn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?as(e,t):Ss(e,t);},[Nt.END_TAG_TOKEN]:Ss,[Nt.EOF_TOKEN]:yn},[Sn]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:bn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:Gn,[Nt.EOF_TOKEN]:yn}};var kn=class{constructor(e){this.options=function(e,t){return [e,t=t||Object.create(null)].reduce(((e,t)=>(Object.keys(t).forEach((n=>{e[n]=t[n];})),e)),Object.create(null))}(Zt,e),this.treeAdapter=this.options.treeAdapter,this.pendingScript=null,this.options.sourceCodeLocationInfo&&gt.install(this,Ut),this.options.onParseError&&gt.install(this,bt,{onParseError:this.options.onParseError});}parse(e){const t=this.treeAdapter.createDocument();return this._bootstrap(t,null),this.tokenizer.write(e,!0),this._runParsingLoop(null),t}parseFragment(e,t){t||(t=this.treeAdapter.createElement(zt.TEMPLATE,qt.HTML,[]));const n=this.treeAdapter.createElement("documentmock",qt.HTML,[]);this._bootstrap(n,t),this.treeAdapter.getTagName(t)===zt.TEMPLATE&&this._pushTmplInsertionMode(Nn),this._initTokenizerForFragmentParsing(),this._insertFakeRootElement(),this._resetInsertionMode(),this._findFormInFragmentContext(),this.tokenizer.write(e,!0),this._runParsingLoop(null);const s=this.treeAdapter.getFirstChild(n),r=this.treeAdapter.createDocumentFragment();return this._adoptNodes(s,r),r}_bootstrap(e,t){this.tokenizer=new Nt(this.options),this.stopped=!1,this.insertionMode=en,this.originalInsertionMode="",this.document=e,this.fragmentContext=t,this.headElement=null,this.formElement=null,this.openElements=new class{constructor(e,t){this.stackTop=-1,this.items=[],this.current=e,this.currentTagName=null,this.currentTmplContent=null,this.tmplCount=0,this.treeAdapter=t;}_indexOf(e){let t=-1;for(let n=this.stackTop;n>=0;n--)if(this.items[n]===e){t=n;break}return t}_isInTemplate(){return this.currentTagName===Ot.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ft.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current),this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null;}push(e){this.items[++this.stackTop]=e,this._updateCurrentElement(),this._isInTemplate()&&this.tmplCount++;}pop(){this.stackTop--,this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this._updateCurrentElement();}replace(e,t){const n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&this._updateCurrentElement();}insertAfter(e,t){const n=this._indexOf(e)+1;this.items.splice(n,0,t),n===++this.stackTop&&this._updateCurrentElement();}popUntilTagNamePopped(e){for(;this.stackTop>-1;){const t=this.currentTagName,n=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),t===e&&n===ft.HTML)break}}popUntilElementPopped(e){for(;this.stackTop>-1;){const t=this.current;if(this.pop(),t===e)break}}popUntilNumberedHeaderPopped(){for(;this.stackTop>-1;){const e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===Ot.H1||e===Ot.H2||e===Ot.H3||e===Ot.H4||e===Ot.H5||e===Ot.H6&&t===ft.HTML)break}}popUntilTableCellPopped(){for(;this.stackTop>-1;){const e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===Ot.TD||e===Ot.TH&&t===ft.HTML)break}}popAllUpToHtmlElement(){this.stackTop=0,this._updateCurrentElement();}clearBackToTableContext(){for(;this.currentTagName!==Ot.TABLE&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}clearBackToTableBodyContext(){for(;this.currentTagName!==Ot.TBODY&&this.currentTagName!==Ot.TFOOT&&this.currentTagName!==Ot.THEAD&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}clearBackToTableRowContext(){for(;this.currentTagName!==Ot.TR&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}remove(e){for(let t=this.stackTop;t>=0;t--)if(this.items[t]===e){this.items.splice(t,1),this.stackTop--,this._updateCurrentElement();break}}tryPeekProperlyNestedBodyElement(){const e=this.items[1];return e&&this.treeAdapter.getTagName(e)===Ot.BODY?e:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e);return --t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.currentTagName===Ot.HTML}hasInScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if(It(n,s))return !1}return !0}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]),n=this.treeAdapter.getNamespaceURI(this.items[e]);if((t===Ot.H1||t===Ot.H2||t===Ot.H3||t===Ot.H4||t===Ot.H5||t===Ot.H6)&&n===ft.HTML)return !0;if(It(t,n))return !1}return !0}hasInListItemScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if((n===Ot.UL||n===Ot.OL)&&s===ft.HTML||It(n,s))return !1}return !0}hasInButtonScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if(n===Ot.BUTTON&&s===ft.HTML||It(n,s))return !1}return !0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===ft.HTML){if(n===e)return !0;if(n===Ot.TABLE||n===Ot.TEMPLATE||n===Ot.HTML)return !1}}return !0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]);if(this.treeAdapter.getNamespaceURI(this.items[e])===ft.HTML){if(t===Ot.TBODY||t===Ot.THEAD||t===Ot.TFOOT)return !0;if(t===Ot.TABLE||t===Ot.HTML)return !1}}return !0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===ft.HTML){if(n===e)return !0;if(n!==Ot.OPTION&&n!==Ot.OPTGROUP)return !1}}return !0}generateImpliedEndTags(){for(;St(this.currentTagName);)this.pop();}generateImpliedEndTagsThoroughly(){for(;Rt(this.currentTagName);)this.pop();}generateImpliedEndTagsWithExclusion(e){for(;St(this.currentTagName)&&this.currentTagName!==e;)this.pop();}}(this.document,this.treeAdapter),this.activeFormattingElements=new kt(this.treeAdapter),this.tmplInsertionModeStack=[],this.tmplInsertionModeStackTop=-1,this.currentTmplInsertionMode=null,this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1;}_err(){}_runParsingLoop(e){for(;!this.stopped;){this._setupTokenizerCDATAMode();const t=this.tokenizer.getNextToken();if(t.type===Nt.HIBERNATION_TOKEN)break;if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.type===Nt.WHITESPACE_CHARACTER_TOKEN&&"\n"===t.chars[0])){if(1===t.chars.length)continue;t.chars=t.chars.substr(1);}if(this._processInputToken(t),e&&this.pendingScript)break}}runParsingLoopForCurrentChunk(e,t){if(this._runParsingLoop(t),t&&this.pendingScript){const e=this.pendingScript;return this.pendingScript=null,void t(e)}e&&e();}_setupTokenizerCDATAMode(){const e=this._getAdjustedCurrentElement();this.tokenizer.allowCDATA=e&&e!==this.document&&this.treeAdapter.getNamespaceURI(e)!==qt.HTML&&!this._isIntegrationPoint(e);}_switchToTextParsing(e,t){this._insertElement(e,qt.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Tn;}switchToPlaintextParsing(){this.insertionMode=Tn,this.originalInsertionMode=an,this.tokenizer.state=Nt.MODE.PLAINTEXT;}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;do{if(this.treeAdapter.getTagName(e)===zt.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e);}while(e)}_initTokenizerForFragmentParsing(){if(this.treeAdapter.getNamespaceURI(this.fragmentContext)===qt.HTML){const e=this.treeAdapter.getTagName(this.fragmentContext);e===zt.TITLE||e===zt.TEXTAREA?this.tokenizer.state=Nt.MODE.RCDATA:e===zt.STYLE||e===zt.XMP||e===zt.IFRAME||e===zt.NOEMBED||e===zt.NOFRAMES||e===zt.NOSCRIPT?this.tokenizer.state=Nt.MODE.RAWTEXT:e===zt.SCRIPT?this.tokenizer.state=Nt.MODE.SCRIPT_DATA:e===zt.PLAINTEXT&&(this.tokenizer.state=Nt.MODE.PLAINTEXT);}}_setDocumentType(e){const t=e.name||"",n=e.publicId||"",s=e.systemId||"";this.treeAdapter.setDocumentType(this.document,t,n,s);}_attachElementToTree(e){if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else {const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.appendChild(t,e);}}_appendElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n);}_insertElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n),this.openElements.push(n);}_insertFakeElement(e){const t=this.treeAdapter.createElement(e,qt.HTML,[]);this._attachElementToTree(t),this.openElements.push(t);}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,qt.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t),this.openElements.push(t);}_insertFakeRootElement(){const e=this.treeAdapter.createElement(zt.HTML,qt.HTML,[]);this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e);}_appendCommentNode(e,t){const n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n);}_insertCharacters(e){if(this._shouldFosterParentOnInsertion())this._fosterParentText(e.chars);else {const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.insertText(t,e.chars);}}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n);}_shouldProcessTokenInForeignContent(e){const t=this._getAdjustedCurrentElement();if(!t||t===this.document)return !1;const n=this.treeAdapter.getNamespaceURI(t);if(n===qt.HTML)return !1;if(this.treeAdapter.getTagName(t)===zt.ANNOTATION_XML&&n===qt.MATHML&&e.type===Nt.START_TAG_TOKEN&&e.tagName===zt.SVG)return !1;const s=e.type===Nt.CHARACTER_TOKEN||e.type===Nt.NULL_CHARACTER_TOKEN||e.type===Nt.WHITESPACE_CHARACTER_TOKEN;return !((e.type===Nt.START_TAG_TOKEN&&e.tagName!==zt.MGLYPH&&e.tagName!==zt.MALIGNMARK||s)&&this._isIntegrationPoint(t,qt.MATHML)||(e.type===Nt.START_TAG_TOKEN||s)&&this._isIntegrationPoint(t,qt.HTML)||e.type===Nt.EOF_TOKEN)}_processToken(e){Ln[this.insertionMode][e.type](this,e);}_processTokenInBodyMode(e){Ln.IN_BODY_MODE[e.type](this,e);}_processTokenInForeignContent(e){e.type===Nt.CHARACTER_TOKEN?function(e,t){e._insertCharacters(t),e.framesetOk=!1;}(this,e):e.type===Nt.NULL_CHARACTER_TOKEN?function(e,t){t.chars=n,e._insertCharacters(t);}(this,e):e.type===Nt.WHITESPACE_CHARACTER_TOKEN?xn(this,e):e.type===Nt.COMMENT_TOKEN?Kn(this,e):e.type===Nt.START_TAG_TOKEN?function(e,t){if(jt.causesExit(t)&&!e.fragmentContext){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==qt.HTML&&!e._isIntegrationPoint(e.openElements.current);)e.openElements.pop();e._processToken(t);}else {const n=e._getAdjustedCurrentElement(),s=e.treeAdapter.getNamespaceURI(n);s===qt.MATHML?jt.adjustTokenMathMLAttrs(t):s===qt.SVG&&(jt.adjustTokenSVGTagName(t),jt.adjustTokenSVGAttrs(t)),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,s):e._insertElement(t,s),t.ackSelfClosing=!0;}}(this,e):e.type===Nt.END_TAG_TOKEN&&function(e,t){for(let n=e.openElements.stackTop;n>0;n--){const s=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(s)===qt.HTML){e._processToken(t);break}if(e.treeAdapter.getTagName(s).toLowerCase()===t.tagName){e.openElements.popUntilElementPopped(s);break}}}(this,e);}_processInputToken(e){this._shouldProcessTokenInForeignContent(e)?this._processTokenInForeignContent(e):this._processToken(e),e.type===Nt.START_TAG_TOKEN&&e.selfClosing&&!e.ackSelfClosing&&this._err("non-void-html-element-start-tag-with-trailing-solidus");}_isIntegrationPoint(e,t){const n=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e),r=this.treeAdapter.getAttrList(e);return jt.isIntegrationPoint(n,s,r,t)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.length;if(e){let t=e,n=null;do{if(t--,n=this.activeFormattingElements.entries[t],n.type===kt.MARKER_ENTRY||this.openElements.contains(n.element)){t++;break}}while(t>0);for(let s=t;s<e;s++)n=this.activeFormattingElements.entries[s],this._insertElement(n.token,this.treeAdapter.getNamespaceURI(n.element)),n.element=this.openElements.current;}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=mn;}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(zt.P),this.openElements.popUntilTagNamePopped(zt.P);}_resetInsertionMode(){for(let e=this.openElements.stackTop,t=!1;e>=0;e--){let n=this.openElements.items[e];0===e&&(t=!0,this.fragmentContext&&(n=this.fragmentContext));const s=this.treeAdapter.getTagName(n),r=Rn[s];if(r){this.insertionMode=r;break}if(!(t||s!==zt.TD&&s!==zt.TH)){this.insertionMode=pn;break}if(!t&&s===zt.HEAD){this.insertionMode=sn;break}if(s===zt.SELECT){this._resetInsertionModeForSelect(e);break}if(s===zt.TEMPLATE){this.insertionMode=this.currentTmplInsertionMode;break}if(s===zt.HTML){this.insertionMode=this.headElement?on:nn;break}if(t){this.insertionMode=an;break}}}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const e=this.openElements.items[t],n=this.treeAdapter.getTagName(e);if(n===zt.TEMPLATE)break;if(n===zt.TABLE)return void(this.insertionMode=un)}this.insertionMode=An;}_pushTmplInsertionMode(e){this.tmplInsertionModeStack.push(e),this.tmplInsertionModeStackTop++,this.currentTmplInsertionMode=e;}_popTmplInsertionMode(){this.tmplInsertionModeStack.pop(),this.tmplInsertionModeStackTop--,this.currentTmplInsertionMode=this.tmplInsertionModeStack[this.tmplInsertionModeStackTop];}_isElementCausesFosterParenting(e){const t=this.treeAdapter.getTagName(e);return t===zt.TABLE||t===zt.TBODY||t===zt.TFOOT||t===zt.THEAD||t===zt.TR}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.current)}_findFosterParentingLocation(){const e={parent:null,beforeElement:null};for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t],s=this.treeAdapter.getTagName(n),r=this.treeAdapter.getNamespaceURI(n);if(s===zt.TEMPLATE&&r===qt.HTML){e.parent=this.treeAdapter.getTemplateContent(n);break}if(s===zt.TABLE){e.parent=this.treeAdapter.getParentNode(n),e.parent?e.beforeElement=n:e.parent=this.openElements.items[t-1];break}}return e.parent||(e.parent=this.openElements.items[0]),e}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e);}_fosterParentText(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertTextBefore(t.parent,e,t.beforeElement):this.treeAdapter.insertText(t.parent,e);}_isSpecialElement(e){const t=this.treeAdapter.getTagName(e),n=this.treeAdapter.getNamespaceURI(e);return Ct.SPECIAL_ELEMENTS[n][t]}};function Mn(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagName)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):hs(e,t),n}function gn(e,t){let n=null;for(let s=e.openElements.stackTop;s>=0;s--){const r=e.openElements.items[s];if(r===t.element)break;e._isSpecialElement(r)&&(n=r);}return n||(e.openElements.popUntilElementPopped(t.element),e.activeFormattingElements.removeEntry(t)),n}function Pn(e,t,n){let s=t,r=e.openElements.getCommonAncestor(t);for(let i=0,o=r;o!==n;i++,o=r){r=e.openElements.getCommonAncestor(o);const n=e.activeFormattingElements.getElementEntry(o),a=n&&i>=3;!n||a?(a&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Hn(e,n),s===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(s),e.treeAdapter.appendChild(o,s),s=o);}return s}function Hn(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),s=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,s),t.element=s,s}function Dn(e,t,n){if(e._isElementCausesFosterParenting(t))e._fosterParentElement(n);else {const s=e.treeAdapter.getTagName(t),r=e.treeAdapter.getNamespaceURI(t);s===zt.TEMPLATE&&r===qt.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n);}}function Fn(e,t,n){const s=e.treeAdapter.getNamespaceURI(n.element),r=n.token,i=e.treeAdapter.createElement(r.tagName,s,r.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,n.token),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i);}function Un(e,t){let n;for(let s=0;s<8&&(n=Mn(e,t),n);s++){const t=gn(e,n);if(!t)break;e.activeFormattingElements.bookmark=n;const s=Pn(e,t,n.element),r=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(s),Dn(e,r,s),Fn(e,t,n);}}function Gn(){}function Bn(e){e._err("misplaced-doctype");}function Kn(e,t){e._appendCommentNode(t,e.openElements.currentTmplContent||e.openElements.current);}function bn(e,t){e._appendCommentNode(t,e.document);}function xn(e,t){e._insertCharacters(t);}function yn(e){e.stopped=!0;}function vn(e,t){e._err("missing-doctype",{beforeToken:!0}),e.treeAdapter.setDocumentMode(e.document,Ct.DOCUMENT_MODE.QUIRKS),e.insertionMode=tn,e._processToken(t);}function Yn(e,t){e._insertFakeRootElement(),e.insertionMode=nn,e._processToken(t);}function wn(e,t){e._insertFakeElement(zt.HEAD),e.headElement=e.openElements.current,e.insertionMode=sn,e._processToken(t);}function Qn(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.TITLE?e._switchToTextParsing(t,Nt.MODE.RCDATA):n===zt.NOSCRIPT?e.options.scriptingEnabled?e._switchToTextParsing(t,Nt.MODE.RAWTEXT):(e._insertElement(t,qt.HTML),e.insertionMode=rn):n===zt.NOFRAMES||n===zt.STYLE?e._switchToTextParsing(t,Nt.MODE.RAWTEXT):n===zt.SCRIPT?e._switchToTextParsing(t,Nt.MODE.SCRIPT_DATA):n===zt.TEMPLATE?(e._insertTemplate(t,qt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Nn,e._pushTmplInsertionMode(Nn)):n===zt.HEAD?e._err(k):Wn(e,t);}function Xn(e,t){const n=t.tagName;n===zt.HEAD?(e.openElements.pop(),e.insertionMode=on):n===zt.BODY||n===zt.BR||n===zt.HTML?Wn(e,t):n===zt.TEMPLATE&&e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagName!==zt.TEMPLATE&&e._err("closing-of-element-with-open-child-elements"),e.openElements.popUntilTagNamePopped(zt.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e._popTmplInsertionMode(),e._resetInsertionMode()):e._err(L);}function Wn(e,t){e.openElements.pop(),e.insertionMode=on,e._processToken(t);}function Vn(e,t){const n=t.type===Nt.EOF_TOKEN?"open-elements-left-after-eof":"disallowed-content-in-noscript-in-head";e._err(n),e.openElements.pop(),e.insertionMode=sn,e._processToken(t);}function jn(e,t){e._insertFakeElement(zt.BODY),e.insertionMode=an,e._processToken(t);}function zn(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t);}function qn(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1;}function Jn(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}function Zn(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.skipNextNewLine=!0,e.framesetOk=!1;}function $n(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}function es(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1;}function ts(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,qt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;}function ns(e,t){e._appendElement(t,qt.HTML),t.ackSelfClosing=!0;}function ss(e,t){e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}function rs(e,t){e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML);}function is(e,t){e.openElements.hasInScope(zt.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,qt.HTML);}function os(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML);}function as(e,t){const n=t.tagName;switch(n.length){case 1:n===zt.I||n===zt.S||n===zt.B||n===zt.U?$n(e,t):n===zt.P?Jn(e,t):n===zt.A?function(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(zt.A);n&&(Un(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}(e,t):os(e,t);break;case 2:n===zt.DL||n===zt.OL||n===zt.UL?Jn(e,t):n===zt.H1||n===zt.H2||n===zt.H3||n===zt.H4||n===zt.H5||n===zt.H6?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement();const n=e.openElements.currentTagName;n!==zt.H1&&n!==zt.H2&&n!==zt.H3&&n!==zt.H4&&n!==zt.H5&&n!==zt.H6||e.openElements.pop(),e._insertElement(t,qt.HTML);}(e,t):n===zt.LI||n===zt.DD||n===zt.DT?function(e,t){e.framesetOk=!1;const n=t.tagName;for(let t=e.openElements.stackTop;t>=0;t--){const s=e.openElements.items[t],r=e.treeAdapter.getTagName(s);let i=null;if(n===zt.LI&&r===zt.LI?i=zt.LI:n!==zt.DD&&n!==zt.DT||r!==zt.DD&&r!==zt.DT||(i=r),i){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(r!==zt.ADDRESS&&r!==zt.DIV&&r!==zt.P&&e._isSpecialElement(s))break}e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}(e,t):n===zt.EM||n===zt.TT?$n(e,t):n===zt.BR?ts(e,t):n===zt.HR?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._appendElement(t,qt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;}(e,t):n===zt.RB?is(e,t):n===zt.RT||n===zt.RP?function(e,t){e.openElements.hasInScope(zt.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(zt.RTC),e._insertElement(t,qt.HTML);}(e,t):n!==zt.TH&&n!==zt.TD&&n!==zt.TR&&os(e,t);break;case 3:n===zt.DIV||n===zt.DIR||n===zt.NAV?Jn(e,t):n===zt.PRE?Zn(e,t):n===zt.BIG?$n(e,t):n===zt.IMG||n===zt.WBR?ts(e,t):n===zt.XMP?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}(e,t):n===zt.SVG?function(e,t){e._reconstructActiveFormattingElements(),jt.adjustTokenSVGAttrs(t),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,qt.SVG):e._insertElement(t,qt.SVG),t.ackSelfClosing=!0;}(e,t):n===zt.RTC?is(e,t):n!==zt.COL&&os(e,t);break;case 4:n===zt.HTML?function(e,t){0===e.openElements.tmplCount&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs);}(e,t):n===zt.BASE||n===zt.LINK||n===zt.META?Qn(e,t):n===zt.BODY?function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&0===e.openElements.tmplCount&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs));}(e,t):n===zt.MAIN||n===zt.MENU?Jn(e,t):n===zt.FORM?function(e,t){const n=e.openElements.tmplCount>0;e.formElement&&!n||(e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),n||(e.formElement=e.openElements.current));}(e,t):n===zt.CODE||n===zt.FONT?$n(e,t):n===zt.NOBR?function(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(zt.NOBR)&&(Un(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}(e,t):n===zt.AREA?ts(e,t):n===zt.MATH?function(e,t){e._reconstructActiveFormattingElements(),jt.adjustTokenMathMLAttrs(t),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,qt.MATHML):e._insertElement(t,qt.MATHML),t.ackSelfClosing=!0;}(e,t):n===zt.MENU?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}(e,t):n!==zt.HEAD&&os(e,t);break;case 5:n===zt.STYLE||n===zt.TITLE?Qn(e,t):n===zt.ASIDE?Jn(e,t):n===zt.SMALL?$n(e,t):n===zt.TABLE?function(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ct.DOCUMENT_MODE.QUIRKS&&e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode=En;}(e,t):n===zt.EMBED?ts(e,t):n===zt.INPUT?function(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,qt.HTML);const n=Nt.getTokenAttr(t,Jt.TYPE);n&&n.toLowerCase()===$t||(e.framesetOk=!1),t.ackSelfClosing=!0;}(e,t):n===zt.PARAM||n===zt.TRACK?ns(e,t):n===zt.IMAGE?function(e,t){t.tagName=zt.IMG,ts(e,t);}(e,t):n!==zt.FRAME&&n!==zt.TBODY&&n!==zt.TFOOT&&n!==zt.THEAD&&os(e,t);break;case 6:n===zt.SCRIPT?Qn(e,t):n===zt.CENTER||n===zt.FIGURE||n===zt.FOOTER||n===zt.HEADER||n===zt.HGROUP||n===zt.DIALOG?Jn(e,t):n===zt.BUTTON?function(e,t){e.openElements.hasInScope(zt.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.framesetOk=!1;}(e,t):n===zt.STRIKE||n===zt.STRONG?$n(e,t):n===zt.APPLET||n===zt.OBJECT?es(e,t):n===zt.KEYGEN?ts(e,t):n===zt.SOURCE?ns(e,t):n===zt.IFRAME?function(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}(e,t):n===zt.SELECT?function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode===En||e.insertionMode===cn||e.insertionMode===ln||e.insertionMode===mn||e.insertionMode===pn?e.insertionMode=un:e.insertionMode=An;}(e,t):n===zt.OPTION?rs(e,t):os(e,t);break;case 7:n===zt.BGSOUND?Qn(e,t):n===zt.DETAILS||n===zt.ADDRESS||n===zt.ARTICLE||n===zt.SECTION||n===zt.SUMMARY?Jn(e,t):n===zt.LISTING?Zn(e,t):n===zt.MARQUEE?es(e,t):n===zt.NOEMBED?ss(e,t):n!==zt.CAPTION&&os(e,t);break;case 8:n===zt.BASEFONT?Qn(e,t):n===zt.FRAMESET?function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,qt.HTML),e.insertionMode=Cn);}(e,t):n===zt.FIELDSET?Jn(e,t):n===zt.TEXTAREA?function(e,t){e._insertElement(t,qt.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Nt.MODE.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Tn;}(e,t):n===zt.TEMPLATE?Qn(e,t):n===zt.NOSCRIPT?e.options.scriptingEnabled?ss(e,t):os(e,t):n===zt.OPTGROUP?rs(e,t):n!==zt.COLGROUP&&os(e,t);break;case 9:n===zt.PLAINTEXT?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.tokenizer.state=Nt.MODE.PLAINTEXT;}(e,t):os(e,t);break;case 10:n===zt.BLOCKQUOTE||n===zt.FIGCAPTION?Jn(e,t):os(e,t);break;default:os(e,t);}}function Ts(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n));}function Es(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker());}function hs(e,t){const n=t.tagName;for(let t=e.openElements.stackTop;t>0;t--){const s=e.openElements.items[t];if(e.treeAdapter.getTagName(s)===n){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilElementPopped(s);break}if(e._isSpecialElement(s))break}}function cs(e,t){const n=t.tagName;switch(n.length){case 1:n===zt.A||n===zt.B||n===zt.I||n===zt.S||n===zt.U?Un(e,t):n===zt.P?function(e){e.openElements.hasInButtonScope(zt.P)||e._insertFakeElement(zt.P),e._closePElement();}(e):hs(e,t);break;case 2:n===zt.DL||n===zt.UL||n===zt.OL?Ts(e,t):n===zt.LI?function(e){e.openElements.hasInListItemScope(zt.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(zt.LI),e.openElements.popUntilTagNamePopped(zt.LI));}(e):n===zt.DD||n===zt.DT?function(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n));}(e,t):n===zt.H1||n===zt.H2||n===zt.H3||n===zt.H4||n===zt.H5||n===zt.H6?function(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped());}(e):n===zt.BR?function(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(zt.BR),e.openElements.pop(),e.framesetOk=!1;}(e):n===zt.EM||n===zt.TT?Un(e,t):hs(e,t);break;case 3:n===zt.BIG?Un(e,t):n===zt.DIR||n===zt.DIV||n===zt.NAV||n===zt.PRE?Ts(e,t):hs(e,t);break;case 4:n===zt.BODY?function(e){e.openElements.hasInScope(zt.BODY)&&(e.insertionMode=dn);}(e):n===zt.HTML?function(e,t){e.openElements.hasInScope(zt.BODY)&&(e.insertionMode=dn,e._processToken(t));}(e,t):n===zt.FORM?function(e){const t=e.openElements.tmplCount>0,n=e.formElement;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(zt.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(zt.FORM):e.openElements.remove(n));}(e):n===zt.CODE||n===zt.FONT||n===zt.NOBR?Un(e,t):n===zt.MAIN||n===zt.MENU?Ts(e,t):hs(e,t);break;case 5:n===zt.ASIDE?Ts(e,t):n===zt.SMALL?Un(e,t):hs(e,t);break;case 6:n===zt.CENTER||n===zt.FIGURE||n===zt.FOOTER||n===zt.HEADER||n===zt.HGROUP||n===zt.DIALOG?Ts(e,t):n===zt.APPLET||n===zt.OBJECT?Es(e,t):n===zt.STRIKE||n===zt.STRONG?Un(e,t):hs(e,t);break;case 7:n===zt.ADDRESS||n===zt.ARTICLE||n===zt.DETAILS||n===zt.SECTION||n===zt.SUMMARY||n===zt.LISTING?Ts(e,t):n===zt.MARQUEE?Es(e,t):hs(e,t);break;case 8:n===zt.FIELDSET?Ts(e,t):n===zt.TEMPLATE?Xn(e,t):hs(e,t);break;case 10:n===zt.BLOCKQUOTE||n===zt.FIGCAPTION?Ts(e,t):hs(e,t);break;default:hs(e,t);}}function _s(e,t){e.tmplInsertionModeStackTop>-1?Os(e,t):e.stopped=!0;}function ls(e,t){const n=e.openElements.currentTagName;n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?(e.pendingCharacterTokens=[],e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=hn,e._processToken(t)):As(e,t);}function ms(e,t){const n=t.tagName;switch(n.length){case 2:n===zt.TD||n===zt.TH||n===zt.TR?function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(zt.TBODY),e.insertionMode=ln,e._processToken(t);}(e,t):As(e,t);break;case 3:n===zt.COL?function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(zt.COLGROUP),e.insertionMode=_n,e._processToken(t);}(e,t):As(e,t);break;case 4:n===zt.FORM?function(e,t){e.formElement||0!==e.openElements.tmplCount||(e._insertElement(t,qt.HTML),e.formElement=e.openElements.current,e.openElements.pop());}(e,t):As(e,t);break;case 5:n===zt.TABLE?function(e,t){e.openElements.hasInTableScope(zt.TABLE)&&(e.openElements.popUntilTagNamePopped(zt.TABLE),e._resetInsertionMode(),e._processToken(t));}(e,t):n===zt.STYLE?Qn(e,t):n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,qt.HTML),e.insertionMode=ln;}(e,t):n===zt.INPUT?function(e,t){const n=Nt.getTokenAttr(t,Jt.TYPE);n&&n.toLowerCase()===$t?e._appendElement(t,qt.HTML):As(e,t),t.ackSelfClosing=!0;}(e,t):As(e,t);break;case 6:n===zt.SCRIPT?Qn(e,t):As(e,t);break;case 7:n===zt.CAPTION?function(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,qt.HTML),e.insertionMode=cn;}(e,t):As(e,t);break;case 8:n===zt.COLGROUP?function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,qt.HTML),e.insertionMode=_n;}(e,t):n===zt.TEMPLATE?Qn(e,t):As(e,t);break;default:As(e,t);}}function ps(e,t){const n=t.tagName;n===zt.TABLE?e.openElements.hasInTableScope(zt.TABLE)&&(e.openElements.popUntilTagNamePopped(zt.TABLE),e._resetInsertionMode()):n===zt.TEMPLATE?Xn(e,t):n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&n!==zt.TBODY&&n!==zt.TD&&n!==zt.TFOOT&&n!==zt.TH&&n!==zt.THEAD&&n!==zt.TR&&As(e,t);}function As(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,e._processTokenInBodyMode(t),e.fosterParentingEnabled=n;}function us(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)As(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t);}function Ns(e,t){e.openElements.currentTagName===zt.COLGROUP&&(e.openElements.pop(),e.insertionMode=En,e._processToken(t));}function ds(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.OPTION?(e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e._insertElement(t,qt.HTML)):n===zt.OPTGROUP?(e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e.openElements.currentTagName===zt.OPTGROUP&&e.openElements.pop(),e._insertElement(t,qt.HTML)):n===zt.INPUT||n===zt.KEYGEN||n===zt.TEXTAREA||n===zt.SELECT?e.openElements.hasInSelectScope(zt.SELECT)&&(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),n!==zt.SELECT&&e._processToken(t)):n!==zt.SCRIPT&&n!==zt.TEMPLATE||Qn(e,t);}function Cs(e,t){const n=t.tagName;if(n===zt.OPTGROUP){const t=e.openElements.items[e.openElements.stackTop-1],n=t&&e.treeAdapter.getTagName(t);e.openElements.currentTagName===zt.OPTION&&n===zt.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagName===zt.OPTGROUP&&e.openElements.pop();}else n===zt.OPTION?e.openElements.currentTagName===zt.OPTION&&e.openElements.pop():n===zt.SELECT&&e.openElements.hasInSelectScope(zt.SELECT)?(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode()):n===zt.TEMPLATE&&Xn(e,t);}function Os(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(zt.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e._popTmplInsertionMode(),e._resetInsertionMode(),e._processToken(t)):e.stopped=!0;}function fs(e,t){e.insertionMode=an,e._processToken(t);}function Ss(e,t){e.insertionMode=an,e._processToken(t);}return e.parse=function(e,t){return new kn(t).parse(e)},e.parseFragment=function(e,t,n){return "string"==typeof e&&(n=t,t=e,e=null),new kn(n).parseFragment(t,e)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});const parse$4=e.parse;const parseFragment=e.parseFragment;
  12325. const docParser = new WeakMap();
  12326. function parseDocumentUtil(ownerDocument, html) {
  12327. const doc = parse$4(html.trim(), getParser(ownerDocument));
  12328. doc.documentElement = doc.firstElementChild;
  12329. doc.head = doc.documentElement.firstElementChild;
  12330. doc.body = doc.head.nextElementSibling;
  12331. return doc;
  12332. }
  12333. function parseFragmentUtil(ownerDocument, html) {
  12334. if (typeof html === 'string') {
  12335. html = html.trim();
  12336. }
  12337. else {
  12338. html = '';
  12339. }
  12340. const frag = parseFragment(html, getParser(ownerDocument));
  12341. return frag;
  12342. }
  12343. function getParser(ownerDocument) {
  12344. let parseOptions = docParser.get(ownerDocument);
  12345. if (parseOptions != null) {
  12346. return parseOptions;
  12347. }
  12348. const treeAdapter = {
  12349. createDocument() {
  12350. const doc = ownerDocument.createElement("#document" /* NODE_NAMES.DOCUMENT_NODE */);
  12351. doc['x-mode'] = 'no-quirks';
  12352. return doc;
  12353. },
  12354. setNodeSourceCodeLocation(node, location) {
  12355. node.sourceCodeLocation = location;
  12356. },
  12357. getNodeSourceCodeLocation(node) {
  12358. return node.sourceCodeLocation;
  12359. },
  12360. createDocumentFragment() {
  12361. return ownerDocument.createDocumentFragment();
  12362. },
  12363. createElement(tagName, namespaceURI, attrs) {
  12364. const elm = ownerDocument.createElementNS(namespaceURI, tagName);
  12365. for (let i = 0; i < attrs.length; i++) {
  12366. const attr = attrs[i];
  12367. if (attr.namespace == null || attr.namespace === 'http://www.w3.org/1999/xhtml') {
  12368. elm.setAttribute(attr.name, attr.value);
  12369. }
  12370. else {
  12371. elm.setAttributeNS(attr.namespace, attr.name, attr.value);
  12372. }
  12373. }
  12374. return elm;
  12375. },
  12376. createCommentNode(data) {
  12377. return ownerDocument.createComment(data);
  12378. },
  12379. appendChild(parentNode, newNode) {
  12380. parentNode.appendChild(newNode);
  12381. },
  12382. insertBefore(parentNode, newNode, referenceNode) {
  12383. parentNode.insertBefore(newNode, referenceNode);
  12384. },
  12385. setTemplateContent(templateElement, contentElement) {
  12386. templateElement.content = contentElement;
  12387. },
  12388. getTemplateContent(templateElement) {
  12389. return templateElement.content;
  12390. },
  12391. setDocumentType(doc, name, publicId, systemId) {
  12392. let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */);
  12393. if (doctypeNode == null) {
  12394. doctypeNode = ownerDocument.createDocumentTypeNode();
  12395. doc.insertBefore(doctypeNode, doc.firstChild);
  12396. }
  12397. doctypeNode.nodeValue = '!DOCTYPE';
  12398. doctypeNode['x-name'] = name;
  12399. doctypeNode['x-publicId'] = publicId;
  12400. doctypeNode['x-systemId'] = systemId;
  12401. },
  12402. setDocumentMode(doc, mode) {
  12403. doc['x-mode'] = mode;
  12404. },
  12405. getDocumentMode(doc) {
  12406. return doc['x-mode'];
  12407. },
  12408. detachNode(node) {
  12409. node.remove();
  12410. },
  12411. insertText(parentNode, text) {
  12412. const lastChild = parentNode.lastChild;
  12413. if (lastChild != null && lastChild.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  12414. lastChild.nodeValue += text;
  12415. }
  12416. else {
  12417. parentNode.appendChild(ownerDocument.createTextNode(text));
  12418. }
  12419. },
  12420. insertTextBefore(parentNode, text, referenceNode) {
  12421. const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
  12422. if (prevNode != null && prevNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  12423. prevNode.nodeValue += text;
  12424. }
  12425. else {
  12426. parentNode.insertBefore(ownerDocument.createTextNode(text), referenceNode);
  12427. }
  12428. },
  12429. adoptAttributes(recipient, attrs) {
  12430. for (let i = 0; i < attrs.length; i++) {
  12431. const attr = attrs[i];
  12432. if (recipient.hasAttributeNS(attr.namespace, attr.name) === false) {
  12433. recipient.setAttributeNS(attr.namespace, attr.name, attr.value);
  12434. }
  12435. }
  12436. },
  12437. getFirstChild(node) {
  12438. return node.childNodes[0];
  12439. },
  12440. getChildNodes(node) {
  12441. return node.childNodes;
  12442. },
  12443. getParentNode(node) {
  12444. return node.parentNode;
  12445. },
  12446. getAttrList(element) {
  12447. const attrs = element.attributes.__items.map((attr) => {
  12448. return {
  12449. name: attr.name,
  12450. value: attr.value,
  12451. namespace: attr.namespaceURI,
  12452. prefix: null,
  12453. };
  12454. });
  12455. return attrs;
  12456. },
  12457. getTagName(element) {
  12458. if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
  12459. return element.nodeName.toLowerCase();
  12460. }
  12461. else {
  12462. return element.nodeName;
  12463. }
  12464. },
  12465. getNamespaceURI(element) {
  12466. return element.namespaceURI;
  12467. },
  12468. getTextNodeContent(textNode) {
  12469. return textNode.nodeValue;
  12470. },
  12471. getCommentNodeContent(commentNode) {
  12472. return commentNode.nodeValue;
  12473. },
  12474. getDocumentTypeNodeName(doctypeNode) {
  12475. return doctypeNode['x-name'];
  12476. },
  12477. getDocumentTypeNodePublicId(doctypeNode) {
  12478. return doctypeNode['x-publicId'];
  12479. },
  12480. getDocumentTypeNodeSystemId(doctypeNode) {
  12481. return doctypeNode['x-systemId'];
  12482. },
  12483. isTextNode(node) {
  12484. return node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */;
  12485. },
  12486. isCommentNode(node) {
  12487. return node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */;
  12488. },
  12489. isDocumentTypeNode(node) {
  12490. return node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
  12491. },
  12492. isElementNode(node) {
  12493. return node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */;
  12494. },
  12495. };
  12496. parseOptions = {
  12497. treeAdapter: treeAdapter,
  12498. };
  12499. docParser.set(ownerDocument, parseOptions);
  12500. return parseOptions;
  12501. }
  12502. // Sizzle 2.3.6
  12503. const Sizzle = (function() {
  12504. const window = {
  12505. document: {
  12506. createElement() {
  12507. return {};
  12508. },
  12509. nodeType: 9,
  12510. documentElement: {
  12511. nodeType: 1,
  12512. nodeName: 'HTML'
  12513. }
  12514. }
  12515. };
  12516. const module = { exports: {} };
  12517. /*! Sizzle v2.3.6 | (c) JS Foundation and other contributors | js.foundation */
  12518. !function(e){var t,n,r,i,o,u,l,a,c,s,d,f,p,h,g,m,y,v,w,b="sizzle"+1*new Date,N=e.document,C=0,x=0,E=ae(),A=ae(),S=ae(),D=ae(),T=function(e,t){return e===t&&(d=!0),0},L={}.hasOwnProperty,q=[],I=q.pop,B=q.push,R=q.push,$=q.slice,k=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return -1},H="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",P="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",z="\\["+M+"*("+P+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+P+"))|)"+M+"*\\]",F=":("+P+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+z+")*)|.*)\\)|)",O=new RegExp(M+"+","g"),j=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),G=new RegExp("^"+M+"*,"+M+"*"),U=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),V=new RegExp(M+"|>"),X=new RegExp(F),J=new RegExp("^"+P+"$"),K={ID:new RegExp("^#("+P+")"),CLASS:new RegExp("^\\.("+P+")"),TAG:new RegExp("^("+P+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+H+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/HTML$/i,W=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){f();},ue=ve(function(e){return !0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{R.apply(q=$.call(N.childNodes),N.childNodes),q[N.childNodes.length].nodeType;}catch(e){R={apply:q.length?function(e,t){B.apply(e,$.call(t));}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1;}};}function le(e,t,r,i){var o,l,c,s,d,h,y,v=t&&t.ownerDocument,N=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==N&&9!==N&&11!==N)return r;if(!i&&(f(t),t=t||p,g)){if(11!==N&&(d=_.exec(e)))if(o=d[1]){if(9===N){if(!(c=t.getElementById(o)))return r;if(c.id===o)return r.push(c),r}else if(v&&(c=v.getElementById(o))&&w(t,c)&&c.id===o)return r.push(c),r}else {if(d[2])return R.apply(r,t.getElementsByTagName(e)),r;if((o=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return R.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!D[e+" "]&&(!m||!m.test(e))&&(1!==N||"object"!==t.nodeName.toLowerCase())){if(y=e,v=t,1===N&&(V.test(e)||U.test(e))){(v=ee.test(e)&&ge(t.parentNode)||t)===t&&n.scope||((s=t.getAttribute("id"))?s=s.replace(re,ie):t.setAttribute("id",s=b)),l=(h=u(e)).length;while(l--)h[l]=(s?"#"+s:":scope")+" "+ye(h[l]);y=h.join(",");}try{return R.apply(r,v.querySelectorAll(y)),r}catch(t){D(e,!0);}finally{s===b&&t.removeAttribute("id");}}}return a(e.replace(j,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function ce(e){return e[b]=!0,e}function se(e){var t=p.createElement("fieldset");try{return !!e(t)}catch(e){return !1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null;}}function de(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t;}function fe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return -1;return e?1:-1}function pe(e){return function(t){return "form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ue(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return ce(function(t){return t=+t,ce(function(n,r){var i,o=e([],n.length,t),u=o.length;while(u--)n[i=o[u]]&&(n[i]=!(r[i]=n[i]));})})}function ge(e){return e&&void 0!==e.getElementsByTagName&&e}n=le.support={},o=le.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return !Q.test(t||n&&n.nodeName||"HTML")},f=le.setDocument=function(e){var t,i,u=e?e.ownerDocument||e:N;return u!=p&&9===u.nodeType&&u.documentElement?(p=u,h=p.documentElement,g=!o(p),N!=p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=se(function(e){return h.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),n.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=se(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Z.test(p.getElementsByClassName),n.getById=se(function(e){return h.appendChild(e).id=b,!p.getElementsByName||!p.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return [o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return [o]}return []}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},y=[],m=[],(n.qsa=Z.test(p.querySelectorAll))&&(se(function(e){var t;h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+M+"*(?:value|"+H+")"),e.querySelectorAll("[id~="+b+"-]").length||m.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||m.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||m.push(".#.+[+~]"),e.querySelectorAll("\\\f"),m.push("[\\r\\n\\f]");}),se(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:");})),(n.matchesSelector=Z.test(v=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&se(function(e){n.disconnectedMatch=v.call(e,"*"),v.call(e,"[s!='']:x"),y.push("!=",F);}),m=m.length&&new RegExp(m.join("|")),y=y.length&&new RegExp(y.join("|")),t=Z.test(h.compareDocumentPosition),w=t||Z.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return !0;return !1},T=t?function(e,t){if(e===t)return d=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==p||e.ownerDocument==N&&w(N,e)?-1:t==p||t.ownerDocument==N&&w(N,t)?1:s?k(s,e)-k(s,t):0:4&r?-1:1)}:function(e,t){if(e===t)return d=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,u=[e],l=[t];if(!i||!o)return e==p?-1:t==p?1:i?-1:o?1:s?k(s,e)-k(s,t):0;if(i===o)return fe(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)l.unshift(n);while(u[r]===l[r])r++;return r?fe(u[r],l[r]):u[r]==N?-1:l[r]==N?1:0},p):p},le.matches=function(e,t){return le(e,null,null,t)},le.matchesSelector=function(e,t){if(f(e),n.matchesSelector&&g&&!D[t+" "]&&(!y||!y.test(t))&&(!m||!m.test(t)))try{var r=v.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){D(t,!0);}return le(t,p,null,[e]).length>0},le.contains=function(e,t){return (e.ownerDocument||e)!=p&&f(e),w(e,t)},le.attr=function(e,t){(e.ownerDocument||e)!=p&&f(e);var i=r.attrHandle[t.toLowerCase()],o=i&&L.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},le.escape=function(e){return (e+"").replace(re,ie)},le.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},le.uniqueSort=function(e){var t,r=[],i=0,o=0;if(d=!n.detectDuplicates,s=!n.sortStable&&e.slice(0),e.sort(T),d){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1);}return s=null,e},i=le.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e);}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=le.selectors={cacheLength:50,createPseudo:ce,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||le.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&le.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=u(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return "*"===e?function(){return !0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=le.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(O," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),u="last"!==e.slice(-4),l="of-type"===t;return 1===r&&0===i?function(e){return !!e.parentNode}:function(t,n,a){var c,s,d,f,p,h,g=o!==u?"nextSibling":"previousSibling",m=t.parentNode,y=l&&t.nodeName.toLowerCase(),v=!a&&!l,w=!1;if(m){if(o){while(g){f=t;while(f=f[g])if(l?f.nodeName.toLowerCase()===y:1===f.nodeType)return !1;h=g="only"===e&&!h&&"nextSibling";}return !0}if(h=[u?m.firstChild:m.lastChild],u&&v){w=(p=(c=(s=(d=(f=m)[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]||[])[0]===C&&c[1])&&c[2],f=p&&m.childNodes[p];while(f=++p&&f&&f[g]||(w=p=0)||h.pop())if(1===f.nodeType&&++w&&f===t){s[e]=[C,p,w];break}}else if(v&&(w=p=(c=(s=(d=(f=t)[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]||[])[0]===C&&c[1]),!1===w)while(f=++p&&f&&f[g]||(w=p=0)||h.pop())if((l?f.nodeName.toLowerCase()===y:1===f.nodeType)&&++w&&(v&&((s=(d=f[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]=[C,w]),f===t))break;return (w-=i)===r||w%r==0&&w/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||le.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ce(function(e,n){var r,o=i(e,t),u=o.length;while(u--)e[r=k(e,o[u])]=!(n[r]=o[u]);}):function(e){return i(e,0,n)}):i}},pseudos:{not:ce(function(e){var t=[],n=[],r=l(e.replace(j,"$1"));return r[b]?ce(function(e,t,n,i){var o,u=r(e,null,i,[]),l=e.length;while(l--)(o=u[l])&&(e[l]=!(t[l]=o));}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:ce(function(e){return function(t){return le(e,t).length>0}}),contains:ce(function(e){return e=e.replace(te,ne),function(t){return (t.textContent||i(t)).indexOf(e)>-1}}),lang:ce(function(e){return J.test(e||"")||le.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return (n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return !1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:pe(!1),disabled:pe(!0),checked:function(e){var t=e.nodeName.toLowerCase();return "input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return !0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return !1;return !0},parent:function(e){return !r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return W.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return "input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return "input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return [0]}),last:he(function(e,t){return [t-1]}),eq:he(function(e,t,n){return [n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n>t?t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=function(e){return function(t){return "input"===t.nodeName.toLowerCase()&&t.type===e}}(t);for(t in {submit:!0,reset:!0})r.pseudos[t]=function(e){return function(t){var n=t.nodeName.toLowerCase();return ("input"===n||"button"===n)&&t.type===e}}(t);function me(){}me.prototype=r.filters=r.pseudos,r.setFilters=new me,u=le.tokenize=function(e,t){var n,i,o,u,l,a,c,s=A[e+" "];if(s)return t?0:s.slice(0);l=e,a=[],c=r.preFilter;while(l){n&&!(i=G.exec(l))||(i&&(l=l.slice(i[0].length)||l),a.push(o=[])),n=!1,(i=U.exec(l))&&(n=i.shift(),o.push({value:n,type:i[0].replace(j," ")}),l=l.slice(n.length));for(u in r.filter)!(i=K[u].exec(l))||c[u]&&!(i=c[u](i))||(n=i.shift(),o.push({value:n,type:u,matches:i}),l=l.slice(n.length));if(!n)break}return t?l.length:l?le.error(e):A(e,a).slice(0)};function ye(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function ve(e,t,n){var r=t.dir,i=t.next,o=i||r,u=n&&"parentNode"===o,l=x++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||u)return e(t,n,i);return !1}:function(t,n,a){var c,s,d,f=[C,l];if(a){while(t=t[r])if((1===t.nodeType||u)&&e(t,n,a))return !0}else while(t=t[r])if(1===t.nodeType||u)if(d=t[b]||(t[b]={}),s=d[t.uniqueID]||(d[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else {if((c=s[o])&&c[0]===C&&c[1]===l)return f[2]=c[2];if(s[o]=f,f[2]=e(t,n,a))return !0}return !1}}function we(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return !1;return !0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)le(e,t[r],n);return n}function Ne(e,t,n,r,i){for(var o,u=[],l=0,a=e.length,c=null!=t;l<a;l++)(o=e[l])&&(n&&!n(o,r,i)||(u.push(o),c&&t.push(l)));return u}function Ce(e,t,n,r,i,o){return r&&!r[b]&&(r=Ce(r)),i&&!i[b]&&(i=Ce(i,o)),ce(function(o,u,l,a){var c,s,d,f=[],p=[],h=u.length,g=o||be(t||"*",l.nodeType?[l]:l,[]),m=!e||!o&&t?g:Ne(g,f,e,l,a),y=n?i||(o?e:h||r)?[]:u:m;if(n&&n(m,y,l,a),r){c=Ne(y,p),r(c,[],l,a),s=c.length;while(s--)(d=c[s])&&(y[p[s]]=!(m[p[s]]=d));}if(o){if(i||e){if(i){c=[],s=y.length;while(s--)(d=y[s])&&c.push(m[s]=d);i(null,y=[],c,a);}s=y.length;while(s--)(d=y[s])&&(c=i?k(o,d):f[s])>-1&&(o[c]=!(u[c]=d));}}else y=Ne(y===u?y.splice(h,y.length):y),i?i(null,u,y,a):R.apply(u,y);})}function xe(e){for(var t,n,i,o=e.length,u=r.relative[e[0].type],l=u||r.relative[" "],a=u?1:0,s=ve(function(e){return e===t},l,!0),d=ve(function(e){return k(t,e)>-1},l,!0),f=[function(e,n,r){var i=!u&&(r||n!==c)||((t=n).nodeType?s(e,n,r):d(e,n,r));return t=null,i}];a<o;a++)if(n=r.relative[e[a].type])f=[ve(we(f),n)];else {if((n=r.filter[e[a].type].apply(null,e[a].matches))[b]){for(i=++a;i<o;i++)if(r.relative[e[i].type])break;return Ce(a>1&&we(f),a>1&&ye(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(j,"$1"),n,a<i&&xe(e.slice(a,i)),i<o&&xe(e=e.slice(i)),i<o&&ye(e))}f.push(n);}return we(f)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,u,l,a,s){var d,h,m,y=0,v="0",w=o&&[],b=[],N=c,x=o||i&&r.find.TAG("*",s),E=C+=null==N?1:Math.random()||.1,A=x.length;for(s&&(c=u==p||u||s);v!==A&&null!=(d=x[v]);v++){if(i&&d){h=0,u||d.ownerDocument==p||(f(d),l=!g);while(m=e[h++])if(m(d,u||p,l)){a.push(d);break}s&&(C=E);}n&&((d=!m&&d)&&y--,o&&w.push(d));}if(y+=v,n&&v!==y){h=0;while(m=t[h++])m(w,b,u,l);if(o){if(y>0)while(v--)w[v]||b[v]||(b[v]=I.call(a));b=Ne(b);}R.apply(a,b),s&&!o&&b.length>0&&y+t.length>1&&le.uniqueSort(a);}return s&&(C=E,c=N),w};return n?ce(o):o}l=le.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=u(e)),n=t.length;while(n--)(o=xe(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e;}return o},a=le.select=function(e,t,n,i){var o,a,c,s,d,f="function"==typeof e&&e,p=!i&&u(e=f.selector||e);if(n=n||[],1===p.length){if((a=p[0]=p[0].slice(0)).length>2&&"ID"===(c=a[0]).type&&9===t.nodeType&&g&&r.relative[a[1].type]){if(!(t=(r.find.ID(c.matches[0].replace(te,ne),t)||[])[0]))return n;f&&(t=t.parentNode),e=e.slice(a.shift().value.length);}o=K.needsContext.test(e)?0:a.length;while(o--){if(c=a[o],r.relative[s=c.type])break;if((d=r.find[s])&&(i=d(c.matches[0].replace(te,ne),ee.test(a[0].type)&&ge(t.parentNode)||t))){if(a.splice(o,1),!(e=i.length&&ye(a)))return R.apply(n,i),n;break}}}return (f||l(e,p))(i,t,!g,n,!t||ee.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(T).join("")===b,n.detectDuplicates=!!d,f(),n.sortDetached=se(function(e){return 1&e.compareDocumentPosition(p.createElement("fieldset"))}),se(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||de("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&se(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||de("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),se(function(e){return null==e.getAttribute("disabled")})||de(H,function(e,t,n){var r;if(!n)return !0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null});var Ae=e.Sizzle;le.noConflict=function(){return e.Sizzle===le&&(e.Sizzle=Ae),le},"function"==typeof define&&define.amd?define(function(){return le}):"undefined"!=typeof module&&module.exports?module.exports=le:e.Sizzle=le;}(window);
  12519. //# sourceMappingURL=sizzle.min.map
  12520. return module.exports;
  12521. })();
  12522. function matches(selector, elm) {
  12523. const r = Sizzle.matches(selector, [elm]);
  12524. return r.length > 0;
  12525. }
  12526. function selectOne(selector, elm) {
  12527. const r = Sizzle(selector, elm);
  12528. return r[0] || null;
  12529. }
  12530. function selectAll(selector, elm) {
  12531. return Sizzle(selector, elm);
  12532. }
  12533. function serializeNodeToHtml(elm, opts = {}) {
  12534. const output = {
  12535. currentLineWidth: 0,
  12536. indent: 0,
  12537. isWithinBody: false,
  12538. text: [],
  12539. };
  12540. if (opts.prettyHtml) {
  12541. if (typeof opts.indentSpaces !== 'number') {
  12542. opts.indentSpaces = 2;
  12543. }
  12544. if (typeof opts.newLines !== 'boolean') {
  12545. opts.newLines = true;
  12546. }
  12547. opts.approximateLineWidth = -1;
  12548. }
  12549. else {
  12550. opts.prettyHtml = false;
  12551. if (typeof opts.newLines !== 'boolean') {
  12552. opts.newLines = false;
  12553. }
  12554. if (typeof opts.indentSpaces !== 'number') {
  12555. opts.indentSpaces = 0;
  12556. }
  12557. }
  12558. if (typeof opts.approximateLineWidth !== 'number') {
  12559. opts.approximateLineWidth = -1;
  12560. }
  12561. if (typeof opts.removeEmptyAttributes !== 'boolean') {
  12562. opts.removeEmptyAttributes = true;
  12563. }
  12564. if (typeof opts.removeAttributeQuotes !== 'boolean') {
  12565. opts.removeAttributeQuotes = false;
  12566. }
  12567. if (typeof opts.removeBooleanAttributeQuotes !== 'boolean') {
  12568. opts.removeBooleanAttributeQuotes = false;
  12569. }
  12570. if (typeof opts.removeHtmlComments !== 'boolean') {
  12571. opts.removeHtmlComments = false;
  12572. }
  12573. if (typeof opts.serializeShadowRoot !== 'boolean') {
  12574. opts.serializeShadowRoot = false;
  12575. }
  12576. if (opts.outerHtml) {
  12577. serializeToHtml(elm, opts, output, false);
  12578. }
  12579. else {
  12580. for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
  12581. serializeToHtml(elm.childNodes[i], opts, output, false);
  12582. }
  12583. }
  12584. if (output.text[0] === '\n') {
  12585. output.text.shift();
  12586. }
  12587. if (output.text[output.text.length - 1] === '\n') {
  12588. output.text.pop();
  12589. }
  12590. return output.text.join('');
  12591. }
  12592. function serializeToHtml(node, opts, output, isShadowRoot) {
  12593. if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ || isShadowRoot) {
  12594. const tagName = isShadowRoot ? 'mock:shadow-root' : getTagName(node);
  12595. if (tagName === 'body') {
  12596. output.isWithinBody = true;
  12597. }
  12598. const ignoreTag = opts.excludeTags != null && opts.excludeTags.includes(tagName);
  12599. if (ignoreTag === false) {
  12600. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  12601. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  12602. output.text.push('\n');
  12603. output.currentLineWidth = 0;
  12604. }
  12605. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  12606. for (let i = 0; i < output.indent; i++) {
  12607. output.text.push(' ');
  12608. }
  12609. output.currentLineWidth += output.indent;
  12610. }
  12611. output.text.push('<' + tagName);
  12612. output.currentLineWidth += tagName.length + 1;
  12613. const attrsLength = node.attributes.length;
  12614. const attributes = opts.prettyHtml && attrsLength > 1
  12615. ? cloneAttributes(node.attributes, true)
  12616. : node.attributes;
  12617. for (let i = 0; i < attrsLength; i++) {
  12618. const attr = attributes.item(i);
  12619. const attrName = attr.name;
  12620. if (attrName === 'style') {
  12621. continue;
  12622. }
  12623. let attrValue = attr.value;
  12624. if (opts.removeEmptyAttributes && attrValue === '' && REMOVE_EMPTY_ATTR.has(attrName)) {
  12625. continue;
  12626. }
  12627. const attrNamespaceURI = attr.namespaceURI;
  12628. if (attrNamespaceURI == null) {
  12629. output.currentLineWidth += attrName.length + 1;
  12630. if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
  12631. output.text.push('\n' + attrName);
  12632. output.currentLineWidth = 0;
  12633. }
  12634. else {
  12635. output.text.push(' ' + attrName);
  12636. }
  12637. }
  12638. else if (attrNamespaceURI === 'http://www.w3.org/XML/1998/namespace') {
  12639. output.text.push(' xml:' + attrName);
  12640. output.currentLineWidth += attrName.length + 5;
  12641. }
  12642. else if (attrNamespaceURI === 'http://www.w3.org/2000/xmlns/') {
  12643. if (attrName !== 'xmlns') {
  12644. output.text.push(' xmlns:' + attrName);
  12645. output.currentLineWidth += attrName.length + 7;
  12646. }
  12647. else {
  12648. output.text.push(' ' + attrName);
  12649. output.currentLineWidth += attrName.length + 1;
  12650. }
  12651. }
  12652. else if (attrNamespaceURI === XLINK_NS) {
  12653. output.text.push(' xlink:' + attrName);
  12654. output.currentLineWidth += attrName.length + 7;
  12655. }
  12656. else {
  12657. output.text.push(' ' + attrNamespaceURI + ':' + attrName);
  12658. output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
  12659. }
  12660. if (opts.prettyHtml && attrName === 'class') {
  12661. attrValue = attr.value = attrValue
  12662. .split(' ')
  12663. .filter((t) => t !== '')
  12664. .sort()
  12665. .join(' ')
  12666. .trim();
  12667. }
  12668. if (attrValue === '') {
  12669. if (opts.removeBooleanAttributeQuotes && BOOLEAN_ATTR.has(attrName)) {
  12670. continue;
  12671. }
  12672. if (opts.removeEmptyAttributes && attrName.startsWith('data-')) {
  12673. continue;
  12674. }
  12675. }
  12676. if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
  12677. output.text.push('=' + escapeString(attrValue, true));
  12678. output.currentLineWidth += attrValue.length + 1;
  12679. }
  12680. else {
  12681. output.text.push('="' + escapeString(attrValue, true) + '"');
  12682. output.currentLineWidth += attrValue.length + 3;
  12683. }
  12684. }
  12685. if (node.hasAttribute('style')) {
  12686. const cssText = node.style.cssText;
  12687. if (opts.approximateLineWidth > 0 &&
  12688. output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
  12689. output.text.push(`\nstyle="${cssText}">`);
  12690. output.currentLineWidth = 0;
  12691. }
  12692. else {
  12693. output.text.push(` style="${cssText}">`);
  12694. output.currentLineWidth += cssText.length + 10;
  12695. }
  12696. }
  12697. else {
  12698. output.text.push('>');
  12699. output.currentLineWidth += 1;
  12700. }
  12701. }
  12702. if (EMPTY_ELEMENTS.has(tagName) === false) {
  12703. if (opts.serializeShadowRoot && node.shadowRoot != null) {
  12704. output.indent = output.indent + opts.indentSpaces;
  12705. serializeToHtml(node.shadowRoot, opts, output, true);
  12706. output.indent = output.indent - opts.indentSpaces;
  12707. if (opts.newLines &&
  12708. (node.childNodes.length === 0 ||
  12709. (node.childNodes.length === 1 &&
  12710. node.childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
  12711. node.childNodes[0].nodeValue.trim() === ''))) {
  12712. output.text.push('\n');
  12713. output.currentLineWidth = 0;
  12714. for (let i = 0; i < output.indent; i++) {
  12715. output.text.push(' ');
  12716. }
  12717. output.currentLineWidth += output.indent;
  12718. }
  12719. }
  12720. if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
  12721. const childNodes = tagName === 'template' ? node.content.childNodes : node.childNodes;
  12722. const childNodeLength = childNodes.length;
  12723. if (childNodeLength > 0) {
  12724. if (childNodeLength === 1 &&
  12725. childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
  12726. (typeof childNodes[0].nodeValue !== 'string' || childNodes[0].nodeValue.trim() === '')) ;
  12727. else {
  12728. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  12729. if (!isWithinWhitespaceSensitiveNode && opts.indentSpaces > 0 && ignoreTag === false) {
  12730. output.indent = output.indent + opts.indentSpaces;
  12731. }
  12732. for (let i = 0; i < childNodeLength; i++) {
  12733. serializeToHtml(childNodes[i], opts, output, false);
  12734. }
  12735. if (ignoreTag === false) {
  12736. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  12737. output.text.push('\n');
  12738. output.currentLineWidth = 0;
  12739. }
  12740. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  12741. output.indent = output.indent - opts.indentSpaces;
  12742. for (let i = 0; i < output.indent; i++) {
  12743. output.text.push(' ');
  12744. }
  12745. output.currentLineWidth += output.indent;
  12746. }
  12747. }
  12748. }
  12749. }
  12750. if (ignoreTag === false) {
  12751. output.text.push('</' + tagName + '>');
  12752. output.currentLineWidth += tagName.length + 3;
  12753. }
  12754. }
  12755. }
  12756. if (opts.approximateLineWidth > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
  12757. output.text.push('\n');
  12758. output.currentLineWidth = 0;
  12759. }
  12760. if (tagName === 'body') {
  12761. output.isWithinBody = false;
  12762. }
  12763. }
  12764. else if (node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  12765. let textContent = node.nodeValue;
  12766. if (typeof textContent === 'string') {
  12767. const trimmedTextContent = textContent.trim();
  12768. if (trimmedTextContent === '') {
  12769. // this text node is whitespace only
  12770. if (isWithinWhitespaceSensitive(node)) {
  12771. // whitespace matters within this element
  12772. // just add the exact text we were given
  12773. output.text.push(textContent);
  12774. output.currentLineWidth += textContent.length;
  12775. }
  12776. else if (opts.approximateLineWidth > 0 && !output.isWithinBody) ;
  12777. else if (!opts.prettyHtml) {
  12778. // this text node is only whitespace, and it's not
  12779. // within a whitespace sensitive element like <pre> or <code>
  12780. // so replace the entire white space with a single new line
  12781. output.currentLineWidth += 1;
  12782. if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
  12783. // good enough for a new line
  12784. // for perf these are all just estimates
  12785. // we don't care to ensure exact line lengths
  12786. output.text.push('\n');
  12787. output.currentLineWidth = 0;
  12788. }
  12789. else {
  12790. // let's keep it all on the same line yet
  12791. output.text.push(' ');
  12792. }
  12793. }
  12794. }
  12795. else {
  12796. // this text node has text content
  12797. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
  12798. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  12799. output.text.push('\n');
  12800. output.currentLineWidth = 0;
  12801. }
  12802. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  12803. for (let i = 0; i < output.indent; i++) {
  12804. output.text.push(' ');
  12805. }
  12806. output.currentLineWidth += output.indent;
  12807. }
  12808. let textContentLength = textContent.length;
  12809. if (textContentLength > 0) {
  12810. // this text node has text content
  12811. const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */
  12812. ? node.parentNode.nodeName
  12813. : null;
  12814. if (NON_ESCAPABLE_CONTENT.has(parentTagName)) {
  12815. // this text node cannot have its content escaped since it's going
  12816. // into an element like <style> or <script>
  12817. if (isWithinWhitespaceSensitive(node)) {
  12818. output.text.push(textContent);
  12819. }
  12820. else {
  12821. output.text.push(trimmedTextContent);
  12822. textContentLength = trimmedTextContent.length;
  12823. }
  12824. output.currentLineWidth += textContentLength;
  12825. }
  12826. else {
  12827. // this text node is going into a normal element and html can be escaped
  12828. if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
  12829. // pretty print the text node
  12830. output.text.push(escapeString(textContent.replace(/\s\s+/g, ' ').trim(), false));
  12831. output.currentLineWidth += textContentLength;
  12832. }
  12833. else {
  12834. // not pretty printing the text node
  12835. if (isWithinWhitespaceSensitive(node)) {
  12836. output.currentLineWidth += textContentLength;
  12837. }
  12838. else {
  12839. // this element is not a whitespace sensitive one, like <pre> or <code> so
  12840. // any whitespace at the start and end can be cleaned up to just be one space
  12841. if (/\s/.test(textContent.charAt(0))) {
  12842. textContent = ' ' + textContent.trimLeft();
  12843. }
  12844. textContentLength = textContent.length;
  12845. if (textContentLength > 1) {
  12846. if (/\s/.test(textContent.charAt(textContentLength - 1))) {
  12847. if (opts.approximateLineWidth > 0 &&
  12848. output.currentLineWidth + textContentLength > opts.approximateLineWidth) {
  12849. textContent = textContent.trimRight() + '\n';
  12850. output.currentLineWidth = 0;
  12851. }
  12852. else {
  12853. textContent = textContent.trimRight() + ' ';
  12854. }
  12855. }
  12856. }
  12857. output.currentLineWidth += textContentLength;
  12858. }
  12859. output.text.push(escapeString(textContent, false));
  12860. }
  12861. }
  12862. }
  12863. }
  12864. }
  12865. }
  12866. else if (node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
  12867. const nodeValue = node.nodeValue;
  12868. if (opts.removeHtmlComments) {
  12869. const isHydrateAnnotation = nodeValue.startsWith(CONTENT_REF_ID + '.') ||
  12870. nodeValue.startsWith(ORG_LOCATION_ID + '.') ||
  12871. nodeValue.startsWith(SLOT_NODE_ID + '.') ||
  12872. nodeValue.startsWith(TEXT_NODE_ID + '.');
  12873. if (!isHydrateAnnotation) {
  12874. return;
  12875. }
  12876. }
  12877. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  12878. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  12879. output.text.push('\n');
  12880. output.currentLineWidth = 0;
  12881. }
  12882. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  12883. for (let i = 0; i < output.indent; i++) {
  12884. output.text.push(' ');
  12885. }
  12886. output.currentLineWidth += output.indent;
  12887. }
  12888. output.text.push('<!--' + nodeValue + '-->');
  12889. output.currentLineWidth += nodeValue.length + 7;
  12890. }
  12891. else if (node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
  12892. output.text.push('<!doctype html>');
  12893. }
  12894. }
  12895. const AMP_REGEX = /&/g;
  12896. const NBSP_REGEX = /\u00a0/g;
  12897. const DOUBLE_QUOTE_REGEX = /"/g;
  12898. const LT_REGEX = /</g;
  12899. const GT_REGEX = />/g;
  12900. const CAN_REMOVE_ATTR_QUOTES = /^[^ \t\n\f\r"'`=<>\/\\-]+$/;
  12901. function getTagName(element) {
  12902. if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
  12903. return element.nodeName.toLowerCase();
  12904. }
  12905. else {
  12906. return element.nodeName;
  12907. }
  12908. }
  12909. function escapeString(str, attrMode) {
  12910. str = str.replace(AMP_REGEX, '&amp;').replace(NBSP_REGEX, '&nbsp;');
  12911. if (attrMode) {
  12912. return str.replace(DOUBLE_QUOTE_REGEX, '&quot;');
  12913. }
  12914. return str.replace(LT_REGEX, '&lt;').replace(GT_REGEX, '&gt;');
  12915. }
  12916. function isWithinWhitespaceSensitive(node) {
  12917. while (node != null) {
  12918. if (WHITESPACE_SENSITIVE.has(node.nodeName)) {
  12919. return true;
  12920. }
  12921. node = node.parentNode;
  12922. }
  12923. return false;
  12924. }
  12925. /*@__PURE__*/ const NON_ESCAPABLE_CONTENT = new Set([
  12926. 'STYLE',
  12927. 'SCRIPT',
  12928. 'IFRAME',
  12929. 'NOSCRIPT',
  12930. 'XMP',
  12931. 'NOEMBED',
  12932. 'NOFRAMES',
  12933. 'PLAINTEXT',
  12934. ]);
  12935. /*@__PURE__*/ const WHITESPACE_SENSITIVE = new Set([
  12936. 'CODE',
  12937. 'OUTPUT',
  12938. 'PLAINTEXT',
  12939. 'PRE',
  12940. 'SCRIPT',
  12941. 'TEMPLATE',
  12942. 'TEXTAREA',
  12943. ]);
  12944. /*@__PURE__*/ const EMPTY_ELEMENTS = new Set([
  12945. 'area',
  12946. 'base',
  12947. 'basefont',
  12948. 'bgsound',
  12949. 'br',
  12950. 'col',
  12951. 'embed',
  12952. 'frame',
  12953. 'hr',
  12954. 'img',
  12955. 'input',
  12956. 'keygen',
  12957. 'link',
  12958. 'meta',
  12959. 'param',
  12960. 'source',
  12961. 'trace',
  12962. 'wbr',
  12963. ]);
  12964. /*@__PURE__*/ const REMOVE_EMPTY_ATTR = new Set(['class', 'dir', 'id', 'lang', 'name', 'title']);
  12965. /*@__PURE__*/ const BOOLEAN_ATTR = new Set([
  12966. 'allowfullscreen',
  12967. 'async',
  12968. 'autofocus',
  12969. 'autoplay',
  12970. 'checked',
  12971. 'compact',
  12972. 'controls',
  12973. 'declare',
  12974. 'default',
  12975. 'defaultchecked',
  12976. 'defaultmuted',
  12977. 'defaultselected',
  12978. 'defer',
  12979. 'disabled',
  12980. 'enabled',
  12981. 'formnovalidate',
  12982. 'hidden',
  12983. 'indeterminate',
  12984. 'inert',
  12985. 'ismap',
  12986. 'itemscope',
  12987. 'loop',
  12988. 'multiple',
  12989. 'muted',
  12990. 'nohref',
  12991. 'nomodule',
  12992. 'noresize',
  12993. 'noshade',
  12994. 'novalidate',
  12995. 'nowrap',
  12996. 'open',
  12997. 'pauseonexit',
  12998. 'readonly',
  12999. 'required',
  13000. 'reversed',
  13001. 'scoped',
  13002. 'seamless',
  13003. 'selected',
  13004. 'sortable',
  13005. 'truespeed',
  13006. 'typemustmatch',
  13007. 'visible',
  13008. ]);
  13009. /*@__PURE__*/ const STRUCTURE_ELEMENTS = new Set([
  13010. 'html',
  13011. 'body',
  13012. 'head',
  13013. 'iframe',
  13014. 'meta',
  13015. 'link',
  13016. 'base',
  13017. 'title',
  13018. 'script',
  13019. 'style',
  13020. ]);
  13021. class MockNode {
  13022. constructor(ownerDocument, nodeType, nodeName, nodeValue) {
  13023. this.ownerDocument = ownerDocument;
  13024. this.nodeType = nodeType;
  13025. this.nodeName = nodeName;
  13026. this._nodeValue = nodeValue;
  13027. this.parentNode = null;
  13028. this.childNodes = [];
  13029. }
  13030. appendChild(newNode) {
  13031. if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
  13032. const nodes = newNode.childNodes.slice();
  13033. for (const child of nodes) {
  13034. this.appendChild(child);
  13035. }
  13036. }
  13037. else {
  13038. newNode.remove();
  13039. newNode.parentNode = this;
  13040. this.childNodes.push(newNode);
  13041. connectNode(this.ownerDocument, newNode);
  13042. }
  13043. return newNode;
  13044. }
  13045. append(...items) {
  13046. items.forEach((item) => {
  13047. const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
  13048. this.appendChild(isNode ? item : this.ownerDocument.createTextNode(String(item)));
  13049. });
  13050. }
  13051. prepend(...items) {
  13052. const firstChild = this.firstChild;
  13053. items.forEach((item) => {
  13054. const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
  13055. if (firstChild) {
  13056. this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
  13057. }
  13058. });
  13059. }
  13060. cloneNode(deep) {
  13061. throw new Error(`invalid node type to clone: ${this.nodeType}, deep: ${deep}`);
  13062. }
  13063. compareDocumentPosition(_other) {
  13064. // unimplemented
  13065. // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
  13066. return -1;
  13067. }
  13068. get firstChild() {
  13069. return this.childNodes[0] || null;
  13070. }
  13071. insertBefore(newNode, referenceNode) {
  13072. if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
  13073. for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
  13074. insertBefore(this, newNode.childNodes[i], referenceNode);
  13075. }
  13076. }
  13077. else {
  13078. insertBefore(this, newNode, referenceNode);
  13079. }
  13080. return newNode;
  13081. }
  13082. get isConnected() {
  13083. let node = this;
  13084. while (node != null) {
  13085. if (node.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */) {
  13086. return true;
  13087. }
  13088. node = node.parentNode;
  13089. if (node != null && node.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
  13090. node = node.host;
  13091. }
  13092. }
  13093. return false;
  13094. }
  13095. isSameNode(node) {
  13096. return this === node;
  13097. }
  13098. get lastChild() {
  13099. return this.childNodes[this.childNodes.length - 1] || null;
  13100. }
  13101. get nextSibling() {
  13102. if (this.parentNode != null) {
  13103. const index = this.parentNode.childNodes.indexOf(this) + 1;
  13104. return this.parentNode.childNodes[index] || null;
  13105. }
  13106. return null;
  13107. }
  13108. get nodeValue() {
  13109. var _a;
  13110. return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
  13111. }
  13112. set nodeValue(value) {
  13113. this._nodeValue = value;
  13114. }
  13115. get parentElement() {
  13116. return this.parentNode || null;
  13117. }
  13118. set parentElement(value) {
  13119. this.parentNode = value;
  13120. }
  13121. get previousSibling() {
  13122. if (this.parentNode != null) {
  13123. const index = this.parentNode.childNodes.indexOf(this) - 1;
  13124. return this.parentNode.childNodes[index] || null;
  13125. }
  13126. return null;
  13127. }
  13128. contains(otherNode) {
  13129. if (otherNode === this) {
  13130. return true;
  13131. }
  13132. const childNodes = Array.from(this.childNodes);
  13133. if (childNodes.includes(otherNode)) {
  13134. return true;
  13135. }
  13136. return childNodes.some((node) => this.contains.bind(node)(otherNode));
  13137. }
  13138. removeChild(childNode) {
  13139. const index = this.childNodes.indexOf(childNode);
  13140. if (index > -1) {
  13141. this.childNodes.splice(index, 1);
  13142. if (this.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  13143. const wasConnected = this.isConnected;
  13144. childNode.parentNode = null;
  13145. if (wasConnected === true) {
  13146. disconnectNode(childNode);
  13147. }
  13148. }
  13149. else {
  13150. childNode.parentNode = null;
  13151. }
  13152. }
  13153. else {
  13154. throw new Error(`node not found within childNodes during removeChild`);
  13155. }
  13156. return childNode;
  13157. }
  13158. remove() {
  13159. if (this.parentNode != null) {
  13160. this.parentNode.removeChild(this);
  13161. }
  13162. }
  13163. replaceChild(newChild, oldChild) {
  13164. if (oldChild.parentNode === this) {
  13165. this.insertBefore(newChild, oldChild);
  13166. oldChild.remove();
  13167. return newChild;
  13168. }
  13169. return null;
  13170. }
  13171. get textContent() {
  13172. var _a;
  13173. return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
  13174. }
  13175. set textContent(value) {
  13176. this._nodeValue = String(value);
  13177. }
  13178. }
  13179. MockNode.ELEMENT_NODE = 1;
  13180. MockNode.TEXT_NODE = 3;
  13181. MockNode.PROCESSING_INSTRUCTION_NODE = 7;
  13182. MockNode.COMMENT_NODE = 8;
  13183. MockNode.DOCUMENT_NODE = 9;
  13184. MockNode.DOCUMENT_TYPE_NODE = 10;
  13185. MockNode.DOCUMENT_FRAGMENT_NODE = 11;
  13186. class MockNodeList {
  13187. constructor(ownerDocument, childNodes, length) {
  13188. this.ownerDocument = ownerDocument;
  13189. this.childNodes = childNodes;
  13190. this.length = length;
  13191. }
  13192. }
  13193. class MockElement extends MockNode {
  13194. constructor(ownerDocument, nodeName) {
  13195. super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
  13196. this.namespaceURI = null;
  13197. this.__shadowRoot = null;
  13198. this.__attributeMap = null;
  13199. }
  13200. addEventListener(type, handler) {
  13201. addEventListener(this, type, handler);
  13202. }
  13203. attachShadow(_opts) {
  13204. const shadowRoot = this.ownerDocument.createDocumentFragment();
  13205. this.shadowRoot = shadowRoot;
  13206. return shadowRoot;
  13207. }
  13208. blur() {
  13209. dispatchEvent(this, new MockFocusEvent('blur', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
  13210. }
  13211. get shadowRoot() {
  13212. return this.__shadowRoot || null;
  13213. }
  13214. set shadowRoot(shadowRoot) {
  13215. if (shadowRoot != null) {
  13216. shadowRoot.host = this;
  13217. this.__shadowRoot = shadowRoot;
  13218. }
  13219. else {
  13220. delete this.__shadowRoot;
  13221. }
  13222. }
  13223. get attributes() {
  13224. if (this.__attributeMap == null) {
  13225. const attrMap = createAttributeProxy(false);
  13226. this.__attributeMap = attrMap;
  13227. return attrMap;
  13228. }
  13229. return this.__attributeMap;
  13230. }
  13231. set attributes(attrs) {
  13232. this.__attributeMap = attrs;
  13233. }
  13234. get children() {
  13235. return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */);
  13236. }
  13237. get childElementCount() {
  13238. return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */).length;
  13239. }
  13240. get className() {
  13241. return this.getAttributeNS(null, 'class') || '';
  13242. }
  13243. set className(value) {
  13244. this.setAttributeNS(null, 'class', value);
  13245. }
  13246. get classList() {
  13247. return new MockClassList(this);
  13248. }
  13249. click() {
  13250. dispatchEvent(this, new MockEvent('click', { bubbles: true, cancelable: true, composed: true }));
  13251. }
  13252. cloneNode(_deep) {
  13253. // implemented on MockElement.prototype from within element.ts
  13254. // @ts-ignore - implemented on MockElement.prototype from within element.ts
  13255. return null;
  13256. }
  13257. closest(selector) {
  13258. let elm = this;
  13259. while (elm != null) {
  13260. if (elm.matches(selector)) {
  13261. return elm;
  13262. }
  13263. elm = elm.parentNode;
  13264. }
  13265. return null;
  13266. }
  13267. get dataset() {
  13268. return dataset(this);
  13269. }
  13270. get dir() {
  13271. return this.getAttributeNS(null, 'dir') || '';
  13272. }
  13273. set dir(value) {
  13274. this.setAttributeNS(null, 'dir', value);
  13275. }
  13276. dispatchEvent(ev) {
  13277. return dispatchEvent(this, ev);
  13278. }
  13279. get firstElementChild() {
  13280. return this.children[0] || null;
  13281. }
  13282. focus(_options) {
  13283. dispatchEvent(this, new MockFocusEvent('focus', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
  13284. }
  13285. getAttribute(attrName) {
  13286. if (attrName === 'style') {
  13287. if (this.__style != null && this.__style.length > 0) {
  13288. return this.style.cssText;
  13289. }
  13290. return null;
  13291. }
  13292. const attr = this.attributes.getNamedItem(attrName);
  13293. if (attr != null) {
  13294. return attr.value;
  13295. }
  13296. return null;
  13297. }
  13298. getAttributeNS(namespaceURI, attrName) {
  13299. const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
  13300. if (attr != null) {
  13301. return attr.value;
  13302. }
  13303. return null;
  13304. }
  13305. getBoundingClientRect() {
  13306. return { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };
  13307. }
  13308. getRootNode(opts) {
  13309. const isComposed = opts != null && opts.composed === true;
  13310. let node = this;
  13311. while (node.parentNode != null) {
  13312. node = node.parentNode;
  13313. if (isComposed === true && node.parentNode == null && node.host != null) {
  13314. node = node.host;
  13315. }
  13316. }
  13317. return node;
  13318. }
  13319. get draggable() {
  13320. return this.getAttributeNS(null, 'draggable') === 'true';
  13321. }
  13322. set draggable(value) {
  13323. this.setAttributeNS(null, 'draggable', value);
  13324. }
  13325. hasChildNodes() {
  13326. return this.childNodes.length > 0;
  13327. }
  13328. get id() {
  13329. return this.getAttributeNS(null, 'id') || '';
  13330. }
  13331. set id(value) {
  13332. this.setAttributeNS(null, 'id', value);
  13333. }
  13334. get innerHTML() {
  13335. if (this.childNodes.length === 0) {
  13336. return '';
  13337. }
  13338. return serializeNodeToHtml(this, {
  13339. newLines: false,
  13340. indentSpaces: 0,
  13341. });
  13342. }
  13343. set innerHTML(html) {
  13344. var _a;
  13345. if (NON_ESCAPABLE_CONTENT.has((_a = this.nodeName) !== null && _a !== void 0 ? _a : '') === true) {
  13346. setTextContent(this, html);
  13347. }
  13348. else {
  13349. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  13350. this.removeChild(this.childNodes[i]);
  13351. }
  13352. if (typeof html === 'string') {
  13353. const frag = parseFragmentUtil(this.ownerDocument, html);
  13354. while (frag.childNodes.length > 0) {
  13355. this.appendChild(frag.childNodes[0]);
  13356. }
  13357. }
  13358. }
  13359. }
  13360. get innerText() {
  13361. const text = [];
  13362. getTextContent(this.childNodes, text);
  13363. return text.join('');
  13364. }
  13365. set innerText(value) {
  13366. setTextContent(this, value);
  13367. }
  13368. insertAdjacentElement(position, elm) {
  13369. if (position === 'beforebegin') {
  13370. insertBefore(this.parentNode, elm, this);
  13371. }
  13372. else if (position === 'afterbegin') {
  13373. this.prepend(elm);
  13374. }
  13375. else if (position === 'beforeend') {
  13376. this.appendChild(elm);
  13377. }
  13378. else if (position === 'afterend') {
  13379. insertBefore(this.parentNode, elm, this.nextSibling);
  13380. }
  13381. return elm;
  13382. }
  13383. insertAdjacentHTML(position, html) {
  13384. const frag = parseFragmentUtil(this.ownerDocument, html);
  13385. if (position === 'beforebegin') {
  13386. while (frag.childNodes.length > 0) {
  13387. insertBefore(this.parentNode, frag.childNodes[0], this);
  13388. }
  13389. }
  13390. else if (position === 'afterbegin') {
  13391. while (frag.childNodes.length > 0) {
  13392. this.prepend(frag.childNodes[frag.childNodes.length - 1]);
  13393. }
  13394. }
  13395. else if (position === 'beforeend') {
  13396. while (frag.childNodes.length > 0) {
  13397. this.appendChild(frag.childNodes[0]);
  13398. }
  13399. }
  13400. else if (position === 'afterend') {
  13401. while (frag.childNodes.length > 0) {
  13402. insertBefore(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
  13403. }
  13404. }
  13405. }
  13406. insertAdjacentText(position, text) {
  13407. const elm = this.ownerDocument.createTextNode(text);
  13408. if (position === 'beforebegin') {
  13409. insertBefore(this.parentNode, elm, this);
  13410. }
  13411. else if (position === 'afterbegin') {
  13412. this.prepend(elm);
  13413. }
  13414. else if (position === 'beforeend') {
  13415. this.appendChild(elm);
  13416. }
  13417. else if (position === 'afterend') {
  13418. insertBefore(this.parentNode, elm, this.nextSibling);
  13419. }
  13420. }
  13421. hasAttribute(attrName) {
  13422. if (attrName === 'style') {
  13423. return this.__style != null && this.__style.length > 0;
  13424. }
  13425. return this.getAttribute(attrName) !== null;
  13426. }
  13427. hasAttributeNS(namespaceURI, name) {
  13428. return this.getAttributeNS(namespaceURI, name) !== null;
  13429. }
  13430. get hidden() {
  13431. return this.hasAttributeNS(null, 'hidden');
  13432. }
  13433. set hidden(isHidden) {
  13434. if (isHidden === true) {
  13435. this.setAttributeNS(null, 'hidden', '');
  13436. }
  13437. else {
  13438. this.removeAttributeNS(null, 'hidden');
  13439. }
  13440. }
  13441. get lang() {
  13442. return this.getAttributeNS(null, 'lang') || '';
  13443. }
  13444. set lang(value) {
  13445. this.setAttributeNS(null, 'lang', value);
  13446. }
  13447. get lastElementChild() {
  13448. const children = this.children;
  13449. return children[children.length - 1] || null;
  13450. }
  13451. matches(selector) {
  13452. return matches(selector, this);
  13453. }
  13454. get nextElementSibling() {
  13455. const parentElement = this.parentElement;
  13456. if (parentElement != null &&
  13457. (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
  13458. parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
  13459. parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
  13460. const children = parentElement.children;
  13461. const index = children.indexOf(this) + 1;
  13462. return parentElement.children[index] || null;
  13463. }
  13464. return null;
  13465. }
  13466. get outerHTML() {
  13467. return serializeNodeToHtml(this, {
  13468. newLines: false,
  13469. outerHtml: true,
  13470. indentSpaces: 0,
  13471. });
  13472. }
  13473. get previousElementSibling() {
  13474. const parentElement = this.parentElement;
  13475. if (parentElement != null &&
  13476. (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
  13477. parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
  13478. parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
  13479. const children = parentElement.children;
  13480. const index = children.indexOf(this) - 1;
  13481. return parentElement.children[index] || null;
  13482. }
  13483. return null;
  13484. }
  13485. getElementsByClassName(classNames) {
  13486. const classes = classNames
  13487. .trim()
  13488. .split(' ')
  13489. .filter((c) => c.length > 0);
  13490. const results = [];
  13491. getElementsByClassName(this, classes, results);
  13492. return results;
  13493. }
  13494. getElementsByTagName(tagName) {
  13495. const results = [];
  13496. getElementsByTagName(this, tagName.toLowerCase(), results);
  13497. return results;
  13498. }
  13499. querySelector(selector) {
  13500. return selectOne(selector, this);
  13501. }
  13502. querySelectorAll(selector) {
  13503. return selectAll(selector, this);
  13504. }
  13505. removeAttribute(attrName) {
  13506. if (attrName === 'style') {
  13507. delete this.__style;
  13508. }
  13509. else {
  13510. const attr = this.attributes.getNamedItem(attrName);
  13511. if (attr != null) {
  13512. this.attributes.removeNamedItemNS(attr);
  13513. if (checkAttributeChanged(this) === true) {
  13514. attributeChanged(this, attrName, attr.value, null);
  13515. }
  13516. }
  13517. }
  13518. }
  13519. removeAttributeNS(namespaceURI, attrName) {
  13520. const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
  13521. if (attr != null) {
  13522. this.attributes.removeNamedItemNS(attr);
  13523. if (checkAttributeChanged(this) === true) {
  13524. attributeChanged(this, attrName, attr.value, null);
  13525. }
  13526. }
  13527. }
  13528. removeEventListener(type, handler) {
  13529. removeEventListener(this, type, handler);
  13530. }
  13531. setAttribute(attrName, value) {
  13532. if (attrName === 'style') {
  13533. this.style = value;
  13534. }
  13535. else {
  13536. const attributes = this.attributes;
  13537. let attr = attributes.getNamedItem(attrName);
  13538. const checkAttrChanged = checkAttributeChanged(this);
  13539. if (attr != null) {
  13540. if (checkAttrChanged === true) {
  13541. const oldValue = attr.value;
  13542. attr.value = value;
  13543. if (oldValue !== attr.value) {
  13544. attributeChanged(this, attr.name, oldValue, attr.value);
  13545. }
  13546. }
  13547. else {
  13548. attr.value = value;
  13549. }
  13550. }
  13551. else {
  13552. if (attributes.caseInsensitive) {
  13553. attrName = attrName.toLowerCase();
  13554. }
  13555. attr = new MockAttr(attrName, value);
  13556. attributes.__items.push(attr);
  13557. if (checkAttrChanged === true) {
  13558. attributeChanged(this, attrName, null, attr.value);
  13559. }
  13560. }
  13561. }
  13562. }
  13563. setAttributeNS(namespaceURI, attrName, value) {
  13564. const attributes = this.attributes;
  13565. let attr = attributes.getNamedItemNS(namespaceURI, attrName);
  13566. const checkAttrChanged = checkAttributeChanged(this);
  13567. if (attr != null) {
  13568. if (checkAttrChanged === true) {
  13569. const oldValue = attr.value;
  13570. attr.value = value;
  13571. if (oldValue !== attr.value) {
  13572. attributeChanged(this, attr.name, oldValue, attr.value);
  13573. }
  13574. }
  13575. else {
  13576. attr.value = value;
  13577. }
  13578. }
  13579. else {
  13580. attr = new MockAttr(attrName, value, namespaceURI);
  13581. attributes.__items.push(attr);
  13582. if (checkAttrChanged === true) {
  13583. attributeChanged(this, attrName, null, attr.value);
  13584. }
  13585. }
  13586. }
  13587. get style() {
  13588. if (this.__style == null) {
  13589. this.__style = createCSSStyleDeclaration();
  13590. }
  13591. return this.__style;
  13592. }
  13593. set style(val) {
  13594. if (typeof val === 'string') {
  13595. if (this.__style == null) {
  13596. this.__style = createCSSStyleDeclaration();
  13597. }
  13598. this.__style.cssText = val;
  13599. }
  13600. else {
  13601. this.__style = val;
  13602. }
  13603. }
  13604. get tabIndex() {
  13605. return parseInt(this.getAttributeNS(null, 'tabindex') || '-1', 10);
  13606. }
  13607. set tabIndex(value) {
  13608. this.setAttributeNS(null, 'tabindex', value);
  13609. }
  13610. get tagName() {
  13611. var _a;
  13612. return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
  13613. }
  13614. set tagName(value) {
  13615. this.nodeName = value;
  13616. }
  13617. get textContent() {
  13618. const text = [];
  13619. getTextContent(this.childNodes, text);
  13620. return text.join('');
  13621. }
  13622. set textContent(value) {
  13623. setTextContent(this, value);
  13624. }
  13625. get title() {
  13626. return this.getAttributeNS(null, 'title') || '';
  13627. }
  13628. set title(value) {
  13629. this.setAttributeNS(null, 'title', value);
  13630. }
  13631. animate() {
  13632. /**/
  13633. }
  13634. onanimationstart() {
  13635. /**/
  13636. }
  13637. onanimationend() {
  13638. /**/
  13639. }
  13640. onanimationiteration() {
  13641. /**/
  13642. }
  13643. onabort() {
  13644. /**/
  13645. }
  13646. onauxclick() {
  13647. /**/
  13648. }
  13649. onbeforecopy() {
  13650. /**/
  13651. }
  13652. onbeforecut() {
  13653. /**/
  13654. }
  13655. onbeforepaste() {
  13656. /**/
  13657. }
  13658. onblur() {
  13659. /**/
  13660. }
  13661. oncancel() {
  13662. /**/
  13663. }
  13664. oncanplay() {
  13665. /**/
  13666. }
  13667. oncanplaythrough() {
  13668. /**/
  13669. }
  13670. onchange() {
  13671. /**/
  13672. }
  13673. onclick() {
  13674. /**/
  13675. }
  13676. onclose() {
  13677. /**/
  13678. }
  13679. oncontextmenu() {
  13680. /**/
  13681. }
  13682. oncopy() {
  13683. /**/
  13684. }
  13685. oncuechange() {
  13686. /**/
  13687. }
  13688. oncut() {
  13689. /**/
  13690. }
  13691. ondblclick() {
  13692. /**/
  13693. }
  13694. ondrag() {
  13695. /**/
  13696. }
  13697. ondragend() {
  13698. /**/
  13699. }
  13700. ondragenter() {
  13701. /**/
  13702. }
  13703. ondragleave() {
  13704. /**/
  13705. }
  13706. ondragover() {
  13707. /**/
  13708. }
  13709. ondragstart() {
  13710. /**/
  13711. }
  13712. ondrop() {
  13713. /**/
  13714. }
  13715. ondurationchange() {
  13716. /**/
  13717. }
  13718. onemptied() {
  13719. /**/
  13720. }
  13721. onended() {
  13722. /**/
  13723. }
  13724. onerror() {
  13725. /**/
  13726. }
  13727. onfocus() {
  13728. /**/
  13729. }
  13730. onfocusin() {
  13731. /**/
  13732. }
  13733. onfocusout() {
  13734. /**/
  13735. }
  13736. onformdata() {
  13737. /**/
  13738. }
  13739. onfullscreenchange() {
  13740. /**/
  13741. }
  13742. onfullscreenerror() {
  13743. /**/
  13744. }
  13745. ongotpointercapture() {
  13746. /**/
  13747. }
  13748. oninput() {
  13749. /**/
  13750. }
  13751. oninvalid() {
  13752. /**/
  13753. }
  13754. onkeydown() {
  13755. /**/
  13756. }
  13757. onkeypress() {
  13758. /**/
  13759. }
  13760. onkeyup() {
  13761. /**/
  13762. }
  13763. onload() {
  13764. /**/
  13765. }
  13766. onloadeddata() {
  13767. /**/
  13768. }
  13769. onloadedmetadata() {
  13770. /**/
  13771. }
  13772. onloadstart() {
  13773. /**/
  13774. }
  13775. onlostpointercapture() {
  13776. /**/
  13777. }
  13778. onmousedown() {
  13779. /**/
  13780. }
  13781. onmouseenter() {
  13782. /**/
  13783. }
  13784. onmouseleave() {
  13785. /**/
  13786. }
  13787. onmousemove() {
  13788. /**/
  13789. }
  13790. onmouseout() {
  13791. /**/
  13792. }
  13793. onmouseover() {
  13794. /**/
  13795. }
  13796. onmouseup() {
  13797. /**/
  13798. }
  13799. onmousewheel() {
  13800. /**/
  13801. }
  13802. onpaste() {
  13803. /**/
  13804. }
  13805. onpause() {
  13806. /**/
  13807. }
  13808. onplay() {
  13809. /**/
  13810. }
  13811. onplaying() {
  13812. /**/
  13813. }
  13814. onpointercancel() {
  13815. /**/
  13816. }
  13817. onpointerdown() {
  13818. /**/
  13819. }
  13820. onpointerenter() {
  13821. /**/
  13822. }
  13823. onpointerleave() {
  13824. /**/
  13825. }
  13826. onpointermove() {
  13827. /**/
  13828. }
  13829. onpointerout() {
  13830. /**/
  13831. }
  13832. onpointerover() {
  13833. /**/
  13834. }
  13835. onpointerup() {
  13836. /**/
  13837. }
  13838. onprogress() {
  13839. /**/
  13840. }
  13841. onratechange() {
  13842. /**/
  13843. }
  13844. onreset() {
  13845. /**/
  13846. }
  13847. onresize() {
  13848. /**/
  13849. }
  13850. onscroll() {
  13851. /**/
  13852. }
  13853. onsearch() {
  13854. /**/
  13855. }
  13856. onseeked() {
  13857. /**/
  13858. }
  13859. onseeking() {
  13860. /**/
  13861. }
  13862. onselect() {
  13863. /**/
  13864. }
  13865. onselectstart() {
  13866. /**/
  13867. }
  13868. onstalled() {
  13869. /**/
  13870. }
  13871. onsubmit() {
  13872. /**/
  13873. }
  13874. onsuspend() {
  13875. /**/
  13876. }
  13877. ontimeupdate() {
  13878. /**/
  13879. }
  13880. ontoggle() {
  13881. /**/
  13882. }
  13883. onvolumechange() {
  13884. /**/
  13885. }
  13886. onwaiting() {
  13887. /**/
  13888. }
  13889. onwebkitfullscreenchange() {
  13890. /**/
  13891. }
  13892. onwebkitfullscreenerror() {
  13893. /**/
  13894. }
  13895. onwheel() {
  13896. /**/
  13897. }
  13898. requestFullscreen() {
  13899. /**/
  13900. }
  13901. scrollBy() {
  13902. /**/
  13903. }
  13904. scrollTo() {
  13905. /**/
  13906. }
  13907. scrollIntoView() {
  13908. /**/
  13909. }
  13910. toString(opts) {
  13911. return serializeNodeToHtml(this, opts);
  13912. }
  13913. }
  13914. function getElementsByClassName(elm, classNames, foundElms) {
  13915. const children = elm.children;
  13916. for (let i = 0, ii = children.length; i < ii; i++) {
  13917. const childElm = children[i];
  13918. for (let j = 0, jj = classNames.length; j < jj; j++) {
  13919. if (childElm.classList.contains(classNames[j])) {
  13920. foundElms.push(childElm);
  13921. }
  13922. }
  13923. getElementsByClassName(childElm, classNames, foundElms);
  13924. }
  13925. }
  13926. function getElementsByTagName(elm, tagName, foundElms) {
  13927. var _a;
  13928. const children = elm.children;
  13929. for (let i = 0, ii = children.length; i < ii; i++) {
  13930. const childElm = children[i];
  13931. if (tagName === '*' || ((_a = childElm.nodeName) !== null && _a !== void 0 ? _a : '').toLowerCase() === tagName) {
  13932. foundElms.push(childElm);
  13933. }
  13934. getElementsByTagName(childElm, tagName, foundElms);
  13935. }
  13936. }
  13937. function resetElement(elm) {
  13938. resetEventListeners(elm);
  13939. delete elm.__attributeMap;
  13940. delete elm.__shadowRoot;
  13941. delete elm.__style;
  13942. }
  13943. function insertBefore(parentNode, newNode, referenceNode) {
  13944. if (newNode !== referenceNode) {
  13945. newNode.remove();
  13946. newNode.parentNode = parentNode;
  13947. newNode.ownerDocument = parentNode.ownerDocument;
  13948. if (referenceNode != null) {
  13949. const index = parentNode.childNodes.indexOf(referenceNode);
  13950. if (index > -1) {
  13951. parentNode.childNodes.splice(index, 0, newNode);
  13952. }
  13953. else {
  13954. throw new Error(`referenceNode not found in parentNode.childNodes`);
  13955. }
  13956. }
  13957. else {
  13958. parentNode.childNodes.push(newNode);
  13959. }
  13960. connectNode(parentNode.ownerDocument, newNode);
  13961. }
  13962. return newNode;
  13963. }
  13964. class MockHTMLElement extends MockElement {
  13965. constructor(ownerDocument, nodeName) {
  13966. super(ownerDocument, typeof nodeName === 'string' ? nodeName.toUpperCase() : null);
  13967. this.namespaceURI = 'http://www.w3.org/1999/xhtml';
  13968. }
  13969. get tagName() {
  13970. var _a;
  13971. return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
  13972. }
  13973. set tagName(value) {
  13974. this.nodeName = value;
  13975. }
  13976. get attributes() {
  13977. if (this.__attributeMap == null) {
  13978. const attrMap = createAttributeProxy(true);
  13979. this.__attributeMap = attrMap;
  13980. return attrMap;
  13981. }
  13982. return this.__attributeMap;
  13983. }
  13984. set attributes(attrs) {
  13985. this.__attributeMap = attrs;
  13986. }
  13987. }
  13988. class MockTextNode extends MockNode {
  13989. constructor(ownerDocument, text) {
  13990. super(ownerDocument, 3 /* NODE_TYPES.TEXT_NODE */, "#text" /* NODE_NAMES.TEXT_NODE */, text);
  13991. }
  13992. cloneNode(_deep) {
  13993. return new MockTextNode(null, this.nodeValue);
  13994. }
  13995. get textContent() {
  13996. return this.nodeValue;
  13997. }
  13998. set textContent(text) {
  13999. this.nodeValue = text;
  14000. }
  14001. get data() {
  14002. return this.nodeValue;
  14003. }
  14004. set data(text) {
  14005. this.nodeValue = text;
  14006. }
  14007. get wholeText() {
  14008. if (this.parentNode != null) {
  14009. const text = [];
  14010. for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
  14011. const childNode = this.parentNode.childNodes[i];
  14012. if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  14013. text.push(childNode.nodeValue);
  14014. }
  14015. }
  14016. return text.join('');
  14017. }
  14018. return this.nodeValue;
  14019. }
  14020. }
  14021. function getTextContent(childNodes, text) {
  14022. for (let i = 0, ii = childNodes.length; i < ii; i++) {
  14023. const childNode = childNodes[i];
  14024. if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  14025. text.push(childNode.nodeValue);
  14026. }
  14027. else if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  14028. getTextContent(childNode.childNodes, text);
  14029. }
  14030. }
  14031. }
  14032. function setTextContent(elm, text) {
  14033. for (let i = elm.childNodes.length - 1; i >= 0; i--) {
  14034. elm.removeChild(elm.childNodes[i]);
  14035. }
  14036. const textNode = new MockTextNode(elm.ownerDocument, text);
  14037. elm.appendChild(textNode);
  14038. }
  14039. class MockComment extends MockNode {
  14040. constructor(ownerDocument, data) {
  14041. super(ownerDocument, 8 /* NODE_TYPES.COMMENT_NODE */, "#comment" /* NODE_NAMES.COMMENT_NODE */, data);
  14042. }
  14043. cloneNode(_deep) {
  14044. return new MockComment(null, this.nodeValue);
  14045. }
  14046. get textContent() {
  14047. return this.nodeValue;
  14048. }
  14049. set textContent(text) {
  14050. this.nodeValue = text;
  14051. }
  14052. }
  14053. class MockDocumentFragment extends MockHTMLElement {
  14054. constructor(ownerDocument) {
  14055. super(ownerDocument, null);
  14056. this.nodeName = "#document-fragment" /* NODE_NAMES.DOCUMENT_FRAGMENT_NODE */;
  14057. this.nodeType = 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */;
  14058. }
  14059. getElementById(id) {
  14060. return getElementById(this, id);
  14061. }
  14062. cloneNode(deep) {
  14063. const cloned = new MockDocumentFragment(null);
  14064. if (deep) {
  14065. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  14066. const childNode = this.childNodes[i];
  14067. if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
  14068. childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ ||
  14069. childNode.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
  14070. const clonedChildNode = this.childNodes[i].cloneNode(true);
  14071. cloned.appendChild(clonedChildNode);
  14072. }
  14073. }
  14074. }
  14075. return cloned;
  14076. }
  14077. }
  14078. class MockDocumentTypeNode extends MockHTMLElement {
  14079. constructor(ownerDocument) {
  14080. super(ownerDocument, '!DOCTYPE');
  14081. this.nodeType = 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
  14082. this.setAttribute('html', '');
  14083. }
  14084. }
  14085. class MockCSSRule {
  14086. constructor(parentStyleSheet) {
  14087. this.parentStyleSheet = parentStyleSheet;
  14088. this.cssText = '';
  14089. this.type = 0;
  14090. }
  14091. }
  14092. class MockCSSStyleSheet {
  14093. constructor(ownerNode) {
  14094. this.type = 'text/css';
  14095. this.parentStyleSheet = null;
  14096. this.cssRules = [];
  14097. this.ownerNode = ownerNode;
  14098. }
  14099. get rules() {
  14100. return this.cssRules;
  14101. }
  14102. set rules(rules) {
  14103. this.cssRules = rules;
  14104. }
  14105. deleteRule(index) {
  14106. if (index >= 0 && index < this.cssRules.length) {
  14107. this.cssRules.splice(index, 1);
  14108. updateStyleTextNode(this.ownerNode);
  14109. }
  14110. }
  14111. insertRule(rule, index = 0) {
  14112. if (typeof index !== 'number') {
  14113. index = 0;
  14114. }
  14115. if (index < 0) {
  14116. index = 0;
  14117. }
  14118. if (index > this.cssRules.length) {
  14119. index = this.cssRules.length;
  14120. }
  14121. const cssRule = new MockCSSRule(this);
  14122. cssRule.cssText = rule;
  14123. this.cssRules.splice(index, 0, cssRule);
  14124. updateStyleTextNode(this.ownerNode);
  14125. return index;
  14126. }
  14127. }
  14128. function getStyleElementText(styleElm) {
  14129. const output = [];
  14130. for (let i = 0; i < styleElm.childNodes.length; i++) {
  14131. output.push(styleElm.childNodes[i].nodeValue);
  14132. }
  14133. return output.join('');
  14134. }
  14135. function setStyleElementText(styleElm, text) {
  14136. // keeping the innerHTML and the sheet.cssRules connected
  14137. // is not technically correct, but since we're doing
  14138. // SSR we'll need to turn any assigned cssRules into
  14139. // real text, not just properties that aren't rendered
  14140. const sheet = styleElm.sheet;
  14141. sheet.cssRules.length = 0;
  14142. sheet.insertRule(text);
  14143. updateStyleTextNode(styleElm);
  14144. }
  14145. function updateStyleTextNode(styleElm) {
  14146. const childNodeLen = styleElm.childNodes.length;
  14147. if (childNodeLen > 1) {
  14148. for (let i = childNodeLen - 1; i >= 1; i--) {
  14149. styleElm.removeChild(styleElm.childNodes[i]);
  14150. }
  14151. }
  14152. else if (childNodeLen < 1) {
  14153. styleElm.appendChild(styleElm.ownerDocument.createTextNode(''));
  14154. }
  14155. const textNode = styleElm.childNodes[0];
  14156. textNode.nodeValue = styleElm.sheet.cssRules.map((r) => r.cssText).join('\n');
  14157. }
  14158. function createElement(ownerDocument, tagName) {
  14159. if (typeof tagName !== 'string' || tagName === '' || !/^[a-z0-9-_:]+$/i.test(tagName)) {
  14160. throw new Error(`The tag name provided (${tagName}) is not a valid name.`);
  14161. }
  14162. tagName = tagName.toLowerCase();
  14163. switch (tagName) {
  14164. case 'a':
  14165. return new MockAnchorElement(ownerDocument);
  14166. case 'base':
  14167. return new MockBaseElement(ownerDocument);
  14168. case 'button':
  14169. return new MockButtonElement(ownerDocument);
  14170. case 'canvas':
  14171. return new MockCanvasElement(ownerDocument);
  14172. case 'form':
  14173. return new MockFormElement(ownerDocument);
  14174. case 'img':
  14175. return new MockImageElement(ownerDocument);
  14176. case 'input':
  14177. return new MockInputElement(ownerDocument);
  14178. case 'link':
  14179. return new MockLinkElement(ownerDocument);
  14180. case 'meta':
  14181. return new MockMetaElement(ownerDocument);
  14182. case 'script':
  14183. return new MockScriptElement(ownerDocument);
  14184. case 'style':
  14185. return new MockStyleElement(ownerDocument);
  14186. case 'template':
  14187. return new MockTemplateElement(ownerDocument);
  14188. case 'title':
  14189. return new MockTitleElement(ownerDocument);
  14190. }
  14191. if (ownerDocument != null && tagName.includes('-')) {
  14192. const win = ownerDocument.defaultView;
  14193. if (win != null && win.customElements != null) {
  14194. return createCustomElement(win.customElements, ownerDocument, tagName);
  14195. }
  14196. }
  14197. return new MockHTMLElement(ownerDocument, tagName);
  14198. }
  14199. function createElementNS(ownerDocument, namespaceURI, tagName) {
  14200. if (namespaceURI === 'http://www.w3.org/1999/xhtml') {
  14201. return createElement(ownerDocument, tagName);
  14202. }
  14203. else if (namespaceURI === 'http://www.w3.org/2000/svg') {
  14204. switch (tagName.toLowerCase()) {
  14205. case 'text':
  14206. case 'tspan':
  14207. case 'tref':
  14208. case 'altglyph':
  14209. case 'textpath':
  14210. return new MockSVGTextContentElement(ownerDocument, tagName);
  14211. case 'circle':
  14212. case 'ellipse':
  14213. case 'image':
  14214. case 'line':
  14215. case 'path':
  14216. case 'polygon':
  14217. case 'polyline':
  14218. case 'rect':
  14219. case 'use':
  14220. return new MockSVGGraphicsElement(ownerDocument, tagName);
  14221. case 'svg':
  14222. return new MockSVGSVGElement(ownerDocument, tagName);
  14223. default:
  14224. return new MockSVGElement(ownerDocument, tagName);
  14225. }
  14226. }
  14227. else {
  14228. return new MockElement(ownerDocument, tagName);
  14229. }
  14230. }
  14231. class MockAnchorElement extends MockHTMLElement {
  14232. constructor(ownerDocument) {
  14233. super(ownerDocument, 'a');
  14234. }
  14235. get href() {
  14236. return fullUrl(this, 'href');
  14237. }
  14238. set href(value) {
  14239. this.setAttribute('href', value);
  14240. }
  14241. get pathname() {
  14242. return new URL(this.href).pathname;
  14243. }
  14244. }
  14245. class MockButtonElement extends MockHTMLElement {
  14246. constructor(ownerDocument) {
  14247. super(ownerDocument, 'button');
  14248. }
  14249. }
  14250. patchPropAttributes(MockButtonElement.prototype, {
  14251. type: String,
  14252. }, {
  14253. type: 'submit',
  14254. });
  14255. class MockImageElement extends MockHTMLElement {
  14256. constructor(ownerDocument) {
  14257. super(ownerDocument, 'img');
  14258. }
  14259. get draggable() {
  14260. return this.getAttributeNS(null, 'draggable') !== 'false';
  14261. }
  14262. set draggable(value) {
  14263. this.setAttributeNS(null, 'draggable', value);
  14264. }
  14265. get src() {
  14266. return fullUrl(this, 'src');
  14267. }
  14268. set src(value) {
  14269. this.setAttribute('src', value);
  14270. }
  14271. }
  14272. patchPropAttributes(MockImageElement.prototype, {
  14273. height: Number,
  14274. width: Number,
  14275. });
  14276. class MockInputElement extends MockHTMLElement {
  14277. constructor(ownerDocument) {
  14278. super(ownerDocument, 'input');
  14279. }
  14280. get list() {
  14281. const listId = this.getAttribute('list');
  14282. if (listId) {
  14283. return this.ownerDocument.getElementById(listId);
  14284. }
  14285. return null;
  14286. }
  14287. }
  14288. patchPropAttributes(MockInputElement.prototype, {
  14289. accept: String,
  14290. autocomplete: String,
  14291. autofocus: Boolean,
  14292. capture: String,
  14293. checked: Boolean,
  14294. disabled: Boolean,
  14295. form: String,
  14296. formaction: String,
  14297. formenctype: String,
  14298. formmethod: String,
  14299. formnovalidate: String,
  14300. formtarget: String,
  14301. height: Number,
  14302. inputmode: String,
  14303. max: String,
  14304. maxLength: Number,
  14305. min: String,
  14306. minLength: Number,
  14307. multiple: Boolean,
  14308. name: String,
  14309. pattern: String,
  14310. placeholder: String,
  14311. required: Boolean,
  14312. readOnly: Boolean,
  14313. size: Number,
  14314. spellCheck: Boolean,
  14315. src: String,
  14316. step: String,
  14317. type: String,
  14318. value: String,
  14319. width: Number,
  14320. }, {
  14321. type: 'text',
  14322. });
  14323. class MockFormElement extends MockHTMLElement {
  14324. constructor(ownerDocument) {
  14325. super(ownerDocument, 'form');
  14326. }
  14327. }
  14328. patchPropAttributes(MockFormElement.prototype, {
  14329. name: String,
  14330. });
  14331. class MockLinkElement extends MockHTMLElement {
  14332. constructor(ownerDocument) {
  14333. super(ownerDocument, 'link');
  14334. }
  14335. get href() {
  14336. return fullUrl(this, 'href');
  14337. }
  14338. set href(value) {
  14339. this.setAttribute('href', value);
  14340. }
  14341. }
  14342. patchPropAttributes(MockLinkElement.prototype, {
  14343. crossorigin: String,
  14344. media: String,
  14345. rel: String,
  14346. type: String,
  14347. });
  14348. class MockMetaElement extends MockHTMLElement {
  14349. constructor(ownerDocument) {
  14350. super(ownerDocument, 'meta');
  14351. }
  14352. }
  14353. patchPropAttributes(MockMetaElement.prototype, {
  14354. charset: String,
  14355. content: String,
  14356. name: String,
  14357. });
  14358. class MockScriptElement extends MockHTMLElement {
  14359. constructor(ownerDocument) {
  14360. super(ownerDocument, 'script');
  14361. }
  14362. get src() {
  14363. return fullUrl(this, 'src');
  14364. }
  14365. set src(value) {
  14366. this.setAttribute('src', value);
  14367. }
  14368. }
  14369. patchPropAttributes(MockScriptElement.prototype, {
  14370. type: String,
  14371. });
  14372. class MockDOMMatrix {
  14373. constructor() {
  14374. this.a = 1;
  14375. this.b = 0;
  14376. this.c = 0;
  14377. this.d = 1;
  14378. this.e = 0;
  14379. this.f = 0;
  14380. this.m11 = 1;
  14381. this.m12 = 0;
  14382. this.m13 = 0;
  14383. this.m14 = 0;
  14384. this.m21 = 0;
  14385. this.m22 = 1;
  14386. this.m23 = 0;
  14387. this.m24 = 0;
  14388. this.m31 = 0;
  14389. this.m32 = 0;
  14390. this.m33 = 1;
  14391. this.m34 = 0;
  14392. this.m41 = 0;
  14393. this.m42 = 0;
  14394. this.m43 = 0;
  14395. this.m44 = 1;
  14396. this.is2D = true;
  14397. this.isIdentity = true;
  14398. }
  14399. static fromMatrix() {
  14400. return new MockDOMMatrix();
  14401. }
  14402. inverse() {
  14403. return new MockDOMMatrix();
  14404. }
  14405. flipX() {
  14406. return new MockDOMMatrix();
  14407. }
  14408. flipY() {
  14409. return new MockDOMMatrix();
  14410. }
  14411. multiply() {
  14412. return new MockDOMMatrix();
  14413. }
  14414. rotate() {
  14415. return new MockDOMMatrix();
  14416. }
  14417. rotateAxisAngle() {
  14418. return new MockDOMMatrix();
  14419. }
  14420. rotateFromVector() {
  14421. return new MockDOMMatrix();
  14422. }
  14423. scale() {
  14424. return new MockDOMMatrix();
  14425. }
  14426. scaleNonUniform() {
  14427. return new MockDOMMatrix();
  14428. }
  14429. skewX() {
  14430. return new MockDOMMatrix();
  14431. }
  14432. skewY() {
  14433. return new MockDOMMatrix();
  14434. }
  14435. toJSON() { }
  14436. toString() { }
  14437. transformPoint() {
  14438. return new MockDOMPoint();
  14439. }
  14440. translate() {
  14441. return new MockDOMMatrix();
  14442. }
  14443. }
  14444. class MockDOMPoint {
  14445. constructor() {
  14446. this.w = 1;
  14447. this.x = 0;
  14448. this.y = 0;
  14449. this.z = 0;
  14450. }
  14451. toJSON() { }
  14452. matrixTransform() {
  14453. return new MockDOMMatrix();
  14454. }
  14455. }
  14456. class MockSVGRect {
  14457. constructor() {
  14458. this.height = 10;
  14459. this.width = 10;
  14460. this.x = 0;
  14461. this.y = 0;
  14462. }
  14463. }
  14464. class MockStyleElement extends MockHTMLElement {
  14465. constructor(ownerDocument) {
  14466. super(ownerDocument, 'style');
  14467. this.sheet = new MockCSSStyleSheet(this);
  14468. }
  14469. get innerHTML() {
  14470. return getStyleElementText(this);
  14471. }
  14472. set innerHTML(value) {
  14473. setStyleElementText(this, value);
  14474. }
  14475. get innerText() {
  14476. return getStyleElementText(this);
  14477. }
  14478. set innerText(value) {
  14479. setStyleElementText(this, value);
  14480. }
  14481. get textContent() {
  14482. return getStyleElementText(this);
  14483. }
  14484. set textContent(value) {
  14485. setStyleElementText(this, value);
  14486. }
  14487. }
  14488. class MockSVGElement extends MockElement {
  14489. // SVGElement properties and methods
  14490. get ownerSVGElement() {
  14491. return null;
  14492. }
  14493. get viewportElement() {
  14494. return null;
  14495. }
  14496. onunload() {
  14497. /**/
  14498. }
  14499. // SVGGeometryElement properties and methods
  14500. get pathLength() {
  14501. return 0;
  14502. }
  14503. isPointInFill(_pt) {
  14504. return false;
  14505. }
  14506. isPointInStroke(_pt) {
  14507. return false;
  14508. }
  14509. getTotalLength() {
  14510. return 0;
  14511. }
  14512. }
  14513. class MockSVGGraphicsElement extends MockSVGElement {
  14514. getBBox(_options) {
  14515. return new MockSVGRect();
  14516. }
  14517. getCTM() {
  14518. return new MockDOMMatrix();
  14519. }
  14520. getScreenCTM() {
  14521. return new MockDOMMatrix();
  14522. }
  14523. }
  14524. class MockSVGSVGElement extends MockSVGGraphicsElement {
  14525. createSVGPoint() {
  14526. return new MockDOMPoint();
  14527. }
  14528. }
  14529. class MockSVGTextContentElement extends MockSVGGraphicsElement {
  14530. getComputedTextLength() {
  14531. return 0;
  14532. }
  14533. }
  14534. class MockBaseElement extends MockHTMLElement {
  14535. constructor(ownerDocument) {
  14536. super(ownerDocument, 'base');
  14537. }
  14538. get href() {
  14539. return fullUrl(this, 'href');
  14540. }
  14541. set href(value) {
  14542. this.setAttribute('href', value);
  14543. }
  14544. }
  14545. class MockTemplateElement extends MockHTMLElement {
  14546. constructor(ownerDocument) {
  14547. super(ownerDocument, 'template');
  14548. this.content = new MockDocumentFragment(ownerDocument);
  14549. }
  14550. get innerHTML() {
  14551. return this.content.innerHTML;
  14552. }
  14553. set innerHTML(html) {
  14554. this.content.innerHTML = html;
  14555. }
  14556. cloneNode(deep) {
  14557. const cloned = new MockTemplateElement(null);
  14558. cloned.attributes = cloneAttributes(this.attributes);
  14559. const styleCssText = this.getAttribute('style');
  14560. if (styleCssText != null && styleCssText.length > 0) {
  14561. cloned.setAttribute('style', styleCssText);
  14562. }
  14563. cloned.content = this.content.cloneNode(deep);
  14564. if (deep) {
  14565. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  14566. const clonedChildNode = this.childNodes[i].cloneNode(true);
  14567. cloned.appendChild(clonedChildNode);
  14568. }
  14569. }
  14570. return cloned;
  14571. }
  14572. }
  14573. class MockTitleElement extends MockHTMLElement {
  14574. constructor(ownerDocument) {
  14575. super(ownerDocument, 'title');
  14576. }
  14577. get text() {
  14578. return this.textContent;
  14579. }
  14580. set text(value) {
  14581. this.textContent = value;
  14582. }
  14583. }
  14584. class MockCanvasElement extends MockHTMLElement {
  14585. constructor(ownerDocument) {
  14586. super(ownerDocument, 'canvas');
  14587. }
  14588. getContext() {
  14589. return {
  14590. fillRect() {
  14591. return;
  14592. },
  14593. clearRect() { },
  14594. getImageData: function (_, __, w, h) {
  14595. return {
  14596. data: new Array(w * h * 4),
  14597. };
  14598. },
  14599. putImageData() { },
  14600. createImageData: function () {
  14601. return [];
  14602. },
  14603. setTransform() { },
  14604. drawImage() { },
  14605. save() { },
  14606. fillText() { },
  14607. restore() { },
  14608. beginPath() { },
  14609. moveTo() { },
  14610. lineTo() { },
  14611. closePath() { },
  14612. stroke() { },
  14613. translate() { },
  14614. scale() { },
  14615. rotate() { },
  14616. arc() { },
  14617. fill() { },
  14618. measureText() {
  14619. return { width: 0 };
  14620. },
  14621. transform() { },
  14622. rect() { },
  14623. clip() { },
  14624. };
  14625. }
  14626. }
  14627. function fullUrl(elm, attrName) {
  14628. const val = elm.getAttribute(attrName) || '';
  14629. if (elm.ownerDocument != null) {
  14630. const win = elm.ownerDocument.defaultView;
  14631. if (win != null) {
  14632. const loc = win.location;
  14633. if (loc != null) {
  14634. try {
  14635. const url = new URL(val, loc.href);
  14636. return url.href;
  14637. }
  14638. catch (e) { }
  14639. }
  14640. }
  14641. }
  14642. return val.replace(/\'|\"/g, '').trim();
  14643. }
  14644. function patchPropAttributes(prototype, attrs, defaults = {}) {
  14645. Object.keys(attrs).forEach((propName) => {
  14646. const attr = attrs[propName];
  14647. const defaultValue = defaults[propName];
  14648. if (attr === Boolean) {
  14649. Object.defineProperty(prototype, propName, {
  14650. get() {
  14651. return this.hasAttribute(propName);
  14652. },
  14653. set(value) {
  14654. if (value) {
  14655. this.setAttribute(propName, '');
  14656. }
  14657. else {
  14658. this.removeAttribute(propName);
  14659. }
  14660. },
  14661. });
  14662. }
  14663. else if (attr === Number) {
  14664. Object.defineProperty(prototype, propName, {
  14665. get() {
  14666. const value = this.getAttribute(propName);
  14667. return value ? parseInt(value, 10) : defaultValue === undefined ? 0 : defaultValue;
  14668. },
  14669. set(value) {
  14670. this.setAttribute(propName, value);
  14671. },
  14672. });
  14673. }
  14674. else {
  14675. Object.defineProperty(prototype, propName, {
  14676. get() {
  14677. return this.hasAttribute(propName) ? this.getAttribute(propName) : defaultValue || '';
  14678. },
  14679. set(value) {
  14680. this.setAttribute(propName, value);
  14681. },
  14682. });
  14683. }
  14684. });
  14685. }
  14686. MockElement.prototype.cloneNode = function (deep) {
  14687. // because we're creating elements, which extending specific HTML base classes there
  14688. // is a MockElement circular reference that bundling has trouble dealing with so
  14689. // the fix is to add cloneNode() to MockElement's prototype after the HTML classes
  14690. const cloned = createElement(this.ownerDocument, this.nodeName);
  14691. cloned.attributes = cloneAttributes(this.attributes);
  14692. const styleCssText = this.getAttribute('style');
  14693. if (styleCssText != null && styleCssText.length > 0) {
  14694. cloned.setAttribute('style', styleCssText);
  14695. }
  14696. if (deep) {
  14697. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  14698. const clonedChildNode = this.childNodes[i].cloneNode(true);
  14699. cloned.appendChild(clonedChildNode);
  14700. }
  14701. }
  14702. return cloned;
  14703. };
  14704. let sharedDocument;
  14705. function parseHtmlToDocument(html, ownerDocument = null) {
  14706. if (ownerDocument == null) {
  14707. if (sharedDocument == null) {
  14708. sharedDocument = new MockDocument();
  14709. }
  14710. ownerDocument = sharedDocument;
  14711. }
  14712. return parseDocumentUtil(ownerDocument, html);
  14713. }
  14714. const consoleNoop = () => {
  14715. /**/
  14716. };
  14717. function createConsole() {
  14718. return {
  14719. debug: consoleNoop,
  14720. error: consoleNoop,
  14721. info: consoleNoop,
  14722. log: consoleNoop,
  14723. warn: consoleNoop,
  14724. dir: consoleNoop,
  14725. dirxml: consoleNoop,
  14726. table: consoleNoop,
  14727. trace: consoleNoop,
  14728. group: consoleNoop,
  14729. groupCollapsed: consoleNoop,
  14730. groupEnd: consoleNoop,
  14731. clear: consoleNoop,
  14732. count: consoleNoop,
  14733. countReset: consoleNoop,
  14734. assert: consoleNoop,
  14735. profile: consoleNoop,
  14736. profileEnd: consoleNoop,
  14737. time: consoleNoop,
  14738. timeLog: consoleNoop,
  14739. timeEnd: consoleNoop,
  14740. timeStamp: consoleNoop,
  14741. context: consoleNoop,
  14742. memory: consoleNoop,
  14743. };
  14744. }
  14745. class MockHeaders {
  14746. constructor(init) {
  14747. this._values = [];
  14748. if (typeof init === 'object') {
  14749. if (typeof init[Symbol.iterator] === 'function') {
  14750. const kvs = [];
  14751. for (const kv of init) {
  14752. if (typeof kv[Symbol.iterator] === 'function') {
  14753. kvs.push([...kv]);
  14754. }
  14755. }
  14756. for (const kv of kvs) {
  14757. this.append(kv[0], kv[1]);
  14758. }
  14759. }
  14760. else {
  14761. for (const key in init) {
  14762. this.append(key, init[key]);
  14763. }
  14764. }
  14765. }
  14766. }
  14767. append(key, value) {
  14768. this._values.push([key, value + '']);
  14769. }
  14770. delete(key) {
  14771. key = key.toLowerCase();
  14772. for (let i = this._values.length - 1; i >= 0; i--) {
  14773. if (this._values[i][0].toLowerCase() === key) {
  14774. this._values.splice(i, 1);
  14775. }
  14776. }
  14777. }
  14778. entries() {
  14779. const entries = [];
  14780. for (const kv of this.keys()) {
  14781. entries.push([kv, this.get(kv)]);
  14782. }
  14783. let index = -1;
  14784. return {
  14785. next() {
  14786. index++;
  14787. return {
  14788. value: entries[index],
  14789. done: !entries[index],
  14790. };
  14791. },
  14792. [Symbol.iterator]() {
  14793. return this;
  14794. },
  14795. };
  14796. }
  14797. forEach(cb) {
  14798. for (const kv of this.entries()) {
  14799. cb(kv[1], kv[0]);
  14800. }
  14801. }
  14802. get(key) {
  14803. const rtn = [];
  14804. key = key.toLowerCase();
  14805. for (const kv of this._values) {
  14806. if (kv[0].toLowerCase() === key) {
  14807. rtn.push(kv[1]);
  14808. }
  14809. }
  14810. return rtn.length > 0 ? rtn.join(', ') : null;
  14811. }
  14812. has(key) {
  14813. key = key.toLowerCase();
  14814. for (const kv of this._values) {
  14815. if (kv[0].toLowerCase() === key) {
  14816. return true;
  14817. }
  14818. }
  14819. return false;
  14820. }
  14821. keys() {
  14822. const keys = [];
  14823. for (const kv of this._values) {
  14824. const key = kv[0].toLowerCase();
  14825. if (!keys.includes(key)) {
  14826. keys.push(key);
  14827. }
  14828. }
  14829. let index = -1;
  14830. return {
  14831. next() {
  14832. index++;
  14833. return {
  14834. value: keys[index],
  14835. done: !keys[index],
  14836. };
  14837. },
  14838. [Symbol.iterator]() {
  14839. return this;
  14840. },
  14841. };
  14842. }
  14843. set(key, value) {
  14844. for (const kv of this._values) {
  14845. if (kv[0].toLowerCase() === key.toLowerCase()) {
  14846. kv[1] = value + '';
  14847. return;
  14848. }
  14849. }
  14850. this.append(key, value);
  14851. }
  14852. values() {
  14853. const values = this._values;
  14854. let index = -1;
  14855. return {
  14856. next() {
  14857. index++;
  14858. const done = !values[index];
  14859. return {
  14860. value: done ? undefined : values[index][1],
  14861. done,
  14862. };
  14863. },
  14864. [Symbol.iterator]() {
  14865. return this;
  14866. },
  14867. };
  14868. }
  14869. [Symbol.iterator]() {
  14870. return this.entries();
  14871. }
  14872. }
  14873. class MockDOMParser {
  14874. parseFromString(htmlToParse, mimeType) {
  14875. if (mimeType !== 'text/html') {
  14876. console.error('XML parsing not implemented yet, continuing as html');
  14877. }
  14878. return parseHtmlToDocument(htmlToParse);
  14879. }
  14880. }
  14881. class MockRequest {
  14882. constructor(input, init = {}) {
  14883. this._method = 'GET';
  14884. this._url = '/';
  14885. this.bodyUsed = false;
  14886. this.cache = 'default';
  14887. this.credentials = 'same-origin';
  14888. this.integrity = '';
  14889. this.keepalive = false;
  14890. this.mode = 'cors';
  14891. this.redirect = 'follow';
  14892. this.referrer = 'about:client';
  14893. this.referrerPolicy = '';
  14894. if (typeof input === 'string') {
  14895. this.url = input;
  14896. }
  14897. else if (input) {
  14898. Object.assign(this, input);
  14899. this.headers = new MockHeaders(input.headers);
  14900. }
  14901. Object.assign(this, init);
  14902. if (init.headers) {
  14903. this.headers = new MockHeaders(init.headers);
  14904. }
  14905. if (!this.headers) {
  14906. this.headers = new MockHeaders();
  14907. }
  14908. }
  14909. get url() {
  14910. if (typeof this._url === 'string') {
  14911. return new URL(this._url, location.href).href;
  14912. }
  14913. return new URL('/', location.href).href;
  14914. }
  14915. set url(value) {
  14916. this._url = value;
  14917. }
  14918. get method() {
  14919. if (typeof this._method === 'string') {
  14920. return this._method.toUpperCase();
  14921. }
  14922. return 'GET';
  14923. }
  14924. set method(value) {
  14925. this._method = value;
  14926. }
  14927. clone() {
  14928. const clone = { ...this };
  14929. clone.headers = new MockHeaders(this.headers);
  14930. return new MockRequest(clone);
  14931. }
  14932. }
  14933. class MockResponse {
  14934. constructor(body, init = {}) {
  14935. this.ok = true;
  14936. this.status = 200;
  14937. this.statusText = '';
  14938. this.type = 'default';
  14939. this.url = '';
  14940. this._body = body;
  14941. if (init) {
  14942. Object.assign(this, init);
  14943. }
  14944. this.headers = new MockHeaders(init.headers);
  14945. }
  14946. async json() {
  14947. return JSON.parse(this._body);
  14948. }
  14949. async text() {
  14950. return this._body;
  14951. }
  14952. clone() {
  14953. const initClone = { ...this };
  14954. initClone.headers = new MockHeaders(this.headers);
  14955. return new MockResponse(this._body, initClone);
  14956. }
  14957. }
  14958. function addGlobalsToWindowPrototype(mockWinPrototype) {
  14959. GLOBAL_CONSTRUCTORS.forEach(([cstrName, Cstr]) => {
  14960. Object.defineProperty(mockWinPrototype, cstrName, {
  14961. get() {
  14962. return this['__' + cstrName] || Cstr;
  14963. },
  14964. set(cstr) {
  14965. this['__' + cstrName] = cstr;
  14966. },
  14967. configurable: true,
  14968. enumerable: true,
  14969. });
  14970. });
  14971. }
  14972. const GLOBAL_CONSTRUCTORS = [
  14973. ['CustomEvent', MockCustomEvent],
  14974. ['Event', MockEvent],
  14975. ['Headers', MockHeaders],
  14976. ['FocusEvent', MockFocusEvent],
  14977. ['KeyboardEvent', MockKeyboardEvent],
  14978. ['MouseEvent', MockMouseEvent],
  14979. ['Request', MockRequest],
  14980. ['Response', MockResponse],
  14981. ['DOMParser', MockDOMParser],
  14982. ['HTMLAnchorElement', MockAnchorElement],
  14983. ['HTMLBaseElement', MockBaseElement],
  14984. ['HTMLButtonElement', MockButtonElement],
  14985. ['HTMLCanvasElement', MockCanvasElement],
  14986. ['HTMLFormElement', MockFormElement],
  14987. ['HTMLImageElement', MockImageElement],
  14988. ['HTMLInputElement', MockInputElement],
  14989. ['HTMLLinkElement', MockLinkElement],
  14990. ['HTMLMetaElement', MockMetaElement],
  14991. ['HTMLScriptElement', MockScriptElement],
  14992. ['HTMLStyleElement', MockStyleElement],
  14993. ['HTMLTemplateElement', MockTemplateElement],
  14994. ['HTMLTitleElement', MockTitleElement],
  14995. ];
  14996. class MockHistory {
  14997. constructor() {
  14998. this.items = [];
  14999. }
  15000. get length() {
  15001. return this.items.length;
  15002. }
  15003. back() {
  15004. this.go(-1);
  15005. }
  15006. forward() {
  15007. this.go(1);
  15008. }
  15009. go(_value) {
  15010. //
  15011. }
  15012. pushState(_state, _title, _url) {
  15013. //
  15014. }
  15015. replaceState(_state, _title, _url) {
  15016. //
  15017. }
  15018. }
  15019. class MockIntersectionObserver {
  15020. constructor() {
  15021. /**/
  15022. }
  15023. disconnect() {
  15024. /**/
  15025. }
  15026. observe() {
  15027. /**/
  15028. }
  15029. takeRecords() {
  15030. return [];
  15031. }
  15032. unobserve() {
  15033. /**/
  15034. }
  15035. }
  15036. class MockLocation {
  15037. constructor() {
  15038. this.ancestorOrigins = null;
  15039. this.protocol = '';
  15040. this.host = '';
  15041. this.hostname = '';
  15042. this.port = '';
  15043. this.pathname = '';
  15044. this.search = '';
  15045. this.hash = '';
  15046. this.username = '';
  15047. this.password = '';
  15048. this.origin = '';
  15049. this._href = '';
  15050. }
  15051. get href() {
  15052. return this._href;
  15053. }
  15054. set href(value) {
  15055. const url = new URL(value, 'http://mockdoc.stenciljs.com');
  15056. this._href = url.href;
  15057. this.protocol = url.protocol;
  15058. this.host = url.host;
  15059. this.hostname = url.hostname;
  15060. this.port = url.port;
  15061. this.pathname = url.pathname;
  15062. this.search = url.search;
  15063. this.hash = url.hash;
  15064. this.username = url.username;
  15065. this.password = url.password;
  15066. this.origin = url.origin;
  15067. }
  15068. assign(_url) {
  15069. //
  15070. }
  15071. reload(_forcedReload) {
  15072. //
  15073. }
  15074. replace(_url) {
  15075. //
  15076. }
  15077. toString() {
  15078. return this.href;
  15079. }
  15080. }
  15081. class MockNavigator {
  15082. constructor() {
  15083. this.appCodeName = 'MockNavigator';
  15084. this.appName = 'MockNavigator';
  15085. this.appVersion = 'MockNavigator';
  15086. this.platform = 'MockNavigator';
  15087. this.userAgent = 'MockNavigator';
  15088. }
  15089. }
  15090. /**
  15091. * https://developer.mozilla.org/en-US/docs/Web/API/Performance
  15092. */
  15093. class MockPerformance {
  15094. constructor() {
  15095. this.timeOrigin = Date.now();
  15096. this.eventCounts = new Map();
  15097. }
  15098. addEventListener() {
  15099. //
  15100. }
  15101. clearMarks() {
  15102. //
  15103. }
  15104. clearMeasures() {
  15105. //
  15106. }
  15107. clearResourceTimings() {
  15108. //
  15109. }
  15110. dispatchEvent() {
  15111. return true;
  15112. }
  15113. getEntries() {
  15114. return [];
  15115. }
  15116. getEntriesByName() {
  15117. return [];
  15118. }
  15119. getEntriesByType() {
  15120. return [];
  15121. }
  15122. // Stencil's implementation of `mark` is non-compliant with the `Performance` interface. Because Stencil will
  15123. // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
  15124. // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
  15125. // associated errors returned by the type checker)
  15126. // @ts-ignore
  15127. mark() {
  15128. //
  15129. }
  15130. // Stencil's implementation of `measure` is non-compliant with the `Performance` interface. Because Stencil will
  15131. // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
  15132. // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
  15133. // associated errors returned by the type checker)
  15134. // @ts-ignore
  15135. measure() {
  15136. //
  15137. }
  15138. get navigation() {
  15139. return {};
  15140. }
  15141. now() {
  15142. return Date.now() - this.timeOrigin;
  15143. }
  15144. get onresourcetimingbufferfull() {
  15145. return null;
  15146. }
  15147. removeEventListener() {
  15148. //
  15149. }
  15150. setResourceTimingBufferSize() {
  15151. //
  15152. }
  15153. get timing() {
  15154. return {};
  15155. }
  15156. toJSON() {
  15157. //
  15158. }
  15159. }
  15160. function resetPerformance(perf) {
  15161. if (perf != null) {
  15162. try {
  15163. perf.timeOrigin = Date.now();
  15164. }
  15165. catch (e) { }
  15166. }
  15167. }
  15168. class MockStorage {
  15169. constructor() {
  15170. this.items = new Map();
  15171. }
  15172. key(_value) {
  15173. //
  15174. }
  15175. getItem(key) {
  15176. key = String(key);
  15177. if (this.items.has(key)) {
  15178. return this.items.get(key);
  15179. }
  15180. return null;
  15181. }
  15182. setItem(key, value) {
  15183. if (value == null) {
  15184. value = 'null';
  15185. }
  15186. this.items.set(String(key), String(value));
  15187. }
  15188. removeItem(key) {
  15189. this.items.delete(String(key));
  15190. }
  15191. clear() {
  15192. this.items.clear();
  15193. }
  15194. }
  15195. const nativeClearInterval = clearInterval;
  15196. const nativeClearTimeout = clearTimeout;
  15197. const nativeSetInterval = setInterval;
  15198. const nativeSetTimeout = setTimeout;
  15199. const nativeURL = URL;
  15200. class MockWindow {
  15201. constructor(html = null) {
  15202. if (html !== false) {
  15203. this.document = new MockDocument(html, this);
  15204. }
  15205. else {
  15206. this.document = null;
  15207. }
  15208. this.performance = new MockPerformance();
  15209. this.customElements = new MockCustomElementRegistry(this);
  15210. this.console = createConsole();
  15211. resetWindowDefaults(this);
  15212. resetWindowDimensions(this);
  15213. }
  15214. addEventListener(type, handler) {
  15215. addEventListener(this, type, handler);
  15216. }
  15217. alert(msg) {
  15218. if (this.console) {
  15219. this.console.debug(msg);
  15220. }
  15221. else {
  15222. console.debug(msg);
  15223. }
  15224. }
  15225. blur() {
  15226. /**/
  15227. }
  15228. cancelAnimationFrame(id) {
  15229. this.__clearTimeout(id);
  15230. }
  15231. cancelIdleCallback(id) {
  15232. this.__clearTimeout(id);
  15233. }
  15234. get CharacterData() {
  15235. if (this.__charDataCstr == null) {
  15236. const ownerDocument = this.document;
  15237. this.__charDataCstr = class extends MockNode {
  15238. constructor() {
  15239. super(ownerDocument, 0, 'test', '');
  15240. throw new Error('Illegal constructor: cannot construct CharacterData');
  15241. }
  15242. };
  15243. }
  15244. return this.__charDataCstr;
  15245. }
  15246. set CharacterData(charDataCstr) {
  15247. this.__charDataCstr = charDataCstr;
  15248. }
  15249. clearInterval(id) {
  15250. this.__clearInterval(id);
  15251. }
  15252. clearTimeout(id) {
  15253. this.__clearTimeout(id);
  15254. }
  15255. close() {
  15256. resetWindow(this);
  15257. }
  15258. confirm() {
  15259. return false;
  15260. }
  15261. get CSS() {
  15262. return {
  15263. supports: () => true,
  15264. };
  15265. }
  15266. get Document() {
  15267. if (this.__docCstr == null) {
  15268. const win = this;
  15269. this.__docCstr = class extends MockDocument {
  15270. constructor() {
  15271. super(false, win);
  15272. throw new Error('Illegal constructor: cannot construct Document');
  15273. }
  15274. };
  15275. }
  15276. return this.__docCstr;
  15277. }
  15278. set Document(docCstr) {
  15279. this.__docCstr = docCstr;
  15280. }
  15281. get DocumentFragment() {
  15282. if (this.__docFragCstr == null) {
  15283. const ownerDocument = this.document;
  15284. this.__docFragCstr = class extends MockDocumentFragment {
  15285. constructor() {
  15286. super(ownerDocument);
  15287. throw new Error('Illegal constructor: cannot construct DocumentFragment');
  15288. }
  15289. };
  15290. }
  15291. return this.__docFragCstr;
  15292. }
  15293. set DocumentFragment(docFragCstr) {
  15294. this.__docFragCstr = docFragCstr;
  15295. }
  15296. get DocumentType() {
  15297. if (this.__docTypeCstr == null) {
  15298. const ownerDocument = this.document;
  15299. this.__docTypeCstr = class extends MockNode {
  15300. constructor() {
  15301. super(ownerDocument, 0, 'test', '');
  15302. throw new Error('Illegal constructor: cannot construct DocumentType');
  15303. }
  15304. };
  15305. }
  15306. return this.__docTypeCstr;
  15307. }
  15308. set DocumentType(docTypeCstr) {
  15309. this.__docTypeCstr = docTypeCstr;
  15310. }
  15311. get DOMTokenList() {
  15312. if (this.__domTokenListCstr == null) {
  15313. this.__domTokenListCstr = class MockDOMTokenList {
  15314. };
  15315. }
  15316. return this.__domTokenListCstr;
  15317. }
  15318. set DOMTokenList(domTokenListCstr) {
  15319. this.__domTokenListCstr = domTokenListCstr;
  15320. }
  15321. dispatchEvent(ev) {
  15322. return dispatchEvent(this, ev);
  15323. }
  15324. get Element() {
  15325. if (this.__elementCstr == null) {
  15326. const ownerDocument = this.document;
  15327. this.__elementCstr = class extends MockElement {
  15328. constructor() {
  15329. super(ownerDocument, '');
  15330. throw new Error('Illegal constructor: cannot construct Element');
  15331. }
  15332. };
  15333. }
  15334. return this.__elementCstr;
  15335. }
  15336. fetch(input, init) {
  15337. if (typeof fetch === 'function') {
  15338. return fetch(input, init);
  15339. }
  15340. throw new Error(`fetch() not implemented`);
  15341. }
  15342. focus() {
  15343. /**/
  15344. }
  15345. getComputedStyle(_) {
  15346. return {
  15347. cssText: '',
  15348. length: 0,
  15349. parentRule: null,
  15350. getPropertyPriority() {
  15351. return null;
  15352. },
  15353. getPropertyValue() {
  15354. return '';
  15355. },
  15356. item() {
  15357. return null;
  15358. },
  15359. removeProperty() {
  15360. return null;
  15361. },
  15362. setProperty() {
  15363. return null;
  15364. },
  15365. };
  15366. }
  15367. get globalThis() {
  15368. return this;
  15369. }
  15370. get history() {
  15371. if (this.__history == null) {
  15372. this.__history = new MockHistory();
  15373. }
  15374. return this.__history;
  15375. }
  15376. set history(hsty) {
  15377. this.__history = hsty;
  15378. }
  15379. get JSON() {
  15380. return JSON;
  15381. }
  15382. get HTMLElement() {
  15383. if (this.__htmlElementCstr == null) {
  15384. const ownerDocument = this.document;
  15385. this.__htmlElementCstr = class extends MockHTMLElement {
  15386. constructor() {
  15387. super(ownerDocument, '');
  15388. const observedAttributes = this.constructor.observedAttributes;
  15389. if (Array.isArray(observedAttributes) && typeof this.attributeChangedCallback === 'function') {
  15390. observedAttributes.forEach((attrName) => {
  15391. const attrValue = this.getAttribute(attrName);
  15392. if (attrValue != null) {
  15393. this.attributeChangedCallback(attrName, null, attrValue);
  15394. }
  15395. });
  15396. }
  15397. }
  15398. };
  15399. }
  15400. return this.__htmlElementCstr;
  15401. }
  15402. set HTMLElement(htmlElementCstr) {
  15403. this.__htmlElementCstr = htmlElementCstr;
  15404. }
  15405. get IntersectionObserver() {
  15406. return MockIntersectionObserver;
  15407. }
  15408. get localStorage() {
  15409. if (this.__localStorage == null) {
  15410. this.__localStorage = new MockStorage();
  15411. }
  15412. return this.__localStorage;
  15413. }
  15414. set localStorage(locStorage) {
  15415. this.__localStorage = locStorage;
  15416. }
  15417. get location() {
  15418. if (this.__location == null) {
  15419. this.__location = new MockLocation();
  15420. }
  15421. return this.__location;
  15422. }
  15423. set location(val) {
  15424. if (typeof val === 'string') {
  15425. if (this.__location == null) {
  15426. this.__location = new MockLocation();
  15427. }
  15428. this.__location.href = val;
  15429. }
  15430. else {
  15431. this.__location = val;
  15432. }
  15433. }
  15434. matchMedia() {
  15435. return {
  15436. matches: false,
  15437. };
  15438. }
  15439. get Node() {
  15440. if (this.__nodeCstr == null) {
  15441. const ownerDocument = this.document;
  15442. this.__nodeCstr = class extends MockNode {
  15443. constructor() {
  15444. super(ownerDocument, 0, 'test', '');
  15445. throw new Error('Illegal constructor: cannot construct Node');
  15446. }
  15447. };
  15448. }
  15449. return this.__nodeCstr;
  15450. }
  15451. get NodeList() {
  15452. if (this.__nodeListCstr == null) {
  15453. const ownerDocument = this.document;
  15454. this.__nodeListCstr = class extends MockNodeList {
  15455. constructor() {
  15456. super(ownerDocument, [], 0);
  15457. throw new Error('Illegal constructor: cannot construct NodeList');
  15458. }
  15459. };
  15460. }
  15461. return this.__nodeListCstr;
  15462. }
  15463. get navigator() {
  15464. if (this.__navigator == null) {
  15465. this.__navigator = new MockNavigator();
  15466. }
  15467. return this.__navigator;
  15468. }
  15469. set navigator(nav) {
  15470. this.__navigator = nav;
  15471. }
  15472. get parent() {
  15473. return null;
  15474. }
  15475. prompt() {
  15476. return '';
  15477. }
  15478. open() {
  15479. return null;
  15480. }
  15481. get origin() {
  15482. return this.location.origin;
  15483. }
  15484. removeEventListener(type, handler) {
  15485. removeEventListener(this, type, handler);
  15486. }
  15487. requestAnimationFrame(callback) {
  15488. return this.setTimeout(() => {
  15489. callback(Date.now());
  15490. }, 0);
  15491. }
  15492. requestIdleCallback(callback) {
  15493. return this.setTimeout(() => {
  15494. callback({
  15495. didTimeout: false,
  15496. timeRemaining: () => 0,
  15497. });
  15498. }, 0);
  15499. }
  15500. scroll(_x, _y) {
  15501. /**/
  15502. }
  15503. scrollBy(_x, _y) {
  15504. /**/
  15505. }
  15506. scrollTo(_x, _y) {
  15507. /**/
  15508. }
  15509. get self() {
  15510. return this;
  15511. }
  15512. get sessionStorage() {
  15513. if (this.__sessionStorage == null) {
  15514. this.__sessionStorage = new MockStorage();
  15515. }
  15516. return this.__sessionStorage;
  15517. }
  15518. set sessionStorage(locStorage) {
  15519. this.__sessionStorage = locStorage;
  15520. }
  15521. setInterval(callback, ms, ...args) {
  15522. if (this.__timeouts == null) {
  15523. this.__timeouts = new Set();
  15524. }
  15525. ms = Math.min(ms, this.__maxTimeout);
  15526. if (this.__allowInterval) {
  15527. const intervalId = this.__setInterval(() => {
  15528. if (this.__timeouts) {
  15529. this.__timeouts.delete(intervalId);
  15530. try {
  15531. callback(...args);
  15532. }
  15533. catch (e) {
  15534. if (this.console) {
  15535. this.console.error(e);
  15536. }
  15537. else {
  15538. console.error(e);
  15539. }
  15540. }
  15541. }
  15542. }, ms);
  15543. if (this.__timeouts) {
  15544. this.__timeouts.add(intervalId);
  15545. }
  15546. return intervalId;
  15547. }
  15548. const timeoutId = this.__setTimeout(() => {
  15549. if (this.__timeouts) {
  15550. this.__timeouts.delete(timeoutId);
  15551. try {
  15552. callback(...args);
  15553. }
  15554. catch (e) {
  15555. if (this.console) {
  15556. this.console.error(e);
  15557. }
  15558. else {
  15559. console.error(e);
  15560. }
  15561. }
  15562. }
  15563. }, ms);
  15564. if (this.__timeouts) {
  15565. this.__timeouts.add(timeoutId);
  15566. }
  15567. return timeoutId;
  15568. }
  15569. setTimeout(callback, ms, ...args) {
  15570. if (this.__timeouts == null) {
  15571. this.__timeouts = new Set();
  15572. }
  15573. ms = Math.min(ms, this.__maxTimeout);
  15574. const timeoutId = this.__setTimeout(() => {
  15575. if (this.__timeouts) {
  15576. this.__timeouts.delete(timeoutId);
  15577. try {
  15578. callback(...args);
  15579. }
  15580. catch (e) {
  15581. if (this.console) {
  15582. this.console.error(e);
  15583. }
  15584. else {
  15585. console.error(e);
  15586. }
  15587. }
  15588. }
  15589. }, ms);
  15590. if (this.__timeouts) {
  15591. this.__timeouts.add(timeoutId);
  15592. }
  15593. return timeoutId;
  15594. }
  15595. get top() {
  15596. return this;
  15597. }
  15598. get window() {
  15599. return this;
  15600. }
  15601. onanimationstart() {
  15602. /**/
  15603. }
  15604. onanimationend() {
  15605. /**/
  15606. }
  15607. onanimationiteration() {
  15608. /**/
  15609. }
  15610. onabort() {
  15611. /**/
  15612. }
  15613. onauxclick() {
  15614. /**/
  15615. }
  15616. onbeforecopy() {
  15617. /**/
  15618. }
  15619. onbeforecut() {
  15620. /**/
  15621. }
  15622. onbeforepaste() {
  15623. /**/
  15624. }
  15625. onblur() {
  15626. /**/
  15627. }
  15628. oncancel() {
  15629. /**/
  15630. }
  15631. oncanplay() {
  15632. /**/
  15633. }
  15634. oncanplaythrough() {
  15635. /**/
  15636. }
  15637. onchange() {
  15638. /**/
  15639. }
  15640. onclick() {
  15641. /**/
  15642. }
  15643. onclose() {
  15644. /**/
  15645. }
  15646. oncontextmenu() {
  15647. /**/
  15648. }
  15649. oncopy() {
  15650. /**/
  15651. }
  15652. oncuechange() {
  15653. /**/
  15654. }
  15655. oncut() {
  15656. /**/
  15657. }
  15658. ondblclick() {
  15659. /**/
  15660. }
  15661. ondrag() {
  15662. /**/
  15663. }
  15664. ondragend() {
  15665. /**/
  15666. }
  15667. ondragenter() {
  15668. /**/
  15669. }
  15670. ondragleave() {
  15671. /**/
  15672. }
  15673. ondragover() {
  15674. /**/
  15675. }
  15676. ondragstart() {
  15677. /**/
  15678. }
  15679. ondrop() {
  15680. /**/
  15681. }
  15682. ondurationchange() {
  15683. /**/
  15684. }
  15685. onemptied() {
  15686. /**/
  15687. }
  15688. onended() {
  15689. /**/
  15690. }
  15691. onerror() {
  15692. /**/
  15693. }
  15694. onfocus() {
  15695. /**/
  15696. }
  15697. onfocusin() {
  15698. /**/
  15699. }
  15700. onfocusout() {
  15701. /**/
  15702. }
  15703. onformdata() {
  15704. /**/
  15705. }
  15706. onfullscreenchange() {
  15707. /**/
  15708. }
  15709. onfullscreenerror() {
  15710. /**/
  15711. }
  15712. ongotpointercapture() {
  15713. /**/
  15714. }
  15715. oninput() {
  15716. /**/
  15717. }
  15718. oninvalid() {
  15719. /**/
  15720. }
  15721. onkeydown() {
  15722. /**/
  15723. }
  15724. onkeypress() {
  15725. /**/
  15726. }
  15727. onkeyup() {
  15728. /**/
  15729. }
  15730. onload() {
  15731. /**/
  15732. }
  15733. onloadeddata() {
  15734. /**/
  15735. }
  15736. onloadedmetadata() {
  15737. /**/
  15738. }
  15739. onloadstart() {
  15740. /**/
  15741. }
  15742. onlostpointercapture() {
  15743. /**/
  15744. }
  15745. onmousedown() {
  15746. /**/
  15747. }
  15748. onmouseenter() {
  15749. /**/
  15750. }
  15751. onmouseleave() {
  15752. /**/
  15753. }
  15754. onmousemove() {
  15755. /**/
  15756. }
  15757. onmouseout() {
  15758. /**/
  15759. }
  15760. onmouseover() {
  15761. /**/
  15762. }
  15763. onmouseup() {
  15764. /**/
  15765. }
  15766. onmousewheel() {
  15767. /**/
  15768. }
  15769. onpaste() {
  15770. /**/
  15771. }
  15772. onpause() {
  15773. /**/
  15774. }
  15775. onplay() {
  15776. /**/
  15777. }
  15778. onplaying() {
  15779. /**/
  15780. }
  15781. onpointercancel() {
  15782. /**/
  15783. }
  15784. onpointerdown() {
  15785. /**/
  15786. }
  15787. onpointerenter() {
  15788. /**/
  15789. }
  15790. onpointerleave() {
  15791. /**/
  15792. }
  15793. onpointermove() {
  15794. /**/
  15795. }
  15796. onpointerout() {
  15797. /**/
  15798. }
  15799. onpointerover() {
  15800. /**/
  15801. }
  15802. onpointerup() {
  15803. /**/
  15804. }
  15805. onprogress() {
  15806. /**/
  15807. }
  15808. onratechange() {
  15809. /**/
  15810. }
  15811. onreset() {
  15812. /**/
  15813. }
  15814. onresize() {
  15815. /**/
  15816. }
  15817. onscroll() {
  15818. /**/
  15819. }
  15820. onsearch() {
  15821. /**/
  15822. }
  15823. onseeked() {
  15824. /**/
  15825. }
  15826. onseeking() {
  15827. /**/
  15828. }
  15829. onselect() {
  15830. /**/
  15831. }
  15832. onselectstart() {
  15833. /**/
  15834. }
  15835. onstalled() {
  15836. /**/
  15837. }
  15838. onsubmit() {
  15839. /**/
  15840. }
  15841. onsuspend() {
  15842. /**/
  15843. }
  15844. ontimeupdate() {
  15845. /**/
  15846. }
  15847. ontoggle() {
  15848. /**/
  15849. }
  15850. onvolumechange() {
  15851. /**/
  15852. }
  15853. onwaiting() {
  15854. /**/
  15855. }
  15856. onwebkitfullscreenchange() {
  15857. /**/
  15858. }
  15859. onwebkitfullscreenerror() {
  15860. /**/
  15861. }
  15862. onwheel() {
  15863. /**/
  15864. }
  15865. }
  15866. addGlobalsToWindowPrototype(MockWindow.prototype);
  15867. function resetWindowDefaults(win) {
  15868. win.__clearInterval = nativeClearInterval;
  15869. win.__clearTimeout = nativeClearTimeout;
  15870. win.__setInterval = nativeSetInterval;
  15871. win.__setTimeout = nativeSetTimeout;
  15872. win.__maxTimeout = 30000;
  15873. win.__allowInterval = true;
  15874. win.URL = nativeURL;
  15875. }
  15876. function cloneWindow(srcWin, opts = {}) {
  15877. if (srcWin == null) {
  15878. return null;
  15879. }
  15880. const clonedWin = new MockWindow(false);
  15881. if (!opts.customElementProxy) {
  15882. // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
  15883. // @ts-ignore
  15884. srcWin.customElements = null;
  15885. }
  15886. if (srcWin.document != null) {
  15887. const clonedDoc = new MockDocument(false, clonedWin);
  15888. clonedWin.document = clonedDoc;
  15889. clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
  15890. }
  15891. else {
  15892. clonedWin.document = new MockDocument(null, clonedWin);
  15893. }
  15894. return clonedWin;
  15895. }
  15896. function cloneDocument(srcDoc) {
  15897. if (srcDoc == null) {
  15898. return null;
  15899. }
  15900. const dstWin = cloneWindow(srcDoc.defaultView);
  15901. return dstWin.document;
  15902. }
  15903. function resetWindow(win) {
  15904. if (win != null) {
  15905. if (win.__timeouts) {
  15906. win.__timeouts.forEach((timeoutId) => {
  15907. nativeClearInterval(timeoutId);
  15908. nativeClearTimeout(timeoutId);
  15909. });
  15910. win.__timeouts.clear();
  15911. }
  15912. if (win.customElements && win.customElements.clear) {
  15913. win.customElements.clear();
  15914. }
  15915. resetDocument(win.document);
  15916. resetPerformance(win.performance);
  15917. for (const key in win) {
  15918. if (win.hasOwnProperty(key) && key !== 'document' && key !== 'performance' && key !== 'customElements') {
  15919. delete win[key];
  15920. }
  15921. }
  15922. resetWindowDefaults(win);
  15923. resetWindowDimensions(win);
  15924. resetEventListeners(win);
  15925. if (win.document != null) {
  15926. try {
  15927. win.document.defaultView = win;
  15928. }
  15929. catch (e) { }
  15930. }
  15931. // ensure we don't hold onto nodeFetch values
  15932. win.fetch = null;
  15933. win.Headers = null;
  15934. win.Request = null;
  15935. win.Response = null;
  15936. win.FetchError = null;
  15937. }
  15938. }
  15939. function resetWindowDimensions(win) {
  15940. try {
  15941. win.devicePixelRatio = 1;
  15942. win.innerHeight = 768;
  15943. win.innerWidth = 1366;
  15944. win.pageXOffset = 0;
  15945. win.pageYOffset = 0;
  15946. win.screenLeft = 0;
  15947. win.screenTop = 0;
  15948. win.screenX = 0;
  15949. win.screenY = 0;
  15950. win.scrollX = 0;
  15951. win.scrollY = 0;
  15952. win.screen = {
  15953. availHeight: win.innerHeight,
  15954. availLeft: 0,
  15955. availTop: 0,
  15956. availWidth: win.innerWidth,
  15957. colorDepth: 24,
  15958. height: win.innerHeight,
  15959. keepAwake: false,
  15960. orientation: {
  15961. angle: 0,
  15962. type: 'portrait-primary',
  15963. },
  15964. pixelDepth: 24,
  15965. width: win.innerWidth,
  15966. };
  15967. }
  15968. catch (e) { }
  15969. }
  15970. class MockDocument extends MockHTMLElement {
  15971. constructor(html = null, win = null) {
  15972. super(null, null);
  15973. this.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
  15974. this.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
  15975. this.defaultView = win;
  15976. this.cookie = '';
  15977. this.referrer = '';
  15978. this.appendChild(this.createDocumentTypeNode());
  15979. if (typeof html === 'string') {
  15980. const parsedDoc = parseDocumentUtil(this, html);
  15981. const documentElement = parsedDoc.children.find((elm) => elm.nodeName === 'HTML');
  15982. if (documentElement != null) {
  15983. this.appendChild(documentElement);
  15984. setOwnerDocument(documentElement, this);
  15985. }
  15986. }
  15987. else if (html !== false) {
  15988. const documentElement = new MockHTMLElement(this, 'html');
  15989. this.appendChild(documentElement);
  15990. documentElement.appendChild(new MockHTMLElement(this, 'head'));
  15991. documentElement.appendChild(new MockHTMLElement(this, 'body'));
  15992. }
  15993. }
  15994. get dir() {
  15995. return this.documentElement.dir;
  15996. }
  15997. set dir(value) {
  15998. this.documentElement.dir = value;
  15999. }
  16000. get location() {
  16001. if (this.defaultView != null) {
  16002. return this.defaultView.location;
  16003. }
  16004. return null;
  16005. }
  16006. set location(val) {
  16007. if (this.defaultView != null) {
  16008. this.defaultView.location = val;
  16009. }
  16010. }
  16011. get baseURI() {
  16012. const baseNode = this.head.childNodes.find((node) => node.nodeName === 'BASE');
  16013. if (baseNode) {
  16014. return baseNode.href;
  16015. }
  16016. return this.URL;
  16017. }
  16018. get URL() {
  16019. return this.location.href;
  16020. }
  16021. get styleSheets() {
  16022. return this.querySelectorAll('style');
  16023. }
  16024. get scripts() {
  16025. return this.querySelectorAll('script');
  16026. }
  16027. get forms() {
  16028. return this.querySelectorAll('form');
  16029. }
  16030. get images() {
  16031. return this.querySelectorAll('img');
  16032. }
  16033. get scrollingElement() {
  16034. return this.documentElement;
  16035. }
  16036. get documentElement() {
  16037. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  16038. if (this.childNodes[i].nodeName === 'HTML') {
  16039. return this.childNodes[i];
  16040. }
  16041. }
  16042. const documentElement = new MockHTMLElement(this, 'html');
  16043. this.appendChild(documentElement);
  16044. return documentElement;
  16045. }
  16046. set documentElement(documentElement) {
  16047. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  16048. if (this.childNodes[i].nodeType !== 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
  16049. this.childNodes[i].remove();
  16050. }
  16051. }
  16052. if (documentElement != null) {
  16053. this.appendChild(documentElement);
  16054. setOwnerDocument(documentElement, this);
  16055. }
  16056. }
  16057. get head() {
  16058. const documentElement = this.documentElement;
  16059. for (let i = 0; i < documentElement.childNodes.length; i++) {
  16060. if (documentElement.childNodes[i].nodeName === 'HEAD') {
  16061. return documentElement.childNodes[i];
  16062. }
  16063. }
  16064. const head = new MockHTMLElement(this, 'head');
  16065. documentElement.insertBefore(head, documentElement.firstChild);
  16066. return head;
  16067. }
  16068. set head(head) {
  16069. const documentElement = this.documentElement;
  16070. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  16071. if (documentElement.childNodes[i].nodeName === 'HEAD') {
  16072. documentElement.childNodes[i].remove();
  16073. }
  16074. }
  16075. if (head != null) {
  16076. documentElement.insertBefore(head, documentElement.firstChild);
  16077. setOwnerDocument(head, this);
  16078. }
  16079. }
  16080. get body() {
  16081. const documentElement = this.documentElement;
  16082. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  16083. if (documentElement.childNodes[i].nodeName === 'BODY') {
  16084. return documentElement.childNodes[i];
  16085. }
  16086. }
  16087. const body = new MockHTMLElement(this, 'body');
  16088. documentElement.appendChild(body);
  16089. return body;
  16090. }
  16091. set body(body) {
  16092. const documentElement = this.documentElement;
  16093. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  16094. if (documentElement.childNodes[i].nodeName === 'BODY') {
  16095. documentElement.childNodes[i].remove();
  16096. }
  16097. }
  16098. if (body != null) {
  16099. documentElement.appendChild(body);
  16100. setOwnerDocument(body, this);
  16101. }
  16102. }
  16103. appendChild(newNode) {
  16104. newNode.remove();
  16105. newNode.parentNode = this;
  16106. this.childNodes.push(newNode);
  16107. return newNode;
  16108. }
  16109. createComment(data) {
  16110. return new MockComment(this, data);
  16111. }
  16112. createAttribute(attrName) {
  16113. return new MockAttr(attrName.toLowerCase(), '');
  16114. }
  16115. createAttributeNS(namespaceURI, attrName) {
  16116. return new MockAttr(attrName, '', namespaceURI);
  16117. }
  16118. createElement(tagName) {
  16119. if (tagName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
  16120. const doc = new MockDocument(false);
  16121. doc.nodeName = tagName;
  16122. doc.parentNode = null;
  16123. return doc;
  16124. }
  16125. return createElement(this, tagName);
  16126. }
  16127. createElementNS(namespaceURI, tagName) {
  16128. const elmNs = createElementNS(this, namespaceURI, tagName);
  16129. elmNs.namespaceURI = namespaceURI;
  16130. return elmNs;
  16131. }
  16132. createTextNode(text) {
  16133. return new MockTextNode(this, text);
  16134. }
  16135. createDocumentFragment() {
  16136. return new MockDocumentFragment(this);
  16137. }
  16138. createDocumentTypeNode() {
  16139. return new MockDocumentTypeNode(this);
  16140. }
  16141. getElementById(id) {
  16142. return getElementById(this, id);
  16143. }
  16144. getElementsByName(elmName) {
  16145. return getElementsByName(this, elmName.toLowerCase());
  16146. }
  16147. get title() {
  16148. const title = this.head.childNodes.find((elm) => elm.nodeName === 'TITLE');
  16149. if (title != null && typeof title.textContent === 'string') {
  16150. return title.textContent.trim();
  16151. }
  16152. return '';
  16153. }
  16154. set title(value) {
  16155. const head = this.head;
  16156. let title = head.childNodes.find((elm) => elm.nodeName === 'TITLE');
  16157. if (title == null) {
  16158. title = this.createElement('title');
  16159. head.appendChild(title);
  16160. }
  16161. title.textContent = value;
  16162. }
  16163. }
  16164. function createDocument(html = null) {
  16165. return new MockWindow(html).document;
  16166. }
  16167. function resetDocument(doc) {
  16168. if (doc != null) {
  16169. resetEventListeners(doc);
  16170. const documentElement = doc.documentElement;
  16171. if (documentElement != null) {
  16172. resetElement(documentElement);
  16173. for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
  16174. const childNode = documentElement.childNodes[i];
  16175. resetElement(childNode);
  16176. childNode.childNodes.length = 0;
  16177. }
  16178. }
  16179. for (const key in doc) {
  16180. if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
  16181. delete doc[key];
  16182. }
  16183. }
  16184. try {
  16185. doc.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
  16186. }
  16187. catch (e) { }
  16188. try {
  16189. doc.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
  16190. }
  16191. catch (e) { }
  16192. try {
  16193. doc.cookie = '';
  16194. }
  16195. catch (e) { }
  16196. try {
  16197. doc.referrer = '';
  16198. }
  16199. catch (e) { }
  16200. }
  16201. }
  16202. const DOC_KEY_KEEPERS = new Set([
  16203. 'nodeName',
  16204. 'nodeType',
  16205. 'nodeValue',
  16206. 'ownerDocument',
  16207. 'parentNode',
  16208. 'childNodes',
  16209. '_shadowRoot',
  16210. ]);
  16211. function getElementById(elm, id) {
  16212. const children = elm.children;
  16213. for (let i = 0, ii = children.length; i < ii; i++) {
  16214. const childElm = children[i];
  16215. if (childElm.id === id) {
  16216. return childElm;
  16217. }
  16218. const childElmFound = getElementById(childElm, id);
  16219. if (childElmFound != null) {
  16220. return childElmFound;
  16221. }
  16222. }
  16223. return null;
  16224. }
  16225. function getElementsByName(elm, elmName, foundElms = []) {
  16226. const children = elm.children;
  16227. for (let i = 0, ii = children.length; i < ii; i++) {
  16228. const childElm = children[i];
  16229. if (childElm.name && childElm.name.toLowerCase() === elmName) {
  16230. foundElms.push(childElm);
  16231. }
  16232. getElementsByName(childElm, elmName, foundElms);
  16233. }
  16234. return foundElms;
  16235. }
  16236. function setOwnerDocument(elm, ownerDocument) {
  16237. for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
  16238. elm.childNodes[i].ownerDocument = ownerDocument;
  16239. if (elm.childNodes[i].nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  16240. setOwnerDocument(elm.childNodes[i], ownerDocument);
  16241. }
  16242. }
  16243. }
  16244. var concatMap$1 = function (xs, fn) {
  16245. var res = [];
  16246. for (var i = 0; i < xs.length; i++) {
  16247. var x = fn(xs[i], i);
  16248. if (isArray$7(x)) res.push.apply(res, x);
  16249. else res.push(x);
  16250. }
  16251. return res;
  16252. };
  16253. var isArray$7 = Array.isArray || function (xs) {
  16254. return Object.prototype.toString.call(xs) === '[object Array]';
  16255. };
  16256. var balancedMatch$1 = balanced$1;
  16257. function balanced$1(a, b, str) {
  16258. if (a instanceof RegExp) a = maybeMatch$1(a, str);
  16259. if (b instanceof RegExp) b = maybeMatch$1(b, str);
  16260. var r = range$1(a, b, str);
  16261. return r && {
  16262. start: r[0],
  16263. end: r[1],
  16264. pre: str.slice(0, r[0]),
  16265. body: str.slice(r[0] + a.length, r[1]),
  16266. post: str.slice(r[1] + b.length)
  16267. };
  16268. }
  16269. function maybeMatch$1(reg, str) {
  16270. var m = str.match(reg);
  16271. return m ? m[0] : null;
  16272. }
  16273. balanced$1.range = range$1;
  16274. function range$1(a, b, str) {
  16275. var begs, beg, left, right, result;
  16276. var ai = str.indexOf(a);
  16277. var bi = str.indexOf(b, ai + 1);
  16278. var i = ai;
  16279. if (ai >= 0 && bi > 0) {
  16280. begs = [];
  16281. left = str.length;
  16282. while (i >= 0 && !result) {
  16283. if (i == ai) {
  16284. begs.push(i);
  16285. ai = str.indexOf(a, i + 1);
  16286. } else if (begs.length == 1) {
  16287. result = [ begs.pop(), bi ];
  16288. } else {
  16289. beg = begs.pop();
  16290. if (beg < left) {
  16291. left = beg;
  16292. right = bi;
  16293. }
  16294. bi = str.indexOf(b, i + 1);
  16295. }
  16296. i = ai < bi && ai >= 0 ? ai : bi;
  16297. }
  16298. if (begs.length) {
  16299. result = [ left, right ];
  16300. }
  16301. }
  16302. return result;
  16303. }
  16304. var braceExpansion$1 = expandTop$1;
  16305. var escSlash$1 = '\0SLASH'+Math.random()+'\0';
  16306. var escOpen$1 = '\0OPEN'+Math.random()+'\0';
  16307. var escClose$1 = '\0CLOSE'+Math.random()+'\0';
  16308. var escComma$1 = '\0COMMA'+Math.random()+'\0';
  16309. var escPeriod$1 = '\0PERIOD'+Math.random()+'\0';
  16310. function numeric$1(str) {
  16311. return parseInt(str, 10) == str
  16312. ? parseInt(str, 10)
  16313. : str.charCodeAt(0);
  16314. }
  16315. function escapeBraces$1(str) {
  16316. return str.split('\\\\').join(escSlash$1)
  16317. .split('\\{').join(escOpen$1)
  16318. .split('\\}').join(escClose$1)
  16319. .split('\\,').join(escComma$1)
  16320. .split('\\.').join(escPeriod$1);
  16321. }
  16322. function unescapeBraces$1(str) {
  16323. return str.split(escSlash$1).join('\\')
  16324. .split(escOpen$1).join('{')
  16325. .split(escClose$1).join('}')
  16326. .split(escComma$1).join(',')
  16327. .split(escPeriod$1).join('.');
  16328. }
  16329. // Basically just str.split(","), but handling cases
  16330. // where we have nested braced sections, which should be
  16331. // treated as individual members, like {a,{b,c},d}
  16332. function parseCommaParts$1(str) {
  16333. if (!str)
  16334. return [''];
  16335. var parts = [];
  16336. var m = balancedMatch$1('{', '}', str);
  16337. if (!m)
  16338. return str.split(',');
  16339. var pre = m.pre;
  16340. var body = m.body;
  16341. var post = m.post;
  16342. var p = pre.split(',');
  16343. p[p.length-1] += '{' + body + '}';
  16344. var postParts = parseCommaParts$1(post);
  16345. if (post.length) {
  16346. p[p.length-1] += postParts.shift();
  16347. p.push.apply(p, postParts);
  16348. }
  16349. parts.push.apply(parts, p);
  16350. return parts;
  16351. }
  16352. function expandTop$1(str) {
  16353. if (!str)
  16354. return [];
  16355. // I don't know why Bash 4.3 does this, but it does.
  16356. // Anything starting with {} will have the first two bytes preserved
  16357. // but *only* at the top level, so {},a}b will not expand to anything,
  16358. // but a{},b}c will be expanded to [a}c,abc].
  16359. // One could argue that this is a bug in Bash, but since the goal of
  16360. // this module is to match Bash's rules, we escape a leading {}
  16361. if (str.substr(0, 2) === '{}') {
  16362. str = '\\{\\}' + str.substr(2);
  16363. }
  16364. return expand$1(escapeBraces$1(str), true).map(unescapeBraces$1);
  16365. }
  16366. function embrace$1(str) {
  16367. return '{' + str + '}';
  16368. }
  16369. function isPadded$1(el) {
  16370. return /^-?0\d/.test(el);
  16371. }
  16372. function lte$1(i, y) {
  16373. return i <= y;
  16374. }
  16375. function gte$1(i, y) {
  16376. return i >= y;
  16377. }
  16378. function expand$1(str, isTop) {
  16379. var expansions = [];
  16380. var m = balancedMatch$1('{', '}', str);
  16381. if (!m || /\$$/.test(m.pre)) return [str];
  16382. var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
  16383. var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
  16384. var isSequence = isNumericSequence || isAlphaSequence;
  16385. var isOptions = m.body.indexOf(',') >= 0;
  16386. if (!isSequence && !isOptions) {
  16387. // {a},b}
  16388. if (m.post.match(/,.*\}/)) {
  16389. str = m.pre + '{' + m.body + escClose$1 + m.post;
  16390. return expand$1(str);
  16391. }
  16392. return [str];
  16393. }
  16394. var n;
  16395. if (isSequence) {
  16396. n = m.body.split(/\.\./);
  16397. } else {
  16398. n = parseCommaParts$1(m.body);
  16399. if (n.length === 1) {
  16400. // x{{a,b}}y ==> x{a}y x{b}y
  16401. n = expand$1(n[0], false).map(embrace$1);
  16402. if (n.length === 1) {
  16403. var post = m.post.length
  16404. ? expand$1(m.post, false)
  16405. : [''];
  16406. return post.map(function(p) {
  16407. return m.pre + n[0] + p;
  16408. });
  16409. }
  16410. }
  16411. }
  16412. // at this point, n is the parts, and we know it's not a comma set
  16413. // with a single entry.
  16414. // no need to expand pre, since it is guaranteed to be free of brace-sets
  16415. var pre = m.pre;
  16416. var post = m.post.length
  16417. ? expand$1(m.post, false)
  16418. : [''];
  16419. var N;
  16420. if (isSequence) {
  16421. var x = numeric$1(n[0]);
  16422. var y = numeric$1(n[1]);
  16423. var width = Math.max(n[0].length, n[1].length);
  16424. var incr = n.length == 3
  16425. ? Math.abs(numeric$1(n[2]))
  16426. : 1;
  16427. var test = lte$1;
  16428. var reverse = y < x;
  16429. if (reverse) {
  16430. incr *= -1;
  16431. test = gte$1;
  16432. }
  16433. var pad = n.some(isPadded$1);
  16434. N = [];
  16435. for (var i = x; test(i, y); i += incr) {
  16436. var c;
  16437. if (isAlphaSequence) {
  16438. c = String.fromCharCode(i);
  16439. if (c === '\\')
  16440. c = '';
  16441. } else {
  16442. c = String(i);
  16443. if (pad) {
  16444. var need = width - c.length;
  16445. if (need > 0) {
  16446. var z = new Array(need + 1).join('0');
  16447. if (i < 0)
  16448. c = '-' + z + c.slice(1);
  16449. else
  16450. c = z + c;
  16451. }
  16452. }
  16453. }
  16454. N.push(c);
  16455. }
  16456. } else {
  16457. N = concatMap$1(n, function(el) { return expand$1(el, false) });
  16458. }
  16459. for (var j = 0; j < N.length; j++) {
  16460. for (var k = 0; k < post.length; k++) {
  16461. var expansion = pre + N[j] + post[k];
  16462. if (!isTop || isSequence || expansion)
  16463. expansions.push(expansion);
  16464. }
  16465. }
  16466. return expansions;
  16467. }
  16468. var minimatch_1$1 = minimatch$1;
  16469. minimatch$1.Minimatch = Minimatch$2;
  16470. var path$1 = { sep: '/' };
  16471. try {
  16472. path$1 = path$4;
  16473. } catch (er) {}
  16474. var GLOBSTAR$1 = minimatch$1.GLOBSTAR = Minimatch$2.GLOBSTAR = {};
  16475. var plTypes$1 = {
  16476. '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
  16477. '?': { open: '(?:', close: ')?' },
  16478. '+': { open: '(?:', close: ')+' },
  16479. '*': { open: '(?:', close: ')*' },
  16480. '@': { open: '(?:', close: ')' }
  16481. };
  16482. // any single thing other than /
  16483. // don't need to escape / when using new RegExp()
  16484. var qmark$1 = '[^/]';
  16485. // * => any number of characters
  16486. var star$1 = qmark$1 + '*?';
  16487. // ** when dots are allowed. Anything goes, except .. and .
  16488. // not (^ or / followed by one or two dots followed by $ or /),
  16489. // followed by anything, any number of times.
  16490. var twoStarDot$1 = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?';
  16491. // not a ^ or / followed by a dot,
  16492. // followed by anything, any number of times.
  16493. var twoStarNoDot$1 = '(?:(?!(?:\\\/|^)\\.).)*?';
  16494. // characters that need to be escaped in RegExp.
  16495. var reSpecials$1 = charSet$1('().*{}+?[]^$\\!');
  16496. // "abc" -> { a:true, b:true, c:true }
  16497. function charSet$1 (s) {
  16498. return s.split('').reduce(function (set, c) {
  16499. set[c] = true;
  16500. return set
  16501. }, {})
  16502. }
  16503. // normalizes slashes.
  16504. var slashSplit$1 = /\/+/;
  16505. minimatch$1.filter = filter$1;
  16506. function filter$1 (pattern, options) {
  16507. options = options || {};
  16508. return function (p, i, list) {
  16509. return minimatch$1(p, pattern, options)
  16510. }
  16511. }
  16512. function ext$1 (a, b) {
  16513. a = a || {};
  16514. b = b || {};
  16515. var t = {};
  16516. Object.keys(b).forEach(function (k) {
  16517. t[k] = b[k];
  16518. });
  16519. Object.keys(a).forEach(function (k) {
  16520. t[k] = a[k];
  16521. });
  16522. return t
  16523. }
  16524. minimatch$1.defaults = function (def) {
  16525. if (!def || !Object.keys(def).length) return minimatch$1
  16526. var orig = minimatch$1;
  16527. var m = function minimatch (p, pattern, options) {
  16528. return orig.minimatch(p, pattern, ext$1(def, options))
  16529. };
  16530. m.Minimatch = function Minimatch (pattern, options) {
  16531. return new orig.Minimatch(pattern, ext$1(def, options))
  16532. };
  16533. return m
  16534. };
  16535. Minimatch$2.defaults = function (def) {
  16536. if (!def || !Object.keys(def).length) return Minimatch$2
  16537. return minimatch$1.defaults(def).Minimatch
  16538. };
  16539. function minimatch$1 (p, pattern, options) {
  16540. if (typeof pattern !== 'string') {
  16541. throw new TypeError('glob pattern string required')
  16542. }
  16543. if (!options) options = {};
  16544. // shortcut: comments match nothing.
  16545. if (!options.nocomment && pattern.charAt(0) === '#') {
  16546. return false
  16547. }
  16548. // "" only matches ""
  16549. if (pattern.trim() === '') return p === ''
  16550. return new Minimatch$2(pattern, options).match(p)
  16551. }
  16552. function Minimatch$2 (pattern, options) {
  16553. if (!(this instanceof Minimatch$2)) {
  16554. return new Minimatch$2(pattern, options)
  16555. }
  16556. if (typeof pattern !== 'string') {
  16557. throw new TypeError('glob pattern string required')
  16558. }
  16559. if (!options) options = {};
  16560. pattern = pattern.trim();
  16561. // windows support: need to use /, not \
  16562. if (path$1.sep !== '/') {
  16563. pattern = pattern.split(path$1.sep).join('/');
  16564. }
  16565. this.options = options;
  16566. this.set = [];
  16567. this.pattern = pattern;
  16568. this.regexp = null;
  16569. this.negate = false;
  16570. this.comment = false;
  16571. this.empty = false;
  16572. // make the set of regexps etc.
  16573. this.make();
  16574. }
  16575. Minimatch$2.prototype.debug = function () {};
  16576. Minimatch$2.prototype.make = make$1;
  16577. function make$1 () {
  16578. // don't do it more than once.
  16579. if (this._made) return
  16580. var pattern = this.pattern;
  16581. var options = this.options;
  16582. // empty patterns and comments match nothing.
  16583. if (!options.nocomment && pattern.charAt(0) === '#') {
  16584. this.comment = true;
  16585. return
  16586. }
  16587. if (!pattern) {
  16588. this.empty = true;
  16589. return
  16590. }
  16591. // step 1: figure out negation, etc.
  16592. this.parseNegate();
  16593. // step 2: expand braces
  16594. var set = this.globSet = this.braceExpand();
  16595. if (options.debug) this.debug = console.error;
  16596. this.debug(this.pattern, set);
  16597. // step 3: now we have a set, so turn each one into a series of path-portion
  16598. // matching patterns.
  16599. // These will be regexps, except in the case of "**", which is
  16600. // set to the GLOBSTAR object for globstar behavior,
  16601. // and will not contain any / characters
  16602. set = this.globParts = set.map(function (s) {
  16603. return s.split(slashSplit$1)
  16604. });
  16605. this.debug(this.pattern, set);
  16606. // glob --> regexps
  16607. set = set.map(function (s, si, set) {
  16608. return s.map(this.parse, this)
  16609. }, this);
  16610. this.debug(this.pattern, set);
  16611. // filter out everything that didn't compile properly.
  16612. set = set.filter(function (s) {
  16613. return s.indexOf(false) === -1
  16614. });
  16615. this.debug(this.pattern, set);
  16616. this.set = set;
  16617. }
  16618. Minimatch$2.prototype.parseNegate = parseNegate$1;
  16619. function parseNegate$1 () {
  16620. var pattern = this.pattern;
  16621. var negate = false;
  16622. var options = this.options;
  16623. var negateOffset = 0;
  16624. if (options.nonegate) return
  16625. for (var i = 0, l = pattern.length
  16626. ; i < l && pattern.charAt(i) === '!'
  16627. ; i++) {
  16628. negate = !negate;
  16629. negateOffset++;
  16630. }
  16631. if (negateOffset) this.pattern = pattern.substr(negateOffset);
  16632. this.negate = negate;
  16633. }
  16634. // Brace expansion:
  16635. // a{b,c}d -> abd acd
  16636. // a{b,}c -> abc ac
  16637. // a{0..3}d -> a0d a1d a2d a3d
  16638. // a{b,c{d,e}f}g -> abg acdfg acefg
  16639. // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
  16640. //
  16641. // Invalid sets are not expanded.
  16642. // a{2..}b -> a{2..}b
  16643. // a{b}c -> a{b}c
  16644. minimatch$1.braceExpand = function (pattern, options) {
  16645. return braceExpand$1(pattern, options)
  16646. };
  16647. Minimatch$2.prototype.braceExpand = braceExpand$1;
  16648. function braceExpand$1 (pattern, options) {
  16649. if (!options) {
  16650. if (this instanceof Minimatch$2) {
  16651. options = this.options;
  16652. } else {
  16653. options = {};
  16654. }
  16655. }
  16656. pattern = typeof pattern === 'undefined'
  16657. ? this.pattern : pattern;
  16658. if (typeof pattern === 'undefined') {
  16659. throw new TypeError('undefined pattern')
  16660. }
  16661. if (options.nobrace ||
  16662. !pattern.match(/\{.*\}/)) {
  16663. // shortcut. no need to expand.
  16664. return [pattern]
  16665. }
  16666. return braceExpansion$1(pattern)
  16667. }
  16668. // parse a component of the expanded set.
  16669. // At this point, no pattern may contain "/" in it
  16670. // so we're going to return a 2d array, where each entry is the full
  16671. // pattern, split on '/', and then turned into a regular expression.
  16672. // A regexp is made at the end which joins each array with an
  16673. // escaped /, and another full one which joins each regexp with |.
  16674. //
  16675. // Following the lead of Bash 4.1, note that "**" only has special meaning
  16676. // when it is the *only* thing in a path portion. Otherwise, any series
  16677. // of * is equivalent to a single *. Globstar behavior is enabled by
  16678. // default, and can be disabled by setting options.noglobstar.
  16679. Minimatch$2.prototype.parse = parse$3;
  16680. var SUBPARSE$1 = {};
  16681. function parse$3 (pattern, isSub) {
  16682. if (pattern.length > 1024 * 64) {
  16683. throw new TypeError('pattern is too long')
  16684. }
  16685. var options = this.options;
  16686. // shortcuts
  16687. if (!options.noglobstar && pattern === '**') return GLOBSTAR$1
  16688. if (pattern === '') return ''
  16689. var re = '';
  16690. var hasMagic = !!options.nocase;
  16691. var escaping = false;
  16692. // ? => one single character
  16693. var patternListStack = [];
  16694. var negativeLists = [];
  16695. var stateChar;
  16696. var inClass = false;
  16697. var reClassStart = -1;
  16698. var classStart = -1;
  16699. // . and .. never match anything that doesn't start with .,
  16700. // even when options.dot is set.
  16701. var patternStart = pattern.charAt(0) === '.' ? '' // anything
  16702. // not (start or / followed by . or .. followed by / or end)
  16703. : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
  16704. : '(?!\\.)';
  16705. var self = this;
  16706. function clearStateChar () {
  16707. if (stateChar) {
  16708. // we had some state-tracking character
  16709. // that wasn't consumed by this pass.
  16710. switch (stateChar) {
  16711. case '*':
  16712. re += star$1;
  16713. hasMagic = true;
  16714. break
  16715. case '?':
  16716. re += qmark$1;
  16717. hasMagic = true;
  16718. break
  16719. default:
  16720. re += '\\' + stateChar;
  16721. break
  16722. }
  16723. self.debug('clearStateChar %j %j', stateChar, re);
  16724. stateChar = false;
  16725. }
  16726. }
  16727. for (var i = 0, len = pattern.length, c
  16728. ; (i < len) && (c = pattern.charAt(i))
  16729. ; i++) {
  16730. this.debug('%s\t%s %s %j', pattern, i, re, c);
  16731. // skip over any that are escaped.
  16732. if (escaping && reSpecials$1[c]) {
  16733. re += '\\' + c;
  16734. escaping = false;
  16735. continue
  16736. }
  16737. switch (c) {
  16738. case '/':
  16739. // completely not allowed, even escaped.
  16740. // Should already be path-split by now.
  16741. return false
  16742. case '\\':
  16743. clearStateChar();
  16744. escaping = true;
  16745. continue
  16746. // the various stateChar values
  16747. // for the "extglob" stuff.
  16748. case '?':
  16749. case '*':
  16750. case '+':
  16751. case '@':
  16752. case '!':
  16753. this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c);
  16754. // all of those are literals inside a class, except that
  16755. // the glob [!a] means [^a] in regexp
  16756. if (inClass) {
  16757. this.debug(' in class');
  16758. if (c === '!' && i === classStart + 1) c = '^';
  16759. re += c;
  16760. continue
  16761. }
  16762. // if we already have a stateChar, then it means
  16763. // that there was something like ** or +? in there.
  16764. // Handle the stateChar, then proceed with this one.
  16765. self.debug('call clearStateChar %j', stateChar);
  16766. clearStateChar();
  16767. stateChar = c;
  16768. // if extglob is disabled, then +(asdf|foo) isn't a thing.
  16769. // just clear the statechar *now*, rather than even diving into
  16770. // the patternList stuff.
  16771. if (options.noext) clearStateChar();
  16772. continue
  16773. case '(':
  16774. if (inClass) {
  16775. re += '(';
  16776. continue
  16777. }
  16778. if (!stateChar) {
  16779. re += '\\(';
  16780. continue
  16781. }
  16782. patternListStack.push({
  16783. type: stateChar,
  16784. start: i - 1,
  16785. reStart: re.length,
  16786. open: plTypes$1[stateChar].open,
  16787. close: plTypes$1[stateChar].close
  16788. });
  16789. // negation is (?:(?!js)[^/]*)
  16790. re += stateChar === '!' ? '(?:(?!(?:' : '(?:';
  16791. this.debug('plType %j %j', stateChar, re);
  16792. stateChar = false;
  16793. continue
  16794. case ')':
  16795. if (inClass || !patternListStack.length) {
  16796. re += '\\)';
  16797. continue
  16798. }
  16799. clearStateChar();
  16800. hasMagic = true;
  16801. var pl = patternListStack.pop();
  16802. // negation is (?:(?!js)[^/]*)
  16803. // The others are (?:<pattern>)<type>
  16804. re += pl.close;
  16805. if (pl.type === '!') {
  16806. negativeLists.push(pl);
  16807. }
  16808. pl.reEnd = re.length;
  16809. continue
  16810. case '|':
  16811. if (inClass || !patternListStack.length || escaping) {
  16812. re += '\\|';
  16813. escaping = false;
  16814. continue
  16815. }
  16816. clearStateChar();
  16817. re += '|';
  16818. continue
  16819. // these are mostly the same in regexp and glob
  16820. case '[':
  16821. // swallow any state-tracking char before the [
  16822. clearStateChar();
  16823. if (inClass) {
  16824. re += '\\' + c;
  16825. continue
  16826. }
  16827. inClass = true;
  16828. classStart = i;
  16829. reClassStart = re.length;
  16830. re += c;
  16831. continue
  16832. case ']':
  16833. // a right bracket shall lose its special
  16834. // meaning and represent itself in
  16835. // a bracket expression if it occurs
  16836. // first in the list. -- POSIX.2 2.8.3.2
  16837. if (i === classStart + 1 || !inClass) {
  16838. re += '\\' + c;
  16839. escaping = false;
  16840. continue
  16841. }
  16842. // handle the case where we left a class open.
  16843. // "[z-a]" is valid, equivalent to "\[z-a\]"
  16844. if (inClass) {
  16845. // split where the last [ was, make sure we don't have
  16846. // an invalid re. if so, re-walk the contents of the
  16847. // would-be class to re-translate any characters that
  16848. // were passed through as-is
  16849. // TODO: It would probably be faster to determine this
  16850. // without a try/catch and a new RegExp, but it's tricky
  16851. // to do safely. For now, this is safe and works.
  16852. var cs = pattern.substring(classStart + 1, i);
  16853. try {
  16854. RegExp('[' + cs + ']');
  16855. } catch (er) {
  16856. // not a valid class!
  16857. var sp = this.parse(cs, SUBPARSE$1);
  16858. re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]';
  16859. hasMagic = hasMagic || sp[1];
  16860. inClass = false;
  16861. continue
  16862. }
  16863. }
  16864. // finish up the class.
  16865. hasMagic = true;
  16866. inClass = false;
  16867. re += c;
  16868. continue
  16869. default:
  16870. // swallow any state char that wasn't consumed
  16871. clearStateChar();
  16872. if (escaping) {
  16873. // no need
  16874. escaping = false;
  16875. } else if (reSpecials$1[c]
  16876. && !(c === '^' && inClass)) {
  16877. re += '\\';
  16878. }
  16879. re += c;
  16880. } // switch
  16881. } // for
  16882. // handle the case where we left a class open.
  16883. // "[abc" is valid, equivalent to "\[abc"
  16884. if (inClass) {
  16885. // split where the last [ was, and escape it
  16886. // this is a huge pita. We now have to re-walk
  16887. // the contents of the would-be class to re-translate
  16888. // any characters that were passed through as-is
  16889. cs = pattern.substr(classStart + 1);
  16890. sp = this.parse(cs, SUBPARSE$1);
  16891. re = re.substr(0, reClassStart) + '\\[' + sp[0];
  16892. hasMagic = hasMagic || sp[1];
  16893. }
  16894. // handle the case where we had a +( thing at the *end*
  16895. // of the pattern.
  16896. // each pattern list stack adds 3 chars, and we need to go through
  16897. // and escape any | chars that were passed through as-is for the regexp.
  16898. // Go through and escape them, taking care not to double-escape any
  16899. // | chars that were already escaped.
  16900. for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
  16901. var tail = re.slice(pl.reStart + pl.open.length);
  16902. this.debug('setting tail', re, pl);
  16903. // maybe some even number of \, then maybe 1 \, followed by a |
  16904. tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
  16905. if (!$2) {
  16906. // the | isn't already escaped, so escape it.
  16907. $2 = '\\';
  16908. }
  16909. // need to escape all those slashes *again*, without escaping the
  16910. // one that we need for escaping the | character. As it works out,
  16911. // escaping an even number of slashes can be done by simply repeating
  16912. // it exactly after itself. That's why this trick works.
  16913. //
  16914. // I am sorry that you have to see this.
  16915. return $1 + $1 + $2 + '|'
  16916. });
  16917. this.debug('tail=%j\n %s', tail, tail, pl, re);
  16918. var t = pl.type === '*' ? star$1
  16919. : pl.type === '?' ? qmark$1
  16920. : '\\' + pl.type;
  16921. hasMagic = true;
  16922. re = re.slice(0, pl.reStart) + t + '\\(' + tail;
  16923. }
  16924. // handle trailing things that only matter at the very end.
  16925. clearStateChar();
  16926. if (escaping) {
  16927. // trailing \\
  16928. re += '\\\\';
  16929. }
  16930. // only need to apply the nodot start if the re starts with
  16931. // something that could conceivably capture a dot
  16932. var addPatternStart = false;
  16933. switch (re.charAt(0)) {
  16934. case '.':
  16935. case '[':
  16936. case '(': addPatternStart = true;
  16937. }
  16938. // Hack to work around lack of negative lookbehind in JS
  16939. // A pattern like: *.!(x).!(y|z) needs to ensure that a name
  16940. // like 'a.xyz.yz' doesn't match. So, the first negative
  16941. // lookahead, has to look ALL the way ahead, to the end of
  16942. // the pattern.
  16943. for (var n = negativeLists.length - 1; n > -1; n--) {
  16944. var nl = negativeLists[n];
  16945. var nlBefore = re.slice(0, nl.reStart);
  16946. var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
  16947. var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
  16948. var nlAfter = re.slice(nl.reEnd);
  16949. nlLast += nlAfter;
  16950. // Handle nested stuff like *(*.js|!(*.json)), where open parens
  16951. // mean that we should *not* include the ) in the bit that is considered
  16952. // "after" the negated section.
  16953. var openParensBefore = nlBefore.split('(').length - 1;
  16954. var cleanAfter = nlAfter;
  16955. for (i = 0; i < openParensBefore; i++) {
  16956. cleanAfter = cleanAfter.replace(/\)[+*?]?/, '');
  16957. }
  16958. nlAfter = cleanAfter;
  16959. var dollar = '';
  16960. if (nlAfter === '' && isSub !== SUBPARSE$1) {
  16961. dollar = '$';
  16962. }
  16963. var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
  16964. re = newRe;
  16965. }
  16966. // if the re is not "" at this point, then we need to make sure
  16967. // it doesn't match against an empty path part.
  16968. // Otherwise a/* will match a/, which it should not.
  16969. if (re !== '' && hasMagic) {
  16970. re = '(?=.)' + re;
  16971. }
  16972. if (addPatternStart) {
  16973. re = patternStart + re;
  16974. }
  16975. // parsing just a piece of a larger pattern.
  16976. if (isSub === SUBPARSE$1) {
  16977. return [re, hasMagic]
  16978. }
  16979. // skip the regexp for non-magical patterns
  16980. // unescape anything in it, though, so that it'll be
  16981. // an exact match against a file etc.
  16982. if (!hasMagic) {
  16983. return globUnescape$1(pattern)
  16984. }
  16985. var flags = options.nocase ? 'i' : '';
  16986. try {
  16987. var regExp = new RegExp('^' + re + '$', flags);
  16988. } catch (er) {
  16989. // If it was an invalid regular expression, then it can't match
  16990. // anything. This trick looks for a character after the end of
  16991. // the string, which is of course impossible, except in multi-line
  16992. // mode, but it's not a /m regex.
  16993. return new RegExp('$.')
  16994. }
  16995. regExp._glob = pattern;
  16996. regExp._src = re;
  16997. return regExp
  16998. }
  16999. minimatch$1.makeRe = function (pattern, options) {
  17000. return new Minimatch$2(pattern, options || {}).makeRe()
  17001. };
  17002. Minimatch$2.prototype.makeRe = makeRe$1;
  17003. function makeRe$1 () {
  17004. if (this.regexp || this.regexp === false) return this.regexp
  17005. // at this point, this.set is a 2d array of partial
  17006. // pattern strings, or "**".
  17007. //
  17008. // It's better to use .match(). This function shouldn't
  17009. // be used, really, but it's pretty convenient sometimes,
  17010. // when you just want to work with a regex.
  17011. var set = this.set;
  17012. if (!set.length) {
  17013. this.regexp = false;
  17014. return this.regexp
  17015. }
  17016. var options = this.options;
  17017. var twoStar = options.noglobstar ? star$1
  17018. : options.dot ? twoStarDot$1
  17019. : twoStarNoDot$1;
  17020. var flags = options.nocase ? 'i' : '';
  17021. var re = set.map(function (pattern) {
  17022. return pattern.map(function (p) {
  17023. return (p === GLOBSTAR$1) ? twoStar
  17024. : (typeof p === 'string') ? regExpEscape$1(p)
  17025. : p._src
  17026. }).join('\\\/')
  17027. }).join('|');
  17028. // must match entire pattern
  17029. // ending in a * or ** will make it less strict.
  17030. re = '^(?:' + re + ')$';
  17031. // can match anything, as long as it's not this.
  17032. if (this.negate) re = '^(?!' + re + ').*$';
  17033. try {
  17034. this.regexp = new RegExp(re, flags);
  17035. } catch (ex) {
  17036. this.regexp = false;
  17037. }
  17038. return this.regexp
  17039. }
  17040. minimatch$1.match = function (list, pattern, options) {
  17041. options = options || {};
  17042. var mm = new Minimatch$2(pattern, options);
  17043. list = list.filter(function (f) {
  17044. return mm.match(f)
  17045. });
  17046. if (mm.options.nonull && !list.length) {
  17047. list.push(pattern);
  17048. }
  17049. return list
  17050. };
  17051. Minimatch$2.prototype.match = match;
  17052. function match (f, partial) {
  17053. this.debug('match', f, this.pattern);
  17054. // short-circuit in the case of busted things.
  17055. // comments, etc.
  17056. if (this.comment) return false
  17057. if (this.empty) return f === ''
  17058. if (f === '/' && partial) return true
  17059. var options = this.options;
  17060. // windows: need to use /, not \
  17061. if (path$1.sep !== '/') {
  17062. f = f.split(path$1.sep).join('/');
  17063. }
  17064. // treat the test path as a set of pathparts.
  17065. f = f.split(slashSplit$1);
  17066. this.debug(this.pattern, 'split', f);
  17067. // just ONE of the pattern sets in this.set needs to match
  17068. // in order for it to be valid. If negating, then just one
  17069. // match means that we have failed.
  17070. // Either way, return on the first hit.
  17071. var set = this.set;
  17072. this.debug(this.pattern, 'set', set);
  17073. // Find the basename of the path by looking for the last non-empty segment
  17074. var filename;
  17075. var i;
  17076. for (i = f.length - 1; i >= 0; i--) {
  17077. filename = f[i];
  17078. if (filename) break
  17079. }
  17080. for (i = 0; i < set.length; i++) {
  17081. var pattern = set[i];
  17082. var file = f;
  17083. if (options.matchBase && pattern.length === 1) {
  17084. file = [filename];
  17085. }
  17086. var hit = this.matchOne(file, pattern, partial);
  17087. if (hit) {
  17088. if (options.flipNegate) return true
  17089. return !this.negate
  17090. }
  17091. }
  17092. // didn't get any hits. this is success if it's a negative
  17093. // pattern, failure otherwise.
  17094. if (options.flipNegate) return false
  17095. return this.negate
  17096. }
  17097. // set partial to true to test if, for example,
  17098. // "/a/b" matches the start of "/*/b/*/d"
  17099. // Partial means, if you run out of file before you run
  17100. // out of pattern, then that's fine, as long as all
  17101. // the parts match.
  17102. Minimatch$2.prototype.matchOne = function (file, pattern, partial) {
  17103. var options = this.options;
  17104. this.debug('matchOne',
  17105. { 'this': this, file: file, pattern: pattern });
  17106. this.debug('matchOne', file.length, pattern.length);
  17107. for (var fi = 0,
  17108. pi = 0,
  17109. fl = file.length,
  17110. pl = pattern.length
  17111. ; (fi < fl) && (pi < pl)
  17112. ; fi++, pi++) {
  17113. this.debug('matchOne loop');
  17114. var p = pattern[pi];
  17115. var f = file[fi];
  17116. this.debug(pattern, p, f);
  17117. // should be impossible.
  17118. // some invalid regexp stuff in the set.
  17119. if (p === false) return false
  17120. if (p === GLOBSTAR$1) {
  17121. this.debug('GLOBSTAR', [pattern, p, f]);
  17122. // "**"
  17123. // a/**/b/**/c would match the following:
  17124. // a/b/x/y/z/c
  17125. // a/x/y/z/b/c
  17126. // a/b/x/b/x/c
  17127. // a/b/c
  17128. // To do this, take the rest of the pattern after
  17129. // the **, and see if it would match the file remainder.
  17130. // If so, return success.
  17131. // If not, the ** "swallows" a segment, and try again.
  17132. // This is recursively awful.
  17133. //
  17134. // a/**/b/**/c matching a/b/x/y/z/c
  17135. // - a matches a
  17136. // - doublestar
  17137. // - matchOne(b/x/y/z/c, b/**/c)
  17138. // - b matches b
  17139. // - doublestar
  17140. // - matchOne(x/y/z/c, c) -> no
  17141. // - matchOne(y/z/c, c) -> no
  17142. // - matchOne(z/c, c) -> no
  17143. // - matchOne(c, c) yes, hit
  17144. var fr = fi;
  17145. var pr = pi + 1;
  17146. if (pr === pl) {
  17147. this.debug('** at the end');
  17148. // a ** at the end will just swallow the rest.
  17149. // We have found a match.
  17150. // however, it will not swallow /.x, unless
  17151. // options.dot is set.
  17152. // . and .. are *never* matched by **, for explosively
  17153. // exponential reasons.
  17154. for (; fi < fl; fi++) {
  17155. if (file[fi] === '.' || file[fi] === '..' ||
  17156. (!options.dot && file[fi].charAt(0) === '.')) return false
  17157. }
  17158. return true
  17159. }
  17160. // ok, let's see if we can swallow whatever we can.
  17161. while (fr < fl) {
  17162. var swallowee = file[fr];
  17163. this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
  17164. // XXX remove this slice. Just pass the start index.
  17165. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
  17166. this.debug('globstar found match!', fr, fl, swallowee);
  17167. // found a match.
  17168. return true
  17169. } else {
  17170. // can't swallow "." or ".." ever.
  17171. // can only swallow ".foo" when explicitly asked.
  17172. if (swallowee === '.' || swallowee === '..' ||
  17173. (!options.dot && swallowee.charAt(0) === '.')) {
  17174. this.debug('dot detected!', file, fr, pattern, pr);
  17175. break
  17176. }
  17177. // ** swallows a segment, and continue.
  17178. this.debug('globstar swallow a segment, and continue');
  17179. fr++;
  17180. }
  17181. }
  17182. // no match was found.
  17183. // However, in partial mode, we can't say this is necessarily over.
  17184. // If there's more *pattern* left, then
  17185. if (partial) {
  17186. // ran out of file
  17187. this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
  17188. if (fr === fl) return true
  17189. }
  17190. return false
  17191. }
  17192. // something other than **
  17193. // non-magic patterns just have to match exactly
  17194. // patterns with magic have been turned into regexps.
  17195. var hit;
  17196. if (typeof p === 'string') {
  17197. if (options.nocase) {
  17198. hit = f.toLowerCase() === p.toLowerCase();
  17199. } else {
  17200. hit = f === p;
  17201. }
  17202. this.debug('string match', p, f, hit);
  17203. } else {
  17204. hit = f.match(p);
  17205. this.debug('pattern match', p, f, hit);
  17206. }
  17207. if (!hit) return false
  17208. }
  17209. // Note: ending in / means that we'll get a final ""
  17210. // at the end of the pattern. This can only match a
  17211. // corresponding "" at the end of the file.
  17212. // If the file ends in /, then it can only match a
  17213. // a pattern that ends in /, unless the pattern just
  17214. // doesn't have any more for it. But, a/b/ should *not*
  17215. // match "a/b/*", even though "" matches against the
  17216. // [^/]*? pattern, except in partial mode, where it might
  17217. // simply not be reached yet.
  17218. // However, a/b/ should still satisfy a/*
  17219. // now either we fell off the end of the pattern, or we're done.
  17220. if (fi === fl && pi === pl) {
  17221. // ran out of pattern and filename at the same time.
  17222. // an exact hit!
  17223. return true
  17224. } else if (fi === fl) {
  17225. // ran out of file, but still had pattern left.
  17226. // this is ok if we're doing the match as part of
  17227. // a glob fs traversal.
  17228. return partial
  17229. } else if (pi === pl) {
  17230. // ran out of pattern, still have file left.
  17231. // this is only acceptable if we're on the very last
  17232. // empty segment of a file with a trailing slash.
  17233. // a/* should match a/b/
  17234. var emptyFileEnd = (fi === fl - 1) && (file[fi] === '');
  17235. return emptyFileEnd
  17236. }
  17237. // should be unreachable.
  17238. throw new Error('wtf?')
  17239. };
  17240. // replace stuff like \* with *
  17241. function globUnescape$1 (s) {
  17242. return s.replace(/\\(.)/g, '$1')
  17243. }
  17244. function regExpEscape$1 (s) {
  17245. return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
  17246. }
  17247. const getComponentAssetsCopyTasks = (config, buildCtx, dest, collectionsPath) => {
  17248. if (!dest) {
  17249. return [];
  17250. }
  17251. // get a list of all the directories to copy
  17252. // these paths should be absolute
  17253. const copyTasks = [];
  17254. const cmps = buildCtx.components;
  17255. cmps
  17256. .filter((cmp) => cmp.assetsDirs != null && cmp.assetsDirs.length > 0)
  17257. .forEach((cmp) => {
  17258. if (!collectionsPath) {
  17259. cmp.assetsDirs.forEach((assetsMeta) => {
  17260. copyTasks.push({
  17261. src: assetsMeta.absolutePath,
  17262. dest: join(dest, assetsMeta.cmpRelativePath),
  17263. warn: false,
  17264. keepDirStructure: false,
  17265. });
  17266. });
  17267. }
  17268. else if (!cmp.excludeFromCollection && !cmp.isCollectionDependency) {
  17269. cmp.assetsDirs.forEach((assetsMeta) => {
  17270. const collectionDirDestination = join(dest, relative$1(config.srcDir, assetsMeta.absolutePath));
  17271. copyTasks.push({
  17272. src: assetsMeta.absolutePath,
  17273. dest: collectionDirDestination,
  17274. warn: false,
  17275. keepDirStructure: false,
  17276. });
  17277. });
  17278. }
  17279. });
  17280. buildCtx.debug(`getComponentAssetsCopyTasks: ${copyTasks.length}`);
  17281. return copyTasks;
  17282. };
  17283. const canSkipAssetsCopy = (compilerCtx, entryModules, filesChanged) => {
  17284. if (!compilerCtx.hasSuccessfulBuild) {
  17285. // always copy assets if we haven't had a successful build yet
  17286. // cannot skip build
  17287. return false;
  17288. }
  17289. // assume we want to skip copying assets again
  17290. let shouldSkipAssetsCopy = true;
  17291. // loop through each of the changed files
  17292. filesChanged.forEach((changedFile) => {
  17293. // get the directory of where the changed file is in
  17294. const changedFileDirPath = normalizePath$1(dirname(changedFile));
  17295. // loop through all the possible asset directories
  17296. entryModules.forEach((entryModule) => {
  17297. entryModule.cmps.forEach((cmp) => {
  17298. if (cmp.assetsDirs != null) {
  17299. // loop through each of the asset directories of each component
  17300. cmp.assetsDirs.forEach((assetsDir) => {
  17301. // get the absolute of the asset directory
  17302. const assetDirPath = normalizePath$1(assetsDir.absolutePath);
  17303. // if the changed file directory is this asset directory
  17304. // then we should recopy everything over again
  17305. if (changedFileDirPath === assetDirPath) {
  17306. shouldSkipAssetsCopy = false;
  17307. return;
  17308. }
  17309. });
  17310. }
  17311. });
  17312. });
  17313. });
  17314. return shouldSkipAssetsCopy;
  17315. };
  17316. const getSrcAbsPath = (config, src) => {
  17317. if (isAbsolute$1(src)) {
  17318. return src;
  17319. }
  17320. return join(config.srcDir, src);
  17321. };
  17322. const getDestAbsPath = (src, destAbsPath, destRelPath) => {
  17323. if (destRelPath) {
  17324. if (isAbsolute$1(destRelPath)) {
  17325. return destRelPath;
  17326. }
  17327. else {
  17328. return join(destAbsPath, destRelPath);
  17329. }
  17330. }
  17331. if (isAbsolute$1(src)) {
  17332. throw new Error(`copy task, "dest" property must exist if "src" property is an absolute path: ${src}`);
  17333. }
  17334. return destAbsPath;
  17335. };
  17336. const outputCopy = async (config, compilerCtx, buildCtx) => {
  17337. const outputTargets = config.outputTargets.filter(isOutputTargetCopy);
  17338. if (outputTargets.length === 0) {
  17339. return;
  17340. }
  17341. const changedFiles = [...buildCtx.filesUpdated, ...buildCtx.filesAdded, ...buildCtx.dirsAdded];
  17342. const copyTasks = [];
  17343. const needsCopyAssets = !canSkipAssetsCopy(compilerCtx, buildCtx.entryModules, buildCtx.filesChanged);
  17344. outputTargets.forEach((o) => {
  17345. if (needsCopyAssets && o.copyAssets) {
  17346. copyTasks.push(...getComponentAssetsCopyTasks(config, buildCtx, o.dir, o.copyAssets === 'collection'));
  17347. }
  17348. copyTasks.push(...getCopyTasks(config, buildCtx, o, changedFiles));
  17349. });
  17350. if (copyTasks.length > 0) {
  17351. const timespan = buildCtx.createTimeSpan(`copy started`);
  17352. let copiedFiles = 0;
  17353. try {
  17354. const copyResults = await config.sys.copy(copyTasks, config.srcDir);
  17355. if (copyResults != null) {
  17356. buildCtx.diagnostics.push(...copyResults.diagnostics);
  17357. compilerCtx.fs.cancelDeleteDirectoriesFromDisk(copyResults.dirPaths);
  17358. compilerCtx.fs.cancelDeleteFilesFromDisk(copyResults.filePaths);
  17359. copiedFiles = copyResults.filePaths.length;
  17360. }
  17361. }
  17362. catch (e) {
  17363. const err = buildError(buildCtx.diagnostics);
  17364. if (e instanceof Error) {
  17365. err.messageText = e.message;
  17366. }
  17367. }
  17368. timespan.finish(`copy finished (${copiedFiles} file${copiedFiles === 1 ? '' : 's'})`);
  17369. }
  17370. };
  17371. const getCopyTasks = (config, buildCtx, o, changedFiles) => {
  17372. if (!Array.isArray(o.copy)) {
  17373. return [];
  17374. }
  17375. const copyTasks = !buildCtx.isRebuild || buildCtx.requiresFullBuild ? o.copy : filterCopyTasks(config, o.copy, changedFiles);
  17376. return copyTasks.map((t) => transformToAbs(t, o.dir));
  17377. };
  17378. const filterCopyTasks = (config, tasks, changedFiles) => {
  17379. if (Array.isArray(tasks)) {
  17380. return tasks.filter((copy) => {
  17381. let copySrc = copy.src;
  17382. if (isGlob(copySrc)) {
  17383. // test the glob
  17384. copySrc = join(config.srcDir, copySrc);
  17385. if (changedFiles.some(minimatch_1$1.filter(copySrc))) {
  17386. return true;
  17387. }
  17388. }
  17389. else {
  17390. copySrc = normalizePath$1(getSrcAbsPath(config, copySrc + '/'));
  17391. if (changedFiles.some((f) => f.startsWith(copySrc))) {
  17392. return true;
  17393. }
  17394. }
  17395. return false;
  17396. });
  17397. }
  17398. return [];
  17399. };
  17400. const transformToAbs = (copyTask, dest) => {
  17401. return {
  17402. src: copyTask.src,
  17403. dest: getDestAbsPath(copyTask.src, dest, copyTask.dest),
  17404. keepDirStructure: typeof copyTask.keepDirStructure === 'boolean' ? copyTask.keepDirStructure : copyTask.dest == null,
  17405. warn: copyTask.warn !== false,
  17406. };
  17407. };
  17408. /**
  17409. * This method is responsible for replacing user-defined import path aliases ({@link https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping})
  17410. * with generated relative import paths during the transformation step of the TS compilation process.
  17411. * This action is taken to prevent issues with import paths not being transpiled at build time resulting in
  17412. * unknown imports in output code for some output targets (`dist-collection` for instance). Output targets that do not run through a bundler
  17413. * are unable to resolve imports using the aliased path names and TS intentionally does not replace resolved paths as a part of
  17414. * their compiler ({@link https://github.com/microsoft/TypeScript/issues/10866})
  17415. *
  17416. * @param config The Stencil configuration object.
  17417. * @param destinationFilePath The location on disk the file will be written to.
  17418. * @param outputTarget The configuration for the collection output target.
  17419. * @returns A factory for creating a {@link ts.Transformer}.
  17420. */
  17421. const mapImportsToPathAliases = (config, destinationFilePath, outputTarget) => {
  17422. return (transformCtx) => {
  17423. const compilerHost = t.createCompilerHost(config.tsCompilerOptions);
  17424. const visit = (sourceFile) => (node) => {
  17425. var _a, _b;
  17426. // Only transform paths when the `transformAliasedImportPaths` flag is
  17427. // set on the output target config
  17428. //
  17429. // We should only attempt to transform standard module imports:
  17430. // - import * as ts from 'typescript';
  17431. // - import { Foo, Bar } from 'baz';
  17432. // - import { Foo as Bar } from 'baz';
  17433. // - import Foo from 'bar';
  17434. // We should NOT transform other import declaration types:
  17435. // - import a = Foo.Bar
  17436. if (outputTarget.transformAliasedImportPaths &&
  17437. t.isImportDeclaration(node) &&
  17438. t.isStringLiteral(node.moduleSpecifier)) {
  17439. let importPath = node.moduleSpecifier.text;
  17440. // We will ignore transforming any paths that are already relative paths or
  17441. // imports from external modules/packages
  17442. if (!importPath.startsWith('.')) {
  17443. const module = t.resolveModuleName(importPath, sourceFile, config.tsCompilerOptions, compilerHost);
  17444. const hasResolvedFileName = ((_a = module.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) != null;
  17445. const isModuleFromNodeModules = ((_b = module.resolvedModule) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport) === true;
  17446. const shouldTranspileImportPath = hasResolvedFileName && !isModuleFromNodeModules;
  17447. if (shouldTranspileImportPath) {
  17448. // Create a regular expression that will be used to remove the last file extension
  17449. // from the import path
  17450. const extensionRegex = new RegExp(Object.values(t.Extension)
  17451. .map((extension) => `${extension}$`)
  17452. .join('|'));
  17453. // In order to make sure the relative path works when the destination depth is different than the source
  17454. // file structure depth, we need to determine where the resolved file exists relative to the destination directory
  17455. const resolvePathInDestination = module.resolvedModule.resolvedFileName.replace(config.srcDir, outputTarget.collectionDir);
  17456. importPath = normalizePath$1(relative$1(dirname(destinationFilePath), resolvePathInDestination).replace(extensionRegex, ''));
  17457. }
  17458. }
  17459. return transformCtx.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, transformCtx.factory.createStringLiteral(importPath), node.assertClause);
  17460. }
  17461. return t.visitEachChild(node, visit(sourceFile), transformCtx);
  17462. };
  17463. return (tsSourceFile) => {
  17464. return t.visitEachChild(tsSourceFile, visit(tsSourceFile.fileName), transformCtx);
  17465. };
  17466. };
  17467. };
  17468. /**
  17469. * Main output target function for `dist-collection`. This function takes the compiled output from a
  17470. * {@link ts.Program}, runs each file through a transformer to transpile import path aliases, and then writes
  17471. * the output code and source maps to disk in the specified collection directory.
  17472. *
  17473. * @param config The validated Stencil config.
  17474. * @param compilerCtx The current compiler context.
  17475. * @param buildCtx The current build context.
  17476. * @param changedModuleFiles The changed modules returned from the TS compiler.
  17477. * @returns An empty promise. Resolved once all functions finish.
  17478. */
  17479. const outputCollection = async (config, compilerCtx, buildCtx, changedModuleFiles) => {
  17480. const outputTargets = config.outputTargets.filter(isOutputTargetDistCollection);
  17481. if (outputTargets.length === 0) {
  17482. return;
  17483. }
  17484. const bundlingEventMessage = `generate collections${config.sourceMap ? ' + source maps' : ''}`;
  17485. const timespan = buildCtx.createTimeSpan(`${bundlingEventMessage} started`, true);
  17486. try {
  17487. await Promise.all(changedModuleFiles.map(async (mod) => {
  17488. let code = mod.staticSourceFileText;
  17489. if (config.preamble) {
  17490. code = `${generatePreamble(config)}\n${code}`;
  17491. }
  17492. const mapCode = mod.sourceMapFileText;
  17493. await Promise.all(outputTargets.map(async (target) => {
  17494. const relPath = relative$1(config.srcDir, mod.jsFilePath);
  17495. const filePath = join(target.collectionDir, relPath);
  17496. // Transpile the already transpiled modules to apply
  17497. // a transformer to convert aliased import paths to relative paths
  17498. // We run this even if the transformer will perform no action
  17499. // to avoid race conditions between multiple output targets that
  17500. // may be writing to the same location
  17501. const { outputText } = t.transpileModule(code, {
  17502. fileName: mod.sourceFilePath,
  17503. compilerOptions: {
  17504. target: t.ScriptTarget.Latest,
  17505. },
  17506. transformers: {
  17507. after: [mapImportsToPathAliases(config, filePath, target)],
  17508. },
  17509. });
  17510. await compilerCtx.fs.writeFile(filePath, outputText, { outputTargetType: target.type });
  17511. if (mod.sourceMapPath) {
  17512. const relativeSourceMapPath = relative$1(config.srcDir, mod.sourceMapPath);
  17513. const sourceMapOutputFilePath = join(target.collectionDir, relativeSourceMapPath);
  17514. await compilerCtx.fs.writeFile(sourceMapOutputFilePath, mapCode, { outputTargetType: target.type });
  17515. }
  17516. }));
  17517. }));
  17518. await writeCollectionManifests(config, compilerCtx, buildCtx, outputTargets);
  17519. }
  17520. catch (e) {
  17521. catchError(buildCtx.diagnostics, e);
  17522. }
  17523. timespan.finish(`${bundlingEventMessage} finished`);
  17524. };
  17525. const writeCollectionManifests = async (config, compilerCtx, buildCtx, outputTargets) => {
  17526. const collectionData = JSON.stringify(serializeCollectionManifest(config, compilerCtx, buildCtx), null, 2);
  17527. return Promise.all(outputTargets.map((o) => writeCollectionManifest(compilerCtx, collectionData, o)));
  17528. };
  17529. // this maps the json data to our internal data structure
  17530. // mapping is so that the internal data structure "could"
  17531. // change, but the external user data will always use the same api
  17532. // over the top lame mapping functions is basically so we can loosely
  17533. // couple core component meta data between specific versions of the compiler
  17534. const writeCollectionManifest = async (compilerCtx, collectionData, outputTarget) => {
  17535. // get the absolute path to the directory where the collection will be saved
  17536. const collectionDir = normalizePath$1(outputTarget.collectionDir);
  17537. // create an absolute file path to the actual collection json file
  17538. const collectionFilePath = normalizePath$1(join(collectionDir, COLLECTION_MANIFEST_FILE_NAME));
  17539. // don't bother serializing/writing the collection if we're not creating a distribution
  17540. await compilerCtx.fs.writeFile(collectionFilePath, collectionData);
  17541. };
  17542. const serializeCollectionManifest = (config, compilerCtx, buildCtx) => {
  17543. // create the single collection we're going to fill up with data
  17544. const collectionManifest = {
  17545. entries: buildCtx.moduleFiles
  17546. .filter((mod) => !mod.isCollectionDependency && mod.cmps.length > 0)
  17547. .map((mod) => relative$1(config.srcDir, mod.jsFilePath)),
  17548. compiler: {
  17549. name: '@stencil/core',
  17550. version: version$3,
  17551. typescriptVersion,
  17552. },
  17553. collections: serializeCollectionDependencies(compilerCtx),
  17554. bundles: config.bundles.map((b) => ({
  17555. components: b.components.slice().sort(),
  17556. })),
  17557. };
  17558. if (config.globalScript) {
  17559. const mod = compilerCtx.moduleMap.get(normalizePath$1(config.globalScript));
  17560. if (mod) {
  17561. collectionManifest.global = relative$1(config.srcDir, mod.jsFilePath);
  17562. }
  17563. }
  17564. return collectionManifest;
  17565. };
  17566. const serializeCollectionDependencies = (compilerCtx) => {
  17567. const collectionDeps = compilerCtx.collections.map((c) => ({
  17568. name: c.collectionName,
  17569. tags: flatOne(c.moduleFiles.map((m) => m.cmps))
  17570. .map((cmp) => cmp.tagName)
  17571. .sort(),
  17572. }));
  17573. return sortBy(collectionDeps, (item) => item.name);
  17574. };
  17575. /**
  17576. * Node builtin modules as of v14.5.0
  17577. */
  17578. const NODE_BUILTINS = [
  17579. '_http_agent',
  17580. '_http_client',
  17581. '_http_common',
  17582. '_http_incoming',
  17583. '_http_outgoing',
  17584. '_http_server',
  17585. '_stream_duplex',
  17586. '_stream_passthrough',
  17587. '_stream_readable',
  17588. '_stream_transform',
  17589. '_stream_wrap',
  17590. '_stream_writable',
  17591. '_tls_common',
  17592. '_tls_wrap',
  17593. 'assert',
  17594. 'async_hooks',
  17595. 'buffer',
  17596. 'child_process',
  17597. 'cluster',
  17598. 'console',
  17599. 'constants',
  17600. 'crypto',
  17601. 'dgram',
  17602. 'dns',
  17603. 'domain',
  17604. 'events',
  17605. 'fs',
  17606. 'fs/promises',
  17607. 'http',
  17608. 'http2',
  17609. 'https',
  17610. 'inspector',
  17611. 'module',
  17612. 'net',
  17613. 'os',
  17614. 'path',
  17615. 'perf_hooks',
  17616. 'process',
  17617. 'punycode',
  17618. 'querystring',
  17619. 'readline',
  17620. 'repl',
  17621. 'stream',
  17622. 'string_decoder',
  17623. 'sys',
  17624. 'timers',
  17625. 'tls',
  17626. 'trace_events',
  17627. 'tty',
  17628. 'url',
  17629. 'util',
  17630. 'v8',
  17631. 'vm',
  17632. 'worker_threads',
  17633. 'zlib',
  17634. ];
  17635. class Module$1 {
  17636. static get builtinModules() {
  17637. return NODE_BUILTINS;
  17638. }
  17639. }
  17640. // Rollup 2.42.3
  17641. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17642. function createCommonjsModule(fn, basedir, module) {
  17643. return module = {
  17644. path: basedir,
  17645. exports: {},
  17646. require: function (path, base) {
  17647. return commonjsRequire();
  17648. }
  17649. }, fn(module, module.exports), module.exports;
  17650. }
  17651. function commonjsRequire () {
  17652. throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
  17653. }
  17654. const WIN_SLASH = '\\\\/';
  17655. const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
  17656. /**
  17657. * Posix glob regex
  17658. */
  17659. const DOT_LITERAL = '\\.';
  17660. const PLUS_LITERAL = '\\+';
  17661. const QMARK_LITERAL = '\\?';
  17662. const SLASH_LITERAL = '\\/';
  17663. const ONE_CHAR = '(?=.)';
  17664. const QMARK = '[^/]';
  17665. const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
  17666. const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
  17667. const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
  17668. const NO_DOT = `(?!${DOT_LITERAL})`;
  17669. const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
  17670. const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
  17671. const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
  17672. const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
  17673. const STAR = `${QMARK}*?`;
  17674. const POSIX_CHARS = {
  17675. DOT_LITERAL,
  17676. PLUS_LITERAL,
  17677. QMARK_LITERAL,
  17678. SLASH_LITERAL,
  17679. ONE_CHAR,
  17680. QMARK,
  17681. END_ANCHOR,
  17682. DOTS_SLASH,
  17683. NO_DOT,
  17684. NO_DOTS,
  17685. NO_DOT_SLASH,
  17686. NO_DOTS_SLASH,
  17687. QMARK_NO_DOT,
  17688. STAR,
  17689. START_ANCHOR
  17690. };
  17691. /**
  17692. * Windows glob regex
  17693. */
  17694. const WINDOWS_CHARS = {
  17695. ...POSIX_CHARS,
  17696. SLASH_LITERAL: `[${WIN_SLASH}]`,
  17697. QMARK: WIN_NO_SLASH,
  17698. STAR: `${WIN_NO_SLASH}*?`,
  17699. DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  17700. NO_DOT: `(?!${DOT_LITERAL})`,
  17701. NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  17702. NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  17703. NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  17704. QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  17705. START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  17706. END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
  17707. };
  17708. /**
  17709. * POSIX Bracket Regex
  17710. */
  17711. const POSIX_REGEX_SOURCE$1 = {
  17712. alnum: 'a-zA-Z0-9',
  17713. alpha: 'a-zA-Z',
  17714. ascii: '\\x00-\\x7F',
  17715. blank: ' \\t',
  17716. cntrl: '\\x00-\\x1F\\x7F',
  17717. digit: '0-9',
  17718. graph: '\\x21-\\x7E',
  17719. lower: 'a-z',
  17720. print: '\\x20-\\x7E ',
  17721. punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
  17722. space: ' \\t\\r\\n\\v\\f',
  17723. upper: 'A-Z',
  17724. word: 'A-Za-z0-9_',
  17725. xdigit: 'A-Fa-f0-9'
  17726. };
  17727. var constants = {
  17728. MAX_LENGTH: 1024 * 64,
  17729. POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
  17730. // regular expressions
  17731. REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  17732. REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  17733. REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  17734. REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  17735. REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  17736. REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
  17737. // Replace globs with equivalent patterns to reduce parsing time.
  17738. REPLACEMENTS: {
  17739. '***': '*',
  17740. '**/**': '**',
  17741. '**/**/**': '**'
  17742. },
  17743. // Digits
  17744. CHAR_0: 48, /* 0 */
  17745. CHAR_9: 57, /* 9 */
  17746. // Alphabet chars.
  17747. CHAR_UPPERCASE_A: 65, /* A */
  17748. CHAR_LOWERCASE_A: 97, /* a */
  17749. CHAR_UPPERCASE_Z: 90, /* Z */
  17750. CHAR_LOWERCASE_Z: 122, /* z */
  17751. CHAR_LEFT_PARENTHESES: 40, /* ( */
  17752. CHAR_RIGHT_PARENTHESES: 41, /* ) */
  17753. CHAR_ASTERISK: 42, /* * */
  17754. // Non-alphabetic chars.
  17755. CHAR_AMPERSAND: 38, /* & */
  17756. CHAR_AT: 64, /* @ */
  17757. CHAR_BACKWARD_SLASH: 92, /* \ */
  17758. CHAR_CARRIAGE_RETURN: 13, /* \r */
  17759. CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
  17760. CHAR_COLON: 58, /* : */
  17761. CHAR_COMMA: 44, /* , */
  17762. CHAR_DOT: 46, /* . */
  17763. CHAR_DOUBLE_QUOTE: 34, /* " */
  17764. CHAR_EQUAL: 61, /* = */
  17765. CHAR_EXCLAMATION_MARK: 33, /* ! */
  17766. CHAR_FORM_FEED: 12, /* \f */
  17767. CHAR_FORWARD_SLASH: 47, /* / */
  17768. CHAR_GRAVE_ACCENT: 96, /* ` */
  17769. CHAR_HASH: 35, /* # */
  17770. CHAR_HYPHEN_MINUS: 45, /* - */
  17771. CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
  17772. CHAR_LEFT_CURLY_BRACE: 123, /* { */
  17773. CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
  17774. CHAR_LINE_FEED: 10, /* \n */
  17775. CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
  17776. CHAR_PERCENT: 37, /* % */
  17777. CHAR_PLUS: 43, /* + */
  17778. CHAR_QUESTION_MARK: 63, /* ? */
  17779. CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
  17780. CHAR_RIGHT_CURLY_BRACE: 125, /* } */
  17781. CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
  17782. CHAR_SEMICOLON: 59, /* ; */
  17783. CHAR_SINGLE_QUOTE: 39, /* ' */
  17784. CHAR_SPACE: 32, /* */
  17785. CHAR_TAB: 9, /* \t */
  17786. CHAR_UNDERSCORE: 95, /* _ */
  17787. CHAR_VERTICAL_LINE: 124, /* | */
  17788. CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
  17789. SEP: path$5.sep,
  17790. /**
  17791. * Create EXTGLOB_CHARS
  17792. */
  17793. extglobChars(chars) {
  17794. return {
  17795. '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
  17796. '?': { type: 'qmark', open: '(?:', close: ')?' },
  17797. '+': { type: 'plus', open: '(?:', close: ')+' },
  17798. '*': { type: 'star', open: '(?:', close: ')*' },
  17799. '@': { type: 'at', open: '(?:', close: ')' }
  17800. };
  17801. },
  17802. /**
  17803. * Create GLOB_CHARS
  17804. */
  17805. globChars(win32) {
  17806. return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  17807. }
  17808. };
  17809. var utils$1 = createCommonjsModule(function (module, exports) {
  17810. const win32 = process.platform === 'win32';
  17811. const {
  17812. REGEX_BACKSLASH,
  17813. REGEX_REMOVE_BACKSLASH,
  17814. REGEX_SPECIAL_CHARS,
  17815. REGEX_SPECIAL_CHARS_GLOBAL
  17816. } = constants;
  17817. exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
  17818. exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
  17819. exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
  17820. exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
  17821. exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
  17822. exports.removeBackslashes = str => {
  17823. return str.replace(REGEX_REMOVE_BACKSLASH, match => {
  17824. return match === '\\' ? '' : match;
  17825. });
  17826. };
  17827. exports.supportsLookbehinds = () => {
  17828. const segs = process.version.slice(1).split('.').map(Number);
  17829. if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
  17830. return true;
  17831. }
  17832. return false;
  17833. };
  17834. exports.isWindows = options => {
  17835. if (options && typeof options.windows === 'boolean') {
  17836. return options.windows;
  17837. }
  17838. return win32 === true || path$5.sep === '\\';
  17839. };
  17840. exports.escapeLast = (input, char, lastIdx) => {
  17841. const idx = input.lastIndexOf(char, lastIdx);
  17842. if (idx === -1) return input;
  17843. if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
  17844. return `${input.slice(0, idx)}\\${input.slice(idx)}`;
  17845. };
  17846. exports.removePrefix = (input, state = {}) => {
  17847. let output = input;
  17848. if (output.startsWith('./')) {
  17849. output = output.slice(2);
  17850. state.prefix = './';
  17851. }
  17852. return output;
  17853. };
  17854. exports.wrapOutput = (input, state = {}, options = {}) => {
  17855. const prepend = options.contains ? '' : '^';
  17856. const append = options.contains ? '' : '$';
  17857. let output = `${prepend}(?:${input})${append}`;
  17858. if (state.negated === true) {
  17859. output = `(?:^(?!${output}).*$)`;
  17860. }
  17861. return output;
  17862. };
  17863. });
  17864. const {
  17865. CHAR_ASTERISK, /* * */
  17866. CHAR_AT, /* @ */
  17867. CHAR_BACKWARD_SLASH, /* \ */
  17868. CHAR_COMMA, /* , */
  17869. CHAR_DOT, /* . */
  17870. CHAR_EXCLAMATION_MARK, /* ! */
  17871. CHAR_FORWARD_SLASH, /* / */
  17872. CHAR_LEFT_CURLY_BRACE, /* { */
  17873. CHAR_LEFT_PARENTHESES, /* ( */
  17874. CHAR_LEFT_SQUARE_BRACKET, /* [ */
  17875. CHAR_PLUS, /* + */
  17876. CHAR_QUESTION_MARK, /* ? */
  17877. CHAR_RIGHT_CURLY_BRACE, /* } */
  17878. CHAR_RIGHT_PARENTHESES, /* ) */
  17879. CHAR_RIGHT_SQUARE_BRACKET /* ] */
  17880. } = constants;
  17881. const isPathSeparator = code => {
  17882. return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
  17883. };
  17884. const depth = token => {
  17885. if (token.isPrefix !== true) {
  17886. token.depth = token.isGlobstar ? Infinity : 1;
  17887. }
  17888. };
  17889. /**
  17890. * Quickly scans a glob pattern and returns an object with a handful of
  17891. * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
  17892. * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
  17893. * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
  17894. *
  17895. * ```js
  17896. * const pm = require('picomatch');
  17897. * console.log(pm.scan('foo/bar/*.js'));
  17898. * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
  17899. * ```
  17900. * @param {String} `str`
  17901. * @param {Object} `options`
  17902. * @return {Object} Returns an object with tokens and regex source string.
  17903. * @api public
  17904. */
  17905. const scan = (input, options) => {
  17906. const opts = options || {};
  17907. const length = input.length - 1;
  17908. const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  17909. const slashes = [];
  17910. const tokens = [];
  17911. const parts = [];
  17912. let str = input;
  17913. let index = -1;
  17914. let start = 0;
  17915. let lastIndex = 0;
  17916. let isBrace = false;
  17917. let isBracket = false;
  17918. let isGlob = false;
  17919. let isExtglob = false;
  17920. let isGlobstar = false;
  17921. let braceEscaped = false;
  17922. let backslashes = false;
  17923. let negated = false;
  17924. let negatedExtglob = false;
  17925. let finished = false;
  17926. let braces = 0;
  17927. let prev;
  17928. let code;
  17929. let token = { value: '', depth: 0, isGlob: false };
  17930. const eos = () => index >= length;
  17931. const peek = () => str.charCodeAt(index + 1);
  17932. const advance = () => {
  17933. prev = code;
  17934. return str.charCodeAt(++index);
  17935. };
  17936. while (index < length) {
  17937. code = advance();
  17938. let next;
  17939. if (code === CHAR_BACKWARD_SLASH) {
  17940. backslashes = token.backslashes = true;
  17941. code = advance();
  17942. if (code === CHAR_LEFT_CURLY_BRACE) {
  17943. braceEscaped = true;
  17944. }
  17945. continue;
  17946. }
  17947. if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
  17948. braces++;
  17949. while (eos() !== true && (code = advance())) {
  17950. if (code === CHAR_BACKWARD_SLASH) {
  17951. backslashes = token.backslashes = true;
  17952. advance();
  17953. continue;
  17954. }
  17955. if (code === CHAR_LEFT_CURLY_BRACE) {
  17956. braces++;
  17957. continue;
  17958. }
  17959. if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
  17960. isBrace = token.isBrace = true;
  17961. isGlob = token.isGlob = true;
  17962. finished = true;
  17963. if (scanToEnd === true) {
  17964. continue;
  17965. }
  17966. break;
  17967. }
  17968. if (braceEscaped !== true && code === CHAR_COMMA) {
  17969. isBrace = token.isBrace = true;
  17970. isGlob = token.isGlob = true;
  17971. finished = true;
  17972. if (scanToEnd === true) {
  17973. continue;
  17974. }
  17975. break;
  17976. }
  17977. if (code === CHAR_RIGHT_CURLY_BRACE) {
  17978. braces--;
  17979. if (braces === 0) {
  17980. braceEscaped = false;
  17981. isBrace = token.isBrace = true;
  17982. finished = true;
  17983. break;
  17984. }
  17985. }
  17986. }
  17987. if (scanToEnd === true) {
  17988. continue;
  17989. }
  17990. break;
  17991. }
  17992. if (code === CHAR_FORWARD_SLASH) {
  17993. slashes.push(index);
  17994. tokens.push(token);
  17995. token = { value: '', depth: 0, isGlob: false };
  17996. if (finished === true) continue;
  17997. if (prev === CHAR_DOT && index === (start + 1)) {
  17998. start += 2;
  17999. continue;
  18000. }
  18001. lastIndex = index + 1;
  18002. continue;
  18003. }
  18004. if (opts.noext !== true) {
  18005. const isExtglobChar = code === CHAR_PLUS
  18006. || code === CHAR_AT
  18007. || code === CHAR_ASTERISK
  18008. || code === CHAR_QUESTION_MARK
  18009. || code === CHAR_EXCLAMATION_MARK;
  18010. if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
  18011. isGlob = token.isGlob = true;
  18012. isExtglob = token.isExtglob = true;
  18013. finished = true;
  18014. if (code === CHAR_EXCLAMATION_MARK && index === start) {
  18015. negatedExtglob = true;
  18016. }
  18017. if (scanToEnd === true) {
  18018. while (eos() !== true && (code = advance())) {
  18019. if (code === CHAR_BACKWARD_SLASH) {
  18020. backslashes = token.backslashes = true;
  18021. code = advance();
  18022. continue;
  18023. }
  18024. if (code === CHAR_RIGHT_PARENTHESES) {
  18025. isGlob = token.isGlob = true;
  18026. finished = true;
  18027. break;
  18028. }
  18029. }
  18030. continue;
  18031. }
  18032. break;
  18033. }
  18034. }
  18035. if (code === CHAR_ASTERISK) {
  18036. if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
  18037. isGlob = token.isGlob = true;
  18038. finished = true;
  18039. if (scanToEnd === true) {
  18040. continue;
  18041. }
  18042. break;
  18043. }
  18044. if (code === CHAR_QUESTION_MARK) {
  18045. isGlob = token.isGlob = true;
  18046. finished = true;
  18047. if (scanToEnd === true) {
  18048. continue;
  18049. }
  18050. break;
  18051. }
  18052. if (code === CHAR_LEFT_SQUARE_BRACKET) {
  18053. while (eos() !== true && (next = advance())) {
  18054. if (next === CHAR_BACKWARD_SLASH) {
  18055. backslashes = token.backslashes = true;
  18056. advance();
  18057. continue;
  18058. }
  18059. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  18060. isBracket = token.isBracket = true;
  18061. isGlob = token.isGlob = true;
  18062. finished = true;
  18063. break;
  18064. }
  18065. }
  18066. if (scanToEnd === true) {
  18067. continue;
  18068. }
  18069. break;
  18070. }
  18071. if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
  18072. negated = token.negated = true;
  18073. start++;
  18074. continue;
  18075. }
  18076. if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
  18077. isGlob = token.isGlob = true;
  18078. if (scanToEnd === true) {
  18079. while (eos() !== true && (code = advance())) {
  18080. if (code === CHAR_LEFT_PARENTHESES) {
  18081. backslashes = token.backslashes = true;
  18082. code = advance();
  18083. continue;
  18084. }
  18085. if (code === CHAR_RIGHT_PARENTHESES) {
  18086. finished = true;
  18087. break;
  18088. }
  18089. }
  18090. continue;
  18091. }
  18092. break;
  18093. }
  18094. if (isGlob === true) {
  18095. finished = true;
  18096. if (scanToEnd === true) {
  18097. continue;
  18098. }
  18099. break;
  18100. }
  18101. }
  18102. if (opts.noext === true) {
  18103. isExtglob = false;
  18104. isGlob = false;
  18105. }
  18106. let base = str;
  18107. let prefix = '';
  18108. let glob = '';
  18109. if (start > 0) {
  18110. prefix = str.slice(0, start);
  18111. str = str.slice(start);
  18112. lastIndex -= start;
  18113. }
  18114. if (base && isGlob === true && lastIndex > 0) {
  18115. base = str.slice(0, lastIndex);
  18116. glob = str.slice(lastIndex);
  18117. } else if (isGlob === true) {
  18118. base = '';
  18119. glob = str;
  18120. } else {
  18121. base = str;
  18122. }
  18123. if (base && base !== '' && base !== '/' && base !== str) {
  18124. if (isPathSeparator(base.charCodeAt(base.length - 1))) {
  18125. base = base.slice(0, -1);
  18126. }
  18127. }
  18128. if (opts.unescape === true) {
  18129. if (glob) glob = utils$1.removeBackslashes(glob);
  18130. if (base && backslashes === true) {
  18131. base = utils$1.removeBackslashes(base);
  18132. }
  18133. }
  18134. const state = {
  18135. prefix,
  18136. input,
  18137. start,
  18138. base,
  18139. glob,
  18140. isBrace,
  18141. isBracket,
  18142. isGlob,
  18143. isExtglob,
  18144. isGlobstar,
  18145. negated,
  18146. negatedExtglob
  18147. };
  18148. if (opts.tokens === true) {
  18149. state.maxDepth = 0;
  18150. if (!isPathSeparator(code)) {
  18151. tokens.push(token);
  18152. }
  18153. state.tokens = tokens;
  18154. }
  18155. if (opts.parts === true || opts.tokens === true) {
  18156. let prevIndex;
  18157. for (let idx = 0; idx < slashes.length; idx++) {
  18158. const n = prevIndex ? prevIndex + 1 : start;
  18159. const i = slashes[idx];
  18160. const value = input.slice(n, i);
  18161. if (opts.tokens) {
  18162. if (idx === 0 && start !== 0) {
  18163. tokens[idx].isPrefix = true;
  18164. tokens[idx].value = prefix;
  18165. } else {
  18166. tokens[idx].value = value;
  18167. }
  18168. depth(tokens[idx]);
  18169. state.maxDepth += tokens[idx].depth;
  18170. }
  18171. if (idx !== 0 || value !== '') {
  18172. parts.push(value);
  18173. }
  18174. prevIndex = i;
  18175. }
  18176. if (prevIndex && prevIndex + 1 < input.length) {
  18177. const value = input.slice(prevIndex + 1);
  18178. parts.push(value);
  18179. if (opts.tokens) {
  18180. tokens[tokens.length - 1].value = value;
  18181. depth(tokens[tokens.length - 1]);
  18182. state.maxDepth += tokens[tokens.length - 1].depth;
  18183. }
  18184. }
  18185. state.slashes = slashes;
  18186. state.parts = parts;
  18187. }
  18188. return state;
  18189. };
  18190. var scan_1 = scan;
  18191. /**
  18192. * Constants
  18193. */
  18194. const {
  18195. MAX_LENGTH,
  18196. POSIX_REGEX_SOURCE,
  18197. REGEX_NON_SPECIAL_CHARS,
  18198. REGEX_SPECIAL_CHARS_BACKREF,
  18199. REPLACEMENTS
  18200. } = constants;
  18201. /**
  18202. * Helpers
  18203. */
  18204. const expandRange = (args, options) => {
  18205. if (typeof options.expandRange === 'function') {
  18206. return options.expandRange(...args, options);
  18207. }
  18208. args.sort();
  18209. const value = `[${args.join('-')}]`;
  18210. try {
  18211. /* eslint-disable-next-line no-new */
  18212. new RegExp(value);
  18213. } catch (ex) {
  18214. return args.map(v => utils$1.escapeRegex(v)).join('..');
  18215. }
  18216. return value;
  18217. };
  18218. /**
  18219. * Create the message for a syntax error
  18220. */
  18221. const syntaxError = (type, char) => {
  18222. return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
  18223. };
  18224. /**
  18225. * Parse the given input string.
  18226. * @param {String} input
  18227. * @param {Object} options
  18228. * @return {Object}
  18229. */
  18230. const parse$1 = (input, options) => {
  18231. if (typeof input !== 'string') {
  18232. throw new TypeError('Expected a string');
  18233. }
  18234. input = REPLACEMENTS[input] || input;
  18235. const opts = { ...options };
  18236. const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  18237. let len = input.length;
  18238. if (len > max) {
  18239. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  18240. }
  18241. const bos = { type: 'bos', value: '', output: opts.prepend || '' };
  18242. const tokens = [bos];
  18243. const capture = opts.capture ? '' : '?:';
  18244. const win32 = utils$1.isWindows(options);
  18245. // create constants based on platform, for windows or posix
  18246. const PLATFORM_CHARS = constants.globChars(win32);
  18247. const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
  18248. const {
  18249. DOT_LITERAL,
  18250. PLUS_LITERAL,
  18251. SLASH_LITERAL,
  18252. ONE_CHAR,
  18253. DOTS_SLASH,
  18254. NO_DOT,
  18255. NO_DOT_SLASH,
  18256. NO_DOTS_SLASH,
  18257. QMARK,
  18258. QMARK_NO_DOT,
  18259. STAR,
  18260. START_ANCHOR
  18261. } = PLATFORM_CHARS;
  18262. const globstar = opts => {
  18263. return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  18264. };
  18265. const nodot = opts.dot ? '' : NO_DOT;
  18266. const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  18267. let star = opts.bash === true ? globstar(opts) : STAR;
  18268. if (opts.capture) {
  18269. star = `(${star})`;
  18270. }
  18271. // minimatch options support
  18272. if (typeof opts.noext === 'boolean') {
  18273. opts.noextglob = opts.noext;
  18274. }
  18275. const state = {
  18276. input,
  18277. index: -1,
  18278. start: 0,
  18279. dot: opts.dot === true,
  18280. consumed: '',
  18281. output: '',
  18282. prefix: '',
  18283. backtrack: false,
  18284. negated: false,
  18285. brackets: 0,
  18286. braces: 0,
  18287. parens: 0,
  18288. quotes: 0,
  18289. globstar: false,
  18290. tokens
  18291. };
  18292. input = utils$1.removePrefix(input, state);
  18293. len = input.length;
  18294. const extglobs = [];
  18295. const braces = [];
  18296. const stack = [];
  18297. let prev = bos;
  18298. let value;
  18299. /**
  18300. * Tokenizing helpers
  18301. */
  18302. const eos = () => state.index === len - 1;
  18303. const peek = state.peek = (n = 1) => input[state.index + n];
  18304. const advance = state.advance = () => input[++state.index] || '';
  18305. const remaining = () => input.slice(state.index + 1);
  18306. const consume = (value = '', num = 0) => {
  18307. state.consumed += value;
  18308. state.index += num;
  18309. };
  18310. const append = token => {
  18311. state.output += token.output != null ? token.output : token.value;
  18312. consume(token.value);
  18313. };
  18314. const negate = () => {
  18315. let count = 1;
  18316. while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
  18317. advance();
  18318. state.start++;
  18319. count++;
  18320. }
  18321. if (count % 2 === 0) {
  18322. return false;
  18323. }
  18324. state.negated = true;
  18325. state.start++;
  18326. return true;
  18327. };
  18328. const increment = type => {
  18329. state[type]++;
  18330. stack.push(type);
  18331. };
  18332. const decrement = type => {
  18333. state[type]--;
  18334. stack.pop();
  18335. };
  18336. /**
  18337. * Push tokens onto the tokens array. This helper speeds up
  18338. * tokenizing by 1) helping us avoid backtracking as much as possible,
  18339. * and 2) helping us avoid creating extra tokens when consecutive
  18340. * characters are plain text. This improves performance and simplifies
  18341. * lookbehinds.
  18342. */
  18343. const push = tok => {
  18344. if (prev.type === 'globstar') {
  18345. const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
  18346. const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
  18347. if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
  18348. state.output = state.output.slice(0, -prev.output.length);
  18349. prev.type = 'star';
  18350. prev.value = '*';
  18351. prev.output = star;
  18352. state.output += prev.output;
  18353. }
  18354. }
  18355. if (extglobs.length && tok.type !== 'paren') {
  18356. extglobs[extglobs.length - 1].inner += tok.value;
  18357. }
  18358. if (tok.value || tok.output) append(tok);
  18359. if (prev && prev.type === 'text' && tok.type === 'text') {
  18360. prev.value += tok.value;
  18361. prev.output = (prev.output || '') + tok.value;
  18362. return;
  18363. }
  18364. tok.prev = prev;
  18365. tokens.push(tok);
  18366. prev = tok;
  18367. };
  18368. const extglobOpen = (type, value) => {
  18369. const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
  18370. token.prev = prev;
  18371. token.parens = state.parens;
  18372. token.output = state.output;
  18373. const output = (opts.capture ? '(' : '') + token.open;
  18374. increment('parens');
  18375. push({ type, value, output: state.output ? '' : ONE_CHAR });
  18376. push({ type: 'paren', extglob: true, value: advance(), output });
  18377. extglobs.push(token);
  18378. };
  18379. const extglobClose = token => {
  18380. let output = token.close + (opts.capture ? ')' : '');
  18381. let rest;
  18382. if (token.type === 'negate') {
  18383. let extglobStar = star;
  18384. if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
  18385. extglobStar = globstar(opts);
  18386. }
  18387. if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
  18388. output = token.close = `)$))${extglobStar}`;
  18389. }
  18390. if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
  18391. // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
  18392. // In this case, we need to parse the string and use it in the output of the original pattern.
  18393. // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
  18394. //
  18395. // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
  18396. const expression = parse$1(rest, { ...options, fastpaths: false }).output;
  18397. output = token.close = `)${expression})${extglobStar})`;
  18398. }
  18399. if (token.prev.type === 'bos') {
  18400. state.negatedExtglob = true;
  18401. }
  18402. }
  18403. push({ type: 'paren', extglob: true, value, output });
  18404. decrement('parens');
  18405. };
  18406. /**
  18407. * Fast paths
  18408. */
  18409. if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
  18410. let backslashes = false;
  18411. let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
  18412. if (first === '\\') {
  18413. backslashes = true;
  18414. return m;
  18415. }
  18416. if (first === '?') {
  18417. if (esc) {
  18418. return esc + first + (rest ? QMARK.repeat(rest.length) : '');
  18419. }
  18420. if (index === 0) {
  18421. return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
  18422. }
  18423. return QMARK.repeat(chars.length);
  18424. }
  18425. if (first === '.') {
  18426. return DOT_LITERAL.repeat(chars.length);
  18427. }
  18428. if (first === '*') {
  18429. if (esc) {
  18430. return esc + first + (rest ? star : '');
  18431. }
  18432. return star;
  18433. }
  18434. return esc ? m : `\\${m}`;
  18435. });
  18436. if (backslashes === true) {
  18437. if (opts.unescape === true) {
  18438. output = output.replace(/\\/g, '');
  18439. } else {
  18440. output = output.replace(/\\+/g, m => {
  18441. return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
  18442. });
  18443. }
  18444. }
  18445. if (output === input && opts.contains === true) {
  18446. state.output = input;
  18447. return state;
  18448. }
  18449. state.output = utils$1.wrapOutput(output, state, options);
  18450. return state;
  18451. }
  18452. /**
  18453. * Tokenize input until we reach end-of-string
  18454. */
  18455. while (!eos()) {
  18456. value = advance();
  18457. if (value === '\u0000') {
  18458. continue;
  18459. }
  18460. /**
  18461. * Escaped characters
  18462. */
  18463. if (value === '\\') {
  18464. const next = peek();
  18465. if (next === '/' && opts.bash !== true) {
  18466. continue;
  18467. }
  18468. if (next === '.' || next === ';') {
  18469. continue;
  18470. }
  18471. if (!next) {
  18472. value += '\\';
  18473. push({ type: 'text', value });
  18474. continue;
  18475. }
  18476. // collapse slashes to reduce potential for exploits
  18477. const match = /^\\+/.exec(remaining());
  18478. let slashes = 0;
  18479. if (match && match[0].length > 2) {
  18480. slashes = match[0].length;
  18481. state.index += slashes;
  18482. if (slashes % 2 !== 0) {
  18483. value += '\\';
  18484. }
  18485. }
  18486. if (opts.unescape === true) {
  18487. value = advance();
  18488. } else {
  18489. value += advance();
  18490. }
  18491. if (state.brackets === 0) {
  18492. push({ type: 'text', value });
  18493. continue;
  18494. }
  18495. }
  18496. /**
  18497. * If we're inside a regex character class, continue
  18498. * until we reach the closing bracket.
  18499. */
  18500. if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
  18501. if (opts.posix !== false && value === ':') {
  18502. const inner = prev.value.slice(1);
  18503. if (inner.includes('[')) {
  18504. prev.posix = true;
  18505. if (inner.includes(':')) {
  18506. const idx = prev.value.lastIndexOf('[');
  18507. const pre = prev.value.slice(0, idx);
  18508. const rest = prev.value.slice(idx + 2);
  18509. const posix = POSIX_REGEX_SOURCE[rest];
  18510. if (posix) {
  18511. prev.value = pre + posix;
  18512. state.backtrack = true;
  18513. advance();
  18514. if (!bos.output && tokens.indexOf(prev) === 1) {
  18515. bos.output = ONE_CHAR;
  18516. }
  18517. continue;
  18518. }
  18519. }
  18520. }
  18521. }
  18522. if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
  18523. value = `\\${value}`;
  18524. }
  18525. if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
  18526. value = `\\${value}`;
  18527. }
  18528. if (opts.posix === true && value === '!' && prev.value === '[') {
  18529. value = '^';
  18530. }
  18531. prev.value += value;
  18532. append({ value });
  18533. continue;
  18534. }
  18535. /**
  18536. * If we're inside a quoted string, continue
  18537. * until we reach the closing double quote.
  18538. */
  18539. if (state.quotes === 1 && value !== '"') {
  18540. value = utils$1.escapeRegex(value);
  18541. prev.value += value;
  18542. append({ value });
  18543. continue;
  18544. }
  18545. /**
  18546. * Double quotes
  18547. */
  18548. if (value === '"') {
  18549. state.quotes = state.quotes === 1 ? 0 : 1;
  18550. if (opts.keepQuotes === true) {
  18551. push({ type: 'text', value });
  18552. }
  18553. continue;
  18554. }
  18555. /**
  18556. * Parentheses
  18557. */
  18558. if (value === '(') {
  18559. increment('parens');
  18560. push({ type: 'paren', value });
  18561. continue;
  18562. }
  18563. if (value === ')') {
  18564. if (state.parens === 0 && opts.strictBrackets === true) {
  18565. throw new SyntaxError(syntaxError('opening', '('));
  18566. }
  18567. const extglob = extglobs[extglobs.length - 1];
  18568. if (extglob && state.parens === extglob.parens + 1) {
  18569. extglobClose(extglobs.pop());
  18570. continue;
  18571. }
  18572. push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
  18573. decrement('parens');
  18574. continue;
  18575. }
  18576. /**
  18577. * Square brackets
  18578. */
  18579. if (value === '[') {
  18580. if (opts.nobracket === true || !remaining().includes(']')) {
  18581. if (opts.nobracket !== true && opts.strictBrackets === true) {
  18582. throw new SyntaxError(syntaxError('closing', ']'));
  18583. }
  18584. value = `\\${value}`;
  18585. } else {
  18586. increment('brackets');
  18587. }
  18588. push({ type: 'bracket', value });
  18589. continue;
  18590. }
  18591. if (value === ']') {
  18592. if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
  18593. push({ type: 'text', value, output: `\\${value}` });
  18594. continue;
  18595. }
  18596. if (state.brackets === 0) {
  18597. if (opts.strictBrackets === true) {
  18598. throw new SyntaxError(syntaxError('opening', '['));
  18599. }
  18600. push({ type: 'text', value, output: `\\${value}` });
  18601. continue;
  18602. }
  18603. decrement('brackets');
  18604. const prevValue = prev.value.slice(1);
  18605. if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
  18606. value = `/${value}`;
  18607. }
  18608. prev.value += value;
  18609. append({ value });
  18610. // when literal brackets are explicitly disabled
  18611. // assume we should match with a regex character class
  18612. if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) {
  18613. continue;
  18614. }
  18615. const escaped = utils$1.escapeRegex(prev.value);
  18616. state.output = state.output.slice(0, -prev.value.length);
  18617. // when literal brackets are explicitly enabled
  18618. // assume we should escape the brackets to match literal characters
  18619. if (opts.literalBrackets === true) {
  18620. state.output += escaped;
  18621. prev.value = escaped;
  18622. continue;
  18623. }
  18624. // when the user specifies nothing, try to match both
  18625. prev.value = `(${capture}${escaped}|${prev.value})`;
  18626. state.output += prev.value;
  18627. continue;
  18628. }
  18629. /**
  18630. * Braces
  18631. */
  18632. if (value === '{' && opts.nobrace !== true) {
  18633. increment('braces');
  18634. const open = {
  18635. type: 'brace',
  18636. value,
  18637. output: '(',
  18638. outputIndex: state.output.length,
  18639. tokensIndex: state.tokens.length
  18640. };
  18641. braces.push(open);
  18642. push(open);
  18643. continue;
  18644. }
  18645. if (value === '}') {
  18646. const brace = braces[braces.length - 1];
  18647. if (opts.nobrace === true || !brace) {
  18648. push({ type: 'text', value, output: value });
  18649. continue;
  18650. }
  18651. let output = ')';
  18652. if (brace.dots === true) {
  18653. const arr = tokens.slice();
  18654. const range = [];
  18655. for (let i = arr.length - 1; i >= 0; i--) {
  18656. tokens.pop();
  18657. if (arr[i].type === 'brace') {
  18658. break;
  18659. }
  18660. if (arr[i].type !== 'dots') {
  18661. range.unshift(arr[i].value);
  18662. }
  18663. }
  18664. output = expandRange(range, opts);
  18665. state.backtrack = true;
  18666. }
  18667. if (brace.comma !== true && brace.dots !== true) {
  18668. const out = state.output.slice(0, brace.outputIndex);
  18669. const toks = state.tokens.slice(brace.tokensIndex);
  18670. brace.value = brace.output = '\\{';
  18671. value = output = '\\}';
  18672. state.output = out;
  18673. for (const t of toks) {
  18674. state.output += (t.output || t.value);
  18675. }
  18676. }
  18677. push({ type: 'brace', value, output });
  18678. decrement('braces');
  18679. braces.pop();
  18680. continue;
  18681. }
  18682. /**
  18683. * Pipes
  18684. */
  18685. if (value === '|') {
  18686. if (extglobs.length > 0) {
  18687. extglobs[extglobs.length - 1].conditions++;
  18688. }
  18689. push({ type: 'text', value });
  18690. continue;
  18691. }
  18692. /**
  18693. * Commas
  18694. */
  18695. if (value === ',') {
  18696. let output = value;
  18697. const brace = braces[braces.length - 1];
  18698. if (brace && stack[stack.length - 1] === 'braces') {
  18699. brace.comma = true;
  18700. output = '|';
  18701. }
  18702. push({ type: 'comma', value, output });
  18703. continue;
  18704. }
  18705. /**
  18706. * Slashes
  18707. */
  18708. if (value === '/') {
  18709. // if the beginning of the glob is "./", advance the start
  18710. // to the current index, and don't add the "./" characters
  18711. // to the state. This greatly simplifies lookbehinds when
  18712. // checking for BOS characters like "!" and "." (not "./")
  18713. if (prev.type === 'dot' && state.index === state.start + 1) {
  18714. state.start = state.index + 1;
  18715. state.consumed = '';
  18716. state.output = '';
  18717. tokens.pop();
  18718. prev = bos; // reset "prev" to the first token
  18719. continue;
  18720. }
  18721. push({ type: 'slash', value, output: SLASH_LITERAL });
  18722. continue;
  18723. }
  18724. /**
  18725. * Dots
  18726. */
  18727. if (value === '.') {
  18728. if (state.braces > 0 && prev.type === 'dot') {
  18729. if (prev.value === '.') prev.output = DOT_LITERAL;
  18730. const brace = braces[braces.length - 1];
  18731. prev.type = 'dots';
  18732. prev.output += value;
  18733. prev.value += value;
  18734. brace.dots = true;
  18735. continue;
  18736. }
  18737. if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
  18738. push({ type: 'text', value, output: DOT_LITERAL });
  18739. continue;
  18740. }
  18741. push({ type: 'dot', value, output: DOT_LITERAL });
  18742. continue;
  18743. }
  18744. /**
  18745. * Question marks
  18746. */
  18747. if (value === '?') {
  18748. const isGroup = prev && prev.value === '(';
  18749. if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
  18750. extglobOpen('qmark', value);
  18751. continue;
  18752. }
  18753. if (prev && prev.type === 'paren') {
  18754. const next = peek();
  18755. let output = value;
  18756. if (next === '<' && !utils$1.supportsLookbehinds()) {
  18757. throw new Error('Node.js v10 or higher is required for regex lookbehinds');
  18758. }
  18759. if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
  18760. output = `\\${value}`;
  18761. }
  18762. push({ type: 'text', value, output });
  18763. continue;
  18764. }
  18765. if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
  18766. push({ type: 'qmark', value, output: QMARK_NO_DOT });
  18767. continue;
  18768. }
  18769. push({ type: 'qmark', value, output: QMARK });
  18770. continue;
  18771. }
  18772. /**
  18773. * Exclamation
  18774. */
  18775. if (value === '!') {
  18776. if (opts.noextglob !== true && peek() === '(') {
  18777. if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
  18778. extglobOpen('negate', value);
  18779. continue;
  18780. }
  18781. }
  18782. if (opts.nonegate !== true && state.index === 0) {
  18783. negate();
  18784. continue;
  18785. }
  18786. }
  18787. /**
  18788. * Plus
  18789. */
  18790. if (value === '+') {
  18791. if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
  18792. extglobOpen('plus', value);
  18793. continue;
  18794. }
  18795. if ((prev && prev.value === '(') || opts.regex === false) {
  18796. push({ type: 'plus', value, output: PLUS_LITERAL });
  18797. continue;
  18798. }
  18799. if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
  18800. push({ type: 'plus', value });
  18801. continue;
  18802. }
  18803. push({ type: 'plus', value: PLUS_LITERAL });
  18804. continue;
  18805. }
  18806. /**
  18807. * Plain text
  18808. */
  18809. if (value === '@') {
  18810. if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
  18811. push({ type: 'at', extglob: true, value, output: '' });
  18812. continue;
  18813. }
  18814. push({ type: 'text', value });
  18815. continue;
  18816. }
  18817. /**
  18818. * Plain text
  18819. */
  18820. if (value !== '*') {
  18821. if (value === '$' || value === '^') {
  18822. value = `\\${value}`;
  18823. }
  18824. const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
  18825. if (match) {
  18826. value += match[0];
  18827. state.index += match[0].length;
  18828. }
  18829. push({ type: 'text', value });
  18830. continue;
  18831. }
  18832. /**
  18833. * Stars
  18834. */
  18835. if (prev && (prev.type === 'globstar' || prev.star === true)) {
  18836. prev.type = 'star';
  18837. prev.star = true;
  18838. prev.value += value;
  18839. prev.output = star;
  18840. state.backtrack = true;
  18841. state.globstar = true;
  18842. consume(value);
  18843. continue;
  18844. }
  18845. let rest = remaining();
  18846. if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
  18847. extglobOpen('star', value);
  18848. continue;
  18849. }
  18850. if (prev.type === 'star') {
  18851. if (opts.noglobstar === true) {
  18852. consume(value);
  18853. continue;
  18854. }
  18855. const prior = prev.prev;
  18856. const before = prior.prev;
  18857. const isStart = prior.type === 'slash' || prior.type === 'bos';
  18858. const afterStar = before && (before.type === 'star' || before.type === 'globstar');
  18859. if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
  18860. push({ type: 'star', value, output: '' });
  18861. continue;
  18862. }
  18863. const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
  18864. const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
  18865. if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
  18866. push({ type: 'star', value, output: '' });
  18867. continue;
  18868. }
  18869. // strip consecutive `/**/`
  18870. while (rest.slice(0, 3) === '/**') {
  18871. const after = input[state.index + 4];
  18872. if (after && after !== '/') {
  18873. break;
  18874. }
  18875. rest = rest.slice(3);
  18876. consume('/**', 3);
  18877. }
  18878. if (prior.type === 'bos' && eos()) {
  18879. prev.type = 'globstar';
  18880. prev.value += value;
  18881. prev.output = globstar(opts);
  18882. state.output = prev.output;
  18883. state.globstar = true;
  18884. consume(value);
  18885. continue;
  18886. }
  18887. if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
  18888. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  18889. prior.output = `(?:${prior.output}`;
  18890. prev.type = 'globstar';
  18891. prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
  18892. prev.value += value;
  18893. state.globstar = true;
  18894. state.output += prior.output + prev.output;
  18895. consume(value);
  18896. continue;
  18897. }
  18898. if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
  18899. const end = rest[1] !== void 0 ? '|$' : '';
  18900. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  18901. prior.output = `(?:${prior.output}`;
  18902. prev.type = 'globstar';
  18903. prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
  18904. prev.value += value;
  18905. state.output += prior.output + prev.output;
  18906. state.globstar = true;
  18907. consume(value + advance());
  18908. push({ type: 'slash', value: '/', output: '' });
  18909. continue;
  18910. }
  18911. if (prior.type === 'bos' && rest[0] === '/') {
  18912. prev.type = 'globstar';
  18913. prev.value += value;
  18914. prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
  18915. state.output = prev.output;
  18916. state.globstar = true;
  18917. consume(value + advance());
  18918. push({ type: 'slash', value: '/', output: '' });
  18919. continue;
  18920. }
  18921. // remove single star from output
  18922. state.output = state.output.slice(0, -prev.output.length);
  18923. // reset previous token to globstar
  18924. prev.type = 'globstar';
  18925. prev.output = globstar(opts);
  18926. prev.value += value;
  18927. // reset output with globstar
  18928. state.output += prev.output;
  18929. state.globstar = true;
  18930. consume(value);
  18931. continue;
  18932. }
  18933. const token = { type: 'star', value, output: star };
  18934. if (opts.bash === true) {
  18935. token.output = '.*?';
  18936. if (prev.type === 'bos' || prev.type === 'slash') {
  18937. token.output = nodot + token.output;
  18938. }
  18939. push(token);
  18940. continue;
  18941. }
  18942. if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
  18943. token.output = value;
  18944. push(token);
  18945. continue;
  18946. }
  18947. if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
  18948. if (prev.type === 'dot') {
  18949. state.output += NO_DOT_SLASH;
  18950. prev.output += NO_DOT_SLASH;
  18951. } else if (opts.dot === true) {
  18952. state.output += NO_DOTS_SLASH;
  18953. prev.output += NO_DOTS_SLASH;
  18954. } else {
  18955. state.output += nodot;
  18956. prev.output += nodot;
  18957. }
  18958. if (peek() !== '*') {
  18959. state.output += ONE_CHAR;
  18960. prev.output += ONE_CHAR;
  18961. }
  18962. }
  18963. push(token);
  18964. }
  18965. while (state.brackets > 0) {
  18966. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
  18967. state.output = utils$1.escapeLast(state.output, '[');
  18968. decrement('brackets');
  18969. }
  18970. while (state.parens > 0) {
  18971. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
  18972. state.output = utils$1.escapeLast(state.output, '(');
  18973. decrement('parens');
  18974. }
  18975. while (state.braces > 0) {
  18976. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
  18977. state.output = utils$1.escapeLast(state.output, '{');
  18978. decrement('braces');
  18979. }
  18980. if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
  18981. push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
  18982. }
  18983. // rebuild the output if we had to backtrack at any point
  18984. if (state.backtrack === true) {
  18985. state.output = '';
  18986. for (const token of state.tokens) {
  18987. state.output += token.output != null ? token.output : token.value;
  18988. if (token.suffix) {
  18989. state.output += token.suffix;
  18990. }
  18991. }
  18992. }
  18993. return state;
  18994. };
  18995. /**
  18996. * Fast paths for creating regular expressions for common glob patterns.
  18997. * This can significantly speed up processing and has very little downside
  18998. * impact when none of the fast paths match.
  18999. */
  19000. parse$1.fastpaths = (input, options) => {
  19001. const opts = { ...options };
  19002. const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  19003. const len = input.length;
  19004. if (len > max) {
  19005. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  19006. }
  19007. input = REPLACEMENTS[input] || input;
  19008. const win32 = utils$1.isWindows(options);
  19009. // create constants based on platform, for windows or posix
  19010. const {
  19011. DOT_LITERAL,
  19012. SLASH_LITERAL,
  19013. ONE_CHAR,
  19014. DOTS_SLASH,
  19015. NO_DOT,
  19016. NO_DOTS,
  19017. NO_DOTS_SLASH,
  19018. STAR,
  19019. START_ANCHOR
  19020. } = constants.globChars(win32);
  19021. const nodot = opts.dot ? NO_DOTS : NO_DOT;
  19022. const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  19023. const capture = opts.capture ? '' : '?:';
  19024. const state = { negated: false, prefix: '' };
  19025. let star = opts.bash === true ? '.*?' : STAR;
  19026. if (opts.capture) {
  19027. star = `(${star})`;
  19028. }
  19029. const globstar = opts => {
  19030. if (opts.noglobstar === true) return star;
  19031. return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  19032. };
  19033. const create = str => {
  19034. switch (str) {
  19035. case '*':
  19036. return `${nodot}${ONE_CHAR}${star}`;
  19037. case '.*':
  19038. return `${DOT_LITERAL}${ONE_CHAR}${star}`;
  19039. case '*.*':
  19040. return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  19041. case '*/*':
  19042. return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
  19043. case '**':
  19044. return nodot + globstar(opts);
  19045. case '**/*':
  19046. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
  19047. case '**/*.*':
  19048. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  19049. case '**/.*':
  19050. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
  19051. default: {
  19052. const match = /^(.*?)\.(\w+)$/.exec(str);
  19053. if (!match) return;
  19054. const source = create(match[1]);
  19055. if (!source) return;
  19056. return source + DOT_LITERAL + match[2];
  19057. }
  19058. }
  19059. };
  19060. const output = utils$1.removePrefix(input, state);
  19061. let source = create(output);
  19062. if (source && opts.strictSlashes !== true) {
  19063. source += `${SLASH_LITERAL}?`;
  19064. }
  19065. return source;
  19066. };
  19067. var parse_1 = parse$1;
  19068. const isObject$2 = val => val && typeof val === 'object' && !Array.isArray(val);
  19069. /**
  19070. * Creates a matcher function from one or more glob patterns. The
  19071. * returned function takes a string to match as its first argument,
  19072. * and returns true if the string is a match. The returned matcher
  19073. * function also takes a boolean as the second argument that, when true,
  19074. * returns an object with additional information.
  19075. *
  19076. * ```js
  19077. * const picomatch = require('picomatch');
  19078. * // picomatch(glob[, options]);
  19079. *
  19080. * const isMatch = picomatch('*.!(*a)');
  19081. * console.log(isMatch('a.a')); //=> false
  19082. * console.log(isMatch('a.b')); //=> true
  19083. * ```
  19084. * @name picomatch
  19085. * @param {String|Array} `globs` One or more glob patterns.
  19086. * @param {Object=} `options`
  19087. * @return {Function=} Returns a matcher function.
  19088. * @api public
  19089. */
  19090. const picomatch$1 = (glob, options, returnState = false) => {
  19091. if (Array.isArray(glob)) {
  19092. const fns = glob.map(input => picomatch$1(input, options, returnState));
  19093. const arrayMatcher = str => {
  19094. for (const isMatch of fns) {
  19095. const state = isMatch(str);
  19096. if (state) return state;
  19097. }
  19098. return false;
  19099. };
  19100. return arrayMatcher;
  19101. }
  19102. const isState = isObject$2(glob) && glob.tokens && glob.input;
  19103. if (glob === '' || (typeof glob !== 'string' && !isState)) {
  19104. throw new TypeError('Expected pattern to be a non-empty string');
  19105. }
  19106. const opts = options || {};
  19107. const posix = utils$1.isWindows(options);
  19108. const regex = isState
  19109. ? picomatch$1.compileRe(glob, options)
  19110. : picomatch$1.makeRe(glob, options, false, true);
  19111. const state = regex.state;
  19112. delete regex.state;
  19113. let isIgnored = () => false;
  19114. if (opts.ignore) {
  19115. const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
  19116. isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
  19117. }
  19118. const matcher = (input, returnObject = false) => {
  19119. const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
  19120. const result = { glob, state, regex, posix, input, output, match, isMatch };
  19121. if (typeof opts.onResult === 'function') {
  19122. opts.onResult(result);
  19123. }
  19124. if (isMatch === false) {
  19125. result.isMatch = false;
  19126. return returnObject ? result : false;
  19127. }
  19128. if (isIgnored(input)) {
  19129. if (typeof opts.onIgnore === 'function') {
  19130. opts.onIgnore(result);
  19131. }
  19132. result.isMatch = false;
  19133. return returnObject ? result : false;
  19134. }
  19135. if (typeof opts.onMatch === 'function') {
  19136. opts.onMatch(result);
  19137. }
  19138. return returnObject ? result : true;
  19139. };
  19140. if (returnState) {
  19141. matcher.state = state;
  19142. }
  19143. return matcher;
  19144. };
  19145. /**
  19146. * Test `input` with the given `regex`. This is used by the main
  19147. * `picomatch()` function to test the input string.
  19148. *
  19149. * ```js
  19150. * const picomatch = require('picomatch');
  19151. * // picomatch.test(input, regex[, options]);
  19152. *
  19153. * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
  19154. * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
  19155. * ```
  19156. * @param {String} `input` String to test.
  19157. * @param {RegExp} `regex`
  19158. * @return {Object} Returns an object with matching info.
  19159. * @api public
  19160. */
  19161. picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
  19162. if (typeof input !== 'string') {
  19163. throw new TypeError('Expected input to be a string');
  19164. }
  19165. if (input === '') {
  19166. return { isMatch: false, output: '' };
  19167. }
  19168. const opts = options || {};
  19169. const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
  19170. let match = input === glob;
  19171. let output = (match && format) ? format(input) : input;
  19172. if (match === false) {
  19173. output = format ? format(input) : input;
  19174. match = output === glob;
  19175. }
  19176. if (match === false || opts.capture === true) {
  19177. if (opts.matchBase === true || opts.basename === true) {
  19178. match = picomatch$1.matchBase(input, regex, options, posix);
  19179. } else {
  19180. match = regex.exec(output);
  19181. }
  19182. }
  19183. return { isMatch: Boolean(match), match, output };
  19184. };
  19185. /**
  19186. * Match the basename of a filepath.
  19187. *
  19188. * ```js
  19189. * const picomatch = require('picomatch');
  19190. * // picomatch.matchBase(input, glob[, options]);
  19191. * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
  19192. * ```
  19193. * @param {String} `input` String to test.
  19194. * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
  19195. * @return {Boolean}
  19196. * @api public
  19197. */
  19198. picomatch$1.matchBase = (input, glob, options, posix = utils$1.isWindows(options)) => {
  19199. const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
  19200. return regex.test(path$5.basename(input));
  19201. };
  19202. /**
  19203. * Returns true if **any** of the given glob `patterns` match the specified `string`.
  19204. *
  19205. * ```js
  19206. * const picomatch = require('picomatch');
  19207. * // picomatch.isMatch(string, patterns[, options]);
  19208. *
  19209. * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
  19210. * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
  19211. * ```
  19212. * @param {String|Array} str The string to test.
  19213. * @param {String|Array} patterns One or more glob patterns to use for matching.
  19214. * @param {Object} [options] See available [options](#options).
  19215. * @return {Boolean} Returns true if any patterns match `str`
  19216. * @api public
  19217. */
  19218. picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
  19219. /**
  19220. * Parse a glob pattern to create the source string for a regular
  19221. * expression.
  19222. *
  19223. * ```js
  19224. * const picomatch = require('picomatch');
  19225. * const result = picomatch.parse(pattern[, options]);
  19226. * ```
  19227. * @param {String} `pattern`
  19228. * @param {Object} `options`
  19229. * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
  19230. * @api public
  19231. */
  19232. picomatch$1.parse = (pattern, options) => {
  19233. if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
  19234. return parse_1(pattern, { ...options, fastpaths: false });
  19235. };
  19236. /**
  19237. * Scan a glob pattern to separate the pattern into segments.
  19238. *
  19239. * ```js
  19240. * const picomatch = require('picomatch');
  19241. * // picomatch.scan(input[, options]);
  19242. *
  19243. * const result = picomatch.scan('!./foo/*.js');
  19244. * console.log(result);
  19245. * { prefix: '!./',
  19246. * input: '!./foo/*.js',
  19247. * start: 3,
  19248. * base: 'foo',
  19249. * glob: '*.js',
  19250. * isBrace: false,
  19251. * isBracket: false,
  19252. * isGlob: true,
  19253. * isExtglob: false,
  19254. * isGlobstar: false,
  19255. * negated: true }
  19256. * ```
  19257. * @param {String} `input` Glob pattern to scan.
  19258. * @param {Object} `options`
  19259. * @return {Object} Returns an object with
  19260. * @api public
  19261. */
  19262. picomatch$1.scan = (input, options) => scan_1(input, options);
  19263. /**
  19264. * Compile a regular expression from the `state` object returned by the
  19265. * [parse()](#parse) method.
  19266. *
  19267. * @param {Object} `state`
  19268. * @param {Object} `options`
  19269. * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
  19270. * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
  19271. * @return {RegExp}
  19272. * @api public
  19273. */
  19274. picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
  19275. if (returnOutput === true) {
  19276. return state.output;
  19277. }
  19278. const opts = options || {};
  19279. const prepend = opts.contains ? '' : '^';
  19280. const append = opts.contains ? '' : '$';
  19281. let source = `${prepend}(?:${state.output})${append}`;
  19282. if (state && state.negated === true) {
  19283. source = `^(?!${source}).*$`;
  19284. }
  19285. const regex = picomatch$1.toRegex(source, options);
  19286. if (returnState === true) {
  19287. regex.state = state;
  19288. }
  19289. return regex;
  19290. };
  19291. /**
  19292. * Create a regular expression from a parsed glob pattern.
  19293. *
  19294. * ```js
  19295. * const picomatch = require('picomatch');
  19296. * const state = picomatch.parse('*.js');
  19297. * // picomatch.compileRe(state[, options]);
  19298. *
  19299. * console.log(picomatch.compileRe(state));
  19300. * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
  19301. * ```
  19302. * @param {String} `state` The object returned from the `.parse` method.
  19303. * @param {Object} `options`
  19304. * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
  19305. * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
  19306. * @return {RegExp} Returns a regex created from the given pattern.
  19307. * @api public
  19308. */
  19309. picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  19310. if (!input || typeof input !== 'string') {
  19311. throw new TypeError('Expected a non-empty string');
  19312. }
  19313. let parsed = { negated: false, fastpaths: true };
  19314. if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
  19315. parsed.output = parse_1.fastpaths(input, options);
  19316. }
  19317. if (!parsed.output) {
  19318. parsed = parse_1(input, options);
  19319. }
  19320. return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
  19321. };
  19322. /**
  19323. * Create a regular expression from the given regex source string.
  19324. *
  19325. * ```js
  19326. * const picomatch = require('picomatch');
  19327. * // picomatch.toRegex(source[, options]);
  19328. *
  19329. * const { output } = picomatch.parse('*.js');
  19330. * console.log(picomatch.toRegex(output));
  19331. * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
  19332. * ```
  19333. * @param {String} `source` Regular expression source string.
  19334. * @param {Object} `options`
  19335. * @return {RegExp}
  19336. * @api public
  19337. */
  19338. picomatch$1.toRegex = (source, options) => {
  19339. try {
  19340. const opts = options || {};
  19341. return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
  19342. } catch (err) {
  19343. if (options && options.debug === true) throw err;
  19344. return /$^/;
  19345. }
  19346. };
  19347. /**
  19348. * Picomatch constants.
  19349. * @return {Object}
  19350. */
  19351. picomatch$1.constants = constants;
  19352. /**
  19353. * Expose "picomatch"
  19354. */
  19355. var picomatch_1 = picomatch$1;
  19356. var picomatch = picomatch_1;
  19357. function walk$2(ast, { enter, leave }) {
  19358. return visit(ast, null, enter, leave);
  19359. }
  19360. let should_skip = false;
  19361. let should_remove = false;
  19362. let replacement = null;
  19363. const context = {
  19364. skip: () => should_skip = true,
  19365. remove: () => should_remove = true,
  19366. replace: (node) => replacement = node
  19367. };
  19368. function replace$1(parent, prop, index, node) {
  19369. if (parent) {
  19370. if (index !== null) {
  19371. parent[prop][index] = node;
  19372. } else {
  19373. parent[prop] = node;
  19374. }
  19375. }
  19376. }
  19377. function remove(parent, prop, index) {
  19378. if (parent) {
  19379. if (index !== null) {
  19380. parent[prop].splice(index, 1);
  19381. } else {
  19382. delete parent[prop];
  19383. }
  19384. }
  19385. }
  19386. function visit(
  19387. node,
  19388. parent,
  19389. enter,
  19390. leave,
  19391. prop,
  19392. index
  19393. ) {
  19394. if (node) {
  19395. if (enter) {
  19396. const _should_skip = should_skip;
  19397. const _should_remove = should_remove;
  19398. const _replacement = replacement;
  19399. should_skip = false;
  19400. should_remove = false;
  19401. replacement = null;
  19402. enter.call(context, node, parent, prop, index);
  19403. if (replacement) {
  19404. node = replacement;
  19405. replace$1(parent, prop, index, node);
  19406. }
  19407. if (should_remove) {
  19408. remove(parent, prop, index);
  19409. }
  19410. const skipped = should_skip;
  19411. const removed = should_remove;
  19412. should_skip = _should_skip;
  19413. should_remove = _should_remove;
  19414. replacement = _replacement;
  19415. if (skipped) return node;
  19416. if (removed) return null;
  19417. }
  19418. for (const key in node) {
  19419. const value = (node )[key];
  19420. if (typeof value !== 'object') {
  19421. continue;
  19422. }
  19423. else if (Array.isArray(value)) {
  19424. for (let j = 0, k = 0; j < value.length; j += 1, k += 1) {
  19425. if (value[j] !== null && typeof value[j].type === 'string') {
  19426. if (!visit(value[j], node, enter, leave, key, k)) {
  19427. // removed
  19428. j--;
  19429. }
  19430. }
  19431. }
  19432. }
  19433. else if (value !== null && typeof value.type === 'string') {
  19434. visit(value, node, enter, leave, key, null);
  19435. }
  19436. }
  19437. if (leave) {
  19438. const _replacement = replacement;
  19439. const _should_remove = should_remove;
  19440. replacement = null;
  19441. should_remove = false;
  19442. leave.call(context, node, parent, prop, index);
  19443. if (replacement) {
  19444. node = replacement;
  19445. replace$1(parent, prop, index, node);
  19446. }
  19447. if (should_remove) {
  19448. remove(parent, prop, index);
  19449. }
  19450. const removed = should_remove;
  19451. replacement = _replacement;
  19452. should_remove = _should_remove;
  19453. if (removed) return null;
  19454. }
  19455. }
  19456. return node;
  19457. }
  19458. const extractors$1 = {
  19459. ArrayPattern(names, param) {
  19460. for (const element of param.elements) {
  19461. if (element)
  19462. extractors$1[element.type](names, element);
  19463. }
  19464. },
  19465. AssignmentPattern(names, param) {
  19466. extractors$1[param.left.type](names, param.left);
  19467. },
  19468. Identifier(names, param) {
  19469. names.push(param.name);
  19470. },
  19471. MemberExpression() { },
  19472. ObjectPattern(names, param) {
  19473. for (const prop of param.properties) {
  19474. // @ts-ignore Typescript reports that this is not a valid type
  19475. if (prop.type === 'RestElement') {
  19476. extractors$1.RestElement(names, prop);
  19477. }
  19478. else {
  19479. extractors$1[prop.value.type](names, prop.value);
  19480. }
  19481. }
  19482. },
  19483. RestElement(names, param) {
  19484. extractors$1[param.argument.type](names, param.argument);
  19485. }
  19486. };
  19487. const extractAssignedNames$1 = function extractAssignedNames(param) {
  19488. const names = [];
  19489. extractors$1[param.type](names, param);
  19490. return names;
  19491. };
  19492. const blockDeclarations$1 = {
  19493. const: true,
  19494. let: true
  19495. };
  19496. class Scope$1$1 {
  19497. constructor(options = {}) {
  19498. this.parent = options.parent;
  19499. this.isBlockScope = !!options.block;
  19500. this.declarations = Object.create(null);
  19501. if (options.params) {
  19502. options.params.forEach((param) => {
  19503. extractAssignedNames$1(param).forEach((name) => {
  19504. this.declarations[name] = true;
  19505. });
  19506. });
  19507. }
  19508. }
  19509. addDeclaration(node, isBlockDeclaration, isVar) {
  19510. if (!isBlockDeclaration && this.isBlockScope) {
  19511. // it's a `var` or function node, and this
  19512. // is a block scope, so we need to go up
  19513. this.parent.addDeclaration(node, isBlockDeclaration, isVar);
  19514. }
  19515. else if (node.id) {
  19516. extractAssignedNames$1(node.id).forEach((name) => {
  19517. this.declarations[name] = true;
  19518. });
  19519. }
  19520. }
  19521. contains(name) {
  19522. return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);
  19523. }
  19524. }
  19525. const attachScopes$1 = function attachScopes(ast, propertyName = 'scope') {
  19526. let scope = new Scope$1$1();
  19527. walk$2(ast, {
  19528. enter(n, parent) {
  19529. const node = n;
  19530. // function foo () {...}
  19531. // class Foo {...}
  19532. if (/(Function|Class)Declaration/.test(node.type)) {
  19533. scope.addDeclaration(node, false, false);
  19534. }
  19535. // var foo = 1
  19536. if (node.type === 'VariableDeclaration') {
  19537. const { kind } = node;
  19538. const isBlockDeclaration = blockDeclarations$1[kind];
  19539. // don't add const/let declarations in the body of a for loop #113
  19540. const parentType = parent ? parent.type : '';
  19541. if (!(isBlockDeclaration && /ForOfStatement/.test(parentType))) {
  19542. node.declarations.forEach((declaration) => {
  19543. scope.addDeclaration(declaration, isBlockDeclaration, true);
  19544. });
  19545. }
  19546. }
  19547. let newScope;
  19548. // create new function scope
  19549. if (/Function/.test(node.type)) {
  19550. const func = node;
  19551. newScope = new Scope$1$1({
  19552. parent: scope,
  19553. block: false,
  19554. params: func.params
  19555. });
  19556. // named function expressions - the name is considered
  19557. // part of the function's scope
  19558. if (func.type === 'FunctionExpression' && func.id) {
  19559. newScope.addDeclaration(func, false, false);
  19560. }
  19561. }
  19562. // create new block scope
  19563. if (node.type === 'BlockStatement' && !/Function/.test(parent.type)) {
  19564. newScope = new Scope$1$1({
  19565. parent: scope,
  19566. block: true
  19567. });
  19568. }
  19569. // catch clause has its own block scope
  19570. if (node.type === 'CatchClause') {
  19571. newScope = new Scope$1$1({
  19572. parent: scope,
  19573. params: node.param ? [node.param] : [],
  19574. block: true
  19575. });
  19576. }
  19577. if (newScope) {
  19578. Object.defineProperty(node, propertyName, {
  19579. value: newScope,
  19580. configurable: true
  19581. });
  19582. scope = newScope;
  19583. }
  19584. },
  19585. leave(n) {
  19586. const node = n;
  19587. if (node[propertyName])
  19588. scope = scope.parent;
  19589. }
  19590. });
  19591. return scope;
  19592. };
  19593. // Helper since Typescript can't detect readonly arrays with Array.isArray
  19594. function isArray$5(arg) {
  19595. return Array.isArray(arg);
  19596. }
  19597. function ensureArray$4(thing) {
  19598. if (isArray$5(thing))
  19599. return thing;
  19600. if (thing == null)
  19601. return [];
  19602. return [thing];
  19603. }
  19604. function getMatcherString$4(id, resolutionBase) {
  19605. if (resolutionBase === false) {
  19606. return id;
  19607. }
  19608. // resolve('') is valid and will default to process.cwd()
  19609. const basePath = resolve$1(resolutionBase || '')
  19610. .split(sep)
  19611. .join('/')
  19612. // escape all possible (posix + win) path characters that might interfere with regex
  19613. .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
  19614. // Note that we use posix.join because:
  19615. // 1. the basePath has been normalized to use /
  19616. // 2. the incoming glob (id) matcher, also uses /
  19617. // otherwise Node will force backslash (\) on windows
  19618. return posix$1.join(basePath, id);
  19619. }
  19620. const createFilter$4 = function createFilter(include, exclude, options) {
  19621. const resolutionBase = options && options.resolve;
  19622. const getMatcher = (id) => id instanceof RegExp
  19623. ? id
  19624. : {
  19625. test: (what) => {
  19626. // this refactor is a tad overly verbose but makes for easy debugging
  19627. const pattern = getMatcherString$4(id, resolutionBase);
  19628. const fn = picomatch(pattern, { dot: true });
  19629. const result = fn(what);
  19630. return result;
  19631. }
  19632. };
  19633. const includeMatchers = ensureArray$4(include).map(getMatcher);
  19634. const excludeMatchers = ensureArray$4(exclude).map(getMatcher);
  19635. return function result(id) {
  19636. if (typeof id !== 'string')
  19637. return false;
  19638. if (/\0/.test(id))
  19639. return false;
  19640. const pathId = id.split(sep).join('/');
  19641. for (let i = 0; i < excludeMatchers.length; ++i) {
  19642. const matcher = excludeMatchers[i];
  19643. if (matcher.test(pathId))
  19644. return false;
  19645. }
  19646. for (let i = 0; i < includeMatchers.length; ++i) {
  19647. const matcher = includeMatchers[i];
  19648. if (matcher.test(pathId))
  19649. return true;
  19650. }
  19651. return !includeMatchers.length;
  19652. };
  19653. };
  19654. const reservedWords$4 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
  19655. const builtins$5 = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
  19656. const forbiddenIdentifiers$4 = new Set(`${reservedWords$4} ${builtins$5}`.split(' '));
  19657. forbiddenIdentifiers$4.add('');
  19658. const makeLegalIdentifier$2 = function makeLegalIdentifier(str) {
  19659. let identifier = str
  19660. .replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
  19661. .replace(/[^$_a-zA-Z0-9]/g, '_');
  19662. if (/\d/.test(identifier[0]) || forbiddenIdentifiers$4.has(identifier)) {
  19663. identifier = `_${identifier}`;
  19664. }
  19665. return identifier || '_';
  19666. };
  19667. var commondir$1 = function (basedir, relfiles) {
  19668. if (relfiles) {
  19669. var files = relfiles.map(function (r) {
  19670. return path$5.resolve(basedir, r);
  19671. });
  19672. }
  19673. else {
  19674. var files = basedir;
  19675. }
  19676. var res = files.slice(1).reduce(function (ps, file) {
  19677. if (!file.match(/^([A-Za-z]:)?\/|\\/)) {
  19678. throw new Error('relative path without a basedir');
  19679. }
  19680. var xs = file.split(/\/+|\\+/);
  19681. for (
  19682. var i = 0;
  19683. ps[i] === xs[i] && i < Math.min(ps.length, xs.length);
  19684. i++
  19685. );
  19686. return ps.slice(0, i);
  19687. }, files[0].split(/\/+|\\+/));
  19688. // Windows correctly handles paths with forward-slashes
  19689. return res.length > 1 ? res.join('/') : '/'
  19690. };
  19691. // @ts-check
  19692. /** @typedef { import('estree').BaseNode} BaseNode */
  19693. /** @typedef {{
  19694. skip: () => void;
  19695. remove: () => void;
  19696. replace: (node: BaseNode) => void;
  19697. }} WalkerContext */
  19698. class WalkerBase$1 {
  19699. constructor() {
  19700. /** @type {boolean} */
  19701. this.should_skip = false;
  19702. /** @type {boolean} */
  19703. this.should_remove = false;
  19704. /** @type {BaseNode | null} */
  19705. this.replacement = null;
  19706. /** @type {WalkerContext} */
  19707. this.context = {
  19708. skip: () => (this.should_skip = true),
  19709. remove: () => (this.should_remove = true),
  19710. replace: (node) => (this.replacement = node)
  19711. };
  19712. }
  19713. /**
  19714. *
  19715. * @param {any} parent
  19716. * @param {string} prop
  19717. * @param {number} index
  19718. * @param {BaseNode} node
  19719. */
  19720. replace(parent, prop, index, node) {
  19721. if (parent) {
  19722. if (index !== null) {
  19723. parent[prop][index] = node;
  19724. } else {
  19725. parent[prop] = node;
  19726. }
  19727. }
  19728. }
  19729. /**
  19730. *
  19731. * @param {any} parent
  19732. * @param {string} prop
  19733. * @param {number} index
  19734. */
  19735. remove(parent, prop, index) {
  19736. if (parent) {
  19737. if (index !== null) {
  19738. parent[prop].splice(index, 1);
  19739. } else {
  19740. delete parent[prop];
  19741. }
  19742. }
  19743. }
  19744. }
  19745. // @ts-check
  19746. /** @typedef { import('estree').BaseNode} BaseNode */
  19747. /** @typedef { import('./walker.js').WalkerContext} WalkerContext */
  19748. /** @typedef {(
  19749. * this: WalkerContext,
  19750. * node: BaseNode,
  19751. * parent: BaseNode,
  19752. * key: string,
  19753. * index: number
  19754. * ) => void} SyncHandler */
  19755. class SyncWalker extends WalkerBase$1 {
  19756. /**
  19757. *
  19758. * @param {SyncHandler} enter
  19759. * @param {SyncHandler} leave
  19760. */
  19761. constructor(enter, leave) {
  19762. super();
  19763. /** @type {SyncHandler} */
  19764. this.enter = enter;
  19765. /** @type {SyncHandler} */
  19766. this.leave = leave;
  19767. }
  19768. /**
  19769. *
  19770. * @param {BaseNode} node
  19771. * @param {BaseNode} parent
  19772. * @param {string} [prop]
  19773. * @param {number} [index]
  19774. * @returns {BaseNode}
  19775. */
  19776. visit(node, parent, prop, index) {
  19777. if (node) {
  19778. if (this.enter) {
  19779. const _should_skip = this.should_skip;
  19780. const _should_remove = this.should_remove;
  19781. const _replacement = this.replacement;
  19782. this.should_skip = false;
  19783. this.should_remove = false;
  19784. this.replacement = null;
  19785. this.enter.call(this.context, node, parent, prop, index);
  19786. if (this.replacement) {
  19787. node = this.replacement;
  19788. this.replace(parent, prop, index, node);
  19789. }
  19790. if (this.should_remove) {
  19791. this.remove(parent, prop, index);
  19792. }
  19793. const skipped = this.should_skip;
  19794. const removed = this.should_remove;
  19795. this.should_skip = _should_skip;
  19796. this.should_remove = _should_remove;
  19797. this.replacement = _replacement;
  19798. if (skipped) return node;
  19799. if (removed) return null;
  19800. }
  19801. for (const key in node) {
  19802. const value = node[key];
  19803. if (typeof value !== "object") {
  19804. continue;
  19805. } else if (Array.isArray(value)) {
  19806. for (let i = 0; i < value.length; i += 1) {
  19807. if (value[i] !== null && typeof value[i].type === 'string') {
  19808. if (!this.visit(value[i], node, key, i)) {
  19809. // removed
  19810. i--;
  19811. }
  19812. }
  19813. }
  19814. } else if (value !== null && typeof value.type === "string") {
  19815. this.visit(value, node, key, null);
  19816. }
  19817. }
  19818. if (this.leave) {
  19819. const _replacement = this.replacement;
  19820. const _should_remove = this.should_remove;
  19821. this.replacement = null;
  19822. this.should_remove = false;
  19823. this.leave.call(this.context, node, parent, prop, index);
  19824. if (this.replacement) {
  19825. node = this.replacement;
  19826. this.replace(parent, prop, index, node);
  19827. }
  19828. if (this.should_remove) {
  19829. this.remove(parent, prop, index);
  19830. }
  19831. const removed = this.should_remove;
  19832. this.replacement = _replacement;
  19833. this.should_remove = _should_remove;
  19834. if (removed) return null;
  19835. }
  19836. }
  19837. return node;
  19838. }
  19839. }
  19840. // @ts-check
  19841. /** @typedef { import('estree').BaseNode} BaseNode */
  19842. /** @typedef { import('./sync.js').SyncHandler} SyncHandler */
  19843. /** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
  19844. /**
  19845. *
  19846. * @param {BaseNode} ast
  19847. * @param {{
  19848. * enter?: SyncHandler
  19849. * leave?: SyncHandler
  19850. * }} walker
  19851. * @returns {BaseNode}
  19852. */
  19853. function walk$1(ast, { enter, leave }) {
  19854. const instance = new SyncWalker(enter, leave);
  19855. return instance.visit(ast, null);
  19856. }
  19857. var chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  19858. function encode$1(decoded) {
  19859. var sourceFileIndex = 0; // second field
  19860. var sourceCodeLine = 0; // third field
  19861. var sourceCodeColumn = 0; // fourth field
  19862. var nameIndex = 0; // fifth field
  19863. var mappings = '';
  19864. for (var i = 0; i < decoded.length; i++) {
  19865. var line = decoded[i];
  19866. if (i > 0)
  19867. mappings += ';';
  19868. if (line.length === 0)
  19869. continue;
  19870. var generatedCodeColumn = 0; // first field
  19871. var lineMappings = [];
  19872. for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
  19873. var segment = line_1[_i];
  19874. var segmentMappings = encodeInteger$1(segment[0] - generatedCodeColumn);
  19875. generatedCodeColumn = segment[0];
  19876. if (segment.length > 1) {
  19877. segmentMappings +=
  19878. encodeInteger$1(segment[1] - sourceFileIndex) +
  19879. encodeInteger$1(segment[2] - sourceCodeLine) +
  19880. encodeInteger$1(segment[3] - sourceCodeColumn);
  19881. sourceFileIndex = segment[1];
  19882. sourceCodeLine = segment[2];
  19883. sourceCodeColumn = segment[3];
  19884. }
  19885. if (segment.length === 5) {
  19886. segmentMappings += encodeInteger$1(segment[4] - nameIndex);
  19887. nameIndex = segment[4];
  19888. }
  19889. lineMappings.push(segmentMappings);
  19890. }
  19891. mappings += lineMappings.join(',');
  19892. }
  19893. return mappings;
  19894. }
  19895. function encodeInteger$1(num) {
  19896. var result = '';
  19897. num = num < 0 ? (-num << 1) | 1 : num << 1;
  19898. do {
  19899. var clamped = num & 31;
  19900. num >>>= 5;
  19901. if (num > 0) {
  19902. clamped |= 32;
  19903. }
  19904. result += chars$2[clamped];
  19905. } while (num > 0);
  19906. return result;
  19907. }
  19908. var BitSet$1 = function BitSet(arg) {
  19909. this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
  19910. };
  19911. BitSet$1.prototype.add = function add (n) {
  19912. this.bits[n >> 5] |= 1 << (n & 31);
  19913. };
  19914. BitSet$1.prototype.has = function has (n) {
  19915. return !!(this.bits[n >> 5] & (1 << (n & 31)));
  19916. };
  19917. var Chunk$1$1 = function Chunk(start, end, content) {
  19918. this.start = start;
  19919. this.end = end;
  19920. this.original = content;
  19921. this.intro = '';
  19922. this.outro = '';
  19923. this.content = content;
  19924. this.storeName = false;
  19925. this.edited = false;
  19926. // we make these non-enumerable, for sanity while debugging
  19927. Object.defineProperties(this, {
  19928. previous: { writable: true, value: null },
  19929. next: { writable: true, value: null },
  19930. });
  19931. };
  19932. Chunk$1$1.prototype.appendLeft = function appendLeft (content) {
  19933. this.outro += content;
  19934. };
  19935. Chunk$1$1.prototype.appendRight = function appendRight (content) {
  19936. this.intro = this.intro + content;
  19937. };
  19938. Chunk$1$1.prototype.clone = function clone () {
  19939. var chunk = new Chunk$1$1(this.start, this.end, this.original);
  19940. chunk.intro = this.intro;
  19941. chunk.outro = this.outro;
  19942. chunk.content = this.content;
  19943. chunk.storeName = this.storeName;
  19944. chunk.edited = this.edited;
  19945. return chunk;
  19946. };
  19947. Chunk$1$1.prototype.contains = function contains (index) {
  19948. return this.start < index && index < this.end;
  19949. };
  19950. Chunk$1$1.prototype.eachNext = function eachNext (fn) {
  19951. var chunk = this;
  19952. while (chunk) {
  19953. fn(chunk);
  19954. chunk = chunk.next;
  19955. }
  19956. };
  19957. Chunk$1$1.prototype.eachPrevious = function eachPrevious (fn) {
  19958. var chunk = this;
  19959. while (chunk) {
  19960. fn(chunk);
  19961. chunk = chunk.previous;
  19962. }
  19963. };
  19964. Chunk$1$1.prototype.edit = function edit (content, storeName, contentOnly) {
  19965. this.content = content;
  19966. if (!contentOnly) {
  19967. this.intro = '';
  19968. this.outro = '';
  19969. }
  19970. this.storeName = storeName;
  19971. this.edited = true;
  19972. return this;
  19973. };
  19974. Chunk$1$1.prototype.prependLeft = function prependLeft (content) {
  19975. this.outro = content + this.outro;
  19976. };
  19977. Chunk$1$1.prototype.prependRight = function prependRight (content) {
  19978. this.intro = content + this.intro;
  19979. };
  19980. Chunk$1$1.prototype.split = function split (index) {
  19981. var sliceIndex = index - this.start;
  19982. var originalBefore = this.original.slice(0, sliceIndex);
  19983. var originalAfter = this.original.slice(sliceIndex);
  19984. this.original = originalBefore;
  19985. var newChunk = new Chunk$1$1(index, this.end, originalAfter);
  19986. newChunk.outro = this.outro;
  19987. this.outro = '';
  19988. this.end = index;
  19989. if (this.edited) {
  19990. // TODO is this block necessary?...
  19991. newChunk.edit('', false);
  19992. this.content = '';
  19993. } else {
  19994. this.content = originalBefore;
  19995. }
  19996. newChunk.next = this.next;
  19997. if (newChunk.next) { newChunk.next.previous = newChunk; }
  19998. newChunk.previous = this;
  19999. this.next = newChunk;
  20000. return newChunk;
  20001. };
  20002. Chunk$1$1.prototype.toString = function toString () {
  20003. return this.intro + this.content + this.outro;
  20004. };
  20005. Chunk$1$1.prototype.trimEnd = function trimEnd (rx) {
  20006. this.outro = this.outro.replace(rx, '');
  20007. if (this.outro.length) { return true; }
  20008. var trimmed = this.content.replace(rx, '');
  20009. if (trimmed.length) {
  20010. if (trimmed !== this.content) {
  20011. this.split(this.start + trimmed.length).edit('', undefined, true);
  20012. }
  20013. return true;
  20014. } else {
  20015. this.edit('', undefined, true);
  20016. this.intro = this.intro.replace(rx, '');
  20017. if (this.intro.length) { return true; }
  20018. }
  20019. };
  20020. Chunk$1$1.prototype.trimStart = function trimStart (rx) {
  20021. this.intro = this.intro.replace(rx, '');
  20022. if (this.intro.length) { return true; }
  20023. var trimmed = this.content.replace(rx, '');
  20024. if (trimmed.length) {
  20025. if (trimmed !== this.content) {
  20026. this.split(this.end - trimmed.length);
  20027. this.edit('', undefined, true);
  20028. }
  20029. return true;
  20030. } else {
  20031. this.edit('', undefined, true);
  20032. this.outro = this.outro.replace(rx, '');
  20033. if (this.outro.length) { return true; }
  20034. }
  20035. };
  20036. var btoa$1$1 = function () {
  20037. throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
  20038. };
  20039. if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
  20040. btoa$1$1 = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
  20041. } else if (typeof Buffer === 'function') {
  20042. btoa$1$1 = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
  20043. }
  20044. var SourceMap$1 = function SourceMap(properties) {
  20045. this.version = 3;
  20046. this.file = properties.file;
  20047. this.sources = properties.sources;
  20048. this.sourcesContent = properties.sourcesContent;
  20049. this.names = properties.names;
  20050. this.mappings = encode$1(properties.mappings);
  20051. };
  20052. SourceMap$1.prototype.toString = function toString () {
  20053. return JSON.stringify(this);
  20054. };
  20055. SourceMap$1.prototype.toUrl = function toUrl () {
  20056. return 'data:application/json;charset=utf-8;base64,' + btoa$1$1(this.toString());
  20057. };
  20058. function guessIndent$1(code) {
  20059. var lines = code.split('\n');
  20060. var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
  20061. var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
  20062. if (tabbed.length === 0 && spaced.length === 0) {
  20063. return null;
  20064. }
  20065. // More lines tabbed than spaced? Assume tabs, and
  20066. // default to tabs in the case of a tie (or nothing
  20067. // to go on)
  20068. if (tabbed.length >= spaced.length) {
  20069. return '\t';
  20070. }
  20071. // Otherwise, we need to guess the multiple
  20072. var min = spaced.reduce(function (previous, current) {
  20073. var numSpaces = /^ +/.exec(current)[0].length;
  20074. return Math.min(numSpaces, previous);
  20075. }, Infinity);
  20076. return new Array(min + 1).join(' ');
  20077. }
  20078. function getRelativePath$1(from, to) {
  20079. var fromParts = from.split(/[/\\]/);
  20080. var toParts = to.split(/[/\\]/);
  20081. fromParts.pop(); // get dirname
  20082. while (fromParts[0] === toParts[0]) {
  20083. fromParts.shift();
  20084. toParts.shift();
  20085. }
  20086. if (fromParts.length) {
  20087. var i = fromParts.length;
  20088. while (i--) { fromParts[i] = '..'; }
  20089. }
  20090. return fromParts.concat(toParts).join('/');
  20091. }
  20092. var toString$1$1 = Object.prototype.toString;
  20093. function isObject$1(thing) {
  20094. return toString$1$1.call(thing) === '[object Object]';
  20095. }
  20096. function getLocator$1$1(source) {
  20097. var originalLines = source.split('\n');
  20098. var lineOffsets = [];
  20099. for (var i = 0, pos = 0; i < originalLines.length; i++) {
  20100. lineOffsets.push(pos);
  20101. pos += originalLines[i].length + 1;
  20102. }
  20103. return function locate(index) {
  20104. var i = 0;
  20105. var j = lineOffsets.length;
  20106. while (i < j) {
  20107. var m = (i + j) >> 1;
  20108. if (index < lineOffsets[m]) {
  20109. j = m;
  20110. } else {
  20111. i = m + 1;
  20112. }
  20113. }
  20114. var line = i - 1;
  20115. var column = index - lineOffsets[line];
  20116. return { line: line, column: column };
  20117. };
  20118. }
  20119. var Mappings$1 = function Mappings(hires) {
  20120. this.hires = hires;
  20121. this.generatedCodeLine = 0;
  20122. this.generatedCodeColumn = 0;
  20123. this.raw = [];
  20124. this.rawSegments = this.raw[this.generatedCodeLine] = [];
  20125. this.pending = null;
  20126. };
  20127. Mappings$1.prototype.addEdit = function addEdit (sourceIndex, content, loc, nameIndex) {
  20128. if (content.length) {
  20129. var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
  20130. if (nameIndex >= 0) {
  20131. segment.push(nameIndex);
  20132. }
  20133. this.rawSegments.push(segment);
  20134. } else if (this.pending) {
  20135. this.rawSegments.push(this.pending);
  20136. }
  20137. this.advance(content);
  20138. this.pending = null;
  20139. };
  20140. Mappings$1.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
  20141. var originalCharIndex = chunk.start;
  20142. var first = true;
  20143. while (originalCharIndex < chunk.end) {
  20144. if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
  20145. this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
  20146. }
  20147. if (original[originalCharIndex] === '\n') {
  20148. loc.line += 1;
  20149. loc.column = 0;
  20150. this.generatedCodeLine += 1;
  20151. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  20152. this.generatedCodeColumn = 0;
  20153. first = true;
  20154. } else {
  20155. loc.column += 1;
  20156. this.generatedCodeColumn += 1;
  20157. first = false;
  20158. }
  20159. originalCharIndex += 1;
  20160. }
  20161. this.pending = null;
  20162. };
  20163. Mappings$1.prototype.advance = function advance (str) {
  20164. if (!str) { return; }
  20165. var lines = str.split('\n');
  20166. if (lines.length > 1) {
  20167. for (var i = 0; i < lines.length - 1; i++) {
  20168. this.generatedCodeLine++;
  20169. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  20170. }
  20171. this.generatedCodeColumn = 0;
  20172. }
  20173. this.generatedCodeColumn += lines[lines.length - 1].length;
  20174. };
  20175. var n$1 = '\n';
  20176. var warned$1 = {
  20177. insertLeft: false,
  20178. insertRight: false,
  20179. storeName: false,
  20180. };
  20181. var MagicString$1 = function MagicString(string, options) {
  20182. if ( options === void 0 ) options = {};
  20183. var chunk = new Chunk$1$1(0, string.length, string);
  20184. Object.defineProperties(this, {
  20185. original: { writable: true, value: string },
  20186. outro: { writable: true, value: '' },
  20187. intro: { writable: true, value: '' },
  20188. firstChunk: { writable: true, value: chunk },
  20189. lastChunk: { writable: true, value: chunk },
  20190. lastSearchedChunk: { writable: true, value: chunk },
  20191. byStart: { writable: true, value: {} },
  20192. byEnd: { writable: true, value: {} },
  20193. filename: { writable: true, value: options.filename },
  20194. indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
  20195. sourcemapLocations: { writable: true, value: new BitSet$1() },
  20196. storedNames: { writable: true, value: {} },
  20197. indentStr: { writable: true, value: guessIndent$1(string) },
  20198. });
  20199. this.byStart[0] = chunk;
  20200. this.byEnd[string.length] = chunk;
  20201. };
  20202. MagicString$1.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
  20203. this.sourcemapLocations.add(char);
  20204. };
  20205. MagicString$1.prototype.append = function append (content) {
  20206. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  20207. this.outro += content;
  20208. return this;
  20209. };
  20210. MagicString$1.prototype.appendLeft = function appendLeft (index, content) {
  20211. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  20212. this._split(index);
  20213. var chunk = this.byEnd[index];
  20214. if (chunk) {
  20215. chunk.appendLeft(content);
  20216. } else {
  20217. this.intro += content;
  20218. }
  20219. return this;
  20220. };
  20221. MagicString$1.prototype.appendRight = function appendRight (index, content) {
  20222. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  20223. this._split(index);
  20224. var chunk = this.byStart[index];
  20225. if (chunk) {
  20226. chunk.appendRight(content);
  20227. } else {
  20228. this.outro += content;
  20229. }
  20230. return this;
  20231. };
  20232. MagicString$1.prototype.clone = function clone () {
  20233. var cloned = new MagicString$1(this.original, { filename: this.filename });
  20234. var originalChunk = this.firstChunk;
  20235. var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
  20236. while (originalChunk) {
  20237. cloned.byStart[clonedChunk.start] = clonedChunk;
  20238. cloned.byEnd[clonedChunk.end] = clonedChunk;
  20239. var nextOriginalChunk = originalChunk.next;
  20240. var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
  20241. if (nextClonedChunk) {
  20242. clonedChunk.next = nextClonedChunk;
  20243. nextClonedChunk.previous = clonedChunk;
  20244. clonedChunk = nextClonedChunk;
  20245. }
  20246. originalChunk = nextOriginalChunk;
  20247. }
  20248. cloned.lastChunk = clonedChunk;
  20249. if (this.indentExclusionRanges) {
  20250. cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
  20251. }
  20252. cloned.sourcemapLocations = new BitSet$1(this.sourcemapLocations);
  20253. cloned.intro = this.intro;
  20254. cloned.outro = this.outro;
  20255. return cloned;
  20256. };
  20257. MagicString$1.prototype.generateDecodedMap = function generateDecodedMap (options) {
  20258. var this$1$1 = this;
  20259. options = options || {};
  20260. var sourceIndex = 0;
  20261. var names = Object.keys(this.storedNames);
  20262. var mappings = new Mappings$1(options.hires);
  20263. var locate = getLocator$1$1(this.original);
  20264. if (this.intro) {
  20265. mappings.advance(this.intro);
  20266. }
  20267. this.firstChunk.eachNext(function (chunk) {
  20268. var loc = locate(chunk.start);
  20269. if (chunk.intro.length) { mappings.advance(chunk.intro); }
  20270. if (chunk.edited) {
  20271. mappings.addEdit(
  20272. sourceIndex,
  20273. chunk.content,
  20274. loc,
  20275. chunk.storeName ? names.indexOf(chunk.original) : -1
  20276. );
  20277. } else {
  20278. mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
  20279. }
  20280. if (chunk.outro.length) { mappings.advance(chunk.outro); }
  20281. });
  20282. return {
  20283. file: options.file ? options.file.split(/[/\\]/).pop() : null,
  20284. sources: [options.source ? getRelativePath$1(options.file || '', options.source) : null],
  20285. sourcesContent: options.includeContent ? [this.original] : [null],
  20286. names: names,
  20287. mappings: mappings.raw,
  20288. };
  20289. };
  20290. MagicString$1.prototype.generateMap = function generateMap (options) {
  20291. return new SourceMap$1(this.generateDecodedMap(options));
  20292. };
  20293. MagicString$1.prototype.getIndentString = function getIndentString () {
  20294. return this.indentStr === null ? '\t' : this.indentStr;
  20295. };
  20296. MagicString$1.prototype.indent = function indent (indentStr, options) {
  20297. var pattern = /^[^\r\n]/gm;
  20298. if (isObject$1(indentStr)) {
  20299. options = indentStr;
  20300. indentStr = undefined;
  20301. }
  20302. indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
  20303. if (indentStr === '') { return this; } // noop
  20304. options = options || {};
  20305. // Process exclusion ranges
  20306. var isExcluded = {};
  20307. if (options.exclude) {
  20308. var exclusions =
  20309. typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
  20310. exclusions.forEach(function (exclusion) {
  20311. for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
  20312. isExcluded[i] = true;
  20313. }
  20314. });
  20315. }
  20316. var shouldIndentNextCharacter = options.indentStart !== false;
  20317. var replacer = function (match) {
  20318. if (shouldIndentNextCharacter) { return ("" + indentStr + match); }
  20319. shouldIndentNextCharacter = true;
  20320. return match;
  20321. };
  20322. this.intro = this.intro.replace(pattern, replacer);
  20323. var charIndex = 0;
  20324. var chunk = this.firstChunk;
  20325. while (chunk) {
  20326. var end = chunk.end;
  20327. if (chunk.edited) {
  20328. if (!isExcluded[charIndex]) {
  20329. chunk.content = chunk.content.replace(pattern, replacer);
  20330. if (chunk.content.length) {
  20331. shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
  20332. }
  20333. }
  20334. } else {
  20335. charIndex = chunk.start;
  20336. while (charIndex < end) {
  20337. if (!isExcluded[charIndex]) {
  20338. var char = this.original[charIndex];
  20339. if (char === '\n') {
  20340. shouldIndentNextCharacter = true;
  20341. } else if (char !== '\r' && shouldIndentNextCharacter) {
  20342. shouldIndentNextCharacter = false;
  20343. if (charIndex === chunk.start) {
  20344. chunk.prependRight(indentStr);
  20345. } else {
  20346. this._splitChunk(chunk, charIndex);
  20347. chunk = chunk.next;
  20348. chunk.prependRight(indentStr);
  20349. }
  20350. }
  20351. }
  20352. charIndex += 1;
  20353. }
  20354. }
  20355. charIndex = chunk.end;
  20356. chunk = chunk.next;
  20357. }
  20358. this.outro = this.outro.replace(pattern, replacer);
  20359. return this;
  20360. };
  20361. MagicString$1.prototype.insert = function insert () {
  20362. throw new Error(
  20363. 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
  20364. );
  20365. };
  20366. MagicString$1.prototype.insertLeft = function insertLeft (index, content) {
  20367. if (!warned$1.insertLeft) {
  20368. console.warn(
  20369. 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
  20370. ); // eslint-disable-line no-console
  20371. warned$1.insertLeft = true;
  20372. }
  20373. return this.appendLeft(index, content);
  20374. };
  20375. MagicString$1.prototype.insertRight = function insertRight (index, content) {
  20376. if (!warned$1.insertRight) {
  20377. console.warn(
  20378. 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
  20379. ); // eslint-disable-line no-console
  20380. warned$1.insertRight = true;
  20381. }
  20382. return this.prependRight(index, content);
  20383. };
  20384. MagicString$1.prototype.move = function move (start, end, index) {
  20385. if (index >= start && index <= end) { throw new Error('Cannot move a selection inside itself'); }
  20386. this._split(start);
  20387. this._split(end);
  20388. this._split(index);
  20389. var first = this.byStart[start];
  20390. var last = this.byEnd[end];
  20391. var oldLeft = first.previous;
  20392. var oldRight = last.next;
  20393. var newRight = this.byStart[index];
  20394. if (!newRight && last === this.lastChunk) { return this; }
  20395. var newLeft = newRight ? newRight.previous : this.lastChunk;
  20396. if (oldLeft) { oldLeft.next = oldRight; }
  20397. if (oldRight) { oldRight.previous = oldLeft; }
  20398. if (newLeft) { newLeft.next = first; }
  20399. if (newRight) { newRight.previous = last; }
  20400. if (!first.previous) { this.firstChunk = last.next; }
  20401. if (!last.next) {
  20402. this.lastChunk = first.previous;
  20403. this.lastChunk.next = null;
  20404. }
  20405. first.previous = newLeft;
  20406. last.next = newRight || null;
  20407. if (!newLeft) { this.firstChunk = first; }
  20408. if (!newRight) { this.lastChunk = last; }
  20409. return this;
  20410. };
  20411. MagicString$1.prototype.overwrite = function overwrite (start, end, content, options) {
  20412. if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
  20413. while (start < 0) { start += this.original.length; }
  20414. while (end < 0) { end += this.original.length; }
  20415. if (end > this.original.length) { throw new Error('end is out of bounds'); }
  20416. if (start === end)
  20417. { throw new Error(
  20418. 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
  20419. ); }
  20420. this._split(start);
  20421. this._split(end);
  20422. if (options === true) {
  20423. if (!warned$1.storeName) {
  20424. console.warn(
  20425. 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
  20426. ); // eslint-disable-line no-console
  20427. warned$1.storeName = true;
  20428. }
  20429. options = { storeName: true };
  20430. }
  20431. var storeName = options !== undefined ? options.storeName : false;
  20432. var contentOnly = options !== undefined ? options.contentOnly : false;
  20433. if (storeName) {
  20434. var original = this.original.slice(start, end);
  20435. Object.defineProperty(this.storedNames, original, { writable: true, value: true, enumerable: true });
  20436. }
  20437. var first = this.byStart[start];
  20438. var last = this.byEnd[end];
  20439. if (first) {
  20440. var chunk = first;
  20441. while (chunk !== last) {
  20442. if (chunk.next !== this.byStart[chunk.end]) {
  20443. throw new Error('Cannot overwrite across a split point');
  20444. }
  20445. chunk = chunk.next;
  20446. chunk.edit('', false);
  20447. }
  20448. first.edit(content, storeName, contentOnly);
  20449. } else {
  20450. // must be inserting at the end
  20451. var newChunk = new Chunk$1$1(start, end, '').edit(content, storeName);
  20452. // TODO last chunk in the array may not be the last chunk, if it's moved...
  20453. last.next = newChunk;
  20454. newChunk.previous = last;
  20455. }
  20456. return this;
  20457. };
  20458. MagicString$1.prototype.prepend = function prepend (content) {
  20459. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  20460. this.intro = content + this.intro;
  20461. return this;
  20462. };
  20463. MagicString$1.prototype.prependLeft = function prependLeft (index, content) {
  20464. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  20465. this._split(index);
  20466. var chunk = this.byEnd[index];
  20467. if (chunk) {
  20468. chunk.prependLeft(content);
  20469. } else {
  20470. this.intro = content + this.intro;
  20471. }
  20472. return this;
  20473. };
  20474. MagicString$1.prototype.prependRight = function prependRight (index, content) {
  20475. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  20476. this._split(index);
  20477. var chunk = this.byStart[index];
  20478. if (chunk) {
  20479. chunk.prependRight(content);
  20480. } else {
  20481. this.outro = content + this.outro;
  20482. }
  20483. return this;
  20484. };
  20485. MagicString$1.prototype.remove = function remove (start, end) {
  20486. while (start < 0) { start += this.original.length; }
  20487. while (end < 0) { end += this.original.length; }
  20488. if (start === end) { return this; }
  20489. if (start < 0 || end > this.original.length) { throw new Error('Character is out of bounds'); }
  20490. if (start > end) { throw new Error('end must be greater than start'); }
  20491. this._split(start);
  20492. this._split(end);
  20493. var chunk = this.byStart[start];
  20494. while (chunk) {
  20495. chunk.intro = '';
  20496. chunk.outro = '';
  20497. chunk.edit('');
  20498. chunk = end > chunk.end ? this.byStart[chunk.end] : null;
  20499. }
  20500. return this;
  20501. };
  20502. MagicString$1.prototype.lastChar = function lastChar () {
  20503. if (this.outro.length) { return this.outro[this.outro.length - 1]; }
  20504. var chunk = this.lastChunk;
  20505. do {
  20506. if (chunk.outro.length) { return chunk.outro[chunk.outro.length - 1]; }
  20507. if (chunk.content.length) { return chunk.content[chunk.content.length - 1]; }
  20508. if (chunk.intro.length) { return chunk.intro[chunk.intro.length - 1]; }
  20509. } while ((chunk = chunk.previous));
  20510. if (this.intro.length) { return this.intro[this.intro.length - 1]; }
  20511. return '';
  20512. };
  20513. MagicString$1.prototype.lastLine = function lastLine () {
  20514. var lineIndex = this.outro.lastIndexOf(n$1);
  20515. if (lineIndex !== -1) { return this.outro.substr(lineIndex + 1); }
  20516. var lineStr = this.outro;
  20517. var chunk = this.lastChunk;
  20518. do {
  20519. if (chunk.outro.length > 0) {
  20520. lineIndex = chunk.outro.lastIndexOf(n$1);
  20521. if (lineIndex !== -1) { return chunk.outro.substr(lineIndex + 1) + lineStr; }
  20522. lineStr = chunk.outro + lineStr;
  20523. }
  20524. if (chunk.content.length > 0) {
  20525. lineIndex = chunk.content.lastIndexOf(n$1);
  20526. if (lineIndex !== -1) { return chunk.content.substr(lineIndex + 1) + lineStr; }
  20527. lineStr = chunk.content + lineStr;
  20528. }
  20529. if (chunk.intro.length > 0) {
  20530. lineIndex = chunk.intro.lastIndexOf(n$1);
  20531. if (lineIndex !== -1) { return chunk.intro.substr(lineIndex + 1) + lineStr; }
  20532. lineStr = chunk.intro + lineStr;
  20533. }
  20534. } while ((chunk = chunk.previous));
  20535. lineIndex = this.intro.lastIndexOf(n$1);
  20536. if (lineIndex !== -1) { return this.intro.substr(lineIndex + 1) + lineStr; }
  20537. return this.intro + lineStr;
  20538. };
  20539. MagicString$1.prototype.slice = function slice (start, end) {
  20540. if ( start === void 0 ) start = 0;
  20541. if ( end === void 0 ) end = this.original.length;
  20542. while (start < 0) { start += this.original.length; }
  20543. while (end < 0) { end += this.original.length; }
  20544. var result = '';
  20545. // find start chunk
  20546. var chunk = this.firstChunk;
  20547. while (chunk && (chunk.start > start || chunk.end <= start)) {
  20548. // found end chunk before start
  20549. if (chunk.start < end && chunk.end >= end) {
  20550. return result;
  20551. }
  20552. chunk = chunk.next;
  20553. }
  20554. if (chunk && chunk.edited && chunk.start !== start)
  20555. { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
  20556. var startChunk = chunk;
  20557. while (chunk) {
  20558. if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
  20559. result += chunk.intro;
  20560. }
  20561. var containsEnd = chunk.start < end && chunk.end >= end;
  20562. if (containsEnd && chunk.edited && chunk.end !== end)
  20563. { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
  20564. var sliceStart = startChunk === chunk ? start - chunk.start : 0;
  20565. var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
  20566. result += chunk.content.slice(sliceStart, sliceEnd);
  20567. if (chunk.outro && (!containsEnd || chunk.end === end)) {
  20568. result += chunk.outro;
  20569. }
  20570. if (containsEnd) {
  20571. break;
  20572. }
  20573. chunk = chunk.next;
  20574. }
  20575. return result;
  20576. };
  20577. // TODO deprecate this? not really very useful
  20578. MagicString$1.prototype.snip = function snip (start, end) {
  20579. var clone = this.clone();
  20580. clone.remove(0, start);
  20581. clone.remove(end, clone.original.length);
  20582. return clone;
  20583. };
  20584. MagicString$1.prototype._split = function _split (index) {
  20585. if (this.byStart[index] || this.byEnd[index]) { return; }
  20586. var chunk = this.lastSearchedChunk;
  20587. var searchForward = index > chunk.end;
  20588. while (chunk) {
  20589. if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
  20590. chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
  20591. }
  20592. };
  20593. MagicString$1.prototype._splitChunk = function _splitChunk (chunk, index) {
  20594. if (chunk.edited && chunk.content.length) {
  20595. // zero-length edited chunks are a special case (overlapping replacements)
  20596. var loc = getLocator$1$1(this.original)(index);
  20597. throw new Error(
  20598. ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
  20599. );
  20600. }
  20601. var newChunk = chunk.split(index);
  20602. this.byEnd[index] = chunk;
  20603. this.byStart[index] = newChunk;
  20604. this.byEnd[newChunk.end] = newChunk;
  20605. if (chunk === this.lastChunk) { this.lastChunk = newChunk; }
  20606. this.lastSearchedChunk = chunk;
  20607. return true;
  20608. };
  20609. MagicString$1.prototype.toString = function toString () {
  20610. var str = this.intro;
  20611. var chunk = this.firstChunk;
  20612. while (chunk) {
  20613. str += chunk.toString();
  20614. chunk = chunk.next;
  20615. }
  20616. return str + this.outro;
  20617. };
  20618. MagicString$1.prototype.isEmpty = function isEmpty () {
  20619. var chunk = this.firstChunk;
  20620. do {
  20621. if (
  20622. (chunk.intro.length && chunk.intro.trim()) ||
  20623. (chunk.content.length && chunk.content.trim()) ||
  20624. (chunk.outro.length && chunk.outro.trim())
  20625. )
  20626. { return false; }
  20627. } while ((chunk = chunk.next));
  20628. return true;
  20629. };
  20630. MagicString$1.prototype.length = function length () {
  20631. var chunk = this.firstChunk;
  20632. var length = 0;
  20633. do {
  20634. length += chunk.intro.length + chunk.content.length + chunk.outro.length;
  20635. } while ((chunk = chunk.next));
  20636. return length;
  20637. };
  20638. MagicString$1.prototype.trimLines = function trimLines () {
  20639. return this.trim('[\\r\\n]');
  20640. };
  20641. MagicString$1.prototype.trim = function trim (charType) {
  20642. return this.trimStart(charType).trimEnd(charType);
  20643. };
  20644. MagicString$1.prototype.trimEndAborted = function trimEndAborted (charType) {
  20645. var rx = new RegExp((charType || '\\s') + '+$');
  20646. this.outro = this.outro.replace(rx, '');
  20647. if (this.outro.length) { return true; }
  20648. var chunk = this.lastChunk;
  20649. do {
  20650. var end = chunk.end;
  20651. var aborted = chunk.trimEnd(rx);
  20652. // if chunk was trimmed, we have a new lastChunk
  20653. if (chunk.end !== end) {
  20654. if (this.lastChunk === chunk) {
  20655. this.lastChunk = chunk.next;
  20656. }
  20657. this.byEnd[chunk.end] = chunk;
  20658. this.byStart[chunk.next.start] = chunk.next;
  20659. this.byEnd[chunk.next.end] = chunk.next;
  20660. }
  20661. if (aborted) { return true; }
  20662. chunk = chunk.previous;
  20663. } while (chunk);
  20664. return false;
  20665. };
  20666. MagicString$1.prototype.trimEnd = function trimEnd (charType) {
  20667. this.trimEndAborted(charType);
  20668. return this;
  20669. };
  20670. MagicString$1.prototype.trimStartAborted = function trimStartAborted (charType) {
  20671. var rx = new RegExp('^' + (charType || '\\s') + '+');
  20672. this.intro = this.intro.replace(rx, '');
  20673. if (this.intro.length) { return true; }
  20674. var chunk = this.firstChunk;
  20675. do {
  20676. var end = chunk.end;
  20677. var aborted = chunk.trimStart(rx);
  20678. if (chunk.end !== end) {
  20679. // special case...
  20680. if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
  20681. this.byEnd[chunk.end] = chunk;
  20682. this.byStart[chunk.next.start] = chunk.next;
  20683. this.byEnd[chunk.next.end] = chunk.next;
  20684. }
  20685. if (aborted) { return true; }
  20686. chunk = chunk.next;
  20687. } while (chunk);
  20688. return false;
  20689. };
  20690. MagicString$1.prototype.trimStart = function trimStart (charType) {
  20691. this.trimStartAborted(charType);
  20692. return this;
  20693. };
  20694. function isReference(node, parent) {
  20695. if (node.type === 'MemberExpression') {
  20696. return !node.computed && isReference(node.object, node);
  20697. }
  20698. if (node.type === 'Identifier') {
  20699. if (!parent)
  20700. return true;
  20701. switch (parent.type) {
  20702. // disregard `bar` in `foo.bar`
  20703. case 'MemberExpression': return parent.computed || node === parent.object;
  20704. // disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}`
  20705. case 'MethodDefinition': return parent.computed;
  20706. // disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}`
  20707. case 'FieldDefinition': return parent.computed || node === parent.value;
  20708. // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }`
  20709. case 'Property': return parent.computed || node === parent.value;
  20710. // disregard the `bar` in `export { foo as bar }` or
  20711. // the foo in `import { foo as bar }`
  20712. case 'ExportSpecifier':
  20713. case 'ImportSpecifier': return node === parent.local;
  20714. // disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}`
  20715. case 'LabeledStatement':
  20716. case 'BreakStatement':
  20717. case 'ContinueStatement': return false;
  20718. default: return true;
  20719. }
  20720. }
  20721. return false;
  20722. }
  20723. // Copyright Joyent, Inc. and other Node contributors.
  20724. //
  20725. // Permission is hereby granted, free of charge, to any person obtaining a
  20726. // copy of this software and associated documentation files (the
  20727. // "Software"), to deal in the Software without restriction, including
  20728. // without limitation the rights to use, copy, modify, merge, publish,
  20729. // distribute, sublicense, and/or sell copies of the Software, and to permit
  20730. // persons to whom the Software is furnished to do so, subject to the
  20731. // following conditions:
  20732. //
  20733. // The above copyright notice and this permission notice shall be included
  20734. // in all copies or substantial portions of the Software.
  20735. //
  20736. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20737. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20738. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  20739. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  20740. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20741. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  20742. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  20743. var isWindows = process.platform === 'win32';
  20744. function rethrow() {
  20745. // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
  20746. // is fairly slow to generate.
  20747. var callback;
  20748. callback = missingCallback;
  20749. return callback;
  20750. function missingCallback(err) {
  20751. if (err) {
  20752. if (process.throwDeprecation)
  20753. throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
  20754. else if (!process.noDeprecation) {
  20755. var msg = 'fs: missing callback ' + (err.stack || err.message);
  20756. if (process.traceDeprecation)
  20757. console.trace(msg);
  20758. else
  20759. console.error(msg);
  20760. }
  20761. }
  20762. }
  20763. }
  20764. function maybeCallback(cb) {
  20765. return typeof cb === 'function' ? cb : rethrow();
  20766. }
  20767. // Regexp that finds the next partion of a (partial) path
  20768. // result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
  20769. if (isWindows) {
  20770. var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
  20771. } else {
  20772. var nextPartRe = /(.*?)(?:[\/]+|$)/g;
  20773. }
  20774. // Regex to find the device root, including trailing slash. E.g. 'c:\\'.
  20775. if (isWindows) {
  20776. var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
  20777. } else {
  20778. var splitRootRe = /^[\/]*/;
  20779. }
  20780. var realpathSync$1 = function realpathSync(p, cache) {
  20781. // make p is absolute
  20782. p = path$5.resolve(p);
  20783. if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
  20784. return cache[p];
  20785. }
  20786. var original = p,
  20787. seenLinks = {},
  20788. knownHard = {};
  20789. // current character position in p
  20790. var pos;
  20791. // the partial path so far, including a trailing slash if any
  20792. var current;
  20793. // the partial path without a trailing slash (except when pointing at a root)
  20794. var base;
  20795. // the partial path scanned in the previous round, with slash
  20796. var previous;
  20797. start();
  20798. function start() {
  20799. // Skip over roots
  20800. var m = splitRootRe.exec(p);
  20801. pos = m[0].length;
  20802. current = m[0];
  20803. base = m[0];
  20804. previous = '';
  20805. // On windows, check that the root exists. On unix there is no need.
  20806. if (isWindows && !knownHard[base]) {
  20807. fs$3.lstatSync(base);
  20808. knownHard[base] = true;
  20809. }
  20810. }
  20811. // walk down the path, swapping out linked pathparts for their real
  20812. // values
  20813. // NB: p.length changes.
  20814. while (pos < p.length) {
  20815. // find the next part
  20816. nextPartRe.lastIndex = pos;
  20817. var result = nextPartRe.exec(p);
  20818. previous = current;
  20819. current += result[0];
  20820. base = previous + result[1];
  20821. pos = nextPartRe.lastIndex;
  20822. // continue if not a symlink
  20823. if (knownHard[base] || (cache && cache[base] === base)) {
  20824. continue;
  20825. }
  20826. var resolvedLink;
  20827. if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
  20828. // some known symbolic link. no need to stat again.
  20829. resolvedLink = cache[base];
  20830. } else {
  20831. var stat = fs$3.lstatSync(base);
  20832. if (!stat.isSymbolicLink()) {
  20833. knownHard[base] = true;
  20834. if (cache) cache[base] = base;
  20835. continue;
  20836. }
  20837. // read the link if it wasn't read before
  20838. // dev/ino always return 0 on windows, so skip the check.
  20839. var linkTarget = null;
  20840. if (!isWindows) {
  20841. var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
  20842. if (seenLinks.hasOwnProperty(id)) {
  20843. linkTarget = seenLinks[id];
  20844. }
  20845. }
  20846. if (linkTarget === null) {
  20847. fs$3.statSync(base);
  20848. linkTarget = fs$3.readlinkSync(base);
  20849. }
  20850. resolvedLink = path$5.resolve(previous, linkTarget);
  20851. // track this, if given a cache.
  20852. if (cache) cache[base] = resolvedLink;
  20853. if (!isWindows) seenLinks[id] = linkTarget;
  20854. }
  20855. // resolve the link, then start over
  20856. p = path$5.resolve(resolvedLink, p.slice(pos));
  20857. start();
  20858. }
  20859. if (cache) cache[original] = p;
  20860. return p;
  20861. };
  20862. var realpath$2 = function realpath(p, cache, cb) {
  20863. if (typeof cb !== 'function') {
  20864. cb = maybeCallback(cache);
  20865. cache = null;
  20866. }
  20867. // make p is absolute
  20868. p = path$5.resolve(p);
  20869. if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
  20870. return process.nextTick(cb.bind(null, null, cache[p]));
  20871. }
  20872. var original = p,
  20873. seenLinks = {},
  20874. knownHard = {};
  20875. // current character position in p
  20876. var pos;
  20877. // the partial path so far, including a trailing slash if any
  20878. var current;
  20879. // the partial path without a trailing slash (except when pointing at a root)
  20880. var base;
  20881. // the partial path scanned in the previous round, with slash
  20882. var previous;
  20883. start();
  20884. function start() {
  20885. // Skip over roots
  20886. var m = splitRootRe.exec(p);
  20887. pos = m[0].length;
  20888. current = m[0];
  20889. base = m[0];
  20890. previous = '';
  20891. // On windows, check that the root exists. On unix there is no need.
  20892. if (isWindows && !knownHard[base]) {
  20893. fs$3.lstat(base, function(err) {
  20894. if (err) return cb(err);
  20895. knownHard[base] = true;
  20896. LOOP();
  20897. });
  20898. } else {
  20899. process.nextTick(LOOP);
  20900. }
  20901. }
  20902. // walk down the path, swapping out linked pathparts for their real
  20903. // values
  20904. function LOOP() {
  20905. // stop if scanned past end of path
  20906. if (pos >= p.length) {
  20907. if (cache) cache[original] = p;
  20908. return cb(null, p);
  20909. }
  20910. // find the next part
  20911. nextPartRe.lastIndex = pos;
  20912. var result = nextPartRe.exec(p);
  20913. previous = current;
  20914. current += result[0];
  20915. base = previous + result[1];
  20916. pos = nextPartRe.lastIndex;
  20917. // continue if not a symlink
  20918. if (knownHard[base] || (cache && cache[base] === base)) {
  20919. return process.nextTick(LOOP);
  20920. }
  20921. if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
  20922. // known symbolic link. no need to stat again.
  20923. return gotResolvedLink(cache[base]);
  20924. }
  20925. return fs$3.lstat(base, gotStat);
  20926. }
  20927. function gotStat(err, stat) {
  20928. if (err) return cb(err);
  20929. // if not a symlink, skip to the next path part
  20930. if (!stat.isSymbolicLink()) {
  20931. knownHard[base] = true;
  20932. if (cache) cache[base] = base;
  20933. return process.nextTick(LOOP);
  20934. }
  20935. // stat & read the link if not read before
  20936. // call gotTarget as soon as the link target is known
  20937. // dev/ino always return 0 on windows, so skip the check.
  20938. if (!isWindows) {
  20939. var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
  20940. if (seenLinks.hasOwnProperty(id)) {
  20941. return gotTarget(null, seenLinks[id], base);
  20942. }
  20943. }
  20944. fs$3.stat(base, function(err) {
  20945. if (err) return cb(err);
  20946. fs$3.readlink(base, function(err, target) {
  20947. if (!isWindows) seenLinks[id] = target;
  20948. gotTarget(err, target);
  20949. });
  20950. });
  20951. }
  20952. function gotTarget(err, target, base) {
  20953. if (err) return cb(err);
  20954. var resolvedLink = path$5.resolve(previous, target);
  20955. if (cache) cache[base] = resolvedLink;
  20956. gotResolvedLink(resolvedLink);
  20957. }
  20958. function gotResolvedLink(resolvedLink) {
  20959. // resolve the link, then start over
  20960. p = path$5.resolve(resolvedLink, p.slice(pos));
  20961. start();
  20962. }
  20963. };
  20964. var old = {
  20965. realpathSync: realpathSync$1,
  20966. realpath: realpath$2
  20967. };
  20968. var fs_realpath = realpath$1;
  20969. realpath$1.realpath = realpath$1;
  20970. realpath$1.sync = realpathSync;
  20971. realpath$1.realpathSync = realpathSync;
  20972. realpath$1.monkeypatch = monkeypatch;
  20973. realpath$1.unmonkeypatch = unmonkeypatch;
  20974. var origRealpath = fs$3.realpath;
  20975. var origRealpathSync = fs$3.realpathSync;
  20976. var version$2 = process.version;
  20977. var ok = /^v[0-5]\./.test(version$2);
  20978. function newError (er) {
  20979. return er && er.syscall === 'realpath' && (
  20980. er.code === 'ELOOP' ||
  20981. er.code === 'ENOMEM' ||
  20982. er.code === 'ENAMETOOLONG'
  20983. )
  20984. }
  20985. function realpath$1 (p, cache, cb) {
  20986. if (ok) {
  20987. return origRealpath(p, cache, cb)
  20988. }
  20989. if (typeof cache === 'function') {
  20990. cb = cache;
  20991. cache = null;
  20992. }
  20993. origRealpath(p, cache, function (er, result) {
  20994. if (newError(er)) {
  20995. old.realpath(p, cache, cb);
  20996. } else {
  20997. cb(er, result);
  20998. }
  20999. });
  21000. }
  21001. function realpathSync (p, cache) {
  21002. if (ok) {
  21003. return origRealpathSync(p, cache)
  21004. }
  21005. try {
  21006. return origRealpathSync(p, cache)
  21007. } catch (er) {
  21008. if (newError(er)) {
  21009. return old.realpathSync(p, cache)
  21010. } else {
  21011. throw er
  21012. }
  21013. }
  21014. }
  21015. function monkeypatch () {
  21016. fs$3.realpath = realpath$1;
  21017. fs$3.realpathSync = realpathSync;
  21018. }
  21019. function unmonkeypatch () {
  21020. fs$3.realpath = origRealpath;
  21021. fs$3.realpathSync = origRealpathSync;
  21022. }
  21023. var concatMap = function (xs, fn) {
  21024. var res = [];
  21025. for (var i = 0; i < xs.length; i++) {
  21026. var x = fn(xs[i], i);
  21027. if (isArray$4(x)) res.push.apply(res, x);
  21028. else res.push(x);
  21029. }
  21030. return res;
  21031. };
  21032. var isArray$4 = Array.isArray || function (xs) {
  21033. return Object.prototype.toString.call(xs) === '[object Array]';
  21034. };
  21035. var balancedMatch = balanced;
  21036. function balanced(a, b, str) {
  21037. if (a instanceof RegExp) a = maybeMatch(a, str);
  21038. if (b instanceof RegExp) b = maybeMatch(b, str);
  21039. var r = range(a, b, str);
  21040. return r && {
  21041. start: r[0],
  21042. end: r[1],
  21043. pre: str.slice(0, r[0]),
  21044. body: str.slice(r[0] + a.length, r[1]),
  21045. post: str.slice(r[1] + b.length)
  21046. };
  21047. }
  21048. function maybeMatch(reg, str) {
  21049. var m = str.match(reg);
  21050. return m ? m[0] : null;
  21051. }
  21052. balanced.range = range;
  21053. function range(a, b, str) {
  21054. var begs, beg, left, right, result;
  21055. var ai = str.indexOf(a);
  21056. var bi = str.indexOf(b, ai + 1);
  21057. var i = ai;
  21058. if (ai >= 0 && bi > 0) {
  21059. begs = [];
  21060. left = str.length;
  21061. while (i >= 0 && !result) {
  21062. if (i == ai) {
  21063. begs.push(i);
  21064. ai = str.indexOf(a, i + 1);
  21065. } else if (begs.length == 1) {
  21066. result = [ begs.pop(), bi ];
  21067. } else {
  21068. beg = begs.pop();
  21069. if (beg < left) {
  21070. left = beg;
  21071. right = bi;
  21072. }
  21073. bi = str.indexOf(b, i + 1);
  21074. }
  21075. i = ai < bi && ai >= 0 ? ai : bi;
  21076. }
  21077. if (begs.length) {
  21078. result = [ left, right ];
  21079. }
  21080. }
  21081. return result;
  21082. }
  21083. var braceExpansion = expandTop;
  21084. var escSlash = '\0SLASH'+Math.random()+'\0';
  21085. var escOpen = '\0OPEN'+Math.random()+'\0';
  21086. var escClose = '\0CLOSE'+Math.random()+'\0';
  21087. var escComma = '\0COMMA'+Math.random()+'\0';
  21088. var escPeriod = '\0PERIOD'+Math.random()+'\0';
  21089. function numeric(str) {
  21090. return parseInt(str, 10) == str
  21091. ? parseInt(str, 10)
  21092. : str.charCodeAt(0);
  21093. }
  21094. function escapeBraces(str) {
  21095. return str.split('\\\\').join(escSlash)
  21096. .split('\\{').join(escOpen)
  21097. .split('\\}').join(escClose)
  21098. .split('\\,').join(escComma)
  21099. .split('\\.').join(escPeriod);
  21100. }
  21101. function unescapeBraces(str) {
  21102. return str.split(escSlash).join('\\')
  21103. .split(escOpen).join('{')
  21104. .split(escClose).join('}')
  21105. .split(escComma).join(',')
  21106. .split(escPeriod).join('.');
  21107. }
  21108. // Basically just str.split(","), but handling cases
  21109. // where we have nested braced sections, which should be
  21110. // treated as individual members, like {a,{b,c},d}
  21111. function parseCommaParts(str) {
  21112. if (!str)
  21113. return [''];
  21114. var parts = [];
  21115. var m = balancedMatch('{', '}', str);
  21116. if (!m)
  21117. return str.split(',');
  21118. var pre = m.pre;
  21119. var body = m.body;
  21120. var post = m.post;
  21121. var p = pre.split(',');
  21122. p[p.length-1] += '{' + body + '}';
  21123. var postParts = parseCommaParts(post);
  21124. if (post.length) {
  21125. p[p.length-1] += postParts.shift();
  21126. p.push.apply(p, postParts);
  21127. }
  21128. parts.push.apply(parts, p);
  21129. return parts;
  21130. }
  21131. function expandTop(str) {
  21132. if (!str)
  21133. return [];
  21134. // I don't know why Bash 4.3 does this, but it does.
  21135. // Anything starting with {} will have the first two bytes preserved
  21136. // but *only* at the top level, so {},a}b will not expand to anything,
  21137. // but a{},b}c will be expanded to [a}c,abc].
  21138. // One could argue that this is a bug in Bash, but since the goal of
  21139. // this module is to match Bash's rules, we escape a leading {}
  21140. if (str.substr(0, 2) === '{}') {
  21141. str = '\\{\\}' + str.substr(2);
  21142. }
  21143. return expand(escapeBraces(str), true).map(unescapeBraces);
  21144. }
  21145. function embrace(str) {
  21146. return '{' + str + '}';
  21147. }
  21148. function isPadded(el) {
  21149. return /^-?0\d/.test(el);
  21150. }
  21151. function lte(i, y) {
  21152. return i <= y;
  21153. }
  21154. function gte(i, y) {
  21155. return i >= y;
  21156. }
  21157. function expand(str, isTop) {
  21158. var expansions = [];
  21159. var m = balancedMatch('{', '}', str);
  21160. if (!m || /\$$/.test(m.pre)) return [str];
  21161. var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
  21162. var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
  21163. var isSequence = isNumericSequence || isAlphaSequence;
  21164. var isOptions = m.body.indexOf(',') >= 0;
  21165. if (!isSequence && !isOptions) {
  21166. // {a},b}
  21167. if (m.post.match(/,.*\}/)) {
  21168. str = m.pre + '{' + m.body + escClose + m.post;
  21169. return expand(str);
  21170. }
  21171. return [str];
  21172. }
  21173. var n;
  21174. if (isSequence) {
  21175. n = m.body.split(/\.\./);
  21176. } else {
  21177. n = parseCommaParts(m.body);
  21178. if (n.length === 1) {
  21179. // x{{a,b}}y ==> x{a}y x{b}y
  21180. n = expand(n[0], false).map(embrace);
  21181. if (n.length === 1) {
  21182. var post = m.post.length
  21183. ? expand(m.post, false)
  21184. : [''];
  21185. return post.map(function(p) {
  21186. return m.pre + n[0] + p;
  21187. });
  21188. }
  21189. }
  21190. }
  21191. // at this point, n is the parts, and we know it's not a comma set
  21192. // with a single entry.
  21193. // no need to expand pre, since it is guaranteed to be free of brace-sets
  21194. var pre = m.pre;
  21195. var post = m.post.length
  21196. ? expand(m.post, false)
  21197. : [''];
  21198. var N;
  21199. if (isSequence) {
  21200. var x = numeric(n[0]);
  21201. var y = numeric(n[1]);
  21202. var width = Math.max(n[0].length, n[1].length);
  21203. var incr = n.length == 3
  21204. ? Math.abs(numeric(n[2]))
  21205. : 1;
  21206. var test = lte;
  21207. var reverse = y < x;
  21208. if (reverse) {
  21209. incr *= -1;
  21210. test = gte;
  21211. }
  21212. var pad = n.some(isPadded);
  21213. N = [];
  21214. for (var i = x; test(i, y); i += incr) {
  21215. var c;
  21216. if (isAlphaSequence) {
  21217. c = String.fromCharCode(i);
  21218. if (c === '\\')
  21219. c = '';
  21220. } else {
  21221. c = String(i);
  21222. if (pad) {
  21223. var need = width - c.length;
  21224. if (need > 0) {
  21225. var z = new Array(need + 1).join('0');
  21226. if (i < 0)
  21227. c = '-' + z + c.slice(1);
  21228. else
  21229. c = z + c;
  21230. }
  21231. }
  21232. }
  21233. N.push(c);
  21234. }
  21235. } else {
  21236. N = concatMap(n, function(el) { return expand(el, false) });
  21237. }
  21238. for (var j = 0; j < N.length; j++) {
  21239. for (var k = 0; k < post.length; k++) {
  21240. var expansion = pre + N[j] + post[k];
  21241. if (!isTop || isSequence || expansion)
  21242. expansions.push(expansion);
  21243. }
  21244. }
  21245. return expansions;
  21246. }
  21247. var minimatch_1 = minimatch;
  21248. minimatch.Minimatch = Minimatch$1;
  21249. var path = (function () { try { return path$5 } catch (e) {}}()) || {
  21250. sep: '/'
  21251. };
  21252. minimatch.sep = path.sep;
  21253. var GLOBSTAR = minimatch.GLOBSTAR = Minimatch$1.GLOBSTAR = {};
  21254. var plTypes = {
  21255. '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
  21256. '?': { open: '(?:', close: ')?' },
  21257. '+': { open: '(?:', close: ')+' },
  21258. '*': { open: '(?:', close: ')*' },
  21259. '@': { open: '(?:', close: ')' }
  21260. };
  21261. // any single thing other than /
  21262. // don't need to escape / when using new RegExp()
  21263. var qmark = '[^/]';
  21264. // * => any number of characters
  21265. var star = qmark + '*?';
  21266. // ** when dots are allowed. Anything goes, except .. and .
  21267. // not (^ or / followed by one or two dots followed by $ or /),
  21268. // followed by anything, any number of times.
  21269. var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?';
  21270. // not a ^ or / followed by a dot,
  21271. // followed by anything, any number of times.
  21272. var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?';
  21273. // characters that need to be escaped in RegExp.
  21274. var reSpecials = charSet('().*{}+?[]^$\\!');
  21275. // "abc" -> { a:true, b:true, c:true }
  21276. function charSet (s) {
  21277. return s.split('').reduce(function (set, c) {
  21278. set[c] = true;
  21279. return set
  21280. }, {})
  21281. }
  21282. // normalizes slashes.
  21283. var slashSplit = /\/+/;
  21284. minimatch.filter = filter;
  21285. function filter (pattern, options) {
  21286. options = options || {};
  21287. return function (p, i, list) {
  21288. return minimatch(p, pattern, options)
  21289. }
  21290. }
  21291. function ext (a, b) {
  21292. b = b || {};
  21293. var t = {};
  21294. Object.keys(a).forEach(function (k) {
  21295. t[k] = a[k];
  21296. });
  21297. Object.keys(b).forEach(function (k) {
  21298. t[k] = b[k];
  21299. });
  21300. return t
  21301. }
  21302. minimatch.defaults = function (def) {
  21303. if (!def || typeof def !== 'object' || !Object.keys(def).length) {
  21304. return minimatch
  21305. }
  21306. var orig = minimatch;
  21307. var m = function minimatch (p, pattern, options) {
  21308. return orig(p, pattern, ext(def, options))
  21309. };
  21310. m.Minimatch = function Minimatch (pattern, options) {
  21311. return new orig.Minimatch(pattern, ext(def, options))
  21312. };
  21313. m.Minimatch.defaults = function defaults (options) {
  21314. return orig.defaults(ext(def, options)).Minimatch
  21315. };
  21316. m.filter = function filter (pattern, options) {
  21317. return orig.filter(pattern, ext(def, options))
  21318. };
  21319. m.defaults = function defaults (options) {
  21320. return orig.defaults(ext(def, options))
  21321. };
  21322. m.makeRe = function makeRe (pattern, options) {
  21323. return orig.makeRe(pattern, ext(def, options))
  21324. };
  21325. m.braceExpand = function braceExpand (pattern, options) {
  21326. return orig.braceExpand(pattern, ext(def, options))
  21327. };
  21328. m.match = function (list, pattern, options) {
  21329. return orig.match(list, pattern, ext(def, options))
  21330. };
  21331. return m
  21332. };
  21333. Minimatch$1.defaults = function (def) {
  21334. return minimatch.defaults(def).Minimatch
  21335. };
  21336. function minimatch (p, pattern, options) {
  21337. assertValidPattern(pattern);
  21338. if (!options) options = {};
  21339. // shortcut: comments match nothing.
  21340. if (!options.nocomment && pattern.charAt(0) === '#') {
  21341. return false
  21342. }
  21343. return new Minimatch$1(pattern, options).match(p)
  21344. }
  21345. function Minimatch$1 (pattern, options) {
  21346. if (!(this instanceof Minimatch$1)) {
  21347. return new Minimatch$1(pattern, options)
  21348. }
  21349. assertValidPattern(pattern);
  21350. if (!options) options = {};
  21351. pattern = pattern.trim();
  21352. // windows support: need to use /, not \
  21353. if (!options.allowWindowsEscape && path.sep !== '/') {
  21354. pattern = pattern.split(path.sep).join('/');
  21355. }
  21356. this.options = options;
  21357. this.set = [];
  21358. this.pattern = pattern;
  21359. this.regexp = null;
  21360. this.negate = false;
  21361. this.comment = false;
  21362. this.empty = false;
  21363. this.partial = !!options.partial;
  21364. // make the set of regexps etc.
  21365. this.make();
  21366. }
  21367. Minimatch$1.prototype.debug = function () {};
  21368. Minimatch$1.prototype.make = make;
  21369. function make () {
  21370. var pattern = this.pattern;
  21371. var options = this.options;
  21372. // empty patterns and comments match nothing.
  21373. if (!options.nocomment && pattern.charAt(0) === '#') {
  21374. this.comment = true;
  21375. return
  21376. }
  21377. if (!pattern) {
  21378. this.empty = true;
  21379. return
  21380. }
  21381. // step 1: figure out negation, etc.
  21382. this.parseNegate();
  21383. // step 2: expand braces
  21384. var set = this.globSet = this.braceExpand();
  21385. if (options.debug) this.debug = function debug() { console.error.apply(console, arguments); };
  21386. this.debug(this.pattern, set);
  21387. // step 3: now we have a set, so turn each one into a series of path-portion
  21388. // matching patterns.
  21389. // These will be regexps, except in the case of "**", which is
  21390. // set to the GLOBSTAR object for globstar behavior,
  21391. // and will not contain any / characters
  21392. set = this.globParts = set.map(function (s) {
  21393. return s.split(slashSplit)
  21394. });
  21395. this.debug(this.pattern, set);
  21396. // glob --> regexps
  21397. set = set.map(function (s, si, set) {
  21398. return s.map(this.parse, this)
  21399. }, this);
  21400. this.debug(this.pattern, set);
  21401. // filter out everything that didn't compile properly.
  21402. set = set.filter(function (s) {
  21403. return s.indexOf(false) === -1
  21404. });
  21405. this.debug(this.pattern, set);
  21406. this.set = set;
  21407. }
  21408. Minimatch$1.prototype.parseNegate = parseNegate;
  21409. function parseNegate () {
  21410. var pattern = this.pattern;
  21411. var negate = false;
  21412. var options = this.options;
  21413. var negateOffset = 0;
  21414. if (options.nonegate) return
  21415. for (var i = 0, l = pattern.length
  21416. ; i < l && pattern.charAt(i) === '!'
  21417. ; i++) {
  21418. negate = !negate;
  21419. negateOffset++;
  21420. }
  21421. if (negateOffset) this.pattern = pattern.substr(negateOffset);
  21422. this.negate = negate;
  21423. }
  21424. // Brace expansion:
  21425. // a{b,c}d -> abd acd
  21426. // a{b,}c -> abc ac
  21427. // a{0..3}d -> a0d a1d a2d a3d
  21428. // a{b,c{d,e}f}g -> abg acdfg acefg
  21429. // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
  21430. //
  21431. // Invalid sets are not expanded.
  21432. // a{2..}b -> a{2..}b
  21433. // a{b}c -> a{b}c
  21434. minimatch.braceExpand = function (pattern, options) {
  21435. return braceExpand(pattern, options)
  21436. };
  21437. Minimatch$1.prototype.braceExpand = braceExpand;
  21438. function braceExpand (pattern, options) {
  21439. if (!options) {
  21440. if (this instanceof Minimatch$1) {
  21441. options = this.options;
  21442. } else {
  21443. options = {};
  21444. }
  21445. }
  21446. pattern = typeof pattern === 'undefined'
  21447. ? this.pattern : pattern;
  21448. assertValidPattern(pattern);
  21449. // Thanks to Yeting Li <https://github.com/yetingli> for
  21450. // improving this regexp to avoid a ReDOS vulnerability.
  21451. if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
  21452. // shortcut. no need to expand.
  21453. return [pattern]
  21454. }
  21455. return braceExpansion(pattern)
  21456. }
  21457. var MAX_PATTERN_LENGTH = 1024 * 64;
  21458. var assertValidPattern = function (pattern) {
  21459. if (typeof pattern !== 'string') {
  21460. throw new TypeError('invalid pattern')
  21461. }
  21462. if (pattern.length > MAX_PATTERN_LENGTH) {
  21463. throw new TypeError('pattern is too long')
  21464. }
  21465. };
  21466. // parse a component of the expanded set.
  21467. // At this point, no pattern may contain "/" in it
  21468. // so we're going to return a 2d array, where each entry is the full
  21469. // pattern, split on '/', and then turned into a regular expression.
  21470. // A regexp is made at the end which joins each array with an
  21471. // escaped /, and another full one which joins each regexp with |.
  21472. //
  21473. // Following the lead of Bash 4.1, note that "**" only has special meaning
  21474. // when it is the *only* thing in a path portion. Otherwise, any series
  21475. // of * is equivalent to a single *. Globstar behavior is enabled by
  21476. // default, and can be disabled by setting options.noglobstar.
  21477. Minimatch$1.prototype.parse = parse$2;
  21478. var SUBPARSE = {};
  21479. function parse$2 (pattern, isSub) {
  21480. assertValidPattern(pattern);
  21481. var options = this.options;
  21482. // shortcuts
  21483. if (pattern === '**') {
  21484. if (!options.noglobstar)
  21485. return GLOBSTAR
  21486. else
  21487. pattern = '*';
  21488. }
  21489. if (pattern === '') return ''
  21490. var re = '';
  21491. var hasMagic = !!options.nocase;
  21492. var escaping = false;
  21493. // ? => one single character
  21494. var patternListStack = [];
  21495. var negativeLists = [];
  21496. var stateChar;
  21497. var inClass = false;
  21498. var reClassStart = -1;
  21499. var classStart = -1;
  21500. // . and .. never match anything that doesn't start with .,
  21501. // even when options.dot is set.
  21502. var patternStart = pattern.charAt(0) === '.' ? '' // anything
  21503. // not (start or / followed by . or .. followed by / or end)
  21504. : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
  21505. : '(?!\\.)';
  21506. var self = this;
  21507. function clearStateChar () {
  21508. if (stateChar) {
  21509. // we had some state-tracking character
  21510. // that wasn't consumed by this pass.
  21511. switch (stateChar) {
  21512. case '*':
  21513. re += star;
  21514. hasMagic = true;
  21515. break
  21516. case '?':
  21517. re += qmark;
  21518. hasMagic = true;
  21519. break
  21520. default:
  21521. re += '\\' + stateChar;
  21522. break
  21523. }
  21524. self.debug('clearStateChar %j %j', stateChar, re);
  21525. stateChar = false;
  21526. }
  21527. }
  21528. for (var i = 0, len = pattern.length, c
  21529. ; (i < len) && (c = pattern.charAt(i))
  21530. ; i++) {
  21531. this.debug('%s\t%s %s %j', pattern, i, re, c);
  21532. // skip over any that are escaped.
  21533. if (escaping && reSpecials[c]) {
  21534. re += '\\' + c;
  21535. escaping = false;
  21536. continue
  21537. }
  21538. switch (c) {
  21539. /* istanbul ignore next */
  21540. case '/': {
  21541. // completely not allowed, even escaped.
  21542. // Should already be path-split by now.
  21543. return false
  21544. }
  21545. case '\\':
  21546. clearStateChar();
  21547. escaping = true;
  21548. continue
  21549. // the various stateChar values
  21550. // for the "extglob" stuff.
  21551. case '?':
  21552. case '*':
  21553. case '+':
  21554. case '@':
  21555. case '!':
  21556. this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c);
  21557. // all of those are literals inside a class, except that
  21558. // the glob [!a] means [^a] in regexp
  21559. if (inClass) {
  21560. this.debug(' in class');
  21561. if (c === '!' && i === classStart + 1) c = '^';
  21562. re += c;
  21563. continue
  21564. }
  21565. // if we already have a stateChar, then it means
  21566. // that there was something like ** or +? in there.
  21567. // Handle the stateChar, then proceed with this one.
  21568. self.debug('call clearStateChar %j', stateChar);
  21569. clearStateChar();
  21570. stateChar = c;
  21571. // if extglob is disabled, then +(asdf|foo) isn't a thing.
  21572. // just clear the statechar *now*, rather than even diving into
  21573. // the patternList stuff.
  21574. if (options.noext) clearStateChar();
  21575. continue
  21576. case '(':
  21577. if (inClass) {
  21578. re += '(';
  21579. continue
  21580. }
  21581. if (!stateChar) {
  21582. re += '\\(';
  21583. continue
  21584. }
  21585. patternListStack.push({
  21586. type: stateChar,
  21587. start: i - 1,
  21588. reStart: re.length,
  21589. open: plTypes[stateChar].open,
  21590. close: plTypes[stateChar].close
  21591. });
  21592. // negation is (?:(?!js)[^/]*)
  21593. re += stateChar === '!' ? '(?:(?!(?:' : '(?:';
  21594. this.debug('plType %j %j', stateChar, re);
  21595. stateChar = false;
  21596. continue
  21597. case ')':
  21598. if (inClass || !patternListStack.length) {
  21599. re += '\\)';
  21600. continue
  21601. }
  21602. clearStateChar();
  21603. hasMagic = true;
  21604. var pl = patternListStack.pop();
  21605. // negation is (?:(?!js)[^/]*)
  21606. // The others are (?:<pattern>)<type>
  21607. re += pl.close;
  21608. if (pl.type === '!') {
  21609. negativeLists.push(pl);
  21610. }
  21611. pl.reEnd = re.length;
  21612. continue
  21613. case '|':
  21614. if (inClass || !patternListStack.length || escaping) {
  21615. re += '\\|';
  21616. escaping = false;
  21617. continue
  21618. }
  21619. clearStateChar();
  21620. re += '|';
  21621. continue
  21622. // these are mostly the same in regexp and glob
  21623. case '[':
  21624. // swallow any state-tracking char before the [
  21625. clearStateChar();
  21626. if (inClass) {
  21627. re += '\\' + c;
  21628. continue
  21629. }
  21630. inClass = true;
  21631. classStart = i;
  21632. reClassStart = re.length;
  21633. re += c;
  21634. continue
  21635. case ']':
  21636. // a right bracket shall lose its special
  21637. // meaning and represent itself in
  21638. // a bracket expression if it occurs
  21639. // first in the list. -- POSIX.2 2.8.3.2
  21640. if (i === classStart + 1 || !inClass) {
  21641. re += '\\' + c;
  21642. escaping = false;
  21643. continue
  21644. }
  21645. // handle the case where we left a class open.
  21646. // "[z-a]" is valid, equivalent to "\[z-a\]"
  21647. // split where the last [ was, make sure we don't have
  21648. // an invalid re. if so, re-walk the contents of the
  21649. // would-be class to re-translate any characters that
  21650. // were passed through as-is
  21651. // TODO: It would probably be faster to determine this
  21652. // without a try/catch and a new RegExp, but it's tricky
  21653. // to do safely. For now, this is safe and works.
  21654. var cs = pattern.substring(classStart + 1, i);
  21655. try {
  21656. RegExp('[' + cs + ']');
  21657. } catch (er) {
  21658. // not a valid class!
  21659. var sp = this.parse(cs, SUBPARSE);
  21660. re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]';
  21661. hasMagic = hasMagic || sp[1];
  21662. inClass = false;
  21663. continue
  21664. }
  21665. // finish up the class.
  21666. hasMagic = true;
  21667. inClass = false;
  21668. re += c;
  21669. continue
  21670. default:
  21671. // swallow any state char that wasn't consumed
  21672. clearStateChar();
  21673. if (escaping) {
  21674. // no need
  21675. escaping = false;
  21676. } else if (reSpecials[c]
  21677. && !(c === '^' && inClass)) {
  21678. re += '\\';
  21679. }
  21680. re += c;
  21681. } // switch
  21682. } // for
  21683. // handle the case where we left a class open.
  21684. // "[abc" is valid, equivalent to "\[abc"
  21685. if (inClass) {
  21686. // split where the last [ was, and escape it
  21687. // this is a huge pita. We now have to re-walk
  21688. // the contents of the would-be class to re-translate
  21689. // any characters that were passed through as-is
  21690. cs = pattern.substr(classStart + 1);
  21691. sp = this.parse(cs, SUBPARSE);
  21692. re = re.substr(0, reClassStart) + '\\[' + sp[0];
  21693. hasMagic = hasMagic || sp[1];
  21694. }
  21695. // handle the case where we had a +( thing at the *end*
  21696. // of the pattern.
  21697. // each pattern list stack adds 3 chars, and we need to go through
  21698. // and escape any | chars that were passed through as-is for the regexp.
  21699. // Go through and escape them, taking care not to double-escape any
  21700. // | chars that were already escaped.
  21701. for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
  21702. var tail = re.slice(pl.reStart + pl.open.length);
  21703. this.debug('setting tail', re, pl);
  21704. // maybe some even number of \, then maybe 1 \, followed by a |
  21705. tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
  21706. if (!$2) {
  21707. // the | isn't already escaped, so escape it.
  21708. $2 = '\\';
  21709. }
  21710. // need to escape all those slashes *again*, without escaping the
  21711. // one that we need for escaping the | character. As it works out,
  21712. // escaping an even number of slashes can be done by simply repeating
  21713. // it exactly after itself. That's why this trick works.
  21714. //
  21715. // I am sorry that you have to see this.
  21716. return $1 + $1 + $2 + '|'
  21717. });
  21718. this.debug('tail=%j\n %s', tail, tail, pl, re);
  21719. var t = pl.type === '*' ? star
  21720. : pl.type === '?' ? qmark
  21721. : '\\' + pl.type;
  21722. hasMagic = true;
  21723. re = re.slice(0, pl.reStart) + t + '\\(' + tail;
  21724. }
  21725. // handle trailing things that only matter at the very end.
  21726. clearStateChar();
  21727. if (escaping) {
  21728. // trailing \\
  21729. re += '\\\\';
  21730. }
  21731. // only need to apply the nodot start if the re starts with
  21732. // something that could conceivably capture a dot
  21733. var addPatternStart = false;
  21734. switch (re.charAt(0)) {
  21735. case '[': case '.': case '(': addPatternStart = true;
  21736. }
  21737. // Hack to work around lack of negative lookbehind in JS
  21738. // A pattern like: *.!(x).!(y|z) needs to ensure that a name
  21739. // like 'a.xyz.yz' doesn't match. So, the first negative
  21740. // lookahead, has to look ALL the way ahead, to the end of
  21741. // the pattern.
  21742. for (var n = negativeLists.length - 1; n > -1; n--) {
  21743. var nl = negativeLists[n];
  21744. var nlBefore = re.slice(0, nl.reStart);
  21745. var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
  21746. var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
  21747. var nlAfter = re.slice(nl.reEnd);
  21748. nlLast += nlAfter;
  21749. // Handle nested stuff like *(*.js|!(*.json)), where open parens
  21750. // mean that we should *not* include the ) in the bit that is considered
  21751. // "after" the negated section.
  21752. var openParensBefore = nlBefore.split('(').length - 1;
  21753. var cleanAfter = nlAfter;
  21754. for (i = 0; i < openParensBefore; i++) {
  21755. cleanAfter = cleanAfter.replace(/\)[+*?]?/, '');
  21756. }
  21757. nlAfter = cleanAfter;
  21758. var dollar = '';
  21759. if (nlAfter === '' && isSub !== SUBPARSE) {
  21760. dollar = '$';
  21761. }
  21762. var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
  21763. re = newRe;
  21764. }
  21765. // if the re is not "" at this point, then we need to make sure
  21766. // it doesn't match against an empty path part.
  21767. // Otherwise a/* will match a/, which it should not.
  21768. if (re !== '' && hasMagic) {
  21769. re = '(?=.)' + re;
  21770. }
  21771. if (addPatternStart) {
  21772. re = patternStart + re;
  21773. }
  21774. // parsing just a piece of a larger pattern.
  21775. if (isSub === SUBPARSE) {
  21776. return [re, hasMagic]
  21777. }
  21778. // skip the regexp for non-magical patterns
  21779. // unescape anything in it, though, so that it'll be
  21780. // an exact match against a file etc.
  21781. if (!hasMagic) {
  21782. return globUnescape(pattern)
  21783. }
  21784. var flags = options.nocase ? 'i' : '';
  21785. try {
  21786. var regExp = new RegExp('^' + re + '$', flags);
  21787. } catch (er) /* istanbul ignore next - should be impossible */ {
  21788. // If it was an invalid regular expression, then it can't match
  21789. // anything. This trick looks for a character after the end of
  21790. // the string, which is of course impossible, except in multi-line
  21791. // mode, but it's not a /m regex.
  21792. return new RegExp('$.')
  21793. }
  21794. regExp._glob = pattern;
  21795. regExp._src = re;
  21796. return regExp
  21797. }
  21798. minimatch.makeRe = function (pattern, options) {
  21799. return new Minimatch$1(pattern, options || {}).makeRe()
  21800. };
  21801. Minimatch$1.prototype.makeRe = makeRe;
  21802. function makeRe () {
  21803. if (this.regexp || this.regexp === false) return this.regexp
  21804. // at this point, this.set is a 2d array of partial
  21805. // pattern strings, or "**".
  21806. //
  21807. // It's better to use .match(). This function shouldn't
  21808. // be used, really, but it's pretty convenient sometimes,
  21809. // when you just want to work with a regex.
  21810. var set = this.set;
  21811. if (!set.length) {
  21812. this.regexp = false;
  21813. return this.regexp
  21814. }
  21815. var options = this.options;
  21816. var twoStar = options.noglobstar ? star
  21817. : options.dot ? twoStarDot
  21818. : twoStarNoDot;
  21819. var flags = options.nocase ? 'i' : '';
  21820. var re = set.map(function (pattern) {
  21821. return pattern.map(function (p) {
  21822. return (p === GLOBSTAR) ? twoStar
  21823. : (typeof p === 'string') ? regExpEscape(p)
  21824. : p._src
  21825. }).join('\\\/')
  21826. }).join('|');
  21827. // must match entire pattern
  21828. // ending in a * or ** will make it less strict.
  21829. re = '^(?:' + re + ')$';
  21830. // can match anything, as long as it's not this.
  21831. if (this.negate) re = '^(?!' + re + ').*$';
  21832. try {
  21833. this.regexp = new RegExp(re, flags);
  21834. } catch (ex) /* istanbul ignore next - should be impossible */ {
  21835. this.regexp = false;
  21836. }
  21837. return this.regexp
  21838. }
  21839. minimatch.match = function (list, pattern, options) {
  21840. options = options || {};
  21841. var mm = new Minimatch$1(pattern, options);
  21842. list = list.filter(function (f) {
  21843. return mm.match(f)
  21844. });
  21845. if (mm.options.nonull && !list.length) {
  21846. list.push(pattern);
  21847. }
  21848. return list
  21849. };
  21850. Minimatch$1.prototype.match = function match (f, partial) {
  21851. if (typeof partial === 'undefined') partial = this.partial;
  21852. this.debug('match', f, this.pattern);
  21853. // short-circuit in the case of busted things.
  21854. // comments, etc.
  21855. if (this.comment) return false
  21856. if (this.empty) return f === ''
  21857. if (f === '/' && partial) return true
  21858. var options = this.options;
  21859. // windows: need to use /, not \
  21860. if (path.sep !== '/') {
  21861. f = f.split(path.sep).join('/');
  21862. }
  21863. // treat the test path as a set of pathparts.
  21864. f = f.split(slashSplit);
  21865. this.debug(this.pattern, 'split', f);
  21866. // just ONE of the pattern sets in this.set needs to match
  21867. // in order for it to be valid. If negating, then just one
  21868. // match means that we have failed.
  21869. // Either way, return on the first hit.
  21870. var set = this.set;
  21871. this.debug(this.pattern, 'set', set);
  21872. // Find the basename of the path by looking for the last non-empty segment
  21873. var filename;
  21874. var i;
  21875. for (i = f.length - 1; i >= 0; i--) {
  21876. filename = f[i];
  21877. if (filename) break
  21878. }
  21879. for (i = 0; i < set.length; i++) {
  21880. var pattern = set[i];
  21881. var file = f;
  21882. if (options.matchBase && pattern.length === 1) {
  21883. file = [filename];
  21884. }
  21885. var hit = this.matchOne(file, pattern, partial);
  21886. if (hit) {
  21887. if (options.flipNegate) return true
  21888. return !this.negate
  21889. }
  21890. }
  21891. // didn't get any hits. this is success if it's a negative
  21892. // pattern, failure otherwise.
  21893. if (options.flipNegate) return false
  21894. return this.negate
  21895. };
  21896. // set partial to true to test if, for example,
  21897. // "/a/b" matches the start of "/*/b/*/d"
  21898. // Partial means, if you run out of file before you run
  21899. // out of pattern, then that's fine, as long as all
  21900. // the parts match.
  21901. Minimatch$1.prototype.matchOne = function (file, pattern, partial) {
  21902. var options = this.options;
  21903. this.debug('matchOne',
  21904. { 'this': this, file: file, pattern: pattern });
  21905. this.debug('matchOne', file.length, pattern.length);
  21906. for (var fi = 0,
  21907. pi = 0,
  21908. fl = file.length,
  21909. pl = pattern.length
  21910. ; (fi < fl) && (pi < pl)
  21911. ; fi++, pi++) {
  21912. this.debug('matchOne loop');
  21913. var p = pattern[pi];
  21914. var f = file[fi];
  21915. this.debug(pattern, p, f);
  21916. // should be impossible.
  21917. // some invalid regexp stuff in the set.
  21918. /* istanbul ignore if */
  21919. if (p === false) return false
  21920. if (p === GLOBSTAR) {
  21921. this.debug('GLOBSTAR', [pattern, p, f]);
  21922. // "**"
  21923. // a/**/b/**/c would match the following:
  21924. // a/b/x/y/z/c
  21925. // a/x/y/z/b/c
  21926. // a/b/x/b/x/c
  21927. // a/b/c
  21928. // To do this, take the rest of the pattern after
  21929. // the **, and see if it would match the file remainder.
  21930. // If so, return success.
  21931. // If not, the ** "swallows" a segment, and try again.
  21932. // This is recursively awful.
  21933. //
  21934. // a/**/b/**/c matching a/b/x/y/z/c
  21935. // - a matches a
  21936. // - doublestar
  21937. // - matchOne(b/x/y/z/c, b/**/c)
  21938. // - b matches b
  21939. // - doublestar
  21940. // - matchOne(x/y/z/c, c) -> no
  21941. // - matchOne(y/z/c, c) -> no
  21942. // - matchOne(z/c, c) -> no
  21943. // - matchOne(c, c) yes, hit
  21944. var fr = fi;
  21945. var pr = pi + 1;
  21946. if (pr === pl) {
  21947. this.debug('** at the end');
  21948. // a ** at the end will just swallow the rest.
  21949. // We have found a match.
  21950. // however, it will not swallow /.x, unless
  21951. // options.dot is set.
  21952. // . and .. are *never* matched by **, for explosively
  21953. // exponential reasons.
  21954. for (; fi < fl; fi++) {
  21955. if (file[fi] === '.' || file[fi] === '..' ||
  21956. (!options.dot && file[fi].charAt(0) === '.')) return false
  21957. }
  21958. return true
  21959. }
  21960. // ok, let's see if we can swallow whatever we can.
  21961. while (fr < fl) {
  21962. var swallowee = file[fr];
  21963. this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
  21964. // XXX remove this slice. Just pass the start index.
  21965. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
  21966. this.debug('globstar found match!', fr, fl, swallowee);
  21967. // found a match.
  21968. return true
  21969. } else {
  21970. // can't swallow "." or ".." ever.
  21971. // can only swallow ".foo" when explicitly asked.
  21972. if (swallowee === '.' || swallowee === '..' ||
  21973. (!options.dot && swallowee.charAt(0) === '.')) {
  21974. this.debug('dot detected!', file, fr, pattern, pr);
  21975. break
  21976. }
  21977. // ** swallows a segment, and continue.
  21978. this.debug('globstar swallow a segment, and continue');
  21979. fr++;
  21980. }
  21981. }
  21982. // no match was found.
  21983. // However, in partial mode, we can't say this is necessarily over.
  21984. // If there's more *pattern* left, then
  21985. /* istanbul ignore if */
  21986. if (partial) {
  21987. // ran out of file
  21988. this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
  21989. if (fr === fl) return true
  21990. }
  21991. return false
  21992. }
  21993. // something other than **
  21994. // non-magic patterns just have to match exactly
  21995. // patterns with magic have been turned into regexps.
  21996. var hit;
  21997. if (typeof p === 'string') {
  21998. hit = f === p;
  21999. this.debug('string match', p, f, hit);
  22000. } else {
  22001. hit = f.match(p);
  22002. this.debug('pattern match', p, f, hit);
  22003. }
  22004. if (!hit) return false
  22005. }
  22006. // Note: ending in / means that we'll get a final ""
  22007. // at the end of the pattern. This can only match a
  22008. // corresponding "" at the end of the file.
  22009. // If the file ends in /, then it can only match a
  22010. // a pattern that ends in /, unless the pattern just
  22011. // doesn't have any more for it. But, a/b/ should *not*
  22012. // match "a/b/*", even though "" matches against the
  22013. // [^/]*? pattern, except in partial mode, where it might
  22014. // simply not be reached yet.
  22015. // However, a/b/ should still satisfy a/*
  22016. // now either we fell off the end of the pattern, or we're done.
  22017. if (fi === fl && pi === pl) {
  22018. // ran out of pattern and filename at the same time.
  22019. // an exact hit!
  22020. return true
  22021. } else if (fi === fl) {
  22022. // ran out of file, but still had pattern left.
  22023. // this is ok if we're doing the match as part of
  22024. // a glob fs traversal.
  22025. return partial
  22026. } else /* istanbul ignore else */ if (pi === pl) {
  22027. // ran out of pattern, still have file left.
  22028. // this is only acceptable if we're on the very last
  22029. // empty segment of a file with a trailing slash.
  22030. // a/* should match a/b/
  22031. return (fi === fl - 1) && (file[fi] === '')
  22032. }
  22033. // should be unreachable.
  22034. /* istanbul ignore next */
  22035. throw new Error('wtf?')
  22036. };
  22037. // replace stuff like \* with *
  22038. function globUnescape (s) {
  22039. return s.replace(/\\(.)/g, '$1')
  22040. }
  22041. function regExpEscape (s) {
  22042. return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
  22043. }
  22044. var inherits_browser$1 = createCommonjsModule(function (module) {
  22045. if (typeof Object.create === 'function') {
  22046. // implementation from standard node.js 'util' module
  22047. module.exports = function inherits(ctor, superCtor) {
  22048. if (superCtor) {
  22049. ctor.super_ = superCtor;
  22050. ctor.prototype = Object.create(superCtor.prototype, {
  22051. constructor: {
  22052. value: ctor,
  22053. enumerable: false,
  22054. writable: true,
  22055. configurable: true
  22056. }
  22057. });
  22058. }
  22059. };
  22060. } else {
  22061. // old school shim for old browsers
  22062. module.exports = function inherits(ctor, superCtor) {
  22063. if (superCtor) {
  22064. ctor.super_ = superCtor;
  22065. var TempCtor = function () {};
  22066. TempCtor.prototype = superCtor.prototype;
  22067. ctor.prototype = new TempCtor();
  22068. ctor.prototype.constructor = ctor;
  22069. }
  22070. };
  22071. }
  22072. });
  22073. var inherits$1 = createCommonjsModule(function (module) {
  22074. try {
  22075. var util = require$$0$1;
  22076. /* istanbul ignore next */
  22077. if (typeof util.inherits !== 'function') throw '';
  22078. module.exports = util.inherits;
  22079. } catch (e) {
  22080. /* istanbul ignore next */
  22081. module.exports = inherits_browser$1;
  22082. }
  22083. });
  22084. // Copyright Joyent, Inc. and other Node contributors.
  22085. var R = typeof Reflect === 'object' ? Reflect : null;
  22086. var ReflectApply = R && typeof R.apply === 'function'
  22087. ? R.apply
  22088. : function ReflectApply(target, receiver, args) {
  22089. return Function.prototype.apply.call(target, receiver, args);
  22090. };
  22091. var ReflectOwnKeys;
  22092. if (R && typeof R.ownKeys === 'function') {
  22093. ReflectOwnKeys = R.ownKeys;
  22094. } else if (Object.getOwnPropertySymbols) {
  22095. ReflectOwnKeys = function ReflectOwnKeys(target) {
  22096. return Object.getOwnPropertyNames(target)
  22097. .concat(Object.getOwnPropertySymbols(target));
  22098. };
  22099. } else {
  22100. ReflectOwnKeys = function ReflectOwnKeys(target) {
  22101. return Object.getOwnPropertyNames(target);
  22102. };
  22103. }
  22104. function ProcessEmitWarning(warning) {
  22105. if (console && console.warn) console.warn(warning);
  22106. }
  22107. var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
  22108. return value !== value;
  22109. };
  22110. function EventEmitter() {
  22111. EventEmitter.init.call(this);
  22112. }
  22113. var events = EventEmitter;
  22114. var once_1$1 = once$1;
  22115. // Backwards-compat with node 0.10.x
  22116. EventEmitter.EventEmitter = EventEmitter;
  22117. EventEmitter.prototype._events = undefined;
  22118. EventEmitter.prototype._eventsCount = 0;
  22119. EventEmitter.prototype._maxListeners = undefined;
  22120. // By default EventEmitters will print a warning if more than 10 listeners are
  22121. // added to it. This is a useful default which helps finding memory leaks.
  22122. var defaultMaxListeners = 10;
  22123. function checkListener(listener) {
  22124. if (typeof listener !== 'function') {
  22125. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  22126. }
  22127. }
  22128. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  22129. enumerable: true,
  22130. get: function() {
  22131. return defaultMaxListeners;
  22132. },
  22133. set: function(arg) {
  22134. if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
  22135. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
  22136. }
  22137. defaultMaxListeners = arg;
  22138. }
  22139. });
  22140. EventEmitter.init = function() {
  22141. if (this._events === undefined ||
  22142. this._events === Object.getPrototypeOf(this)._events) {
  22143. this._events = Object.create(null);
  22144. this._eventsCount = 0;
  22145. }
  22146. this._maxListeners = this._maxListeners || undefined;
  22147. };
  22148. // Obviously not all Emitters should be limited to 10. This function allows
  22149. // that to be increased. Set to zero for unlimited.
  22150. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  22151. if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
  22152. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
  22153. }
  22154. this._maxListeners = n;
  22155. return this;
  22156. };
  22157. function _getMaxListeners(that) {
  22158. if (that._maxListeners === undefined)
  22159. return EventEmitter.defaultMaxListeners;
  22160. return that._maxListeners;
  22161. }
  22162. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  22163. return _getMaxListeners(this);
  22164. };
  22165. EventEmitter.prototype.emit = function emit(type) {
  22166. var args = [];
  22167. for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
  22168. var doError = (type === 'error');
  22169. var events = this._events;
  22170. if (events !== undefined)
  22171. doError = (doError && events.error === undefined);
  22172. else if (!doError)
  22173. return false;
  22174. // If there is no 'error' event listener then throw.
  22175. if (doError) {
  22176. var er;
  22177. if (args.length > 0)
  22178. er = args[0];
  22179. if (er instanceof Error) {
  22180. // Note: The comments on the `throw` lines are intentional, they show
  22181. // up in Node's output if this results in an unhandled exception.
  22182. throw er; // Unhandled 'error' event
  22183. }
  22184. // At least give some kind of context to the user
  22185. var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
  22186. err.context = er;
  22187. throw err; // Unhandled 'error' event
  22188. }
  22189. var handler = events[type];
  22190. if (handler === undefined)
  22191. return false;
  22192. if (typeof handler === 'function') {
  22193. ReflectApply(handler, this, args);
  22194. } else {
  22195. var len = handler.length;
  22196. var listeners = arrayClone(handler, len);
  22197. for (var i = 0; i < len; ++i)
  22198. ReflectApply(listeners[i], this, args);
  22199. }
  22200. return true;
  22201. };
  22202. function _addListener(target, type, listener, prepend) {
  22203. var m;
  22204. var events;
  22205. var existing;
  22206. checkListener(listener);
  22207. events = target._events;
  22208. if (events === undefined) {
  22209. events = target._events = Object.create(null);
  22210. target._eventsCount = 0;
  22211. } else {
  22212. // To avoid recursion in the case that type === "newListener"! Before
  22213. // adding it to the listeners, first emit "newListener".
  22214. if (events.newListener !== undefined) {
  22215. target.emit('newListener', type,
  22216. listener.listener ? listener.listener : listener);
  22217. // Re-assign `events` because a newListener handler could have caused the
  22218. // this._events to be assigned to a new object
  22219. events = target._events;
  22220. }
  22221. existing = events[type];
  22222. }
  22223. if (existing === undefined) {
  22224. // Optimize the case of one listener. Don't need the extra array object.
  22225. existing = events[type] = listener;
  22226. ++target._eventsCount;
  22227. } else {
  22228. if (typeof existing === 'function') {
  22229. // Adding the second element, need to change to array.
  22230. existing = events[type] =
  22231. prepend ? [listener, existing] : [existing, listener];
  22232. // If we've already got an array, just append.
  22233. } else if (prepend) {
  22234. existing.unshift(listener);
  22235. } else {
  22236. existing.push(listener);
  22237. }
  22238. // Check for listener leak
  22239. m = _getMaxListeners(target);
  22240. if (m > 0 && existing.length > m && !existing.warned) {
  22241. existing.warned = true;
  22242. // No error code for this since it is a Warning
  22243. // eslint-disable-next-line no-restricted-syntax
  22244. var w = new Error('Possible EventEmitter memory leak detected. ' +
  22245. existing.length + ' ' + String(type) + ' listeners ' +
  22246. 'added. Use emitter.setMaxListeners() to ' +
  22247. 'increase limit');
  22248. w.name = 'MaxListenersExceededWarning';
  22249. w.emitter = target;
  22250. w.type = type;
  22251. w.count = existing.length;
  22252. ProcessEmitWarning(w);
  22253. }
  22254. }
  22255. return target;
  22256. }
  22257. EventEmitter.prototype.addListener = function addListener(type, listener) {
  22258. return _addListener(this, type, listener, false);
  22259. };
  22260. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  22261. EventEmitter.prototype.prependListener =
  22262. function prependListener(type, listener) {
  22263. return _addListener(this, type, listener, true);
  22264. };
  22265. function onceWrapper() {
  22266. if (!this.fired) {
  22267. this.target.removeListener(this.type, this.wrapFn);
  22268. this.fired = true;
  22269. if (arguments.length === 0)
  22270. return this.listener.call(this.target);
  22271. return this.listener.apply(this.target, arguments);
  22272. }
  22273. }
  22274. function _onceWrap(target, type, listener) {
  22275. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  22276. var wrapped = onceWrapper.bind(state);
  22277. wrapped.listener = listener;
  22278. state.wrapFn = wrapped;
  22279. return wrapped;
  22280. }
  22281. EventEmitter.prototype.once = function once(type, listener) {
  22282. checkListener(listener);
  22283. this.on(type, _onceWrap(this, type, listener));
  22284. return this;
  22285. };
  22286. EventEmitter.prototype.prependOnceListener =
  22287. function prependOnceListener(type, listener) {
  22288. checkListener(listener);
  22289. this.prependListener(type, _onceWrap(this, type, listener));
  22290. return this;
  22291. };
  22292. // Emits a 'removeListener' event if and only if the listener was removed.
  22293. EventEmitter.prototype.removeListener =
  22294. function removeListener(type, listener) {
  22295. var list, events, position, i, originalListener;
  22296. checkListener(listener);
  22297. events = this._events;
  22298. if (events === undefined)
  22299. return this;
  22300. list = events[type];
  22301. if (list === undefined)
  22302. return this;
  22303. if (list === listener || list.listener === listener) {
  22304. if (--this._eventsCount === 0)
  22305. this._events = Object.create(null);
  22306. else {
  22307. delete events[type];
  22308. if (events.removeListener)
  22309. this.emit('removeListener', type, list.listener || listener);
  22310. }
  22311. } else if (typeof list !== 'function') {
  22312. position = -1;
  22313. for (i = list.length - 1; i >= 0; i--) {
  22314. if (list[i] === listener || list[i].listener === listener) {
  22315. originalListener = list[i].listener;
  22316. position = i;
  22317. break;
  22318. }
  22319. }
  22320. if (position < 0)
  22321. return this;
  22322. if (position === 0)
  22323. list.shift();
  22324. else {
  22325. spliceOne(list, position);
  22326. }
  22327. if (list.length === 1)
  22328. events[type] = list[0];
  22329. if (events.removeListener !== undefined)
  22330. this.emit('removeListener', type, originalListener || listener);
  22331. }
  22332. return this;
  22333. };
  22334. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  22335. EventEmitter.prototype.removeAllListeners =
  22336. function removeAllListeners(type) {
  22337. var listeners, events, i;
  22338. events = this._events;
  22339. if (events === undefined)
  22340. return this;
  22341. // not listening for removeListener, no need to emit
  22342. if (events.removeListener === undefined) {
  22343. if (arguments.length === 0) {
  22344. this._events = Object.create(null);
  22345. this._eventsCount = 0;
  22346. } else if (events[type] !== undefined) {
  22347. if (--this._eventsCount === 0)
  22348. this._events = Object.create(null);
  22349. else
  22350. delete events[type];
  22351. }
  22352. return this;
  22353. }
  22354. // emit removeListener for all listeners on all events
  22355. if (arguments.length === 0) {
  22356. var keys = Object.keys(events);
  22357. var key;
  22358. for (i = 0; i < keys.length; ++i) {
  22359. key = keys[i];
  22360. if (key === 'removeListener') continue;
  22361. this.removeAllListeners(key);
  22362. }
  22363. this.removeAllListeners('removeListener');
  22364. this._events = Object.create(null);
  22365. this._eventsCount = 0;
  22366. return this;
  22367. }
  22368. listeners = events[type];
  22369. if (typeof listeners === 'function') {
  22370. this.removeListener(type, listeners);
  22371. } else if (listeners !== undefined) {
  22372. // LIFO order
  22373. for (i = listeners.length - 1; i >= 0; i--) {
  22374. this.removeListener(type, listeners[i]);
  22375. }
  22376. }
  22377. return this;
  22378. };
  22379. function _listeners(target, type, unwrap) {
  22380. var events = target._events;
  22381. if (events === undefined)
  22382. return [];
  22383. var evlistener = events[type];
  22384. if (evlistener === undefined)
  22385. return [];
  22386. if (typeof evlistener === 'function')
  22387. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  22388. return unwrap ?
  22389. unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  22390. }
  22391. EventEmitter.prototype.listeners = function listeners(type) {
  22392. return _listeners(this, type, true);
  22393. };
  22394. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  22395. return _listeners(this, type, false);
  22396. };
  22397. EventEmitter.listenerCount = function(emitter, type) {
  22398. if (typeof emitter.listenerCount === 'function') {
  22399. return emitter.listenerCount(type);
  22400. } else {
  22401. return listenerCount.call(emitter, type);
  22402. }
  22403. };
  22404. EventEmitter.prototype.listenerCount = listenerCount;
  22405. function listenerCount(type) {
  22406. var events = this._events;
  22407. if (events !== undefined) {
  22408. var evlistener = events[type];
  22409. if (typeof evlistener === 'function') {
  22410. return 1;
  22411. } else if (evlistener !== undefined) {
  22412. return evlistener.length;
  22413. }
  22414. }
  22415. return 0;
  22416. }
  22417. EventEmitter.prototype.eventNames = function eventNames() {
  22418. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  22419. };
  22420. function arrayClone(arr, n) {
  22421. var copy = new Array(n);
  22422. for (var i = 0; i < n; ++i)
  22423. copy[i] = arr[i];
  22424. return copy;
  22425. }
  22426. function spliceOne(list, index) {
  22427. for (; index + 1 < list.length; index++)
  22428. list[index] = list[index + 1];
  22429. list.pop();
  22430. }
  22431. function unwrapListeners(arr) {
  22432. var ret = new Array(arr.length);
  22433. for (var i = 0; i < ret.length; ++i) {
  22434. ret[i] = arr[i].listener || arr[i];
  22435. }
  22436. return ret;
  22437. }
  22438. function once$1(emitter, name) {
  22439. return new Promise(function (resolve, reject) {
  22440. function errorListener(err) {
  22441. emitter.removeListener(name, resolver);
  22442. reject(err);
  22443. }
  22444. function resolver() {
  22445. if (typeof emitter.removeListener === 'function') {
  22446. emitter.removeListener('error', errorListener);
  22447. }
  22448. resolve([].slice.call(arguments));
  22449. }
  22450. eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
  22451. if (name !== 'error') {
  22452. addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
  22453. }
  22454. });
  22455. }
  22456. function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
  22457. if (typeof emitter.on === 'function') {
  22458. eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
  22459. }
  22460. }
  22461. function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
  22462. if (typeof emitter.on === 'function') {
  22463. if (flags.once) {
  22464. emitter.once(name, listener);
  22465. } else {
  22466. emitter.on(name, listener);
  22467. }
  22468. } else if (typeof emitter.addEventListener === 'function') {
  22469. // EventTarget does not have `error` event semantics like Node
  22470. // EventEmitters, we do not listen for `error` events here.
  22471. emitter.addEventListener(name, function wrapListener(arg) {
  22472. // IE does not have builtin `{ once: true }` support so we
  22473. // have to do it manually.
  22474. if (flags.once) {
  22475. emitter.removeEventListener(name, wrapListener);
  22476. }
  22477. listener(arg);
  22478. });
  22479. } else {
  22480. throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
  22481. }
  22482. }
  22483. events.once = once_1$1;
  22484. /*
  22485. object-assign
  22486. (c) Sindre Sorhus
  22487. @license MIT
  22488. */
  22489. /* eslint-disable no-unused-vars */
  22490. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  22491. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  22492. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  22493. function toObject(val) {
  22494. if (val === null || val === undefined) {
  22495. throw new TypeError('Object.assign cannot be called with null or undefined');
  22496. }
  22497. return Object(val);
  22498. }
  22499. function shouldUseNative() {
  22500. try {
  22501. if (!Object.assign) {
  22502. return false;
  22503. }
  22504. // Detect buggy property enumeration order in older V8 versions.
  22505. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  22506. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  22507. test1[5] = 'de';
  22508. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  22509. return false;
  22510. }
  22511. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  22512. var test2 = {};
  22513. for (var i = 0; i < 10; i++) {
  22514. test2['_' + String.fromCharCode(i)] = i;
  22515. }
  22516. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  22517. return test2[n];
  22518. });
  22519. if (order2.join('') !== '0123456789') {
  22520. return false;
  22521. }
  22522. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  22523. var test3 = {};
  22524. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  22525. test3[letter] = letter;
  22526. });
  22527. if (Object.keys(Object.assign({}, test3)).join('') !==
  22528. 'abcdefghijklmnopqrst') {
  22529. return false;
  22530. }
  22531. return true;
  22532. } catch (err) {
  22533. // We don't expect any of the above to throw, but better to be safe.
  22534. return false;
  22535. }
  22536. }
  22537. var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
  22538. var from;
  22539. var to = toObject(target);
  22540. var symbols;
  22541. for (var s = 1; s < arguments.length; s++) {
  22542. from = Object(arguments[s]);
  22543. for (var key in from) {
  22544. if (hasOwnProperty$1.call(from, key)) {
  22545. to[key] = from[key];
  22546. }
  22547. }
  22548. if (getOwnPropertySymbols) {
  22549. symbols = getOwnPropertySymbols(from);
  22550. for (var i = 0; i < symbols.length; i++) {
  22551. if (propIsEnumerable.call(from, symbols[i])) {
  22552. to[symbols[i]] = from[symbols[i]];
  22553. }
  22554. }
  22555. }
  22556. }
  22557. return to;
  22558. };
  22559. var isBuffer = function isBuffer(arg) {
  22560. return arg instanceof Buffer;
  22561. };
  22562. var inherits$2 = require$$0$1.inherits;
  22563. var util = createCommonjsModule(function (module, exports) {
  22564. // Copyright Joyent, Inc. and other Node contributors.
  22565. //
  22566. // Permission is hereby granted, free of charge, to any person obtaining a
  22567. // copy of this software and associated documentation files (the
  22568. // "Software"), to deal in the Software without restriction, including
  22569. // without limitation the rights to use, copy, modify, merge, publish,
  22570. // distribute, sublicense, and/or sell copies of the Software, and to permit
  22571. // persons to whom the Software is furnished to do so, subject to the
  22572. // following conditions:
  22573. //
  22574. // The above copyright notice and this permission notice shall be included
  22575. // in all copies or substantial portions of the Software.
  22576. //
  22577. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  22578. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22579. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  22580. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  22581. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22582. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  22583. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  22584. var formatRegExp = /%[sdj%]/g;
  22585. exports.format = function(f) {
  22586. if (!isString(f)) {
  22587. var objects = [];
  22588. for (var i = 0; i < arguments.length; i++) {
  22589. objects.push(inspect(arguments[i]));
  22590. }
  22591. return objects.join(' ');
  22592. }
  22593. var i = 1;
  22594. var args = arguments;
  22595. var len = args.length;
  22596. var str = String(f).replace(formatRegExp, function(x) {
  22597. if (x === '%%') return '%';
  22598. if (i >= len) return x;
  22599. switch (x) {
  22600. case '%s': return String(args[i++]);
  22601. case '%d': return Number(args[i++]);
  22602. case '%j':
  22603. try {
  22604. return JSON.stringify(args[i++]);
  22605. } catch (_) {
  22606. return '[Circular]';
  22607. }
  22608. default:
  22609. return x;
  22610. }
  22611. });
  22612. for (var x = args[i]; i < len; x = args[++i]) {
  22613. if (isNull(x) || !isObject(x)) {
  22614. str += ' ' + x;
  22615. } else {
  22616. str += ' ' + inspect(x);
  22617. }
  22618. }
  22619. return str;
  22620. };
  22621. // Mark that a method should not be used.
  22622. // Returns a modified function which warns once by default.
  22623. // If --no-deprecation is set, then it is a no-op.
  22624. exports.deprecate = function(fn, msg) {
  22625. // Allow for deprecating things in the process of starting up.
  22626. if (isUndefined(commonjsGlobal.process)) {
  22627. return function() {
  22628. return exports.deprecate(fn, msg).apply(this, arguments);
  22629. };
  22630. }
  22631. if (process.noDeprecation === true) {
  22632. return fn;
  22633. }
  22634. var warned = false;
  22635. function deprecated() {
  22636. if (!warned) {
  22637. if (process.throwDeprecation) {
  22638. throw new Error(msg);
  22639. } else if (process.traceDeprecation) {
  22640. console.trace(msg);
  22641. } else {
  22642. console.error(msg);
  22643. }
  22644. warned = true;
  22645. }
  22646. return fn.apply(this, arguments);
  22647. }
  22648. return deprecated;
  22649. };
  22650. var debugs = {};
  22651. var debugEnviron;
  22652. exports.debuglog = function(set) {
  22653. if (isUndefined(debugEnviron))
  22654. debugEnviron = '';
  22655. set = set.toUpperCase();
  22656. if (!debugs[set]) {
  22657. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  22658. var pid = process.pid;
  22659. debugs[set] = function() {
  22660. var msg = exports.format.apply(exports, arguments);
  22661. console.error('%s %d: %s', set, pid, msg);
  22662. };
  22663. } else {
  22664. debugs[set] = function() {};
  22665. }
  22666. }
  22667. return debugs[set];
  22668. };
  22669. /**
  22670. * Echos the value of a value. Trys to print the value out
  22671. * in the best way possible given the different types.
  22672. *
  22673. * @param {Object} obj The object to print out.
  22674. * @param {Object} opts Optional options object that alters the output.
  22675. */
  22676. /* legacy: obj, showHidden, depth, colors*/
  22677. function inspect(obj, opts) {
  22678. // default options
  22679. var ctx = {
  22680. seen: [],
  22681. stylize: stylizeNoColor
  22682. };
  22683. // legacy...
  22684. if (arguments.length >= 3) ctx.depth = arguments[2];
  22685. if (arguments.length >= 4) ctx.colors = arguments[3];
  22686. if (isBoolean(opts)) {
  22687. // legacy...
  22688. ctx.showHidden = opts;
  22689. } else if (opts) {
  22690. // got an "options" object
  22691. exports._extend(ctx, opts);
  22692. }
  22693. // set default options
  22694. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  22695. if (isUndefined(ctx.depth)) ctx.depth = 2;
  22696. if (isUndefined(ctx.colors)) ctx.colors = false;
  22697. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  22698. if (ctx.colors) ctx.stylize = stylizeWithColor;
  22699. return formatValue(ctx, obj, ctx.depth);
  22700. }
  22701. exports.inspect = inspect;
  22702. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  22703. inspect.colors = {
  22704. 'bold' : [1, 22],
  22705. 'italic' : [3, 23],
  22706. 'underline' : [4, 24],
  22707. 'inverse' : [7, 27],
  22708. 'white' : [37, 39],
  22709. 'grey' : [90, 39],
  22710. 'black' : [30, 39],
  22711. 'blue' : [34, 39],
  22712. 'cyan' : [36, 39],
  22713. 'green' : [32, 39],
  22714. 'magenta' : [35, 39],
  22715. 'red' : [31, 39],
  22716. 'yellow' : [33, 39]
  22717. };
  22718. // Don't use 'blue' not visible on cmd.exe
  22719. inspect.styles = {
  22720. 'special': 'cyan',
  22721. 'number': 'yellow',
  22722. 'boolean': 'yellow',
  22723. 'undefined': 'grey',
  22724. 'null': 'bold',
  22725. 'string': 'green',
  22726. 'date': 'magenta',
  22727. // "name": intentionally not styling
  22728. 'regexp': 'red'
  22729. };
  22730. function stylizeWithColor(str, styleType) {
  22731. var style = inspect.styles[styleType];
  22732. if (style) {
  22733. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  22734. '\u001b[' + inspect.colors[style][1] + 'm';
  22735. } else {
  22736. return str;
  22737. }
  22738. }
  22739. function stylizeNoColor(str, styleType) {
  22740. return str;
  22741. }
  22742. function arrayToHash(array) {
  22743. var hash = {};
  22744. array.forEach(function(val, idx) {
  22745. hash[val] = true;
  22746. });
  22747. return hash;
  22748. }
  22749. function formatValue(ctx, value, recurseTimes) {
  22750. // Provide a hook for user-specified inspect functions.
  22751. // Check that value is an object with an inspect function on it
  22752. if (ctx.customInspect &&
  22753. value &&
  22754. isFunction(value.inspect) &&
  22755. // Filter out the util module, it's inspect function is special
  22756. value.inspect !== exports.inspect &&
  22757. // Also filter out any prototype objects using the circular check.
  22758. !(value.constructor && value.constructor.prototype === value)) {
  22759. var ret = value.inspect(recurseTimes, ctx);
  22760. if (!isString(ret)) {
  22761. ret = formatValue(ctx, ret, recurseTimes);
  22762. }
  22763. return ret;
  22764. }
  22765. // Primitive types cannot have properties
  22766. var primitive = formatPrimitive(ctx, value);
  22767. if (primitive) {
  22768. return primitive;
  22769. }
  22770. // Look up the keys of the object.
  22771. var keys = Object.keys(value);
  22772. var visibleKeys = arrayToHash(keys);
  22773. if (ctx.showHidden) {
  22774. keys = Object.getOwnPropertyNames(value);
  22775. }
  22776. // IE doesn't make error fields non-enumerable
  22777. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  22778. if (isError(value)
  22779. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  22780. return formatError(value);
  22781. }
  22782. // Some type of object without properties can be shortcutted.
  22783. if (keys.length === 0) {
  22784. if (isFunction(value)) {
  22785. var name = value.name ? ': ' + value.name : '';
  22786. return ctx.stylize('[Function' + name + ']', 'special');
  22787. }
  22788. if (isRegExp(value)) {
  22789. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  22790. }
  22791. if (isDate(value)) {
  22792. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  22793. }
  22794. if (isError(value)) {
  22795. return formatError(value);
  22796. }
  22797. }
  22798. var base = '', array = false, braces = ['{', '}'];
  22799. // Make Array say that they are Array
  22800. if (isArray(value)) {
  22801. array = true;
  22802. braces = ['[', ']'];
  22803. }
  22804. // Make functions say that they are functions
  22805. if (isFunction(value)) {
  22806. var n = value.name ? ': ' + value.name : '';
  22807. base = ' [Function' + n + ']';
  22808. }
  22809. // Make RegExps say that they are RegExps
  22810. if (isRegExp(value)) {
  22811. base = ' ' + RegExp.prototype.toString.call(value);
  22812. }
  22813. // Make dates with properties first say the date
  22814. if (isDate(value)) {
  22815. base = ' ' + Date.prototype.toUTCString.call(value);
  22816. }
  22817. // Make error with message first say the error
  22818. if (isError(value)) {
  22819. base = ' ' + formatError(value);
  22820. }
  22821. if (keys.length === 0 && (!array || value.length == 0)) {
  22822. return braces[0] + base + braces[1];
  22823. }
  22824. if (recurseTimes < 0) {
  22825. if (isRegExp(value)) {
  22826. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  22827. } else {
  22828. return ctx.stylize('[Object]', 'special');
  22829. }
  22830. }
  22831. ctx.seen.push(value);
  22832. var output;
  22833. if (array) {
  22834. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  22835. } else {
  22836. output = keys.map(function(key) {
  22837. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  22838. });
  22839. }
  22840. ctx.seen.pop();
  22841. return reduceToSingleString(output, base, braces);
  22842. }
  22843. function formatPrimitive(ctx, value) {
  22844. if (isUndefined(value))
  22845. return ctx.stylize('undefined', 'undefined');
  22846. if (isString(value)) {
  22847. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  22848. .replace(/'/g, "\\'")
  22849. .replace(/\\"/g, '"') + '\'';
  22850. return ctx.stylize(simple, 'string');
  22851. }
  22852. if (isNumber(value))
  22853. return ctx.stylize('' + value, 'number');
  22854. if (isBoolean(value))
  22855. return ctx.stylize('' + value, 'boolean');
  22856. // For some reason typeof null is "object", so special case here.
  22857. if (isNull(value))
  22858. return ctx.stylize('null', 'null');
  22859. }
  22860. function formatError(value) {
  22861. return '[' + Error.prototype.toString.call(value) + ']';
  22862. }
  22863. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  22864. var output = [];
  22865. for (var i = 0, l = value.length; i < l; ++i) {
  22866. if (hasOwnProperty(value, String(i))) {
  22867. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  22868. String(i), true));
  22869. } else {
  22870. output.push('');
  22871. }
  22872. }
  22873. keys.forEach(function(key) {
  22874. if (!key.match(/^\d+$/)) {
  22875. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  22876. key, true));
  22877. }
  22878. });
  22879. return output;
  22880. }
  22881. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  22882. var name, str, desc;
  22883. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  22884. if (desc.get) {
  22885. if (desc.set) {
  22886. str = ctx.stylize('[Getter/Setter]', 'special');
  22887. } else {
  22888. str = ctx.stylize('[Getter]', 'special');
  22889. }
  22890. } else {
  22891. if (desc.set) {
  22892. str = ctx.stylize('[Setter]', 'special');
  22893. }
  22894. }
  22895. if (!hasOwnProperty(visibleKeys, key)) {
  22896. name = '[' + key + ']';
  22897. }
  22898. if (!str) {
  22899. if (ctx.seen.indexOf(desc.value) < 0) {
  22900. if (isNull(recurseTimes)) {
  22901. str = formatValue(ctx, desc.value, null);
  22902. } else {
  22903. str = formatValue(ctx, desc.value, recurseTimes - 1);
  22904. }
  22905. if (str.indexOf('\n') > -1) {
  22906. if (array) {
  22907. str = str.split('\n').map(function(line) {
  22908. return ' ' + line;
  22909. }).join('\n').substr(2);
  22910. } else {
  22911. str = '\n' + str.split('\n').map(function(line) {
  22912. return ' ' + line;
  22913. }).join('\n');
  22914. }
  22915. }
  22916. } else {
  22917. str = ctx.stylize('[Circular]', 'special');
  22918. }
  22919. }
  22920. if (isUndefined(name)) {
  22921. if (array && key.match(/^\d+$/)) {
  22922. return str;
  22923. }
  22924. name = JSON.stringify('' + key);
  22925. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  22926. name = name.substr(1, name.length - 2);
  22927. name = ctx.stylize(name, 'name');
  22928. } else {
  22929. name = name.replace(/'/g, "\\'")
  22930. .replace(/\\"/g, '"')
  22931. .replace(/(^"|"$)/g, "'");
  22932. name = ctx.stylize(name, 'string');
  22933. }
  22934. }
  22935. return name + ': ' + str;
  22936. }
  22937. function reduceToSingleString(output, base, braces) {
  22938. var length = output.reduce(function(prev, cur) {
  22939. if (cur.indexOf('\n') >= 0) ;
  22940. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  22941. }, 0);
  22942. if (length > 60) {
  22943. return braces[0] +
  22944. (base === '' ? '' : base + '\n ') +
  22945. ' ' +
  22946. output.join(',\n ') +
  22947. ' ' +
  22948. braces[1];
  22949. }
  22950. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  22951. }
  22952. // NOTE: These type checking functions intentionally don't use `instanceof`
  22953. // because it is fragile and can be easily faked with `Object.create()`.
  22954. function isArray(ar) {
  22955. return Array.isArray(ar);
  22956. }
  22957. exports.isArray = isArray;
  22958. function isBoolean(arg) {
  22959. return typeof arg === 'boolean';
  22960. }
  22961. exports.isBoolean = isBoolean;
  22962. function isNull(arg) {
  22963. return arg === null;
  22964. }
  22965. exports.isNull = isNull;
  22966. function isNullOrUndefined(arg) {
  22967. return arg == null;
  22968. }
  22969. exports.isNullOrUndefined = isNullOrUndefined;
  22970. function isNumber(arg) {
  22971. return typeof arg === 'number';
  22972. }
  22973. exports.isNumber = isNumber;
  22974. function isString(arg) {
  22975. return typeof arg === 'string';
  22976. }
  22977. exports.isString = isString;
  22978. function isSymbol(arg) {
  22979. return typeof arg === 'symbol';
  22980. }
  22981. exports.isSymbol = isSymbol;
  22982. function isUndefined(arg) {
  22983. return arg === void 0;
  22984. }
  22985. exports.isUndefined = isUndefined;
  22986. function isRegExp(re) {
  22987. return isObject(re) && objectToString(re) === '[object RegExp]';
  22988. }
  22989. exports.isRegExp = isRegExp;
  22990. function isObject(arg) {
  22991. return typeof arg === 'object' && arg !== null;
  22992. }
  22993. exports.isObject = isObject;
  22994. function isDate(d) {
  22995. return isObject(d) && objectToString(d) === '[object Date]';
  22996. }
  22997. exports.isDate = isDate;
  22998. function isError(e) {
  22999. return isObject(e) &&
  23000. (objectToString(e) === '[object Error]' || e instanceof Error);
  23001. }
  23002. exports.isError = isError;
  23003. function isFunction(arg) {
  23004. return typeof arg === 'function';
  23005. }
  23006. exports.isFunction = isFunction;
  23007. function isPrimitive(arg) {
  23008. return arg === null ||
  23009. typeof arg === 'boolean' ||
  23010. typeof arg === 'number' ||
  23011. typeof arg === 'string' ||
  23012. typeof arg === 'symbol' || // ES6 symbol
  23013. typeof arg === 'undefined';
  23014. }
  23015. exports.isPrimitive = isPrimitive;
  23016. exports.isBuffer = isBuffer;
  23017. function objectToString(o) {
  23018. return Object.prototype.toString.call(o);
  23019. }
  23020. function pad(n) {
  23021. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  23022. }
  23023. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  23024. 'Oct', 'Nov', 'Dec'];
  23025. // 26 Feb 16:19:34
  23026. function timestamp() {
  23027. var d = new Date();
  23028. var time = [pad(d.getHours()),
  23029. pad(d.getMinutes()),
  23030. pad(d.getSeconds())].join(':');
  23031. return [d.getDate(), months[d.getMonth()], time].join(' ');
  23032. }
  23033. // log is just a thin wrapper to console.log that prepends a timestamp
  23034. exports.log = function() {
  23035. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  23036. };
  23037. /**
  23038. * Inherit the prototype methods from one constructor into another.
  23039. *
  23040. * The Function.prototype.inherits from lang.js rewritten as a standalone
  23041. * function (not on Function.prototype). NOTE: If this file is to be loaded
  23042. * during bootstrapping this function needs to be rewritten using some native
  23043. * functions as prototype setup using normal JavaScript does not work as
  23044. * expected during bootstrapping (see mirror.js in r114903).
  23045. *
  23046. * @param {function} ctor Constructor function which needs to inherit the
  23047. * prototype.
  23048. * @param {function} superCtor Constructor function to inherit prototype from.
  23049. */
  23050. exports.inherits = inherits$2;
  23051. exports._extend = function(origin, add) {
  23052. // Don't do anything if add isn't an object
  23053. if (!add || !isObject(add)) return origin;
  23054. var keys = Object.keys(add);
  23055. var i = keys.length;
  23056. while (i--) {
  23057. origin[keys[i]] = add[keys[i]];
  23058. }
  23059. return origin;
  23060. };
  23061. function hasOwnProperty(obj, prop) {
  23062. return Object.prototype.hasOwnProperty.call(obj, prop);
  23063. }
  23064. });
  23065. var assert_1 = createCommonjsModule(function (module) {
  23066. // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
  23067. // original notice:
  23068. /*!
  23069. * The buffer module from node.js, for the browser.
  23070. *
  23071. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  23072. * @license MIT
  23073. */
  23074. function compare(a, b) {
  23075. if (a === b) {
  23076. return 0;
  23077. }
  23078. var x = a.length;
  23079. var y = b.length;
  23080. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  23081. if (a[i] !== b[i]) {
  23082. x = a[i];
  23083. y = b[i];
  23084. break;
  23085. }
  23086. }
  23087. if (x < y) {
  23088. return -1;
  23089. }
  23090. if (y < x) {
  23091. return 1;
  23092. }
  23093. return 0;
  23094. }
  23095. function isBuffer(b) {
  23096. if (commonjsGlobal.Buffer && typeof commonjsGlobal.Buffer.isBuffer === 'function') {
  23097. return commonjsGlobal.Buffer.isBuffer(b);
  23098. }
  23099. return !!(b != null && b._isBuffer);
  23100. }
  23101. // based on node assert, original notice:
  23102. // NB: The URL to the CommonJS spec is kept just for tradition.
  23103. // node-assert has evolved a lot since then, both in API and behavior.
  23104. // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
  23105. //
  23106. // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
  23107. //
  23108. // Originally from narwhal.js (http://narwhaljs.org)
  23109. // Copyright (c) 2009 Thomas Robinson <280north.com>
  23110. //
  23111. // Permission is hereby granted, free of charge, to any person obtaining a copy
  23112. // of this software and associated documentation files (the 'Software'), to
  23113. // deal in the Software without restriction, including without limitation the
  23114. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  23115. // sell copies of the Software, and to permit persons to whom the Software is
  23116. // furnished to do so, subject to the following conditions:
  23117. //
  23118. // The above copyright notice and this permission notice shall be included in
  23119. // all copies or substantial portions of the Software.
  23120. //
  23121. // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23122. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23123. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  23124. // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  23125. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23126. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23127. var hasOwn = Object.prototype.hasOwnProperty;
  23128. var pSlice = Array.prototype.slice;
  23129. var functionsHaveNames = (function () {
  23130. return function foo() {}.name === 'foo';
  23131. }());
  23132. function pToString (obj) {
  23133. return Object.prototype.toString.call(obj);
  23134. }
  23135. function isView(arrbuf) {
  23136. if (isBuffer(arrbuf)) {
  23137. return false;
  23138. }
  23139. if (typeof commonjsGlobal.ArrayBuffer !== 'function') {
  23140. return false;
  23141. }
  23142. if (typeof ArrayBuffer.isView === 'function') {
  23143. return ArrayBuffer.isView(arrbuf);
  23144. }
  23145. if (!arrbuf) {
  23146. return false;
  23147. }
  23148. if (arrbuf instanceof DataView) {
  23149. return true;
  23150. }
  23151. if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
  23152. return true;
  23153. }
  23154. return false;
  23155. }
  23156. // 1. The assert module provides functions that throw
  23157. // AssertionError's when particular conditions are not met. The
  23158. // assert module must conform to the following interface.
  23159. var assert = module.exports = ok;
  23160. // 2. The AssertionError is defined in assert.
  23161. // new assert.AssertionError({ message: message,
  23162. // actual: actual,
  23163. // expected: expected })
  23164. var regex = /\s*function\s+([^\(\s]*)\s*/;
  23165. // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
  23166. function getName(func) {
  23167. if (!util.isFunction(func)) {
  23168. return;
  23169. }
  23170. if (functionsHaveNames) {
  23171. return func.name;
  23172. }
  23173. var str = func.toString();
  23174. var match = str.match(regex);
  23175. return match && match[1];
  23176. }
  23177. assert.AssertionError = function AssertionError(options) {
  23178. this.name = 'AssertionError';
  23179. this.actual = options.actual;
  23180. this.expected = options.expected;
  23181. this.operator = options.operator;
  23182. if (options.message) {
  23183. this.message = options.message;
  23184. this.generatedMessage = false;
  23185. } else {
  23186. this.message = getMessage(this);
  23187. this.generatedMessage = true;
  23188. }
  23189. var stackStartFunction = options.stackStartFunction || fail;
  23190. if (Error.captureStackTrace) {
  23191. Error.captureStackTrace(this, stackStartFunction);
  23192. } else {
  23193. // non v8 browsers so we can have a stacktrace
  23194. var err = new Error();
  23195. if (err.stack) {
  23196. var out = err.stack;
  23197. // try to strip useless frames
  23198. var fn_name = getName(stackStartFunction);
  23199. var idx = out.indexOf('\n' + fn_name);
  23200. if (idx >= 0) {
  23201. // once we have located the function frame
  23202. // we need to strip out everything before it (and its line)
  23203. var next_line = out.indexOf('\n', idx + 1);
  23204. out = out.substring(next_line + 1);
  23205. }
  23206. this.stack = out;
  23207. }
  23208. }
  23209. };
  23210. // assert.AssertionError instanceof Error
  23211. util.inherits(assert.AssertionError, Error);
  23212. function truncate(s, n) {
  23213. if (typeof s === 'string') {
  23214. return s.length < n ? s : s.slice(0, n);
  23215. } else {
  23216. return s;
  23217. }
  23218. }
  23219. function inspect(something) {
  23220. if (functionsHaveNames || !util.isFunction(something)) {
  23221. return util.inspect(something);
  23222. }
  23223. var rawname = getName(something);
  23224. var name = rawname ? ': ' + rawname : '';
  23225. return '[Function' + name + ']';
  23226. }
  23227. function getMessage(self) {
  23228. return truncate(inspect(self.actual), 128) + ' ' +
  23229. self.operator + ' ' +
  23230. truncate(inspect(self.expected), 128);
  23231. }
  23232. // At present only the three keys mentioned above are used and
  23233. // understood by the spec. Implementations or sub modules can pass
  23234. // other keys to the AssertionError's constructor - they will be
  23235. // ignored.
  23236. // 3. All of the following functions must throw an AssertionError
  23237. // when a corresponding condition is not met, with a message that
  23238. // may be undefined if not provided. All assertion methods provide
  23239. // both the actual and expected values to the assertion error for
  23240. // display purposes.
  23241. function fail(actual, expected, message, operator, stackStartFunction) {
  23242. throw new assert.AssertionError({
  23243. message: message,
  23244. actual: actual,
  23245. expected: expected,
  23246. operator: operator,
  23247. stackStartFunction: stackStartFunction
  23248. });
  23249. }
  23250. // EXTENSION! allows for well behaved errors defined elsewhere.
  23251. assert.fail = fail;
  23252. // 4. Pure assertion tests whether a value is truthy, as determined
  23253. // by !!guard.
  23254. // assert.ok(guard, message_opt);
  23255. // This statement is equivalent to assert.equal(true, !!guard,
  23256. // message_opt);. To test strictly for the value true, use
  23257. // assert.strictEqual(true, guard, message_opt);.
  23258. function ok(value, message) {
  23259. if (!value) fail(value, true, message, '==', assert.ok);
  23260. }
  23261. assert.ok = ok;
  23262. // 5. The equality assertion tests shallow, coercive equality with
  23263. // ==.
  23264. // assert.equal(actual, expected, message_opt);
  23265. assert.equal = function equal(actual, expected, message) {
  23266. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  23267. };
  23268. // 6. The non-equality assertion tests for whether two objects are not equal
  23269. // with != assert.notEqual(actual, expected, message_opt);
  23270. assert.notEqual = function notEqual(actual, expected, message) {
  23271. if (actual == expected) {
  23272. fail(actual, expected, message, '!=', assert.notEqual);
  23273. }
  23274. };
  23275. // 7. The equivalence assertion tests a deep equality relation.
  23276. // assert.deepEqual(actual, expected, message_opt);
  23277. assert.deepEqual = function deepEqual(actual, expected, message) {
  23278. if (!_deepEqual(actual, expected, false)) {
  23279. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  23280. }
  23281. };
  23282. assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
  23283. if (!_deepEqual(actual, expected, true)) {
  23284. fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
  23285. }
  23286. };
  23287. function _deepEqual(actual, expected, strict, memos) {
  23288. // 7.1. All identical values are equivalent, as determined by ===.
  23289. if (actual === expected) {
  23290. return true;
  23291. } else if (isBuffer(actual) && isBuffer(expected)) {
  23292. return compare(actual, expected) === 0;
  23293. // 7.2. If the expected value is a Date object, the actual value is
  23294. // equivalent if it is also a Date object that refers to the same time.
  23295. } else if (util.isDate(actual) && util.isDate(expected)) {
  23296. return actual.getTime() === expected.getTime();
  23297. // 7.3 If the expected value is a RegExp object, the actual value is
  23298. // equivalent if it is also a RegExp object with the same source and
  23299. // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
  23300. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  23301. return actual.source === expected.source &&
  23302. actual.global === expected.global &&
  23303. actual.multiline === expected.multiline &&
  23304. actual.lastIndex === expected.lastIndex &&
  23305. actual.ignoreCase === expected.ignoreCase;
  23306. // 7.4. Other pairs that do not both pass typeof value == 'object',
  23307. // equivalence is determined by ==.
  23308. } else if ((actual === null || typeof actual !== 'object') &&
  23309. (expected === null || typeof expected !== 'object')) {
  23310. return strict ? actual === expected : actual == expected;
  23311. // If both values are instances of typed arrays, wrap their underlying
  23312. // ArrayBuffers in a Buffer each to increase performance
  23313. // This optimization requires the arrays to have the same type as checked by
  23314. // Object.prototype.toString (aka pToString). Never perform binary
  23315. // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
  23316. // bit patterns are not identical.
  23317. } else if (isView(actual) && isView(expected) &&
  23318. pToString(actual) === pToString(expected) &&
  23319. !(actual instanceof Float32Array ||
  23320. actual instanceof Float64Array)) {
  23321. return compare(new Uint8Array(actual.buffer),
  23322. new Uint8Array(expected.buffer)) === 0;
  23323. // 7.5 For all other Object pairs, including Array objects, equivalence is
  23324. // determined by having the same number of owned properties (as verified
  23325. // with Object.prototype.hasOwnProperty.call), the same set of keys
  23326. // (although not necessarily the same order), equivalent values for every
  23327. // corresponding key, and an identical 'prototype' property. Note: this
  23328. // accounts for both named and indexed properties on Arrays.
  23329. } else if (isBuffer(actual) !== isBuffer(expected)) {
  23330. return false;
  23331. } else {
  23332. memos = memos || {actual: [], expected: []};
  23333. var actualIndex = memos.actual.indexOf(actual);
  23334. if (actualIndex !== -1) {
  23335. if (actualIndex === memos.expected.indexOf(expected)) {
  23336. return true;
  23337. }
  23338. }
  23339. memos.actual.push(actual);
  23340. memos.expected.push(expected);
  23341. return objEquiv(actual, expected, strict, memos);
  23342. }
  23343. }
  23344. function isArguments(object) {
  23345. return Object.prototype.toString.call(object) == '[object Arguments]';
  23346. }
  23347. function objEquiv(a, b, strict, actualVisitedObjects) {
  23348. if (a === null || a === undefined || b === null || b === undefined)
  23349. return false;
  23350. // if one is a primitive, the other must be same
  23351. if (util.isPrimitive(a) || util.isPrimitive(b))
  23352. return a === b;
  23353. if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
  23354. return false;
  23355. var aIsArgs = isArguments(a);
  23356. var bIsArgs = isArguments(b);
  23357. if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
  23358. return false;
  23359. if (aIsArgs) {
  23360. a = pSlice.call(a);
  23361. b = pSlice.call(b);
  23362. return _deepEqual(a, b, strict);
  23363. }
  23364. var ka = objectKeys(a);
  23365. var kb = objectKeys(b);
  23366. var key, i;
  23367. // having the same number of owned properties (keys incorporates
  23368. // hasOwnProperty)
  23369. if (ka.length !== kb.length)
  23370. return false;
  23371. //the same set of keys (although not necessarily the same order),
  23372. ka.sort();
  23373. kb.sort();
  23374. //~~~cheap key test
  23375. for (i = ka.length - 1; i >= 0; i--) {
  23376. if (ka[i] !== kb[i])
  23377. return false;
  23378. }
  23379. //equivalent values for every corresponding key, and
  23380. //~~~possibly expensive deep test
  23381. for (i = ka.length - 1; i >= 0; i--) {
  23382. key = ka[i];
  23383. if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
  23384. return false;
  23385. }
  23386. return true;
  23387. }
  23388. // 8. The non-equivalence assertion tests for any deep inequality.
  23389. // assert.notDeepEqual(actual, expected, message_opt);
  23390. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  23391. if (_deepEqual(actual, expected, false)) {
  23392. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  23393. }
  23394. };
  23395. assert.notDeepStrictEqual = notDeepStrictEqual;
  23396. function notDeepStrictEqual(actual, expected, message) {
  23397. if (_deepEqual(actual, expected, true)) {
  23398. fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
  23399. }
  23400. }
  23401. // 9. The strict equality assertion tests strict equality, as determined by ===.
  23402. // assert.strictEqual(actual, expected, message_opt);
  23403. assert.strictEqual = function strictEqual(actual, expected, message) {
  23404. if (actual !== expected) {
  23405. fail(actual, expected, message, '===', assert.strictEqual);
  23406. }
  23407. };
  23408. // 10. The strict non-equality assertion tests for strict inequality, as
  23409. // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
  23410. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  23411. if (actual === expected) {
  23412. fail(actual, expected, message, '!==', assert.notStrictEqual);
  23413. }
  23414. };
  23415. function expectedException(actual, expected) {
  23416. if (!actual || !expected) {
  23417. return false;
  23418. }
  23419. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  23420. return expected.test(actual);
  23421. }
  23422. try {
  23423. if (actual instanceof expected) {
  23424. return true;
  23425. }
  23426. } catch (e) {
  23427. // Ignore. The instanceof check doesn't work for arrow functions.
  23428. }
  23429. if (Error.isPrototypeOf(expected)) {
  23430. return false;
  23431. }
  23432. return expected.call({}, actual) === true;
  23433. }
  23434. function _tryBlock(block) {
  23435. var error;
  23436. try {
  23437. block();
  23438. } catch (e) {
  23439. error = e;
  23440. }
  23441. return error;
  23442. }
  23443. function _throws(shouldThrow, block, expected, message) {
  23444. var actual;
  23445. if (typeof block !== 'function') {
  23446. throw new TypeError('"block" argument must be a function');
  23447. }
  23448. if (typeof expected === 'string') {
  23449. message = expected;
  23450. expected = null;
  23451. }
  23452. actual = _tryBlock(block);
  23453. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  23454. (message ? ' ' + message : '.');
  23455. if (shouldThrow && !actual) {
  23456. fail(actual, expected, 'Missing expected exception' + message);
  23457. }
  23458. var userProvidedMessage = typeof message === 'string';
  23459. var isUnwantedException = !shouldThrow && util.isError(actual);
  23460. var isUnexpectedException = !shouldThrow && actual && !expected;
  23461. if ((isUnwantedException &&
  23462. userProvidedMessage &&
  23463. expectedException(actual, expected)) ||
  23464. isUnexpectedException) {
  23465. fail(actual, expected, 'Got unwanted exception' + message);
  23466. }
  23467. if ((shouldThrow && actual && expected &&
  23468. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  23469. throw actual;
  23470. }
  23471. }
  23472. // 11. Expected to throw an error:
  23473. // assert.throws(block, Error_opt, message_opt);
  23474. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  23475. _throws(true, block, error, message);
  23476. };
  23477. // EXTENSION! This is annoying to write outside this module.
  23478. assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
  23479. _throws(false, block, error, message);
  23480. };
  23481. assert.ifError = function(err) { if (err) throw err; };
  23482. // Expose a strict only variant of assert
  23483. function strict(value, message) {
  23484. if (!value) fail(value, true, message, '==', strict);
  23485. }
  23486. assert.strict = objectAssign(strict, assert, {
  23487. equal: assert.strictEqual,
  23488. deepEqual: assert.deepStrictEqual,
  23489. notEqual: assert.notStrictEqual,
  23490. notDeepEqual: assert.notDeepStrictEqual
  23491. });
  23492. assert.strict.strict = assert.strict;
  23493. var objectKeys = Object.keys || function (obj) {
  23494. var keys = [];
  23495. for (var key in obj) {
  23496. if (hasOwn.call(obj, key)) keys.push(key);
  23497. }
  23498. return keys;
  23499. };
  23500. });
  23501. function posix(path) {
  23502. return path.charAt(0) === '/';
  23503. }
  23504. function win32(path) {
  23505. // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
  23506. var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
  23507. var result = splitDeviceRe.exec(path);
  23508. var device = result[1] || '';
  23509. var isUnc = Boolean(device && device.charAt(1) !== ':');
  23510. // UNC paths are always absolute
  23511. return Boolean(result[2] || isUnc);
  23512. }
  23513. var pathIsAbsolute = process.platform === 'win32' ? win32 : posix;
  23514. var posix_1 = posix;
  23515. var win32_1 = win32;
  23516. pathIsAbsolute.posix = posix_1;
  23517. pathIsAbsolute.win32 = win32_1;
  23518. var setopts_1 = setopts$2;
  23519. var ownProp_1 = ownProp$2;
  23520. var makeAbs_1 = makeAbs;
  23521. var finish_1 = finish;
  23522. var mark_1 = mark;
  23523. var isIgnored_1 = isIgnored$2;
  23524. var childrenIgnored_1 = childrenIgnored$2;
  23525. function ownProp$2 (obj, field) {
  23526. return Object.prototype.hasOwnProperty.call(obj, field)
  23527. }
  23528. var Minimatch = minimatch_1.Minimatch;
  23529. function alphasort (a, b) {
  23530. return a.localeCompare(b, 'en')
  23531. }
  23532. function setupIgnores (self, options) {
  23533. self.ignore = options.ignore || [];
  23534. if (!Array.isArray(self.ignore))
  23535. self.ignore = [self.ignore];
  23536. if (self.ignore.length) {
  23537. self.ignore = self.ignore.map(ignoreMap);
  23538. }
  23539. }
  23540. // ignore patterns are always in dot:true mode.
  23541. function ignoreMap (pattern) {
  23542. var gmatcher = null;
  23543. if (pattern.slice(-3) === '/**') {
  23544. var gpattern = pattern.replace(/(\/\*\*)+$/, '');
  23545. gmatcher = new Minimatch(gpattern, { dot: true });
  23546. }
  23547. return {
  23548. matcher: new Minimatch(pattern, { dot: true }),
  23549. gmatcher: gmatcher
  23550. }
  23551. }
  23552. function setopts$2 (self, pattern, options) {
  23553. if (!options)
  23554. options = {};
  23555. // base-matching: just use globstar for that.
  23556. if (options.matchBase && -1 === pattern.indexOf("/")) {
  23557. if (options.noglobstar) {
  23558. throw new Error("base matching requires globstar")
  23559. }
  23560. pattern = "**/" + pattern;
  23561. }
  23562. self.silent = !!options.silent;
  23563. self.pattern = pattern;
  23564. self.strict = options.strict !== false;
  23565. self.realpath = !!options.realpath;
  23566. self.realpathCache = options.realpathCache || Object.create(null);
  23567. self.follow = !!options.follow;
  23568. self.dot = !!options.dot;
  23569. self.mark = !!options.mark;
  23570. self.nodir = !!options.nodir;
  23571. if (self.nodir)
  23572. self.mark = true;
  23573. self.sync = !!options.sync;
  23574. self.nounique = !!options.nounique;
  23575. self.nonull = !!options.nonull;
  23576. self.nosort = !!options.nosort;
  23577. self.nocase = !!options.nocase;
  23578. self.stat = !!options.stat;
  23579. self.noprocess = !!options.noprocess;
  23580. self.absolute = !!options.absolute;
  23581. self.fs = options.fs || fs$3;
  23582. self.maxLength = options.maxLength || Infinity;
  23583. self.cache = options.cache || Object.create(null);
  23584. self.statCache = options.statCache || Object.create(null);
  23585. self.symlinks = options.symlinks || Object.create(null);
  23586. setupIgnores(self, options);
  23587. self.changedCwd = false;
  23588. var cwd = process.cwd();
  23589. if (!ownProp$2(options, "cwd"))
  23590. self.cwd = cwd;
  23591. else {
  23592. self.cwd = path$5.resolve(options.cwd);
  23593. self.changedCwd = self.cwd !== cwd;
  23594. }
  23595. self.root = options.root || path$5.resolve(self.cwd, "/");
  23596. self.root = path$5.resolve(self.root);
  23597. if (process.platform === "win32")
  23598. self.root = self.root.replace(/\\/g, "/");
  23599. // TODO: is an absolute `cwd` supposed to be resolved against `root`?
  23600. // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
  23601. self.cwdAbs = pathIsAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
  23602. if (process.platform === "win32")
  23603. self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
  23604. self.nomount = !!options.nomount;
  23605. // disable comments and negation in Minimatch.
  23606. // Note that they are not supported in Glob itself anyway.
  23607. options.nonegate = true;
  23608. options.nocomment = true;
  23609. // always treat \ in patterns as escapes, not path separators
  23610. options.allowWindowsEscape = false;
  23611. self.minimatch = new Minimatch(pattern, options);
  23612. self.options = self.minimatch.options;
  23613. }
  23614. function finish (self) {
  23615. var nou = self.nounique;
  23616. var all = nou ? [] : Object.create(null);
  23617. for (var i = 0, l = self.matches.length; i < l; i ++) {
  23618. var matches = self.matches[i];
  23619. if (!matches || Object.keys(matches).length === 0) {
  23620. if (self.nonull) {
  23621. // do like the shell, and spit out the literal glob
  23622. var literal = self.minimatch.globSet[i];
  23623. if (nou)
  23624. all.push(literal);
  23625. else
  23626. all[literal] = true;
  23627. }
  23628. } else {
  23629. // had matches
  23630. var m = Object.keys(matches);
  23631. if (nou)
  23632. all.push.apply(all, m);
  23633. else
  23634. m.forEach(function (m) {
  23635. all[m] = true;
  23636. });
  23637. }
  23638. }
  23639. if (!nou)
  23640. all = Object.keys(all);
  23641. if (!self.nosort)
  23642. all = all.sort(alphasort);
  23643. // at *some* point we statted all of these
  23644. if (self.mark) {
  23645. for (var i = 0; i < all.length; i++) {
  23646. all[i] = self._mark(all[i]);
  23647. }
  23648. if (self.nodir) {
  23649. all = all.filter(function (e) {
  23650. var notDir = !(/\/$/.test(e));
  23651. var c = self.cache[e] || self.cache[makeAbs(self, e)];
  23652. if (notDir && c)
  23653. notDir = c !== 'DIR' && !Array.isArray(c);
  23654. return notDir
  23655. });
  23656. }
  23657. }
  23658. if (self.ignore.length)
  23659. all = all.filter(function(m) {
  23660. return !isIgnored$2(self, m)
  23661. });
  23662. self.found = all;
  23663. }
  23664. function mark (self, p) {
  23665. var abs = makeAbs(self, p);
  23666. var c = self.cache[abs];
  23667. var m = p;
  23668. if (c) {
  23669. var isDir = c === 'DIR' || Array.isArray(c);
  23670. var slash = p.slice(-1) === '/';
  23671. if (isDir && !slash)
  23672. m += '/';
  23673. else if (!isDir && slash)
  23674. m = m.slice(0, -1);
  23675. if (m !== p) {
  23676. var mabs = makeAbs(self, m);
  23677. self.statCache[mabs] = self.statCache[abs];
  23678. self.cache[mabs] = self.cache[abs];
  23679. }
  23680. }
  23681. return m
  23682. }
  23683. // lotta situps...
  23684. function makeAbs (self, f) {
  23685. var abs = f;
  23686. if (f.charAt(0) === '/') {
  23687. abs = path$5.join(self.root, f);
  23688. } else if (pathIsAbsolute(f) || f === '') {
  23689. abs = f;
  23690. } else if (self.changedCwd) {
  23691. abs = path$5.resolve(self.cwd, f);
  23692. } else {
  23693. abs = path$5.resolve(f);
  23694. }
  23695. if (process.platform === 'win32')
  23696. abs = abs.replace(/\\/g, '/');
  23697. return abs
  23698. }
  23699. // Return true, if pattern ends with globstar '**', for the accompanying parent directory.
  23700. // Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
  23701. function isIgnored$2 (self, path) {
  23702. if (!self.ignore.length)
  23703. return false
  23704. return self.ignore.some(function(item) {
  23705. return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
  23706. })
  23707. }
  23708. function childrenIgnored$2 (self, path) {
  23709. if (!self.ignore.length)
  23710. return false
  23711. return self.ignore.some(function(item) {
  23712. return !!(item.gmatcher && item.gmatcher.match(path))
  23713. })
  23714. }
  23715. var common$2 = {
  23716. setopts: setopts_1,
  23717. ownProp: ownProp_1,
  23718. makeAbs: makeAbs_1,
  23719. finish: finish_1,
  23720. mark: mark_1,
  23721. isIgnored: isIgnored_1,
  23722. childrenIgnored: childrenIgnored_1
  23723. };
  23724. var sync = globSync;
  23725. globSync.GlobSync = GlobSync$1;
  23726. var setopts$1 = common$2.setopts;
  23727. var ownProp$1 = common$2.ownProp;
  23728. var childrenIgnored$1 = common$2.childrenIgnored;
  23729. var isIgnored$1 = common$2.isIgnored;
  23730. function globSync (pattern, options) {
  23731. if (typeof options === 'function' || arguments.length === 3)
  23732. throw new TypeError('callback provided to sync glob\n'+
  23733. 'See: https://github.com/isaacs/node-glob/issues/167')
  23734. return new GlobSync$1(pattern, options).found
  23735. }
  23736. function GlobSync$1 (pattern, options) {
  23737. if (!pattern)
  23738. throw new Error('must provide pattern')
  23739. if (typeof options === 'function' || arguments.length === 3)
  23740. throw new TypeError('callback provided to sync glob\n'+
  23741. 'See: https://github.com/isaacs/node-glob/issues/167')
  23742. if (!(this instanceof GlobSync$1))
  23743. return new GlobSync$1(pattern, options)
  23744. setopts$1(this, pattern, options);
  23745. if (this.noprocess)
  23746. return this
  23747. var n = this.minimatch.set.length;
  23748. this.matches = new Array(n);
  23749. for (var i = 0; i < n; i ++) {
  23750. this._process(this.minimatch.set[i], i, false);
  23751. }
  23752. this._finish();
  23753. }
  23754. GlobSync$1.prototype._finish = function () {
  23755. assert_1.ok(this instanceof GlobSync$1);
  23756. if (this.realpath) {
  23757. var self = this;
  23758. this.matches.forEach(function (matchset, index) {
  23759. var set = self.matches[index] = Object.create(null);
  23760. for (var p in matchset) {
  23761. try {
  23762. p = self._makeAbs(p);
  23763. var real = fs_realpath.realpathSync(p, self.realpathCache);
  23764. set[real] = true;
  23765. } catch (er) {
  23766. if (er.syscall === 'stat')
  23767. set[self._makeAbs(p)] = true;
  23768. else
  23769. throw er
  23770. }
  23771. }
  23772. });
  23773. }
  23774. common$2.finish(this);
  23775. };
  23776. GlobSync$1.prototype._process = function (pattern, index, inGlobStar) {
  23777. assert_1.ok(this instanceof GlobSync$1);
  23778. // Get the first [n] parts of pattern that are all strings.
  23779. var n = 0;
  23780. while (typeof pattern[n] === 'string') {
  23781. n ++;
  23782. }
  23783. // now n is the index of the first one that is *not* a string.
  23784. // See if there's anything else
  23785. var prefix;
  23786. switch (n) {
  23787. // if not, then this is rather simple
  23788. case pattern.length:
  23789. this._processSimple(pattern.join('/'), index);
  23790. return
  23791. case 0:
  23792. // pattern *starts* with some non-trivial item.
  23793. // going to readdir(cwd), but not include the prefix in matches.
  23794. prefix = null;
  23795. break
  23796. default:
  23797. // pattern has some string bits in the front.
  23798. // whatever it starts with, whether that's 'absolute' like /foo/bar,
  23799. // or 'relative' like '../baz'
  23800. prefix = pattern.slice(0, n).join('/');
  23801. break
  23802. }
  23803. var remain = pattern.slice(n);
  23804. // get the list of entries.
  23805. var read;
  23806. if (prefix === null)
  23807. read = '.';
  23808. else if (pathIsAbsolute(prefix) ||
  23809. pathIsAbsolute(pattern.map(function (p) {
  23810. return typeof p === 'string' ? p : '[*]'
  23811. }).join('/'))) {
  23812. if (!prefix || !pathIsAbsolute(prefix))
  23813. prefix = '/' + prefix;
  23814. read = prefix;
  23815. } else
  23816. read = prefix;
  23817. var abs = this._makeAbs(read);
  23818. //if ignored, skip processing
  23819. if (childrenIgnored$1(this, read))
  23820. return
  23821. var isGlobStar = remain[0] === minimatch_1.GLOBSTAR;
  23822. if (isGlobStar)
  23823. this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
  23824. else
  23825. this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
  23826. };
  23827. GlobSync$1.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
  23828. var entries = this._readdir(abs, inGlobStar);
  23829. // if the abs isn't a dir, then nothing can match!
  23830. if (!entries)
  23831. return
  23832. // It will only match dot entries if it starts with a dot, or if
  23833. // dot is set. Stuff like @(.foo|.bar) isn't allowed.
  23834. var pn = remain[0];
  23835. var negate = !!this.minimatch.negate;
  23836. var rawGlob = pn._glob;
  23837. var dotOk = this.dot || rawGlob.charAt(0) === '.';
  23838. var matchedEntries = [];
  23839. for (var i = 0; i < entries.length; i++) {
  23840. var e = entries[i];
  23841. if (e.charAt(0) !== '.' || dotOk) {
  23842. var m;
  23843. if (negate && !prefix) {
  23844. m = !e.match(pn);
  23845. } else {
  23846. m = e.match(pn);
  23847. }
  23848. if (m)
  23849. matchedEntries.push(e);
  23850. }
  23851. }
  23852. var len = matchedEntries.length;
  23853. // If there are no matched entries, then nothing matches.
  23854. if (len === 0)
  23855. return
  23856. // if this is the last remaining pattern bit, then no need for
  23857. // an additional stat *unless* the user has specified mark or
  23858. // stat explicitly. We know they exist, since readdir returned
  23859. // them.
  23860. if (remain.length === 1 && !this.mark && !this.stat) {
  23861. if (!this.matches[index])
  23862. this.matches[index] = Object.create(null);
  23863. for (var i = 0; i < len; i ++) {
  23864. var e = matchedEntries[i];
  23865. if (prefix) {
  23866. if (prefix.slice(-1) !== '/')
  23867. e = prefix + '/' + e;
  23868. else
  23869. e = prefix + e;
  23870. }
  23871. if (e.charAt(0) === '/' && !this.nomount) {
  23872. e = path$5.join(this.root, e);
  23873. }
  23874. this._emitMatch(index, e);
  23875. }
  23876. // This was the last one, and no stats were needed
  23877. return
  23878. }
  23879. // now test all matched entries as stand-ins for that part
  23880. // of the pattern.
  23881. remain.shift();
  23882. for (var i = 0; i < len; i ++) {
  23883. var e = matchedEntries[i];
  23884. var newPattern;
  23885. if (prefix)
  23886. newPattern = [prefix, e];
  23887. else
  23888. newPattern = [e];
  23889. this._process(newPattern.concat(remain), index, inGlobStar);
  23890. }
  23891. };
  23892. GlobSync$1.prototype._emitMatch = function (index, e) {
  23893. if (isIgnored$1(this, e))
  23894. return
  23895. var abs = this._makeAbs(e);
  23896. if (this.mark)
  23897. e = this._mark(e);
  23898. if (this.absolute) {
  23899. e = abs;
  23900. }
  23901. if (this.matches[index][e])
  23902. return
  23903. if (this.nodir) {
  23904. var c = this.cache[abs];
  23905. if (c === 'DIR' || Array.isArray(c))
  23906. return
  23907. }
  23908. this.matches[index][e] = true;
  23909. if (this.stat)
  23910. this._stat(e);
  23911. };
  23912. GlobSync$1.prototype._readdirInGlobStar = function (abs) {
  23913. // follow all symlinked directories forever
  23914. // just proceed as if this is a non-globstar situation
  23915. if (this.follow)
  23916. return this._readdir(abs, false)
  23917. var entries;
  23918. var lstat;
  23919. try {
  23920. lstat = this.fs.lstatSync(abs);
  23921. } catch (er) {
  23922. if (er.code === 'ENOENT') {
  23923. // lstat failed, doesn't exist
  23924. return null
  23925. }
  23926. }
  23927. var isSym = lstat && lstat.isSymbolicLink();
  23928. this.symlinks[abs] = isSym;
  23929. // If it's not a symlink or a dir, then it's definitely a regular file.
  23930. // don't bother doing a readdir in that case.
  23931. if (!isSym && lstat && !lstat.isDirectory())
  23932. this.cache[abs] = 'FILE';
  23933. else
  23934. entries = this._readdir(abs, false);
  23935. return entries
  23936. };
  23937. GlobSync$1.prototype._readdir = function (abs, inGlobStar) {
  23938. if (inGlobStar && !ownProp$1(this.symlinks, abs))
  23939. return this._readdirInGlobStar(abs)
  23940. if (ownProp$1(this.cache, abs)) {
  23941. var c = this.cache[abs];
  23942. if (!c || c === 'FILE')
  23943. return null
  23944. if (Array.isArray(c))
  23945. return c
  23946. }
  23947. try {
  23948. return this._readdirEntries(abs, this.fs.readdirSync(abs))
  23949. } catch (er) {
  23950. this._readdirError(abs, er);
  23951. return null
  23952. }
  23953. };
  23954. GlobSync$1.prototype._readdirEntries = function (abs, entries) {
  23955. // if we haven't asked to stat everything, then just
  23956. // assume that everything in there exists, so we can avoid
  23957. // having to stat it a second time.
  23958. if (!this.mark && !this.stat) {
  23959. for (var i = 0; i < entries.length; i ++) {
  23960. var e = entries[i];
  23961. if (abs === '/')
  23962. e = abs + e;
  23963. else
  23964. e = abs + '/' + e;
  23965. this.cache[e] = true;
  23966. }
  23967. }
  23968. this.cache[abs] = entries;
  23969. // mark and cache dir-ness
  23970. return entries
  23971. };
  23972. GlobSync$1.prototype._readdirError = function (f, er) {
  23973. // handle errors, and cache the information
  23974. switch (er.code) {
  23975. case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
  23976. case 'ENOTDIR': // totally normal. means it *does* exist.
  23977. var abs = this._makeAbs(f);
  23978. this.cache[abs] = 'FILE';
  23979. if (abs === this.cwdAbs) {
  23980. var error = new Error(er.code + ' invalid cwd ' + this.cwd);
  23981. error.path = this.cwd;
  23982. error.code = er.code;
  23983. throw error
  23984. }
  23985. break
  23986. case 'ENOENT': // not terribly unusual
  23987. case 'ELOOP':
  23988. case 'ENAMETOOLONG':
  23989. case 'UNKNOWN':
  23990. this.cache[this._makeAbs(f)] = false;
  23991. break
  23992. default: // some unusual error. Treat as failure.
  23993. this.cache[this._makeAbs(f)] = false;
  23994. if (this.strict)
  23995. throw er
  23996. if (!this.silent)
  23997. console.error('glob error', er);
  23998. break
  23999. }
  24000. };
  24001. GlobSync$1.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
  24002. var entries = this._readdir(abs, inGlobStar);
  24003. // no entries means not a dir, so it can never have matches
  24004. // foo.txt/** doesn't match foo.txt
  24005. if (!entries)
  24006. return
  24007. // test without the globstar, and with every child both below
  24008. // and replacing the globstar.
  24009. var remainWithoutGlobStar = remain.slice(1);
  24010. var gspref = prefix ? [ prefix ] : [];
  24011. var noGlobStar = gspref.concat(remainWithoutGlobStar);
  24012. // the noGlobStar pattern exits the inGlobStar state
  24013. this._process(noGlobStar, index, false);
  24014. var len = entries.length;
  24015. var isSym = this.symlinks[abs];
  24016. // If it's a symlink, and we're in a globstar, then stop
  24017. if (isSym && inGlobStar)
  24018. return
  24019. for (var i = 0; i < len; i++) {
  24020. var e = entries[i];
  24021. if (e.charAt(0) === '.' && !this.dot)
  24022. continue
  24023. // these two cases enter the inGlobStar state
  24024. var instead = gspref.concat(entries[i], remainWithoutGlobStar);
  24025. this._process(instead, index, true);
  24026. var below = gspref.concat(entries[i], remain);
  24027. this._process(below, index, true);
  24028. }
  24029. };
  24030. GlobSync$1.prototype._processSimple = function (prefix, index) {
  24031. // XXX review this. Shouldn't it be doing the mounting etc
  24032. // before doing stat? kinda weird?
  24033. var exists = this._stat(prefix);
  24034. if (!this.matches[index])
  24035. this.matches[index] = Object.create(null);
  24036. // If it doesn't exist, then just mark the lack of results
  24037. if (!exists)
  24038. return
  24039. if (prefix && pathIsAbsolute(prefix) && !this.nomount) {
  24040. var trail = /[\/\\]$/.test(prefix);
  24041. if (prefix.charAt(0) === '/') {
  24042. prefix = path$5.join(this.root, prefix);
  24043. } else {
  24044. prefix = path$5.resolve(this.root, prefix);
  24045. if (trail)
  24046. prefix += '/';
  24047. }
  24048. }
  24049. if (process.platform === 'win32')
  24050. prefix = prefix.replace(/\\/g, '/');
  24051. // Mark this as a match
  24052. this._emitMatch(index, prefix);
  24053. };
  24054. // Returns either 'DIR', 'FILE', or false
  24055. GlobSync$1.prototype._stat = function (f) {
  24056. var abs = this._makeAbs(f);
  24057. var needDir = f.slice(-1) === '/';
  24058. if (f.length > this.maxLength)
  24059. return false
  24060. if (!this.stat && ownProp$1(this.cache, abs)) {
  24061. var c = this.cache[abs];
  24062. if (Array.isArray(c))
  24063. c = 'DIR';
  24064. // It exists, but maybe not how we need it
  24065. if (!needDir || c === 'DIR')
  24066. return c
  24067. if (needDir && c === 'FILE')
  24068. return false
  24069. // otherwise we have to stat, because maybe c=true
  24070. // if we know it exists, but not what it is.
  24071. }
  24072. var stat = this.statCache[abs];
  24073. if (!stat) {
  24074. var lstat;
  24075. try {
  24076. lstat = this.fs.lstatSync(abs);
  24077. } catch (er) {
  24078. if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
  24079. this.statCache[abs] = false;
  24080. return false
  24081. }
  24082. }
  24083. if (lstat && lstat.isSymbolicLink()) {
  24084. try {
  24085. stat = this.fs.statSync(abs);
  24086. } catch (er) {
  24087. stat = lstat;
  24088. }
  24089. } else {
  24090. stat = lstat;
  24091. }
  24092. }
  24093. this.statCache[abs] = stat;
  24094. var c = true;
  24095. if (stat)
  24096. c = stat.isDirectory() ? 'DIR' : 'FILE';
  24097. this.cache[abs] = this.cache[abs] || c;
  24098. if (needDir && c === 'FILE')
  24099. return false
  24100. return c
  24101. };
  24102. GlobSync$1.prototype._mark = function (p) {
  24103. return common$2.mark(this, p)
  24104. };
  24105. GlobSync$1.prototype._makeAbs = function (f) {
  24106. return common$2.makeAbs(this, f)
  24107. };
  24108. // Returns a wrapper function that returns a wrapped callback
  24109. // The wrapper function should do some stuff, and return a
  24110. // presumably different callback function.
  24111. // This makes sure that own properties are retained, so that
  24112. // decorations and such are not lost along the way.
  24113. var wrappy_1 = wrappy;
  24114. function wrappy (fn, cb) {
  24115. if (fn && cb) return wrappy(fn)(cb)
  24116. if (typeof fn !== 'function')
  24117. throw new TypeError('need wrapper function')
  24118. Object.keys(fn).forEach(function (k) {
  24119. wrapper[k] = fn[k];
  24120. });
  24121. return wrapper
  24122. function wrapper() {
  24123. var args = new Array(arguments.length);
  24124. for (var i = 0; i < args.length; i++) {
  24125. args[i] = arguments[i];
  24126. }
  24127. var ret = fn.apply(this, args);
  24128. var cb = args[args.length-1];
  24129. if (typeof ret === 'function' && ret !== cb) {
  24130. Object.keys(cb).forEach(function (k) {
  24131. ret[k] = cb[k];
  24132. });
  24133. }
  24134. return ret
  24135. }
  24136. }
  24137. var once_1 = wrappy_1(once);
  24138. var strict = wrappy_1(onceStrict);
  24139. once.proto = once(function () {
  24140. Object.defineProperty(Function.prototype, 'once', {
  24141. value: function () {
  24142. return once(this)
  24143. },
  24144. configurable: true
  24145. });
  24146. Object.defineProperty(Function.prototype, 'onceStrict', {
  24147. value: function () {
  24148. return onceStrict(this)
  24149. },
  24150. configurable: true
  24151. });
  24152. });
  24153. function once (fn) {
  24154. var f = function () {
  24155. if (f.called) return f.value
  24156. f.called = true;
  24157. return f.value = fn.apply(this, arguments)
  24158. };
  24159. f.called = false;
  24160. return f
  24161. }
  24162. function onceStrict (fn) {
  24163. var f = function () {
  24164. if (f.called)
  24165. throw new Error(f.onceError)
  24166. f.called = true;
  24167. return f.value = fn.apply(this, arguments)
  24168. };
  24169. var name = fn.name || 'Function wrapped with `once`';
  24170. f.onceError = name + " shouldn't be called more than once";
  24171. f.called = false;
  24172. return f
  24173. }
  24174. once_1.strict = strict;
  24175. var reqs = Object.create(null);
  24176. var inflight_1 = wrappy_1(inflight);
  24177. function inflight (key, cb) {
  24178. if (reqs[key]) {
  24179. reqs[key].push(cb);
  24180. return null
  24181. } else {
  24182. reqs[key] = [cb];
  24183. return makeres(key)
  24184. }
  24185. }
  24186. function makeres (key) {
  24187. return once_1(function RES () {
  24188. var cbs = reqs[key];
  24189. var len = cbs.length;
  24190. var args = slice(arguments);
  24191. // XXX It's somewhat ambiguous whether a new callback added in this
  24192. // pass should be queued for later execution if something in the
  24193. // list of callbacks throws, or if it should just be discarded.
  24194. // However, it's such an edge case that it hardly matters, and either
  24195. // choice is likely as surprising as the other.
  24196. // As it happens, we do go ahead and schedule it for later execution.
  24197. try {
  24198. for (var i = 0; i < len; i++) {
  24199. cbs[i].apply(null, args);
  24200. }
  24201. } finally {
  24202. if (cbs.length > len) {
  24203. // added more in the interim.
  24204. // de-zalgo, just in case, but don't call again.
  24205. cbs.splice(0, len);
  24206. process.nextTick(function () {
  24207. RES.apply(null, args);
  24208. });
  24209. } else {
  24210. delete reqs[key];
  24211. }
  24212. }
  24213. })
  24214. }
  24215. function slice (args) {
  24216. var length = args.length;
  24217. var array = [];
  24218. for (var i = 0; i < length; i++) array[i] = args[i];
  24219. return array
  24220. }
  24221. // Approach:
  24222. //
  24223. // 1. Get the minimatch set
  24224. // 2. For each pattern in the set, PROCESS(pattern, false)
  24225. // 3. Store matches per-set, then uniq them
  24226. //
  24227. // PROCESS(pattern, inGlobStar)
  24228. // Get the first [n] items from pattern that are all strings
  24229. // Join these together. This is PREFIX.
  24230. // If there is no more remaining, then stat(PREFIX) and
  24231. // add to matches if it succeeds. END.
  24232. //
  24233. // If inGlobStar and PREFIX is symlink and points to dir
  24234. // set ENTRIES = []
  24235. // else readdir(PREFIX) as ENTRIES
  24236. // If fail, END
  24237. //
  24238. // with ENTRIES
  24239. // If pattern[n] is GLOBSTAR
  24240. // // handle the case where the globstar match is empty
  24241. // // by pruning it out, and testing the resulting pattern
  24242. // PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
  24243. // // handle other cases.
  24244. // for ENTRY in ENTRIES (not dotfiles)
  24245. // // attach globstar + tail onto the entry
  24246. // // Mark that this entry is a globstar match
  24247. // PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
  24248. //
  24249. // else // not globstar
  24250. // for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
  24251. // Test ENTRY against pattern[n]
  24252. // If fails, continue
  24253. // If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
  24254. //
  24255. // Caveat:
  24256. // Cache all stats and readdirs results to minimize syscall. Since all
  24257. // we ever care about is existence and directory-ness, we can just keep
  24258. // `true` for files, and [children,...] for directories, or `false` for
  24259. // things that don't exist.
  24260. var glob_1 = glob;
  24261. var EE = events.EventEmitter;
  24262. var setopts = common$2.setopts;
  24263. var ownProp = common$2.ownProp;
  24264. var childrenIgnored = common$2.childrenIgnored;
  24265. var isIgnored = common$2.isIgnored;
  24266. function glob (pattern, options, cb) {
  24267. if (typeof options === 'function') cb = options, options = {};
  24268. if (!options) options = {};
  24269. if (options.sync) {
  24270. if (cb)
  24271. throw new TypeError('callback provided to sync glob')
  24272. return sync(pattern, options)
  24273. }
  24274. return new Glob(pattern, options, cb)
  24275. }
  24276. glob.sync = sync;
  24277. var GlobSync = glob.GlobSync = sync.GlobSync;
  24278. // old api surface
  24279. glob.glob = glob;
  24280. function extend (origin, add) {
  24281. if (add === null || typeof add !== 'object') {
  24282. return origin
  24283. }
  24284. var keys = Object.keys(add);
  24285. var i = keys.length;
  24286. while (i--) {
  24287. origin[keys[i]] = add[keys[i]];
  24288. }
  24289. return origin
  24290. }
  24291. glob.hasMagic = function (pattern, options_) {
  24292. var options = extend({}, options_);
  24293. options.noprocess = true;
  24294. var g = new Glob(pattern, options);
  24295. var set = g.minimatch.set;
  24296. if (!pattern)
  24297. return false
  24298. if (set.length > 1)
  24299. return true
  24300. for (var j = 0; j < set[0].length; j++) {
  24301. if (typeof set[0][j] !== 'string')
  24302. return true
  24303. }
  24304. return false
  24305. };
  24306. glob.Glob = Glob;
  24307. inherits$1(Glob, EE);
  24308. function Glob (pattern, options, cb) {
  24309. if (typeof options === 'function') {
  24310. cb = options;
  24311. options = null;
  24312. }
  24313. if (options && options.sync) {
  24314. if (cb)
  24315. throw new TypeError('callback provided to sync glob')
  24316. return new GlobSync(pattern, options)
  24317. }
  24318. if (!(this instanceof Glob))
  24319. return new Glob(pattern, options, cb)
  24320. setopts(this, pattern, options);
  24321. this._didRealPath = false;
  24322. // process each pattern in the minimatch set
  24323. var n = this.minimatch.set.length;
  24324. // The matches are stored as {<filename>: true,...} so that
  24325. // duplicates are automagically pruned.
  24326. // Later, we do an Object.keys() on these.
  24327. // Keep them as a list so we can fill in when nonull is set.
  24328. this.matches = new Array(n);
  24329. if (typeof cb === 'function') {
  24330. cb = once_1(cb);
  24331. this.on('error', cb);
  24332. this.on('end', function (matches) {
  24333. cb(null, matches);
  24334. });
  24335. }
  24336. var self = this;
  24337. this._processing = 0;
  24338. this._emitQueue = [];
  24339. this._processQueue = [];
  24340. this.paused = false;
  24341. if (this.noprocess)
  24342. return this
  24343. if (n === 0)
  24344. return done()
  24345. var sync = true;
  24346. for (var i = 0; i < n; i ++) {
  24347. this._process(this.minimatch.set[i], i, false, done);
  24348. }
  24349. sync = false;
  24350. function done () {
  24351. --self._processing;
  24352. if (self._processing <= 0) {
  24353. if (sync) {
  24354. process.nextTick(function () {
  24355. self._finish();
  24356. });
  24357. } else {
  24358. self._finish();
  24359. }
  24360. }
  24361. }
  24362. }
  24363. Glob.prototype._finish = function () {
  24364. assert_1(this instanceof Glob);
  24365. if (this.aborted)
  24366. return
  24367. if (this.realpath && !this._didRealpath)
  24368. return this._realpath()
  24369. common$2.finish(this);
  24370. this.emit('end', this.found);
  24371. };
  24372. Glob.prototype._realpath = function () {
  24373. if (this._didRealpath)
  24374. return
  24375. this._didRealpath = true;
  24376. var n = this.matches.length;
  24377. if (n === 0)
  24378. return this._finish()
  24379. var self = this;
  24380. for (var i = 0; i < this.matches.length; i++)
  24381. this._realpathSet(i, next);
  24382. function next () {
  24383. if (--n === 0)
  24384. self._finish();
  24385. }
  24386. };
  24387. Glob.prototype._realpathSet = function (index, cb) {
  24388. var matchset = this.matches[index];
  24389. if (!matchset)
  24390. return cb()
  24391. var found = Object.keys(matchset);
  24392. var self = this;
  24393. var n = found.length;
  24394. if (n === 0)
  24395. return cb()
  24396. var set = this.matches[index] = Object.create(null);
  24397. found.forEach(function (p, i) {
  24398. // If there's a problem with the stat, then it means that
  24399. // one or more of the links in the realpath couldn't be
  24400. // resolved. just return the abs value in that case.
  24401. p = self._makeAbs(p);
  24402. fs_realpath.realpath(p, self.realpathCache, function (er, real) {
  24403. if (!er)
  24404. set[real] = true;
  24405. else if (er.syscall === 'stat')
  24406. set[p] = true;
  24407. else
  24408. self.emit('error', er); // srsly wtf right here
  24409. if (--n === 0) {
  24410. self.matches[index] = set;
  24411. cb();
  24412. }
  24413. });
  24414. });
  24415. };
  24416. Glob.prototype._mark = function (p) {
  24417. return common$2.mark(this, p)
  24418. };
  24419. Glob.prototype._makeAbs = function (f) {
  24420. return common$2.makeAbs(this, f)
  24421. };
  24422. Glob.prototype.abort = function () {
  24423. this.aborted = true;
  24424. this.emit('abort');
  24425. };
  24426. Glob.prototype.pause = function () {
  24427. if (!this.paused) {
  24428. this.paused = true;
  24429. this.emit('pause');
  24430. }
  24431. };
  24432. Glob.prototype.resume = function () {
  24433. if (this.paused) {
  24434. this.emit('resume');
  24435. this.paused = false;
  24436. if (this._emitQueue.length) {
  24437. var eq = this._emitQueue.slice(0);
  24438. this._emitQueue.length = 0;
  24439. for (var i = 0; i < eq.length; i ++) {
  24440. var e = eq[i];
  24441. this._emitMatch(e[0], e[1]);
  24442. }
  24443. }
  24444. if (this._processQueue.length) {
  24445. var pq = this._processQueue.slice(0);
  24446. this._processQueue.length = 0;
  24447. for (var i = 0; i < pq.length; i ++) {
  24448. var p = pq[i];
  24449. this._processing--;
  24450. this._process(p[0], p[1], p[2], p[3]);
  24451. }
  24452. }
  24453. }
  24454. };
  24455. Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
  24456. assert_1(this instanceof Glob);
  24457. assert_1(typeof cb === 'function');
  24458. if (this.aborted)
  24459. return
  24460. this._processing++;
  24461. if (this.paused) {
  24462. this._processQueue.push([pattern, index, inGlobStar, cb]);
  24463. return
  24464. }
  24465. //console.error('PROCESS %d', this._processing, pattern)
  24466. // Get the first [n] parts of pattern that are all strings.
  24467. var n = 0;
  24468. while (typeof pattern[n] === 'string') {
  24469. n ++;
  24470. }
  24471. // now n is the index of the first one that is *not* a string.
  24472. // see if there's anything else
  24473. var prefix;
  24474. switch (n) {
  24475. // if not, then this is rather simple
  24476. case pattern.length:
  24477. this._processSimple(pattern.join('/'), index, cb);
  24478. return
  24479. case 0:
  24480. // pattern *starts* with some non-trivial item.
  24481. // going to readdir(cwd), but not include the prefix in matches.
  24482. prefix = null;
  24483. break
  24484. default:
  24485. // pattern has some string bits in the front.
  24486. // whatever it starts with, whether that's 'absolute' like /foo/bar,
  24487. // or 'relative' like '../baz'
  24488. prefix = pattern.slice(0, n).join('/');
  24489. break
  24490. }
  24491. var remain = pattern.slice(n);
  24492. // get the list of entries.
  24493. var read;
  24494. if (prefix === null)
  24495. read = '.';
  24496. else if (pathIsAbsolute(prefix) ||
  24497. pathIsAbsolute(pattern.map(function (p) {
  24498. return typeof p === 'string' ? p : '[*]'
  24499. }).join('/'))) {
  24500. if (!prefix || !pathIsAbsolute(prefix))
  24501. prefix = '/' + prefix;
  24502. read = prefix;
  24503. } else
  24504. read = prefix;
  24505. var abs = this._makeAbs(read);
  24506. //if ignored, skip _processing
  24507. if (childrenIgnored(this, read))
  24508. return cb()
  24509. var isGlobStar = remain[0] === minimatch_1.GLOBSTAR;
  24510. if (isGlobStar)
  24511. this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
  24512. else
  24513. this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
  24514. };
  24515. Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
  24516. var self = this;
  24517. this._readdir(abs, inGlobStar, function (er, entries) {
  24518. return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
  24519. });
  24520. };
  24521. Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
  24522. // if the abs isn't a dir, then nothing can match!
  24523. if (!entries)
  24524. return cb()
  24525. // It will only match dot entries if it starts with a dot, or if
  24526. // dot is set. Stuff like @(.foo|.bar) isn't allowed.
  24527. var pn = remain[0];
  24528. var negate = !!this.minimatch.negate;
  24529. var rawGlob = pn._glob;
  24530. var dotOk = this.dot || rawGlob.charAt(0) === '.';
  24531. var matchedEntries = [];
  24532. for (var i = 0; i < entries.length; i++) {
  24533. var e = entries[i];
  24534. if (e.charAt(0) !== '.' || dotOk) {
  24535. var m;
  24536. if (negate && !prefix) {
  24537. m = !e.match(pn);
  24538. } else {
  24539. m = e.match(pn);
  24540. }
  24541. if (m)
  24542. matchedEntries.push(e);
  24543. }
  24544. }
  24545. //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
  24546. var len = matchedEntries.length;
  24547. // If there are no matched entries, then nothing matches.
  24548. if (len === 0)
  24549. return cb()
  24550. // if this is the last remaining pattern bit, then no need for
  24551. // an additional stat *unless* the user has specified mark or
  24552. // stat explicitly. We know they exist, since readdir returned
  24553. // them.
  24554. if (remain.length === 1 && !this.mark && !this.stat) {
  24555. if (!this.matches[index])
  24556. this.matches[index] = Object.create(null);
  24557. for (var i = 0; i < len; i ++) {
  24558. var e = matchedEntries[i];
  24559. if (prefix) {
  24560. if (prefix !== '/')
  24561. e = prefix + '/' + e;
  24562. else
  24563. e = prefix + e;
  24564. }
  24565. if (e.charAt(0) === '/' && !this.nomount) {
  24566. e = path$5.join(this.root, e);
  24567. }
  24568. this._emitMatch(index, e);
  24569. }
  24570. // This was the last one, and no stats were needed
  24571. return cb()
  24572. }
  24573. // now test all matched entries as stand-ins for that part
  24574. // of the pattern.
  24575. remain.shift();
  24576. for (var i = 0; i < len; i ++) {
  24577. var e = matchedEntries[i];
  24578. if (prefix) {
  24579. if (prefix !== '/')
  24580. e = prefix + '/' + e;
  24581. else
  24582. e = prefix + e;
  24583. }
  24584. this._process([e].concat(remain), index, inGlobStar, cb);
  24585. }
  24586. cb();
  24587. };
  24588. Glob.prototype._emitMatch = function (index, e) {
  24589. if (this.aborted)
  24590. return
  24591. if (isIgnored(this, e))
  24592. return
  24593. if (this.paused) {
  24594. this._emitQueue.push([index, e]);
  24595. return
  24596. }
  24597. var abs = pathIsAbsolute(e) ? e : this._makeAbs(e);
  24598. if (this.mark)
  24599. e = this._mark(e);
  24600. if (this.absolute)
  24601. e = abs;
  24602. if (this.matches[index][e])
  24603. return
  24604. if (this.nodir) {
  24605. var c = this.cache[abs];
  24606. if (c === 'DIR' || Array.isArray(c))
  24607. return
  24608. }
  24609. this.matches[index][e] = true;
  24610. var st = this.statCache[abs];
  24611. if (st)
  24612. this.emit('stat', e, st);
  24613. this.emit('match', e);
  24614. };
  24615. Glob.prototype._readdirInGlobStar = function (abs, cb) {
  24616. if (this.aborted)
  24617. return
  24618. // follow all symlinked directories forever
  24619. // just proceed as if this is a non-globstar situation
  24620. if (this.follow)
  24621. return this._readdir(abs, false, cb)
  24622. var lstatkey = 'lstat\0' + abs;
  24623. var self = this;
  24624. var lstatcb = inflight_1(lstatkey, lstatcb_);
  24625. if (lstatcb)
  24626. self.fs.lstat(abs, lstatcb);
  24627. function lstatcb_ (er, lstat) {
  24628. if (er && er.code === 'ENOENT')
  24629. return cb()
  24630. var isSym = lstat && lstat.isSymbolicLink();
  24631. self.symlinks[abs] = isSym;
  24632. // If it's not a symlink or a dir, then it's definitely a regular file.
  24633. // don't bother doing a readdir in that case.
  24634. if (!isSym && lstat && !lstat.isDirectory()) {
  24635. self.cache[abs] = 'FILE';
  24636. cb();
  24637. } else
  24638. self._readdir(abs, false, cb);
  24639. }
  24640. };
  24641. Glob.prototype._readdir = function (abs, inGlobStar, cb) {
  24642. if (this.aborted)
  24643. return
  24644. cb = inflight_1('readdir\0'+abs+'\0'+inGlobStar, cb);
  24645. if (!cb)
  24646. return
  24647. //console.error('RD %j %j', +inGlobStar, abs)
  24648. if (inGlobStar && !ownProp(this.symlinks, abs))
  24649. return this._readdirInGlobStar(abs, cb)
  24650. if (ownProp(this.cache, abs)) {
  24651. var c = this.cache[abs];
  24652. if (!c || c === 'FILE')
  24653. return cb()
  24654. if (Array.isArray(c))
  24655. return cb(null, c)
  24656. }
  24657. var self = this;
  24658. self.fs.readdir(abs, readdirCb(this, abs, cb));
  24659. };
  24660. function readdirCb (self, abs, cb) {
  24661. return function (er, entries) {
  24662. if (er)
  24663. self._readdirError(abs, er, cb);
  24664. else
  24665. self._readdirEntries(abs, entries, cb);
  24666. }
  24667. }
  24668. Glob.prototype._readdirEntries = function (abs, entries, cb) {
  24669. if (this.aborted)
  24670. return
  24671. // if we haven't asked to stat everything, then just
  24672. // assume that everything in there exists, so we can avoid
  24673. // having to stat it a second time.
  24674. if (!this.mark && !this.stat) {
  24675. for (var i = 0; i < entries.length; i ++) {
  24676. var e = entries[i];
  24677. if (abs === '/')
  24678. e = abs + e;
  24679. else
  24680. e = abs + '/' + e;
  24681. this.cache[e] = true;
  24682. }
  24683. }
  24684. this.cache[abs] = entries;
  24685. return cb(null, entries)
  24686. };
  24687. Glob.prototype._readdirError = function (f, er, cb) {
  24688. if (this.aborted)
  24689. return
  24690. // handle errors, and cache the information
  24691. switch (er.code) {
  24692. case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
  24693. case 'ENOTDIR': // totally normal. means it *does* exist.
  24694. var abs = this._makeAbs(f);
  24695. this.cache[abs] = 'FILE';
  24696. if (abs === this.cwdAbs) {
  24697. var error = new Error(er.code + ' invalid cwd ' + this.cwd);
  24698. error.path = this.cwd;
  24699. error.code = er.code;
  24700. this.emit('error', error);
  24701. this.abort();
  24702. }
  24703. break
  24704. case 'ENOENT': // not terribly unusual
  24705. case 'ELOOP':
  24706. case 'ENAMETOOLONG':
  24707. case 'UNKNOWN':
  24708. this.cache[this._makeAbs(f)] = false;
  24709. break
  24710. default: // some unusual error. Treat as failure.
  24711. this.cache[this._makeAbs(f)] = false;
  24712. if (this.strict) {
  24713. this.emit('error', er);
  24714. // If the error is handled, then we abort
  24715. // if not, we threw out of here
  24716. this.abort();
  24717. }
  24718. if (!this.silent)
  24719. console.error('glob error', er);
  24720. break
  24721. }
  24722. return cb()
  24723. };
  24724. Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
  24725. var self = this;
  24726. this._readdir(abs, inGlobStar, function (er, entries) {
  24727. self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
  24728. });
  24729. };
  24730. Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
  24731. //console.error('pgs2', prefix, remain[0], entries)
  24732. // no entries means not a dir, so it can never have matches
  24733. // foo.txt/** doesn't match foo.txt
  24734. if (!entries)
  24735. return cb()
  24736. // test without the globstar, and with every child both below
  24737. // and replacing the globstar.
  24738. var remainWithoutGlobStar = remain.slice(1);
  24739. var gspref = prefix ? [ prefix ] : [];
  24740. var noGlobStar = gspref.concat(remainWithoutGlobStar);
  24741. // the noGlobStar pattern exits the inGlobStar state
  24742. this._process(noGlobStar, index, false, cb);
  24743. var isSym = this.symlinks[abs];
  24744. var len = entries.length;
  24745. // If it's a symlink, and we're in a globstar, then stop
  24746. if (isSym && inGlobStar)
  24747. return cb()
  24748. for (var i = 0; i < len; i++) {
  24749. var e = entries[i];
  24750. if (e.charAt(0) === '.' && !this.dot)
  24751. continue
  24752. // these two cases enter the inGlobStar state
  24753. var instead = gspref.concat(entries[i], remainWithoutGlobStar);
  24754. this._process(instead, index, true, cb);
  24755. var below = gspref.concat(entries[i], remain);
  24756. this._process(below, index, true, cb);
  24757. }
  24758. cb();
  24759. };
  24760. Glob.prototype._processSimple = function (prefix, index, cb) {
  24761. // XXX review this. Shouldn't it be doing the mounting etc
  24762. // before doing stat? kinda weird?
  24763. var self = this;
  24764. this._stat(prefix, function (er, exists) {
  24765. self._processSimple2(prefix, index, er, exists, cb);
  24766. });
  24767. };
  24768. Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
  24769. //console.error('ps2', prefix, exists)
  24770. if (!this.matches[index])
  24771. this.matches[index] = Object.create(null);
  24772. // If it doesn't exist, then just mark the lack of results
  24773. if (!exists)
  24774. return cb()
  24775. if (prefix && pathIsAbsolute(prefix) && !this.nomount) {
  24776. var trail = /[\/\\]$/.test(prefix);
  24777. if (prefix.charAt(0) === '/') {
  24778. prefix = path$5.join(this.root, prefix);
  24779. } else {
  24780. prefix = path$5.resolve(this.root, prefix);
  24781. if (trail)
  24782. prefix += '/';
  24783. }
  24784. }
  24785. if (process.platform === 'win32')
  24786. prefix = prefix.replace(/\\/g, '/');
  24787. // Mark this as a match
  24788. this._emitMatch(index, prefix);
  24789. cb();
  24790. };
  24791. // Returns either 'DIR', 'FILE', or false
  24792. Glob.prototype._stat = function (f, cb) {
  24793. var abs = this._makeAbs(f);
  24794. var needDir = f.slice(-1) === '/';
  24795. if (f.length > this.maxLength)
  24796. return cb()
  24797. if (!this.stat && ownProp(this.cache, abs)) {
  24798. var c = this.cache[abs];
  24799. if (Array.isArray(c))
  24800. c = 'DIR';
  24801. // It exists, but maybe not how we need it
  24802. if (!needDir || c === 'DIR')
  24803. return cb(null, c)
  24804. if (needDir && c === 'FILE')
  24805. return cb()
  24806. // otherwise we have to stat, because maybe c=true
  24807. // if we know it exists, but not what it is.
  24808. }
  24809. var stat = this.statCache[abs];
  24810. if (stat !== undefined) {
  24811. if (stat === false)
  24812. return cb(null, stat)
  24813. else {
  24814. var type = stat.isDirectory() ? 'DIR' : 'FILE';
  24815. if (needDir && type === 'FILE')
  24816. return cb()
  24817. else
  24818. return cb(null, type, stat)
  24819. }
  24820. }
  24821. var self = this;
  24822. var statcb = inflight_1('stat\0' + abs, lstatcb_);
  24823. if (statcb)
  24824. self.fs.lstat(abs, statcb);
  24825. function lstatcb_ (er, lstat) {
  24826. if (lstat && lstat.isSymbolicLink()) {
  24827. // If it's a symlink, then treat it as the target, unless
  24828. // the target does not exist, then treat it as a file.
  24829. return self.fs.stat(abs, function (er, stat) {
  24830. if (er)
  24831. self._stat2(f, abs, null, lstat, cb);
  24832. else
  24833. self._stat2(f, abs, er, stat, cb);
  24834. })
  24835. } else {
  24836. self._stat2(f, abs, er, lstat, cb);
  24837. }
  24838. }
  24839. };
  24840. Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
  24841. if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
  24842. this.statCache[abs] = false;
  24843. return cb()
  24844. }
  24845. var needDir = f.slice(-1) === '/';
  24846. this.statCache[abs] = stat;
  24847. if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
  24848. return cb(null, false, stat)
  24849. var c = true;
  24850. if (stat)
  24851. c = stat.isDirectory() ? 'DIR' : 'FILE';
  24852. this.cache[abs] = this.cache[abs] || c;
  24853. if (needDir && c === 'FILE')
  24854. return cb()
  24855. return cb(null, c, stat)
  24856. };
  24857. var peerDependencies = {
  24858. rollup: "^2.22.0"
  24859. };
  24860. const PROXY_SUFFIX = '?commonjs-proxy';
  24861. const getProxyId = (id) => `\0${id}${PROXY_SUFFIX}`;
  24862. const getIdFromProxyId = (proxyId) => proxyId.slice(1, -PROXY_SUFFIX.length);
  24863. const EXTERNAL_SUFFIX = '?commonjs-external';
  24864. const getExternalProxyId = (id) => `\0${id}${EXTERNAL_SUFFIX}`;
  24865. const getIdFromExternalProxyId = (proxyId) => proxyId.slice(1, -EXTERNAL_SUFFIX.length);
  24866. const VIRTUAL_PATH_BASE = '/$$rollup_base$$';
  24867. const getVirtualPathForDynamicRequirePath = (path, commonDir) => {
  24868. if (path.startsWith(commonDir)) return VIRTUAL_PATH_BASE + path.slice(commonDir.length);
  24869. return path;
  24870. };
  24871. const DYNAMIC_REGISTER_PREFIX = '\0commonjs-dynamic-register:';
  24872. const DYNAMIC_JSON_PREFIX = '\0commonjs-dynamic-json:';
  24873. const DYNAMIC_PACKAGES_ID = '\0commonjs-dynamic-packages';
  24874. const HELPERS_ID = '\0commonjsHelpers.js';
  24875. // `x['default']` is used instead of `x.default` for backward compatibility with ES3 browsers.
  24876. // Minifiers like uglify will usually transpile it back if compatibility with ES3 is not enabled.
  24877. // This will no longer be necessary once Rollup switches to ES6 output, likely
  24878. // in Rollup 3
  24879. // The "hasOwnProperty" call in "getDefaultExportFromCjs" is technically not
  24880. // needed, but for consumers that use Rollup's old interop pattern, it will fix
  24881. // rollup/rollup-plugin-commonjs#224
  24882. // We should remove it once Rollup core and this plugin are updated to not use
  24883. // this pattern any more
  24884. const HELPERS = `
  24885. export var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  24886. export function getDefaultExportFromCjs (x) {
  24887. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  24888. }
  24889. export function createCommonjsModule(fn, basedir, module) {
  24890. return module = {
  24891. path: basedir,
  24892. exports: {},
  24893. require: function (path, base) {
  24894. return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
  24895. }
  24896. }, fn(module, module.exports), module.exports;
  24897. }
  24898. export function getDefaultExportFromNamespaceIfPresent (n) {
  24899. return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
  24900. }
  24901. export function getDefaultExportFromNamespaceIfNotNamed (n) {
  24902. return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
  24903. }
  24904. export function getAugmentedNamespace(n) {
  24905. if (n.__esModule) return n;
  24906. var a = Object.defineProperty({}, '__esModule', {value: true});
  24907. Object.keys(n).forEach(function (k) {
  24908. var d = Object.getOwnPropertyDescriptor(n, k);
  24909. Object.defineProperty(a, k, d.get ? d : {
  24910. enumerable: true,
  24911. get: function () {
  24912. return n[k];
  24913. }
  24914. });
  24915. });
  24916. return a;
  24917. }
  24918. `;
  24919. const HELPER_NON_DYNAMIC = `
  24920. export function commonjsRequire () {
  24921. throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
  24922. }
  24923. `;
  24924. const HELPERS_DYNAMIC = `
  24925. export function commonjsRegister (path, loader) {
  24926. DYNAMIC_REQUIRE_LOADERS[path] = loader;
  24927. }
  24928. const DYNAMIC_REQUIRE_LOADERS = Object.create(null);
  24929. const DYNAMIC_REQUIRE_CACHE = Object.create(null);
  24930. const DEFAULT_PARENT_MODULE = {
  24931. id: '<' + 'rollup>', exports: {}, parent: undefined, filename: null, loaded: false, children: [], paths: []
  24932. };
  24933. const CHECKED_EXTENSIONS = ['', '.js', '.json'];
  24934. function normalize (path) {
  24935. path = path.replace(/\\\\/g, '/');
  24936. const parts = path.split('/');
  24937. const slashed = parts[0] === '';
  24938. for (let i = 1; i < parts.length; i++) {
  24939. if (parts[i] === '.' || parts[i] === '') {
  24940. parts.splice(i--, 1);
  24941. }
  24942. }
  24943. for (let i = 1; i < parts.length; i++) {
  24944. if (parts[i] !== '..') continue;
  24945. if (i > 0 && parts[i - 1] !== '..' && parts[i - 1] !== '.') {
  24946. parts.splice(--i, 2);
  24947. i--;
  24948. }
  24949. }
  24950. path = parts.join('/');
  24951. if (slashed && path[0] !== '/')
  24952. path = '/' + path;
  24953. else if (path.length === 0)
  24954. path = '.';
  24955. return path;
  24956. }
  24957. function join () {
  24958. if (arguments.length === 0)
  24959. return '.';
  24960. let joined;
  24961. for (let i = 0; i < arguments.length; ++i) {
  24962. let arg = arguments[i];
  24963. if (arg.length > 0) {
  24964. if (joined === undefined)
  24965. joined = arg;
  24966. else
  24967. joined += '/' + arg;
  24968. }
  24969. }
  24970. if (joined === undefined)
  24971. return '.';
  24972. return joined;
  24973. }
  24974. function isPossibleNodeModulesPath (modulePath) {
  24975. let c0 = modulePath[0];
  24976. if (c0 === '/' || c0 === '\\\\') return false;
  24977. let c1 = modulePath[1], c2 = modulePath[2];
  24978. if ((c0 === '.' && (!c1 || c1 === '/' || c1 === '\\\\')) ||
  24979. (c0 === '.' && c1 === '.' && (!c2 || c2 === '/' || c2 === '\\\\'))) return false;
  24980. if (c1 === ':' && (c2 === '/' || c2 === '\\\\'))
  24981. return false;
  24982. return true;
  24983. }
  24984. function dirname (path) {
  24985. if (path.length === 0)
  24986. return '.';
  24987. let i = path.length - 1;
  24988. while (i > 0) {
  24989. const c = path.charCodeAt(i);
  24990. if ((c === 47 || c === 92) && i !== path.length - 1)
  24991. break;
  24992. i--;
  24993. }
  24994. if (i > 0)
  24995. return path.substr(0, i);
  24996. if (path.chartCodeAt(0) === 47 || path.chartCodeAt(0) === 92)
  24997. return path.charAt(0);
  24998. return '.';
  24999. }
  25000. export function commonjsRequire (path, originalModuleDir) {
  25001. const shouldTryNodeModules = isPossibleNodeModulesPath(path);
  25002. path = normalize(path);
  25003. let relPath;
  25004. while (true) {
  25005. if (!shouldTryNodeModules) {
  25006. relPath = originalModuleDir ? normalize(originalModuleDir + '/' + path) : path;
  25007. } else if (originalModuleDir) {
  25008. relPath = normalize(originalModuleDir + '/node_modules/' + path);
  25009. } else {
  25010. relPath = normalize(join('node_modules', path));
  25011. }
  25012. for (let extensionIndex = 0; extensionIndex < CHECKED_EXTENSIONS.length; extensionIndex++) {
  25013. const resolvedPath = relPath + CHECKED_EXTENSIONS[extensionIndex];
  25014. let cachedModule = DYNAMIC_REQUIRE_CACHE[resolvedPath];
  25015. if (cachedModule) return cachedModule.exports;
  25016. const loader = DYNAMIC_REQUIRE_LOADERS[resolvedPath];
  25017. if (loader) {
  25018. DYNAMIC_REQUIRE_CACHE[resolvedPath] = cachedModule = {
  25019. id: resolvedPath,
  25020. filename: resolvedPath,
  25021. path: dirname(resolvedPath),
  25022. exports: {},
  25023. parent: DEFAULT_PARENT_MODULE,
  25024. loaded: false,
  25025. children: [],
  25026. paths: [],
  25027. require: function (path, base) {
  25028. return commonjsRequire(path, (base === undefined || base === null) ? cachedModule.path : base);
  25029. }
  25030. };
  25031. try {
  25032. loader.call(commonjsGlobal, cachedModule, cachedModule.exports);
  25033. } catch (error) {
  25034. delete DYNAMIC_REQUIRE_CACHE[resolvedPath];
  25035. throw error;
  25036. }
  25037. cachedModule.loaded = true;
  25038. return cachedModule.exports;
  25039. };
  25040. }
  25041. if (!shouldTryNodeModules) break;
  25042. const nextDir = normalize(originalModuleDir + '/..');
  25043. if (nextDir === originalModuleDir) break;
  25044. originalModuleDir = nextDir;
  25045. }
  25046. return require(path);
  25047. }
  25048. commonjsRequire.cache = DYNAMIC_REQUIRE_CACHE;
  25049. `;
  25050. function getHelpersModule(isDynamicRequireModulesEnabled) {
  25051. return `${HELPERS}${isDynamicRequireModulesEnabled ? HELPERS_DYNAMIC : HELPER_NON_DYNAMIC}`;
  25052. }
  25053. /* eslint-disable no-undefined */
  25054. const operators = {
  25055. '==': (x) => equals(x.left, x.right, false),
  25056. '!=': (x) => not(operators['=='](x)),
  25057. '===': (x) => equals(x.left, x.right, true),
  25058. '!==': (x) => not(operators['==='](x)),
  25059. '!': (x) => isFalsy(x.argument),
  25060. '&&': (x) => isTruthy(x.left) && isTruthy(x.right),
  25061. '||': (x) => isTruthy(x.left) || isTruthy(x.right)
  25062. };
  25063. function flatten(node) {
  25064. const parts = [];
  25065. while (node.type === 'MemberExpression') {
  25066. if (node.computed) return null;
  25067. parts.unshift(node.property.name);
  25068. // eslint-disable-next-line no-param-reassign
  25069. node = node.object;
  25070. }
  25071. if (node.type !== 'Identifier') return null;
  25072. const { name } = node;
  25073. parts.unshift(name);
  25074. return { name, keypath: parts.join('.') };
  25075. }
  25076. function isTruthy(node) {
  25077. if (node.type === 'Literal') return !!node.value;
  25078. if (node.type === 'ParenthesizedExpression') return isTruthy(node.expression);
  25079. if (node.operator in operators) return operators[node.operator](node);
  25080. return undefined;
  25081. }
  25082. function isFalsy(node) {
  25083. return not(isTruthy(node));
  25084. }
  25085. function not(value) {
  25086. return value === undefined ? value : !value;
  25087. }
  25088. function equals(a, b, strict) {
  25089. if (a.type !== b.type) return undefined;
  25090. // eslint-disable-next-line eqeqeq
  25091. if (a.type === 'Literal') return strict ? a.value === b.value : a.value == b.value;
  25092. return undefined;
  25093. }
  25094. /* eslint-disable import/prefer-default-export */
  25095. function getName(id) {
  25096. const name = makeLegalIdentifier$2(basename(id, extname$1(id)));
  25097. if (name !== 'index') {
  25098. return name;
  25099. }
  25100. const segments = dirname(id).split(sep);
  25101. return makeLegalIdentifier$2(segments[segments.length - 1]);
  25102. }
  25103. /* eslint-disable no-param-reassign, no-shadow, no-underscore-dangle, no-continue */
  25104. const reserved = 'process location abstract arguments boolean break byte case catch char class const continue debugger default delete do double else enum eval export extends false final finally float for from function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with yield'.split(
  25105. ' '
  25106. );
  25107. const blacklist = { __esModule: true };
  25108. reserved.forEach((word) => (blacklist[word] = true));
  25109. const exportsPattern = /^(?:module\.)?exports(?:\.([a-zA-Z_$][a-zA-Z_$0-9]*))?$/;
  25110. const firstpassGlobal = /\b(?:require|module|exports|global)\b/;
  25111. const firstpassNoGlobal = /\b(?:require|module|exports)\b/;
  25112. const functionType = /^(?:FunctionDeclaration|FunctionExpression|ArrowFunctionExpression)$/;
  25113. function deconflict(scope, globals, identifier) {
  25114. let i = 1;
  25115. let deconflicted = makeLegalIdentifier$2(identifier);
  25116. while (scope.contains(deconflicted) || globals.has(deconflicted) || deconflicted in blacklist) {
  25117. deconflicted = `${identifier}_${i}`;
  25118. i += 1;
  25119. }
  25120. scope.declarations[deconflicted] = true;
  25121. return deconflicted;
  25122. }
  25123. function tryParse(parse, code, id) {
  25124. try {
  25125. return parse(code, { allowReturnOutsideFunction: true });
  25126. } catch (err) {
  25127. err.message += ` in ${id}`;
  25128. throw err;
  25129. }
  25130. }
  25131. function normalizePathSlashes(path) {
  25132. return path.replace(/\\/g, '/');
  25133. }
  25134. function hasCjsKeywords(code, ignoreGlobal) {
  25135. const firstpass = ignoreGlobal ? firstpassNoGlobal : firstpassGlobal;
  25136. return firstpass.test(code);
  25137. }
  25138. function checkEsModule(parse, code, id) {
  25139. const ast = tryParse(parse, code, id);
  25140. let isEsModule = false;
  25141. let hasDefaultExport = false;
  25142. let hasNamedExports = false;
  25143. for (const node of ast.body) {
  25144. if (node.type === 'ExportDefaultDeclaration') {
  25145. isEsModule = true;
  25146. hasDefaultExport = true;
  25147. } else if (node.type === 'ExportNamedDeclaration') {
  25148. isEsModule = true;
  25149. if (node.declaration) {
  25150. hasNamedExports = true;
  25151. } else {
  25152. for (const specifier of node.specifiers) {
  25153. if (specifier.exported.name === 'default') {
  25154. hasDefaultExport = true;
  25155. } else {
  25156. hasNamedExports = true;
  25157. }
  25158. }
  25159. }
  25160. } else if (node.type === 'ExportAllDeclaration') {
  25161. isEsModule = true;
  25162. if (node.exported && node.exported.name === 'default') {
  25163. hasDefaultExport = true;
  25164. } else {
  25165. hasNamedExports = true;
  25166. }
  25167. } else if (node.type === 'ImportDeclaration') {
  25168. isEsModule = true;
  25169. }
  25170. }
  25171. return { isEsModule, hasDefaultExport, hasNamedExports, ast };
  25172. }
  25173. function getDefinePropertyCallName(node, targetName) {
  25174. if (node.type !== 'CallExpression') return;
  25175. const {
  25176. callee: { object, property }
  25177. } = node;
  25178. if (!object || object.type !== 'Identifier' || object.name !== 'Object') return;
  25179. if (!property || property.type !== 'Identifier' || property.name !== 'defineProperty') return;
  25180. if (node.arguments.length !== 3) return;
  25181. const [target, val] = node.arguments;
  25182. if (target.type !== 'Identifier' || target.name !== targetName) return;
  25183. // eslint-disable-next-line consistent-return
  25184. return val.value;
  25185. }
  25186. function transformCommonjs(
  25187. parse,
  25188. code,
  25189. id,
  25190. isEsModule,
  25191. ignoreGlobal,
  25192. ignoreRequire,
  25193. sourceMap,
  25194. isDynamicRequireModulesEnabled,
  25195. dynamicRequireModuleSet,
  25196. commonDir,
  25197. astCache
  25198. ) {
  25199. const ast = astCache || tryParse(parse, code, id);
  25200. const magicString = new MagicString$1(code);
  25201. const required = {};
  25202. // Because objects have no guaranteed ordering, yet we need it,
  25203. // we need to keep track of the order in a array
  25204. const sources = [];
  25205. let uid = 0;
  25206. let scope = attachScopes$1(ast, 'scope');
  25207. const uses = { module: false, exports: false, global: false, require: false };
  25208. let lexicalDepth = 0;
  25209. let programDepth = 0;
  25210. const globals = new Set();
  25211. // TODO technically wrong since globals isn't populated yet, but ¯\_(ツ)_/¯
  25212. const HELPERS_NAME = deconflict(scope, globals, 'commonjsHelpers');
  25213. // TODO handle transpiled modules
  25214. let shouldWrap = /__esModule/.test(code);
  25215. let usesCommonjsHelpers = false;
  25216. function isRequireStatement(node) {
  25217. if (!node) return false;
  25218. if (node.type !== 'CallExpression') return false;
  25219. // Weird case of `require()` or `module.require()` without arguments
  25220. if (node.arguments.length === 0) return false;
  25221. return isRequireIdentifier(node.callee);
  25222. }
  25223. function isRequireIdentifier(node) {
  25224. if (!node) return false;
  25225. if (node.type === 'Identifier' && node.name === 'require' /* `require` */) {
  25226. // `require` is hidden by a variable in local scope
  25227. if (scope.contains('require')) return false;
  25228. return true;
  25229. } else if (node.type === 'MemberExpression' /* `[something].[something]` */) {
  25230. // `module.[something]`
  25231. if (node.object.type !== 'Identifier' || node.object.name !== 'module') return false;
  25232. // `module` is hidden by a variable in local scope
  25233. if (scope.contains('module')) return false;
  25234. // `module.require(...)`
  25235. if (node.property.type !== 'Identifier' || node.property.name !== 'require') return false;
  25236. return true;
  25237. }
  25238. return false;
  25239. }
  25240. function hasDynamicArguments(node) {
  25241. return (
  25242. node.arguments.length > 1 ||
  25243. (node.arguments[0].type !== 'Literal' &&
  25244. (node.arguments[0].type !== 'TemplateLiteral' || node.arguments[0].expressions.length > 0))
  25245. );
  25246. }
  25247. function isStaticRequireStatement(node) {
  25248. if (!isRequireStatement(node)) return false;
  25249. return !hasDynamicArguments(node);
  25250. }
  25251. function isNodeRequireStatement(parent) {
  25252. const reservedMethod = ['resolve', 'cache', 'main'];
  25253. return !!(parent && parent.property && reservedMethod.indexOf(parent.property.name) > -1);
  25254. }
  25255. function isIgnoredRequireStatement(requiredNode) {
  25256. return ignoreRequire(requiredNode.arguments[0].value);
  25257. }
  25258. function getRequireStringArg(node) {
  25259. return node.arguments[0].type === 'Literal'
  25260. ? node.arguments[0].value
  25261. : node.arguments[0].quasis[0].value.cooked;
  25262. }
  25263. function getRequired(node, name) {
  25264. let sourceId = getRequireStringArg(node);
  25265. const isDynamicRegister = sourceId.startsWith(DYNAMIC_REGISTER_PREFIX);
  25266. if (isDynamicRegister) {
  25267. sourceId = sourceId.substr(DYNAMIC_REGISTER_PREFIX.length);
  25268. }
  25269. const existing = required[sourceId];
  25270. // eslint-disable-next-line no-undefined
  25271. if (existing === undefined) {
  25272. const isDynamic = hasDynamicModuleForPath(sourceId);
  25273. if (!name) {
  25274. do {
  25275. name = `require$$${uid}`;
  25276. uid += 1;
  25277. } while (scope.contains(name));
  25278. }
  25279. if (isDynamicRegister && sourceId.endsWith('.json')) {
  25280. sourceId = DYNAMIC_JSON_PREFIX + sourceId;
  25281. }
  25282. if (isDynamicRegister || !isDynamic || sourceId.endsWith('.json')) {
  25283. sources.push([sourceId, !isDynamicRegister]);
  25284. }
  25285. required[sourceId] = { source: sourceId, name, importsDefault: false, isDynamic };
  25286. }
  25287. return required[sourceId];
  25288. }
  25289. function hasDynamicModuleForPath(source) {
  25290. if (!/[/\\]/.test(source)) {
  25291. try {
  25292. const resolvedPath = normalizePathSlashes(
  25293. resolve.sync(source, { basedir: dirname(id) })
  25294. );
  25295. if (dynamicRequireModuleSet.has(resolvedPath)) {
  25296. return true;
  25297. }
  25298. } catch (ex) {
  25299. // Probably a node.js internal module
  25300. return false;
  25301. }
  25302. return false;
  25303. }
  25304. for (const attemptExt of ['', '.js', '.json']) {
  25305. const resolvedPath = normalizePathSlashes(resolve$1(dirname(id), source + attemptExt));
  25306. if (dynamicRequireModuleSet.has(resolvedPath)) {
  25307. return true;
  25308. }
  25309. }
  25310. return false;
  25311. }
  25312. function shouldUseSimulatedRequire(required) {
  25313. return (
  25314. hasDynamicModuleForPath(required.source) &&
  25315. // We only do `commonjsRequire` for json if it's the `commonjsRegister` call.
  25316. (required.source.startsWith(DYNAMIC_REGISTER_PREFIX) || !required.source.endsWith('.json'))
  25317. );
  25318. }
  25319. // do a first pass, see which names are assigned to. This is necessary to prevent
  25320. // illegally replacing `var foo = require('foo')` with `import foo from 'foo'`,
  25321. // where `foo` is later reassigned. (This happens in the wild. CommonJS, sigh)
  25322. const assignedTo = new Set();
  25323. walk$1(ast, {
  25324. enter(node) {
  25325. if (node.type !== 'AssignmentExpression') return;
  25326. if (node.left.type === 'MemberExpression') return;
  25327. extractAssignedNames$1(node.left).forEach((name) => {
  25328. assignedTo.add(name);
  25329. });
  25330. }
  25331. });
  25332. walk$1(ast, {
  25333. enter(node, parent) {
  25334. if (sourceMap) {
  25335. magicString.addSourcemapLocation(node.start);
  25336. magicString.addSourcemapLocation(node.end);
  25337. }
  25338. // skip dead branches
  25339. if (parent && (parent.type === 'IfStatement' || parent.type === 'ConditionalExpression')) {
  25340. if (node === parent.consequent && isFalsy(parent.test)) {
  25341. this.skip();
  25342. return;
  25343. }
  25344. if (node === parent.alternate && isTruthy(parent.test)) {
  25345. this.skip();
  25346. return;
  25347. }
  25348. }
  25349. if (node._skip) {
  25350. this.skip();
  25351. return;
  25352. }
  25353. programDepth += 1;
  25354. if (node.scope) ({ scope } = node);
  25355. if (functionType.test(node.type)) lexicalDepth += 1;
  25356. // if toplevel return, we need to wrap it
  25357. if (node.type === 'ReturnStatement' && lexicalDepth === 0) {
  25358. shouldWrap = true;
  25359. }
  25360. // rewrite `this` as `commonjsHelpers.commonjsGlobal`
  25361. if (node.type === 'ThisExpression' && lexicalDepth === 0) {
  25362. uses.global = true;
  25363. if (!ignoreGlobal) {
  25364. magicString.overwrite(node.start, node.end, `${HELPERS_NAME}.commonjsGlobal`, {
  25365. storeName: true
  25366. });
  25367. usesCommonjsHelpers = true;
  25368. }
  25369. return;
  25370. }
  25371. // rewrite `typeof module`, `typeof module.exports` and `typeof exports` (https://github.com/rollup/rollup-plugin-commonjs/issues/151)
  25372. if (node.type === 'UnaryExpression' && node.operator === 'typeof') {
  25373. const flattened = flatten(node.argument);
  25374. if (!flattened) return;
  25375. if (scope.contains(flattened.name)) return;
  25376. if (
  25377. flattened.keypath === 'module.exports' ||
  25378. flattened.keypath === 'module' ||
  25379. flattened.keypath === 'exports'
  25380. ) {
  25381. magicString.overwrite(node.start, node.end, `'object'`, { storeName: false });
  25382. }
  25383. }
  25384. // rewrite `require` (if not already handled) `global` and `define`, and handle free references to
  25385. // `module` and `exports` as these mean we need to wrap the module in commonjsHelpers.createCommonjsModule
  25386. if (node.type === 'Identifier') {
  25387. if (isReference(node, parent) && !scope.contains(node.name)) {
  25388. if (node.name in uses) {
  25389. if (isRequireIdentifier(node)) {
  25390. if (isNodeRequireStatement(parent)) {
  25391. return;
  25392. }
  25393. if (!isDynamicRequireModulesEnabled && isStaticRequireStatement(parent)) {
  25394. return;
  25395. }
  25396. if (isDynamicRequireModulesEnabled && isRequireStatement(parent)) {
  25397. magicString.appendLeft(
  25398. parent.end - 1,
  25399. `,${JSON.stringify(
  25400. dirname(id) === '.'
  25401. ? null /* default behavior */
  25402. : getVirtualPathForDynamicRequirePath(
  25403. normalizePathSlashes(dirname(id)),
  25404. commonDir
  25405. )
  25406. )}`
  25407. );
  25408. }
  25409. magicString.overwrite(node.start, node.end, `${HELPERS_NAME}.commonjsRequire`, {
  25410. storeName: true
  25411. });
  25412. usesCommonjsHelpers = true;
  25413. }
  25414. uses[node.name] = true;
  25415. if (node.name === 'global' && !ignoreGlobal) {
  25416. magicString.overwrite(node.start, node.end, `${HELPERS_NAME}.commonjsGlobal`, {
  25417. storeName: true
  25418. });
  25419. usesCommonjsHelpers = true;
  25420. }
  25421. // if module or exports are used outside the context of an assignment
  25422. // expression, we need to wrap the module
  25423. if (node.name === 'module' || node.name === 'exports') {
  25424. shouldWrap = true;
  25425. }
  25426. }
  25427. if (node.name === 'define') {
  25428. magicString.overwrite(node.start, node.end, 'undefined', { storeName: true });
  25429. }
  25430. globals.add(node.name);
  25431. }
  25432. return;
  25433. }
  25434. // Is this an assignment to exports or module.exports?
  25435. if (node.type === 'AssignmentExpression') {
  25436. if (node.left.type !== 'MemberExpression') return;
  25437. const flattened = flatten(node.left);
  25438. if (!flattened) return;
  25439. if (scope.contains(flattened.name)) return;
  25440. const match = exportsPattern.exec(flattened.keypath);
  25441. if (!match || flattened.keypath === 'exports') return;
  25442. uses[flattened.name] = true;
  25443. // we're dealing with `module.exports = ...` or `[module.]exports.foo = ...` –
  25444. // if this isn't top-level, we'll need to wrap the module
  25445. if (programDepth > 3) shouldWrap = true;
  25446. node.left._skip = true;
  25447. if (flattened.keypath === 'module.exports' && node.right.type === 'ObjectExpression') {
  25448. node.right.properties.forEach((prop) => {
  25449. if (prop.computed || !('key' in prop) || prop.key.type !== 'Identifier') return;
  25450. const { name } = prop.key;
  25451. if (name === makeLegalIdentifier$2(name)) ;
  25452. });
  25453. return;
  25454. }
  25455. return;
  25456. }
  25457. const name = getDefinePropertyCallName(node, 'exports');
  25458. if (name && name === makeLegalIdentifier$2(name)) ;
  25459. // if this is `var x = require('x')`, we can do `import x from 'x'`
  25460. if (
  25461. node.type === 'VariableDeclarator' &&
  25462. node.id.type === 'Identifier' &&
  25463. isStaticRequireStatement(node.init) &&
  25464. !isIgnoredRequireStatement(node.init)
  25465. ) {
  25466. // for now, only do this for top-level requires. maybe fix this in future
  25467. if (scope.parent) return;
  25468. // edge case — CJS allows you to assign to imports. ES doesn't
  25469. if (assignedTo.has(node.id.name)) return;
  25470. const required = getRequired(node.init, node.id.name);
  25471. required.importsDefault = true;
  25472. if (required.name === node.id.name && !required.isDynamic) {
  25473. node._shouldRemove = true;
  25474. }
  25475. }
  25476. if (!isStaticRequireStatement(node) || isIgnoredRequireStatement(node)) {
  25477. return;
  25478. }
  25479. const required = getRequired(node);
  25480. if (parent.type === 'ExpressionStatement') {
  25481. // is a bare import, e.g. `require('foo');`
  25482. magicString.remove(parent.start, parent.end);
  25483. } else {
  25484. required.importsDefault = true;
  25485. if (shouldUseSimulatedRequire(required)) {
  25486. magicString.overwrite(
  25487. node.start,
  25488. node.end,
  25489. `${HELPERS_NAME}.commonjsRequire(${JSON.stringify(
  25490. getVirtualPathForDynamicRequirePath(normalizePathSlashes(required.source), commonDir)
  25491. )}, ${JSON.stringify(
  25492. dirname(id) === '.'
  25493. ? null /* default behavior */
  25494. : getVirtualPathForDynamicRequirePath(normalizePathSlashes(dirname(id)), commonDir)
  25495. )})`
  25496. );
  25497. usesCommonjsHelpers = true;
  25498. } else {
  25499. magicString.overwrite(node.start, node.end, required.name);
  25500. }
  25501. }
  25502. node.callee._skip = true;
  25503. },
  25504. leave(node) {
  25505. programDepth -= 1;
  25506. if (node.scope) scope = scope.parent;
  25507. if (functionType.test(node.type)) lexicalDepth -= 1;
  25508. if (node.type === 'VariableDeclaration') {
  25509. let keepDeclaration = false;
  25510. let c = node.declarations[0].start;
  25511. for (let i = 0; i < node.declarations.length; i += 1) {
  25512. const declarator = node.declarations[i];
  25513. if (declarator._shouldRemove) {
  25514. magicString.remove(c, declarator.end);
  25515. } else {
  25516. if (!keepDeclaration) {
  25517. magicString.remove(c, declarator.start);
  25518. keepDeclaration = true;
  25519. }
  25520. c = declarator.end;
  25521. }
  25522. }
  25523. if (!keepDeclaration) {
  25524. magicString.remove(node.start, node.end);
  25525. }
  25526. }
  25527. }
  25528. });
  25529. if (
  25530. !sources.length &&
  25531. !uses.module &&
  25532. !uses.exports &&
  25533. !uses.require &&
  25534. (ignoreGlobal || !uses.global)
  25535. ) {
  25536. // not a CommonJS module
  25537. return null;
  25538. }
  25539. // If `isEsModule` is on, it means it has ES6 import/export statements,
  25540. // which just can't be wrapped in a function.
  25541. if (isEsModule) shouldWrap = false;
  25542. usesCommonjsHelpers = usesCommonjsHelpers || shouldWrap;
  25543. const importBlock = `${(usesCommonjsHelpers
  25544. ? [`import * as ${HELPERS_NAME} from '${HELPERS_ID}';`]
  25545. : []
  25546. )
  25547. .concat(
  25548. sources.map(
  25549. ([source]) =>
  25550. // import the actual module before the proxy, so that we know
  25551. // what kind of proxy to build
  25552. `import '${source}';`
  25553. ),
  25554. sources
  25555. .filter(([, importProxy]) => importProxy)
  25556. .map(([source]) => {
  25557. const { name, importsDefault } = required[source];
  25558. return `import ${importsDefault ? `${name} from ` : ``}'${
  25559. source.startsWith('\0') ? source : getProxyId(source)
  25560. }';`;
  25561. })
  25562. )
  25563. .join('\n')}\n\n`;
  25564. const namedExportDeclarations = [];
  25565. let wrapperStart = '';
  25566. let wrapperEnd = '';
  25567. const moduleName = deconflict(scope, globals, getName(id));
  25568. if (!isEsModule) {
  25569. const exportModuleExports = {
  25570. str: `export { ${moduleName} as __moduleExports };`,
  25571. name: '__moduleExports'
  25572. };
  25573. namedExportDeclarations.push(exportModuleExports);
  25574. }
  25575. const defaultExportPropertyAssignments = [];
  25576. let hasDefaultExport = false;
  25577. if (shouldWrap) {
  25578. const args = `module${uses.exports ? ', exports' : ''}`;
  25579. wrapperStart = `var ${moduleName} = ${HELPERS_NAME}.createCommonjsModule(function (${args}) {\n`;
  25580. wrapperEnd = `\n}`;
  25581. if (isDynamicRequireModulesEnabled) {
  25582. wrapperEnd += `, ${JSON.stringify(
  25583. getVirtualPathForDynamicRequirePath(normalizePathSlashes(dirname(id)), commonDir)
  25584. )}`;
  25585. }
  25586. wrapperEnd += `);`;
  25587. } else {
  25588. const names = [];
  25589. for (const node of ast.body) {
  25590. if (node.type === 'ExpressionStatement' && node.expression.type === 'AssignmentExpression') {
  25591. const { left } = node.expression;
  25592. const flattened = flatten(left);
  25593. if (!flattened) {
  25594. continue;
  25595. }
  25596. const match = exportsPattern.exec(flattened.keypath);
  25597. if (!match) {
  25598. continue;
  25599. }
  25600. if (flattened.keypath === 'module.exports') {
  25601. hasDefaultExport = true;
  25602. magicString.overwrite(left.start, left.end, `var ${moduleName}`);
  25603. } else {
  25604. const [, name] = match;
  25605. const deconflicted = deconflict(scope, globals, name);
  25606. names.push({ name, deconflicted });
  25607. magicString.overwrite(node.start, left.end, `var ${deconflicted}`);
  25608. const declaration =
  25609. name === deconflicted
  25610. ? `export { ${name} };`
  25611. : `export { ${deconflicted} as ${name} };`;
  25612. if (name !== 'default') {
  25613. namedExportDeclarations.push({
  25614. str: declaration,
  25615. name
  25616. });
  25617. }
  25618. defaultExportPropertyAssignments.push(`${moduleName}.${name} = ${deconflicted};`);
  25619. }
  25620. }
  25621. }
  25622. if (!(isEsModule || hasDefaultExport)) {
  25623. wrapperEnd = `\n\nvar ${moduleName} = {\n${names
  25624. .map(({ name, deconflicted }) => `\t${name}: ${deconflicted}`)
  25625. .join(',\n')}\n};`;
  25626. }
  25627. }
  25628. magicString
  25629. .trim()
  25630. .prepend(importBlock + wrapperStart)
  25631. .trim()
  25632. .append(wrapperEnd);
  25633. const defaultExport =
  25634. code.indexOf('__esModule') >= 0
  25635. ? `export default /*@__PURE__*/${HELPERS_NAME}.getDefaultExportFromCjs(${moduleName});`
  25636. : `export default ${moduleName};`;
  25637. const named = namedExportDeclarations
  25638. .filter((x) => x.name !== 'default' || !hasDefaultExport)
  25639. .map((x) => x.str);
  25640. magicString.append(
  25641. `\n\n${(isEsModule ? [] : [defaultExport])
  25642. .concat(named)
  25643. .concat(hasDefaultExport ? defaultExportPropertyAssignments : [])
  25644. .join('\n')}`
  25645. );
  25646. code = magicString.toString();
  25647. const map = sourceMap ? magicString.generateMap() : null;
  25648. return { code, map, syntheticNamedExports: isEsModule ? false : '__moduleExports' };
  25649. }
  25650. function getDynamicPackagesModule(dynamicRequireModuleDirPaths, commonDir) {
  25651. let code = `const commonjsRegister = require('${HELPERS_ID}?commonjsRegister');`;
  25652. for (const dir of dynamicRequireModuleDirPaths) {
  25653. let entryPoint = 'index.js';
  25654. try {
  25655. if (existsSync(join(dir, 'package.json'))) {
  25656. entryPoint =
  25657. JSON.parse(readFileSync(join(dir, 'package.json'), { encoding: 'utf8' })).main ||
  25658. entryPoint;
  25659. }
  25660. } catch (ignored) {
  25661. // ignored
  25662. }
  25663. code += `\ncommonjsRegister(${JSON.stringify(
  25664. getVirtualPathForDynamicRequirePath(dir, commonDir)
  25665. )}, function (module, exports) {
  25666. module.exports = require(${JSON.stringify(normalizePathSlashes(join(dir, entryPoint)))});
  25667. });`;
  25668. }
  25669. return code;
  25670. }
  25671. function getDynamicPackagesEntryIntro(
  25672. id,
  25673. dynamicRequireModuleDirPaths,
  25674. dynamicRequireModuleSet
  25675. ) {
  25676. try {
  25677. const code = readFileSync(id, { encoding: 'utf8' });
  25678. let dynamicImports = Array.from(
  25679. dynamicRequireModuleSet,
  25680. (dynamicId) => `require(${JSON.stringify(DYNAMIC_REGISTER_PREFIX + dynamicId)});`
  25681. ).join('\n');
  25682. if (dynamicRequireModuleDirPaths.length) {
  25683. dynamicImports += `require(${JSON.stringify(
  25684. DYNAMIC_REGISTER_PREFIX + DYNAMIC_PACKAGES_ID
  25685. )});`;
  25686. }
  25687. return `${dynamicImports}\n${code}`;
  25688. } catch (ex) {
  25689. this.warn(`Failed to read file ${id}, dynamic modules might not work correctly`);
  25690. return null;
  25691. }
  25692. }
  25693. function getDynamicRequirePaths(patterns) {
  25694. const dynamicRequireModuleSet = new Set();
  25695. for (const pattern of !patterns || Array.isArray(patterns) ? patterns || [] : [patterns]) {
  25696. const isNegated = pattern.startsWith('!');
  25697. const modifySet = Set.prototype[isNegated ? 'delete' : 'add'].bind(dynamicRequireModuleSet);
  25698. for (const path of glob_1.sync(isNegated ? pattern.substr(1) : pattern)) {
  25699. modifySet(normalizePathSlashes(resolve$1(path)));
  25700. }
  25701. }
  25702. const dynamicRequireModuleDirPaths = Array.from(dynamicRequireModuleSet.values()).filter(
  25703. (path) => {
  25704. try {
  25705. if (statSync(path).isDirectory()) return true;
  25706. } catch (ignored) {
  25707. // Nothing to do here
  25708. }
  25709. return false;
  25710. }
  25711. );
  25712. return { dynamicRequireModuleSet, dynamicRequireModuleDirPaths };
  25713. }
  25714. /* eslint-disable no-undefined */
  25715. const isCjsPromises = new Map();
  25716. function getIsCjsPromise(id) {
  25717. let isCjsPromise = isCjsPromises.get(id);
  25718. if (isCjsPromise) return isCjsPromise.promise;
  25719. const promise = new Promise((resolve) => {
  25720. isCjsPromise = {
  25721. resolve,
  25722. promise: undefined
  25723. };
  25724. isCjsPromises.set(id, isCjsPromise);
  25725. });
  25726. isCjsPromise.promise = promise;
  25727. return promise;
  25728. }
  25729. function setIsCjsPromise(id, resolution) {
  25730. const isCjsPromise = isCjsPromises.get(id);
  25731. if (isCjsPromise) {
  25732. if (isCjsPromise.resolve) {
  25733. isCjsPromise.resolve(resolution);
  25734. isCjsPromise.resolve = undefined;
  25735. }
  25736. } else {
  25737. isCjsPromises.set(id, { promise: Promise.resolve(resolution), resolve: undefined });
  25738. }
  25739. }
  25740. // e.g. id === "commonjsHelpers?commonjsRegister"
  25741. function getSpecificHelperProxy(id) {
  25742. return `export {${id.split('?')[1]} as default} from '${HELPERS_ID}';`;
  25743. }
  25744. function getUnknownRequireProxy(id, requireReturnsDefault) {
  25745. if (requireReturnsDefault === true || id.endsWith('.json')) {
  25746. return `export {default} from ${JSON.stringify(id)};`;
  25747. }
  25748. const name = getName(id);
  25749. const exported =
  25750. requireReturnsDefault === 'auto'
  25751. ? `import {getDefaultExportFromNamespaceIfNotNamed} from "${HELPERS_ID}"; export default /*@__PURE__*/getDefaultExportFromNamespaceIfNotNamed(${name});`
  25752. : requireReturnsDefault === 'preferred'
  25753. ? `import {getDefaultExportFromNamespaceIfPresent} from "${HELPERS_ID}"; export default /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(${name});`
  25754. : !requireReturnsDefault
  25755. ? `import {getAugmentedNamespace} from "${HELPERS_ID}"; export default /*@__PURE__*/getAugmentedNamespace(${name});`
  25756. : `export default ${name};`;
  25757. return `import * as ${name} from ${JSON.stringify(id)}; ${exported}`;
  25758. }
  25759. function getDynamicJsonProxy(id, commonDir) {
  25760. const normalizedPath = normalizePathSlashes(id.slice(DYNAMIC_JSON_PREFIX.length));
  25761. return `const commonjsRegister = require('${HELPERS_ID}?commonjsRegister');\ncommonjsRegister(${JSON.stringify(
  25762. getVirtualPathForDynamicRequirePath(normalizedPath, commonDir)
  25763. )}, function (module, exports) {
  25764. module.exports = require(${JSON.stringify(normalizedPath)});
  25765. });`;
  25766. }
  25767. function getDynamicRequireProxy(normalizedPath, commonDir) {
  25768. return `const commonjsRegister = require('${HELPERS_ID}?commonjsRegister');\ncommonjsRegister(${JSON.stringify(
  25769. getVirtualPathForDynamicRequirePath(normalizedPath, commonDir)
  25770. )}, function (module, exports) {
  25771. ${readFileSync(normalizedPath, { encoding: 'utf8' })}
  25772. });`;
  25773. }
  25774. async function getStaticRequireProxy(
  25775. id,
  25776. requireReturnsDefault,
  25777. esModulesWithDefaultExport,
  25778. esModulesWithNamedExports
  25779. ) {
  25780. const name = getName(id);
  25781. const isCjs = await getIsCjsPromise(id);
  25782. if (isCjs) {
  25783. return `import { __moduleExports } from ${JSON.stringify(id)}; export default __moduleExports;`;
  25784. } else if (isCjs === null) {
  25785. return getUnknownRequireProxy(id, requireReturnsDefault);
  25786. } else if (!requireReturnsDefault) {
  25787. return `import {getAugmentedNamespace} from "${HELPERS_ID}"; import * as ${name} from ${JSON.stringify(
  25788. id
  25789. )}; export default /*@__PURE__*/getAugmentedNamespace(${name});`;
  25790. } else if (
  25791. requireReturnsDefault !== true &&
  25792. (requireReturnsDefault === 'namespace' ||
  25793. !esModulesWithDefaultExport.has(id) ||
  25794. (requireReturnsDefault === 'auto' && esModulesWithNamedExports.has(id)))
  25795. ) {
  25796. return `import * as ${name} from ${JSON.stringify(id)}; export default ${name};`;
  25797. }
  25798. return `export {default} from ${JSON.stringify(id)};`;
  25799. }
  25800. /* eslint-disable no-param-reassign, no-undefined */
  25801. function getCandidatesForExtension(resolved, extension) {
  25802. return [resolved + extension, `${resolved}${sep}index${extension}`];
  25803. }
  25804. function getCandidates(resolved, extensions) {
  25805. return extensions.reduce(
  25806. (paths, extension) => paths.concat(getCandidatesForExtension(resolved, extension)),
  25807. [resolved]
  25808. );
  25809. }
  25810. function getResolveId(extensions) {
  25811. function resolveExtensions(importee, importer) {
  25812. // not our problem
  25813. if (importee[0] !== '.' || !importer) return undefined;
  25814. const resolved = resolve$1(dirname(importer), importee);
  25815. const candidates = getCandidates(resolved, extensions);
  25816. for (let i = 0; i < candidates.length; i += 1) {
  25817. try {
  25818. const stats = statSync(candidates[i]);
  25819. if (stats.isFile()) return { id: candidates[i] };
  25820. } catch (err) {
  25821. /* noop */
  25822. }
  25823. }
  25824. return undefined;
  25825. }
  25826. function resolveId(importee, importer) {
  25827. const isProxyModule = importee.endsWith(PROXY_SUFFIX);
  25828. if (isProxyModule) {
  25829. importee = getIdFromProxyId(importee);
  25830. }
  25831. if (importee.startsWith('\0')) {
  25832. if (
  25833. importee.startsWith(HELPERS_ID) ||
  25834. importee === DYNAMIC_PACKAGES_ID ||
  25835. importee.startsWith(DYNAMIC_JSON_PREFIX)
  25836. ) {
  25837. return importee;
  25838. }
  25839. if (!isProxyModule) {
  25840. return null;
  25841. }
  25842. }
  25843. if (importer && importer.endsWith(PROXY_SUFFIX)) {
  25844. importer = getIdFromProxyId(importer);
  25845. }
  25846. return this.resolve(importee, importer, { skipSelf: true }).then((resolved) => {
  25847. if (!resolved) {
  25848. resolved = resolveExtensions(importee, importer);
  25849. }
  25850. if (isProxyModule) {
  25851. if (!resolved) {
  25852. return { id: getExternalProxyId(importee), external: false };
  25853. }
  25854. resolved.id = (resolved.external ? getExternalProxyId : getProxyId)(resolved.id);
  25855. resolved.external = false;
  25856. return resolved;
  25857. }
  25858. return resolved;
  25859. });
  25860. }
  25861. return resolveId;
  25862. }
  25863. function commonjs(options = {}) {
  25864. const extensions = options.extensions || ['.js'];
  25865. const filter = createFilter$4(options.include, options.exclude);
  25866. const {
  25867. ignoreGlobal,
  25868. requireReturnsDefault: requireReturnsDefaultOption,
  25869. esmExternals
  25870. } = options;
  25871. const getRequireReturnsDefault =
  25872. typeof requireReturnsDefaultOption === 'function'
  25873. ? requireReturnsDefaultOption
  25874. : () => requireReturnsDefaultOption;
  25875. let esmExternalIds;
  25876. const isEsmExternal =
  25877. typeof esmExternals === 'function'
  25878. ? esmExternals
  25879. : Array.isArray(esmExternals)
  25880. ? ((esmExternalIds = new Set(esmExternals)), (id) => esmExternalIds.has(id))
  25881. : () => esmExternals;
  25882. const { dynamicRequireModuleSet, dynamicRequireModuleDirPaths } = getDynamicRequirePaths(
  25883. options.dynamicRequireTargets
  25884. );
  25885. const isDynamicRequireModulesEnabled = dynamicRequireModuleSet.size > 0;
  25886. const commonDir = isDynamicRequireModulesEnabled
  25887. ? commondir$1(null, Array.from(dynamicRequireModuleSet).concat(process.cwd()))
  25888. : null;
  25889. const esModulesWithDefaultExport = new Set();
  25890. const esModulesWithNamedExports = new Set();
  25891. const ignoreRequire =
  25892. typeof options.ignore === 'function'
  25893. ? options.ignore
  25894. : Array.isArray(options.ignore)
  25895. ? (id) => options.ignore.includes(id)
  25896. : () => false;
  25897. const resolveId = getResolveId(extensions);
  25898. const sourceMap = options.sourceMap !== false;
  25899. function transformAndCheckExports(code, id) {
  25900. const { isEsModule, hasDefaultExport, hasNamedExports, ast } = checkEsModule(
  25901. this.parse,
  25902. code,
  25903. id
  25904. );
  25905. if (hasDefaultExport) {
  25906. esModulesWithDefaultExport.add(id);
  25907. }
  25908. if (hasNamedExports) {
  25909. esModulesWithNamedExports.add(id);
  25910. }
  25911. if (
  25912. !dynamicRequireModuleSet.has(normalizePathSlashes(id)) &&
  25913. (!hasCjsKeywords(code, ignoreGlobal) || (isEsModule && !options.transformMixedEsModules))
  25914. ) {
  25915. setIsCjsPromise(id, false);
  25916. return null;
  25917. }
  25918. const transformed = transformCommonjs(
  25919. this.parse,
  25920. code,
  25921. id,
  25922. isEsModule,
  25923. ignoreGlobal || isEsModule,
  25924. ignoreRequire,
  25925. sourceMap,
  25926. isDynamicRequireModulesEnabled,
  25927. dynamicRequireModuleSet,
  25928. commonDir,
  25929. ast
  25930. );
  25931. setIsCjsPromise(id, isEsModule ? false : Boolean(transformed));
  25932. return transformed;
  25933. }
  25934. return {
  25935. name: 'commonjs',
  25936. buildStart() {
  25937. if (options.namedExports != null) {
  25938. this.warn(
  25939. 'The namedExports option from "@rollup/plugin-commonjs" is deprecated. Named exports are now handled automatically.'
  25940. );
  25941. }
  25942. const [major, minor] = this.meta.rollupVersion.split('.').map(Number);
  25943. const minVersion = peerDependencies.rollup.slice(2);
  25944. const [minMajor, minMinor] = minVersion.split('.').map(Number);
  25945. if (major < minMajor || (major === minMajor && minor < minMinor)) {
  25946. this.error(
  25947. `Insufficient Rollup version: "@rollup/plugin-commonjs" requires at least rollup@${minVersion} but found rollup@${this.meta.rollupVersion}.`
  25948. );
  25949. }
  25950. },
  25951. resolveId,
  25952. load(id) {
  25953. if (id === HELPERS_ID) {
  25954. return getHelpersModule(isDynamicRequireModulesEnabled);
  25955. }
  25956. if (id.startsWith(HELPERS_ID)) {
  25957. return getSpecificHelperProxy(id);
  25958. }
  25959. if (id.endsWith(EXTERNAL_SUFFIX)) {
  25960. const actualId = getIdFromExternalProxyId(id);
  25961. return getUnknownRequireProxy(
  25962. actualId,
  25963. isEsmExternal(actualId) ? getRequireReturnsDefault(actualId) : true
  25964. );
  25965. }
  25966. if (id === DYNAMIC_PACKAGES_ID) {
  25967. return getDynamicPackagesModule(dynamicRequireModuleDirPaths, commonDir);
  25968. }
  25969. if (id.startsWith(DYNAMIC_JSON_PREFIX)) {
  25970. return getDynamicJsonProxy(id, commonDir);
  25971. }
  25972. const normalizedPath = normalizePathSlashes(id);
  25973. if (dynamicRequireModuleSet.has(normalizedPath) && !normalizedPath.endsWith('.json')) {
  25974. return getDynamicRequireProxy(normalizedPath, commonDir);
  25975. }
  25976. if (id.endsWith(PROXY_SUFFIX)) {
  25977. const actualId = getIdFromProxyId(id);
  25978. return getStaticRequireProxy(
  25979. actualId,
  25980. getRequireReturnsDefault(actualId),
  25981. esModulesWithDefaultExport,
  25982. esModulesWithNamedExports
  25983. );
  25984. }
  25985. if (isDynamicRequireModulesEnabled && this.getModuleInfo(id).isEntry) {
  25986. return getDynamicPackagesEntryIntro(
  25987. id,
  25988. dynamicRequireModuleDirPaths,
  25989. dynamicRequireModuleSet
  25990. );
  25991. }
  25992. return null;
  25993. },
  25994. transform(code, id) {
  25995. const extName = extname$1(id);
  25996. if (
  25997. extName !== '.cjs' &&
  25998. id !== DYNAMIC_PACKAGES_ID &&
  25999. !id.startsWith(DYNAMIC_JSON_PREFIX) &&
  26000. (!filter(id) || !extensions.includes(extName))
  26001. ) {
  26002. setIsCjsPromise(id, null);
  26003. return null;
  26004. }
  26005. let transformed;
  26006. try {
  26007. transformed = transformAndCheckExports.call(this, code, id);
  26008. } catch (err) {
  26009. transformed = null;
  26010. setIsCjsPromise(id, false);
  26011. this.error(err, err.loc);
  26012. }
  26013. return transformed;
  26014. }
  26015. };
  26016. }
  26017. // Helper since Typescript can't detect readonly arrays with Array.isArray
  26018. function isArray$3(arg) {
  26019. return Array.isArray(arg);
  26020. }
  26021. function ensureArray$3(thing) {
  26022. if (isArray$3(thing))
  26023. return thing;
  26024. if (thing == null)
  26025. return [];
  26026. return [thing];
  26027. }
  26028. function getMatcherString$3(id, resolutionBase) {
  26029. if (resolutionBase === false) {
  26030. return id;
  26031. }
  26032. // resolve('') is valid and will default to process.cwd()
  26033. const basePath = resolve$1(resolutionBase || '')
  26034. .split(sep)
  26035. .join('/')
  26036. // escape all possible (posix + win) path characters that might interfere with regex
  26037. .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
  26038. // Note that we use posix.join because:
  26039. // 1. the basePath has been normalized to use /
  26040. // 2. the incoming glob (id) matcher, also uses /
  26041. // otherwise Node will force backslash (\) on windows
  26042. return posix$1.join(basePath, id);
  26043. }
  26044. const createFilter$3 = function createFilter(include, exclude, options) {
  26045. const resolutionBase = options && options.resolve;
  26046. const getMatcher = (id) => id instanceof RegExp
  26047. ? id
  26048. : {
  26049. test: (what) => {
  26050. // this refactor is a tad overly verbose but makes for easy debugging
  26051. const pattern = getMatcherString$3(id, resolutionBase);
  26052. const fn = picomatch(pattern, { dot: true });
  26053. const result = fn(what);
  26054. return result;
  26055. }
  26056. };
  26057. const includeMatchers = ensureArray$3(include).map(getMatcher);
  26058. const excludeMatchers = ensureArray$3(exclude).map(getMatcher);
  26059. return function result(id) {
  26060. if (typeof id !== 'string')
  26061. return false;
  26062. if (/\0/.test(id))
  26063. return false;
  26064. const pathId = id.split(sep).join('/');
  26065. for (let i = 0; i < excludeMatchers.length; ++i) {
  26066. const matcher = excludeMatchers[i];
  26067. if (matcher.test(pathId))
  26068. return false;
  26069. }
  26070. for (let i = 0; i < includeMatchers.length; ++i) {
  26071. const matcher = includeMatchers[i];
  26072. if (matcher.test(pathId))
  26073. return true;
  26074. }
  26075. return !includeMatchers.length;
  26076. };
  26077. };
  26078. const reservedWords$3 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
  26079. const builtins$4 = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
  26080. const forbiddenIdentifiers$3 = new Set(`${reservedWords$3} ${builtins$4}`.split(' '));
  26081. forbiddenIdentifiers$3.add('');
  26082. const makeLegalIdentifier$1 = function makeLegalIdentifier(str) {
  26083. let identifier = str
  26084. .replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
  26085. .replace(/[^$_a-zA-Z0-9]/g, '_');
  26086. if (/\d/.test(identifier[0]) || forbiddenIdentifiers$3.has(identifier)) {
  26087. identifier = `_${identifier}`;
  26088. }
  26089. return identifier || '_';
  26090. };
  26091. function stringify$1(obj) {
  26092. return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`);
  26093. }
  26094. function serializeArray$1(arr, indent, baseIndent) {
  26095. let output = '[';
  26096. const separator = indent ? `\n${baseIndent}${indent}` : '';
  26097. for (let i = 0; i < arr.length; i++) {
  26098. const key = arr[i];
  26099. output += `${i > 0 ? ',' : ''}${separator}${serialize$1(key, indent, baseIndent + indent)}`;
  26100. }
  26101. return `${output}${indent ? `\n${baseIndent}` : ''}]`;
  26102. }
  26103. function serializeObject$1(obj, indent, baseIndent) {
  26104. let output = '{';
  26105. const separator = indent ? `\n${baseIndent}${indent}` : '';
  26106. const entries = Object.entries(obj);
  26107. for (let i = 0; i < entries.length; i++) {
  26108. const [key, value] = entries[i];
  26109. const stringKey = makeLegalIdentifier$1(key) === key ? key : stringify$1(key);
  26110. output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize$1(value, indent, baseIndent + indent)}`;
  26111. }
  26112. return `${output}${indent ? `\n${baseIndent}` : ''}}`;
  26113. }
  26114. function serialize$1(obj, indent, baseIndent) {
  26115. if (obj === Infinity)
  26116. return 'Infinity';
  26117. if (obj === -Infinity)
  26118. return '-Infinity';
  26119. if (obj === 0 && 1 / obj === -Infinity)
  26120. return '-0';
  26121. if (obj instanceof Date)
  26122. return `new Date(${obj.getTime()})`;
  26123. if (obj instanceof RegExp)
  26124. return obj.toString();
  26125. if (obj !== obj)
  26126. return 'NaN'; // eslint-disable-line no-self-compare
  26127. if (Array.isArray(obj))
  26128. return serializeArray$1(obj, indent, baseIndent);
  26129. if (obj === null)
  26130. return 'null';
  26131. if (typeof obj === 'object')
  26132. return serializeObject$1(obj, indent, baseIndent);
  26133. return stringify$1(obj);
  26134. }
  26135. const dataToEsm$1 = function dataToEsm(data, options = {}) {
  26136. const t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
  26137. const _ = options.compact ? '' : ' ';
  26138. const n = options.compact ? '' : '\n';
  26139. const declarationType = options.preferConst ? 'const' : 'var';
  26140. if (options.namedExports === false ||
  26141. typeof data !== 'object' ||
  26142. Array.isArray(data) ||
  26143. data instanceof Date ||
  26144. data instanceof RegExp ||
  26145. data === null) {
  26146. const code = serialize$1(data, options.compact ? null : t, '');
  26147. const magic = _ || (/^[{[\-\/]/.test(code) ? '' : ' '); // eslint-disable-line no-useless-escape
  26148. return `export default${magic}${code};`;
  26149. }
  26150. let namedExportCode = '';
  26151. const defaultExportRows = [];
  26152. for (const [key, value] of Object.entries(data)) {
  26153. if (key === makeLegalIdentifier$1(key)) {
  26154. if (options.objectShorthand)
  26155. defaultExportRows.push(key);
  26156. else
  26157. defaultExportRows.push(`${key}:${_}${key}`);
  26158. namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize$1(value, options.compact ? null : t, '')};${n}`;
  26159. }
  26160. else {
  26161. defaultExportRows.push(`${stringify$1(key)}:${_}${serialize$1(value, options.compact ? null : t, '')}`);
  26162. }
  26163. }
  26164. return `${namedExportCode}export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`;
  26165. };
  26166. function json(options) {
  26167. if ( options === void 0 ) options = {};
  26168. var filter = createFilter$3(options.include, options.exclude);
  26169. var indent = 'indent' in options ? options.indent : '\t';
  26170. return {
  26171. name: 'json',
  26172. // eslint-disable-next-line no-shadow
  26173. transform: function transform(json, id) {
  26174. if (id.slice(-5) !== '.json' || !filter(id)) { return null; }
  26175. try {
  26176. var parsed = JSON.parse(json);
  26177. return {
  26178. code: dataToEsm$1(parsed, {
  26179. preferConst: options.preferConst,
  26180. compact: options.compact,
  26181. namedExports: options.namedExports,
  26182. indent: indent
  26183. }),
  26184. map: { mappings: '' }
  26185. };
  26186. } catch (err) {
  26187. var message = 'Could not parse JSON file';
  26188. var position = parseInt(/[\d]/.exec(err.message)[0], 10);
  26189. this.warn({ message: message, id: id, position: position });
  26190. return null;
  26191. }
  26192. }
  26193. };
  26194. }
  26195. const {builtinModules} = Module$1;
  26196. const ignoreList = [
  26197. 'sys'
  26198. ];
  26199. // eslint-disable-next-line node/no-deprecated-api
  26200. var builtinModules_1 = (builtinModules)
  26201. .filter(x => !/^_|^(internal|v8|node-inspect)\/|\//.test(x) && !ignoreList.includes(x))
  26202. .sort();
  26203. var isMergeableObject = function isMergeableObject(value) {
  26204. return isNonNullObject(value)
  26205. && !isSpecial(value)
  26206. };
  26207. function isNonNullObject(value) {
  26208. return !!value && typeof value === 'object'
  26209. }
  26210. function isSpecial(value) {
  26211. var stringValue = Object.prototype.toString.call(value);
  26212. return stringValue === '[object RegExp]'
  26213. || stringValue === '[object Date]'
  26214. || isReactElement(value)
  26215. }
  26216. // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
  26217. var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
  26218. var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
  26219. function isReactElement(value) {
  26220. return value.$$typeof === REACT_ELEMENT_TYPE
  26221. }
  26222. function emptyTarget(val) {
  26223. return Array.isArray(val) ? [] : {}
  26224. }
  26225. function cloneUnlessOtherwiseSpecified(value, options) {
  26226. return (options.clone !== false && options.isMergeableObject(value))
  26227. ? deepmerge(emptyTarget(value), value, options)
  26228. : value
  26229. }
  26230. function defaultArrayMerge(target, source, options) {
  26231. return target.concat(source).map(function(element) {
  26232. return cloneUnlessOtherwiseSpecified(element, options)
  26233. })
  26234. }
  26235. function getMergeFunction(key, options) {
  26236. if (!options.customMerge) {
  26237. return deepmerge
  26238. }
  26239. var customMerge = options.customMerge(key);
  26240. return typeof customMerge === 'function' ? customMerge : deepmerge
  26241. }
  26242. function getEnumerableOwnPropertySymbols(target) {
  26243. return Object.getOwnPropertySymbols
  26244. ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
  26245. return target.propertyIsEnumerable(symbol)
  26246. })
  26247. : []
  26248. }
  26249. function getKeys(target) {
  26250. return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
  26251. }
  26252. function propertyIsOnObject(object, property) {
  26253. try {
  26254. return property in object
  26255. } catch(_) {
  26256. return false
  26257. }
  26258. }
  26259. // Protects from prototype poisoning and unexpected merging up the prototype chain.
  26260. function propertyIsUnsafe(target, key) {
  26261. return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
  26262. && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
  26263. && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
  26264. }
  26265. function mergeObject(target, source, options) {
  26266. var destination = {};
  26267. if (options.isMergeableObject(target)) {
  26268. getKeys(target).forEach(function(key) {
  26269. destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
  26270. });
  26271. }
  26272. getKeys(source).forEach(function(key) {
  26273. if (propertyIsUnsafe(target, key)) {
  26274. return
  26275. }
  26276. if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
  26277. destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
  26278. } else {
  26279. destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
  26280. }
  26281. });
  26282. return destination
  26283. }
  26284. function deepmerge(target, source, options) {
  26285. options = options || {};
  26286. options.arrayMerge = options.arrayMerge || defaultArrayMerge;
  26287. options.isMergeableObject = options.isMergeableObject || isMergeableObject;
  26288. // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
  26289. // implementations can use it. The caller may not replace it.
  26290. options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
  26291. var sourceIsArray = Array.isArray(source);
  26292. var targetIsArray = Array.isArray(target);
  26293. var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
  26294. if (!sourceAndTargetTypesMatch) {
  26295. return cloneUnlessOtherwiseSpecified(source, options)
  26296. } else if (sourceIsArray) {
  26297. return options.arrayMerge(target, source, options)
  26298. } else {
  26299. return mergeObject(target, source, options)
  26300. }
  26301. }
  26302. deepmerge.all = function deepmergeAll(array, options) {
  26303. if (!Array.isArray(array)) {
  26304. throw new Error('first argument should be an array')
  26305. }
  26306. return array.reduce(function(prev, next) {
  26307. return deepmerge(prev, next, options)
  26308. }, {})
  26309. };
  26310. var deepmerge_1 = deepmerge;
  26311. var cjs$1 = deepmerge_1;
  26312. // no idea what these regular expressions do,
  26313. // but i extracted it from https://github.com/yahoo/js-module-formats/blob/master/index.js#L18
  26314. var ES6ImportExportRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(import\s+['"]|(import|module)\s+[^"'\(\)\n;]+\s+from\s+['"]|export\s+(\*|\{|default|function|var|const|let|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*))/;
  26315. var ES6AliasRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(export\s*\*\s*from\s*(?:'([^']+)'|"([^"]+)"))/;
  26316. var isModule = function (sauce) {
  26317. return ES6ImportExportRegExp.test(sauce)
  26318. || ES6AliasRegExp.test(sauce);
  26319. };
  26320. // Helper since Typescript can't detect readonly arrays with Array.isArray
  26321. function isArray$2(arg) {
  26322. return Array.isArray(arg);
  26323. }
  26324. function ensureArray$2(thing) {
  26325. if (isArray$2(thing))
  26326. return thing;
  26327. if (thing == null)
  26328. return [];
  26329. return [thing];
  26330. }
  26331. function getMatcherString$2(id, resolutionBase) {
  26332. if (resolutionBase === false) {
  26333. return id;
  26334. }
  26335. // resolve('') is valid and will default to process.cwd()
  26336. const basePath = resolve$1(resolutionBase || '')
  26337. .split(sep)
  26338. .join('/')
  26339. // escape all possible (posix + win) path characters that might interfere with regex
  26340. .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
  26341. // Note that we use posix.join because:
  26342. // 1. the basePath has been normalized to use /
  26343. // 2. the incoming glob (id) matcher, also uses /
  26344. // otherwise Node will force backslash (\) on windows
  26345. return posix$1.join(basePath, id);
  26346. }
  26347. const createFilter$2 = function createFilter(include, exclude, options) {
  26348. const resolutionBase = options && options.resolve;
  26349. const getMatcher = (id) => id instanceof RegExp
  26350. ? id
  26351. : {
  26352. test: (what) => {
  26353. // this refactor is a tad overly verbose but makes for easy debugging
  26354. const pattern = getMatcherString$2(id, resolutionBase);
  26355. const fn = picomatch(pattern, { dot: true });
  26356. const result = fn(what);
  26357. return result;
  26358. }
  26359. };
  26360. const includeMatchers = ensureArray$2(include).map(getMatcher);
  26361. const excludeMatchers = ensureArray$2(exclude).map(getMatcher);
  26362. return function result(id) {
  26363. if (typeof id !== 'string')
  26364. return false;
  26365. if (/\0/.test(id))
  26366. return false;
  26367. const pathId = id.split(sep).join('/');
  26368. for (let i = 0; i < excludeMatchers.length; ++i) {
  26369. const matcher = excludeMatchers[i];
  26370. if (matcher.test(pathId))
  26371. return false;
  26372. }
  26373. for (let i = 0; i < includeMatchers.length; ++i) {
  26374. const matcher = includeMatchers[i];
  26375. if (matcher.test(pathId))
  26376. return true;
  26377. }
  26378. return !includeMatchers.length;
  26379. };
  26380. };
  26381. const reservedWords$2 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
  26382. const builtins$3 = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
  26383. const forbiddenIdentifiers$2 = new Set(`${reservedWords$2} ${builtins$3}`.split(' '));
  26384. forbiddenIdentifiers$2.add('');
  26385. const exists = promisify(fs$3.exists);
  26386. const readFile$1 = promisify(fs$3.readFile);
  26387. const realpath = promisify(fs$3.realpath);
  26388. const stat = promisify(fs$3.stat);
  26389. const onError = (error) => {
  26390. if (error.code === 'ENOENT') {
  26391. return false;
  26392. }
  26393. throw error;
  26394. };
  26395. const makeCache = (fn) => {
  26396. const cache = new Map();
  26397. const wrapped = async (param, done) => {
  26398. if (cache.has(param) === false) {
  26399. cache.set(
  26400. param,
  26401. fn(param).catch((err) => {
  26402. cache.delete(param);
  26403. throw err;
  26404. })
  26405. );
  26406. }
  26407. try {
  26408. const result = cache.get(param);
  26409. const value = await result;
  26410. return done(null, value);
  26411. } catch (error) {
  26412. return done(error);
  26413. }
  26414. };
  26415. wrapped.clear = () => cache.clear();
  26416. return wrapped;
  26417. };
  26418. const isDirCached = makeCache(async (file) => {
  26419. try {
  26420. const stats = await stat(file);
  26421. return stats.isDirectory();
  26422. } catch (error) {
  26423. return onError(error);
  26424. }
  26425. });
  26426. const isFileCached = makeCache(async (file) => {
  26427. try {
  26428. const stats = await stat(file);
  26429. return stats.isFile();
  26430. } catch (error) {
  26431. return onError(error);
  26432. }
  26433. });
  26434. const readCachedFile = makeCache(readFile$1);
  26435. const resolveId$1 = promisify(resolve);
  26436. // returns the imported package name for bare module imports
  26437. function getPackageName(id) {
  26438. if (id.startsWith('.') || id.startsWith('/')) {
  26439. return null;
  26440. }
  26441. const split = id.split('/');
  26442. // @my-scope/my-package/foo.js -> @my-scope/my-package
  26443. // @my-scope/my-package -> @my-scope/my-package
  26444. if (split[0][0] === '@') {
  26445. return `${split[0]}/${split[1]}`;
  26446. }
  26447. // my-package/foo.js -> my-package
  26448. // my-package -> my-package
  26449. return split[0];
  26450. }
  26451. function getMainFields(options) {
  26452. let mainFields;
  26453. if (options.mainFields) {
  26454. ({ mainFields } = options);
  26455. } else {
  26456. mainFields = ['module', 'main'];
  26457. }
  26458. if (options.browser && mainFields.indexOf('browser') === -1) {
  26459. return ['browser'].concat(mainFields);
  26460. }
  26461. if (!mainFields.length) {
  26462. throw new Error('Please ensure at least one `mainFields` value is specified');
  26463. }
  26464. return mainFields;
  26465. }
  26466. function getPackageInfo(options) {
  26467. const { cache, extensions, pkg, mainFields, preserveSymlinks, useBrowserOverrides } = options;
  26468. let { pkgPath } = options;
  26469. if (cache.has(pkgPath)) {
  26470. return cache.get(pkgPath);
  26471. }
  26472. // browserify/resolve doesn't realpath paths returned in its packageFilter callback
  26473. if (!preserveSymlinks) {
  26474. pkgPath = realpathSync$2(pkgPath);
  26475. }
  26476. const pkgRoot = dirname(pkgPath);
  26477. const packageInfo = {
  26478. // copy as we are about to munge the `main` field of `pkg`.
  26479. packageJson: Object.assign({}, pkg),
  26480. // path to package.json file
  26481. packageJsonPath: pkgPath,
  26482. // directory containing the package.json
  26483. root: pkgRoot,
  26484. // which main field was used during resolution of this module (main, module, or browser)
  26485. resolvedMainField: 'main',
  26486. // whether the browser map was used to resolve the entry point to this module
  26487. browserMappedMain: false,
  26488. // the entry point of the module with respect to the selected main field and any
  26489. // relevant browser mappings.
  26490. resolvedEntryPoint: ''
  26491. };
  26492. let overriddenMain = false;
  26493. for (let i = 0; i < mainFields.length; i++) {
  26494. const field = mainFields[i];
  26495. if (typeof pkg[field] === 'string') {
  26496. pkg.main = pkg[field];
  26497. packageInfo.resolvedMainField = field;
  26498. overriddenMain = true;
  26499. break;
  26500. }
  26501. }
  26502. const internalPackageInfo = {
  26503. cachedPkg: pkg,
  26504. hasModuleSideEffects: () => null,
  26505. hasPackageEntry: overriddenMain !== false || mainFields.indexOf('main') !== -1,
  26506. packageBrowserField:
  26507. useBrowserOverrides &&
  26508. typeof pkg.browser === 'object' &&
  26509. Object.keys(pkg.browser).reduce((browser, key) => {
  26510. let resolved = pkg.browser[key];
  26511. if (resolved && resolved[0] === '.') {
  26512. resolved = resolve$1(pkgRoot, resolved);
  26513. }
  26514. /* eslint-disable no-param-reassign */
  26515. browser[key] = resolved;
  26516. if (key[0] === '.') {
  26517. const absoluteKey = resolve$1(pkgRoot, key);
  26518. browser[absoluteKey] = resolved;
  26519. if (!extname$1(key)) {
  26520. extensions.reduce((subBrowser, ext) => {
  26521. subBrowser[absoluteKey + ext] = subBrowser[key];
  26522. return subBrowser;
  26523. }, browser);
  26524. }
  26525. }
  26526. return browser;
  26527. }, {}),
  26528. packageInfo
  26529. };
  26530. const browserMap = internalPackageInfo.packageBrowserField;
  26531. if (
  26532. useBrowserOverrides &&
  26533. typeof pkg.browser === 'object' &&
  26534. // eslint-disable-next-line no-prototype-builtins
  26535. browserMap.hasOwnProperty(pkg.main)
  26536. ) {
  26537. packageInfo.resolvedEntryPoint = browserMap[pkg.main];
  26538. packageInfo.browserMappedMain = true;
  26539. } else {
  26540. // index.node is technically a valid default entrypoint as well...
  26541. packageInfo.resolvedEntryPoint = resolve$1(pkgRoot, pkg.main || 'index.js');
  26542. packageInfo.browserMappedMain = false;
  26543. }
  26544. const packageSideEffects = pkg.sideEffects;
  26545. if (typeof packageSideEffects === 'boolean') {
  26546. internalPackageInfo.hasModuleSideEffects = () => packageSideEffects;
  26547. } else if (Array.isArray(packageSideEffects)) {
  26548. internalPackageInfo.hasModuleSideEffects = createFilter$2(packageSideEffects, null, {
  26549. resolve: pkgRoot
  26550. });
  26551. }
  26552. cache.set(pkgPath, internalPackageInfo);
  26553. return internalPackageInfo;
  26554. }
  26555. function normalizeInput(input) {
  26556. if (Array.isArray(input)) {
  26557. return input;
  26558. } else if (typeof input === 'object') {
  26559. return Object.values(input);
  26560. }
  26561. // otherwise it's a string
  26562. return [input];
  26563. }
  26564. // Resolve module specifiers in order. Promise resolves to the first module that resolves
  26565. // successfully, or the error that resulted from the last attempted module resolution.
  26566. function resolveImportSpecifiers(importSpecifierList, resolveOptions) {
  26567. let promise = Promise.resolve();
  26568. for (let i = 0; i < importSpecifierList.length; i++) {
  26569. promise = promise.then((value) => {
  26570. // if we've already resolved to something, just return it.
  26571. if (value) {
  26572. return value;
  26573. }
  26574. return resolveId$1(importSpecifierList[i], resolveOptions).then((result) => {
  26575. if (!resolveOptions.preserveSymlinks) {
  26576. result = realpathSync$2(result);
  26577. }
  26578. return result;
  26579. });
  26580. });
  26581. if (i < importSpecifierList.length - 1) {
  26582. // swallow MODULE_NOT_FOUND errors from all but the last resolution
  26583. promise = promise.catch((error) => {
  26584. if (error.code !== 'MODULE_NOT_FOUND') {
  26585. throw error;
  26586. }
  26587. });
  26588. }
  26589. }
  26590. return promise;
  26591. }
  26592. /* eslint-disable no-param-reassign, no-shadow, no-undefined */
  26593. const builtins$2 = new Set(builtinModules_1);
  26594. const ES6_BROWSER_EMPTY = '\0node-resolve:empty.js';
  26595. const nullFn = () => null;
  26596. const deepFreeze = (object) => {
  26597. Object.freeze(object);
  26598. for (const value of Object.values(object)) {
  26599. if (typeof value === 'object' && !Object.isFrozen(value)) {
  26600. deepFreeze(value);
  26601. }
  26602. }
  26603. return object;
  26604. };
  26605. const defaults = {
  26606. customResolveOptions: {},
  26607. dedupe: [],
  26608. // It's important that .mjs is listed before .js so that Rollup will interpret npm modules
  26609. // which deploy both ESM .mjs and CommonJS .js files as ESM.
  26610. extensions: ['.mjs', '.js', '.json', '.node'],
  26611. resolveOnly: []
  26612. };
  26613. deepFreeze(cjs$1({}, defaults));
  26614. function nodeResolve(opts = {}) {
  26615. const options = Object.assign({}, defaults, opts);
  26616. const { customResolveOptions, extensions, jail } = options;
  26617. const warnings = [];
  26618. const packageInfoCache = new Map();
  26619. const idToPackageInfo = new Map();
  26620. const mainFields = getMainFields(options);
  26621. const useBrowserOverrides = mainFields.indexOf('browser') !== -1;
  26622. const isPreferBuiltinsSet = options.preferBuiltins === true || options.preferBuiltins === false;
  26623. const preferBuiltins = isPreferBuiltinsSet ? options.preferBuiltins : true;
  26624. const rootDir = options.rootDir || process.cwd();
  26625. let { dedupe } = options;
  26626. let rollupOptions;
  26627. if (options.only) {
  26628. warnings.push('node-resolve: The `only` options is deprecated, please use `resolveOnly`');
  26629. options.resolveOnly = options.only;
  26630. }
  26631. if (typeof dedupe !== 'function') {
  26632. dedupe = (importee) =>
  26633. options.dedupe.includes(importee) || options.dedupe.includes(getPackageName(importee));
  26634. }
  26635. const resolveOnly = options.resolveOnly.map((pattern) => {
  26636. if (pattern instanceof RegExp) {
  26637. return pattern;
  26638. }
  26639. const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
  26640. return new RegExp(`^${normalized}$`);
  26641. });
  26642. const browserMapCache = new Map();
  26643. let preserveSymlinks;
  26644. return {
  26645. name: 'node-resolve',
  26646. buildStart(options) {
  26647. rollupOptions = options;
  26648. for (const warning of warnings) {
  26649. this.warn(warning);
  26650. }
  26651. ({ preserveSymlinks } = options);
  26652. },
  26653. generateBundle() {
  26654. readCachedFile.clear();
  26655. isFileCached.clear();
  26656. isDirCached.clear();
  26657. },
  26658. async resolveId(importee, importer) {
  26659. if (importee === ES6_BROWSER_EMPTY) {
  26660. return importee;
  26661. }
  26662. // ignore IDs with null character, these belong to other plugins
  26663. if (/\0/.test(importee)) return null;
  26664. // strip hash and query params from import
  26665. const [withoutHash, hash] = importee.split('#');
  26666. const [importPath, params] = withoutHash.split('?');
  26667. const importSuffix = `${params ? `?${params}` : ''}${hash ? `#${hash}` : ''}`;
  26668. importee = importPath;
  26669. const basedir = !importer || dedupe(importee) ? rootDir : dirname(importer);
  26670. // https://github.com/defunctzombie/package-browser-field-spec
  26671. const browser = browserMapCache.get(importer);
  26672. if (useBrowserOverrides && browser) {
  26673. const resolvedImportee = resolve$1(basedir, importee);
  26674. if (browser[importee] === false || browser[resolvedImportee] === false) {
  26675. return ES6_BROWSER_EMPTY;
  26676. }
  26677. const browserImportee =
  26678. browser[importee] ||
  26679. browser[resolvedImportee] ||
  26680. browser[`${resolvedImportee}.js`] ||
  26681. browser[`${resolvedImportee}.json`];
  26682. if (browserImportee) {
  26683. importee = browserImportee;
  26684. }
  26685. }
  26686. const parts = importee.split(/[/\\]/);
  26687. let id = parts.shift();
  26688. let isRelativeImport = false;
  26689. if (id[0] === '@' && parts.length > 0) {
  26690. // scoped packages
  26691. id += `/${parts.shift()}`;
  26692. } else if (id[0] === '.') {
  26693. // an import relative to the parent dir of the importer
  26694. id = resolve$1(basedir, importee);
  26695. isRelativeImport = true;
  26696. }
  26697. if (
  26698. !isRelativeImport &&
  26699. resolveOnly.length &&
  26700. !resolveOnly.some((pattern) => pattern.test(id))
  26701. ) {
  26702. if (normalizeInput(rollupOptions.input).includes(importee)) {
  26703. return null;
  26704. }
  26705. return false;
  26706. }
  26707. let hasModuleSideEffects = nullFn;
  26708. let hasPackageEntry = true;
  26709. let packageBrowserField = false;
  26710. let packageInfo;
  26711. const filter = (pkg, pkgPath) => {
  26712. const info = getPackageInfo({
  26713. cache: packageInfoCache,
  26714. extensions,
  26715. pkg,
  26716. pkgPath,
  26717. mainFields,
  26718. preserveSymlinks,
  26719. useBrowserOverrides
  26720. });
  26721. ({ packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = info);
  26722. return info.cachedPkg;
  26723. };
  26724. let resolveOptions = {
  26725. basedir,
  26726. packageFilter: filter,
  26727. readFile: readCachedFile,
  26728. isFile: isFileCached,
  26729. isDirectory: isDirCached,
  26730. extensions
  26731. };
  26732. if (preserveSymlinks !== undefined) {
  26733. resolveOptions.preserveSymlinks = preserveSymlinks;
  26734. }
  26735. const importSpecifierList = [];
  26736. if (importer === undefined && !importee[0].match(/^\.?\.?\//)) {
  26737. // For module graph roots (i.e. when importer is undefined), we
  26738. // need to handle 'path fragments` like `foo/bar` that are commonly
  26739. // found in rollup config files. If importee doesn't look like a
  26740. // relative or absolute path, we make it relative and attempt to
  26741. // resolve it. If we don't find anything, we try resolving it as we
  26742. // got it.
  26743. importSpecifierList.push(`./${importee}`);
  26744. }
  26745. const importeeIsBuiltin = builtins$2.has(importee);
  26746. if (importeeIsBuiltin && (!preferBuiltins || !isPreferBuiltinsSet)) {
  26747. // The `resolve` library will not resolve packages with the same
  26748. // name as a node built-in module. If we're resolving something
  26749. // that's a builtin, and we don't prefer to find built-ins, we
  26750. // first try to look up a local module with that name. If we don't
  26751. // find anything, we resolve the builtin which just returns back
  26752. // the built-in's name.
  26753. importSpecifierList.push(`${importee}/`);
  26754. }
  26755. // TypeScript files may import '.js' to refer to either '.ts' or '.tsx'
  26756. if (importer && importee.endsWith('.js')) {
  26757. for (const ext of ['.ts', '.tsx']) {
  26758. if (importer.endsWith(ext) && extensions.includes(ext)) {
  26759. importSpecifierList.push(importee.replace(/.js$/, ext));
  26760. }
  26761. }
  26762. }
  26763. importSpecifierList.push(importee);
  26764. resolveOptions = Object.assign(resolveOptions, customResolveOptions);
  26765. try {
  26766. let resolved = await resolveImportSpecifiers(importSpecifierList, resolveOptions);
  26767. if (resolved && packageBrowserField) {
  26768. if (Object.prototype.hasOwnProperty.call(packageBrowserField, resolved)) {
  26769. if (!packageBrowserField[resolved]) {
  26770. browserMapCache.set(resolved, packageBrowserField);
  26771. return ES6_BROWSER_EMPTY;
  26772. }
  26773. resolved = packageBrowserField[resolved];
  26774. }
  26775. browserMapCache.set(resolved, packageBrowserField);
  26776. }
  26777. if (hasPackageEntry && !preserveSymlinks && resolved) {
  26778. const fileExists = await exists(resolved);
  26779. if (fileExists) {
  26780. resolved = await realpath(resolved);
  26781. }
  26782. }
  26783. idToPackageInfo.set(resolved, packageInfo);
  26784. if (hasPackageEntry) {
  26785. if (builtins$2.has(resolved) && preferBuiltins && isPreferBuiltinsSet) {
  26786. return null;
  26787. } else if (importeeIsBuiltin && preferBuiltins) {
  26788. if (!isPreferBuiltinsSet) {
  26789. this.warn(
  26790. `preferring built-in module '${importee}' over local alternative at '${resolved}', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning`
  26791. );
  26792. }
  26793. return null;
  26794. } else if (jail && resolved.indexOf(normalize$1(jail.trim(sep))) !== 0) {
  26795. return null;
  26796. }
  26797. }
  26798. if (resolved && options.modulesOnly) {
  26799. const code = await readFile$1(resolved, 'utf-8');
  26800. if (isModule(code)) {
  26801. return {
  26802. id: `${resolved}${importSuffix}`,
  26803. moduleSideEffects: hasModuleSideEffects(resolved)
  26804. };
  26805. }
  26806. return null;
  26807. }
  26808. const result = {
  26809. id: `${resolved}${importSuffix}`,
  26810. moduleSideEffects: hasModuleSideEffects(resolved)
  26811. };
  26812. return result;
  26813. } catch (error) {
  26814. return null;
  26815. }
  26816. },
  26817. load(importee) {
  26818. if (importee === ES6_BROWSER_EMPTY) {
  26819. return 'export default {};';
  26820. }
  26821. return null;
  26822. },
  26823. getPackageInfoForId(id) {
  26824. return idToPackageInfo.get(id);
  26825. }
  26826. };
  26827. }
  26828. var BitSet$2 = function BitSet(arg) {
  26829. this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
  26830. };
  26831. BitSet$2.prototype.add = function add (n) {
  26832. this.bits[n >> 5] |= 1 << (n & 31);
  26833. };
  26834. BitSet$2.prototype.has = function has (n) {
  26835. return !!(this.bits[n >> 5] & (1 << (n & 31)));
  26836. };
  26837. var Chunk$2 = function Chunk(start, end, content) {
  26838. this.start = start;
  26839. this.end = end;
  26840. this.original = content;
  26841. this.intro = '';
  26842. this.outro = '';
  26843. this.content = content;
  26844. this.storeName = false;
  26845. this.edited = false;
  26846. // we make these non-enumerable, for sanity while debugging
  26847. Object.defineProperties(this, {
  26848. previous: { writable: true, value: null },
  26849. next: { writable: true, value: null },
  26850. });
  26851. };
  26852. Chunk$2.prototype.appendLeft = function appendLeft (content) {
  26853. this.outro += content;
  26854. };
  26855. Chunk$2.prototype.appendRight = function appendRight (content) {
  26856. this.intro = this.intro + content;
  26857. };
  26858. Chunk$2.prototype.clone = function clone () {
  26859. var chunk = new Chunk$2(this.start, this.end, this.original);
  26860. chunk.intro = this.intro;
  26861. chunk.outro = this.outro;
  26862. chunk.content = this.content;
  26863. chunk.storeName = this.storeName;
  26864. chunk.edited = this.edited;
  26865. return chunk;
  26866. };
  26867. Chunk$2.prototype.contains = function contains (index) {
  26868. return this.start < index && index < this.end;
  26869. };
  26870. Chunk$2.prototype.eachNext = function eachNext (fn) {
  26871. var chunk = this;
  26872. while (chunk) {
  26873. fn(chunk);
  26874. chunk = chunk.next;
  26875. }
  26876. };
  26877. Chunk$2.prototype.eachPrevious = function eachPrevious (fn) {
  26878. var chunk = this;
  26879. while (chunk) {
  26880. fn(chunk);
  26881. chunk = chunk.previous;
  26882. }
  26883. };
  26884. Chunk$2.prototype.edit = function edit (content, storeName, contentOnly) {
  26885. this.content = content;
  26886. if (!contentOnly) {
  26887. this.intro = '';
  26888. this.outro = '';
  26889. }
  26890. this.storeName = storeName;
  26891. this.edited = true;
  26892. return this;
  26893. };
  26894. Chunk$2.prototype.prependLeft = function prependLeft (content) {
  26895. this.outro = content + this.outro;
  26896. };
  26897. Chunk$2.prototype.prependRight = function prependRight (content) {
  26898. this.intro = content + this.intro;
  26899. };
  26900. Chunk$2.prototype.split = function split (index) {
  26901. var sliceIndex = index - this.start;
  26902. var originalBefore = this.original.slice(0, sliceIndex);
  26903. var originalAfter = this.original.slice(sliceIndex);
  26904. this.original = originalBefore;
  26905. var newChunk = new Chunk$2(index, this.end, originalAfter);
  26906. newChunk.outro = this.outro;
  26907. this.outro = '';
  26908. this.end = index;
  26909. if (this.edited) {
  26910. // TODO is this block necessary?...
  26911. newChunk.edit('', false);
  26912. this.content = '';
  26913. } else {
  26914. this.content = originalBefore;
  26915. }
  26916. newChunk.next = this.next;
  26917. if (newChunk.next) { newChunk.next.previous = newChunk; }
  26918. newChunk.previous = this;
  26919. this.next = newChunk;
  26920. return newChunk;
  26921. };
  26922. Chunk$2.prototype.toString = function toString () {
  26923. return this.intro + this.content + this.outro;
  26924. };
  26925. Chunk$2.prototype.trimEnd = function trimEnd (rx) {
  26926. this.outro = this.outro.replace(rx, '');
  26927. if (this.outro.length) { return true; }
  26928. var trimmed = this.content.replace(rx, '');
  26929. if (trimmed.length) {
  26930. if (trimmed !== this.content) {
  26931. this.split(this.start + trimmed.length).edit('', undefined, true);
  26932. }
  26933. return true;
  26934. } else {
  26935. this.edit('', undefined, true);
  26936. this.intro = this.intro.replace(rx, '');
  26937. if (this.intro.length) { return true; }
  26938. }
  26939. };
  26940. Chunk$2.prototype.trimStart = function trimStart (rx) {
  26941. this.intro = this.intro.replace(rx, '');
  26942. if (this.intro.length) { return true; }
  26943. var trimmed = this.content.replace(rx, '');
  26944. if (trimmed.length) {
  26945. if (trimmed !== this.content) {
  26946. this.split(this.end - trimmed.length);
  26947. this.edit('', undefined, true);
  26948. }
  26949. return true;
  26950. } else {
  26951. this.edit('', undefined, true);
  26952. this.outro = this.outro.replace(rx, '');
  26953. if (this.outro.length) { return true; }
  26954. }
  26955. };
  26956. var btoa$2 = function () {
  26957. throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
  26958. };
  26959. if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
  26960. btoa$2 = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
  26961. } else if (typeof Buffer === 'function') {
  26962. btoa$2 = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
  26963. }
  26964. var SourceMap$2 = function SourceMap(properties) {
  26965. this.version = 3;
  26966. this.file = properties.file;
  26967. this.sources = properties.sources;
  26968. this.sourcesContent = properties.sourcesContent;
  26969. this.names = properties.names;
  26970. this.mappings = encode$1(properties.mappings);
  26971. };
  26972. SourceMap$2.prototype.toString = function toString () {
  26973. return JSON.stringify(this);
  26974. };
  26975. SourceMap$2.prototype.toUrl = function toUrl () {
  26976. return 'data:application/json;charset=utf-8;base64,' + btoa$2(this.toString());
  26977. };
  26978. function guessIndent$2(code) {
  26979. var lines = code.split('\n');
  26980. var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
  26981. var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
  26982. if (tabbed.length === 0 && spaced.length === 0) {
  26983. return null;
  26984. }
  26985. // More lines tabbed than spaced? Assume tabs, and
  26986. // default to tabs in the case of a tie (or nothing
  26987. // to go on)
  26988. if (tabbed.length >= spaced.length) {
  26989. return '\t';
  26990. }
  26991. // Otherwise, we need to guess the multiple
  26992. var min = spaced.reduce(function (previous, current) {
  26993. var numSpaces = /^ +/.exec(current)[0].length;
  26994. return Math.min(numSpaces, previous);
  26995. }, Infinity);
  26996. return new Array(min + 1).join(' ');
  26997. }
  26998. function getRelativePath$2(from, to) {
  26999. var fromParts = from.split(/[/\\]/);
  27000. var toParts = to.split(/[/\\]/);
  27001. fromParts.pop(); // get dirname
  27002. while (fromParts[0] === toParts[0]) {
  27003. fromParts.shift();
  27004. toParts.shift();
  27005. }
  27006. if (fromParts.length) {
  27007. var i = fromParts.length;
  27008. while (i--) { fromParts[i] = '..'; }
  27009. }
  27010. return fromParts.concat(toParts).join('/');
  27011. }
  27012. var toString$2 = Object.prototype.toString;
  27013. function isObject$3(thing) {
  27014. return toString$2.call(thing) === '[object Object]';
  27015. }
  27016. function getLocator$2(source) {
  27017. var originalLines = source.split('\n');
  27018. var lineOffsets = [];
  27019. for (var i = 0, pos = 0; i < originalLines.length; i++) {
  27020. lineOffsets.push(pos);
  27021. pos += originalLines[i].length + 1;
  27022. }
  27023. return function locate(index) {
  27024. var i = 0;
  27025. var j = lineOffsets.length;
  27026. while (i < j) {
  27027. var m = (i + j) >> 1;
  27028. if (index < lineOffsets[m]) {
  27029. j = m;
  27030. } else {
  27031. i = m + 1;
  27032. }
  27033. }
  27034. var line = i - 1;
  27035. var column = index - lineOffsets[line];
  27036. return { line: line, column: column };
  27037. };
  27038. }
  27039. var Mappings$2 = function Mappings(hires) {
  27040. this.hires = hires;
  27041. this.generatedCodeLine = 0;
  27042. this.generatedCodeColumn = 0;
  27043. this.raw = [];
  27044. this.rawSegments = this.raw[this.generatedCodeLine] = [];
  27045. this.pending = null;
  27046. };
  27047. Mappings$2.prototype.addEdit = function addEdit (sourceIndex, content, loc, nameIndex) {
  27048. if (content.length) {
  27049. var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
  27050. if (nameIndex >= 0) {
  27051. segment.push(nameIndex);
  27052. }
  27053. this.rawSegments.push(segment);
  27054. } else if (this.pending) {
  27055. this.rawSegments.push(this.pending);
  27056. }
  27057. this.advance(content);
  27058. this.pending = null;
  27059. };
  27060. Mappings$2.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
  27061. var originalCharIndex = chunk.start;
  27062. var first = true;
  27063. while (originalCharIndex < chunk.end) {
  27064. if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
  27065. this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
  27066. }
  27067. if (original[originalCharIndex] === '\n') {
  27068. loc.line += 1;
  27069. loc.column = 0;
  27070. this.generatedCodeLine += 1;
  27071. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  27072. this.generatedCodeColumn = 0;
  27073. first = true;
  27074. } else {
  27075. loc.column += 1;
  27076. this.generatedCodeColumn += 1;
  27077. first = false;
  27078. }
  27079. originalCharIndex += 1;
  27080. }
  27081. this.pending = null;
  27082. };
  27083. Mappings$2.prototype.advance = function advance (str) {
  27084. if (!str) { return; }
  27085. var lines = str.split('\n');
  27086. if (lines.length > 1) {
  27087. for (var i = 0; i < lines.length - 1; i++) {
  27088. this.generatedCodeLine++;
  27089. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  27090. }
  27091. this.generatedCodeColumn = 0;
  27092. }
  27093. this.generatedCodeColumn += lines[lines.length - 1].length;
  27094. };
  27095. var n$2 = '\n';
  27096. var warned$2 = {
  27097. insertLeft: false,
  27098. insertRight: false,
  27099. storeName: false,
  27100. };
  27101. var MagicString$2 = function MagicString(string, options) {
  27102. if ( options === void 0 ) options = {};
  27103. var chunk = new Chunk$2(0, string.length, string);
  27104. Object.defineProperties(this, {
  27105. original: { writable: true, value: string },
  27106. outro: { writable: true, value: '' },
  27107. intro: { writable: true, value: '' },
  27108. firstChunk: { writable: true, value: chunk },
  27109. lastChunk: { writable: true, value: chunk },
  27110. lastSearchedChunk: { writable: true, value: chunk },
  27111. byStart: { writable: true, value: {} },
  27112. byEnd: { writable: true, value: {} },
  27113. filename: { writable: true, value: options.filename },
  27114. indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
  27115. sourcemapLocations: { writable: true, value: new BitSet$2() },
  27116. storedNames: { writable: true, value: {} },
  27117. indentStr: { writable: true, value: guessIndent$2(string) },
  27118. });
  27119. this.byStart[0] = chunk;
  27120. this.byEnd[string.length] = chunk;
  27121. };
  27122. MagicString$2.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
  27123. this.sourcemapLocations.add(char);
  27124. };
  27125. MagicString$2.prototype.append = function append (content) {
  27126. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  27127. this.outro += content;
  27128. return this;
  27129. };
  27130. MagicString$2.prototype.appendLeft = function appendLeft (index, content) {
  27131. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  27132. this._split(index);
  27133. var chunk = this.byEnd[index];
  27134. if (chunk) {
  27135. chunk.appendLeft(content);
  27136. } else {
  27137. this.intro += content;
  27138. }
  27139. return this;
  27140. };
  27141. MagicString$2.prototype.appendRight = function appendRight (index, content) {
  27142. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  27143. this._split(index);
  27144. var chunk = this.byStart[index];
  27145. if (chunk) {
  27146. chunk.appendRight(content);
  27147. } else {
  27148. this.outro += content;
  27149. }
  27150. return this;
  27151. };
  27152. MagicString$2.prototype.clone = function clone () {
  27153. var cloned = new MagicString$2(this.original, { filename: this.filename });
  27154. var originalChunk = this.firstChunk;
  27155. var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
  27156. while (originalChunk) {
  27157. cloned.byStart[clonedChunk.start] = clonedChunk;
  27158. cloned.byEnd[clonedChunk.end] = clonedChunk;
  27159. var nextOriginalChunk = originalChunk.next;
  27160. var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
  27161. if (nextClonedChunk) {
  27162. clonedChunk.next = nextClonedChunk;
  27163. nextClonedChunk.previous = clonedChunk;
  27164. clonedChunk = nextClonedChunk;
  27165. }
  27166. originalChunk = nextOriginalChunk;
  27167. }
  27168. cloned.lastChunk = clonedChunk;
  27169. if (this.indentExclusionRanges) {
  27170. cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
  27171. }
  27172. cloned.sourcemapLocations = new BitSet$2(this.sourcemapLocations);
  27173. cloned.intro = this.intro;
  27174. cloned.outro = this.outro;
  27175. return cloned;
  27176. };
  27177. MagicString$2.prototype.generateDecodedMap = function generateDecodedMap (options) {
  27178. var this$1$1 = this;
  27179. options = options || {};
  27180. var sourceIndex = 0;
  27181. var names = Object.keys(this.storedNames);
  27182. var mappings = new Mappings$2(options.hires);
  27183. var locate = getLocator$2(this.original);
  27184. if (this.intro) {
  27185. mappings.advance(this.intro);
  27186. }
  27187. this.firstChunk.eachNext(function (chunk) {
  27188. var loc = locate(chunk.start);
  27189. if (chunk.intro.length) { mappings.advance(chunk.intro); }
  27190. if (chunk.edited) {
  27191. mappings.addEdit(
  27192. sourceIndex,
  27193. chunk.content,
  27194. loc,
  27195. chunk.storeName ? names.indexOf(chunk.original) : -1
  27196. );
  27197. } else {
  27198. mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
  27199. }
  27200. if (chunk.outro.length) { mappings.advance(chunk.outro); }
  27201. });
  27202. return {
  27203. file: options.file ? options.file.split(/[/\\]/).pop() : null,
  27204. sources: [options.source ? getRelativePath$2(options.file || '', options.source) : null],
  27205. sourcesContent: options.includeContent ? [this.original] : [null],
  27206. names: names,
  27207. mappings: mappings.raw,
  27208. };
  27209. };
  27210. MagicString$2.prototype.generateMap = function generateMap (options) {
  27211. return new SourceMap$2(this.generateDecodedMap(options));
  27212. };
  27213. MagicString$2.prototype.getIndentString = function getIndentString () {
  27214. return this.indentStr === null ? '\t' : this.indentStr;
  27215. };
  27216. MagicString$2.prototype.indent = function indent (indentStr, options) {
  27217. var pattern = /^[^\r\n]/gm;
  27218. if (isObject$3(indentStr)) {
  27219. options = indentStr;
  27220. indentStr = undefined;
  27221. }
  27222. indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
  27223. if (indentStr === '') { return this; } // noop
  27224. options = options || {};
  27225. // Process exclusion ranges
  27226. var isExcluded = {};
  27227. if (options.exclude) {
  27228. var exclusions =
  27229. typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
  27230. exclusions.forEach(function (exclusion) {
  27231. for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
  27232. isExcluded[i] = true;
  27233. }
  27234. });
  27235. }
  27236. var shouldIndentNextCharacter = options.indentStart !== false;
  27237. var replacer = function (match) {
  27238. if (shouldIndentNextCharacter) { return ("" + indentStr + match); }
  27239. shouldIndentNextCharacter = true;
  27240. return match;
  27241. };
  27242. this.intro = this.intro.replace(pattern, replacer);
  27243. var charIndex = 0;
  27244. var chunk = this.firstChunk;
  27245. while (chunk) {
  27246. var end = chunk.end;
  27247. if (chunk.edited) {
  27248. if (!isExcluded[charIndex]) {
  27249. chunk.content = chunk.content.replace(pattern, replacer);
  27250. if (chunk.content.length) {
  27251. shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
  27252. }
  27253. }
  27254. } else {
  27255. charIndex = chunk.start;
  27256. while (charIndex < end) {
  27257. if (!isExcluded[charIndex]) {
  27258. var char = this.original[charIndex];
  27259. if (char === '\n') {
  27260. shouldIndentNextCharacter = true;
  27261. } else if (char !== '\r' && shouldIndentNextCharacter) {
  27262. shouldIndentNextCharacter = false;
  27263. if (charIndex === chunk.start) {
  27264. chunk.prependRight(indentStr);
  27265. } else {
  27266. this._splitChunk(chunk, charIndex);
  27267. chunk = chunk.next;
  27268. chunk.prependRight(indentStr);
  27269. }
  27270. }
  27271. }
  27272. charIndex += 1;
  27273. }
  27274. }
  27275. charIndex = chunk.end;
  27276. chunk = chunk.next;
  27277. }
  27278. this.outro = this.outro.replace(pattern, replacer);
  27279. return this;
  27280. };
  27281. MagicString$2.prototype.insert = function insert () {
  27282. throw new Error(
  27283. 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
  27284. );
  27285. };
  27286. MagicString$2.prototype.insertLeft = function insertLeft (index, content) {
  27287. if (!warned$2.insertLeft) {
  27288. console.warn(
  27289. 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
  27290. ); // eslint-disable-line no-console
  27291. warned$2.insertLeft = true;
  27292. }
  27293. return this.appendLeft(index, content);
  27294. };
  27295. MagicString$2.prototype.insertRight = function insertRight (index, content) {
  27296. if (!warned$2.insertRight) {
  27297. console.warn(
  27298. 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
  27299. ); // eslint-disable-line no-console
  27300. warned$2.insertRight = true;
  27301. }
  27302. return this.prependRight(index, content);
  27303. };
  27304. MagicString$2.prototype.move = function move (start, end, index) {
  27305. if (index >= start && index <= end) { throw new Error('Cannot move a selection inside itself'); }
  27306. this._split(start);
  27307. this._split(end);
  27308. this._split(index);
  27309. var first = this.byStart[start];
  27310. var last = this.byEnd[end];
  27311. var oldLeft = first.previous;
  27312. var oldRight = last.next;
  27313. var newRight = this.byStart[index];
  27314. if (!newRight && last === this.lastChunk) { return this; }
  27315. var newLeft = newRight ? newRight.previous : this.lastChunk;
  27316. if (oldLeft) { oldLeft.next = oldRight; }
  27317. if (oldRight) { oldRight.previous = oldLeft; }
  27318. if (newLeft) { newLeft.next = first; }
  27319. if (newRight) { newRight.previous = last; }
  27320. if (!first.previous) { this.firstChunk = last.next; }
  27321. if (!last.next) {
  27322. this.lastChunk = first.previous;
  27323. this.lastChunk.next = null;
  27324. }
  27325. first.previous = newLeft;
  27326. last.next = newRight || null;
  27327. if (!newLeft) { this.firstChunk = first; }
  27328. if (!newRight) { this.lastChunk = last; }
  27329. return this;
  27330. };
  27331. MagicString$2.prototype.overwrite = function overwrite (start, end, content, options) {
  27332. if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
  27333. while (start < 0) { start += this.original.length; }
  27334. while (end < 0) { end += this.original.length; }
  27335. if (end > this.original.length) { throw new Error('end is out of bounds'); }
  27336. if (start === end)
  27337. { throw new Error(
  27338. 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
  27339. ); }
  27340. this._split(start);
  27341. this._split(end);
  27342. if (options === true) {
  27343. if (!warned$2.storeName) {
  27344. console.warn(
  27345. 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
  27346. ); // eslint-disable-line no-console
  27347. warned$2.storeName = true;
  27348. }
  27349. options = { storeName: true };
  27350. }
  27351. var storeName = options !== undefined ? options.storeName : false;
  27352. var contentOnly = options !== undefined ? options.contentOnly : false;
  27353. if (storeName) {
  27354. var original = this.original.slice(start, end);
  27355. Object.defineProperty(this.storedNames, original, { writable: true, value: true, enumerable: true });
  27356. }
  27357. var first = this.byStart[start];
  27358. var last = this.byEnd[end];
  27359. if (first) {
  27360. var chunk = first;
  27361. while (chunk !== last) {
  27362. if (chunk.next !== this.byStart[chunk.end]) {
  27363. throw new Error('Cannot overwrite across a split point');
  27364. }
  27365. chunk = chunk.next;
  27366. chunk.edit('', false);
  27367. }
  27368. first.edit(content, storeName, contentOnly);
  27369. } else {
  27370. // must be inserting at the end
  27371. var newChunk = new Chunk$2(start, end, '').edit(content, storeName);
  27372. // TODO last chunk in the array may not be the last chunk, if it's moved...
  27373. last.next = newChunk;
  27374. newChunk.previous = last;
  27375. }
  27376. return this;
  27377. };
  27378. MagicString$2.prototype.prepend = function prepend (content) {
  27379. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  27380. this.intro = content + this.intro;
  27381. return this;
  27382. };
  27383. MagicString$2.prototype.prependLeft = function prependLeft (index, content) {
  27384. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  27385. this._split(index);
  27386. var chunk = this.byEnd[index];
  27387. if (chunk) {
  27388. chunk.prependLeft(content);
  27389. } else {
  27390. this.intro = content + this.intro;
  27391. }
  27392. return this;
  27393. };
  27394. MagicString$2.prototype.prependRight = function prependRight (index, content) {
  27395. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  27396. this._split(index);
  27397. var chunk = this.byStart[index];
  27398. if (chunk) {
  27399. chunk.prependRight(content);
  27400. } else {
  27401. this.outro = content + this.outro;
  27402. }
  27403. return this;
  27404. };
  27405. MagicString$2.prototype.remove = function remove (start, end) {
  27406. while (start < 0) { start += this.original.length; }
  27407. while (end < 0) { end += this.original.length; }
  27408. if (start === end) { return this; }
  27409. if (start < 0 || end > this.original.length) { throw new Error('Character is out of bounds'); }
  27410. if (start > end) { throw new Error('end must be greater than start'); }
  27411. this._split(start);
  27412. this._split(end);
  27413. var chunk = this.byStart[start];
  27414. while (chunk) {
  27415. chunk.intro = '';
  27416. chunk.outro = '';
  27417. chunk.edit('');
  27418. chunk = end > chunk.end ? this.byStart[chunk.end] : null;
  27419. }
  27420. return this;
  27421. };
  27422. MagicString$2.prototype.lastChar = function lastChar () {
  27423. if (this.outro.length) { return this.outro[this.outro.length - 1]; }
  27424. var chunk = this.lastChunk;
  27425. do {
  27426. if (chunk.outro.length) { return chunk.outro[chunk.outro.length - 1]; }
  27427. if (chunk.content.length) { return chunk.content[chunk.content.length - 1]; }
  27428. if (chunk.intro.length) { return chunk.intro[chunk.intro.length - 1]; }
  27429. } while ((chunk = chunk.previous));
  27430. if (this.intro.length) { return this.intro[this.intro.length - 1]; }
  27431. return '';
  27432. };
  27433. MagicString$2.prototype.lastLine = function lastLine () {
  27434. var lineIndex = this.outro.lastIndexOf(n$2);
  27435. if (lineIndex !== -1) { return this.outro.substr(lineIndex + 1); }
  27436. var lineStr = this.outro;
  27437. var chunk = this.lastChunk;
  27438. do {
  27439. if (chunk.outro.length > 0) {
  27440. lineIndex = chunk.outro.lastIndexOf(n$2);
  27441. if (lineIndex !== -1) { return chunk.outro.substr(lineIndex + 1) + lineStr; }
  27442. lineStr = chunk.outro + lineStr;
  27443. }
  27444. if (chunk.content.length > 0) {
  27445. lineIndex = chunk.content.lastIndexOf(n$2);
  27446. if (lineIndex !== -1) { return chunk.content.substr(lineIndex + 1) + lineStr; }
  27447. lineStr = chunk.content + lineStr;
  27448. }
  27449. if (chunk.intro.length > 0) {
  27450. lineIndex = chunk.intro.lastIndexOf(n$2);
  27451. if (lineIndex !== -1) { return chunk.intro.substr(lineIndex + 1) + lineStr; }
  27452. lineStr = chunk.intro + lineStr;
  27453. }
  27454. } while ((chunk = chunk.previous));
  27455. lineIndex = this.intro.lastIndexOf(n$2);
  27456. if (lineIndex !== -1) { return this.intro.substr(lineIndex + 1) + lineStr; }
  27457. return this.intro + lineStr;
  27458. };
  27459. MagicString$2.prototype.slice = function slice (start, end) {
  27460. if ( start === void 0 ) start = 0;
  27461. if ( end === void 0 ) end = this.original.length;
  27462. while (start < 0) { start += this.original.length; }
  27463. while (end < 0) { end += this.original.length; }
  27464. var result = '';
  27465. // find start chunk
  27466. var chunk = this.firstChunk;
  27467. while (chunk && (chunk.start > start || chunk.end <= start)) {
  27468. // found end chunk before start
  27469. if (chunk.start < end && chunk.end >= end) {
  27470. return result;
  27471. }
  27472. chunk = chunk.next;
  27473. }
  27474. if (chunk && chunk.edited && chunk.start !== start)
  27475. { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
  27476. var startChunk = chunk;
  27477. while (chunk) {
  27478. if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
  27479. result += chunk.intro;
  27480. }
  27481. var containsEnd = chunk.start < end && chunk.end >= end;
  27482. if (containsEnd && chunk.edited && chunk.end !== end)
  27483. { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
  27484. var sliceStart = startChunk === chunk ? start - chunk.start : 0;
  27485. var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
  27486. result += chunk.content.slice(sliceStart, sliceEnd);
  27487. if (chunk.outro && (!containsEnd || chunk.end === end)) {
  27488. result += chunk.outro;
  27489. }
  27490. if (containsEnd) {
  27491. break;
  27492. }
  27493. chunk = chunk.next;
  27494. }
  27495. return result;
  27496. };
  27497. // TODO deprecate this? not really very useful
  27498. MagicString$2.prototype.snip = function snip (start, end) {
  27499. var clone = this.clone();
  27500. clone.remove(0, start);
  27501. clone.remove(end, clone.original.length);
  27502. return clone;
  27503. };
  27504. MagicString$2.prototype._split = function _split (index) {
  27505. if (this.byStart[index] || this.byEnd[index]) { return; }
  27506. var chunk = this.lastSearchedChunk;
  27507. var searchForward = index > chunk.end;
  27508. while (chunk) {
  27509. if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
  27510. chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
  27511. }
  27512. };
  27513. MagicString$2.prototype._splitChunk = function _splitChunk (chunk, index) {
  27514. if (chunk.edited && chunk.content.length) {
  27515. // zero-length edited chunks are a special case (overlapping replacements)
  27516. var loc = getLocator$2(this.original)(index);
  27517. throw new Error(
  27518. ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
  27519. );
  27520. }
  27521. var newChunk = chunk.split(index);
  27522. this.byEnd[index] = chunk;
  27523. this.byStart[index] = newChunk;
  27524. this.byEnd[newChunk.end] = newChunk;
  27525. if (chunk === this.lastChunk) { this.lastChunk = newChunk; }
  27526. this.lastSearchedChunk = chunk;
  27527. return true;
  27528. };
  27529. MagicString$2.prototype.toString = function toString () {
  27530. var str = this.intro;
  27531. var chunk = this.firstChunk;
  27532. while (chunk) {
  27533. str += chunk.toString();
  27534. chunk = chunk.next;
  27535. }
  27536. return str + this.outro;
  27537. };
  27538. MagicString$2.prototype.isEmpty = function isEmpty () {
  27539. var chunk = this.firstChunk;
  27540. do {
  27541. if (
  27542. (chunk.intro.length && chunk.intro.trim()) ||
  27543. (chunk.content.length && chunk.content.trim()) ||
  27544. (chunk.outro.length && chunk.outro.trim())
  27545. )
  27546. { return false; }
  27547. } while ((chunk = chunk.next));
  27548. return true;
  27549. };
  27550. MagicString$2.prototype.length = function length () {
  27551. var chunk = this.firstChunk;
  27552. var length = 0;
  27553. do {
  27554. length += chunk.intro.length + chunk.content.length + chunk.outro.length;
  27555. } while ((chunk = chunk.next));
  27556. return length;
  27557. };
  27558. MagicString$2.prototype.trimLines = function trimLines () {
  27559. return this.trim('[\\r\\n]');
  27560. };
  27561. MagicString$2.prototype.trim = function trim (charType) {
  27562. return this.trimStart(charType).trimEnd(charType);
  27563. };
  27564. MagicString$2.prototype.trimEndAborted = function trimEndAborted (charType) {
  27565. var rx = new RegExp((charType || '\\s') + '+$');
  27566. this.outro = this.outro.replace(rx, '');
  27567. if (this.outro.length) { return true; }
  27568. var chunk = this.lastChunk;
  27569. do {
  27570. var end = chunk.end;
  27571. var aborted = chunk.trimEnd(rx);
  27572. // if chunk was trimmed, we have a new lastChunk
  27573. if (chunk.end !== end) {
  27574. if (this.lastChunk === chunk) {
  27575. this.lastChunk = chunk.next;
  27576. }
  27577. this.byEnd[chunk.end] = chunk;
  27578. this.byStart[chunk.next.start] = chunk.next;
  27579. this.byEnd[chunk.next.end] = chunk.next;
  27580. }
  27581. if (aborted) { return true; }
  27582. chunk = chunk.previous;
  27583. } while (chunk);
  27584. return false;
  27585. };
  27586. MagicString$2.prototype.trimEnd = function trimEnd (charType) {
  27587. this.trimEndAborted(charType);
  27588. return this;
  27589. };
  27590. MagicString$2.prototype.trimStartAborted = function trimStartAborted (charType) {
  27591. var rx = new RegExp('^' + (charType || '\\s') + '+');
  27592. this.intro = this.intro.replace(rx, '');
  27593. if (this.intro.length) { return true; }
  27594. var chunk = this.firstChunk;
  27595. do {
  27596. var end = chunk.end;
  27597. var aborted = chunk.trimStart(rx);
  27598. if (chunk.end !== end) {
  27599. // special case...
  27600. if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
  27601. this.byEnd[chunk.end] = chunk;
  27602. this.byStart[chunk.next.start] = chunk.next;
  27603. this.byEnd[chunk.next.end] = chunk.next;
  27604. }
  27605. if (aborted) { return true; }
  27606. chunk = chunk.next;
  27607. } while (chunk);
  27608. return false;
  27609. };
  27610. MagicString$2.prototype.trimStart = function trimStart (charType) {
  27611. this.trimStartAborted(charType);
  27612. return this;
  27613. };
  27614. // Helper since Typescript can't detect readonly arrays with Array.isArray
  27615. function isArray$1(arg) {
  27616. return Array.isArray(arg);
  27617. }
  27618. function ensureArray$1(thing) {
  27619. if (isArray$1(thing))
  27620. return thing;
  27621. if (thing == null)
  27622. return [];
  27623. return [thing];
  27624. }
  27625. function getMatcherString$1(id, resolutionBase) {
  27626. if (resolutionBase === false) {
  27627. return id;
  27628. }
  27629. // resolve('') is valid and will default to process.cwd()
  27630. const basePath = resolve$1(resolutionBase || '')
  27631. .split(sep)
  27632. .join('/')
  27633. // escape all possible (posix + win) path characters that might interfere with regex
  27634. .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
  27635. // Note that we use posix.join because:
  27636. // 1. the basePath has been normalized to use /
  27637. // 2. the incoming glob (id) matcher, also uses /
  27638. // otherwise Node will force backslash (\) on windows
  27639. return posix$1.join(basePath, id);
  27640. }
  27641. const createFilter$1 = function createFilter(include, exclude, options) {
  27642. const resolutionBase = options && options.resolve;
  27643. const getMatcher = (id) => id instanceof RegExp
  27644. ? id
  27645. : {
  27646. test: (what) => {
  27647. // this refactor is a tad overly verbose but makes for easy debugging
  27648. const pattern = getMatcherString$1(id, resolutionBase);
  27649. const fn = picomatch(pattern, { dot: true });
  27650. const result = fn(what);
  27651. return result;
  27652. }
  27653. };
  27654. const includeMatchers = ensureArray$1(include).map(getMatcher);
  27655. const excludeMatchers = ensureArray$1(exclude).map(getMatcher);
  27656. return function result(id) {
  27657. if (typeof id !== 'string')
  27658. return false;
  27659. if (/\0/.test(id))
  27660. return false;
  27661. const pathId = id.split(sep).join('/');
  27662. for (let i = 0; i < excludeMatchers.length; ++i) {
  27663. const matcher = excludeMatchers[i];
  27664. if (matcher.test(pathId))
  27665. return false;
  27666. }
  27667. for (let i = 0; i < includeMatchers.length; ++i) {
  27668. const matcher = includeMatchers[i];
  27669. if (matcher.test(pathId))
  27670. return true;
  27671. }
  27672. return !includeMatchers.length;
  27673. };
  27674. };
  27675. const reservedWords$1$1 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
  27676. const builtins$1$1 = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
  27677. const forbiddenIdentifiers$1 = new Set(`${reservedWords$1$1} ${builtins$1$1}`.split(' '));
  27678. forbiddenIdentifiers$1.add('');
  27679. function escape(str) {
  27680. return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
  27681. }
  27682. function ensureFunction(functionOrValue) {
  27683. if (typeof functionOrValue === 'function') { return functionOrValue; }
  27684. return function () { return functionOrValue; };
  27685. }
  27686. function longest(a, b) {
  27687. return b.length - a.length;
  27688. }
  27689. function getReplacements(options) {
  27690. if (options.values) {
  27691. return Object.assign({}, options.values);
  27692. }
  27693. var values = Object.assign({}, options);
  27694. delete values.delimiters;
  27695. delete values.include;
  27696. delete values.exclude;
  27697. delete values.sourcemap;
  27698. delete values.sourceMap;
  27699. return values;
  27700. }
  27701. function mapToFunctions(object) {
  27702. return Object.keys(object).reduce(function (fns, key) {
  27703. var functions = Object.assign({}, fns);
  27704. functions[key] = ensureFunction(object[key]);
  27705. return functions;
  27706. }, {});
  27707. }
  27708. function replace(options) {
  27709. if ( options === void 0 ) options = {};
  27710. var filter = createFilter$1(options.include, options.exclude);
  27711. var delimiters = options.delimiters;
  27712. var functionValues = mapToFunctions(getReplacements(options));
  27713. var keys = Object.keys(functionValues)
  27714. .sort(longest)
  27715. .map(escape);
  27716. var pattern = delimiters
  27717. ? new RegExp(((escape(delimiters[0])) + "(" + (keys.join('|')) + ")" + (escape(delimiters[1]))), 'g')
  27718. : new RegExp(("\\b(" + (keys.join('|')) + ")\\b"), 'g');
  27719. return {
  27720. name: 'replace',
  27721. renderChunk: function renderChunk(code, chunk) {
  27722. var id = chunk.fileName;
  27723. if (!keys.length) { return null; }
  27724. if (!filter(id)) { return null; }
  27725. return executeReplacement(code, id);
  27726. },
  27727. transform: function transform(code, id) {
  27728. if (!keys.length) { return null; }
  27729. if (!filter(id)) { return null; }
  27730. return executeReplacement(code, id);
  27731. }
  27732. };
  27733. function executeReplacement(code, id) {
  27734. var magicString = new MagicString$2(code);
  27735. if (!codeHasReplacements(code, id, magicString)) {
  27736. return null;
  27737. }
  27738. var result = { code: magicString.toString() };
  27739. if (isSourceMapEnabled()) {
  27740. result.map = magicString.generateMap({ hires: true });
  27741. }
  27742. return result;
  27743. }
  27744. function codeHasReplacements(code, id, magicString) {
  27745. var result = false;
  27746. var match;
  27747. // eslint-disable-next-line no-cond-assign
  27748. while ((match = pattern.exec(code))) {
  27749. result = true;
  27750. var start = match.index;
  27751. var end = start + match[0].length;
  27752. var replacement = String(functionValues[match[1]](id));
  27753. magicString.overwrite(start, end, replacement);
  27754. }
  27755. return result;
  27756. }
  27757. function isSourceMapEnabled() {
  27758. return options.sourceMap !== false && options.sourcemap !== false;
  27759. }
  27760. }
  27761. const addExtension = function addExtension(filename, ext = '.js') {
  27762. let result = `${filename}`;
  27763. if (!extname$1(filename))
  27764. result += ext;
  27765. return result;
  27766. };
  27767. class WalkerBase {constructor() { WalkerBase.prototype.__init.call(this);WalkerBase.prototype.__init2.call(this);WalkerBase.prototype.__init3.call(this);WalkerBase.prototype.__init4.call(this); }
  27768. __init() {this.should_skip = false;}
  27769. __init2() {this.should_remove = false;}
  27770. __init3() {this.replacement = null;}
  27771. __init4() {this.context = {
  27772. skip: () => (this.should_skip = true),
  27773. remove: () => (this.should_remove = true),
  27774. replace: (node) => (this.replacement = node)
  27775. };}
  27776. replace(parent, prop, index, node) {
  27777. if (parent) {
  27778. if (index !== null) {
  27779. parent[prop][index] = node;
  27780. } else {
  27781. parent[prop] = node;
  27782. }
  27783. }
  27784. }
  27785. remove(parent, prop, index) {
  27786. if (parent) {
  27787. if (index !== null) {
  27788. parent[prop].splice(index, 1);
  27789. } else {
  27790. delete parent[prop];
  27791. }
  27792. }
  27793. }
  27794. }
  27795. class SyncWalkerClass extends WalkerBase {
  27796. constructor(walker) {
  27797. super();
  27798. this.enter = walker.enter;
  27799. this.leave = walker.leave;
  27800. }
  27801. visit(
  27802. node,
  27803. parent,
  27804. enter,
  27805. leave,
  27806. prop,
  27807. index
  27808. ) {
  27809. if (node) {
  27810. if (enter) {
  27811. const _should_skip = this.should_skip;
  27812. const _should_remove = this.should_remove;
  27813. const _replacement = this.replacement;
  27814. this.should_skip = false;
  27815. this.should_remove = false;
  27816. this.replacement = null;
  27817. enter.call(this.context, node, parent, prop, index);
  27818. if (this.replacement) {
  27819. node = this.replacement;
  27820. this.replace(parent, prop, index, node);
  27821. }
  27822. if (this.should_remove) {
  27823. this.remove(parent, prop, index);
  27824. }
  27825. const skipped = this.should_skip;
  27826. const removed = this.should_remove;
  27827. this.should_skip = _should_skip;
  27828. this.should_remove = _should_remove;
  27829. this.replacement = _replacement;
  27830. if (skipped) return node;
  27831. if (removed) return null;
  27832. }
  27833. for (const key in node) {
  27834. const value = (node )[key];
  27835. if (typeof value !== "object") {
  27836. continue;
  27837. } else if (Array.isArray(value)) {
  27838. for (let i = 0; i < value.length; i += 1) {
  27839. if (value[i] !== null && typeof value[i].type === 'string') {
  27840. if (!this.visit(value[i], node, enter, leave, key, i)) {
  27841. // removed
  27842. i--;
  27843. }
  27844. }
  27845. }
  27846. } else if (value !== null && typeof value.type === "string") {
  27847. this.visit(value, node, enter, leave, key, null);
  27848. }
  27849. }
  27850. if (leave) {
  27851. const _replacement = this.replacement;
  27852. const _should_remove = this.should_remove;
  27853. this.replacement = null;
  27854. this.should_remove = false;
  27855. leave.call(this.context, node, parent, prop, index);
  27856. if (this.replacement) {
  27857. node = this.replacement;
  27858. this.replace(parent, prop, index, node);
  27859. }
  27860. if (this.should_remove) {
  27861. this.remove(parent, prop, index);
  27862. }
  27863. const removed = this.should_remove;
  27864. this.replacement = _replacement;
  27865. this.should_remove = _should_remove;
  27866. if (removed) return null;
  27867. }
  27868. }
  27869. return node;
  27870. }
  27871. }
  27872. function walk(ast, walker) {
  27873. const instance = new SyncWalkerClass(walker);
  27874. return instance.visit(ast, null, walker.enter, walker.leave);
  27875. }
  27876. const extractors$2 = {
  27877. ArrayPattern(names, param) {
  27878. for (const element of param.elements) {
  27879. if (element)
  27880. extractors$2[element.type](names, element);
  27881. }
  27882. },
  27883. AssignmentPattern(names, param) {
  27884. extractors$2[param.left.type](names, param.left);
  27885. },
  27886. Identifier(names, param) {
  27887. names.push(param.name);
  27888. },
  27889. MemberExpression() { },
  27890. ObjectPattern(names, param) {
  27891. for (const prop of param.properties) {
  27892. // @ts-ignore Typescript reports that this is not a valid type
  27893. if (prop.type === 'RestElement') {
  27894. extractors$2.RestElement(names, prop);
  27895. }
  27896. else {
  27897. extractors$2[prop.value.type](names, prop.value);
  27898. }
  27899. }
  27900. },
  27901. RestElement(names, param) {
  27902. extractors$2[param.argument.type](names, param.argument);
  27903. }
  27904. };
  27905. const extractAssignedNames$2 = function extractAssignedNames(param) {
  27906. const names = [];
  27907. extractors$2[param.type](names, param);
  27908. return names;
  27909. };
  27910. const blockDeclarations = {
  27911. const: true,
  27912. let: true
  27913. };
  27914. class Scope$2 {
  27915. constructor(options = {}) {
  27916. this.parent = options.parent;
  27917. this.isBlockScope = !!options.block;
  27918. this.declarations = Object.create(null);
  27919. if (options.params) {
  27920. options.params.forEach((param) => {
  27921. extractAssignedNames$2(param).forEach((name) => {
  27922. this.declarations[name] = true;
  27923. });
  27924. });
  27925. }
  27926. }
  27927. addDeclaration(node, isBlockDeclaration, isVar) {
  27928. if (!isBlockDeclaration && this.isBlockScope) {
  27929. // it's a `var` or function node, and this
  27930. // is a block scope, so we need to go up
  27931. this.parent.addDeclaration(node, isBlockDeclaration, isVar);
  27932. }
  27933. else if (node.id) {
  27934. extractAssignedNames$2(node.id).forEach((name) => {
  27935. this.declarations[name] = true;
  27936. });
  27937. }
  27938. }
  27939. contains(name) {
  27940. return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);
  27941. }
  27942. }
  27943. const attachScopes = function attachScopes(ast, propertyName = 'scope') {
  27944. let scope = new Scope$2();
  27945. walk(ast, {
  27946. enter(n, parent) {
  27947. const node = n;
  27948. // function foo () {...}
  27949. // class Foo {...}
  27950. if (/(Function|Class)Declaration/.test(node.type)) {
  27951. scope.addDeclaration(node, false, false);
  27952. }
  27953. // var foo = 1
  27954. if (node.type === 'VariableDeclaration') {
  27955. const { kind } = node;
  27956. const isBlockDeclaration = blockDeclarations[kind];
  27957. node.declarations.forEach((declaration) => {
  27958. scope.addDeclaration(declaration, isBlockDeclaration, true);
  27959. });
  27960. }
  27961. let newScope;
  27962. // create new function scope
  27963. if (/Function/.test(node.type)) {
  27964. const func = node;
  27965. newScope = new Scope$2({
  27966. parent: scope,
  27967. block: false,
  27968. params: func.params
  27969. });
  27970. // named function expressions - the name is considered
  27971. // part of the function's scope
  27972. if (func.type === 'FunctionExpression' && func.id) {
  27973. newScope.addDeclaration(func, false, false);
  27974. }
  27975. }
  27976. // create new for scope
  27977. if (/For(In|Of)?Statement/.test(node.type)) {
  27978. newScope = new Scope$2({
  27979. parent: scope,
  27980. block: true
  27981. });
  27982. }
  27983. // create new block scope
  27984. if (node.type === 'BlockStatement' && !/Function/.test(parent.type)) {
  27985. newScope = new Scope$2({
  27986. parent: scope,
  27987. block: true
  27988. });
  27989. }
  27990. // catch clause has its own block scope
  27991. if (node.type === 'CatchClause') {
  27992. newScope = new Scope$2({
  27993. parent: scope,
  27994. params: node.param ? [node.param] : [],
  27995. block: true
  27996. });
  27997. }
  27998. if (newScope) {
  27999. Object.defineProperty(node, propertyName, {
  28000. value: newScope,
  28001. configurable: true
  28002. });
  28003. scope = newScope;
  28004. }
  28005. },
  28006. leave(n) {
  28007. const node = n;
  28008. if (node[propertyName])
  28009. scope = scope.parent;
  28010. }
  28011. });
  28012. return scope;
  28013. };
  28014. // Helper since Typescript can't detect readonly arrays with Array.isArray
  28015. function isArray$6(arg) {
  28016. return Array.isArray(arg);
  28017. }
  28018. function ensureArray$5(thing) {
  28019. if (isArray$6(thing))
  28020. return thing;
  28021. if (thing == null)
  28022. return [];
  28023. return [thing];
  28024. }
  28025. const normalizePath = function (filename) {
  28026. return filename.split(win32$1.sep).join(posix$1.sep);
  28027. };
  28028. function getMatcherString(id, resolutionBase) {
  28029. if (resolutionBase === false || isAbsolute$1(id) || id.startsWith('*')) {
  28030. return id;
  28031. }
  28032. // resolve('') is valid and will default to process.cwd()
  28033. const basePath = normalizePath(resolve$1(resolutionBase || ''))
  28034. // escape all possible (posix + win) path characters that might interfere with regex
  28035. .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
  28036. // Note that we use posix.join because:
  28037. // 1. the basePath has been normalized to use /
  28038. // 2. the incoming glob (id) matcher, also uses /
  28039. // otherwise Node will force backslash (\) on windows
  28040. return posix$1.join(basePath, id);
  28041. }
  28042. const createFilter = function createFilter(include, exclude, options) {
  28043. const resolutionBase = options && options.resolve;
  28044. const getMatcher = (id) => id instanceof RegExp
  28045. ? id
  28046. : {
  28047. test: (what) => {
  28048. // this refactor is a tad overly verbose but makes for easy debugging
  28049. const pattern = getMatcherString(id, resolutionBase);
  28050. const fn = picomatch(pattern, { dot: true });
  28051. const result = fn(what);
  28052. return result;
  28053. }
  28054. };
  28055. const includeMatchers = ensureArray$5(include).map(getMatcher);
  28056. const excludeMatchers = ensureArray$5(exclude).map(getMatcher);
  28057. return function result(id) {
  28058. if (typeof id !== 'string')
  28059. return false;
  28060. if (/\0/.test(id))
  28061. return false;
  28062. const pathId = normalizePath(id);
  28063. for (let i = 0; i < excludeMatchers.length; ++i) {
  28064. const matcher = excludeMatchers[i];
  28065. if (matcher.test(pathId))
  28066. return false;
  28067. }
  28068. for (let i = 0; i < includeMatchers.length; ++i) {
  28069. const matcher = includeMatchers[i];
  28070. if (matcher.test(pathId))
  28071. return true;
  28072. }
  28073. return !includeMatchers.length;
  28074. };
  28075. };
  28076. const reservedWords$5 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
  28077. const builtins$6 = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
  28078. const forbiddenIdentifiers = new Set(`${reservedWords$5} ${builtins$6}`.split(' '));
  28079. forbiddenIdentifiers.add('');
  28080. const makeLegalIdentifier = function makeLegalIdentifier(str) {
  28081. let identifier = str
  28082. .replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
  28083. .replace(/[^$_a-zA-Z0-9]/g, '_');
  28084. if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
  28085. identifier = `_${identifier}`;
  28086. }
  28087. return identifier || '_';
  28088. };
  28089. function stringify(obj) {
  28090. return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`);
  28091. }
  28092. function serializeArray(arr, indent, baseIndent) {
  28093. let output = '[';
  28094. const separator = indent ? `\n${baseIndent}${indent}` : '';
  28095. for (let i = 0; i < arr.length; i++) {
  28096. const key = arr[i];
  28097. output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`;
  28098. }
  28099. return `${output}${indent ? `\n${baseIndent}` : ''}]`;
  28100. }
  28101. function serializeObject(obj, indent, baseIndent) {
  28102. let output = '{';
  28103. const separator = indent ? `\n${baseIndent}${indent}` : '';
  28104. const entries = Object.entries(obj);
  28105. for (let i = 0; i < entries.length; i++) {
  28106. const [key, value] = entries[i];
  28107. const stringKey = makeLegalIdentifier(key) === key ? key : stringify(key);
  28108. output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(value, indent, baseIndent + indent)}`;
  28109. }
  28110. return `${output}${indent ? `\n${baseIndent}` : ''}}`;
  28111. }
  28112. function serialize(obj, indent, baseIndent) {
  28113. if (obj === Infinity)
  28114. return 'Infinity';
  28115. if (obj === -Infinity)
  28116. return '-Infinity';
  28117. if (obj === 0 && 1 / obj === -Infinity)
  28118. return '-0';
  28119. if (obj instanceof Date)
  28120. return `new Date(${obj.getTime()})`;
  28121. if (obj instanceof RegExp)
  28122. return obj.toString();
  28123. if (obj !== obj)
  28124. return 'NaN'; // eslint-disable-line no-self-compare
  28125. if (Array.isArray(obj))
  28126. return serializeArray(obj, indent, baseIndent);
  28127. if (obj === null)
  28128. return 'null';
  28129. if (typeof obj === 'object')
  28130. return serializeObject(obj, indent, baseIndent);
  28131. return stringify(obj);
  28132. }
  28133. const dataToEsm = function dataToEsm(data, options = {}) {
  28134. const t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
  28135. const _ = options.compact ? '' : ' ';
  28136. const n = options.compact ? '' : '\n';
  28137. const declarationType = options.preferConst ? 'const' : 'var';
  28138. if (options.namedExports === false ||
  28139. typeof data !== 'object' ||
  28140. Array.isArray(data) ||
  28141. data instanceof Date ||
  28142. data instanceof RegExp ||
  28143. data === null) {
  28144. const code = serialize(data, options.compact ? null : t, '');
  28145. const magic = _ || (/^[{[\-\/]/.test(code) ? '' : ' '); // eslint-disable-line no-useless-escape
  28146. return `export default${magic}${code};`;
  28147. }
  28148. let namedExportCode = '';
  28149. const defaultExportRows = [];
  28150. for (const [key, value] of Object.entries(data)) {
  28151. if (key === makeLegalIdentifier(key)) {
  28152. if (options.objectShorthand)
  28153. defaultExportRows.push(key);
  28154. else
  28155. defaultExportRows.push(`${key}:${_}${key}`);
  28156. namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`;
  28157. }
  28158. else {
  28159. defaultExportRows.push(`${stringify(key)}:${_}${serialize(value, options.compact ? null : t, '')}`);
  28160. }
  28161. }
  28162. return `${namedExportCode}export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`;
  28163. };
  28164. // TODO: remove this in next major
  28165. var index = {
  28166. addExtension,
  28167. attachScopes,
  28168. createFilter,
  28169. dataToEsm,
  28170. extractAssignedNames: extractAssignedNames$2,
  28171. makeLegalIdentifier,
  28172. normalizePath
  28173. };
  28174. var minimalisticAssert = assert;
  28175. function assert(val, msg) {
  28176. if (!val)
  28177. throw new Error(msg || 'Assertion failed');
  28178. }
  28179. assert.equal = function assertEqual(l, r, msg) {
  28180. if (l != r)
  28181. throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
  28182. };
  28183. var inherits_browser = createCommonjsModule$1(function (module) {
  28184. if (typeof Object.create === 'function') {
  28185. // implementation from standard node.js 'util' module
  28186. module.exports = function inherits(ctor, superCtor) {
  28187. if (superCtor) {
  28188. ctor.super_ = superCtor;
  28189. ctor.prototype = Object.create(superCtor.prototype, {
  28190. constructor: {
  28191. value: ctor,
  28192. enumerable: false,
  28193. writable: true,
  28194. configurable: true
  28195. }
  28196. });
  28197. }
  28198. };
  28199. } else {
  28200. // old school shim for old browsers
  28201. module.exports = function inherits(ctor, superCtor) {
  28202. if (superCtor) {
  28203. ctor.super_ = superCtor;
  28204. var TempCtor = function () {};
  28205. TempCtor.prototype = superCtor.prototype;
  28206. ctor.prototype = new TempCtor();
  28207. ctor.prototype.constructor = ctor;
  28208. }
  28209. };
  28210. }
  28211. });
  28212. const require$$0 = /*@__PURE__*/getAugmentedNamespace$1(util$4);
  28213. var inherits = createCommonjsModule$1(function (module) {
  28214. try {
  28215. var util = require$$0;
  28216. /* istanbul ignore next */
  28217. if (typeof util.inherits !== 'function') throw '';
  28218. module.exports = util.inherits;
  28219. } catch (e) {
  28220. /* istanbul ignore next */
  28221. module.exports = inherits_browser;
  28222. }
  28223. });
  28224. var inherits_1 = inherits;
  28225. function isSurrogatePair(msg, i) {
  28226. if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
  28227. return false;
  28228. }
  28229. if (i < 0 || i + 1 >= msg.length) {
  28230. return false;
  28231. }
  28232. return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
  28233. }
  28234. function toArray(msg, enc) {
  28235. if (Array.isArray(msg))
  28236. return msg.slice();
  28237. if (!msg)
  28238. return [];
  28239. var res = [];
  28240. if (typeof msg === 'string') {
  28241. if (!enc) {
  28242. // Inspired by stringToUtf8ByteArray() in closure-library by Google
  28243. // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
  28244. // Apache License 2.0
  28245. // https://github.com/google/closure-library/blob/master/LICENSE
  28246. var p = 0;
  28247. for (var i = 0; i < msg.length; i++) {
  28248. var c = msg.charCodeAt(i);
  28249. if (c < 128) {
  28250. res[p++] = c;
  28251. } else if (c < 2048) {
  28252. res[p++] = (c >> 6) | 192;
  28253. res[p++] = (c & 63) | 128;
  28254. } else if (isSurrogatePair(msg, i)) {
  28255. c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
  28256. res[p++] = (c >> 18) | 240;
  28257. res[p++] = ((c >> 12) & 63) | 128;
  28258. res[p++] = ((c >> 6) & 63) | 128;
  28259. res[p++] = (c & 63) | 128;
  28260. } else {
  28261. res[p++] = (c >> 12) | 224;
  28262. res[p++] = ((c >> 6) & 63) | 128;
  28263. res[p++] = (c & 63) | 128;
  28264. }
  28265. }
  28266. } else if (enc === 'hex') {
  28267. msg = msg.replace(/[^a-z0-9]+/ig, '');
  28268. if (msg.length % 2 !== 0)
  28269. msg = '0' + msg;
  28270. for (i = 0; i < msg.length; i += 2)
  28271. res.push(parseInt(msg[i] + msg[i + 1], 16));
  28272. }
  28273. } else {
  28274. for (i = 0; i < msg.length; i++)
  28275. res[i] = msg[i] | 0;
  28276. }
  28277. return res;
  28278. }
  28279. var toArray_1 = toArray;
  28280. function toHex(msg) {
  28281. var res = '';
  28282. for (var i = 0; i < msg.length; i++)
  28283. res += zero2(msg[i].toString(16));
  28284. return res;
  28285. }
  28286. var toHex_1 = toHex;
  28287. function htonl(w) {
  28288. var res = (w >>> 24) |
  28289. ((w >>> 8) & 0xff00) |
  28290. ((w << 8) & 0xff0000) |
  28291. ((w & 0xff) << 24);
  28292. return res >>> 0;
  28293. }
  28294. var htonl_1 = htonl;
  28295. function toHex32(msg, endian) {
  28296. var res = '';
  28297. for (var i = 0; i < msg.length; i++) {
  28298. var w = msg[i];
  28299. if (endian === 'little')
  28300. w = htonl(w);
  28301. res += zero8(w.toString(16));
  28302. }
  28303. return res;
  28304. }
  28305. var toHex32_1 = toHex32;
  28306. function zero2(word) {
  28307. if (word.length === 1)
  28308. return '0' + word;
  28309. else
  28310. return word;
  28311. }
  28312. var zero2_1 = zero2;
  28313. function zero8(word) {
  28314. if (word.length === 7)
  28315. return '0' + word;
  28316. else if (word.length === 6)
  28317. return '00' + word;
  28318. else if (word.length === 5)
  28319. return '000' + word;
  28320. else if (word.length === 4)
  28321. return '0000' + word;
  28322. else if (word.length === 3)
  28323. return '00000' + word;
  28324. else if (word.length === 2)
  28325. return '000000' + word;
  28326. else if (word.length === 1)
  28327. return '0000000' + word;
  28328. else
  28329. return word;
  28330. }
  28331. var zero8_1 = zero8;
  28332. function join32(msg, start, end, endian) {
  28333. var len = end - start;
  28334. minimalisticAssert(len % 4 === 0);
  28335. var res = new Array(len / 4);
  28336. for (var i = 0, k = start; i < res.length; i++, k += 4) {
  28337. var w;
  28338. if (endian === 'big')
  28339. w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
  28340. else
  28341. w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
  28342. res[i] = w >>> 0;
  28343. }
  28344. return res;
  28345. }
  28346. var join32_1 = join32;
  28347. function split32(msg, endian) {
  28348. var res = new Array(msg.length * 4);
  28349. for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
  28350. var m = msg[i];
  28351. if (endian === 'big') {
  28352. res[k] = m >>> 24;
  28353. res[k + 1] = (m >>> 16) & 0xff;
  28354. res[k + 2] = (m >>> 8) & 0xff;
  28355. res[k + 3] = m & 0xff;
  28356. } else {
  28357. res[k + 3] = m >>> 24;
  28358. res[k + 2] = (m >>> 16) & 0xff;
  28359. res[k + 1] = (m >>> 8) & 0xff;
  28360. res[k] = m & 0xff;
  28361. }
  28362. }
  28363. return res;
  28364. }
  28365. var split32_1 = split32;
  28366. function rotr32$1(w, b) {
  28367. return (w >>> b) | (w << (32 - b));
  28368. }
  28369. var rotr32_1 = rotr32$1;
  28370. function rotl32(w, b) {
  28371. return (w << b) | (w >>> (32 - b));
  28372. }
  28373. var rotl32_1 = rotl32;
  28374. function sum32$1(a, b) {
  28375. return (a + b) >>> 0;
  28376. }
  28377. var sum32_1 = sum32$1;
  28378. function sum32_3(a, b, c) {
  28379. return (a + b + c) >>> 0;
  28380. }
  28381. var sum32_3_1 = sum32_3;
  28382. function sum32_4$1(a, b, c, d) {
  28383. return (a + b + c + d) >>> 0;
  28384. }
  28385. var sum32_4_1 = sum32_4$1;
  28386. function sum32_5$1(a, b, c, d, e) {
  28387. return (a + b + c + d + e) >>> 0;
  28388. }
  28389. var sum32_5_1 = sum32_5$1;
  28390. function sum64(buf, pos, ah, al) {
  28391. var bh = buf[pos];
  28392. var bl = buf[pos + 1];
  28393. var lo = (al + bl) >>> 0;
  28394. var hi = (lo < al ? 1 : 0) + ah + bh;
  28395. buf[pos] = hi >>> 0;
  28396. buf[pos + 1] = lo;
  28397. }
  28398. var sum64_1 = sum64;
  28399. function sum64_hi(ah, al, bh, bl) {
  28400. var lo = (al + bl) >>> 0;
  28401. var hi = (lo < al ? 1 : 0) + ah + bh;
  28402. return hi >>> 0;
  28403. }
  28404. var sum64_hi_1 = sum64_hi;
  28405. function sum64_lo(ah, al, bh, bl) {
  28406. var lo = al + bl;
  28407. return lo >>> 0;
  28408. }
  28409. var sum64_lo_1 = sum64_lo;
  28410. function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
  28411. var carry = 0;
  28412. var lo = al;
  28413. lo = (lo + bl) >>> 0;
  28414. carry += lo < al ? 1 : 0;
  28415. lo = (lo + cl) >>> 0;
  28416. carry += lo < cl ? 1 : 0;
  28417. lo = (lo + dl) >>> 0;
  28418. carry += lo < dl ? 1 : 0;
  28419. var hi = ah + bh + ch + dh + carry;
  28420. return hi >>> 0;
  28421. }
  28422. var sum64_4_hi_1 = sum64_4_hi;
  28423. function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
  28424. var lo = al + bl + cl + dl;
  28425. return lo >>> 0;
  28426. }
  28427. var sum64_4_lo_1 = sum64_4_lo;
  28428. function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  28429. var carry = 0;
  28430. var lo = al;
  28431. lo = (lo + bl) >>> 0;
  28432. carry += lo < al ? 1 : 0;
  28433. lo = (lo + cl) >>> 0;
  28434. carry += lo < cl ? 1 : 0;
  28435. lo = (lo + dl) >>> 0;
  28436. carry += lo < dl ? 1 : 0;
  28437. lo = (lo + el) >>> 0;
  28438. carry += lo < el ? 1 : 0;
  28439. var hi = ah + bh + ch + dh + eh + carry;
  28440. return hi >>> 0;
  28441. }
  28442. var sum64_5_hi_1 = sum64_5_hi;
  28443. function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  28444. var lo = al + bl + cl + dl + el;
  28445. return lo >>> 0;
  28446. }
  28447. var sum64_5_lo_1 = sum64_5_lo;
  28448. function rotr64_hi(ah, al, num) {
  28449. var r = (al << (32 - num)) | (ah >>> num);
  28450. return r >>> 0;
  28451. }
  28452. var rotr64_hi_1 = rotr64_hi;
  28453. function rotr64_lo(ah, al, num) {
  28454. var r = (ah << (32 - num)) | (al >>> num);
  28455. return r >>> 0;
  28456. }
  28457. var rotr64_lo_1 = rotr64_lo;
  28458. function shr64_hi(ah, al, num) {
  28459. return ah >>> num;
  28460. }
  28461. var shr64_hi_1 = shr64_hi;
  28462. function shr64_lo(ah, al, num) {
  28463. var r = (ah << (32 - num)) | (al >>> num);
  28464. return r >>> 0;
  28465. }
  28466. var shr64_lo_1 = shr64_lo;
  28467. var utils = {
  28468. inherits: inherits_1,
  28469. toArray: toArray_1,
  28470. toHex: toHex_1,
  28471. htonl: htonl_1,
  28472. toHex32: toHex32_1,
  28473. zero2: zero2_1,
  28474. zero8: zero8_1,
  28475. join32: join32_1,
  28476. split32: split32_1,
  28477. rotr32: rotr32_1,
  28478. rotl32: rotl32_1,
  28479. sum32: sum32_1,
  28480. sum32_3: sum32_3_1,
  28481. sum32_4: sum32_4_1,
  28482. sum32_5: sum32_5_1,
  28483. sum64: sum64_1,
  28484. sum64_hi: sum64_hi_1,
  28485. sum64_lo: sum64_lo_1,
  28486. sum64_4_hi: sum64_4_hi_1,
  28487. sum64_4_lo: sum64_4_lo_1,
  28488. sum64_5_hi: sum64_5_hi_1,
  28489. sum64_5_lo: sum64_5_lo_1,
  28490. rotr64_hi: rotr64_hi_1,
  28491. rotr64_lo: rotr64_lo_1,
  28492. shr64_hi: shr64_hi_1,
  28493. shr64_lo: shr64_lo_1
  28494. };
  28495. function BlockHash$1() {
  28496. this.pending = null;
  28497. this.pendingTotal = 0;
  28498. this.blockSize = this.constructor.blockSize;
  28499. this.outSize = this.constructor.outSize;
  28500. this.hmacStrength = this.constructor.hmacStrength;
  28501. this.padLength = this.constructor.padLength / 8;
  28502. this.endian = 'big';
  28503. this._delta8 = this.blockSize / 8;
  28504. this._delta32 = this.blockSize / 32;
  28505. }
  28506. var BlockHash_1 = BlockHash$1;
  28507. BlockHash$1.prototype.update = function update(msg, enc) {
  28508. // Convert message to array, pad it, and join into 32bit blocks
  28509. msg = utils.toArray(msg, enc);
  28510. if (!this.pending)
  28511. this.pending = msg;
  28512. else
  28513. this.pending = this.pending.concat(msg);
  28514. this.pendingTotal += msg.length;
  28515. // Enough data, try updating
  28516. if (this.pending.length >= this._delta8) {
  28517. msg = this.pending;
  28518. // Process pending data in blocks
  28519. var r = msg.length % this._delta8;
  28520. this.pending = msg.slice(msg.length - r, msg.length);
  28521. if (this.pending.length === 0)
  28522. this.pending = null;
  28523. msg = utils.join32(msg, 0, msg.length - r, this.endian);
  28524. for (var i = 0; i < msg.length; i += this._delta32)
  28525. this._update(msg, i, i + this._delta32);
  28526. }
  28527. return this;
  28528. };
  28529. BlockHash$1.prototype.digest = function digest(enc) {
  28530. this.update(this._pad());
  28531. minimalisticAssert(this.pending === null);
  28532. return this._digest(enc);
  28533. };
  28534. BlockHash$1.prototype._pad = function pad() {
  28535. var len = this.pendingTotal;
  28536. var bytes = this._delta8;
  28537. var k = bytes - ((len + this.padLength) % bytes);
  28538. var res = new Array(k + this.padLength);
  28539. res[0] = 0x80;
  28540. for (var i = 1; i < k; i++)
  28541. res[i] = 0;
  28542. // Append length
  28543. len <<= 3;
  28544. if (this.endian === 'big') {
  28545. for (var t = 8; t < this.padLength; t++)
  28546. res[i++] = 0;
  28547. res[i++] = 0;
  28548. res[i++] = 0;
  28549. res[i++] = 0;
  28550. res[i++] = 0;
  28551. res[i++] = (len >>> 24) & 0xff;
  28552. res[i++] = (len >>> 16) & 0xff;
  28553. res[i++] = (len >>> 8) & 0xff;
  28554. res[i++] = len & 0xff;
  28555. } else {
  28556. res[i++] = len & 0xff;
  28557. res[i++] = (len >>> 8) & 0xff;
  28558. res[i++] = (len >>> 16) & 0xff;
  28559. res[i++] = (len >>> 24) & 0xff;
  28560. res[i++] = 0;
  28561. res[i++] = 0;
  28562. res[i++] = 0;
  28563. res[i++] = 0;
  28564. for (t = 8; t < this.padLength; t++)
  28565. res[i++] = 0;
  28566. }
  28567. return res;
  28568. };
  28569. var common$1 = {
  28570. BlockHash: BlockHash_1
  28571. };
  28572. var rotr32 = utils.rotr32;
  28573. function ft_1(s, x, y, z) {
  28574. if (s === 0)
  28575. return ch32$1(x, y, z);
  28576. if (s === 1 || s === 3)
  28577. return p32(x, y, z);
  28578. if (s === 2)
  28579. return maj32$1(x, y, z);
  28580. }
  28581. var ft_1_1 = ft_1;
  28582. function ch32$1(x, y, z) {
  28583. return (x & y) ^ ((~x) & z);
  28584. }
  28585. var ch32_1 = ch32$1;
  28586. function maj32$1(x, y, z) {
  28587. return (x & y) ^ (x & z) ^ (y & z);
  28588. }
  28589. var maj32_1 = maj32$1;
  28590. function p32(x, y, z) {
  28591. return x ^ y ^ z;
  28592. }
  28593. var p32_1 = p32;
  28594. function s0_256$1(x) {
  28595. return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
  28596. }
  28597. var s0_256_1 = s0_256$1;
  28598. function s1_256$1(x) {
  28599. return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
  28600. }
  28601. var s1_256_1 = s1_256$1;
  28602. function g0_256$1(x) {
  28603. return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
  28604. }
  28605. var g0_256_1 = g0_256$1;
  28606. function g1_256$1(x) {
  28607. return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
  28608. }
  28609. var g1_256_1 = g1_256$1;
  28610. var common = {
  28611. ft_1: ft_1_1,
  28612. ch32: ch32_1,
  28613. maj32: maj32_1,
  28614. p32: p32_1,
  28615. s0_256: s0_256_1,
  28616. s1_256: s1_256_1,
  28617. g0_256: g0_256_1,
  28618. g1_256: g1_256_1
  28619. };
  28620. var sum32 = utils.sum32;
  28621. var sum32_4 = utils.sum32_4;
  28622. var sum32_5 = utils.sum32_5;
  28623. var ch32 = common.ch32;
  28624. var maj32 = common.maj32;
  28625. var s0_256 = common.s0_256;
  28626. var s1_256 = common.s1_256;
  28627. var g0_256 = common.g0_256;
  28628. var g1_256 = common.g1_256;
  28629. var BlockHash = common$1.BlockHash;
  28630. var sha256_K = [
  28631. 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
  28632. 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
  28633. 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
  28634. 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
  28635. 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
  28636. 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
  28637. 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
  28638. 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
  28639. 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
  28640. 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
  28641. 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
  28642. 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
  28643. 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
  28644. 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
  28645. 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
  28646. 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
  28647. ];
  28648. function SHA256() {
  28649. if (!(this instanceof SHA256))
  28650. return new SHA256();
  28651. BlockHash.call(this);
  28652. this.h = [
  28653. 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
  28654. 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
  28655. ];
  28656. this.k = sha256_K;
  28657. this.W = new Array(64);
  28658. }
  28659. utils.inherits(SHA256, BlockHash);
  28660. var _256 = SHA256;
  28661. SHA256.blockSize = 512;
  28662. SHA256.outSize = 256;
  28663. SHA256.hmacStrength = 192;
  28664. SHA256.padLength = 64;
  28665. SHA256.prototype._update = function _update(msg, start) {
  28666. var W = this.W;
  28667. for (var i = 0; i < 16; i++)
  28668. W[i] = msg[start + i];
  28669. for (; i < W.length; i++)
  28670. W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
  28671. var a = this.h[0];
  28672. var b = this.h[1];
  28673. var c = this.h[2];
  28674. var d = this.h[3];
  28675. var e = this.h[4];
  28676. var f = this.h[5];
  28677. var g = this.h[6];
  28678. var h = this.h[7];
  28679. minimalisticAssert(this.k.length === W.length);
  28680. for (i = 0; i < W.length; i++) {
  28681. var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
  28682. var T2 = sum32(s0_256(a), maj32(a, b, c));
  28683. h = g;
  28684. g = f;
  28685. f = e;
  28686. e = sum32(d, T1);
  28687. d = c;
  28688. c = b;
  28689. b = a;
  28690. a = sum32(T1, T2);
  28691. }
  28692. this.h[0] = sum32(this.h[0], a);
  28693. this.h[1] = sum32(this.h[1], b);
  28694. this.h[2] = sum32(this.h[2], c);
  28695. this.h[3] = sum32(this.h[3], d);
  28696. this.h[4] = sum32(this.h[4], e);
  28697. this.h[5] = sum32(this.h[5], f);
  28698. this.h[6] = sum32(this.h[6], g);
  28699. this.h[7] = sum32(this.h[7], h);
  28700. };
  28701. SHA256.prototype._digest = function digest(enc) {
  28702. if (enc === 'hex')
  28703. return utils.toHex32(this.h, 'big');
  28704. else
  28705. return utils.split32(this.h, 'big');
  28706. };
  28707. //@ts-ignore
  28708. const createHash$1 = () => _256();
  28709. /*
  28710. @license
  28711. Rollup.js v2.42.3
  28712. Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
  28713. https://github.com/rollup/rollup
  28714. Released under the MIT License.
  28715. */
  28716. var version$1 = "2.42.3";
  28717. var charToInteger = {};
  28718. var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  28719. for (var i = 0; i < chars$1.length; i++) {
  28720. charToInteger[chars$1.charCodeAt(i)] = i;
  28721. }
  28722. function decode(mappings) {
  28723. var decoded = [];
  28724. var line = [];
  28725. var segment = [
  28726. 0,
  28727. 0,
  28728. 0,
  28729. 0,
  28730. 0,
  28731. ];
  28732. var j = 0;
  28733. for (var i = 0, shift = 0, value = 0; i < mappings.length; i++) {
  28734. var c = mappings.charCodeAt(i);
  28735. if (c === 44) { // ","
  28736. segmentify(line, segment, j);
  28737. j = 0;
  28738. }
  28739. else if (c === 59) { // ";"
  28740. segmentify(line, segment, j);
  28741. j = 0;
  28742. decoded.push(line);
  28743. line = [];
  28744. segment[0] = 0;
  28745. }
  28746. else {
  28747. var integer = charToInteger[c];
  28748. if (integer === undefined) {
  28749. throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
  28750. }
  28751. var hasContinuationBit = integer & 32;
  28752. integer &= 31;
  28753. value += integer << shift;
  28754. if (hasContinuationBit) {
  28755. shift += 5;
  28756. }
  28757. else {
  28758. var shouldNegate = value & 1;
  28759. value >>>= 1;
  28760. if (shouldNegate) {
  28761. value = value === 0 ? -0x80000000 : -value;
  28762. }
  28763. segment[j] += value;
  28764. j++;
  28765. value = shift = 0; // reset
  28766. }
  28767. }
  28768. }
  28769. segmentify(line, segment, j);
  28770. decoded.push(line);
  28771. return decoded;
  28772. }
  28773. function segmentify(line, segment, j) {
  28774. // This looks ugly, but we're creating specialized arrays with a specific
  28775. // length. This is much faster than creating a new array (which v8 expands to
  28776. // a capacity of 17 after pushing the first item), or slicing out a subarray
  28777. // (which is slow). Length 4 is assumed to be the most frequent, followed by
  28778. // length 5 (since not everything will have an associated name), followed by
  28779. // length 1 (it's probably rare for a source substring to not have an
  28780. // associated segment data).
  28781. if (j === 4)
  28782. line.push([segment[0], segment[1], segment[2], segment[3]]);
  28783. else if (j === 5)
  28784. line.push([segment[0], segment[1], segment[2], segment[3], segment[4]]);
  28785. else if (j === 1)
  28786. line.push([segment[0]]);
  28787. }
  28788. function encode(decoded) {
  28789. var sourceFileIndex = 0; // second field
  28790. var sourceCodeLine = 0; // third field
  28791. var sourceCodeColumn = 0; // fourth field
  28792. var nameIndex = 0; // fifth field
  28793. var mappings = '';
  28794. for (var i = 0; i < decoded.length; i++) {
  28795. var line = decoded[i];
  28796. if (i > 0)
  28797. mappings += ';';
  28798. if (line.length === 0)
  28799. continue;
  28800. var generatedCodeColumn = 0; // first field
  28801. var lineMappings = [];
  28802. for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
  28803. var segment = line_1[_i];
  28804. var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
  28805. generatedCodeColumn = segment[0];
  28806. if (segment.length > 1) {
  28807. segmentMappings +=
  28808. encodeInteger(segment[1] - sourceFileIndex) +
  28809. encodeInteger(segment[2] - sourceCodeLine) +
  28810. encodeInteger(segment[3] - sourceCodeColumn);
  28811. sourceFileIndex = segment[1];
  28812. sourceCodeLine = segment[2];
  28813. sourceCodeColumn = segment[3];
  28814. }
  28815. if (segment.length === 5) {
  28816. segmentMappings += encodeInteger(segment[4] - nameIndex);
  28817. nameIndex = segment[4];
  28818. }
  28819. lineMappings.push(segmentMappings);
  28820. }
  28821. mappings += lineMappings.join(',');
  28822. }
  28823. return mappings;
  28824. }
  28825. function encodeInteger(num) {
  28826. var result = '';
  28827. num = num < 0 ? (-num << 1) | 1 : num << 1;
  28828. do {
  28829. var clamped = num & 31;
  28830. num >>>= 5;
  28831. if (num > 0) {
  28832. clamped |= 32;
  28833. }
  28834. result += chars$1[clamped];
  28835. } while (num > 0);
  28836. return result;
  28837. }
  28838. var BitSet = function BitSet(arg) {
  28839. this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
  28840. };
  28841. BitSet.prototype.add = function add (n) {
  28842. this.bits[n >> 5] |= 1 << (n & 31);
  28843. };
  28844. BitSet.prototype.has = function has (n) {
  28845. return !!(this.bits[n >> 5] & (1 << (n & 31)));
  28846. };
  28847. var Chunk$1 = function Chunk(start, end, content) {
  28848. this.start = start;
  28849. this.end = end;
  28850. this.original = content;
  28851. this.intro = '';
  28852. this.outro = '';
  28853. this.content = content;
  28854. this.storeName = false;
  28855. this.edited = false;
  28856. // we make these non-enumerable, for sanity while debugging
  28857. Object.defineProperties(this, {
  28858. previous: { writable: true, value: null },
  28859. next: { writable: true, value: null }
  28860. });
  28861. };
  28862. Chunk$1.prototype.appendLeft = function appendLeft (content) {
  28863. this.outro += content;
  28864. };
  28865. Chunk$1.prototype.appendRight = function appendRight (content) {
  28866. this.intro = this.intro + content;
  28867. };
  28868. Chunk$1.prototype.clone = function clone () {
  28869. var chunk = new Chunk$1(this.start, this.end, this.original);
  28870. chunk.intro = this.intro;
  28871. chunk.outro = this.outro;
  28872. chunk.content = this.content;
  28873. chunk.storeName = this.storeName;
  28874. chunk.edited = this.edited;
  28875. return chunk;
  28876. };
  28877. Chunk$1.prototype.contains = function contains (index) {
  28878. return this.start < index && index < this.end;
  28879. };
  28880. Chunk$1.prototype.eachNext = function eachNext (fn) {
  28881. var chunk = this;
  28882. while (chunk) {
  28883. fn(chunk);
  28884. chunk = chunk.next;
  28885. }
  28886. };
  28887. Chunk$1.prototype.eachPrevious = function eachPrevious (fn) {
  28888. var chunk = this;
  28889. while (chunk) {
  28890. fn(chunk);
  28891. chunk = chunk.previous;
  28892. }
  28893. };
  28894. Chunk$1.prototype.edit = function edit (content, storeName, contentOnly) {
  28895. this.content = content;
  28896. if (!contentOnly) {
  28897. this.intro = '';
  28898. this.outro = '';
  28899. }
  28900. this.storeName = storeName;
  28901. this.edited = true;
  28902. return this;
  28903. };
  28904. Chunk$1.prototype.prependLeft = function prependLeft (content) {
  28905. this.outro = content + this.outro;
  28906. };
  28907. Chunk$1.prototype.prependRight = function prependRight (content) {
  28908. this.intro = content + this.intro;
  28909. };
  28910. Chunk$1.prototype.split = function split (index) {
  28911. var sliceIndex = index - this.start;
  28912. var originalBefore = this.original.slice(0, sliceIndex);
  28913. var originalAfter = this.original.slice(sliceIndex);
  28914. this.original = originalBefore;
  28915. var newChunk = new Chunk$1(index, this.end, originalAfter);
  28916. newChunk.outro = this.outro;
  28917. this.outro = '';
  28918. this.end = index;
  28919. if (this.edited) {
  28920. // TODO is this block necessary?...
  28921. newChunk.edit('', false);
  28922. this.content = '';
  28923. } else {
  28924. this.content = originalBefore;
  28925. }
  28926. newChunk.next = this.next;
  28927. if (newChunk.next) { newChunk.next.previous = newChunk; }
  28928. newChunk.previous = this;
  28929. this.next = newChunk;
  28930. return newChunk;
  28931. };
  28932. Chunk$1.prototype.toString = function toString () {
  28933. return this.intro + this.content + this.outro;
  28934. };
  28935. Chunk$1.prototype.trimEnd = function trimEnd (rx) {
  28936. this.outro = this.outro.replace(rx, '');
  28937. if (this.outro.length) { return true; }
  28938. var trimmed = this.content.replace(rx, '');
  28939. if (trimmed.length) {
  28940. if (trimmed !== this.content) {
  28941. this.split(this.start + trimmed.length).edit('', undefined, true);
  28942. }
  28943. return true;
  28944. } else {
  28945. this.edit('', undefined, true);
  28946. this.intro = this.intro.replace(rx, '');
  28947. if (this.intro.length) { return true; }
  28948. }
  28949. };
  28950. Chunk$1.prototype.trimStart = function trimStart (rx) {
  28951. this.intro = this.intro.replace(rx, '');
  28952. if (this.intro.length) { return true; }
  28953. var trimmed = this.content.replace(rx, '');
  28954. if (trimmed.length) {
  28955. if (trimmed !== this.content) {
  28956. this.split(this.end - trimmed.length);
  28957. this.edit('', undefined, true);
  28958. }
  28959. return true;
  28960. } else {
  28961. this.edit('', undefined, true);
  28962. this.outro = this.outro.replace(rx, '');
  28963. if (this.outro.length) { return true; }
  28964. }
  28965. };
  28966. var btoa$1 = function () {
  28967. throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
  28968. };
  28969. if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
  28970. btoa$1 = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
  28971. } else if (typeof Buffer === 'function') {
  28972. btoa$1 = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
  28973. }
  28974. var SourceMap = function SourceMap(properties) {
  28975. this.version = 3;
  28976. this.file = properties.file;
  28977. this.sources = properties.sources;
  28978. this.sourcesContent = properties.sourcesContent;
  28979. this.names = properties.names;
  28980. this.mappings = encode(properties.mappings);
  28981. };
  28982. SourceMap.prototype.toString = function toString () {
  28983. return JSON.stringify(this);
  28984. };
  28985. SourceMap.prototype.toUrl = function toUrl () {
  28986. return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
  28987. };
  28988. function guessIndent(code) {
  28989. var lines = code.split('\n');
  28990. var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
  28991. var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
  28992. if (tabbed.length === 0 && spaced.length === 0) {
  28993. return null;
  28994. }
  28995. // More lines tabbed than spaced? Assume tabs, and
  28996. // default to tabs in the case of a tie (or nothing
  28997. // to go on)
  28998. if (tabbed.length >= spaced.length) {
  28999. return '\t';
  29000. }
  29001. // Otherwise, we need to guess the multiple
  29002. var min = spaced.reduce(function (previous, current) {
  29003. var numSpaces = /^ +/.exec(current)[0].length;
  29004. return Math.min(numSpaces, previous);
  29005. }, Infinity);
  29006. return new Array(min + 1).join(' ');
  29007. }
  29008. function getRelativePath(from, to) {
  29009. var fromParts = from.split(/[/\\]/);
  29010. var toParts = to.split(/[/\\]/);
  29011. fromParts.pop(); // get dirname
  29012. while (fromParts[0] === toParts[0]) {
  29013. fromParts.shift();
  29014. toParts.shift();
  29015. }
  29016. if (fromParts.length) {
  29017. var i = fromParts.length;
  29018. while (i--) { fromParts[i] = '..'; }
  29019. }
  29020. return fromParts.concat(toParts).join('/');
  29021. }
  29022. var toString$1 = Object.prototype.toString;
  29023. function isObject(thing) {
  29024. return toString$1.call(thing) === '[object Object]';
  29025. }
  29026. function getLocator$1(source) {
  29027. var originalLines = source.split('\n');
  29028. var lineOffsets = [];
  29029. for (var i = 0, pos = 0; i < originalLines.length; i++) {
  29030. lineOffsets.push(pos);
  29031. pos += originalLines[i].length + 1;
  29032. }
  29033. return function locate(index) {
  29034. var i = 0;
  29035. var j = lineOffsets.length;
  29036. while (i < j) {
  29037. var m = (i + j) >> 1;
  29038. if (index < lineOffsets[m]) {
  29039. j = m;
  29040. } else {
  29041. i = m + 1;
  29042. }
  29043. }
  29044. var line = i - 1;
  29045. var column = index - lineOffsets[line];
  29046. return { line: line, column: column };
  29047. };
  29048. }
  29049. var Mappings = function Mappings(hires) {
  29050. this.hires = hires;
  29051. this.generatedCodeLine = 0;
  29052. this.generatedCodeColumn = 0;
  29053. this.raw = [];
  29054. this.rawSegments = this.raw[this.generatedCodeLine] = [];
  29055. this.pending = null;
  29056. };
  29057. Mappings.prototype.addEdit = function addEdit (sourceIndex, content, loc, nameIndex) {
  29058. if (content.length) {
  29059. var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
  29060. if (nameIndex >= 0) {
  29061. segment.push(nameIndex);
  29062. }
  29063. this.rawSegments.push(segment);
  29064. } else if (this.pending) {
  29065. this.rawSegments.push(this.pending);
  29066. }
  29067. this.advance(content);
  29068. this.pending = null;
  29069. };
  29070. Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
  29071. var originalCharIndex = chunk.start;
  29072. var first = true;
  29073. while (originalCharIndex < chunk.end) {
  29074. if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
  29075. this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
  29076. }
  29077. if (original[originalCharIndex] === '\n') {
  29078. loc.line += 1;
  29079. loc.column = 0;
  29080. this.generatedCodeLine += 1;
  29081. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  29082. this.generatedCodeColumn = 0;
  29083. first = true;
  29084. } else {
  29085. loc.column += 1;
  29086. this.generatedCodeColumn += 1;
  29087. first = false;
  29088. }
  29089. originalCharIndex += 1;
  29090. }
  29091. this.pending = null;
  29092. };
  29093. Mappings.prototype.advance = function advance (str) {
  29094. if (!str) { return; }
  29095. var lines = str.split('\n');
  29096. if (lines.length > 1) {
  29097. for (var i = 0; i < lines.length - 1; i++) {
  29098. this.generatedCodeLine++;
  29099. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  29100. }
  29101. this.generatedCodeColumn = 0;
  29102. }
  29103. this.generatedCodeColumn += lines[lines.length - 1].length;
  29104. };
  29105. var n = '\n';
  29106. var warned = {
  29107. insertLeft: false,
  29108. insertRight: false,
  29109. storeName: false
  29110. };
  29111. var MagicString = function MagicString(string, options) {
  29112. if ( options === void 0 ) options = {};
  29113. var chunk = new Chunk$1(0, string.length, string);
  29114. Object.defineProperties(this, {
  29115. original: { writable: true, value: string },
  29116. outro: { writable: true, value: '' },
  29117. intro: { writable: true, value: '' },
  29118. firstChunk: { writable: true, value: chunk },
  29119. lastChunk: { writable: true, value: chunk },
  29120. lastSearchedChunk: { writable: true, value: chunk },
  29121. byStart: { writable: true, value: {} },
  29122. byEnd: { writable: true, value: {} },
  29123. filename: { writable: true, value: options.filename },
  29124. indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
  29125. sourcemapLocations: { writable: true, value: new BitSet() },
  29126. storedNames: { writable: true, value: {} },
  29127. indentStr: { writable: true, value: guessIndent(string) }
  29128. });
  29129. this.byStart[0] = chunk;
  29130. this.byEnd[string.length] = chunk;
  29131. };
  29132. MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
  29133. this.sourcemapLocations.add(char);
  29134. };
  29135. MagicString.prototype.append = function append (content) {
  29136. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  29137. this.outro += content;
  29138. return this;
  29139. };
  29140. MagicString.prototype.appendLeft = function appendLeft (index, content) {
  29141. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  29142. this._split(index);
  29143. var chunk = this.byEnd[index];
  29144. if (chunk) {
  29145. chunk.appendLeft(content);
  29146. } else {
  29147. this.intro += content;
  29148. }
  29149. return this;
  29150. };
  29151. MagicString.prototype.appendRight = function appendRight (index, content) {
  29152. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  29153. this._split(index);
  29154. var chunk = this.byStart[index];
  29155. if (chunk) {
  29156. chunk.appendRight(content);
  29157. } else {
  29158. this.outro += content;
  29159. }
  29160. return this;
  29161. };
  29162. MagicString.prototype.clone = function clone () {
  29163. var cloned = new MagicString(this.original, { filename: this.filename });
  29164. var originalChunk = this.firstChunk;
  29165. var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
  29166. while (originalChunk) {
  29167. cloned.byStart[clonedChunk.start] = clonedChunk;
  29168. cloned.byEnd[clonedChunk.end] = clonedChunk;
  29169. var nextOriginalChunk = originalChunk.next;
  29170. var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
  29171. if (nextClonedChunk) {
  29172. clonedChunk.next = nextClonedChunk;
  29173. nextClonedChunk.previous = clonedChunk;
  29174. clonedChunk = nextClonedChunk;
  29175. }
  29176. originalChunk = nextOriginalChunk;
  29177. }
  29178. cloned.lastChunk = clonedChunk;
  29179. if (this.indentExclusionRanges) {
  29180. cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
  29181. }
  29182. cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
  29183. cloned.intro = this.intro;
  29184. cloned.outro = this.outro;
  29185. return cloned;
  29186. };
  29187. MagicString.prototype.generateDecodedMap = function generateDecodedMap (options) {
  29188. var this$1 = this;
  29189. options = options || {};
  29190. var sourceIndex = 0;
  29191. var names = Object.keys(this.storedNames);
  29192. var mappings = new Mappings(options.hires);
  29193. var locate = getLocator$1(this.original);
  29194. if (this.intro) {
  29195. mappings.advance(this.intro);
  29196. }
  29197. this.firstChunk.eachNext(function (chunk) {
  29198. var loc = locate(chunk.start);
  29199. if (chunk.intro.length) { mappings.advance(chunk.intro); }
  29200. if (chunk.edited) {
  29201. mappings.addEdit(
  29202. sourceIndex,
  29203. chunk.content,
  29204. loc,
  29205. chunk.storeName ? names.indexOf(chunk.original) : -1
  29206. );
  29207. } else {
  29208. mappings.addUneditedChunk(sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations);
  29209. }
  29210. if (chunk.outro.length) { mappings.advance(chunk.outro); }
  29211. });
  29212. return {
  29213. file: options.file ? options.file.split(/[/\\]/).pop() : null,
  29214. sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
  29215. sourcesContent: options.includeContent ? [this.original] : [null],
  29216. names: names,
  29217. mappings: mappings.raw
  29218. };
  29219. };
  29220. MagicString.prototype.generateMap = function generateMap (options) {
  29221. return new SourceMap(this.generateDecodedMap(options));
  29222. };
  29223. MagicString.prototype.getIndentString = function getIndentString () {
  29224. return this.indentStr === null ? '\t' : this.indentStr;
  29225. };
  29226. MagicString.prototype.indent = function indent (indentStr, options) {
  29227. var pattern = /^[^\r\n]/gm;
  29228. if (isObject(indentStr)) {
  29229. options = indentStr;
  29230. indentStr = undefined;
  29231. }
  29232. indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
  29233. if (indentStr === '') { return this; } // noop
  29234. options = options || {};
  29235. // Process exclusion ranges
  29236. var isExcluded = {};
  29237. if (options.exclude) {
  29238. var exclusions =
  29239. typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
  29240. exclusions.forEach(function (exclusion) {
  29241. for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
  29242. isExcluded[i] = true;
  29243. }
  29244. });
  29245. }
  29246. var shouldIndentNextCharacter = options.indentStart !== false;
  29247. var replacer = function (match) {
  29248. if (shouldIndentNextCharacter) { return ("" + indentStr + match); }
  29249. shouldIndentNextCharacter = true;
  29250. return match;
  29251. };
  29252. this.intro = this.intro.replace(pattern, replacer);
  29253. var charIndex = 0;
  29254. var chunk = this.firstChunk;
  29255. while (chunk) {
  29256. var end = chunk.end;
  29257. if (chunk.edited) {
  29258. if (!isExcluded[charIndex]) {
  29259. chunk.content = chunk.content.replace(pattern, replacer);
  29260. if (chunk.content.length) {
  29261. shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
  29262. }
  29263. }
  29264. } else {
  29265. charIndex = chunk.start;
  29266. while (charIndex < end) {
  29267. if (!isExcluded[charIndex]) {
  29268. var char = this.original[charIndex];
  29269. if (char === '\n') {
  29270. shouldIndentNextCharacter = true;
  29271. } else if (char !== '\r' && shouldIndentNextCharacter) {
  29272. shouldIndentNextCharacter = false;
  29273. if (charIndex === chunk.start) {
  29274. chunk.prependRight(indentStr);
  29275. } else {
  29276. this._splitChunk(chunk, charIndex);
  29277. chunk = chunk.next;
  29278. chunk.prependRight(indentStr);
  29279. }
  29280. }
  29281. }
  29282. charIndex += 1;
  29283. }
  29284. }
  29285. charIndex = chunk.end;
  29286. chunk = chunk.next;
  29287. }
  29288. this.outro = this.outro.replace(pattern, replacer);
  29289. return this;
  29290. };
  29291. MagicString.prototype.insert = function insert () {
  29292. throw new Error('magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)');
  29293. };
  29294. MagicString.prototype.insertLeft = function insertLeft (index, content) {
  29295. if (!warned.insertLeft) {
  29296. console.warn('magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'); // eslint-disable-line no-console
  29297. warned.insertLeft = true;
  29298. }
  29299. return this.appendLeft(index, content);
  29300. };
  29301. MagicString.prototype.insertRight = function insertRight (index, content) {
  29302. if (!warned.insertRight) {
  29303. console.warn('magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'); // eslint-disable-line no-console
  29304. warned.insertRight = true;
  29305. }
  29306. return this.prependRight(index, content);
  29307. };
  29308. MagicString.prototype.move = function move (start, end, index) {
  29309. if (index >= start && index <= end) { throw new Error('Cannot move a selection inside itself'); }
  29310. this._split(start);
  29311. this._split(end);
  29312. this._split(index);
  29313. var first = this.byStart[start];
  29314. var last = this.byEnd[end];
  29315. var oldLeft = first.previous;
  29316. var oldRight = last.next;
  29317. var newRight = this.byStart[index];
  29318. if (!newRight && last === this.lastChunk) { return this; }
  29319. var newLeft = newRight ? newRight.previous : this.lastChunk;
  29320. if (oldLeft) { oldLeft.next = oldRight; }
  29321. if (oldRight) { oldRight.previous = oldLeft; }
  29322. if (newLeft) { newLeft.next = first; }
  29323. if (newRight) { newRight.previous = last; }
  29324. if (!first.previous) { this.firstChunk = last.next; }
  29325. if (!last.next) {
  29326. this.lastChunk = first.previous;
  29327. this.lastChunk.next = null;
  29328. }
  29329. first.previous = newLeft;
  29330. last.next = newRight || null;
  29331. if (!newLeft) { this.firstChunk = first; }
  29332. if (!newRight) { this.lastChunk = last; }
  29333. return this;
  29334. };
  29335. MagicString.prototype.overwrite = function overwrite (start, end, content, options) {
  29336. if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
  29337. while (start < 0) { start += this.original.length; }
  29338. while (end < 0) { end += this.original.length; }
  29339. if (end > this.original.length) { throw new Error('end is out of bounds'); }
  29340. if (start === end)
  29341. { throw new Error('Cannot overwrite a zero-length range – use appendLeft or prependRight instead'); }
  29342. this._split(start);
  29343. this._split(end);
  29344. if (options === true) {
  29345. if (!warned.storeName) {
  29346. console.warn('The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'); // eslint-disable-line no-console
  29347. warned.storeName = true;
  29348. }
  29349. options = { storeName: true };
  29350. }
  29351. var storeName = options !== undefined ? options.storeName : false;
  29352. var contentOnly = options !== undefined ? options.contentOnly : false;
  29353. if (storeName) {
  29354. var original = this.original.slice(start, end);
  29355. this.storedNames[original] = true;
  29356. }
  29357. var first = this.byStart[start];
  29358. var last = this.byEnd[end];
  29359. if (first) {
  29360. if (end > first.end && first.next !== this.byStart[first.end]) {
  29361. throw new Error('Cannot overwrite across a split point');
  29362. }
  29363. first.edit(content, storeName, contentOnly);
  29364. if (first !== last) {
  29365. var chunk = first.next;
  29366. while (chunk !== last) {
  29367. chunk.edit('', false);
  29368. chunk = chunk.next;
  29369. }
  29370. chunk.edit('', false);
  29371. }
  29372. } else {
  29373. // must be inserting at the end
  29374. var newChunk = new Chunk$1(start, end, '').edit(content, storeName);
  29375. // TODO last chunk in the array may not be the last chunk, if it's moved...
  29376. last.next = newChunk;
  29377. newChunk.previous = last;
  29378. }
  29379. return this;
  29380. };
  29381. MagicString.prototype.prepend = function prepend (content) {
  29382. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  29383. this.intro = content + this.intro;
  29384. return this;
  29385. };
  29386. MagicString.prototype.prependLeft = function prependLeft (index, content) {
  29387. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  29388. this._split(index);
  29389. var chunk = this.byEnd[index];
  29390. if (chunk) {
  29391. chunk.prependLeft(content);
  29392. } else {
  29393. this.intro = content + this.intro;
  29394. }
  29395. return this;
  29396. };
  29397. MagicString.prototype.prependRight = function prependRight (index, content) {
  29398. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  29399. this._split(index);
  29400. var chunk = this.byStart[index];
  29401. if (chunk) {
  29402. chunk.prependRight(content);
  29403. } else {
  29404. this.outro = content + this.outro;
  29405. }
  29406. return this;
  29407. };
  29408. MagicString.prototype.remove = function remove (start, end) {
  29409. while (start < 0) { start += this.original.length; }
  29410. while (end < 0) { end += this.original.length; }
  29411. if (start === end) { return this; }
  29412. if (start < 0 || end > this.original.length) { throw new Error('Character is out of bounds'); }
  29413. if (start > end) { throw new Error('end must be greater than start'); }
  29414. this._split(start);
  29415. this._split(end);
  29416. var chunk = this.byStart[start];
  29417. while (chunk) {
  29418. chunk.intro = '';
  29419. chunk.outro = '';
  29420. chunk.edit('');
  29421. chunk = end > chunk.end ? this.byStart[chunk.end] : null;
  29422. }
  29423. return this;
  29424. };
  29425. MagicString.prototype.lastChar = function lastChar () {
  29426. if (this.outro.length)
  29427. { return this.outro[this.outro.length - 1]; }
  29428. var chunk = this.lastChunk;
  29429. do {
  29430. if (chunk.outro.length)
  29431. { return chunk.outro[chunk.outro.length - 1]; }
  29432. if (chunk.content.length)
  29433. { return chunk.content[chunk.content.length - 1]; }
  29434. if (chunk.intro.length)
  29435. { return chunk.intro[chunk.intro.length - 1]; }
  29436. } while (chunk = chunk.previous);
  29437. if (this.intro.length)
  29438. { return this.intro[this.intro.length - 1]; }
  29439. return '';
  29440. };
  29441. MagicString.prototype.lastLine = function lastLine () {
  29442. var lineIndex = this.outro.lastIndexOf(n);
  29443. if (lineIndex !== -1)
  29444. { return this.outro.substr(lineIndex + 1); }
  29445. var lineStr = this.outro;
  29446. var chunk = this.lastChunk;
  29447. do {
  29448. if (chunk.outro.length > 0) {
  29449. lineIndex = chunk.outro.lastIndexOf(n);
  29450. if (lineIndex !== -1)
  29451. { return chunk.outro.substr(lineIndex + 1) + lineStr; }
  29452. lineStr = chunk.outro + lineStr;
  29453. }
  29454. if (chunk.content.length > 0) {
  29455. lineIndex = chunk.content.lastIndexOf(n);
  29456. if (lineIndex !== -1)
  29457. { return chunk.content.substr(lineIndex + 1) + lineStr; }
  29458. lineStr = chunk.content + lineStr;
  29459. }
  29460. if (chunk.intro.length > 0) {
  29461. lineIndex = chunk.intro.lastIndexOf(n);
  29462. if (lineIndex !== -1)
  29463. { return chunk.intro.substr(lineIndex + 1) + lineStr; }
  29464. lineStr = chunk.intro + lineStr;
  29465. }
  29466. } while (chunk = chunk.previous);
  29467. lineIndex = this.intro.lastIndexOf(n);
  29468. if (lineIndex !== -1)
  29469. { return this.intro.substr(lineIndex + 1) + lineStr; }
  29470. return this.intro + lineStr;
  29471. };
  29472. MagicString.prototype.slice = function slice (start, end) {
  29473. if ( start === void 0 ) start = 0;
  29474. if ( end === void 0 ) end = this.original.length;
  29475. while (start < 0) { start += this.original.length; }
  29476. while (end < 0) { end += this.original.length; }
  29477. var result = '';
  29478. // find start chunk
  29479. var chunk = this.firstChunk;
  29480. while (chunk && (chunk.start > start || chunk.end <= start)) {
  29481. // found end chunk before start
  29482. if (chunk.start < end && chunk.end >= end) {
  29483. return result;
  29484. }
  29485. chunk = chunk.next;
  29486. }
  29487. if (chunk && chunk.edited && chunk.start !== start)
  29488. { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
  29489. var startChunk = chunk;
  29490. while (chunk) {
  29491. if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
  29492. result += chunk.intro;
  29493. }
  29494. var containsEnd = chunk.start < end && chunk.end >= end;
  29495. if (containsEnd && chunk.edited && chunk.end !== end)
  29496. { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
  29497. var sliceStart = startChunk === chunk ? start - chunk.start : 0;
  29498. var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
  29499. result += chunk.content.slice(sliceStart, sliceEnd);
  29500. if (chunk.outro && (!containsEnd || chunk.end === end)) {
  29501. result += chunk.outro;
  29502. }
  29503. if (containsEnd) {
  29504. break;
  29505. }
  29506. chunk = chunk.next;
  29507. }
  29508. return result;
  29509. };
  29510. // TODO deprecate this? not really very useful
  29511. MagicString.prototype.snip = function snip (start, end) {
  29512. var clone = this.clone();
  29513. clone.remove(0, start);
  29514. clone.remove(end, clone.original.length);
  29515. return clone;
  29516. };
  29517. MagicString.prototype._split = function _split (index) {
  29518. if (this.byStart[index] || this.byEnd[index]) { return; }
  29519. var chunk = this.lastSearchedChunk;
  29520. var searchForward = index > chunk.end;
  29521. while (chunk) {
  29522. if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
  29523. chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
  29524. }
  29525. };
  29526. MagicString.prototype._splitChunk = function _splitChunk (chunk, index) {
  29527. if (chunk.edited && chunk.content.length) {
  29528. // zero-length edited chunks are a special case (overlapping replacements)
  29529. var loc = getLocator$1(this.original)(index);
  29530. throw new Error(
  29531. ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
  29532. );
  29533. }
  29534. var newChunk = chunk.split(index);
  29535. this.byEnd[index] = chunk;
  29536. this.byStart[index] = newChunk;
  29537. this.byEnd[newChunk.end] = newChunk;
  29538. if (chunk === this.lastChunk) { this.lastChunk = newChunk; }
  29539. this.lastSearchedChunk = chunk;
  29540. return true;
  29541. };
  29542. MagicString.prototype.toString = function toString () {
  29543. var str = this.intro;
  29544. var chunk = this.firstChunk;
  29545. while (chunk) {
  29546. str += chunk.toString();
  29547. chunk = chunk.next;
  29548. }
  29549. return str + this.outro;
  29550. };
  29551. MagicString.prototype.isEmpty = function isEmpty () {
  29552. var chunk = this.firstChunk;
  29553. do {
  29554. if (chunk.intro.length && chunk.intro.trim() ||
  29555. chunk.content.length && chunk.content.trim() ||
  29556. chunk.outro.length && chunk.outro.trim())
  29557. { return false; }
  29558. } while (chunk = chunk.next);
  29559. return true;
  29560. };
  29561. MagicString.prototype.length = function length () {
  29562. var chunk = this.firstChunk;
  29563. var length = 0;
  29564. do {
  29565. length += chunk.intro.length + chunk.content.length + chunk.outro.length;
  29566. } while (chunk = chunk.next);
  29567. return length;
  29568. };
  29569. MagicString.prototype.trimLines = function trimLines () {
  29570. return this.trim('[\\r\\n]');
  29571. };
  29572. MagicString.prototype.trim = function trim (charType) {
  29573. return this.trimStart(charType).trimEnd(charType);
  29574. };
  29575. MagicString.prototype.trimEndAborted = function trimEndAborted (charType) {
  29576. var rx = new RegExp((charType || '\\s') + '+$');
  29577. this.outro = this.outro.replace(rx, '');
  29578. if (this.outro.length) { return true; }
  29579. var chunk = this.lastChunk;
  29580. do {
  29581. var end = chunk.end;
  29582. var aborted = chunk.trimEnd(rx);
  29583. // if chunk was trimmed, we have a new lastChunk
  29584. if (chunk.end !== end) {
  29585. if (this.lastChunk === chunk) {
  29586. this.lastChunk = chunk.next;
  29587. }
  29588. this.byEnd[chunk.end] = chunk;
  29589. this.byStart[chunk.next.start] = chunk.next;
  29590. this.byEnd[chunk.next.end] = chunk.next;
  29591. }
  29592. if (aborted) { return true; }
  29593. chunk = chunk.previous;
  29594. } while (chunk);
  29595. return false;
  29596. };
  29597. MagicString.prototype.trimEnd = function trimEnd (charType) {
  29598. this.trimEndAborted(charType);
  29599. return this;
  29600. };
  29601. MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
  29602. var rx = new RegExp('^' + (charType || '\\s') + '+');
  29603. this.intro = this.intro.replace(rx, '');
  29604. if (this.intro.length) { return true; }
  29605. var chunk = this.firstChunk;
  29606. do {
  29607. var end = chunk.end;
  29608. var aborted = chunk.trimStart(rx);
  29609. if (chunk.end !== end) {
  29610. // special case...
  29611. if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
  29612. this.byEnd[chunk.end] = chunk;
  29613. this.byStart[chunk.next.start] = chunk.next;
  29614. this.byEnd[chunk.next.end] = chunk.next;
  29615. }
  29616. if (aborted) { return true; }
  29617. chunk = chunk.next;
  29618. } while (chunk);
  29619. return false;
  29620. };
  29621. MagicString.prototype.trimStart = function trimStart (charType) {
  29622. this.trimStartAborted(charType);
  29623. return this;
  29624. };
  29625. var hasOwnProp = Object.prototype.hasOwnProperty;
  29626. var Bundle$1 = function Bundle(options) {
  29627. if ( options === void 0 ) options = {};
  29628. this.intro = options.intro || '';
  29629. this.separator = options.separator !== undefined ? options.separator : '\n';
  29630. this.sources = [];
  29631. this.uniqueSources = [];
  29632. this.uniqueSourceIndexByFilename = {};
  29633. };
  29634. Bundle$1.prototype.addSource = function addSource (source) {
  29635. if (source instanceof MagicString) {
  29636. return this.addSource({
  29637. content: source,
  29638. filename: source.filename,
  29639. separator: this.separator
  29640. });
  29641. }
  29642. if (!isObject(source) || !source.content) {
  29643. throw new Error('bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`');
  29644. }
  29645. ['filename', 'indentExclusionRanges', 'separator'].forEach(function (option) {
  29646. if (!hasOwnProp.call(source, option)) { source[option] = source.content[option]; }
  29647. });
  29648. if (source.separator === undefined) {
  29649. // TODO there's a bunch of this sort of thing, needs cleaning up
  29650. source.separator = this.separator;
  29651. }
  29652. if (source.filename) {
  29653. if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
  29654. this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
  29655. this.uniqueSources.push({ filename: source.filename, content: source.content.original });
  29656. } else {
  29657. var uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
  29658. if (source.content.original !== uniqueSource.content) {
  29659. throw new Error(("Illegal source: same filename (" + (source.filename) + "), different contents"));
  29660. }
  29661. }
  29662. }
  29663. this.sources.push(source);
  29664. return this;
  29665. };
  29666. Bundle$1.prototype.append = function append (str, options) {
  29667. this.addSource({
  29668. content: new MagicString(str),
  29669. separator: (options && options.separator) || ''
  29670. });
  29671. return this;
  29672. };
  29673. Bundle$1.prototype.clone = function clone () {
  29674. var bundle = new Bundle$1({
  29675. intro: this.intro,
  29676. separator: this.separator
  29677. });
  29678. this.sources.forEach(function (source) {
  29679. bundle.addSource({
  29680. filename: source.filename,
  29681. content: source.content.clone(),
  29682. separator: source.separator
  29683. });
  29684. });
  29685. return bundle;
  29686. };
  29687. Bundle$1.prototype.generateDecodedMap = function generateDecodedMap (options) {
  29688. var this$1 = this;
  29689. if ( options === void 0 ) options = {};
  29690. var names = [];
  29691. this.sources.forEach(function (source) {
  29692. Object.keys(source.content.storedNames).forEach(function (name) {
  29693. if (!~names.indexOf(name)) { names.push(name); }
  29694. });
  29695. });
  29696. var mappings = new Mappings(options.hires);
  29697. if (this.intro) {
  29698. mappings.advance(this.intro);
  29699. }
  29700. this.sources.forEach(function (source, i) {
  29701. if (i > 0) {
  29702. mappings.advance(this$1.separator);
  29703. }
  29704. var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[source.filename] : -1;
  29705. var magicString = source.content;
  29706. var locate = getLocator$1(magicString.original);
  29707. if (magicString.intro) {
  29708. mappings.advance(magicString.intro);
  29709. }
  29710. magicString.firstChunk.eachNext(function (chunk) {
  29711. var loc = locate(chunk.start);
  29712. if (chunk.intro.length) { mappings.advance(chunk.intro); }
  29713. if (source.filename) {
  29714. if (chunk.edited) {
  29715. mappings.addEdit(
  29716. sourceIndex,
  29717. chunk.content,
  29718. loc,
  29719. chunk.storeName ? names.indexOf(chunk.original) : -1
  29720. );
  29721. } else {
  29722. mappings.addUneditedChunk(
  29723. sourceIndex,
  29724. chunk,
  29725. magicString.original,
  29726. loc,
  29727. magicString.sourcemapLocations
  29728. );
  29729. }
  29730. } else {
  29731. mappings.advance(chunk.content);
  29732. }
  29733. if (chunk.outro.length) { mappings.advance(chunk.outro); }
  29734. });
  29735. if (magicString.outro) {
  29736. mappings.advance(magicString.outro);
  29737. }
  29738. });
  29739. return {
  29740. file: options.file ? options.file.split(/[/\\]/).pop() : null,
  29741. sources: this.uniqueSources.map(function (source) {
  29742. return options.file ? getRelativePath(options.file, source.filename) : source.filename;
  29743. }),
  29744. sourcesContent: this.uniqueSources.map(function (source) {
  29745. return options.includeContent ? source.content : null;
  29746. }),
  29747. names: names,
  29748. mappings: mappings.raw
  29749. };
  29750. };
  29751. Bundle$1.prototype.generateMap = function generateMap (options) {
  29752. return new SourceMap(this.generateDecodedMap(options));
  29753. };
  29754. Bundle$1.prototype.getIndentString = function getIndentString () {
  29755. var indentStringCounts = {};
  29756. this.sources.forEach(function (source) {
  29757. var indentStr = source.content.indentStr;
  29758. if (indentStr === null) { return; }
  29759. if (!indentStringCounts[indentStr]) { indentStringCounts[indentStr] = 0; }
  29760. indentStringCounts[indentStr] += 1;
  29761. });
  29762. return (
  29763. Object.keys(indentStringCounts).sort(function (a, b) {
  29764. return indentStringCounts[a] - indentStringCounts[b];
  29765. })[0] || '\t'
  29766. );
  29767. };
  29768. Bundle$1.prototype.indent = function indent (indentStr) {
  29769. var this$1 = this;
  29770. if (!arguments.length) {
  29771. indentStr = this.getIndentString();
  29772. }
  29773. if (indentStr === '') { return this; } // noop
  29774. var trailingNewline = !this.intro || this.intro.slice(-1) === '\n';
  29775. this.sources.forEach(function (source, i) {
  29776. var separator = source.separator !== undefined ? source.separator : this$1.separator;
  29777. var indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator));
  29778. source.content.indent(indentStr, {
  29779. exclude: source.indentExclusionRanges,
  29780. indentStart: indentStart //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
  29781. });
  29782. trailingNewline = source.content.lastChar() === '\n';
  29783. });
  29784. if (this.intro) {
  29785. this.intro =
  29786. indentStr +
  29787. this.intro.replace(/^[^\n]/gm, function (match, index) {
  29788. return index > 0 ? indentStr + match : match;
  29789. });
  29790. }
  29791. return this;
  29792. };
  29793. Bundle$1.prototype.prepend = function prepend (str) {
  29794. this.intro = str + this.intro;
  29795. return this;
  29796. };
  29797. Bundle$1.prototype.toString = function toString () {
  29798. var this$1 = this;
  29799. var body = this.sources
  29800. .map(function (source, i) {
  29801. var separator = source.separator !== undefined ? source.separator : this$1.separator;
  29802. var str = (i > 0 ? separator : '') + source.content.toString();
  29803. return str;
  29804. })
  29805. .join('');
  29806. return this.intro + body;
  29807. };
  29808. Bundle$1.prototype.isEmpty = function isEmpty () {
  29809. if (this.intro.length && this.intro.trim())
  29810. { return false; }
  29811. if (this.sources.some(function (source) { return !source.content.isEmpty(); }))
  29812. { return false; }
  29813. return true;
  29814. };
  29815. Bundle$1.prototype.length = function length () {
  29816. return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
  29817. };
  29818. Bundle$1.prototype.trimLines = function trimLines () {
  29819. return this.trim('[\\r\\n]');
  29820. };
  29821. Bundle$1.prototype.trim = function trim (charType) {
  29822. return this.trimStart(charType).trimEnd(charType);
  29823. };
  29824. Bundle$1.prototype.trimStart = function trimStart (charType) {
  29825. var rx = new RegExp('^' + (charType || '\\s') + '+');
  29826. this.intro = this.intro.replace(rx, '');
  29827. if (!this.intro) {
  29828. var source;
  29829. var i = 0;
  29830. do {
  29831. source = this.sources[i++];
  29832. if (!source) {
  29833. break;
  29834. }
  29835. } while (!source.content.trimStartAborted(charType));
  29836. }
  29837. return this;
  29838. };
  29839. Bundle$1.prototype.trimEnd = function trimEnd (charType) {
  29840. var rx = new RegExp((charType || '\\s') + '+$');
  29841. var source;
  29842. var i = this.sources.length - 1;
  29843. do {
  29844. source = this.sources[i--];
  29845. if (!source) {
  29846. this.intro = this.intro.replace(rx, '');
  29847. break;
  29848. }
  29849. } while (!source.content.trimEndAborted(charType));
  29850. return this;
  29851. };
  29852. function relative(from, to) {
  29853. const fromParts = from.split(/[/\\]/).filter(Boolean);
  29854. const toParts = to.split(/[/\\]/).filter(Boolean);
  29855. if (fromParts[0] === '.')
  29856. fromParts.shift();
  29857. if (toParts[0] === '.')
  29858. toParts.shift();
  29859. while (fromParts[0] && toParts[0] && fromParts[0] === toParts[0]) {
  29860. fromParts.shift();
  29861. toParts.shift();
  29862. }
  29863. while (toParts[0] === '..' && fromParts.length > 0) {
  29864. toParts.shift();
  29865. fromParts.pop();
  29866. }
  29867. while (fromParts.pop()) {
  29868. toParts.unshift('..');
  29869. }
  29870. return toParts.join('/');
  29871. }
  29872. const ArrowFunctionExpression$1 = 'ArrowFunctionExpression';
  29873. const BlockStatement$1 = 'BlockStatement';
  29874. const CallExpression$1 = 'CallExpression';
  29875. const ChainExpression$1 = 'ChainExpression';
  29876. const ExpressionStatement$1 = 'ExpressionStatement';
  29877. const Identifier$1 = 'Identifier';
  29878. const ImportDefaultSpecifier$1 = 'ImportDefaultSpecifier';
  29879. const ImportNamespaceSpecifier$1 = 'ImportNamespaceSpecifier';
  29880. const NewExpression$1 = 'NewExpression';
  29881. const Program$1 = 'Program';
  29882. const Property$1 = 'Property';
  29883. const ReturnStatement$1 = 'ReturnStatement';
  29884. function treeshakeNode(node, code, start, end) {
  29885. code.remove(start, end);
  29886. if (node.annotations) {
  29887. for (const annotation of node.annotations) {
  29888. if (!annotation.comment) {
  29889. continue;
  29890. }
  29891. if (annotation.comment.start < start) {
  29892. code.remove(annotation.comment.start, annotation.comment.end);
  29893. }
  29894. else {
  29895. return;
  29896. }
  29897. }
  29898. }
  29899. }
  29900. function removeAnnotations(node, code) {
  29901. if (!node.annotations && node.parent.type === ExpressionStatement$1) {
  29902. node = node.parent;
  29903. }
  29904. if (node.annotations) {
  29905. for (const annotation of node.annotations.filter((a) => a.comment)) {
  29906. code.remove(annotation.comment.start, annotation.comment.end);
  29907. }
  29908. }
  29909. }
  29910. const NO_SEMICOLON = { isNoStatement: true };
  29911. // This assumes there are only white-space and comments between start and the string we are looking for
  29912. function findFirstOccurrenceOutsideComment(code, searchString, start = 0) {
  29913. let searchPos, charCodeAfterSlash;
  29914. searchPos = code.indexOf(searchString, start);
  29915. while (true) {
  29916. start = code.indexOf('/', start);
  29917. if (start === -1 || start >= searchPos)
  29918. return searchPos;
  29919. charCodeAfterSlash = code.charCodeAt(++start);
  29920. ++start;
  29921. // With our assumption, '/' always starts a comment. Determine comment type:
  29922. start =
  29923. charCodeAfterSlash === 47 /*"/"*/
  29924. ? code.indexOf('\n', start) + 1
  29925. : code.indexOf('*/', start) + 2;
  29926. if (start > searchPos) {
  29927. searchPos = code.indexOf(searchString, start);
  29928. }
  29929. }
  29930. }
  29931. const NON_WHITESPACE = /\S/g;
  29932. function findNonWhiteSpace(code, index) {
  29933. NON_WHITESPACE.lastIndex = index;
  29934. const result = NON_WHITESPACE.exec(code);
  29935. return result.index;
  29936. }
  29937. // This assumes "code" only contains white-space and comments
  29938. // Returns position of line-comment if applicable
  29939. function findFirstLineBreakOutsideComment(code) {
  29940. let lineBreakPos, charCodeAfterSlash, start = 0;
  29941. lineBreakPos = code.indexOf('\n', start);
  29942. while (true) {
  29943. start = code.indexOf('/', start);
  29944. if (start === -1 || start > lineBreakPos)
  29945. return [lineBreakPos, lineBreakPos + 1];
  29946. // With our assumption, '/' always starts a comment. Determine comment type:
  29947. charCodeAfterSlash = code.charCodeAt(start + 1);
  29948. if (charCodeAfterSlash === 47 /*"/"*/)
  29949. return [start, lineBreakPos + 1];
  29950. start = code.indexOf('*/', start + 3) + 2;
  29951. if (start > lineBreakPos) {
  29952. lineBreakPos = code.indexOf('\n', start);
  29953. }
  29954. }
  29955. }
  29956. function renderStatementList(statements, code, start, end, options) {
  29957. let currentNode, currentNodeStart, currentNodeNeedsBoundaries, nextNodeStart;
  29958. let nextNode = statements[0];
  29959. let nextNodeNeedsBoundaries = !nextNode.included || nextNode.needsBoundaries;
  29960. if (nextNodeNeedsBoundaries) {
  29961. nextNodeStart =
  29962. start + findFirstLineBreakOutsideComment(code.original.slice(start, nextNode.start))[1];
  29963. }
  29964. for (let nextIndex = 1; nextIndex <= statements.length; nextIndex++) {
  29965. currentNode = nextNode;
  29966. currentNodeStart = nextNodeStart;
  29967. currentNodeNeedsBoundaries = nextNodeNeedsBoundaries;
  29968. nextNode = statements[nextIndex];
  29969. nextNodeNeedsBoundaries =
  29970. nextNode === undefined ? false : !nextNode.included || nextNode.needsBoundaries;
  29971. if (currentNodeNeedsBoundaries || nextNodeNeedsBoundaries) {
  29972. nextNodeStart =
  29973. currentNode.end +
  29974. findFirstLineBreakOutsideComment(code.original.slice(currentNode.end, nextNode === undefined ? end : nextNode.start))[1];
  29975. if (currentNode.included) {
  29976. currentNodeNeedsBoundaries
  29977. ? currentNode.render(code, options, {
  29978. end: nextNodeStart,
  29979. start: currentNodeStart
  29980. })
  29981. : currentNode.render(code, options);
  29982. }
  29983. else {
  29984. treeshakeNode(currentNode, code, currentNodeStart, nextNodeStart);
  29985. }
  29986. }
  29987. else {
  29988. currentNode.render(code, options);
  29989. }
  29990. }
  29991. }
  29992. // This assumes that the first character is not part of the first node
  29993. function getCommaSeparatedNodesWithBoundaries(nodes, code, start, end) {
  29994. const splitUpNodes = [];
  29995. let node, nextNode, nextNodeStart, contentEnd, char;
  29996. let separator = start - 1;
  29997. for (let nextIndex = 0; nextIndex < nodes.length; nextIndex++) {
  29998. nextNode = nodes[nextIndex];
  29999. if (node !== undefined) {
  30000. separator =
  30001. node.end +
  30002. findFirstOccurrenceOutsideComment(code.original.slice(node.end, nextNode.start), ',');
  30003. }
  30004. nextNodeStart = contentEnd =
  30005. separator +
  30006. 1 +
  30007. findFirstLineBreakOutsideComment(code.original.slice(separator + 1, nextNode.start))[1];
  30008. while (((char = code.original.charCodeAt(nextNodeStart)),
  30009. char === 32 /*" "*/ || char === 9 /*"\t"*/ || char === 10 /*"\n"*/ || char === 13) /*"\r"*/)
  30010. nextNodeStart++;
  30011. if (node !== undefined) {
  30012. splitUpNodes.push({
  30013. contentEnd,
  30014. end: nextNodeStart,
  30015. node,
  30016. separator,
  30017. start
  30018. });
  30019. }
  30020. node = nextNode;
  30021. start = nextNodeStart;
  30022. }
  30023. splitUpNodes.push({
  30024. contentEnd: end,
  30025. end,
  30026. node: node,
  30027. separator: null,
  30028. start
  30029. });
  30030. return splitUpNodes;
  30031. }
  30032. // This assumes there are only white-space and comments between start and end
  30033. function removeLineBreaks(code, start, end) {
  30034. while (true) {
  30035. const [removeStart, removeEnd] = findFirstLineBreakOutsideComment(code.original.slice(start, end));
  30036. if (removeStart === -1) {
  30037. break;
  30038. }
  30039. code.remove(start + removeStart, (start += removeEnd));
  30040. }
  30041. }
  30042. function getSystemExportStatement(exportedVariables, options) {
  30043. const _ = options.compact ? '' : ' ';
  30044. if (exportedVariables.length === 1 &&
  30045. options.exportNamesByVariable.get(exportedVariables[0]).length === 1) {
  30046. const variable = exportedVariables[0];
  30047. return `exports('${options.exportNamesByVariable.get(variable)}',${_}${variable.getName()})`;
  30048. }
  30049. else {
  30050. return `exports({${_}${exportedVariables
  30051. .map(variable => {
  30052. return options.exportNamesByVariable
  30053. .get(variable)
  30054. .map(exportName => `${exportName}:${_}${variable.getName()}`)
  30055. .join(`,${_}`);
  30056. })
  30057. .join(`,${_}`)}${_}})`;
  30058. }
  30059. }
  30060. function getSystemExportFunctionLeft(exportedVariables, setFromExpression, options) {
  30061. const _ = options.compact ? '' : ' ';
  30062. const s = options.compact ? '' : ';';
  30063. return `function${_}(v)${_}{${_}return exports({${_}${exportedVariables
  30064. .map(variable => {
  30065. return options.exportNamesByVariable
  30066. .get(variable)
  30067. .map(exportName => `${exportName}:${_}${setFromExpression ? variable.getName() : 'v'}`)
  30068. .join(`,${_}`);
  30069. })
  30070. .join(`,${_}`)}${_}}),${_}v${s}${_}}(`;
  30071. }
  30072. const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
  30073. const base$1 = 64;
  30074. function toBase64(num) {
  30075. let outStr = '';
  30076. do {
  30077. const curDigit = num % base$1;
  30078. num = Math.floor(num / base$1);
  30079. outStr = chars[curDigit] + outStr;
  30080. } while (num !== 0);
  30081. return outStr;
  30082. }
  30083. const RESERVED_NAMES = {
  30084. // @ts-ignore
  30085. __proto__: null,
  30086. await: true,
  30087. break: true,
  30088. case: true,
  30089. catch: true,
  30090. class: true,
  30091. const: true,
  30092. continue: true,
  30093. debugger: true,
  30094. default: true,
  30095. delete: true,
  30096. do: true,
  30097. else: true,
  30098. enum: true,
  30099. eval: true,
  30100. export: true,
  30101. extends: true,
  30102. false: true,
  30103. finally: true,
  30104. for: true,
  30105. function: true,
  30106. if: true,
  30107. implements: true,
  30108. import: true,
  30109. in: true,
  30110. instanceof: true,
  30111. interface: true,
  30112. let: true,
  30113. new: true,
  30114. null: true,
  30115. package: true,
  30116. private: true,
  30117. protected: true,
  30118. public: true,
  30119. return: true,
  30120. static: true,
  30121. super: true,
  30122. switch: true,
  30123. this: true,
  30124. throw: true,
  30125. true: true,
  30126. try: true,
  30127. typeof: true,
  30128. undefined: true,
  30129. var: true,
  30130. void: true,
  30131. while: true,
  30132. with: true,
  30133. yield: true
  30134. };
  30135. function getSafeName(baseName, usedNames) {
  30136. let safeName = baseName;
  30137. let count = 1;
  30138. while (usedNames.has(safeName) || RESERVED_NAMES[safeName]) {
  30139. safeName = `${baseName}$${toBase64(count++)}`;
  30140. }
  30141. usedNames.add(safeName);
  30142. return safeName;
  30143. }
  30144. const NO_ARGS = [];
  30145. function getOrCreate(map, key, init) {
  30146. const existing = map.get(key);
  30147. if (existing) {
  30148. return existing;
  30149. }
  30150. const value = init();
  30151. map.set(key, value);
  30152. return value;
  30153. }
  30154. const UnknownKey = Symbol('Unknown Key');
  30155. const EMPTY_PATH = [];
  30156. const UNKNOWN_PATH = [UnknownKey];
  30157. const EntitiesKey = Symbol('Entities');
  30158. class PathTracker {
  30159. constructor() {
  30160. this.entityPaths = Object.create(null, { [EntitiesKey]: { value: new Set() } });
  30161. }
  30162. getEntities(path) {
  30163. let currentPaths = this.entityPaths;
  30164. for (const pathSegment of path) {
  30165. currentPaths = currentPaths[pathSegment] =
  30166. currentPaths[pathSegment] ||
  30167. Object.create(null, { [EntitiesKey]: { value: new Set() } });
  30168. }
  30169. return currentPaths[EntitiesKey];
  30170. }
  30171. }
  30172. const SHARED_RECURSION_TRACKER = new PathTracker();
  30173. class DiscriminatedPathTracker {
  30174. constructor() {
  30175. this.entityPaths = Object.create(null, {
  30176. [EntitiesKey]: { value: new Map() }
  30177. });
  30178. }
  30179. getEntities(path, discriminator) {
  30180. let currentPaths = this.entityPaths;
  30181. for (const pathSegment of path) {
  30182. currentPaths = currentPaths[pathSegment] =
  30183. currentPaths[pathSegment] ||
  30184. Object.create(null, { [EntitiesKey]: { value: new Map() } });
  30185. }
  30186. return getOrCreate(currentPaths[EntitiesKey], discriminator, () => new Set());
  30187. }
  30188. }
  30189. function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
  30190. return Object.create(inheritedDescriptions, memberDescriptions);
  30191. }
  30192. const UnknownValue = Symbol('Unknown Value');
  30193. const UNKNOWN_EXPRESSION = {
  30194. deoptimizePath: () => { },
  30195. getLiteralValueAtPath: () => UnknownValue,
  30196. getReturnExpressionWhenCalledAtPath: () => UNKNOWN_EXPRESSION,
  30197. hasEffectsWhenAccessedAtPath: path => path.length > 0,
  30198. hasEffectsWhenAssignedAtPath: path => path.length > 0,
  30199. hasEffectsWhenCalledAtPath: () => true,
  30200. include: () => { },
  30201. includeCallArguments(context, args) {
  30202. for (const arg of args) {
  30203. arg.include(context, false);
  30204. }
  30205. },
  30206. included: true,
  30207. toString: () => '[[UNKNOWN]]'
  30208. };
  30209. const UNDEFINED_EXPRESSION = {
  30210. deoptimizePath: () => { },
  30211. getLiteralValueAtPath: () => undefined,
  30212. getReturnExpressionWhenCalledAtPath: () => UNKNOWN_EXPRESSION,
  30213. hasEffectsWhenAccessedAtPath: path => path.length > 0,
  30214. hasEffectsWhenAssignedAtPath: path => path.length > 0,
  30215. hasEffectsWhenCalledAtPath: () => true,
  30216. include: () => { },
  30217. includeCallArguments() { },
  30218. included: true,
  30219. toString: () => 'undefined'
  30220. };
  30221. const returnsUnknown = {
  30222. value: {
  30223. callsArgs: null,
  30224. mutatesSelf: false,
  30225. returns: null,
  30226. returnsPrimitive: UNKNOWN_EXPRESSION
  30227. }
  30228. };
  30229. const mutatesSelfReturnsUnknown = {
  30230. value: { returns: null, returnsPrimitive: UNKNOWN_EXPRESSION, callsArgs: null, mutatesSelf: true }
  30231. };
  30232. const callsArgReturnsUnknown = {
  30233. value: { returns: null, returnsPrimitive: UNKNOWN_EXPRESSION, callsArgs: [0], mutatesSelf: false }
  30234. };
  30235. class UnknownArrayExpression {
  30236. constructor() {
  30237. this.included = false;
  30238. }
  30239. deoptimizePath() { }
  30240. getLiteralValueAtPath() {
  30241. return UnknownValue;
  30242. }
  30243. getReturnExpressionWhenCalledAtPath(path) {
  30244. if (path.length === 1) {
  30245. return getMemberReturnExpressionWhenCalled(arrayMembers, path[0]);
  30246. }
  30247. return UNKNOWN_EXPRESSION;
  30248. }
  30249. hasEffectsWhenAccessedAtPath(path) {
  30250. return path.length > 1;
  30251. }
  30252. hasEffectsWhenAssignedAtPath(path) {
  30253. return path.length > 1;
  30254. }
  30255. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  30256. if (path.length === 1) {
  30257. return hasMemberEffectWhenCalled(arrayMembers, path[0], this.included, callOptions, context);
  30258. }
  30259. return true;
  30260. }
  30261. include() {
  30262. this.included = true;
  30263. }
  30264. includeCallArguments(context, args) {
  30265. for (const arg of args) {
  30266. arg.include(context, false);
  30267. }
  30268. }
  30269. toString() {
  30270. return '[[UNKNOWN ARRAY]]';
  30271. }
  30272. }
  30273. const returnsArray = {
  30274. value: {
  30275. callsArgs: null,
  30276. mutatesSelf: false,
  30277. returns: UnknownArrayExpression,
  30278. returnsPrimitive: null
  30279. }
  30280. };
  30281. const mutatesSelfReturnsArray = {
  30282. value: {
  30283. callsArgs: null,
  30284. mutatesSelf: true,
  30285. returns: UnknownArrayExpression,
  30286. returnsPrimitive: null
  30287. }
  30288. };
  30289. const callsArgReturnsArray = {
  30290. value: {
  30291. callsArgs: [0],
  30292. mutatesSelf: false,
  30293. returns: UnknownArrayExpression,
  30294. returnsPrimitive: null
  30295. }
  30296. };
  30297. const callsArgMutatesSelfReturnsArray = {
  30298. value: {
  30299. callsArgs: [0],
  30300. mutatesSelf: true,
  30301. returns: UnknownArrayExpression,
  30302. returnsPrimitive: null
  30303. }
  30304. };
  30305. const UNKNOWN_LITERAL_BOOLEAN = {
  30306. deoptimizePath: () => { },
  30307. getLiteralValueAtPath: () => UnknownValue,
  30308. getReturnExpressionWhenCalledAtPath: path => {
  30309. if (path.length === 1) {
  30310. return getMemberReturnExpressionWhenCalled(literalBooleanMembers, path[0]);
  30311. }
  30312. return UNKNOWN_EXPRESSION;
  30313. },
  30314. hasEffectsWhenAccessedAtPath: path => path.length > 1,
  30315. hasEffectsWhenAssignedAtPath: path => path.length > 0,
  30316. hasEffectsWhenCalledAtPath: path => {
  30317. if (path.length === 1) {
  30318. const subPath = path[0];
  30319. return typeof subPath !== 'string' || !literalBooleanMembers[subPath];
  30320. }
  30321. return true;
  30322. },
  30323. include: () => { },
  30324. includeCallArguments(context, args) {
  30325. for (const arg of args) {
  30326. arg.include(context, false);
  30327. }
  30328. },
  30329. included: true,
  30330. toString: () => '[[UNKNOWN BOOLEAN]]'
  30331. };
  30332. const returnsBoolean = {
  30333. value: {
  30334. callsArgs: null,
  30335. mutatesSelf: false,
  30336. returns: null,
  30337. returnsPrimitive: UNKNOWN_LITERAL_BOOLEAN
  30338. }
  30339. };
  30340. const callsArgReturnsBoolean = {
  30341. value: {
  30342. callsArgs: [0],
  30343. mutatesSelf: false,
  30344. returns: null,
  30345. returnsPrimitive: UNKNOWN_LITERAL_BOOLEAN
  30346. }
  30347. };
  30348. const UNKNOWN_LITERAL_NUMBER = {
  30349. deoptimizePath: () => { },
  30350. getLiteralValueAtPath: () => UnknownValue,
  30351. getReturnExpressionWhenCalledAtPath: path => {
  30352. if (path.length === 1) {
  30353. return getMemberReturnExpressionWhenCalled(literalNumberMembers, path[0]);
  30354. }
  30355. return UNKNOWN_EXPRESSION;
  30356. },
  30357. hasEffectsWhenAccessedAtPath: path => path.length > 1,
  30358. hasEffectsWhenAssignedAtPath: path => path.length > 0,
  30359. hasEffectsWhenCalledAtPath: path => {
  30360. if (path.length === 1) {
  30361. const subPath = path[0];
  30362. return typeof subPath !== 'string' || !literalNumberMembers[subPath];
  30363. }
  30364. return true;
  30365. },
  30366. include: () => { },
  30367. includeCallArguments(context, args) {
  30368. for (const arg of args) {
  30369. arg.include(context, false);
  30370. }
  30371. },
  30372. included: true,
  30373. toString: () => '[[UNKNOWN NUMBER]]'
  30374. };
  30375. const returnsNumber = {
  30376. value: {
  30377. callsArgs: null,
  30378. mutatesSelf: false,
  30379. returns: null,
  30380. returnsPrimitive: UNKNOWN_LITERAL_NUMBER
  30381. }
  30382. };
  30383. const mutatesSelfReturnsNumber = {
  30384. value: {
  30385. callsArgs: null,
  30386. mutatesSelf: true,
  30387. returns: null,
  30388. returnsPrimitive: UNKNOWN_LITERAL_NUMBER
  30389. }
  30390. };
  30391. const callsArgReturnsNumber = {
  30392. value: {
  30393. callsArgs: [0],
  30394. mutatesSelf: false,
  30395. returns: null,
  30396. returnsPrimitive: UNKNOWN_LITERAL_NUMBER
  30397. }
  30398. };
  30399. const UNKNOWN_LITERAL_STRING = {
  30400. deoptimizePath: () => { },
  30401. getLiteralValueAtPath: () => UnknownValue,
  30402. getReturnExpressionWhenCalledAtPath: path => {
  30403. if (path.length === 1) {
  30404. return getMemberReturnExpressionWhenCalled(literalStringMembers, path[0]);
  30405. }
  30406. return UNKNOWN_EXPRESSION;
  30407. },
  30408. hasEffectsWhenAccessedAtPath: path => path.length > 1,
  30409. hasEffectsWhenAssignedAtPath: path => path.length > 0,
  30410. hasEffectsWhenCalledAtPath: (path, callOptions, context) => {
  30411. if (path.length === 1) {
  30412. return hasMemberEffectWhenCalled(literalStringMembers, path[0], true, callOptions, context);
  30413. }
  30414. return true;
  30415. },
  30416. include: () => { },
  30417. includeCallArguments(context, args) {
  30418. for (const arg of args) {
  30419. arg.include(context, false);
  30420. }
  30421. },
  30422. included: true,
  30423. toString: () => '[[UNKNOWN STRING]]'
  30424. };
  30425. const returnsString = {
  30426. value: {
  30427. callsArgs: null,
  30428. mutatesSelf: false,
  30429. returns: null,
  30430. returnsPrimitive: UNKNOWN_LITERAL_STRING
  30431. }
  30432. };
  30433. class UnknownObjectExpression {
  30434. constructor() {
  30435. this.included = false;
  30436. }
  30437. deoptimizePath() { }
  30438. getLiteralValueAtPath() {
  30439. return UnknownValue;
  30440. }
  30441. getReturnExpressionWhenCalledAtPath(path) {
  30442. if (path.length === 1) {
  30443. return getMemberReturnExpressionWhenCalled(objectMembers, path[0]);
  30444. }
  30445. return UNKNOWN_EXPRESSION;
  30446. }
  30447. hasEffectsWhenAccessedAtPath(path) {
  30448. return path.length > 1;
  30449. }
  30450. hasEffectsWhenAssignedAtPath(path) {
  30451. return path.length > 1;
  30452. }
  30453. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  30454. if (path.length === 1) {
  30455. return hasMemberEffectWhenCalled(objectMembers, path[0], this.included, callOptions, context);
  30456. }
  30457. return true;
  30458. }
  30459. include() {
  30460. this.included = true;
  30461. }
  30462. includeCallArguments(context, args) {
  30463. for (const arg of args) {
  30464. arg.include(context, false);
  30465. }
  30466. }
  30467. toString() {
  30468. return '[[UNKNOWN OBJECT]]';
  30469. }
  30470. }
  30471. const objectMembers = assembleMemberDescriptions({
  30472. hasOwnProperty: returnsBoolean,
  30473. isPrototypeOf: returnsBoolean,
  30474. propertyIsEnumerable: returnsBoolean,
  30475. toLocaleString: returnsString,
  30476. toString: returnsString,
  30477. valueOf: returnsUnknown
  30478. });
  30479. const arrayMembers = assembleMemberDescriptions({
  30480. concat: returnsArray,
  30481. copyWithin: mutatesSelfReturnsArray,
  30482. every: callsArgReturnsBoolean,
  30483. fill: mutatesSelfReturnsArray,
  30484. filter: callsArgReturnsArray,
  30485. find: callsArgReturnsUnknown,
  30486. findIndex: callsArgReturnsNumber,
  30487. forEach: callsArgReturnsUnknown,
  30488. includes: returnsBoolean,
  30489. indexOf: returnsNumber,
  30490. join: returnsString,
  30491. lastIndexOf: returnsNumber,
  30492. map: callsArgReturnsArray,
  30493. pop: mutatesSelfReturnsUnknown,
  30494. push: mutatesSelfReturnsNumber,
  30495. reduce: callsArgReturnsUnknown,
  30496. reduceRight: callsArgReturnsUnknown,
  30497. reverse: mutatesSelfReturnsArray,
  30498. shift: mutatesSelfReturnsUnknown,
  30499. slice: returnsArray,
  30500. some: callsArgReturnsBoolean,
  30501. sort: callsArgMutatesSelfReturnsArray,
  30502. splice: mutatesSelfReturnsArray,
  30503. unshift: mutatesSelfReturnsNumber
  30504. }, objectMembers);
  30505. const literalBooleanMembers = assembleMemberDescriptions({
  30506. valueOf: returnsBoolean
  30507. }, objectMembers);
  30508. const literalNumberMembers = assembleMemberDescriptions({
  30509. toExponential: returnsString,
  30510. toFixed: returnsString,
  30511. toLocaleString: returnsString,
  30512. toPrecision: returnsString,
  30513. valueOf: returnsNumber
  30514. }, objectMembers);
  30515. const literalStringMembers = assembleMemberDescriptions({
  30516. charAt: returnsString,
  30517. charCodeAt: returnsNumber,
  30518. codePointAt: returnsNumber,
  30519. concat: returnsString,
  30520. endsWith: returnsBoolean,
  30521. includes: returnsBoolean,
  30522. indexOf: returnsNumber,
  30523. lastIndexOf: returnsNumber,
  30524. localeCompare: returnsNumber,
  30525. match: returnsBoolean,
  30526. normalize: returnsString,
  30527. padEnd: returnsString,
  30528. padStart: returnsString,
  30529. repeat: returnsString,
  30530. replace: {
  30531. value: {
  30532. callsArgs: [1],
  30533. mutatesSelf: false,
  30534. returns: null,
  30535. returnsPrimitive: UNKNOWN_LITERAL_STRING
  30536. }
  30537. },
  30538. search: returnsNumber,
  30539. slice: returnsString,
  30540. split: returnsArray,
  30541. startsWith: returnsBoolean,
  30542. substr: returnsString,
  30543. substring: returnsString,
  30544. toLocaleLowerCase: returnsString,
  30545. toLocaleUpperCase: returnsString,
  30546. toLowerCase: returnsString,
  30547. toUpperCase: returnsString,
  30548. trim: returnsString,
  30549. valueOf: returnsString
  30550. }, objectMembers);
  30551. function getLiteralMembersForValue(value) {
  30552. switch (typeof value) {
  30553. case 'boolean':
  30554. return literalBooleanMembers;
  30555. case 'number':
  30556. return literalNumberMembers;
  30557. case 'string':
  30558. return literalStringMembers;
  30559. default:
  30560. return Object.create(null);
  30561. }
  30562. }
  30563. function hasMemberEffectWhenCalled(members, memberName, parentIncluded, callOptions, context) {
  30564. if (typeof memberName !== 'string' ||
  30565. !members[memberName] ||
  30566. (members[memberName].mutatesSelf && parentIncluded))
  30567. return true;
  30568. if (!members[memberName].callsArgs)
  30569. return false;
  30570. for (const argIndex of members[memberName].callsArgs) {
  30571. if (callOptions.args[argIndex] &&
  30572. callOptions.args[argIndex].hasEffectsWhenCalledAtPath(EMPTY_PATH, {
  30573. args: NO_ARGS,
  30574. withNew: false
  30575. }, context))
  30576. return true;
  30577. }
  30578. return false;
  30579. }
  30580. function getMemberReturnExpressionWhenCalled(members, memberName) {
  30581. if (typeof memberName !== 'string' || !members[memberName])
  30582. return UNKNOWN_EXPRESSION;
  30583. return members[memberName].returnsPrimitive !== null
  30584. ? members[memberName].returnsPrimitive
  30585. : new members[memberName].returns();
  30586. }
  30587. const BROKEN_FLOW_NONE = 0;
  30588. const BROKEN_FLOW_BREAK_CONTINUE = 1;
  30589. const BROKEN_FLOW_ERROR_RETURN_LABEL = 2;
  30590. function createInclusionContext() {
  30591. return {
  30592. brokenFlow: BROKEN_FLOW_NONE,
  30593. includedCallArguments: new Set(),
  30594. includedLabels: new Set()
  30595. };
  30596. }
  30597. function createHasEffectsContext() {
  30598. return {
  30599. accessed: new PathTracker(),
  30600. assigned: new PathTracker(),
  30601. brokenFlow: BROKEN_FLOW_NONE,
  30602. called: new DiscriminatedPathTracker(),
  30603. ignore: {
  30604. breaks: false,
  30605. continues: false,
  30606. labels: new Set(),
  30607. returnAwaitYield: false
  30608. },
  30609. includedLabels: new Set(),
  30610. instantiated: new DiscriminatedPathTracker(),
  30611. replacedVariableInits: new Map()
  30612. };
  30613. }
  30614. class Variable {
  30615. constructor(name) {
  30616. this.alwaysRendered = false;
  30617. this.included = false;
  30618. this.isId = false;
  30619. this.isReassigned = false;
  30620. this.renderBaseName = null;
  30621. this.renderName = null;
  30622. this.name = name;
  30623. }
  30624. /**
  30625. * Binds identifiers that reference this variable to this variable.
  30626. * Necessary to be able to change variable names.
  30627. */
  30628. addReference(_identifier) { }
  30629. deoptimizePath(_path) { }
  30630. getBaseVariableName() {
  30631. return this.renderBaseName || this.renderName || this.name;
  30632. }
  30633. getLiteralValueAtPath(_path, _recursionTracker, _origin) {
  30634. return UnknownValue;
  30635. }
  30636. getName() {
  30637. const name = this.renderName || this.name;
  30638. return this.renderBaseName
  30639. ? `${this.renderBaseName}${RESERVED_NAMES[name] ? `['${name}']` : `.${name}`}`
  30640. : name;
  30641. }
  30642. getReturnExpressionWhenCalledAtPath(_path, _recursionTracker, _origin) {
  30643. return UNKNOWN_EXPRESSION;
  30644. }
  30645. hasEffectsWhenAccessedAtPath(path, _context) {
  30646. return path.length > 0;
  30647. }
  30648. hasEffectsWhenAssignedAtPath(_path, _context) {
  30649. return true;
  30650. }
  30651. hasEffectsWhenCalledAtPath(_path, _callOptions, _context) {
  30652. return true;
  30653. }
  30654. /**
  30655. * Marks this variable as being part of the bundle, which is usually the case when one of
  30656. * its identifiers becomes part of the bundle. Returns true if it has not been included
  30657. * previously.
  30658. * Once a variable is included, it should take care all its declarations are included.
  30659. */
  30660. include() {
  30661. this.included = true;
  30662. }
  30663. includeCallArguments(context, args) {
  30664. for (const arg of args) {
  30665. arg.include(context, false);
  30666. }
  30667. }
  30668. markCalledFromTryStatement() { }
  30669. setRenderNames(baseName, name) {
  30670. this.renderBaseName = baseName;
  30671. this.renderName = name;
  30672. }
  30673. }
  30674. // To avoid infinite recursions
  30675. const MAX_PATH_DEPTH = 7;
  30676. class LocalVariable extends Variable {
  30677. constructor(name, declarator, init, context) {
  30678. super(name);
  30679. this.additionalInitializers = null;
  30680. this.calledFromTryStatement = false;
  30681. this.expressionsToBeDeoptimized = [];
  30682. this.declarations = declarator ? [declarator] : [];
  30683. this.init = init;
  30684. this.deoptimizationTracker = context.deoptimizationTracker;
  30685. this.module = context.module;
  30686. }
  30687. addDeclaration(identifier, init) {
  30688. this.declarations.push(identifier);
  30689. if (this.additionalInitializers === null) {
  30690. this.additionalInitializers = this.init === null ? [] : [this.init];
  30691. this.init = UNKNOWN_EXPRESSION;
  30692. this.isReassigned = true;
  30693. }
  30694. if (init !== null) {
  30695. this.additionalInitializers.push(init);
  30696. }
  30697. }
  30698. consolidateInitializers() {
  30699. if (this.additionalInitializers !== null) {
  30700. for (const initializer of this.additionalInitializers) {
  30701. initializer.deoptimizePath(UNKNOWN_PATH);
  30702. }
  30703. this.additionalInitializers = null;
  30704. }
  30705. }
  30706. deoptimizePath(path) {
  30707. if (path.length > MAX_PATH_DEPTH || this.isReassigned)
  30708. return;
  30709. const trackedEntities = this.deoptimizationTracker.getEntities(path);
  30710. if (trackedEntities.has(this))
  30711. return;
  30712. trackedEntities.add(this);
  30713. if (path.length === 0) {
  30714. if (!this.isReassigned) {
  30715. this.isReassigned = true;
  30716. const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
  30717. this.expressionsToBeDeoptimized = [];
  30718. for (const expression of expressionsToBeDeoptimized) {
  30719. expression.deoptimizeCache();
  30720. }
  30721. if (this.init) {
  30722. this.init.deoptimizePath(UNKNOWN_PATH);
  30723. }
  30724. }
  30725. }
  30726. else if (this.init) {
  30727. this.init.deoptimizePath(path);
  30728. }
  30729. }
  30730. getLiteralValueAtPath(path, recursionTracker, origin) {
  30731. if (this.isReassigned || !this.init || path.length > MAX_PATH_DEPTH) {
  30732. return UnknownValue;
  30733. }
  30734. const trackedEntities = recursionTracker.getEntities(path);
  30735. if (trackedEntities.has(this.init)) {
  30736. return UnknownValue;
  30737. }
  30738. this.expressionsToBeDeoptimized.push(origin);
  30739. trackedEntities.add(this.init);
  30740. const value = this.init.getLiteralValueAtPath(path, recursionTracker, origin);
  30741. trackedEntities.delete(this.init);
  30742. return value;
  30743. }
  30744. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  30745. if (this.isReassigned || !this.init || path.length > MAX_PATH_DEPTH) {
  30746. return UNKNOWN_EXPRESSION;
  30747. }
  30748. const trackedEntities = recursionTracker.getEntities(path);
  30749. if (trackedEntities.has(this.init)) {
  30750. return UNKNOWN_EXPRESSION;
  30751. }
  30752. this.expressionsToBeDeoptimized.push(origin);
  30753. trackedEntities.add(this.init);
  30754. const value = this.init.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  30755. trackedEntities.delete(this.init);
  30756. return value;
  30757. }
  30758. hasEffectsWhenAccessedAtPath(path, context) {
  30759. if (path.length === 0)
  30760. return false;
  30761. if (this.isReassigned || path.length > MAX_PATH_DEPTH)
  30762. return true;
  30763. const trackedExpressions = context.accessed.getEntities(path);
  30764. if (trackedExpressions.has(this))
  30765. return false;
  30766. trackedExpressions.add(this);
  30767. return (this.init && this.init.hasEffectsWhenAccessedAtPath(path, context));
  30768. }
  30769. hasEffectsWhenAssignedAtPath(path, context) {
  30770. if (this.included || path.length > MAX_PATH_DEPTH)
  30771. return true;
  30772. if (path.length === 0)
  30773. return false;
  30774. if (this.isReassigned)
  30775. return true;
  30776. const trackedExpressions = context.assigned.getEntities(path);
  30777. if (trackedExpressions.has(this))
  30778. return false;
  30779. trackedExpressions.add(this);
  30780. return (this.init && this.init.hasEffectsWhenAssignedAtPath(path, context));
  30781. }
  30782. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  30783. if (path.length > MAX_PATH_DEPTH || this.isReassigned)
  30784. return true;
  30785. const trackedExpressions = (callOptions.withNew
  30786. ? context.instantiated
  30787. : context.called).getEntities(path, callOptions);
  30788. if (trackedExpressions.has(this))
  30789. return false;
  30790. trackedExpressions.add(this);
  30791. return (this.init && this.init.hasEffectsWhenCalledAtPath(path, callOptions, context));
  30792. }
  30793. include() {
  30794. if (!this.included) {
  30795. this.included = true;
  30796. for (const declaration of this.declarations) {
  30797. // If node is a default export, it can save a tree-shaking run to include the full declaration now
  30798. if (!declaration.included)
  30799. declaration.include(createInclusionContext(), false);
  30800. let node = declaration.parent;
  30801. while (!node.included) {
  30802. // We do not want to properly include parents in case they are part of a dead branch
  30803. // in which case .include() might pull in more dead code
  30804. node.included = true;
  30805. if (node.type === Program$1)
  30806. break;
  30807. node = node.parent;
  30808. }
  30809. }
  30810. }
  30811. }
  30812. includeCallArguments(context, args) {
  30813. if (this.isReassigned || (this.init && context.includedCallArguments.has(this.init))) {
  30814. for (const arg of args) {
  30815. arg.include(context, false);
  30816. }
  30817. }
  30818. else if (this.init) {
  30819. context.includedCallArguments.add(this.init);
  30820. this.init.includeCallArguments(context, args);
  30821. context.includedCallArguments.delete(this.init);
  30822. }
  30823. }
  30824. markCalledFromTryStatement() {
  30825. this.calledFromTryStatement = true;
  30826. }
  30827. }
  30828. class Scope$1 {
  30829. constructor() {
  30830. this.children = [];
  30831. this.variables = new Map();
  30832. }
  30833. addDeclaration(identifier, context, init, _isHoisted) {
  30834. const name = identifier.name;
  30835. let variable = this.variables.get(name);
  30836. if (variable) {
  30837. variable.addDeclaration(identifier, init);
  30838. }
  30839. else {
  30840. variable = new LocalVariable(identifier.name, identifier, init || UNDEFINED_EXPRESSION, context);
  30841. this.variables.set(name, variable);
  30842. }
  30843. return variable;
  30844. }
  30845. contains(name) {
  30846. return this.variables.has(name);
  30847. }
  30848. findVariable(_name) {
  30849. throw new Error('Internal Error: findVariable needs to be implemented by a subclass');
  30850. }
  30851. }
  30852. class ChildScope extends Scope$1 {
  30853. constructor(parent) {
  30854. super();
  30855. this.accessedOutsideVariables = new Map();
  30856. this.parent = parent;
  30857. parent.children.push(this);
  30858. }
  30859. addAccessedDynamicImport(importExpression) {
  30860. (this.accessedDynamicImports || (this.accessedDynamicImports = new Set())).add(importExpression);
  30861. if (this.parent instanceof ChildScope) {
  30862. this.parent.addAccessedDynamicImport(importExpression);
  30863. }
  30864. }
  30865. addAccessedGlobals(globals, accessedGlobalsByScope) {
  30866. const accessedGlobals = accessedGlobalsByScope.get(this) || new Set();
  30867. for (const name of globals) {
  30868. accessedGlobals.add(name);
  30869. }
  30870. accessedGlobalsByScope.set(this, accessedGlobals);
  30871. if (this.parent instanceof ChildScope) {
  30872. this.parent.addAccessedGlobals(globals, accessedGlobalsByScope);
  30873. }
  30874. }
  30875. addNamespaceMemberAccess(name, variable) {
  30876. this.accessedOutsideVariables.set(name, variable);
  30877. this.parent.addNamespaceMemberAccess(name, variable);
  30878. }
  30879. addReturnExpression(expression) {
  30880. this.parent instanceof ChildScope && this.parent.addReturnExpression(expression);
  30881. }
  30882. addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope) {
  30883. for (const variable of this.accessedOutsideVariables.values()) {
  30884. if (variable.included) {
  30885. usedNames.add(variable.getBaseVariableName());
  30886. if (format === 'system' && exportNamesByVariable.has(variable)) {
  30887. usedNames.add('exports');
  30888. }
  30889. }
  30890. }
  30891. const accessedGlobals = accessedGlobalsByScope.get(this);
  30892. if (accessedGlobals) {
  30893. for (const name of accessedGlobals) {
  30894. usedNames.add(name);
  30895. }
  30896. }
  30897. }
  30898. contains(name) {
  30899. return this.variables.has(name) || this.parent.contains(name);
  30900. }
  30901. deconflict(format, exportNamesByVariable, accessedGlobalsByScope) {
  30902. const usedNames = new Set();
  30903. this.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
  30904. if (this.accessedDynamicImports) {
  30905. for (const importExpression of this.accessedDynamicImports) {
  30906. if (importExpression.inlineNamespace) {
  30907. usedNames.add(importExpression.inlineNamespace.getBaseVariableName());
  30908. }
  30909. }
  30910. }
  30911. for (const [name, variable] of this.variables) {
  30912. if (variable.included || variable.alwaysRendered) {
  30913. variable.setRenderNames(null, getSafeName(name, usedNames));
  30914. }
  30915. }
  30916. for (const scope of this.children) {
  30917. scope.deconflict(format, exportNamesByVariable, accessedGlobalsByScope);
  30918. }
  30919. }
  30920. findLexicalBoundary() {
  30921. return this.parent.findLexicalBoundary();
  30922. }
  30923. findVariable(name) {
  30924. const knownVariable = this.variables.get(name) || this.accessedOutsideVariables.get(name);
  30925. if (knownVariable) {
  30926. return knownVariable;
  30927. }
  30928. const variable = this.parent.findVariable(name);
  30929. this.accessedOutsideVariables.set(name, variable);
  30930. return variable;
  30931. }
  30932. }
  30933. function getLocator(source, options) {
  30934. if (options === void 0) { options = {}; }
  30935. var offsetLine = options.offsetLine || 0;
  30936. var offsetColumn = options.offsetColumn || 0;
  30937. var originalLines = source.split('\n');
  30938. var start = 0;
  30939. var lineRanges = originalLines.map(function (line, i) {
  30940. var end = start + line.length + 1;
  30941. var range = { start: start, end: end, line: i };
  30942. start = end;
  30943. return range;
  30944. });
  30945. var i = 0;
  30946. function rangeContains(range, index) {
  30947. return range.start <= index && index < range.end;
  30948. }
  30949. function getLocation(range, index) {
  30950. return { line: offsetLine + range.line, column: offsetColumn + index - range.start, character: index };
  30951. }
  30952. function locate(search, startIndex) {
  30953. if (typeof search === 'string') {
  30954. search = source.indexOf(search, startIndex || 0);
  30955. }
  30956. var range = lineRanges[i];
  30957. var d = search >= range.end ? 1 : -1;
  30958. while (range) {
  30959. if (rangeContains(range, search))
  30960. return getLocation(range, search);
  30961. i += d;
  30962. range = lineRanges[i];
  30963. }
  30964. }
  30965. return locate;
  30966. }
  30967. function locate(source, search, options) {
  30968. if (typeof options === 'number') {
  30969. throw new Error('locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument');
  30970. }
  30971. return getLocator(source, options)(search, options && options.startIndex);
  30972. }
  30973. const keys = {
  30974. Literal: [],
  30975. Program: ['body']
  30976. };
  30977. function getAndCreateKeys(esTreeNode) {
  30978. keys[esTreeNode.type] = Object.keys(esTreeNode).filter(key => key !== '_rollupAnnotations' && typeof esTreeNode[key] === 'object');
  30979. return keys[esTreeNode.type];
  30980. }
  30981. const INCLUDE_PARAMETERS = 'variables';
  30982. class NodeBase {
  30983. constructor(esTreeNode, parent, parentScope) {
  30984. this.included = false;
  30985. this.esTreeNode = esTreeNode;
  30986. this.keys = keys[esTreeNode.type] || getAndCreateKeys(esTreeNode);
  30987. this.parent = parent;
  30988. this.context = parent.context;
  30989. this.createScope(parentScope);
  30990. this.parseNode(esTreeNode);
  30991. this.initialise();
  30992. this.context.magicString.addSourcemapLocation(this.start);
  30993. this.context.magicString.addSourcemapLocation(this.end);
  30994. }
  30995. addExportedVariables(_variables, _exportNamesByVariable) { }
  30996. /**
  30997. * Override this to bind assignments to variables and do any initialisations that
  30998. * require the scopes to be populated with variables.
  30999. */
  31000. bind() {
  31001. for (const key of this.keys) {
  31002. const value = this[key];
  31003. if (value === null)
  31004. continue;
  31005. if (Array.isArray(value)) {
  31006. for (const child of value) {
  31007. if (child !== null)
  31008. child.bind();
  31009. }
  31010. }
  31011. else {
  31012. value.bind();
  31013. }
  31014. }
  31015. }
  31016. /**
  31017. * Override if this node should receive a different scope than the parent scope.
  31018. */
  31019. createScope(parentScope) {
  31020. this.scope = parentScope;
  31021. }
  31022. deoptimizePath(_path) { }
  31023. getLiteralValueAtPath(_path, _recursionTracker, _origin) {
  31024. return UnknownValue;
  31025. }
  31026. getReturnExpressionWhenCalledAtPath(_path, _recursionTracker, _origin) {
  31027. return UNKNOWN_EXPRESSION;
  31028. }
  31029. hasEffects(context) {
  31030. for (const key of this.keys) {
  31031. const value = this[key];
  31032. if (value === null)
  31033. continue;
  31034. if (Array.isArray(value)) {
  31035. for (const child of value) {
  31036. if (child !== null && child.hasEffects(context))
  31037. return true;
  31038. }
  31039. }
  31040. else if (value.hasEffects(context))
  31041. return true;
  31042. }
  31043. return false;
  31044. }
  31045. hasEffectsWhenAccessedAtPath(path, _context) {
  31046. return path.length > 0;
  31047. }
  31048. hasEffectsWhenAssignedAtPath(_path, _context) {
  31049. return true;
  31050. }
  31051. hasEffectsWhenCalledAtPath(_path, _callOptions, _context) {
  31052. return true;
  31053. }
  31054. include(context, includeChildrenRecursively) {
  31055. this.included = true;
  31056. for (const key of this.keys) {
  31057. const value = this[key];
  31058. if (value === null)
  31059. continue;
  31060. if (Array.isArray(value)) {
  31061. for (const child of value) {
  31062. if (child !== null)
  31063. child.include(context, includeChildrenRecursively);
  31064. }
  31065. }
  31066. else {
  31067. value.include(context, includeChildrenRecursively);
  31068. }
  31069. }
  31070. }
  31071. includeAsSingleStatement(context, includeChildrenRecursively) {
  31072. this.include(context, includeChildrenRecursively);
  31073. }
  31074. includeCallArguments(context, args) {
  31075. for (const arg of args) {
  31076. arg.include(context, false);
  31077. }
  31078. }
  31079. /**
  31080. * Override to perform special initialisation steps after the scope is initialised
  31081. */
  31082. initialise() { }
  31083. insertSemicolon(code) {
  31084. if (code.original[this.end - 1] !== ';') {
  31085. code.appendLeft(this.end, ';');
  31086. }
  31087. }
  31088. parseNode(esTreeNode) {
  31089. for (const key of Object.keys(esTreeNode)) {
  31090. // That way, we can override this function to add custom initialisation and then call super.parseNode
  31091. if (this.hasOwnProperty(key))
  31092. continue;
  31093. const value = esTreeNode[key];
  31094. if (key === '_rollupAnnotations') {
  31095. this.annotations = value;
  31096. }
  31097. else if (typeof value !== 'object' || value === null) {
  31098. this[key] = value;
  31099. }
  31100. else if (Array.isArray(value)) {
  31101. this[key] = [];
  31102. for (const child of value) {
  31103. this[key].push(child === null
  31104. ? null
  31105. : new (this.context.nodeConstructors[child.type] ||
  31106. this.context.nodeConstructors.UnknownNode)(child, this, this.scope));
  31107. }
  31108. }
  31109. else {
  31110. this[key] = new (this.context.nodeConstructors[value.type] ||
  31111. this.context.nodeConstructors.UnknownNode)(value, this, this.scope);
  31112. }
  31113. }
  31114. }
  31115. render(code, options) {
  31116. for (const key of this.keys) {
  31117. const value = this[key];
  31118. if (value === null)
  31119. continue;
  31120. if (Array.isArray(value)) {
  31121. for (const child of value) {
  31122. if (child !== null)
  31123. child.render(code, options);
  31124. }
  31125. }
  31126. else {
  31127. value.render(code, options);
  31128. }
  31129. }
  31130. }
  31131. shouldBeIncluded(context) {
  31132. return this.included || (!context.brokenFlow && this.hasEffects(createHasEffectsContext()));
  31133. }
  31134. }
  31135. class ClassNode extends NodeBase {
  31136. createScope(parentScope) {
  31137. this.scope = new ChildScope(parentScope);
  31138. }
  31139. hasEffectsWhenAccessedAtPath(path) {
  31140. if (path.length <= 1)
  31141. return false;
  31142. return path.length > 2 || path[0] !== 'prototype';
  31143. }
  31144. hasEffectsWhenAssignedAtPath(path) {
  31145. if (path.length <= 1)
  31146. return false;
  31147. return path.length > 2 || path[0] !== 'prototype';
  31148. }
  31149. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  31150. if (!callOptions.withNew)
  31151. return true;
  31152. return (this.body.hasEffectsWhenCalledAtPath(path, callOptions, context) ||
  31153. (this.superClass !== null &&
  31154. this.superClass.hasEffectsWhenCalledAtPath(path, callOptions, context)));
  31155. }
  31156. initialise() {
  31157. if (this.id !== null) {
  31158. this.id.declare('class', this);
  31159. }
  31160. }
  31161. }
  31162. class ClassDeclaration extends ClassNode {
  31163. initialise() {
  31164. super.initialise();
  31165. if (this.id !== null) {
  31166. this.id.variable.isId = true;
  31167. }
  31168. }
  31169. parseNode(esTreeNode) {
  31170. if (esTreeNode.id !== null) {
  31171. this.id = new this.context.nodeConstructors.Identifier(esTreeNode.id, this, this.scope.parent);
  31172. }
  31173. super.parseNode(esTreeNode);
  31174. }
  31175. render(code, options) {
  31176. if (options.format === 'system' &&
  31177. this.id &&
  31178. options.exportNamesByVariable.has(this.id.variable)) {
  31179. code.appendLeft(this.end, `${options.compact ? '' : ' '}${getSystemExportStatement([this.id.variable], options)};`);
  31180. }
  31181. super.render(code, options);
  31182. }
  31183. }
  31184. class ArgumentsVariable extends LocalVariable {
  31185. constructor(context) {
  31186. super('arguments', null, UNKNOWN_EXPRESSION, context);
  31187. }
  31188. hasEffectsWhenAccessedAtPath(path) {
  31189. return path.length > 1;
  31190. }
  31191. hasEffectsWhenAssignedAtPath() {
  31192. return true;
  31193. }
  31194. hasEffectsWhenCalledAtPath() {
  31195. return true;
  31196. }
  31197. }
  31198. class ThisVariable extends LocalVariable {
  31199. constructor(context) {
  31200. super('this', null, null, context);
  31201. }
  31202. getLiteralValueAtPath() {
  31203. return UnknownValue;
  31204. }
  31205. hasEffectsWhenAccessedAtPath(path, context) {
  31206. return (this.getInit(context).hasEffectsWhenAccessedAtPath(path, context) ||
  31207. super.hasEffectsWhenAccessedAtPath(path, context));
  31208. }
  31209. hasEffectsWhenAssignedAtPath(path, context) {
  31210. return (this.getInit(context).hasEffectsWhenAssignedAtPath(path, context) ||
  31211. super.hasEffectsWhenAssignedAtPath(path, context));
  31212. }
  31213. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  31214. return (this.getInit(context).hasEffectsWhenCalledAtPath(path, callOptions, context) ||
  31215. super.hasEffectsWhenCalledAtPath(path, callOptions, context));
  31216. }
  31217. getInit(context) {
  31218. return context.replacedVariableInits.get(this) || UNKNOWN_EXPRESSION;
  31219. }
  31220. }
  31221. class SpreadElement extends NodeBase {
  31222. bind() {
  31223. super.bind();
  31224. // Only properties of properties of the argument could become subject to reassignment
  31225. // This will also reassign the return values of iterators
  31226. this.argument.deoptimizePath([UnknownKey, UnknownKey]);
  31227. }
  31228. }
  31229. class ParameterScope extends ChildScope {
  31230. constructor(parent, context) {
  31231. super(parent);
  31232. this.parameters = [];
  31233. this.hasRest = false;
  31234. this.context = context;
  31235. this.hoistedBodyVarScope = new ChildScope(this);
  31236. }
  31237. /**
  31238. * Adds a parameter to this scope. Parameters must be added in the correct
  31239. * order, e.g. from left to right.
  31240. */
  31241. addParameterDeclaration(identifier) {
  31242. const name = identifier.name;
  31243. let variable = this.hoistedBodyVarScope.variables.get(name);
  31244. if (variable) {
  31245. variable.addDeclaration(identifier, null);
  31246. }
  31247. else {
  31248. variable = new LocalVariable(name, identifier, UNKNOWN_EXPRESSION, this.context);
  31249. }
  31250. this.variables.set(name, variable);
  31251. return variable;
  31252. }
  31253. addParameterVariables(parameters, hasRest) {
  31254. this.parameters = parameters;
  31255. for (const parameterList of parameters) {
  31256. for (const parameter of parameterList) {
  31257. parameter.alwaysRendered = true;
  31258. }
  31259. }
  31260. this.hasRest = hasRest;
  31261. }
  31262. includeCallArguments(context, args) {
  31263. let calledFromTryStatement = false;
  31264. let argIncluded = false;
  31265. const restParam = this.hasRest && this.parameters[this.parameters.length - 1];
  31266. for (const checkedArg of args) {
  31267. if (checkedArg instanceof SpreadElement) {
  31268. for (const arg of args) {
  31269. arg.include(context, false);
  31270. }
  31271. break;
  31272. }
  31273. }
  31274. for (let index = args.length - 1; index >= 0; index--) {
  31275. const paramVars = this.parameters[index] || restParam;
  31276. const arg = args[index];
  31277. if (paramVars) {
  31278. calledFromTryStatement = false;
  31279. if (paramVars.length === 0) {
  31280. // handle empty destructuring
  31281. argIncluded = true;
  31282. }
  31283. else {
  31284. for (const variable of paramVars) {
  31285. if (variable.included) {
  31286. argIncluded = true;
  31287. }
  31288. if (variable.calledFromTryStatement) {
  31289. calledFromTryStatement = true;
  31290. }
  31291. }
  31292. }
  31293. }
  31294. if (!argIncluded && arg.shouldBeIncluded(context)) {
  31295. argIncluded = true;
  31296. }
  31297. if (argIncluded) {
  31298. arg.include(context, calledFromTryStatement);
  31299. }
  31300. }
  31301. }
  31302. }
  31303. class ReturnValueScope extends ParameterScope {
  31304. constructor() {
  31305. super(...arguments);
  31306. this.returnExpression = null;
  31307. this.returnExpressions = [];
  31308. }
  31309. addReturnExpression(expression) {
  31310. this.returnExpressions.push(expression);
  31311. }
  31312. getReturnExpression() {
  31313. if (this.returnExpression === null)
  31314. this.updateReturnExpression();
  31315. return this.returnExpression;
  31316. }
  31317. updateReturnExpression() {
  31318. if (this.returnExpressions.length === 1) {
  31319. this.returnExpression = this.returnExpressions[0];
  31320. }
  31321. else {
  31322. this.returnExpression = UNKNOWN_EXPRESSION;
  31323. for (const expression of this.returnExpressions) {
  31324. expression.deoptimizePath(UNKNOWN_PATH);
  31325. }
  31326. }
  31327. }
  31328. }
  31329. class FunctionScope extends ReturnValueScope {
  31330. constructor(parent, context) {
  31331. super(parent, context);
  31332. this.variables.set('arguments', (this.argumentsVariable = new ArgumentsVariable(context)));
  31333. this.variables.set('this', (this.thisVariable = new ThisVariable(context)));
  31334. }
  31335. findLexicalBoundary() {
  31336. return this;
  31337. }
  31338. includeCallArguments(context, args) {
  31339. super.includeCallArguments(context, args);
  31340. if (this.argumentsVariable.included) {
  31341. for (const arg of args) {
  31342. if (!arg.included) {
  31343. arg.include(context, false);
  31344. }
  31345. }
  31346. }
  31347. }
  31348. }
  31349. //@ts-check
  31350. /** @typedef { import('estree').Node} Node */
  31351. /** @typedef {Node | {
  31352. * type: 'PropertyDefinition';
  31353. * computed: boolean;
  31354. * value: Node
  31355. * }} NodeWithPropertyDefinition */
  31356. /**
  31357. *
  31358. * @param {NodeWithPropertyDefinition} node
  31359. * @param {NodeWithPropertyDefinition} parent
  31360. * @returns boolean
  31361. */
  31362. function is_reference (node, parent) {
  31363. if (node.type === 'MemberExpression') {
  31364. return !node.computed && is_reference(node.object, node);
  31365. }
  31366. if (node.type === 'Identifier') {
  31367. if (!parent) return true;
  31368. switch (parent.type) {
  31369. // disregard `bar` in `foo.bar`
  31370. case 'MemberExpression': return parent.computed || node === parent.object;
  31371. // disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}`
  31372. case 'MethodDefinition': return parent.computed;
  31373. // disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}`
  31374. case 'PropertyDefinition': return parent.computed || node === parent.value;
  31375. // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }`
  31376. case 'Property': return parent.computed || node === parent.value;
  31377. // disregard the `bar` in `export { foo as bar }` or
  31378. // the foo in `import { foo as bar }`
  31379. case 'ExportSpecifier':
  31380. case 'ImportSpecifier': return node === parent.local;
  31381. // disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}`
  31382. case 'LabeledStatement':
  31383. case 'BreakStatement':
  31384. case 'ContinueStatement': return false;
  31385. default: return true;
  31386. }
  31387. }
  31388. return false;
  31389. }
  31390. const BLANK = Object.freeze(Object.create(null));
  31391. const EMPTY_OBJECT = Object.freeze({});
  31392. const EMPTY_ARRAY = Object.freeze([]);
  31393. const ValueProperties = Symbol('Value Properties');
  31394. const PURE = { pure: true };
  31395. const IMPURE = { pure: false };
  31396. // We use shortened variables to reduce file size here
  31397. /* OBJECT */
  31398. const O = {
  31399. // @ts-ignore
  31400. __proto__: null,
  31401. [ValueProperties]: IMPURE
  31402. };
  31403. /* PURE FUNCTION */
  31404. const PF = {
  31405. // @ts-ignore
  31406. __proto__: null,
  31407. [ValueProperties]: PURE
  31408. };
  31409. /* CONSTRUCTOR */
  31410. const C = {
  31411. // @ts-ignore
  31412. __proto__: null,
  31413. [ValueProperties]: IMPURE,
  31414. prototype: O
  31415. };
  31416. /* PURE CONSTRUCTOR */
  31417. const PC = {
  31418. // @ts-ignore
  31419. __proto__: null,
  31420. [ValueProperties]: PURE,
  31421. prototype: O
  31422. };
  31423. const ARRAY_TYPE = {
  31424. // @ts-ignore
  31425. __proto__: null,
  31426. [ValueProperties]: PURE,
  31427. from: PF,
  31428. of: PF,
  31429. prototype: O
  31430. };
  31431. const INTL_MEMBER = {
  31432. // @ts-ignore
  31433. __proto__: null,
  31434. [ValueProperties]: PURE,
  31435. supportedLocalesOf: PC
  31436. };
  31437. const knownGlobals = {
  31438. // Placeholders for global objects to avoid shape mutations
  31439. global: O,
  31440. globalThis: O,
  31441. self: O,
  31442. window: O,
  31443. // Common globals
  31444. // @ts-ignore
  31445. __proto__: null,
  31446. [ValueProperties]: IMPURE,
  31447. Array: {
  31448. // @ts-ignore
  31449. __proto__: null,
  31450. [ValueProperties]: IMPURE,
  31451. from: O,
  31452. isArray: PF,
  31453. of: PF,
  31454. prototype: O
  31455. },
  31456. ArrayBuffer: {
  31457. // @ts-ignore
  31458. __proto__: null,
  31459. [ValueProperties]: PURE,
  31460. isView: PF,
  31461. prototype: O
  31462. },
  31463. Atomics: O,
  31464. BigInt: C,
  31465. BigInt64Array: C,
  31466. BigUint64Array: C,
  31467. Boolean: PC,
  31468. // @ts-ignore
  31469. constructor: C,
  31470. DataView: PC,
  31471. Date: {
  31472. // @ts-ignore
  31473. __proto__: null,
  31474. [ValueProperties]: PURE,
  31475. now: PF,
  31476. parse: PF,
  31477. prototype: O,
  31478. UTC: PF
  31479. },
  31480. decodeURI: PF,
  31481. decodeURIComponent: PF,
  31482. encodeURI: PF,
  31483. encodeURIComponent: PF,
  31484. Error: PC,
  31485. escape: PF,
  31486. eval: O,
  31487. EvalError: PC,
  31488. Float32Array: ARRAY_TYPE,
  31489. Float64Array: ARRAY_TYPE,
  31490. Function: C,
  31491. // @ts-ignore
  31492. hasOwnProperty: O,
  31493. Infinity: O,
  31494. Int16Array: ARRAY_TYPE,
  31495. Int32Array: ARRAY_TYPE,
  31496. Int8Array: ARRAY_TYPE,
  31497. isFinite: PF,
  31498. isNaN: PF,
  31499. // @ts-ignore
  31500. isPrototypeOf: O,
  31501. JSON: O,
  31502. Map: PC,
  31503. Math: {
  31504. // @ts-ignore
  31505. __proto__: null,
  31506. [ValueProperties]: IMPURE,
  31507. abs: PF,
  31508. acos: PF,
  31509. acosh: PF,
  31510. asin: PF,
  31511. asinh: PF,
  31512. atan: PF,
  31513. atan2: PF,
  31514. atanh: PF,
  31515. cbrt: PF,
  31516. ceil: PF,
  31517. clz32: PF,
  31518. cos: PF,
  31519. cosh: PF,
  31520. exp: PF,
  31521. expm1: PF,
  31522. floor: PF,
  31523. fround: PF,
  31524. hypot: PF,
  31525. imul: PF,
  31526. log: PF,
  31527. log10: PF,
  31528. log1p: PF,
  31529. log2: PF,
  31530. max: PF,
  31531. min: PF,
  31532. pow: PF,
  31533. random: PF,
  31534. round: PF,
  31535. sign: PF,
  31536. sin: PF,
  31537. sinh: PF,
  31538. sqrt: PF,
  31539. tan: PF,
  31540. tanh: PF,
  31541. trunc: PF
  31542. },
  31543. NaN: O,
  31544. Number: {
  31545. // @ts-ignore
  31546. __proto__: null,
  31547. [ValueProperties]: PURE,
  31548. isFinite: PF,
  31549. isInteger: PF,
  31550. isNaN: PF,
  31551. isSafeInteger: PF,
  31552. parseFloat: PF,
  31553. parseInt: PF,
  31554. prototype: O
  31555. },
  31556. Object: {
  31557. // @ts-ignore
  31558. __proto__: null,
  31559. [ValueProperties]: PURE,
  31560. create: PF,
  31561. getNotifier: PF,
  31562. getOwn: PF,
  31563. getOwnPropertyDescriptor: PF,
  31564. getOwnPropertyNames: PF,
  31565. getOwnPropertySymbols: PF,
  31566. getPrototypeOf: PF,
  31567. is: PF,
  31568. isExtensible: PF,
  31569. isFrozen: PF,
  31570. isSealed: PF,
  31571. keys: PF,
  31572. prototype: O
  31573. },
  31574. parseFloat: PF,
  31575. parseInt: PF,
  31576. Promise: {
  31577. // @ts-ignore
  31578. __proto__: null,
  31579. [ValueProperties]: IMPURE,
  31580. all: PF,
  31581. prototype: O,
  31582. race: PF,
  31583. resolve: PF
  31584. },
  31585. // @ts-ignore
  31586. propertyIsEnumerable: O,
  31587. Proxy: O,
  31588. RangeError: PC,
  31589. ReferenceError: PC,
  31590. Reflect: O,
  31591. RegExp: PC,
  31592. Set: PC,
  31593. SharedArrayBuffer: C,
  31594. String: {
  31595. // @ts-ignore
  31596. __proto__: null,
  31597. [ValueProperties]: PURE,
  31598. fromCharCode: PF,
  31599. fromCodePoint: PF,
  31600. prototype: O,
  31601. raw: PF
  31602. },
  31603. Symbol: {
  31604. // @ts-ignore
  31605. __proto__: null,
  31606. [ValueProperties]: PURE,
  31607. for: PF,
  31608. keyFor: PF,
  31609. prototype: O
  31610. },
  31611. SyntaxError: PC,
  31612. // @ts-ignore
  31613. toLocaleString: O,
  31614. // @ts-ignore
  31615. toString: O,
  31616. TypeError: PC,
  31617. Uint16Array: ARRAY_TYPE,
  31618. Uint32Array: ARRAY_TYPE,
  31619. Uint8Array: ARRAY_TYPE,
  31620. Uint8ClampedArray: ARRAY_TYPE,
  31621. // Technically, this is a global, but it needs special handling
  31622. // undefined: ?,
  31623. unescape: PF,
  31624. URIError: PC,
  31625. // @ts-ignore
  31626. valueOf: O,
  31627. WeakMap: PC,
  31628. WeakSet: PC,
  31629. // Additional globals shared by Node and Browser that are not strictly part of the language
  31630. clearInterval: C,
  31631. clearTimeout: C,
  31632. console: O,
  31633. Intl: {
  31634. // @ts-ignore
  31635. __proto__: null,
  31636. [ValueProperties]: IMPURE,
  31637. Collator: INTL_MEMBER,
  31638. DateTimeFormat: INTL_MEMBER,
  31639. ListFormat: INTL_MEMBER,
  31640. NumberFormat: INTL_MEMBER,
  31641. PluralRules: INTL_MEMBER,
  31642. RelativeTimeFormat: INTL_MEMBER
  31643. },
  31644. setInterval: C,
  31645. setTimeout: C,
  31646. TextDecoder: C,
  31647. TextEncoder: C,
  31648. URL: C,
  31649. URLSearchParams: C,
  31650. // Browser specific globals
  31651. AbortController: C,
  31652. AbortSignal: C,
  31653. addEventListener: O,
  31654. alert: O,
  31655. AnalyserNode: C,
  31656. Animation: C,
  31657. AnimationEvent: C,
  31658. applicationCache: O,
  31659. ApplicationCache: C,
  31660. ApplicationCacheErrorEvent: C,
  31661. atob: O,
  31662. Attr: C,
  31663. Audio: C,
  31664. AudioBuffer: C,
  31665. AudioBufferSourceNode: C,
  31666. AudioContext: C,
  31667. AudioDestinationNode: C,
  31668. AudioListener: C,
  31669. AudioNode: C,
  31670. AudioParam: C,
  31671. AudioProcessingEvent: C,
  31672. AudioScheduledSourceNode: C,
  31673. AudioWorkletNode: C,
  31674. BarProp: C,
  31675. BaseAudioContext: C,
  31676. BatteryManager: C,
  31677. BeforeUnloadEvent: C,
  31678. BiquadFilterNode: C,
  31679. Blob: C,
  31680. BlobEvent: C,
  31681. blur: O,
  31682. BroadcastChannel: C,
  31683. btoa: O,
  31684. ByteLengthQueuingStrategy: C,
  31685. Cache: C,
  31686. caches: O,
  31687. CacheStorage: C,
  31688. cancelAnimationFrame: O,
  31689. cancelIdleCallback: O,
  31690. CanvasCaptureMediaStreamTrack: C,
  31691. CanvasGradient: C,
  31692. CanvasPattern: C,
  31693. CanvasRenderingContext2D: C,
  31694. ChannelMergerNode: C,
  31695. ChannelSplitterNode: C,
  31696. CharacterData: C,
  31697. clientInformation: O,
  31698. ClipboardEvent: C,
  31699. close: O,
  31700. closed: O,
  31701. CloseEvent: C,
  31702. Comment: C,
  31703. CompositionEvent: C,
  31704. confirm: O,
  31705. ConstantSourceNode: C,
  31706. ConvolverNode: C,
  31707. CountQueuingStrategy: C,
  31708. createImageBitmap: O,
  31709. Credential: C,
  31710. CredentialsContainer: C,
  31711. crypto: O,
  31712. Crypto: C,
  31713. CryptoKey: C,
  31714. CSS: C,
  31715. CSSConditionRule: C,
  31716. CSSFontFaceRule: C,
  31717. CSSGroupingRule: C,
  31718. CSSImportRule: C,
  31719. CSSKeyframeRule: C,
  31720. CSSKeyframesRule: C,
  31721. CSSMediaRule: C,
  31722. CSSNamespaceRule: C,
  31723. CSSPageRule: C,
  31724. CSSRule: C,
  31725. CSSRuleList: C,
  31726. CSSStyleDeclaration: C,
  31727. CSSStyleRule: C,
  31728. CSSStyleSheet: C,
  31729. CSSSupportsRule: C,
  31730. CustomElementRegistry: C,
  31731. customElements: O,
  31732. CustomEvent: C,
  31733. DataTransfer: C,
  31734. DataTransferItem: C,
  31735. DataTransferItemList: C,
  31736. defaultstatus: O,
  31737. defaultStatus: O,
  31738. DelayNode: C,
  31739. DeviceMotionEvent: C,
  31740. DeviceOrientationEvent: C,
  31741. devicePixelRatio: O,
  31742. dispatchEvent: O,
  31743. document: O,
  31744. Document: C,
  31745. DocumentFragment: C,
  31746. DocumentType: C,
  31747. DOMError: C,
  31748. DOMException: C,
  31749. DOMImplementation: C,
  31750. DOMMatrix: C,
  31751. DOMMatrixReadOnly: C,
  31752. DOMParser: C,
  31753. DOMPoint: C,
  31754. DOMPointReadOnly: C,
  31755. DOMQuad: C,
  31756. DOMRect: C,
  31757. DOMRectReadOnly: C,
  31758. DOMStringList: C,
  31759. DOMStringMap: C,
  31760. DOMTokenList: C,
  31761. DragEvent: C,
  31762. DynamicsCompressorNode: C,
  31763. Element: C,
  31764. ErrorEvent: C,
  31765. Event: C,
  31766. EventSource: C,
  31767. EventTarget: C,
  31768. external: O,
  31769. fetch: O,
  31770. File: C,
  31771. FileList: C,
  31772. FileReader: C,
  31773. find: O,
  31774. focus: O,
  31775. FocusEvent: C,
  31776. FontFace: C,
  31777. FontFaceSetLoadEvent: C,
  31778. FormData: C,
  31779. frames: O,
  31780. GainNode: C,
  31781. Gamepad: C,
  31782. GamepadButton: C,
  31783. GamepadEvent: C,
  31784. getComputedStyle: O,
  31785. getSelection: O,
  31786. HashChangeEvent: C,
  31787. Headers: C,
  31788. history: O,
  31789. History: C,
  31790. HTMLAllCollection: C,
  31791. HTMLAnchorElement: C,
  31792. HTMLAreaElement: C,
  31793. HTMLAudioElement: C,
  31794. HTMLBaseElement: C,
  31795. HTMLBodyElement: C,
  31796. HTMLBRElement: C,
  31797. HTMLButtonElement: C,
  31798. HTMLCanvasElement: C,
  31799. HTMLCollection: C,
  31800. HTMLContentElement: C,
  31801. HTMLDataElement: C,
  31802. HTMLDataListElement: C,
  31803. HTMLDetailsElement: C,
  31804. HTMLDialogElement: C,
  31805. HTMLDirectoryElement: C,
  31806. HTMLDivElement: C,
  31807. HTMLDListElement: C,
  31808. HTMLDocument: C,
  31809. HTMLElement: C,
  31810. HTMLEmbedElement: C,
  31811. HTMLFieldSetElement: C,
  31812. HTMLFontElement: C,
  31813. HTMLFormControlsCollection: C,
  31814. HTMLFormElement: C,
  31815. HTMLFrameElement: C,
  31816. HTMLFrameSetElement: C,
  31817. HTMLHeadElement: C,
  31818. HTMLHeadingElement: C,
  31819. HTMLHRElement: C,
  31820. HTMLHtmlElement: C,
  31821. HTMLIFrameElement: C,
  31822. HTMLImageElement: C,
  31823. HTMLInputElement: C,
  31824. HTMLLabelElement: C,
  31825. HTMLLegendElement: C,
  31826. HTMLLIElement: C,
  31827. HTMLLinkElement: C,
  31828. HTMLMapElement: C,
  31829. HTMLMarqueeElement: C,
  31830. HTMLMediaElement: C,
  31831. HTMLMenuElement: C,
  31832. HTMLMetaElement: C,
  31833. HTMLMeterElement: C,
  31834. HTMLModElement: C,
  31835. HTMLObjectElement: C,
  31836. HTMLOListElement: C,
  31837. HTMLOptGroupElement: C,
  31838. HTMLOptionElement: C,
  31839. HTMLOptionsCollection: C,
  31840. HTMLOutputElement: C,
  31841. HTMLParagraphElement: C,
  31842. HTMLParamElement: C,
  31843. HTMLPictureElement: C,
  31844. HTMLPreElement: C,
  31845. HTMLProgressElement: C,
  31846. HTMLQuoteElement: C,
  31847. HTMLScriptElement: C,
  31848. HTMLSelectElement: C,
  31849. HTMLShadowElement: C,
  31850. HTMLSlotElement: C,
  31851. HTMLSourceElement: C,
  31852. HTMLSpanElement: C,
  31853. HTMLStyleElement: C,
  31854. HTMLTableCaptionElement: C,
  31855. HTMLTableCellElement: C,
  31856. HTMLTableColElement: C,
  31857. HTMLTableElement: C,
  31858. HTMLTableRowElement: C,
  31859. HTMLTableSectionElement: C,
  31860. HTMLTemplateElement: C,
  31861. HTMLTextAreaElement: C,
  31862. HTMLTimeElement: C,
  31863. HTMLTitleElement: C,
  31864. HTMLTrackElement: C,
  31865. HTMLUListElement: C,
  31866. HTMLUnknownElement: C,
  31867. HTMLVideoElement: C,
  31868. IDBCursor: C,
  31869. IDBCursorWithValue: C,
  31870. IDBDatabase: C,
  31871. IDBFactory: C,
  31872. IDBIndex: C,
  31873. IDBKeyRange: C,
  31874. IDBObjectStore: C,
  31875. IDBOpenDBRequest: C,
  31876. IDBRequest: C,
  31877. IDBTransaction: C,
  31878. IDBVersionChangeEvent: C,
  31879. IdleDeadline: C,
  31880. IIRFilterNode: C,
  31881. Image: C,
  31882. ImageBitmap: C,
  31883. ImageBitmapRenderingContext: C,
  31884. ImageCapture: C,
  31885. ImageData: C,
  31886. indexedDB: O,
  31887. innerHeight: O,
  31888. innerWidth: O,
  31889. InputEvent: C,
  31890. IntersectionObserver: C,
  31891. IntersectionObserverEntry: C,
  31892. isSecureContext: O,
  31893. KeyboardEvent: C,
  31894. KeyframeEffect: C,
  31895. length: O,
  31896. localStorage: O,
  31897. location: O,
  31898. Location: C,
  31899. locationbar: O,
  31900. matchMedia: O,
  31901. MediaDeviceInfo: C,
  31902. MediaDevices: C,
  31903. MediaElementAudioSourceNode: C,
  31904. MediaEncryptedEvent: C,
  31905. MediaError: C,
  31906. MediaKeyMessageEvent: C,
  31907. MediaKeySession: C,
  31908. MediaKeyStatusMap: C,
  31909. MediaKeySystemAccess: C,
  31910. MediaList: C,
  31911. MediaQueryList: C,
  31912. MediaQueryListEvent: C,
  31913. MediaRecorder: C,
  31914. MediaSettingsRange: C,
  31915. MediaSource: C,
  31916. MediaStream: C,
  31917. MediaStreamAudioDestinationNode: C,
  31918. MediaStreamAudioSourceNode: C,
  31919. MediaStreamEvent: C,
  31920. MediaStreamTrack: C,
  31921. MediaStreamTrackEvent: C,
  31922. menubar: O,
  31923. MessageChannel: C,
  31924. MessageEvent: C,
  31925. MessagePort: C,
  31926. MIDIAccess: C,
  31927. MIDIConnectionEvent: C,
  31928. MIDIInput: C,
  31929. MIDIInputMap: C,
  31930. MIDIMessageEvent: C,
  31931. MIDIOutput: C,
  31932. MIDIOutputMap: C,
  31933. MIDIPort: C,
  31934. MimeType: C,
  31935. MimeTypeArray: C,
  31936. MouseEvent: C,
  31937. moveBy: O,
  31938. moveTo: O,
  31939. MutationEvent: C,
  31940. MutationObserver: C,
  31941. MutationRecord: C,
  31942. name: O,
  31943. NamedNodeMap: C,
  31944. NavigationPreloadManager: C,
  31945. navigator: O,
  31946. Navigator: C,
  31947. NetworkInformation: C,
  31948. Node: C,
  31949. NodeFilter: O,
  31950. NodeIterator: C,
  31951. NodeList: C,
  31952. Notification: C,
  31953. OfflineAudioCompletionEvent: C,
  31954. OfflineAudioContext: C,
  31955. offscreenBuffering: O,
  31956. OffscreenCanvas: C,
  31957. open: O,
  31958. openDatabase: O,
  31959. Option: C,
  31960. origin: O,
  31961. OscillatorNode: C,
  31962. outerHeight: O,
  31963. outerWidth: O,
  31964. PageTransitionEvent: C,
  31965. pageXOffset: O,
  31966. pageYOffset: O,
  31967. PannerNode: C,
  31968. parent: O,
  31969. Path2D: C,
  31970. PaymentAddress: C,
  31971. PaymentRequest: C,
  31972. PaymentRequestUpdateEvent: C,
  31973. PaymentResponse: C,
  31974. performance: O,
  31975. Performance: C,
  31976. PerformanceEntry: C,
  31977. PerformanceLongTaskTiming: C,
  31978. PerformanceMark: C,
  31979. PerformanceMeasure: C,
  31980. PerformanceNavigation: C,
  31981. PerformanceNavigationTiming: C,
  31982. PerformanceObserver: C,
  31983. PerformanceObserverEntryList: C,
  31984. PerformancePaintTiming: C,
  31985. PerformanceResourceTiming: C,
  31986. PerformanceTiming: C,
  31987. PeriodicWave: C,
  31988. Permissions: C,
  31989. PermissionStatus: C,
  31990. personalbar: O,
  31991. PhotoCapabilities: C,
  31992. Plugin: C,
  31993. PluginArray: C,
  31994. PointerEvent: C,
  31995. PopStateEvent: C,
  31996. postMessage: O,
  31997. Presentation: C,
  31998. PresentationAvailability: C,
  31999. PresentationConnection: C,
  32000. PresentationConnectionAvailableEvent: C,
  32001. PresentationConnectionCloseEvent: C,
  32002. PresentationConnectionList: C,
  32003. PresentationReceiver: C,
  32004. PresentationRequest: C,
  32005. print: O,
  32006. ProcessingInstruction: C,
  32007. ProgressEvent: C,
  32008. PromiseRejectionEvent: C,
  32009. prompt: O,
  32010. PushManager: C,
  32011. PushSubscription: C,
  32012. PushSubscriptionOptions: C,
  32013. queueMicrotask: O,
  32014. RadioNodeList: C,
  32015. Range: C,
  32016. ReadableStream: C,
  32017. RemotePlayback: C,
  32018. removeEventListener: O,
  32019. Request: C,
  32020. requestAnimationFrame: O,
  32021. requestIdleCallback: O,
  32022. resizeBy: O,
  32023. ResizeObserver: C,
  32024. ResizeObserverEntry: C,
  32025. resizeTo: O,
  32026. Response: C,
  32027. RTCCertificate: C,
  32028. RTCDataChannel: C,
  32029. RTCDataChannelEvent: C,
  32030. RTCDtlsTransport: C,
  32031. RTCIceCandidate: C,
  32032. RTCIceTransport: C,
  32033. RTCPeerConnection: C,
  32034. RTCPeerConnectionIceEvent: C,
  32035. RTCRtpReceiver: C,
  32036. RTCRtpSender: C,
  32037. RTCSctpTransport: C,
  32038. RTCSessionDescription: C,
  32039. RTCStatsReport: C,
  32040. RTCTrackEvent: C,
  32041. screen: O,
  32042. Screen: C,
  32043. screenLeft: O,
  32044. ScreenOrientation: C,
  32045. screenTop: O,
  32046. screenX: O,
  32047. screenY: O,
  32048. ScriptProcessorNode: C,
  32049. scroll: O,
  32050. scrollbars: O,
  32051. scrollBy: O,
  32052. scrollTo: O,
  32053. scrollX: O,
  32054. scrollY: O,
  32055. SecurityPolicyViolationEvent: C,
  32056. Selection: C,
  32057. ServiceWorker: C,
  32058. ServiceWorkerContainer: C,
  32059. ServiceWorkerRegistration: C,
  32060. sessionStorage: O,
  32061. ShadowRoot: C,
  32062. SharedWorker: C,
  32063. SourceBuffer: C,
  32064. SourceBufferList: C,
  32065. speechSynthesis: O,
  32066. SpeechSynthesisEvent: C,
  32067. SpeechSynthesisUtterance: C,
  32068. StaticRange: C,
  32069. status: O,
  32070. statusbar: O,
  32071. StereoPannerNode: C,
  32072. stop: O,
  32073. Storage: C,
  32074. StorageEvent: C,
  32075. StorageManager: C,
  32076. styleMedia: O,
  32077. StyleSheet: C,
  32078. StyleSheetList: C,
  32079. SubtleCrypto: C,
  32080. SVGAElement: C,
  32081. SVGAngle: C,
  32082. SVGAnimatedAngle: C,
  32083. SVGAnimatedBoolean: C,
  32084. SVGAnimatedEnumeration: C,
  32085. SVGAnimatedInteger: C,
  32086. SVGAnimatedLength: C,
  32087. SVGAnimatedLengthList: C,
  32088. SVGAnimatedNumber: C,
  32089. SVGAnimatedNumberList: C,
  32090. SVGAnimatedPreserveAspectRatio: C,
  32091. SVGAnimatedRect: C,
  32092. SVGAnimatedString: C,
  32093. SVGAnimatedTransformList: C,
  32094. SVGAnimateElement: C,
  32095. SVGAnimateMotionElement: C,
  32096. SVGAnimateTransformElement: C,
  32097. SVGAnimationElement: C,
  32098. SVGCircleElement: C,
  32099. SVGClipPathElement: C,
  32100. SVGComponentTransferFunctionElement: C,
  32101. SVGDefsElement: C,
  32102. SVGDescElement: C,
  32103. SVGDiscardElement: C,
  32104. SVGElement: C,
  32105. SVGEllipseElement: C,
  32106. SVGFEBlendElement: C,
  32107. SVGFEColorMatrixElement: C,
  32108. SVGFEComponentTransferElement: C,
  32109. SVGFECompositeElement: C,
  32110. SVGFEConvolveMatrixElement: C,
  32111. SVGFEDiffuseLightingElement: C,
  32112. SVGFEDisplacementMapElement: C,
  32113. SVGFEDistantLightElement: C,
  32114. SVGFEDropShadowElement: C,
  32115. SVGFEFloodElement: C,
  32116. SVGFEFuncAElement: C,
  32117. SVGFEFuncBElement: C,
  32118. SVGFEFuncGElement: C,
  32119. SVGFEFuncRElement: C,
  32120. SVGFEGaussianBlurElement: C,
  32121. SVGFEImageElement: C,
  32122. SVGFEMergeElement: C,
  32123. SVGFEMergeNodeElement: C,
  32124. SVGFEMorphologyElement: C,
  32125. SVGFEOffsetElement: C,
  32126. SVGFEPointLightElement: C,
  32127. SVGFESpecularLightingElement: C,
  32128. SVGFESpotLightElement: C,
  32129. SVGFETileElement: C,
  32130. SVGFETurbulenceElement: C,
  32131. SVGFilterElement: C,
  32132. SVGForeignObjectElement: C,
  32133. SVGGElement: C,
  32134. SVGGeometryElement: C,
  32135. SVGGradientElement: C,
  32136. SVGGraphicsElement: C,
  32137. SVGImageElement: C,
  32138. SVGLength: C,
  32139. SVGLengthList: C,
  32140. SVGLinearGradientElement: C,
  32141. SVGLineElement: C,
  32142. SVGMarkerElement: C,
  32143. SVGMaskElement: C,
  32144. SVGMatrix: C,
  32145. SVGMetadataElement: C,
  32146. SVGMPathElement: C,
  32147. SVGNumber: C,
  32148. SVGNumberList: C,
  32149. SVGPathElement: C,
  32150. SVGPatternElement: C,
  32151. SVGPoint: C,
  32152. SVGPointList: C,
  32153. SVGPolygonElement: C,
  32154. SVGPolylineElement: C,
  32155. SVGPreserveAspectRatio: C,
  32156. SVGRadialGradientElement: C,
  32157. SVGRect: C,
  32158. SVGRectElement: C,
  32159. SVGScriptElement: C,
  32160. SVGSetElement: C,
  32161. SVGStopElement: C,
  32162. SVGStringList: C,
  32163. SVGStyleElement: C,
  32164. SVGSVGElement: C,
  32165. SVGSwitchElement: C,
  32166. SVGSymbolElement: C,
  32167. SVGTextContentElement: C,
  32168. SVGTextElement: C,
  32169. SVGTextPathElement: C,
  32170. SVGTextPositioningElement: C,
  32171. SVGTitleElement: C,
  32172. SVGTransform: C,
  32173. SVGTransformList: C,
  32174. SVGTSpanElement: C,
  32175. SVGUnitTypes: C,
  32176. SVGUseElement: C,
  32177. SVGViewElement: C,
  32178. TaskAttributionTiming: C,
  32179. Text: C,
  32180. TextEvent: C,
  32181. TextMetrics: C,
  32182. TextTrack: C,
  32183. TextTrackCue: C,
  32184. TextTrackCueList: C,
  32185. TextTrackList: C,
  32186. TimeRanges: C,
  32187. toolbar: O,
  32188. top: O,
  32189. Touch: C,
  32190. TouchEvent: C,
  32191. TouchList: C,
  32192. TrackEvent: C,
  32193. TransitionEvent: C,
  32194. TreeWalker: C,
  32195. UIEvent: C,
  32196. ValidityState: C,
  32197. visualViewport: O,
  32198. VisualViewport: C,
  32199. VTTCue: C,
  32200. WaveShaperNode: C,
  32201. WebAssembly: O,
  32202. WebGL2RenderingContext: C,
  32203. WebGLActiveInfo: C,
  32204. WebGLBuffer: C,
  32205. WebGLContextEvent: C,
  32206. WebGLFramebuffer: C,
  32207. WebGLProgram: C,
  32208. WebGLQuery: C,
  32209. WebGLRenderbuffer: C,
  32210. WebGLRenderingContext: C,
  32211. WebGLSampler: C,
  32212. WebGLShader: C,
  32213. WebGLShaderPrecisionFormat: C,
  32214. WebGLSync: C,
  32215. WebGLTexture: C,
  32216. WebGLTransformFeedback: C,
  32217. WebGLUniformLocation: C,
  32218. WebGLVertexArrayObject: C,
  32219. WebSocket: C,
  32220. WheelEvent: C,
  32221. Window: C,
  32222. Worker: C,
  32223. WritableStream: C,
  32224. XMLDocument: C,
  32225. XMLHttpRequest: C,
  32226. XMLHttpRequestEventTarget: C,
  32227. XMLHttpRequestUpload: C,
  32228. XMLSerializer: C,
  32229. XPathEvaluator: C,
  32230. XPathExpression: C,
  32231. XPathResult: C,
  32232. XSLTProcessor: C
  32233. };
  32234. for (const global of ['window', 'global', 'self', 'globalThis']) {
  32235. knownGlobals[global] = knownGlobals;
  32236. }
  32237. function getGlobalAtPath(path) {
  32238. let currentGlobal = knownGlobals;
  32239. for (const pathSegment of path) {
  32240. if (typeof pathSegment !== 'string') {
  32241. return null;
  32242. }
  32243. currentGlobal = currentGlobal[pathSegment];
  32244. if (!currentGlobal) {
  32245. return null;
  32246. }
  32247. }
  32248. return currentGlobal[ValueProperties];
  32249. }
  32250. function isPureGlobal(path) {
  32251. const globalAtPath = getGlobalAtPath(path);
  32252. return globalAtPath !== null && globalAtPath.pure;
  32253. }
  32254. function isGlobalMember(path) {
  32255. if (path.length === 1) {
  32256. return path[0] === 'undefined' || getGlobalAtPath(path) !== null;
  32257. }
  32258. return getGlobalAtPath(path.slice(0, -1)) !== null;
  32259. }
  32260. class GlobalVariable extends Variable {
  32261. constructor() {
  32262. super(...arguments);
  32263. this.isReassigned = true;
  32264. }
  32265. hasEffectsWhenAccessedAtPath(path) {
  32266. return !isGlobalMember([this.name, ...path]);
  32267. }
  32268. hasEffectsWhenCalledAtPath(path) {
  32269. return !isPureGlobal([this.name, ...path]);
  32270. }
  32271. }
  32272. class Identifier extends NodeBase {
  32273. constructor() {
  32274. super(...arguments);
  32275. this.variable = null;
  32276. this.bound = false;
  32277. }
  32278. addExportedVariables(variables, exportNamesByVariable) {
  32279. if (this.variable !== null && exportNamesByVariable.has(this.variable)) {
  32280. variables.push(this.variable);
  32281. }
  32282. }
  32283. bind() {
  32284. if (this.bound)
  32285. return;
  32286. this.bound = true;
  32287. if (this.variable === null && is_reference(this, this.parent)) {
  32288. this.variable = this.scope.findVariable(this.name);
  32289. this.variable.addReference(this);
  32290. }
  32291. if (this.variable !== null &&
  32292. this.variable instanceof LocalVariable &&
  32293. this.variable.additionalInitializers !== null) {
  32294. this.variable.consolidateInitializers();
  32295. }
  32296. }
  32297. declare(kind, init) {
  32298. let variable;
  32299. switch (kind) {
  32300. case 'var':
  32301. variable = this.scope.addDeclaration(this, this.context, init, true);
  32302. break;
  32303. case 'function':
  32304. // in strict mode, functions are only hoisted within a scope but not across block scopes
  32305. variable = this.scope.addDeclaration(this, this.context, init, false);
  32306. break;
  32307. case 'let':
  32308. case 'const':
  32309. case 'class':
  32310. variable = this.scope.addDeclaration(this, this.context, init, false);
  32311. break;
  32312. case 'parameter':
  32313. variable = this.scope.addParameterDeclaration(this);
  32314. break;
  32315. /* istanbul ignore next */
  32316. default:
  32317. /* istanbul ignore next */
  32318. throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
  32319. }
  32320. return [(this.variable = variable)];
  32321. }
  32322. deoptimizePath(path) {
  32323. if (!this.bound)
  32324. this.bind();
  32325. if (path.length === 0 && !this.scope.contains(this.name)) {
  32326. this.disallowImportReassignment();
  32327. }
  32328. this.variable.deoptimizePath(path);
  32329. }
  32330. getLiteralValueAtPath(path, recursionTracker, origin) {
  32331. if (!this.bound)
  32332. this.bind();
  32333. return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
  32334. }
  32335. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  32336. if (!this.bound)
  32337. this.bind();
  32338. return this.variable.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  32339. }
  32340. hasEffects() {
  32341. return (this.context.options.treeshake.unknownGlobalSideEffects &&
  32342. this.variable instanceof GlobalVariable &&
  32343. this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
  32344. }
  32345. hasEffectsWhenAccessedAtPath(path, context) {
  32346. return this.variable !== null && this.variable.hasEffectsWhenAccessedAtPath(path, context);
  32347. }
  32348. hasEffectsWhenAssignedAtPath(path, context) {
  32349. return !this.variable || this.variable.hasEffectsWhenAssignedAtPath(path, context);
  32350. }
  32351. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  32352. return !this.variable || this.variable.hasEffectsWhenCalledAtPath(path, callOptions, context);
  32353. }
  32354. include() {
  32355. if (!this.included) {
  32356. this.included = true;
  32357. if (this.variable !== null) {
  32358. this.context.includeVariableInModule(this.variable);
  32359. }
  32360. }
  32361. }
  32362. includeCallArguments(context, args) {
  32363. this.variable.includeCallArguments(context, args);
  32364. }
  32365. render(code, _options, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
  32366. if (this.variable) {
  32367. const name = this.variable.getName();
  32368. if (name !== this.name) {
  32369. code.overwrite(this.start, this.end, name, {
  32370. contentOnly: true,
  32371. storeName: true
  32372. });
  32373. if (isShorthandProperty) {
  32374. code.prependRight(this.start, `${this.name}: `);
  32375. }
  32376. }
  32377. // In strict mode, any variable named "eval" must be the actual "eval" function
  32378. if (name === 'eval' &&
  32379. renderedParentType === CallExpression$1 &&
  32380. isCalleeOfRenderedParent) {
  32381. code.appendRight(this.start, '0, ');
  32382. }
  32383. }
  32384. }
  32385. disallowImportReassignment() {
  32386. return this.context.error({
  32387. code: 'ILLEGAL_REASSIGNMENT',
  32388. message: `Illegal reassignment to import '${this.name}'`
  32389. }, this.start);
  32390. }
  32391. }
  32392. class RestElement extends NodeBase {
  32393. constructor() {
  32394. super(...arguments);
  32395. this.declarationInit = null;
  32396. }
  32397. addExportedVariables(variables, exportNamesByVariable) {
  32398. this.argument.addExportedVariables(variables, exportNamesByVariable);
  32399. }
  32400. bind() {
  32401. super.bind();
  32402. if (this.declarationInit !== null) {
  32403. this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]);
  32404. }
  32405. }
  32406. declare(kind, init) {
  32407. this.declarationInit = init;
  32408. return this.argument.declare(kind, UNKNOWN_EXPRESSION);
  32409. }
  32410. deoptimizePath(path) {
  32411. path.length === 0 && this.argument.deoptimizePath(EMPTY_PATH);
  32412. }
  32413. hasEffectsWhenAssignedAtPath(path, context) {
  32414. return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
  32415. }
  32416. }
  32417. class FunctionNode extends NodeBase {
  32418. constructor() {
  32419. super(...arguments);
  32420. this.isPrototypeDeoptimized = false;
  32421. }
  32422. createScope(parentScope) {
  32423. this.scope = new FunctionScope(parentScope, this.context);
  32424. }
  32425. deoptimizePath(path) {
  32426. if (path.length === 1) {
  32427. if (path[0] === 'prototype') {
  32428. this.isPrototypeDeoptimized = true;
  32429. }
  32430. else if (path[0] === UnknownKey) {
  32431. this.isPrototypeDeoptimized = true;
  32432. // A reassignment of UNKNOWN_PATH is considered equivalent to having lost track
  32433. // which means the return expression needs to be reassigned as well
  32434. this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
  32435. }
  32436. }
  32437. }
  32438. getReturnExpressionWhenCalledAtPath(path) {
  32439. return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
  32440. }
  32441. hasEffects() {
  32442. return this.id !== null && this.id.hasEffects();
  32443. }
  32444. hasEffectsWhenAccessedAtPath(path) {
  32445. if (path.length <= 1)
  32446. return false;
  32447. return path.length > 2 || path[0] !== 'prototype' || this.isPrototypeDeoptimized;
  32448. }
  32449. hasEffectsWhenAssignedAtPath(path) {
  32450. if (path.length <= 1) {
  32451. return false;
  32452. }
  32453. return path.length > 2 || path[0] !== 'prototype' || this.isPrototypeDeoptimized;
  32454. }
  32455. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  32456. if (path.length > 0)
  32457. return true;
  32458. for (const param of this.params) {
  32459. if (param.hasEffects(context))
  32460. return true;
  32461. }
  32462. const thisInit = context.replacedVariableInits.get(this.scope.thisVariable);
  32463. context.replacedVariableInits.set(this.scope.thisVariable, callOptions.withNew ? new UnknownObjectExpression() : UNKNOWN_EXPRESSION);
  32464. const { brokenFlow, ignore } = context;
  32465. context.ignore = {
  32466. breaks: false,
  32467. continues: false,
  32468. labels: new Set(),
  32469. returnAwaitYield: true
  32470. };
  32471. if (this.body.hasEffects(context))
  32472. return true;
  32473. context.brokenFlow = brokenFlow;
  32474. if (thisInit) {
  32475. context.replacedVariableInits.set(this.scope.thisVariable, thisInit);
  32476. }
  32477. else {
  32478. context.replacedVariableInits.delete(this.scope.thisVariable);
  32479. }
  32480. context.ignore = ignore;
  32481. return false;
  32482. }
  32483. include(context, includeChildrenRecursively) {
  32484. this.included = true;
  32485. if (this.id)
  32486. this.id.include();
  32487. const hasArguments = this.scope.argumentsVariable.included;
  32488. for (const param of this.params) {
  32489. if (!(param instanceof Identifier) || hasArguments) {
  32490. param.include(context, includeChildrenRecursively);
  32491. }
  32492. }
  32493. const { brokenFlow } = context;
  32494. context.brokenFlow = BROKEN_FLOW_NONE;
  32495. this.body.include(context, includeChildrenRecursively);
  32496. context.brokenFlow = brokenFlow;
  32497. }
  32498. includeCallArguments(context, args) {
  32499. this.scope.includeCallArguments(context, args);
  32500. }
  32501. initialise() {
  32502. if (this.id !== null) {
  32503. this.id.declare('function', this);
  32504. }
  32505. this.scope.addParameterVariables(this.params.map(param => param.declare('parameter', UNKNOWN_EXPRESSION)), this.params[this.params.length - 1] instanceof RestElement);
  32506. this.body.addImplicitReturnExpressionToScope();
  32507. }
  32508. parseNode(esTreeNode) {
  32509. this.body = new this.context.nodeConstructors.BlockStatement(esTreeNode.body, this, this.scope.hoistedBodyVarScope);
  32510. super.parseNode(esTreeNode);
  32511. }
  32512. }
  32513. FunctionNode.prototype.preventChildBlockScope = true;
  32514. class FunctionDeclaration extends FunctionNode {
  32515. initialise() {
  32516. super.initialise();
  32517. if (this.id !== null) {
  32518. this.id.variable.isId = true;
  32519. }
  32520. }
  32521. parseNode(esTreeNode) {
  32522. if (esTreeNode.id !== null) {
  32523. this.id = new this.context.nodeConstructors.Identifier(esTreeNode.id, this, this.scope
  32524. .parent);
  32525. }
  32526. super.parseNode(esTreeNode);
  32527. }
  32528. }
  32529. // The header ends at the first non-white-space after "default"
  32530. function getDeclarationStart(code, start) {
  32531. return findNonWhiteSpace(code, findFirstOccurrenceOutsideComment(code, 'default', start) + 7);
  32532. }
  32533. function getIdInsertPosition(code, declarationKeyword, endMarker, start) {
  32534. const declarationEnd = findFirstOccurrenceOutsideComment(code, declarationKeyword, start) + declarationKeyword.length;
  32535. code = code.slice(declarationEnd, findFirstOccurrenceOutsideComment(code, endMarker, declarationEnd));
  32536. const generatorStarPos = findFirstOccurrenceOutsideComment(code, '*');
  32537. if (generatorStarPos === -1) {
  32538. return declarationEnd;
  32539. }
  32540. return declarationEnd + generatorStarPos + 1;
  32541. }
  32542. class ExportDefaultDeclaration extends NodeBase {
  32543. include(context, includeChildrenRecursively) {
  32544. super.include(context, includeChildrenRecursively);
  32545. if (includeChildrenRecursively) {
  32546. this.context.includeVariableInModule(this.variable);
  32547. }
  32548. }
  32549. initialise() {
  32550. const declaration = this.declaration;
  32551. this.declarationName =
  32552. (declaration.id && declaration.id.name) || this.declaration.name;
  32553. this.variable = this.scope.addExportDefaultDeclaration(this.declarationName || this.context.getModuleName(), this, this.context);
  32554. this.context.addExport(this);
  32555. }
  32556. render(code, options, nodeRenderOptions) {
  32557. const { start, end } = nodeRenderOptions;
  32558. const declarationStart = getDeclarationStart(code.original, this.start);
  32559. if (this.declaration instanceof FunctionDeclaration) {
  32560. this.renderNamedDeclaration(code, declarationStart, 'function', '(', this.declaration.id === null, options);
  32561. }
  32562. else if (this.declaration instanceof ClassDeclaration) {
  32563. this.renderNamedDeclaration(code, declarationStart, 'class', '{', this.declaration.id === null, options);
  32564. }
  32565. else if (this.variable.getOriginalVariable() !== this.variable) {
  32566. // Remove altogether to prevent re-declaring the same variable
  32567. treeshakeNode(this, code, start, end);
  32568. return;
  32569. }
  32570. else if (this.variable.included) {
  32571. this.renderVariableDeclaration(code, declarationStart, options);
  32572. }
  32573. else {
  32574. code.remove(this.start, declarationStart);
  32575. this.declaration.render(code, options, {
  32576. isCalleeOfRenderedParent: false,
  32577. renderedParentType: ExpressionStatement$1
  32578. });
  32579. if (code.original[this.end - 1] !== ';') {
  32580. code.appendLeft(this.end, ';');
  32581. }
  32582. return;
  32583. }
  32584. this.declaration.render(code, options);
  32585. }
  32586. renderNamedDeclaration(code, declarationStart, declarationKeyword, endMarker, needsId, options) {
  32587. const name = this.variable.getName();
  32588. // Remove `export default`
  32589. code.remove(this.start, declarationStart);
  32590. if (needsId) {
  32591. code.appendLeft(getIdInsertPosition(code.original, declarationKeyword, endMarker, declarationStart), ` ${name}`);
  32592. }
  32593. if (options.format === 'system' &&
  32594. this.declaration instanceof ClassDeclaration &&
  32595. options.exportNamesByVariable.has(this.variable)) {
  32596. code.appendLeft(this.end, ` ${getSystemExportStatement([this.variable], options)};`);
  32597. }
  32598. }
  32599. renderVariableDeclaration(code, declarationStart, options) {
  32600. const hasTrailingSemicolon = code.original.charCodeAt(this.end - 1) === 59; /*";"*/
  32601. const systemExportNames = options.format === 'system' && options.exportNamesByVariable.get(this.variable);
  32602. if (systemExportNames) {
  32603. code.overwrite(this.start, declarationStart, `${options.varOrConst} ${this.variable.getName()} = exports('${systemExportNames[0]}', `);
  32604. code.appendRight(hasTrailingSemicolon ? this.end - 1 : this.end, ')' + (hasTrailingSemicolon ? '' : ';'));
  32605. }
  32606. else {
  32607. code.overwrite(this.start, declarationStart, `${options.varOrConst} ${this.variable.getName()} = `);
  32608. if (!hasTrailingSemicolon) {
  32609. code.appendLeft(this.end, ';');
  32610. }
  32611. }
  32612. }
  32613. }
  32614. ExportDefaultDeclaration.prototype.needsBoundaries = true;
  32615. class UndefinedVariable extends Variable {
  32616. constructor() {
  32617. super('undefined');
  32618. }
  32619. getLiteralValueAtPath() {
  32620. return undefined;
  32621. }
  32622. }
  32623. class ExportDefaultVariable extends LocalVariable {
  32624. constructor(name, exportDefaultDeclaration, context) {
  32625. super(name, exportDefaultDeclaration, exportDefaultDeclaration.declaration, context);
  32626. this.hasId = false;
  32627. this.originalId = null;
  32628. this.originalVariable = null;
  32629. const declaration = exportDefaultDeclaration.declaration;
  32630. if ((declaration instanceof FunctionDeclaration || declaration instanceof ClassDeclaration) &&
  32631. declaration.id) {
  32632. this.hasId = true;
  32633. this.originalId = declaration.id;
  32634. }
  32635. else if (declaration instanceof Identifier) {
  32636. this.originalId = declaration;
  32637. }
  32638. }
  32639. addReference(identifier) {
  32640. if (!this.hasId) {
  32641. this.name = identifier.name;
  32642. }
  32643. }
  32644. getAssignedVariableName() {
  32645. return (this.originalId && this.originalId.name) || null;
  32646. }
  32647. getBaseVariableName() {
  32648. const original = this.getOriginalVariable();
  32649. if (original === this) {
  32650. return super.getBaseVariableName();
  32651. }
  32652. else {
  32653. return original.getBaseVariableName();
  32654. }
  32655. }
  32656. getDirectOriginalVariable() {
  32657. return this.originalId &&
  32658. (this.hasId ||
  32659. !(this.originalId.variable.isReassigned ||
  32660. this.originalId.variable instanceof UndefinedVariable ||
  32661. // this avoids a circular dependency
  32662. 'syntheticNamespace' in this.originalId.variable))
  32663. ? this.originalId.variable
  32664. : null;
  32665. }
  32666. getName() {
  32667. const original = this.getOriginalVariable();
  32668. if (original === this) {
  32669. return super.getName();
  32670. }
  32671. else {
  32672. return original.getName();
  32673. }
  32674. }
  32675. getOriginalVariable() {
  32676. if (this.originalVariable)
  32677. return this.originalVariable;
  32678. let original = this;
  32679. let currentVariable;
  32680. const checkedVariables = new Set();
  32681. do {
  32682. checkedVariables.add(original);
  32683. currentVariable = original;
  32684. original = currentVariable.getDirectOriginalVariable();
  32685. } while (original instanceof ExportDefaultVariable && !checkedVariables.has(original));
  32686. return (this.originalVariable = original || currentVariable);
  32687. }
  32688. }
  32689. const MISSING_EXPORT_SHIM_VARIABLE = '_missingExportShim';
  32690. class ExportShimVariable extends Variable {
  32691. constructor(module) {
  32692. super(MISSING_EXPORT_SHIM_VARIABLE);
  32693. this.module = module;
  32694. }
  32695. }
  32696. class NamespaceVariable extends Variable {
  32697. constructor(context, syntheticNamedExports) {
  32698. super(context.getModuleName());
  32699. this.memberVariables = null;
  32700. this.mergedNamespaces = [];
  32701. this.referencedEarly = false;
  32702. this.references = [];
  32703. this.context = context;
  32704. this.module = context.module;
  32705. this.syntheticNamedExports = syntheticNamedExports;
  32706. }
  32707. addReference(identifier) {
  32708. this.references.push(identifier);
  32709. this.name = identifier.name;
  32710. }
  32711. // This is only called if "UNKNOWN_PATH" is reassigned as in all other situations, either the
  32712. // build fails due to an illegal namespace reassignment or MemberExpression already forwards
  32713. // the reassignment to the right variable. This means we lost track of this variable and thus
  32714. // need to reassign all exports.
  32715. deoptimizePath() {
  32716. const memberVariables = this.getMemberVariables();
  32717. for (const key of Object.keys(memberVariables)) {
  32718. memberVariables[key].deoptimizePath(UNKNOWN_PATH);
  32719. }
  32720. }
  32721. getMemberVariables() {
  32722. if (this.memberVariables) {
  32723. return this.memberVariables;
  32724. }
  32725. const memberVariables = Object.create(null);
  32726. for (const name of this.context.getExports().concat(this.context.getReexports())) {
  32727. if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
  32728. memberVariables[name] = this.context.traceExport(name);
  32729. }
  32730. }
  32731. return (this.memberVariables = memberVariables);
  32732. }
  32733. include() {
  32734. this.included = true;
  32735. this.context.includeAllExports();
  32736. }
  32737. prepareNamespace(mergedNamespaces) {
  32738. this.mergedNamespaces = mergedNamespaces;
  32739. const moduleExecIndex = this.context.getModuleExecIndex();
  32740. for (const identifier of this.references) {
  32741. if (identifier.context.getModuleExecIndex() <= moduleExecIndex) {
  32742. this.referencedEarly = true;
  32743. break;
  32744. }
  32745. }
  32746. }
  32747. renderBlock(options) {
  32748. const _ = options.compact ? '' : ' ';
  32749. const n = options.compact ? '' : '\n';
  32750. const t = options.indent;
  32751. const memberVariables = this.getMemberVariables();
  32752. const members = Object.keys(memberVariables).map(name => {
  32753. const original = memberVariables[name];
  32754. if (this.referencedEarly || original.isReassigned) {
  32755. return `${t}get ${name}${_}()${_}{${_}return ${original.getName()}${options.compact ? '' : ';'}${_}}`;
  32756. }
  32757. const safeName = RESERVED_NAMES[name] ? `'${name}'` : name;
  32758. return `${t}${safeName}: ${original.getName()}`;
  32759. });
  32760. if (options.namespaceToStringTag) {
  32761. members.unshift(`${t}[Symbol.toStringTag]:${_}'Module'`);
  32762. }
  32763. const needsObjectAssign = this.mergedNamespaces.length > 0 || this.syntheticNamedExports;
  32764. if (!needsObjectAssign)
  32765. members.unshift(`${t}__proto__:${_}null`);
  32766. let output = `{${n}${members.join(`,${n}`)}${n}}`;
  32767. if (needsObjectAssign) {
  32768. const assignmentArgs = ['/*#__PURE__*/Object.create(null)'];
  32769. if (this.mergedNamespaces.length > 0) {
  32770. assignmentArgs.push(...this.mergedNamespaces.map(variable => variable.getName()));
  32771. }
  32772. if (this.syntheticNamedExports) {
  32773. assignmentArgs.push(this.module.getSyntheticNamespace().getName());
  32774. }
  32775. if (members.length > 0) {
  32776. assignmentArgs.push(output);
  32777. }
  32778. output = `/*#__PURE__*/Object.assign(${assignmentArgs.join(`,${_}`)})`;
  32779. }
  32780. if (options.freeze) {
  32781. output = `/*#__PURE__*/Object.freeze(${output})`;
  32782. }
  32783. const name = this.getName();
  32784. output = `${options.varOrConst} ${name}${_}=${_}${output};`;
  32785. if (options.format === 'system' && options.exportNamesByVariable.has(this)) {
  32786. output += `${n}${getSystemExportStatement([this], options)};`;
  32787. }
  32788. return output;
  32789. }
  32790. renderFirst() {
  32791. return this.referencedEarly;
  32792. }
  32793. }
  32794. NamespaceVariable.prototype.isNamespace = true;
  32795. class SyntheticNamedExportVariable extends Variable {
  32796. constructor(context, name, syntheticNamespace) {
  32797. super(name);
  32798. this.baseVariable = null;
  32799. this.context = context;
  32800. this.module = context.module;
  32801. this.syntheticNamespace = syntheticNamespace;
  32802. }
  32803. getBaseVariable() {
  32804. if (this.baseVariable)
  32805. return this.baseVariable;
  32806. let baseVariable = this.syntheticNamespace;
  32807. while (baseVariable instanceof ExportDefaultVariable ||
  32808. baseVariable instanceof SyntheticNamedExportVariable) {
  32809. if (baseVariable instanceof ExportDefaultVariable) {
  32810. const original = baseVariable.getOriginalVariable();
  32811. if (original === baseVariable)
  32812. break;
  32813. baseVariable = original;
  32814. }
  32815. if (baseVariable instanceof SyntheticNamedExportVariable) {
  32816. baseVariable = baseVariable.syntheticNamespace;
  32817. }
  32818. }
  32819. return (this.baseVariable = baseVariable);
  32820. }
  32821. getBaseVariableName() {
  32822. return this.syntheticNamespace.getBaseVariableName();
  32823. }
  32824. getName() {
  32825. const name = this.name;
  32826. return `${this.syntheticNamespace.getName()}${getPropertyAccess(name)}`;
  32827. }
  32828. include() {
  32829. if (!this.included) {
  32830. this.included = true;
  32831. this.context.includeVariableInModule(this.syntheticNamespace);
  32832. }
  32833. }
  32834. setRenderNames(baseName, name) {
  32835. super.setRenderNames(baseName, name);
  32836. }
  32837. }
  32838. const getPropertyAccess = (name) => {
  32839. return !RESERVED_NAMES[name] && /^(?!\d)[\w$]+$/.test(name)
  32840. ? `.${name}`
  32841. : `[${JSON.stringify(name)}]`;
  32842. };
  32843. class ExternalVariable extends Variable {
  32844. constructor(module, name) {
  32845. super(name);
  32846. this.module = module;
  32847. this.isNamespace = name === '*';
  32848. this.referenced = false;
  32849. }
  32850. addReference(identifier) {
  32851. this.referenced = true;
  32852. if (this.name === 'default' || this.name === '*') {
  32853. this.module.suggestName(identifier.name);
  32854. }
  32855. }
  32856. hasEffectsWhenAccessedAtPath(path) {
  32857. return path.length > (this.isNamespace ? 1 : 0);
  32858. }
  32859. include() {
  32860. if (!this.included) {
  32861. this.included = true;
  32862. this.module.used = true;
  32863. }
  32864. }
  32865. }
  32866. const reservedWords$1 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split(' ');
  32867. const builtins$1 = 'Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split(' ');
  32868. const blacklisted = new Set(reservedWords$1.concat(builtins$1));
  32869. const illegalCharacters = /[^$_a-zA-Z0-9]/g;
  32870. const startsWithDigit = (str) => /\d/.test(str[0]);
  32871. function isLegal(str) {
  32872. if (startsWithDigit(str) || blacklisted.has(str)) {
  32873. return false;
  32874. }
  32875. return !illegalCharacters.test(str);
  32876. }
  32877. function makeLegal(str) {
  32878. str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
  32879. if (startsWithDigit(str) || blacklisted.has(str))
  32880. str = `_${str}`;
  32881. return str || '_';
  32882. }
  32883. const absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
  32884. const relativePath$1 = /^\.?\.\//;
  32885. function isAbsolute(path) {
  32886. return absolutePath.test(path);
  32887. }
  32888. function isRelative(path) {
  32889. return relativePath$1.test(path);
  32890. }
  32891. function normalize(path) {
  32892. if (path.indexOf('\\') == -1)
  32893. return path;
  32894. return path.replace(/\\/g, '/');
  32895. }
  32896. class ExternalModule {
  32897. constructor(options, id, hasModuleSideEffects, meta) {
  32898. this.options = options;
  32899. this.id = id;
  32900. this.defaultVariableName = '';
  32901. this.dynamicImporters = [];
  32902. this.importers = [];
  32903. this.mostCommonSuggestion = 0;
  32904. this.namespaceVariableName = '';
  32905. this.reexported = false;
  32906. this.renderPath = undefined;
  32907. this.renormalizeRenderPath = false;
  32908. this.used = false;
  32909. this.variableName = '';
  32910. this.execIndex = Infinity;
  32911. this.suggestedVariableName = makeLegal(id.split(/[\\/]/).pop());
  32912. this.nameSuggestions = Object.create(null);
  32913. this.declarations = Object.create(null);
  32914. this.exportedVariables = new Map();
  32915. const module = this;
  32916. this.info = {
  32917. ast: null,
  32918. code: null,
  32919. dynamicallyImportedIds: EMPTY_ARRAY,
  32920. get dynamicImporters() {
  32921. return module.dynamicImporters.sort();
  32922. },
  32923. hasModuleSideEffects,
  32924. id,
  32925. implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
  32926. implicitlyLoadedBefore: EMPTY_ARRAY,
  32927. importedIds: EMPTY_ARRAY,
  32928. get importers() {
  32929. return module.importers.sort();
  32930. },
  32931. isEntry: false,
  32932. isExternal: true,
  32933. meta,
  32934. syntheticNamedExports: false
  32935. };
  32936. }
  32937. getVariableForExportName(name) {
  32938. let declaration = this.declarations[name];
  32939. if (declaration)
  32940. return declaration;
  32941. this.declarations[name] = declaration = new ExternalVariable(this, name);
  32942. this.exportedVariables.set(declaration, name);
  32943. return declaration;
  32944. }
  32945. setRenderPath(options, inputBase) {
  32946. this.renderPath =
  32947. typeof options.paths === 'function' ? options.paths(this.id) : options.paths[this.id];
  32948. if (!this.renderPath) {
  32949. if (!isAbsolute(this.id)) {
  32950. this.renderPath = this.id;
  32951. }
  32952. else {
  32953. this.renderPath = normalize(relative$1(inputBase, this.id));
  32954. this.renormalizeRenderPath = true;
  32955. }
  32956. }
  32957. return this.renderPath;
  32958. }
  32959. suggestName(name) {
  32960. if (!this.nameSuggestions[name])
  32961. this.nameSuggestions[name] = 0;
  32962. this.nameSuggestions[name] += 1;
  32963. if (this.nameSuggestions[name] > this.mostCommonSuggestion) {
  32964. this.mostCommonSuggestion = this.nameSuggestions[name];
  32965. this.suggestedVariableName = name;
  32966. }
  32967. }
  32968. warnUnusedImports() {
  32969. const unused = Object.keys(this.declarations).filter(name => {
  32970. if (name === '*')
  32971. return false;
  32972. const declaration = this.declarations[name];
  32973. return !declaration.included && !this.reexported && !declaration.referenced;
  32974. });
  32975. if (unused.length === 0)
  32976. return;
  32977. const names = unused.length === 1
  32978. ? `'${unused[0]}' is`
  32979. : `${unused
  32980. .slice(0, -1)
  32981. .map(name => `'${name}'`)
  32982. .join(', ')} and '${unused.slice(-1)}' are`;
  32983. this.options.onwarn({
  32984. code: 'UNUSED_EXTERNAL_IMPORT',
  32985. message: `${names} imported from external module '${this.id}' but never used`,
  32986. names: unused,
  32987. source: this.id
  32988. });
  32989. }
  32990. }
  32991. function removeJsExtension(name) {
  32992. return name.endsWith('.js') ? name.slice(0, -3) : name;
  32993. }
  32994. function getCompleteAmdId(options, chunkId) {
  32995. if (!options.autoId) {
  32996. return options.id || '';
  32997. }
  32998. else {
  32999. return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
  33000. }
  33001. }
  33002. const INTEROP_DEFAULT_VARIABLE = '_interopDefault';
  33003. const INTEROP_DEFAULT_LEGACY_VARIABLE = '_interopDefaultLegacy';
  33004. const INTEROP_NAMESPACE_VARIABLE = '_interopNamespace';
  33005. const INTEROP_NAMESPACE_DEFAULT_VARIABLE = '_interopNamespaceDefault';
  33006. const INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE = '_interopNamespaceDefaultOnly';
  33007. const defaultInteropHelpersByInteropType = {
  33008. auto: INTEROP_DEFAULT_VARIABLE,
  33009. default: null,
  33010. defaultOnly: null,
  33011. esModule: null,
  33012. false: null,
  33013. true: INTEROP_DEFAULT_LEGACY_VARIABLE
  33014. };
  33015. function isDefaultAProperty(interopType, externalLiveBindings) {
  33016. return (interopType === 'esModule' ||
  33017. (externalLiveBindings && (interopType === 'auto' || interopType === 'true')));
  33018. }
  33019. const namespaceInteropHelpersByInteropType = {
  33020. auto: INTEROP_NAMESPACE_VARIABLE,
  33021. default: INTEROP_NAMESPACE_DEFAULT_VARIABLE,
  33022. defaultOnly: INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE,
  33023. esModule: null,
  33024. false: null,
  33025. true: INTEROP_NAMESPACE_VARIABLE
  33026. };
  33027. function canDefaultBeTakenFromNamespace(interopType, externalLiveBindings) {
  33028. return (isDefaultAProperty(interopType, externalLiveBindings) &&
  33029. defaultInteropHelpersByInteropType[interopType] === INTEROP_DEFAULT_VARIABLE);
  33030. }
  33031. function getDefaultOnlyHelper() {
  33032. return INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE;
  33033. }
  33034. function getHelpersBlock(usedHelpers, accessedGlobals, _, n, s, t, liveBindings, freeze, namespaceToStringTag) {
  33035. return HELPER_NAMES.map(variable => usedHelpers.has(variable) || accessedGlobals.has(variable)
  33036. ? HELPER_GENERATORS[variable](_, n, s, t, liveBindings, freeze, namespaceToStringTag, usedHelpers)
  33037. : '').join('');
  33038. }
  33039. const HELPER_GENERATORS = {
  33040. [INTEROP_DEFAULT_VARIABLE]: (_, n, s, _t, liveBindings) => `function ${INTEROP_DEFAULT_VARIABLE}${_}(e)${_}{${_}return ` +
  33041. `e${_}&&${_}e.__esModule${_}?${_}` +
  33042. `${liveBindings ? getDefaultLiveBinding(_) : getDefaultStatic(_)}${s}${_}}${n}${n}`,
  33043. [INTEROP_DEFAULT_LEGACY_VARIABLE]: (_, n, s, _t, liveBindings) => `function ${INTEROP_DEFAULT_LEGACY_VARIABLE}${_}(e)${_}{${_}return ` +
  33044. `e${_}&&${_}typeof e${_}===${_}'object'${_}&&${_}'default'${_}in e${_}?${_}` +
  33045. `${liveBindings ? getDefaultLiveBinding(_) : getDefaultStatic(_)}${s}${_}}${n}${n}`,
  33046. [INTEROP_NAMESPACE_VARIABLE]: (_, n, s, t, liveBindings, freeze, namespaceToStringTag, usedHelpers) => `function ${INTEROP_NAMESPACE_VARIABLE}(e)${_}{${n}` +
  33047. (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)
  33048. ? `${t}return e${_}&&${_}e.__esModule${_}?${_}e${_}:${_}${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${s}${n}`
  33049. : `${t}if${_}(e${_}&&${_}e.__esModule)${_}return e;${n}` +
  33050. createNamespaceObject(_, n, t, t, liveBindings, freeze, namespaceToStringTag)) +
  33051. `}${n}${n}`,
  33052. [INTEROP_NAMESPACE_DEFAULT_VARIABLE]: (_, n, _s, t, liveBindings, freeze, namespaceToStringTag) => `function ${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${_}{${n}` +
  33053. createNamespaceObject(_, n, t, t, liveBindings, freeze, namespaceToStringTag) +
  33054. `}${n}${n}`,
  33055. [INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE]: (_, n, _s, t, _liveBindings, freeze, namespaceToStringTag) => `function ${INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE}(e)${_}{${n}` +
  33056. `${t}return ${getFrozen(`{__proto__: null,${namespaceToStringTag ? `${_}[Symbol.toStringTag]:${_}'Module',` : ''}${_}'default':${_}e}`, freeze)};${n}` +
  33057. `}${n}${n}`
  33058. };
  33059. function getDefaultLiveBinding(_) {
  33060. return `e${_}:${_}{${_}'default':${_}e${_}}`;
  33061. }
  33062. function getDefaultStatic(_) {
  33063. return `e['default']${_}:${_}e`;
  33064. }
  33065. function createNamespaceObject(_, n, t, i, liveBindings, freeze, namespaceToStringTag) {
  33066. return (`${i}var n${_}=${_}${namespaceToStringTag
  33067. ? `{__proto__:${_}null,${_}[Symbol.toStringTag]:${_}'Module'}`
  33068. : 'Object.create(null)'};${n}` +
  33069. `${i}if${_}(e)${_}{${n}` +
  33070. `${i}${t}Object.keys(e).forEach(function${_}(k)${_}{${n}` +
  33071. (liveBindings ? copyPropertyLiveBinding : copyPropertyStatic)(_, n, t, i + t + t) +
  33072. `${i}${t}});${n}` +
  33073. `${i}}${n}` +
  33074. `${i}n['default']${_}=${_}e;${n}` +
  33075. `${i}return ${getFrozen('n', freeze)};${n}`);
  33076. }
  33077. function copyPropertyLiveBinding(_, n, t, i) {
  33078. return (`${i}if${_}(k${_}!==${_}'default')${_}{${n}` +
  33079. `${i}${t}var d${_}=${_}Object.getOwnPropertyDescriptor(e,${_}k);${n}` +
  33080. `${i}${t}Object.defineProperty(n,${_}k,${_}d.get${_}?${_}d${_}:${_}{${n}` +
  33081. `${i}${t}${t}enumerable:${_}true,${n}` +
  33082. `${i}${t}${t}get:${_}function${_}()${_}{${n}` +
  33083. `${i}${t}${t}${t}return e[k];${n}` +
  33084. `${i}${t}${t}}${n}` +
  33085. `${i}${t}});${n}` +
  33086. `${i}}${n}`);
  33087. }
  33088. function copyPropertyStatic(_, n, _t, i) {
  33089. return `${i}n[k]${_}=${_}e[k];${n}`;
  33090. }
  33091. function getFrozen(fragment, freeze) {
  33092. return freeze ? `Object.freeze(${fragment})` : fragment;
  33093. }
  33094. const HELPER_NAMES = Object.keys(HELPER_GENERATORS);
  33095. function getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, mechanism = 'return ') {
  33096. const _ = compact ? '' : ' ';
  33097. const n = compact ? '' : '\n';
  33098. if (!namedExportsMode) {
  33099. return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings)};`;
  33100. }
  33101. let exportBlock = '';
  33102. for (const { defaultVariableName, id, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
  33103. if (reexports && namedExportsMode) {
  33104. for (const specifier of reexports) {
  33105. if (specifier.reexported !== '*') {
  33106. const importName = getReexportedImportName(name, specifier.imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, id, externalLiveBindings);
  33107. if (exportBlock)
  33108. exportBlock += n;
  33109. exportBlock +=
  33110. specifier.imported !== '*' && specifier.needsLiveBinding
  33111. ? `Object.defineProperty(exports,${_}'${specifier.reexported}',${_}{${n}` +
  33112. `${t}enumerable:${_}true,${n}` +
  33113. `${t}get:${_}function${_}()${_}{${n}` +
  33114. `${t}${t}return ${importName};${n}${t}}${n}});`
  33115. : `exports.${specifier.reexported}${_}=${_}${importName};`;
  33116. }
  33117. }
  33118. }
  33119. }
  33120. for (const chunkExport of exports) {
  33121. const lhs = `exports.${chunkExport.exported}`;
  33122. const rhs = chunkExport.local;
  33123. if (lhs !== rhs) {
  33124. if (exportBlock)
  33125. exportBlock += n;
  33126. exportBlock += `${lhs}${_}=${_}${rhs};`;
  33127. }
  33128. }
  33129. for (const { name, reexports } of dependencies) {
  33130. if (reexports && namedExportsMode) {
  33131. for (const specifier of reexports) {
  33132. if (specifier.reexported === '*') {
  33133. if (exportBlock)
  33134. exportBlock += n;
  33135. if (specifier.needsLiveBinding) {
  33136. exportBlock +=
  33137. `Object.keys(${name}).forEach(function${_}(k)${_}{${n}` +
  33138. `${t}if${_}(k${_}!==${_}'default'${_}&&${_}!exports.hasOwnProperty(k))${_}Object.defineProperty(exports,${_}k,${_}{${n}` +
  33139. `${t}${t}enumerable:${_}true,${n}` +
  33140. `${t}${t}get:${_}function${_}()${_}{${n}` +
  33141. `${t}${t}${t}return ${name}[k];${n}` +
  33142. `${t}${t}}${n}${t}});${n}});`;
  33143. }
  33144. else {
  33145. exportBlock +=
  33146. `Object.keys(${name}).forEach(function${_}(k)${_}{${n}` +
  33147. `${t}if${_}(k${_}!==${_}'default'${_}&&${_}!exports.hasOwnProperty(k))${_}exports[k]${_}=${_}${name}[k];${n}});`;
  33148. }
  33149. }
  33150. }
  33151. }
  33152. }
  33153. if (exportBlock) {
  33154. return `${n}${n}${exportBlock}`;
  33155. }
  33156. return '';
  33157. }
  33158. function getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings) {
  33159. if (exports.length > 0) {
  33160. return exports[0].local;
  33161. }
  33162. else {
  33163. for (const { defaultVariableName, id, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
  33164. if (reexports) {
  33165. return getReexportedImportName(name, reexports[0].imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, id, externalLiveBindings);
  33166. }
  33167. }
  33168. }
  33169. }
  33170. function getReexportedImportName(moduleVariableName, imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, moduleId, externalLiveBindings) {
  33171. if (imported === 'default') {
  33172. if (!isChunk) {
  33173. const moduleInterop = String(interop(moduleId));
  33174. const variableName = defaultInteropHelpersByInteropType[moduleInterop]
  33175. ? defaultVariableName
  33176. : moduleVariableName;
  33177. return isDefaultAProperty(moduleInterop, externalLiveBindings)
  33178. ? `${variableName}['default']`
  33179. : variableName;
  33180. }
  33181. return depNamedExportsMode ? `${moduleVariableName}['default']` : moduleVariableName;
  33182. }
  33183. if (imported === '*') {
  33184. return (isChunk
  33185. ? !depNamedExportsMode
  33186. : namespaceInteropHelpersByInteropType[String(interop(moduleId))])
  33187. ? namespaceVariableName
  33188. : moduleVariableName;
  33189. }
  33190. return `${moduleVariableName}.${imported}`;
  33191. }
  33192. function getEsModuleExport(_) {
  33193. return `Object.defineProperty(exports,${_}'__esModule',${_}{${_}value:${_}true${_}});`;
  33194. }
  33195. function getNamespaceToStringExport(_) {
  33196. return `exports[Symbol.toStringTag]${_}=${_}'Module';`;
  33197. }
  33198. function getNamespaceMarkers(hasNamedExports, addEsModule, addNamespaceToStringTag, _, n) {
  33199. let namespaceMarkers = '';
  33200. if (hasNamedExports) {
  33201. if (addEsModule) {
  33202. namespaceMarkers += getEsModuleExport(_);
  33203. }
  33204. if (addNamespaceToStringTag) {
  33205. if (namespaceMarkers) {
  33206. namespaceMarkers += n;
  33207. }
  33208. namespaceMarkers += getNamespaceToStringExport(_);
  33209. }
  33210. }
  33211. return namespaceMarkers;
  33212. }
  33213. function getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t) {
  33214. const neededInteropHelpers = new Set();
  33215. const interopStatements = [];
  33216. const addInteropStatement = (helperVariableName, helper, dependencyVariableName) => {
  33217. neededInteropHelpers.add(helper);
  33218. interopStatements.push(`${varOrConst} ${helperVariableName}${_}=${_}/*#__PURE__*/${helper}(${dependencyVariableName});`);
  33219. };
  33220. for (const { defaultVariableName, imports, id, isChunk, name, namedExportsMode, namespaceVariableName, reexports } of dependencies) {
  33221. if (isChunk) {
  33222. for (const { imported, reexported } of [
  33223. ...(imports || []),
  33224. ...(reexports || [])
  33225. ]) {
  33226. if (imported === '*' && reexported !== '*') {
  33227. if (!namedExportsMode) {
  33228. addInteropStatement(namespaceVariableName, getDefaultOnlyHelper(), name);
  33229. }
  33230. break;
  33231. }
  33232. }
  33233. }
  33234. else {
  33235. const moduleInterop = String(interop(id));
  33236. let hasDefault = false;
  33237. let hasNamespace = false;
  33238. for (const { imported, reexported } of [
  33239. ...(imports || []),
  33240. ...(reexports || [])
  33241. ]) {
  33242. let helper;
  33243. let variableName;
  33244. if (imported === 'default') {
  33245. if (!hasDefault) {
  33246. hasDefault = true;
  33247. if (defaultVariableName !== namespaceVariableName) {
  33248. variableName = defaultVariableName;
  33249. helper = defaultInteropHelpersByInteropType[moduleInterop];
  33250. }
  33251. }
  33252. }
  33253. else if (imported === '*' && reexported !== '*') {
  33254. if (!hasNamespace) {
  33255. hasNamespace = true;
  33256. helper = namespaceInteropHelpersByInteropType[moduleInterop];
  33257. variableName = namespaceVariableName;
  33258. }
  33259. }
  33260. if (helper) {
  33261. addInteropStatement(variableName, helper, name);
  33262. }
  33263. }
  33264. }
  33265. }
  33266. return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, _, n, s, t, externalLiveBindings, freeze, namespaceToStringTag)}${interopStatements.length > 0 ? `${interopStatements.join(n)}${n}${n}` : ''}`;
  33267. }
  33268. // AMD resolution will only respect the AMD baseUrl if the .js extension is omitted.
  33269. // The assumption is that this makes sense for all relative ids:
  33270. // https://requirejs.org/docs/api.html#jsfiles
  33271. function removeExtensionFromRelativeAmdId(id) {
  33272. return id[0] === '.' ? removeJsExtension(id) : id;
  33273. }
  33274. const builtins = {
  33275. assert: true,
  33276. buffer: true,
  33277. console: true,
  33278. constants: true,
  33279. domain: true,
  33280. events: true,
  33281. http: true,
  33282. https: true,
  33283. os: true,
  33284. path: true,
  33285. process: true,
  33286. punycode: true,
  33287. querystring: true,
  33288. stream: true,
  33289. string_decoder: true,
  33290. timers: true,
  33291. tty: true,
  33292. url: true,
  33293. util: true,
  33294. vm: true,
  33295. zlib: true
  33296. };
  33297. function warnOnBuiltins(warn, dependencies) {
  33298. const externalBuiltins = dependencies.map(({ id }) => id).filter(id => id in builtins);
  33299. if (!externalBuiltins.length)
  33300. return;
  33301. const detail = externalBuiltins.length === 1
  33302. ? `module ('${externalBuiltins[0]}')`
  33303. : `modules (${externalBuiltins
  33304. .slice(0, -1)
  33305. .map(name => `'${name}'`)
  33306. .join(', ')} and '${externalBuiltins.slice(-1)}')`;
  33307. warn({
  33308. code: 'MISSING_NODE_BUILTINS',
  33309. message: `Creating a browser bundle that depends on Node.js built-in ${detail}. You might need to include https://github.com/ionic-team/rollup-plugin-node-polyfills`,
  33310. modules: externalBuiltins
  33311. });
  33312. }
  33313. function amd(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indentString: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, varOrConst, warn }, { amd, compact, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
  33314. warnOnBuiltins(warn, dependencies);
  33315. const deps = dependencies.map(m => `'${removeExtensionFromRelativeAmdId(m.id)}'`);
  33316. const args = dependencies.map(m => m.name);
  33317. const n = compact ? '' : '\n';
  33318. const s = compact ? '' : ';';
  33319. const _ = compact ? '' : ' ';
  33320. if (namedExportsMode && hasExports) {
  33321. args.unshift(`exports`);
  33322. deps.unshift(`'exports'`);
  33323. }
  33324. if (accessedGlobals.has('require')) {
  33325. args.unshift('require');
  33326. deps.unshift(`'require'`);
  33327. }
  33328. if (accessedGlobals.has('module')) {
  33329. args.unshift('module');
  33330. deps.unshift(`'module'`);
  33331. }
  33332. const completeAmdId = getCompleteAmdId(amd, id);
  33333. const params = (completeAmdId ? `'${completeAmdId}',${_}` : ``) +
  33334. (deps.length ? `[${deps.join(`,${_}`)}],${_}` : ``);
  33335. const useStrict = strict ? `${_}'use strict';` : '';
  33336. magicString.prepend(`${intro}${getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t)}`);
  33337. const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
  33338. let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, _, n);
  33339. if (namespaceMarkers) {
  33340. namespaceMarkers = n + n + namespaceMarkers;
  33341. }
  33342. magicString.append(`${exportBlock}${namespaceMarkers}${outro}`);
  33343. return magicString
  33344. .indent(t)
  33345. .prepend(`${amd.define}(${params}function${_}(${args.join(`,${_}`)})${_}{${useStrict}${n}${n}`)
  33346. .append(`${n}${n}});`);
  33347. }
  33348. function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports, indentString: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, varOrConst }, { compact, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
  33349. const n = compact ? '' : '\n';
  33350. const s = compact ? '' : ';';
  33351. const _ = compact ? '' : ' ';
  33352. const useStrict = strict ? `'use strict';${n}${n}` : '';
  33353. let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, _, n);
  33354. if (namespaceMarkers) {
  33355. namespaceMarkers += n + n;
  33356. }
  33357. const importBlock = getImportBlock$1(dependencies, compact, varOrConst, n, _);
  33358. const interopBlock = getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t);
  33359. magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
  33360. const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings, `module.exports${_}=${_}`);
  33361. return magicString.append(`${exportBlock}${outro}`);
  33362. }
  33363. function getImportBlock$1(dependencies, compact, varOrConst, n, _) {
  33364. let importBlock = '';
  33365. let definingVariable = false;
  33366. for (const { id, name, reexports, imports } of dependencies) {
  33367. if (!reexports && !imports) {
  33368. if (importBlock) {
  33369. importBlock += !compact || definingVariable ? `;${n}` : ',';
  33370. }
  33371. definingVariable = false;
  33372. importBlock += `require('${id}')`;
  33373. }
  33374. else {
  33375. importBlock +=
  33376. compact && definingVariable ? ',' : `${importBlock ? `;${n}` : ''}${varOrConst} `;
  33377. definingVariable = true;
  33378. importBlock += `${name}${_}=${_}require('${id}')`;
  33379. }
  33380. }
  33381. if (importBlock) {
  33382. return `${importBlock};${n}${n}`;
  33383. }
  33384. return '';
  33385. }
  33386. function es(magicString, { intro, outro, dependencies, exports, varOrConst }, { compact }) {
  33387. const _ = compact ? '' : ' ';
  33388. const n = compact ? '' : '\n';
  33389. const importBlock = getImportBlock(dependencies, _);
  33390. if (importBlock.length > 0)
  33391. intro += importBlock.join(n) + n + n;
  33392. if (intro)
  33393. magicString.prepend(intro);
  33394. const exportBlock = getExportBlock(exports, _, varOrConst);
  33395. if (exportBlock.length)
  33396. magicString.append(n + n + exportBlock.join(n).trim());
  33397. if (outro)
  33398. magicString.append(outro);
  33399. return magicString.trim();
  33400. }
  33401. function getImportBlock(dependencies, _) {
  33402. const importBlock = [];
  33403. for (const { id, reexports, imports, name } of dependencies) {
  33404. if (!reexports && !imports) {
  33405. importBlock.push(`import${_}'${id}';`);
  33406. continue;
  33407. }
  33408. if (imports) {
  33409. let defaultImport = null;
  33410. let starImport = null;
  33411. const importedNames = [];
  33412. for (const specifier of imports) {
  33413. if (specifier.imported === 'default') {
  33414. defaultImport = specifier;
  33415. }
  33416. else if (specifier.imported === '*') {
  33417. starImport = specifier;
  33418. }
  33419. else {
  33420. importedNames.push(specifier);
  33421. }
  33422. }
  33423. if (starImport) {
  33424. importBlock.push(`import${_}*${_}as ${starImport.local} from${_}'${id}';`);
  33425. }
  33426. if (defaultImport && importedNames.length === 0) {
  33427. importBlock.push(`import ${defaultImport.local} from${_}'${id}';`);
  33428. }
  33429. else if (importedNames.length > 0) {
  33430. importBlock.push(`import ${defaultImport ? `${defaultImport.local},${_}` : ''}{${_}${importedNames
  33431. .map(specifier => {
  33432. if (specifier.imported === specifier.local) {
  33433. return specifier.imported;
  33434. }
  33435. else {
  33436. return `${specifier.imported} as ${specifier.local}`;
  33437. }
  33438. })
  33439. .join(`,${_}`)}${_}}${_}from${_}'${id}';`);
  33440. }
  33441. }
  33442. if (reexports) {
  33443. let starExport = null;
  33444. const namespaceReexports = [];
  33445. const namedReexports = [];
  33446. for (const specifier of reexports) {
  33447. if (specifier.reexported === '*') {
  33448. starExport = specifier;
  33449. }
  33450. else if (specifier.imported === '*') {
  33451. namespaceReexports.push(specifier);
  33452. }
  33453. else {
  33454. namedReexports.push(specifier);
  33455. }
  33456. }
  33457. if (starExport) {
  33458. importBlock.push(`export${_}*${_}from${_}'${id}';`);
  33459. }
  33460. if (namespaceReexports.length > 0) {
  33461. if (!imports ||
  33462. !imports.some(specifier => specifier.imported === '*' && specifier.local === name)) {
  33463. importBlock.push(`import${_}*${_}as ${name} from${_}'${id}';`);
  33464. }
  33465. for (const specifier of namespaceReexports) {
  33466. importBlock.push(`export${_}{${_}${name === specifier.reexported ? name : `${name} as ${specifier.reexported}`} };`);
  33467. }
  33468. }
  33469. if (namedReexports.length > 0) {
  33470. importBlock.push(`export${_}{${_}${namedReexports
  33471. .map(specifier => {
  33472. if (specifier.imported === specifier.reexported) {
  33473. return specifier.imported;
  33474. }
  33475. else {
  33476. return `${specifier.imported} as ${specifier.reexported}`;
  33477. }
  33478. })
  33479. .join(`,${_}`)}${_}}${_}from${_}'${id}';`);
  33480. }
  33481. }
  33482. }
  33483. return importBlock;
  33484. }
  33485. function getExportBlock(exports, _, varOrConst) {
  33486. const exportBlock = [];
  33487. const exportDeclaration = [];
  33488. for (const specifier of exports) {
  33489. if (specifier.exported === 'default') {
  33490. exportBlock.push(`export default ${specifier.local};`);
  33491. }
  33492. else {
  33493. if (specifier.expression) {
  33494. exportBlock.push(`${varOrConst} ${specifier.local}${_}=${_}${specifier.expression};`);
  33495. }
  33496. exportDeclaration.push(specifier.exported === specifier.local
  33497. ? specifier.local
  33498. : `${specifier.local} as ${specifier.exported}`);
  33499. }
  33500. }
  33501. if (exportDeclaration.length) {
  33502. exportBlock.push(`export${_}{${_}${exportDeclaration.join(`,${_}`)}${_}};`);
  33503. }
  33504. return exportBlock;
  33505. }
  33506. function spaces(i) {
  33507. let result = '';
  33508. while (i--)
  33509. result += ' ';
  33510. return result;
  33511. }
  33512. function tabsToSpaces(str) {
  33513. return str.replace(/^\t+/, match => match.split('\t').join(' '));
  33514. }
  33515. function getCodeFrame(source, line, column) {
  33516. let lines = source.split('\n');
  33517. const frameStart = Math.max(0, line - 3);
  33518. let frameEnd = Math.min(line + 2, lines.length);
  33519. lines = lines.slice(frameStart, frameEnd);
  33520. while (!/\S/.test(lines[lines.length - 1])) {
  33521. lines.pop();
  33522. frameEnd -= 1;
  33523. }
  33524. const digits = String(frameEnd).length;
  33525. return lines
  33526. .map((str, i) => {
  33527. const isErrorLine = frameStart + i + 1 === line;
  33528. let lineNum = String(i + frameStart + 1);
  33529. while (lineNum.length < digits)
  33530. lineNum = ` ${lineNum}`;
  33531. if (isErrorLine) {
  33532. const indicator = spaces(digits + 2 + tabsToSpaces(str.slice(0, column)).length) + '^';
  33533. return `${lineNum}: ${tabsToSpaces(str)}\n${indicator}`;
  33534. }
  33535. return `${lineNum}: ${tabsToSpaces(str)}`;
  33536. })
  33537. .join('\n');
  33538. }
  33539. function sanitizeFileName(name) {
  33540. const match = /^[a-z]:/i.exec(name);
  33541. const driveLetter = match ? match[0] : "";
  33542. // A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
  33543. // Otherwise, avoid them because they can refer to NTFS alternate data streams.
  33544. return driveLetter + name.substr(driveLetter.length).replace(/[\0?*:]/g, '_');
  33545. }
  33546. function getAliasName(id) {
  33547. const base = basename(id);
  33548. return base.substr(0, base.length - extname$1(id).length);
  33549. }
  33550. function relativeId(id) {
  33551. if (!isAbsolute(id))
  33552. return id;
  33553. return relative$1(resolve$1(), id);
  33554. }
  33555. function isPlainPathFragment(name) {
  33556. // not starting with "/", "./", "../"
  33557. return (name[0] !== '/' &&
  33558. !(name[0] === '.' && (name[1] === '/' || name[1] === '.')) &&
  33559. sanitizeFileName(name) === name &&
  33560. !isAbsolute(name));
  33561. }
  33562. function error(base) {
  33563. if (!(base instanceof Error))
  33564. base = Object.assign(new Error(base.message), base);
  33565. throw base;
  33566. }
  33567. function augmentCodeLocation(props, pos, source, id) {
  33568. if (typeof pos === 'object') {
  33569. const { line, column } = pos;
  33570. props.loc = { file: id, line, column };
  33571. }
  33572. else {
  33573. props.pos = pos;
  33574. const { line, column } = locate(source, pos, { offsetLine: 1 });
  33575. props.loc = { file: id, line, column };
  33576. }
  33577. if (props.frame === undefined) {
  33578. const { line, column } = props.loc;
  33579. props.frame = getCodeFrame(source, line, column);
  33580. }
  33581. }
  33582. var Errors;
  33583. (function (Errors) {
  33584. Errors["ALREADY_CLOSED"] = "ALREADY_CLOSED";
  33585. Errors["ASSET_NOT_FINALISED"] = "ASSET_NOT_FINALISED";
  33586. Errors["ASSET_NOT_FOUND"] = "ASSET_NOT_FOUND";
  33587. Errors["ASSET_SOURCE_ALREADY_SET"] = "ASSET_SOURCE_ALREADY_SET";
  33588. Errors["ASSET_SOURCE_MISSING"] = "ASSET_SOURCE_MISSING";
  33589. Errors["BAD_LOADER"] = "BAD_LOADER";
  33590. Errors["CANNOT_EMIT_FROM_OPTIONS_HOOK"] = "CANNOT_EMIT_FROM_OPTIONS_HOOK";
  33591. Errors["CHUNK_NOT_GENERATED"] = "CHUNK_NOT_GENERATED";
  33592. Errors["CHUNK_INVALID"] = "CHUNK_INVALID";
  33593. Errors["CIRCULAR_REEXPORT"] = "CIRCULAR_REEXPORT";
  33594. Errors["CYCLIC_CROSS_CHUNK_REEXPORT"] = "CYCLIC_CROSS_CHUNK_REEXPORT";
  33595. Errors["DEPRECATED_FEATURE"] = "DEPRECATED_FEATURE";
  33596. Errors["EXTERNAL_SYNTHETIC_EXPORTS"] = "EXTERNAL_SYNTHETIC_EXPORTS";
  33597. Errors["FILE_NAME_CONFLICT"] = "FILE_NAME_CONFLICT";
  33598. Errors["FILE_NOT_FOUND"] = "FILE_NOT_FOUND";
  33599. Errors["INPUT_HOOK_IN_OUTPUT_PLUGIN"] = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
  33600. Errors["INVALID_CHUNK"] = "INVALID_CHUNK";
  33601. Errors["INVALID_EXPORT_OPTION"] = "INVALID_EXPORT_OPTION";
  33602. Errors["INVALID_EXTERNAL_ID"] = "INVALID_EXTERNAL_ID";
  33603. Errors["INVALID_OPTION"] = "INVALID_OPTION";
  33604. Errors["INVALID_PLUGIN_HOOK"] = "INVALID_PLUGIN_HOOK";
  33605. Errors["INVALID_ROLLUP_PHASE"] = "INVALID_ROLLUP_PHASE";
  33606. Errors["MISSING_EXPORT"] = "MISSING_EXPORT";
  33607. Errors["MISSING_IMPLICIT_DEPENDANT"] = "MISSING_IMPLICIT_DEPENDANT";
  33608. Errors["MIXED_EXPORTS"] = "MIXED_EXPORTS";
  33609. Errors["NAMESPACE_CONFLICT"] = "NAMESPACE_CONFLICT";
  33610. Errors["NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE"] = "NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE";
  33611. Errors["PLUGIN_ERROR"] = "PLUGIN_ERROR";
  33612. Errors["PREFER_NAMED_EXPORTS"] = "PREFER_NAMED_EXPORTS";
  33613. Errors["SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT"] = "SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT";
  33614. Errors["UNEXPECTED_NAMED_IMPORT"] = "UNEXPECTED_NAMED_IMPORT";
  33615. Errors["UNRESOLVED_ENTRY"] = "UNRESOLVED_ENTRY";
  33616. Errors["UNRESOLVED_IMPORT"] = "UNRESOLVED_IMPORT";
  33617. Errors["VALIDATION_ERROR"] = "VALIDATION_ERROR";
  33618. })(Errors || (Errors = {}));
  33619. function errAssetNotFinalisedForFileName(name) {
  33620. return {
  33621. code: Errors.ASSET_NOT_FINALISED,
  33622. message: `Plugin error - Unable to get file name for asset "${name}". Ensure that the source is set and that generate is called first.`
  33623. };
  33624. }
  33625. function errCannotEmitFromOptionsHook() {
  33626. return {
  33627. code: Errors.CANNOT_EMIT_FROM_OPTIONS_HOOK,
  33628. message: `Cannot emit files or set asset sources in the "outputOptions" hook, use the "renderStart" hook instead.`
  33629. };
  33630. }
  33631. function errChunkNotGeneratedForFileName(name) {
  33632. return {
  33633. code: Errors.CHUNK_NOT_GENERATED,
  33634. message: `Plugin error - Unable to get file name for chunk "${name}". Ensure that generate is called first.`
  33635. };
  33636. }
  33637. function errChunkInvalid({ fileName, code }, exception) {
  33638. const errorProps = {
  33639. code: Errors.CHUNK_INVALID,
  33640. message: `Chunk "${fileName}" is not valid JavaScript: ${exception.message}.`
  33641. };
  33642. augmentCodeLocation(errorProps, exception.loc, code, fileName);
  33643. return errorProps;
  33644. }
  33645. function errCircularReexport(exportName, importedModule) {
  33646. return {
  33647. code: Errors.CIRCULAR_REEXPORT,
  33648. id: importedModule,
  33649. message: `"${exportName}" cannot be exported from ${relativeId(importedModule)} as it is a reexport that references itself.`
  33650. };
  33651. }
  33652. function errCyclicCrossChunkReexport(exportName, exporter, reexporter, importer) {
  33653. return {
  33654. code: Errors.CYCLIC_CROSS_CHUNK_REEXPORT,
  33655. exporter,
  33656. importer,
  33657. message: `Export "${exportName}" of module ${relativeId(exporter)} was reexported through module ${relativeId(reexporter)} while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.\nEither change the import in ${relativeId(importer)} to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.`,
  33658. reexporter
  33659. };
  33660. }
  33661. function errAssetReferenceIdNotFoundForSetSource(assetReferenceId) {
  33662. return {
  33663. code: Errors.ASSET_NOT_FOUND,
  33664. message: `Plugin error - Unable to set the source for unknown asset "${assetReferenceId}".`
  33665. };
  33666. }
  33667. function errAssetSourceAlreadySet(name) {
  33668. return {
  33669. code: Errors.ASSET_SOURCE_ALREADY_SET,
  33670. message: `Unable to set the source for asset "${name}", source already set.`
  33671. };
  33672. }
  33673. function errNoAssetSourceSet(assetName) {
  33674. return {
  33675. code: Errors.ASSET_SOURCE_MISSING,
  33676. message: `Plugin error creating asset "${assetName}" - no asset source set.`
  33677. };
  33678. }
  33679. function errBadLoader(id) {
  33680. return {
  33681. code: Errors.BAD_LOADER,
  33682. message: `Error loading ${relativeId(id)}: plugin load hook should return a string, a { code, map } object, or nothing/null`
  33683. };
  33684. }
  33685. function errDeprecation(deprecation) {
  33686. return {
  33687. code: Errors.DEPRECATED_FEATURE,
  33688. ...(typeof deprecation === 'string' ? { message: deprecation } : deprecation)
  33689. };
  33690. }
  33691. function errFileReferenceIdNotFoundForFilename(assetReferenceId) {
  33692. return {
  33693. code: Errors.FILE_NOT_FOUND,
  33694. message: `Plugin error - Unable to get file name for unknown file "${assetReferenceId}".`
  33695. };
  33696. }
  33697. function errFileNameConflict(fileName) {
  33698. return {
  33699. code: Errors.FILE_NAME_CONFLICT,
  33700. message: `The emitted file "${fileName}" overwrites a previously emitted file of the same name.`
  33701. };
  33702. }
  33703. function errInputHookInOutputPlugin(pluginName, hookName) {
  33704. return {
  33705. code: Errors.INPUT_HOOK_IN_OUTPUT_PLUGIN,
  33706. message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
  33707. };
  33708. }
  33709. function errCannotAssignModuleToChunk(moduleId, assignToAlias, currentAlias) {
  33710. return {
  33711. code: Errors.INVALID_CHUNK,
  33712. message: `Cannot assign ${relativeId(moduleId)} to the "${assignToAlias}" chunk as it is already in the "${currentAlias}" chunk.`
  33713. };
  33714. }
  33715. function errInvalidExportOptionValue(optionValue) {
  33716. return {
  33717. code: Errors.INVALID_EXPORT_OPTION,
  33718. message: `"output.exports" must be "default", "named", "none", "auto", or left unspecified (defaults to "auto"), received "${optionValue}"`,
  33719. url: `https://rollupjs.org/guide/en/#outputexports`
  33720. };
  33721. }
  33722. function errIncompatibleExportOptionValue(optionValue, keys, entryModule) {
  33723. return {
  33724. code: 'INVALID_EXPORT_OPTION',
  33725. message: `"${optionValue}" was specified for "output.exports", but entry module "${relativeId(entryModule)}" has the following exports: ${keys.join(', ')}`
  33726. };
  33727. }
  33728. function errInternalIdCannotBeExternal(source, importer) {
  33729. return {
  33730. code: Errors.INVALID_EXTERNAL_ID,
  33731. message: `'${source}' is imported as an external by ${relativeId(importer)}, but is already an existing non-external module id.`
  33732. };
  33733. }
  33734. function errInvalidOption(option, explanation) {
  33735. return {
  33736. code: Errors.INVALID_OPTION,
  33737. message: `Invalid value for option "${option}" - ${explanation}.`
  33738. };
  33739. }
  33740. function errInvalidRollupPhaseForAddWatchFile() {
  33741. return {
  33742. code: Errors.INVALID_ROLLUP_PHASE,
  33743. message: `Cannot call addWatchFile after the build has finished.`
  33744. };
  33745. }
  33746. function errInvalidRollupPhaseForChunkEmission() {
  33747. return {
  33748. code: Errors.INVALID_ROLLUP_PHASE,
  33749. message: `Cannot emit chunks after module loading has finished.`
  33750. };
  33751. }
  33752. function errMissingExport(exportName, importingModule, importedModule) {
  33753. return {
  33754. code: Errors.MISSING_EXPORT,
  33755. message: `'${exportName}' is not exported by ${relativeId(importedModule)}, imported by ${relativeId(importingModule)}`,
  33756. url: `https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module`
  33757. };
  33758. }
  33759. function errImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore) {
  33760. return {
  33761. code: Errors.MISSING_IMPLICIT_DEPENDANT,
  33762. message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" cannot be external.`
  33763. };
  33764. }
  33765. function errUnresolvedImplicitDependant(unresolvedId, implicitlyLoadedBefore) {
  33766. return {
  33767. code: Errors.MISSING_IMPLICIT_DEPENDANT,
  33768. message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" could not be resolved.`
  33769. };
  33770. }
  33771. function errImplicitDependantIsNotIncluded(module) {
  33772. const implicitDependencies = Array.from(module.implicitlyLoadedBefore, dependency => relativeId(dependency.id)).sort();
  33773. return {
  33774. code: Errors.MISSING_IMPLICIT_DEPENDANT,
  33775. message: `Module "${relativeId(module.id)}" that should be implicitly loaded before "${implicitDependencies.length === 1
  33776. ? implicitDependencies[0]
  33777. : `${implicitDependencies.slice(0, -1).join('", "')}" and "${implicitDependencies.slice(-1)[0]}`}" is not included in the module graph. Either it was not imported by an included module or only via a tree-shaken dynamic import, or no imported bindings were used and it had otherwise no side-effects.`
  33778. };
  33779. }
  33780. function errMixedExport(facadeModuleId, name) {
  33781. return {
  33782. code: Errors.MIXED_EXPORTS,
  33783. id: facadeModuleId,
  33784. message: `Entry module "${relativeId(facadeModuleId)}" is using named and default exports together. Consumers of your bundle will have to use \`${name || 'chunk'}["default"]\` to access the default export, which may not be what you want. Use \`output.exports: "named"\` to disable this warning`,
  33785. url: `https://rollupjs.org/guide/en/#outputexports`
  33786. };
  33787. }
  33788. function errNamespaceConflict(name, reexportingModule, additionalExportAllModule) {
  33789. return {
  33790. code: Errors.NAMESPACE_CONFLICT,
  33791. message: `Conflicting namespaces: ${relativeId(reexportingModule.id)} re-exports '${name}' from both ${relativeId(reexportingModule.exportsAll[name])} and ${relativeId(additionalExportAllModule.exportsAll[name])} (will be ignored)`,
  33792. name,
  33793. reexporter: reexportingModule.id,
  33794. sources: [reexportingModule.exportsAll[name], additionalExportAllModule.exportsAll[name]]
  33795. };
  33796. }
  33797. function errNoTransformMapOrAstWithoutCode(pluginName) {
  33798. return {
  33799. code: Errors.NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE,
  33800. message: `The plugin "${pluginName}" returned a "map" or "ast" without returning ` +
  33801. 'a "code". This will be ignored.'
  33802. };
  33803. }
  33804. function errPreferNamedExports(facadeModuleId) {
  33805. const file = relativeId(facadeModuleId);
  33806. return {
  33807. code: Errors.PREFER_NAMED_EXPORTS,
  33808. id: facadeModuleId,
  33809. message: `Entry module "${file}" is implicitly using "default" export mode, which means for CommonJS output that its default export is assigned to "module.exports". For many tools, such CommonJS output will not be interchangeable with the original ES module. If this is intended, explicitly set "output.exports" to either "auto" or "default", otherwise you might want to consider changing the signature of "${file}" to use named exports only.`,
  33810. url: `https://rollupjs.org/guide/en/#outputexports`
  33811. };
  33812. }
  33813. function errSyntheticNamedExportsNeedNamespaceExport(id, syntheticNamedExportsOption) {
  33814. return {
  33815. code: Errors.SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT,
  33816. id,
  33817. message: `Module "${relativeId(id)}" that is marked with 'syntheticNamedExports: ${JSON.stringify(syntheticNamedExportsOption)}' needs ${typeof syntheticNamedExportsOption === 'string' && syntheticNamedExportsOption !== 'default'
  33818. ? `an export named "${syntheticNamedExportsOption}"`
  33819. : 'a default export'} that does not reexport an unresolved named export of the same module.`
  33820. };
  33821. }
  33822. function errUnexpectedNamedImport(id, imported, isReexport) {
  33823. const importType = isReexport ? 'reexport' : 'import';
  33824. return {
  33825. code: Errors.UNEXPECTED_NAMED_IMPORT,
  33826. id,
  33827. message: `The named export "${imported}" was ${importType}ed from the external module ${relativeId(id)} even though its interop type is "defaultOnly". Either remove or change this ${importType} or change the value of the "output.interop" option.`,
  33828. url: 'https://rollupjs.org/guide/en/#outputinterop'
  33829. };
  33830. }
  33831. function errUnexpectedNamespaceReexport(id) {
  33832. return {
  33833. code: Errors.UNEXPECTED_NAMED_IMPORT,
  33834. id,
  33835. message: `There was a namespace "*" reexport from the external module ${relativeId(id)} even though its interop type is "defaultOnly". This will be ignored as namespace reexports only reexport named exports. If this is not intended, either remove or change this reexport or change the value of the "output.interop" option.`,
  33836. url: 'https://rollupjs.org/guide/en/#outputinterop'
  33837. };
  33838. }
  33839. function errEntryCannotBeExternal(unresolvedId) {
  33840. return {
  33841. code: Errors.UNRESOLVED_ENTRY,
  33842. message: `Entry module cannot be external (${relativeId(unresolvedId)}).`
  33843. };
  33844. }
  33845. function errUnresolvedEntry(unresolvedId) {
  33846. return {
  33847. code: Errors.UNRESOLVED_ENTRY,
  33848. message: `Could not resolve entry module (${relativeId(unresolvedId)}).`
  33849. };
  33850. }
  33851. function errUnresolvedImport(source, importer) {
  33852. return {
  33853. code: Errors.UNRESOLVED_IMPORT,
  33854. message: `Could not resolve '${source}' from ${relativeId(importer)}`
  33855. };
  33856. }
  33857. function errUnresolvedImportTreatedAsExternal(source, importer) {
  33858. return {
  33859. code: Errors.UNRESOLVED_IMPORT,
  33860. importer: relativeId(importer),
  33861. message: `'${source}' is imported by ${relativeId(importer)}, but could not be resolved – treating it as an external dependency`,
  33862. source,
  33863. url: 'https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency'
  33864. };
  33865. }
  33866. function errExternalSyntheticExports(source, importer) {
  33867. return {
  33868. code: Errors.EXTERNAL_SYNTHETIC_EXPORTS,
  33869. importer: relativeId(importer),
  33870. message: `External '${source}' can not have 'syntheticNamedExports' enabled.`,
  33871. source
  33872. };
  33873. }
  33874. function errFailedValidation(message) {
  33875. return {
  33876. code: Errors.VALIDATION_ERROR,
  33877. message
  33878. };
  33879. }
  33880. function errAlreadyClosed() {
  33881. return {
  33882. code: Errors.ALREADY_CLOSED,
  33883. message: 'Bundle is already closed, no more calls to "generate" or "write" are allowed.'
  33884. };
  33885. }
  33886. function warnDeprecation(deprecation, activeDeprecation, options) {
  33887. warnDeprecationWithOptions(deprecation, activeDeprecation, options.onwarn, options.strictDeprecations);
  33888. }
  33889. function warnDeprecationWithOptions(deprecation, activeDeprecation, warn, strictDeprecations) {
  33890. if (activeDeprecation || strictDeprecations) {
  33891. const warning = errDeprecation(deprecation);
  33892. if (strictDeprecations) {
  33893. return error(warning);
  33894. }
  33895. warn(warning);
  33896. }
  33897. }
  33898. // Generate strings which dereference dotted properties, but use array notation `['prop-deref']`
  33899. // if the property name isn't trivial
  33900. const shouldUseDot = /^[a-zA-Z$_][a-zA-Z0-9$_]*$/;
  33901. function property(prop) {
  33902. return shouldUseDot.test(prop) ? `.${prop}` : `['${prop}']`;
  33903. }
  33904. function keypath(keypath) {
  33905. return keypath
  33906. .split('.')
  33907. .map(property)
  33908. .join('');
  33909. }
  33910. function setupNamespace(name, root, globals, compact) {
  33911. const _ = compact ? '' : ' ';
  33912. const parts = name.split('.');
  33913. parts[0] = (typeof globals === 'function' ? globals(parts[0]) : globals[parts[0]]) || parts[0];
  33914. parts.pop();
  33915. let acc = root;
  33916. return (parts
  33917. .map(part => ((acc += property(part)), `${acc}${_}=${_}${acc}${_}||${_}{}${compact ? '' : ';'}`))
  33918. .join(compact ? ',' : '\n') + (compact && parts.length ? ';' : '\n'));
  33919. }
  33920. function assignToDeepVariable(deepName, root, globals, compact, assignment) {
  33921. const _ = compact ? '' : ' ';
  33922. const parts = deepName.split('.');
  33923. parts[0] = (typeof globals === 'function' ? globals(parts[0]) : globals[parts[0]]) || parts[0];
  33924. const last = parts.pop();
  33925. let acc = root;
  33926. let deepAssignment = parts
  33927. .map(part => ((acc += property(part)), `${acc}${_}=${_}${acc}${_}||${_}{}`))
  33928. .concat(`${acc}${property(last)}`)
  33929. .join(`,${_}`)
  33930. .concat(`${_}=${_}${assignment}`);
  33931. if (parts.length > 0) {
  33932. deepAssignment = `(${deepAssignment})`;
  33933. }
  33934. return deepAssignment;
  33935. }
  33936. function trimEmptyImports(dependencies) {
  33937. let i = dependencies.length;
  33938. while (i--) {
  33939. const { imports, reexports } = dependencies[i];
  33940. if (imports || reexports) {
  33941. return dependencies.slice(0, i + 1);
  33942. }
  33943. }
  33944. return [];
  33945. }
  33946. const thisProp = (name) => `this${keypath(name)}`;
  33947. function iife(magicString, { accessedGlobals, dependencies, exports, hasExports, indentString: t, intro, namedExportsMode, outro, varOrConst, warn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
  33948. const _ = compact ? '' : ' ';
  33949. const s = compact ? '' : ';';
  33950. const n = compact ? '' : '\n';
  33951. const isNamespaced = name && name.indexOf('.') !== -1;
  33952. const useVariableAssignment = !extend && !isNamespaced;
  33953. if (name && useVariableAssignment && !isLegal(name)) {
  33954. return error({
  33955. code: 'ILLEGAL_IDENTIFIER_AS_NAME',
  33956. message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`
  33957. });
  33958. }
  33959. warnOnBuiltins(warn, dependencies);
  33960. const external = trimEmptyImports(dependencies);
  33961. const deps = external.map(dep => dep.globalName || 'null');
  33962. const args = external.map(m => m.name);
  33963. if (hasExports && !name) {
  33964. warn({
  33965. code: 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT',
  33966. message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.`
  33967. });
  33968. }
  33969. if (namedExportsMode && hasExports) {
  33970. if (extend) {
  33971. deps.unshift(`${thisProp(name)}${_}=${_}${thisProp(name)}${_}||${_}{}`);
  33972. args.unshift('exports');
  33973. }
  33974. else {
  33975. deps.unshift('{}');
  33976. args.unshift('exports');
  33977. }
  33978. }
  33979. const useStrict = strict ? `${t}'use strict';${n}` : '';
  33980. const interopBlock = getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t);
  33981. magicString.prepend(`${intro}${interopBlock}`);
  33982. let wrapperIntro = `(function${_}(${args.join(`,${_}`)})${_}{${n}${useStrict}${n}`;
  33983. if (hasExports) {
  33984. if (name && !(extend && namedExportsMode)) {
  33985. wrapperIntro =
  33986. (useVariableAssignment ? `${varOrConst} ${name}` : thisProp(name)) +
  33987. `${_}=${_}${wrapperIntro}`;
  33988. }
  33989. if (isNamespaced) {
  33990. wrapperIntro = setupNamespace(name, 'this', globals, compact) + wrapperIntro;
  33991. }
  33992. }
  33993. let wrapperOutro = `${n}${n}}(${deps.join(`,${_}`)}));`;
  33994. if (hasExports && !extend && namedExportsMode) {
  33995. wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
  33996. }
  33997. const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
  33998. let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, _, n);
  33999. if (namespaceMarkers) {
  34000. namespaceMarkers = n + n + namespaceMarkers;
  34001. }
  34002. magicString.append(`${exportBlock}${namespaceMarkers}${outro}`);
  34003. return magicString.indent(t).prepend(wrapperIntro).append(wrapperOutro);
  34004. }
  34005. function getStarExcludes({ dependencies, exports }) {
  34006. const starExcludes = new Set(exports.map(expt => expt.exported));
  34007. if (!starExcludes.has('default'))
  34008. starExcludes.add('default');
  34009. // also include reexport names
  34010. for (const { reexports } of dependencies) {
  34011. if (reexports) {
  34012. for (const reexport of reexports) {
  34013. if (reexport.imported !== '*' && !starExcludes.has(reexport.reexported))
  34014. starExcludes.add(reexport.reexported);
  34015. }
  34016. }
  34017. }
  34018. return starExcludes;
  34019. }
  34020. const getStarExcludesBlock = (starExcludes, varOrConst, _, t, n) => starExcludes
  34021. ? `${n}${t}${varOrConst} _starExcludes${_}=${_}{${_}${[...starExcludes]
  34022. .map(prop => `${prop}:${_}1`)
  34023. .join(`,${_}`)}${_}};`
  34024. : '';
  34025. const getImportBindingsBlock = (importBindings, _, t, n) => (importBindings.length ? `${n}${t}var ${importBindings.join(`,${_}`)};` : '');
  34026. function getExportsBlock(exports, _, t, n) {
  34027. if (exports.length === 0) {
  34028. return '';
  34029. }
  34030. if (exports.length === 1) {
  34031. return `${t}${t}${t}exports('${exports[0].name}',${_}${exports[0].value});${n}${n}`;
  34032. }
  34033. return (`${t}${t}${t}exports({${n}` +
  34034. exports.map(({ name, value }) => `${t}${t}${t}${t}${name}:${_}${value}`).join(`,${n}`) +
  34035. `${n}${t}${t}${t}});${n}${n}`);
  34036. }
  34037. const getHoistedExportsBlock = (exports, _, t, n) => getExportsBlock(exports
  34038. .filter(expt => expt.hoisted || expt.uninitialized)
  34039. .map(expt => ({ name: expt.exported, value: expt.uninitialized ? 'void 0' : expt.local })), _, t, n);
  34040. const getMissingExportsBlock = (exports, _, t, n) => getExportsBlock(exports
  34041. .filter(expt => expt.local === MISSING_EXPORT_SHIM_VARIABLE)
  34042. .map(expt => ({ name: expt.exported, value: MISSING_EXPORT_SHIM_VARIABLE })), _, t, n);
  34043. const getSyntheticExportsBlock = (exports, _, t, n) => getExportsBlock(exports
  34044. .filter(expt => expt.expression)
  34045. .map(expt => ({ name: expt.exported, value: expt.local })), _, t, n);
  34046. function system(magicString, { accessedGlobals, dependencies, exports, hasExports, indentString: t, intro, outro, usesTopLevelAwait, varOrConst }, options) {
  34047. const n = options.compact ? '' : '\n';
  34048. const _ = options.compact ? '' : ' ';
  34049. const dependencyIds = dependencies.map(m => `'${m.id}'`);
  34050. const importBindings = [];
  34051. let starExcludes;
  34052. const setters = [];
  34053. for (const { imports, reexports } of dependencies) {
  34054. const setter = [];
  34055. if (imports) {
  34056. for (const specifier of imports) {
  34057. importBindings.push(specifier.local);
  34058. if (specifier.imported === '*') {
  34059. setter.push(`${specifier.local}${_}=${_}module;`);
  34060. }
  34061. else {
  34062. setter.push(`${specifier.local}${_}=${_}module.${specifier.imported};`);
  34063. }
  34064. }
  34065. }
  34066. if (reexports) {
  34067. let createdSetter = false;
  34068. // bulk-reexport form
  34069. if (reexports.length > 1 ||
  34070. (reexports.length === 1 &&
  34071. (reexports[0].reexported === '*' || reexports[0].imported === '*'))) {
  34072. // star reexports
  34073. for (const specifier of reexports) {
  34074. if (specifier.reexported !== '*')
  34075. continue;
  34076. // need own exports list for deduping in star export case
  34077. if (!starExcludes) {
  34078. starExcludes = getStarExcludes({ dependencies, exports });
  34079. }
  34080. if (!createdSetter) {
  34081. setter.push(`${varOrConst} _setter${_}=${_}{};`);
  34082. createdSetter = true;
  34083. }
  34084. setter.push(`for${_}(var _$p${_}in${_}module)${_}{`);
  34085. setter.push(`${t}if${_}(!_starExcludes[_$p])${_}_setter[_$p]${_}=${_}module[_$p];`);
  34086. setter.push('}');
  34087. }
  34088. // star import reexport
  34089. for (const specifier of reexports) {
  34090. if (specifier.imported !== '*' || specifier.reexported === '*')
  34091. continue;
  34092. setter.push(`exports('${specifier.reexported}',${_}module);`);
  34093. }
  34094. // reexports
  34095. for (const specifier of reexports) {
  34096. if (specifier.reexported === '*' || specifier.imported === '*')
  34097. continue;
  34098. if (!createdSetter) {
  34099. setter.push(`${varOrConst} _setter${_}=${_}{};`);
  34100. createdSetter = true;
  34101. }
  34102. setter.push(`_setter.${specifier.reexported}${_}=${_}module.${specifier.imported};`);
  34103. }
  34104. if (createdSetter) {
  34105. setter.push('exports(_setter);');
  34106. }
  34107. }
  34108. else {
  34109. // single reexport
  34110. for (const specifier of reexports) {
  34111. setter.push(`exports('${specifier.reexported}',${_}module.${specifier.imported});`);
  34112. }
  34113. }
  34114. }
  34115. setters.push(setter.join(`${n}${t}${t}${t}`));
  34116. }
  34117. const registeredName = options.name ? `'${options.name}',${_}` : '';
  34118. const wrapperParams = accessedGlobals.has('module')
  34119. ? `exports,${_}module`
  34120. : hasExports
  34121. ? 'exports'
  34122. : '';
  34123. let wrapperStart = `System.register(${registeredName}[` +
  34124. dependencyIds.join(`,${_}`) +
  34125. `],${_}function${_}(${wrapperParams})${_}{${n}${t}${options.strict ? "'use strict';" : ''}` +
  34126. getStarExcludesBlock(starExcludes, varOrConst, _, t, n) +
  34127. getImportBindingsBlock(importBindings, _, t, n) +
  34128. `${n}${t}return${_}{${setters.length
  34129. ? `${n}${t}${t}setters:${_}[${setters
  34130. .map(s => s
  34131. ? `function${_}(module)${_}{${n}${t}${t}${t}${s}${n}${t}${t}}`
  34132. : options.systemNullSetters
  34133. ? `null`
  34134. : `function${_}()${_}{}`)
  34135. .join(`,${_}`)}],`
  34136. : ''}${n}`;
  34137. wrapperStart +=
  34138. `${t}${t}execute:${_}${usesTopLevelAwait ? `async${_}` : ''}function${_}()${_}{${n}${n}` +
  34139. getHoistedExportsBlock(exports, _, t, n);
  34140. const wrapperEnd = `${n}${n}` +
  34141. getSyntheticExportsBlock(exports, _, t, n) +
  34142. getMissingExportsBlock(exports, _, t, n) +
  34143. `${t}${t}}${n}${t}}${options.compact ? '' : ';'}${n}});`;
  34144. if (intro)
  34145. magicString.prepend(intro);
  34146. if (outro)
  34147. magicString.append(outro);
  34148. return magicString.indent(`${t}${t}${t}`).append(wrapperEnd).prepend(wrapperStart);
  34149. }
  34150. function globalProp(name, globalVar) {
  34151. if (!name)
  34152. return 'null';
  34153. return `${globalVar}${keypath(name)}`;
  34154. }
  34155. function safeAccess(name, globalVar, _) {
  34156. const parts = name.split('.');
  34157. let acc = globalVar;
  34158. return parts.map(part => (acc += property(part))).join(`${_}&&${_}`);
  34159. }
  34160. function umd(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indentString: t, intro, namedExportsMode, outro, varOrConst, warn }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, namespaceToStringTag, globals, noConflict, strict }) {
  34161. const _ = compact ? '' : ' ';
  34162. const n = compact ? '' : '\n';
  34163. const s = compact ? '' : ';';
  34164. const factoryVar = compact ? 'f' : 'factory';
  34165. const globalVar = compact ? 'g' : 'global';
  34166. if (hasExports && !name) {
  34167. return error({
  34168. code: 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT',
  34169. message: 'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.'
  34170. });
  34171. }
  34172. warnOnBuiltins(warn, dependencies);
  34173. const amdDeps = dependencies.map(m => `'${removeExtensionFromRelativeAmdId(m.id)}'`);
  34174. const cjsDeps = dependencies.map(m => `require('${m.id}')`);
  34175. const trimmedImports = trimEmptyImports(dependencies);
  34176. const globalDeps = trimmedImports.map(module => globalProp(module.globalName, globalVar));
  34177. const factoryArgs = trimmedImports.map(m => m.name);
  34178. if (namedExportsMode && (hasExports || noConflict)) {
  34179. amdDeps.unshift(`'exports'`);
  34180. cjsDeps.unshift(`exports`);
  34181. globalDeps.unshift(assignToDeepVariable(name, globalVar, globals, compact, `${extend ? `${globalProp(name, globalVar)}${_}||${_}` : ''}{}`));
  34182. factoryArgs.unshift('exports');
  34183. }
  34184. const completeAmdId = getCompleteAmdId(amd, id);
  34185. const amdParams = (completeAmdId ? `'${completeAmdId}',${_}` : ``) +
  34186. (amdDeps.length ? `[${amdDeps.join(`,${_}`)}],${_}` : ``);
  34187. const define = amd.define;
  34188. const cjsExport = !namedExportsMode && hasExports ? `module.exports${_}=${_}` : ``;
  34189. const useStrict = strict ? `${_}'use strict';${n}` : ``;
  34190. let iifeExport;
  34191. if (noConflict) {
  34192. const noConflictExportsVar = compact ? 'e' : 'exports';
  34193. let factory;
  34194. if (!namedExportsMode && hasExports) {
  34195. factory = `var ${noConflictExportsVar}${_}=${_}${assignToDeepVariable(name, globalVar, globals, compact, `${factoryVar}(${globalDeps.join(`,${_}`)})`)};`;
  34196. }
  34197. else {
  34198. const module = globalDeps.shift();
  34199. factory =
  34200. `var ${noConflictExportsVar}${_}=${_}${module};${n}` +
  34201. `${t}${t}${factoryVar}(${[noConflictExportsVar].concat(globalDeps).join(`,${_}`)});`;
  34202. }
  34203. iifeExport =
  34204. `(function${_}()${_}{${n}` +
  34205. `${t}${t}var current${_}=${_}${safeAccess(name, globalVar, _)};${n}` +
  34206. `${t}${t}${factory}${n}` +
  34207. `${t}${t}${noConflictExportsVar}.noConflict${_}=${_}function${_}()${_}{${_}` +
  34208. `${globalProp(name, globalVar)}${_}=${_}current;${_}return ${noConflictExportsVar}${compact ? '' : '; '}};${n}` +
  34209. `${t}}())`;
  34210. }
  34211. else {
  34212. iifeExport = `${factoryVar}(${globalDeps.join(`,${_}`)})`;
  34213. if (!namedExportsMode && hasExports) {
  34214. iifeExport = assignToDeepVariable(name, globalVar, globals, compact, iifeExport);
  34215. }
  34216. }
  34217. const iifeNeedsGlobal = hasExports || (noConflict && namedExportsMode) || globalDeps.length > 0;
  34218. const globalParam = iifeNeedsGlobal ? `${globalVar},${_}` : '';
  34219. const globalArg = iifeNeedsGlobal ? `this,${_}` : '';
  34220. const iifeStart = iifeNeedsGlobal
  34221. ? `(${globalVar}${_}=${_}typeof globalThis${_}!==${_}'undefined'${_}?${_}globalThis${_}:${_}${globalVar}${_}||${_}self,${_}`
  34222. : '';
  34223. const iifeEnd = iifeNeedsGlobal ? ')' : '';
  34224. const cjsIntro = iifeNeedsGlobal
  34225. ? `${t}typeof exports${_}===${_}'object'${_}&&${_}typeof module${_}!==${_}'undefined'${_}?` +
  34226. `${_}${cjsExport}${factoryVar}(${cjsDeps.join(`,${_}`)})${_}:${n}`
  34227. : '';
  34228. // factory function should be wrapped by parentheses to avoid lazy parsing
  34229. const wrapperIntro = `(function${_}(${globalParam}${factoryVar})${_}{${n}` +
  34230. cjsIntro +
  34231. `${t}typeof ${define}${_}===${_}'function'${_}&&${_}${define}.amd${_}?${_}${define}(${amdParams}${factoryVar})${_}:${n}` +
  34232. `${t}${iifeStart}${iifeExport}${iifeEnd};${n}` +
  34233. `}(${globalArg}(function${_}(${factoryArgs.join(', ')})${_}{${useStrict}${n}`;
  34234. const wrapperOutro = n + n + '})));';
  34235. magicString.prepend(`${intro}${getInteropBlock(dependencies, varOrConst, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, _, n, s, t)}`);
  34236. const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, compact, t, externalLiveBindings);
  34237. let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, _, n);
  34238. if (namespaceMarkers) {
  34239. namespaceMarkers = n + n + namespaceMarkers;
  34240. }
  34241. magicString.append(`${exportBlock}${namespaceMarkers}${outro}`);
  34242. return magicString.trim().indent(t).append(wrapperOutro).prepend(wrapperIntro);
  34243. }
  34244. var finalisers = { system, amd, cjs, es, iife, umd };
  34245. const extractors = {
  34246. ArrayPattern(names, param) {
  34247. for (const element of param.elements) {
  34248. if (element)
  34249. extractors[element.type](names, element);
  34250. }
  34251. },
  34252. AssignmentPattern(names, param) {
  34253. extractors[param.left.type](names, param.left);
  34254. },
  34255. Identifier(names, param) {
  34256. names.push(param.name);
  34257. },
  34258. MemberExpression() { },
  34259. ObjectPattern(names, param) {
  34260. for (const prop of param.properties) {
  34261. if (prop.type === 'RestElement') {
  34262. extractors.RestElement(names, prop);
  34263. }
  34264. else {
  34265. extractors[prop.value.type](names, prop.value);
  34266. }
  34267. }
  34268. },
  34269. RestElement(names, param) {
  34270. extractors[param.argument.type](names, param.argument);
  34271. }
  34272. };
  34273. const extractAssignedNames = function extractAssignedNames(param) {
  34274. const names = [];
  34275. extractors[param.type](names, param);
  34276. return names;
  34277. };
  34278. class ExportAllDeclaration extends NodeBase {
  34279. hasEffects() {
  34280. return false;
  34281. }
  34282. initialise() {
  34283. this.context.addExport(this);
  34284. }
  34285. render(code, _options, nodeRenderOptions) {
  34286. code.remove(nodeRenderOptions.start, nodeRenderOptions.end);
  34287. }
  34288. }
  34289. ExportAllDeclaration.prototype.needsBoundaries = true;
  34290. class ArrayExpression extends NodeBase {
  34291. bind() {
  34292. super.bind();
  34293. for (const element of this.elements) {
  34294. if (element !== null)
  34295. element.deoptimizePath(UNKNOWN_PATH);
  34296. }
  34297. }
  34298. getReturnExpressionWhenCalledAtPath(path) {
  34299. if (path.length !== 1)
  34300. return UNKNOWN_EXPRESSION;
  34301. return getMemberReturnExpressionWhenCalled(arrayMembers, path[0]);
  34302. }
  34303. hasEffectsWhenAccessedAtPath(path) {
  34304. return path.length > 1;
  34305. }
  34306. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  34307. if (path.length === 1) {
  34308. return hasMemberEffectWhenCalled(arrayMembers, path[0], this.included, callOptions, context);
  34309. }
  34310. return true;
  34311. }
  34312. }
  34313. class ArrayPattern extends NodeBase {
  34314. addExportedVariables(variables, exportNamesByVariable) {
  34315. for (const element of this.elements) {
  34316. if (element !== null) {
  34317. element.addExportedVariables(variables, exportNamesByVariable);
  34318. }
  34319. }
  34320. }
  34321. declare(kind) {
  34322. const variables = [];
  34323. for (const element of this.elements) {
  34324. if (element !== null) {
  34325. variables.push(...element.declare(kind, UNKNOWN_EXPRESSION));
  34326. }
  34327. }
  34328. return variables;
  34329. }
  34330. deoptimizePath(path) {
  34331. if (path.length === 0) {
  34332. for (const element of this.elements) {
  34333. if (element !== null) {
  34334. element.deoptimizePath(path);
  34335. }
  34336. }
  34337. }
  34338. }
  34339. hasEffectsWhenAssignedAtPath(path, context) {
  34340. if (path.length > 0)
  34341. return true;
  34342. for (const element of this.elements) {
  34343. if (element !== null && element.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context))
  34344. return true;
  34345. }
  34346. return false;
  34347. }
  34348. }
  34349. class BlockScope extends ChildScope {
  34350. addDeclaration(identifier, context, init, isHoisted) {
  34351. if (isHoisted) {
  34352. return this.parent.addDeclaration(identifier, context, UNKNOWN_EXPRESSION, isHoisted);
  34353. }
  34354. else {
  34355. return super.addDeclaration(identifier, context, init, false);
  34356. }
  34357. }
  34358. }
  34359. class ExpressionStatement extends NodeBase {
  34360. initialise() {
  34361. if (this.directive &&
  34362. this.directive !== 'use strict' &&
  34363. this.parent.type === Program$1) {
  34364. this.context.warn(
  34365. // This is necessary, because either way (deleting or not) can lead to errors.
  34366. {
  34367. code: 'MODULE_LEVEL_DIRECTIVE',
  34368. message: `Module level directives cause errors when bundled, '${this.directive}' was ignored.`
  34369. }, this.start);
  34370. }
  34371. }
  34372. render(code, options) {
  34373. super.render(code, options);
  34374. if (this.included)
  34375. this.insertSemicolon(code);
  34376. }
  34377. shouldBeIncluded(context) {
  34378. if (this.directive && this.directive !== 'use strict')
  34379. return this.parent.type !== Program$1;
  34380. return super.shouldBeIncluded(context);
  34381. }
  34382. }
  34383. class BlockStatement extends NodeBase {
  34384. constructor() {
  34385. super(...arguments);
  34386. this.directlyIncluded = false;
  34387. }
  34388. addImplicitReturnExpressionToScope() {
  34389. const lastStatement = this.body[this.body.length - 1];
  34390. if (!lastStatement || lastStatement.type !== ReturnStatement$1) {
  34391. this.scope.addReturnExpression(UNKNOWN_EXPRESSION);
  34392. }
  34393. }
  34394. createScope(parentScope) {
  34395. this.scope = this.parent.preventChildBlockScope
  34396. ? parentScope
  34397. : new BlockScope(parentScope);
  34398. }
  34399. hasEffects(context) {
  34400. if (this.deoptimizeBody)
  34401. return true;
  34402. for (const node of this.body) {
  34403. if (node.hasEffects(context))
  34404. return true;
  34405. if (context.brokenFlow)
  34406. break;
  34407. }
  34408. return false;
  34409. }
  34410. include(context, includeChildrenRecursively) {
  34411. if (!this.deoptimizeBody || !this.directlyIncluded) {
  34412. this.included = true;
  34413. this.directlyIncluded = true;
  34414. if (this.deoptimizeBody)
  34415. includeChildrenRecursively = true;
  34416. for (const node of this.body) {
  34417. if (includeChildrenRecursively || node.shouldBeIncluded(context))
  34418. node.include(context, includeChildrenRecursively);
  34419. }
  34420. }
  34421. }
  34422. initialise() {
  34423. const firstBodyStatement = this.body[0];
  34424. this.deoptimizeBody =
  34425. firstBodyStatement instanceof ExpressionStatement &&
  34426. firstBodyStatement.directive === 'use asm';
  34427. }
  34428. render(code, options) {
  34429. if (this.body.length) {
  34430. renderStatementList(this.body, code, this.start + 1, this.end - 1, options);
  34431. }
  34432. else {
  34433. super.render(code, options);
  34434. }
  34435. }
  34436. }
  34437. class ArrowFunctionExpression extends NodeBase {
  34438. createScope(parentScope) {
  34439. this.scope = new ReturnValueScope(parentScope, this.context);
  34440. }
  34441. deoptimizePath(path) {
  34442. // A reassignment of UNKNOWN_PATH is considered equivalent to having lost track
  34443. // which means the return expression needs to be reassigned
  34444. if (path.length === 1 && path[0] === UnknownKey) {
  34445. this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
  34446. }
  34447. }
  34448. getReturnExpressionWhenCalledAtPath(path) {
  34449. return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
  34450. }
  34451. hasEffects() {
  34452. return false;
  34453. }
  34454. hasEffectsWhenAccessedAtPath(path) {
  34455. return path.length > 1;
  34456. }
  34457. hasEffectsWhenAssignedAtPath(path) {
  34458. return path.length > 1;
  34459. }
  34460. hasEffectsWhenCalledAtPath(path, _callOptions, context) {
  34461. if (path.length > 0)
  34462. return true;
  34463. for (const param of this.params) {
  34464. if (param.hasEffects(context))
  34465. return true;
  34466. }
  34467. const { ignore, brokenFlow } = context;
  34468. context.ignore = {
  34469. breaks: false,
  34470. continues: false,
  34471. labels: new Set(),
  34472. returnAwaitYield: true
  34473. };
  34474. if (this.body.hasEffects(context))
  34475. return true;
  34476. context.ignore = ignore;
  34477. context.brokenFlow = brokenFlow;
  34478. return false;
  34479. }
  34480. include(context, includeChildrenRecursively) {
  34481. this.included = true;
  34482. for (const param of this.params) {
  34483. if (!(param instanceof Identifier)) {
  34484. param.include(context, includeChildrenRecursively);
  34485. }
  34486. }
  34487. const { brokenFlow } = context;
  34488. context.brokenFlow = BROKEN_FLOW_NONE;
  34489. this.body.include(context, includeChildrenRecursively);
  34490. context.brokenFlow = brokenFlow;
  34491. }
  34492. includeCallArguments(context, args) {
  34493. this.scope.includeCallArguments(context, args);
  34494. }
  34495. initialise() {
  34496. this.scope.addParameterVariables(this.params.map(param => param.declare('parameter', UNKNOWN_EXPRESSION)), this.params[this.params.length - 1] instanceof RestElement);
  34497. if (this.body instanceof BlockStatement) {
  34498. this.body.addImplicitReturnExpressionToScope();
  34499. }
  34500. else {
  34501. this.scope.addReturnExpression(this.body);
  34502. }
  34503. }
  34504. parseNode(esTreeNode) {
  34505. if (esTreeNode.body.type === BlockStatement$1) {
  34506. this.body = new this.context.nodeConstructors.BlockStatement(esTreeNode.body, this, this.scope.hoistedBodyVarScope);
  34507. }
  34508. super.parseNode(esTreeNode);
  34509. }
  34510. }
  34511. ArrowFunctionExpression.prototype.preventChildBlockScope = true;
  34512. class AssignmentExpression extends NodeBase {
  34513. constructor() {
  34514. super(...arguments);
  34515. this.deoptimized = false;
  34516. }
  34517. hasEffects(context) {
  34518. if (!this.deoptimized)
  34519. this.applyDeoptimizations();
  34520. return (this.right.hasEffects(context) ||
  34521. this.left.hasEffects(context) ||
  34522. this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context));
  34523. }
  34524. hasEffectsWhenAccessedAtPath(path, context) {
  34525. return path.length > 0 && this.right.hasEffectsWhenAccessedAtPath(path, context);
  34526. }
  34527. include(context, includeChildrenRecursively) {
  34528. if (!this.deoptimized)
  34529. this.applyDeoptimizations();
  34530. this.included = true;
  34531. let hasEffectsContext;
  34532. if (includeChildrenRecursively ||
  34533. this.operator !== '=' ||
  34534. this.left.included ||
  34535. ((hasEffectsContext = createHasEffectsContext()),
  34536. this.left.hasEffects(hasEffectsContext) ||
  34537. this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, hasEffectsContext))) {
  34538. this.left.include(context, includeChildrenRecursively);
  34539. }
  34540. this.right.include(context, includeChildrenRecursively);
  34541. }
  34542. render(code, options, { preventASI, renderedParentType } = BLANK) {
  34543. if (this.left.included) {
  34544. this.left.render(code, options);
  34545. this.right.render(code, options);
  34546. }
  34547. else {
  34548. const inclusionStart = findNonWhiteSpace(code.original, findFirstOccurrenceOutsideComment(code.original, '=', this.left.end) + 1);
  34549. code.remove(this.start, inclusionStart);
  34550. if (preventASI) {
  34551. removeLineBreaks(code, inclusionStart, this.right.start);
  34552. }
  34553. this.right.render(code, options, {
  34554. renderedParentType: renderedParentType || this.parent.type
  34555. });
  34556. }
  34557. if (options.format === 'system') {
  34558. const exportNames = this.left.variable && options.exportNamesByVariable.get(this.left.variable);
  34559. if (this.left.type === 'Identifier' && exportNames) {
  34560. const _ = options.compact ? '' : ' ';
  34561. const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
  34562. const operation = this.operator.length > 1 ? `${exportNames[0]}${_}${this.operator.slice(0, -1)}${_}` : '';
  34563. code.overwrite(operatorPos, findNonWhiteSpace(code.original, operatorPos + this.operator.length), `=${_}${exportNames.length === 1
  34564. ? `exports('${exportNames[0]}',${_}`
  34565. : getSystemExportFunctionLeft([this.left.variable], false, options)}${operation}`);
  34566. code.appendLeft(this.right.end, ')');
  34567. }
  34568. else {
  34569. const systemPatternExports = [];
  34570. this.left.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
  34571. if (systemPatternExports.length > 0) {
  34572. code.prependRight(this.start, `(${getSystemExportFunctionLeft(systemPatternExports, true, options)}`);
  34573. code.appendLeft(this.end, '))');
  34574. }
  34575. }
  34576. }
  34577. }
  34578. applyDeoptimizations() {
  34579. this.deoptimized = true;
  34580. this.left.deoptimizePath(EMPTY_PATH);
  34581. this.right.deoptimizePath(UNKNOWN_PATH);
  34582. }
  34583. }
  34584. class AssignmentPattern extends NodeBase {
  34585. addExportedVariables(variables, exportNamesByVariable) {
  34586. this.left.addExportedVariables(variables, exportNamesByVariable);
  34587. }
  34588. bind() {
  34589. super.bind();
  34590. this.left.deoptimizePath(EMPTY_PATH);
  34591. this.right.deoptimizePath(UNKNOWN_PATH);
  34592. }
  34593. declare(kind, init) {
  34594. return this.left.declare(kind, init);
  34595. }
  34596. deoptimizePath(path) {
  34597. path.length === 0 && this.left.deoptimizePath(path);
  34598. }
  34599. hasEffectsWhenAssignedAtPath(path, context) {
  34600. return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
  34601. }
  34602. render(code, options, { isShorthandProperty } = BLANK) {
  34603. this.left.render(code, options, { isShorthandProperty });
  34604. this.right.render(code, options);
  34605. }
  34606. }
  34607. class AwaitExpression extends NodeBase {
  34608. hasEffects(context) {
  34609. return !context.ignore.returnAwaitYield || this.argument.hasEffects(context);
  34610. }
  34611. include(context, includeChildrenRecursively) {
  34612. if (!this.included) {
  34613. this.included = true;
  34614. checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
  34615. let parent = this.parent;
  34616. do {
  34617. if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
  34618. break checkTopLevelAwait;
  34619. } while ((parent = parent.parent));
  34620. this.context.usesTopLevelAwait = true;
  34621. }
  34622. }
  34623. this.argument.include(context, includeChildrenRecursively);
  34624. }
  34625. }
  34626. const binaryOperators = {
  34627. '!=': (left, right) => left != right,
  34628. '!==': (left, right) => left !== right,
  34629. '%': (left, right) => left % right,
  34630. '&': (left, right) => left & right,
  34631. '*': (left, right) => left * right,
  34632. // At the moment, "**" will be transpiled to Math.pow
  34633. '**': (left, right) => left ** right,
  34634. '+': (left, right) => left + right,
  34635. '-': (left, right) => left - right,
  34636. '/': (left, right) => left / right,
  34637. '<': (left, right) => left < right,
  34638. '<<': (left, right) => left << right,
  34639. '<=': (left, right) => left <= right,
  34640. '==': (left, right) => left == right,
  34641. '===': (left, right) => left === right,
  34642. '>': (left, right) => left > right,
  34643. '>=': (left, right) => left >= right,
  34644. '>>': (left, right) => left >> right,
  34645. '>>>': (left, right) => left >>> right,
  34646. '^': (left, right) => left ^ right,
  34647. in: () => UnknownValue,
  34648. instanceof: () => UnknownValue,
  34649. '|': (left, right) => left | right
  34650. };
  34651. class BinaryExpression extends NodeBase {
  34652. deoptimizeCache() { }
  34653. getLiteralValueAtPath(path, recursionTracker, origin) {
  34654. if (path.length > 0)
  34655. return UnknownValue;
  34656. const leftValue = this.left.getLiteralValueAtPath(EMPTY_PATH, recursionTracker, origin);
  34657. if (leftValue === UnknownValue)
  34658. return UnknownValue;
  34659. const rightValue = this.right.getLiteralValueAtPath(EMPTY_PATH, recursionTracker, origin);
  34660. if (rightValue === UnknownValue)
  34661. return UnknownValue;
  34662. const operatorFn = binaryOperators[this.operator];
  34663. if (!operatorFn)
  34664. return UnknownValue;
  34665. return operatorFn(leftValue, rightValue);
  34666. }
  34667. hasEffects(context) {
  34668. // support some implicit type coercion runtime errors
  34669. if (this.operator === '+' &&
  34670. this.parent instanceof ExpressionStatement &&
  34671. this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) === '')
  34672. return true;
  34673. return super.hasEffects(context);
  34674. }
  34675. hasEffectsWhenAccessedAtPath(path) {
  34676. return path.length > 1;
  34677. }
  34678. }
  34679. class BreakStatement extends NodeBase {
  34680. hasEffects(context) {
  34681. if (this.label) {
  34682. if (!context.ignore.labels.has(this.label.name))
  34683. return true;
  34684. context.includedLabels.add(this.label.name);
  34685. context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
  34686. }
  34687. else {
  34688. if (!context.ignore.breaks)
  34689. return true;
  34690. context.brokenFlow = BROKEN_FLOW_BREAK_CONTINUE;
  34691. }
  34692. return false;
  34693. }
  34694. include(context) {
  34695. this.included = true;
  34696. if (this.label) {
  34697. this.label.include();
  34698. context.includedLabels.add(this.label.name);
  34699. }
  34700. context.brokenFlow = this.label ? BROKEN_FLOW_ERROR_RETURN_LABEL : BROKEN_FLOW_BREAK_CONTINUE;
  34701. }
  34702. }
  34703. class Literal extends NodeBase {
  34704. getLiteralValueAtPath(path) {
  34705. if (path.length > 0 ||
  34706. // unknown literals can also be null but do not start with an "n"
  34707. (this.value === null && this.context.code.charCodeAt(this.start) !== 110) ||
  34708. typeof this.value === 'bigint' ||
  34709. // to support shims for regular expressions
  34710. this.context.code.charCodeAt(this.start) === 47) {
  34711. return UnknownValue;
  34712. }
  34713. return this.value;
  34714. }
  34715. getReturnExpressionWhenCalledAtPath(path) {
  34716. if (path.length !== 1)
  34717. return UNKNOWN_EXPRESSION;
  34718. return getMemberReturnExpressionWhenCalled(this.members, path[0]);
  34719. }
  34720. hasEffectsWhenAccessedAtPath(path) {
  34721. if (this.value === null) {
  34722. return path.length > 0;
  34723. }
  34724. return path.length > 1;
  34725. }
  34726. hasEffectsWhenAssignedAtPath(path) {
  34727. return path.length > 0;
  34728. }
  34729. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  34730. if (path.length === 1) {
  34731. return hasMemberEffectWhenCalled(this.members, path[0], this.included, callOptions, context);
  34732. }
  34733. return true;
  34734. }
  34735. initialise() {
  34736. this.members = getLiteralMembersForValue(this.value);
  34737. }
  34738. parseNode(esTreeNode) {
  34739. this.value = esTreeNode.value;
  34740. this.regex = esTreeNode.regex;
  34741. super.parseNode(esTreeNode);
  34742. }
  34743. render(code) {
  34744. if (typeof this.value === 'string') {
  34745. code.indentExclusionRanges.push([this.start + 1, this.end - 1]);
  34746. }
  34747. }
  34748. }
  34749. function getResolvablePropertyKey(memberExpression) {
  34750. return memberExpression.computed
  34751. ? getResolvableComputedPropertyKey(memberExpression.property)
  34752. : memberExpression.property.name;
  34753. }
  34754. function getResolvableComputedPropertyKey(propertyKey) {
  34755. if (propertyKey instanceof Literal) {
  34756. return String(propertyKey.value);
  34757. }
  34758. return null;
  34759. }
  34760. function getPathIfNotComputed(memberExpression) {
  34761. const nextPathKey = memberExpression.propertyKey;
  34762. const object = memberExpression.object;
  34763. if (typeof nextPathKey === 'string') {
  34764. if (object instanceof Identifier) {
  34765. return [
  34766. { key: object.name, pos: object.start },
  34767. { key: nextPathKey, pos: memberExpression.property.start }
  34768. ];
  34769. }
  34770. if (object instanceof MemberExpression) {
  34771. const parentPath = getPathIfNotComputed(object);
  34772. return (parentPath && [...parentPath, { key: nextPathKey, pos: memberExpression.property.start }]);
  34773. }
  34774. }
  34775. return null;
  34776. }
  34777. function getStringFromPath(path) {
  34778. let pathString = path[0].key;
  34779. for (let index = 1; index < path.length; index++) {
  34780. pathString += '.' + path[index].key;
  34781. }
  34782. return pathString;
  34783. }
  34784. class MemberExpression extends NodeBase {
  34785. constructor() {
  34786. super(...arguments);
  34787. this.variable = null;
  34788. this.bound = false;
  34789. this.expressionsToBeDeoptimized = [];
  34790. this.replacement = null;
  34791. this.wasPathDeoptimizedWhileOptimized = false;
  34792. }
  34793. bind() {
  34794. if (this.bound)
  34795. return;
  34796. this.bound = true;
  34797. const path = getPathIfNotComputed(this);
  34798. const baseVariable = path && this.scope.findVariable(path[0].key);
  34799. if (baseVariable && baseVariable.isNamespace) {
  34800. const resolvedVariable = this.resolveNamespaceVariables(baseVariable, path.slice(1));
  34801. if (!resolvedVariable) {
  34802. super.bind();
  34803. }
  34804. else if (typeof resolvedVariable === 'string') {
  34805. this.replacement = resolvedVariable;
  34806. }
  34807. else {
  34808. this.variable = resolvedVariable;
  34809. this.scope.addNamespaceMemberAccess(getStringFromPath(path), resolvedVariable);
  34810. }
  34811. }
  34812. else {
  34813. super.bind();
  34814. // ensure the propertyKey is set for the tree-shaking passes
  34815. this.getPropertyKey();
  34816. }
  34817. }
  34818. deoptimizeCache() {
  34819. const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
  34820. this.expressionsToBeDeoptimized = [];
  34821. this.propertyKey = UnknownKey;
  34822. if (this.wasPathDeoptimizedWhileOptimized) {
  34823. this.object.deoptimizePath(UNKNOWN_PATH);
  34824. }
  34825. for (const expression of expressionsToBeDeoptimized) {
  34826. expression.deoptimizeCache();
  34827. }
  34828. }
  34829. deoptimizePath(path) {
  34830. if (!this.bound)
  34831. this.bind();
  34832. if (path.length === 0)
  34833. this.disallowNamespaceReassignment();
  34834. if (this.variable) {
  34835. this.variable.deoptimizePath(path);
  34836. }
  34837. else {
  34838. const propertyKey = this.getPropertyKey();
  34839. if (propertyKey === UnknownKey) {
  34840. this.object.deoptimizePath(UNKNOWN_PATH);
  34841. }
  34842. else {
  34843. this.wasPathDeoptimizedWhileOptimized = true;
  34844. this.object.deoptimizePath([propertyKey, ...path]);
  34845. }
  34846. }
  34847. }
  34848. getLiteralValueAtPath(path, recursionTracker, origin) {
  34849. if (!this.bound)
  34850. this.bind();
  34851. if (this.variable !== null) {
  34852. return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
  34853. }
  34854. this.expressionsToBeDeoptimized.push(origin);
  34855. return this.object.getLiteralValueAtPath([this.getPropertyKey(), ...path], recursionTracker, origin);
  34856. }
  34857. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  34858. if (!this.bound)
  34859. this.bind();
  34860. if (this.variable !== null) {
  34861. return this.variable.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  34862. }
  34863. this.expressionsToBeDeoptimized.push(origin);
  34864. return this.object.getReturnExpressionWhenCalledAtPath([this.getPropertyKey(), ...path], recursionTracker, origin);
  34865. }
  34866. hasEffects(context) {
  34867. const propertyReadSideEffects = this.context.options.treeshake
  34868. .propertyReadSideEffects;
  34869. return (propertyReadSideEffects === 'always' ||
  34870. this.property.hasEffects(context) ||
  34871. this.object.hasEffects(context) ||
  34872. (propertyReadSideEffects &&
  34873. this.object.hasEffectsWhenAccessedAtPath([this.propertyKey], context)));
  34874. }
  34875. hasEffectsWhenAccessedAtPath(path, context) {
  34876. if (path.length === 0)
  34877. return false;
  34878. if (this.variable !== null) {
  34879. return this.variable.hasEffectsWhenAccessedAtPath(path, context);
  34880. }
  34881. return this.object.hasEffectsWhenAccessedAtPath([this.propertyKey, ...path], context);
  34882. }
  34883. hasEffectsWhenAssignedAtPath(path, context) {
  34884. if (this.variable !== null) {
  34885. return this.variable.hasEffectsWhenAssignedAtPath(path, context);
  34886. }
  34887. return this.object.hasEffectsWhenAssignedAtPath([this.propertyKey, ...path], context);
  34888. }
  34889. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  34890. if (this.variable !== null) {
  34891. return this.variable.hasEffectsWhenCalledAtPath(path, callOptions, context);
  34892. }
  34893. return this.object.hasEffectsWhenCalledAtPath([this.propertyKey, ...path], callOptions, context);
  34894. }
  34895. include(context, includeChildrenRecursively) {
  34896. if (!this.included) {
  34897. this.included = true;
  34898. if (this.variable !== null) {
  34899. this.context.includeVariableInModule(this.variable);
  34900. }
  34901. }
  34902. this.object.include(context, includeChildrenRecursively);
  34903. this.property.include(context, includeChildrenRecursively);
  34904. }
  34905. includeCallArguments(context, args) {
  34906. if (this.variable) {
  34907. this.variable.includeCallArguments(context, args);
  34908. }
  34909. else {
  34910. super.includeCallArguments(context, args);
  34911. }
  34912. }
  34913. initialise() {
  34914. this.propertyKey = getResolvablePropertyKey(this);
  34915. }
  34916. render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
  34917. const isCalleeOfDifferentParent = renderedParentType === CallExpression$1 && isCalleeOfRenderedParent;
  34918. if (this.variable || this.replacement) {
  34919. let replacement = this.variable ? this.variable.getName() : this.replacement;
  34920. if (isCalleeOfDifferentParent)
  34921. replacement = '0, ' + replacement;
  34922. code.overwrite(this.start, this.end, replacement, {
  34923. contentOnly: true,
  34924. storeName: true
  34925. });
  34926. }
  34927. else {
  34928. if (isCalleeOfDifferentParent) {
  34929. code.appendRight(this.start, '0, ');
  34930. }
  34931. const surroundingElement = renderedParentType || renderedSurroundingElement;
  34932. this.object.render(code, options, surroundingElement ? { renderedSurroundingElement: surroundingElement } : BLANK);
  34933. this.property.render(code, options);
  34934. }
  34935. }
  34936. disallowNamespaceReassignment() {
  34937. if (this.object instanceof Identifier) {
  34938. const variable = this.scope.findVariable(this.object.name);
  34939. if (variable.isNamespace) {
  34940. if (this.variable) {
  34941. this.context.includeVariableInModule(this.variable);
  34942. }
  34943. this.context.warn({
  34944. code: 'ILLEGAL_NAMESPACE_REASSIGNMENT',
  34945. message: `Illegal reassignment to import '${this.object.name}'`
  34946. }, this.start);
  34947. }
  34948. }
  34949. }
  34950. getPropertyKey() {
  34951. if (this.propertyKey === null) {
  34952. this.propertyKey = UnknownKey;
  34953. const value = this.property.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
  34954. return (this.propertyKey = value === UnknownValue ? UnknownKey : String(value));
  34955. }
  34956. return this.propertyKey;
  34957. }
  34958. resolveNamespaceVariables(baseVariable, path) {
  34959. if (path.length === 0)
  34960. return baseVariable;
  34961. if (!baseVariable.isNamespace || baseVariable instanceof ExternalVariable)
  34962. return null;
  34963. const exportName = path[0].key;
  34964. const variable = baseVariable.context.traceExport(exportName);
  34965. if (!variable) {
  34966. const fileName = baseVariable.context.fileName;
  34967. this.context.warn({
  34968. code: 'MISSING_EXPORT',
  34969. exporter: relativeId(fileName),
  34970. importer: relativeId(this.context.fileName),
  34971. message: `'${exportName}' is not exported by '${relativeId(fileName)}'`,
  34972. missing: exportName,
  34973. url: `https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module`
  34974. }, path[0].pos);
  34975. return 'undefined';
  34976. }
  34977. return this.resolveNamespaceVariables(variable, path.slice(1));
  34978. }
  34979. }
  34980. class CallExpression extends NodeBase {
  34981. constructor() {
  34982. super(...arguments);
  34983. this.expressionsToBeDeoptimized = [];
  34984. this.returnExpression = null;
  34985. this.wasPathDeoptmizedWhileOptimized = false;
  34986. }
  34987. bind() {
  34988. super.bind();
  34989. if (this.callee instanceof Identifier) {
  34990. const variable = this.scope.findVariable(this.callee.name);
  34991. if (variable.isNamespace) {
  34992. this.context.warn({
  34993. code: 'CANNOT_CALL_NAMESPACE',
  34994. message: `Cannot call a namespace ('${this.callee.name}')`
  34995. }, this.start);
  34996. }
  34997. if (this.callee.name === 'eval') {
  34998. this.context.warn({
  34999. code: 'EVAL',
  35000. message: `Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification`,
  35001. url: 'https://rollupjs.org/guide/en/#avoiding-eval'
  35002. }, this.start);
  35003. }
  35004. }
  35005. // ensure the returnExpression is set for the tree-shaking passes
  35006. this.getReturnExpression(SHARED_RECURSION_TRACKER);
  35007. // This deoptimizes "this" for non-namespace calls until we have a better solution
  35008. if (this.callee instanceof MemberExpression && !this.callee.variable) {
  35009. this.callee.object.deoptimizePath(UNKNOWN_PATH);
  35010. }
  35011. for (const argument of this.arguments) {
  35012. // This will make sure all properties of parameters behave as "unknown"
  35013. argument.deoptimizePath(UNKNOWN_PATH);
  35014. }
  35015. }
  35016. deoptimizeCache() {
  35017. if (this.returnExpression !== UNKNOWN_EXPRESSION) {
  35018. this.returnExpression = null;
  35019. const returnExpression = this.getReturnExpression(SHARED_RECURSION_TRACKER);
  35020. const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
  35021. if (returnExpression !== UNKNOWN_EXPRESSION) {
  35022. // We need to replace here because is possible new expressions are added
  35023. // while we are deoptimizing the old ones
  35024. this.expressionsToBeDeoptimized = [];
  35025. if (this.wasPathDeoptmizedWhileOptimized) {
  35026. returnExpression.deoptimizePath(UNKNOWN_PATH);
  35027. this.wasPathDeoptmizedWhileOptimized = false;
  35028. }
  35029. }
  35030. for (const expression of expressionsToBeDeoptimized) {
  35031. expression.deoptimizeCache();
  35032. }
  35033. }
  35034. }
  35035. deoptimizePath(path) {
  35036. if (path.length === 0)
  35037. return;
  35038. const trackedEntities = this.context.deoptimizationTracker.getEntities(path);
  35039. if (trackedEntities.has(this))
  35040. return;
  35041. trackedEntities.add(this);
  35042. const returnExpression = this.getReturnExpression(SHARED_RECURSION_TRACKER);
  35043. if (returnExpression !== UNKNOWN_EXPRESSION) {
  35044. this.wasPathDeoptmizedWhileOptimized = true;
  35045. returnExpression.deoptimizePath(path);
  35046. }
  35047. }
  35048. getLiteralValueAtPath(path, recursionTracker, origin) {
  35049. const returnExpression = this.getReturnExpression(recursionTracker);
  35050. if (returnExpression === UNKNOWN_EXPRESSION) {
  35051. return UnknownValue;
  35052. }
  35053. const trackedEntities = recursionTracker.getEntities(path);
  35054. if (trackedEntities.has(returnExpression)) {
  35055. return UnknownValue;
  35056. }
  35057. this.expressionsToBeDeoptimized.push(origin);
  35058. trackedEntities.add(returnExpression);
  35059. const value = returnExpression.getLiteralValueAtPath(path, recursionTracker, origin);
  35060. trackedEntities.delete(returnExpression);
  35061. return value;
  35062. }
  35063. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  35064. const returnExpression = this.getReturnExpression(recursionTracker);
  35065. if (this.returnExpression === UNKNOWN_EXPRESSION) {
  35066. return UNKNOWN_EXPRESSION;
  35067. }
  35068. const trackedEntities = recursionTracker.getEntities(path);
  35069. if (trackedEntities.has(returnExpression)) {
  35070. return UNKNOWN_EXPRESSION;
  35071. }
  35072. this.expressionsToBeDeoptimized.push(origin);
  35073. trackedEntities.add(returnExpression);
  35074. const value = returnExpression.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  35075. trackedEntities.delete(returnExpression);
  35076. return value;
  35077. }
  35078. hasEffects(context) {
  35079. var _a;
  35080. for (const argument of this.arguments) {
  35081. if (argument.hasEffects(context))
  35082. return true;
  35083. }
  35084. if (this.context.options.treeshake.annotations && ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
  35085. return false;
  35086. return (this.callee.hasEffects(context) ||
  35087. this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
  35088. }
  35089. hasEffectsWhenAccessedAtPath(path, context) {
  35090. if (path.length === 0)
  35091. return false;
  35092. const trackedExpressions = context.accessed.getEntities(path);
  35093. if (trackedExpressions.has(this))
  35094. return false;
  35095. trackedExpressions.add(this);
  35096. return this.returnExpression.hasEffectsWhenAccessedAtPath(path, context);
  35097. }
  35098. hasEffectsWhenAssignedAtPath(path, context) {
  35099. if (path.length === 0)
  35100. return true;
  35101. const trackedExpressions = context.assigned.getEntities(path);
  35102. if (trackedExpressions.has(this))
  35103. return false;
  35104. trackedExpressions.add(this);
  35105. return this.returnExpression.hasEffectsWhenAssignedAtPath(path, context);
  35106. }
  35107. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  35108. const trackedExpressions = (callOptions.withNew
  35109. ? context.instantiated
  35110. : context.called).getEntities(path, callOptions);
  35111. if (trackedExpressions.has(this))
  35112. return false;
  35113. trackedExpressions.add(this);
  35114. return this.returnExpression.hasEffectsWhenCalledAtPath(path, callOptions, context);
  35115. }
  35116. include(context, includeChildrenRecursively) {
  35117. if (includeChildrenRecursively) {
  35118. super.include(context, includeChildrenRecursively);
  35119. if (includeChildrenRecursively === INCLUDE_PARAMETERS &&
  35120. this.callee instanceof Identifier &&
  35121. this.callee.variable) {
  35122. this.callee.variable.markCalledFromTryStatement();
  35123. }
  35124. }
  35125. else {
  35126. this.included = true;
  35127. this.callee.include(context, false);
  35128. }
  35129. this.callee.includeCallArguments(context, this.arguments);
  35130. if (!this.returnExpression.included) {
  35131. this.returnExpression.include(context, false);
  35132. }
  35133. }
  35134. initialise() {
  35135. this.callOptions = {
  35136. args: this.arguments,
  35137. withNew: false
  35138. };
  35139. }
  35140. render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
  35141. const surroundingELement = renderedParentType || renderedSurroundingElement;
  35142. this.callee.render(code, options, surroundingELement ? { renderedSurroundingElement: surroundingELement } : BLANK);
  35143. if (this.arguments.length > 0) {
  35144. if (this.arguments[this.arguments.length - 1].included) {
  35145. for (const arg of this.arguments) {
  35146. arg.render(code, options);
  35147. }
  35148. }
  35149. else {
  35150. let lastIncludedIndex = this.arguments.length - 2;
  35151. while (lastIncludedIndex >= 0 && !this.arguments[lastIncludedIndex].included) {
  35152. lastIncludedIndex--;
  35153. }
  35154. if (lastIncludedIndex >= 0) {
  35155. for (let index = 0; index <= lastIncludedIndex; index++) {
  35156. this.arguments[index].render(code, options);
  35157. }
  35158. code.remove(findFirstOccurrenceOutsideComment(code.original, ',', this.arguments[lastIncludedIndex].end), this.end - 1);
  35159. }
  35160. else {
  35161. code.remove(findFirstOccurrenceOutsideComment(code.original, '(', this.callee.end) + 1, this.end - 1);
  35162. }
  35163. }
  35164. }
  35165. }
  35166. getReturnExpression(recursionTracker) {
  35167. if (this.returnExpression === null) {
  35168. this.returnExpression = UNKNOWN_EXPRESSION;
  35169. return (this.returnExpression = this.callee.getReturnExpressionWhenCalledAtPath(EMPTY_PATH, recursionTracker, this));
  35170. }
  35171. return this.returnExpression;
  35172. }
  35173. }
  35174. class CatchScope extends ParameterScope {
  35175. addDeclaration(identifier, context, init, isHoisted) {
  35176. if (isHoisted) {
  35177. return this.parent.addDeclaration(identifier, context, init, isHoisted);
  35178. }
  35179. else {
  35180. return super.addDeclaration(identifier, context, init, false);
  35181. }
  35182. }
  35183. }
  35184. class CatchClause extends NodeBase {
  35185. createScope(parentScope) {
  35186. this.scope = new CatchScope(parentScope, this.context);
  35187. }
  35188. initialise() {
  35189. if (this.param) {
  35190. this.param.declare('parameter', UNKNOWN_EXPRESSION);
  35191. }
  35192. }
  35193. parseNode(esTreeNode) {
  35194. this.body = new this.context.nodeConstructors.BlockStatement(esTreeNode.body, this, this.scope);
  35195. super.parseNode(esTreeNode);
  35196. }
  35197. }
  35198. CatchClause.prototype.preventChildBlockScope = true;
  35199. class ChainExpression extends NodeBase {
  35200. }
  35201. class ClassBodyScope extends ChildScope {
  35202. findLexicalBoundary() {
  35203. return this;
  35204. }
  35205. }
  35206. class MethodDefinition extends NodeBase {
  35207. hasEffects(context) {
  35208. return this.key.hasEffects(context);
  35209. }
  35210. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  35211. return (path.length > 0 || this.value.hasEffectsWhenCalledAtPath(EMPTY_PATH, callOptions, context));
  35212. }
  35213. }
  35214. class ClassBody extends NodeBase {
  35215. createScope(parentScope) {
  35216. this.scope = new ClassBodyScope(parentScope);
  35217. }
  35218. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  35219. if (path.length > 0)
  35220. return true;
  35221. return (this.classConstructor !== null &&
  35222. this.classConstructor.hasEffectsWhenCalledAtPath(EMPTY_PATH, callOptions, context));
  35223. }
  35224. initialise() {
  35225. for (const method of this.body) {
  35226. if (method instanceof MethodDefinition && method.kind === 'constructor') {
  35227. this.classConstructor = method;
  35228. return;
  35229. }
  35230. }
  35231. this.classConstructor = null;
  35232. }
  35233. }
  35234. class ClassExpression extends ClassNode {
  35235. render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
  35236. super.render(code, options);
  35237. const surroundingElement = renderedParentType || renderedSurroundingElement;
  35238. if (surroundingElement === ExpressionStatement$1) {
  35239. code.appendRight(this.start, '(');
  35240. code.prependLeft(this.end, ')');
  35241. }
  35242. }
  35243. }
  35244. class MultiExpression {
  35245. constructor(expressions) {
  35246. this.included = false;
  35247. this.expressions = expressions;
  35248. }
  35249. deoptimizePath(path) {
  35250. for (const expression of this.expressions) {
  35251. expression.deoptimizePath(path);
  35252. }
  35253. }
  35254. getLiteralValueAtPath() {
  35255. return UnknownValue;
  35256. }
  35257. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  35258. return new MultiExpression(this.expressions.map(expression => expression.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin)));
  35259. }
  35260. hasEffectsWhenAccessedAtPath(path, context) {
  35261. for (const expression of this.expressions) {
  35262. if (expression.hasEffectsWhenAccessedAtPath(path, context))
  35263. return true;
  35264. }
  35265. return false;
  35266. }
  35267. hasEffectsWhenAssignedAtPath(path, context) {
  35268. for (const expression of this.expressions) {
  35269. if (expression.hasEffectsWhenAssignedAtPath(path, context))
  35270. return true;
  35271. }
  35272. return false;
  35273. }
  35274. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  35275. for (const expression of this.expressions) {
  35276. if (expression.hasEffectsWhenCalledAtPath(path, callOptions, context))
  35277. return true;
  35278. }
  35279. return false;
  35280. }
  35281. include(context, includeChildrenRecursively) {
  35282. // This is only relevant to include values that do not have an AST representation,
  35283. // such as UnknownArrayExpression. Thus we only need to include them once.
  35284. for (const expression of this.expressions) {
  35285. if (!expression.included) {
  35286. expression.include(context, includeChildrenRecursively);
  35287. }
  35288. }
  35289. }
  35290. includeCallArguments() { }
  35291. }
  35292. class ConditionalExpression extends NodeBase {
  35293. constructor() {
  35294. super(...arguments);
  35295. this.expressionsToBeDeoptimized = [];
  35296. this.isBranchResolutionAnalysed = false;
  35297. this.usedBranch = null;
  35298. this.wasPathDeoptimizedWhileOptimized = false;
  35299. }
  35300. bind() {
  35301. super.bind();
  35302. // ensure the usedBranch is set for the tree-shaking passes
  35303. this.getUsedBranch();
  35304. }
  35305. deoptimizeCache() {
  35306. if (this.usedBranch !== null) {
  35307. const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
  35308. this.usedBranch = null;
  35309. const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
  35310. this.expressionsToBeDeoptimized = [];
  35311. if (this.wasPathDeoptimizedWhileOptimized) {
  35312. unusedBranch.deoptimizePath(UNKNOWN_PATH);
  35313. }
  35314. for (const expression of expressionsToBeDeoptimized) {
  35315. expression.deoptimizeCache();
  35316. }
  35317. }
  35318. }
  35319. deoptimizePath(path) {
  35320. if (path.length > 0) {
  35321. const usedBranch = this.getUsedBranch();
  35322. if (usedBranch === null) {
  35323. this.consequent.deoptimizePath(path);
  35324. this.alternate.deoptimizePath(path);
  35325. }
  35326. else {
  35327. this.wasPathDeoptimizedWhileOptimized = true;
  35328. usedBranch.deoptimizePath(path);
  35329. }
  35330. }
  35331. }
  35332. getLiteralValueAtPath(path, recursionTracker, origin) {
  35333. const usedBranch = this.getUsedBranch();
  35334. if (usedBranch === null)
  35335. return UnknownValue;
  35336. this.expressionsToBeDeoptimized.push(origin);
  35337. return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
  35338. }
  35339. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  35340. const usedBranch = this.getUsedBranch();
  35341. if (usedBranch === null)
  35342. return new MultiExpression([
  35343. this.consequent.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin),
  35344. this.alternate.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin)
  35345. ]);
  35346. this.expressionsToBeDeoptimized.push(origin);
  35347. return usedBranch.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  35348. }
  35349. hasEffects(context) {
  35350. if (this.test.hasEffects(context))
  35351. return true;
  35352. if (this.usedBranch === null) {
  35353. return this.consequent.hasEffects(context) || this.alternate.hasEffects(context);
  35354. }
  35355. return this.usedBranch.hasEffects(context);
  35356. }
  35357. hasEffectsWhenAccessedAtPath(path, context) {
  35358. if (path.length === 0)
  35359. return false;
  35360. if (this.usedBranch === null) {
  35361. return (this.consequent.hasEffectsWhenAccessedAtPath(path, context) ||
  35362. this.alternate.hasEffectsWhenAccessedAtPath(path, context));
  35363. }
  35364. return this.usedBranch.hasEffectsWhenAccessedAtPath(path, context);
  35365. }
  35366. hasEffectsWhenAssignedAtPath(path, context) {
  35367. if (path.length === 0)
  35368. return true;
  35369. if (this.usedBranch === null) {
  35370. return (this.consequent.hasEffectsWhenAssignedAtPath(path, context) ||
  35371. this.alternate.hasEffectsWhenAssignedAtPath(path, context));
  35372. }
  35373. return this.usedBranch.hasEffectsWhenAssignedAtPath(path, context);
  35374. }
  35375. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  35376. if (this.usedBranch === null) {
  35377. return (this.consequent.hasEffectsWhenCalledAtPath(path, callOptions, context) ||
  35378. this.alternate.hasEffectsWhenCalledAtPath(path, callOptions, context));
  35379. }
  35380. return this.usedBranch.hasEffectsWhenCalledAtPath(path, callOptions, context);
  35381. }
  35382. include(context, includeChildrenRecursively) {
  35383. this.included = true;
  35384. if (includeChildrenRecursively ||
  35385. this.test.shouldBeIncluded(context) ||
  35386. this.usedBranch === null) {
  35387. this.test.include(context, includeChildrenRecursively);
  35388. this.consequent.include(context, includeChildrenRecursively);
  35389. this.alternate.include(context, includeChildrenRecursively);
  35390. }
  35391. else {
  35392. this.usedBranch.include(context, includeChildrenRecursively);
  35393. }
  35394. }
  35395. includeCallArguments(context, args) {
  35396. if (this.usedBranch === null) {
  35397. this.consequent.includeCallArguments(context, args);
  35398. this.alternate.includeCallArguments(context, args);
  35399. }
  35400. else {
  35401. this.usedBranch.includeCallArguments(context, args);
  35402. }
  35403. }
  35404. render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = BLANK) {
  35405. if (!this.test.included) {
  35406. const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
  35407. const inclusionStart = findNonWhiteSpace(code.original, (this.consequent.included
  35408. ? findFirstOccurrenceOutsideComment(code.original, '?', this.test.end)
  35409. : colonPos) + 1);
  35410. if (preventASI) {
  35411. removeLineBreaks(code, inclusionStart, this.usedBranch.start);
  35412. }
  35413. code.remove(this.start, inclusionStart);
  35414. if (this.consequent.included) {
  35415. code.remove(colonPos, this.end);
  35416. }
  35417. removeAnnotations(this, code);
  35418. this.usedBranch.render(code, options, {
  35419. isCalleeOfRenderedParent: renderedParentType
  35420. ? isCalleeOfRenderedParent
  35421. : this.parent.callee === this,
  35422. preventASI: true,
  35423. renderedParentType: renderedParentType || this.parent.type
  35424. });
  35425. }
  35426. else {
  35427. super.render(code, options);
  35428. }
  35429. }
  35430. getUsedBranch() {
  35431. if (this.isBranchResolutionAnalysed) {
  35432. return this.usedBranch;
  35433. }
  35434. this.isBranchResolutionAnalysed = true;
  35435. const testValue = this.test.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
  35436. return testValue === UnknownValue
  35437. ? null
  35438. : (this.usedBranch = testValue ? this.consequent : this.alternate);
  35439. }
  35440. }
  35441. class ContinueStatement extends NodeBase {
  35442. hasEffects(context) {
  35443. if (this.label) {
  35444. if (!context.ignore.labels.has(this.label.name))
  35445. return true;
  35446. context.includedLabels.add(this.label.name);
  35447. context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
  35448. }
  35449. else {
  35450. if (!context.ignore.continues)
  35451. return true;
  35452. context.brokenFlow = BROKEN_FLOW_BREAK_CONTINUE;
  35453. }
  35454. return false;
  35455. }
  35456. include(context) {
  35457. this.included = true;
  35458. if (this.label) {
  35459. this.label.include();
  35460. context.includedLabels.add(this.label.name);
  35461. }
  35462. context.brokenFlow = this.label ? BROKEN_FLOW_ERROR_RETURN_LABEL : BROKEN_FLOW_BREAK_CONTINUE;
  35463. }
  35464. }
  35465. class DoWhileStatement extends NodeBase {
  35466. hasEffects(context) {
  35467. if (this.test.hasEffects(context))
  35468. return true;
  35469. const { brokenFlow, ignore: { breaks, continues } } = context;
  35470. context.ignore.breaks = true;
  35471. context.ignore.continues = true;
  35472. if (this.body.hasEffects(context))
  35473. return true;
  35474. context.ignore.breaks = breaks;
  35475. context.ignore.continues = continues;
  35476. context.brokenFlow = brokenFlow;
  35477. return false;
  35478. }
  35479. include(context, includeChildrenRecursively) {
  35480. this.included = true;
  35481. this.test.include(context, includeChildrenRecursively);
  35482. const { brokenFlow } = context;
  35483. this.body.includeAsSingleStatement(context, includeChildrenRecursively);
  35484. context.brokenFlow = brokenFlow;
  35485. }
  35486. }
  35487. class EmptyStatement extends NodeBase {
  35488. hasEffects() {
  35489. return false;
  35490. }
  35491. }
  35492. class ExportNamedDeclaration extends NodeBase {
  35493. bind() {
  35494. // Do not bind specifiers
  35495. if (this.declaration !== null)
  35496. this.declaration.bind();
  35497. }
  35498. hasEffects(context) {
  35499. return this.declaration !== null && this.declaration.hasEffects(context);
  35500. }
  35501. initialise() {
  35502. this.context.addExport(this);
  35503. }
  35504. render(code, options, nodeRenderOptions) {
  35505. const { start, end } = nodeRenderOptions;
  35506. if (this.declaration === null) {
  35507. code.remove(start, end);
  35508. }
  35509. else {
  35510. code.remove(this.start, this.declaration.start);
  35511. this.declaration.render(code, options, { start, end });
  35512. }
  35513. }
  35514. }
  35515. ExportNamedDeclaration.prototype.needsBoundaries = true;
  35516. class ExportSpecifier extends NodeBase {
  35517. }
  35518. class ForInStatement extends NodeBase {
  35519. bind() {
  35520. this.left.bind();
  35521. this.left.deoptimizePath(EMPTY_PATH);
  35522. this.right.bind();
  35523. this.body.bind();
  35524. }
  35525. createScope(parentScope) {
  35526. this.scope = new BlockScope(parentScope);
  35527. }
  35528. hasEffects(context) {
  35529. if ((this.left &&
  35530. (this.left.hasEffects(context) ||
  35531. this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context))) ||
  35532. (this.right && this.right.hasEffects(context)))
  35533. return true;
  35534. const { brokenFlow, ignore: { breaks, continues } } = context;
  35535. context.ignore.breaks = true;
  35536. context.ignore.continues = true;
  35537. if (this.body.hasEffects(context))
  35538. return true;
  35539. context.ignore.breaks = breaks;
  35540. context.ignore.continues = continues;
  35541. context.brokenFlow = brokenFlow;
  35542. return false;
  35543. }
  35544. include(context, includeChildrenRecursively) {
  35545. this.included = true;
  35546. this.left.include(context, includeChildrenRecursively || true);
  35547. this.left.deoptimizePath(EMPTY_PATH);
  35548. this.right.include(context, includeChildrenRecursively);
  35549. const { brokenFlow } = context;
  35550. this.body.includeAsSingleStatement(context, includeChildrenRecursively);
  35551. context.brokenFlow = brokenFlow;
  35552. }
  35553. render(code, options) {
  35554. this.left.render(code, options, NO_SEMICOLON);
  35555. this.right.render(code, options, NO_SEMICOLON);
  35556. // handle no space between "in" and the right side
  35557. if (code.original.charCodeAt(this.right.start - 1) === 110 /* n */) {
  35558. code.prependLeft(this.right.start, ' ');
  35559. }
  35560. this.body.render(code, options);
  35561. }
  35562. }
  35563. class ForOfStatement extends NodeBase {
  35564. bind() {
  35565. this.left.bind();
  35566. this.left.deoptimizePath(EMPTY_PATH);
  35567. this.right.bind();
  35568. this.body.bind();
  35569. }
  35570. createScope(parentScope) {
  35571. this.scope = new BlockScope(parentScope);
  35572. }
  35573. hasEffects() {
  35574. // Placeholder until proper Symbol.Iterator support
  35575. return true;
  35576. }
  35577. include(context, includeChildrenRecursively) {
  35578. this.included = true;
  35579. this.left.include(context, includeChildrenRecursively || true);
  35580. this.left.deoptimizePath(EMPTY_PATH);
  35581. this.right.include(context, includeChildrenRecursively);
  35582. const { brokenFlow } = context;
  35583. this.body.includeAsSingleStatement(context, includeChildrenRecursively);
  35584. context.brokenFlow = brokenFlow;
  35585. }
  35586. render(code, options) {
  35587. this.left.render(code, options, NO_SEMICOLON);
  35588. this.right.render(code, options, NO_SEMICOLON);
  35589. // handle no space between "of" and the right side
  35590. if (code.original.charCodeAt(this.right.start - 1) === 102 /* f */) {
  35591. code.prependLeft(this.right.start, ' ');
  35592. }
  35593. this.body.render(code, options);
  35594. }
  35595. }
  35596. class ForStatement extends NodeBase {
  35597. createScope(parentScope) {
  35598. this.scope = new BlockScope(parentScope);
  35599. }
  35600. hasEffects(context) {
  35601. if ((this.init && this.init.hasEffects(context)) ||
  35602. (this.test && this.test.hasEffects(context)) ||
  35603. (this.update && this.update.hasEffects(context)))
  35604. return true;
  35605. const { brokenFlow, ignore: { breaks, continues } } = context;
  35606. context.ignore.breaks = true;
  35607. context.ignore.continues = true;
  35608. if (this.body.hasEffects(context))
  35609. return true;
  35610. context.ignore.breaks = breaks;
  35611. context.ignore.continues = continues;
  35612. context.brokenFlow = brokenFlow;
  35613. return false;
  35614. }
  35615. include(context, includeChildrenRecursively) {
  35616. this.included = true;
  35617. if (this.init)
  35618. this.init.includeAsSingleStatement(context, includeChildrenRecursively);
  35619. if (this.test)
  35620. this.test.include(context, includeChildrenRecursively);
  35621. const { brokenFlow } = context;
  35622. if (this.update)
  35623. this.update.include(context, includeChildrenRecursively);
  35624. this.body.includeAsSingleStatement(context, includeChildrenRecursively);
  35625. context.brokenFlow = brokenFlow;
  35626. }
  35627. render(code, options) {
  35628. if (this.init)
  35629. this.init.render(code, options, NO_SEMICOLON);
  35630. if (this.test)
  35631. this.test.render(code, options, NO_SEMICOLON);
  35632. if (this.update)
  35633. this.update.render(code, options, NO_SEMICOLON);
  35634. this.body.render(code, options);
  35635. }
  35636. }
  35637. class FunctionExpression extends FunctionNode {
  35638. render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
  35639. super.render(code, options);
  35640. const surroundingElement = renderedParentType || renderedSurroundingElement;
  35641. if (surroundingElement === ExpressionStatement$1) {
  35642. code.appendRight(this.start, '(');
  35643. code.prependLeft(this.end, ')');
  35644. }
  35645. }
  35646. }
  35647. class TrackingScope extends BlockScope {
  35648. constructor() {
  35649. super(...arguments);
  35650. this.hoistedDeclarations = [];
  35651. }
  35652. addDeclaration(identifier, context, init, isHoisted) {
  35653. this.hoistedDeclarations.push(identifier);
  35654. return this.parent.addDeclaration(identifier, context, init, isHoisted);
  35655. }
  35656. }
  35657. const unset = Symbol('unset');
  35658. class IfStatement extends NodeBase {
  35659. constructor() {
  35660. super(...arguments);
  35661. this.testValue = unset;
  35662. }
  35663. deoptimizeCache() {
  35664. this.testValue = UnknownValue;
  35665. }
  35666. hasEffects(context) {
  35667. if (this.test.hasEffects(context)) {
  35668. return true;
  35669. }
  35670. const testValue = this.getTestValue();
  35671. if (testValue === UnknownValue) {
  35672. const { brokenFlow } = context;
  35673. if (this.consequent.hasEffects(context))
  35674. return true;
  35675. const consequentBrokenFlow = context.brokenFlow;
  35676. context.brokenFlow = brokenFlow;
  35677. if (this.alternate === null)
  35678. return false;
  35679. if (this.alternate.hasEffects(context))
  35680. return true;
  35681. context.brokenFlow =
  35682. context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
  35683. return false;
  35684. }
  35685. return testValue
  35686. ? this.consequent.hasEffects(context)
  35687. : this.alternate !== null && this.alternate.hasEffects(context);
  35688. }
  35689. include(context, includeChildrenRecursively) {
  35690. this.included = true;
  35691. if (includeChildrenRecursively) {
  35692. this.includeRecursively(includeChildrenRecursively, context);
  35693. }
  35694. else {
  35695. const testValue = this.getTestValue();
  35696. if (testValue === UnknownValue) {
  35697. this.includeUnknownTest(context);
  35698. }
  35699. else {
  35700. this.includeKnownTest(context, testValue);
  35701. }
  35702. }
  35703. }
  35704. parseNode(esTreeNode) {
  35705. this.consequentScope = new TrackingScope(this.scope);
  35706. this.consequent = new (this.context.nodeConstructors[esTreeNode.consequent.type] ||
  35707. this.context.nodeConstructors.UnknownNode)(esTreeNode.consequent, this, this.consequentScope);
  35708. if (esTreeNode.alternate) {
  35709. this.alternateScope = new TrackingScope(this.scope);
  35710. this.alternate = new (this.context.nodeConstructors[esTreeNode.alternate.type] ||
  35711. this.context.nodeConstructors.UnknownNode)(esTreeNode.alternate, this, this.alternateScope);
  35712. }
  35713. super.parseNode(esTreeNode);
  35714. }
  35715. render(code, options) {
  35716. // Note that unknown test values are always included
  35717. const testValue = this.getTestValue();
  35718. const hoistedDeclarations = [];
  35719. const includesIfElse = this.test.included;
  35720. const noTreeshake = !this.context.options.treeshake;
  35721. if (includesIfElse) {
  35722. this.test.render(code, options);
  35723. }
  35724. else {
  35725. removeAnnotations(this, code);
  35726. code.remove(this.start, this.consequent.start);
  35727. }
  35728. if (this.consequent.included && (noTreeshake || testValue === UnknownValue || testValue)) {
  35729. this.consequent.render(code, options);
  35730. }
  35731. else {
  35732. code.overwrite(this.consequent.start, this.consequent.end, includesIfElse ? ';' : '');
  35733. hoistedDeclarations.push(...this.consequentScope.hoistedDeclarations);
  35734. }
  35735. if (this.alternate) {
  35736. if (this.alternate.included && (noTreeshake || testValue === UnknownValue || !testValue)) {
  35737. if (includesIfElse) {
  35738. if (code.original.charCodeAt(this.alternate.start - 1) === 101) {
  35739. code.prependLeft(this.alternate.start, ' ');
  35740. }
  35741. }
  35742. else {
  35743. code.remove(this.consequent.end, this.alternate.start);
  35744. }
  35745. this.alternate.render(code, options);
  35746. }
  35747. else {
  35748. if (includesIfElse && this.shouldKeepAlternateBranch()) {
  35749. code.overwrite(this.alternate.start, this.end, ';');
  35750. }
  35751. else {
  35752. code.remove(this.consequent.end, this.end);
  35753. }
  35754. hoistedDeclarations.push(...this.alternateScope.hoistedDeclarations);
  35755. }
  35756. }
  35757. this.renderHoistedDeclarations(hoistedDeclarations, code);
  35758. }
  35759. getTestValue() {
  35760. if (this.testValue === unset) {
  35761. return (this.testValue = this.test.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this));
  35762. }
  35763. return this.testValue;
  35764. }
  35765. includeKnownTest(context, testValue) {
  35766. if (this.test.shouldBeIncluded(context)) {
  35767. this.test.include(context, false);
  35768. }
  35769. if (testValue && this.consequent.shouldBeIncluded(context)) {
  35770. this.consequent.includeAsSingleStatement(context, false);
  35771. }
  35772. if (this.alternate !== null && !testValue && this.alternate.shouldBeIncluded(context)) {
  35773. this.alternate.includeAsSingleStatement(context, false);
  35774. }
  35775. }
  35776. includeRecursively(includeChildrenRecursively, context) {
  35777. this.test.include(context, includeChildrenRecursively);
  35778. this.consequent.include(context, includeChildrenRecursively);
  35779. if (this.alternate !== null) {
  35780. this.alternate.include(context, includeChildrenRecursively);
  35781. }
  35782. }
  35783. includeUnknownTest(context) {
  35784. this.test.include(context, false);
  35785. const { brokenFlow } = context;
  35786. let consequentBrokenFlow = BROKEN_FLOW_NONE;
  35787. if (this.consequent.shouldBeIncluded(context)) {
  35788. this.consequent.includeAsSingleStatement(context, false);
  35789. consequentBrokenFlow = context.brokenFlow;
  35790. context.brokenFlow = brokenFlow;
  35791. }
  35792. if (this.alternate !== null && this.alternate.shouldBeIncluded(context)) {
  35793. this.alternate.includeAsSingleStatement(context, false);
  35794. context.brokenFlow =
  35795. context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
  35796. }
  35797. }
  35798. renderHoistedDeclarations(hoistedDeclarations, code) {
  35799. const hoistedVars = [
  35800. ...new Set(hoistedDeclarations.map(identifier => {
  35801. const variable = identifier.variable;
  35802. return variable.included ? variable.getName() : '';
  35803. }))
  35804. ]
  35805. .filter(Boolean)
  35806. .join(', ');
  35807. if (hoistedVars) {
  35808. const parentType = this.parent.type;
  35809. const needsBraces = parentType !== Program$1 && parentType !== BlockStatement$1;
  35810. code.prependRight(this.start, `${needsBraces ? '{ ' : ''}var ${hoistedVars}; `);
  35811. if (needsBraces) {
  35812. code.appendLeft(this.end, ` }`);
  35813. }
  35814. }
  35815. }
  35816. shouldKeepAlternateBranch() {
  35817. let currentParent = this.parent;
  35818. do {
  35819. if (currentParent instanceof IfStatement && currentParent.alternate) {
  35820. return true;
  35821. }
  35822. if (currentParent instanceof BlockStatement) {
  35823. return false;
  35824. }
  35825. currentParent = currentParent.parent;
  35826. } while (currentParent);
  35827. return false;
  35828. }
  35829. }
  35830. class ImportDeclaration extends NodeBase {
  35831. bind() { }
  35832. hasEffects() {
  35833. return false;
  35834. }
  35835. initialise() {
  35836. this.context.addImport(this);
  35837. }
  35838. render(code, _options, nodeRenderOptions) {
  35839. code.remove(nodeRenderOptions.start, nodeRenderOptions.end);
  35840. }
  35841. }
  35842. ImportDeclaration.prototype.needsBoundaries = true;
  35843. class ImportDefaultSpecifier extends NodeBase {
  35844. }
  35845. class ImportExpression extends NodeBase {
  35846. constructor() {
  35847. super(...arguments);
  35848. this.inlineNamespace = null;
  35849. this.mechanism = null;
  35850. this.resolution = null;
  35851. }
  35852. hasEffects() {
  35853. return true;
  35854. }
  35855. include(context, includeChildrenRecursively) {
  35856. if (!this.included) {
  35857. this.included = true;
  35858. this.context.includeDynamicImport(this);
  35859. this.scope.addAccessedDynamicImport(this);
  35860. }
  35861. this.source.include(context, includeChildrenRecursively);
  35862. }
  35863. initialise() {
  35864. this.context.addDynamicImport(this);
  35865. }
  35866. render(code, options) {
  35867. if (this.inlineNamespace) {
  35868. const _ = options.compact ? '' : ' ';
  35869. const s = options.compact ? '' : ';';
  35870. code.overwrite(this.start, this.end, `Promise.resolve().then(function${_}()${_}{${_}return ${this.inlineNamespace.getName()}${s}${_}})`);
  35871. return;
  35872. }
  35873. if (this.mechanism) {
  35874. code.overwrite(this.start, findFirstOccurrenceOutsideComment(code.original, '(', this.start + 6) + 1, this.mechanism.left);
  35875. code.overwrite(this.end - 1, this.end, this.mechanism.right);
  35876. }
  35877. this.source.render(code, options);
  35878. }
  35879. renderFinalResolution(code, resolution, namespaceExportName, options) {
  35880. code.overwrite(this.source.start, this.source.end, resolution);
  35881. if (namespaceExportName) {
  35882. const _ = options.compact ? '' : ' ';
  35883. const s = options.compact ? '' : ';';
  35884. code.prependLeft(this.end, `.then(function${_}(n)${_}{${_}return n.${namespaceExportName}${s}${_}})`);
  35885. }
  35886. }
  35887. setExternalResolution(exportMode, resolution, options, pluginDriver, accessedGlobalsByScope) {
  35888. this.resolution = resolution;
  35889. const accessedGlobals = [...(accessedImportGlobals[options.format] || [])];
  35890. let helper;
  35891. ({ helper, mechanism: this.mechanism } = this.getDynamicImportMechanismAndHelper(resolution, exportMode, options, pluginDriver));
  35892. if (helper) {
  35893. accessedGlobals.push(helper);
  35894. }
  35895. if (accessedGlobals.length > 0) {
  35896. this.scope.addAccessedGlobals(accessedGlobals, accessedGlobalsByScope);
  35897. }
  35898. }
  35899. setInternalResolution(inlineNamespace) {
  35900. this.inlineNamespace = inlineNamespace;
  35901. }
  35902. getDynamicImportMechanismAndHelper(resolution, exportMode, options, pluginDriver) {
  35903. const mechanism = pluginDriver.hookFirstSync('renderDynamicImport', [
  35904. {
  35905. customResolution: typeof this.resolution === 'string' ? this.resolution : null,
  35906. format: options.format,
  35907. moduleId: this.context.module.id,
  35908. targetModuleId: this.resolution && typeof this.resolution !== 'string' ? this.resolution.id : null
  35909. }
  35910. ]);
  35911. if (mechanism) {
  35912. return { helper: null, mechanism };
  35913. }
  35914. switch (options.format) {
  35915. case 'cjs': {
  35916. const _ = options.compact ? '' : ' ';
  35917. const s = options.compact ? '' : ';';
  35918. const leftStart = `Promise.resolve().then(function${_}()${_}{${_}return`;
  35919. const helper = this.getInteropHelper(resolution, exportMode, options.interop);
  35920. return {
  35921. helper,
  35922. mechanism: helper
  35923. ? {
  35924. left: `${leftStart} /*#__PURE__*/${helper}(require(`,
  35925. right: `))${s}${_}})`
  35926. }
  35927. : {
  35928. left: `${leftStart} require(`,
  35929. right: `)${s}${_}})`
  35930. }
  35931. };
  35932. }
  35933. case 'amd': {
  35934. const _ = options.compact ? '' : ' ';
  35935. const resolve = options.compact ? 'c' : 'resolve';
  35936. const reject = options.compact ? 'e' : 'reject';
  35937. const helper = this.getInteropHelper(resolution, exportMode, options.interop);
  35938. const resolveNamespace = helper
  35939. ? `function${_}(m)${_}{${_}${resolve}(/*#__PURE__*/${helper}(m));${_}}`
  35940. : resolve;
  35941. return {
  35942. helper,
  35943. mechanism: {
  35944. left: `new Promise(function${_}(${resolve},${_}${reject})${_}{${_}require([`,
  35945. right: `],${_}${resolveNamespace},${_}${reject})${_}})`
  35946. }
  35947. };
  35948. }
  35949. case 'system':
  35950. return {
  35951. helper: null,
  35952. mechanism: {
  35953. left: 'module.import(',
  35954. right: ')'
  35955. }
  35956. };
  35957. case 'es':
  35958. if (options.dynamicImportFunction) {
  35959. return {
  35960. helper: null,
  35961. mechanism: {
  35962. left: `${options.dynamicImportFunction}(`,
  35963. right: ')'
  35964. }
  35965. };
  35966. }
  35967. }
  35968. return { helper: null, mechanism: null };
  35969. }
  35970. getInteropHelper(resolution, exportMode, interop) {
  35971. return exportMode === 'external'
  35972. ? namespaceInteropHelpersByInteropType[String(interop(resolution instanceof ExternalModule ? resolution.id : null))]
  35973. : exportMode === 'default'
  35974. ? getDefaultOnlyHelper()
  35975. : null;
  35976. }
  35977. }
  35978. const accessedImportGlobals = {
  35979. amd: ['require'],
  35980. cjs: ['require'],
  35981. system: ['module']
  35982. };
  35983. class ImportNamespaceSpecifier extends NodeBase {
  35984. }
  35985. class ImportSpecifier extends NodeBase {
  35986. }
  35987. class LabeledStatement extends NodeBase {
  35988. hasEffects(context) {
  35989. const brokenFlow = context.brokenFlow;
  35990. context.ignore.labels.add(this.label.name);
  35991. if (this.body.hasEffects(context))
  35992. return true;
  35993. context.ignore.labels.delete(this.label.name);
  35994. if (context.includedLabels.has(this.label.name)) {
  35995. context.includedLabels.delete(this.label.name);
  35996. context.brokenFlow = brokenFlow;
  35997. }
  35998. return false;
  35999. }
  36000. include(context, includeChildrenRecursively) {
  36001. this.included = true;
  36002. const brokenFlow = context.brokenFlow;
  36003. this.body.include(context, includeChildrenRecursively);
  36004. if (includeChildrenRecursively || context.includedLabels.has(this.label.name)) {
  36005. this.label.include();
  36006. context.includedLabels.delete(this.label.name);
  36007. context.brokenFlow = brokenFlow;
  36008. }
  36009. }
  36010. render(code, options) {
  36011. if (this.label.included) {
  36012. this.label.render(code, options);
  36013. }
  36014. else {
  36015. code.remove(this.start, findNonWhiteSpace(code.original, findFirstOccurrenceOutsideComment(code.original, ':', this.label.end) + 1));
  36016. }
  36017. this.body.render(code, options);
  36018. }
  36019. }
  36020. class LogicalExpression extends NodeBase {
  36021. constructor() {
  36022. super(...arguments);
  36023. // We collect deoptimization information if usedBranch !== null
  36024. this.expressionsToBeDeoptimized = [];
  36025. this.isBranchResolutionAnalysed = false;
  36026. this.unusedBranch = null;
  36027. this.usedBranch = null;
  36028. this.wasPathDeoptimizedWhileOptimized = false;
  36029. }
  36030. bind() {
  36031. super.bind();
  36032. // ensure the usedBranch is set for the tree-shaking passes
  36033. this.getUsedBranch();
  36034. }
  36035. deoptimizeCache() {
  36036. if (this.usedBranch !== null) {
  36037. this.usedBranch = null;
  36038. const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
  36039. this.expressionsToBeDeoptimized = [];
  36040. if (this.wasPathDeoptimizedWhileOptimized) {
  36041. this.unusedBranch.deoptimizePath(UNKNOWN_PATH);
  36042. }
  36043. for (const expression of expressionsToBeDeoptimized) {
  36044. expression.deoptimizeCache();
  36045. }
  36046. }
  36047. }
  36048. deoptimizePath(path) {
  36049. const usedBranch = this.getUsedBranch();
  36050. if (usedBranch === null) {
  36051. this.left.deoptimizePath(path);
  36052. this.right.deoptimizePath(path);
  36053. }
  36054. else {
  36055. this.wasPathDeoptimizedWhileOptimized = true;
  36056. usedBranch.deoptimizePath(path);
  36057. }
  36058. }
  36059. getLiteralValueAtPath(path, recursionTracker, origin) {
  36060. const usedBranch = this.getUsedBranch();
  36061. if (usedBranch === null)
  36062. return UnknownValue;
  36063. this.expressionsToBeDeoptimized.push(origin);
  36064. return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
  36065. }
  36066. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  36067. const usedBranch = this.getUsedBranch();
  36068. if (usedBranch === null)
  36069. return new MultiExpression([
  36070. this.left.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin),
  36071. this.right.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin)
  36072. ]);
  36073. this.expressionsToBeDeoptimized.push(origin);
  36074. return usedBranch.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  36075. }
  36076. hasEffects(context) {
  36077. if (this.left.hasEffects(context)) {
  36078. return true;
  36079. }
  36080. if (this.usedBranch !== this.left) {
  36081. return this.right.hasEffects(context);
  36082. }
  36083. return false;
  36084. }
  36085. hasEffectsWhenAccessedAtPath(path, context) {
  36086. if (path.length === 0)
  36087. return false;
  36088. if (this.usedBranch === null) {
  36089. return (this.left.hasEffectsWhenAccessedAtPath(path, context) ||
  36090. this.right.hasEffectsWhenAccessedAtPath(path, context));
  36091. }
  36092. return this.usedBranch.hasEffectsWhenAccessedAtPath(path, context);
  36093. }
  36094. hasEffectsWhenAssignedAtPath(path, context) {
  36095. if (path.length === 0)
  36096. return true;
  36097. if (this.usedBranch === null) {
  36098. return (this.left.hasEffectsWhenAssignedAtPath(path, context) ||
  36099. this.right.hasEffectsWhenAssignedAtPath(path, context));
  36100. }
  36101. return this.usedBranch.hasEffectsWhenAssignedAtPath(path, context);
  36102. }
  36103. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  36104. if (this.usedBranch === null) {
  36105. return (this.left.hasEffectsWhenCalledAtPath(path, callOptions, context) ||
  36106. this.right.hasEffectsWhenCalledAtPath(path, callOptions, context));
  36107. }
  36108. return this.usedBranch.hasEffectsWhenCalledAtPath(path, callOptions, context);
  36109. }
  36110. include(context, includeChildrenRecursively) {
  36111. this.included = true;
  36112. if (includeChildrenRecursively ||
  36113. (this.usedBranch === this.right && this.left.shouldBeIncluded(context)) ||
  36114. this.usedBranch === null) {
  36115. this.left.include(context, includeChildrenRecursively);
  36116. this.right.include(context, includeChildrenRecursively);
  36117. }
  36118. else {
  36119. this.usedBranch.include(context, includeChildrenRecursively);
  36120. }
  36121. }
  36122. render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = BLANK) {
  36123. if (!this.left.included || !this.right.included) {
  36124. const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
  36125. if (this.right.included) {
  36126. const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
  36127. code.remove(this.start, removePos);
  36128. if (preventASI) {
  36129. removeLineBreaks(code, removePos, this.right.start);
  36130. }
  36131. }
  36132. else {
  36133. code.remove(operatorPos, this.end);
  36134. }
  36135. removeAnnotations(this, code);
  36136. this.usedBranch.render(code, options, {
  36137. isCalleeOfRenderedParent: renderedParentType
  36138. ? isCalleeOfRenderedParent
  36139. : this.parent.callee === this,
  36140. preventASI,
  36141. renderedParentType: renderedParentType || this.parent.type
  36142. });
  36143. }
  36144. else {
  36145. this.left.render(code, options, { preventASI });
  36146. this.right.render(code, options);
  36147. }
  36148. }
  36149. getUsedBranch() {
  36150. if (!this.isBranchResolutionAnalysed) {
  36151. this.isBranchResolutionAnalysed = true;
  36152. const leftValue = this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
  36153. if (leftValue === UnknownValue) {
  36154. return null;
  36155. }
  36156. else {
  36157. if ((this.operator === '||' && leftValue) ||
  36158. (this.operator === '&&' && !leftValue) ||
  36159. (this.operator === '??' && leftValue != null)) {
  36160. this.usedBranch = this.left;
  36161. this.unusedBranch = this.right;
  36162. }
  36163. else {
  36164. this.usedBranch = this.right;
  36165. this.unusedBranch = this.left;
  36166. }
  36167. }
  36168. }
  36169. return this.usedBranch;
  36170. }
  36171. }
  36172. const ASSET_PREFIX = 'ROLLUP_ASSET_URL_';
  36173. const CHUNK_PREFIX = 'ROLLUP_CHUNK_URL_';
  36174. const FILE_PREFIX = 'ROLLUP_FILE_URL_';
  36175. class MetaProperty extends NodeBase {
  36176. addAccessedGlobals(format, accessedGlobalsByScope) {
  36177. const metaProperty = this.metaProperty;
  36178. const accessedGlobals = (metaProperty &&
  36179. (metaProperty.startsWith(FILE_PREFIX) ||
  36180. metaProperty.startsWith(ASSET_PREFIX) ||
  36181. metaProperty.startsWith(CHUNK_PREFIX))
  36182. ? accessedFileUrlGlobals
  36183. : accessedMetaUrlGlobals)[format];
  36184. if (accessedGlobals.length > 0) {
  36185. this.scope.addAccessedGlobals(accessedGlobals, accessedGlobalsByScope);
  36186. }
  36187. }
  36188. getReferencedFileName(outputPluginDriver) {
  36189. const metaProperty = this.metaProperty;
  36190. if (metaProperty && metaProperty.startsWith(FILE_PREFIX)) {
  36191. return outputPluginDriver.getFileName(metaProperty.substr(FILE_PREFIX.length));
  36192. }
  36193. return null;
  36194. }
  36195. hasEffects() {
  36196. return false;
  36197. }
  36198. hasEffectsWhenAccessedAtPath(path) {
  36199. return path.length > 1;
  36200. }
  36201. include() {
  36202. if (!this.included) {
  36203. this.included = true;
  36204. if (this.meta.name === 'import') {
  36205. this.context.addImportMeta(this);
  36206. const parent = this.parent;
  36207. this.metaProperty =
  36208. parent instanceof MemberExpression && typeof parent.propertyKey === 'string'
  36209. ? parent.propertyKey
  36210. : null;
  36211. }
  36212. }
  36213. }
  36214. renderFinalMechanism(code, chunkId, format, outputPluginDriver) {
  36215. var _a;
  36216. const parent = this.parent;
  36217. const metaProperty = this.metaProperty;
  36218. if (metaProperty &&
  36219. (metaProperty.startsWith(FILE_PREFIX) ||
  36220. metaProperty.startsWith(ASSET_PREFIX) ||
  36221. metaProperty.startsWith(CHUNK_PREFIX))) {
  36222. let referenceId = null;
  36223. let assetReferenceId = null;
  36224. let chunkReferenceId = null;
  36225. let fileName;
  36226. if (metaProperty.startsWith(FILE_PREFIX)) {
  36227. referenceId = metaProperty.substr(FILE_PREFIX.length);
  36228. fileName = outputPluginDriver.getFileName(referenceId);
  36229. }
  36230. else if (metaProperty.startsWith(ASSET_PREFIX)) {
  36231. warnDeprecation(`Using the "${ASSET_PREFIX}" prefix to reference files is deprecated. Use the "${FILE_PREFIX}" prefix instead.`, true, this.context.options);
  36232. assetReferenceId = metaProperty.substr(ASSET_PREFIX.length);
  36233. fileName = outputPluginDriver.getFileName(assetReferenceId);
  36234. }
  36235. else {
  36236. warnDeprecation(`Using the "${CHUNK_PREFIX}" prefix to reference files is deprecated. Use the "${FILE_PREFIX}" prefix instead.`, true, this.context.options);
  36237. chunkReferenceId = metaProperty.substr(CHUNK_PREFIX.length);
  36238. fileName = outputPluginDriver.getFileName(chunkReferenceId);
  36239. }
  36240. const relativePath = normalize(relative$1(dirname(chunkId), fileName));
  36241. let replacement;
  36242. if (assetReferenceId !== null) {
  36243. replacement = outputPluginDriver.hookFirstSync('resolveAssetUrl', [
  36244. {
  36245. assetFileName: fileName,
  36246. chunkId,
  36247. format,
  36248. moduleId: this.context.module.id,
  36249. relativeAssetPath: relativePath
  36250. }
  36251. ]);
  36252. }
  36253. if (!replacement) {
  36254. replacement =
  36255. outputPluginDriver.hookFirstSync('resolveFileUrl', [
  36256. {
  36257. assetReferenceId,
  36258. chunkId,
  36259. chunkReferenceId,
  36260. fileName,
  36261. format,
  36262. moduleId: this.context.module.id,
  36263. referenceId: referenceId || assetReferenceId || chunkReferenceId,
  36264. relativePath
  36265. }
  36266. ]) || relativeUrlMechanisms[format](relativePath);
  36267. }
  36268. code.overwrite(parent.start, parent.end, replacement, { contentOnly: true });
  36269. return;
  36270. }
  36271. const replacement = outputPluginDriver.hookFirstSync('resolveImportMeta', [
  36272. metaProperty,
  36273. {
  36274. chunkId,
  36275. format,
  36276. moduleId: this.context.module.id
  36277. }
  36278. ]) || ((_a = importMetaMechanisms[format]) === null || _a === void 0 ? void 0 : _a.call(importMetaMechanisms, metaProperty, chunkId));
  36279. if (typeof replacement === 'string') {
  36280. if (parent instanceof MemberExpression) {
  36281. code.overwrite(parent.start, parent.end, replacement, { contentOnly: true });
  36282. }
  36283. else {
  36284. code.overwrite(this.start, this.end, replacement, { contentOnly: true });
  36285. }
  36286. }
  36287. }
  36288. }
  36289. const accessedMetaUrlGlobals = {
  36290. amd: ['document', 'module', 'URL'],
  36291. cjs: ['document', 'require', 'URL'],
  36292. es: [],
  36293. iife: ['document', 'URL'],
  36294. system: ['module'],
  36295. umd: ['document', 'require', 'URL']
  36296. };
  36297. const accessedFileUrlGlobals = {
  36298. amd: ['document', 'require', 'URL'],
  36299. cjs: ['document', 'require', 'URL'],
  36300. es: [],
  36301. iife: ['document', 'URL'],
  36302. system: ['module', 'URL'],
  36303. umd: ['document', 'require', 'URL']
  36304. };
  36305. const getResolveUrl = (path, URL = 'URL') => `new ${URL}(${path}).href`;
  36306. const getRelativeUrlFromDocument = (relativePath) => getResolveUrl(`'${relativePath}', document.currentScript && document.currentScript.src || document.baseURI`);
  36307. const getGenericImportMetaMechanism = (getUrl) => (prop, chunkId) => {
  36308. const urlMechanism = getUrl(chunkId);
  36309. return prop === null ? `({ url: ${urlMechanism} })` : prop === 'url' ? urlMechanism : 'undefined';
  36310. };
  36311. const getUrlFromDocument = (chunkId) => `(document.currentScript && document.currentScript.src || new URL('${chunkId}', document.baseURI).href)`;
  36312. const relativeUrlMechanisms = {
  36313. amd: relativePath => {
  36314. if (relativePath[0] !== '.')
  36315. relativePath = './' + relativePath;
  36316. return getResolveUrl(`require.toUrl('${relativePath}'), document.baseURI`);
  36317. },
  36318. cjs: relativePath => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __dirname + '/${relativePath}'`, `(require('u' + 'rl').URL)`)} : ${getRelativeUrlFromDocument(relativePath)})`,
  36319. es: relativePath => getResolveUrl(`'${relativePath}', import.meta.url`),
  36320. iife: relativePath => getRelativeUrlFromDocument(relativePath),
  36321. system: relativePath => getResolveUrl(`'${relativePath}', module.meta.url`),
  36322. umd: relativePath => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __dirname + '/${relativePath}'`, `(require('u' + 'rl').URL)`)} : ${getRelativeUrlFromDocument(relativePath)})`
  36323. };
  36324. const importMetaMechanisms = {
  36325. amd: getGenericImportMetaMechanism(() => getResolveUrl(`module.uri, document.baseURI`)),
  36326. cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __filename`, `(require('u' + 'rl').URL)`)} : ${getUrlFromDocument(chunkId)})`),
  36327. iife: getGenericImportMetaMechanism(chunkId => getUrlFromDocument(chunkId)),
  36328. system: prop => (prop === null ? `module.meta` : `module.meta.${prop}`),
  36329. umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __filename`, `(require('u' + 'rl').URL)`)} : ${getUrlFromDocument(chunkId)})`)
  36330. };
  36331. class NewExpression extends NodeBase {
  36332. bind() {
  36333. super.bind();
  36334. for (const argument of this.arguments) {
  36335. // This will make sure all properties of parameters behave as "unknown"
  36336. argument.deoptimizePath(UNKNOWN_PATH);
  36337. }
  36338. }
  36339. hasEffects(context) {
  36340. var _a;
  36341. for (const argument of this.arguments) {
  36342. if (argument.hasEffects(context))
  36343. return true;
  36344. }
  36345. if (this.context.options.treeshake.annotations && ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
  36346. return false;
  36347. return (this.callee.hasEffects(context) ||
  36348. this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
  36349. }
  36350. hasEffectsWhenAccessedAtPath(path) {
  36351. return path.length > 1;
  36352. }
  36353. initialise() {
  36354. this.callOptions = {
  36355. args: this.arguments,
  36356. withNew: true
  36357. };
  36358. }
  36359. }
  36360. class ObjectExpression extends NodeBase {
  36361. constructor() {
  36362. super(...arguments);
  36363. this.deoptimizedPaths = new Set();
  36364. // We collect deoptimization information if we can resolve a computed property access
  36365. this.expressionsToBeDeoptimized = new Map();
  36366. this.hasUnknownDeoptimizedProperty = false;
  36367. this.propertyMap = null;
  36368. this.unmatchablePropertiesRead = [];
  36369. this.unmatchablePropertiesWrite = [];
  36370. }
  36371. bind() {
  36372. super.bind();
  36373. // ensure the propertyMap is set for the tree-shaking passes
  36374. this.getPropertyMap();
  36375. }
  36376. // We could also track this per-property but this would quickly become much more complex
  36377. deoptimizeCache() {
  36378. if (!this.hasUnknownDeoptimizedProperty)
  36379. this.deoptimizeAllProperties();
  36380. }
  36381. deoptimizePath(path) {
  36382. if (this.hasUnknownDeoptimizedProperty)
  36383. return;
  36384. const propertyMap = this.getPropertyMap();
  36385. const key = path[0];
  36386. if (path.length === 1) {
  36387. if (typeof key !== 'string') {
  36388. this.deoptimizeAllProperties();
  36389. return;
  36390. }
  36391. if (!this.deoptimizedPaths.has(key)) {
  36392. this.deoptimizedPaths.add(key);
  36393. // we only deoptimizeCache exact matches as in all other cases,
  36394. // we do not return a literal value or return expression
  36395. const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized.get(key);
  36396. if (expressionsToBeDeoptimized) {
  36397. for (const expression of expressionsToBeDeoptimized) {
  36398. expression.deoptimizeCache();
  36399. }
  36400. }
  36401. }
  36402. }
  36403. const subPath = path.length === 1 ? UNKNOWN_PATH : path.slice(1);
  36404. for (const property of typeof key === 'string'
  36405. ? propertyMap[key]
  36406. ? propertyMap[key].propertiesRead
  36407. : []
  36408. : this.properties) {
  36409. property.deoptimizePath(subPath);
  36410. }
  36411. }
  36412. getLiteralValueAtPath(path, recursionTracker, origin) {
  36413. const propertyMap = this.getPropertyMap();
  36414. const key = path[0];
  36415. if (path.length === 0 ||
  36416. this.hasUnknownDeoptimizedProperty ||
  36417. typeof key !== 'string' ||
  36418. this.deoptimizedPaths.has(key)) {
  36419. return UnknownValue;
  36420. }
  36421. if (path.length === 1 &&
  36422. !propertyMap[key] &&
  36423. !objectMembers[key] &&
  36424. this.unmatchablePropertiesRead.length === 0) {
  36425. getOrCreate(this.expressionsToBeDeoptimized, key, () => []).push(origin);
  36426. return undefined;
  36427. }
  36428. if (!propertyMap[key] ||
  36429. propertyMap[key].exactMatchRead === null ||
  36430. propertyMap[key].propertiesRead.length > 1) {
  36431. return UnknownValue;
  36432. }
  36433. getOrCreate(this.expressionsToBeDeoptimized, key, () => []).push(origin);
  36434. return propertyMap[key].exactMatchRead.getLiteralValueAtPath(path.slice(1), recursionTracker, origin);
  36435. }
  36436. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  36437. const propertyMap = this.getPropertyMap();
  36438. const key = path[0];
  36439. if (path.length === 0 ||
  36440. this.hasUnknownDeoptimizedProperty ||
  36441. typeof key !== 'string' ||
  36442. this.deoptimizedPaths.has(key)) {
  36443. return UNKNOWN_EXPRESSION;
  36444. }
  36445. if (path.length === 1 &&
  36446. objectMembers[key] &&
  36447. this.unmatchablePropertiesRead.length === 0 &&
  36448. (!propertyMap[key] || propertyMap[key].exactMatchRead === null)) {
  36449. return getMemberReturnExpressionWhenCalled(objectMembers, key);
  36450. }
  36451. if (!propertyMap[key] ||
  36452. propertyMap[key].exactMatchRead === null ||
  36453. propertyMap[key].propertiesRead.length > 1) {
  36454. return UNKNOWN_EXPRESSION;
  36455. }
  36456. getOrCreate(this.expressionsToBeDeoptimized, key, () => []).push(origin);
  36457. return propertyMap[key].exactMatchRead.getReturnExpressionWhenCalledAtPath(path.slice(1), recursionTracker, origin);
  36458. }
  36459. hasEffectsWhenAccessedAtPath(path, context) {
  36460. if (path.length === 0)
  36461. return false;
  36462. const key = path[0];
  36463. const propertyMap = this.propertyMap;
  36464. if (path.length > 1 &&
  36465. (this.hasUnknownDeoptimizedProperty ||
  36466. typeof key !== 'string' ||
  36467. this.deoptimizedPaths.has(key) ||
  36468. !propertyMap[key] ||
  36469. propertyMap[key].exactMatchRead === null))
  36470. return true;
  36471. const subPath = path.slice(1);
  36472. for (const property of typeof key !== 'string'
  36473. ? this.properties
  36474. : propertyMap[key]
  36475. ? propertyMap[key].propertiesRead
  36476. : []) {
  36477. if (property.hasEffectsWhenAccessedAtPath(subPath, context))
  36478. return true;
  36479. }
  36480. return false;
  36481. }
  36482. hasEffectsWhenAssignedAtPath(path, context) {
  36483. const key = path[0];
  36484. const propertyMap = this.propertyMap;
  36485. if (path.length > 1 &&
  36486. (this.hasUnknownDeoptimizedProperty ||
  36487. this.deoptimizedPaths.has(key) ||
  36488. !propertyMap[key] ||
  36489. propertyMap[key].exactMatchRead === null)) {
  36490. return true;
  36491. }
  36492. const subPath = path.slice(1);
  36493. for (const property of typeof key !== 'string'
  36494. ? this.properties
  36495. : path.length > 1
  36496. ? propertyMap[key].propertiesRead
  36497. : propertyMap[key]
  36498. ? propertyMap[key].propertiesWrite
  36499. : []) {
  36500. if (property.hasEffectsWhenAssignedAtPath(subPath, context))
  36501. return true;
  36502. }
  36503. return false;
  36504. }
  36505. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  36506. const key = path[0];
  36507. if (typeof key !== 'string' ||
  36508. this.hasUnknownDeoptimizedProperty ||
  36509. this.deoptimizedPaths.has(key) ||
  36510. (this.propertyMap[key]
  36511. ? !this.propertyMap[key].exactMatchRead
  36512. : path.length > 1 || !objectMembers[key])) {
  36513. return true;
  36514. }
  36515. const subPath = path.slice(1);
  36516. if (this.propertyMap[key]) {
  36517. for (const property of this.propertyMap[key].propertiesRead) {
  36518. if (property.hasEffectsWhenCalledAtPath(subPath, callOptions, context))
  36519. return true;
  36520. }
  36521. }
  36522. if (path.length === 1 && objectMembers[key])
  36523. return hasMemberEffectWhenCalled(objectMembers, key, this.included, callOptions, context);
  36524. return false;
  36525. }
  36526. render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
  36527. super.render(code, options);
  36528. const surroundingElement = renderedParentType || renderedSurroundingElement;
  36529. if (surroundingElement === ExpressionStatement$1 ||
  36530. surroundingElement === ArrowFunctionExpression$1) {
  36531. code.appendRight(this.start, '(');
  36532. code.prependLeft(this.end, ')');
  36533. }
  36534. }
  36535. deoptimizeAllProperties() {
  36536. this.hasUnknownDeoptimizedProperty = true;
  36537. for (const property of this.properties) {
  36538. property.deoptimizePath(UNKNOWN_PATH);
  36539. }
  36540. for (const expressionsToBeDeoptimized of this.expressionsToBeDeoptimized.values()) {
  36541. for (const expression of expressionsToBeDeoptimized) {
  36542. expression.deoptimizeCache();
  36543. }
  36544. }
  36545. }
  36546. getPropertyMap() {
  36547. if (this.propertyMap !== null) {
  36548. return this.propertyMap;
  36549. }
  36550. const propertyMap = (this.propertyMap = Object.create(null));
  36551. for (let index = this.properties.length - 1; index >= 0; index--) {
  36552. const property = this.properties[index];
  36553. if (property instanceof SpreadElement) {
  36554. this.unmatchablePropertiesRead.push(property);
  36555. continue;
  36556. }
  36557. const isWrite = property.kind !== 'get';
  36558. const isRead = property.kind !== 'set';
  36559. let key;
  36560. if (property.computed) {
  36561. const keyValue = property.key.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
  36562. if (keyValue === UnknownValue) {
  36563. if (isRead) {
  36564. this.unmatchablePropertiesRead.push(property);
  36565. }
  36566. else {
  36567. this.unmatchablePropertiesWrite.push(property);
  36568. }
  36569. continue;
  36570. }
  36571. key = String(keyValue);
  36572. }
  36573. else if (property.key instanceof Identifier) {
  36574. key = property.key.name;
  36575. }
  36576. else {
  36577. key = String(property.key.value);
  36578. }
  36579. const propertyMapProperty = propertyMap[key];
  36580. if (!propertyMapProperty) {
  36581. propertyMap[key] = {
  36582. exactMatchRead: isRead ? property : null,
  36583. exactMatchWrite: isWrite ? property : null,
  36584. propertiesRead: isRead ? [property, ...this.unmatchablePropertiesRead] : [],
  36585. propertiesWrite: isWrite && !isRead ? [property, ...this.unmatchablePropertiesWrite] : []
  36586. };
  36587. continue;
  36588. }
  36589. if (isRead && propertyMapProperty.exactMatchRead === null) {
  36590. propertyMapProperty.exactMatchRead = property;
  36591. propertyMapProperty.propertiesRead.push(property, ...this.unmatchablePropertiesRead);
  36592. }
  36593. if (isWrite && !isRead && propertyMapProperty.exactMatchWrite === null) {
  36594. propertyMapProperty.exactMatchWrite = property;
  36595. propertyMapProperty.propertiesWrite.push(property, ...this.unmatchablePropertiesWrite);
  36596. }
  36597. }
  36598. return propertyMap;
  36599. }
  36600. }
  36601. class ObjectPattern extends NodeBase {
  36602. addExportedVariables(variables, exportNamesByVariable) {
  36603. for (const property of this.properties) {
  36604. if (property.type === Property$1) {
  36605. property.value.addExportedVariables(variables, exportNamesByVariable);
  36606. }
  36607. else {
  36608. property.argument.addExportedVariables(variables, exportNamesByVariable);
  36609. }
  36610. }
  36611. }
  36612. declare(kind, init) {
  36613. const variables = [];
  36614. for (const property of this.properties) {
  36615. variables.push(...property.declare(kind, init));
  36616. }
  36617. return variables;
  36618. }
  36619. deoptimizePath(path) {
  36620. if (path.length === 0) {
  36621. for (const property of this.properties) {
  36622. property.deoptimizePath(path);
  36623. }
  36624. }
  36625. }
  36626. hasEffectsWhenAssignedAtPath(path, context) {
  36627. if (path.length > 0)
  36628. return true;
  36629. for (const property of this.properties) {
  36630. if (property.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context))
  36631. return true;
  36632. }
  36633. return false;
  36634. }
  36635. }
  36636. class PrivateIdentifier extends NodeBase {
  36637. }
  36638. class Program extends NodeBase {
  36639. constructor() {
  36640. super(...arguments);
  36641. this.hasCachedEffect = false;
  36642. }
  36643. hasEffects(context) {
  36644. // We are caching here to later more efficiently identify side-effect-free modules
  36645. if (this.hasCachedEffect)
  36646. return true;
  36647. for (const node of this.body) {
  36648. if (node.hasEffects(context)) {
  36649. return (this.hasCachedEffect = true);
  36650. }
  36651. }
  36652. return false;
  36653. }
  36654. include(context, includeChildrenRecursively) {
  36655. this.included = true;
  36656. for (const node of this.body) {
  36657. if (includeChildrenRecursively || node.shouldBeIncluded(context)) {
  36658. node.include(context, includeChildrenRecursively);
  36659. }
  36660. }
  36661. }
  36662. render(code, options) {
  36663. if (this.body.length) {
  36664. renderStatementList(this.body, code, this.start, this.end, options);
  36665. }
  36666. else {
  36667. super.render(code, options);
  36668. }
  36669. }
  36670. }
  36671. class Property extends NodeBase {
  36672. constructor() {
  36673. super(...arguments);
  36674. this.declarationInit = null;
  36675. this.returnExpression = null;
  36676. }
  36677. bind() {
  36678. super.bind();
  36679. if (this.kind === 'get') {
  36680. // ensure the returnExpression is set for the tree-shaking passes
  36681. this.getReturnExpression();
  36682. }
  36683. if (this.declarationInit !== null) {
  36684. this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]);
  36685. }
  36686. }
  36687. declare(kind, init) {
  36688. this.declarationInit = init;
  36689. return this.value.declare(kind, UNKNOWN_EXPRESSION);
  36690. }
  36691. // As getter properties directly receive their values from function expressions that always
  36692. // have a fixed return value, there is no known situation where a getter is deoptimized.
  36693. deoptimizeCache() { }
  36694. deoptimizePath(path) {
  36695. if (this.kind === 'get') {
  36696. this.getReturnExpression().deoptimizePath(path);
  36697. }
  36698. else {
  36699. this.value.deoptimizePath(path);
  36700. }
  36701. }
  36702. getLiteralValueAtPath(path, recursionTracker, origin) {
  36703. if (this.kind === 'get') {
  36704. return this.getReturnExpression().getLiteralValueAtPath(path, recursionTracker, origin);
  36705. }
  36706. return this.value.getLiteralValueAtPath(path, recursionTracker, origin);
  36707. }
  36708. getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin) {
  36709. if (this.kind === 'get') {
  36710. return this.getReturnExpression().getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  36711. }
  36712. return this.value.getReturnExpressionWhenCalledAtPath(path, recursionTracker, origin);
  36713. }
  36714. hasEffects(context) {
  36715. const propertyReadSideEffects = this.context.options.treeshake.propertyReadSideEffects;
  36716. return this.parent.type === 'ObjectPattern' && propertyReadSideEffects === 'always' ||
  36717. this.key.hasEffects(context) ||
  36718. this.value.hasEffects(context);
  36719. }
  36720. hasEffectsWhenAccessedAtPath(path, context) {
  36721. if (this.kind === 'get') {
  36722. const trackedExpressions = context.accessed.getEntities(path);
  36723. if (trackedExpressions.has(this))
  36724. return false;
  36725. trackedExpressions.add(this);
  36726. return (this.value.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.accessorCallOptions, context) ||
  36727. (path.length > 0 && this.returnExpression.hasEffectsWhenAccessedAtPath(path, context)));
  36728. }
  36729. return this.value.hasEffectsWhenAccessedAtPath(path, context);
  36730. }
  36731. hasEffectsWhenAssignedAtPath(path, context) {
  36732. if (this.kind === 'get') {
  36733. const trackedExpressions = context.assigned.getEntities(path);
  36734. if (trackedExpressions.has(this))
  36735. return false;
  36736. trackedExpressions.add(this);
  36737. return this.returnExpression.hasEffectsWhenAssignedAtPath(path, context);
  36738. }
  36739. if (this.kind === 'set') {
  36740. const trackedExpressions = context.assigned.getEntities(path);
  36741. if (trackedExpressions.has(this))
  36742. return false;
  36743. trackedExpressions.add(this);
  36744. return this.value.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.accessorCallOptions, context);
  36745. }
  36746. return this.value.hasEffectsWhenAssignedAtPath(path, context);
  36747. }
  36748. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  36749. if (this.kind === 'get') {
  36750. const trackedExpressions = (callOptions.withNew
  36751. ? context.instantiated
  36752. : context.called).getEntities(path, callOptions);
  36753. if (trackedExpressions.has(this))
  36754. return false;
  36755. trackedExpressions.add(this);
  36756. return this.returnExpression.hasEffectsWhenCalledAtPath(path, callOptions, context);
  36757. }
  36758. return this.value.hasEffectsWhenCalledAtPath(path, callOptions, context);
  36759. }
  36760. initialise() {
  36761. this.accessorCallOptions = {
  36762. args: NO_ARGS,
  36763. withNew: false
  36764. };
  36765. }
  36766. render(code, options) {
  36767. if (!this.shorthand) {
  36768. this.key.render(code, options);
  36769. }
  36770. this.value.render(code, options, { isShorthandProperty: this.shorthand });
  36771. }
  36772. getReturnExpression() {
  36773. if (this.returnExpression === null) {
  36774. this.returnExpression = UNKNOWN_EXPRESSION;
  36775. return (this.returnExpression = this.value.getReturnExpressionWhenCalledAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this));
  36776. }
  36777. return this.returnExpression;
  36778. }
  36779. }
  36780. class PropertyDefinition extends NodeBase {
  36781. hasEffects(context) {
  36782. return (this.key.hasEffects(context) ||
  36783. (this.static && this.value !== null && this.value.hasEffects(context)));
  36784. }
  36785. }
  36786. class ReturnStatement extends NodeBase {
  36787. hasEffects(context) {
  36788. if (!context.ignore.returnAwaitYield ||
  36789. (this.argument !== null && this.argument.hasEffects(context)))
  36790. return true;
  36791. context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
  36792. return false;
  36793. }
  36794. include(context, includeChildrenRecursively) {
  36795. this.included = true;
  36796. if (this.argument) {
  36797. this.argument.include(context, includeChildrenRecursively);
  36798. }
  36799. context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
  36800. }
  36801. initialise() {
  36802. this.scope.addReturnExpression(this.argument || UNKNOWN_EXPRESSION);
  36803. }
  36804. render(code, options) {
  36805. if (this.argument) {
  36806. this.argument.render(code, options, { preventASI: true });
  36807. if (this.argument.start === this.start + 6 /* 'return'.length */) {
  36808. code.prependLeft(this.start + 6, ' ');
  36809. }
  36810. }
  36811. }
  36812. }
  36813. class SequenceExpression extends NodeBase {
  36814. deoptimizePath(path) {
  36815. if (path.length > 0)
  36816. this.expressions[this.expressions.length - 1].deoptimizePath(path);
  36817. }
  36818. getLiteralValueAtPath(path, recursionTracker, origin) {
  36819. return this.expressions[this.expressions.length - 1].getLiteralValueAtPath(path, recursionTracker, origin);
  36820. }
  36821. hasEffects(context) {
  36822. for (const expression of this.expressions) {
  36823. if (expression.hasEffects(context))
  36824. return true;
  36825. }
  36826. return false;
  36827. }
  36828. hasEffectsWhenAccessedAtPath(path, context) {
  36829. return (path.length > 0 &&
  36830. this.expressions[this.expressions.length - 1].hasEffectsWhenAccessedAtPath(path, context));
  36831. }
  36832. hasEffectsWhenAssignedAtPath(path, context) {
  36833. return (path.length === 0 ||
  36834. this.expressions[this.expressions.length - 1].hasEffectsWhenAssignedAtPath(path, context));
  36835. }
  36836. hasEffectsWhenCalledAtPath(path, callOptions, context) {
  36837. return this.expressions[this.expressions.length - 1].hasEffectsWhenCalledAtPath(path, callOptions, context);
  36838. }
  36839. include(context, includeChildrenRecursively) {
  36840. this.included = true;
  36841. for (let i = 0; i < this.expressions.length - 1; i++) {
  36842. const node = this.expressions[i];
  36843. if (includeChildrenRecursively || node.shouldBeIncluded(context))
  36844. node.include(context, includeChildrenRecursively);
  36845. }
  36846. this.expressions[this.expressions.length - 1].include(context, includeChildrenRecursively);
  36847. }
  36848. render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = BLANK) {
  36849. let includedNodes = 0;
  36850. for (const { node, start, end } of getCommaSeparatedNodesWithBoundaries(this.expressions, code, this.start, this.end)) {
  36851. if (!node.included) {
  36852. treeshakeNode(node, code, start, end);
  36853. continue;
  36854. }
  36855. includedNodes++;
  36856. if (includedNodes === 1 && preventASI) {
  36857. removeLineBreaks(code, start, node.start);
  36858. }
  36859. if (node === this.expressions[this.expressions.length - 1] && includedNodes === 1) {
  36860. node.render(code, options, {
  36861. isCalleeOfRenderedParent: renderedParentType
  36862. ? isCalleeOfRenderedParent
  36863. : this.parent.callee === this,
  36864. renderedParentType: renderedParentType || this.parent.type
  36865. });
  36866. }
  36867. else {
  36868. node.render(code, options);
  36869. }
  36870. }
  36871. }
  36872. }
  36873. class Super extends NodeBase {
  36874. }
  36875. class SwitchCase extends NodeBase {
  36876. hasEffects(context) {
  36877. if (this.test && this.test.hasEffects(context))
  36878. return true;
  36879. for (const node of this.consequent) {
  36880. if (context.brokenFlow)
  36881. break;
  36882. if (node.hasEffects(context))
  36883. return true;
  36884. }
  36885. return false;
  36886. }
  36887. include(context, includeChildrenRecursively) {
  36888. this.included = true;
  36889. if (this.test)
  36890. this.test.include(context, includeChildrenRecursively);
  36891. for (const node of this.consequent) {
  36892. if (includeChildrenRecursively || node.shouldBeIncluded(context))
  36893. node.include(context, includeChildrenRecursively);
  36894. }
  36895. }
  36896. render(code, options, nodeRenderOptions) {
  36897. if (this.consequent.length) {
  36898. this.test && this.test.render(code, options);
  36899. const testEnd = this.test
  36900. ? this.test.end
  36901. : findFirstOccurrenceOutsideComment(code.original, 'default', this.start) + 7;
  36902. const consequentStart = findFirstOccurrenceOutsideComment(code.original, ':', testEnd) + 1;
  36903. renderStatementList(this.consequent, code, consequentStart, nodeRenderOptions.end, options);
  36904. }
  36905. else {
  36906. super.render(code, options);
  36907. }
  36908. }
  36909. }
  36910. SwitchCase.prototype.needsBoundaries = true;
  36911. class SwitchStatement extends NodeBase {
  36912. createScope(parentScope) {
  36913. this.scope = new BlockScope(parentScope);
  36914. }
  36915. hasEffects(context) {
  36916. if (this.discriminant.hasEffects(context))
  36917. return true;
  36918. const { brokenFlow, ignore: { breaks } } = context;
  36919. let minBrokenFlow = Infinity;
  36920. context.ignore.breaks = true;
  36921. for (const switchCase of this.cases) {
  36922. if (switchCase.hasEffects(context))
  36923. return true;
  36924. minBrokenFlow = context.brokenFlow < minBrokenFlow ? context.brokenFlow : minBrokenFlow;
  36925. context.brokenFlow = brokenFlow;
  36926. }
  36927. if (this.defaultCase !== null && !(minBrokenFlow === BROKEN_FLOW_BREAK_CONTINUE)) {
  36928. context.brokenFlow = minBrokenFlow;
  36929. }
  36930. context.ignore.breaks = breaks;
  36931. return false;
  36932. }
  36933. include(context, includeChildrenRecursively) {
  36934. this.included = true;
  36935. this.discriminant.include(context, includeChildrenRecursively);
  36936. const { brokenFlow } = context;
  36937. let minBrokenFlow = Infinity;
  36938. let isCaseIncluded = includeChildrenRecursively ||
  36939. (this.defaultCase !== null && this.defaultCase < this.cases.length - 1);
  36940. for (let caseIndex = this.cases.length - 1; caseIndex >= 0; caseIndex--) {
  36941. const switchCase = this.cases[caseIndex];
  36942. if (switchCase.included) {
  36943. isCaseIncluded = true;
  36944. }
  36945. if (!isCaseIncluded) {
  36946. const hasEffectsContext = createHasEffectsContext();
  36947. hasEffectsContext.ignore.breaks = true;
  36948. isCaseIncluded = switchCase.hasEffects(hasEffectsContext);
  36949. }
  36950. if (isCaseIncluded) {
  36951. switchCase.include(context, includeChildrenRecursively);
  36952. minBrokenFlow = minBrokenFlow < context.brokenFlow ? minBrokenFlow : context.brokenFlow;
  36953. context.brokenFlow = brokenFlow;
  36954. }
  36955. else {
  36956. minBrokenFlow = brokenFlow;
  36957. }
  36958. }
  36959. if (isCaseIncluded &&
  36960. this.defaultCase !== null &&
  36961. !(minBrokenFlow === BROKEN_FLOW_BREAK_CONTINUE)) {
  36962. context.brokenFlow = minBrokenFlow;
  36963. }
  36964. }
  36965. initialise() {
  36966. for (let caseIndex = 0; caseIndex < this.cases.length; caseIndex++) {
  36967. if (this.cases[caseIndex].test === null) {
  36968. this.defaultCase = caseIndex;
  36969. return;
  36970. }
  36971. }
  36972. this.defaultCase = null;
  36973. }
  36974. render(code, options) {
  36975. this.discriminant.render(code, options);
  36976. if (this.cases.length > 0) {
  36977. renderStatementList(this.cases, code, this.cases[0].start, this.end - 1, options);
  36978. }
  36979. }
  36980. }
  36981. class TaggedTemplateExpression extends NodeBase {
  36982. bind() {
  36983. super.bind();
  36984. if (this.tag.type === Identifier$1) {
  36985. const name = this.tag.name;
  36986. const variable = this.scope.findVariable(name);
  36987. if (variable.isNamespace) {
  36988. this.context.warn({
  36989. code: 'CANNOT_CALL_NAMESPACE',
  36990. message: `Cannot call a namespace ('${name}')`,
  36991. }, this.start);
  36992. }
  36993. if (name === 'eval') {
  36994. this.context.warn({
  36995. code: 'EVAL',
  36996. message: `Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification`,
  36997. url: 'https://rollupjs.org/guide/en/#avoiding-eval',
  36998. }, this.start);
  36999. }
  37000. }
  37001. }
  37002. hasEffects(context) {
  37003. return (super.hasEffects(context) ||
  37004. this.tag.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
  37005. }
  37006. initialise() {
  37007. this.callOptions = {
  37008. args: NO_ARGS,
  37009. withNew: false,
  37010. };
  37011. }
  37012. }
  37013. class TemplateElement extends NodeBase {
  37014. bind() { }
  37015. hasEffects() {
  37016. return false;
  37017. }
  37018. include() {
  37019. this.included = true;
  37020. }
  37021. parseNode(esTreeNode) {
  37022. this.value = esTreeNode.value;
  37023. super.parseNode(esTreeNode);
  37024. }
  37025. render() { }
  37026. }
  37027. class TemplateLiteral extends NodeBase {
  37028. getLiteralValueAtPath(path) {
  37029. if (path.length > 0 || this.quasis.length !== 1) {
  37030. return UnknownValue;
  37031. }
  37032. return this.quasis[0].value.cooked;
  37033. }
  37034. render(code, options) {
  37035. code.indentExclusionRanges.push([this.start, this.end]);
  37036. super.render(code, options);
  37037. }
  37038. }
  37039. class ModuleScope extends ChildScope {
  37040. constructor(parent, context) {
  37041. super(parent);
  37042. this.context = context;
  37043. this.variables.set('this', new LocalVariable('this', null, UNDEFINED_EXPRESSION, context));
  37044. }
  37045. addExportDefaultDeclaration(name, exportDefaultDeclaration, context) {
  37046. const variable = new ExportDefaultVariable(name, exportDefaultDeclaration, context);
  37047. this.variables.set('default', variable);
  37048. return variable;
  37049. }
  37050. addNamespaceMemberAccess() { }
  37051. deconflict(format, exportNamesByVariable, accessedGlobalsByScope) {
  37052. // all module level variables are already deconflicted when deconflicting the chunk
  37053. for (const scope of this.children)
  37054. scope.deconflict(format, exportNamesByVariable, accessedGlobalsByScope);
  37055. }
  37056. findLexicalBoundary() {
  37057. return this;
  37058. }
  37059. findVariable(name) {
  37060. const knownVariable = this.variables.get(name) || this.accessedOutsideVariables.get(name);
  37061. if (knownVariable) {
  37062. return knownVariable;
  37063. }
  37064. const variable = this.context.traceVariable(name) || this.parent.findVariable(name);
  37065. if (variable instanceof GlobalVariable) {
  37066. this.accessedOutsideVariables.set(name, variable);
  37067. }
  37068. return variable;
  37069. }
  37070. }
  37071. class ThisExpression extends NodeBase {
  37072. bind() {
  37073. super.bind();
  37074. this.variable = this.scope.findVariable('this');
  37075. }
  37076. hasEffectsWhenAccessedAtPath(path, context) {
  37077. return path.length > 0 && this.variable.hasEffectsWhenAccessedAtPath(path, context);
  37078. }
  37079. hasEffectsWhenAssignedAtPath(path, context) {
  37080. return this.variable.hasEffectsWhenAssignedAtPath(path, context);
  37081. }
  37082. initialise() {
  37083. this.alias =
  37084. this.scope.findLexicalBoundary() instanceof ModuleScope ? this.context.moduleContext : null;
  37085. if (this.alias === 'undefined') {
  37086. this.context.warn({
  37087. code: 'THIS_IS_UNDEFINED',
  37088. message: `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`,
  37089. url: `https://rollupjs.org/guide/en/#error-this-is-undefined`
  37090. }, this.start);
  37091. }
  37092. }
  37093. render(code) {
  37094. if (this.alias !== null) {
  37095. code.overwrite(this.start, this.end, this.alias, {
  37096. contentOnly: false,
  37097. storeName: true
  37098. });
  37099. }
  37100. }
  37101. }
  37102. class ThrowStatement extends NodeBase {
  37103. hasEffects() {
  37104. return true;
  37105. }
  37106. include(context, includeChildrenRecursively) {
  37107. this.included = true;
  37108. this.argument.include(context, includeChildrenRecursively);
  37109. context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
  37110. }
  37111. render(code, options) {
  37112. this.argument.render(code, options, { preventASI: true });
  37113. if (this.argument.start === this.start + 5 /* 'throw'.length */) {
  37114. code.prependLeft(this.start + 5, ' ');
  37115. }
  37116. }
  37117. }
  37118. class TryStatement extends NodeBase {
  37119. constructor() {
  37120. super(...arguments);
  37121. this.directlyIncluded = false;
  37122. this.includedLabelsAfterBlock = null;
  37123. }
  37124. hasEffects(context) {
  37125. return ((this.context.options.treeshake.tryCatchDeoptimization
  37126. ? this.block.body.length > 0
  37127. : this.block.hasEffects(context)) ||
  37128. (this.finalizer !== null && this.finalizer.hasEffects(context)));
  37129. }
  37130. include(context, includeChildrenRecursively) {
  37131. var _a;
  37132. const tryCatchDeoptimization = (_a = this.context.options.treeshake) === null || _a === void 0 ? void 0 : _a.tryCatchDeoptimization;
  37133. const { brokenFlow } = context;
  37134. if (!this.directlyIncluded || !tryCatchDeoptimization) {
  37135. this.included = true;
  37136. this.directlyIncluded = true;
  37137. this.block.include(context, tryCatchDeoptimization ? INCLUDE_PARAMETERS : includeChildrenRecursively);
  37138. if (context.includedLabels.size > 0) {
  37139. this.includedLabelsAfterBlock = [...context.includedLabels];
  37140. }
  37141. context.brokenFlow = brokenFlow;
  37142. }
  37143. else if (this.includedLabelsAfterBlock) {
  37144. for (const label of this.includedLabelsAfterBlock) {
  37145. context.includedLabels.add(label);
  37146. }
  37147. }
  37148. if (this.handler !== null) {
  37149. this.handler.include(context, includeChildrenRecursively);
  37150. context.brokenFlow = brokenFlow;
  37151. }
  37152. if (this.finalizer !== null) {
  37153. this.finalizer.include(context, includeChildrenRecursively);
  37154. }
  37155. }
  37156. }
  37157. const unaryOperators = {
  37158. '!': value => !value,
  37159. '+': value => +value,
  37160. '-': value => -value,
  37161. delete: () => UnknownValue,
  37162. typeof: value => typeof value,
  37163. void: () => undefined,
  37164. '~': value => ~value
  37165. };
  37166. class UnaryExpression extends NodeBase {
  37167. bind() {
  37168. super.bind();
  37169. if (this.operator === 'delete') {
  37170. this.argument.deoptimizePath(EMPTY_PATH);
  37171. }
  37172. }
  37173. getLiteralValueAtPath(path, recursionTracker, origin) {
  37174. if (path.length > 0)
  37175. return UnknownValue;
  37176. const argumentValue = this.argument.getLiteralValueAtPath(EMPTY_PATH, recursionTracker, origin);
  37177. if (argumentValue === UnknownValue)
  37178. return UnknownValue;
  37179. return unaryOperators[this.operator](argumentValue);
  37180. }
  37181. hasEffects(context) {
  37182. if (this.operator === 'typeof' && this.argument instanceof Identifier)
  37183. return false;
  37184. return (this.argument.hasEffects(context) ||
  37185. (this.operator === 'delete' &&
  37186. this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context)));
  37187. }
  37188. hasEffectsWhenAccessedAtPath(path) {
  37189. if (this.operator === 'void') {
  37190. return path.length > 0;
  37191. }
  37192. return path.length > 1;
  37193. }
  37194. }
  37195. class UnknownNode extends NodeBase {
  37196. hasEffects() {
  37197. return true;
  37198. }
  37199. include(context) {
  37200. super.include(context, true);
  37201. }
  37202. }
  37203. class UpdateExpression extends NodeBase {
  37204. bind() {
  37205. super.bind();
  37206. this.argument.deoptimizePath(EMPTY_PATH);
  37207. if (this.argument instanceof Identifier) {
  37208. const variable = this.scope.findVariable(this.argument.name);
  37209. variable.isReassigned = true;
  37210. }
  37211. }
  37212. hasEffects(context) {
  37213. return (this.argument.hasEffects(context) ||
  37214. this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context));
  37215. }
  37216. hasEffectsWhenAccessedAtPath(path) {
  37217. return path.length > 1;
  37218. }
  37219. render(code, options) {
  37220. this.argument.render(code, options);
  37221. if (options.format === 'system') {
  37222. const variable = this.argument.variable;
  37223. const exportNames = options.exportNamesByVariable.get(variable);
  37224. if (exportNames && exportNames.length) {
  37225. const _ = options.compact ? '' : ' ';
  37226. const name = variable.getName();
  37227. if (this.prefix) {
  37228. if (exportNames.length === 1) {
  37229. code.overwrite(this.start, this.end, `exports('${exportNames[0]}',${_}${this.operator}${name})`);
  37230. }
  37231. else {
  37232. code.overwrite(this.start, this.end, `(${this.operator}${name},${_}${getSystemExportStatement([variable], options)},${_}${name})`);
  37233. }
  37234. }
  37235. else if (exportNames.length > 1) {
  37236. code.overwrite(this.start, this.end, `(${getSystemExportFunctionLeft([variable], false, options)}${this.operator}${name}))`);
  37237. }
  37238. else {
  37239. let op;
  37240. switch (this.operator) {
  37241. case '++':
  37242. op = `${name}${_}+${_}1`;
  37243. break;
  37244. case '--':
  37245. op = `${name}${_}-${_}1`;
  37246. break;
  37247. }
  37248. code.overwrite(this.start, this.end, `(exports('${exportNames[0]}',${_}${op}),${_}${name}${this.operator})`);
  37249. }
  37250. }
  37251. }
  37252. }
  37253. }
  37254. function isReassignedExportsMember(variable, exportNamesByVariable) {
  37255. return (variable.renderBaseName !== null && exportNamesByVariable.has(variable) && variable.isReassigned);
  37256. }
  37257. function areAllDeclarationsIncludedAndNotExported(declarations, exportNamesByVariable) {
  37258. for (const declarator of declarations) {
  37259. if (!declarator.id.included)
  37260. return false;
  37261. if (declarator.id.type === Identifier$1) {
  37262. if (exportNamesByVariable.has(declarator.id.variable))
  37263. return false;
  37264. }
  37265. else {
  37266. const exportedVariables = [];
  37267. declarator.id.addExportedVariables(exportedVariables, exportNamesByVariable);
  37268. if (exportedVariables.length > 0)
  37269. return false;
  37270. }
  37271. }
  37272. return true;
  37273. }
  37274. class VariableDeclaration extends NodeBase {
  37275. deoptimizePath() {
  37276. for (const declarator of this.declarations) {
  37277. declarator.deoptimizePath(EMPTY_PATH);
  37278. }
  37279. }
  37280. hasEffectsWhenAssignedAtPath() {
  37281. return false;
  37282. }
  37283. include(context, includeChildrenRecursively) {
  37284. this.included = true;
  37285. for (const declarator of this.declarations) {
  37286. if (includeChildrenRecursively || declarator.shouldBeIncluded(context))
  37287. declarator.include(context, includeChildrenRecursively);
  37288. }
  37289. }
  37290. includeAsSingleStatement(context, includeChildrenRecursively) {
  37291. this.included = true;
  37292. for (const declarator of this.declarations) {
  37293. if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) {
  37294. declarator.include(context, includeChildrenRecursively);
  37295. declarator.id.include(context, includeChildrenRecursively);
  37296. }
  37297. }
  37298. }
  37299. initialise() {
  37300. for (const declarator of this.declarations) {
  37301. declarator.declareDeclarator(this.kind);
  37302. }
  37303. }
  37304. render(code, options, nodeRenderOptions = BLANK) {
  37305. if (areAllDeclarationsIncludedAndNotExported(this.declarations, options.exportNamesByVariable)) {
  37306. for (const declarator of this.declarations) {
  37307. declarator.render(code, options);
  37308. }
  37309. if (!nodeRenderOptions.isNoStatement &&
  37310. code.original.charCodeAt(this.end - 1) !== 59 /*";"*/) {
  37311. code.appendLeft(this.end, ';');
  37312. }
  37313. }
  37314. else {
  37315. this.renderReplacedDeclarations(code, options, nodeRenderOptions);
  37316. }
  37317. }
  37318. renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options, isNoStatement) {
  37319. if (code.original.charCodeAt(this.end - 1) === 59 /*";"*/) {
  37320. code.remove(this.end - 1, this.end);
  37321. }
  37322. if (!isNoStatement) {
  37323. separatorString += ';';
  37324. }
  37325. if (lastSeparatorPos !== null) {
  37326. if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
  37327. (code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
  37328. code.original.charCodeAt(this.end) === 13) /*"\r"*/) {
  37329. actualContentEnd--;
  37330. if (code.original.charCodeAt(actualContentEnd) === 13 /*"\r"*/) {
  37331. actualContentEnd--;
  37332. }
  37333. }
  37334. if (actualContentEnd === lastSeparatorPos + 1) {
  37335. code.overwrite(lastSeparatorPos, renderedContentEnd, separatorString);
  37336. }
  37337. else {
  37338. code.overwrite(lastSeparatorPos, lastSeparatorPos + 1, separatorString);
  37339. code.remove(actualContentEnd, renderedContentEnd);
  37340. }
  37341. }
  37342. else {
  37343. code.appendLeft(renderedContentEnd, separatorString);
  37344. }
  37345. if (systemPatternExports.length > 0) {
  37346. code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
  37347. }
  37348. }
  37349. renderReplacedDeclarations(code, options, { isNoStatement }) {
  37350. const separatedNodes = getCommaSeparatedNodesWithBoundaries(this.declarations, code, this.start + this.kind.length, this.end - (code.original.charCodeAt(this.end - 1) === 59 /*";"*/ ? 1 : 0));
  37351. let actualContentEnd, renderedContentEnd;
  37352. renderedContentEnd = findNonWhiteSpace(code.original, this.start + this.kind.length);
  37353. let lastSeparatorPos = renderedContentEnd - 1;
  37354. code.remove(this.start, lastSeparatorPos);
  37355. let isInDeclaration = false;
  37356. let hasRenderedContent = false;
  37357. let separatorString = '', leadingString, nextSeparatorString;
  37358. const systemPatternExports = [];
  37359. for (const { node, start, separator, contentEnd, end } of separatedNodes) {
  37360. if (!node.included) {
  37361. code.remove(start, end);
  37362. continue;
  37363. }
  37364. leadingString = '';
  37365. nextSeparatorString = '';
  37366. if (!node.id.included ||
  37367. (node.id instanceof Identifier &&
  37368. isReassignedExportsMember(node.id.variable, options.exportNamesByVariable))) {
  37369. if (hasRenderedContent) {
  37370. separatorString += ';';
  37371. }
  37372. isInDeclaration = false;
  37373. }
  37374. else {
  37375. if (options.format === 'system' && node.init !== null) {
  37376. if (node.id.type !== Identifier$1) {
  37377. node.id.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
  37378. }
  37379. else {
  37380. const exportNames = options.exportNamesByVariable.get(node.id.variable);
  37381. if (exportNames) {
  37382. const _ = options.compact ? '' : ' ';
  37383. const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', node.id.end);
  37384. code.prependLeft(findNonWhiteSpace(code.original, operatorPos + 1), exportNames.length === 1
  37385. ? `exports('${exportNames[0]}',${_}`
  37386. : getSystemExportFunctionLeft([node.id.variable], false, options));
  37387. nextSeparatorString += ')';
  37388. }
  37389. }
  37390. }
  37391. if (isInDeclaration) {
  37392. separatorString += ',';
  37393. }
  37394. else {
  37395. if (hasRenderedContent) {
  37396. separatorString += ';';
  37397. }
  37398. leadingString += `${this.kind} `;
  37399. isInDeclaration = true;
  37400. }
  37401. }
  37402. if (renderedContentEnd === lastSeparatorPos + 1) {
  37403. code.overwrite(lastSeparatorPos, renderedContentEnd, separatorString + leadingString);
  37404. }
  37405. else {
  37406. code.overwrite(lastSeparatorPos, lastSeparatorPos + 1, separatorString);
  37407. code.appendLeft(renderedContentEnd, leadingString);
  37408. }
  37409. node.render(code, options);
  37410. actualContentEnd = contentEnd;
  37411. renderedContentEnd = end;
  37412. hasRenderedContent = true;
  37413. lastSeparatorPos = separator;
  37414. separatorString = nextSeparatorString;
  37415. }
  37416. this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options, isNoStatement);
  37417. }
  37418. }
  37419. class VariableDeclarator extends NodeBase {
  37420. declareDeclarator(kind) {
  37421. this.id.declare(kind, this.init || UNDEFINED_EXPRESSION);
  37422. }
  37423. deoptimizePath(path) {
  37424. this.id.deoptimizePath(path);
  37425. }
  37426. hasEffects(context) {
  37427. return this.id.hasEffects(context) || (this.init !== null && this.init.hasEffects(context));
  37428. }
  37429. include(context, includeChildrenRecursively) {
  37430. this.included = true;
  37431. if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
  37432. this.id.include(context, includeChildrenRecursively);
  37433. }
  37434. if (this.init) {
  37435. this.init.include(context, includeChildrenRecursively);
  37436. }
  37437. }
  37438. render(code, options) {
  37439. const renderId = this.id.included;
  37440. if (renderId) {
  37441. this.id.render(code, options);
  37442. }
  37443. else {
  37444. const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', this.id.end);
  37445. code.remove(this.start, findNonWhiteSpace(code.original, operatorPos + 1));
  37446. }
  37447. if (this.init) {
  37448. this.init.render(code, options, renderId ? BLANK : { renderedParentType: ExpressionStatement$1 });
  37449. }
  37450. else if (this.id instanceof Identifier &&
  37451. isReassignedExportsMember(this.id.variable, options.exportNamesByVariable)) {
  37452. const _ = options.compact ? '' : ' ';
  37453. code.appendLeft(this.end, `${_}=${_}void 0`);
  37454. }
  37455. }
  37456. }
  37457. class WhileStatement extends NodeBase {
  37458. hasEffects(context) {
  37459. if (this.test.hasEffects(context))
  37460. return true;
  37461. const { brokenFlow, ignore: { breaks, continues } } = context;
  37462. context.ignore.breaks = true;
  37463. context.ignore.continues = true;
  37464. if (this.body.hasEffects(context))
  37465. return true;
  37466. context.ignore.breaks = breaks;
  37467. context.ignore.continues = continues;
  37468. context.brokenFlow = brokenFlow;
  37469. return false;
  37470. }
  37471. include(context, includeChildrenRecursively) {
  37472. this.included = true;
  37473. this.test.include(context, includeChildrenRecursively);
  37474. const { brokenFlow } = context;
  37475. this.body.includeAsSingleStatement(context, includeChildrenRecursively);
  37476. context.brokenFlow = brokenFlow;
  37477. }
  37478. }
  37479. class YieldExpression extends NodeBase {
  37480. bind() {
  37481. super.bind();
  37482. if (this.argument !== null) {
  37483. this.argument.deoptimizePath(UNKNOWN_PATH);
  37484. }
  37485. }
  37486. hasEffects(context) {
  37487. return (!context.ignore.returnAwaitYield ||
  37488. (this.argument !== null && this.argument.hasEffects(context)));
  37489. }
  37490. render(code, options) {
  37491. if (this.argument) {
  37492. this.argument.render(code, options, { preventASI: true });
  37493. if (this.argument.start === this.start + 5 /* 'yield'.length */) {
  37494. code.prependLeft(this.start + 5, ' ');
  37495. }
  37496. }
  37497. }
  37498. }
  37499. const nodeConstructors = {
  37500. ArrayExpression,
  37501. ArrayPattern,
  37502. ArrowFunctionExpression,
  37503. AssignmentExpression,
  37504. AssignmentPattern,
  37505. AwaitExpression,
  37506. BinaryExpression,
  37507. BlockStatement,
  37508. BreakStatement,
  37509. CallExpression,
  37510. CatchClause,
  37511. ChainExpression,
  37512. ClassBody,
  37513. ClassDeclaration,
  37514. ClassExpression,
  37515. ConditionalExpression,
  37516. ContinueStatement,
  37517. DoWhileStatement,
  37518. EmptyStatement,
  37519. ExportAllDeclaration,
  37520. ExportDefaultDeclaration,
  37521. ExportNamedDeclaration,
  37522. ExportSpecifier,
  37523. ExpressionStatement,
  37524. ForInStatement,
  37525. ForOfStatement,
  37526. ForStatement,
  37527. FunctionDeclaration,
  37528. FunctionExpression,
  37529. Identifier,
  37530. IfStatement,
  37531. ImportDeclaration,
  37532. ImportDefaultSpecifier,
  37533. ImportExpression,
  37534. ImportNamespaceSpecifier,
  37535. ImportSpecifier,
  37536. LabeledStatement,
  37537. Literal,
  37538. LogicalExpression,
  37539. MemberExpression,
  37540. MetaProperty,
  37541. MethodDefinition,
  37542. NewExpression,
  37543. ObjectExpression,
  37544. ObjectPattern,
  37545. PrivateIdentifier,
  37546. Program,
  37547. Property,
  37548. PropertyDefinition,
  37549. RestElement,
  37550. ReturnStatement,
  37551. SequenceExpression,
  37552. SpreadElement,
  37553. Super,
  37554. SwitchCase,
  37555. SwitchStatement,
  37556. TaggedTemplateExpression,
  37557. TemplateElement,
  37558. TemplateLiteral,
  37559. ThisExpression,
  37560. ThrowStatement,
  37561. TryStatement,
  37562. UnaryExpression,
  37563. UnknownNode,
  37564. UpdateExpression,
  37565. VariableDeclaration,
  37566. VariableDeclarator,
  37567. WhileStatement,
  37568. YieldExpression
  37569. };
  37570. function getId(m) {
  37571. return m.id;
  37572. }
  37573. function getOriginalLocation(sourcemapChain, location) {
  37574. // This cast is guaranteed. If it were a missing Map, it wouldn't have a mappings.
  37575. const filteredSourcemapChain = sourcemapChain.filter(sourcemap => sourcemap.mappings);
  37576. while (filteredSourcemapChain.length > 0) {
  37577. const sourcemap = filteredSourcemapChain.pop();
  37578. const line = sourcemap.mappings[location.line - 1];
  37579. let locationFound = false;
  37580. if (line !== undefined) {
  37581. for (const segment of line) {
  37582. if (segment[0] >= location.column) {
  37583. if (segment.length === 1)
  37584. break;
  37585. location = {
  37586. column: segment[3],
  37587. line: segment[2] + 1,
  37588. name: segment.length === 5 ? sourcemap.names[segment[4]] : undefined,
  37589. source: sourcemap.sources[segment[1]]
  37590. };
  37591. locationFound = true;
  37592. break;
  37593. }
  37594. }
  37595. }
  37596. if (!locationFound) {
  37597. throw new Error("Can't resolve original location of error.");
  37598. }
  37599. }
  37600. return location;
  37601. }
  37602. // this looks ridiculous, but it prevents sourcemap tooling from mistaking
  37603. // this for an actual sourceMappingURL
  37604. let SOURCEMAPPING_URL = 'sourceMa';
  37605. SOURCEMAPPING_URL += 'ppingURL';
  37606. const whiteSpaceNoNewline = '[ \\f\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]';
  37607. const SOURCEMAPPING_URL_LINE_COMMENT_RE = `//#${whiteSpaceNoNewline}+${SOURCEMAPPING_URL}=.+`;
  37608. const SOURCEMAPPING_URL_BLOCK_COMMENT_RE = `/\\*#${whiteSpaceNoNewline}+${SOURCEMAPPING_URL}=.+\\*/`;
  37609. const SOURCEMAPPING_URL_COMMENT_RE = new RegExp(`(${SOURCEMAPPING_URL_LINE_COMMENT_RE})|(${SOURCEMAPPING_URL_BLOCK_COMMENT_RE})`, 'g');
  37610. const NOOP = () => { };
  37611. let getStartTime = () => [0, 0];
  37612. let getElapsedTime = () => 0;
  37613. let getMemory = () => 0;
  37614. let timers = {};
  37615. const normalizeHrTime = (time) => time[0] * 1e3 + time[1] / 1e6;
  37616. function setTimeHelpers() {
  37617. if (typeof process !== 'undefined' && typeof process.hrtime === 'function') {
  37618. getStartTime = process.hrtime.bind(process);
  37619. getElapsedTime = previous => normalizeHrTime(process.hrtime(previous));
  37620. }
  37621. else if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
  37622. getStartTime = () => [performance.now(), 0];
  37623. getElapsedTime = previous => performance.now() - previous[0];
  37624. }
  37625. if (typeof process !== 'undefined' && typeof process.memoryUsage === 'function') {
  37626. getMemory = () => process.memoryUsage().heapUsed;
  37627. }
  37628. }
  37629. function getPersistedLabel(label, level) {
  37630. switch (level) {
  37631. case 1:
  37632. return `# ${label}`;
  37633. case 2:
  37634. return `## ${label}`;
  37635. case 3:
  37636. return label;
  37637. default:
  37638. return `${' '.repeat(level - 4)}- ${label}`;
  37639. }
  37640. }
  37641. function timeStartImpl(label, level = 3) {
  37642. label = getPersistedLabel(label, level);
  37643. if (!timers.hasOwnProperty(label)) {
  37644. timers[label] = {
  37645. memory: 0,
  37646. startMemory: undefined,
  37647. startTime: undefined,
  37648. time: 0,
  37649. totalMemory: 0
  37650. };
  37651. }
  37652. const currentMemory = getMemory();
  37653. timers[label].startTime = getStartTime();
  37654. timers[label].startMemory = currentMemory;
  37655. }
  37656. function timeEndImpl(label, level = 3) {
  37657. label = getPersistedLabel(label, level);
  37658. if (timers.hasOwnProperty(label)) {
  37659. const currentMemory = getMemory();
  37660. timers[label].time += getElapsedTime(timers[label].startTime);
  37661. timers[label].totalMemory = Math.max(timers[label].totalMemory, currentMemory);
  37662. timers[label].memory += currentMemory - timers[label].startMemory;
  37663. }
  37664. }
  37665. function getTimings() {
  37666. const newTimings = {};
  37667. for (const label of Object.keys(timers)) {
  37668. newTimings[label] = [timers[label].time, timers[label].memory, timers[label].totalMemory];
  37669. }
  37670. return newTimings;
  37671. }
  37672. let timeStart = NOOP, timeEnd = NOOP;
  37673. const TIMED_PLUGIN_HOOKS = {
  37674. load: true,
  37675. resolveDynamicImport: true,
  37676. resolveId: true,
  37677. transform: true
  37678. };
  37679. function getPluginWithTimers(plugin, index) {
  37680. const timedPlugin = {};
  37681. for (const hook of Object.keys(plugin)) {
  37682. if (TIMED_PLUGIN_HOOKS[hook] === true) {
  37683. let timerLabel = `plugin ${index}`;
  37684. if (plugin.name) {
  37685. timerLabel += ` (${plugin.name})`;
  37686. }
  37687. timerLabel += ` - ${hook}`;
  37688. timedPlugin[hook] = function () {
  37689. timeStart(timerLabel, 4);
  37690. let result = plugin[hook].apply(this === timedPlugin ? plugin : this, arguments);
  37691. timeEnd(timerLabel, 4);
  37692. if (result && typeof result.then === 'function') {
  37693. timeStart(`${timerLabel} (async)`, 4);
  37694. result = result.then(() => timeEnd(`${timerLabel} (async)`, 4));
  37695. }
  37696. return result;
  37697. };
  37698. }
  37699. else {
  37700. timedPlugin[hook] = plugin[hook];
  37701. }
  37702. }
  37703. return timedPlugin;
  37704. }
  37705. function initialiseTimers(inputOptions) {
  37706. if (inputOptions.perf) {
  37707. timers = {};
  37708. setTimeHelpers();
  37709. timeStart = timeStartImpl;
  37710. timeEnd = timeEndImpl;
  37711. inputOptions.plugins = inputOptions.plugins.map(getPluginWithTimers);
  37712. }
  37713. else {
  37714. timeStart = NOOP;
  37715. timeEnd = NOOP;
  37716. }
  37717. }
  37718. function markModuleAndImpureDependenciesAsExecuted(baseModule) {
  37719. baseModule.isExecuted = true;
  37720. const modules = [baseModule];
  37721. const visitedModules = new Set();
  37722. for (const module of modules) {
  37723. for (const dependency of [...module.dependencies, ...module.implicitlyLoadedBefore]) {
  37724. if (!(dependency instanceof ExternalModule) &&
  37725. !dependency.isExecuted &&
  37726. (dependency.info.hasModuleSideEffects || module.implicitlyLoadedBefore.has(dependency)) &&
  37727. !visitedModules.has(dependency.id)) {
  37728. dependency.isExecuted = true;
  37729. visitedModules.add(dependency.id);
  37730. modules.push(dependency);
  37731. }
  37732. }
  37733. }
  37734. }
  37735. const MISSING_EXPORT_SHIM_DESCRIPTION = {
  37736. identifier: null,
  37737. localName: MISSING_EXPORT_SHIM_VARIABLE
  37738. };
  37739. function findSourceMappingURLComments(ast, code) {
  37740. const ret = [];
  37741. const addCommentsPos = (start, end) => {
  37742. if (start == end) {
  37743. return;
  37744. }
  37745. let sourcemappingUrlMatch;
  37746. const interStatmentCode = code.slice(start, end);
  37747. while (sourcemappingUrlMatch = SOURCEMAPPING_URL_COMMENT_RE.exec(interStatmentCode)) {
  37748. ret.push([start + sourcemappingUrlMatch.index, start + SOURCEMAPPING_URL_COMMENT_RE.lastIndex]);
  37749. }
  37750. };
  37751. let prevStmtEnd = 0;
  37752. for (const stmt of ast.body) {
  37753. addCommentsPos(prevStmtEnd, stmt.start);
  37754. prevStmtEnd = stmt.end;
  37755. }
  37756. addCommentsPos(prevStmtEnd, code.length);
  37757. return ret;
  37758. }
  37759. function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map()) {
  37760. const searchedModules = searchedNamesAndModules.get(name);
  37761. if (searchedModules) {
  37762. if (searchedModules.has(target)) {
  37763. return isExportAllSearch ? null : error(errCircularReexport(name, target.id));
  37764. }
  37765. searchedModules.add(target);
  37766. }
  37767. else {
  37768. searchedNamesAndModules.set(name, new Set([target]));
  37769. }
  37770. return target.getVariableForExportName(name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules);
  37771. }
  37772. function getAndExtendSideEffectModules(variable, module) {
  37773. const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, () => new Set());
  37774. let currentVariable = variable;
  37775. const referencedVariables = new Set([currentVariable]);
  37776. while (true) {
  37777. const importingModule = currentVariable.module;
  37778. currentVariable =
  37779. currentVariable instanceof ExportDefaultVariable
  37780. ? currentVariable.getDirectOriginalVariable()
  37781. : currentVariable instanceof SyntheticNamedExportVariable
  37782. ? currentVariable.syntheticNamespace
  37783. : null;
  37784. if (!currentVariable || referencedVariables.has(currentVariable)) {
  37785. break;
  37786. }
  37787. referencedVariables.add(currentVariable);
  37788. sideEffectModules.add(importingModule);
  37789. const originalSideEffects = importingModule.sideEffectDependenciesByVariable.get(currentVariable);
  37790. if (originalSideEffects) {
  37791. for (const module of originalSideEffects) {
  37792. sideEffectModules.add(module);
  37793. }
  37794. }
  37795. }
  37796. return sideEffectModules;
  37797. }
  37798. class Module {
  37799. constructor(graph, id, options, isEntry, hasModuleSideEffects, syntheticNamedExports, meta) {
  37800. this.graph = graph;
  37801. this.id = id;
  37802. this.options = options;
  37803. this.alternativeReexportModules = new Map();
  37804. this.ast = null;
  37805. this.chunkFileNames = new Set();
  37806. this.chunkName = null;
  37807. this.cycles = new Set();
  37808. this.dependencies = new Set();
  37809. this.dynamicDependencies = new Set();
  37810. this.dynamicImporters = [];
  37811. this.dynamicImports = [];
  37812. this.execIndex = Infinity;
  37813. this.exportAllSources = new Set();
  37814. this.exports = Object.create(null);
  37815. this.exportsAll = Object.create(null);
  37816. this.implicitlyLoadedAfter = new Set();
  37817. this.implicitlyLoadedBefore = new Set();
  37818. this.importDescriptions = Object.create(null);
  37819. this.importers = [];
  37820. this.importMetas = [];
  37821. this.imports = new Set();
  37822. this.includedDynamicImporters = [];
  37823. this.isExecuted = false;
  37824. this.isUserDefinedEntryPoint = false;
  37825. this.preserveSignature = this.options.preserveEntrySignatures;
  37826. this.reexportDescriptions = Object.create(null);
  37827. this.sideEffectDependenciesByVariable = new Map();
  37828. this.sources = new Set();
  37829. this.userChunkNames = new Set();
  37830. this.usesTopLevelAwait = false;
  37831. this.allExportNames = null;
  37832. this.exportAllModules = [];
  37833. this.exportNamesByVariable = null;
  37834. this.exportShimVariable = new ExportShimVariable(this);
  37835. this.relevantDependencies = null;
  37836. this.syntheticExports = new Map();
  37837. this.syntheticNamespace = null;
  37838. this.transformDependencies = [];
  37839. this.transitiveReexports = null;
  37840. this.excludeFromSourcemap = /\0/.test(id);
  37841. this.context = options.moduleContext(id);
  37842. const module = this;
  37843. this.info = {
  37844. ast: null,
  37845. code: null,
  37846. get dynamicallyImportedIds() {
  37847. const dynamicallyImportedIds = [];
  37848. for (const { resolution } of module.dynamicImports) {
  37849. if (resolution instanceof Module || resolution instanceof ExternalModule) {
  37850. dynamicallyImportedIds.push(resolution.id);
  37851. }
  37852. }
  37853. return dynamicallyImportedIds;
  37854. },
  37855. get dynamicImporters() {
  37856. return module.dynamicImporters.sort();
  37857. },
  37858. hasModuleSideEffects,
  37859. id,
  37860. get implicitlyLoadedAfterOneOf() {
  37861. return Array.from(module.implicitlyLoadedAfter, getId);
  37862. },
  37863. get implicitlyLoadedBefore() {
  37864. return Array.from(module.implicitlyLoadedBefore, getId);
  37865. },
  37866. get importedIds() {
  37867. return Array.from(module.sources, source => module.resolvedIds[source].id);
  37868. },
  37869. get importers() {
  37870. return module.importers.sort();
  37871. },
  37872. isEntry,
  37873. isExternal: false,
  37874. meta,
  37875. syntheticNamedExports
  37876. };
  37877. }
  37878. basename() {
  37879. const base = basename(this.id);
  37880. const ext = extname$1(this.id);
  37881. return makeLegal(ext ? base.slice(0, -ext.length) : base);
  37882. }
  37883. bindReferences() {
  37884. this.ast.bind();
  37885. }
  37886. error(props, pos) {
  37887. this.addLocationToLogProps(props, pos);
  37888. return error(props);
  37889. }
  37890. getAllExportNames() {
  37891. if (this.allExportNames) {
  37892. return this.allExportNames;
  37893. }
  37894. const allExportNames = (this.allExportNames = new Set());
  37895. for (const name of Object.keys(this.exports)) {
  37896. allExportNames.add(name);
  37897. }
  37898. for (const name of Object.keys(this.reexportDescriptions)) {
  37899. allExportNames.add(name);
  37900. }
  37901. for (const module of this.exportAllModules) {
  37902. if (module instanceof ExternalModule) {
  37903. allExportNames.add(`*${module.id}`);
  37904. continue;
  37905. }
  37906. for (const name of module.getAllExportNames()) {
  37907. if (name !== 'default')
  37908. allExportNames.add(name);
  37909. }
  37910. }
  37911. return allExportNames;
  37912. }
  37913. getDependenciesToBeIncluded() {
  37914. if (this.relevantDependencies)
  37915. return this.relevantDependencies;
  37916. const relevantDependencies = new Set();
  37917. const necessaryDependencies = new Set();
  37918. const alwaysCheckedDependencies = new Set();
  37919. let dependencyVariables = this.imports.keys();
  37920. if (this.info.isEntry ||
  37921. this.includedDynamicImporters.length > 0 ||
  37922. this.namespace.included ||
  37923. this.implicitlyLoadedAfter.size > 0) {
  37924. dependencyVariables = new Set(dependencyVariables);
  37925. for (const exportName of [...this.getReexports(), ...this.getExports()]) {
  37926. dependencyVariables.add(this.getVariableForExportName(exportName));
  37927. }
  37928. }
  37929. for (let variable of dependencyVariables) {
  37930. const sideEffectDependencies = this.sideEffectDependenciesByVariable.get(variable);
  37931. if (sideEffectDependencies) {
  37932. for (const module of sideEffectDependencies) {
  37933. alwaysCheckedDependencies.add(module);
  37934. }
  37935. }
  37936. if (variable instanceof SyntheticNamedExportVariable) {
  37937. variable = variable.getBaseVariable();
  37938. }
  37939. else if (variable instanceof ExportDefaultVariable) {
  37940. variable = variable.getOriginalVariable();
  37941. }
  37942. necessaryDependencies.add(variable.module);
  37943. }
  37944. if (this.options.treeshake && this.info.hasModuleSideEffects !== 'no-treeshake') {
  37945. this.addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
  37946. }
  37947. else {
  37948. for (const dependency of this.dependencies) {
  37949. relevantDependencies.add(dependency);
  37950. }
  37951. }
  37952. for (const dependency of necessaryDependencies) {
  37953. relevantDependencies.add(dependency);
  37954. }
  37955. return (this.relevantDependencies = relevantDependencies);
  37956. }
  37957. getExportNamesByVariable() {
  37958. if (this.exportNamesByVariable) {
  37959. return this.exportNamesByVariable;
  37960. }
  37961. const exportNamesByVariable = new Map();
  37962. for (const exportName of this.getAllExportNames()) {
  37963. if (exportName === this.info.syntheticNamedExports)
  37964. continue;
  37965. let tracedVariable = this.getVariableForExportName(exportName);
  37966. if (tracedVariable instanceof ExportDefaultVariable) {
  37967. tracedVariable = tracedVariable.getOriginalVariable();
  37968. }
  37969. if (!tracedVariable ||
  37970. !(tracedVariable.included || tracedVariable instanceof ExternalVariable)) {
  37971. continue;
  37972. }
  37973. const existingExportNames = exportNamesByVariable.get(tracedVariable);
  37974. if (existingExportNames) {
  37975. existingExportNames.push(exportName);
  37976. }
  37977. else {
  37978. exportNamesByVariable.set(tracedVariable, [exportName]);
  37979. }
  37980. }
  37981. return (this.exportNamesByVariable = exportNamesByVariable);
  37982. }
  37983. getExports() {
  37984. return Object.keys(this.exports);
  37985. }
  37986. getReexports() {
  37987. if (this.transitiveReexports) {
  37988. return this.transitiveReexports;
  37989. }
  37990. // to avoid infinite recursion when using circular `export * from X`
  37991. this.transitiveReexports = [];
  37992. const reexports = new Set();
  37993. for (const name in this.reexportDescriptions) {
  37994. reexports.add(name);
  37995. }
  37996. for (const module of this.exportAllModules) {
  37997. if (module instanceof ExternalModule) {
  37998. reexports.add(`*${module.id}`);
  37999. }
  38000. else {
  38001. for (const name of [...module.getReexports(), ...module.getExports()]) {
  38002. if (name !== 'default')
  38003. reexports.add(name);
  38004. }
  38005. }
  38006. }
  38007. return (this.transitiveReexports = [...reexports]);
  38008. }
  38009. getRenderedExports() {
  38010. // only direct exports are counted here, not reexports at all
  38011. const renderedExports = [];
  38012. const removedExports = [];
  38013. for (const exportName in this.exports) {
  38014. const variable = this.getVariableForExportName(exportName);
  38015. (variable && variable.included ? renderedExports : removedExports).push(exportName);
  38016. }
  38017. return { renderedExports, removedExports };
  38018. }
  38019. getSyntheticNamespace() {
  38020. if (this.syntheticNamespace === null) {
  38021. this.syntheticNamespace = undefined;
  38022. this.syntheticNamespace = this.getVariableForExportName(typeof this.info.syntheticNamedExports === 'string'
  38023. ? this.info.syntheticNamedExports
  38024. : 'default');
  38025. }
  38026. if (!this.syntheticNamespace) {
  38027. return error(errSyntheticNamedExportsNeedNamespaceExport(this.id, this.info.syntheticNamedExports));
  38028. }
  38029. return this.syntheticNamespace;
  38030. }
  38031. getVariableForExportName(name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules) {
  38032. if (name[0] === '*') {
  38033. if (name.length === 1) {
  38034. // export * from './other'
  38035. return this.namespace;
  38036. }
  38037. else {
  38038. // export * from 'external'
  38039. const module = this.graph.modulesById.get(name.slice(1));
  38040. return module.getVariableForExportName('*');
  38041. }
  38042. }
  38043. // export { foo } from './other'
  38044. const reexportDeclaration = this.reexportDescriptions[name];
  38045. if (reexportDeclaration) {
  38046. const variable = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules);
  38047. if (!variable) {
  38048. return this.error(errMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id), reexportDeclaration.start);
  38049. }
  38050. if (importerForSideEffects) {
  38051. setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
  38052. }
  38053. return variable;
  38054. }
  38055. const exportDeclaration = this.exports[name];
  38056. if (exportDeclaration) {
  38057. if (exportDeclaration === MISSING_EXPORT_SHIM_DESCRIPTION) {
  38058. return this.exportShimVariable;
  38059. }
  38060. const name = exportDeclaration.localName;
  38061. const variable = this.traceVariable(name, importerForSideEffects);
  38062. if (importerForSideEffects) {
  38063. getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
  38064. setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
  38065. }
  38066. return variable;
  38067. }
  38068. if (name !== 'default') {
  38069. let foundSyntheticDeclaration = null;
  38070. for (const module of this.exportAllModules) {
  38071. const declaration = getVariableForExportNameRecursive(module, name, importerForSideEffects, true, searchedNamesAndModules);
  38072. if (declaration) {
  38073. if (!(declaration instanceof SyntheticNamedExportVariable)) {
  38074. return declaration;
  38075. }
  38076. if (!foundSyntheticDeclaration) {
  38077. foundSyntheticDeclaration = declaration;
  38078. }
  38079. }
  38080. }
  38081. if (foundSyntheticDeclaration) {
  38082. return foundSyntheticDeclaration;
  38083. }
  38084. }
  38085. if (this.info.syntheticNamedExports) {
  38086. let syntheticExport = this.syntheticExports.get(name);
  38087. if (!syntheticExport) {
  38088. const syntheticNamespace = this.getSyntheticNamespace();
  38089. syntheticExport = new SyntheticNamedExportVariable(this.astContext, name, syntheticNamespace);
  38090. this.syntheticExports.set(name, syntheticExport);
  38091. return syntheticExport;
  38092. }
  38093. return syntheticExport;
  38094. }
  38095. // we don't want to create shims when we are just
  38096. // probing export * modules for exports
  38097. if (!isExportAllSearch) {
  38098. if (this.options.shimMissingExports) {
  38099. this.shimMissingExport(name);
  38100. return this.exportShimVariable;
  38101. }
  38102. }
  38103. return null;
  38104. }
  38105. hasEffects() {
  38106. return (this.info.hasModuleSideEffects === 'no-treeshake' ||
  38107. (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
  38108. }
  38109. include() {
  38110. const context = createInclusionContext();
  38111. if (this.ast.shouldBeIncluded(context))
  38112. this.ast.include(context, false);
  38113. }
  38114. includeAllExports(includeNamespaceMembers) {
  38115. if (!this.isExecuted) {
  38116. this.graph.needsTreeshakingPass = true;
  38117. markModuleAndImpureDependenciesAsExecuted(this);
  38118. }
  38119. for (const exportName of this.getExports()) {
  38120. if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
  38121. const variable = this.getVariableForExportName(exportName);
  38122. variable.deoptimizePath(UNKNOWN_PATH);
  38123. if (!variable.included) {
  38124. this.includeVariable(variable);
  38125. }
  38126. }
  38127. }
  38128. for (const name of this.getReexports()) {
  38129. const variable = this.getVariableForExportName(name);
  38130. variable.deoptimizePath(UNKNOWN_PATH);
  38131. if (!variable.included) {
  38132. this.includeVariable(variable);
  38133. }
  38134. if (variable instanceof ExternalVariable) {
  38135. variable.module.reexported = true;
  38136. }
  38137. }
  38138. if (includeNamespaceMembers) {
  38139. this.namespace.prepareNamespace(this.includeAndGetAdditionalMergedNamespaces());
  38140. }
  38141. }
  38142. includeAllInBundle() {
  38143. this.ast.include(createInclusionContext(), true);
  38144. }
  38145. isIncluded() {
  38146. return this.ast.included || this.namespace.included;
  38147. }
  38148. linkImports() {
  38149. this.addModulesToImportDescriptions(this.importDescriptions);
  38150. this.addModulesToImportDescriptions(this.reexportDescriptions);
  38151. for (const name in this.exports) {
  38152. if (name !== 'default' && name !== this.info.syntheticNamedExports) {
  38153. this.exportsAll[name] = this.id;
  38154. }
  38155. }
  38156. const externalExportAllModules = [];
  38157. for (const source of this.exportAllSources) {
  38158. const module = this.graph.modulesById.get(this.resolvedIds[source].id);
  38159. if (module instanceof ExternalModule) {
  38160. externalExportAllModules.push(module);
  38161. continue;
  38162. }
  38163. this.exportAllModules.push(module);
  38164. for (const name in module.exportsAll) {
  38165. if (name in this.exportsAll) {
  38166. this.options.onwarn(errNamespaceConflict(name, this, module));
  38167. }
  38168. else {
  38169. this.exportsAll[name] = module.exportsAll[name];
  38170. }
  38171. }
  38172. }
  38173. this.exportAllModules.push(...externalExportAllModules);
  38174. }
  38175. render(options) {
  38176. const magicString = this.magicString.clone();
  38177. this.ast.render(magicString, options);
  38178. this.usesTopLevelAwait = this.astContext.usesTopLevelAwait;
  38179. return magicString;
  38180. }
  38181. setSource({ alwaysRemovedCode, ast, code, customTransformCache, originalCode, originalSourcemap, resolvedIds, sourcemapChain, transformDependencies, transformFiles, ...moduleOptions }) {
  38182. this.info.code = code;
  38183. this.originalCode = originalCode;
  38184. this.originalSourcemap = originalSourcemap;
  38185. this.sourcemapChain = sourcemapChain;
  38186. if (transformFiles) {
  38187. this.transformFiles = transformFiles;
  38188. }
  38189. this.transformDependencies = transformDependencies;
  38190. this.customTransformCache = customTransformCache;
  38191. this.updateOptions(moduleOptions);
  38192. timeStart('generate ast', 3);
  38193. this.alwaysRemovedCode = alwaysRemovedCode || [];
  38194. if (!ast) {
  38195. ast = this.tryParse();
  38196. }
  38197. this.alwaysRemovedCode.push(...findSourceMappingURLComments(ast, this.info.code));
  38198. timeEnd('generate ast', 3);
  38199. this.resolvedIds = resolvedIds || Object.create(null);
  38200. // By default, `id` is the file name. Custom resolvers and loaders
  38201. // can change that, but it makes sense to use it for the source file name
  38202. const fileName = this.id;
  38203. this.magicString = new MagicString(code, {
  38204. filename: (this.excludeFromSourcemap ? null : fileName),
  38205. indentExclusionRanges: []
  38206. });
  38207. for (const [start, end] of this.alwaysRemovedCode) {
  38208. this.magicString.remove(start, end);
  38209. }
  38210. timeStart('analyse ast', 3);
  38211. this.astContext = {
  38212. addDynamicImport: this.addDynamicImport.bind(this),
  38213. addExport: this.addExport.bind(this),
  38214. addImport: this.addImport.bind(this),
  38215. addImportMeta: this.addImportMeta.bind(this),
  38216. code,
  38217. deoptimizationTracker: this.graph.deoptimizationTracker,
  38218. error: this.error.bind(this),
  38219. fileName,
  38220. getExports: this.getExports.bind(this),
  38221. getModuleExecIndex: () => this.execIndex,
  38222. getModuleName: this.basename.bind(this),
  38223. getReexports: this.getReexports.bind(this),
  38224. importDescriptions: this.importDescriptions,
  38225. includeAllExports: () => this.includeAllExports(true),
  38226. includeDynamicImport: this.includeDynamicImport.bind(this),
  38227. includeVariableInModule: this.includeVariableInModule.bind(this),
  38228. magicString: this.magicString,
  38229. module: this,
  38230. moduleContext: this.context,
  38231. nodeConstructors,
  38232. options: this.options,
  38233. traceExport: this.getVariableForExportName.bind(this),
  38234. traceVariable: this.traceVariable.bind(this),
  38235. usesTopLevelAwait: false,
  38236. warn: this.warn.bind(this)
  38237. };
  38238. this.scope = new ModuleScope(this.graph.scope, this.astContext);
  38239. this.namespace = new NamespaceVariable(this.astContext, this.info.syntheticNamedExports);
  38240. this.ast = new Program(ast, { type: 'Module', context: this.astContext }, this.scope);
  38241. this.info.ast = ast;
  38242. timeEnd('analyse ast', 3);
  38243. }
  38244. toJSON() {
  38245. return {
  38246. alwaysRemovedCode: this.alwaysRemovedCode,
  38247. ast: this.ast.esTreeNode,
  38248. code: this.info.code,
  38249. customTransformCache: this.customTransformCache,
  38250. dependencies: Array.from(this.dependencies, getId),
  38251. id: this.id,
  38252. meta: this.info.meta,
  38253. moduleSideEffects: this.info.hasModuleSideEffects,
  38254. originalCode: this.originalCode,
  38255. originalSourcemap: this.originalSourcemap,
  38256. resolvedIds: this.resolvedIds,
  38257. sourcemapChain: this.sourcemapChain,
  38258. syntheticNamedExports: this.info.syntheticNamedExports,
  38259. transformDependencies: this.transformDependencies,
  38260. transformFiles: this.transformFiles
  38261. };
  38262. }
  38263. traceVariable(name, importerForSideEffects) {
  38264. const localVariable = this.scope.variables.get(name);
  38265. if (localVariable) {
  38266. return localVariable;
  38267. }
  38268. if (name in this.importDescriptions) {
  38269. const importDeclaration = this.importDescriptions[name];
  38270. const otherModule = importDeclaration.module;
  38271. if (otherModule instanceof Module && importDeclaration.name === '*') {
  38272. return otherModule.namespace;
  38273. }
  38274. const declaration = otherModule.getVariableForExportName(importDeclaration.name, importerForSideEffects || this);
  38275. if (!declaration) {
  38276. return this.error(errMissingExport(importDeclaration.name, this.id, otherModule.id), importDeclaration.start);
  38277. }
  38278. return declaration;
  38279. }
  38280. return null;
  38281. }
  38282. tryParse() {
  38283. try {
  38284. return this.graph.contextParse(this.info.code);
  38285. }
  38286. catch (err) {
  38287. let message = err.message.replace(/ \(\d+:\d+\)$/, '');
  38288. if (this.id.endsWith('.json')) {
  38289. message += ' (Note that you need @rollup/plugin-json to import JSON files)';
  38290. }
  38291. else if (!this.id.endsWith('.js')) {
  38292. message += ' (Note that you need plugins to import files that are not JavaScript)';
  38293. }
  38294. return this.error({
  38295. code: 'PARSE_ERROR',
  38296. message,
  38297. parserError: err
  38298. }, err.pos);
  38299. }
  38300. }
  38301. updateOptions({ meta, moduleSideEffects, syntheticNamedExports }) {
  38302. if (moduleSideEffects != null) {
  38303. this.info.hasModuleSideEffects = moduleSideEffects;
  38304. }
  38305. if (syntheticNamedExports != null) {
  38306. this.info.syntheticNamedExports = syntheticNamedExports;
  38307. }
  38308. if (meta != null) {
  38309. this.info.meta = { ...this.info.meta, ...meta };
  38310. }
  38311. }
  38312. warn(props, pos) {
  38313. this.addLocationToLogProps(props, pos);
  38314. this.options.onwarn(props);
  38315. }
  38316. addDynamicImport(node) {
  38317. let argument = node.source;
  38318. if (argument instanceof TemplateLiteral) {
  38319. if (argument.quasis.length === 1 && argument.quasis[0].value.cooked) {
  38320. argument = argument.quasis[0].value.cooked;
  38321. }
  38322. }
  38323. else if (argument instanceof Literal && typeof argument.value === 'string') {
  38324. argument = argument.value;
  38325. }
  38326. this.dynamicImports.push({ node, resolution: null, argument });
  38327. }
  38328. addExport(node) {
  38329. if (node instanceof ExportDefaultDeclaration) {
  38330. // export default foo;
  38331. this.exports.default = {
  38332. identifier: node.variable.getAssignedVariableName(),
  38333. localName: 'default'
  38334. };
  38335. }
  38336. else if (node instanceof ExportAllDeclaration) {
  38337. const source = node.source.value;
  38338. this.sources.add(source);
  38339. if (node.exported) {
  38340. // export * as name from './other'
  38341. const name = node.exported.name;
  38342. this.reexportDescriptions[name] = {
  38343. localName: '*',
  38344. module: null,
  38345. source,
  38346. start: node.start
  38347. };
  38348. }
  38349. else {
  38350. // export * from './other'
  38351. this.exportAllSources.add(source);
  38352. }
  38353. }
  38354. else if (node.source instanceof Literal) {
  38355. // export { name } from './other'
  38356. const source = node.source.value;
  38357. this.sources.add(source);
  38358. for (const specifier of node.specifiers) {
  38359. const name = specifier.exported.name;
  38360. this.reexportDescriptions[name] = {
  38361. localName: specifier.local.name,
  38362. module: null,
  38363. source,
  38364. start: specifier.start
  38365. };
  38366. }
  38367. }
  38368. else if (node.declaration) {
  38369. const declaration = node.declaration;
  38370. if (declaration instanceof VariableDeclaration) {
  38371. // export var { foo, bar } = ...
  38372. // export var foo = 1, bar = 2;
  38373. for (const declarator of declaration.declarations) {
  38374. for (const localName of extractAssignedNames(declarator.id)) {
  38375. this.exports[localName] = { identifier: null, localName };
  38376. }
  38377. }
  38378. }
  38379. else {
  38380. // export function foo () {}
  38381. const localName = declaration.id.name;
  38382. this.exports[localName] = { identifier: null, localName };
  38383. }
  38384. }
  38385. else {
  38386. // export { foo, bar, baz }
  38387. for (const specifier of node.specifiers) {
  38388. const localName = specifier.local.name;
  38389. const exportedName = specifier.exported.name;
  38390. this.exports[exportedName] = { identifier: null, localName };
  38391. }
  38392. }
  38393. }
  38394. addImport(node) {
  38395. const source = node.source.value;
  38396. this.sources.add(source);
  38397. for (const specifier of node.specifiers) {
  38398. const isDefault = specifier.type === ImportDefaultSpecifier$1;
  38399. const isNamespace = specifier.type === ImportNamespaceSpecifier$1;
  38400. const name = isDefault
  38401. ? 'default'
  38402. : isNamespace
  38403. ? '*'
  38404. : specifier.imported.name;
  38405. this.importDescriptions[specifier.local.name] = {
  38406. module: null,
  38407. name,
  38408. source,
  38409. start: specifier.start
  38410. };
  38411. }
  38412. }
  38413. addImportMeta(node) {
  38414. this.importMetas.push(node);
  38415. }
  38416. addLocationToLogProps(props, pos) {
  38417. props.id = this.id;
  38418. props.pos = pos;
  38419. let code = this.info.code;
  38420. let { column, line } = locate(code, pos, { offsetLine: 1 });
  38421. try {
  38422. ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
  38423. code = this.originalCode;
  38424. }
  38425. catch (e) {
  38426. this.options.onwarn({
  38427. code: 'SOURCEMAP_ERROR',
  38428. id: this.id,
  38429. loc: {
  38430. column,
  38431. file: this.id,
  38432. line
  38433. },
  38434. message: `Error when using sourcemap for reporting an error: ${e.message}`,
  38435. pos
  38436. });
  38437. }
  38438. augmentCodeLocation(props, { column, line }, code, this.id);
  38439. }
  38440. addModulesToImportDescriptions(importDescription) {
  38441. for (const name of Object.keys(importDescription)) {
  38442. const specifier = importDescription[name];
  38443. const id = this.resolvedIds[specifier.source].id;
  38444. specifier.module = this.graph.modulesById.get(id);
  38445. }
  38446. }
  38447. addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies) {
  38448. const handledDependencies = new Set();
  38449. const addSideEffectDependencies = (possibleDependencies) => {
  38450. for (const dependency of possibleDependencies) {
  38451. if (handledDependencies.has(dependency)) {
  38452. continue;
  38453. }
  38454. handledDependencies.add(dependency);
  38455. if (necessaryDependencies.has(dependency)) {
  38456. relevantDependencies.add(dependency);
  38457. continue;
  38458. }
  38459. if (!(dependency.info.hasModuleSideEffects || alwaysCheckedDependencies.has(dependency))) {
  38460. continue;
  38461. }
  38462. if (dependency instanceof ExternalModule || dependency.hasEffects()) {
  38463. relevantDependencies.add(dependency);
  38464. continue;
  38465. }
  38466. addSideEffectDependencies(dependency.dependencies);
  38467. }
  38468. };
  38469. addSideEffectDependencies(this.dependencies);
  38470. addSideEffectDependencies(alwaysCheckedDependencies);
  38471. }
  38472. includeAndGetAdditionalMergedNamespaces() {
  38473. const mergedNamespaces = [];
  38474. for (const module of this.exportAllModules) {
  38475. if (module instanceof ExternalModule) {
  38476. const externalVariable = module.getVariableForExportName('*');
  38477. externalVariable.include();
  38478. this.imports.add(externalVariable);
  38479. mergedNamespaces.push(externalVariable);
  38480. }
  38481. else if (module.info.syntheticNamedExports) {
  38482. const syntheticNamespace = module.getSyntheticNamespace();
  38483. syntheticNamespace.include();
  38484. this.imports.add(syntheticNamespace);
  38485. mergedNamespaces.push(syntheticNamespace);
  38486. }
  38487. }
  38488. return mergedNamespaces;
  38489. }
  38490. includeDynamicImport(node) {
  38491. const resolution = this.dynamicImports.find(dynamicImport => dynamicImport.node === node).resolution;
  38492. if (resolution instanceof Module) {
  38493. resolution.includedDynamicImporters.push(this);
  38494. resolution.includeAllExports(true);
  38495. }
  38496. }
  38497. includeVariable(variable) {
  38498. if (!variable.included) {
  38499. variable.include();
  38500. this.graph.needsTreeshakingPass = true;
  38501. const variableModule = variable.module;
  38502. if (variableModule && variableModule instanceof Module) {
  38503. if (!variableModule.isExecuted) {
  38504. markModuleAndImpureDependenciesAsExecuted(variableModule);
  38505. }
  38506. if (variableModule !== this) {
  38507. const sideEffectModules = getAndExtendSideEffectModules(variable, this);
  38508. for (const module of sideEffectModules) {
  38509. if (!module.isExecuted) {
  38510. markModuleAndImpureDependenciesAsExecuted(module);
  38511. }
  38512. }
  38513. }
  38514. }
  38515. }
  38516. }
  38517. includeVariableInModule(variable) {
  38518. this.includeVariable(variable);
  38519. const variableModule = variable.module;
  38520. if (variableModule && variableModule !== this) {
  38521. this.imports.add(variable);
  38522. }
  38523. }
  38524. shimMissingExport(name) {
  38525. this.options.onwarn({
  38526. code: 'SHIMMED_EXPORT',
  38527. exporter: relativeId(this.id),
  38528. exportName: name,
  38529. message: `Missing export "${name}" has been shimmed in module ${relativeId(this.id)}.`
  38530. });
  38531. this.exports[name] = MISSING_EXPORT_SHIM_DESCRIPTION;
  38532. }
  38533. }
  38534. // if there is a cyclic import in the reexport chain, we should not
  38535. // import from the original module but from the cyclic module to not
  38536. // mess up execution order.
  38537. function setAlternativeExporterIfCyclic(variable, importer, reexporter) {
  38538. if (variable.module instanceof Module && variable.module !== reexporter) {
  38539. const exporterCycles = variable.module.cycles;
  38540. if (exporterCycles.size > 0) {
  38541. const importerCycles = reexporter.cycles;
  38542. for (const cycleSymbol of importerCycles) {
  38543. if (exporterCycles.has(cycleSymbol)) {
  38544. importer.alternativeReexportModules.set(variable, reexporter);
  38545. break;
  38546. }
  38547. }
  38548. }
  38549. }
  38550. }
  38551. class Source {
  38552. constructor(filename, content) {
  38553. this.isOriginal = true;
  38554. this.filename = filename;
  38555. this.content = content;
  38556. }
  38557. traceSegment(line, column, name) {
  38558. return { line, column, name, source: this };
  38559. }
  38560. }
  38561. class Link {
  38562. constructor(map, sources) {
  38563. this.sources = sources;
  38564. this.names = map.names;
  38565. this.mappings = map.mappings;
  38566. }
  38567. traceMappings() {
  38568. const sources = [];
  38569. const sourcesContent = [];
  38570. const names = [];
  38571. const mappings = [];
  38572. for (const line of this.mappings) {
  38573. const tracedLine = [];
  38574. for (const segment of line) {
  38575. if (segment.length == 1)
  38576. continue;
  38577. const source = this.sources[segment[1]];
  38578. if (!source)
  38579. continue;
  38580. const traced = source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : '');
  38581. if (traced) {
  38582. // newer sources are more likely to be used, so search backwards.
  38583. let sourceIndex = sources.lastIndexOf(traced.source.filename);
  38584. if (sourceIndex === -1) {
  38585. sourceIndex = sources.length;
  38586. sources.push(traced.source.filename);
  38587. sourcesContent[sourceIndex] = traced.source.content;
  38588. }
  38589. else if (sourcesContent[sourceIndex] == null) {
  38590. sourcesContent[sourceIndex] = traced.source.content;
  38591. }
  38592. else if (traced.source.content != null &&
  38593. sourcesContent[sourceIndex] !== traced.source.content) {
  38594. return error({
  38595. message: `Multiple conflicting contents for sourcemap source ${traced.source.filename}`
  38596. });
  38597. }
  38598. const tracedSegment = [
  38599. segment[0],
  38600. sourceIndex,
  38601. traced.line,
  38602. traced.column
  38603. ];
  38604. if (traced.name) {
  38605. let nameIndex = names.indexOf(traced.name);
  38606. if (nameIndex === -1) {
  38607. nameIndex = names.length;
  38608. names.push(traced.name);
  38609. }
  38610. tracedSegment[4] = nameIndex;
  38611. }
  38612. tracedLine.push(tracedSegment);
  38613. }
  38614. }
  38615. mappings.push(tracedLine);
  38616. }
  38617. return { sources, sourcesContent, names, mappings };
  38618. }
  38619. traceSegment(line, column, name) {
  38620. const segments = this.mappings[line];
  38621. if (!segments)
  38622. return null;
  38623. // binary search through segments for the given column
  38624. let i = 0;
  38625. let j = segments.length - 1;
  38626. while (i <= j) {
  38627. const m = (i + j) >> 1;
  38628. const segment = segments[m];
  38629. if (segment[0] === column) {
  38630. if (segment.length == 1)
  38631. return null;
  38632. const source = this.sources[segment[1]];
  38633. if (!source)
  38634. return null;
  38635. return source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : name);
  38636. }
  38637. if (segment[0] > column) {
  38638. j = m - 1;
  38639. }
  38640. else {
  38641. i = m + 1;
  38642. }
  38643. }
  38644. return null;
  38645. }
  38646. }
  38647. function getLinkMap(warn) {
  38648. return function linkMap(source, map) {
  38649. if (map.mappings) {
  38650. return new Link(map, [source]);
  38651. }
  38652. warn({
  38653. code: 'SOURCEMAP_BROKEN',
  38654. message: `Sourcemap is likely to be incorrect: a plugin (${map.plugin}) was used to transform ` +
  38655. "files, but didn't generate a sourcemap for the transformation. Consult the plugin " +
  38656. 'documentation for help',
  38657. plugin: map.plugin,
  38658. url: `https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect`
  38659. });
  38660. return new Link({
  38661. mappings: [],
  38662. names: []
  38663. }, [source]);
  38664. };
  38665. }
  38666. function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, linkMap) {
  38667. let source;
  38668. if (!originalSourcemap) {
  38669. source = new Source(id, originalCode);
  38670. }
  38671. else {
  38672. const sources = originalSourcemap.sources;
  38673. const sourcesContent = originalSourcemap.sourcesContent || [];
  38674. const directory = dirname(id) || '.';
  38675. const sourceRoot = originalSourcemap.sourceRoot || '.';
  38676. const baseSources = sources.map((source, i) => new Source(resolve$1(directory, sourceRoot, source), sourcesContent[i]));
  38677. source = new Link(originalSourcemap, baseSources);
  38678. }
  38679. return sourcemapChain.reduce(linkMap, source);
  38680. }
  38681. function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent, warn) {
  38682. const linkMap = getLinkMap(warn);
  38683. const moduleSources = modules
  38684. .filter(module => !module.excludeFromSourcemap)
  38685. .map(module => getCollapsedSourcemap(module.id, module.originalCode, module.originalSourcemap, module.sourcemapChain, linkMap));
  38686. // DecodedSourceMap (from magic-string) uses a number[] instead of the more
  38687. // correct SourceMapSegment tuples. Cast it here to gain type safety.
  38688. let source = new Link(map, moduleSources);
  38689. source = bundleSourcemapChain.reduce(linkMap, source);
  38690. let { sources, sourcesContent, names, mappings } = source.traceMappings();
  38691. if (file) {
  38692. const directory = dirname(file);
  38693. sources = sources.map((source) => relative$1(directory, source));
  38694. file = basename(file);
  38695. }
  38696. sourcesContent = (excludeContent ? null : sourcesContent);
  38697. return new SourceMap({ file, sources, sourcesContent, names, mappings });
  38698. }
  38699. function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn) {
  38700. if (!sourcemapChain.length) {
  38701. return originalSourcemap;
  38702. }
  38703. const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(warn));
  38704. const map = source.traceMappings();
  38705. return { version: 3, ...map };
  38706. }
  38707. const createHash = () => createHash$1();
  38708. const DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT = {
  38709. amd: deconflictImportsOther,
  38710. cjs: deconflictImportsOther,
  38711. es: deconflictImportsEsmOrSystem,
  38712. iife: deconflictImportsOther,
  38713. system: deconflictImportsEsmOrSystem,
  38714. umd: deconflictImportsOther
  38715. };
  38716. function deconflictChunk(modules, dependenciesToBeDeconflicted, imports, usedNames, format, interop, preserveModules, externalLiveBindings, chunkByModule, syntheticExports, exportNamesByVariable, accessedGlobalsByScope, includedNamespaces) {
  38717. const reversedModules = modules.slice().reverse();
  38718. for (const module of reversedModules) {
  38719. module.scope.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
  38720. }
  38721. deconflictTopLevelVariables(usedNames, reversedModules, includedNamespaces);
  38722. DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT[format](usedNames, imports, dependenciesToBeDeconflicted, interop, preserveModules, externalLiveBindings, chunkByModule, syntheticExports);
  38723. for (const module of reversedModules) {
  38724. module.scope.deconflict(format, exportNamesByVariable, accessedGlobalsByScope);
  38725. }
  38726. }
  38727. function deconflictImportsEsmOrSystem(usedNames, imports, dependenciesToBeDeconflicted, _interop, preserveModules, _externalLiveBindings, chunkByModule, syntheticExports) {
  38728. // This is needed for namespace reexports
  38729. for (const dependency of dependenciesToBeDeconflicted.dependencies) {
  38730. if (preserveModules || dependency instanceof ExternalModule) {
  38731. dependency.variableName = getSafeName(dependency.suggestedVariableName, usedNames);
  38732. }
  38733. }
  38734. for (const variable of imports) {
  38735. const module = variable.module;
  38736. const name = variable.name;
  38737. if (variable.isNamespace && (preserveModules || module instanceof ExternalModule)) {
  38738. variable.setRenderNames(null, (module instanceof ExternalModule ? module : chunkByModule.get(module)).variableName);
  38739. }
  38740. else if (module instanceof ExternalModule && name === 'default') {
  38741. variable.setRenderNames(null, getSafeName([...module.exportedVariables].some(([exportedVariable, exportedName]) => exportedName === '*' && exportedVariable.included)
  38742. ? module.suggestedVariableName + '__default'
  38743. : module.suggestedVariableName, usedNames));
  38744. }
  38745. else {
  38746. variable.setRenderNames(null, getSafeName(name, usedNames));
  38747. }
  38748. }
  38749. for (const variable of syntheticExports) {
  38750. variable.setRenderNames(null, getSafeName(variable.name, usedNames));
  38751. }
  38752. }
  38753. function deconflictImportsOther(usedNames, imports, { deconflictedDefault, deconflictedNamespace, dependencies }, interop, preserveModules, externalLiveBindings, chunkByModule) {
  38754. for (const chunkOrExternalModule of dependencies) {
  38755. chunkOrExternalModule.variableName = getSafeName(chunkOrExternalModule.suggestedVariableName, usedNames);
  38756. }
  38757. for (const externalModuleOrChunk of deconflictedNamespace) {
  38758. externalModuleOrChunk.namespaceVariableName = getSafeName(`${externalModuleOrChunk.suggestedVariableName}__namespace`, usedNames);
  38759. }
  38760. for (const externalModule of deconflictedDefault) {
  38761. if (deconflictedNamespace.has(externalModule) &&
  38762. canDefaultBeTakenFromNamespace(String(interop(externalModule.id)), externalLiveBindings)) {
  38763. externalModule.defaultVariableName = externalModule.namespaceVariableName;
  38764. }
  38765. else {
  38766. externalModule.defaultVariableName = getSafeName(`${externalModule.suggestedVariableName}__default`, usedNames);
  38767. }
  38768. }
  38769. for (const variable of imports) {
  38770. const module = variable.module;
  38771. if (module instanceof ExternalModule) {
  38772. const name = variable.name;
  38773. if (name === 'default') {
  38774. const moduleInterop = String(interop(module.id));
  38775. const variableName = defaultInteropHelpersByInteropType[moduleInterop]
  38776. ? module.defaultVariableName
  38777. : module.variableName;
  38778. if (isDefaultAProperty(moduleInterop, externalLiveBindings)) {
  38779. variable.setRenderNames(variableName, 'default');
  38780. }
  38781. else {
  38782. variable.setRenderNames(null, variableName);
  38783. }
  38784. }
  38785. else if (name === '*') {
  38786. variable.setRenderNames(null, namespaceInteropHelpersByInteropType[String(interop(module.id))]
  38787. ? module.namespaceVariableName
  38788. : module.variableName);
  38789. }
  38790. else {
  38791. // if the second parameter is `null`, it uses its "name" for the property name
  38792. variable.setRenderNames(module.variableName, null);
  38793. }
  38794. }
  38795. else {
  38796. const chunk = chunkByModule.get(module);
  38797. if (preserveModules && variable.isNamespace) {
  38798. variable.setRenderNames(null, chunk.exportMode === 'default' ? chunk.namespaceVariableName : chunk.variableName);
  38799. }
  38800. else if (chunk.exportMode === 'default') {
  38801. variable.setRenderNames(null, chunk.variableName);
  38802. }
  38803. else {
  38804. variable.setRenderNames(chunk.variableName, chunk.getVariableExportName(variable));
  38805. }
  38806. }
  38807. }
  38808. }
  38809. function deconflictTopLevelVariables(usedNames, modules, includedNamespaces) {
  38810. for (const module of modules) {
  38811. for (const variable of module.scope.variables.values()) {
  38812. if (variable.included &&
  38813. // this will only happen for exports in some formats
  38814. !(variable.renderBaseName ||
  38815. (variable instanceof ExportDefaultVariable && variable.getOriginalVariable() !== variable))) {
  38816. variable.setRenderNames(null, getSafeName(variable.name, usedNames));
  38817. }
  38818. }
  38819. if (includedNamespaces.has(module)) {
  38820. const namespace = module.namespace;
  38821. namespace.setRenderNames(null, getSafeName(namespace.name, usedNames));
  38822. }
  38823. }
  38824. }
  38825. const needsEscapeRegEx = /[\\'\r\n\u2028\u2029]/;
  38826. const quoteNewlineRegEx = /(['\r\n\u2028\u2029])/g;
  38827. const backSlashRegEx = /\\/g;
  38828. function escapeId(id) {
  38829. if (!id.match(needsEscapeRegEx))
  38830. return id;
  38831. return id.replace(backSlashRegEx, '\\\\').replace(quoteNewlineRegEx, '\\$1');
  38832. }
  38833. function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariable) {
  38834. let nameIndex = 0;
  38835. for (const variable of exports) {
  38836. let exportName = variable.name[0];
  38837. if (exportsByName[exportName]) {
  38838. do {
  38839. exportName = toBase64(++nameIndex);
  38840. // skip past leading number identifiers
  38841. if (exportName.charCodeAt(0) === 49 /* '1' */) {
  38842. nameIndex += 9 * 64 ** (exportName.length - 1);
  38843. exportName = toBase64(nameIndex);
  38844. }
  38845. } while (RESERVED_NAMES[exportName] || exportsByName[exportName]);
  38846. }
  38847. exportsByName[exportName] = variable;
  38848. exportNamesByVariable.set(variable, [exportName]);
  38849. }
  38850. }
  38851. function assignExportsToNames(exports, exportsByName, exportNamesByVariable) {
  38852. for (const variable of exports) {
  38853. let nameIndex = 0;
  38854. let exportName = variable.name;
  38855. while (exportsByName[exportName]) {
  38856. exportName = variable.name + '$' + ++nameIndex;
  38857. }
  38858. exportsByName[exportName] = variable;
  38859. exportNamesByVariable.set(variable, [exportName]);
  38860. }
  38861. }
  38862. function getExportMode(chunk, { exports: exportMode, name, format }, unsetOptions, facadeModuleId, warn) {
  38863. const exportKeys = chunk.getExportNames();
  38864. if (exportMode === 'default') {
  38865. if (exportKeys.length !== 1 || exportKeys[0] !== 'default') {
  38866. return error(errIncompatibleExportOptionValue('default', exportKeys, facadeModuleId));
  38867. }
  38868. }
  38869. else if (exportMode === 'none' && exportKeys.length) {
  38870. return error(errIncompatibleExportOptionValue('none', exportKeys, facadeModuleId));
  38871. }
  38872. if (exportMode === 'auto') {
  38873. if (exportKeys.length === 0) {
  38874. exportMode = 'none';
  38875. }
  38876. else if (exportKeys.length === 1 && exportKeys[0] === 'default') {
  38877. if (format === 'cjs' && unsetOptions.has('exports')) {
  38878. warn(errPreferNamedExports(facadeModuleId));
  38879. }
  38880. exportMode = 'default';
  38881. }
  38882. else {
  38883. if (format !== 'es' && exportKeys.indexOf('default') !== -1) {
  38884. warn(errMixedExport(facadeModuleId, name));
  38885. }
  38886. exportMode = 'named';
  38887. }
  38888. }
  38889. return exportMode;
  38890. }
  38891. function guessIndentString(code) {
  38892. const lines = code.split('\n');
  38893. const tabbed = lines.filter(line => /^\t+/.test(line));
  38894. const spaced = lines.filter(line => /^ {2,}/.test(line));
  38895. if (tabbed.length === 0 && spaced.length === 0) {
  38896. return null;
  38897. }
  38898. // More lines tabbed than spaced? Assume tabs, and
  38899. // default to tabs in the case of a tie (or nothing
  38900. // to go on)
  38901. if (tabbed.length >= spaced.length) {
  38902. return '\t';
  38903. }
  38904. // Otherwise, we need to guess the multiple
  38905. const min = spaced.reduce((previous, current) => {
  38906. const numSpaces = /^ +/.exec(current)[0].length;
  38907. return Math.min(numSpaces, previous);
  38908. }, Infinity);
  38909. return new Array(min + 1).join(' ');
  38910. }
  38911. function getIndentString(modules, options) {
  38912. if (options.indent !== true)
  38913. return options.indent;
  38914. for (let i = 0; i < modules.length; i++) {
  38915. const indent = guessIndentString(modules[i].originalCode);
  38916. if (indent !== null)
  38917. return indent;
  38918. }
  38919. return '\t';
  38920. }
  38921. function getStaticDependencies(chunk, orderedModules, chunkByModule) {
  38922. const staticDependencyBlocks = [];
  38923. const handledDependencies = new Set();
  38924. for (let modulePos = orderedModules.length - 1; modulePos >= 0; modulePos--) {
  38925. const module = orderedModules[modulePos];
  38926. if (!handledDependencies.has(module)) {
  38927. const staticDependencies = [];
  38928. addStaticDependencies(module, staticDependencies, handledDependencies, chunk, chunkByModule);
  38929. staticDependencyBlocks.unshift(staticDependencies);
  38930. }
  38931. }
  38932. const dependencies = new Set();
  38933. for (const block of staticDependencyBlocks) {
  38934. for (const dependency of block) {
  38935. dependencies.add(dependency);
  38936. }
  38937. }
  38938. return dependencies;
  38939. }
  38940. function addStaticDependencies(module, staticDependencies, handledModules, chunk, chunkByModule) {
  38941. const dependencies = module.getDependenciesToBeIncluded();
  38942. for (const dependency of dependencies) {
  38943. if (dependency instanceof ExternalModule) {
  38944. staticDependencies.push(dependency);
  38945. continue;
  38946. }
  38947. const dependencyChunk = chunkByModule.get(dependency);
  38948. if (dependencyChunk !== chunk) {
  38949. staticDependencies.push(dependencyChunk);
  38950. continue;
  38951. }
  38952. if (!handledModules.has(dependency)) {
  38953. handledModules.add(dependency);
  38954. addStaticDependencies(dependency, staticDependencies, handledModules, chunk, chunkByModule);
  38955. }
  38956. }
  38957. }
  38958. function decodedSourcemap(map) {
  38959. if (!map)
  38960. return null;
  38961. if (typeof map === 'string') {
  38962. map = JSON.parse(map);
  38963. }
  38964. if (map.mappings === '') {
  38965. return {
  38966. mappings: [],
  38967. names: [],
  38968. sources: [],
  38969. version: 3
  38970. };
  38971. }
  38972. let mappings;
  38973. if (typeof map.mappings === 'string') {
  38974. mappings = decode(map.mappings);
  38975. }
  38976. else {
  38977. mappings = map.mappings;
  38978. }
  38979. return { ...map, mappings };
  38980. }
  38981. function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemapChain }) {
  38982. const renderChunkReducer = (code, result, plugin) => {
  38983. if (result == null)
  38984. return code;
  38985. if (typeof result === 'string')
  38986. result = {
  38987. code: result,
  38988. map: undefined
  38989. };
  38990. // strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
  38991. if (result.map !== null) {
  38992. const map = decodedSourcemap(result.map);
  38993. sourcemapChain.push(map || { missing: true, plugin: plugin.name });
  38994. }
  38995. return result.code;
  38996. };
  38997. return outputPluginDriver.hookReduceArg0('renderChunk', [code, renderChunk, options], renderChunkReducer);
  38998. }
  38999. function renderNamePattern(pattern, patternName, replacements) {
  39000. if (!isPlainPathFragment(pattern))
  39001. return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths and must not contain invalid characters.`));
  39002. return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
  39003. if (!replacements.hasOwnProperty(type)) {
  39004. return error(errFailedValidation(`"[${type}]" is not a valid placeholder in "${patternName}" pattern.`));
  39005. }
  39006. const replacement = replacements[type]();
  39007. if (!isPlainPathFragment(replacement))
  39008. return error(errFailedValidation(`Invalid substitution "${replacement}" for placeholder "[${type}]" in "${patternName}" pattern, can be neither absolute nor relative path.`));
  39009. return replacement;
  39010. });
  39011. }
  39012. function makeUnique(name, existingNames) {
  39013. const existingNamesLowercase = new Set(Object.keys(existingNames).map(key => key.toLowerCase()));
  39014. if (!existingNamesLowercase.has(name.toLocaleLowerCase()))
  39015. return name;
  39016. const ext = extname$1(name);
  39017. name = name.substr(0, name.length - ext.length);
  39018. let uniqueName, uniqueIndex = 1;
  39019. while (existingNamesLowercase.has((uniqueName = name + ++uniqueIndex + ext).toLowerCase()))
  39020. ;
  39021. return uniqueName;
  39022. }
  39023. const NON_ASSET_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx'];
  39024. function getGlobalName(module, globals, hasExports, warn) {
  39025. const globalName = typeof globals === 'function' ? globals(module.id) : globals[module.id];
  39026. if (globalName) {
  39027. return globalName;
  39028. }
  39029. if (hasExports) {
  39030. warn({
  39031. code: 'MISSING_GLOBAL_NAME',
  39032. guess: module.variableName,
  39033. message: `No name was provided for external module '${module.id}' in output.globals – guessing '${module.variableName}'`,
  39034. source: module.id
  39035. });
  39036. return module.variableName;
  39037. }
  39038. }
  39039. class Chunk {
  39040. constructor(orderedModules, inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, manualChunkAlias) {
  39041. this.orderedModules = orderedModules;
  39042. this.inputOptions = inputOptions;
  39043. this.outputOptions = outputOptions;
  39044. this.unsetOptions = unsetOptions;
  39045. this.pluginDriver = pluginDriver;
  39046. this.modulesById = modulesById;
  39047. this.chunkByModule = chunkByModule;
  39048. this.facadeChunkByModule = facadeChunkByModule;
  39049. this.includedNamespaces = includedNamespaces;
  39050. this.manualChunkAlias = manualChunkAlias;
  39051. this.entryModules = [];
  39052. this.exportMode = 'named';
  39053. this.facadeModule = null;
  39054. this.id = null;
  39055. this.namespaceVariableName = '';
  39056. this.variableName = '';
  39057. this.accessedGlobalsByScope = new Map();
  39058. this.dependencies = new Set();
  39059. this.dynamicDependencies = new Set();
  39060. this.dynamicEntryModules = [];
  39061. this.exportNamesByVariable = new Map();
  39062. this.exports = new Set();
  39063. this.exportsByName = Object.create(null);
  39064. this.fileName = null;
  39065. this.implicitEntryModules = [];
  39066. this.implicitlyLoadedBefore = new Set();
  39067. this.imports = new Set();
  39068. this.indentString = undefined;
  39069. this.isEmpty = true;
  39070. this.name = null;
  39071. this.needsExportsShim = false;
  39072. this.renderedDependencies = null;
  39073. this.renderedExports = null;
  39074. this.renderedHash = undefined;
  39075. this.renderedModules = Object.create(null);
  39076. this.renderedModuleSources = new Map();
  39077. this.renderedSource = null;
  39078. this.sortedExportNames = null;
  39079. this.strictFacade = false;
  39080. this.usedModules = undefined;
  39081. this.execIndex = orderedModules.length > 0 ? orderedModules[0].execIndex : Infinity;
  39082. const chunkModules = new Set(orderedModules);
  39083. for (const module of orderedModules) {
  39084. if (module.namespace.included) {
  39085. includedNamespaces.add(module);
  39086. }
  39087. if (this.isEmpty && module.isIncluded()) {
  39088. this.isEmpty = false;
  39089. }
  39090. if (module.info.isEntry || outputOptions.preserveModules) {
  39091. this.entryModules.push(module);
  39092. }
  39093. for (const importer of module.includedDynamicImporters) {
  39094. if (!chunkModules.has(importer)) {
  39095. this.dynamicEntryModules.push(module);
  39096. // Modules with synthetic exports need an artificial namespace for dynamic imports
  39097. if (module.info.syntheticNamedExports && !outputOptions.preserveModules) {
  39098. includedNamespaces.add(module);
  39099. this.exports.add(module.namespace);
  39100. }
  39101. }
  39102. }
  39103. if (module.implicitlyLoadedAfter.size > 0) {
  39104. this.implicitEntryModules.push(module);
  39105. }
  39106. }
  39107. this.suggestedVariableName = makeLegal(this.generateVariableName());
  39108. }
  39109. static generateFacade(inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, facadedModule, facadeName) {
  39110. const chunk = new Chunk([], inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, includedNamespaces, null);
  39111. chunk.assignFacadeName(facadeName, facadedModule);
  39112. if (!facadeChunkByModule.has(facadedModule)) {
  39113. facadeChunkByModule.set(facadedModule, chunk);
  39114. }
  39115. for (const dependency of facadedModule.getDependenciesToBeIncluded()) {
  39116. chunk.dependencies.add(dependency instanceof Module ? chunkByModule.get(dependency) : dependency);
  39117. }
  39118. if (!chunk.dependencies.has(chunkByModule.get(facadedModule)) &&
  39119. facadedModule.info.hasModuleSideEffects &&
  39120. facadedModule.hasEffects()) {
  39121. chunk.dependencies.add(chunkByModule.get(facadedModule));
  39122. }
  39123. chunk.ensureReexportsAreAvailableForModule(facadedModule);
  39124. chunk.facadeModule = facadedModule;
  39125. chunk.strictFacade = true;
  39126. return chunk;
  39127. }
  39128. canModuleBeFacade(module, exposedVariables) {
  39129. const moduleExportNamesByVariable = module.getExportNamesByVariable();
  39130. for (const exposedVariable of this.exports) {
  39131. if (!moduleExportNamesByVariable.has(exposedVariable)) {
  39132. if (moduleExportNamesByVariable.size === 0 &&
  39133. module.isUserDefinedEntryPoint &&
  39134. module.preserveSignature === 'strict' &&
  39135. this.unsetOptions.has('preserveEntrySignatures')) {
  39136. this.inputOptions.onwarn({
  39137. code: 'EMPTY_FACADE',
  39138. id: module.id,
  39139. message: `To preserve the export signature of the entry module "${relativeId(module.id)}", an empty facade chunk was created. This often happens when creating a bundle for a web app where chunks are placed in script tags and exports are ignored. In this case it is recommended to set "preserveEntrySignatures: false" to avoid this and reduce the number of chunks. Otherwise if this is intentional, set "preserveEntrySignatures: 'strict'" explicitly to silence this warning.`,
  39140. url: 'https://rollupjs.org/guide/en/#preserveentrysignatures'
  39141. });
  39142. }
  39143. return false;
  39144. }
  39145. }
  39146. for (const exposedVariable of exposedVariables) {
  39147. if (!(moduleExportNamesByVariable.has(exposedVariable) || exposedVariable.module === module)) {
  39148. return false;
  39149. }
  39150. }
  39151. return true;
  39152. }
  39153. generateExports() {
  39154. this.sortedExportNames = null;
  39155. const remainingExports = new Set(this.exports);
  39156. if (this.facadeModule !== null &&
  39157. (this.facadeModule.preserveSignature !== false || this.strictFacade)) {
  39158. const exportNamesByVariable = this.facadeModule.getExportNamesByVariable();
  39159. for (const [variable, exportNames] of exportNamesByVariable) {
  39160. this.exportNamesByVariable.set(variable, [...exportNames]);
  39161. for (const exportName of exportNames) {
  39162. this.exportsByName[exportName] = variable;
  39163. }
  39164. remainingExports.delete(variable);
  39165. }
  39166. }
  39167. if (this.outputOptions.minifyInternalExports) {
  39168. assignExportsToMangledNames(remainingExports, this.exportsByName, this.exportNamesByVariable);
  39169. }
  39170. else {
  39171. assignExportsToNames(remainingExports, this.exportsByName, this.exportNamesByVariable);
  39172. }
  39173. if (this.outputOptions.preserveModules || (this.facadeModule && this.facadeModule.info.isEntry))
  39174. this.exportMode = getExportMode(this, this.outputOptions, this.unsetOptions, this.facadeModule.id, this.inputOptions.onwarn);
  39175. }
  39176. generateFacades() {
  39177. var _a;
  39178. const facades = [];
  39179. const entryModules = new Set([...this.entryModules, ...this.implicitEntryModules]);
  39180. const exposedVariables = new Set(this.dynamicEntryModules.map(module => module.namespace));
  39181. for (const module of entryModules) {
  39182. if (module.preserveSignature) {
  39183. for (const exportedVariable of module.getExportNamesByVariable().keys()) {
  39184. exposedVariables.add(exportedVariable);
  39185. }
  39186. }
  39187. }
  39188. for (const module of entryModules) {
  39189. const requiredFacades = Array.from(module.userChunkNames, name => ({
  39190. name
  39191. }));
  39192. if (requiredFacades.length === 0 && module.isUserDefinedEntryPoint) {
  39193. requiredFacades.push({});
  39194. }
  39195. requiredFacades.push(...Array.from(module.chunkFileNames, fileName => ({ fileName })));
  39196. if (requiredFacades.length === 0) {
  39197. requiredFacades.push({});
  39198. }
  39199. if (!this.facadeModule) {
  39200. const needsStrictFacade = module.preserveSignature === 'strict' ||
  39201. (module.preserveSignature === 'exports-only' &&
  39202. module.getExportNamesByVariable().size !== 0);
  39203. if (!needsStrictFacade ||
  39204. this.outputOptions.preserveModules ||
  39205. this.canModuleBeFacade(module, exposedVariables)) {
  39206. this.facadeModule = module;
  39207. this.facadeChunkByModule.set(module, this);
  39208. if (module.preserveSignature) {
  39209. this.strictFacade = needsStrictFacade;
  39210. }
  39211. this.assignFacadeName(requiredFacades.shift(), module);
  39212. }
  39213. }
  39214. for (const facadeName of requiredFacades) {
  39215. facades.push(Chunk.generateFacade(this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.modulesById, this.chunkByModule, this.facadeChunkByModule, this.includedNamespaces, module, facadeName));
  39216. }
  39217. }
  39218. for (const module of this.dynamicEntryModules) {
  39219. if (module.info.syntheticNamedExports)
  39220. continue;
  39221. if (!this.facadeModule && this.canModuleBeFacade(module, exposedVariables)) {
  39222. this.facadeModule = module;
  39223. this.facadeChunkByModule.set(module, this);
  39224. this.strictFacade = true;
  39225. this.assignFacadeName({}, module);
  39226. }
  39227. else if (this.facadeModule === module &&
  39228. !this.strictFacade &&
  39229. this.canModuleBeFacade(module, exposedVariables)) {
  39230. this.strictFacade = true;
  39231. }
  39232. else if (!((_a = this.facadeChunkByModule.get(module)) === null || _a === void 0 ? void 0 : _a.strictFacade)) {
  39233. this.includedNamespaces.add(module);
  39234. this.exports.add(module.namespace);
  39235. }
  39236. }
  39237. return facades;
  39238. }
  39239. generateId(addons, options, existingNames, includeHash) {
  39240. if (this.fileName !== null) {
  39241. return this.fileName;
  39242. }
  39243. const [pattern, patternName] = this.facadeModule && this.facadeModule.isUserDefinedEntryPoint
  39244. ? [options.entryFileNames, 'output.entryFileNames']
  39245. : [options.chunkFileNames, 'output.chunkFileNames'];
  39246. return makeUnique(renderNamePattern(typeof pattern === 'function' ? pattern(this.getChunkInfo()) : pattern, patternName, {
  39247. format: () => options.format,
  39248. hash: () => includeHash
  39249. ? this.computeContentHashWithDependencies(addons, options, existingNames)
  39250. : '[hash]',
  39251. name: () => this.getChunkName()
  39252. }), existingNames);
  39253. }
  39254. generateIdPreserveModules(preserveModulesRelativeDir, options, existingNames, unsetOptions) {
  39255. const id = this.orderedModules[0].id;
  39256. const sanitizedId = sanitizeFileName(id);
  39257. let path;
  39258. if (isAbsolute(id)) {
  39259. const extension = extname$1(id);
  39260. const pattern = unsetOptions.has('entryFileNames')
  39261. ? NON_ASSET_EXTENSIONS.includes(extension)
  39262. ? '[name].js'
  39263. : '[name][extname].js'
  39264. : options.entryFileNames;
  39265. const currentDir = dirname(sanitizedId);
  39266. const fileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getChunkInfo()) : pattern, 'output.entryFileNames', {
  39267. ext: () => extension.substr(1),
  39268. extname: () => extension,
  39269. format: () => options.format,
  39270. name: () => this.getChunkName()
  39271. });
  39272. const currentPath = `${currentDir}/${fileName}`;
  39273. const { preserveModulesRoot } = options;
  39274. if (preserveModulesRoot && currentPath.startsWith(preserveModulesRoot)) {
  39275. path = currentPath.slice(preserveModulesRoot.length).replace(/^[\\/]/, '');
  39276. }
  39277. else {
  39278. path = relative(preserveModulesRelativeDir, currentPath);
  39279. }
  39280. }
  39281. else {
  39282. path = `_virtual/${basename(sanitizedId)}`;
  39283. }
  39284. return makeUnique(normalize(path), existingNames);
  39285. }
  39286. getChunkInfo() {
  39287. const facadeModule = this.facadeModule;
  39288. const getChunkName = this.getChunkName.bind(this);
  39289. return {
  39290. exports: this.getExportNames(),
  39291. facadeModuleId: facadeModule && facadeModule.id,
  39292. isDynamicEntry: this.dynamicEntryModules.length > 0,
  39293. isEntry: facadeModule !== null && facadeModule.info.isEntry,
  39294. isImplicitEntry: this.implicitEntryModules.length > 0,
  39295. modules: this.renderedModules,
  39296. get name() {
  39297. return getChunkName();
  39298. },
  39299. type: 'chunk'
  39300. };
  39301. }
  39302. getChunkInfoWithFileNames() {
  39303. return Object.assign(this.getChunkInfo(), {
  39304. code: undefined,
  39305. dynamicImports: Array.from(this.dynamicDependencies, getId),
  39306. fileName: this.id,
  39307. implicitlyLoadedBefore: Array.from(this.implicitlyLoadedBefore, getId),
  39308. importedBindings: this.getImportedBindingsPerDependency(),
  39309. imports: Array.from(this.dependencies, getId),
  39310. map: undefined,
  39311. referencedFiles: this.getReferencedFiles()
  39312. });
  39313. }
  39314. getChunkName() {
  39315. return this.name || (this.name = sanitizeFileName(this.getFallbackChunkName()));
  39316. }
  39317. getExportNames() {
  39318. return (this.sortedExportNames || (this.sortedExportNames = Object.keys(this.exportsByName).sort()));
  39319. }
  39320. getRenderedHash() {
  39321. if (this.renderedHash)
  39322. return this.renderedHash;
  39323. const hash = createHash();
  39324. const hashAugmentation = this.pluginDriver.hookReduceValueSync('augmentChunkHash', '', [this.getChunkInfo()], (augmentation, pluginHash) => {
  39325. if (pluginHash) {
  39326. augmentation += pluginHash;
  39327. }
  39328. return augmentation;
  39329. });
  39330. hash.update(hashAugmentation);
  39331. hash.update(this.renderedSource.toString());
  39332. hash.update(this.getExportNames()
  39333. .map(exportName => {
  39334. const variable = this.exportsByName[exportName];
  39335. return `${relativeId(variable.module.id).replace(/\\/g, '/')}:${variable.name}:${exportName}`;
  39336. })
  39337. .join(','));
  39338. return (this.renderedHash = hash.digest('hex'));
  39339. }
  39340. getVariableExportName(variable) {
  39341. if (this.outputOptions.preserveModules && variable instanceof NamespaceVariable) {
  39342. return '*';
  39343. }
  39344. return this.exportNamesByVariable.get(variable)[0];
  39345. }
  39346. link() {
  39347. this.dependencies = getStaticDependencies(this, this.orderedModules, this.chunkByModule);
  39348. for (const module of this.orderedModules) {
  39349. this.addDependenciesToChunk(module.dynamicDependencies, this.dynamicDependencies);
  39350. this.addDependenciesToChunk(module.implicitlyLoadedBefore, this.implicitlyLoadedBefore);
  39351. this.setUpChunkImportsAndExportsForModule(module);
  39352. }
  39353. }
  39354. // prerender allows chunk hashes and names to be generated before finalizing
  39355. preRender(options, inputBase) {
  39356. const magicString = new Bundle$1({ separator: options.compact ? '' : '\n\n' });
  39357. this.usedModules = [];
  39358. this.indentString = getIndentString(this.orderedModules, options);
  39359. const n = options.compact ? '' : '\n';
  39360. const _ = options.compact ? '' : ' ';
  39361. const renderOptions = {
  39362. compact: options.compact,
  39363. dynamicImportFunction: options.dynamicImportFunction,
  39364. exportNamesByVariable: this.exportNamesByVariable,
  39365. format: options.format,
  39366. freeze: options.freeze,
  39367. indent: this.indentString,
  39368. namespaceToStringTag: options.namespaceToStringTag,
  39369. outputPluginDriver: this.pluginDriver,
  39370. varOrConst: options.preferConst ? 'const' : 'var'
  39371. };
  39372. // for static and dynamic entry points, inline the execution list to avoid loading latency
  39373. if (options.hoistTransitiveImports &&
  39374. !this.outputOptions.preserveModules &&
  39375. this.facadeModule !== null) {
  39376. for (const dep of this.dependencies) {
  39377. if (dep instanceof Chunk)
  39378. this.inlineChunkDependencies(dep);
  39379. }
  39380. }
  39381. this.prepareDynamicImportsAndImportMetas();
  39382. this.setIdentifierRenderResolutions(options);
  39383. let hoistedSource = '';
  39384. const renderedModules = this.renderedModules;
  39385. for (const module of this.orderedModules) {
  39386. let renderedLength = 0;
  39387. if (module.isIncluded() || this.includedNamespaces.has(module)) {
  39388. const source = module.render(renderOptions).trim();
  39389. renderedLength = source.length();
  39390. if (renderedLength) {
  39391. if (options.compact && source.lastLine().indexOf('//') !== -1)
  39392. source.append('\n');
  39393. this.renderedModuleSources.set(module, source);
  39394. magicString.addSource(source);
  39395. this.usedModules.push(module);
  39396. }
  39397. const namespace = module.namespace;
  39398. if (this.includedNamespaces.has(module) && !this.outputOptions.preserveModules) {
  39399. const rendered = namespace.renderBlock(renderOptions);
  39400. if (namespace.renderFirst())
  39401. hoistedSource += n + rendered;
  39402. else
  39403. magicString.addSource(new MagicString(rendered));
  39404. }
  39405. }
  39406. const { renderedExports, removedExports } = module.getRenderedExports();
  39407. renderedModules[module.id] = {
  39408. originalLength: module.originalCode.length,
  39409. removedExports,
  39410. renderedExports,
  39411. renderedLength
  39412. };
  39413. }
  39414. if (hoistedSource)
  39415. magicString.prepend(hoistedSource + n + n);
  39416. if (this.needsExportsShim) {
  39417. magicString.prepend(`${n}${renderOptions.varOrConst} ${MISSING_EXPORT_SHIM_VARIABLE}${_}=${_}void 0;${n}${n}`);
  39418. }
  39419. if (options.compact) {
  39420. this.renderedSource = magicString;
  39421. }
  39422. else {
  39423. this.renderedSource = magicString.trim();
  39424. }
  39425. this.renderedHash = undefined;
  39426. if (this.isEmpty && this.getExportNames().length === 0 && this.dependencies.size === 0) {
  39427. const chunkName = this.getChunkName();
  39428. this.inputOptions.onwarn({
  39429. chunkName,
  39430. code: 'EMPTY_BUNDLE',
  39431. message: `Generated an empty chunk: "${chunkName}"`
  39432. });
  39433. }
  39434. this.setExternalRenderPaths(options, inputBase);
  39435. this.renderedDependencies = this.getChunkDependencyDeclarations(options);
  39436. this.renderedExports =
  39437. this.exportMode === 'none' ? [] : this.getChunkExportDeclarations(options.format);
  39438. }
  39439. async render(options, addons, outputChunk) {
  39440. timeStart('render format', 2);
  39441. const format = options.format;
  39442. const finalise = finalisers[format];
  39443. if (options.dynamicImportFunction && format !== 'es') {
  39444. this.inputOptions.onwarn({
  39445. code: 'INVALID_OPTION',
  39446. message: '"output.dynamicImportFunction" is ignored for formats other than "es".'
  39447. });
  39448. }
  39449. // populate ids in the rendered declarations only here
  39450. // as chunk ids known only after prerender
  39451. for (const dependency of this.dependencies) {
  39452. const renderedDependency = this.renderedDependencies.get(dependency);
  39453. if (dependency instanceof ExternalModule) {
  39454. const originalId = dependency.renderPath;
  39455. renderedDependency.id = escapeId(dependency.renormalizeRenderPath ? this.getRelativePath(originalId, false) : originalId);
  39456. }
  39457. else {
  39458. renderedDependency.namedExportsMode = dependency.exportMode !== 'default';
  39459. renderedDependency.id = escapeId(this.getRelativePath(dependency.id, false));
  39460. }
  39461. }
  39462. this.finaliseDynamicImports(options);
  39463. this.finaliseImportMetas(format);
  39464. const hasExports = this.renderedExports.length !== 0 ||
  39465. [...this.renderedDependencies.values()].some(dep => (dep.reexports && dep.reexports.length !== 0));
  39466. let usesTopLevelAwait = false;
  39467. const accessedGlobals = new Set();
  39468. for (const module of this.orderedModules) {
  39469. if (module.usesTopLevelAwait) {
  39470. usesTopLevelAwait = true;
  39471. }
  39472. const accessedGlobalVariables = this.accessedGlobalsByScope.get(module.scope);
  39473. if (accessedGlobalVariables) {
  39474. for (const name of accessedGlobalVariables) {
  39475. accessedGlobals.add(name);
  39476. }
  39477. }
  39478. }
  39479. if (usesTopLevelAwait && format !== 'es' && format !== 'system') {
  39480. return error({
  39481. code: 'INVALID_TLA_FORMAT',
  39482. message: `Module format ${format} does not support top-level await. Use the "es" or "system" output formats rather.`
  39483. });
  39484. }
  39485. /* istanbul ignore next */
  39486. if (!this.id) {
  39487. throw new Error('Internal Error: expecting chunk id');
  39488. }
  39489. const magicString = finalise(this.renderedSource, {
  39490. accessedGlobals,
  39491. dependencies: [...this.renderedDependencies.values()],
  39492. exports: this.renderedExports,
  39493. hasExports,
  39494. id: this.id,
  39495. indentString: this.indentString,
  39496. intro: addons.intro,
  39497. isEntryFacade: this.outputOptions.preserveModules ||
  39498. (this.facadeModule !== null && this.facadeModule.info.isEntry),
  39499. isModuleFacade: this.facadeModule !== null,
  39500. namedExportsMode: this.exportMode !== 'default',
  39501. outro: addons.outro,
  39502. usesTopLevelAwait,
  39503. varOrConst: options.preferConst ? 'const' : 'var',
  39504. warn: this.inputOptions.onwarn
  39505. }, options);
  39506. if (addons.banner)
  39507. magicString.prepend(addons.banner);
  39508. if (addons.footer)
  39509. magicString.append(addons.footer);
  39510. const prevCode = magicString.toString();
  39511. timeEnd('render format', 2);
  39512. let map = null;
  39513. const chunkSourcemapChain = [];
  39514. let code = await renderChunk({
  39515. code: prevCode,
  39516. options,
  39517. outputPluginDriver: this.pluginDriver,
  39518. renderChunk: outputChunk,
  39519. sourcemapChain: chunkSourcemapChain
  39520. });
  39521. if (options.sourcemap) {
  39522. timeStart('sourcemap', 2);
  39523. let file;
  39524. if (options.file)
  39525. file = resolve$1(options.sourcemapFile || options.file);
  39526. else if (options.dir)
  39527. file = resolve$1(options.dir, this.id);
  39528. else
  39529. file = resolve$1(this.id);
  39530. const decodedMap = magicString.generateDecodedMap({});
  39531. map = collapseSourcemaps(file, decodedMap, this.usedModules, chunkSourcemapChain, options.sourcemapExcludeSources, this.inputOptions.onwarn);
  39532. map.sources = map.sources
  39533. .map(sourcePath => {
  39534. const { sourcemapPathTransform } = options;
  39535. if (sourcemapPathTransform) {
  39536. const newSourcePath = sourcemapPathTransform(sourcePath, `${file}.map`);
  39537. if (typeof newSourcePath !== 'string') {
  39538. error(errFailedValidation(`sourcemapPathTransform function must return a string.`));
  39539. }
  39540. return newSourcePath;
  39541. }
  39542. return sourcePath;
  39543. })
  39544. .map(normalize);
  39545. timeEnd('sourcemap', 2);
  39546. }
  39547. if (!options.compact && code[code.length - 1] !== '\n')
  39548. code += '\n';
  39549. return { code, map };
  39550. }
  39551. addDependenciesToChunk(moduleDependencies, chunkDependencies) {
  39552. for (const module of moduleDependencies) {
  39553. if (module instanceof Module) {
  39554. const chunk = this.chunkByModule.get(module);
  39555. if (chunk && chunk !== this) {
  39556. chunkDependencies.add(chunk);
  39557. }
  39558. }
  39559. else {
  39560. chunkDependencies.add(module);
  39561. }
  39562. }
  39563. }
  39564. assignFacadeName({ fileName, name }, facadedModule) {
  39565. if (fileName) {
  39566. this.fileName = fileName;
  39567. }
  39568. else {
  39569. this.name = sanitizeFileName(name || facadedModule.chunkName || getAliasName(facadedModule.id));
  39570. }
  39571. }
  39572. checkCircularDependencyImport(variable, importingModule) {
  39573. const variableModule = variable.module;
  39574. if (variableModule instanceof Module) {
  39575. const exportChunk = this.chunkByModule.get(variableModule);
  39576. let alternativeReexportModule;
  39577. do {
  39578. alternativeReexportModule = importingModule.alternativeReexportModules.get(variable);
  39579. if (alternativeReexportModule) {
  39580. const exportingChunk = this.chunkByModule.get(alternativeReexportModule);
  39581. if (exportingChunk && exportingChunk !== exportChunk) {
  39582. this.inputOptions.onwarn(errCyclicCrossChunkReexport(variableModule.getExportNamesByVariable().get(variable)[0], variableModule.id, alternativeReexportModule.id, importingModule.id));
  39583. }
  39584. importingModule = alternativeReexportModule;
  39585. }
  39586. } while (alternativeReexportModule);
  39587. }
  39588. }
  39589. computeContentHashWithDependencies(addons, options, existingNames) {
  39590. const hash = createHash();
  39591. hash.update([addons.intro, addons.outro, addons.banner, addons.footer].map(addon => addon || '').join(':'));
  39592. hash.update(options.format);
  39593. const dependenciesForHashing = new Set([this]);
  39594. for (const current of dependenciesForHashing) {
  39595. if (current instanceof ExternalModule) {
  39596. hash.update(':' + current.renderPath);
  39597. }
  39598. else {
  39599. hash.update(current.getRenderedHash());
  39600. hash.update(current.generateId(addons, options, existingNames, false));
  39601. }
  39602. if (current instanceof ExternalModule)
  39603. continue;
  39604. for (const dependency of [...current.dependencies, ...current.dynamicDependencies]) {
  39605. dependenciesForHashing.add(dependency);
  39606. }
  39607. }
  39608. return hash.digest('hex').substr(0, 8);
  39609. }
  39610. ensureReexportsAreAvailableForModule(module) {
  39611. const map = module.getExportNamesByVariable();
  39612. for (const exportedVariable of map.keys()) {
  39613. const isSynthetic = exportedVariable instanceof SyntheticNamedExportVariable;
  39614. const importedVariable = isSynthetic
  39615. ? exportedVariable.getBaseVariable()
  39616. : exportedVariable;
  39617. if (!(importedVariable instanceof NamespaceVariable && this.outputOptions.preserveModules)) {
  39618. this.checkCircularDependencyImport(importedVariable, module);
  39619. const exportingModule = importedVariable.module;
  39620. if (exportingModule instanceof Module) {
  39621. const chunk = this.chunkByModule.get(exportingModule);
  39622. if (chunk && chunk !== this) {
  39623. chunk.exports.add(importedVariable);
  39624. if (isSynthetic) {
  39625. this.imports.add(importedVariable);
  39626. }
  39627. }
  39628. }
  39629. }
  39630. }
  39631. }
  39632. finaliseDynamicImports(options) {
  39633. const stripKnownJsExtensions = options.format === 'amd';
  39634. for (const [module, code] of this.renderedModuleSources) {
  39635. for (const { node, resolution } of module.dynamicImports) {
  39636. const chunk = this.chunkByModule.get(resolution);
  39637. const facadeChunk = this.facadeChunkByModule.get(resolution);
  39638. if (!resolution || !node.included || chunk === this) {
  39639. continue;
  39640. }
  39641. const renderedResolution = resolution instanceof Module
  39642. ? `'${this.getRelativePath((facadeChunk || chunk).id, stripKnownJsExtensions)}'`
  39643. : resolution instanceof ExternalModule
  39644. ? `'${resolution.renormalizeRenderPath
  39645. ? this.getRelativePath(resolution.renderPath, stripKnownJsExtensions)
  39646. : resolution.renderPath}'`
  39647. : resolution;
  39648. node.renderFinalResolution(code, renderedResolution, resolution instanceof Module &&
  39649. !(facadeChunk === null || facadeChunk === void 0 ? void 0 : facadeChunk.strictFacade) &&
  39650. chunk.exportNamesByVariable.get(resolution.namespace)[0], options);
  39651. }
  39652. }
  39653. }
  39654. finaliseImportMetas(format) {
  39655. for (const [module, code] of this.renderedModuleSources) {
  39656. for (const importMeta of module.importMetas) {
  39657. importMeta.renderFinalMechanism(code, this.id, format, this.pluginDriver);
  39658. }
  39659. }
  39660. }
  39661. generateVariableName() {
  39662. if (this.manualChunkAlias) {
  39663. return this.manualChunkAlias;
  39664. }
  39665. const moduleForNaming = this.entryModules[0] ||
  39666. this.implicitEntryModules[0] ||
  39667. this.dynamicEntryModules[0] ||
  39668. this.orderedModules[this.orderedModules.length - 1];
  39669. if (moduleForNaming) {
  39670. return moduleForNaming.chunkName || getAliasName(moduleForNaming.id);
  39671. }
  39672. return 'chunk';
  39673. }
  39674. getChunkDependencyDeclarations(options) {
  39675. const importSpecifiers = this.getImportSpecifiers();
  39676. const reexportSpecifiers = this.getReexportSpecifiers();
  39677. const dependencyDeclaration = new Map();
  39678. for (const dep of this.dependencies) {
  39679. const imports = importSpecifiers.get(dep) || null;
  39680. const reexports = reexportSpecifiers.get(dep) || null;
  39681. const namedExportsMode = dep instanceof ExternalModule || dep.exportMode !== 'default';
  39682. dependencyDeclaration.set(dep, {
  39683. defaultVariableName: dep.defaultVariableName,
  39684. globalName: (dep instanceof ExternalModule &&
  39685. (options.format === 'umd' || options.format === 'iife') &&
  39686. getGlobalName(dep, options.globals, (imports || reexports) !== null, this.inputOptions.onwarn)),
  39687. id: undefined,
  39688. imports,
  39689. isChunk: dep instanceof Chunk,
  39690. name: dep.variableName,
  39691. namedExportsMode,
  39692. namespaceVariableName: dep.namespaceVariableName,
  39693. reexports
  39694. });
  39695. }
  39696. return dependencyDeclaration;
  39697. }
  39698. getChunkExportDeclarations(format) {
  39699. const exports = [];
  39700. for (const exportName of this.getExportNames()) {
  39701. if (exportName[0] === '*')
  39702. continue;
  39703. const variable = this.exportsByName[exportName];
  39704. if (!(variable instanceof SyntheticNamedExportVariable)) {
  39705. const module = variable.module;
  39706. if (module && this.chunkByModule.get(module) !== this)
  39707. continue;
  39708. }
  39709. let expression = null;
  39710. let hoisted = false;
  39711. let uninitialized = false;
  39712. let local = variable.getName();
  39713. if (variable instanceof LocalVariable) {
  39714. if (variable.init === UNDEFINED_EXPRESSION) {
  39715. uninitialized = true;
  39716. }
  39717. for (const declaration of variable.declarations) {
  39718. if (declaration.parent instanceof FunctionDeclaration ||
  39719. (declaration instanceof ExportDefaultDeclaration &&
  39720. declaration.declaration instanceof FunctionDeclaration)) {
  39721. hoisted = true;
  39722. break;
  39723. }
  39724. }
  39725. }
  39726. else if (variable instanceof SyntheticNamedExportVariable) {
  39727. expression = local;
  39728. if (format === 'es' && exportName !== 'default') {
  39729. local = variable.renderName;
  39730. }
  39731. }
  39732. exports.push({
  39733. exported: exportName,
  39734. expression,
  39735. hoisted,
  39736. local,
  39737. uninitialized
  39738. });
  39739. }
  39740. return exports;
  39741. }
  39742. getDependenciesToBeDeconflicted(addNonNamespacesAndInteropHelpers, addDependenciesWithoutBindings, interop) {
  39743. const dependencies = new Set();
  39744. const deconflictedDefault = new Set();
  39745. const deconflictedNamespace = new Set();
  39746. for (const variable of [...this.exportNamesByVariable.keys(), ...this.imports]) {
  39747. if (addNonNamespacesAndInteropHelpers || variable.isNamespace) {
  39748. const module = variable.module;
  39749. if (module instanceof ExternalModule) {
  39750. dependencies.add(module);
  39751. if (addNonNamespacesAndInteropHelpers) {
  39752. if (variable.name === 'default') {
  39753. if (defaultInteropHelpersByInteropType[String(interop(module.id))]) {
  39754. deconflictedDefault.add(module);
  39755. }
  39756. }
  39757. else if (variable.name === '*') {
  39758. if (namespaceInteropHelpersByInteropType[String(interop(module.id))]) {
  39759. deconflictedNamespace.add(module);
  39760. }
  39761. }
  39762. }
  39763. }
  39764. else {
  39765. const chunk = this.chunkByModule.get(module);
  39766. if (chunk !== this) {
  39767. dependencies.add(chunk);
  39768. if (addNonNamespacesAndInteropHelpers &&
  39769. chunk.exportMode === 'default' &&
  39770. variable.isNamespace) {
  39771. deconflictedNamespace.add(chunk);
  39772. }
  39773. }
  39774. }
  39775. }
  39776. }
  39777. if (addDependenciesWithoutBindings) {
  39778. for (const dependency of this.dependencies) {
  39779. dependencies.add(dependency);
  39780. }
  39781. }
  39782. return { deconflictedDefault, deconflictedNamespace, dependencies };
  39783. }
  39784. getFallbackChunkName() {
  39785. if (this.manualChunkAlias) {
  39786. return this.manualChunkAlias;
  39787. }
  39788. if (this.fileName) {
  39789. return getAliasName(this.fileName);
  39790. }
  39791. return getAliasName(this.orderedModules[this.orderedModules.length - 1].id);
  39792. }
  39793. getImportedBindingsPerDependency() {
  39794. const importSpecifiers = {};
  39795. for (const [dependency, declaration] of this.renderedDependencies) {
  39796. const specifiers = new Set();
  39797. if (declaration.imports) {
  39798. for (const { imported } of declaration.imports) {
  39799. specifiers.add(imported);
  39800. }
  39801. }
  39802. if (declaration.reexports) {
  39803. for (const { imported } of declaration.reexports) {
  39804. specifiers.add(imported);
  39805. }
  39806. }
  39807. importSpecifiers[dependency.id] = [...specifiers];
  39808. }
  39809. return importSpecifiers;
  39810. }
  39811. getImportSpecifiers() {
  39812. const { interop } = this.outputOptions;
  39813. const importsByDependency = new Map();
  39814. for (const variable of this.imports) {
  39815. const module = variable.module;
  39816. let dependency;
  39817. let imported;
  39818. if (module instanceof ExternalModule) {
  39819. dependency = module;
  39820. imported = variable.name;
  39821. if (imported !== 'default' && imported !== '*' && interop(module.id) === 'defaultOnly') {
  39822. return error(errUnexpectedNamedImport(module.id, imported, false));
  39823. }
  39824. }
  39825. else {
  39826. dependency = this.chunkByModule.get(module);
  39827. imported = dependency.getVariableExportName(variable);
  39828. }
  39829. getOrCreate(importsByDependency, dependency, () => []).push({
  39830. imported,
  39831. local: variable.getName()
  39832. });
  39833. }
  39834. return importsByDependency;
  39835. }
  39836. getReexportSpecifiers() {
  39837. const { externalLiveBindings, interop } = this.outputOptions;
  39838. const reexportSpecifiers = new Map();
  39839. for (let exportName of this.getExportNames()) {
  39840. let dependency;
  39841. let imported;
  39842. let needsLiveBinding = false;
  39843. if (exportName[0] === '*') {
  39844. const id = exportName.substr(1);
  39845. if (interop(id) === 'defaultOnly') {
  39846. this.inputOptions.onwarn(errUnexpectedNamespaceReexport(id));
  39847. }
  39848. needsLiveBinding = externalLiveBindings;
  39849. dependency = this.modulesById.get(id);
  39850. imported = exportName = '*';
  39851. }
  39852. else {
  39853. const variable = this.exportsByName[exportName];
  39854. if (variable instanceof SyntheticNamedExportVariable)
  39855. continue;
  39856. const module = variable.module;
  39857. if (module instanceof Module) {
  39858. dependency = this.chunkByModule.get(module);
  39859. if (dependency === this)
  39860. continue;
  39861. imported = dependency.getVariableExportName(variable);
  39862. needsLiveBinding = variable.isReassigned;
  39863. }
  39864. else {
  39865. dependency = module;
  39866. imported = variable.name;
  39867. if (imported !== 'default' && imported !== '*' && interop(module.id) === 'defaultOnly') {
  39868. return error(errUnexpectedNamedImport(module.id, imported, true));
  39869. }
  39870. needsLiveBinding =
  39871. externalLiveBindings &&
  39872. (imported !== 'default' || isDefaultAProperty(String(interop(module.id)), true));
  39873. }
  39874. }
  39875. getOrCreate(reexportSpecifiers, dependency, () => []).push({
  39876. imported,
  39877. needsLiveBinding,
  39878. reexported: exportName
  39879. });
  39880. }
  39881. return reexportSpecifiers;
  39882. }
  39883. getReferencedFiles() {
  39884. const referencedFiles = [];
  39885. for (const module of this.orderedModules) {
  39886. for (const meta of module.importMetas) {
  39887. const fileName = meta.getReferencedFileName(this.pluginDriver);
  39888. if (fileName) {
  39889. referencedFiles.push(fileName);
  39890. }
  39891. }
  39892. }
  39893. return referencedFiles;
  39894. }
  39895. getRelativePath(targetPath, stripJsExtension) {
  39896. let relativePath = normalize(relative(dirname(this.id), targetPath));
  39897. if (stripJsExtension && relativePath.endsWith('.js')) {
  39898. relativePath = relativePath.slice(0, -3);
  39899. }
  39900. if (relativePath === '..')
  39901. return '../../' + basename(targetPath);
  39902. if (relativePath === '')
  39903. return '../' + basename(targetPath);
  39904. return relativePath.startsWith('../') ? relativePath : './' + relativePath;
  39905. }
  39906. inlineChunkDependencies(chunk) {
  39907. for (const dep of chunk.dependencies) {
  39908. if (this.dependencies.has(dep))
  39909. continue;
  39910. this.dependencies.add(dep);
  39911. if (dep instanceof Chunk) {
  39912. this.inlineChunkDependencies(dep);
  39913. }
  39914. }
  39915. }
  39916. prepareDynamicImportsAndImportMetas() {
  39917. var _a;
  39918. const accessedGlobalsByScope = this.accessedGlobalsByScope;
  39919. for (const module of this.orderedModules) {
  39920. for (const { node, resolution } of module.dynamicImports) {
  39921. if (node.included) {
  39922. if (resolution instanceof Module) {
  39923. const chunk = this.chunkByModule.get(resolution);
  39924. if (chunk === this) {
  39925. node.setInternalResolution(resolution.namespace);
  39926. }
  39927. else {
  39928. node.setExternalResolution(((_a = this.facadeChunkByModule.get(resolution)) === null || _a === void 0 ? void 0 : _a.exportMode) || chunk.exportMode, resolution, this.outputOptions, this.pluginDriver, accessedGlobalsByScope);
  39929. }
  39930. }
  39931. else {
  39932. node.setExternalResolution('external', resolution, this.outputOptions, this.pluginDriver, accessedGlobalsByScope);
  39933. }
  39934. }
  39935. }
  39936. for (const importMeta of module.importMetas) {
  39937. importMeta.addAccessedGlobals(this.outputOptions.format, accessedGlobalsByScope);
  39938. }
  39939. }
  39940. }
  39941. setExternalRenderPaths(options, inputBase) {
  39942. for (const dependency of [...this.dependencies, ...this.dynamicDependencies]) {
  39943. if (dependency instanceof ExternalModule) {
  39944. dependency.setRenderPath(options, inputBase);
  39945. }
  39946. }
  39947. }
  39948. setIdentifierRenderResolutions({ format, interop, namespaceToStringTag }) {
  39949. const syntheticExports = new Set();
  39950. for (const exportName of this.getExportNames()) {
  39951. const exportVariable = this.exportsByName[exportName];
  39952. if (exportVariable instanceof ExportShimVariable) {
  39953. this.needsExportsShim = true;
  39954. }
  39955. if (format !== 'es' &&
  39956. format !== 'system' &&
  39957. exportVariable.isReassigned &&
  39958. !exportVariable.isId) {
  39959. exportVariable.setRenderNames('exports', exportName);
  39960. }
  39961. else if (exportVariable instanceof SyntheticNamedExportVariable) {
  39962. syntheticExports.add(exportVariable);
  39963. }
  39964. else {
  39965. exportVariable.setRenderNames(null, null);
  39966. }
  39967. }
  39968. const usedNames = new Set(['Object', 'Promise']);
  39969. if (this.needsExportsShim) {
  39970. usedNames.add(MISSING_EXPORT_SHIM_VARIABLE);
  39971. }
  39972. if (namespaceToStringTag) {
  39973. usedNames.add('Symbol');
  39974. }
  39975. switch (format) {
  39976. case 'system':
  39977. usedNames.add('module').add('exports');
  39978. break;
  39979. case 'es':
  39980. break;
  39981. case 'cjs':
  39982. usedNames.add('module').add('require').add('__filename').add('__dirname');
  39983. // fallthrough
  39984. default:
  39985. usedNames.add('exports');
  39986. for (const helper of HELPER_NAMES) {
  39987. usedNames.add(helper);
  39988. }
  39989. }
  39990. deconflictChunk(this.orderedModules, this.getDependenciesToBeDeconflicted(format !== 'es' && format !== 'system', format === 'amd' || format === 'umd' || format === 'iife', interop), this.imports, usedNames, format, interop, this.outputOptions.preserveModules, this.outputOptions.externalLiveBindings, this.chunkByModule, syntheticExports, this.exportNamesByVariable, this.accessedGlobalsByScope, this.includedNamespaces);
  39991. }
  39992. setUpChunkImportsAndExportsForModule(module) {
  39993. const moduleImports = new Set(module.imports);
  39994. // when we are not preserving modules, we need to make all namespace variables available for
  39995. // rendering the namespace object
  39996. if (!this.outputOptions.preserveModules) {
  39997. if (this.includedNamespaces.has(module)) {
  39998. const memberVariables = module.namespace.getMemberVariables();
  39999. for (const name of Object.keys(memberVariables)) {
  40000. moduleImports.add(memberVariables[name]);
  40001. }
  40002. }
  40003. }
  40004. for (let variable of moduleImports) {
  40005. if (variable instanceof ExportDefaultVariable) {
  40006. variable = variable.getOriginalVariable();
  40007. }
  40008. if (variable instanceof SyntheticNamedExportVariable) {
  40009. variable = variable.getBaseVariable();
  40010. }
  40011. const chunk = this.chunkByModule.get(variable.module);
  40012. if (chunk !== this) {
  40013. this.imports.add(variable);
  40014. if (!(variable instanceof NamespaceVariable && this.outputOptions.preserveModules) &&
  40015. variable.module instanceof Module) {
  40016. chunk.exports.add(variable);
  40017. this.checkCircularDependencyImport(variable, module);
  40018. }
  40019. }
  40020. }
  40021. if (this.includedNamespaces.has(module) ||
  40022. (module.info.isEntry && module.preserveSignature !== false) ||
  40023. module.includedDynamicImporters.some(importer => this.chunkByModule.get(importer) !== this)) {
  40024. this.ensureReexportsAreAvailableForModule(module);
  40025. }
  40026. for (const { node, resolution } of module.dynamicImports) {
  40027. if (node.included &&
  40028. resolution instanceof Module &&
  40029. this.chunkByModule.get(resolution) === this &&
  40030. !this.includedNamespaces.has(resolution)) {
  40031. this.includedNamespaces.add(resolution);
  40032. this.ensureReexportsAreAvailableForModule(resolution);
  40033. }
  40034. }
  40035. }
  40036. }
  40037. const concatSep = (out, next) => (next ? `${out}\n${next}` : out);
  40038. const concatDblSep = (out, next) => (next ? `${out}\n\n${next}` : out);
  40039. async function createAddons(options, outputPluginDriver) {
  40040. try {
  40041. let [banner, footer, intro, outro] = await Promise.all([
  40042. outputPluginDriver.hookReduceValue('banner', options.banner(), [], concatSep),
  40043. outputPluginDriver.hookReduceValue('footer', options.footer(), [], concatSep),
  40044. outputPluginDriver.hookReduceValue('intro', options.intro(), [], concatDblSep),
  40045. outputPluginDriver.hookReduceValue('outro', options.outro(), [], concatDblSep)
  40046. ]);
  40047. if (intro)
  40048. intro += '\n\n';
  40049. if (outro)
  40050. outro = `\n\n${outro}`;
  40051. if (banner.length)
  40052. banner += '\n';
  40053. if (footer.length)
  40054. footer = '\n' + footer;
  40055. return { intro, outro, banner, footer };
  40056. }
  40057. catch (err) {
  40058. return error({
  40059. code: 'ADDON_ERROR',
  40060. message: `Could not retrieve ${err.hook}. Check configuration of plugin ${err.plugin}.
  40061. \tError Message: ${err.message}`
  40062. });
  40063. }
  40064. }
  40065. function getChunkAssignments(entryModules, manualChunkAliasByEntry) {
  40066. const chunkDefinitions = [];
  40067. const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
  40068. const manualChunkModulesByAlias = Object.create(null);
  40069. for (const [entry, alias] of manualChunkAliasByEntry) {
  40070. const chunkModules = (manualChunkModulesByAlias[alias] =
  40071. manualChunkModulesByAlias[alias] || []);
  40072. addStaticDependenciesToManualChunk(entry, chunkModules, modulesInManualChunks);
  40073. }
  40074. for (const [alias, modules] of Object.entries(manualChunkModulesByAlias)) {
  40075. chunkDefinitions.push({ alias, modules });
  40076. }
  40077. const assignedEntryPointsByModule = new Map();
  40078. const { dependentEntryPointsByModule, dynamicEntryModules } = analyzeModuleGraph(entryModules);
  40079. const dynamicallyDependentEntryPointsByDynamicEntry = getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules);
  40080. const staticEntries = new Set(entryModules);
  40081. function assignEntryToStaticDependencies(entry, dynamicDependentEntryPoints) {
  40082. const modulesToHandle = new Set([entry]);
  40083. for (const module of modulesToHandle) {
  40084. const assignedEntryPoints = getOrCreate(assignedEntryPointsByModule, module, () => new Set());
  40085. if (dynamicDependentEntryPoints &&
  40086. areEntryPointsContainedOrDynamicallyDependent(dynamicDependentEntryPoints, dependentEntryPointsByModule.get(module))) {
  40087. continue;
  40088. }
  40089. else {
  40090. assignedEntryPoints.add(entry);
  40091. }
  40092. for (const dependency of module.getDependenciesToBeIncluded()) {
  40093. if (!(dependency instanceof ExternalModule || modulesInManualChunks.has(dependency))) {
  40094. modulesToHandle.add(dependency);
  40095. }
  40096. }
  40097. }
  40098. }
  40099. function areEntryPointsContainedOrDynamicallyDependent(entryPoints, containedIn) {
  40100. const entriesToCheck = new Set(entryPoints);
  40101. for (const entry of entriesToCheck) {
  40102. if (!containedIn.has(entry)) {
  40103. if (staticEntries.has(entry))
  40104. return false;
  40105. const dynamicallyDependentEntryPoints = dynamicallyDependentEntryPointsByDynamicEntry.get(entry);
  40106. for (const dependentEntry of dynamicallyDependentEntryPoints) {
  40107. entriesToCheck.add(dependentEntry);
  40108. }
  40109. }
  40110. }
  40111. return true;
  40112. }
  40113. for (const entry of entryModules) {
  40114. if (!modulesInManualChunks.has(entry)) {
  40115. assignEntryToStaticDependencies(entry, null);
  40116. }
  40117. }
  40118. for (const entry of dynamicEntryModules) {
  40119. if (!modulesInManualChunks.has(entry)) {
  40120. assignEntryToStaticDependencies(entry, dynamicallyDependentEntryPointsByDynamicEntry.get(entry));
  40121. }
  40122. }
  40123. chunkDefinitions.push(...createChunks([...entryModules, ...dynamicEntryModules], assignedEntryPointsByModule));
  40124. return chunkDefinitions;
  40125. }
  40126. function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesInManualChunks) {
  40127. const modulesToHandle = new Set([entry]);
  40128. for (const module of modulesToHandle) {
  40129. modulesInManualChunks.add(module);
  40130. manualChunkModules.push(module);
  40131. for (const dependency of module.dependencies) {
  40132. if (!(dependency instanceof ExternalModule || modulesInManualChunks.has(dependency))) {
  40133. modulesToHandle.add(dependency);
  40134. }
  40135. }
  40136. }
  40137. }
  40138. function analyzeModuleGraph(entryModules) {
  40139. const dynamicEntryModules = new Set();
  40140. const dependentEntryPointsByModule = new Map();
  40141. const entriesToHandle = new Set(entryModules);
  40142. for (const currentEntry of entriesToHandle) {
  40143. const modulesToHandle = new Set([currentEntry]);
  40144. for (const module of modulesToHandle) {
  40145. getOrCreate(dependentEntryPointsByModule, module, () => new Set()).add(currentEntry);
  40146. for (const dependency of module.getDependenciesToBeIncluded()) {
  40147. if (!(dependency instanceof ExternalModule)) {
  40148. modulesToHandle.add(dependency);
  40149. }
  40150. }
  40151. for (const { resolution } of module.dynamicImports) {
  40152. if (resolution instanceof Module && resolution.includedDynamicImporters.length > 0) {
  40153. dynamicEntryModules.add(resolution);
  40154. entriesToHandle.add(resolution);
  40155. }
  40156. }
  40157. for (const dependency of module.implicitlyLoadedBefore) {
  40158. dynamicEntryModules.add(dependency);
  40159. entriesToHandle.add(dependency);
  40160. }
  40161. }
  40162. }
  40163. return { dependentEntryPointsByModule, dynamicEntryModules };
  40164. }
  40165. function getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules) {
  40166. const dynamicallyDependentEntryPointsByDynamicEntry = new Map();
  40167. for (const dynamicEntry of dynamicEntryModules) {
  40168. const dynamicDependentEntryPoints = getOrCreate(dynamicallyDependentEntryPointsByDynamicEntry, dynamicEntry, () => new Set());
  40169. for (const importer of [
  40170. ...dynamicEntry.includedDynamicImporters,
  40171. ...dynamicEntry.implicitlyLoadedAfter
  40172. ]) {
  40173. for (const entryPoint of dependentEntryPointsByModule.get(importer)) {
  40174. dynamicDependentEntryPoints.add(entryPoint);
  40175. }
  40176. }
  40177. }
  40178. return dynamicallyDependentEntryPointsByDynamicEntry;
  40179. }
  40180. function createChunks(allEntryPoints, assignedEntryPointsByModule) {
  40181. const chunkModules = Object.create(null);
  40182. for (const [module, assignedEntryPoints] of assignedEntryPointsByModule) {
  40183. let chunkSignature = '';
  40184. for (const entry of allEntryPoints) {
  40185. chunkSignature += assignedEntryPoints.has(entry) ? 'X' : '_';
  40186. }
  40187. const chunk = chunkModules[chunkSignature];
  40188. if (chunk) {
  40189. chunk.push(module);
  40190. }
  40191. else {
  40192. chunkModules[chunkSignature] = [module];
  40193. }
  40194. }
  40195. return Object.keys(chunkModules).map(chunkSignature => ({
  40196. alias: null,
  40197. modules: chunkModules[chunkSignature]
  40198. }));
  40199. }
  40200. // ported from https://github.com/substack/node-commondir
  40201. function commondir(files) {
  40202. if (files.length === 0)
  40203. return '/';
  40204. if (files.length === 1)
  40205. return dirname(files[0]);
  40206. const commonSegments = files.slice(1).reduce((commonSegments, file) => {
  40207. const pathSegements = file.split(/\/+|\\+/);
  40208. let i;
  40209. for (i = 0; commonSegments[i] === pathSegements[i] &&
  40210. i < Math.min(commonSegments.length, pathSegements.length); i++)
  40211. ;
  40212. return commonSegments.slice(0, i);
  40213. }, files[0].split(/\/+|\\+/));
  40214. // Windows correctly handles paths with forward-slashes
  40215. return commonSegments.length > 1 ? commonSegments.join('/') : '/';
  40216. }
  40217. const compareExecIndex = (unitA, unitB) => unitA.execIndex > unitB.execIndex ? 1 : -1;
  40218. function sortByExecutionOrder(units) {
  40219. units.sort(compareExecIndex);
  40220. }
  40221. function analyseModuleExecution(entryModules) {
  40222. let nextExecIndex = 0;
  40223. const cyclePaths = [];
  40224. const analysedModules = new Set();
  40225. const dynamicImports = new Set();
  40226. const parents = new Map();
  40227. const orderedModules = [];
  40228. const analyseModule = (module) => {
  40229. if (module instanceof Module) {
  40230. for (const dependency of module.dependencies) {
  40231. if (parents.has(dependency)) {
  40232. if (!analysedModules.has(dependency)) {
  40233. cyclePaths.push(getCyclePath(dependency, module, parents));
  40234. }
  40235. continue;
  40236. }
  40237. parents.set(dependency, module);
  40238. analyseModule(dependency);
  40239. }
  40240. for (const dependency of module.implicitlyLoadedBefore) {
  40241. dynamicImports.add(dependency);
  40242. }
  40243. for (const { resolution } of module.dynamicImports) {
  40244. if (resolution instanceof Module) {
  40245. dynamicImports.add(resolution);
  40246. }
  40247. }
  40248. orderedModules.push(module);
  40249. }
  40250. module.execIndex = nextExecIndex++;
  40251. analysedModules.add(module);
  40252. };
  40253. for (const curEntry of entryModules) {
  40254. if (!parents.has(curEntry)) {
  40255. parents.set(curEntry, null);
  40256. analyseModule(curEntry);
  40257. }
  40258. }
  40259. for (const curEntry of dynamicImports) {
  40260. if (!parents.has(curEntry)) {
  40261. parents.set(curEntry, null);
  40262. analyseModule(curEntry);
  40263. }
  40264. }
  40265. return { orderedModules, cyclePaths };
  40266. }
  40267. function getCyclePath(module, parent, parents) {
  40268. const cycleSymbol = Symbol(module.id);
  40269. const path = [relativeId(module.id)];
  40270. let nextModule = parent;
  40271. module.cycles.add(cycleSymbol);
  40272. while (nextModule !== module) {
  40273. nextModule.cycles.add(cycleSymbol);
  40274. path.push(relativeId(nextModule.id));
  40275. nextModule = parents.get(nextModule);
  40276. }
  40277. path.push(path[0]);
  40278. path.reverse();
  40279. return path;
  40280. }
  40281. var BuildPhase;
  40282. (function (BuildPhase) {
  40283. BuildPhase[BuildPhase["LOAD_AND_PARSE"] = 0] = "LOAD_AND_PARSE";
  40284. BuildPhase[BuildPhase["ANALYSE"] = 1] = "ANALYSE";
  40285. BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
  40286. })(BuildPhase || (BuildPhase = {}));
  40287. function generateAssetFileName(name, source, output) {
  40288. const emittedName = name || 'asset';
  40289. return makeUnique(renderNamePattern(typeof output.assetFileNames === 'function'
  40290. ? output.assetFileNames({ name, source, type: 'asset' })
  40291. : output.assetFileNames, 'output.assetFileNames', {
  40292. hash() {
  40293. const hash = createHash();
  40294. hash.update(emittedName);
  40295. hash.update(':');
  40296. hash.update(source);
  40297. return hash.digest('hex').substr(0, 8);
  40298. },
  40299. ext: () => extname$1(emittedName).substr(1),
  40300. extname: () => extname$1(emittedName),
  40301. name: () => emittedName.substr(0, emittedName.length - extname$1(emittedName).length)
  40302. }), output.bundle);
  40303. }
  40304. function reserveFileNameInBundle(fileName, bundle, warn) {
  40305. if (fileName in bundle) {
  40306. warn(errFileNameConflict(fileName));
  40307. }
  40308. bundle[fileName] = FILE_PLACEHOLDER;
  40309. }
  40310. const FILE_PLACEHOLDER = {
  40311. type: 'placeholder'
  40312. };
  40313. function hasValidType(emittedFile) {
  40314. return Boolean(emittedFile &&
  40315. (emittedFile.type === 'asset' ||
  40316. emittedFile.type === 'chunk'));
  40317. }
  40318. function hasValidName(emittedFile) {
  40319. const validatedName = emittedFile.fileName || emittedFile.name;
  40320. return (!validatedName || (typeof validatedName === 'string' && isPlainPathFragment(validatedName)));
  40321. }
  40322. function getValidSource(source, emittedFile, fileReferenceId) {
  40323. if (!(typeof source === 'string' || source instanceof Uint8Array)) {
  40324. const assetName = emittedFile.fileName || emittedFile.name || fileReferenceId;
  40325. return error(errFailedValidation(`Could not set source for ${typeof assetName === 'string' ? `asset "${assetName}"` : 'unnamed asset'}, asset source needs to be a string, Uint8Array or Buffer.`));
  40326. }
  40327. return source;
  40328. }
  40329. function getAssetFileName(file, referenceId) {
  40330. if (typeof file.fileName !== 'string') {
  40331. return error(errAssetNotFinalisedForFileName(file.name || referenceId));
  40332. }
  40333. return file.fileName;
  40334. }
  40335. function getChunkFileName(file, facadeChunkByModule) {
  40336. var _a;
  40337. const fileName = file.fileName || (file.module && ((_a = facadeChunkByModule === null || facadeChunkByModule === void 0 ? void 0 : facadeChunkByModule.get(file.module)) === null || _a === void 0 ? void 0 : _a.id));
  40338. if (!fileName)
  40339. return error(errChunkNotGeneratedForFileName(file.fileName || file.name));
  40340. return fileName;
  40341. }
  40342. class FileEmitter {
  40343. constructor(graph, options, baseFileEmitter) {
  40344. this.graph = graph;
  40345. this.options = options;
  40346. this.facadeChunkByModule = null;
  40347. this.output = null;
  40348. this.assertAssetsFinalized = () => {
  40349. for (const [referenceId, emittedFile] of this.filesByReferenceId.entries()) {
  40350. if (emittedFile.type === 'asset' && typeof emittedFile.fileName !== 'string')
  40351. return error(errNoAssetSourceSet(emittedFile.name || referenceId));
  40352. }
  40353. };
  40354. this.emitFile = (emittedFile) => {
  40355. if (!hasValidType(emittedFile)) {
  40356. return error(errFailedValidation(`Emitted files must be of type "asset" or "chunk", received "${emittedFile && emittedFile.type}".`));
  40357. }
  40358. if (!hasValidName(emittedFile)) {
  40359. return error(errFailedValidation(`The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths and do not contain invalid characters, received "${emittedFile.fileName || emittedFile.name}".`));
  40360. }
  40361. if (emittedFile.type === 'chunk') {
  40362. return this.emitChunk(emittedFile);
  40363. }
  40364. else {
  40365. return this.emitAsset(emittedFile);
  40366. }
  40367. };
  40368. this.getFileName = (fileReferenceId) => {
  40369. const emittedFile = this.filesByReferenceId.get(fileReferenceId);
  40370. if (!emittedFile)
  40371. return error(errFileReferenceIdNotFoundForFilename(fileReferenceId));
  40372. if (emittedFile.type === 'chunk') {
  40373. return getChunkFileName(emittedFile, this.facadeChunkByModule);
  40374. }
  40375. else {
  40376. return getAssetFileName(emittedFile, fileReferenceId);
  40377. }
  40378. };
  40379. this.setAssetSource = (referenceId, requestedSource) => {
  40380. const consumedFile = this.filesByReferenceId.get(referenceId);
  40381. if (!consumedFile)
  40382. return error(errAssetReferenceIdNotFoundForSetSource(referenceId));
  40383. if (consumedFile.type !== 'asset') {
  40384. return error(errFailedValidation(`Asset sources can only be set for emitted assets but "${referenceId}" is an emitted chunk.`));
  40385. }
  40386. if (consumedFile.source !== undefined) {
  40387. return error(errAssetSourceAlreadySet(consumedFile.name || referenceId));
  40388. }
  40389. const source = getValidSource(requestedSource, consumedFile, referenceId);
  40390. if (this.output) {
  40391. this.finalizeAsset(consumedFile, source, referenceId, this.output);
  40392. }
  40393. else {
  40394. consumedFile.source = source;
  40395. }
  40396. };
  40397. this.setOutputBundle = (outputBundle, assetFileNames, facadeChunkByModule) => {
  40398. this.output = {
  40399. assetFileNames,
  40400. bundle: outputBundle
  40401. };
  40402. this.facadeChunkByModule = facadeChunkByModule;
  40403. for (const emittedFile of this.filesByReferenceId.values()) {
  40404. if (emittedFile.fileName) {
  40405. reserveFileNameInBundle(emittedFile.fileName, this.output.bundle, this.options.onwarn);
  40406. }
  40407. }
  40408. for (const [referenceId, consumedFile] of this.filesByReferenceId.entries()) {
  40409. if (consumedFile.type === 'asset' && consumedFile.source !== undefined) {
  40410. this.finalizeAsset(consumedFile, consumedFile.source, referenceId, this.output);
  40411. }
  40412. }
  40413. };
  40414. this.filesByReferenceId = baseFileEmitter
  40415. ? new Map(baseFileEmitter.filesByReferenceId)
  40416. : new Map();
  40417. }
  40418. assignReferenceId(file, idBase) {
  40419. let referenceId;
  40420. do {
  40421. const hash = createHash();
  40422. if (referenceId) {
  40423. hash.update(referenceId);
  40424. }
  40425. else {
  40426. hash.update(idBase);
  40427. }
  40428. referenceId = hash.digest('hex').substr(0, 8);
  40429. } while (this.filesByReferenceId.has(referenceId));
  40430. this.filesByReferenceId.set(referenceId, file);
  40431. return referenceId;
  40432. }
  40433. emitAsset(emittedAsset) {
  40434. const source = typeof emittedAsset.source !== 'undefined'
  40435. ? getValidSource(emittedAsset.source, emittedAsset, null)
  40436. : undefined;
  40437. const consumedAsset = {
  40438. fileName: emittedAsset.fileName,
  40439. name: emittedAsset.name,
  40440. source,
  40441. type: 'asset'
  40442. };
  40443. const referenceId = this.assignReferenceId(consumedAsset, emittedAsset.fileName || emittedAsset.name || emittedAsset.type);
  40444. if (this.output) {
  40445. if (emittedAsset.fileName) {
  40446. reserveFileNameInBundle(emittedAsset.fileName, this.output.bundle, this.options.onwarn);
  40447. }
  40448. if (source !== undefined) {
  40449. this.finalizeAsset(consumedAsset, source, referenceId, this.output);
  40450. }
  40451. }
  40452. return referenceId;
  40453. }
  40454. emitChunk(emittedChunk) {
  40455. if (this.graph.phase > BuildPhase.LOAD_AND_PARSE) {
  40456. return error(errInvalidRollupPhaseForChunkEmission());
  40457. }
  40458. if (typeof emittedChunk.id !== 'string') {
  40459. return error(errFailedValidation(`Emitted chunks need to have a valid string id, received "${emittedChunk.id}"`));
  40460. }
  40461. const consumedChunk = {
  40462. fileName: emittedChunk.fileName,
  40463. module: null,
  40464. name: emittedChunk.name || emittedChunk.id,
  40465. type: 'chunk'
  40466. };
  40467. this.graph.moduleLoader
  40468. .emitChunk(emittedChunk)
  40469. .then(module => (consumedChunk.module = module))
  40470. .catch(() => {
  40471. // Avoid unhandled Promise rejection as the error will be thrown later
  40472. // once module loading has finished
  40473. });
  40474. return this.assignReferenceId(consumedChunk, emittedChunk.id);
  40475. }
  40476. finalizeAsset(consumedFile, source, referenceId, output) {
  40477. const fileName = consumedFile.fileName ||
  40478. findExistingAssetFileNameWithSource(output.bundle, source) ||
  40479. generateAssetFileName(consumedFile.name, source, output);
  40480. // We must not modify the original assets to avoid interaction between outputs
  40481. const assetWithFileName = { ...consumedFile, source, fileName };
  40482. this.filesByReferenceId.set(referenceId, assetWithFileName);
  40483. const options = this.options;
  40484. output.bundle[fileName] = {
  40485. fileName,
  40486. name: consumedFile.name,
  40487. get isAsset() {
  40488. warnDeprecation('Accessing "isAsset" on files in the bundle is deprecated, please use "type === \'asset\'" instead', true, options);
  40489. return true;
  40490. },
  40491. source,
  40492. type: 'asset'
  40493. };
  40494. }
  40495. }
  40496. function findExistingAssetFileNameWithSource(bundle, source) {
  40497. for (const fileName of Object.keys(bundle)) {
  40498. const outputFile = bundle[fileName];
  40499. if (outputFile.type === 'asset' && areSourcesEqual(source, outputFile.source))
  40500. return fileName;
  40501. }
  40502. return null;
  40503. }
  40504. function areSourcesEqual(sourceA, sourceB) {
  40505. if (typeof sourceA === 'string') {
  40506. return sourceA === sourceB;
  40507. }
  40508. if (typeof sourceB === 'string') {
  40509. return false;
  40510. }
  40511. if ('equals' in sourceA) {
  40512. return sourceA.equals(sourceB);
  40513. }
  40514. if (sourceA.length !== sourceB.length) {
  40515. return false;
  40516. }
  40517. for (let index = 0; index < sourceA.length; index++) {
  40518. if (sourceA[index] !== sourceB[index]) {
  40519. return false;
  40520. }
  40521. }
  40522. return true;
  40523. }
  40524. class Bundle {
  40525. constructor(outputOptions, unsetOptions, inputOptions, pluginDriver, graph) {
  40526. this.outputOptions = outputOptions;
  40527. this.unsetOptions = unsetOptions;
  40528. this.inputOptions = inputOptions;
  40529. this.pluginDriver = pluginDriver;
  40530. this.graph = graph;
  40531. this.facadeChunkByModule = new Map();
  40532. this.includedNamespaces = new Set();
  40533. }
  40534. async generate(isWrite) {
  40535. timeStart('GENERATE', 1);
  40536. const outputBundle = Object.create(null);
  40537. this.pluginDriver.setOutputBundle(outputBundle, this.outputOptions.assetFileNames, this.facadeChunkByModule);
  40538. try {
  40539. await this.pluginDriver.hookParallel('renderStart', [this.outputOptions, this.inputOptions]);
  40540. timeStart('generate chunks', 2);
  40541. const chunks = await this.generateChunks();
  40542. if (chunks.length > 1) {
  40543. validateOptionsForMultiChunkOutput(this.outputOptions, this.inputOptions.onwarn);
  40544. }
  40545. const inputBase = commondir(getAbsoluteEntryModulePaths(chunks));
  40546. timeEnd('generate chunks', 2);
  40547. timeStart('render modules', 2);
  40548. // We need to create addons before prerender because at the moment, there
  40549. // can be no async code between prerender and render due to internal state
  40550. const addons = await createAddons(this.outputOptions, this.pluginDriver);
  40551. this.prerenderChunks(chunks, inputBase);
  40552. timeEnd('render modules', 2);
  40553. await this.addFinalizedChunksToBundle(chunks, inputBase, addons, outputBundle);
  40554. }
  40555. catch (error) {
  40556. await this.pluginDriver.hookParallel('renderError', [error]);
  40557. throw error;
  40558. }
  40559. await this.pluginDriver.hookSeq('generateBundle', [
  40560. this.outputOptions,
  40561. outputBundle,
  40562. isWrite
  40563. ]);
  40564. this.finaliseAssets(outputBundle);
  40565. timeEnd('GENERATE', 1);
  40566. return outputBundle;
  40567. }
  40568. async addFinalizedChunksToBundle(chunks, inputBase, addons, outputBundle) {
  40569. this.assignChunkIds(chunks, inputBase, addons, outputBundle);
  40570. for (const chunk of chunks) {
  40571. outputBundle[chunk.id] = chunk.getChunkInfoWithFileNames();
  40572. }
  40573. await Promise.all(chunks.map(async (chunk) => {
  40574. const outputChunk = outputBundle[chunk.id];
  40575. Object.assign(outputChunk, await chunk.render(this.outputOptions, addons, outputChunk));
  40576. }));
  40577. }
  40578. async addManualChunks(manualChunks) {
  40579. const manualChunkAliasByEntry = new Map();
  40580. const chunkEntries = await Promise.all(Object.keys(manualChunks).map(async (alias) => ({
  40581. alias,
  40582. entries: await this.graph.moduleLoader.addAdditionalModules(manualChunks[alias])
  40583. })));
  40584. for (const { alias, entries } of chunkEntries) {
  40585. for (const entry of entries) {
  40586. addModuleToManualChunk(alias, entry, manualChunkAliasByEntry);
  40587. }
  40588. }
  40589. return manualChunkAliasByEntry;
  40590. }
  40591. assignChunkIds(chunks, inputBase, addons, bundle) {
  40592. const entryChunks = [];
  40593. const otherChunks = [];
  40594. for (const chunk of chunks) {
  40595. (chunk.facadeModule && chunk.facadeModule.isUserDefinedEntryPoint
  40596. ? entryChunks
  40597. : otherChunks).push(chunk);
  40598. }
  40599. // make sure entry chunk names take precedence with regard to deconflicting
  40600. const chunksForNaming = entryChunks.concat(otherChunks);
  40601. for (const chunk of chunksForNaming) {
  40602. if (this.outputOptions.file) {
  40603. chunk.id = basename(this.outputOptions.file);
  40604. }
  40605. else if (this.outputOptions.preserveModules) {
  40606. chunk.id = chunk.generateIdPreserveModules(inputBase, this.outputOptions, bundle, this.unsetOptions);
  40607. }
  40608. else {
  40609. chunk.id = chunk.generateId(addons, this.outputOptions, bundle, true);
  40610. }
  40611. bundle[chunk.id] = FILE_PLACEHOLDER;
  40612. }
  40613. }
  40614. assignManualChunks(getManualChunk) {
  40615. const manualChunkAliasByEntry = new Map();
  40616. const manualChunksApi = {
  40617. getModuleIds: () => this.graph.modulesById.keys(),
  40618. getModuleInfo: this.graph.getModuleInfo
  40619. };
  40620. for (const module of this.graph.modulesById.values()) {
  40621. if (module instanceof Module) {
  40622. const manualChunkAlias = getManualChunk(module.id, manualChunksApi);
  40623. if (typeof manualChunkAlias === 'string') {
  40624. addModuleToManualChunk(manualChunkAlias, module, manualChunkAliasByEntry);
  40625. }
  40626. }
  40627. }
  40628. return manualChunkAliasByEntry;
  40629. }
  40630. finaliseAssets(outputBundle) {
  40631. for (const key of Object.keys(outputBundle)) {
  40632. const file = outputBundle[key];
  40633. if (!file.type) {
  40634. warnDeprecation('A plugin is directly adding properties to the bundle object in the "generateBundle" hook. This is deprecated and will be removed in a future Rollup version, please use "this.emitFile" instead.', true, this.inputOptions);
  40635. file.type = 'asset';
  40636. }
  40637. if (this.outputOptions.validate && typeof file.code == 'string') {
  40638. try {
  40639. this.graph.contextParse(file.code, {
  40640. allowHashBang: true,
  40641. ecmaVersion: 'latest'
  40642. });
  40643. }
  40644. catch (exception) {
  40645. this.inputOptions.onwarn(errChunkInvalid(file, exception));
  40646. }
  40647. }
  40648. }
  40649. this.pluginDriver.finaliseAssets();
  40650. }
  40651. async generateChunks() {
  40652. const { manualChunks } = this.outputOptions;
  40653. const manualChunkAliasByEntry = typeof manualChunks === 'object'
  40654. ? await this.addManualChunks(manualChunks)
  40655. : this.assignManualChunks(manualChunks);
  40656. const chunks = [];
  40657. const chunkByModule = new Map();
  40658. for (const { alias, modules } of this.outputOptions.inlineDynamicImports
  40659. ? [{ alias: null, modules: getIncludedModules(this.graph.modulesById) }]
  40660. : this.outputOptions.preserveModules
  40661. ? getIncludedModules(this.graph.modulesById).map(module => ({
  40662. alias: null,
  40663. modules: [module]
  40664. }))
  40665. : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry)) {
  40666. sortByExecutionOrder(modules);
  40667. const chunk = new Chunk(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias);
  40668. chunks.push(chunk);
  40669. for (const module of modules) {
  40670. chunkByModule.set(module, chunk);
  40671. }
  40672. }
  40673. for (const chunk of chunks) {
  40674. chunk.link();
  40675. }
  40676. const facades = [];
  40677. for (const chunk of chunks) {
  40678. facades.push(...chunk.generateFacades());
  40679. }
  40680. return [...chunks, ...facades];
  40681. }
  40682. prerenderChunks(chunks, inputBase) {
  40683. for (const chunk of chunks) {
  40684. chunk.generateExports();
  40685. }
  40686. for (const chunk of chunks) {
  40687. chunk.preRender(this.outputOptions, inputBase);
  40688. }
  40689. }
  40690. }
  40691. function getAbsoluteEntryModulePaths(chunks) {
  40692. const absoluteEntryModulePaths = [];
  40693. for (const chunk of chunks) {
  40694. for (const entryModule of chunk.entryModules) {
  40695. if (isAbsolute(entryModule.id)) {
  40696. absoluteEntryModulePaths.push(entryModule.id);
  40697. }
  40698. }
  40699. }
  40700. return absoluteEntryModulePaths;
  40701. }
  40702. function validateOptionsForMultiChunkOutput(outputOptions, onWarn) {
  40703. if (outputOptions.format === 'umd' || outputOptions.format === 'iife')
  40704. return error({
  40705. code: 'INVALID_OPTION',
  40706. message: 'UMD and IIFE output formats are not supported for code-splitting builds.'
  40707. });
  40708. if (typeof outputOptions.file === 'string')
  40709. return error({
  40710. code: 'INVALID_OPTION',
  40711. message: 'When building multiple chunks, the "output.dir" option must be used, not "output.file". ' +
  40712. 'To inline dynamic imports, set the "inlineDynamicImports" option.'
  40713. });
  40714. if (outputOptions.sourcemapFile)
  40715. return error({
  40716. code: 'INVALID_OPTION',
  40717. message: '"output.sourcemapFile" is only supported for single-file builds.'
  40718. });
  40719. if (!outputOptions.amd.autoId && outputOptions.amd.id)
  40720. onWarn({
  40721. code: 'INVALID_OPTION',
  40722. message: '"output.amd.id" is only properly supported for single-file builds. Use "output.amd.autoId" and "output.amd.basePath".'
  40723. });
  40724. }
  40725. function getIncludedModules(modulesById) {
  40726. return [...modulesById.values()].filter(module => module instanceof Module &&
  40727. (module.isIncluded() || module.info.isEntry || module.includedDynamicImporters.length > 0));
  40728. }
  40729. function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
  40730. const existingAlias = manualChunkAliasByEntry.get(module);
  40731. if (typeof existingAlias === 'string' && existingAlias !== alias) {
  40732. return error(errCannotAssignModuleToChunk(module.id, alias, existingAlias));
  40733. }
  40734. manualChunkAliasByEntry.set(module, alias);
  40735. }
  40736. // Reserved word lists for various dialects of the language
  40737. var reservedWords = {
  40738. 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
  40739. 5: "class enum extends super const export import",
  40740. 6: "enum",
  40741. strict: "implements interface let package private protected public static yield",
  40742. strictBind: "eval arguments"
  40743. };
  40744. // And the keywords
  40745. var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
  40746. var keywords = {
  40747. 5: ecma5AndLessKeywords,
  40748. "5module": ecma5AndLessKeywords + " export import",
  40749. 6: ecma5AndLessKeywords + " const class extends export import super"
  40750. };
  40751. var keywordRelationalOperator = /^in(stanceof)?$/;
  40752. // ## Character categories
  40753. // Big ugly regular expressions that match characters in the
  40754. // whitespace, identifier, and identifier-start categories. These
  40755. // are only applied when a character is found to actually have a
  40756. // code point above 128.
  40757. // Generated by `bin/generate-identifier-regex.js`.
  40758. var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
  40759. var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
  40760. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  40761. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  40762. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  40763. // These are a run-length and offset encoded representation of the
  40764. // >0xffff code points that are a valid part of identifiers. The
  40765. // offset starts at 0x10000, and each pair of numbers represents an
  40766. // offset to the next range, and then a size of the range. They were
  40767. // generated by bin/generate-identifier-regex.js
  40768. // eslint-disable-next-line comma-spacing
  40769. var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];
  40770. // eslint-disable-next-line comma-spacing
  40771. var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];
  40772. // This has a complexity linear to the value of the code. The
  40773. // assumption is that looking up astral identifier characters is
  40774. // rare.
  40775. function isInAstralSet(code, set) {
  40776. var pos = 0x10000;
  40777. for (var i = 0; i < set.length; i += 2) {
  40778. pos += set[i];
  40779. if (pos > code) { return false }
  40780. pos += set[i + 1];
  40781. if (pos >= code) { return true }
  40782. }
  40783. }
  40784. // Test whether a given character code starts an identifier.
  40785. function isIdentifierStart(code, astral) {
  40786. if (code < 65) { return code === 36 }
  40787. if (code < 91) { return true }
  40788. if (code < 97) { return code === 95 }
  40789. if (code < 123) { return true }
  40790. if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }
  40791. if (astral === false) { return false }
  40792. return isInAstralSet(code, astralIdentifierStartCodes)
  40793. }
  40794. // Test whether a given character is part of an identifier.
  40795. function isIdentifierChar(code, astral) {
  40796. if (code < 48) { return code === 36 }
  40797. if (code < 58) { return true }
  40798. if (code < 65) { return false }
  40799. if (code < 91) { return true }
  40800. if (code < 97) { return code === 95 }
  40801. if (code < 123) { return true }
  40802. if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }
  40803. if (astral === false) { return false }
  40804. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
  40805. }
  40806. // ## Token types
  40807. // The assignment of fine-grained, information-carrying type objects
  40808. // allows the tokenizer to store the information it has about a
  40809. // token in a way that is very cheap for the parser to look up.
  40810. // All token type variables start with an underscore, to make them
  40811. // easy to recognize.
  40812. // The `beforeExpr` property is used to disambiguate between regular
  40813. // expressions and divisions. It is set on all token types that can
  40814. // be followed by an expression (thus, a slash after them would be a
  40815. // regular expression).
  40816. //
  40817. // The `startsExpr` property is used to check if the token ends a
  40818. // `yield` expression. It is set on all token types that either can
  40819. // directly start an expression (like a quotation mark) or can
  40820. // continue an expression (like the body of a string).
  40821. //
  40822. // `isLoop` marks a keyword as starting a loop, which is important
  40823. // to know when parsing a label, in order to allow or disallow
  40824. // continue jumps to that label.
  40825. var TokenType = function TokenType(label, conf) {
  40826. if ( conf === void 0 ) conf = {};
  40827. this.label = label;
  40828. this.keyword = conf.keyword;
  40829. this.beforeExpr = !!conf.beforeExpr;
  40830. this.startsExpr = !!conf.startsExpr;
  40831. this.isLoop = !!conf.isLoop;
  40832. this.isAssign = !!conf.isAssign;
  40833. this.prefix = !!conf.prefix;
  40834. this.postfix = !!conf.postfix;
  40835. this.binop = conf.binop || null;
  40836. this.updateContext = null;
  40837. };
  40838. function binop(name, prec) {
  40839. return new TokenType(name, {beforeExpr: true, binop: prec})
  40840. }
  40841. var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
  40842. // Map keyword names to token types.
  40843. var keywords$1 = {};
  40844. // Succinct definitions of keyword token types
  40845. function kw(name, options) {
  40846. if ( options === void 0 ) options = {};
  40847. options.keyword = name;
  40848. return keywords$1[name] = new TokenType(name, options)
  40849. }
  40850. var types = {
  40851. num: new TokenType("num", startsExpr),
  40852. regexp: new TokenType("regexp", startsExpr),
  40853. string: new TokenType("string", startsExpr),
  40854. name: new TokenType("name", startsExpr),
  40855. eof: new TokenType("eof"),
  40856. // Punctuation token types.
  40857. bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
  40858. bracketR: new TokenType("]"),
  40859. braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
  40860. braceR: new TokenType("}"),
  40861. parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
  40862. parenR: new TokenType(")"),
  40863. comma: new TokenType(",", beforeExpr),
  40864. semi: new TokenType(";", beforeExpr),
  40865. colon: new TokenType(":", beforeExpr),
  40866. dot: new TokenType("."),
  40867. question: new TokenType("?", beforeExpr),
  40868. questionDot: new TokenType("?."),
  40869. arrow: new TokenType("=>", beforeExpr),
  40870. template: new TokenType("template"),
  40871. invalidTemplate: new TokenType("invalidTemplate"),
  40872. ellipsis: new TokenType("...", beforeExpr),
  40873. backQuote: new TokenType("`", startsExpr),
  40874. dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
  40875. // Operators. These carry several kinds of properties to help the
  40876. // parser use them properly (the presence of these properties is
  40877. // what categorizes them as operators).
  40878. //
  40879. // `binop`, when present, specifies that this operator is a binary
  40880. // operator, and will refer to its precedence.
  40881. //
  40882. // `prefix` and `postfix` mark the operator as a prefix or postfix
  40883. // unary operator.
  40884. //
  40885. // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
  40886. // binary operators with a very low precedence, that should result
  40887. // in AssignmentExpression nodes.
  40888. eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
  40889. assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
  40890. incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
  40891. prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
  40892. logicalOR: binop("||", 1),
  40893. logicalAND: binop("&&", 2),
  40894. bitwiseOR: binop("|", 3),
  40895. bitwiseXOR: binop("^", 4),
  40896. bitwiseAND: binop("&", 5),
  40897. equality: binop("==/!=/===/!==", 6),
  40898. relational: binop("</>/<=/>=", 7),
  40899. bitShift: binop("<</>>/>>>", 8),
  40900. plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
  40901. modulo: binop("%", 10),
  40902. star: binop("*", 10),
  40903. slash: binop("/", 10),
  40904. starstar: new TokenType("**", {beforeExpr: true}),
  40905. coalesce: binop("??", 1),
  40906. // Keyword token types.
  40907. _break: kw("break"),
  40908. _case: kw("case", beforeExpr),
  40909. _catch: kw("catch"),
  40910. _continue: kw("continue"),
  40911. _debugger: kw("debugger"),
  40912. _default: kw("default", beforeExpr),
  40913. _do: kw("do", {isLoop: true, beforeExpr: true}),
  40914. _else: kw("else", beforeExpr),
  40915. _finally: kw("finally"),
  40916. _for: kw("for", {isLoop: true}),
  40917. _function: kw("function", startsExpr),
  40918. _if: kw("if"),
  40919. _return: kw("return", beforeExpr),
  40920. _switch: kw("switch"),
  40921. _throw: kw("throw", beforeExpr),
  40922. _try: kw("try"),
  40923. _var: kw("var"),
  40924. _const: kw("const"),
  40925. _while: kw("while", {isLoop: true}),
  40926. _with: kw("with"),
  40927. _new: kw("new", {beforeExpr: true, startsExpr: true}),
  40928. _this: kw("this", startsExpr),
  40929. _super: kw("super", startsExpr),
  40930. _class: kw("class", startsExpr),
  40931. _extends: kw("extends", beforeExpr),
  40932. _export: kw("export"),
  40933. _import: kw("import", startsExpr),
  40934. _null: kw("null", startsExpr),
  40935. _true: kw("true", startsExpr),
  40936. _false: kw("false", startsExpr),
  40937. _in: kw("in", {beforeExpr: true, binop: 7}),
  40938. _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
  40939. _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
  40940. _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
  40941. _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
  40942. };
  40943. // Matches a whole line break (where CRLF is considered a single
  40944. // line break). Used to count lines.
  40945. var lineBreak = /\r\n?|\n|\u2028|\u2029/;
  40946. var lineBreakG = new RegExp(lineBreak.source, "g");
  40947. function isNewLine(code, ecma2019String) {
  40948. return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))
  40949. }
  40950. var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
  40951. var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
  40952. var ref = Object.prototype;
  40953. var hasOwnProperty = ref.hasOwnProperty;
  40954. var toString = ref.toString;
  40955. // Checks if an object has a property.
  40956. function has(obj, propName) {
  40957. return hasOwnProperty.call(obj, propName)
  40958. }
  40959. var isArray = Array.isArray || (function (obj) { return (
  40960. toString.call(obj) === "[object Array]"
  40961. ); });
  40962. function wordsRegexp(words) {
  40963. return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
  40964. }
  40965. // These are used when `options.locations` is on, for the
  40966. // `startLoc` and `endLoc` properties.
  40967. var Position = function Position(line, col) {
  40968. this.line = line;
  40969. this.column = col;
  40970. };
  40971. Position.prototype.offset = function offset (n) {
  40972. return new Position(this.line, this.column + n)
  40973. };
  40974. var SourceLocation = function SourceLocation(p, start, end) {
  40975. this.start = start;
  40976. this.end = end;
  40977. if (p.sourceFile !== null) { this.source = p.sourceFile; }
  40978. };
  40979. // The `getLineInfo` function is mostly useful when the
  40980. // `locations` option is off (for performance reasons) and you
  40981. // want to find the line/column position for a given character
  40982. // offset. `input` should be the code string that the offset refers
  40983. // into.
  40984. function getLineInfo(input, offset) {
  40985. for (var line = 1, cur = 0;;) {
  40986. lineBreakG.lastIndex = cur;
  40987. var match = lineBreakG.exec(input);
  40988. if (match && match.index < offset) {
  40989. ++line;
  40990. cur = match.index + match[0].length;
  40991. } else {
  40992. return new Position(line, offset - cur)
  40993. }
  40994. }
  40995. }
  40996. // A second argument must be given to configure the parser process.
  40997. // These options are recognized (only `ecmaVersion` is required):
  40998. var defaultOptions = {
  40999. // `ecmaVersion` indicates the ECMAScript version to parse. Must be
  41000. // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
  41001. // (2019), 11 (2020), 12 (2021), or `"latest"` (the latest version
  41002. // the library supports). This influences support for strict mode,
  41003. // the set of reserved words, and support for new syntax features.
  41004. ecmaVersion: null,
  41005. // `sourceType` indicates the mode the code should be parsed in.
  41006. // Can be either `"script"` or `"module"`. This influences global
  41007. // strict mode and parsing of `import` and `export` declarations.
  41008. sourceType: "script",
  41009. // `onInsertedSemicolon` can be a callback that will be called
  41010. // when a semicolon is automatically inserted. It will be passed
  41011. // the position of the comma as an offset, and if `locations` is
  41012. // enabled, it is given the location as a `{line, column}` object
  41013. // as second argument.
  41014. onInsertedSemicolon: null,
  41015. // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
  41016. // trailing commas.
  41017. onTrailingComma: null,
  41018. // By default, reserved words are only enforced if ecmaVersion >= 5.
  41019. // Set `allowReserved` to a boolean value to explicitly turn this on
  41020. // an off. When this option has the value "never", reserved words
  41021. // and keywords can also not be used as property names.
  41022. allowReserved: null,
  41023. // When enabled, a return at the top level is not considered an
  41024. // error.
  41025. allowReturnOutsideFunction: false,
  41026. // When enabled, import/export statements are not constrained to
  41027. // appearing at the top of the program.
  41028. allowImportExportEverywhere: false,
  41029. // When enabled, await identifiers are allowed to appear at the top-level scope,
  41030. // but they are still not allowed in non-async functions.
  41031. allowAwaitOutsideFunction: false,
  41032. // When enabled, hashbang directive in the beginning of file
  41033. // is allowed and treated as a line comment.
  41034. allowHashBang: false,
  41035. // When `locations` is on, `loc` properties holding objects with
  41036. // `start` and `end` properties in `{line, column}` form (with
  41037. // line being 1-based and column 0-based) will be attached to the
  41038. // nodes.
  41039. locations: false,
  41040. // A function can be passed as `onToken` option, which will
  41041. // cause Acorn to call that function with object in the same
  41042. // format as tokens returned from `tokenizer().getToken()`. Note
  41043. // that you are not allowed to call the parser from the
  41044. // callback—that will corrupt its internal state.
  41045. onToken: null,
  41046. // A function can be passed as `onComment` option, which will
  41047. // cause Acorn to call that function with `(block, text, start,
  41048. // end)` parameters whenever a comment is skipped. `block` is a
  41049. // boolean indicating whether this is a block (`/* */`) comment,
  41050. // `text` is the content of the comment, and `start` and `end` are
  41051. // character offsets that denote the start and end of the comment.
  41052. // When the `locations` option is on, two more parameters are
  41053. // passed, the full `{line, column}` locations of the start and
  41054. // end of the comments. Note that you are not allowed to call the
  41055. // parser from the callback—that will corrupt its internal state.
  41056. onComment: null,
  41057. // Nodes have their start and end characters offsets recorded in
  41058. // `start` and `end` properties (directly on the node, rather than
  41059. // the `loc` object, which holds line/column data. To also add a
  41060. // [semi-standardized][range] `range` property holding a `[start,
  41061. // end]` array with the same numbers, set the `ranges` option to
  41062. // `true`.
  41063. //
  41064. // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
  41065. ranges: false,
  41066. // It is possible to parse multiple files into a single AST by
  41067. // passing the tree produced by parsing the first file as
  41068. // `program` option in subsequent parses. This will add the
  41069. // toplevel forms of the parsed file to the `Program` (top) node
  41070. // of an existing parse tree.
  41071. program: null,
  41072. // When `locations` is on, you can pass this to record the source
  41073. // file in every node's `loc` object.
  41074. sourceFile: null,
  41075. // This value, if given, is stored in every node, whether
  41076. // `locations` is on or off.
  41077. directSourceFile: null,
  41078. // When enabled, parenthesized expressions are represented by
  41079. // (non-standard) ParenthesizedExpression nodes
  41080. preserveParens: false
  41081. };
  41082. // Interpret and default an options object
  41083. var warnedAboutEcmaVersion = false;
  41084. function getOptions(opts) {
  41085. var options = {};
  41086. for (var opt in defaultOptions)
  41087. { options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; }
  41088. if (options.ecmaVersion === "latest") {
  41089. options.ecmaVersion = 1e8;
  41090. } else if (options.ecmaVersion == null) {
  41091. if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
  41092. warnedAboutEcmaVersion = true;
  41093. console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
  41094. }
  41095. options.ecmaVersion = 11;
  41096. } else if (options.ecmaVersion >= 2015) {
  41097. options.ecmaVersion -= 2009;
  41098. }
  41099. if (options.allowReserved == null)
  41100. { options.allowReserved = options.ecmaVersion < 5; }
  41101. if (isArray(options.onToken)) {
  41102. var tokens = options.onToken;
  41103. options.onToken = function (token) { return tokens.push(token); };
  41104. }
  41105. if (isArray(options.onComment))
  41106. { options.onComment = pushComment(options, options.onComment); }
  41107. return options
  41108. }
  41109. function pushComment(options, array) {
  41110. return function(block, text, start, end, startLoc, endLoc) {
  41111. var comment = {
  41112. type: block ? "Block" : "Line",
  41113. value: text,
  41114. start: start,
  41115. end: end
  41116. };
  41117. if (options.locations)
  41118. { comment.loc = new SourceLocation(this, startLoc, endLoc); }
  41119. if (options.ranges)
  41120. { comment.range = [start, end]; }
  41121. array.push(comment);
  41122. }
  41123. }
  41124. // Each scope gets a bitset that may contain these flags
  41125. var
  41126. SCOPE_TOP = 1,
  41127. SCOPE_FUNCTION = 2,
  41128. SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,
  41129. SCOPE_ASYNC = 4,
  41130. SCOPE_GENERATOR = 8,
  41131. SCOPE_ARROW = 16,
  41132. SCOPE_SIMPLE_CATCH = 32,
  41133. SCOPE_SUPER = 64,
  41134. SCOPE_DIRECT_SUPER = 128;
  41135. function functionFlags(async, generator) {
  41136. return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)
  41137. }
  41138. // Used in checkLVal* and declareName to determine the type of a binding
  41139. var
  41140. BIND_NONE = 0, // Not a binding
  41141. BIND_VAR = 1, // Var-style binding
  41142. BIND_LEXICAL = 2, // Let- or const-style binding
  41143. BIND_FUNCTION = 3, // Function declaration
  41144. BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding
  41145. BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
  41146. var Parser = function Parser(options, input, startPos) {
  41147. this.options = options = getOptions(options);
  41148. this.sourceFile = options.sourceFile;
  41149. this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
  41150. var reserved = "";
  41151. if (options.allowReserved !== true) {
  41152. reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
  41153. if (options.sourceType === "module") { reserved += " await"; }
  41154. }
  41155. this.reservedWords = wordsRegexp(reserved);
  41156. var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
  41157. this.reservedWordsStrict = wordsRegexp(reservedStrict);
  41158. this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
  41159. this.input = String(input);
  41160. // Used to signal to callers of `readWord1` whether the word
  41161. // contained any escape sequences. This is needed because words with
  41162. // escape sequences must not be interpreted as keywords.
  41163. this.containsEsc = false;
  41164. // Set up token state
  41165. // The current position of the tokenizer in the input.
  41166. if (startPos) {
  41167. this.pos = startPos;
  41168. this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
  41169. this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
  41170. } else {
  41171. this.pos = this.lineStart = 0;
  41172. this.curLine = 1;
  41173. }
  41174. // Properties of the current token:
  41175. // Its type
  41176. this.type = types.eof;
  41177. // For tokens that include more information than their type, the value
  41178. this.value = null;
  41179. // Its start and end offset
  41180. this.start = this.end = this.pos;
  41181. // And, if locations are used, the {line, column} object
  41182. // corresponding to those offsets
  41183. this.startLoc = this.endLoc = this.curPosition();
  41184. // Position information for the previous token
  41185. this.lastTokEndLoc = this.lastTokStartLoc = null;
  41186. this.lastTokStart = this.lastTokEnd = this.pos;
  41187. // The context stack is used to superficially track syntactic
  41188. // context to predict whether a regular expression is allowed in a
  41189. // given position.
  41190. this.context = this.initialContext();
  41191. this.exprAllowed = true;
  41192. // Figure out if it's a module code.
  41193. this.inModule = options.sourceType === "module";
  41194. this.strict = this.inModule || this.strictDirective(this.pos);
  41195. // Used to signify the start of a potential arrow function
  41196. this.potentialArrowAt = -1;
  41197. // Positions to delayed-check that yield/await does not exist in default parameters.
  41198. this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
  41199. // Labels in scope.
  41200. this.labels = [];
  41201. // Thus-far undefined exports.
  41202. this.undefinedExports = Object.create(null);
  41203. // If enabled, skip leading hashbang line.
  41204. if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
  41205. { this.skipLineComment(2); }
  41206. // Scope tracking for duplicate variable names (see scope.js)
  41207. this.scopeStack = [];
  41208. this.enterScope(SCOPE_TOP);
  41209. // For RegExp validation
  41210. this.regexpState = null;
  41211. };
  41212. var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },inNonArrowFunction: { configurable: true } };
  41213. Parser.prototype.parse = function parse () {
  41214. var node = this.options.program || this.startNode();
  41215. this.nextToken();
  41216. return this.parseTopLevel(node)
  41217. };
  41218. prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
  41219. prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
  41220. prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
  41221. prototypeAccessors.allowSuper.get = function () { return (this.currentThisScope().flags & SCOPE_SUPER) > 0 };
  41222. prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
  41223. prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
  41224. prototypeAccessors.inNonArrowFunction.get = function () { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0 };
  41225. Parser.extend = function extend () {
  41226. var plugins = [], len = arguments.length;
  41227. while ( len-- ) plugins[ len ] = arguments[ len ];
  41228. var cls = this;
  41229. for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
  41230. return cls
  41231. };
  41232. Parser.parse = function parse (input, options) {
  41233. return new this(options, input).parse()
  41234. };
  41235. Parser.parseExpressionAt = function parseExpressionAt (input, pos, options) {
  41236. var parser = new this(options, input, pos);
  41237. parser.nextToken();
  41238. return parser.parseExpression()
  41239. };
  41240. Parser.tokenizer = function tokenizer (input, options) {
  41241. return new this(options, input)
  41242. };
  41243. Object.defineProperties( Parser.prototype, prototypeAccessors );
  41244. var pp = Parser.prototype;
  41245. // ## Parser utilities
  41246. var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
  41247. pp.strictDirective = function(start) {
  41248. for (;;) {
  41249. // Try to find string literal.
  41250. skipWhiteSpace.lastIndex = start;
  41251. start += skipWhiteSpace.exec(this.input)[0].length;
  41252. var match = literal.exec(this.input.slice(start));
  41253. if (!match) { return false }
  41254. if ((match[1] || match[2]) === "use strict") {
  41255. skipWhiteSpace.lastIndex = start + match[0].length;
  41256. var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
  41257. var next = this.input.charAt(end);
  41258. return next === ";" || next === "}" ||
  41259. (lineBreak.test(spaceAfter[0]) &&
  41260. !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
  41261. }
  41262. start += match[0].length;
  41263. // Skip semicolon, if any.
  41264. skipWhiteSpace.lastIndex = start;
  41265. start += skipWhiteSpace.exec(this.input)[0].length;
  41266. if (this.input[start] === ";")
  41267. { start++; }
  41268. }
  41269. };
  41270. // Predicate that tests whether the next token is of the given
  41271. // type, and if yes, consumes it as a side effect.
  41272. pp.eat = function(type) {
  41273. if (this.type === type) {
  41274. this.next();
  41275. return true
  41276. } else {
  41277. return false
  41278. }
  41279. };
  41280. // Tests whether parsed token is a contextual keyword.
  41281. pp.isContextual = function(name) {
  41282. return this.type === types.name && this.value === name && !this.containsEsc
  41283. };
  41284. // Consumes contextual keyword if possible.
  41285. pp.eatContextual = function(name) {
  41286. if (!this.isContextual(name)) { return false }
  41287. this.next();
  41288. return true
  41289. };
  41290. // Asserts that following token is given contextual keyword.
  41291. pp.expectContextual = function(name) {
  41292. if (!this.eatContextual(name)) { this.unexpected(); }
  41293. };
  41294. // Test whether a semicolon can be inserted at the current position.
  41295. pp.canInsertSemicolon = function() {
  41296. return this.type === types.eof ||
  41297. this.type === types.braceR ||
  41298. lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
  41299. };
  41300. pp.insertSemicolon = function() {
  41301. if (this.canInsertSemicolon()) {
  41302. if (this.options.onInsertedSemicolon)
  41303. { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
  41304. return true
  41305. }
  41306. };
  41307. // Consume a semicolon, or, failing that, see if we are allowed to
  41308. // pretend that there is a semicolon at this position.
  41309. pp.semicolon = function() {
  41310. if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
  41311. };
  41312. pp.afterTrailingComma = function(tokType, notNext) {
  41313. if (this.type === tokType) {
  41314. if (this.options.onTrailingComma)
  41315. { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
  41316. if (!notNext)
  41317. { this.next(); }
  41318. return true
  41319. }
  41320. };
  41321. // Expect a token of a given type. If found, consume it, otherwise,
  41322. // raise an unexpected token error.
  41323. pp.expect = function(type) {
  41324. this.eat(type) || this.unexpected();
  41325. };
  41326. // Raise an unexpected token error.
  41327. pp.unexpected = function(pos) {
  41328. this.raise(pos != null ? pos : this.start, "Unexpected token");
  41329. };
  41330. function DestructuringErrors() {
  41331. this.shorthandAssign =
  41332. this.trailingComma =
  41333. this.parenthesizedAssign =
  41334. this.parenthesizedBind =
  41335. this.doubleProto =
  41336. -1;
  41337. }
  41338. pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
  41339. if (!refDestructuringErrors) { return }
  41340. if (refDestructuringErrors.trailingComma > -1)
  41341. { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
  41342. var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
  41343. if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
  41344. };
  41345. pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
  41346. if (!refDestructuringErrors) { return false }
  41347. var shorthandAssign = refDestructuringErrors.shorthandAssign;
  41348. var doubleProto = refDestructuringErrors.doubleProto;
  41349. if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }
  41350. if (shorthandAssign >= 0)
  41351. { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); }
  41352. if (doubleProto >= 0)
  41353. { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
  41354. };
  41355. pp.checkYieldAwaitInDefaultParams = function() {
  41356. if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
  41357. { this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
  41358. if (this.awaitPos)
  41359. { this.raise(this.awaitPos, "Await expression cannot be a default value"); }
  41360. };
  41361. pp.isSimpleAssignTarget = function(expr) {
  41362. if (expr.type === "ParenthesizedExpression")
  41363. { return this.isSimpleAssignTarget(expr.expression) }
  41364. return expr.type === "Identifier" || expr.type === "MemberExpression"
  41365. };
  41366. var pp$1 = Parser.prototype;
  41367. // ### Statement parsing
  41368. // Parse a program. Initializes the parser, reads any number of
  41369. // statements, and wraps them in a Program node. Optionally takes a
  41370. // `program` argument. If present, the statements will be appended
  41371. // to its body instead of creating a new node.
  41372. pp$1.parseTopLevel = function(node) {
  41373. var exports = Object.create(null);
  41374. if (!node.body) { node.body = []; }
  41375. while (this.type !== types.eof) {
  41376. var stmt = this.parseStatement(null, true, exports);
  41377. node.body.push(stmt);
  41378. }
  41379. if (this.inModule)
  41380. { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)
  41381. {
  41382. var name = list[i];
  41383. this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined"));
  41384. } }
  41385. this.adaptDirectivePrologue(node.body);
  41386. this.next();
  41387. node.sourceType = this.options.sourceType;
  41388. return this.finishNode(node, "Program")
  41389. };
  41390. var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
  41391. pp$1.isLet = function(context) {
  41392. if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
  41393. skipWhiteSpace.lastIndex = this.pos;
  41394. var skip = skipWhiteSpace.exec(this.input);
  41395. var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
  41396. // For ambiguous cases, determine if a LexicalDeclaration (or only a
  41397. // Statement) is allowed here. If context is not empty then only a Statement
  41398. // is allowed. However, `let [` is an explicit negative lookahead for
  41399. // ExpressionStatement, so special-case it first.
  41400. if (nextCh === 91) { return true } // '['
  41401. if (context) { return false }
  41402. if (nextCh === 123) { return true } // '{'
  41403. if (isIdentifierStart(nextCh, true)) {
  41404. var pos = next + 1;
  41405. while (isIdentifierChar(this.input.charCodeAt(pos), true)) { ++pos; }
  41406. var ident = this.input.slice(next, pos);
  41407. if (!keywordRelationalOperator.test(ident)) { return true }
  41408. }
  41409. return false
  41410. };
  41411. // check 'async [no LineTerminator here] function'
  41412. // - 'async /*foo*/ function' is OK.
  41413. // - 'async /*\n*/ function' is invalid.
  41414. pp$1.isAsyncFunction = function() {
  41415. if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
  41416. { return false }
  41417. skipWhiteSpace.lastIndex = this.pos;
  41418. var skip = skipWhiteSpace.exec(this.input);
  41419. var next = this.pos + skip[0].length;
  41420. return !lineBreak.test(this.input.slice(this.pos, next)) &&
  41421. this.input.slice(next, next + 8) === "function" &&
  41422. (next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))
  41423. };
  41424. // Parse a single statement.
  41425. //
  41426. // If expecting a statement and finding a slash operator, parse a
  41427. // regular expression literal. This is to handle cases like
  41428. // `if (foo) /blah/.exec(foo)`, where looking at the previous token
  41429. // does not help.
  41430. pp$1.parseStatement = function(context, topLevel, exports) {
  41431. var starttype = this.type, node = this.startNode(), kind;
  41432. if (this.isLet(context)) {
  41433. starttype = types._var;
  41434. kind = "let";
  41435. }
  41436. // Most types of statements are recognized by the keyword they
  41437. // start with. Many are trivial to parse, some require a bit of
  41438. // complexity.
  41439. switch (starttype) {
  41440. case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
  41441. case types._debugger: return this.parseDebuggerStatement(node)
  41442. case types._do: return this.parseDoStatement(node)
  41443. case types._for: return this.parseForStatement(node)
  41444. case types._function:
  41445. // Function as sole body of either an if statement or a labeled statement
  41446. // works, but not when it is part of a labeled statement that is the sole
  41447. // body of an if statement.
  41448. if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
  41449. return this.parseFunctionStatement(node, false, !context)
  41450. case types._class:
  41451. if (context) { this.unexpected(); }
  41452. return this.parseClass(node, true)
  41453. case types._if: return this.parseIfStatement(node)
  41454. case types._return: return this.parseReturnStatement(node)
  41455. case types._switch: return this.parseSwitchStatement(node)
  41456. case types._throw: return this.parseThrowStatement(node)
  41457. case types._try: return this.parseTryStatement(node)
  41458. case types._const: case types._var:
  41459. kind = kind || this.value;
  41460. if (context && kind !== "var") { this.unexpected(); }
  41461. return this.parseVarStatement(node, kind)
  41462. case types._while: return this.parseWhileStatement(node)
  41463. case types._with: return this.parseWithStatement(node)
  41464. case types.braceL: return this.parseBlock(true, node)
  41465. case types.semi: return this.parseEmptyStatement(node)
  41466. case types._export:
  41467. case types._import:
  41468. if (this.options.ecmaVersion > 10 && starttype === types._import) {
  41469. skipWhiteSpace.lastIndex = this.pos;
  41470. var skip = skipWhiteSpace.exec(this.input);
  41471. var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
  41472. if (nextCh === 40 || nextCh === 46) // '(' or '.'
  41473. { return this.parseExpressionStatement(node, this.parseExpression()) }
  41474. }
  41475. if (!this.options.allowImportExportEverywhere) {
  41476. if (!topLevel)
  41477. { this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
  41478. if (!this.inModule)
  41479. { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
  41480. }
  41481. return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
  41482. // If the statement does not start with a statement keyword or a
  41483. // brace, it's an ExpressionStatement or LabeledStatement. We
  41484. // simply start parsing an expression, and afterwards, if the
  41485. // next token is a colon and the expression was a simple
  41486. // Identifier node, we switch to interpreting it as a label.
  41487. default:
  41488. if (this.isAsyncFunction()) {
  41489. if (context) { this.unexpected(); }
  41490. this.next();
  41491. return this.parseFunctionStatement(node, true, !context)
  41492. }
  41493. var maybeName = this.value, expr = this.parseExpression();
  41494. if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
  41495. { return this.parseLabeledStatement(node, maybeName, expr, context) }
  41496. else { return this.parseExpressionStatement(node, expr) }
  41497. }
  41498. };
  41499. pp$1.parseBreakContinueStatement = function(node, keyword) {
  41500. var isBreak = keyword === "break";
  41501. this.next();
  41502. if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
  41503. else if (this.type !== types.name) { this.unexpected(); }
  41504. else {
  41505. node.label = this.parseIdent();
  41506. this.semicolon();
  41507. }
  41508. // Verify that there is an actual destination to break or
  41509. // continue to.
  41510. var i = 0;
  41511. for (; i < this.labels.length; ++i) {
  41512. var lab = this.labels[i];
  41513. if (node.label == null || lab.name === node.label.name) {
  41514. if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
  41515. if (node.label && isBreak) { break }
  41516. }
  41517. }
  41518. if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); }
  41519. return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
  41520. };
  41521. pp$1.parseDebuggerStatement = function(node) {
  41522. this.next();
  41523. this.semicolon();
  41524. return this.finishNode(node, "DebuggerStatement")
  41525. };
  41526. pp$1.parseDoStatement = function(node) {
  41527. this.next();
  41528. this.labels.push(loopLabel);
  41529. node.body = this.parseStatement("do");
  41530. this.labels.pop();
  41531. this.expect(types._while);
  41532. node.test = this.parseParenExpression();
  41533. if (this.options.ecmaVersion >= 6)
  41534. { this.eat(types.semi); }
  41535. else
  41536. { this.semicolon(); }
  41537. return this.finishNode(node, "DoWhileStatement")
  41538. };
  41539. // Disambiguating between a `for` and a `for`/`in` or `for`/`of`
  41540. // loop is non-trivial. Basically, we have to parse the init `var`
  41541. // statement or expression, disallowing the `in` operator (see
  41542. // the second parameter to `parseExpression`), and then check
  41543. // whether the next token is `in` or `of`. When there is no init
  41544. // part (semicolon immediately after the opening parenthesis), it
  41545. // is a regular `for` loop.
  41546. pp$1.parseForStatement = function(node) {
  41547. this.next();
  41548. var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1;
  41549. this.labels.push(loopLabel);
  41550. this.enterScope(0);
  41551. this.expect(types.parenL);
  41552. if (this.type === types.semi) {
  41553. if (awaitAt > -1) { this.unexpected(awaitAt); }
  41554. return this.parseFor(node, null)
  41555. }
  41556. var isLet = this.isLet();
  41557. if (this.type === types._var || this.type === types._const || isLet) {
  41558. var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
  41559. this.next();
  41560. this.parseVar(init$1, true, kind);
  41561. this.finishNode(init$1, "VariableDeclaration");
  41562. if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
  41563. if (this.options.ecmaVersion >= 9) {
  41564. if (this.type === types._in) {
  41565. if (awaitAt > -1) { this.unexpected(awaitAt); }
  41566. } else { node.await = awaitAt > -1; }
  41567. }
  41568. return this.parseForIn(node, init$1)
  41569. }
  41570. if (awaitAt > -1) { this.unexpected(awaitAt); }
  41571. return this.parseFor(node, init$1)
  41572. }
  41573. var refDestructuringErrors = new DestructuringErrors;
  41574. var init = this.parseExpression(true, refDestructuringErrors);
  41575. if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
  41576. if (this.options.ecmaVersion >= 9) {
  41577. if (this.type === types._in) {
  41578. if (awaitAt > -1) { this.unexpected(awaitAt); }
  41579. } else { node.await = awaitAt > -1; }
  41580. }
  41581. this.toAssignable(init, false, refDestructuringErrors);
  41582. this.checkLValPattern(init);
  41583. return this.parseForIn(node, init)
  41584. } else {
  41585. this.checkExpressionErrors(refDestructuringErrors, true);
  41586. }
  41587. if (awaitAt > -1) { this.unexpected(awaitAt); }
  41588. return this.parseFor(node, init)
  41589. };
  41590. pp$1.parseFunctionStatement = function(node, isAsync, declarationPosition) {
  41591. this.next();
  41592. return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
  41593. };
  41594. pp$1.parseIfStatement = function(node) {
  41595. this.next();
  41596. node.test = this.parseParenExpression();
  41597. // allow function declarations in branches, but only in non-strict mode
  41598. node.consequent = this.parseStatement("if");
  41599. node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
  41600. return this.finishNode(node, "IfStatement")
  41601. };
  41602. pp$1.parseReturnStatement = function(node) {
  41603. if (!this.inFunction && !this.options.allowReturnOutsideFunction)
  41604. { this.raise(this.start, "'return' outside of function"); }
  41605. this.next();
  41606. // In `return` (and `break`/`continue`), the keywords with
  41607. // optional arguments, we eagerly look for a semicolon or the
  41608. // possibility to insert one.
  41609. if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
  41610. else { node.argument = this.parseExpression(); this.semicolon(); }
  41611. return this.finishNode(node, "ReturnStatement")
  41612. };
  41613. pp$1.parseSwitchStatement = function(node) {
  41614. this.next();
  41615. node.discriminant = this.parseParenExpression();
  41616. node.cases = [];
  41617. this.expect(types.braceL);
  41618. this.labels.push(switchLabel);
  41619. this.enterScope(0);
  41620. // Statements under must be grouped (by label) in SwitchCase
  41621. // nodes. `cur` is used to keep the node that we are currently
  41622. // adding statements to.
  41623. var cur;
  41624. for (var sawDefault = false; this.type !== types.braceR;) {
  41625. if (this.type === types._case || this.type === types._default) {
  41626. var isCase = this.type === types._case;
  41627. if (cur) { this.finishNode(cur, "SwitchCase"); }
  41628. node.cases.push(cur = this.startNode());
  41629. cur.consequent = [];
  41630. this.next();
  41631. if (isCase) {
  41632. cur.test = this.parseExpression();
  41633. } else {
  41634. if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); }
  41635. sawDefault = true;
  41636. cur.test = null;
  41637. }
  41638. this.expect(types.colon);
  41639. } else {
  41640. if (!cur) { this.unexpected(); }
  41641. cur.consequent.push(this.parseStatement(null));
  41642. }
  41643. }
  41644. this.exitScope();
  41645. if (cur) { this.finishNode(cur, "SwitchCase"); }
  41646. this.next(); // Closing brace
  41647. this.labels.pop();
  41648. return this.finishNode(node, "SwitchStatement")
  41649. };
  41650. pp$1.parseThrowStatement = function(node) {
  41651. this.next();
  41652. if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
  41653. { this.raise(this.lastTokEnd, "Illegal newline after throw"); }
  41654. node.argument = this.parseExpression();
  41655. this.semicolon();
  41656. return this.finishNode(node, "ThrowStatement")
  41657. };
  41658. // Reused empty array added for node fields that are always empty.
  41659. var empty = [];
  41660. pp$1.parseTryStatement = function(node) {
  41661. this.next();
  41662. node.block = this.parseBlock();
  41663. node.handler = null;
  41664. if (this.type === types._catch) {
  41665. var clause = this.startNode();
  41666. this.next();
  41667. if (this.eat(types.parenL)) {
  41668. clause.param = this.parseBindingAtom();
  41669. var simple = clause.param.type === "Identifier";
  41670. this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
  41671. this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
  41672. this.expect(types.parenR);
  41673. } else {
  41674. if (this.options.ecmaVersion < 10) { this.unexpected(); }
  41675. clause.param = null;
  41676. this.enterScope(0);
  41677. }
  41678. clause.body = this.parseBlock(false);
  41679. this.exitScope();
  41680. node.handler = this.finishNode(clause, "CatchClause");
  41681. }
  41682. node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
  41683. if (!node.handler && !node.finalizer)
  41684. { this.raise(node.start, "Missing catch or finally clause"); }
  41685. return this.finishNode(node, "TryStatement")
  41686. };
  41687. pp$1.parseVarStatement = function(node, kind) {
  41688. this.next();
  41689. this.parseVar(node, false, kind);
  41690. this.semicolon();
  41691. return this.finishNode(node, "VariableDeclaration")
  41692. };
  41693. pp$1.parseWhileStatement = function(node) {
  41694. this.next();
  41695. node.test = this.parseParenExpression();
  41696. this.labels.push(loopLabel);
  41697. node.body = this.parseStatement("while");
  41698. this.labels.pop();
  41699. return this.finishNode(node, "WhileStatement")
  41700. };
  41701. pp$1.parseWithStatement = function(node) {
  41702. if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
  41703. this.next();
  41704. node.object = this.parseParenExpression();
  41705. node.body = this.parseStatement("with");
  41706. return this.finishNode(node, "WithStatement")
  41707. };
  41708. pp$1.parseEmptyStatement = function(node) {
  41709. this.next();
  41710. return this.finishNode(node, "EmptyStatement")
  41711. };
  41712. pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
  41713. for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
  41714. {
  41715. var label = list[i$1];
  41716. if (label.name === maybeName)
  41717. { this.raise(expr.start, "Label '" + maybeName + "' is already declared");
  41718. } }
  41719. var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
  41720. for (var i = this.labels.length - 1; i >= 0; i--) {
  41721. var label$1 = this.labels[i];
  41722. if (label$1.statementStart === node.start) {
  41723. // Update information about previous labels on this node
  41724. label$1.statementStart = this.start;
  41725. label$1.kind = kind;
  41726. } else { break }
  41727. }
  41728. this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
  41729. node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
  41730. this.labels.pop();
  41731. node.label = expr;
  41732. return this.finishNode(node, "LabeledStatement")
  41733. };
  41734. pp$1.parseExpressionStatement = function(node, expr) {
  41735. node.expression = expr;
  41736. this.semicolon();
  41737. return this.finishNode(node, "ExpressionStatement")
  41738. };
  41739. // Parse a semicolon-enclosed block of statements, handling `"use
  41740. // strict"` declarations when `allowStrict` is true (used for
  41741. // function bodies).
  41742. pp$1.parseBlock = function(createNewLexicalScope, node, exitStrict) {
  41743. if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
  41744. if ( node === void 0 ) node = this.startNode();
  41745. node.body = [];
  41746. this.expect(types.braceL);
  41747. if (createNewLexicalScope) { this.enterScope(0); }
  41748. while (this.type !== types.braceR) {
  41749. var stmt = this.parseStatement(null);
  41750. node.body.push(stmt);
  41751. }
  41752. if (exitStrict) { this.strict = false; }
  41753. this.next();
  41754. if (createNewLexicalScope) { this.exitScope(); }
  41755. return this.finishNode(node, "BlockStatement")
  41756. };
  41757. // Parse a regular `for` loop. The disambiguation code in
  41758. // `parseStatement` will already have parsed the init statement or
  41759. // expression.
  41760. pp$1.parseFor = function(node, init) {
  41761. node.init = init;
  41762. this.expect(types.semi);
  41763. node.test = this.type === types.semi ? null : this.parseExpression();
  41764. this.expect(types.semi);
  41765. node.update = this.type === types.parenR ? null : this.parseExpression();
  41766. this.expect(types.parenR);
  41767. node.body = this.parseStatement("for");
  41768. this.exitScope();
  41769. this.labels.pop();
  41770. return this.finishNode(node, "ForStatement")
  41771. };
  41772. // Parse a `for`/`in` and `for`/`of` loop, which are almost
  41773. // same from parser's perspective.
  41774. pp$1.parseForIn = function(node, init) {
  41775. var isForIn = this.type === types._in;
  41776. this.next();
  41777. if (
  41778. init.type === "VariableDeclaration" &&
  41779. init.declarations[0].init != null &&
  41780. (
  41781. !isForIn ||
  41782. this.options.ecmaVersion < 8 ||
  41783. this.strict ||
  41784. init.kind !== "var" ||
  41785. init.declarations[0].id.type !== "Identifier"
  41786. )
  41787. ) {
  41788. this.raise(
  41789. init.start,
  41790. ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer")
  41791. );
  41792. }
  41793. node.left = init;
  41794. node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
  41795. this.expect(types.parenR);
  41796. node.body = this.parseStatement("for");
  41797. this.exitScope();
  41798. this.labels.pop();
  41799. return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement")
  41800. };
  41801. // Parse a list of variable declarations.
  41802. pp$1.parseVar = function(node, isFor, kind) {
  41803. node.declarations = [];
  41804. node.kind = kind;
  41805. for (;;) {
  41806. var decl = this.startNode();
  41807. this.parseVarId(decl, kind);
  41808. if (this.eat(types.eq)) {
  41809. decl.init = this.parseMaybeAssign(isFor);
  41810. } else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
  41811. this.unexpected();
  41812. } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
  41813. this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
  41814. } else {
  41815. decl.init = null;
  41816. }
  41817. node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
  41818. if (!this.eat(types.comma)) { break }
  41819. }
  41820. return node
  41821. };
  41822. pp$1.parseVarId = function(decl, kind) {
  41823. decl.id = this.parseBindingAtom();
  41824. this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
  41825. };
  41826. var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
  41827. // Parse a function declaration or literal (depending on the
  41828. // `statement & FUNC_STATEMENT`).
  41829. // Remove `allowExpressionBody` for 7.0.0, as it is only called with false
  41830. pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync) {
  41831. this.initFunction(node);
  41832. if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
  41833. if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
  41834. { this.unexpected(); }
  41835. node.generator = this.eat(types.star);
  41836. }
  41837. if (this.options.ecmaVersion >= 8)
  41838. { node.async = !!isAsync; }
  41839. if (statement & FUNC_STATEMENT) {
  41840. node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
  41841. if (node.id && !(statement & FUNC_HANGING_STATEMENT))
  41842. // If it is a regular function declaration in sloppy mode, then it is
  41843. // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
  41844. // mode depends on properties of the current scope (see
  41845. // treatFunctionsAsVar).
  41846. { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }
  41847. }
  41848. var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
  41849. this.yieldPos = 0;
  41850. this.awaitPos = 0;
  41851. this.awaitIdentPos = 0;
  41852. this.enterScope(functionFlags(node.async, node.generator));
  41853. if (!(statement & FUNC_STATEMENT))
  41854. { node.id = this.type === types.name ? this.parseIdent() : null; }
  41855. this.parseFunctionParams(node);
  41856. this.parseFunctionBody(node, allowExpressionBody, false);
  41857. this.yieldPos = oldYieldPos;
  41858. this.awaitPos = oldAwaitPos;
  41859. this.awaitIdentPos = oldAwaitIdentPos;
  41860. return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
  41861. };
  41862. pp$1.parseFunctionParams = function(node) {
  41863. this.expect(types.parenL);
  41864. node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
  41865. this.checkYieldAwaitInDefaultParams();
  41866. };
  41867. // Parse a class declaration or literal (depending on the
  41868. // `isStatement` parameter).
  41869. pp$1.parseClass = function(node, isStatement) {
  41870. this.next();
  41871. // ecma-262 14.6 Class Definitions
  41872. // A class definition is always strict mode code.
  41873. var oldStrict = this.strict;
  41874. this.strict = true;
  41875. this.parseClassId(node, isStatement);
  41876. this.parseClassSuper(node);
  41877. var classBody = this.startNode();
  41878. var hadConstructor = false;
  41879. classBody.body = [];
  41880. this.expect(types.braceL);
  41881. while (this.type !== types.braceR) {
  41882. var element = this.parseClassElement(node.superClass !== null);
  41883. if (element) {
  41884. classBody.body.push(element);
  41885. if (element.type === "MethodDefinition" && element.kind === "constructor") {
  41886. if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
  41887. hadConstructor = true;
  41888. }
  41889. }
  41890. }
  41891. this.strict = oldStrict;
  41892. this.next();
  41893. node.body = this.finishNode(classBody, "ClassBody");
  41894. return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
  41895. };
  41896. pp$1.parseClassElement = function(constructorAllowsSuper) {
  41897. var this$1 = this;
  41898. if (this.eat(types.semi)) { return null }
  41899. var method = this.startNode();
  41900. var tryContextual = function (k, noLineBreak) {
  41901. if ( noLineBreak === void 0 ) noLineBreak = false;
  41902. var start = this$1.start, startLoc = this$1.startLoc;
  41903. if (!this$1.eatContextual(k)) { return false }
  41904. if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
  41905. if (method.key) { this$1.unexpected(); }
  41906. method.computed = false;
  41907. method.key = this$1.startNodeAt(start, startLoc);
  41908. method.key.name = k;
  41909. this$1.finishNode(method.key, "Identifier");
  41910. return false
  41911. };
  41912. method.kind = "method";
  41913. method.static = tryContextual("static");
  41914. var isGenerator = this.eat(types.star);
  41915. var isAsync = false;
  41916. if (!isGenerator) {
  41917. if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
  41918. isAsync = true;
  41919. isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
  41920. } else if (tryContextual("get")) {
  41921. method.kind = "get";
  41922. } else if (tryContextual("set")) {
  41923. method.kind = "set";
  41924. }
  41925. }
  41926. if (!method.key) { this.parsePropertyName(method); }
  41927. var key = method.key;
  41928. var allowsDirectSuper = false;
  41929. if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" ||
  41930. key.type === "Literal" && key.value === "constructor")) {
  41931. if (method.kind !== "method") { this.raise(key.start, "Constructor can't have get/set modifier"); }
  41932. if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
  41933. if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
  41934. method.kind = "constructor";
  41935. allowsDirectSuper = constructorAllowsSuper;
  41936. } else if (method.static && key.type === "Identifier" && key.name === "prototype") {
  41937. this.raise(key.start, "Classes may not have a static property named prototype");
  41938. }
  41939. this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);
  41940. if (method.kind === "get" && method.value.params.length !== 0)
  41941. { this.raiseRecoverable(method.value.start, "getter should have no params"); }
  41942. if (method.kind === "set" && method.value.params.length !== 1)
  41943. { this.raiseRecoverable(method.value.start, "setter should have exactly one param"); }
  41944. if (method.kind === "set" && method.value.params[0].type === "RestElement")
  41945. { this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); }
  41946. return method
  41947. };
  41948. pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
  41949. method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
  41950. return this.finishNode(method, "MethodDefinition")
  41951. };
  41952. pp$1.parseClassId = function(node, isStatement) {
  41953. if (this.type === types.name) {
  41954. node.id = this.parseIdent();
  41955. if (isStatement)
  41956. { this.checkLValSimple(node.id, BIND_LEXICAL, false); }
  41957. } else {
  41958. if (isStatement === true)
  41959. { this.unexpected(); }
  41960. node.id = null;
  41961. }
  41962. };
  41963. pp$1.parseClassSuper = function(node) {
  41964. node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
  41965. };
  41966. // Parses module export declaration.
  41967. pp$1.parseExport = function(node, exports) {
  41968. this.next();
  41969. // export * from '...'
  41970. if (this.eat(types.star)) {
  41971. if (this.options.ecmaVersion >= 11) {
  41972. if (this.eatContextual("as")) {
  41973. node.exported = this.parseIdent(true);
  41974. this.checkExport(exports, node.exported.name, this.lastTokStart);
  41975. } else {
  41976. node.exported = null;
  41977. }
  41978. }
  41979. this.expectContextual("from");
  41980. if (this.type !== types.string) { this.unexpected(); }
  41981. node.source = this.parseExprAtom();
  41982. this.semicolon();
  41983. return this.finishNode(node, "ExportAllDeclaration")
  41984. }
  41985. if (this.eat(types._default)) { // export default ...
  41986. this.checkExport(exports, "default", this.lastTokStart);
  41987. var isAsync;
  41988. if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
  41989. var fNode = this.startNode();
  41990. this.next();
  41991. if (isAsync) { this.next(); }
  41992. node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
  41993. } else if (this.type === types._class) {
  41994. var cNode = this.startNode();
  41995. node.declaration = this.parseClass(cNode, "nullableID");
  41996. } else {
  41997. node.declaration = this.parseMaybeAssign();
  41998. this.semicolon();
  41999. }
  42000. return this.finishNode(node, "ExportDefaultDeclaration")
  42001. }
  42002. // export var|const|let|function|class ...
  42003. if (this.shouldParseExportStatement()) {
  42004. node.declaration = this.parseStatement(null);
  42005. if (node.declaration.type === "VariableDeclaration")
  42006. { this.checkVariableExport(exports, node.declaration.declarations); }
  42007. else
  42008. { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }
  42009. node.specifiers = [];
  42010. node.source = null;
  42011. } else { // export { x, y as z } [from '...']
  42012. node.declaration = null;
  42013. node.specifiers = this.parseExportSpecifiers(exports);
  42014. if (this.eatContextual("from")) {
  42015. if (this.type !== types.string) { this.unexpected(); }
  42016. node.source = this.parseExprAtom();
  42017. } else {
  42018. for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
  42019. // check for keywords used as local names
  42020. var spec = list[i];
  42021. this.checkUnreserved(spec.local);
  42022. // check if export is defined
  42023. this.checkLocalExport(spec.local);
  42024. }
  42025. node.source = null;
  42026. }
  42027. this.semicolon();
  42028. }
  42029. return this.finishNode(node, "ExportNamedDeclaration")
  42030. };
  42031. pp$1.checkExport = function(exports, name, pos) {
  42032. if (!exports) { return }
  42033. if (has(exports, name))
  42034. { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
  42035. exports[name] = true;
  42036. };
  42037. pp$1.checkPatternExport = function(exports, pat) {
  42038. var type = pat.type;
  42039. if (type === "Identifier")
  42040. { this.checkExport(exports, pat.name, pat.start); }
  42041. else if (type === "ObjectPattern")
  42042. { for (var i = 0, list = pat.properties; i < list.length; i += 1)
  42043. {
  42044. var prop = list[i];
  42045. this.checkPatternExport(exports, prop);
  42046. } }
  42047. else if (type === "ArrayPattern")
  42048. { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
  42049. var elt = list$1[i$1];
  42050. if (elt) { this.checkPatternExport(exports, elt); }
  42051. } }
  42052. else if (type === "Property")
  42053. { this.checkPatternExport(exports, pat.value); }
  42054. else if (type === "AssignmentPattern")
  42055. { this.checkPatternExport(exports, pat.left); }
  42056. else if (type === "RestElement")
  42057. { this.checkPatternExport(exports, pat.argument); }
  42058. else if (type === "ParenthesizedExpression")
  42059. { this.checkPatternExport(exports, pat.expression); }
  42060. };
  42061. pp$1.checkVariableExport = function(exports, decls) {
  42062. if (!exports) { return }
  42063. for (var i = 0, list = decls; i < list.length; i += 1)
  42064. {
  42065. var decl = list[i];
  42066. this.checkPatternExport(exports, decl.id);
  42067. }
  42068. };
  42069. pp$1.shouldParseExportStatement = function() {
  42070. return this.type.keyword === "var" ||
  42071. this.type.keyword === "const" ||
  42072. this.type.keyword === "class" ||
  42073. this.type.keyword === "function" ||
  42074. this.isLet() ||
  42075. this.isAsyncFunction()
  42076. };
  42077. // Parses a comma-separated list of module exports.
  42078. pp$1.parseExportSpecifiers = function(exports) {
  42079. var nodes = [], first = true;
  42080. // export { x, y as z } [from '...']
  42081. this.expect(types.braceL);
  42082. while (!this.eat(types.braceR)) {
  42083. if (!first) {
  42084. this.expect(types.comma);
  42085. if (this.afterTrailingComma(types.braceR)) { break }
  42086. } else { first = false; }
  42087. var node = this.startNode();
  42088. node.local = this.parseIdent(true);
  42089. node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
  42090. this.checkExport(exports, node.exported.name, node.exported.start);
  42091. nodes.push(this.finishNode(node, "ExportSpecifier"));
  42092. }
  42093. return nodes
  42094. };
  42095. // Parses import declaration.
  42096. pp$1.parseImport = function(node) {
  42097. this.next();
  42098. // import '...'
  42099. if (this.type === types.string) {
  42100. node.specifiers = empty;
  42101. node.source = this.parseExprAtom();
  42102. } else {
  42103. node.specifiers = this.parseImportSpecifiers();
  42104. this.expectContextual("from");
  42105. node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
  42106. }
  42107. this.semicolon();
  42108. return this.finishNode(node, "ImportDeclaration")
  42109. };
  42110. // Parses a comma-separated list of module imports.
  42111. pp$1.parseImportSpecifiers = function() {
  42112. var nodes = [], first = true;
  42113. if (this.type === types.name) {
  42114. // import defaultObj, { x, y as z } from '...'
  42115. var node = this.startNode();
  42116. node.local = this.parseIdent();
  42117. this.checkLValSimple(node.local, BIND_LEXICAL);
  42118. nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
  42119. if (!this.eat(types.comma)) { return nodes }
  42120. }
  42121. if (this.type === types.star) {
  42122. var node$1 = this.startNode();
  42123. this.next();
  42124. this.expectContextual("as");
  42125. node$1.local = this.parseIdent();
  42126. this.checkLValSimple(node$1.local, BIND_LEXICAL);
  42127. nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
  42128. return nodes
  42129. }
  42130. this.expect(types.braceL);
  42131. while (!this.eat(types.braceR)) {
  42132. if (!first) {
  42133. this.expect(types.comma);
  42134. if (this.afterTrailingComma(types.braceR)) { break }
  42135. } else { first = false; }
  42136. var node$2 = this.startNode();
  42137. node$2.imported = this.parseIdent(true);
  42138. if (this.eatContextual("as")) {
  42139. node$2.local = this.parseIdent();
  42140. } else {
  42141. this.checkUnreserved(node$2.imported);
  42142. node$2.local = node$2.imported;
  42143. }
  42144. this.checkLValSimple(node$2.local, BIND_LEXICAL);
  42145. nodes.push(this.finishNode(node$2, "ImportSpecifier"));
  42146. }
  42147. return nodes
  42148. };
  42149. // Set `ExpressionStatement#directive` property for directive prologues.
  42150. pp$1.adaptDirectivePrologue = function(statements) {
  42151. for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
  42152. statements[i].directive = statements[i].expression.raw.slice(1, -1);
  42153. }
  42154. };
  42155. pp$1.isDirectiveCandidate = function(statement) {
  42156. return (
  42157. statement.type === "ExpressionStatement" &&
  42158. statement.expression.type === "Literal" &&
  42159. typeof statement.expression.value === "string" &&
  42160. // Reject parenthesized strings.
  42161. (this.input[statement.start] === "\"" || this.input[statement.start] === "'")
  42162. )
  42163. };
  42164. var pp$2 = Parser.prototype;
  42165. // Convert existing expression atom to assignable pattern
  42166. // if possible.
  42167. pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
  42168. if (this.options.ecmaVersion >= 6 && node) {
  42169. switch (node.type) {
  42170. case "Identifier":
  42171. if (this.inAsync && node.name === "await")
  42172. { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); }
  42173. break
  42174. case "ObjectPattern":
  42175. case "ArrayPattern":
  42176. case "AssignmentPattern":
  42177. case "RestElement":
  42178. break
  42179. case "ObjectExpression":
  42180. node.type = "ObjectPattern";
  42181. if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
  42182. for (var i = 0, list = node.properties; i < list.length; i += 1) {
  42183. var prop = list[i];
  42184. this.toAssignable(prop, isBinding);
  42185. // Early error:
  42186. // AssignmentRestProperty[Yield, Await] :
  42187. // `...` DestructuringAssignmentTarget[Yield, Await]
  42188. //
  42189. // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
  42190. if (
  42191. prop.type === "RestElement" &&
  42192. (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
  42193. ) {
  42194. this.raise(prop.argument.start, "Unexpected token");
  42195. }
  42196. }
  42197. break
  42198. case "Property":
  42199. // AssignmentProperty has type === "Property"
  42200. if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
  42201. this.toAssignable(node.value, isBinding);
  42202. break
  42203. case "ArrayExpression":
  42204. node.type = "ArrayPattern";
  42205. if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
  42206. this.toAssignableList(node.elements, isBinding);
  42207. break
  42208. case "SpreadElement":
  42209. node.type = "RestElement";
  42210. this.toAssignable(node.argument, isBinding);
  42211. if (node.argument.type === "AssignmentPattern")
  42212. { this.raise(node.argument.start, "Rest elements cannot have a default value"); }
  42213. break
  42214. case "AssignmentExpression":
  42215. if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); }
  42216. node.type = "AssignmentPattern";
  42217. delete node.operator;
  42218. this.toAssignable(node.left, isBinding);
  42219. break
  42220. case "ParenthesizedExpression":
  42221. this.toAssignable(node.expression, isBinding, refDestructuringErrors);
  42222. break
  42223. case "ChainExpression":
  42224. this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
  42225. break
  42226. case "MemberExpression":
  42227. if (!isBinding) { break }
  42228. default:
  42229. this.raise(node.start, "Assigning to rvalue");
  42230. }
  42231. } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
  42232. return node
  42233. };
  42234. // Convert list of expression atoms to binding list.
  42235. pp$2.toAssignableList = function(exprList, isBinding) {
  42236. var end = exprList.length;
  42237. for (var i = 0; i < end; i++) {
  42238. var elt = exprList[i];
  42239. if (elt) { this.toAssignable(elt, isBinding); }
  42240. }
  42241. if (end) {
  42242. var last = exprList[end - 1];
  42243. if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
  42244. { this.unexpected(last.argument.start); }
  42245. }
  42246. return exprList
  42247. };
  42248. // Parses spread element.
  42249. pp$2.parseSpread = function(refDestructuringErrors) {
  42250. var node = this.startNode();
  42251. this.next();
  42252. node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
  42253. return this.finishNode(node, "SpreadElement")
  42254. };
  42255. pp$2.parseRestBinding = function() {
  42256. var node = this.startNode();
  42257. this.next();
  42258. // RestElement inside of a function parameter must be an identifier
  42259. if (this.options.ecmaVersion === 6 && this.type !== types.name)
  42260. { this.unexpected(); }
  42261. node.argument = this.parseBindingAtom();
  42262. return this.finishNode(node, "RestElement")
  42263. };
  42264. // Parses lvalue (assignable) atom.
  42265. pp$2.parseBindingAtom = function() {
  42266. if (this.options.ecmaVersion >= 6) {
  42267. switch (this.type) {
  42268. case types.bracketL:
  42269. var node = this.startNode();
  42270. this.next();
  42271. node.elements = this.parseBindingList(types.bracketR, true, true);
  42272. return this.finishNode(node, "ArrayPattern")
  42273. case types.braceL:
  42274. return this.parseObj(true)
  42275. }
  42276. }
  42277. return this.parseIdent()
  42278. };
  42279. pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
  42280. var elts = [], first = true;
  42281. while (!this.eat(close)) {
  42282. if (first) { first = false; }
  42283. else { this.expect(types.comma); }
  42284. if (allowEmpty && this.type === types.comma) {
  42285. elts.push(null);
  42286. } else if (allowTrailingComma && this.afterTrailingComma(close)) {
  42287. break
  42288. } else if (this.type === types.ellipsis) {
  42289. var rest = this.parseRestBinding();
  42290. this.parseBindingListItem(rest);
  42291. elts.push(rest);
  42292. if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
  42293. this.expect(close);
  42294. break
  42295. } else {
  42296. var elem = this.parseMaybeDefault(this.start, this.startLoc);
  42297. this.parseBindingListItem(elem);
  42298. elts.push(elem);
  42299. }
  42300. }
  42301. return elts
  42302. };
  42303. pp$2.parseBindingListItem = function(param) {
  42304. return param
  42305. };
  42306. // Parses assignment pattern around given atom if possible.
  42307. pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
  42308. left = left || this.parseBindingAtom();
  42309. if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
  42310. var node = this.startNodeAt(startPos, startLoc);
  42311. node.left = left;
  42312. node.right = this.parseMaybeAssign();
  42313. return this.finishNode(node, "AssignmentPattern")
  42314. };
  42315. // The following three functions all verify that a node is an lvalue —
  42316. // something that can be bound, or assigned to. In order to do so, they perform
  42317. // a variety of checks:
  42318. //
  42319. // - Check that none of the bound/assigned-to identifiers are reserved words.
  42320. // - Record name declarations for bindings in the appropriate scope.
  42321. // - Check duplicate argument names, if checkClashes is set.
  42322. //
  42323. // If a complex binding pattern is encountered (e.g., object and array
  42324. // destructuring), the entire pattern is recursively checked.
  42325. //
  42326. // There are three versions of checkLVal*() appropriate for different
  42327. // circumstances:
  42328. //
  42329. // - checkLValSimple() shall be used if the syntactic construct supports
  42330. // nothing other than identifiers and member expressions. Parenthesized
  42331. // expressions are also correctly handled. This is generally appropriate for
  42332. // constructs for which the spec says
  42333. //
  42334. // > It is a Syntax Error if AssignmentTargetType of [the production] is not
  42335. // > simple.
  42336. //
  42337. // It is also appropriate for checking if an identifier is valid and not
  42338. // defined elsewhere, like import declarations or function/class identifiers.
  42339. //
  42340. // Examples where this is used include:
  42341. // a += …;
  42342. // import a from '…';
  42343. // where a is the node to be checked.
  42344. //
  42345. // - checkLValPattern() shall be used if the syntactic construct supports
  42346. // anything checkLValSimple() supports, as well as object and array
  42347. // destructuring patterns. This is generally appropriate for constructs for
  42348. // which the spec says
  42349. //
  42350. // > It is a Syntax Error if [the production] is neither an ObjectLiteral nor
  42351. // > an ArrayLiteral and AssignmentTargetType of [the production] is not
  42352. // > simple.
  42353. //
  42354. // Examples where this is used include:
  42355. // (a = …);
  42356. // const a = …;
  42357. // try { … } catch (a) { … }
  42358. // where a is the node to be checked.
  42359. //
  42360. // - checkLValInnerPattern() shall be used if the syntactic construct supports
  42361. // anything checkLValPattern() supports, as well as default assignment
  42362. // patterns, rest elements, and other constructs that may appear within an
  42363. // object or array destructuring pattern.
  42364. //
  42365. // As a special case, function parameters also use checkLValInnerPattern(),
  42366. // as they also support defaults and rest constructs.
  42367. //
  42368. // These functions deliberately support both assignment and binding constructs,
  42369. // as the logic for both is exceedingly similar. If the node is the target of
  42370. // an assignment, then bindingType should be set to BIND_NONE. Otherwise, it
  42371. // should be set to the appropriate BIND_* constant, like BIND_VAR or
  42372. // BIND_LEXICAL.
  42373. //
  42374. // If the function is called with a non-BIND_NONE bindingType, then
  42375. // additionally a checkClashes object may be specified to allow checking for
  42376. // duplicate argument names. checkClashes is ignored if the provided construct
  42377. // is an assignment (i.e., bindingType is BIND_NONE).
  42378. pp$2.checkLValSimple = function(expr, bindingType, checkClashes) {
  42379. if ( bindingType === void 0 ) bindingType = BIND_NONE;
  42380. var isBind = bindingType !== BIND_NONE;
  42381. switch (expr.type) {
  42382. case "Identifier":
  42383. if (this.strict && this.reservedWordsStrictBind.test(expr.name))
  42384. { this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
  42385. if (isBind) {
  42386. if (bindingType === BIND_LEXICAL && expr.name === "let")
  42387. { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); }
  42388. if (checkClashes) {
  42389. if (has(checkClashes, expr.name))
  42390. { this.raiseRecoverable(expr.start, "Argument name clash"); }
  42391. checkClashes[expr.name] = true;
  42392. }
  42393. if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }
  42394. }
  42395. break
  42396. case "ChainExpression":
  42397. this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
  42398. break
  42399. case "MemberExpression":
  42400. if (isBind) { this.raiseRecoverable(expr.start, "Binding member expression"); }
  42401. break
  42402. case "ParenthesizedExpression":
  42403. if (isBind) { this.raiseRecoverable(expr.start, "Binding parenthesized expression"); }
  42404. return this.checkLValSimple(expr.expression, bindingType, checkClashes)
  42405. default:
  42406. this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
  42407. }
  42408. };
  42409. pp$2.checkLValPattern = function(expr, bindingType, checkClashes) {
  42410. if ( bindingType === void 0 ) bindingType = BIND_NONE;
  42411. switch (expr.type) {
  42412. case "ObjectPattern":
  42413. for (var i = 0, list = expr.properties; i < list.length; i += 1) {
  42414. var prop = list[i];
  42415. this.checkLValInnerPattern(prop, bindingType, checkClashes);
  42416. }
  42417. break
  42418. case "ArrayPattern":
  42419. for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
  42420. var elem = list$1[i$1];
  42421. if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); }
  42422. }
  42423. break
  42424. default:
  42425. this.checkLValSimple(expr, bindingType, checkClashes);
  42426. }
  42427. };
  42428. pp$2.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
  42429. if ( bindingType === void 0 ) bindingType = BIND_NONE;
  42430. switch (expr.type) {
  42431. case "Property":
  42432. // AssignmentProperty has type === "Property"
  42433. this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
  42434. break
  42435. case "AssignmentPattern":
  42436. this.checkLValPattern(expr.left, bindingType, checkClashes);
  42437. break
  42438. case "RestElement":
  42439. this.checkLValPattern(expr.argument, bindingType, checkClashes);
  42440. break
  42441. default:
  42442. this.checkLValPattern(expr, bindingType, checkClashes);
  42443. }
  42444. };
  42445. // A recursive descent parser operates by defining functions for all
  42446. var pp$3 = Parser.prototype;
  42447. // Check if property name clashes with already added.
  42448. // Object/class getters and setters are not allowed to clash —
  42449. // either with each other or with an init property — and in
  42450. // strict mode, init properties are also not allowed to be repeated.
  42451. pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
  42452. if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
  42453. { return }
  42454. if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
  42455. { return }
  42456. var key = prop.key;
  42457. var name;
  42458. switch (key.type) {
  42459. case "Identifier": name = key.name; break
  42460. case "Literal": name = String(key.value); break
  42461. default: return
  42462. }
  42463. var kind = prop.kind;
  42464. if (this.options.ecmaVersion >= 6) {
  42465. if (name === "__proto__" && kind === "init") {
  42466. if (propHash.proto) {
  42467. if (refDestructuringErrors) {
  42468. if (refDestructuringErrors.doubleProto < 0)
  42469. { refDestructuringErrors.doubleProto = key.start; }
  42470. // Backwards-compat kludge. Can be removed in version 6.0
  42471. } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); }
  42472. }
  42473. propHash.proto = true;
  42474. }
  42475. return
  42476. }
  42477. name = "$" + name;
  42478. var other = propHash[name];
  42479. if (other) {
  42480. var redefinition;
  42481. if (kind === "init") {
  42482. redefinition = this.strict && other.init || other.get || other.set;
  42483. } else {
  42484. redefinition = other.init || other[kind];
  42485. }
  42486. if (redefinition)
  42487. { this.raiseRecoverable(key.start, "Redefinition of property"); }
  42488. } else {
  42489. other = propHash[name] = {
  42490. init: false,
  42491. get: false,
  42492. set: false
  42493. };
  42494. }
  42495. other[kind] = true;
  42496. };
  42497. // ### Expression parsing
  42498. // These nest, from the most general expression type at the top to
  42499. // 'atomic', nondivisible expression types at the bottom. Most of
  42500. // the functions will simply let the function(s) below them parse,
  42501. // and, *if* the syntactic construct they handle is present, wrap
  42502. // the AST node that the inner parser gave them in another node.
  42503. // Parse a full expression. The optional arguments are used to
  42504. // forbid the `in` operator (in for loops initalization expressions)
  42505. // and provide reference for storing '=' operator inside shorthand
  42506. // property assignment in contexts where both object expression
  42507. // and object pattern might appear (so it's possible to raise
  42508. // delayed syntax error at correct position).
  42509. pp$3.parseExpression = function(noIn, refDestructuringErrors) {
  42510. var startPos = this.start, startLoc = this.startLoc;
  42511. var expr = this.parseMaybeAssign(noIn, refDestructuringErrors);
  42512. if (this.type === types.comma) {
  42513. var node = this.startNodeAt(startPos, startLoc);
  42514. node.expressions = [expr];
  42515. while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); }
  42516. return this.finishNode(node, "SequenceExpression")
  42517. }
  42518. return expr
  42519. };
  42520. // Parse an assignment expression. This includes applications of
  42521. // operators like `+=`.
  42522. pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
  42523. if (this.isContextual("yield")) {
  42524. if (this.inGenerator) { return this.parseYield(noIn) }
  42525. // The tokenizer will assume an expression is allowed after
  42526. // `yield`, but this isn't that kind of yield
  42527. else { this.exprAllowed = false; }
  42528. }
  42529. var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
  42530. if (refDestructuringErrors) {
  42531. oldParenAssign = refDestructuringErrors.parenthesizedAssign;
  42532. oldTrailingComma = refDestructuringErrors.trailingComma;
  42533. refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
  42534. } else {
  42535. refDestructuringErrors = new DestructuringErrors;
  42536. ownDestructuringErrors = true;
  42537. }
  42538. var startPos = this.start, startLoc = this.startLoc;
  42539. if (this.type === types.parenL || this.type === types.name)
  42540. { this.potentialArrowAt = this.start; }
  42541. var left = this.parseMaybeConditional(noIn, refDestructuringErrors);
  42542. if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
  42543. if (this.type.isAssign) {
  42544. var node = this.startNodeAt(startPos, startLoc);
  42545. node.operator = this.value;
  42546. if (this.type === types.eq)
  42547. { left = this.toAssignable(left, false, refDestructuringErrors); }
  42548. if (!ownDestructuringErrors) {
  42549. refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
  42550. }
  42551. if (refDestructuringErrors.shorthandAssign >= left.start)
  42552. { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
  42553. if (this.type === types.eq)
  42554. { this.checkLValPattern(left); }
  42555. else
  42556. { this.checkLValSimple(left); }
  42557. node.left = left;
  42558. this.next();
  42559. node.right = this.parseMaybeAssign(noIn);
  42560. return this.finishNode(node, "AssignmentExpression")
  42561. } else {
  42562. if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
  42563. }
  42564. if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }
  42565. if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }
  42566. return left
  42567. };
  42568. // Parse a ternary conditional (`?:`) operator.
  42569. pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
  42570. var startPos = this.start, startLoc = this.startLoc;
  42571. var expr = this.parseExprOps(noIn, refDestructuringErrors);
  42572. if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
  42573. if (this.eat(types.question)) {
  42574. var node = this.startNodeAt(startPos, startLoc);
  42575. node.test = expr;
  42576. node.consequent = this.parseMaybeAssign();
  42577. this.expect(types.colon);
  42578. node.alternate = this.parseMaybeAssign(noIn);
  42579. return this.finishNode(node, "ConditionalExpression")
  42580. }
  42581. return expr
  42582. };
  42583. // Start the precedence parser.
  42584. pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
  42585. var startPos = this.start, startLoc = this.startLoc;
  42586. var expr = this.parseMaybeUnary(refDestructuringErrors, false);
  42587. if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
  42588. return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)
  42589. };
  42590. // Parse binary operators with the operator precedence parsing
  42591. // algorithm. `left` is the left-hand side of the operator.
  42592. // `minPrec` provides context that allows the function to stop and
  42593. // defer further parser to one of its callers when it encounters an
  42594. // operator that has a lower precedence than the set it is parsing.
  42595. pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
  42596. var prec = this.type.binop;
  42597. if (prec != null && (!noIn || this.type !== types._in)) {
  42598. if (prec > minPrec) {
  42599. var logical = this.type === types.logicalOR || this.type === types.logicalAND;
  42600. var coalesce = this.type === types.coalesce;
  42601. if (coalesce) {
  42602. // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
  42603. // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
  42604. prec = types.logicalAND.binop;
  42605. }
  42606. var op = this.value;
  42607. this.next();
  42608. var startPos = this.start, startLoc = this.startLoc;
  42609. var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
  42610. var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
  42611. if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
  42612. this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
  42613. }
  42614. return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
  42615. }
  42616. }
  42617. return left
  42618. };
  42619. pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
  42620. var node = this.startNodeAt(startPos, startLoc);
  42621. node.left = left;
  42622. node.operator = op;
  42623. node.right = right;
  42624. return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
  42625. };
  42626. // Parse unary operators, both prefix and postfix.
  42627. pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
  42628. var startPos = this.start, startLoc = this.startLoc, expr;
  42629. if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
  42630. expr = this.parseAwait();
  42631. sawUnary = true;
  42632. } else if (this.type.prefix) {
  42633. var node = this.startNode(), update = this.type === types.incDec;
  42634. node.operator = this.value;
  42635. node.prefix = true;
  42636. this.next();
  42637. node.argument = this.parseMaybeUnary(null, true);
  42638. this.checkExpressionErrors(refDestructuringErrors, true);
  42639. if (update) { this.checkLValSimple(node.argument); }
  42640. else if (this.strict && node.operator === "delete" &&
  42641. node.argument.type === "Identifier")
  42642. { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
  42643. else { sawUnary = true; }
  42644. expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
  42645. } else {
  42646. expr = this.parseExprSubscripts(refDestructuringErrors);
  42647. if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
  42648. while (this.type.postfix && !this.canInsertSemicolon()) {
  42649. var node$1 = this.startNodeAt(startPos, startLoc);
  42650. node$1.operator = this.value;
  42651. node$1.prefix = false;
  42652. node$1.argument = expr;
  42653. this.checkLValSimple(expr);
  42654. this.next();
  42655. expr = this.finishNode(node$1, "UpdateExpression");
  42656. }
  42657. }
  42658. if (!sawUnary && this.eat(types.starstar))
  42659. { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
  42660. else
  42661. { return expr }
  42662. };
  42663. // Parse call, dot, and `[]`-subscript expressions.
  42664. pp$3.parseExprSubscripts = function(refDestructuringErrors) {
  42665. var startPos = this.start, startLoc = this.startLoc;
  42666. var expr = this.parseExprAtom(refDestructuringErrors);
  42667. if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
  42668. { return expr }
  42669. var result = this.parseSubscripts(expr, startPos, startLoc);
  42670. if (refDestructuringErrors && result.type === "MemberExpression") {
  42671. if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
  42672. if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
  42673. }
  42674. return result
  42675. };
  42676. pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
  42677. var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
  42678. this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
  42679. this.potentialArrowAt === base.start;
  42680. var optionalChained = false;
  42681. while (true) {
  42682. var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained);
  42683. if (element.optional) { optionalChained = true; }
  42684. if (element === base || element.type === "ArrowFunctionExpression") {
  42685. if (optionalChained) {
  42686. var chainNode = this.startNodeAt(startPos, startLoc);
  42687. chainNode.expression = element;
  42688. element = this.finishNode(chainNode, "ChainExpression");
  42689. }
  42690. return element
  42691. }
  42692. base = element;
  42693. }
  42694. };
  42695. pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained) {
  42696. var optionalSupported = this.options.ecmaVersion >= 11;
  42697. var optional = optionalSupported && this.eat(types.questionDot);
  42698. if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
  42699. var computed = this.eat(types.bracketL);
  42700. if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
  42701. var node = this.startNodeAt(startPos, startLoc);
  42702. node.object = base;
  42703. node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never");
  42704. node.computed = !!computed;
  42705. if (computed) { this.expect(types.bracketR); }
  42706. if (optionalSupported) {
  42707. node.optional = optional;
  42708. }
  42709. base = this.finishNode(node, "MemberExpression");
  42710. } else if (!noCalls && this.eat(types.parenL)) {
  42711. var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
  42712. this.yieldPos = 0;
  42713. this.awaitPos = 0;
  42714. this.awaitIdentPos = 0;
  42715. var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
  42716. if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
  42717. this.checkPatternErrors(refDestructuringErrors, false);
  42718. this.checkYieldAwaitInDefaultParams();
  42719. if (this.awaitIdentPos > 0)
  42720. { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
  42721. this.yieldPos = oldYieldPos;
  42722. this.awaitPos = oldAwaitPos;
  42723. this.awaitIdentPos = oldAwaitIdentPos;
  42724. return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
  42725. }
  42726. this.checkExpressionErrors(refDestructuringErrors, true);
  42727. this.yieldPos = oldYieldPos || this.yieldPos;
  42728. this.awaitPos = oldAwaitPos || this.awaitPos;
  42729. this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
  42730. var node$1 = this.startNodeAt(startPos, startLoc);
  42731. node$1.callee = base;
  42732. node$1.arguments = exprList;
  42733. if (optionalSupported) {
  42734. node$1.optional = optional;
  42735. }
  42736. base = this.finishNode(node$1, "CallExpression");
  42737. } else if (this.type === types.backQuote) {
  42738. if (optional || optionalChained) {
  42739. this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
  42740. }
  42741. var node$2 = this.startNodeAt(startPos, startLoc);
  42742. node$2.tag = base;
  42743. node$2.quasi = this.parseTemplate({isTagged: true});
  42744. base = this.finishNode(node$2, "TaggedTemplateExpression");
  42745. }
  42746. return base
  42747. };
  42748. // Parse an atomic expression — either a single token that is an
  42749. // expression, an expression started by a keyword like `function` or
  42750. // `new`, or an expression wrapped in punctuation like `()`, `[]`,
  42751. // or `{}`.
  42752. pp$3.parseExprAtom = function(refDestructuringErrors) {
  42753. // If a division operator appears in an expression position, the
  42754. // tokenizer got confused, and we force it to read a regexp instead.
  42755. if (this.type === types.slash) { this.readRegexp(); }
  42756. var node, canBeArrow = this.potentialArrowAt === this.start;
  42757. switch (this.type) {
  42758. case types._super:
  42759. if (!this.allowSuper)
  42760. { this.raise(this.start, "'super' keyword outside a method"); }
  42761. node = this.startNode();
  42762. this.next();
  42763. if (this.type === types.parenL && !this.allowDirectSuper)
  42764. { this.raise(node.start, "super() call outside constructor of a subclass"); }
  42765. // The `super` keyword can appear at below:
  42766. // SuperProperty:
  42767. // super [ Expression ]
  42768. // super . IdentifierName
  42769. // SuperCall:
  42770. // super ( Arguments )
  42771. if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
  42772. { this.unexpected(); }
  42773. return this.finishNode(node, "Super")
  42774. case types._this:
  42775. node = this.startNode();
  42776. this.next();
  42777. return this.finishNode(node, "ThisExpression")
  42778. case types.name:
  42779. var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
  42780. var id = this.parseIdent(false);
  42781. if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function))
  42782. { return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true) }
  42783. if (canBeArrow && !this.canInsertSemicolon()) {
  42784. if (this.eat(types.arrow))
  42785. { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
  42786. if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc) {
  42787. id = this.parseIdent(false);
  42788. if (this.canInsertSemicolon() || !this.eat(types.arrow))
  42789. { this.unexpected(); }
  42790. return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)
  42791. }
  42792. }
  42793. return id
  42794. case types.regexp:
  42795. var value = this.value;
  42796. node = this.parseLiteral(value.value);
  42797. node.regex = {pattern: value.pattern, flags: value.flags};
  42798. return node
  42799. case types.num: case types.string:
  42800. return this.parseLiteral(this.value)
  42801. case types._null: case types._true: case types._false:
  42802. node = this.startNode();
  42803. node.value = this.type === types._null ? null : this.type === types._true;
  42804. node.raw = this.type.keyword;
  42805. this.next();
  42806. return this.finishNode(node, "Literal")
  42807. case types.parenL:
  42808. var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow);
  42809. if (refDestructuringErrors) {
  42810. if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
  42811. { refDestructuringErrors.parenthesizedAssign = start; }
  42812. if (refDestructuringErrors.parenthesizedBind < 0)
  42813. { refDestructuringErrors.parenthesizedBind = start; }
  42814. }
  42815. return expr
  42816. case types.bracketL:
  42817. node = this.startNode();
  42818. this.next();
  42819. node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
  42820. return this.finishNode(node, "ArrayExpression")
  42821. case types.braceL:
  42822. return this.parseObj(false, refDestructuringErrors)
  42823. case types._function:
  42824. node = this.startNode();
  42825. this.next();
  42826. return this.parseFunction(node, 0)
  42827. case types._class:
  42828. return this.parseClass(this.startNode(), false)
  42829. case types._new:
  42830. return this.parseNew()
  42831. case types.backQuote:
  42832. return this.parseTemplate()
  42833. case types._import:
  42834. if (this.options.ecmaVersion >= 11) {
  42835. return this.parseExprImport()
  42836. } else {
  42837. return this.unexpected()
  42838. }
  42839. default:
  42840. this.unexpected();
  42841. }
  42842. };
  42843. pp$3.parseExprImport = function() {
  42844. var node = this.startNode();
  42845. // Consume `import` as an identifier for `import.meta`.
  42846. // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
  42847. if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
  42848. var meta = this.parseIdent(true);
  42849. switch (this.type) {
  42850. case types.parenL:
  42851. return this.parseDynamicImport(node)
  42852. case types.dot:
  42853. node.meta = meta;
  42854. return this.parseImportMeta(node)
  42855. default:
  42856. this.unexpected();
  42857. }
  42858. };
  42859. pp$3.parseDynamicImport = function(node) {
  42860. this.next(); // skip `(`
  42861. // Parse node.source.
  42862. node.source = this.parseMaybeAssign();
  42863. // Verify ending.
  42864. if (!this.eat(types.parenR)) {
  42865. var errorPos = this.start;
  42866. if (this.eat(types.comma) && this.eat(types.parenR)) {
  42867. this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
  42868. } else {
  42869. this.unexpected(errorPos);
  42870. }
  42871. }
  42872. return this.finishNode(node, "ImportExpression")
  42873. };
  42874. pp$3.parseImportMeta = function(node) {
  42875. this.next(); // skip `.`
  42876. var containsEsc = this.containsEsc;
  42877. node.property = this.parseIdent(true);
  42878. if (node.property.name !== "meta")
  42879. { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
  42880. if (containsEsc)
  42881. { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
  42882. if (this.options.sourceType !== "module")
  42883. { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
  42884. return this.finishNode(node, "MetaProperty")
  42885. };
  42886. pp$3.parseLiteral = function(value) {
  42887. var node = this.startNode();
  42888. node.value = value;
  42889. node.raw = this.input.slice(this.start, this.end);
  42890. if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); }
  42891. this.next();
  42892. return this.finishNode(node, "Literal")
  42893. };
  42894. pp$3.parseParenExpression = function() {
  42895. this.expect(types.parenL);
  42896. var val = this.parseExpression();
  42897. this.expect(types.parenR);
  42898. return val
  42899. };
  42900. pp$3.parseParenAndDistinguishExpression = function(canBeArrow) {
  42901. var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
  42902. if (this.options.ecmaVersion >= 6) {
  42903. this.next();
  42904. var innerStartPos = this.start, innerStartLoc = this.startLoc;
  42905. var exprList = [], first = true, lastIsComma = false;
  42906. var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
  42907. this.yieldPos = 0;
  42908. this.awaitPos = 0;
  42909. // Do not save awaitIdentPos to allow checking awaits nested in parameters
  42910. while (this.type !== types.parenR) {
  42911. first ? first = false : this.expect(types.comma);
  42912. if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
  42913. lastIsComma = true;
  42914. break
  42915. } else if (this.type === types.ellipsis) {
  42916. spreadStart = this.start;
  42917. exprList.push(this.parseParenItem(this.parseRestBinding()));
  42918. if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
  42919. break
  42920. } else {
  42921. exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
  42922. }
  42923. }
  42924. var innerEndPos = this.start, innerEndLoc = this.startLoc;
  42925. this.expect(types.parenR);
  42926. if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
  42927. this.checkPatternErrors(refDestructuringErrors, false);
  42928. this.checkYieldAwaitInDefaultParams();
  42929. this.yieldPos = oldYieldPos;
  42930. this.awaitPos = oldAwaitPos;
  42931. return this.parseParenArrowList(startPos, startLoc, exprList)
  42932. }
  42933. if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
  42934. if (spreadStart) { this.unexpected(spreadStart); }
  42935. this.checkExpressionErrors(refDestructuringErrors, true);
  42936. this.yieldPos = oldYieldPos || this.yieldPos;
  42937. this.awaitPos = oldAwaitPos || this.awaitPos;
  42938. if (exprList.length > 1) {
  42939. val = this.startNodeAt(innerStartPos, innerStartLoc);
  42940. val.expressions = exprList;
  42941. this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
  42942. } else {
  42943. val = exprList[0];
  42944. }
  42945. } else {
  42946. val = this.parseParenExpression();
  42947. }
  42948. if (this.options.preserveParens) {
  42949. var par = this.startNodeAt(startPos, startLoc);
  42950. par.expression = val;
  42951. return this.finishNode(par, "ParenthesizedExpression")
  42952. } else {
  42953. return val
  42954. }
  42955. };
  42956. pp$3.parseParenItem = function(item) {
  42957. return item
  42958. };
  42959. pp$3.parseParenArrowList = function(startPos, startLoc, exprList) {
  42960. return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
  42961. };
  42962. // New's precedence is slightly tricky. It must allow its argument to
  42963. // be a `[]` or dot subscript expression, but not a call — at least,
  42964. // not without wrapping it in parentheses. Thus, it uses the noCalls
  42965. // argument to parseSubscripts to prevent it from consuming the
  42966. // argument list.
  42967. var empty$1 = [];
  42968. pp$3.parseNew = function() {
  42969. if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
  42970. var node = this.startNode();
  42971. var meta = this.parseIdent(true);
  42972. if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
  42973. node.meta = meta;
  42974. var containsEsc = this.containsEsc;
  42975. node.property = this.parseIdent(true);
  42976. if (node.property.name !== "target")
  42977. { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
  42978. if (containsEsc)
  42979. { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
  42980. if (!this.inNonArrowFunction)
  42981. { this.raiseRecoverable(node.start, "'new.target' can only be used in functions"); }
  42982. return this.finishNode(node, "MetaProperty")
  42983. }
  42984. var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
  42985. node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
  42986. if (isImport && node.callee.type === "ImportExpression") {
  42987. this.raise(startPos, "Cannot use new with import()");
  42988. }
  42989. if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
  42990. else { node.arguments = empty$1; }
  42991. return this.finishNode(node, "NewExpression")
  42992. };
  42993. // Parse template expression.
  42994. pp$3.parseTemplateElement = function(ref) {
  42995. var isTagged = ref.isTagged;
  42996. var elem = this.startNode();
  42997. if (this.type === types.invalidTemplate) {
  42998. if (!isTagged) {
  42999. this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
  43000. }
  43001. elem.value = {
  43002. raw: this.value,
  43003. cooked: null
  43004. };
  43005. } else {
  43006. elem.value = {
  43007. raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
  43008. cooked: this.value
  43009. };
  43010. }
  43011. this.next();
  43012. elem.tail = this.type === types.backQuote;
  43013. return this.finishNode(elem, "TemplateElement")
  43014. };
  43015. pp$3.parseTemplate = function(ref) {
  43016. if ( ref === void 0 ) ref = {};
  43017. var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
  43018. var node = this.startNode();
  43019. this.next();
  43020. node.expressions = [];
  43021. var curElt = this.parseTemplateElement({isTagged: isTagged});
  43022. node.quasis = [curElt];
  43023. while (!curElt.tail) {
  43024. if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
  43025. this.expect(types.dollarBraceL);
  43026. node.expressions.push(this.parseExpression());
  43027. this.expect(types.braceR);
  43028. node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
  43029. }
  43030. this.next();
  43031. return this.finishNode(node, "TemplateLiteral")
  43032. };
  43033. pp$3.isAsyncProp = function(prop) {
  43034. return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
  43035. (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
  43036. !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
  43037. };
  43038. // Parse an object literal or binding pattern.
  43039. pp$3.parseObj = function(isPattern, refDestructuringErrors) {
  43040. var node = this.startNode(), first = true, propHash = {};
  43041. node.properties = [];
  43042. this.next();
  43043. while (!this.eat(types.braceR)) {
  43044. if (!first) {
  43045. this.expect(types.comma);
  43046. if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
  43047. } else { first = false; }
  43048. var prop = this.parseProperty(isPattern, refDestructuringErrors);
  43049. if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }
  43050. node.properties.push(prop);
  43051. }
  43052. return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
  43053. };
  43054. pp$3.parseProperty = function(isPattern, refDestructuringErrors) {
  43055. var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
  43056. if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
  43057. if (isPattern) {
  43058. prop.argument = this.parseIdent(false);
  43059. if (this.type === types.comma) {
  43060. this.raise(this.start, "Comma is not permitted after the rest element");
  43061. }
  43062. return this.finishNode(prop, "RestElement")
  43063. }
  43064. // To disallow parenthesized identifier via `this.toAssignable()`.
  43065. if (this.type === types.parenL && refDestructuringErrors) {
  43066. if (refDestructuringErrors.parenthesizedAssign < 0) {
  43067. refDestructuringErrors.parenthesizedAssign = this.start;
  43068. }
  43069. if (refDestructuringErrors.parenthesizedBind < 0) {
  43070. refDestructuringErrors.parenthesizedBind = this.start;
  43071. }
  43072. }
  43073. // Parse argument.
  43074. prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
  43075. // To disallow trailing comma via `this.toAssignable()`.
  43076. if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
  43077. refDestructuringErrors.trailingComma = this.start;
  43078. }
  43079. // Finish
  43080. return this.finishNode(prop, "SpreadElement")
  43081. }
  43082. if (this.options.ecmaVersion >= 6) {
  43083. prop.method = false;
  43084. prop.shorthand = false;
  43085. if (isPattern || refDestructuringErrors) {
  43086. startPos = this.start;
  43087. startLoc = this.startLoc;
  43088. }
  43089. if (!isPattern)
  43090. { isGenerator = this.eat(types.star); }
  43091. }
  43092. var containsEsc = this.containsEsc;
  43093. this.parsePropertyName(prop);
  43094. if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
  43095. isAsync = true;
  43096. isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
  43097. this.parsePropertyName(prop, refDestructuringErrors);
  43098. } else {
  43099. isAsync = false;
  43100. }
  43101. this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
  43102. return this.finishNode(prop, "Property")
  43103. };
  43104. pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
  43105. if ((isGenerator || isAsync) && this.type === types.colon)
  43106. { this.unexpected(); }
  43107. if (this.eat(types.colon)) {
  43108. prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
  43109. prop.kind = "init";
  43110. } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
  43111. if (isPattern) { this.unexpected(); }
  43112. prop.kind = "init";
  43113. prop.method = true;
  43114. prop.value = this.parseMethod(isGenerator, isAsync);
  43115. } else if (!isPattern && !containsEsc &&
  43116. this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
  43117. (prop.key.name === "get" || prop.key.name === "set") &&
  43118. (this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
  43119. if (isGenerator || isAsync) { this.unexpected(); }
  43120. prop.kind = prop.key.name;
  43121. this.parsePropertyName(prop);
  43122. prop.value = this.parseMethod(false);
  43123. var paramCount = prop.kind === "get" ? 0 : 1;
  43124. if (prop.value.params.length !== paramCount) {
  43125. var start = prop.value.start;
  43126. if (prop.kind === "get")
  43127. { this.raiseRecoverable(start, "getter should have no params"); }
  43128. else
  43129. { this.raiseRecoverable(start, "setter should have exactly one param"); }
  43130. } else {
  43131. if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
  43132. { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
  43133. }
  43134. } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
  43135. if (isGenerator || isAsync) { this.unexpected(); }
  43136. this.checkUnreserved(prop.key);
  43137. if (prop.key.name === "await" && !this.awaitIdentPos)
  43138. { this.awaitIdentPos = startPos; }
  43139. prop.kind = "init";
  43140. if (isPattern) {
  43141. prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
  43142. } else if (this.type === types.eq && refDestructuringErrors) {
  43143. if (refDestructuringErrors.shorthandAssign < 0)
  43144. { refDestructuringErrors.shorthandAssign = this.start; }
  43145. prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
  43146. } else {
  43147. prop.value = this.copyNode(prop.key);
  43148. }
  43149. prop.shorthand = true;
  43150. } else { this.unexpected(); }
  43151. };
  43152. pp$3.parsePropertyName = function(prop) {
  43153. if (this.options.ecmaVersion >= 6) {
  43154. if (this.eat(types.bracketL)) {
  43155. prop.computed = true;
  43156. prop.key = this.parseMaybeAssign();
  43157. this.expect(types.bracketR);
  43158. return prop.key
  43159. } else {
  43160. prop.computed = false;
  43161. }
  43162. }
  43163. return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
  43164. };
  43165. // Initialize empty function node.
  43166. pp$3.initFunction = function(node) {
  43167. node.id = null;
  43168. if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
  43169. if (this.options.ecmaVersion >= 8) { node.async = false; }
  43170. };
  43171. // Parse object or class method.
  43172. pp$3.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
  43173. var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
  43174. this.initFunction(node);
  43175. if (this.options.ecmaVersion >= 6)
  43176. { node.generator = isGenerator; }
  43177. if (this.options.ecmaVersion >= 8)
  43178. { node.async = !!isAsync; }
  43179. this.yieldPos = 0;
  43180. this.awaitPos = 0;
  43181. this.awaitIdentPos = 0;
  43182. this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
  43183. this.expect(types.parenL);
  43184. node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
  43185. this.checkYieldAwaitInDefaultParams();
  43186. this.parseFunctionBody(node, false, true);
  43187. this.yieldPos = oldYieldPos;
  43188. this.awaitPos = oldAwaitPos;
  43189. this.awaitIdentPos = oldAwaitIdentPos;
  43190. return this.finishNode(node, "FunctionExpression")
  43191. };
  43192. // Parse arrow function expression with given parameters.
  43193. pp$3.parseArrowExpression = function(node, params, isAsync) {
  43194. var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
  43195. this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
  43196. this.initFunction(node);
  43197. if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }
  43198. this.yieldPos = 0;
  43199. this.awaitPos = 0;
  43200. this.awaitIdentPos = 0;
  43201. node.params = this.toAssignableList(params, true);
  43202. this.parseFunctionBody(node, true, false);
  43203. this.yieldPos = oldYieldPos;
  43204. this.awaitPos = oldAwaitPos;
  43205. this.awaitIdentPos = oldAwaitIdentPos;
  43206. return this.finishNode(node, "ArrowFunctionExpression")
  43207. };
  43208. // Parse function body and check parameters.
  43209. pp$3.parseFunctionBody = function(node, isArrowFunction, isMethod) {
  43210. var isExpression = isArrowFunction && this.type !== types.braceL;
  43211. var oldStrict = this.strict, useStrict = false;
  43212. if (isExpression) {
  43213. node.body = this.parseMaybeAssign();
  43214. node.expression = true;
  43215. this.checkParams(node, false);
  43216. } else {
  43217. var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
  43218. if (!oldStrict || nonSimple) {
  43219. useStrict = this.strictDirective(this.end);
  43220. // If this is a strict mode function, verify that argument names
  43221. // are not repeated, and it does not try to bind the words `eval`
  43222. // or `arguments`.
  43223. if (useStrict && nonSimple)
  43224. { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); }
  43225. }
  43226. // Start a new scope with regard to labels and the `inFunction`
  43227. // flag (restore them to their old value afterwards).
  43228. var oldLabels = this.labels;
  43229. this.labels = [];
  43230. if (useStrict) { this.strict = true; }
  43231. // Add the params to varDeclaredNames to ensure that an error is thrown
  43232. // if a let/const declaration in the function clashes with one of the params.
  43233. this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
  43234. // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
  43235. if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); }
  43236. node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
  43237. node.expression = false;
  43238. this.adaptDirectivePrologue(node.body.body);
  43239. this.labels = oldLabels;
  43240. }
  43241. this.exitScope();
  43242. };
  43243. pp$3.isSimpleParamList = function(params) {
  43244. for (var i = 0, list = params; i < list.length; i += 1)
  43245. {
  43246. var param = list[i];
  43247. if (param.type !== "Identifier") { return false
  43248. } }
  43249. return true
  43250. };
  43251. // Checks function params for various disallowed patterns such as using "eval"
  43252. // or "arguments" and duplicate parameters.
  43253. pp$3.checkParams = function(node, allowDuplicates) {
  43254. var nameHash = Object.create(null);
  43255. for (var i = 0, list = node.params; i < list.length; i += 1)
  43256. {
  43257. var param = list[i];
  43258. this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
  43259. }
  43260. };
  43261. // Parses a comma-separated list of expressions, and returns them as
  43262. // an array. `close` is the token type that ends the list, and
  43263. // `allowEmpty` can be turned on to allow subsequent commas with
  43264. // nothing in between them to be parsed as `null` (which is needed
  43265. // for array literals).
  43266. pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
  43267. var elts = [], first = true;
  43268. while (!this.eat(close)) {
  43269. if (!first) {
  43270. this.expect(types.comma);
  43271. if (allowTrailingComma && this.afterTrailingComma(close)) { break }
  43272. } else { first = false; }
  43273. var elt = (void 0);
  43274. if (allowEmpty && this.type === types.comma)
  43275. { elt = null; }
  43276. else if (this.type === types.ellipsis) {
  43277. elt = this.parseSpread(refDestructuringErrors);
  43278. if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
  43279. { refDestructuringErrors.trailingComma = this.start; }
  43280. } else {
  43281. elt = this.parseMaybeAssign(false, refDestructuringErrors);
  43282. }
  43283. elts.push(elt);
  43284. }
  43285. return elts
  43286. };
  43287. pp$3.checkUnreserved = function(ref) {
  43288. var start = ref.start;
  43289. var end = ref.end;
  43290. var name = ref.name;
  43291. if (this.inGenerator && name === "yield")
  43292. { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
  43293. if (this.inAsync && name === "await")
  43294. { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
  43295. if (this.keywords.test(name))
  43296. { this.raise(start, ("Unexpected keyword '" + name + "'")); }
  43297. if (this.options.ecmaVersion < 6 &&
  43298. this.input.slice(start, end).indexOf("\\") !== -1) { return }
  43299. var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
  43300. if (re.test(name)) {
  43301. if (!this.inAsync && name === "await")
  43302. { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); }
  43303. this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved"));
  43304. }
  43305. };
  43306. // Parse the next token as an identifier. If `liberal` is true (used
  43307. // when parsing properties), it will also convert keywords into
  43308. // identifiers.
  43309. pp$3.parseIdent = function(liberal, isBinding) {
  43310. var node = this.startNode();
  43311. if (this.type === types.name) {
  43312. node.name = this.value;
  43313. } else if (this.type.keyword) {
  43314. node.name = this.type.keyword;
  43315. // To fix https://github.com/acornjs/acorn/issues/575
  43316. // `class` and `function` keywords push new context into this.context.
  43317. // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
  43318. // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
  43319. if ((node.name === "class" || node.name === "function") &&
  43320. (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
  43321. this.context.pop();
  43322. }
  43323. } else {
  43324. this.unexpected();
  43325. }
  43326. this.next(!!liberal);
  43327. this.finishNode(node, "Identifier");
  43328. if (!liberal) {
  43329. this.checkUnreserved(node);
  43330. if (node.name === "await" && !this.awaitIdentPos)
  43331. { this.awaitIdentPos = node.start; }
  43332. }
  43333. return node
  43334. };
  43335. // Parses yield expression inside generator.
  43336. pp$3.parseYield = function(noIn) {
  43337. if (!this.yieldPos) { this.yieldPos = this.start; }
  43338. var node = this.startNode();
  43339. this.next();
  43340. if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
  43341. node.delegate = false;
  43342. node.argument = null;
  43343. } else {
  43344. node.delegate = this.eat(types.star);
  43345. node.argument = this.parseMaybeAssign(noIn);
  43346. }
  43347. return this.finishNode(node, "YieldExpression")
  43348. };
  43349. pp$3.parseAwait = function() {
  43350. if (!this.awaitPos) { this.awaitPos = this.start; }
  43351. var node = this.startNode();
  43352. this.next();
  43353. node.argument = this.parseMaybeUnary(null, true);
  43354. return this.finishNode(node, "AwaitExpression")
  43355. };
  43356. var pp$4 = Parser.prototype;
  43357. // This function is used to raise exceptions on parse errors. It
  43358. // takes an offset integer (into the current `input`) to indicate
  43359. // the location of the error, attaches the position to the end
  43360. // of the error message, and then raises a `SyntaxError` with that
  43361. // message.
  43362. pp$4.raise = function(pos, message) {
  43363. var loc = getLineInfo(this.input, pos);
  43364. message += " (" + loc.line + ":" + loc.column + ")";
  43365. var err = new SyntaxError(message);
  43366. err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
  43367. throw err
  43368. };
  43369. pp$4.raiseRecoverable = pp$4.raise;
  43370. pp$4.curPosition = function() {
  43371. if (this.options.locations) {
  43372. return new Position(this.curLine, this.pos - this.lineStart)
  43373. }
  43374. };
  43375. var pp$5 = Parser.prototype;
  43376. var Scope = function Scope(flags) {
  43377. this.flags = flags;
  43378. // A list of var-declared names in the current lexical scope
  43379. this.var = [];
  43380. // A list of lexically-declared names in the current lexical scope
  43381. this.lexical = [];
  43382. // A list of lexically-declared FunctionDeclaration names in the current lexical scope
  43383. this.functions = [];
  43384. };
  43385. // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
  43386. pp$5.enterScope = function(flags) {
  43387. this.scopeStack.push(new Scope(flags));
  43388. };
  43389. pp$5.exitScope = function() {
  43390. this.scopeStack.pop();
  43391. };
  43392. // The spec says:
  43393. // > At the top level of a function, or script, function declarations are
  43394. // > treated like var declarations rather than like lexical declarations.
  43395. pp$5.treatFunctionsAsVarInScope = function(scope) {
  43396. return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
  43397. };
  43398. pp$5.declareName = function(name, bindingType, pos) {
  43399. var redeclared = false;
  43400. if (bindingType === BIND_LEXICAL) {
  43401. var scope = this.currentScope();
  43402. redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
  43403. scope.lexical.push(name);
  43404. if (this.inModule && (scope.flags & SCOPE_TOP))
  43405. { delete this.undefinedExports[name]; }
  43406. } else if (bindingType === BIND_SIMPLE_CATCH) {
  43407. var scope$1 = this.currentScope();
  43408. scope$1.lexical.push(name);
  43409. } else if (bindingType === BIND_FUNCTION) {
  43410. var scope$2 = this.currentScope();
  43411. if (this.treatFunctionsAsVar)
  43412. { redeclared = scope$2.lexical.indexOf(name) > -1; }
  43413. else
  43414. { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }
  43415. scope$2.functions.push(name);
  43416. } else {
  43417. for (var i = this.scopeStack.length - 1; i >= 0; --i) {
  43418. var scope$3 = this.scopeStack[i];
  43419. if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
  43420. !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
  43421. redeclared = true;
  43422. break
  43423. }
  43424. scope$3.var.push(name);
  43425. if (this.inModule && (scope$3.flags & SCOPE_TOP))
  43426. { delete this.undefinedExports[name]; }
  43427. if (scope$3.flags & SCOPE_VAR) { break }
  43428. }
  43429. }
  43430. if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
  43431. };
  43432. pp$5.checkLocalExport = function(id) {
  43433. // scope.functions must be empty as Module code is always strict.
  43434. if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
  43435. this.scopeStack[0].var.indexOf(id.name) === -1) {
  43436. this.undefinedExports[id.name] = id;
  43437. }
  43438. };
  43439. pp$5.currentScope = function() {
  43440. return this.scopeStack[this.scopeStack.length - 1]
  43441. };
  43442. pp$5.currentVarScope = function() {
  43443. for (var i = this.scopeStack.length - 1;; i--) {
  43444. var scope = this.scopeStack[i];
  43445. if (scope.flags & SCOPE_VAR) { return scope }
  43446. }
  43447. };
  43448. // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
  43449. pp$5.currentThisScope = function() {
  43450. for (var i = this.scopeStack.length - 1;; i--) {
  43451. var scope = this.scopeStack[i];
  43452. if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
  43453. }
  43454. };
  43455. var Node = function Node(parser, pos, loc) {
  43456. this.type = "";
  43457. this.start = pos;
  43458. this.end = 0;
  43459. if (parser.options.locations)
  43460. { this.loc = new SourceLocation(parser, loc); }
  43461. if (parser.options.directSourceFile)
  43462. { this.sourceFile = parser.options.directSourceFile; }
  43463. if (parser.options.ranges)
  43464. { this.range = [pos, 0]; }
  43465. };
  43466. // Start an AST node, attaching a start offset.
  43467. var pp$6 = Parser.prototype;
  43468. pp$6.startNode = function() {
  43469. return new Node(this, this.start, this.startLoc)
  43470. };
  43471. pp$6.startNodeAt = function(pos, loc) {
  43472. return new Node(this, pos, loc)
  43473. };
  43474. // Finish an AST node, adding `type` and `end` properties.
  43475. function finishNodeAt(node, type, pos, loc) {
  43476. node.type = type;
  43477. node.end = pos;
  43478. if (this.options.locations)
  43479. { node.loc.end = loc; }
  43480. if (this.options.ranges)
  43481. { node.range[1] = pos; }
  43482. return node
  43483. }
  43484. pp$6.finishNode = function(node, type) {
  43485. return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
  43486. };
  43487. // Finish node at given position
  43488. pp$6.finishNodeAt = function(node, type, pos, loc) {
  43489. return finishNodeAt.call(this, node, type, pos, loc)
  43490. };
  43491. pp$6.copyNode = function(node) {
  43492. var newNode = new Node(this, node.start, this.startLoc);
  43493. for (var prop in node) { newNode[prop] = node[prop]; }
  43494. return newNode
  43495. };
  43496. // The algorithm used to determine whether a regexp can appear at a
  43497. var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
  43498. this.token = token;
  43499. this.isExpr = !!isExpr;
  43500. this.preserveSpace = !!preserveSpace;
  43501. this.override = override;
  43502. this.generator = !!generator;
  43503. };
  43504. var types$1 = {
  43505. b_stat: new TokContext("{", false),
  43506. b_expr: new TokContext("{", true),
  43507. b_tmpl: new TokContext("${", false),
  43508. p_stat: new TokContext("(", false),
  43509. p_expr: new TokContext("(", true),
  43510. q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
  43511. f_stat: new TokContext("function", false),
  43512. f_expr: new TokContext("function", true),
  43513. f_expr_gen: new TokContext("function", true, false, null, true),
  43514. f_gen: new TokContext("function", false, false, null, true)
  43515. };
  43516. var pp$7 = Parser.prototype;
  43517. pp$7.initialContext = function() {
  43518. return [types$1.b_stat]
  43519. };
  43520. pp$7.braceIsBlock = function(prevType) {
  43521. var parent = this.curContext();
  43522. if (parent === types$1.f_expr || parent === types$1.f_stat)
  43523. { return true }
  43524. if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))
  43525. { return !parent.isExpr }
  43526. // The check for `tt.name && exprAllowed` detects whether we are
  43527. // after a `yield` or `of` construct. See the `updateContext` for
  43528. // `tt.name`.
  43529. if (prevType === types._return || prevType === types.name && this.exprAllowed)
  43530. { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
  43531. if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
  43532. { return true }
  43533. if (prevType === types.braceL)
  43534. { return parent === types$1.b_stat }
  43535. if (prevType === types._var || prevType === types._const || prevType === types.name)
  43536. { return false }
  43537. return !this.exprAllowed
  43538. };
  43539. pp$7.inGeneratorContext = function() {
  43540. for (var i = this.context.length - 1; i >= 1; i--) {
  43541. var context = this.context[i];
  43542. if (context.token === "function")
  43543. { return context.generator }
  43544. }
  43545. return false
  43546. };
  43547. pp$7.updateContext = function(prevType) {
  43548. var update, type = this.type;
  43549. if (type.keyword && prevType === types.dot)
  43550. { this.exprAllowed = false; }
  43551. else if (update = type.updateContext)
  43552. { update.call(this, prevType); }
  43553. else
  43554. { this.exprAllowed = type.beforeExpr; }
  43555. };
  43556. // Token-specific context update code
  43557. types.parenR.updateContext = types.braceR.updateContext = function() {
  43558. if (this.context.length === 1) {
  43559. this.exprAllowed = true;
  43560. return
  43561. }
  43562. var out = this.context.pop();
  43563. if (out === types$1.b_stat && this.curContext().token === "function") {
  43564. out = this.context.pop();
  43565. }
  43566. this.exprAllowed = !out.isExpr;
  43567. };
  43568. types.braceL.updateContext = function(prevType) {
  43569. this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);
  43570. this.exprAllowed = true;
  43571. };
  43572. types.dollarBraceL.updateContext = function() {
  43573. this.context.push(types$1.b_tmpl);
  43574. this.exprAllowed = true;
  43575. };
  43576. types.parenL.updateContext = function(prevType) {
  43577. var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
  43578. this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);
  43579. this.exprAllowed = true;
  43580. };
  43581. types.incDec.updateContext = function() {
  43582. // tokExprAllowed stays unchanged
  43583. };
  43584. types._function.updateContext = types._class.updateContext = function(prevType) {
  43585. if (prevType.beforeExpr && prevType !== types._else &&
  43586. !(prevType === types.semi && this.curContext() !== types$1.p_stat) &&
  43587. !(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
  43588. !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))
  43589. { this.context.push(types$1.f_expr); }
  43590. else
  43591. { this.context.push(types$1.f_stat); }
  43592. this.exprAllowed = false;
  43593. };
  43594. types.backQuote.updateContext = function() {
  43595. if (this.curContext() === types$1.q_tmpl)
  43596. { this.context.pop(); }
  43597. else
  43598. { this.context.push(types$1.q_tmpl); }
  43599. this.exprAllowed = false;
  43600. };
  43601. types.star.updateContext = function(prevType) {
  43602. if (prevType === types._function) {
  43603. var index = this.context.length - 1;
  43604. if (this.context[index] === types$1.f_expr)
  43605. { this.context[index] = types$1.f_expr_gen; }
  43606. else
  43607. { this.context[index] = types$1.f_gen; }
  43608. }
  43609. this.exprAllowed = true;
  43610. };
  43611. types.name.updateContext = function(prevType) {
  43612. var allowed = false;
  43613. if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
  43614. if (this.value === "of" && !this.exprAllowed ||
  43615. this.value === "yield" && this.inGeneratorContext())
  43616. { allowed = true; }
  43617. }
  43618. this.exprAllowed = allowed;
  43619. };
  43620. // This file contains Unicode properties extracted from the ECMAScript
  43621. // specification. The lists are extracted like so:
  43622. // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
  43623. // #table-binary-unicode-properties
  43624. var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
  43625. var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
  43626. var ecma11BinaryProperties = ecma10BinaryProperties;
  43627. var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
  43628. var unicodeBinaryProperties = {
  43629. 9: ecma9BinaryProperties,
  43630. 10: ecma10BinaryProperties,
  43631. 11: ecma11BinaryProperties,
  43632. 12: ecma12BinaryProperties
  43633. };
  43634. // #table-unicode-general-category-values
  43635. var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
  43636. // #table-unicode-script-values
  43637. var ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
  43638. var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
  43639. var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
  43640. var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
  43641. var unicodeScriptValues = {
  43642. 9: ecma9ScriptValues,
  43643. 10: ecma10ScriptValues,
  43644. 11: ecma11ScriptValues,
  43645. 12: ecma12ScriptValues
  43646. };
  43647. var data = {};
  43648. function buildUnicodeData(ecmaVersion) {
  43649. var d = data[ecmaVersion] = {
  43650. binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
  43651. nonBinary: {
  43652. General_Category: wordsRegexp(unicodeGeneralCategoryValues),
  43653. Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
  43654. }
  43655. };
  43656. d.nonBinary.Script_Extensions = d.nonBinary.Script;
  43657. d.nonBinary.gc = d.nonBinary.General_Category;
  43658. d.nonBinary.sc = d.nonBinary.Script;
  43659. d.nonBinary.scx = d.nonBinary.Script_Extensions;
  43660. }
  43661. buildUnicodeData(9);
  43662. buildUnicodeData(10);
  43663. buildUnicodeData(11);
  43664. buildUnicodeData(12);
  43665. var pp$8 = Parser.prototype;
  43666. var RegExpValidationState = function RegExpValidationState(parser) {
  43667. this.parser = parser;
  43668. this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "");
  43669. this.unicodeProperties = data[parser.options.ecmaVersion >= 12 ? 12 : parser.options.ecmaVersion];
  43670. this.source = "";
  43671. this.flags = "";
  43672. this.start = 0;
  43673. this.switchU = false;
  43674. this.switchN = false;
  43675. this.pos = 0;
  43676. this.lastIntValue = 0;
  43677. this.lastStringValue = "";
  43678. this.lastAssertionIsQuantifiable = false;
  43679. this.numCapturingParens = 0;
  43680. this.maxBackReference = 0;
  43681. this.groupNames = [];
  43682. this.backReferenceNames = [];
  43683. };
  43684. RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
  43685. var unicode = flags.indexOf("u") !== -1;
  43686. this.start = start | 0;
  43687. this.source = pattern + "";
  43688. this.flags = flags;
  43689. this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
  43690. this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
  43691. };
  43692. RegExpValidationState.prototype.raise = function raise (message) {
  43693. this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message));
  43694. };
  43695. // If u flag is given, this returns the code point at the index (it combines a surrogate pair).
  43696. // Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
  43697. RegExpValidationState.prototype.at = function at (i, forceU) {
  43698. if ( forceU === void 0 ) forceU = false;
  43699. var s = this.source;
  43700. var l = s.length;
  43701. if (i >= l) {
  43702. return -1
  43703. }
  43704. var c = s.charCodeAt(i);
  43705. if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
  43706. return c
  43707. }
  43708. var next = s.charCodeAt(i + 1);
  43709. return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
  43710. };
  43711. RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {
  43712. if ( forceU === void 0 ) forceU = false;
  43713. var s = this.source;
  43714. var l = s.length;
  43715. if (i >= l) {
  43716. return l
  43717. }
  43718. var c = s.charCodeAt(i), next;
  43719. if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
  43720. (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
  43721. return i + 1
  43722. }
  43723. return i + 2
  43724. };
  43725. RegExpValidationState.prototype.current = function current (forceU) {
  43726. if ( forceU === void 0 ) forceU = false;
  43727. return this.at(this.pos, forceU)
  43728. };
  43729. RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
  43730. if ( forceU === void 0 ) forceU = false;
  43731. return this.at(this.nextIndex(this.pos, forceU), forceU)
  43732. };
  43733. RegExpValidationState.prototype.advance = function advance (forceU) {
  43734. if ( forceU === void 0 ) forceU = false;
  43735. this.pos = this.nextIndex(this.pos, forceU);
  43736. };
  43737. RegExpValidationState.prototype.eat = function eat (ch, forceU) {
  43738. if ( forceU === void 0 ) forceU = false;
  43739. if (this.current(forceU) === ch) {
  43740. this.advance(forceU);
  43741. return true
  43742. }
  43743. return false
  43744. };
  43745. function codePointToString(ch) {
  43746. if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
  43747. ch -= 0x10000;
  43748. return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
  43749. }
  43750. /**
  43751. * Validate the flags part of a given RegExpLiteral.
  43752. *
  43753. * @param {RegExpValidationState} state The state to validate RegExp.
  43754. * @returns {void}
  43755. */
  43756. pp$8.validateRegExpFlags = function(state) {
  43757. var validFlags = state.validFlags;
  43758. var flags = state.flags;
  43759. for (var i = 0; i < flags.length; i++) {
  43760. var flag = flags.charAt(i);
  43761. if (validFlags.indexOf(flag) === -1) {
  43762. this.raise(state.start, "Invalid regular expression flag");
  43763. }
  43764. if (flags.indexOf(flag, i + 1) > -1) {
  43765. this.raise(state.start, "Duplicate regular expression flag");
  43766. }
  43767. }
  43768. };
  43769. /**
  43770. * Validate the pattern part of a given RegExpLiteral.
  43771. *
  43772. * @param {RegExpValidationState} state The state to validate RegExp.
  43773. * @returns {void}
  43774. */
  43775. pp$8.validateRegExpPattern = function(state) {
  43776. this.regexp_pattern(state);
  43777. // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
  43778. // parsing contains a |GroupName|, reparse with the goal symbol
  43779. // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
  43780. // exception if _P_ did not conform to the grammar, if any elements of _P_
  43781. // were not matched by the parse, or if any Early Error conditions exist.
  43782. if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
  43783. state.switchN = true;
  43784. this.regexp_pattern(state);
  43785. }
  43786. };
  43787. // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
  43788. pp$8.regexp_pattern = function(state) {
  43789. state.pos = 0;
  43790. state.lastIntValue = 0;
  43791. state.lastStringValue = "";
  43792. state.lastAssertionIsQuantifiable = false;
  43793. state.numCapturingParens = 0;
  43794. state.maxBackReference = 0;
  43795. state.groupNames.length = 0;
  43796. state.backReferenceNames.length = 0;
  43797. this.regexp_disjunction(state);
  43798. if (state.pos !== state.source.length) {
  43799. // Make the same messages as V8.
  43800. if (state.eat(0x29 /* ) */)) {
  43801. state.raise("Unmatched ')'");
  43802. }
  43803. if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
  43804. state.raise("Lone quantifier brackets");
  43805. }
  43806. }
  43807. if (state.maxBackReference > state.numCapturingParens) {
  43808. state.raise("Invalid escape");
  43809. }
  43810. for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
  43811. var name = list[i];
  43812. if (state.groupNames.indexOf(name) === -1) {
  43813. state.raise("Invalid named capture referenced");
  43814. }
  43815. }
  43816. };
  43817. // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
  43818. pp$8.regexp_disjunction = function(state) {
  43819. this.regexp_alternative(state);
  43820. while (state.eat(0x7C /* | */)) {
  43821. this.regexp_alternative(state);
  43822. }
  43823. // Make the same message as V8.
  43824. if (this.regexp_eatQuantifier(state, true)) {
  43825. state.raise("Nothing to repeat");
  43826. }
  43827. if (state.eat(0x7B /* { */)) {
  43828. state.raise("Lone quantifier brackets");
  43829. }
  43830. };
  43831. // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
  43832. pp$8.regexp_alternative = function(state) {
  43833. while (state.pos < state.source.length && this.regexp_eatTerm(state))
  43834. { }
  43835. };
  43836. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
  43837. pp$8.regexp_eatTerm = function(state) {
  43838. if (this.regexp_eatAssertion(state)) {
  43839. // Handle `QuantifiableAssertion Quantifier` alternative.
  43840. // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
  43841. // is a QuantifiableAssertion.
  43842. if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
  43843. // Make the same message as V8.
  43844. if (state.switchU) {
  43845. state.raise("Invalid quantifier");
  43846. }
  43847. }
  43848. return true
  43849. }
  43850. if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
  43851. this.regexp_eatQuantifier(state);
  43852. return true
  43853. }
  43854. return false
  43855. };
  43856. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
  43857. pp$8.regexp_eatAssertion = function(state) {
  43858. var start = state.pos;
  43859. state.lastAssertionIsQuantifiable = false;
  43860. // ^, $
  43861. if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
  43862. return true
  43863. }
  43864. // \b \B
  43865. if (state.eat(0x5C /* \ */)) {
  43866. if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
  43867. return true
  43868. }
  43869. state.pos = start;
  43870. }
  43871. // Lookahead / Lookbehind
  43872. if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
  43873. var lookbehind = false;
  43874. if (this.options.ecmaVersion >= 9) {
  43875. lookbehind = state.eat(0x3C /* < */);
  43876. }
  43877. if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
  43878. this.regexp_disjunction(state);
  43879. if (!state.eat(0x29 /* ) */)) {
  43880. state.raise("Unterminated group");
  43881. }
  43882. state.lastAssertionIsQuantifiable = !lookbehind;
  43883. return true
  43884. }
  43885. }
  43886. state.pos = start;
  43887. return false
  43888. };
  43889. // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
  43890. pp$8.regexp_eatQuantifier = function(state, noError) {
  43891. if ( noError === void 0 ) noError = false;
  43892. if (this.regexp_eatQuantifierPrefix(state, noError)) {
  43893. state.eat(0x3F /* ? */);
  43894. return true
  43895. }
  43896. return false
  43897. };
  43898. // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
  43899. pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
  43900. return (
  43901. state.eat(0x2A /* * */) ||
  43902. state.eat(0x2B /* + */) ||
  43903. state.eat(0x3F /* ? */) ||
  43904. this.regexp_eatBracedQuantifier(state, noError)
  43905. )
  43906. };
  43907. pp$8.regexp_eatBracedQuantifier = function(state, noError) {
  43908. var start = state.pos;
  43909. if (state.eat(0x7B /* { */)) {
  43910. var min = 0, max = -1;
  43911. if (this.regexp_eatDecimalDigits(state)) {
  43912. min = state.lastIntValue;
  43913. if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
  43914. max = state.lastIntValue;
  43915. }
  43916. if (state.eat(0x7D /* } */)) {
  43917. // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
  43918. if (max !== -1 && max < min && !noError) {
  43919. state.raise("numbers out of order in {} quantifier");
  43920. }
  43921. return true
  43922. }
  43923. }
  43924. if (state.switchU && !noError) {
  43925. state.raise("Incomplete quantifier");
  43926. }
  43927. state.pos = start;
  43928. }
  43929. return false
  43930. };
  43931. // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
  43932. pp$8.regexp_eatAtom = function(state) {
  43933. return (
  43934. this.regexp_eatPatternCharacters(state) ||
  43935. state.eat(0x2E /* . */) ||
  43936. this.regexp_eatReverseSolidusAtomEscape(state) ||
  43937. this.regexp_eatCharacterClass(state) ||
  43938. this.regexp_eatUncapturingGroup(state) ||
  43939. this.regexp_eatCapturingGroup(state)
  43940. )
  43941. };
  43942. pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
  43943. var start = state.pos;
  43944. if (state.eat(0x5C /* \ */)) {
  43945. if (this.regexp_eatAtomEscape(state)) {
  43946. return true
  43947. }
  43948. state.pos = start;
  43949. }
  43950. return false
  43951. };
  43952. pp$8.regexp_eatUncapturingGroup = function(state) {
  43953. var start = state.pos;
  43954. if (state.eat(0x28 /* ( */)) {
  43955. if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
  43956. this.regexp_disjunction(state);
  43957. if (state.eat(0x29 /* ) */)) {
  43958. return true
  43959. }
  43960. state.raise("Unterminated group");
  43961. }
  43962. state.pos = start;
  43963. }
  43964. return false
  43965. };
  43966. pp$8.regexp_eatCapturingGroup = function(state) {
  43967. if (state.eat(0x28 /* ( */)) {
  43968. if (this.options.ecmaVersion >= 9) {
  43969. this.regexp_groupSpecifier(state);
  43970. } else if (state.current() === 0x3F /* ? */) {
  43971. state.raise("Invalid group");
  43972. }
  43973. this.regexp_disjunction(state);
  43974. if (state.eat(0x29 /* ) */)) {
  43975. state.numCapturingParens += 1;
  43976. return true
  43977. }
  43978. state.raise("Unterminated group");
  43979. }
  43980. return false
  43981. };
  43982. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
  43983. pp$8.regexp_eatExtendedAtom = function(state) {
  43984. return (
  43985. state.eat(0x2E /* . */) ||
  43986. this.regexp_eatReverseSolidusAtomEscape(state) ||
  43987. this.regexp_eatCharacterClass(state) ||
  43988. this.regexp_eatUncapturingGroup(state) ||
  43989. this.regexp_eatCapturingGroup(state) ||
  43990. this.regexp_eatInvalidBracedQuantifier(state) ||
  43991. this.regexp_eatExtendedPatternCharacter(state)
  43992. )
  43993. };
  43994. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
  43995. pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
  43996. if (this.regexp_eatBracedQuantifier(state, true)) {
  43997. state.raise("Nothing to repeat");
  43998. }
  43999. return false
  44000. };
  44001. // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
  44002. pp$8.regexp_eatSyntaxCharacter = function(state) {
  44003. var ch = state.current();
  44004. if (isSyntaxCharacter(ch)) {
  44005. state.lastIntValue = ch;
  44006. state.advance();
  44007. return true
  44008. }
  44009. return false
  44010. };
  44011. function isSyntaxCharacter(ch) {
  44012. return (
  44013. ch === 0x24 /* $ */ ||
  44014. ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||
  44015. ch === 0x2E /* . */ ||
  44016. ch === 0x3F /* ? */ ||
  44017. ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||
  44018. ch >= 0x7B /* { */ && ch <= 0x7D /* } */
  44019. )
  44020. }
  44021. // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
  44022. // But eat eager.
  44023. pp$8.regexp_eatPatternCharacters = function(state) {
  44024. var start = state.pos;
  44025. var ch = 0;
  44026. while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
  44027. state.advance();
  44028. }
  44029. return state.pos !== start
  44030. };
  44031. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
  44032. pp$8.regexp_eatExtendedPatternCharacter = function(state) {
  44033. var ch = state.current();
  44034. if (
  44035. ch !== -1 &&
  44036. ch !== 0x24 /* $ */ &&
  44037. !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&
  44038. ch !== 0x2E /* . */ &&
  44039. ch !== 0x3F /* ? */ &&
  44040. ch !== 0x5B /* [ */ &&
  44041. ch !== 0x5E /* ^ */ &&
  44042. ch !== 0x7C /* | */
  44043. ) {
  44044. state.advance();
  44045. return true
  44046. }
  44047. return false
  44048. };
  44049. // GroupSpecifier ::
  44050. // [empty]
  44051. // `?` GroupName
  44052. pp$8.regexp_groupSpecifier = function(state) {
  44053. if (state.eat(0x3F /* ? */)) {
  44054. if (this.regexp_eatGroupName(state)) {
  44055. if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
  44056. state.raise("Duplicate capture group name");
  44057. }
  44058. state.groupNames.push(state.lastStringValue);
  44059. return
  44060. }
  44061. state.raise("Invalid group");
  44062. }
  44063. };
  44064. // GroupName ::
  44065. // `<` RegExpIdentifierName `>`
  44066. // Note: this updates `state.lastStringValue` property with the eaten name.
  44067. pp$8.regexp_eatGroupName = function(state) {
  44068. state.lastStringValue = "";
  44069. if (state.eat(0x3C /* < */)) {
  44070. if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
  44071. return true
  44072. }
  44073. state.raise("Invalid capture group name");
  44074. }
  44075. return false
  44076. };
  44077. // RegExpIdentifierName ::
  44078. // RegExpIdentifierStart
  44079. // RegExpIdentifierName RegExpIdentifierPart
  44080. // Note: this updates `state.lastStringValue` property with the eaten name.
  44081. pp$8.regexp_eatRegExpIdentifierName = function(state) {
  44082. state.lastStringValue = "";
  44083. if (this.regexp_eatRegExpIdentifierStart(state)) {
  44084. state.lastStringValue += codePointToString(state.lastIntValue);
  44085. while (this.regexp_eatRegExpIdentifierPart(state)) {
  44086. state.lastStringValue += codePointToString(state.lastIntValue);
  44087. }
  44088. return true
  44089. }
  44090. return false
  44091. };
  44092. // RegExpIdentifierStart ::
  44093. // UnicodeIDStart
  44094. // `$`
  44095. // `_`
  44096. // `\` RegExpUnicodeEscapeSequence[+U]
  44097. pp$8.regexp_eatRegExpIdentifierStart = function(state) {
  44098. var start = state.pos;
  44099. var forceU = this.options.ecmaVersion >= 11;
  44100. var ch = state.current(forceU);
  44101. state.advance(forceU);
  44102. if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
  44103. ch = state.lastIntValue;
  44104. }
  44105. if (isRegExpIdentifierStart(ch)) {
  44106. state.lastIntValue = ch;
  44107. return true
  44108. }
  44109. state.pos = start;
  44110. return false
  44111. };
  44112. function isRegExpIdentifierStart(ch) {
  44113. return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
  44114. }
  44115. // RegExpIdentifierPart ::
  44116. // UnicodeIDContinue
  44117. // `$`
  44118. // `_`
  44119. // `\` RegExpUnicodeEscapeSequence[+U]
  44120. // <ZWNJ>
  44121. // <ZWJ>
  44122. pp$8.regexp_eatRegExpIdentifierPart = function(state) {
  44123. var start = state.pos;
  44124. var forceU = this.options.ecmaVersion >= 11;
  44125. var ch = state.current(forceU);
  44126. state.advance(forceU);
  44127. if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
  44128. ch = state.lastIntValue;
  44129. }
  44130. if (isRegExpIdentifierPart(ch)) {
  44131. state.lastIntValue = ch;
  44132. return true
  44133. }
  44134. state.pos = start;
  44135. return false
  44136. };
  44137. function isRegExpIdentifierPart(ch) {
  44138. return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */
  44139. }
  44140. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
  44141. pp$8.regexp_eatAtomEscape = function(state) {
  44142. if (
  44143. this.regexp_eatBackReference(state) ||
  44144. this.regexp_eatCharacterClassEscape(state) ||
  44145. this.regexp_eatCharacterEscape(state) ||
  44146. (state.switchN && this.regexp_eatKGroupName(state))
  44147. ) {
  44148. return true
  44149. }
  44150. if (state.switchU) {
  44151. // Make the same message as V8.
  44152. if (state.current() === 0x63 /* c */) {
  44153. state.raise("Invalid unicode escape");
  44154. }
  44155. state.raise("Invalid escape");
  44156. }
  44157. return false
  44158. };
  44159. pp$8.regexp_eatBackReference = function(state) {
  44160. var start = state.pos;
  44161. if (this.regexp_eatDecimalEscape(state)) {
  44162. var n = state.lastIntValue;
  44163. if (state.switchU) {
  44164. // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
  44165. if (n > state.maxBackReference) {
  44166. state.maxBackReference = n;
  44167. }
  44168. return true
  44169. }
  44170. if (n <= state.numCapturingParens) {
  44171. return true
  44172. }
  44173. state.pos = start;
  44174. }
  44175. return false
  44176. };
  44177. pp$8.regexp_eatKGroupName = function(state) {
  44178. if (state.eat(0x6B /* k */)) {
  44179. if (this.regexp_eatGroupName(state)) {
  44180. state.backReferenceNames.push(state.lastStringValue);
  44181. return true
  44182. }
  44183. state.raise("Invalid named reference");
  44184. }
  44185. return false
  44186. };
  44187. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
  44188. pp$8.regexp_eatCharacterEscape = function(state) {
  44189. return (
  44190. this.regexp_eatControlEscape(state) ||
  44191. this.regexp_eatCControlLetter(state) ||
  44192. this.regexp_eatZero(state) ||
  44193. this.regexp_eatHexEscapeSequence(state) ||
  44194. this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||
  44195. (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
  44196. this.regexp_eatIdentityEscape(state)
  44197. )
  44198. };
  44199. pp$8.regexp_eatCControlLetter = function(state) {
  44200. var start = state.pos;
  44201. if (state.eat(0x63 /* c */)) {
  44202. if (this.regexp_eatControlLetter(state)) {
  44203. return true
  44204. }
  44205. state.pos = start;
  44206. }
  44207. return false
  44208. };
  44209. pp$8.regexp_eatZero = function(state) {
  44210. if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
  44211. state.lastIntValue = 0;
  44212. state.advance();
  44213. return true
  44214. }
  44215. return false
  44216. };
  44217. // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
  44218. pp$8.regexp_eatControlEscape = function(state) {
  44219. var ch = state.current();
  44220. if (ch === 0x74 /* t */) {
  44221. state.lastIntValue = 0x09; /* \t */
  44222. state.advance();
  44223. return true
  44224. }
  44225. if (ch === 0x6E /* n */) {
  44226. state.lastIntValue = 0x0A; /* \n */
  44227. state.advance();
  44228. return true
  44229. }
  44230. if (ch === 0x76 /* v */) {
  44231. state.lastIntValue = 0x0B; /* \v */
  44232. state.advance();
  44233. return true
  44234. }
  44235. if (ch === 0x66 /* f */) {
  44236. state.lastIntValue = 0x0C; /* \f */
  44237. state.advance();
  44238. return true
  44239. }
  44240. if (ch === 0x72 /* r */) {
  44241. state.lastIntValue = 0x0D; /* \r */
  44242. state.advance();
  44243. return true
  44244. }
  44245. return false
  44246. };
  44247. // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
  44248. pp$8.regexp_eatControlLetter = function(state) {
  44249. var ch = state.current();
  44250. if (isControlLetter(ch)) {
  44251. state.lastIntValue = ch % 0x20;
  44252. state.advance();
  44253. return true
  44254. }
  44255. return false
  44256. };
  44257. function isControlLetter(ch) {
  44258. return (
  44259. (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||
  44260. (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)
  44261. )
  44262. }
  44263. // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
  44264. pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
  44265. if ( forceU === void 0 ) forceU = false;
  44266. var start = state.pos;
  44267. var switchU = forceU || state.switchU;
  44268. if (state.eat(0x75 /* u */)) {
  44269. if (this.regexp_eatFixedHexDigits(state, 4)) {
  44270. var lead = state.lastIntValue;
  44271. if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
  44272. var leadSurrogateEnd = state.pos;
  44273. if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
  44274. var trail = state.lastIntValue;
  44275. if (trail >= 0xDC00 && trail <= 0xDFFF) {
  44276. state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
  44277. return true
  44278. }
  44279. }
  44280. state.pos = leadSurrogateEnd;
  44281. state.lastIntValue = lead;
  44282. }
  44283. return true
  44284. }
  44285. if (
  44286. switchU &&
  44287. state.eat(0x7B /* { */) &&
  44288. this.regexp_eatHexDigits(state) &&
  44289. state.eat(0x7D /* } */) &&
  44290. isValidUnicode(state.lastIntValue)
  44291. ) {
  44292. return true
  44293. }
  44294. if (switchU) {
  44295. state.raise("Invalid unicode escape");
  44296. }
  44297. state.pos = start;
  44298. }
  44299. return false
  44300. };
  44301. function isValidUnicode(ch) {
  44302. return ch >= 0 && ch <= 0x10FFFF
  44303. }
  44304. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
  44305. pp$8.regexp_eatIdentityEscape = function(state) {
  44306. if (state.switchU) {
  44307. if (this.regexp_eatSyntaxCharacter(state)) {
  44308. return true
  44309. }
  44310. if (state.eat(0x2F /* / */)) {
  44311. state.lastIntValue = 0x2F; /* / */
  44312. return true
  44313. }
  44314. return false
  44315. }
  44316. var ch = state.current();
  44317. if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
  44318. state.lastIntValue = ch;
  44319. state.advance();
  44320. return true
  44321. }
  44322. return false
  44323. };
  44324. // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
  44325. pp$8.regexp_eatDecimalEscape = function(state) {
  44326. state.lastIntValue = 0;
  44327. var ch = state.current();
  44328. if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
  44329. do {
  44330. state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
  44331. state.advance();
  44332. } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)
  44333. return true
  44334. }
  44335. return false
  44336. };
  44337. // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
  44338. pp$8.regexp_eatCharacterClassEscape = function(state) {
  44339. var ch = state.current();
  44340. if (isCharacterClassEscape(ch)) {
  44341. state.lastIntValue = -1;
  44342. state.advance();
  44343. return true
  44344. }
  44345. if (
  44346. state.switchU &&
  44347. this.options.ecmaVersion >= 9 &&
  44348. (ch === 0x50 /* P */ || ch === 0x70 /* p */)
  44349. ) {
  44350. state.lastIntValue = -1;
  44351. state.advance();
  44352. if (
  44353. state.eat(0x7B /* { */) &&
  44354. this.regexp_eatUnicodePropertyValueExpression(state) &&
  44355. state.eat(0x7D /* } */)
  44356. ) {
  44357. return true
  44358. }
  44359. state.raise("Invalid property name");
  44360. }
  44361. return false
  44362. };
  44363. function isCharacterClassEscape(ch) {
  44364. return (
  44365. ch === 0x64 /* d */ ||
  44366. ch === 0x44 /* D */ ||
  44367. ch === 0x73 /* s */ ||
  44368. ch === 0x53 /* S */ ||
  44369. ch === 0x77 /* w */ ||
  44370. ch === 0x57 /* W */
  44371. )
  44372. }
  44373. // UnicodePropertyValueExpression ::
  44374. // UnicodePropertyName `=` UnicodePropertyValue
  44375. // LoneUnicodePropertyNameOrValue
  44376. pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
  44377. var start = state.pos;
  44378. // UnicodePropertyName `=` UnicodePropertyValue
  44379. if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
  44380. var name = state.lastStringValue;
  44381. if (this.regexp_eatUnicodePropertyValue(state)) {
  44382. var value = state.lastStringValue;
  44383. this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
  44384. return true
  44385. }
  44386. }
  44387. state.pos = start;
  44388. // LoneUnicodePropertyNameOrValue
  44389. if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
  44390. var nameOrValue = state.lastStringValue;
  44391. this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
  44392. return true
  44393. }
  44394. return false
  44395. };
  44396. pp$8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
  44397. if (!has(state.unicodeProperties.nonBinary, name))
  44398. { state.raise("Invalid property name"); }
  44399. if (!state.unicodeProperties.nonBinary[name].test(value))
  44400. { state.raise("Invalid property value"); }
  44401. };
  44402. pp$8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
  44403. if (!state.unicodeProperties.binary.test(nameOrValue))
  44404. { state.raise("Invalid property name"); }
  44405. };
  44406. // UnicodePropertyName ::
  44407. // UnicodePropertyNameCharacters
  44408. pp$8.regexp_eatUnicodePropertyName = function(state) {
  44409. var ch = 0;
  44410. state.lastStringValue = "";
  44411. while (isUnicodePropertyNameCharacter(ch = state.current())) {
  44412. state.lastStringValue += codePointToString(ch);
  44413. state.advance();
  44414. }
  44415. return state.lastStringValue !== ""
  44416. };
  44417. function isUnicodePropertyNameCharacter(ch) {
  44418. return isControlLetter(ch) || ch === 0x5F /* _ */
  44419. }
  44420. // UnicodePropertyValue ::
  44421. // UnicodePropertyValueCharacters
  44422. pp$8.regexp_eatUnicodePropertyValue = function(state) {
  44423. var ch = 0;
  44424. state.lastStringValue = "";
  44425. while (isUnicodePropertyValueCharacter(ch = state.current())) {
  44426. state.lastStringValue += codePointToString(ch);
  44427. state.advance();
  44428. }
  44429. return state.lastStringValue !== ""
  44430. };
  44431. function isUnicodePropertyValueCharacter(ch) {
  44432. return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)
  44433. }
  44434. // LoneUnicodePropertyNameOrValue ::
  44435. // UnicodePropertyValueCharacters
  44436. pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
  44437. return this.regexp_eatUnicodePropertyValue(state)
  44438. };
  44439. // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
  44440. pp$8.regexp_eatCharacterClass = function(state) {
  44441. if (state.eat(0x5B /* [ */)) {
  44442. state.eat(0x5E /* ^ */);
  44443. this.regexp_classRanges(state);
  44444. if (state.eat(0x5D /* ] */)) {
  44445. return true
  44446. }
  44447. // Unreachable since it threw "unterminated regular expression" error before.
  44448. state.raise("Unterminated character class");
  44449. }
  44450. return false
  44451. };
  44452. // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
  44453. // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
  44454. // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
  44455. pp$8.regexp_classRanges = function(state) {
  44456. while (this.regexp_eatClassAtom(state)) {
  44457. var left = state.lastIntValue;
  44458. if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
  44459. var right = state.lastIntValue;
  44460. if (state.switchU && (left === -1 || right === -1)) {
  44461. state.raise("Invalid character class");
  44462. }
  44463. if (left !== -1 && right !== -1 && left > right) {
  44464. state.raise("Range out of order in character class");
  44465. }
  44466. }
  44467. }
  44468. };
  44469. // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
  44470. // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
  44471. pp$8.regexp_eatClassAtom = function(state) {
  44472. var start = state.pos;
  44473. if (state.eat(0x5C /* \ */)) {
  44474. if (this.regexp_eatClassEscape(state)) {
  44475. return true
  44476. }
  44477. if (state.switchU) {
  44478. // Make the same message as V8.
  44479. var ch$1 = state.current();
  44480. if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
  44481. state.raise("Invalid class escape");
  44482. }
  44483. state.raise("Invalid escape");
  44484. }
  44485. state.pos = start;
  44486. }
  44487. var ch = state.current();
  44488. if (ch !== 0x5D /* ] */) {
  44489. state.lastIntValue = ch;
  44490. state.advance();
  44491. return true
  44492. }
  44493. return false
  44494. };
  44495. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
  44496. pp$8.regexp_eatClassEscape = function(state) {
  44497. var start = state.pos;
  44498. if (state.eat(0x62 /* b */)) {
  44499. state.lastIntValue = 0x08; /* <BS> */
  44500. return true
  44501. }
  44502. if (state.switchU && state.eat(0x2D /* - */)) {
  44503. state.lastIntValue = 0x2D; /* - */
  44504. return true
  44505. }
  44506. if (!state.switchU && state.eat(0x63 /* c */)) {
  44507. if (this.regexp_eatClassControlLetter(state)) {
  44508. return true
  44509. }
  44510. state.pos = start;
  44511. }
  44512. return (
  44513. this.regexp_eatCharacterClassEscape(state) ||
  44514. this.regexp_eatCharacterEscape(state)
  44515. )
  44516. };
  44517. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
  44518. pp$8.regexp_eatClassControlLetter = function(state) {
  44519. var ch = state.current();
  44520. if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
  44521. state.lastIntValue = ch % 0x20;
  44522. state.advance();
  44523. return true
  44524. }
  44525. return false
  44526. };
  44527. // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
  44528. pp$8.regexp_eatHexEscapeSequence = function(state) {
  44529. var start = state.pos;
  44530. if (state.eat(0x78 /* x */)) {
  44531. if (this.regexp_eatFixedHexDigits(state, 2)) {
  44532. return true
  44533. }
  44534. if (state.switchU) {
  44535. state.raise("Invalid escape");
  44536. }
  44537. state.pos = start;
  44538. }
  44539. return false
  44540. };
  44541. // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
  44542. pp$8.regexp_eatDecimalDigits = function(state) {
  44543. var start = state.pos;
  44544. var ch = 0;
  44545. state.lastIntValue = 0;
  44546. while (isDecimalDigit(ch = state.current())) {
  44547. state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
  44548. state.advance();
  44549. }
  44550. return state.pos !== start
  44551. };
  44552. function isDecimalDigit(ch) {
  44553. return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */
  44554. }
  44555. // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
  44556. pp$8.regexp_eatHexDigits = function(state) {
  44557. var start = state.pos;
  44558. var ch = 0;
  44559. state.lastIntValue = 0;
  44560. while (isHexDigit(ch = state.current())) {
  44561. state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
  44562. state.advance();
  44563. }
  44564. return state.pos !== start
  44565. };
  44566. function isHexDigit(ch) {
  44567. return (
  44568. (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||
  44569. (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||
  44570. (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)
  44571. )
  44572. }
  44573. function hexToInt(ch) {
  44574. if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
  44575. return 10 + (ch - 0x41 /* A */)
  44576. }
  44577. if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
  44578. return 10 + (ch - 0x61 /* a */)
  44579. }
  44580. return ch - 0x30 /* 0 */
  44581. }
  44582. // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
  44583. // Allows only 0-377(octal) i.e. 0-255(decimal).
  44584. pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
  44585. if (this.regexp_eatOctalDigit(state)) {
  44586. var n1 = state.lastIntValue;
  44587. if (this.regexp_eatOctalDigit(state)) {
  44588. var n2 = state.lastIntValue;
  44589. if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
  44590. state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
  44591. } else {
  44592. state.lastIntValue = n1 * 8 + n2;
  44593. }
  44594. } else {
  44595. state.lastIntValue = n1;
  44596. }
  44597. return true
  44598. }
  44599. return false
  44600. };
  44601. // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
  44602. pp$8.regexp_eatOctalDigit = function(state) {
  44603. var ch = state.current();
  44604. if (isOctalDigit(ch)) {
  44605. state.lastIntValue = ch - 0x30; /* 0 */
  44606. state.advance();
  44607. return true
  44608. }
  44609. state.lastIntValue = 0;
  44610. return false
  44611. };
  44612. function isOctalDigit(ch) {
  44613. return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */
  44614. }
  44615. // https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
  44616. // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
  44617. // And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
  44618. pp$8.regexp_eatFixedHexDigits = function(state, length) {
  44619. var start = state.pos;
  44620. state.lastIntValue = 0;
  44621. for (var i = 0; i < length; ++i) {
  44622. var ch = state.current();
  44623. if (!isHexDigit(ch)) {
  44624. state.pos = start;
  44625. return false
  44626. }
  44627. state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
  44628. state.advance();
  44629. }
  44630. return true
  44631. };
  44632. // Object type used to represent tokens. Note that normally, tokens
  44633. // simply exist as properties on the parser object. This is only
  44634. // used for the onToken callback and the external tokenizer.
  44635. var Token = function Token(p) {
  44636. this.type = p.type;
  44637. this.value = p.value;
  44638. this.start = p.start;
  44639. this.end = p.end;
  44640. if (p.options.locations)
  44641. { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }
  44642. if (p.options.ranges)
  44643. { this.range = [p.start, p.end]; }
  44644. };
  44645. // ## Tokenizer
  44646. var pp$9 = Parser.prototype;
  44647. // Move to the next token
  44648. pp$9.next = function(ignoreEscapeSequenceInKeyword) {
  44649. if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
  44650. { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
  44651. if (this.options.onToken)
  44652. { this.options.onToken(new Token(this)); }
  44653. this.lastTokEnd = this.end;
  44654. this.lastTokStart = this.start;
  44655. this.lastTokEndLoc = this.endLoc;
  44656. this.lastTokStartLoc = this.startLoc;
  44657. this.nextToken();
  44658. };
  44659. pp$9.getToken = function() {
  44660. this.next();
  44661. return new Token(this)
  44662. };
  44663. // If we're in an ES6 environment, make parsers iterable
  44664. if (typeof Symbol !== "undefined")
  44665. { pp$9[Symbol.iterator] = function() {
  44666. var this$1 = this;
  44667. return {
  44668. next: function () {
  44669. var token = this$1.getToken();
  44670. return {
  44671. done: token.type === types.eof,
  44672. value: token
  44673. }
  44674. }
  44675. }
  44676. }; }
  44677. // Toggle strict mode. Re-reads the next number or string to please
  44678. // pedantic tests (`"use strict"; 010;` should fail).
  44679. pp$9.curContext = function() {
  44680. return this.context[this.context.length - 1]
  44681. };
  44682. // Read a single token, updating the parser object's token-related
  44683. // properties.
  44684. pp$9.nextToken = function() {
  44685. var curContext = this.curContext();
  44686. if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
  44687. this.start = this.pos;
  44688. if (this.options.locations) { this.startLoc = this.curPosition(); }
  44689. if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
  44690. if (curContext.override) { return curContext.override(this) }
  44691. else { this.readToken(this.fullCharCodeAtPos()); }
  44692. };
  44693. pp$9.readToken = function(code) {
  44694. // Identifier or keyword. '\uXXXX' sequences are allowed in
  44695. // identifiers, so '\' also dispatches to that.
  44696. if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
  44697. { return this.readWord() }
  44698. return this.getTokenFromCode(code)
  44699. };
  44700. pp$9.fullCharCodeAtPos = function() {
  44701. var code = this.input.charCodeAt(this.pos);
  44702. if (code <= 0xd7ff || code >= 0xe000) { return code }
  44703. var next = this.input.charCodeAt(this.pos + 1);
  44704. return (code << 10) + next - 0x35fdc00
  44705. };
  44706. pp$9.skipBlockComment = function() {
  44707. var startLoc = this.options.onComment && this.curPosition();
  44708. var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
  44709. if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
  44710. this.pos = end + 2;
  44711. if (this.options.locations) {
  44712. lineBreakG.lastIndex = start;
  44713. var match;
  44714. while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
  44715. ++this.curLine;
  44716. this.lineStart = match.index + match[0].length;
  44717. }
  44718. }
  44719. if (this.options.onComment)
  44720. { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
  44721. startLoc, this.curPosition()); }
  44722. };
  44723. pp$9.skipLineComment = function(startSkip) {
  44724. var start = this.pos;
  44725. var startLoc = this.options.onComment && this.curPosition();
  44726. var ch = this.input.charCodeAt(this.pos += startSkip);
  44727. while (this.pos < this.input.length && !isNewLine(ch)) {
  44728. ch = this.input.charCodeAt(++this.pos);
  44729. }
  44730. if (this.options.onComment)
  44731. { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
  44732. startLoc, this.curPosition()); }
  44733. };
  44734. // Called at the start of the parse and after every token. Skips
  44735. // whitespace and comments, and.
  44736. pp$9.skipSpace = function() {
  44737. loop: while (this.pos < this.input.length) {
  44738. var ch = this.input.charCodeAt(this.pos);
  44739. switch (ch) {
  44740. case 32: case 160: // ' '
  44741. ++this.pos;
  44742. break
  44743. case 13:
  44744. if (this.input.charCodeAt(this.pos + 1) === 10) {
  44745. ++this.pos;
  44746. }
  44747. case 10: case 8232: case 8233:
  44748. ++this.pos;
  44749. if (this.options.locations) {
  44750. ++this.curLine;
  44751. this.lineStart = this.pos;
  44752. }
  44753. break
  44754. case 47: // '/'
  44755. switch (this.input.charCodeAt(this.pos + 1)) {
  44756. case 42: // '*'
  44757. this.skipBlockComment();
  44758. break
  44759. case 47:
  44760. this.skipLineComment(2);
  44761. break
  44762. default:
  44763. break loop
  44764. }
  44765. break
  44766. default:
  44767. if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
  44768. ++this.pos;
  44769. } else {
  44770. break loop
  44771. }
  44772. }
  44773. }
  44774. };
  44775. // Called at the end of every token. Sets `end`, `val`, and
  44776. // maintains `context` and `exprAllowed`, and skips the space after
  44777. // the token, so that the next one's `start` will point at the
  44778. // right position.
  44779. pp$9.finishToken = function(type, val) {
  44780. this.end = this.pos;
  44781. if (this.options.locations) { this.endLoc = this.curPosition(); }
  44782. var prevType = this.type;
  44783. this.type = type;
  44784. this.value = val;
  44785. this.updateContext(prevType);
  44786. };
  44787. // ### Token reading
  44788. // This is the function that is called to fetch the next token. It
  44789. // is somewhat obscure, because it works in character codes rather
  44790. // than characters, and because operator parsing has been inlined
  44791. // into it.
  44792. //
  44793. // All in the name of speed.
  44794. //
  44795. pp$9.readToken_dot = function() {
  44796. var next = this.input.charCodeAt(this.pos + 1);
  44797. if (next >= 48 && next <= 57) { return this.readNumber(true) }
  44798. var next2 = this.input.charCodeAt(this.pos + 2);
  44799. if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
  44800. this.pos += 3;
  44801. return this.finishToken(types.ellipsis)
  44802. } else {
  44803. ++this.pos;
  44804. return this.finishToken(types.dot)
  44805. }
  44806. };
  44807. pp$9.readToken_slash = function() { // '/'
  44808. var next = this.input.charCodeAt(this.pos + 1);
  44809. if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
  44810. if (next === 61) { return this.finishOp(types.assign, 2) }
  44811. return this.finishOp(types.slash, 1)
  44812. };
  44813. pp$9.readToken_mult_modulo_exp = function(code) { // '%*'
  44814. var next = this.input.charCodeAt(this.pos + 1);
  44815. var size = 1;
  44816. var tokentype = code === 42 ? types.star : types.modulo;
  44817. // exponentiation operator ** and **=
  44818. if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
  44819. ++size;
  44820. tokentype = types.starstar;
  44821. next = this.input.charCodeAt(this.pos + 2);
  44822. }
  44823. if (next === 61) { return this.finishOp(types.assign, size + 1) }
  44824. return this.finishOp(tokentype, size)
  44825. };
  44826. pp$9.readToken_pipe_amp = function(code) { // '|&'
  44827. var next = this.input.charCodeAt(this.pos + 1);
  44828. if (next === code) {
  44829. if (this.options.ecmaVersion >= 12) {
  44830. var next2 = this.input.charCodeAt(this.pos + 2);
  44831. if (next2 === 61) { return this.finishOp(types.assign, 3) }
  44832. }
  44833. return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
  44834. }
  44835. if (next === 61) { return this.finishOp(types.assign, 2) }
  44836. return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
  44837. };
  44838. pp$9.readToken_caret = function() { // '^'
  44839. var next = this.input.charCodeAt(this.pos + 1);
  44840. if (next === 61) { return this.finishOp(types.assign, 2) }
  44841. return this.finishOp(types.bitwiseXOR, 1)
  44842. };
  44843. pp$9.readToken_plus_min = function(code) { // '+-'
  44844. var next = this.input.charCodeAt(this.pos + 1);
  44845. if (next === code) {
  44846. if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
  44847. (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
  44848. // A `-->` line comment
  44849. this.skipLineComment(3);
  44850. this.skipSpace();
  44851. return this.nextToken()
  44852. }
  44853. return this.finishOp(types.incDec, 2)
  44854. }
  44855. if (next === 61) { return this.finishOp(types.assign, 2) }
  44856. return this.finishOp(types.plusMin, 1)
  44857. };
  44858. pp$9.readToken_lt_gt = function(code) { // '<>'
  44859. var next = this.input.charCodeAt(this.pos + 1);
  44860. var size = 1;
  44861. if (next === code) {
  44862. size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
  44863. if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
  44864. return this.finishOp(types.bitShift, size)
  44865. }
  44866. if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
  44867. this.input.charCodeAt(this.pos + 3) === 45) {
  44868. // `<!--`, an XML-style comment that should be interpreted as a line comment
  44869. this.skipLineComment(4);
  44870. this.skipSpace();
  44871. return this.nextToken()
  44872. }
  44873. if (next === 61) { size = 2; }
  44874. return this.finishOp(types.relational, size)
  44875. };
  44876. pp$9.readToken_eq_excl = function(code) { // '=!'
  44877. var next = this.input.charCodeAt(this.pos + 1);
  44878. if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
  44879. if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
  44880. this.pos += 2;
  44881. return this.finishToken(types.arrow)
  44882. }
  44883. return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
  44884. };
  44885. pp$9.readToken_question = function() { // '?'
  44886. var ecmaVersion = this.options.ecmaVersion;
  44887. if (ecmaVersion >= 11) {
  44888. var next = this.input.charCodeAt(this.pos + 1);
  44889. if (next === 46) {
  44890. var next2 = this.input.charCodeAt(this.pos + 2);
  44891. if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
  44892. }
  44893. if (next === 63) {
  44894. if (ecmaVersion >= 12) {
  44895. var next2$1 = this.input.charCodeAt(this.pos + 2);
  44896. if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
  44897. }
  44898. return this.finishOp(types.coalesce, 2)
  44899. }
  44900. }
  44901. return this.finishOp(types.question, 1)
  44902. };
  44903. pp$9.getTokenFromCode = function(code) {
  44904. switch (code) {
  44905. // The interpretation of a dot depends on whether it is followed
  44906. // by a digit or another two dots.
  44907. case 46: // '.'
  44908. return this.readToken_dot()
  44909. // Punctuation tokens.
  44910. case 40: ++this.pos; return this.finishToken(types.parenL)
  44911. case 41: ++this.pos; return this.finishToken(types.parenR)
  44912. case 59: ++this.pos; return this.finishToken(types.semi)
  44913. case 44: ++this.pos; return this.finishToken(types.comma)
  44914. case 91: ++this.pos; return this.finishToken(types.bracketL)
  44915. case 93: ++this.pos; return this.finishToken(types.bracketR)
  44916. case 123: ++this.pos; return this.finishToken(types.braceL)
  44917. case 125: ++this.pos; return this.finishToken(types.braceR)
  44918. case 58: ++this.pos; return this.finishToken(types.colon)
  44919. case 96: // '`'
  44920. if (this.options.ecmaVersion < 6) { break }
  44921. ++this.pos;
  44922. return this.finishToken(types.backQuote)
  44923. case 48: // '0'
  44924. var next = this.input.charCodeAt(this.pos + 1);
  44925. if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number
  44926. if (this.options.ecmaVersion >= 6) {
  44927. if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number
  44928. if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number
  44929. }
  44930. // Anything else beginning with a digit is an integer, octal
  44931. // number, or float.
  44932. case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9
  44933. return this.readNumber(false)
  44934. // Quotes produce strings.
  44935. case 34: case 39: // '"', "'"
  44936. return this.readString(code)
  44937. // Operators are parsed inline in tiny state machines. '=' (61) is
  44938. // often referred to. `finishOp` simply skips the amount of
  44939. // characters it is given as second argument, and returns a token
  44940. // of the type given by its first argument.
  44941. case 47: // '/'
  44942. return this.readToken_slash()
  44943. case 37: case 42: // '%*'
  44944. return this.readToken_mult_modulo_exp(code)
  44945. case 124: case 38: // '|&'
  44946. return this.readToken_pipe_amp(code)
  44947. case 94: // '^'
  44948. return this.readToken_caret()
  44949. case 43: case 45: // '+-'
  44950. return this.readToken_plus_min(code)
  44951. case 60: case 62: // '<>'
  44952. return this.readToken_lt_gt(code)
  44953. case 61: case 33: // '=!'
  44954. return this.readToken_eq_excl(code)
  44955. case 63: // '?'
  44956. return this.readToken_question()
  44957. case 126: // '~'
  44958. return this.finishOp(types.prefix, 1)
  44959. }
  44960. this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
  44961. };
  44962. pp$9.finishOp = function(type, size) {
  44963. var str = this.input.slice(this.pos, this.pos + size);
  44964. this.pos += size;
  44965. return this.finishToken(type, str)
  44966. };
  44967. pp$9.readRegexp = function() {
  44968. var escaped, inClass, start = this.pos;
  44969. for (;;) {
  44970. if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
  44971. var ch = this.input.charAt(this.pos);
  44972. if (lineBreak.test(ch)) { this.raise(start, "Unterminated regular expression"); }
  44973. if (!escaped) {
  44974. if (ch === "[") { inClass = true; }
  44975. else if (ch === "]" && inClass) { inClass = false; }
  44976. else if (ch === "/" && !inClass) { break }
  44977. escaped = ch === "\\";
  44978. } else { escaped = false; }
  44979. ++this.pos;
  44980. }
  44981. var pattern = this.input.slice(start, this.pos);
  44982. ++this.pos;
  44983. var flagsStart = this.pos;
  44984. var flags = this.readWord1();
  44985. if (this.containsEsc) { this.unexpected(flagsStart); }
  44986. // Validate pattern
  44987. var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
  44988. state.reset(start, pattern, flags);
  44989. this.validateRegExpFlags(state);
  44990. this.validateRegExpPattern(state);
  44991. // Create Literal#value property value.
  44992. var value = null;
  44993. try {
  44994. value = new RegExp(pattern, flags);
  44995. } catch (e) {
  44996. // ESTree requires null if it failed to instantiate RegExp object.
  44997. // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
  44998. }
  44999. return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
  45000. };
  45001. // Read an integer in the given radix. Return null if zero digits
  45002. // were read, the integer value otherwise. When `len` is given, this
  45003. // will return `null` unless the integer has exactly `len` digits.
  45004. pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
  45005. // `len` is used for character escape sequences. In that case, disallow separators.
  45006. var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
  45007. // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
  45008. // and isn't fraction part nor exponent part. In that case, if the first digit
  45009. // is zero then disallow separators.
  45010. var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
  45011. var start = this.pos, total = 0, lastCode = 0;
  45012. for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
  45013. var code = this.input.charCodeAt(this.pos), val = (void 0);
  45014. if (allowSeparators && code === 95) {
  45015. if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); }
  45016. if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); }
  45017. if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); }
  45018. lastCode = code;
  45019. continue
  45020. }
  45021. if (code >= 97) { val = code - 97 + 10; } // a
  45022. else if (code >= 65) { val = code - 65 + 10; } // A
  45023. else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
  45024. else { val = Infinity; }
  45025. if (val >= radix) { break }
  45026. lastCode = code;
  45027. total = total * radix + val;
  45028. }
  45029. if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); }
  45030. if (this.pos === start || len != null && this.pos - start !== len) { return null }
  45031. return total
  45032. };
  45033. function stringToNumber(str, isLegacyOctalNumericLiteral) {
  45034. if (isLegacyOctalNumericLiteral) {
  45035. return parseInt(str, 8)
  45036. }
  45037. // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
  45038. return parseFloat(str.replace(/_/g, ""))
  45039. }
  45040. function stringToBigInt(str) {
  45041. if (typeof BigInt !== "function") {
  45042. return null
  45043. }
  45044. // `BigInt(value)` throws syntax error if the string contains numeric separators.
  45045. return BigInt(str.replace(/_/g, ""))
  45046. }
  45047. pp$9.readRadixNumber = function(radix) {
  45048. var start = this.pos;
  45049. this.pos += 2; // 0x
  45050. var val = this.readInt(radix);
  45051. if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
  45052. if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
  45053. val = stringToBigInt(this.input.slice(start, this.pos));
  45054. ++this.pos;
  45055. } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
  45056. return this.finishToken(types.num, val)
  45057. };
  45058. // Read an integer, octal integer, or floating-point number.
  45059. pp$9.readNumber = function(startsWithDot) {
  45060. var start = this.pos;
  45061. if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
  45062. var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
  45063. if (octal && this.strict) { this.raise(start, "Invalid number"); }
  45064. var next = this.input.charCodeAt(this.pos);
  45065. if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
  45066. var val$1 = stringToBigInt(this.input.slice(start, this.pos));
  45067. ++this.pos;
  45068. if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
  45069. return this.finishToken(types.num, val$1)
  45070. }
  45071. if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
  45072. if (next === 46 && !octal) { // '.'
  45073. ++this.pos;
  45074. this.readInt(10);
  45075. next = this.input.charCodeAt(this.pos);
  45076. }
  45077. if ((next === 69 || next === 101) && !octal) { // 'eE'
  45078. next = this.input.charCodeAt(++this.pos);
  45079. if (next === 43 || next === 45) { ++this.pos; } // '+-'
  45080. if (this.readInt(10) === null) { this.raise(start, "Invalid number"); }
  45081. }
  45082. if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
  45083. var val = stringToNumber(this.input.slice(start, this.pos), octal);
  45084. return this.finishToken(types.num, val)
  45085. };
  45086. // Read a string value, interpreting backslash-escapes.
  45087. pp$9.readCodePoint = function() {
  45088. var ch = this.input.charCodeAt(this.pos), code;
  45089. if (ch === 123) { // '{'
  45090. if (this.options.ecmaVersion < 6) { this.unexpected(); }
  45091. var codePos = ++this.pos;
  45092. code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
  45093. ++this.pos;
  45094. if (code > 0x10FFFF) { this.invalidStringToken(codePos, "Code point out of bounds"); }
  45095. } else {
  45096. code = this.readHexChar(4);
  45097. }
  45098. return code
  45099. };
  45100. function codePointToString$1(code) {
  45101. // UTF-16 Decoding
  45102. if (code <= 0xFFFF) { return String.fromCharCode(code) }
  45103. code -= 0x10000;
  45104. return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
  45105. }
  45106. pp$9.readString = function(quote) {
  45107. var out = "", chunkStart = ++this.pos;
  45108. for (;;) {
  45109. if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
  45110. var ch = this.input.charCodeAt(this.pos);
  45111. if (ch === quote) { break }
  45112. if (ch === 92) { // '\'
  45113. out += this.input.slice(chunkStart, this.pos);
  45114. out += this.readEscapedChar(false);
  45115. chunkStart = this.pos;
  45116. } else {
  45117. if (isNewLine(ch, this.options.ecmaVersion >= 10)) { this.raise(this.start, "Unterminated string constant"); }
  45118. ++this.pos;
  45119. }
  45120. }
  45121. out += this.input.slice(chunkStart, this.pos++);
  45122. return this.finishToken(types.string, out)
  45123. };
  45124. // Reads template string tokens.
  45125. var INVALID_TEMPLATE_ESCAPE_ERROR = {};
  45126. pp$9.tryReadTemplateToken = function() {
  45127. this.inTemplateElement = true;
  45128. try {
  45129. this.readTmplToken();
  45130. } catch (err) {
  45131. if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
  45132. this.readInvalidTemplateToken();
  45133. } else {
  45134. throw err
  45135. }
  45136. }
  45137. this.inTemplateElement = false;
  45138. };
  45139. pp$9.invalidStringToken = function(position, message) {
  45140. if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
  45141. throw INVALID_TEMPLATE_ESCAPE_ERROR
  45142. } else {
  45143. this.raise(position, message);
  45144. }
  45145. };
  45146. pp$9.readTmplToken = function() {
  45147. var out = "", chunkStart = this.pos;
  45148. for (;;) {
  45149. if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
  45150. var ch = this.input.charCodeAt(this.pos);
  45151. if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
  45152. if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
  45153. if (ch === 36) {
  45154. this.pos += 2;
  45155. return this.finishToken(types.dollarBraceL)
  45156. } else {
  45157. ++this.pos;
  45158. return this.finishToken(types.backQuote)
  45159. }
  45160. }
  45161. out += this.input.slice(chunkStart, this.pos);
  45162. return this.finishToken(types.template, out)
  45163. }
  45164. if (ch === 92) { // '\'
  45165. out += this.input.slice(chunkStart, this.pos);
  45166. out += this.readEscapedChar(true);
  45167. chunkStart = this.pos;
  45168. } else if (isNewLine(ch)) {
  45169. out += this.input.slice(chunkStart, this.pos);
  45170. ++this.pos;
  45171. switch (ch) {
  45172. case 13:
  45173. if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }
  45174. case 10:
  45175. out += "\n";
  45176. break
  45177. default:
  45178. out += String.fromCharCode(ch);
  45179. break
  45180. }
  45181. if (this.options.locations) {
  45182. ++this.curLine;
  45183. this.lineStart = this.pos;
  45184. }
  45185. chunkStart = this.pos;
  45186. } else {
  45187. ++this.pos;
  45188. }
  45189. }
  45190. };
  45191. // Reads a template token to search for the end, without validating any escape sequences
  45192. pp$9.readInvalidTemplateToken = function() {
  45193. for (; this.pos < this.input.length; this.pos++) {
  45194. switch (this.input[this.pos]) {
  45195. case "\\":
  45196. ++this.pos;
  45197. break
  45198. case "$":
  45199. if (this.input[this.pos + 1] !== "{") {
  45200. break
  45201. }
  45202. // falls through
  45203. case "`":
  45204. return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
  45205. // no default
  45206. }
  45207. }
  45208. this.raise(this.start, "Unterminated template");
  45209. };
  45210. // Used to read escaped characters
  45211. pp$9.readEscapedChar = function(inTemplate) {
  45212. var ch = this.input.charCodeAt(++this.pos);
  45213. ++this.pos;
  45214. switch (ch) {
  45215. case 110: return "\n" // 'n' -> '\n'
  45216. case 114: return "\r" // 'r' -> '\r'
  45217. case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
  45218. case 117: return codePointToString$1(this.readCodePoint()) // 'u'
  45219. case 116: return "\t" // 't' -> '\t'
  45220. case 98: return "\b" // 'b' -> '\b'
  45221. case 118: return "\u000b" // 'v' -> '\u000b'
  45222. case 102: return "\f" // 'f' -> '\f'
  45223. case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\r\n'
  45224. case 10: // ' \n'
  45225. if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
  45226. return ""
  45227. case 56:
  45228. case 57:
  45229. if (this.strict) {
  45230. this.invalidStringToken(
  45231. this.pos - 1,
  45232. "Invalid escape sequence"
  45233. );
  45234. }
  45235. if (inTemplate) {
  45236. var codePos = this.pos - 1;
  45237. this.invalidStringToken(
  45238. codePos,
  45239. "Invalid escape sequence in template string"
  45240. );
  45241. return null
  45242. }
  45243. default:
  45244. if (ch >= 48 && ch <= 55) {
  45245. var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
  45246. var octal = parseInt(octalStr, 8);
  45247. if (octal > 255) {
  45248. octalStr = octalStr.slice(0, -1);
  45249. octal = parseInt(octalStr, 8);
  45250. }
  45251. this.pos += octalStr.length - 1;
  45252. ch = this.input.charCodeAt(this.pos);
  45253. if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
  45254. this.invalidStringToken(
  45255. this.pos - 1 - octalStr.length,
  45256. inTemplate
  45257. ? "Octal literal in template string"
  45258. : "Octal literal in strict mode"
  45259. );
  45260. }
  45261. return String.fromCharCode(octal)
  45262. }
  45263. if (isNewLine(ch)) {
  45264. // Unicode new line characters after \ get removed from output in both
  45265. // template literals and strings
  45266. return ""
  45267. }
  45268. return String.fromCharCode(ch)
  45269. }
  45270. };
  45271. // Used to read character escape sequences ('\x', '\u', '\U').
  45272. pp$9.readHexChar = function(len) {
  45273. var codePos = this.pos;
  45274. var n = this.readInt(16, len);
  45275. if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
  45276. return n
  45277. };
  45278. // Read an identifier, and return it as a string. Sets `this.containsEsc`
  45279. // to whether the word contained a '\u' escape.
  45280. //
  45281. // Incrementally adds only escaped chars, adding other chunks as-is
  45282. // as a micro-optimization.
  45283. pp$9.readWord1 = function() {
  45284. this.containsEsc = false;
  45285. var word = "", first = true, chunkStart = this.pos;
  45286. var astral = this.options.ecmaVersion >= 6;
  45287. while (this.pos < this.input.length) {
  45288. var ch = this.fullCharCodeAtPos();
  45289. if (isIdentifierChar(ch, astral)) {
  45290. this.pos += ch <= 0xffff ? 1 : 2;
  45291. } else if (ch === 92) { // "\"
  45292. this.containsEsc = true;
  45293. word += this.input.slice(chunkStart, this.pos);
  45294. var escStart = this.pos;
  45295. if (this.input.charCodeAt(++this.pos) !== 117) // "u"
  45296. { this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); }
  45297. ++this.pos;
  45298. var esc = this.readCodePoint();
  45299. if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
  45300. { this.invalidStringToken(escStart, "Invalid Unicode escape"); }
  45301. word += codePointToString$1(esc);
  45302. chunkStart = this.pos;
  45303. } else {
  45304. break
  45305. }
  45306. first = false;
  45307. }
  45308. return word + this.input.slice(chunkStart, this.pos)
  45309. };
  45310. // Read an identifier or keyword token. Will check for reserved
  45311. // words when necessary.
  45312. pp$9.readWord = function() {
  45313. var word = this.readWord1();
  45314. var type = types.name;
  45315. if (this.keywords.test(word)) {
  45316. type = keywords$1[word];
  45317. }
  45318. return this.finishToken(type, word)
  45319. };
  45320. // Acorn is a tiny, fast JavaScript parser written in JavaScript.
  45321. var version = "8.0.5";
  45322. Parser.acorn = {
  45323. Parser: Parser,
  45324. version: version,
  45325. defaultOptions: defaultOptions,
  45326. Position: Position,
  45327. SourceLocation: SourceLocation,
  45328. getLineInfo: getLineInfo,
  45329. Node: Node,
  45330. TokenType: TokenType,
  45331. tokTypes: types,
  45332. keywordTypes: keywords$1,
  45333. TokContext: TokContext,
  45334. tokContexts: types$1,
  45335. isIdentifierChar: isIdentifierChar,
  45336. isIdentifierStart: isIdentifierStart,
  45337. Token: Token,
  45338. isNewLine: isNewLine,
  45339. lineBreak: lineBreak,
  45340. lineBreakG: lineBreakG,
  45341. nonASCIIwhitespace: nonASCIIwhitespace
  45342. };
  45343. // The main exported interface (under `self.acorn` when in the
  45344. // browser) is a `parse` function that takes a code string and
  45345. // returns an abstract syntax tree as specified by [Mozilla parser
  45346. // API][api].
  45347. //
  45348. // [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
  45349. function parse(input, options) {
  45350. return Parser.parse(input, options)
  45351. }
  45352. // This function tries to parse a single expression at a given
  45353. // offset in a string. Useful for parsing mixed-language formats
  45354. // that embed JavaScript expressions.
  45355. function parseExpressionAt(input, pos, options) {
  45356. return Parser.parseExpressionAt(input, pos, options)
  45357. }
  45358. // Acorn is organized as a tokenizer and a recursive-descent parser.
  45359. // The `tokenizer` export provides an interface to the tokenizer.
  45360. function tokenizer(input, options) {
  45361. return Parser.tokenizer(input, options)
  45362. }
  45363. var acorn = {
  45364. __proto__: null,
  45365. Node: Node,
  45366. Parser: Parser,
  45367. Position: Position,
  45368. SourceLocation: SourceLocation,
  45369. TokContext: TokContext,
  45370. Token: Token,
  45371. TokenType: TokenType,
  45372. defaultOptions: defaultOptions,
  45373. getLineInfo: getLineInfo,
  45374. isIdentifierChar: isIdentifierChar,
  45375. isIdentifierStart: isIdentifierStart,
  45376. isNewLine: isNewLine,
  45377. keywordTypes: keywords$1,
  45378. lineBreak: lineBreak,
  45379. lineBreakG: lineBreakG,
  45380. nonASCIIwhitespace: nonASCIIwhitespace,
  45381. parse: parse,
  45382. parseExpressionAt: parseExpressionAt,
  45383. tokContexts: types$1,
  45384. tokTypes: types,
  45385. tokenizer: tokenizer,
  45386. version: version
  45387. };
  45388. class GlobalScope extends Scope$1 {
  45389. constructor() {
  45390. super();
  45391. this.variables.set('undefined', new UndefinedVariable());
  45392. }
  45393. findVariable(name) {
  45394. let variable = this.variables.get(name);
  45395. if (!variable) {
  45396. variable = new GlobalVariable(name);
  45397. this.variables.set(name, variable);
  45398. }
  45399. return variable;
  45400. }
  45401. }
  45402. const readFile = (file) => new Promise((fulfil, reject) => readFile$2(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
  45403. function mkdirpath(path) {
  45404. const dir = dirname(path);
  45405. try {
  45406. readdirSync(dir);
  45407. }
  45408. catch (err) {
  45409. mkdirpath(dir);
  45410. try {
  45411. mkdirSync(dir);
  45412. }
  45413. catch (err2) {
  45414. if (err2.code !== 'EEXIST') {
  45415. throw err2;
  45416. }
  45417. }
  45418. }
  45419. }
  45420. function writeFile(dest, data) {
  45421. return new Promise((fulfil, reject) => {
  45422. mkdirpath(dest);
  45423. writeFile$1(dest, data, err => {
  45424. if (err) {
  45425. reject(err);
  45426. }
  45427. else {
  45428. fulfil();
  45429. }
  45430. });
  45431. });
  45432. }
  45433. function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
  45434. let skipped = null;
  45435. let replaceContext = null;
  45436. if (skip) {
  45437. skipped = new Set();
  45438. for (const skippedCall of skip) {
  45439. if (source === skippedCall.source && importer === skippedCall.importer) {
  45440. skipped.add(skippedCall.plugin);
  45441. }
  45442. }
  45443. replaceContext = (pluginContext, plugin) => ({
  45444. ...pluginContext,
  45445. resolve: (source, importer, { custom, skipSelf } = BLANK) => {
  45446. return moduleLoaderResolveId(source, importer, custom, skipSelf ? [...skip, { importer, plugin, source }] : skip);
  45447. }
  45448. });
  45449. }
  45450. return pluginDriver.hookFirst('resolveId', [source, importer, { custom: customOptions }], replaceContext, skipped);
  45451. }
  45452. async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
  45453. const pluginResult = await resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions);
  45454. if (pluginResult != null)
  45455. return pluginResult;
  45456. // external modules (non-entry modules that start with neither '.' or '/')
  45457. // are skipped at this stage.
  45458. if (importer !== undefined && !isAbsolute(source) && source[0] !== '.')
  45459. return null;
  45460. // `resolve` processes paths from right to left, prepending them until an
  45461. // absolute path is created. Absolute importees therefore shortcircuit the
  45462. // resolve call and require no special handing on our part.
  45463. // See https://nodejs.org/api/path.html#path_path_resolve_paths
  45464. return addJsExtensionIfNecessary(importer ? resolve$1(dirname(importer), source) : resolve$1(source), preserveSymlinks);
  45465. }
  45466. function addJsExtensionIfNecessary(file, preserveSymlinks) {
  45467. let found = findFile(file, preserveSymlinks);
  45468. if (found)
  45469. return found;
  45470. found = findFile(file + '.mjs', preserveSymlinks);
  45471. if (found)
  45472. return found;
  45473. found = findFile(file + '.js', preserveSymlinks);
  45474. return found;
  45475. }
  45476. function findFile(file, preserveSymlinks) {
  45477. try {
  45478. const stats = lstatSync(file);
  45479. if (!preserveSymlinks && stats.isSymbolicLink())
  45480. return findFile(realpathSync$2(file), preserveSymlinks);
  45481. if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
  45482. // check case
  45483. const name = basename(file);
  45484. const files = readdirSync(dirname(file));
  45485. if (files.indexOf(name) !== -1)
  45486. return file;
  45487. }
  45488. }
  45489. catch (_a) {
  45490. // suppress
  45491. }
  45492. }
  45493. const ANONYMOUS_PLUGIN_PREFIX = 'at position ';
  45494. const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = 'at output position ';
  45495. function throwPluginError(err, plugin, { hook, id } = {}) {
  45496. if (typeof err === 'string')
  45497. err = { message: err };
  45498. if (err.code && err.code !== Errors.PLUGIN_ERROR) {
  45499. err.pluginCode = err.code;
  45500. }
  45501. err.code = Errors.PLUGIN_ERROR;
  45502. err.plugin = plugin;
  45503. if (hook) {
  45504. err.hook = hook;
  45505. }
  45506. if (id) {
  45507. err.id = id;
  45508. }
  45509. return error(err);
  45510. }
  45511. const deprecatedHooks = [
  45512. { active: true, deprecated: 'resolveAssetUrl', replacement: 'resolveFileUrl' }
  45513. ];
  45514. function warnDeprecatedHooks(plugins, options) {
  45515. for (const { active, deprecated, replacement } of deprecatedHooks) {
  45516. for (const plugin of plugins) {
  45517. if (deprecated in plugin) {
  45518. warnDeprecation({
  45519. message: `The "${deprecated}" hook used by plugin ${plugin.name} is deprecated. The "${replacement}" hook should be used instead.`,
  45520. plugin: plugin.name
  45521. }, active, options);
  45522. }
  45523. }
  45524. }
  45525. }
  45526. function createPluginCache(cache) {
  45527. return {
  45528. has(id) {
  45529. const item = cache[id];
  45530. if (!item)
  45531. return false;
  45532. item[0] = 0;
  45533. return true;
  45534. },
  45535. get(id) {
  45536. const item = cache[id];
  45537. if (!item)
  45538. return undefined;
  45539. item[0] = 0;
  45540. return item[1];
  45541. },
  45542. set(id, value) {
  45543. cache[id] = [0, value];
  45544. },
  45545. delete(id) {
  45546. return delete cache[id];
  45547. }
  45548. };
  45549. }
  45550. function getTrackedPluginCache(pluginCache, onUse) {
  45551. return {
  45552. has(id) {
  45553. onUse();
  45554. return pluginCache.has(id);
  45555. },
  45556. get(id) {
  45557. onUse();
  45558. return pluginCache.get(id);
  45559. },
  45560. set(id, value) {
  45561. onUse();
  45562. return pluginCache.set(id, value);
  45563. },
  45564. delete(id) {
  45565. onUse();
  45566. return pluginCache.delete(id);
  45567. }
  45568. };
  45569. }
  45570. const NO_CACHE = {
  45571. has() {
  45572. return false;
  45573. },
  45574. get() {
  45575. return undefined;
  45576. },
  45577. set() { },
  45578. delete() {
  45579. return false;
  45580. }
  45581. };
  45582. function uncacheablePluginError(pluginName) {
  45583. if (pluginName.startsWith(ANONYMOUS_PLUGIN_PREFIX) ||
  45584. pluginName.startsWith(ANONYMOUS_OUTPUT_PLUGIN_PREFIX)) {
  45585. return error({
  45586. code: 'ANONYMOUS_PLUGIN_CACHE',
  45587. message: 'A plugin is trying to use the Rollup cache but is not declaring a plugin name or cacheKey.'
  45588. });
  45589. }
  45590. return error({
  45591. code: 'DUPLICATE_PLUGIN_NAME',
  45592. message: `The plugin name ${pluginName} is being used twice in the same build. Plugin names must be distinct or provide a cacheKey (please post an issue to the plugin if you are a plugin user).`
  45593. });
  45594. }
  45595. function getCacheForUncacheablePlugin(pluginName) {
  45596. return {
  45597. has() {
  45598. return uncacheablePluginError(pluginName);
  45599. },
  45600. get() {
  45601. return uncacheablePluginError(pluginName);
  45602. },
  45603. set() {
  45604. return uncacheablePluginError(pluginName);
  45605. },
  45606. delete() {
  45607. return uncacheablePluginError(pluginName);
  45608. }
  45609. };
  45610. }
  45611. function transform(source, module, pluginDriver, warn) {
  45612. const id = module.id;
  45613. const sourcemapChain = [];
  45614. let originalSourcemap = source.map === null ? null : decodedSourcemap(source.map);
  45615. const originalCode = source.code;
  45616. let ast = source.ast;
  45617. const transformDependencies = [];
  45618. const emittedFiles = [];
  45619. let customTransformCache = false;
  45620. const useCustomTransformCache = () => (customTransformCache = true);
  45621. let curPlugin;
  45622. const curSource = source.code;
  45623. function transformReducer(previousCode, result, plugin) {
  45624. let code;
  45625. let map;
  45626. if (typeof result === 'string') {
  45627. code = result;
  45628. }
  45629. else if (result && typeof result === 'object') {
  45630. module.updateOptions(result);
  45631. if (result.code == null) {
  45632. if (result.map || result.ast) {
  45633. warn(errNoTransformMapOrAstWithoutCode(plugin.name));
  45634. }
  45635. return previousCode;
  45636. }
  45637. ({ code, map, ast } = result);
  45638. }
  45639. else {
  45640. return previousCode;
  45641. }
  45642. // strict null check allows 'null' maps to not be pushed to the chain,
  45643. // while 'undefined' gets the missing map warning
  45644. if (map !== null) {
  45645. sourcemapChain.push(decodedSourcemap(typeof map === 'string' ? JSON.parse(map) : map) || {
  45646. missing: true,
  45647. plugin: plugin.name
  45648. });
  45649. }
  45650. return code;
  45651. }
  45652. return pluginDriver
  45653. .hookReduceArg0('transform', [curSource, id], transformReducer, (pluginContext, plugin) => {
  45654. curPlugin = plugin;
  45655. return {
  45656. ...pluginContext,
  45657. cache: customTransformCache
  45658. ? pluginContext.cache
  45659. : getTrackedPluginCache(pluginContext.cache, useCustomTransformCache),
  45660. warn(warning, pos) {
  45661. if (typeof warning === 'string')
  45662. warning = { message: warning };
  45663. if (pos)
  45664. augmentCodeLocation(warning, pos, curSource, id);
  45665. warning.id = id;
  45666. warning.hook = 'transform';
  45667. pluginContext.warn(warning);
  45668. },
  45669. error(err, pos) {
  45670. if (typeof err === 'string')
  45671. err = { message: err };
  45672. if (pos)
  45673. augmentCodeLocation(err, pos, curSource, id);
  45674. err.id = id;
  45675. err.hook = 'transform';
  45676. return pluginContext.error(err);
  45677. },
  45678. emitAsset(name, source) {
  45679. emittedFiles.push({ type: 'asset', name, source });
  45680. return pluginContext.emitAsset(name, source);
  45681. },
  45682. emitChunk(id, options) {
  45683. emittedFiles.push({ type: 'chunk', id, name: options && options.name });
  45684. return pluginContext.emitChunk(id, options);
  45685. },
  45686. emitFile(emittedFile) {
  45687. emittedFiles.push(emittedFile);
  45688. return pluginDriver.emitFile(emittedFile);
  45689. },
  45690. addWatchFile(id) {
  45691. transformDependencies.push(id);
  45692. pluginContext.addWatchFile(id);
  45693. },
  45694. setAssetSource() {
  45695. return this.error({
  45696. code: 'INVALID_SETASSETSOURCE',
  45697. message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
  45698. });
  45699. },
  45700. getCombinedSourcemap() {
  45701. const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
  45702. if (!combinedMap) {
  45703. const magicString = new MagicString(originalCode);
  45704. return magicString.generateMap({ includeContent: true, hires: true, source: id });
  45705. }
  45706. if (originalSourcemap !== combinedMap) {
  45707. originalSourcemap = combinedMap;
  45708. sourcemapChain.length = 0;
  45709. }
  45710. return new SourceMap({
  45711. ...combinedMap,
  45712. file: null,
  45713. sourcesContent: combinedMap.sourcesContent
  45714. });
  45715. }
  45716. };
  45717. })
  45718. .catch(err => throwPluginError(err, curPlugin.name, { hook: 'transform', id }))
  45719. .then(code => {
  45720. if (!customTransformCache) {
  45721. // files emitted by a transform hook need to be emitted again if the hook is skipped
  45722. if (emittedFiles.length)
  45723. module.transformFiles = emittedFiles;
  45724. }
  45725. return {
  45726. ast,
  45727. code,
  45728. customTransformCache,
  45729. meta: module.info.meta,
  45730. originalCode,
  45731. originalSourcemap,
  45732. sourcemapChain,
  45733. transformDependencies
  45734. };
  45735. });
  45736. }
  45737. class ModuleLoader {
  45738. constructor(graph, modulesById, options, pluginDriver) {
  45739. this.graph = graph;
  45740. this.modulesById = modulesById;
  45741. this.options = options;
  45742. this.pluginDriver = pluginDriver;
  45743. this.implicitEntryModules = new Set();
  45744. this.indexedEntryModules = [];
  45745. this.latestLoadModulesPromise = Promise.resolve();
  45746. this.nextEntryModuleIndex = 0;
  45747. this.resolveId = async (source, importer, customOptions, skip = null) => {
  45748. return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
  45749. ? false
  45750. : await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions), importer, source));
  45751. };
  45752. this.hasModuleSideEffects = options.treeshake
  45753. ? options.treeshake.moduleSideEffects
  45754. : () => true;
  45755. }
  45756. async addAdditionalModules(unresolvedModules) {
  45757. const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
  45758. await this.awaitLoadModulesPromise();
  45759. return result;
  45760. }
  45761. async addEntryModules(unresolvedEntryModules, isUserDefined) {
  45762. const firstEntryModuleIndex = this.nextEntryModuleIndex;
  45763. this.nextEntryModuleIndex += unresolvedEntryModules.length;
  45764. const newEntryModules = await this.extendLoadModulesPromise(Promise.all(unresolvedEntryModules.map(({ id, importer }) => this.loadEntryModule(id, true, importer, null))).then(entryModules => {
  45765. let moduleIndex = firstEntryModuleIndex;
  45766. for (let index = 0; index < entryModules.length; index++) {
  45767. const entryModule = entryModules[index];
  45768. entryModule.isUserDefinedEntryPoint =
  45769. entryModule.isUserDefinedEntryPoint || isUserDefined;
  45770. addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined);
  45771. const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
  45772. if (!existingIndexedModule) {
  45773. this.indexedEntryModules.push({ module: entryModule, index: moduleIndex });
  45774. }
  45775. else {
  45776. existingIndexedModule.index = Math.min(existingIndexedModule.index, moduleIndex);
  45777. }
  45778. moduleIndex++;
  45779. }
  45780. this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
  45781. return entryModules;
  45782. }));
  45783. await this.awaitLoadModulesPromise();
  45784. return {
  45785. entryModules: this.indexedEntryModules.map(({ module }) => module),
  45786. implicitEntryModules: [...this.implicitEntryModules],
  45787. newEntryModules
  45788. };
  45789. }
  45790. async emitChunk({ fileName, id, importer, name, implicitlyLoadedAfterOneOf, preserveSignature }) {
  45791. const unresolvedModule = {
  45792. fileName: fileName || null,
  45793. id,
  45794. importer,
  45795. name: name || null
  45796. };
  45797. const module = implicitlyLoadedAfterOneOf
  45798. ? await this.addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfterOneOf)
  45799. : (await this.addEntryModules([unresolvedModule], false)).newEntryModules[0];
  45800. if (preserveSignature != null) {
  45801. module.preserveSignature = preserveSignature;
  45802. }
  45803. return module;
  45804. }
  45805. addDefaultsToResolvedId(resolvedId) {
  45806. var _a, _b;
  45807. if (!resolvedId) {
  45808. return null;
  45809. }
  45810. const external = resolvedId.external || false;
  45811. return {
  45812. external,
  45813. id: resolvedId.id,
  45814. meta: resolvedId.meta || EMPTY_OBJECT,
  45815. moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, external),
  45816. syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
  45817. };
  45818. }
  45819. addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfter) {
  45820. return this.extendLoadModulesPromise(this.loadEntryModule(unresolvedModule.id, false, unresolvedModule.importer, null).then(async (entryModule) => {
  45821. addChunkNamesToModule(entryModule, unresolvedModule, false);
  45822. if (!entryModule.info.isEntry) {
  45823. this.implicitEntryModules.add(entryModule);
  45824. const implicitlyLoadedAfterModules = await Promise.all(implicitlyLoadedAfter.map(id => this.loadEntryModule(id, false, unresolvedModule.importer, entryModule.id)));
  45825. for (const module of implicitlyLoadedAfterModules) {
  45826. entryModule.implicitlyLoadedAfter.add(module);
  45827. }
  45828. for (const dependant of entryModule.implicitlyLoadedAfter) {
  45829. dependant.implicitlyLoadedBefore.add(entryModule);
  45830. }
  45831. }
  45832. return entryModule;
  45833. }));
  45834. }
  45835. async addModuleSource(id, importer, module) {
  45836. var _a;
  45837. timeStart('load modules', 3);
  45838. let source;
  45839. try {
  45840. source = (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id));
  45841. }
  45842. catch (err) {
  45843. timeEnd('load modules', 3);
  45844. let msg = `Could not load ${id}`;
  45845. if (importer)
  45846. msg += ` (imported by ${relativeId(importer)})`;
  45847. msg += `: ${err.message}`;
  45848. err.message = msg;
  45849. throw err;
  45850. }
  45851. timeEnd('load modules', 3);
  45852. const sourceDescription = typeof source === 'string'
  45853. ? { code: source }
  45854. : typeof source === 'object' && typeof source.code === 'string'
  45855. ? source
  45856. : error(errBadLoader(id));
  45857. const cachedModule = this.graph.cachedModules.get(id);
  45858. if (cachedModule &&
  45859. !cachedModule.customTransformCache &&
  45860. cachedModule.originalCode === sourceDescription.code) {
  45861. if (cachedModule.transformFiles) {
  45862. for (const emittedFile of cachedModule.transformFiles)
  45863. this.pluginDriver.emitFile(emittedFile);
  45864. }
  45865. module.setSource(cachedModule);
  45866. }
  45867. else {
  45868. module.updateOptions(sourceDescription);
  45869. module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onwarn));
  45870. }
  45871. }
  45872. async awaitLoadModulesPromise() {
  45873. let startingPromise;
  45874. do {
  45875. startingPromise = this.latestLoadModulesPromise;
  45876. await startingPromise;
  45877. } while (startingPromise !== this.latestLoadModulesPromise);
  45878. }
  45879. extendLoadModulesPromise(loadNewModulesPromise) {
  45880. this.latestLoadModulesPromise = Promise.all([
  45881. loadNewModulesPromise,
  45882. this.latestLoadModulesPromise
  45883. ]);
  45884. this.latestLoadModulesPromise.catch(() => {
  45885. /* Avoid unhandled Promise rejections */
  45886. });
  45887. return loadNewModulesPromise;
  45888. }
  45889. async fetchDynamicDependencies(module) {
  45890. const dependencies = await Promise.all(module.dynamicImports.map(async (dynamicImport) => {
  45891. const resolvedId = await this.resolveDynamicImport(module, typeof dynamicImport.argument === 'string'
  45892. ? dynamicImport.argument
  45893. : dynamicImport.argument.esTreeNode, module.id);
  45894. if (resolvedId === null)
  45895. return null;
  45896. if (typeof resolvedId === 'string') {
  45897. dynamicImport.resolution = resolvedId;
  45898. return null;
  45899. }
  45900. return (dynamicImport.resolution = await this.fetchResolvedDependency(relativeId(resolvedId.id), module.id, resolvedId));
  45901. }));
  45902. for (const dependency of dependencies) {
  45903. if (dependency) {
  45904. module.dynamicDependencies.add(dependency);
  45905. dependency.dynamicImporters.push(module.id);
  45906. }
  45907. }
  45908. }
  45909. async fetchModule({ id, meta, moduleSideEffects, syntheticNamedExports }, importer, isEntry) {
  45910. const existingModule = this.modulesById.get(id);
  45911. if (existingModule instanceof Module) {
  45912. if (isEntry) {
  45913. existingModule.info.isEntry = true;
  45914. this.implicitEntryModules.delete(existingModule);
  45915. for (const dependant of existingModule.implicitlyLoadedAfter) {
  45916. dependant.implicitlyLoadedBefore.delete(existingModule);
  45917. }
  45918. existingModule.implicitlyLoadedAfter.clear();
  45919. }
  45920. return existingModule;
  45921. }
  45922. const module = new Module(this.graph, id, this.options, isEntry, moduleSideEffects, syntheticNamedExports, meta);
  45923. this.modulesById.set(id, module);
  45924. this.graph.watchFiles[id] = true;
  45925. await this.addModuleSource(id, importer, module);
  45926. await this.pluginDriver.hookParallel('moduleParsed', [module.info]);
  45927. await Promise.all([
  45928. this.fetchStaticDependencies(module),
  45929. this.fetchDynamicDependencies(module)
  45930. ]);
  45931. module.linkImports();
  45932. return module;
  45933. }
  45934. fetchResolvedDependency(source, importer, resolvedId) {
  45935. if (resolvedId.external) {
  45936. if (!this.modulesById.has(resolvedId.id)) {
  45937. this.modulesById.set(resolvedId.id, new ExternalModule(this.options, resolvedId.id, resolvedId.moduleSideEffects, resolvedId.meta));
  45938. }
  45939. const externalModule = this.modulesById.get(resolvedId.id);
  45940. if (!(externalModule instanceof ExternalModule)) {
  45941. return error(errInternalIdCannotBeExternal(source, importer));
  45942. }
  45943. return Promise.resolve(externalModule);
  45944. }
  45945. else {
  45946. return this.fetchModule(resolvedId, importer, false);
  45947. }
  45948. }
  45949. async fetchStaticDependencies(module) {
  45950. for (const dependency of await Promise.all(Array.from(module.sources, async (source) => this.fetchResolvedDependency(source, module.id, (module.resolvedIds[source] =
  45951. module.resolvedIds[source] ||
  45952. this.handleResolveId(await this.resolveId(source, module.id, EMPTY_OBJECT), source, module.id)))))) {
  45953. module.dependencies.add(dependency);
  45954. dependency.importers.push(module.id);
  45955. }
  45956. }
  45957. getNormalizedResolvedIdWithoutDefaults(resolveIdResult, importer, source) {
  45958. if (resolveIdResult) {
  45959. if (typeof resolveIdResult === 'object') {
  45960. return {
  45961. ...resolveIdResult,
  45962. external: resolveIdResult.external || this.options.external(resolveIdResult.id, importer, true)
  45963. };
  45964. }
  45965. const external = this.options.external(resolveIdResult, importer, true);
  45966. return {
  45967. external,
  45968. id: external ? normalizeRelativeExternalId(resolveIdResult, importer) : resolveIdResult
  45969. };
  45970. }
  45971. const id = normalizeRelativeExternalId(source, importer);
  45972. if (resolveIdResult !== false && !this.options.external(id, importer, true)) {
  45973. return null;
  45974. }
  45975. return {
  45976. external: true,
  45977. id
  45978. };
  45979. }
  45980. handleResolveId(resolvedId, source, importer) {
  45981. if (resolvedId === null) {
  45982. if (isRelative(source)) {
  45983. return error(errUnresolvedImport(source, importer));
  45984. }
  45985. this.options.onwarn(errUnresolvedImportTreatedAsExternal(source, importer));
  45986. return {
  45987. external: true,
  45988. id: source,
  45989. meta: EMPTY_OBJECT,
  45990. moduleSideEffects: this.hasModuleSideEffects(source, true),
  45991. syntheticNamedExports: false
  45992. };
  45993. }
  45994. else {
  45995. if (resolvedId.external && resolvedId.syntheticNamedExports) {
  45996. this.options.onwarn(errExternalSyntheticExports(source, importer));
  45997. }
  45998. }
  45999. return resolvedId;
  46000. }
  46001. async loadEntryModule(unresolvedId, isEntry, importer, implicitlyLoadedBefore) {
  46002. const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, EMPTY_OBJECT);
  46003. if (resolveIdResult == null) {
  46004. return error(implicitlyLoadedBefore === null
  46005. ? errUnresolvedEntry(unresolvedId)
  46006. : errUnresolvedImplicitDependant(unresolvedId, implicitlyLoadedBefore));
  46007. }
  46008. if (resolveIdResult === false ||
  46009. (typeof resolveIdResult === 'object' && resolveIdResult.external)) {
  46010. return error(implicitlyLoadedBefore === null
  46011. ? errEntryCannotBeExternal(unresolvedId)
  46012. : errImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore));
  46013. }
  46014. return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object' ? resolveIdResult : { id: resolveIdResult }), undefined, isEntry);
  46015. }
  46016. async resolveDynamicImport(module, specifier, importer) {
  46017. const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
  46018. specifier,
  46019. importer
  46020. ]);
  46021. if (typeof specifier !== 'string') {
  46022. if (typeof resolution === 'string') {
  46023. return resolution;
  46024. }
  46025. if (!resolution) {
  46026. return null;
  46027. }
  46028. return {
  46029. external: false,
  46030. moduleSideEffects: true,
  46031. ...resolution
  46032. };
  46033. }
  46034. if (resolution == null) {
  46035. return (module.resolvedIds[specifier] =
  46036. module.resolvedIds[specifier] ||
  46037. this.handleResolveId(await this.resolveId(specifier, module.id, EMPTY_OBJECT), specifier, module.id));
  46038. }
  46039. return this.handleResolveId(this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier)), specifier, importer);
  46040. }
  46041. }
  46042. function normalizeRelativeExternalId(source, importer) {
  46043. return isRelative(source)
  46044. ? importer
  46045. ? resolve$1(importer, '..', source)
  46046. : resolve$1(source)
  46047. : source;
  46048. }
  46049. function addChunkNamesToModule(module, { fileName, name }, isUserDefined) {
  46050. if (fileName !== null) {
  46051. module.chunkFileNames.add(fileName);
  46052. }
  46053. else if (name !== null) {
  46054. if (module.chunkName === null) {
  46055. module.chunkName = name;
  46056. }
  46057. if (isUserDefined) {
  46058. module.userChunkNames.add(name);
  46059. }
  46060. }
  46061. }
  46062. function getDeprecatedContextHandler(handler, handlerName, newHandlerName, pluginName, activeDeprecation, options) {
  46063. let deprecationWarningShown = false;
  46064. return ((...args) => {
  46065. if (!deprecationWarningShown) {
  46066. deprecationWarningShown = true;
  46067. warnDeprecation({
  46068. message: `The "this.${handlerName}" plugin context function used by plugin ${pluginName} is deprecated. The "this.${newHandlerName}" plugin context function should be used instead.`,
  46069. plugin: pluginName
  46070. }, activeDeprecation, options);
  46071. }
  46072. return handler(...args);
  46073. });
  46074. }
  46075. function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, existingPluginNames) {
  46076. let cacheable = true;
  46077. if (typeof plugin.cacheKey !== 'string') {
  46078. if (plugin.name.startsWith(ANONYMOUS_PLUGIN_PREFIX) ||
  46079. plugin.name.startsWith(ANONYMOUS_OUTPUT_PLUGIN_PREFIX) ||
  46080. existingPluginNames.has(plugin.name)) {
  46081. cacheable = false;
  46082. }
  46083. else {
  46084. existingPluginNames.add(plugin.name);
  46085. }
  46086. }
  46087. let cacheInstance;
  46088. if (!pluginCache) {
  46089. cacheInstance = NO_CACHE;
  46090. }
  46091. else if (cacheable) {
  46092. const cacheKey = plugin.cacheKey || plugin.name;
  46093. cacheInstance = createPluginCache(pluginCache[cacheKey] || (pluginCache[cacheKey] = Object.create(null)));
  46094. }
  46095. else {
  46096. cacheInstance = getCacheForUncacheablePlugin(plugin.name);
  46097. }
  46098. const context = {
  46099. addWatchFile(id) {
  46100. if (graph.phase >= BuildPhase.GENERATE) {
  46101. return this.error(errInvalidRollupPhaseForAddWatchFile());
  46102. }
  46103. graph.watchFiles[id] = true;
  46104. },
  46105. cache: cacheInstance,
  46106. emitAsset: getDeprecatedContextHandler((name, source) => fileEmitter.emitFile({ type: 'asset', name, source }), 'emitAsset', 'emitFile', plugin.name, true, options),
  46107. emitChunk: getDeprecatedContextHandler((id, options) => fileEmitter.emitFile({ type: 'chunk', id, name: options && options.name }), 'emitChunk', 'emitFile', plugin.name, true, options),
  46108. emitFile: fileEmitter.emitFile,
  46109. error(err) {
  46110. return throwPluginError(err, plugin.name);
  46111. },
  46112. getAssetFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getAssetFileName', 'getFileName', plugin.name, true, options),
  46113. getChunkFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getChunkFileName', 'getFileName', plugin.name, true, options),
  46114. getFileName: fileEmitter.getFileName,
  46115. getModuleIds: () => graph.modulesById.keys(),
  46116. getModuleInfo: graph.getModuleInfo,
  46117. getWatchFiles: () => Object.keys(graph.watchFiles),
  46118. isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
  46119. meta: {
  46120. rollupVersion: version$1,
  46121. watchMode: graph.watchMode
  46122. },
  46123. get moduleIds() {
  46124. function* wrappedModuleIds() {
  46125. warnDeprecation({
  46126. message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
  46127. plugin: plugin.name
  46128. }, false, options);
  46129. yield* moduleIds;
  46130. }
  46131. const moduleIds = graph.modulesById.keys();
  46132. return wrappedModuleIds();
  46133. },
  46134. parse: graph.contextParse.bind(graph),
  46135. resolve(source, importer, { custom, skipSelf } = BLANK) {
  46136. return graph.moduleLoader.resolveId(source, importer, custom, skipSelf ? [{ importer, plugin, source }] : null);
  46137. },
  46138. resolveId: getDeprecatedContextHandler((source, importer) => graph.moduleLoader
  46139. .resolveId(source, importer, BLANK)
  46140. .then(resolveId => resolveId && resolveId.id), 'resolveId', 'resolve', plugin.name, true, options),
  46141. setAssetSource: fileEmitter.setAssetSource,
  46142. warn(warning) {
  46143. if (typeof warning === 'string')
  46144. warning = { message: warning };
  46145. if (warning.code)
  46146. warning.pluginCode = warning.code;
  46147. warning.code = 'PLUGIN_WARNING';
  46148. warning.plugin = plugin.name;
  46149. options.onwarn(warning);
  46150. }
  46151. };
  46152. return context;
  46153. }
  46154. const inputHookNames = {
  46155. buildEnd: 1,
  46156. buildStart: 1,
  46157. closeBundle: 1,
  46158. closeWatcher: 1,
  46159. load: 1,
  46160. moduleParsed: 1,
  46161. options: 1,
  46162. resolveDynamicImport: 1,
  46163. resolveId: 1,
  46164. transform: 1,
  46165. watchChange: 1
  46166. };
  46167. const inputHooks = Object.keys(inputHookNames);
  46168. function throwInvalidHookError(hookName, pluginName) {
  46169. return error({
  46170. code: 'INVALID_PLUGIN_HOOK',
  46171. message: `Error running plugin hook ${hookName} for ${pluginName}, expected a function hook.`
  46172. });
  46173. }
  46174. class PluginDriver {
  46175. constructor(graph, options, userPlugins, pluginCache, basePluginDriver) {
  46176. this.graph = graph;
  46177. this.options = options;
  46178. this.pluginContexts = new Map();
  46179. warnDeprecatedHooks(userPlugins, options);
  46180. this.pluginCache = pluginCache;
  46181. this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
  46182. this.emitFile = this.fileEmitter.emitFile;
  46183. this.getFileName = this.fileEmitter.getFileName;
  46184. this.finaliseAssets = this.fileEmitter.assertAssetsFinalized;
  46185. this.setOutputBundle = this.fileEmitter.setOutputBundle;
  46186. this.plugins = userPlugins.concat(basePluginDriver ? basePluginDriver.plugins : []);
  46187. const existingPluginNames = new Set();
  46188. for (const plugin of this.plugins) {
  46189. this.pluginContexts.set(plugin, getPluginContext(plugin, pluginCache, graph, options, this.fileEmitter, existingPluginNames));
  46190. }
  46191. if (basePluginDriver) {
  46192. for (const plugin of userPlugins) {
  46193. for (const hook of inputHooks) {
  46194. if (hook in plugin) {
  46195. options.onwarn(errInputHookInOutputPlugin(plugin.name, hook));
  46196. }
  46197. }
  46198. }
  46199. }
  46200. }
  46201. createOutputPluginDriver(plugins) {
  46202. return new PluginDriver(this.graph, this.options, plugins, this.pluginCache, this);
  46203. }
  46204. // chains, first non-null result stops and returns
  46205. hookFirst(hookName, args, replaceContext, skipped) {
  46206. let promise = Promise.resolve(undefined);
  46207. for (const plugin of this.plugins) {
  46208. if (skipped && skipped.has(plugin))
  46209. continue;
  46210. promise = promise.then(result => {
  46211. if (result != null)
  46212. return result;
  46213. return this.runHook(hookName, args, plugin, false, replaceContext);
  46214. });
  46215. }
  46216. return promise;
  46217. }
  46218. // chains synchronously, first non-null result stops and returns
  46219. hookFirstSync(hookName, args, replaceContext) {
  46220. for (const plugin of this.plugins) {
  46221. const result = this.runHookSync(hookName, args, plugin, replaceContext);
  46222. if (result != null)
  46223. return result;
  46224. }
  46225. return null;
  46226. }
  46227. // parallel, ignores returns
  46228. hookParallel(hookName, args, replaceContext) {
  46229. const promises = [];
  46230. for (const plugin of this.plugins) {
  46231. const hookPromise = this.runHook(hookName, args, plugin, false, replaceContext);
  46232. if (!hookPromise)
  46233. continue;
  46234. promises.push(hookPromise);
  46235. }
  46236. return Promise.all(promises).then(() => { });
  46237. }
  46238. // chains, reduces returned value, handling the reduced value as the first hook argument
  46239. hookReduceArg0(hookName, [arg0, ...rest], reduce, replaceContext) {
  46240. let promise = Promise.resolve(arg0);
  46241. for (const plugin of this.plugins) {
  46242. promise = promise.then(arg0 => {
  46243. const args = [arg0, ...rest];
  46244. const hookPromise = this.runHook(hookName, args, plugin, false, replaceContext);
  46245. if (!hookPromise)
  46246. return arg0;
  46247. return hookPromise.then(result => reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin));
  46248. });
  46249. }
  46250. return promise;
  46251. }
  46252. // chains synchronously, reduces returned value, handling the reduced value as the first hook argument
  46253. hookReduceArg0Sync(hookName, [arg0, ...rest], reduce, replaceContext) {
  46254. for (const plugin of this.plugins) {
  46255. const args = [arg0, ...rest];
  46256. const result = this.runHookSync(hookName, args, plugin, replaceContext);
  46257. arg0 = reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin);
  46258. }
  46259. return arg0;
  46260. }
  46261. // chains, reduces returned value to type T, handling the reduced value separately. permits hooks as values.
  46262. hookReduceValue(hookName, initialValue, args, reduce, replaceContext) {
  46263. let promise = Promise.resolve(initialValue);
  46264. for (const plugin of this.plugins) {
  46265. promise = promise.then(value => {
  46266. const hookPromise = this.runHook(hookName, args, plugin, true, replaceContext);
  46267. if (!hookPromise)
  46268. return value;
  46269. return hookPromise.then(result => reduce.call(this.pluginContexts.get(plugin), value, result, plugin));
  46270. });
  46271. }
  46272. return promise;
  46273. }
  46274. // chains synchronously, reduces returned value to type T, handling the reduced value separately. permits hooks as values.
  46275. hookReduceValueSync(hookName, initialValue, args, reduce, replaceContext) {
  46276. let acc = initialValue;
  46277. for (const plugin of this.plugins) {
  46278. const result = this.runHookSync(hookName, args, plugin, replaceContext);
  46279. acc = reduce.call(this.pluginContexts.get(plugin), acc, result, plugin);
  46280. }
  46281. return acc;
  46282. }
  46283. // chains, ignores returns
  46284. hookSeq(hookName, args, replaceContext) {
  46285. let promise = Promise.resolve();
  46286. for (const plugin of this.plugins) {
  46287. promise = promise.then(() => this.runHook(hookName, args, plugin, false, replaceContext));
  46288. }
  46289. return promise;
  46290. }
  46291. // chains synchronously, ignores returns
  46292. hookSeqSync(hookName, args, replaceContext) {
  46293. for (const plugin of this.plugins) {
  46294. this.runHookSync(hookName, args, plugin, replaceContext);
  46295. }
  46296. }
  46297. runHook(hookName, args, plugin, permitValues, hookContext) {
  46298. const hook = plugin[hookName];
  46299. if (!hook)
  46300. return undefined;
  46301. let context = this.pluginContexts.get(plugin);
  46302. if (hookContext) {
  46303. context = hookContext(context, plugin);
  46304. }
  46305. return Promise.resolve()
  46306. .then(() => {
  46307. // permit values allows values to be returned instead of a functional hook
  46308. if (typeof hook !== 'function') {
  46309. if (permitValues)
  46310. return hook;
  46311. return throwInvalidHookError(hookName, plugin.name);
  46312. }
  46313. return hook.apply(context, args);
  46314. })
  46315. .catch(err => throwPluginError(err, plugin.name, { hook: hookName }));
  46316. }
  46317. /**
  46318. * Run a sync plugin hook and return the result.
  46319. * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
  46320. * @param args Arguments passed to the plugin hook.
  46321. * @param plugin The acutal plugin
  46322. * @param hookContext When passed, the plugin context can be overridden.
  46323. */
  46324. runHookSync(hookName, args, plugin, hookContext) {
  46325. const hook = plugin[hookName];
  46326. if (!hook)
  46327. return undefined;
  46328. let context = this.pluginContexts.get(plugin);
  46329. if (hookContext) {
  46330. context = hookContext(context, plugin);
  46331. }
  46332. try {
  46333. // permit values allows values to be returned instead of a functional hook
  46334. if (typeof hook !== 'function') {
  46335. return throwInvalidHookError(hookName, plugin.name);
  46336. }
  46337. return hook.apply(context, args);
  46338. }
  46339. catch (err) {
  46340. return throwPluginError(err, plugin.name, { hook: hookName });
  46341. }
  46342. }
  46343. }
  46344. // AST walker module for Mozilla Parser API compatible trees
  46345. function skipThrough(node, st, c) { c(node, st); }
  46346. function ignore(_node, _st, _c) {}
  46347. // Node walkers.
  46348. var base = {};
  46349. base.Program = base.BlockStatement = function (node, st, c) {
  46350. for (var i = 0, list = node.body; i < list.length; i += 1)
  46351. {
  46352. var stmt = list[i];
  46353. c(stmt, st, "Statement");
  46354. }
  46355. };
  46356. base.Statement = skipThrough;
  46357. base.EmptyStatement = ignore;
  46358. base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
  46359. function (node, st, c) { return c(node.expression, st, "Expression"); };
  46360. base.IfStatement = function (node, st, c) {
  46361. c(node.test, st, "Expression");
  46362. c(node.consequent, st, "Statement");
  46363. if (node.alternate) { c(node.alternate, st, "Statement"); }
  46364. };
  46365. base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
  46366. base.BreakStatement = base.ContinueStatement = ignore;
  46367. base.WithStatement = function (node, st, c) {
  46368. c(node.object, st, "Expression");
  46369. c(node.body, st, "Statement");
  46370. };
  46371. base.SwitchStatement = function (node, st, c) {
  46372. c(node.discriminant, st, "Expression");
  46373. for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
  46374. var cs = list$1[i$1];
  46375. if (cs.test) { c(cs.test, st, "Expression"); }
  46376. for (var i = 0, list = cs.consequent; i < list.length; i += 1)
  46377. {
  46378. var cons = list[i];
  46379. c(cons, st, "Statement");
  46380. }
  46381. }
  46382. };
  46383. base.SwitchCase = function (node, st, c) {
  46384. if (node.test) { c(node.test, st, "Expression"); }
  46385. for (var i = 0, list = node.consequent; i < list.length; i += 1)
  46386. {
  46387. var cons = list[i];
  46388. c(cons, st, "Statement");
  46389. }
  46390. };
  46391. base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
  46392. if (node.argument) { c(node.argument, st, "Expression"); }
  46393. };
  46394. base.ThrowStatement = base.SpreadElement =
  46395. function (node, st, c) { return c(node.argument, st, "Expression"); };
  46396. base.TryStatement = function (node, st, c) {
  46397. c(node.block, st, "Statement");
  46398. if (node.handler) { c(node.handler, st); }
  46399. if (node.finalizer) { c(node.finalizer, st, "Statement"); }
  46400. };
  46401. base.CatchClause = function (node, st, c) {
  46402. if (node.param) { c(node.param, st, "Pattern"); }
  46403. c(node.body, st, "Statement");
  46404. };
  46405. base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
  46406. c(node.test, st, "Expression");
  46407. c(node.body, st, "Statement");
  46408. };
  46409. base.ForStatement = function (node, st, c) {
  46410. if (node.init) { c(node.init, st, "ForInit"); }
  46411. if (node.test) { c(node.test, st, "Expression"); }
  46412. if (node.update) { c(node.update, st, "Expression"); }
  46413. c(node.body, st, "Statement");
  46414. };
  46415. base.ForInStatement = base.ForOfStatement = function (node, st, c) {
  46416. c(node.left, st, "ForInit");
  46417. c(node.right, st, "Expression");
  46418. c(node.body, st, "Statement");
  46419. };
  46420. base.ForInit = function (node, st, c) {
  46421. if (node.type === "VariableDeclaration") { c(node, st); }
  46422. else { c(node, st, "Expression"); }
  46423. };
  46424. base.DebuggerStatement = ignore;
  46425. base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
  46426. base.VariableDeclaration = function (node, st, c) {
  46427. for (var i = 0, list = node.declarations; i < list.length; i += 1)
  46428. {
  46429. var decl = list[i];
  46430. c(decl, st);
  46431. }
  46432. };
  46433. base.VariableDeclarator = function (node, st, c) {
  46434. c(node.id, st, "Pattern");
  46435. if (node.init) { c(node.init, st, "Expression"); }
  46436. };
  46437. base.Function = function (node, st, c) {
  46438. if (node.id) { c(node.id, st, "Pattern"); }
  46439. for (var i = 0, list = node.params; i < list.length; i += 1)
  46440. {
  46441. var param = list[i];
  46442. c(param, st, "Pattern");
  46443. }
  46444. c(node.body, st, node.expression ? "Expression" : "Statement");
  46445. };
  46446. base.Pattern = function (node, st, c) {
  46447. if (node.type === "Identifier")
  46448. { c(node, st, "VariablePattern"); }
  46449. else if (node.type === "MemberExpression")
  46450. { c(node, st, "MemberPattern"); }
  46451. else
  46452. { c(node, st); }
  46453. };
  46454. base.VariablePattern = ignore;
  46455. base.MemberPattern = skipThrough;
  46456. base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
  46457. base.ArrayPattern = function (node, st, c) {
  46458. for (var i = 0, list = node.elements; i < list.length; i += 1) {
  46459. var elt = list[i];
  46460. if (elt) { c(elt, st, "Pattern"); }
  46461. }
  46462. };
  46463. base.ObjectPattern = function (node, st, c) {
  46464. for (var i = 0, list = node.properties; i < list.length; i += 1) {
  46465. var prop = list[i];
  46466. if (prop.type === "Property") {
  46467. if (prop.computed) { c(prop.key, st, "Expression"); }
  46468. c(prop.value, st, "Pattern");
  46469. } else if (prop.type === "RestElement") {
  46470. c(prop.argument, st, "Pattern");
  46471. }
  46472. }
  46473. };
  46474. base.Expression = skipThrough;
  46475. base.ThisExpression = base.Super = base.MetaProperty = ignore;
  46476. base.ArrayExpression = function (node, st, c) {
  46477. for (var i = 0, list = node.elements; i < list.length; i += 1) {
  46478. var elt = list[i];
  46479. if (elt) { c(elt, st, "Expression"); }
  46480. }
  46481. };
  46482. base.ObjectExpression = function (node, st, c) {
  46483. for (var i = 0, list = node.properties; i < list.length; i += 1)
  46484. {
  46485. var prop = list[i];
  46486. c(prop, st);
  46487. }
  46488. };
  46489. base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
  46490. base.SequenceExpression = function (node, st, c) {
  46491. for (var i = 0, list = node.expressions; i < list.length; i += 1)
  46492. {
  46493. var expr = list[i];
  46494. c(expr, st, "Expression");
  46495. }
  46496. };
  46497. base.TemplateLiteral = function (node, st, c) {
  46498. for (var i = 0, list = node.quasis; i < list.length; i += 1)
  46499. {
  46500. var quasi = list[i];
  46501. c(quasi, st);
  46502. }
  46503. for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
  46504. {
  46505. var expr = list$1[i$1];
  46506. c(expr, st, "Expression");
  46507. }
  46508. };
  46509. base.TemplateElement = ignore;
  46510. base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
  46511. c(node.argument, st, "Expression");
  46512. };
  46513. base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
  46514. c(node.left, st, "Expression");
  46515. c(node.right, st, "Expression");
  46516. };
  46517. base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
  46518. c(node.left, st, "Pattern");
  46519. c(node.right, st, "Expression");
  46520. };
  46521. base.ConditionalExpression = function (node, st, c) {
  46522. c(node.test, st, "Expression");
  46523. c(node.consequent, st, "Expression");
  46524. c(node.alternate, st, "Expression");
  46525. };
  46526. base.NewExpression = base.CallExpression = function (node, st, c) {
  46527. c(node.callee, st, "Expression");
  46528. if (node.arguments)
  46529. { for (var i = 0, list = node.arguments; i < list.length; i += 1)
  46530. {
  46531. var arg = list[i];
  46532. c(arg, st, "Expression");
  46533. } }
  46534. };
  46535. base.MemberExpression = function (node, st, c) {
  46536. c(node.object, st, "Expression");
  46537. if (node.computed) { c(node.property, st, "Expression"); }
  46538. };
  46539. base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
  46540. if (node.declaration)
  46541. { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
  46542. if (node.source) { c(node.source, st, "Expression"); }
  46543. };
  46544. base.ExportAllDeclaration = function (node, st, c) {
  46545. if (node.exported)
  46546. { c(node.exported, st); }
  46547. c(node.source, st, "Expression");
  46548. };
  46549. base.ImportDeclaration = function (node, st, c) {
  46550. for (var i = 0, list = node.specifiers; i < list.length; i += 1)
  46551. {
  46552. var spec = list[i];
  46553. c(spec, st);
  46554. }
  46555. c(node.source, st, "Expression");
  46556. };
  46557. base.ImportExpression = function (node, st, c) {
  46558. c(node.source, st, "Expression");
  46559. };
  46560. base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
  46561. base.TaggedTemplateExpression = function (node, st, c) {
  46562. c(node.tag, st, "Expression");
  46563. c(node.quasi, st, "Expression");
  46564. };
  46565. base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
  46566. base.Class = function (node, st, c) {
  46567. if (node.id) { c(node.id, st, "Pattern"); }
  46568. if (node.superClass) { c(node.superClass, st, "Expression"); }
  46569. c(node.body, st);
  46570. };
  46571. base.ClassBody = function (node, st, c) {
  46572. for (var i = 0, list = node.body; i < list.length; i += 1)
  46573. {
  46574. var elt = list[i];
  46575. c(elt, st);
  46576. }
  46577. };
  46578. base.MethodDefinition = base.Property = function (node, st, c) {
  46579. if (node.computed) { c(node.key, st, "Expression"); }
  46580. c(node.value, st, "Expression");
  46581. };
  46582. // patch up acorn-walk until class-fields are officially supported
  46583. base.PropertyDefinition = function (node, st, c) {
  46584. if (node.computed) {
  46585. c(node.key, st, 'Expression');
  46586. }
  46587. if (node.value) {
  46588. c(node.value, st, 'Expression');
  46589. }
  46590. };
  46591. function handlePureAnnotationsOfNode(node, state, type = node.type) {
  46592. let commentNode = state.commentNodes[state.commentIndex];
  46593. while (commentNode && node.start >= commentNode.end) {
  46594. markPureNode(node, commentNode);
  46595. commentNode = state.commentNodes[++state.commentIndex];
  46596. }
  46597. if (commentNode && commentNode.end <= node.end) {
  46598. base[type](node, state, handlePureAnnotationsOfNode);
  46599. }
  46600. }
  46601. function markPureNode(node, comment) {
  46602. if (node._rollupAnnotations) {
  46603. node._rollupAnnotations.push({ comment });
  46604. }
  46605. else {
  46606. node._rollupAnnotations = [{ comment }];
  46607. }
  46608. while (node.type === ExpressionStatement$1 || node.type === ChainExpression$1) {
  46609. node = node.expression;
  46610. }
  46611. if (node.type === CallExpression$1 || node.type === NewExpression$1) {
  46612. if (node._rollupAnnotations) {
  46613. node._rollupAnnotations.push({ pure: true });
  46614. }
  46615. else {
  46616. node._rollupAnnotations = [{ pure: true }];
  46617. }
  46618. }
  46619. }
  46620. const pureCommentRegex = /[@#]__PURE__/;
  46621. const isPureComment = (comment) => pureCommentRegex.test(comment.value);
  46622. function markPureCallExpressions(comments, esTreeAst) {
  46623. handlePureAnnotationsOfNode(esTreeAst, {
  46624. commentIndex: 0,
  46625. commentNodes: comments.filter(isPureComment)
  46626. });
  46627. }
  46628. function normalizeEntryModules(entryModules) {
  46629. if (Array.isArray(entryModules)) {
  46630. return entryModules.map(id => ({
  46631. fileName: null,
  46632. id,
  46633. implicitlyLoadedAfter: [],
  46634. importer: undefined,
  46635. name: null
  46636. }));
  46637. }
  46638. return Object.keys(entryModules).map(name => ({
  46639. fileName: null,
  46640. id: entryModules[name],
  46641. implicitlyLoadedAfter: [],
  46642. importer: undefined,
  46643. name
  46644. }));
  46645. }
  46646. class Graph {
  46647. constructor(options, watcher) {
  46648. var _a, _b;
  46649. this.options = options;
  46650. this.entryModules = [];
  46651. this.modulesById = new Map();
  46652. this.needsTreeshakingPass = false;
  46653. this.phase = BuildPhase.LOAD_AND_PARSE;
  46654. this.watchFiles = Object.create(null);
  46655. this.watchMode = false;
  46656. this.externalModules = [];
  46657. this.implicitEntryModules = [];
  46658. this.modules = [];
  46659. this.getModuleInfo = (moduleId) => {
  46660. const foundModule = this.modulesById.get(moduleId);
  46661. if (!foundModule)
  46662. return null;
  46663. return foundModule.info;
  46664. };
  46665. this.deoptimizationTracker = new PathTracker();
  46666. this.cachedModules = new Map();
  46667. if (options.cache !== false) {
  46668. if ((_a = options.cache) === null || _a === void 0 ? void 0 : _a.modules) {
  46669. for (const module of options.cache.modules)
  46670. this.cachedModules.set(module.id, module);
  46671. }
  46672. this.pluginCache = ((_b = options.cache) === null || _b === void 0 ? void 0 : _b.plugins) || Object.create(null);
  46673. // increment access counter
  46674. for (const name in this.pluginCache) {
  46675. const cache = this.pluginCache[name];
  46676. for (const key of Object.keys(cache))
  46677. cache[key][0]++;
  46678. }
  46679. }
  46680. if (watcher) {
  46681. this.watchMode = true;
  46682. const handleChange = (...args) => this.pluginDriver.hookSeqSync('watchChange', args);
  46683. const handleClose = () => this.pluginDriver.hookSeqSync('closeWatcher', []);
  46684. watcher.on('change', handleChange);
  46685. watcher.on('close', handleClose);
  46686. watcher.once('restart', () => {
  46687. watcher.removeListener('change', handleChange);
  46688. watcher.removeListener('close', handleClose);
  46689. });
  46690. }
  46691. this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
  46692. this.scope = new GlobalScope();
  46693. this.acornParser = Parser.extend(...options.acornInjectPlugins);
  46694. this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
  46695. }
  46696. async build() {
  46697. timeStart('generate module graph', 2);
  46698. await this.generateModuleGraph();
  46699. timeEnd('generate module graph', 2);
  46700. timeStart('sort modules', 2);
  46701. this.phase = BuildPhase.ANALYSE;
  46702. this.sortModules();
  46703. timeEnd('sort modules', 2);
  46704. timeStart('mark included statements', 2);
  46705. this.includeStatements();
  46706. timeEnd('mark included statements', 2);
  46707. this.phase = BuildPhase.GENERATE;
  46708. }
  46709. contextParse(code, options = {}) {
  46710. const onCommentOrig = options.onComment;
  46711. const comments = [];
  46712. if (onCommentOrig && typeof onCommentOrig == 'function') {
  46713. options.onComment = (block, text, start, end, ...args) => {
  46714. comments.push({ type: block ? "Block" : "Line", value: text, start, end });
  46715. return onCommentOrig.call(options, block, text, start, end, ...args);
  46716. };
  46717. }
  46718. else {
  46719. options.onComment = comments;
  46720. }
  46721. const ast = this.acornParser.parse(code, {
  46722. ...this.options.acorn,
  46723. ...options
  46724. });
  46725. if (typeof onCommentOrig == 'object') {
  46726. onCommentOrig.push(...comments);
  46727. }
  46728. options.onComment = onCommentOrig;
  46729. markPureCallExpressions(comments, ast);
  46730. return ast;
  46731. }
  46732. getCache() {
  46733. // handle plugin cache eviction
  46734. for (const name in this.pluginCache) {
  46735. const cache = this.pluginCache[name];
  46736. let allDeleted = true;
  46737. for (const key of Object.keys(cache)) {
  46738. if (cache[key][0] >= this.options.experimentalCacheExpiry)
  46739. delete cache[key];
  46740. else
  46741. allDeleted = false;
  46742. }
  46743. if (allDeleted)
  46744. delete this.pluginCache[name];
  46745. }
  46746. return {
  46747. modules: this.modules.map(module => module.toJSON()),
  46748. plugins: this.pluginCache
  46749. };
  46750. }
  46751. async generateModuleGraph() {
  46752. ({
  46753. entryModules: this.entryModules,
  46754. implicitEntryModules: this.implicitEntryModules
  46755. } = await this.moduleLoader.addEntryModules(normalizeEntryModules(this.options.input), true));
  46756. if (this.entryModules.length === 0) {
  46757. throw new Error('You must supply options.input to rollup');
  46758. }
  46759. for (const module of this.modulesById.values()) {
  46760. if (module instanceof Module) {
  46761. this.modules.push(module);
  46762. }
  46763. else {
  46764. this.externalModules.push(module);
  46765. }
  46766. }
  46767. }
  46768. includeStatements() {
  46769. for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
  46770. if (module.preserveSignature !== false) {
  46771. module.includeAllExports(false);
  46772. }
  46773. else {
  46774. markModuleAndImpureDependenciesAsExecuted(module);
  46775. }
  46776. }
  46777. if (this.options.treeshake) {
  46778. let treeshakingPass = 1;
  46779. do {
  46780. timeStart(`treeshaking pass ${treeshakingPass}`, 3);
  46781. this.needsTreeshakingPass = false;
  46782. for (const module of this.modules) {
  46783. if (module.isExecuted) {
  46784. if (module.info.hasModuleSideEffects === 'no-treeshake') {
  46785. module.includeAllInBundle();
  46786. }
  46787. else {
  46788. module.include();
  46789. }
  46790. }
  46791. }
  46792. timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
  46793. } while (this.needsTreeshakingPass);
  46794. }
  46795. else {
  46796. for (const module of this.modules)
  46797. module.includeAllInBundle();
  46798. }
  46799. for (const externalModule of this.externalModules)
  46800. externalModule.warnUnusedImports();
  46801. for (const module of this.implicitEntryModules) {
  46802. for (const dependant of module.implicitlyLoadedAfter) {
  46803. if (!(dependant.info.isEntry || dependant.isIncluded())) {
  46804. error(errImplicitDependantIsNotIncluded(dependant));
  46805. }
  46806. }
  46807. }
  46808. }
  46809. sortModules() {
  46810. const { orderedModules, cyclePaths } = analyseModuleExecution(this.entryModules);
  46811. for (const cyclePath of cyclePaths) {
  46812. this.options.onwarn({
  46813. code: 'CIRCULAR_DEPENDENCY',
  46814. cycle: cyclePath,
  46815. importer: cyclePath[0],
  46816. message: `Circular dependency: ${cyclePath.join(' -> ')}`
  46817. });
  46818. }
  46819. this.modules = orderedModules;
  46820. for (const module of this.modules) {
  46821. module.bindReferences();
  46822. }
  46823. this.warnForMissingExports();
  46824. }
  46825. warnForMissingExports() {
  46826. for (const module of this.modules) {
  46827. for (const importName of Object.keys(module.importDescriptions)) {
  46828. const importDescription = module.importDescriptions[importName];
  46829. if (importDescription.name !== '*' &&
  46830. !importDescription.module.getVariableForExportName(importDescription.name)) {
  46831. module.warn({
  46832. code: 'NON_EXISTENT_EXPORT',
  46833. message: `Non-existent export '${importDescription.name}' is imported from ${relativeId(importDescription.module.id)}`,
  46834. name: importDescription.name,
  46835. source: importDescription.module.id
  46836. }, importDescription.start);
  46837. }
  46838. }
  46839. }
  46840. }
  46841. }
  46842. function ensureArray(items) {
  46843. if (Array.isArray(items)) {
  46844. return items.filter(Boolean);
  46845. }
  46846. if (items) {
  46847. return [items];
  46848. }
  46849. return [];
  46850. }
  46851. function getAugmentedNamespace(n) {
  46852. if (n.__esModule) return n;
  46853. var a = Object.defineProperty({}, '__esModule', {value: true});
  46854. Object.keys(n).forEach(function (k) {
  46855. var d = Object.getOwnPropertyDescriptor(n, k);
  46856. Object.defineProperty(a, k, d.get ? d : {
  46857. enumerable: true,
  46858. get: function () {
  46859. return n[k];
  46860. }
  46861. });
  46862. });
  46863. return a;
  46864. }
  46865. var require$$1 = /*@__PURE__*/getAugmentedNamespace(acorn);
  46866. const getPrototype = Object.getPrototypeOf || (o => o.__proto__);
  46867. const getAcorn$1 = Parser => {
  46868. if (Parser.acorn) return Parser.acorn
  46869. const acorn = require$$1;
  46870. if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
  46871. throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
  46872. }
  46873. // Make sure `Parser` comes from the same acorn as we `require`d,
  46874. // otherwise the comparisons fail.
  46875. for (let cur = Parser; cur && cur !== acorn.Parser; cur = getPrototype(cur)) {
  46876. if (cur !== acorn.Parser) {
  46877. throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
  46878. }
  46879. }
  46880. return acorn
  46881. };
  46882. var acornPrivateClassElements = function(Parser) {
  46883. // Only load this plugin once.
  46884. if (Parser.prototype.parsePrivateName) {
  46885. return Parser
  46886. }
  46887. const acorn = getAcorn$1(Parser);
  46888. Parser = class extends Parser {
  46889. _branch() {
  46890. this.__branch = this.__branch || new Parser({ecmaVersion: this.options.ecmaVersion}, this.input);
  46891. this.__branch.end = this.end;
  46892. this.__branch.pos = this.pos;
  46893. this.__branch.type = this.type;
  46894. this.__branch.value = this.value;
  46895. this.__branch.containsEsc = this.containsEsc;
  46896. return this.__branch
  46897. }
  46898. parsePrivateClassElementName(element) {
  46899. element.computed = false;
  46900. element.key = this.parsePrivateName();
  46901. if (element.key.name == "constructor") this.raise(element.key.start, "Classes may not have a private element named constructor");
  46902. const accept = {get: "set", set: "get"}[element.kind];
  46903. const privateBoundNames = this._privateBoundNames;
  46904. if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) {
  46905. this.raise(element.start, "Duplicate private element");
  46906. }
  46907. privateBoundNames[element.key.name] = element.kind || true;
  46908. delete this._unresolvedPrivateNames[element.key.name];
  46909. return element.key
  46910. }
  46911. parsePrivateName() {
  46912. const node = this.startNode();
  46913. node.name = this.value;
  46914. this.next();
  46915. this.finishNode(node, "PrivateIdentifier");
  46916. if (this.options.allowReserved == "never") this.checkUnreserved(node);
  46917. return node
  46918. }
  46919. // Parse # token
  46920. getTokenFromCode(code) {
  46921. if (code === 35) {
  46922. ++this.pos;
  46923. const word = this.readWord1();
  46924. return this.finishToken(this.privateIdentifierToken, word)
  46925. }
  46926. return super.getTokenFromCode(code)
  46927. }
  46928. // Manage stacks and check for undeclared private names
  46929. parseClass(node, isStatement) {
  46930. const oldOuterPrivateBoundNames = this._outerPrivateBoundNames;
  46931. this._outerPrivateBoundNames = this._privateBoundNames;
  46932. this._privateBoundNames = Object.create(this._privateBoundNames || null);
  46933. const oldOuterUnresolvedPrivateNames = this._outerUnresolvedPrivateNames;
  46934. this._outerUnresolvedPrivateNames = this._unresolvedPrivateNames;
  46935. this._unresolvedPrivateNames = Object.create(null);
  46936. const _return = super.parseClass(node, isStatement);
  46937. const unresolvedPrivateNames = this._unresolvedPrivateNames;
  46938. this._privateBoundNames = this._outerPrivateBoundNames;
  46939. this._outerPrivateBoundNames = oldOuterPrivateBoundNames;
  46940. this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
  46941. this._outerUnresolvedPrivateNames = oldOuterUnresolvedPrivateNames;
  46942. if (!this._unresolvedPrivateNames) {
  46943. const names = Object.keys(unresolvedPrivateNames);
  46944. if (names.length) {
  46945. names.sort((n1, n2) => unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]);
  46946. this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name");
  46947. }
  46948. } else Object.assign(this._unresolvedPrivateNames, unresolvedPrivateNames);
  46949. return _return
  46950. }
  46951. // Class heritage is evaluated with outer private environment
  46952. parseClassSuper(node) {
  46953. const privateBoundNames = this._privateBoundNames;
  46954. this._privateBoundNames = this._outerPrivateBoundNames;
  46955. const unresolvedPrivateNames = this._unresolvedPrivateNames;
  46956. this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
  46957. const _return = super.parseClassSuper(node);
  46958. this._privateBoundNames = privateBoundNames;
  46959. this._unresolvedPrivateNames = unresolvedPrivateNames;
  46960. return _return
  46961. }
  46962. // Parse private element access
  46963. parseSubscript(base, startPos, startLoc, _noCalls, _maybeAsyncArrow, _optionalChained) {
  46964. const optionalSupported = this.options.ecmaVersion >= 11 && acorn.tokTypes.questionDot;
  46965. const branch = this._branch();
  46966. if (!(
  46967. (branch.eat(acorn.tokTypes.dot) || (optionalSupported && branch.eat(acorn.tokTypes.questionDot))) &&
  46968. branch.type == this.privateIdentifierToken
  46969. )) {
  46970. return super.parseSubscript.apply(this, arguments)
  46971. }
  46972. let optional = false;
  46973. if (!this.eat(acorn.tokTypes.dot)) {
  46974. this.expect(acorn.tokTypes.questionDot);
  46975. optional = true;
  46976. }
  46977. let node = this.startNodeAt(startPos, startLoc);
  46978. node.object = base;
  46979. node.computed = false;
  46980. if (optionalSupported) {
  46981. node.optional = optional;
  46982. }
  46983. if (this.type == this.privateIdentifierToken) {
  46984. if (base.type == "Super") {
  46985. this.raise(this.start, "Cannot access private element on super");
  46986. }
  46987. node.property = this.parsePrivateName();
  46988. if (!this._privateBoundNames || !this._privateBoundNames[node.property.name]) {
  46989. if (!this._unresolvedPrivateNames) {
  46990. this.raise(node.property.start, "Usage of undeclared private name");
  46991. }
  46992. this._unresolvedPrivateNames[node.property.name] = node.property.start;
  46993. }
  46994. } else {
  46995. node.property = this.parseIdent(true);
  46996. }
  46997. return this.finishNode(node, "MemberExpression")
  46998. }
  46999. // Prohibit delete of private class elements
  47000. parseMaybeUnary(refDestructuringErrors, sawUnary) {
  47001. const _return = super.parseMaybeUnary(refDestructuringErrors, sawUnary);
  47002. if (_return.operator == "delete") {
  47003. if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateIdentifier") {
  47004. this.raise(_return.start, "Private elements may not be deleted");
  47005. }
  47006. }
  47007. return _return
  47008. }
  47009. };
  47010. Parser.prototype.privateIdentifierToken = new acorn.TokenType("privateIdentifier");
  47011. return Parser
  47012. };
  47013. const privateClassElements$1 = acornPrivateClassElements;
  47014. var acornClassFields = function(Parser) {
  47015. const acorn = Parser.acorn || require$$1;
  47016. const tt = acorn.tokTypes;
  47017. Parser = privateClassElements$1(Parser);
  47018. return class extends Parser {
  47019. _maybeParseFieldValue(field) {
  47020. if (this.eat(tt.eq)) {
  47021. const oldInFieldValue = this._inFieldValue;
  47022. this._inFieldValue = true;
  47023. if (this.type === tt.name && this.value === "await" && (this.inAsync || this.options.allowAwaitOutsideFunction)) {
  47024. field.value = this.parseAwait();
  47025. } else field.value = this.parseExpression();
  47026. this._inFieldValue = oldInFieldValue;
  47027. } else field.value = null;
  47028. }
  47029. // Parse fields
  47030. parseClassElement(_constructorAllowsSuper) {
  47031. if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type.keyword || this.type == this.privateIdentifierToken || this.type == tt.bracketL || this.type == tt.string || this.type == tt.num)) {
  47032. const branch = this._branch();
  47033. if (branch.type == tt.bracketL) {
  47034. let count = 0;
  47035. do {
  47036. if (branch.eat(tt.bracketL)) ++count;
  47037. else if (branch.eat(tt.bracketR)) --count;
  47038. else branch.next();
  47039. } while (count > 0)
  47040. } else branch.next(true);
  47041. let isField = branch.type == tt.eq || branch.type == tt.semi;
  47042. if (!isField && branch.canInsertSemicolon()) {
  47043. isField = branch.type != tt.parenL;
  47044. }
  47045. if (isField) {
  47046. const node = this.startNode();
  47047. if (this.type == this.privateIdentifierToken) {
  47048. this.parsePrivateClassElementName(node);
  47049. } else {
  47050. this.parsePropertyName(node);
  47051. }
  47052. if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
  47053. (node.key.type === "Literal" && node.key.value === "constructor")) {
  47054. this.raise(node.key.start, "Classes may not have a field called constructor");
  47055. }
  47056. this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
  47057. this._maybeParseFieldValue(node);
  47058. this.exitScope();
  47059. this.finishNode(node, "PropertyDefinition");
  47060. this.semicolon();
  47061. return node
  47062. }
  47063. }
  47064. return super.parseClassElement.apply(this, arguments)
  47065. }
  47066. // Prohibit arguments in class field initializers
  47067. parseIdent(liberal, isBinding) {
  47068. const ident = super.parseIdent(liberal, isBinding);
  47069. if (this._inFieldValue && ident.name == "arguments") this.raise(ident.start, "A class field initializer may not contain arguments");
  47070. return ident
  47071. }
  47072. }
  47073. };
  47074. const privateClassElements = acornPrivateClassElements;
  47075. var acornStaticClassFeatures = function(Parser) {
  47076. const ExtendedParser = privateClassElements(Parser);
  47077. const acorn = Parser.acorn || require$$1;
  47078. const tt = acorn.tokTypes;
  47079. return class extends ExtendedParser {
  47080. _maybeParseFieldValue(field) {
  47081. if (this.eat(tt.eq)) {
  47082. const oldInFieldValue = this._inStaticFieldScope;
  47083. this._inStaticFieldScope = this.currentThisScope();
  47084. field.value = this.parseExpression();
  47085. this._inStaticFieldScope = oldInFieldValue;
  47086. } else field.value = null;
  47087. }
  47088. // Parse fields
  47089. parseClassElement(_constructorAllowsSuper) {
  47090. if (this.options.ecmaVersion < 8 || !this.isContextual("static")) {
  47091. return super.parseClassElement.apply(this, arguments)
  47092. }
  47093. const branch = this._branch();
  47094. branch.next();
  47095. if ([tt.name, tt.bracketL, tt.string, tt.num, this.privateIdentifierToken].indexOf(branch.type) == -1 && !branch.type.keyword) {
  47096. return super.parseClassElement.apply(this, arguments)
  47097. }
  47098. if (branch.type == tt.bracketL) {
  47099. let count = 0;
  47100. do {
  47101. if (branch.eat(tt.bracketL)) ++count;
  47102. else if (branch.eat(tt.bracketR)) --count;
  47103. else branch.next();
  47104. } while (count > 0)
  47105. } else branch.next();
  47106. if (branch.type != tt.eq && !branch.canInsertSemicolon() && branch.type != tt.semi) {
  47107. return super.parseClassElement.apply(this, arguments)
  47108. }
  47109. const node = this.startNode();
  47110. node.static = this.eatContextual("static");
  47111. if (this.type == this.privateIdentifierToken) {
  47112. this.parsePrivateClassElementName(node);
  47113. } else {
  47114. this.parsePropertyName(node);
  47115. }
  47116. if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
  47117. (node.key.type === "Literal" && !node.computed && node.key.value === "constructor")) {
  47118. this.raise(node.key.start, "Classes may not have a field called constructor");
  47119. }
  47120. if ((node.key.name || node.key.value) === "prototype" && !node.computed) {
  47121. this.raise(node.key.start, "Classes may not have a static property named prototype");
  47122. }
  47123. this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
  47124. this._maybeParseFieldValue(node);
  47125. this.exitScope();
  47126. this.finishNode(node, "PropertyDefinition");
  47127. this.semicolon();
  47128. return node
  47129. }
  47130. // Parse private static methods
  47131. parsePropertyName(prop) {
  47132. if (prop.static && this.type == this.privateIdentifierToken) {
  47133. this.parsePrivateClassElementName(prop);
  47134. } else {
  47135. super.parsePropertyName(prop);
  47136. }
  47137. }
  47138. // Prohibit arguments in class field initializers
  47139. parseIdent(liberal, isBinding) {
  47140. const ident = super.parseIdent(liberal, isBinding);
  47141. if (this._inStaticFieldScope && this.currentThisScope() === this._inStaticFieldScope && ident.name == "arguments") {
  47142. this.raise(ident.start, "A static class field initializer may not contain arguments");
  47143. }
  47144. return ident
  47145. }
  47146. }
  47147. };
  47148. const defaultOnWarn = warning => console.warn(warning.message || warning);
  47149. function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignoredKeys = /$./) {
  47150. const validOptionSet = new Set(validOptions);
  47151. const unknownOptions = Object.keys(passedOptions).filter(key => !(validOptionSet.has(key) || ignoredKeys.test(key)));
  47152. if (unknownOptions.length > 0) {
  47153. warn({
  47154. code: 'UNKNOWN_OPTION',
  47155. message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${[
  47156. ...validOptionSet
  47157. ]
  47158. .sort()
  47159. .join(', ')}`
  47160. });
  47161. }
  47162. }
  47163. function normalizeInputOptions(config) {
  47164. var _a, _b;
  47165. // These are options that may trigger special warnings or behaviour later
  47166. // if the user did not select an explicit value
  47167. const unsetOptions = new Set();
  47168. const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
  47169. const onwarn = getOnwarn(config);
  47170. const strictDeprecations = config.strictDeprecations || false;
  47171. const options = {
  47172. acorn: getAcorn(config),
  47173. acornInjectPlugins: getAcornInjectPlugins(config),
  47174. cache: getCache(config),
  47175. context,
  47176. experimentalCacheExpiry: (_b = config.experimentalCacheExpiry) !== null && _b !== void 0 ? _b : 10,
  47177. external: getIdMatcher(config.external),
  47178. inlineDynamicImports: getInlineDynamicImports$1(config, onwarn, strictDeprecations),
  47179. input: getInput(config),
  47180. manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
  47181. moduleContext: getModuleContext(config, context),
  47182. onwarn,
  47183. perf: config.perf || false,
  47184. plugins: ensureArray(config.plugins),
  47185. preserveEntrySignatures: getPreserveEntrySignatures(config, unsetOptions),
  47186. preserveModules: getPreserveModules$1(config, onwarn, strictDeprecations),
  47187. preserveSymlinks: config.preserveSymlinks || false,
  47188. shimMissingExports: config.shimMissingExports || false,
  47189. strictDeprecations,
  47190. treeshake: getTreeshake(config, onwarn, strictDeprecations)
  47191. };
  47192. warnUnknownOptions(config, [...Object.keys(options), 'watch'], 'input options', options.onwarn, /^(output)$/);
  47193. return { options, unsetOptions };
  47194. }
  47195. const getOnwarn = (config) => {
  47196. return config.onwarn
  47197. ? warning => {
  47198. warning.toString = () => {
  47199. let str = '';
  47200. if (warning.plugin)
  47201. str += `(${warning.plugin} plugin) `;
  47202. if (warning.loc)
  47203. str += `${relativeId(warning.loc.file)} (${warning.loc.line}:${warning.loc.column}) `;
  47204. str += warning.message;
  47205. return str;
  47206. };
  47207. config.onwarn(warning, defaultOnWarn);
  47208. }
  47209. : defaultOnWarn;
  47210. };
  47211. const getAcorn = (config) => ({
  47212. allowAwaitOutsideFunction: true,
  47213. ecmaVersion: 'latest',
  47214. preserveParens: false,
  47215. sourceType: 'module',
  47216. ...config.acorn
  47217. });
  47218. const getAcornInjectPlugins = (config) => [
  47219. acornClassFields,
  47220. acornStaticClassFeatures,
  47221. ...ensureArray(config.acornInjectPlugins)
  47222. ];
  47223. const getCache = (config) => {
  47224. var _a;
  47225. return ((_a = config.cache) === null || _a === void 0 ? void 0 : _a.cache) || config.cache;
  47226. };
  47227. const getIdMatcher = (option) => {
  47228. if (option === true) {
  47229. return () => true;
  47230. }
  47231. if (typeof option === 'function') {
  47232. return (id, ...args) => (!id.startsWith('\0') && option(id, ...args)) || false;
  47233. }
  47234. if (option) {
  47235. const ids = new Set();
  47236. const matchers = [];
  47237. for (const value of ensureArray(option)) {
  47238. if (value instanceof RegExp) {
  47239. matchers.push(value);
  47240. }
  47241. else {
  47242. ids.add(value);
  47243. }
  47244. }
  47245. return (id, ..._args) => ids.has(id) || matchers.some(matcher => matcher.test(id));
  47246. }
  47247. return () => false;
  47248. };
  47249. const getInlineDynamicImports$1 = (config, warn, strictDeprecations) => {
  47250. const configInlineDynamicImports = config.inlineDynamicImports;
  47251. if (configInlineDynamicImports) {
  47252. warnDeprecationWithOptions('The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', false, warn, strictDeprecations);
  47253. }
  47254. return configInlineDynamicImports;
  47255. };
  47256. const getInput = (config) => {
  47257. const configInput = config.input;
  47258. return configInput == null ? [] : typeof configInput === 'string' ? [configInput] : configInput;
  47259. };
  47260. const getManualChunks$1 = (config, warn, strictDeprecations) => {
  47261. const configManualChunks = config.manualChunks;
  47262. if (configManualChunks) {
  47263. warnDeprecationWithOptions('The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', false, warn, strictDeprecations);
  47264. }
  47265. return configManualChunks;
  47266. };
  47267. const getModuleContext = (config, context) => {
  47268. const configModuleContext = config.moduleContext;
  47269. if (typeof configModuleContext === 'function') {
  47270. return id => { var _a; return (_a = configModuleContext(id)) !== null && _a !== void 0 ? _a : context; };
  47271. }
  47272. if (configModuleContext) {
  47273. const contextByModuleId = Object.create(null);
  47274. for (const key of Object.keys(configModuleContext)) {
  47275. contextByModuleId[resolve$1(key)] = configModuleContext[key];
  47276. }
  47277. return id => contextByModuleId[id] || context;
  47278. }
  47279. return () => context;
  47280. };
  47281. const getPreserveEntrySignatures = (config, unsetOptions) => {
  47282. const configPreserveEntrySignatures = config.preserveEntrySignatures;
  47283. if (configPreserveEntrySignatures == null) {
  47284. unsetOptions.add('preserveEntrySignatures');
  47285. }
  47286. return configPreserveEntrySignatures !== null && configPreserveEntrySignatures !== void 0 ? configPreserveEntrySignatures : 'strict';
  47287. };
  47288. const getPreserveModules$1 = (config, warn, strictDeprecations) => {
  47289. const configPreserveModules = config.preserveModules;
  47290. if (configPreserveModules) {
  47291. warnDeprecationWithOptions('The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', false, warn, strictDeprecations);
  47292. }
  47293. return configPreserveModules;
  47294. };
  47295. const getTreeshake = (config, warn, strictDeprecations) => {
  47296. const configTreeshake = config.treeshake;
  47297. if (configTreeshake === false) {
  47298. return false;
  47299. }
  47300. if (configTreeshake && configTreeshake !== true) {
  47301. if (typeof configTreeshake.pureExternalModules !== 'undefined') {
  47302. warnDeprecationWithOptions(`The "treeshake.pureExternalModules" option is deprecated. The "treeshake.moduleSideEffects" option should be used instead. "treeshake.pureExternalModules: true" is equivalent to "treeshake.moduleSideEffects: 'no-external'"`, true, warn, strictDeprecations);
  47303. }
  47304. return {
  47305. annotations: configTreeshake.annotations !== false,
  47306. moduleSideEffects: getHasModuleSideEffects(configTreeshake.moduleSideEffects, configTreeshake.pureExternalModules, warn),
  47307. propertyReadSideEffects: configTreeshake.propertyReadSideEffects === 'always' && 'always' ||
  47308. configTreeshake.propertyReadSideEffects !== false,
  47309. tryCatchDeoptimization: configTreeshake.tryCatchDeoptimization !== false,
  47310. unknownGlobalSideEffects: configTreeshake.unknownGlobalSideEffects !== false
  47311. };
  47312. }
  47313. return {
  47314. annotations: true,
  47315. moduleSideEffects: () => true,
  47316. propertyReadSideEffects: true,
  47317. tryCatchDeoptimization: true,
  47318. unknownGlobalSideEffects: true
  47319. };
  47320. };
  47321. const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules, warn) => {
  47322. if (typeof moduleSideEffectsOption === 'boolean') {
  47323. return () => moduleSideEffectsOption;
  47324. }
  47325. if (moduleSideEffectsOption === 'no-external') {
  47326. return (_id, external) => !external;
  47327. }
  47328. if (typeof moduleSideEffectsOption === 'function') {
  47329. return (id, external) => !id.startsWith('\0') ? moduleSideEffectsOption(id, external) !== false : true;
  47330. }
  47331. if (Array.isArray(moduleSideEffectsOption)) {
  47332. const ids = new Set(moduleSideEffectsOption);
  47333. return id => ids.has(id);
  47334. }
  47335. if (moduleSideEffectsOption) {
  47336. warn(errInvalidOption('treeshake.moduleSideEffects', 'please use one of false, "no-external", a function or an array'));
  47337. }
  47338. const isPureExternalModule = getIdMatcher(pureExternalModules);
  47339. return (id, external) => !(external && isPureExternalModule(id));
  47340. };
  47341. function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
  47342. var _a, _b, _c, _d, _e, _f, _g;
  47343. // These are options that may trigger special warnings or behaviour later
  47344. // if the user did not select an explicit value
  47345. const unsetOptions = new Set(unsetInputOptions);
  47346. const compact = config.compact || false;
  47347. const format = getFormat(config);
  47348. const inlineDynamicImports = getInlineDynamicImports(config, inputOptions);
  47349. const preserveModules = getPreserveModules(config, inlineDynamicImports, inputOptions);
  47350. const file = getFile(config, preserveModules, inputOptions);
  47351. const outputOptions = {
  47352. amd: getAmd(config),
  47353. assetFileNames: (_a = config.assetFileNames) !== null && _a !== void 0 ? _a : 'assets/[name]-[hash][extname]',
  47354. banner: getAddon(config, 'banner'),
  47355. chunkFileNames: (_b = config.chunkFileNames) !== null && _b !== void 0 ? _b : '[name]-[hash].js',
  47356. compact,
  47357. dir: getDir(config, file),
  47358. dynamicImportFunction: getDynamicImportFunction(config, inputOptions),
  47359. entryFileNames: getEntryFileNames(config, unsetOptions),
  47360. esModule: (_c = config.esModule) !== null && _c !== void 0 ? _c : true,
  47361. exports: getExports(config, unsetOptions),
  47362. extend: config.extend || false,
  47363. externalLiveBindings: (_d = config.externalLiveBindings) !== null && _d !== void 0 ? _d : true,
  47364. file,
  47365. footer: getAddon(config, 'footer'),
  47366. format,
  47367. freeze: (_e = config.freeze) !== null && _e !== void 0 ? _e : true,
  47368. globals: config.globals || {},
  47369. hoistTransitiveImports: (_f = config.hoistTransitiveImports) !== null && _f !== void 0 ? _f : true,
  47370. indent: getIndent(config, compact),
  47371. inlineDynamicImports,
  47372. interop: getInterop(config, inputOptions),
  47373. intro: getAddon(config, 'intro'),
  47374. manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules, inputOptions),
  47375. minifyInternalExports: getMinifyInternalExports(config, format, compact),
  47376. name: config.name,
  47377. namespaceToStringTag: config.namespaceToStringTag || false,
  47378. noConflict: config.noConflict || false,
  47379. outro: getAddon(config, 'outro'),
  47380. paths: config.paths || {},
  47381. plugins: ensureArray(config.plugins),
  47382. preferConst: config.preferConst || false,
  47383. preserveModules,
  47384. preserveModulesRoot: getPreserveModulesRoot(config),
  47385. sourcemap: config.sourcemap || false,
  47386. sourcemapExcludeSources: config.sourcemapExcludeSources || false,
  47387. sourcemapFile: config.sourcemapFile,
  47388. sourcemapPathTransform: config.sourcemapPathTransform,
  47389. strict: (_g = config.strict) !== null && _g !== void 0 ? _g : true,
  47390. systemNullSetters: config.systemNullSetters || false,
  47391. validate: config.validate || false
  47392. };
  47393. warnUnknownOptions(config, Object.keys(outputOptions), 'output options', inputOptions.onwarn);
  47394. return { options: outputOptions, unsetOptions };
  47395. }
  47396. const getFile = (config, preserveModules, inputOptions) => {
  47397. const file = config.file;
  47398. if (typeof file === 'string') {
  47399. if (preserveModules) {
  47400. return error({
  47401. code: 'INVALID_OPTION',
  47402. message: 'You must set "output.dir" instead of "output.file" when using the "output.preserveModules" option.'
  47403. });
  47404. }
  47405. if (!Array.isArray(inputOptions.input))
  47406. return error({
  47407. code: 'INVALID_OPTION',
  47408. message: 'You must set "output.dir" instead of "output.file" when providing named inputs.'
  47409. });
  47410. }
  47411. return file;
  47412. };
  47413. const getFormat = (config) => {
  47414. const configFormat = config.format;
  47415. switch (configFormat) {
  47416. case undefined:
  47417. case 'es':
  47418. case 'esm':
  47419. case 'module':
  47420. return 'es';
  47421. case 'cjs':
  47422. case 'commonjs':
  47423. return 'cjs';
  47424. case 'system':
  47425. case 'systemjs':
  47426. return 'system';
  47427. case 'amd':
  47428. case 'iife':
  47429. case 'umd':
  47430. return configFormat;
  47431. default:
  47432. return error({
  47433. message: `You must specify "output.format", which can be one of "amd", "cjs", "system", "es", "iife" or "umd".`,
  47434. url: `https://rollupjs.org/guide/en/#outputformat`
  47435. });
  47436. }
  47437. };
  47438. const getInlineDynamicImports = (config, inputOptions) => {
  47439. var _a;
  47440. const inlineDynamicImports = ((_a = config.inlineDynamicImports) !== null && _a !== void 0 ? _a : inputOptions.inlineDynamicImports) ||
  47441. false;
  47442. const { input } = inputOptions;
  47443. if (inlineDynamicImports && (Array.isArray(input) ? input : Object.keys(input)).length > 1) {
  47444. return error({
  47445. code: 'INVALID_OPTION',
  47446. message: 'Multiple inputs are not supported for "output.inlineDynamicImports".'
  47447. });
  47448. }
  47449. return inlineDynamicImports;
  47450. };
  47451. const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
  47452. var _a;
  47453. const preserveModules = ((_a = config.preserveModules) !== null && _a !== void 0 ? _a : inputOptions.preserveModules) || false;
  47454. if (preserveModules) {
  47455. if (inlineDynamicImports) {
  47456. return error({
  47457. code: 'INVALID_OPTION',
  47458. message: `The "output.inlineDynamicImports" option is not supported for "output.preserveModules".`
  47459. });
  47460. }
  47461. if (inputOptions.preserveEntrySignatures === false) {
  47462. return error({
  47463. code: 'INVALID_OPTION',
  47464. message: 'Setting "preserveEntrySignatures" to "false" is not supported for "output.preserveModules".'
  47465. });
  47466. }
  47467. }
  47468. return preserveModules;
  47469. };
  47470. const getPreserveModulesRoot = (config) => {
  47471. const preserveModulesRoot = config.preserveModulesRoot;
  47472. if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
  47473. return undefined;
  47474. }
  47475. return resolve$1(preserveModulesRoot);
  47476. };
  47477. const getAmd = (config) => {
  47478. const collection = {
  47479. autoId: false,
  47480. basePath: '',
  47481. define: 'define',
  47482. ...config.amd
  47483. };
  47484. if ((collection.autoId || collection.basePath) && collection.id) {
  47485. return error({
  47486. code: 'INVALID_OPTION',
  47487. message: '"output.amd.autoId"/"output.amd.basePath" and "output.amd.id" cannot be used together.'
  47488. });
  47489. }
  47490. if (collection.basePath && !collection.autoId) {
  47491. return error({
  47492. code: 'INVALID_OPTION',
  47493. message: '"output.amd.basePath" only works with "output.amd.autoId".'
  47494. });
  47495. }
  47496. let normalized;
  47497. if (collection.autoId) {
  47498. normalized = {
  47499. autoId: true,
  47500. basePath: collection.basePath,
  47501. define: collection.define
  47502. };
  47503. }
  47504. else {
  47505. normalized = {
  47506. autoId: false,
  47507. define: collection.define,
  47508. id: collection.id
  47509. };
  47510. }
  47511. return normalized;
  47512. };
  47513. const getAddon = (config, name) => {
  47514. const configAddon = config[name];
  47515. if (typeof configAddon === 'function') {
  47516. return configAddon;
  47517. }
  47518. return () => configAddon || '';
  47519. };
  47520. const getDir = (config, file) => {
  47521. const dir = config.dir;
  47522. if (typeof dir === 'string' && typeof file === 'string') {
  47523. return error({
  47524. code: 'INVALID_OPTION',
  47525. message: 'You must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks.'
  47526. });
  47527. }
  47528. return dir;
  47529. };
  47530. const getDynamicImportFunction = (config, inputOptions) => {
  47531. const configDynamicImportFunction = config.dynamicImportFunction;
  47532. if (configDynamicImportFunction) {
  47533. warnDeprecation(`The "output.dynamicImportFunction" option is deprecated. Use the "renderDynamicImport" plugin hook instead.`, false, inputOptions);
  47534. }
  47535. return configDynamicImportFunction;
  47536. };
  47537. const getEntryFileNames = (config, unsetOptions) => {
  47538. const configEntryFileNames = config.entryFileNames;
  47539. if (configEntryFileNames == null) {
  47540. unsetOptions.add('entryFileNames');
  47541. }
  47542. return configEntryFileNames !== null && configEntryFileNames !== void 0 ? configEntryFileNames : '[name].js';
  47543. };
  47544. function getExports(config, unsetOptions) {
  47545. const configExports = config.exports;
  47546. if (configExports == null) {
  47547. unsetOptions.add('exports');
  47548. }
  47549. else if (!['default', 'named', 'none', 'auto'].includes(configExports)) {
  47550. return error(errInvalidExportOptionValue(configExports));
  47551. }
  47552. return configExports || 'auto';
  47553. }
  47554. const getIndent = (config, compact) => {
  47555. if (compact) {
  47556. return '';
  47557. }
  47558. const configIndent = config.indent;
  47559. return configIndent === false ? '' : configIndent !== null && configIndent !== void 0 ? configIndent : true;
  47560. };
  47561. const ALLOWED_INTEROP_TYPES = new Set(['auto', 'esModule', 'default', 'defaultOnly', true, false]);
  47562. const getInterop = (config, inputOptions) => {
  47563. const configInterop = config.interop;
  47564. const validatedInteropTypes = new Set();
  47565. const validateInterop = (interop) => {
  47566. if (!validatedInteropTypes.has(interop)) {
  47567. validatedInteropTypes.add(interop);
  47568. if (!ALLOWED_INTEROP_TYPES.has(interop)) {
  47569. return error({
  47570. code: 'INVALID_OPTION',
  47571. message: `The value ${JSON.stringify(interop)} is not supported for "output.interop". Use one of ${Array.from(ALLOWED_INTEROP_TYPES.values(), value => JSON.stringify(value)).join(', ')} instead.`,
  47572. url: 'https://rollupjs.org/guide/en/#outputinterop'
  47573. });
  47574. }
  47575. if (typeof interop === 'boolean') {
  47576. warnDeprecation({
  47577. message: `The boolean value "${interop}" for the "output.interop" option is deprecated. Use ${interop ? '"auto"' : '"esModule", "default" or "defaultOnly"'} instead.`,
  47578. url: 'https://rollupjs.org/guide/en/#outputinterop'
  47579. }, false, inputOptions);
  47580. }
  47581. }
  47582. return interop;
  47583. };
  47584. if (typeof configInterop === 'function') {
  47585. const interopPerId = Object.create(null);
  47586. let defaultInterop = null;
  47587. return id => id === null
  47588. ? defaultInterop || validateInterop((defaultInterop = configInterop(id)))
  47589. : id in interopPerId
  47590. ? interopPerId[id]
  47591. : validateInterop((interopPerId[id] = configInterop(id)));
  47592. }
  47593. return configInterop === undefined ? () => true : () => validateInterop(configInterop);
  47594. };
  47595. const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOptions) => {
  47596. const configManualChunks = config.manualChunks || inputOptions.manualChunks;
  47597. if (configManualChunks) {
  47598. if (inlineDynamicImports) {
  47599. return error({
  47600. code: 'INVALID_OPTION',
  47601. message: 'The "output.manualChunks" option is not supported for "output.inlineDynamicImports".'
  47602. });
  47603. }
  47604. if (preserveModules) {
  47605. return error({
  47606. code: 'INVALID_OPTION',
  47607. message: 'The "output.manualChunks" option is not supported for "output.preserveModules".'
  47608. });
  47609. }
  47610. }
  47611. return configManualChunks || {};
  47612. };
  47613. const getMinifyInternalExports = (config, format, compact) => { var _a; return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system'); };
  47614. function rollup(rawInputOptions) {
  47615. return rollupInternal(rawInputOptions, null);
  47616. }
  47617. async function rollupInternal(rawInputOptions, watcher) {
  47618. const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, watcher !== null);
  47619. initialiseTimers(inputOptions);
  47620. const graph = new Graph(inputOptions, watcher);
  47621. // remove the cache option from the memory after graph creation (cache is not used anymore)
  47622. const useCache = rawInputOptions.cache !== false;
  47623. delete inputOptions.cache;
  47624. delete rawInputOptions.cache;
  47625. timeStart('BUILD', 1);
  47626. try {
  47627. await graph.pluginDriver.hookParallel('buildStart', [inputOptions]);
  47628. await graph.build();
  47629. }
  47630. catch (err) {
  47631. const watchFiles = Object.keys(graph.watchFiles);
  47632. if (watchFiles.length > 0) {
  47633. err.watchFiles = watchFiles;
  47634. }
  47635. await graph.pluginDriver.hookParallel('buildEnd', [err]);
  47636. await graph.pluginDriver.hookParallel('closeBundle', []);
  47637. throw err;
  47638. }
  47639. await graph.pluginDriver.hookParallel('buildEnd', []);
  47640. timeEnd('BUILD', 1);
  47641. const result = {
  47642. cache: useCache ? graph.getCache() : undefined,
  47643. closed: false,
  47644. async close() {
  47645. if (result.closed)
  47646. return;
  47647. result.closed = true;
  47648. await graph.pluginDriver.hookParallel('closeBundle', []);
  47649. },
  47650. async generate(rawOutputOptions) {
  47651. if (result.closed)
  47652. return error(errAlreadyClosed());
  47653. return handleGenerateWrite(false, inputOptions, unsetInputOptions, rawOutputOptions, graph);
  47654. },
  47655. watchFiles: Object.keys(graph.watchFiles),
  47656. async write(rawOutputOptions) {
  47657. if (result.closed)
  47658. return error(errAlreadyClosed());
  47659. return handleGenerateWrite(true, inputOptions, unsetInputOptions, rawOutputOptions, graph);
  47660. }
  47661. };
  47662. if (inputOptions.perf)
  47663. result.getTimings = getTimings;
  47664. return result;
  47665. }
  47666. async function getInputOptions(rawInputOptions, watchMode) {
  47667. if (!rawInputOptions) {
  47668. throw new Error('You must supply an options object to rollup');
  47669. }
  47670. const rawPlugins = ensureArray(rawInputOptions.plugins);
  47671. const { options, unsetOptions } = normalizeInputOptions(await rawPlugins.reduce(applyOptionHook(watchMode), Promise.resolve(rawInputOptions)));
  47672. normalizePlugins(options.plugins, ANONYMOUS_PLUGIN_PREFIX);
  47673. return { options, unsetOptions };
  47674. }
  47675. function applyOptionHook(watchMode) {
  47676. return async (inputOptions, plugin) => {
  47677. if (plugin.options)
  47678. return (plugin.options.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions) || inputOptions);
  47679. return inputOptions;
  47680. };
  47681. }
  47682. function normalizePlugins(plugins, anonymousPrefix) {
  47683. for (let pluginIndex = 0; pluginIndex < plugins.length; pluginIndex++) {
  47684. const plugin = plugins[pluginIndex];
  47685. if (!plugin.name) {
  47686. plugin.name = `${anonymousPrefix}${pluginIndex + 1}`;
  47687. }
  47688. }
  47689. }
  47690. async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutputOptions, graph) {
  47691. const { options: outputOptions, outputPluginDriver, unsetOptions } = getOutputOptionsAndPluginDriver(rawOutputOptions, graph.pluginDriver, inputOptions, unsetInputOptions);
  47692. const bundle = new Bundle(outputOptions, unsetOptions, inputOptions, outputPluginDriver, graph);
  47693. const generated = await bundle.generate(isWrite);
  47694. if (isWrite) {
  47695. if (!outputOptions.dir && !outputOptions.file) {
  47696. return error({
  47697. code: 'MISSING_OPTION',
  47698. message: 'You must specify "output.file" or "output.dir" for the build.'
  47699. });
  47700. }
  47701. await Promise.all(Object.keys(generated).map(chunkId => writeOutputFile(generated[chunkId], outputOptions)));
  47702. await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
  47703. }
  47704. return createOutput(generated);
  47705. }
  47706. function getOutputOptionsAndPluginDriver(rawOutputOptions, inputPluginDriver, inputOptions, unsetInputOptions) {
  47707. if (!rawOutputOptions) {
  47708. throw new Error('You must supply an options object');
  47709. }
  47710. const rawPlugins = ensureArray(rawOutputOptions.plugins);
  47711. normalizePlugins(rawPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
  47712. const outputPluginDriver = inputPluginDriver.createOutputPluginDriver(rawPlugins);
  47713. return {
  47714. ...getOutputOptions(inputOptions, unsetInputOptions, rawOutputOptions, outputPluginDriver),
  47715. outputPluginDriver
  47716. };
  47717. }
  47718. function getOutputOptions(inputOptions, unsetInputOptions, rawOutputOptions, outputPluginDriver) {
  47719. return normalizeOutputOptions(outputPluginDriver.hookReduceArg0Sync('outputOptions', [rawOutputOptions.output || rawOutputOptions], (outputOptions, result) => result || outputOptions, pluginContext => {
  47720. const emitError = () => pluginContext.error(errCannotEmitFromOptionsHook());
  47721. return {
  47722. ...pluginContext,
  47723. emitFile: emitError,
  47724. setAssetSource: emitError
  47725. };
  47726. }), inputOptions, unsetInputOptions);
  47727. }
  47728. function createOutput(outputBundle) {
  47729. return {
  47730. output: Object.keys(outputBundle)
  47731. .map(fileName => outputBundle[fileName])
  47732. .filter(outputFile => Object.keys(outputFile).length > 0).sort((outputFileA, outputFileB) => {
  47733. const fileTypeA = getSortingFileType(outputFileA);
  47734. const fileTypeB = getSortingFileType(outputFileB);
  47735. if (fileTypeA === fileTypeB)
  47736. return 0;
  47737. return fileTypeA < fileTypeB ? -1 : 1;
  47738. })
  47739. };
  47740. }
  47741. var SortingFileType;
  47742. (function (SortingFileType) {
  47743. SortingFileType[SortingFileType["ENTRY_CHUNK"] = 0] = "ENTRY_CHUNK";
  47744. SortingFileType[SortingFileType["SECONDARY_CHUNK"] = 1] = "SECONDARY_CHUNK";
  47745. SortingFileType[SortingFileType["ASSET"] = 2] = "ASSET";
  47746. })(SortingFileType || (SortingFileType = {}));
  47747. function getSortingFileType(file) {
  47748. if (file.type === 'asset') {
  47749. return SortingFileType.ASSET;
  47750. }
  47751. if (file.isEntry) {
  47752. return SortingFileType.ENTRY_CHUNK;
  47753. }
  47754. return SortingFileType.SECONDARY_CHUNK;
  47755. }
  47756. function writeOutputFile(outputFile, outputOptions) {
  47757. const fileName = resolve$1(outputOptions.dir || dirname(outputOptions.file), outputFile.fileName);
  47758. let writeSourceMapPromise;
  47759. let source;
  47760. if (outputFile.type === 'asset') {
  47761. source = outputFile.source;
  47762. }
  47763. else {
  47764. source = outputFile.code;
  47765. if (outputOptions.sourcemap && outputFile.map) {
  47766. let url;
  47767. if (outputOptions.sourcemap === 'inline') {
  47768. url = outputFile.map.toUrl();
  47769. }
  47770. else {
  47771. url = `${basename(outputFile.fileName)}.map`;
  47772. writeSourceMapPromise = writeFile(`${fileName}.map`, outputFile.map.toString());
  47773. }
  47774. if (outputOptions.sourcemap !== 'hidden') {
  47775. source += `//# ${SOURCEMAPPING_URL}=${url}\n`;
  47776. }
  47777. }
  47778. }
  47779. return Promise.all([writeFile(fileName, source), writeSourceMapPromise]);
  47780. }
  47781. const lazyComponentPlugin = (buildCtx) => {
  47782. const entrys = new Map();
  47783. const plugin = {
  47784. name: 'lazyComponentPlugin',
  47785. resolveId(importee) {
  47786. const entryModule = buildCtx.entryModules.find((entryModule) => entryModule.entryKey === importee);
  47787. if (entryModule) {
  47788. entrys.set(importee, entryModule);
  47789. return importee;
  47790. }
  47791. return null;
  47792. },
  47793. load(id) {
  47794. const entryModule = entrys.get(id);
  47795. if (entryModule) {
  47796. return entryModule.cmps.map(createComponentExport).join('\n');
  47797. }
  47798. return null;
  47799. },
  47800. };
  47801. return plugin;
  47802. };
  47803. const createComponentExport = (cmp) => {
  47804. const originalClassName = cmp.componentClassName;
  47805. const underscoredClassName = cmp.tagName.replace(/-/g, '_');
  47806. const filePath = normalizePath$1(cmp.sourceFilePath);
  47807. return `export { ${originalClassName} as ${underscoredClassName} } from '${filePath}';`;
  47808. };
  47809. const removeCollectionImports = (compilerCtx) => {
  47810. /*
  47811. // remove side effect collection imports like:
  47812. import 'ionicons';
  47813. // do not remove collection imports with importClauses:
  47814. import * as asdf 'ionicons';
  47815. import { asdf } '@ionic/core';
  47816. */
  47817. return () => {
  47818. return (tsSourceFile) => {
  47819. let madeUpdates = false;
  47820. const statements = tsSourceFile.statements.slice();
  47821. for (let i = statements.length - 1; i >= 0; i--) {
  47822. const n = statements[i];
  47823. if (t.isImportDeclaration(n)) {
  47824. if (!n.importClause && n.moduleSpecifier && t.isStringLiteral(n.moduleSpecifier)) {
  47825. // must not have an import clause
  47826. // must have a module specifier and
  47827. // the module specifier must be a string literal
  47828. const importPath = n.moduleSpecifier.text;
  47829. // test if this side effect import is a collection
  47830. const isCollectionImport = compilerCtx.collections.some((c) => {
  47831. return c.collectionName === importPath || c.moduleId === importPath;
  47832. });
  47833. if (isCollectionImport) {
  47834. // turns out this is a side effect import is a collection,
  47835. // we actually don't want to include this in the JS output
  47836. // we've already gather the types we needed, kthxbai
  47837. madeUpdates = true;
  47838. statements.splice(i, 1);
  47839. }
  47840. }
  47841. }
  47842. }
  47843. if (madeUpdates) {
  47844. return t.updateSourceFileNode(tsSourceFile, statements);
  47845. }
  47846. return tsSourceFile;
  47847. };
  47848. };
  47849. };
  47850. const STENCIL_CORE_ID = '@stencil/core';
  47851. const STENCIL_INTERNAL_ID = '@stencil/core/internal';
  47852. const STENCIL_APP_DATA_ID = '@stencil/core/internal/app-data';
  47853. const STENCIL_APP_GLOBALS_ID = '@stencil/core/internal/app-globals';
  47854. const STENCIL_HYDRATE_FACTORY_ID = '@stencil/core/hydrate-factory';
  47855. const STENCIL_INTERNAL_CLIENT_ID = '@stencil/core/internal/client';
  47856. const STENCIL_INTERNAL_CLIENT_PATCH_BROWSER_ID = '@stencil/core/internal/client/patch-browser';
  47857. const STENCIL_INTERNAL_CLIENT_PATCH_ESM_ID = '@stencil/core/internal/client/patch-esm';
  47858. const STENCIL_INTERNAL_HYDRATE_ID = '@stencil/core/internal/hydrate';
  47859. const STENCIL_MOCK_DOC_ID = '@stencil/core/mock-doc';
  47860. const APP_DATA_CONDITIONAL = '?app-data=conditional';
  47861. const LAZY_BROWSER_ENTRY_ID = '@lazy-browser-entrypoint' + APP_DATA_CONDITIONAL;
  47862. const LAZY_EXTERNAL_ENTRY_ID = '@lazy-external-entrypoint' + APP_DATA_CONDITIONAL;
  47863. const USER_INDEX_ENTRY_ID = '@user-index-entrypoint';
  47864. const appDataPlugin = (config, compilerCtx, buildCtx, build, platform) => {
  47865. if (!platform) {
  47866. return {
  47867. name: 'appDataPlugin',
  47868. };
  47869. }
  47870. const globalScripts = getGlobalScriptData(config, compilerCtx);
  47871. return {
  47872. name: 'appDataPlugin',
  47873. resolveId(id, importer) {
  47874. if (id === STENCIL_APP_DATA_ID || id === STENCIL_APP_GLOBALS_ID) {
  47875. if (platform === 'worker') {
  47876. this.error('@stencil/core packages cannot be imported from a worker.');
  47877. }
  47878. if (platform === 'hydrate' || STENCIL_APP_GLOBALS_ID) {
  47879. // hydrate will always bundle app-data and runtime
  47880. // and the load() fn will build a custom globals import
  47881. return id;
  47882. }
  47883. else if (platform === 'client' && importer && importer.endsWith(APP_DATA_CONDITIONAL)) {
  47884. // since the importer ends with ?app-data=conditional we know that
  47885. // we need to build custom app-data based off of component metadata
  47886. // return the same "id" so that the "load()" method knows to
  47887. // build custom app-data
  47888. return id;
  47889. }
  47890. // for a client build that does not have ?app-data=conditional at the end then we
  47891. // do not want to create custom app-data, but should use the default
  47892. }
  47893. return null;
  47894. },
  47895. load(id) {
  47896. if (id === STENCIL_APP_GLOBALS_ID) {
  47897. const s = new MagicString$3(``);
  47898. appendGlobalScripts(globalScripts, s);
  47899. return s.toString();
  47900. }
  47901. if (id === STENCIL_APP_DATA_ID) {
  47902. // build custom app-data based off of component metadata
  47903. const s = new MagicString$3(``);
  47904. appendNamespace(config, s);
  47905. appendBuildConditionals(config, build, s);
  47906. appendEnv(config, s);
  47907. return s.toString();
  47908. }
  47909. if (id !== config.globalScript) {
  47910. return null;
  47911. }
  47912. const module = compilerCtx.moduleMap.get(config.globalScript);
  47913. if (!module) {
  47914. return null;
  47915. }
  47916. else if (!module.sourceMapFileText) {
  47917. return {
  47918. code: module.staticSourceFileText,
  47919. map: null,
  47920. };
  47921. }
  47922. const sourceMap = JSON.parse(module.sourceMapFileText);
  47923. sourceMap.sources = sourceMap.sources.map((src) => basename(src));
  47924. return { code: module.staticSourceFileText, map: sourceMap };
  47925. },
  47926. transform(code, id) {
  47927. id = normalizePath$1(id);
  47928. if (globalScripts.some((s) => s.path === id)) {
  47929. const program = this.parse(code, {});
  47930. const needsDefault = !program.body.some((s) => s.type === 'ExportDefaultDeclaration');
  47931. const defaultExport = needsDefault ? '\nexport const globalFn = () => {};\nexport default globalFn;' : '';
  47932. code = getContextImport(platform) + code + defaultExport;
  47933. const compilerOptions = { ...config.tsCompilerOptions };
  47934. compilerOptions.module = t.ModuleKind.ESNext;
  47935. const results = t.transpileModule(code, {
  47936. compilerOptions,
  47937. fileName: id,
  47938. transformers: {
  47939. after: [removeCollectionImports(compilerCtx)],
  47940. },
  47941. });
  47942. buildCtx.diagnostics.push(...loadTypeScriptDiagnostics(results.diagnostics));
  47943. if (config.sourceMap) {
  47944. // generate the sourcemap for global script
  47945. const codeMs = new MagicString$3(code);
  47946. const codeMap = codeMs.generateMap({
  47947. source: id,
  47948. // this is the name of the sourcemap, not to be confused with the `file` field in a generated sourcemap
  47949. file: id + '.map',
  47950. includeContent: true,
  47951. hires: true,
  47952. });
  47953. return { code: results.outputText, map: codeMap };
  47954. }
  47955. return { code: results.outputText };
  47956. }
  47957. return null;
  47958. },
  47959. };
  47960. };
  47961. const getGlobalScriptData = (config, compilerCtx) => {
  47962. const globalScripts = [];
  47963. if (isString$1(config.globalScript)) {
  47964. const mod = compilerCtx.moduleMap.get(config.globalScript);
  47965. const globalScript = compilerCtx.version === 2 ? config.globalScript : mod && mod.jsFilePath;
  47966. if (globalScript) {
  47967. globalScripts.push({
  47968. defaultName: createJsVarName(config.namespace + 'GlobalScript'),
  47969. path: normalizePath$1(globalScript),
  47970. });
  47971. }
  47972. }
  47973. compilerCtx.collections.forEach((collection) => {
  47974. if (collection.global != null && isString$1(collection.global.sourceFilePath)) {
  47975. let defaultName = createJsVarName(collection.collectionName + 'GlobalScript');
  47976. if (globalScripts.some((s) => s.defaultName === defaultName)) {
  47977. defaultName += globalScripts.length;
  47978. }
  47979. globalScripts.push({
  47980. defaultName,
  47981. path: normalizePath$1(collection.global.sourceFilePath),
  47982. });
  47983. }
  47984. });
  47985. return globalScripts;
  47986. };
  47987. const appendGlobalScripts = (globalScripts, s) => {
  47988. if (globalScripts.length === 1) {
  47989. s.prepend(`import appGlobalScript from '${globalScripts[0].path}';\n`);
  47990. s.append(`export const globalScripts = appGlobalScript;\n`);
  47991. }
  47992. else if (globalScripts.length > 1) {
  47993. globalScripts.forEach((globalScript) => {
  47994. s.prepend(`import ${globalScript.defaultName} from '${globalScript.path}';\n`);
  47995. });
  47996. s.append(`export const globalScripts = () => {\n`);
  47997. globalScripts.forEach((globalScript) => {
  47998. s.append(` ${globalScript.defaultName}();\n`);
  47999. });
  48000. s.append(`};\n`);
  48001. }
  48002. else {
  48003. s.append(`export const globalScripts = () => {};\n`);
  48004. }
  48005. };
  48006. const appendBuildConditionals = (config, build, s) => {
  48007. const buildData = Object.keys(build)
  48008. .sort()
  48009. .map((key) => key + ': ' + (build[key] ? 'true' : 'false'))
  48010. .join(', ');
  48011. s.append(`export const BUILD = /* ${config.fsNamespace} */ { ${buildData} };\n`);
  48012. };
  48013. const appendEnv = (config, s) => {
  48014. s.append(`export const Env = /* ${config.fsNamespace} */ ${JSON.stringify(config.env)};\n`);
  48015. };
  48016. const appendNamespace = (config, s) => {
  48017. s.append(`export const NAMESPACE = '${config.fsNamespace}';\n`);
  48018. };
  48019. const getContextImport = (platform) => {
  48020. return `import { Context } from '${platform === 'hydrate' ? STENCIL_INTERNAL_HYDRATE_ID : STENCIL_CORE_ID}';\n`;
  48021. };
  48022. const coreResolvePlugin = (config, compilerCtx, platform, externalRuntime) => {
  48023. const compilerExe = config.sys.getCompilerExecutingPath();
  48024. const internalClient = getStencilInternalModule(config, compilerExe, 'client/index.js');
  48025. const internalClientPatchBrowser = getStencilInternalModule(config, compilerExe, 'client/patch-browser.js');
  48026. const internalClientPatchEsm = getStencilInternalModule(config, compilerExe, 'client/patch-esm.js');
  48027. const internalHydrate = getStencilInternalModule(config, compilerExe, 'hydrate/index.js');
  48028. return {
  48029. name: 'coreResolvePlugin',
  48030. resolveId(id) {
  48031. if (id === STENCIL_CORE_ID || id === STENCIL_INTERNAL_ID) {
  48032. if (platform === 'client') {
  48033. if (externalRuntime) {
  48034. return {
  48035. id: STENCIL_INTERNAL_CLIENT_ID,
  48036. external: true,
  48037. };
  48038. }
  48039. // adding ?app-data=conditional as an identifier to ensure we don't
  48040. // use the default app-data, but build a custom one based on component meta
  48041. return internalClient + APP_DATA_CONDITIONAL;
  48042. }
  48043. if (platform === 'hydrate') {
  48044. return internalHydrate;
  48045. }
  48046. }
  48047. if (id === STENCIL_INTERNAL_CLIENT_ID) {
  48048. if (externalRuntime) {
  48049. // not bunding the client runtime and the user's component together this
  48050. // must be the custom elements build, where @stencil/core/internal/client
  48051. // is an import, rather than bundling
  48052. return {
  48053. id: STENCIL_INTERNAL_CLIENT_ID,
  48054. external: true,
  48055. };
  48056. }
  48057. // importing @stencil/core/internal/client directly, so it shouldn't get
  48058. // the custom app-data conditionals
  48059. return internalClient;
  48060. }
  48061. if (id === STENCIL_INTERNAL_CLIENT_PATCH_BROWSER_ID) {
  48062. if (externalRuntime) {
  48063. return {
  48064. id: STENCIL_INTERNAL_CLIENT_PATCH_BROWSER_ID,
  48065. external: true,
  48066. };
  48067. }
  48068. return internalClientPatchBrowser;
  48069. }
  48070. if (id === STENCIL_INTERNAL_CLIENT_PATCH_ESM_ID) {
  48071. if (externalRuntime) {
  48072. return {
  48073. id: STENCIL_INTERNAL_CLIENT_PATCH_ESM_ID,
  48074. external: true,
  48075. };
  48076. }
  48077. return internalClientPatchEsm;
  48078. }
  48079. if (id === STENCIL_INTERNAL_HYDRATE_ID) {
  48080. return internalHydrate;
  48081. }
  48082. return null;
  48083. },
  48084. async load(filePath) {
  48085. if (filePath && !filePath.startsWith('\0')) {
  48086. filePath = normalizeFsPath(filePath);
  48087. if (filePath === internalClient || filePath === internalHydrate) {
  48088. if (platform === 'worker') {
  48089. return `
  48090. export const Build = {
  48091. isDev: ${config.devMode},
  48092. isBrowser: true,
  48093. isServer: false,
  48094. isTesting: false,
  48095. };`;
  48096. }
  48097. let code = await compilerCtx.fs.readFile(filePath);
  48098. if (typeof code !== 'string' && isRemoteUrl(compilerExe)) {
  48099. const url = getStencilModuleUrl(compilerExe, filePath);
  48100. code = await fetchModuleAsync(config.sys, compilerCtx.fs, packageVersions, url, filePath);
  48101. }
  48102. if (typeof code === 'string') {
  48103. const hydratedFlag = config.hydratedFlag;
  48104. if (hydratedFlag) {
  48105. const hydratedFlagHead = getHydratedFlagHead(hydratedFlag);
  48106. if (HYDRATED_CSS !== hydratedFlagHead) {
  48107. code = code.replace(HYDRATED_CSS, hydratedFlagHead);
  48108. if (hydratedFlag.name !== 'hydrated') {
  48109. code = code.replace(`.classList.add("hydrated")`, `.classList.add("${hydratedFlag.name}")`);
  48110. code = code.replace(`.classList.add('hydrated')`, `.classList.add('${hydratedFlag.name}')`);
  48111. code = code.replace(`.setAttribute("hydrated",`, `.setAttribute("${hydratedFlag.name}",`);
  48112. code = code.replace(`.setAttribute('hydrated',`, `.setAttribute('${hydratedFlag.name}',`);
  48113. }
  48114. }
  48115. }
  48116. else {
  48117. code = code.replace(HYDRATED_CSS, '{}');
  48118. }
  48119. }
  48120. return code;
  48121. }
  48122. }
  48123. return null;
  48124. },
  48125. resolveImportMeta(prop, { format }) {
  48126. if (config.extras.dynamicImportShim && prop === 'url' && format === 'es') {
  48127. return '""';
  48128. }
  48129. return null;
  48130. },
  48131. };
  48132. };
  48133. const getStencilInternalModule = (config, compilerExe, internalModule) => {
  48134. if (isRemoteUrl(compilerExe)) {
  48135. return normalizePath$1(config.sys.getLocalModulePath({
  48136. rootDir: config.rootDir,
  48137. moduleId: '@stencil/core',
  48138. path: 'internal/' + internalModule,
  48139. }));
  48140. }
  48141. const compilerExeDir = dirname(compilerExe);
  48142. return normalizePath$1(join(compilerExeDir, '..', 'internal', internalModule));
  48143. };
  48144. const getHydratedFlagHead = (h) => {
  48145. // {visibility:hidden}.hydrated{visibility:inherit}
  48146. let initial;
  48147. let hydrated;
  48148. if (!String(h.initialValue) || h.initialValue === '' || h.initialValue == null) {
  48149. initial = '';
  48150. }
  48151. else {
  48152. initial = `{${h.property}:${h.initialValue}}`;
  48153. }
  48154. const selector = h.selector === 'attribute' ? `[${h.name}]` : `.${h.name}`;
  48155. if (!String(h.hydratedValue) || h.hydratedValue === '' || h.hydratedValue == null) {
  48156. hydrated = '';
  48157. }
  48158. else {
  48159. hydrated = `${selector}{${h.property}:${h.hydratedValue}}`;
  48160. }
  48161. return initial + hydrated;
  48162. };
  48163. /**
  48164. * A new BuildCtx object is created for every build
  48165. * and rebuild.
  48166. */
  48167. class BuildContext {
  48168. constructor(config, compilerCtx) {
  48169. this.buildId = -1;
  48170. this.buildMessages = [];
  48171. this.buildResults = null;
  48172. this.bundleBuildCount = 0;
  48173. this.collections = [];
  48174. this.completedTasks = [];
  48175. this.components = [];
  48176. this.componentGraph = new Map();
  48177. this.data = {};
  48178. this.buildStats = undefined;
  48179. this.diagnostics = [];
  48180. this.dirsAdded = [];
  48181. this.dirsDeleted = [];
  48182. this.entryModules = [];
  48183. this.filesAdded = [];
  48184. this.filesChanged = [];
  48185. this.filesDeleted = [];
  48186. this.filesUpdated = [];
  48187. this.filesWritten = [];
  48188. this.globalStyle = undefined;
  48189. this.hasConfigChanges = false;
  48190. this.hasFinished = false;
  48191. this.hasHtmlChanges = false;
  48192. this.hasPrintedResults = false;
  48193. this.hasServiceWorkerChanges = false;
  48194. this.hasScriptChanges = true;
  48195. this.hasStyleChanges = true;
  48196. this.hydrateAppFilePath = null;
  48197. this.indexBuildCount = 0;
  48198. this.indexDoc = undefined;
  48199. this.isRebuild = false;
  48200. this.moduleFiles = [];
  48201. this.outputs = [];
  48202. this.packageJson = {};
  48203. this.packageJsonFilePath = null;
  48204. this.pendingCopyTasks = [];
  48205. this.requiresFullBuild = true;
  48206. this.scriptsAdded = [];
  48207. this.scriptsDeleted = [];
  48208. this.startTime = Date.now();
  48209. this.styleBuildCount = 0;
  48210. this.stylesPromise = null;
  48211. this.stylesUpdated = [];
  48212. this.timeSpan = null;
  48213. this.transpileBuildCount = 0;
  48214. this.config = config;
  48215. this.compilerCtx = compilerCtx;
  48216. this.buildId = ++this.compilerCtx.activeBuildId;
  48217. this.debug = config.logger.debug.bind(config.logger);
  48218. }
  48219. start() {
  48220. // get the build id from the incremented activeBuildId
  48221. // print out a good message
  48222. const msg = `${this.isRebuild ? 'rebuild' : 'build'}, ${this.config.fsNamespace}, ${this.config.devMode ? 'dev' : 'prod'} mode, started`;
  48223. const buildLog = {
  48224. buildId: this.buildId,
  48225. messages: [],
  48226. progress: 0,
  48227. };
  48228. this.compilerCtx.events.emit('buildLog', buildLog);
  48229. // create a timespan for this build
  48230. this.timeSpan = this.createTimeSpan(msg);
  48231. // create a build timestamp for this build
  48232. this.timestamp = getBuildTimestamp();
  48233. // debug log our new build
  48234. this.debug(`start build, ${this.timestamp}`);
  48235. const buildStart = {
  48236. buildId: this.buildId,
  48237. timestamp: this.timestamp,
  48238. };
  48239. this.compilerCtx.events.emit('buildStart', buildStart);
  48240. }
  48241. createTimeSpan(msg, debug) {
  48242. if (!this.hasFinished || debug) {
  48243. if (debug) {
  48244. if (this.config.watch) {
  48245. msg = `${this.config.logger.cyan('[' + this.buildId + ']')} ${msg}`;
  48246. }
  48247. }
  48248. const timeSpan = this.config.logger.createTimeSpan(msg, debug, this.buildMessages);
  48249. if (!debug && this.compilerCtx.events) {
  48250. const buildLog = {
  48251. buildId: this.buildId,
  48252. messages: this.buildMessages,
  48253. progress: getProgress(this.completedTasks),
  48254. };
  48255. this.compilerCtx.events.emit('buildLog', buildLog);
  48256. }
  48257. return {
  48258. duration: () => {
  48259. return timeSpan.duration();
  48260. },
  48261. finish: (finishedMsg, color, bold, newLineSuffix) => {
  48262. if (!this.hasFinished || debug) {
  48263. if (debug) {
  48264. if (this.config.watch) {
  48265. finishedMsg = `${this.config.logger.cyan('[' + this.buildId + ']')} ${finishedMsg}`;
  48266. }
  48267. }
  48268. timeSpan.finish(finishedMsg, color, bold, newLineSuffix);
  48269. if (!debug) {
  48270. const buildLog = {
  48271. buildId: this.buildId,
  48272. messages: this.buildMessages.slice(),
  48273. progress: getProgress(this.completedTasks),
  48274. };
  48275. this.compilerCtx.events.emit('buildLog', buildLog);
  48276. }
  48277. }
  48278. return timeSpan.duration();
  48279. },
  48280. };
  48281. }
  48282. return {
  48283. duration() {
  48284. return 0;
  48285. },
  48286. finish() {
  48287. return 0;
  48288. },
  48289. };
  48290. }
  48291. debug(msg) {
  48292. this.config.logger.debug(msg);
  48293. }
  48294. get hasError() {
  48295. return hasError(this.diagnostics);
  48296. }
  48297. get hasWarning() {
  48298. return hasWarning(this.diagnostics);
  48299. }
  48300. progress(t) {
  48301. this.completedTasks.push(t);
  48302. }
  48303. async validateTypesBuild() {
  48304. if (this.hasError) {
  48305. // no need to wait on this one since
  48306. // we already aborted this build
  48307. return;
  48308. }
  48309. if (!this.validateTypesPromise) {
  48310. // there is no pending validate types promise
  48311. // so it probably already finished
  48312. // so no need to wait on anything
  48313. return;
  48314. }
  48315. if (!this.config.watch) {
  48316. // this is not a watch build, so we need to make
  48317. // sure that the type validation has finished
  48318. this.debug(`build, non-watch, waiting on validateTypes`);
  48319. await this.validateTypesPromise;
  48320. this.debug(`build, non-watch, finished waiting on validateTypes`);
  48321. }
  48322. }
  48323. }
  48324. const getBuildTimestamp = () => {
  48325. const d = new Date();
  48326. // YYYY-MM-DDThh:mm:ss
  48327. let timestamp = d.getUTCFullYear() + '-';
  48328. timestamp += ('0' + (d.getUTCMonth() + 1)).slice(-2) + '-';
  48329. timestamp += ('0' + d.getUTCDate()).slice(-2) + 'T';
  48330. timestamp += ('0' + d.getUTCHours()).slice(-2) + ':';
  48331. timestamp += ('0' + d.getUTCMinutes()).slice(-2) + ':';
  48332. timestamp += ('0' + d.getUTCSeconds()).slice(-2);
  48333. return timestamp;
  48334. };
  48335. const getProgress = (completedTasks) => {
  48336. let progressIndex = 0;
  48337. const taskKeys = Object.keys(ProgressTask);
  48338. taskKeys.forEach((taskKey, index) => {
  48339. if (completedTasks.includes(ProgressTask[taskKey])) {
  48340. progressIndex = index;
  48341. }
  48342. });
  48343. return (progressIndex + 1) / taskKeys.length;
  48344. };
  48345. const ProgressTask = {
  48346. emptyOutputTargets: {},
  48347. transpileApp: {},
  48348. generateStyles: {},
  48349. generateOutputTargets: {},
  48350. validateTypesBuild: {},
  48351. writeBuildFiles: {},
  48352. };
  48353. const devNodeModuleResolveId = async (config, inMemoryFs, resolvedId, importee) => {
  48354. if (!shouldCheckDevModule(resolvedId, importee)) {
  48355. return resolvedId;
  48356. }
  48357. const resolvedPath = resolvedId.id;
  48358. const pkgPath = getPackageJsonPath(resolvedPath, importee);
  48359. if (!pkgPath) {
  48360. return resolvedId;
  48361. }
  48362. const pkgJsonStr = await inMemoryFs.readFile(pkgPath);
  48363. if (!pkgJsonStr) {
  48364. return resolvedId;
  48365. }
  48366. let pkgJsonData;
  48367. try {
  48368. pkgJsonData = JSON.parse(pkgJsonStr);
  48369. }
  48370. catch (e) { }
  48371. if (!pkgJsonData || !pkgJsonData.version) {
  48372. return resolvedId;
  48373. }
  48374. resolvedId.id = serializeDevNodeModuleUrl(config, pkgJsonData.name, pkgJsonData.version, resolvedPath);
  48375. resolvedId.external = true;
  48376. return resolvedId;
  48377. };
  48378. const getPackageJsonPath = (resolvedPath, importee) => {
  48379. let currentPath = resolvedPath;
  48380. for (let i = 0; i < 10; i++) {
  48381. currentPath = dirname(currentPath);
  48382. const aBasename = basename(currentPath);
  48383. const upDir = dirname(currentPath);
  48384. const bBasename = basename(upDir);
  48385. if (aBasename === importee && bBasename === 'node_modules') {
  48386. return join(currentPath, 'package.json');
  48387. }
  48388. }
  48389. return null;
  48390. };
  48391. const compilerRequest = async (config, compilerCtx, data) => {
  48392. const results = {
  48393. path: data.path,
  48394. nodeModuleId: null,
  48395. nodeModuleVersion: null,
  48396. nodeResolvedPath: null,
  48397. cachePath: null,
  48398. cacheHit: false,
  48399. content: '',
  48400. status: 404,
  48401. };
  48402. try {
  48403. const parsedUrl = parseDevModuleUrl(config, data.path);
  48404. Object.assign(results, parsedUrl);
  48405. if (parsedUrl.nodeModuleId) {
  48406. if (!parsedUrl.nodeModuleVersion) {
  48407. results.content = `/* invalid module version */`;
  48408. results.status = 400;
  48409. return results;
  48410. }
  48411. if (!parsedUrl.nodeResolvedPath) {
  48412. results.content = `/* invalid resolved path */`;
  48413. results.status = 400;
  48414. return results;
  48415. }
  48416. const useCache = await useDevModuleCache(config, parsedUrl.nodeResolvedPath);
  48417. let cachePath = null;
  48418. if (useCache) {
  48419. cachePath = getDevModuleCachePath(config, parsedUrl);
  48420. const cachedContent = await config.sys.readFile(cachePath);
  48421. if (typeof cachedContent === 'string') {
  48422. results.content = cachedContent;
  48423. results.cachePath = cachePath;
  48424. results.cacheHit = true;
  48425. results.status = 200;
  48426. return results;
  48427. }
  48428. }
  48429. await bundleDevModule(config, compilerCtx, parsedUrl, results);
  48430. if (results.status === 200 && useCache) {
  48431. results.cachePath = cachePath;
  48432. writeCachedFile(config, results);
  48433. }
  48434. }
  48435. else {
  48436. results.content = `/* invalid dev module */`;
  48437. results.status = 400;
  48438. return results;
  48439. }
  48440. }
  48441. catch (e) {
  48442. if (e) {
  48443. if (e instanceof Error && e.stack) {
  48444. results.content = `/*\n${e.stack}\n*/`;
  48445. }
  48446. else {
  48447. results.content = `/*\n${e}\n*/`;
  48448. }
  48449. }
  48450. results.status = 500;
  48451. }
  48452. return results;
  48453. };
  48454. const bundleDevModule = async (config, compilerCtx, parsedUrl, results) => {
  48455. const buildCtx = new BuildContext(config, compilerCtx);
  48456. try {
  48457. const inputOpts = getRollupOptions(config, compilerCtx, buildCtx, {
  48458. id: parsedUrl.nodeModuleId,
  48459. platform: 'client',
  48460. inputs: {
  48461. index: parsedUrl.nodeResolvedPath,
  48462. },
  48463. });
  48464. const rollupBuild = await rollup(inputOpts);
  48465. const outputOpts = {
  48466. banner: generatePreamble(config),
  48467. format: 'es',
  48468. };
  48469. if (parsedUrl.nodeModuleId) {
  48470. const commentPath = relative$1(config.rootDir, parsedUrl.nodeResolvedPath);
  48471. outputOpts.intro = `/**\n * Dev Node Module: ${parsedUrl.nodeModuleId}, v${parsedUrl.nodeModuleVersion}\n * Entry: ${commentPath}\n * DEVELOPMENT PURPOSES ONLY!!\n */`;
  48472. inputOpts.input = parsedUrl.nodeResolvedPath;
  48473. }
  48474. const r = await rollupBuild.generate(outputOpts);
  48475. if (buildCtx.hasError) {
  48476. results.status = 500;
  48477. results.content = `console.error(${JSON.stringify(buildCtx.diagnostics)})`;
  48478. }
  48479. else if (r && r.output && r.output.length > 0) {
  48480. results.content = r.output[0].code;
  48481. results.status = 200;
  48482. }
  48483. }
  48484. catch (e) {
  48485. results.status = 500;
  48486. const errorMsg = e instanceof Error ? e.stack : e + '';
  48487. results.content = `console.error(${JSON.stringify(errorMsg)})`;
  48488. }
  48489. };
  48490. const useDevModuleCache = async (config, p) => {
  48491. if (config.enableCache) {
  48492. for (let i = 0; i < 10; i++) {
  48493. const n = basename(p);
  48494. if (n === 'node_modules') {
  48495. return true;
  48496. }
  48497. const isSymbolicLink = await config.sys.isSymbolicLink(p);
  48498. if (isSymbolicLink) {
  48499. return false;
  48500. }
  48501. p = dirname(p);
  48502. }
  48503. }
  48504. return false;
  48505. };
  48506. const writeCachedFile = async (config, results) => {
  48507. try {
  48508. await config.sys.createDir(config.cacheDir);
  48509. config.sys.writeFile(results.cachePath, results.content);
  48510. }
  48511. catch (e) {
  48512. console.error(e);
  48513. }
  48514. };
  48515. const serializeDevNodeModuleUrl = (config, moduleId, moduleVersion, resolvedPath) => {
  48516. resolvedPath = relative$1(config.rootDir, resolvedPath);
  48517. let id = `/${DEV_MODULE_DIR}/`;
  48518. id += encodeURIComponent(moduleId) + '@';
  48519. id += encodeURIComponent(moduleVersion) + '.js';
  48520. id += '?p=' + encodeURIComponent(resolvedPath);
  48521. return id;
  48522. };
  48523. const parseDevModuleUrl = (config, u) => {
  48524. const parsedUrl = {
  48525. nodeModuleId: null,
  48526. nodeModuleVersion: null,
  48527. nodeResolvedPath: null,
  48528. };
  48529. if (u && u.includes(DEV_MODULE_DIR) && u.endsWith('.js')) {
  48530. const url = new URL(u, 'https://stenciljs.com');
  48531. let reqPath = basename(url.pathname);
  48532. reqPath = reqPath.substring(0, reqPath.length - 3);
  48533. const splt = reqPath.split('@');
  48534. if (splt.length === 2) {
  48535. parsedUrl.nodeModuleId = decodeURIComponent(splt[0]);
  48536. parsedUrl.nodeModuleVersion = decodeURIComponent(splt[1]);
  48537. parsedUrl.nodeResolvedPath = url.searchParams.get('p');
  48538. if (parsedUrl.nodeResolvedPath) {
  48539. parsedUrl.nodeResolvedPath = decodeURIComponent(parsedUrl.nodeResolvedPath);
  48540. parsedUrl.nodeResolvedPath = join(config.rootDir, parsedUrl.nodeResolvedPath);
  48541. }
  48542. }
  48543. }
  48544. return parsedUrl;
  48545. };
  48546. const getDevModuleCachePath = (config, parsedUrl) => {
  48547. return join(config.cacheDir, `dev_module_${parsedUrl.nodeModuleId}_${parsedUrl.nodeModuleVersion}_${DEV_MODULE_CACHE_BUSTER}.log`);
  48548. };
  48549. const DEV_MODULE_CACHE_BUSTER = 0;
  48550. const DEV_MODULE_DIR = `~dev-module`;
  48551. const shouldCheckDevModule = (resolvedId, importee) => resolvedId &&
  48552. importee &&
  48553. resolvedId.id &&
  48554. resolvedId.id.includes('node_modules') &&
  48555. (resolvedId.id.endsWith('.js') || resolvedId.id.endsWith('.mjs')) &&
  48556. !resolvedId.external &&
  48557. !importee.startsWith('.') &&
  48558. !importee.startsWith('/');
  48559. const extFormatPlugin = (config) => {
  48560. return {
  48561. name: 'extFormatPlugin',
  48562. transform(code, importPath) {
  48563. if (/\0/.test(importPath)) {
  48564. return null;
  48565. }
  48566. const { ext, filePath, format } = normalizeFsPathQuery(importPath);
  48567. // ?format= param takes precedence before file extension
  48568. switch (format) {
  48569. case 'url':
  48570. return { code: formatUrl(config, this, code, filePath, ext), map: null };
  48571. case 'text':
  48572. return { code: formatText(code, filePath), map: null };
  48573. }
  48574. // didn't provide a ?format= param
  48575. // check if it's a known extension we should format
  48576. if (FORMAT_TEXT_EXTS.includes(ext)) {
  48577. return { code: formatText(code, filePath), map: null };
  48578. }
  48579. if (FORMAT_URL_MIME[ext]) {
  48580. return { code: formatUrl(config, this, code, filePath, ext), map: null };
  48581. }
  48582. return null;
  48583. },
  48584. };
  48585. };
  48586. const FORMAT_TEXT_EXTS = ['txt', 'frag', 'vert'];
  48587. const FORMAT_URL_MIME = {
  48588. svg: 'image/svg+xml',
  48589. };
  48590. const DATAURL_MAX_IMAGE_SIZE = 4 * 1024; // 4KiB
  48591. const formatText = (code, filePath) => {
  48592. const varName = createJsVarName(basename(filePath));
  48593. return `const ${varName} = ${JSON.stringify(code)};export default ${varName};`;
  48594. };
  48595. const formatUrl = (config, pluginCtx, code, filePath, ext) => {
  48596. const mime = FORMAT_URL_MIME[ext];
  48597. if (!mime) {
  48598. pluginCtx.warn(`Unsupported url format for "${ext}" extension.`);
  48599. return formatText('', filePath);
  48600. }
  48601. const varName = createJsVarName(basename(filePath));
  48602. const base64 = config.sys.encodeToBase64(code);
  48603. if (config.devMode && base64.length > DATAURL_MAX_IMAGE_SIZE) {
  48604. pluginCtx.warn(`Importing large files will bloat your bundle size, please use external assets instead.`);
  48605. }
  48606. return `const ${varName} = 'data:${mime};base64,${base64}';export default ${varName};`;
  48607. };
  48608. /**
  48609. * Parse CSS imports into an object which contains a manifest of imports and a
  48610. * stylesheet with all imports resolved and concatenated.
  48611. *
  48612. * @param config the current config
  48613. * @param compilerCtx the compiler context (we need filesystem access)
  48614. * @param buildCtx the build context, we'll need access to diagnostics
  48615. * @param srcFilePath the source filepath
  48616. * @param resolvedFilePath the resolved filepath
  48617. * @param styleText style text we start with
  48618. * @param styleDocs optional array of style document objects
  48619. * @returns an object with concatenated styleText and imports
  48620. */
  48621. const parseCssImports = async (config, compilerCtx, buildCtx, srcFilePath, resolvedFilePath, styleText, styleDocs) => {
  48622. const isCssEntry = resolvedFilePath.toLowerCase().endsWith('.css');
  48623. const allCssImports = [];
  48624. // a Set of previously-resolved file paths that we add to as we traverse the
  48625. // import tree (to avoid a possible circular dependency and infinite loop)
  48626. const resolvedFilePaths = new Set();
  48627. const concatStyleText = await resolveAndFlattenImports(srcFilePath, resolvedFilePath, styleText);
  48628. return {
  48629. imports: allCssImports,
  48630. styleText: concatStyleText,
  48631. };
  48632. /**
  48633. * Resolve and flatten all imports for a given CSS file, recursively crawling
  48634. * the tree of imports to resolve them all and produce a concatenated
  48635. * stylesheet. We declare this function here, within `parseCssImports`, in order
  48636. * to get access to `compilerCtx`, `buildCtx`, and more without having to pass
  48637. * a whole bunch of arguments.
  48638. *
  48639. * @param srcFilePath the source filepath
  48640. * @param resolvedFilePath the resolved filepath
  48641. * @param styleText style text we start with*
  48642. * @returns concatenated styles assembled from the various imported stylesheets
  48643. */
  48644. async function resolveAndFlattenImports(srcFilePath, resolvedFilePath, styleText) {
  48645. // if we've seen this path before we early return
  48646. if (resolvedFilePaths.has(resolvedFilePath)) {
  48647. return styleText;
  48648. }
  48649. resolvedFilePaths.add(resolvedFilePath);
  48650. if (styleDocs != null) {
  48651. parseStyleDocs(styleDocs, styleText);
  48652. }
  48653. const cssImports = await getCssImports(config, compilerCtx, buildCtx, resolvedFilePath, styleText);
  48654. if (cssImports.length === 0) {
  48655. return styleText;
  48656. }
  48657. // add any newly-found imports to the 'global' list
  48658. for (const cssImport of cssImports) {
  48659. if (!allCssImports.includes(cssImport.filePath)) {
  48660. allCssImports.push(cssImport.filePath);
  48661. }
  48662. }
  48663. // Recur down the tree of CSS imports, resolving all the imports in
  48664. // the children of the current file (and, by extension, in their children
  48665. // and so on)
  48666. await Promise.all(cssImports.map(async (cssImportData) => {
  48667. cssImportData.styleText = await loadStyleText(compilerCtx, cssImportData);
  48668. if (typeof cssImportData.styleText === 'string') {
  48669. cssImportData.styleText = await resolveAndFlattenImports(cssImportData.filePath, cssImportData.filePath, cssImportData.styleText);
  48670. }
  48671. else {
  48672. // we had some error loading the file from disk, so write a diagnostic
  48673. const err = buildError(buildCtx.diagnostics);
  48674. err.messageText = `Unable to read css import: ${cssImportData.srcImport}`;
  48675. err.absFilePath = srcFilePath;
  48676. }
  48677. }));
  48678. // replace import statements with the actual CSS code in children modules
  48679. return replaceImportDeclarations(styleText, cssImports, isCssEntry);
  48680. }
  48681. };
  48682. /**
  48683. * Load the style text for a CSS file from disk, based on the filepaths set in
  48684. * our import data.
  48685. *
  48686. * @param compilerCtx the compiler context
  48687. * @param cssImportData the import data for the file we want to read
  48688. * @returns the contents of the file, if it can be read without error
  48689. */
  48690. const loadStyleText = async (compilerCtx, cssImportData) => {
  48691. let styleText = null;
  48692. try {
  48693. styleText = await compilerCtx.fs.readFile(cssImportData.filePath);
  48694. }
  48695. catch (e) {
  48696. if (cssImportData.altFilePath) {
  48697. try {
  48698. styleText = await compilerCtx.fs.readFile(cssImportData.filePath);
  48699. }
  48700. catch (e) { }
  48701. }
  48702. }
  48703. return styleText;
  48704. };
  48705. /**
  48706. * Get a manifest of all the CSS imports in a given CSS file
  48707. *
  48708. * @param config the current config
  48709. * @param compilerCtx the compiler context (we need the filesystem)
  48710. * @param buildCtx the build context, in case we need to set a diagnostic
  48711. * @param filePath the filepath we're working with
  48712. * @param styleText the CSS for which we want to retrieve import data
  48713. * @returns a Promise wrapping a list of CSS import data objects
  48714. */
  48715. const getCssImports = async (config, compilerCtx, buildCtx, filePath, styleText) => {
  48716. var _a;
  48717. const imports = [];
  48718. if (!styleText.includes('@import')) {
  48719. // no @import at all, so don't bother
  48720. return imports;
  48721. }
  48722. styleText = stripCssComments(styleText);
  48723. const dir = dirname(filePath);
  48724. const importeeExt = ((_a = filePath.split('.').pop()) !== null && _a !== void 0 ? _a : '').toLowerCase();
  48725. let r;
  48726. const IMPORT_RE = /(@import)\s+(url\()?\s?(.*?)\s?\)?([^;]*);?/gi;
  48727. while ((r = IMPORT_RE.exec(styleText))) {
  48728. const cssImportData = {
  48729. srcImport: r[0],
  48730. url: r[4].replace(/[\"\'\)]/g, ''),
  48731. filePath: '',
  48732. };
  48733. if (!isLocalCssImport(cssImportData.srcImport)) {
  48734. // do nothing for @import url(http://external.css)
  48735. config.logger.debug(`did not resolve external css @import: ${cssImportData.srcImport}`);
  48736. continue;
  48737. }
  48738. if (isCssNodeModule(cssImportData.url)) {
  48739. // node resolve this path cuz it starts with ~
  48740. await resolveCssNodeModule(config, compilerCtx, buildCtx.diagnostics, filePath, cssImportData);
  48741. }
  48742. else if (isAbsolute$1(cssImportData.url)) {
  48743. // absolute path already
  48744. cssImportData.filePath = normalizePath$1(cssImportData.url);
  48745. }
  48746. else {
  48747. // relative path
  48748. cssImportData.filePath = normalizePath$1(join(dir, cssImportData.url));
  48749. }
  48750. if (importeeExt !== 'css' && !cssImportData.filePath.toLowerCase().endsWith('.css')) {
  48751. cssImportData.filePath += `.${importeeExt}`;
  48752. if (importeeExt === 'scss') {
  48753. const fileName = '_' + basename(cssImportData.filePath);
  48754. const dirPath = dirname(cssImportData.filePath);
  48755. cssImportData.altFilePath = normalizePath$1(join(dirPath, fileName));
  48756. }
  48757. }
  48758. // we set `filePath` to `""` when the object is created above, so if it
  48759. // hasn't been changed in the intervening conditionals then we didn't resolve
  48760. // a filepath for it.
  48761. if (cssImportData.filePath !== '') {
  48762. imports.push(cssImportData);
  48763. }
  48764. }
  48765. return imports;
  48766. };
  48767. const isCssNodeModule = (url) => url.startsWith('~');
  48768. const resolveCssNodeModule = async (config, compilerCtx, diagnostics, filePath, cssImportData) => {
  48769. try {
  48770. const m = getModuleId(cssImportData.url);
  48771. const resolved = await resolveModuleIdAsync(config.sys, compilerCtx.fs, {
  48772. moduleId: m.moduleId,
  48773. containingFile: filePath,
  48774. exts: [],
  48775. packageFilter: (pkg) => {
  48776. if (m.filePath !== '') {
  48777. pkg.main = m.filePath;
  48778. }
  48779. return pkg;
  48780. },
  48781. });
  48782. cssImportData.filePath = resolved.resolveId;
  48783. cssImportData.updatedImport = `@import "${cssImportData.filePath}";`;
  48784. }
  48785. catch (e) {
  48786. const d = buildError(diagnostics);
  48787. d.messageText = `Unable to resolve node module for CSS @import: ${cssImportData.url}`;
  48788. d.absFilePath = filePath;
  48789. }
  48790. };
  48791. const isLocalCssImport = (srcImport) => {
  48792. srcImport = srcImport.toLowerCase();
  48793. if (srcImport.includes('url(')) {
  48794. srcImport = srcImport.replace(/\"/g, '');
  48795. srcImport = srcImport.replace(/\'/g, '');
  48796. srcImport = srcImport.replace(/\s/g, '');
  48797. if (srcImport.includes('url(http') || srcImport.includes('url(//')) {
  48798. return false;
  48799. }
  48800. }
  48801. return true;
  48802. };
  48803. /**
  48804. * Replace import declarations (like '@import "foobar";') with the actual CSS
  48805. * written in the imported module, allowing us to produce a single file from a
  48806. * tree of stylesheets.
  48807. *
  48808. * @param styleText the text within which we want to replace @import statements
  48809. * @param cssImports information about imported modules
  48810. * @param isCssEntry whether we're dealing with a CSS file
  48811. * @returns an updated string with the requisite substitutions
  48812. */
  48813. const replaceImportDeclarations = (styleText, cssImports, isCssEntry) => {
  48814. for (const cssImport of cssImports) {
  48815. if (isCssEntry) {
  48816. if (typeof cssImport.styleText === 'string') {
  48817. styleText = styleText.replace(cssImport.srcImport, cssImport.styleText);
  48818. }
  48819. }
  48820. else if (typeof cssImport.updatedImport === 'string') {
  48821. styleText = styleText.replace(cssImport.srcImport, cssImport.updatedImport);
  48822. }
  48823. }
  48824. return styleText;
  48825. };
  48826. const runPluginResolveId = async (pluginCtx, importee) => {
  48827. for (const plugin of pluginCtx.config.plugins) {
  48828. if (isFunction(plugin.resolveId)) {
  48829. try {
  48830. const results = plugin.resolveId(importee, null, pluginCtx);
  48831. if (results != null) {
  48832. if (isFunction(results.then)) {
  48833. const promiseResults = await results;
  48834. if (promiseResults != null) {
  48835. return promiseResults;
  48836. }
  48837. }
  48838. else if (isString$1(results)) {
  48839. return results;
  48840. }
  48841. }
  48842. }
  48843. catch (e) {
  48844. catchError(pluginCtx.diagnostics, e);
  48845. }
  48846. }
  48847. }
  48848. // default resolvedId
  48849. return importee;
  48850. };
  48851. const runPluginLoad = async (pluginCtx, id) => {
  48852. for (const plugin of pluginCtx.config.plugins) {
  48853. if (isFunction(plugin.load)) {
  48854. try {
  48855. const results = plugin.load(id, pluginCtx);
  48856. if (results != null) {
  48857. if (isFunction(results.then)) {
  48858. const promiseResults = await results;
  48859. if (promiseResults != null) {
  48860. return promiseResults;
  48861. }
  48862. }
  48863. else if (isString$1(results)) {
  48864. return results;
  48865. }
  48866. }
  48867. }
  48868. catch (e) {
  48869. catchError(pluginCtx.diagnostics, e);
  48870. }
  48871. }
  48872. }
  48873. // default load()
  48874. return pluginCtx.fs.readFile(id);
  48875. };
  48876. const runPluginTransforms = async (config, compilerCtx, buildCtx, id, cmp) => {
  48877. const pluginCtx = {
  48878. config: config,
  48879. sys: config.sys,
  48880. fs: compilerCtx.fs,
  48881. cache: compilerCtx.cache,
  48882. diagnostics: [],
  48883. };
  48884. const resolvedId = await runPluginResolveId(pluginCtx, id);
  48885. const sourceText = await runPluginLoad(pluginCtx, resolvedId);
  48886. if (!isString$1(sourceText)) {
  48887. const diagnostic = buildError(buildCtx.diagnostics);
  48888. diagnostic.header = `Unable to find "${basename(id)}"`;
  48889. diagnostic.messageText = `The file "${relative$1(config.rootDir, id)}" was unable to load.`;
  48890. return null;
  48891. }
  48892. const transformResults = {
  48893. code: sourceText,
  48894. id: id,
  48895. };
  48896. const isRawCssFile = transformResults.id.toLowerCase().endsWith('.css');
  48897. const shouldParseCssDocs = cmp != null && config.outputTargets.some(isOutputTargetDocs);
  48898. if (isRawCssFile) {
  48899. // concat all css @imports into one file
  48900. // when the entry file is a .css file (not .scss)
  48901. // do this BEFORE transformations on css files
  48902. if (shouldParseCssDocs && cmp != null) {
  48903. cmp.styleDocs = cmp.styleDocs || [];
  48904. const cssParseResults = await parseCssImports(config, compilerCtx, buildCtx, id, id, transformResults.code, cmp.styleDocs);
  48905. transformResults.code = cssParseResults.styleText;
  48906. transformResults.dependencies = cssParseResults.imports;
  48907. }
  48908. else {
  48909. const cssParseResults = await parseCssImports(config, compilerCtx, buildCtx, id, id, transformResults.code);
  48910. transformResults.code = cssParseResults.styleText;
  48911. transformResults.dependencies = cssParseResults.imports;
  48912. }
  48913. }
  48914. for (const plugin of pluginCtx.config.plugins) {
  48915. if (isFunction(plugin.transform)) {
  48916. try {
  48917. let pluginTransformResults;
  48918. const results = plugin.transform(transformResults.code, transformResults.id, pluginCtx);
  48919. if (results != null) {
  48920. if (isFunction(results.then)) {
  48921. pluginTransformResults = await results;
  48922. }
  48923. else {
  48924. pluginTransformResults = results;
  48925. }
  48926. if (pluginTransformResults != null) {
  48927. if (isString$1(pluginTransformResults)) {
  48928. transformResults.code = pluginTransformResults;
  48929. }
  48930. else {
  48931. if (isString$1(pluginTransformResults.code)) {
  48932. transformResults.code = pluginTransformResults.code;
  48933. }
  48934. if (isString$1(pluginTransformResults.id)) {
  48935. transformResults.id = pluginTransformResults.id;
  48936. }
  48937. }
  48938. }
  48939. }
  48940. }
  48941. catch (e) {
  48942. catchError(buildCtx.diagnostics, e);
  48943. }
  48944. }
  48945. }
  48946. buildCtx.diagnostics.push(...pluginCtx.diagnostics);
  48947. if (!isRawCssFile) {
  48948. // sass precompiler just ran and converted @import "my.css" into @import url("my.css")
  48949. // because of the ".css" extension. Sass did NOT concat the ".css" files into the output
  48950. // but only updated it to use url() instead. Let's go ahead and concat the url() css
  48951. // files into one file like we did for raw .css files.
  48952. // do this AFTER transformations on non-css files
  48953. if (shouldParseCssDocs && cmp != null) {
  48954. cmp.styleDocs = cmp.styleDocs || [];
  48955. const cssParseResults = await parseCssImports(config, compilerCtx, buildCtx, id, transformResults.id, transformResults.code, cmp.styleDocs);
  48956. transformResults.code = cssParseResults.styleText;
  48957. transformResults.dependencies = cssParseResults.imports;
  48958. }
  48959. else {
  48960. const cssParseResults = await parseCssImports(config, compilerCtx, buildCtx, id, transformResults.id, transformResults.code);
  48961. transformResults.code = cssParseResults.styleText;
  48962. transformResults.dependencies = cssParseResults.imports;
  48963. }
  48964. }
  48965. return transformResults;
  48966. };
  48967. const runPluginTransformsEsmImports = async (config, compilerCtx, buildCtx, code, id) => {
  48968. const pluginCtx = {
  48969. config: config,
  48970. sys: config.sys,
  48971. fs: compilerCtx.fs,
  48972. cache: compilerCtx.cache,
  48973. diagnostics: [],
  48974. };
  48975. const transformResults = {
  48976. code,
  48977. id,
  48978. map: null,
  48979. diagnostics: [],
  48980. dependencies: [],
  48981. };
  48982. const isRawCssFile = id.toLowerCase().endsWith('.css');
  48983. if (isRawCssFile) {
  48984. // concat all css @imports into one file
  48985. // when the entry file is a .css file (not .scss)
  48986. // do this BEFORE transformations on css files
  48987. const cssParseResults = await parseCssImports(config, compilerCtx, buildCtx, id, id, transformResults.code);
  48988. transformResults.code = cssParseResults.styleText;
  48989. if (Array.isArray(cssParseResults.imports)) {
  48990. transformResults.dependencies.push(...cssParseResults.imports);
  48991. }
  48992. }
  48993. for (const plugin of pluginCtx.config.plugins) {
  48994. if (isFunction(plugin.transform)) {
  48995. try {
  48996. let pluginTransformResults;
  48997. const results = plugin.transform(transformResults.code, transformResults.id, pluginCtx);
  48998. if (results != null) {
  48999. if (isFunction(results.then)) {
  49000. pluginTransformResults = await results;
  49001. }
  49002. else {
  49003. pluginTransformResults = results;
  49004. }
  49005. if (pluginTransformResults != null) {
  49006. if (isString$1(pluginTransformResults)) {
  49007. transformResults.code = pluginTransformResults;
  49008. }
  49009. else {
  49010. if (isString$1(pluginTransformResults.code)) {
  49011. transformResults.code = pluginTransformResults.code;
  49012. }
  49013. if (isString$1(pluginTransformResults.id)) {
  49014. transformResults.id = pluginTransformResults.id;
  49015. }
  49016. if (Array.isArray(pluginTransformResults.dependencies)) {
  49017. const imports = pluginTransformResults.dependencies.filter((f) => !transformResults.dependencies.includes(f));
  49018. transformResults.dependencies.push(...imports);
  49019. }
  49020. }
  49021. }
  49022. }
  49023. }
  49024. catch (e) {
  49025. catchError(transformResults.diagnostics, e);
  49026. }
  49027. }
  49028. }
  49029. transformResults.diagnostics.push(...pluginCtx.diagnostics);
  49030. if (!isRawCssFile) {
  49031. // precompilers just ran and converted @import "my.css" into @import url("my.css")
  49032. // because of the ".css" extension. Precompilers did NOT concat the ".css" files into
  49033. // the output but only updated it to use url() instead. Let's go ahead and concat
  49034. // the url() css files into one file like we did for raw .css files. Do this
  49035. // AFTER transformations on non-css files
  49036. const cssParseResults = await parseCssImports(config, compilerCtx, buildCtx, id, transformResults.id, transformResults.code);
  49037. transformResults.code = cssParseResults.styleText;
  49038. if (Array.isArray(cssParseResults.imports)) {
  49039. const imports = cssParseResults.imports.filter((f) => !transformResults.dependencies.includes(f));
  49040. transformResults.dependencies.push(...imports);
  49041. }
  49042. }
  49043. return transformResults;
  49044. };
  49045. /**
  49046. * A Rollup plugin which bundles up some transformation of CSS imports as well
  49047. * as writing some files to disk for the `DIST_COLLECTION` output target.
  49048. *
  49049. * @param config a user-supplied configuration
  49050. * @param compilerCtx the current compiler context
  49051. * @param buildCtx the current build context
  49052. * @param bundleOpts bundle options for Rollup
  49053. * @returns a Rollup plugin which carries out the necessary work
  49054. */
  49055. const extTransformsPlugin = (config, compilerCtx, buildCtx, bundleOpts) => {
  49056. return {
  49057. name: 'extTransformsPlugin',
  49058. /**
  49059. * A custom function targeting the `transform` build hook in Rollup. See here for details:
  49060. * https://rollupjs.org/guide/en/#transform
  49061. *
  49062. * Here we are ignoring the first argument (which contains the module's source code) and
  49063. * only looking at the `id` argument. We use that `id` to get information about the module
  49064. * in question from disk ourselves so that we can then do some transformations on it.
  49065. *
  49066. * @param _ an unused parameter (normally the code for a given module)
  49067. * @param id the id of a module
  49068. * @returns metadata for Rollup or null if no transformation should be done
  49069. */
  49070. async transform(_, id) {
  49071. var _a, _b;
  49072. if (/\0/.test(id)) {
  49073. return null;
  49074. }
  49075. // The `id` here was possibly previously updated using
  49076. // `serializeImportPath` to annotate the filepath with various metadata
  49077. // serialized to query-params. If that was done for this particular `id`
  49078. // then the `data` prop will not be null.
  49079. const { data } = parseImportPath(id);
  49080. if (data != null) {
  49081. let cmp = undefined;
  49082. const filePath = normalizeFsPath(id);
  49083. const code = await compilerCtx.fs.readFile(filePath);
  49084. if (typeof code !== 'string') {
  49085. return null;
  49086. }
  49087. const pluginTransforms = await runPluginTransformsEsmImports(config, compilerCtx, buildCtx, code, filePath);
  49088. // We need to check whether the current build is a dev-mode watch build w/ HMR enabled in
  49089. // order to know how we'll want to set `commentOriginalSelector` (below). If we are doing
  49090. // a hydrate build we need to set this to `true` because commenting-out selectors is what
  49091. // gives us support for scoped CSS w/ hydrated components (we don't support shadow DOM and
  49092. // styling via that route for them). However, we don't want to comment selectors in dev
  49093. // mode when using HMR in the browser, since there we _do_ support putting stylesheets into
  49094. // the shadow DOM and commenting out e.g. the `:host` selector in those stylesheets will
  49095. // break components' CSS when an HMR update is sent to the browser.
  49096. //
  49097. // See https://github.com/ionic-team/stencil/issues/3461 for details
  49098. const isDevWatchHMRBuild = config.flags.watch &&
  49099. config.flags.dev &&
  49100. config.flags.serve &&
  49101. ((_b = (_a = config.devServer) === null || _a === void 0 ? void 0 : _a.reloadStrategy) !== null && _b !== void 0 ? _b : null) === 'hmr';
  49102. const commentOriginalSelector = bundleOpts.platform === 'hydrate' && data.encapsulation === 'shadow' && !isDevWatchHMRBuild;
  49103. if (data.tag) {
  49104. cmp = buildCtx.components.find((c) => c.tagName === data.tag);
  49105. const moduleFile = cmp && compilerCtx.moduleMap.get(cmp.sourceFilePath);
  49106. if (moduleFile) {
  49107. const collectionDirs = config.outputTargets.filter(isOutputTargetDistCollection);
  49108. const relPath = relative$1(config.srcDir, pluginTransforms.id);
  49109. // If we found a `moduleFile` in the module map above then we
  49110. // should write the transformed CSS file (found in the return value
  49111. // of `runPluginTransformsEsmImports`, above) to disk.
  49112. await Promise.all(collectionDirs.map(async (outputTarget) => {
  49113. const collectionPath = join(outputTarget.collectionDir, relPath);
  49114. await compilerCtx.fs.writeFile(collectionPath, pluginTransforms.code);
  49115. }));
  49116. }
  49117. }
  49118. const cssTransformResults = await compilerCtx.worker.transformCssToEsm({
  49119. file: pluginTransforms.id,
  49120. input: pluginTransforms.code,
  49121. tag: data.tag,
  49122. encapsulation: data.encapsulation,
  49123. mode: data.mode,
  49124. commentOriginalSelector,
  49125. sourceMap: config.sourceMap,
  49126. minify: config.minifyCss,
  49127. autoprefixer: config.autoprefixCss,
  49128. docs: config.buildDocs,
  49129. });
  49130. // Set style docs
  49131. if (cmp) {
  49132. cmp.styleDocs = cssTransformResults.styleDocs;
  49133. }
  49134. // Track dependencies
  49135. for (const dep of pluginTransforms.dependencies) {
  49136. this.addWatchFile(dep);
  49137. compilerCtx.addWatchFile(dep);
  49138. }
  49139. buildCtx.diagnostics.push(...pluginTransforms.diagnostics);
  49140. buildCtx.diagnostics.push(...cssTransformResults.diagnostics);
  49141. const didError = hasError(cssTransformResults.diagnostics) || hasError(pluginTransforms.diagnostics);
  49142. if (didError) {
  49143. this.error('Plugin CSS transform error');
  49144. }
  49145. const hasUpdatedStyle = buildCtx.stylesUpdated.some((s) => {
  49146. return s.styleTag === data.tag && s.styleMode === data.mode && s.styleText === cssTransformResults.styleText;
  49147. });
  49148. if (!hasUpdatedStyle) {
  49149. buildCtx.stylesUpdated.push({
  49150. styleTag: data.tag,
  49151. styleMode: data.mode,
  49152. styleText: cssTransformResults.styleText,
  49153. });
  49154. }
  49155. return {
  49156. code: cssTransformResults.output,
  49157. map: cssTransformResults.map,
  49158. moduleSideEffects: false,
  49159. };
  49160. }
  49161. return null;
  49162. },
  49163. };
  49164. };
  49165. const fileLoadPlugin = (fs) => {
  49166. return {
  49167. name: 'fileLoadPlugin',
  49168. load(id) {
  49169. const fsFilePath = normalizeFsPath(id);
  49170. if (id.endsWith('.d.ts')) {
  49171. return '';
  49172. }
  49173. return fs.readFile(fsFilePath);
  49174. },
  49175. };
  49176. };
  49177. /**
  49178. * Rollup plugin that aids in resolving the entry points (1 or more files) for a Stencil project. For example, a project
  49179. * using the `dist-custom-elements` output target may have a single 'entry point' for each file containing a component.
  49180. * Each of those files will be independently resolved and loaded by this plugin for further processing by Rollup later
  49181. * in the bundling process.
  49182. *
  49183. * @param entries the Stencil project files to process. It should be noted that the keys in this object may not
  49184. * necessarily be an absolute or relative path to a file, but may be a Rollup Virtual Module (which begin with \0).
  49185. * @returns the rollup plugin that loads and process a Stencil project's entry points
  49186. */
  49187. const loaderPlugin = (entries = {}) => {
  49188. return {
  49189. name: 'stencilLoaderPlugin',
  49190. /**
  49191. * A rollup build hook for resolving the imports of individual Stencil project files. This hook only resolves
  49192. * modules that are contained in the plugin's `entries` argument. [Source](https://rollupjs.org/guide/en/#resolveid)
  49193. * @param id the importee to resolve
  49194. * @returns a string that resolves an import to some id, null otherwise
  49195. */
  49196. resolveId(id) {
  49197. if (id in entries) {
  49198. return {
  49199. id,
  49200. };
  49201. }
  49202. return null;
  49203. },
  49204. /**
  49205. * A rollup build hook for loading individual Stencil project files [Source](https://rollupjs.org/guide/en/#load)
  49206. * @param id the path of the module to load. It should be noted that the keys in this object may not necessarily
  49207. * be an absolute or relative path to a file, but may be a Rollup Virtual Module.
  49208. * @returns the module matched, null otherwise
  49209. */
  49210. load(id) {
  49211. if (id in entries) {
  49212. return entries[id];
  49213. }
  49214. return null;
  49215. },
  49216. };
  49217. };
  49218. const pluginHelper = (config, builtCtx, platform) => {
  49219. return {
  49220. name: 'pluginHelper',
  49221. resolveId(importee, importer) {
  49222. if (/\0/.test(importee)) {
  49223. // ignore IDs with null character, these belong to other plugins
  49224. return null;
  49225. }
  49226. if (importee.endsWith('/')) {
  49227. importee = importee.slice(0, -1);
  49228. }
  49229. if (builtIns.has(importee)) {
  49230. let fromMsg = '';
  49231. if (importer) {
  49232. fromMsg = ` from ${relative$1(config.rootDir, importer)}`;
  49233. }
  49234. const diagnostic = buildError(builtCtx.diagnostics);
  49235. diagnostic.header = `Node Polyfills Required`;
  49236. diagnostic.messageText = `For the import "${importee}" to be bundled${fromMsg}, ensure the "rollup-plugin-node-polyfills" plugin is installed and added to the stencil config plugins (${platform}). Please see the bundling docs for more information.
  49237. Further information: https://stenciljs.com/docs/module-bundling`;
  49238. }
  49239. return null;
  49240. },
  49241. };
  49242. };
  49243. const builtIns = new Set([
  49244. 'child_process',
  49245. 'cluster',
  49246. 'dgram',
  49247. 'dns',
  49248. 'module',
  49249. 'net',
  49250. 'readline',
  49251. 'repl',
  49252. 'tls',
  49253. 'assert',
  49254. 'console',
  49255. 'constants',
  49256. 'domain',
  49257. 'events',
  49258. 'path',
  49259. 'punycode',
  49260. 'querystring',
  49261. '_stream_duplex',
  49262. '_stream_passthrough',
  49263. '_stream_readable',
  49264. '_stream_writable',
  49265. '_stream_transform',
  49266. 'string_decoder',
  49267. 'sys',
  49268. 'tty',
  49269. 'crypto',
  49270. 'fs',
  49271. 'Buffer',
  49272. 'buffer',
  49273. 'global',
  49274. 'http',
  49275. 'https',
  49276. 'os',
  49277. 'process',
  49278. 'stream',
  49279. 'timers',
  49280. 'url',
  49281. 'util',
  49282. 'vm',
  49283. 'zlib',
  49284. ]);
  49285. const serverPlugin = (config, platform) => {
  49286. const isHydrateBundle = platform === 'hydrate';
  49287. const serverVarid = `@removed-server-code`;
  49288. const isServerOnlyModule = (id) => {
  49289. if (isString$1(id)) {
  49290. id = normalizeFsPath(id);
  49291. return id.includes('.server/') || id.endsWith('.server');
  49292. }
  49293. return false;
  49294. };
  49295. const externals = isHydrateBundle
  49296. ? config.outputTargets.filter(isOutputTargetHydrate).flatMap((o) => o.external)
  49297. : [];
  49298. return {
  49299. name: 'serverPlugin',
  49300. resolveId(id, importer) {
  49301. if (id === serverVarid) {
  49302. return id;
  49303. }
  49304. if (isHydrateBundle) {
  49305. if (externals.includes(id)) {
  49306. // don't attempt to bundle node builtins for the hydrate bundle
  49307. return {
  49308. id,
  49309. external: true,
  49310. };
  49311. }
  49312. if (isServerOnlyModule(importer) && !id.startsWith('.') && !isAbsolute$1(id)) {
  49313. // do not bundle if the importer is a server-only module
  49314. // and the module it is importing is a node module
  49315. return {
  49316. id,
  49317. external: true,
  49318. };
  49319. }
  49320. }
  49321. else {
  49322. if (isServerOnlyModule(id)) {
  49323. // any path that has .server in it shouldn't actually
  49324. // be bundled in the web build, only the hydrate build
  49325. return serverVarid;
  49326. }
  49327. }
  49328. return null;
  49329. },
  49330. load(id) {
  49331. if (id === serverVarid) {
  49332. return {
  49333. code: 'export default {};',
  49334. syntheticNamedExports: true,
  49335. };
  49336. }
  49337. return null;
  49338. },
  49339. };
  49340. };
  49341. const fetchModuleSync = (sys, inMemoryFs, pkgVersions, url, filePath) => {
  49342. if (skipFilePathFetch(filePath)) {
  49343. return undefined;
  49344. }
  49345. const content = fetchUrlSync(url);
  49346. if (isString$1(content)) {
  49347. writeFetchSuccessSync(sys, inMemoryFs, url, filePath, content, pkgVersions);
  49348. }
  49349. return content;
  49350. };
  49351. const fetchUrlSync = (url) => {
  49352. if (known404Urls.has(url) || skipUrlFetch(url)) {
  49353. return undefined;
  49354. }
  49355. try {
  49356. const xhr = new XMLHttpRequest();
  49357. xhr.open('GET', url, false);
  49358. xhr.send(null);
  49359. if (xhr.status >= 200 && xhr.status <= 299) {
  49360. return xhr.responseText;
  49361. }
  49362. }
  49363. catch (e) { }
  49364. known404Urls.add(url);
  49365. return undefined;
  49366. };
  49367. const resolveRemoteModuleIdSync = (config, inMemoryFs, opts) => {
  49368. const packageJson = resolveRemotePackageJsonSync(config, inMemoryFs, opts.moduleId);
  49369. if (packageJson) {
  49370. const resolveModuleSyncOpts = {
  49371. ...opts,
  49372. exts: ['.js', '.mjs'],
  49373. };
  49374. const resolvedUrl = resolveModuleIdSync(config.sys, inMemoryFs, resolveModuleSyncOpts);
  49375. if (typeof resolvedUrl === 'string') {
  49376. return {
  49377. resolvedUrl,
  49378. packageJson,
  49379. };
  49380. }
  49381. }
  49382. return null;
  49383. };
  49384. const resolveRemotePackageJsonSync = (config, inMemoryFs, moduleId) => {
  49385. if (inMemoryFs) {
  49386. const filePath = normalizePath$1(config.sys.getLocalModulePath({ rootDir: config.rootDir, moduleId, path: 'package.json' }));
  49387. let pkgJson = inMemoryFs.readFileSync(filePath);
  49388. if (!isString$1(pkgJson) && IS_WEB_WORKER_ENV) {
  49389. const url = config.sys.getRemoteModuleUrl({ moduleId, path: 'package.json' });
  49390. pkgJson = fetchModuleSync(config.sys, inMemoryFs, packageVersions, url, filePath);
  49391. }
  49392. if (typeof pkgJson === 'string') {
  49393. try {
  49394. return JSON.parse(pkgJson);
  49395. }
  49396. catch (e) { }
  49397. }
  49398. }
  49399. return null;
  49400. };
  49401. const resolveModuleIdSync = (sys, inMemoryFs, opts) => {
  49402. if (inMemoryFs) {
  49403. const resolverOpts = createCustomResolverSync(sys, inMemoryFs, opts.exts);
  49404. resolverOpts.basedir = dirname(opts.containingFile);
  49405. resolverOpts.packageFilter = opts.packageFilter;
  49406. const resolvedModule = resolve.sync(opts.moduleId, resolverOpts);
  49407. return resolvedModule;
  49408. }
  49409. return null;
  49410. };
  49411. const createCustomResolverSync = (sys, inMemoryFs, exts) => {
  49412. return {
  49413. isFile(filePath) {
  49414. const fsFilePath = normalizeFsPath(filePath);
  49415. const stat = inMemoryFs.statSync(fsFilePath);
  49416. if (stat.isFile) {
  49417. return true;
  49418. }
  49419. if (shouldFetchModule(fsFilePath)) {
  49420. const endsWithExt = exts.some((ext) => fsFilePath.endsWith(ext));
  49421. if (!endsWithExt) {
  49422. return false;
  49423. }
  49424. const url = getNodeModuleFetchUrl(sys, packageVersions, fsFilePath);
  49425. const content = fetchModuleSync(sys, inMemoryFs, packageVersions, url, fsFilePath);
  49426. return typeof content === 'string';
  49427. }
  49428. return false;
  49429. },
  49430. isDirectory(dirPath) {
  49431. const fsDirPath = normalizeFsPath(dirPath);
  49432. const stat = inMemoryFs.statSync(fsDirPath);
  49433. if (stat.isDirectory) {
  49434. return true;
  49435. }
  49436. if (shouldFetchModule(fsDirPath)) {
  49437. if (basename(fsDirPath) === 'node_modules') {
  49438. // just the /node_modules directory
  49439. inMemoryFs.sys.createDirSync(fsDirPath);
  49440. inMemoryFs.clearFileCache(fsDirPath);
  49441. return true;
  49442. }
  49443. if (isCommonDirModuleFile(fsDirPath)) {
  49444. // don't bother seeing if it's a directory if it has a common file extension
  49445. return false;
  49446. }
  49447. const checkFileExists = (fileName) => {
  49448. const url = getCommonDirUrl(sys, packageVersions, fsDirPath, fileName);
  49449. const filePath = getCommonDirName(fsDirPath, fileName);
  49450. const content = fetchModuleSync(sys, inMemoryFs, packageVersions, url, filePath);
  49451. return isString$1(content);
  49452. };
  49453. return COMMON_DIR_FILENAMES.some(checkFileExists);
  49454. }
  49455. return false;
  49456. },
  49457. readFileSync(p) {
  49458. const data = inMemoryFs.readFileSync(p);
  49459. if (isString$1(data)) {
  49460. return data;
  49461. }
  49462. throw new Error(`file not found: ${p}`);
  49463. },
  49464. realpathSync(p) {
  49465. const fsFilePath = normalizeFsPath(p);
  49466. try {
  49467. return sys.realpathSync(fsFilePath);
  49468. }
  49469. catch (realpathErr) {
  49470. if (isErrnoException(realpathErr)) {
  49471. if (realpathErr.code !== 'ENOENT') {
  49472. throw realpathErr;
  49473. }
  49474. }
  49475. }
  49476. return fsFilePath;
  49477. },
  49478. extensions: exts,
  49479. };
  49480. };
  49481. /**
  49482. * Type guard to determine if an Error is an instance of `ErrnoException`. For the purposes of this type guard, we
  49483. * must ensure that the `code` field is present. This type guard was written with the `ErrnoException` definition from
  49484. * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d121716ed123957f6a86f8985eb013fcaddab345/types/node/globals.d.ts#L183-L188
  49485. * in mind.
  49486. * @param err the entity to check the type of
  49487. * @returns true if the provided value is an instance of `ErrnoException`, `false` otherwise
  49488. */
  49489. function isErrnoException(err) {
  49490. return err instanceof Error && err.hasOwnProperty('code');
  49491. }
  49492. const patchTsSystemFileSystem = (config, compilerSys, inMemoryFs, tsSys) => {
  49493. const realpath = (path) => {
  49494. const rp = compilerSys.realpathSync(path);
  49495. if (isString$1(rp)) {
  49496. return rp;
  49497. }
  49498. return path;
  49499. };
  49500. const getAccessibleFileSystemEntries = (path) => {
  49501. try {
  49502. const entries = compilerSys.readDirSync(path || '.').sort();
  49503. const files = [];
  49504. const directories = [];
  49505. for (const absPath of entries) {
  49506. // This is necessary because on some file system node fails to exclude
  49507. // "." and "..". See https://github.com/nodejs/node/issues/4002
  49508. const stat = inMemoryFs.statSync(absPath);
  49509. if (!stat) {
  49510. continue;
  49511. }
  49512. const entry = basename(absPath);
  49513. if (stat.isFile) {
  49514. files.push(entry);
  49515. }
  49516. else if (stat.isDirectory) {
  49517. directories.push(entry);
  49518. }
  49519. }
  49520. return { files, directories };
  49521. }
  49522. catch (e) {
  49523. return { files: [], directories: [] };
  49524. }
  49525. };
  49526. tsSys.createDirectory = (p) => {
  49527. compilerSys.createDirSync(p, { recursive: true });
  49528. };
  49529. tsSys.directoryExists = (p) => {
  49530. const s = inMemoryFs.statSync(p);
  49531. return s.isDirectory;
  49532. };
  49533. tsSys.exit = compilerSys.exit;
  49534. tsSys.fileExists = (p) => {
  49535. let filePath = p;
  49536. if (isRemoteUrl(p)) {
  49537. filePath = getTypescriptPathFromUrl(config, tsSys.getExecutingFilePath(), p);
  49538. }
  49539. const s = inMemoryFs.statSync(filePath);
  49540. return !!(s && s.isFile);
  49541. };
  49542. tsSys.getCurrentDirectory = compilerSys.getCurrentDirectory;
  49543. tsSys.getExecutingFilePath = compilerSys.getCompilerExecutingPath;
  49544. tsSys.getDirectories = (p) => {
  49545. const items = compilerSys.readDirSync(p);
  49546. return items.filter((itemPath) => {
  49547. const s = inMemoryFs.statSync(itemPath);
  49548. return !!(s && s.exists && s.isDirectory);
  49549. });
  49550. };
  49551. tsSys.readDirectory = (path, extensions, exclude, include, depth) => {
  49552. const cwd = compilerSys.getCurrentDirectory();
  49553. // TODO(STENCIL-344): Replace `matchFiles` with a function that is publicly exposed
  49554. return t.matchFiles(path, extensions, exclude, include, IS_CASE_SENSITIVE_FILE_NAMES, cwd, depth, getAccessibleFileSystemEntries, realpath);
  49555. };
  49556. tsSys.readFile = (p) => {
  49557. let filePath = p;
  49558. const isUrl = isRemoteUrl(p);
  49559. if (isUrl) {
  49560. filePath = getTypescriptPathFromUrl(config, tsSys.getExecutingFilePath(), p);
  49561. }
  49562. let content = inMemoryFs.readFileSync(filePath, { useCache: isUrl });
  49563. if (typeof content !== 'string' && isUrl) {
  49564. if (IS_WEB_WORKER_ENV) {
  49565. content = fetchUrlSync(p);
  49566. if (typeof content === 'string') {
  49567. inMemoryFs.writeFile(filePath, content);
  49568. }
  49569. }
  49570. else {
  49571. config.logger.error(`ts.sys can only request http resources from within a web worker: ${p}`);
  49572. }
  49573. }
  49574. return content;
  49575. };
  49576. tsSys.writeFile = (p, data) => inMemoryFs.writeFile(p, data);
  49577. return tsSys;
  49578. };
  49579. const patchTsSystemWatch = (compilerSystem, tsSys) => {
  49580. tsSys.watchDirectory = (p, cb, recursive) => {
  49581. const watcher = compilerSystem.watchDirectory(p, (filePath) => {
  49582. cb(filePath);
  49583. }, recursive);
  49584. return {
  49585. close() {
  49586. watcher.close();
  49587. },
  49588. };
  49589. };
  49590. tsSys.watchFile = (p, cb) => {
  49591. const watcher = compilerSystem.watchFile(p, (filePath, eventKind) => {
  49592. if (eventKind === 'fileAdd') {
  49593. cb(filePath, t.FileWatcherEventKind.Created);
  49594. }
  49595. else if (eventKind === 'fileUpdate') {
  49596. cb(filePath, t.FileWatcherEventKind.Changed);
  49597. }
  49598. else if (eventKind === 'fileDelete') {
  49599. cb(filePath, t.FileWatcherEventKind.Deleted);
  49600. }
  49601. });
  49602. return {
  49603. close() {
  49604. watcher.close();
  49605. },
  49606. };
  49607. };
  49608. };
  49609. const patchTypescript = (config, inMemoryFs) => {
  49610. if (!t.__patched) {
  49611. if (config.sys) {
  49612. patchTsSystemFileSystem(config, config.sys, inMemoryFs, t.sys);
  49613. patchTsSystemWatch(config.sys, t.sys);
  49614. }
  49615. patchTypeScriptResolveModule(config, inMemoryFs);
  49616. patchTypeScriptGetParsedCommandLineOfConfigFile();
  49617. t.__patched = true;
  49618. }
  49619. };
  49620. const patchTypeScriptSysMinimum = () => {
  49621. if (!t.sys) {
  49622. // patches just the bare minimum
  49623. // if ts.sys already exists then it must be node ts.sys
  49624. // otherwise we're browser
  49625. // will be updated later on with the stencil sys
  49626. t.sys = {
  49627. args: [],
  49628. createDirectory: noop$1,
  49629. directoryExists: () => false,
  49630. exit: noop$1,
  49631. fileExists: () => false,
  49632. getCurrentDirectory,
  49633. getDirectories: () => [],
  49634. getExecutingFilePath: () => './',
  49635. readDirectory: () => [],
  49636. readFile: noop$1,
  49637. newLine: '\n',
  49638. resolvePath: resolve$1,
  49639. useCaseSensitiveFileNames: false,
  49640. write: noop$1,
  49641. writeFile: noop$1,
  49642. };
  49643. }
  49644. };
  49645. patchTypeScriptSysMinimum();
  49646. const getTypescriptPathFromUrl = (config, tsExecutingUrl, url) => {
  49647. const tsBaseUrl = new URL('..', tsExecutingUrl).href;
  49648. if (url.startsWith(tsBaseUrl)) {
  49649. const tsFilePath = url.replace(tsBaseUrl, '/');
  49650. const tsNodePath = config.sys.getLocalModulePath({
  49651. rootDir: config.rootDir,
  49652. moduleId: '@stencil/core',
  49653. path: tsFilePath,
  49654. });
  49655. return normalizePath$1(tsNodePath);
  49656. }
  49657. return url;
  49658. };
  49659. const patchTypeScriptGetParsedCommandLineOfConfigFile = () => {
  49660. const orgGetParsedCommandLineOfConfigFile = t.getParsedCommandLineOfConfigFile;
  49661. t.getParsedCommandLineOfConfigFile = (configFileName, optionsToExtend, host, extendedConfigCache) => {
  49662. const results = orgGetParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache);
  49663. // manually filter out any .spec or .e2e files
  49664. results.fileNames = results.fileNames.filter((f) => {
  49665. // filter e2e tests
  49666. if (f.includes('.e2e.') || f.includes('/e2e.')) {
  49667. return false;
  49668. }
  49669. // filter spec tests
  49670. if (f.includes('.spec.') || f.includes('/spec.')) {
  49671. return false;
  49672. }
  49673. return true;
  49674. });
  49675. return results;
  49676. };
  49677. };
  49678. const patchTypeScriptResolveModule = (config, inMemoryFs) => {
  49679. let compilerExe;
  49680. if (config.sys) {
  49681. compilerExe = config.sys.getCompilerExecutingPath();
  49682. }
  49683. else if (IS_BROWSER_ENV) {
  49684. compilerExe = location.href;
  49685. }
  49686. if (shouldPatchRemoteTypeScript(compilerExe)) {
  49687. const resolveModuleName = (t.__resolveModuleName = t.resolveModuleName);
  49688. t.resolveModuleName = (moduleName, containingFile, compilerOptions, host, cache, redirectedReference) => {
  49689. const resolvedModule = patchedTsResolveModule(config, inMemoryFs, moduleName, containingFile);
  49690. if (resolvedModule) {
  49691. return resolvedModule;
  49692. }
  49693. return resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
  49694. };
  49695. }
  49696. };
  49697. const tsResolveModuleName = (config, compilerCtx, moduleName, containingFile) => {
  49698. const resolveModuleName = t.__resolveModuleName || t.resolveModuleName;
  49699. if (moduleName && resolveModuleName && config.tsCompilerOptions) {
  49700. const host = patchTsSystemFileSystem(config, config.sys, compilerCtx.fs, t.sys);
  49701. const compilerOptions = { ...config.tsCompilerOptions };
  49702. compilerOptions.resolveJsonModule = true;
  49703. return resolveModuleName(moduleName, containingFile, compilerOptions, host);
  49704. }
  49705. return null;
  49706. };
  49707. const tsResolveModuleNamePackageJsonPath = (config, compilerCtx, moduleName, containingFile) => {
  49708. try {
  49709. const resolvedModule = tsResolveModuleName(config, compilerCtx, moduleName, containingFile);
  49710. if (resolvedModule && resolvedModule.resolvedModule && resolvedModule.resolvedModule.resolvedFileName) {
  49711. const rootDir = resolve$1('/');
  49712. let resolvedFileName = resolvedModule.resolvedModule.resolvedFileName;
  49713. for (let i = 0; i < 30; i++) {
  49714. if (rootDir === resolvedFileName) {
  49715. return null;
  49716. }
  49717. resolvedFileName = dirname(resolvedFileName);
  49718. const pkgJsonPath = join(resolvedFileName, 'package.json');
  49719. const exists = config.sys.accessSync(pkgJsonPath);
  49720. if (exists) {
  49721. return normalizePath$1(pkgJsonPath);
  49722. }
  49723. }
  49724. }
  49725. }
  49726. catch (e) {
  49727. config.logger.error(e);
  49728. }
  49729. return null;
  49730. };
  49731. const patchedTsResolveModule = (config, inMemoryFs, moduleName, containingFile) => {
  49732. if (isLocalModule(moduleName)) {
  49733. const containingDir = dirname(containingFile);
  49734. let resolvedFileName = join(containingDir, moduleName);
  49735. resolvedFileName = normalizePath$1(ensureExtension(resolvedFileName, containingFile));
  49736. if (isAbsolute$1(resolvedFileName) && !inMemoryFs.accessSync(resolvedFileName)) {
  49737. return null;
  49738. }
  49739. if (!isAbsolute$1(resolvedFileName) && !resolvedFileName.startsWith('.') && !resolvedFileName.startsWith('/')) {
  49740. resolvedFileName = './' + resolvedFileName;
  49741. }
  49742. const rtn = {
  49743. resolvedModule: {
  49744. extension: getTsResolveExtension(resolvedFileName),
  49745. resolvedFileName,
  49746. packageId: {
  49747. name: moduleName,
  49748. subModuleName: '',
  49749. version: version$3,
  49750. },
  49751. },
  49752. };
  49753. rtn.failedLookupLocations = [];
  49754. return rtn;
  49755. }
  49756. // node module id
  49757. return tsResolveNodeModule(config, inMemoryFs, moduleName, containingFile);
  49758. };
  49759. const tsResolveNodeModule = (config, inMemoryFs, moduleId, containingFile) => {
  49760. if (isStencilCoreImport(moduleId)) {
  49761. const rtn = {
  49762. resolvedModule: {
  49763. extension: t.Extension.Dts,
  49764. resolvedFileName: normalizePath$1(config.sys.getLocalModulePath({
  49765. rootDir: config.rootDir,
  49766. moduleId: '@stencil/core',
  49767. path: 'internal/index.d.ts',
  49768. })),
  49769. packageId: {
  49770. name: moduleId,
  49771. subModuleName: '',
  49772. version: version$3,
  49773. },
  49774. },
  49775. };
  49776. rtn.failedLookupLocations = [];
  49777. return rtn;
  49778. }
  49779. const resolved = resolveRemoteModuleIdSync(config, inMemoryFs, {
  49780. moduleId,
  49781. containingFile,
  49782. });
  49783. if (resolved) {
  49784. const rtn = {
  49785. resolvedModule: {
  49786. extension: t.Extension.Js,
  49787. resolvedFileName: resolved.resolvedUrl,
  49788. packageId: {
  49789. name: moduleId,
  49790. subModuleName: '',
  49791. version: resolved.packageJson.version,
  49792. },
  49793. },
  49794. };
  49795. rtn.failedLookupLocations = [];
  49796. return rtn;
  49797. }
  49798. return null;
  49799. };
  49800. const ensureExtension = (fileName, containingFile) => {
  49801. if (!basename(fileName).includes('.') && isString$1(containingFile)) {
  49802. containingFile = containingFile.toLowerCase();
  49803. if (isJsFile(containingFile)) {
  49804. fileName += '.js';
  49805. }
  49806. else if (isDtsFile(containingFile)) {
  49807. fileName += '.d.ts';
  49808. }
  49809. else if (isTsxFile(containingFile)) {
  49810. fileName += '.tsx';
  49811. }
  49812. else if (isTsFile(containingFile)) {
  49813. fileName += '.ts';
  49814. }
  49815. else if (isJsxFile(containingFile)) {
  49816. fileName += '.jsx';
  49817. }
  49818. }
  49819. return fileName;
  49820. };
  49821. const getTsResolveExtension = (p) => {
  49822. if (isDtsFile(p)) {
  49823. return t.Extension.Dts;
  49824. }
  49825. if (isTsxFile(p)) {
  49826. return t.Extension.Tsx;
  49827. }
  49828. if (isJsFile(p)) {
  49829. return t.Extension.Js;
  49830. }
  49831. if (isJsxFile(p)) {
  49832. return t.Extension.Jsx;
  49833. }
  49834. if (isJsonFile(p)) {
  49835. return t.Extension.Json;
  49836. }
  49837. return t.Extension.Ts;
  49838. };
  49839. const shouldPatchRemoteTypeScript = (compilerExe) => !IS_NODE_ENV && isRemoteUrl(compilerExe);
  49840. const getModule = (compilerCtx, filePath) => compilerCtx.moduleMap.get(normalizePath$1(filePath));
  49841. const createModule = (staticSourceFile, // this is NOT the original
  49842. staticSourceFileText, emitFilepath) => ({
  49843. sourceFilePath: normalizePath$1(staticSourceFile.fileName),
  49844. jsFilePath: emitFilepath,
  49845. staticSourceFile,
  49846. staticSourceFileText,
  49847. cmps: [],
  49848. coreRuntimeApis: [],
  49849. collectionName: null,
  49850. dtsFilePath: null,
  49851. excludeFromCollection: false,
  49852. externalImports: [],
  49853. hasVdomAttribute: false,
  49854. hasVdomClass: false,
  49855. hasVdomFunctional: false,
  49856. hasVdomKey: false,
  49857. hasVdomListener: false,
  49858. hasVdomPropOrAttr: false,
  49859. hasVdomRef: false,
  49860. hasVdomRender: false,
  49861. hasVdomStyle: false,
  49862. hasVdomText: false,
  49863. hasVdomXlink: false,
  49864. htmlAttrNames: [],
  49865. htmlParts: [],
  49866. htmlTagNames: [],
  49867. isCollectionDependency: false,
  49868. isLegacy: false,
  49869. localImports: [],
  49870. originalCollectionComponentPath: null,
  49871. originalImports: [],
  49872. potentialCmpRefs: [],
  49873. sourceMapPath: null,
  49874. sourceMapFileText: null,
  49875. });
  49876. /**
  49877. * Rollup plugin that aids in resolving the TypeScript files and performing the transpilation step.
  49878. * @param compilerCtx the current compiler context
  49879. * @param bundleOpts Rollup bundling options to apply during TypeScript compilation
  49880. * @param config the Stencil configuration for the project
  49881. * @returns the rollup plugin for handling TypeScript files.
  49882. */
  49883. const typescriptPlugin = (compilerCtx, bundleOpts, config) => {
  49884. return {
  49885. name: `${bundleOpts.id}TypescriptPlugin`,
  49886. /**
  49887. * A rollup build hook for loading TypeScript files and their associated source maps (if they exist).
  49888. * [Source](https://rollupjs.org/guide/en/#load)
  49889. * @param id the path of the file to load
  49890. * @returns the module matched (with its sourcemap if it exists), null otherwise
  49891. */
  49892. load(id) {
  49893. if (isAbsolute$1(id)) {
  49894. const fsFilePath = normalizeFsPath(id);
  49895. const module = getModule(compilerCtx, fsFilePath);
  49896. if (module) {
  49897. if (!module.sourceMapFileText) {
  49898. return { code: module.staticSourceFileText, map: null };
  49899. }
  49900. const sourceMap = JSON.parse(module.sourceMapFileText);
  49901. sourceMap.sources = sourceMap.sources.map((src) => basename(src));
  49902. return { code: module.staticSourceFileText, map: sourceMap };
  49903. }
  49904. }
  49905. return null;
  49906. },
  49907. /**
  49908. * Performs TypeScript compilation/transpilation, including applying any transformations against the Abstract Syntax
  49909. * Tree (AST) specific to stencil
  49910. * @param _code the code to modify, unused
  49911. * @param id module's identifier
  49912. * @returns the transpiled code, with its associated sourcemap. null otherwise
  49913. */
  49914. transform(_code, id) {
  49915. if (isAbsolute$1(id)) {
  49916. const fsFilePath = normalizeFsPath(id);
  49917. const mod = getModule(compilerCtx, fsFilePath);
  49918. if (mod && mod.cmps.length > 0) {
  49919. const tsResult = t.transpileModule(mod.staticSourceFileText, {
  49920. compilerOptions: config.tsCompilerOptions,
  49921. fileName: mod.sourceFilePath,
  49922. transformers: { before: bundleOpts.customTransformers },
  49923. });
  49924. const sourceMap = tsResult.sourceMapText ? JSON.parse(tsResult.sourceMapText) : null;
  49925. return { code: tsResult.outputText, map: sourceMap };
  49926. }
  49927. }
  49928. return null;
  49929. },
  49930. };
  49931. };
  49932. const resolveIdWithTypeScript = (config, compilerCtx) => {
  49933. return {
  49934. name: `resolveIdWithTypeScript`,
  49935. async resolveId(importee, importer) {
  49936. if (/\0/.test(importee) || !isString$1(importer)) {
  49937. return null;
  49938. }
  49939. const tsResolved = tsResolveModuleName(config, compilerCtx, importee, importer);
  49940. if (tsResolved && tsResolved.resolvedModule) {
  49941. // this is probably a .d.ts file for whatever reason in how TS resolves this
  49942. // use this resolved file as the "importer"
  49943. const tsResolvedPath = tsResolved.resolvedModule.resolvedFileName;
  49944. if (isString$1(tsResolvedPath) && !tsResolvedPath.endsWith('.d.ts')) {
  49945. return tsResolvedPath;
  49946. }
  49947. }
  49948. return null;
  49949. },
  49950. };
  49951. };
  49952. const userIndexPlugin = (config, compilerCtx) => {
  49953. return {
  49954. name: 'userIndexPlugin',
  49955. async resolveId(importee) {
  49956. if (importee === USER_INDEX_ENTRY_ID) {
  49957. const usersIndexJsPath = join(config.srcDir, 'index.ts');
  49958. const hasUserIndex = await compilerCtx.fs.access(usersIndexJsPath);
  49959. if (hasUserIndex) {
  49960. return usersIndexJsPath;
  49961. }
  49962. return importee;
  49963. }
  49964. return null;
  49965. },
  49966. async load(id) {
  49967. if (id === USER_INDEX_ENTRY_ID) {
  49968. return `//! Autogenerated index`;
  49969. }
  49970. return null;
  49971. },
  49972. };
  49973. };
  49974. const workerPlugin = (config, compilerCtx, buildCtx, platform, inlineWorkers) => {
  49975. if (platform === 'worker' || platform === 'hydrate') {
  49976. return {
  49977. name: 'workerPlugin',
  49978. transform(_, id) {
  49979. if (id.endsWith('?worker') || id.endsWith('?worker-inline')) {
  49980. return getMockedWorkerMain();
  49981. }
  49982. return null;
  49983. },
  49984. };
  49985. }
  49986. const workersMap = new Map();
  49987. return {
  49988. name: 'workerPlugin',
  49989. buildStart() {
  49990. workersMap.clear();
  49991. },
  49992. resolveId(id) {
  49993. if (id === WORKER_HELPER_ID) {
  49994. return {
  49995. id,
  49996. moduleSideEffects: false,
  49997. };
  49998. }
  49999. return null;
  50000. },
  50001. load(id) {
  50002. if (id === WORKER_HELPER_ID) {
  50003. return WORKER_HELPERS;
  50004. }
  50005. return null;
  50006. },
  50007. async transform(_, id) {
  50008. if (/\0/.test(id)) {
  50009. return null;
  50010. }
  50011. // Canonical worker path
  50012. if (id.endsWith('?worker')) {
  50013. const workerEntryPath = normalizeFsPath(id);
  50014. const workerName = getWorkerName(workerEntryPath);
  50015. const { code, dependencies, workerMsgId } = await getWorker(config, compilerCtx, buildCtx, this, workersMap, workerEntryPath);
  50016. const referenceId = this.emitFile({
  50017. type: 'asset',
  50018. source: code,
  50019. name: workerName + '.js',
  50020. });
  50021. dependencies.forEach((id) => this.addWatchFile(id));
  50022. return {
  50023. code: getWorkerMain(referenceId, workerName, workerMsgId),
  50024. moduleSideEffects: false,
  50025. };
  50026. }
  50027. else if (id.endsWith('?worker-inline')) {
  50028. const workerEntryPath = normalizeFsPath(id);
  50029. const workerName = getWorkerName(workerEntryPath);
  50030. const { code, dependencies, workerMsgId } = await getWorker(config, compilerCtx, buildCtx, this, workersMap, workerEntryPath);
  50031. const referenceId = this.emitFile({
  50032. type: 'asset',
  50033. source: code,
  50034. name: workerName + '.js',
  50035. });
  50036. dependencies.forEach((id) => this.addWatchFile(id));
  50037. return {
  50038. code: getInlineWorker(referenceId, workerName, workerMsgId),
  50039. moduleSideEffects: false,
  50040. };
  50041. }
  50042. // Proxy worker path
  50043. const workerEntryPath = getWorkerEntryPath(id);
  50044. if (workerEntryPath != null) {
  50045. const worker = await getWorker(config, compilerCtx, buildCtx, this, workersMap, workerEntryPath);
  50046. if (worker) {
  50047. if (inlineWorkers) {
  50048. return {
  50049. code: getInlineWorkerProxy(workerEntryPath, worker.workerMsgId, worker.exports),
  50050. moduleSideEffects: false,
  50051. };
  50052. }
  50053. else {
  50054. return {
  50055. code: getWorkerProxy(workerEntryPath, worker.exports),
  50056. moduleSideEffects: false,
  50057. };
  50058. }
  50059. }
  50060. }
  50061. return null;
  50062. },
  50063. };
  50064. };
  50065. const getWorkerEntryPath = (id) => {
  50066. if (WORKER_SUFFIX.some((p) => id.endsWith(p))) {
  50067. return normalizeFsPath(id);
  50068. }
  50069. return null;
  50070. };
  50071. const getWorker = async (config, compilerCtx, buildCtx, ctx, workersMap, workerEntryPath) => {
  50072. let worker = workersMap.get(workerEntryPath);
  50073. if (!worker) {
  50074. worker = await buildWorker(config, compilerCtx, buildCtx, ctx, workerEntryPath);
  50075. workersMap.set(workerEntryPath, worker);
  50076. }
  50077. return worker;
  50078. };
  50079. const getWorkerName = (id) => {
  50080. const parts = id.split('/').filter((i) => !i.includes('index'));
  50081. id = parts[parts.length - 1];
  50082. return id.replace('.tsx', '').replace('.ts', '');
  50083. };
  50084. const buildWorker = async (config, compilerCtx, buildCtx, ctx, workerEntryPath) => {
  50085. const workerName = getWorkerName(workerEntryPath);
  50086. const workerMsgId = `stencil.${workerName}`;
  50087. const build = await bundleOutput(config, compilerCtx, buildCtx, {
  50088. platform: 'worker',
  50089. id: workerName,
  50090. inputs: {
  50091. [workerName]: workerEntryPath,
  50092. },
  50093. inlineDynamicImports: true,
  50094. });
  50095. if (build) {
  50096. // Generate commonjs output so we can intercept exports at runtime
  50097. const output = await build.generate({
  50098. format: 'commonjs',
  50099. banner: `${generatePreamble(config)}\n(()=>{\n`,
  50100. footer: '})();',
  50101. intro: getWorkerIntro(workerMsgId, config.devMode),
  50102. esModule: false,
  50103. preferConst: true,
  50104. externalLiveBindings: false,
  50105. });
  50106. const entryPoint = output.output[0];
  50107. if (entryPoint.imports.length > 0) {
  50108. ctx.error('Workers should not have any external imports: ' + JSON.stringify(entryPoint.imports));
  50109. }
  50110. // Optimize code
  50111. let code = entryPoint.code;
  50112. const results = await optimizeModule(config, compilerCtx, {
  50113. input: code,
  50114. sourceTarget: config.buildEs5 ? 'es5' : 'es2017',
  50115. isCore: false,
  50116. minify: config.minifyJs,
  50117. inlineHelpers: true,
  50118. });
  50119. buildCtx.diagnostics.push(...results.diagnostics);
  50120. if (!hasError(results.diagnostics)) {
  50121. code = results.output;
  50122. }
  50123. return {
  50124. code,
  50125. exports: entryPoint.exports,
  50126. workerMsgId,
  50127. dependencies: Object.keys(entryPoint.modules).filter((id) => !/\0/.test(id) && id !== workerEntryPath),
  50128. };
  50129. }
  50130. return null;
  50131. };
  50132. const WORKER_SUFFIX = ['.worker.ts', '.worker.tsx', '.worker/index.ts', '.worker/index.tsx'];
  50133. const WORKER_HELPER_ID = '@worker-helper';
  50134. const GET_TRANSFERABLES = `
  50135. const isInstanceOf = (value, className) => {
  50136. const C = globalThis[className];
  50137. return C != null && value instanceof C;
  50138. }
  50139. const getTransferables = (value) => {
  50140. if (value != null) {
  50141. if (
  50142. isInstanceOf(value, "ArrayBuffer") ||
  50143. isInstanceOf(value, "MessagePort") ||
  50144. isInstanceOf(value, "ImageBitmap") ||
  50145. isInstanceOf(value, "OffscreenCanvas")
  50146. ) {
  50147. return [value];
  50148. }
  50149. if (typeof value === "object") {
  50150. if (value.constructor === Object) {
  50151. value = Object.values(value);
  50152. }
  50153. if (Array.isArray(value)) {
  50154. return value.flatMap(getTransferables);
  50155. }
  50156. return getTransferables(value.buffer);
  50157. }
  50158. }
  50159. return [];
  50160. };`;
  50161. const getWorkerIntro = (workerMsgId, isDev) => `
  50162. ${GET_TRANSFERABLES}
  50163. const exports = {};
  50164. const workerMsgId = '${workerMsgId}';
  50165. const workerMsgCallbackId = workerMsgId + '.cb';
  50166. addEventListener('message', async ({data}) => {
  50167. if (data && data[0] === workerMsgId) {
  50168. let id = data[1];
  50169. let method = data[2];
  50170. let args = data[3];
  50171. let i = 0;
  50172. let argsLen = args.length;
  50173. let value;
  50174. let err;
  50175. try {
  50176. for (; i < argsLen; i++) {
  50177. if (Array.isArray(args[i]) && args[i][0] === workerMsgCallbackId) {
  50178. const callbackId = args[i][1];
  50179. args[i] = (...cbArgs) => {
  50180. postMessage(
  50181. [workerMsgCallbackId, callbackId, cbArgs]
  50182. );
  50183. };
  50184. }
  50185. }
  50186. ${isDev
  50187. ? `
  50188. value = exports[method](...args);
  50189. if (!value || !value.then) {
  50190. throw new Error('The exported method "' + method + '" does not return a Promise, make sure it is an "async" function');
  50191. }
  50192. value = await value;
  50193. `
  50194. : `
  50195. value = await exports[method](...args);`}
  50196. } catch (e) {
  50197. value = null;
  50198. if (e instanceof Error) {
  50199. err = {
  50200. isError: true,
  50201. value: {
  50202. message: e.message,
  50203. name: e.name,
  50204. stack: e.stack,
  50205. }
  50206. };
  50207. } else {
  50208. err = {
  50209. isError: false,
  50210. value: e
  50211. };
  50212. }
  50213. value = undefined;
  50214. }
  50215. const transferables = getTransferables(value);
  50216. ${isDev ? `if (transferables.length > 0) console.debug('Transfering', transferables);` : ''}
  50217. postMessage(
  50218. [workerMsgId, id, value, err],
  50219. transferables
  50220. );
  50221. }
  50222. });
  50223. `;
  50224. const WORKER_HELPERS = `
  50225. import { consoleError } from '${STENCIL_INTERNAL_ID}';
  50226. ${GET_TRANSFERABLES}
  50227. let pendingIds = 0;
  50228. let callbackIds = 0;
  50229. const pending = new Map();
  50230. const callbacks = new Map();
  50231. export const createWorker = (workerPath, workerName, workerMsgId) => {
  50232. const worker = new Worker(workerPath, {name:workerName});
  50233. worker.addEventListener('message', ({data}) => {
  50234. if (data) {
  50235. const workerMsg = data[0];
  50236. const id = data[1];
  50237. const value = data[2];
  50238. if (workerMsg === workerMsgId) {
  50239. const err = data[3];
  50240. const [resolve, reject, callbackIds] = pending.get(id);
  50241. pending.delete(id);
  50242. if (err) {
  50243. const errObj = (err.isError)
  50244. ? Object.assign(new Error(err.value.message), err.value)
  50245. : err.value;
  50246. consoleError(errObj);
  50247. reject(errObj);
  50248. } else {
  50249. if (callbackIds) {
  50250. callbackIds.forEach(id => callbacks.delete(id));
  50251. }
  50252. resolve(value);
  50253. }
  50254. } else if (workerMsg === workerMsgId + '.cb') {
  50255. try {
  50256. callbacks.get(id)(...value);
  50257. } catch (e) {
  50258. consoleError(e);
  50259. }
  50260. }
  50261. }
  50262. });
  50263. return worker;
  50264. };
  50265. export const createWorkerProxy = (worker, workerMsgId, exportedMethod) => (
  50266. (...args) => new Promise((resolve, reject) => {
  50267. let pendingId = pendingIds++;
  50268. let i = 0;
  50269. let argLen = args.length;
  50270. let mainData = [resolve, reject];
  50271. pending.set(pendingId, mainData);
  50272. for (; i < argLen; i++) {
  50273. if (typeof args[i] === 'function') {
  50274. const callbackId = callbackIds++;
  50275. callbacks.set(callbackId, args[i]);
  50276. args[i] = [workerMsgId + '.cb', callbackId];
  50277. (mainData[2] = mainData[2] || []).push(callbackId);
  50278. }
  50279. }
  50280. const postMessage = (w) => (
  50281. w.postMessage(
  50282. [workerMsgId, pendingId, exportedMethod, args],
  50283. getTransferables(args)
  50284. )
  50285. );
  50286. if (worker.then) {
  50287. worker.then(postMessage);
  50288. } else {
  50289. postMessage(worker);
  50290. }
  50291. })
  50292. );
  50293. `;
  50294. const getWorkerMain = (referenceId, workerName, workerMsgId) => {
  50295. return `
  50296. import { createWorker } from '${WORKER_HELPER_ID}';
  50297. export const workerName = '${workerName}';
  50298. export const workerMsgId = '${workerMsgId}';
  50299. export const workerPath = /*@__PURE__*/import.meta.ROLLUP_FILE_URL_${referenceId};
  50300. export const worker = /*@__PURE__*/createWorker(workerPath, workerName, workerMsgId);
  50301. `;
  50302. };
  50303. const getInlineWorker = (referenceId, workerName, workerMsgId) => {
  50304. return `
  50305. import { createWorker } from '${WORKER_HELPER_ID}';
  50306. export const workerName = '${workerName}';
  50307. export const workerMsgId = '${workerMsgId}';
  50308. export const workerPath = /*@__PURE__*/import.meta.ROLLUP_FILE_URL_${referenceId};
  50309. const blob = new Blob(['importScripts("' + workerPath + '")'], { type: 'text/javascript' });
  50310. const url = URL.createObjectURL(blob);
  50311. export const worker = /*@__PURE__*/createWorker(url, workerName, workerMsgId);
  50312. URL.revokeObjectURL(url);
  50313. `;
  50314. };
  50315. const getMockedWorkerMain = () => {
  50316. // for the hydrate build the workers won't actually work
  50317. // however, we still need to make the {worker} export
  50318. // kick-in otherwise bundling chokes
  50319. return `
  50320. export const workerName = 'mocked-worker';
  50321. export const workerMsgId = workerName;
  50322. export const workerPath = workerName;
  50323. export const worker = { name: workerName };
  50324. `;
  50325. };
  50326. const getWorkerProxy = (workerEntryPath, exportedMethods) => {
  50327. return `
  50328. import { createWorkerProxy } from '${WORKER_HELPER_ID}';
  50329. import { worker, workerName, workerMsgId } from '${workerEntryPath}?worker';
  50330. ${exportedMethods
  50331. .map((exportedMethod) => {
  50332. return `export const ${exportedMethod} = /*@__PURE__*/createWorkerProxy(worker, workerMsgId, '${exportedMethod}');`;
  50333. })
  50334. .join('\n')}
  50335. `;
  50336. };
  50337. const getInlineWorkerProxy = (workerEntryPath, workerMsgId, exportedMethods) => {
  50338. return `
  50339. import { createWorkerProxy } from '${WORKER_HELPER_ID}';
  50340. const workerPromise = import('${workerEntryPath}?worker-inline').then(m => m.worker);
  50341. ${exportedMethods
  50342. .map((exportedMethod) => {
  50343. return `export const ${exportedMethod} = /*@__PURE__*/createWorkerProxy(workerPromise, '${workerMsgId}', '${exportedMethod}');`;
  50344. })
  50345. .join('\n')}
  50346. `;
  50347. };
  50348. const bundleOutput = async (config, compilerCtx, buildCtx, bundleOpts) => {
  50349. try {
  50350. const rollupOptions = getRollupOptions(config, compilerCtx, buildCtx, bundleOpts);
  50351. const rollupBuild = await rollup(rollupOptions);
  50352. compilerCtx.rollupCache.set(bundleOpts.id, rollupBuild.cache);
  50353. return rollupBuild;
  50354. }
  50355. catch (e) {
  50356. if (!buildCtx.hasError) {
  50357. // TODO(STENCIL-353): Implement a type guard that balances using our own copy of Rollup types (which are
  50358. // breakable) and type safety (so that the error variable may be something other than `any`)
  50359. loadRollupDiagnostics(config, compilerCtx, buildCtx, e);
  50360. }
  50361. }
  50362. return undefined;
  50363. };
  50364. /**
  50365. * Build the rollup options that will be used to transpile, minify, and otherwise transform a Stencil project
  50366. * @param config the Stencil configuration for the project
  50367. * @param compilerCtx the current compiler context
  50368. * @param buildCtx a context object containing information about the current build
  50369. * @param bundleOpts Rollup bundling options to apply to the base configuration setup by this function
  50370. * @returns the rollup options to be used
  50371. */
  50372. const getRollupOptions = (config, compilerCtx, buildCtx, bundleOpts) => {
  50373. var _a;
  50374. const customResolveOptions = createCustomResolverAsync(config.sys, compilerCtx.fs, [
  50375. '.tsx',
  50376. '.ts',
  50377. '.js',
  50378. '.mjs',
  50379. '.json',
  50380. '.d.ts',
  50381. ]);
  50382. const nodeResolvePlugin = nodeResolve({
  50383. mainFields: ['collection:main', 'jsnext:main', 'es2017', 'es2015', 'module', 'main'],
  50384. customResolveOptions,
  50385. browser: true,
  50386. rootDir: config.rootDir,
  50387. ...config.nodeResolve,
  50388. });
  50389. const orgNodeResolveId = nodeResolvePlugin.resolveId;
  50390. const orgNodeResolveId2 = (nodeResolvePlugin.resolveId = async function (importee, importer) {
  50391. const [realImportee, query] = importee.split('?');
  50392. const resolved = await orgNodeResolveId.call(nodeResolvePlugin, realImportee, importer);
  50393. if (resolved) {
  50394. if (isString$1(resolved)) {
  50395. return query ? resolved + '?' + query : resolved;
  50396. }
  50397. return {
  50398. ...resolved,
  50399. id: query ? resolved.id + '?' + query : resolved.id,
  50400. };
  50401. }
  50402. return resolved;
  50403. });
  50404. if (config.devServer && config.devServer.experimentalDevModules) {
  50405. nodeResolvePlugin.resolveId = async function (importee, importer) {
  50406. const resolvedId = await orgNodeResolveId2.call(nodeResolvePlugin, importee, importer);
  50407. return devNodeModuleResolveId(config, compilerCtx.fs, resolvedId, importee);
  50408. };
  50409. }
  50410. const beforePlugins = config.rollupPlugins.before || [];
  50411. const afterPlugins = config.rollupPlugins.after || [];
  50412. const rollupOptions = {
  50413. input: bundleOpts.inputs,
  50414. plugins: [
  50415. coreResolvePlugin(config, compilerCtx, bundleOpts.platform, bundleOpts.externalRuntime),
  50416. appDataPlugin(config, compilerCtx, buildCtx, bundleOpts.conditionals, bundleOpts.platform),
  50417. lazyComponentPlugin(buildCtx),
  50418. loaderPlugin(bundleOpts.loader),
  50419. userIndexPlugin(config, compilerCtx),
  50420. typescriptPlugin(compilerCtx, bundleOpts, config),
  50421. extFormatPlugin(config),
  50422. extTransformsPlugin(config, compilerCtx, buildCtx, bundleOpts),
  50423. workerPlugin(config, compilerCtx, buildCtx, bundleOpts.platform, !!bundleOpts.inlineWorkers),
  50424. serverPlugin(config, bundleOpts.platform),
  50425. ...beforePlugins,
  50426. nodeResolvePlugin,
  50427. resolveIdWithTypeScript(config, compilerCtx),
  50428. commonjs({
  50429. include: /node_modules/,
  50430. sourceMap: config.sourceMap,
  50431. transformMixedEsModules: false,
  50432. ...config.commonjs,
  50433. }),
  50434. ...afterPlugins,
  50435. pluginHelper(config, buildCtx, bundleOpts.platform),
  50436. json({
  50437. preferConst: true,
  50438. }),
  50439. replace({
  50440. 'process.env.NODE_ENV': config.devMode ? '"development"' : '"production"',
  50441. }),
  50442. fileLoadPlugin(compilerCtx.fs),
  50443. ],
  50444. treeshake: getTreeshakeOption(config, bundleOpts),
  50445. inlineDynamicImports: bundleOpts.inlineDynamicImports,
  50446. preserveEntrySignatures: (_a = bundleOpts.preserveEntrySignatures) !== null && _a !== void 0 ? _a : 'strict',
  50447. onwarn: createOnWarnFn(buildCtx.diagnostics),
  50448. cache: compilerCtx.rollupCache.get(bundleOpts.id),
  50449. };
  50450. return rollupOptions;
  50451. };
  50452. const getTreeshakeOption = (config, bundleOpts) => {
  50453. if (bundleOpts.platform === 'hydrate') {
  50454. return {
  50455. propertyReadSideEffects: false,
  50456. tryCatchDeoptimization: false,
  50457. };
  50458. }
  50459. const treeshake = !config.devMode && config.rollupConfig.inputOptions.treeshake !== false
  50460. ? {
  50461. propertyReadSideEffects: false,
  50462. tryCatchDeoptimization: false,
  50463. }
  50464. : false;
  50465. return treeshake;
  50466. };
  50467. /**
  50468. * Decorators on class declarations that we remove as part of the compilation
  50469. * process
  50470. */
  50471. const CLASS_DECORATORS_TO_REMOVE = ['Component'];
  50472. /**
  50473. * Decorators on class members that we remove as part of the compilation
  50474. * process
  50475. */
  50476. const MEMBER_DECORATORS_TO_REMOVE = [
  50477. 'Element',
  50478. 'Event',
  50479. 'Listen',
  50480. 'Method',
  50481. 'Prop',
  50482. 'PropDidChange',
  50483. 'PropWillChange',
  50484. 'State',
  50485. 'Watch',
  50486. ];
  50487. /**
  50488. * Determine if a class member is private or not
  50489. * @param member the class member to evaluate
  50490. * @returns `true` if the member has the `private` or `protected` modifier attached to it. `false` otherwise
  50491. */
  50492. const isMemberPrivate = (member) => {
  50493. if (member.modifiers &&
  50494. member.modifiers.some((m) => m.kind === t.SyntaxKind.PrivateKeyword || m.kind === t.SyntaxKind.ProtectedKeyword)) {
  50495. return true;
  50496. }
  50497. return false;
  50498. };
  50499. /**
  50500. * Convert a JavaScript value to the TypeScript Intermediate Representation
  50501. * (IR) for a literal Abstract Syntax Tree (AST) node with that same value. The
  50502. * value to convert may be a primitive type like `string`, `boolean`, etc or
  50503. * may be an `Object`, `Array`, etc.
  50504. *
  50505. * Note that this function takes a param (`refs`) with a default value,
  50506. * normally a value should _not_ be passed for this parameter since it is
  50507. * intended to be used for recursive calls.
  50508. *
  50509. * @param val the value to convert
  50510. * @param refs a set of references, used in recursive calls to avoid
  50511. * circular references when creating object literal IR instances. **note that
  50512. * you shouldn't pass this parameter unless you know what you're doing!**
  50513. * @returns TypeScript IR for a literal corresponding to the JavaScript value
  50514. * with which the function was called
  50515. */
  50516. const convertValueToLiteral = (val, refs = null) => {
  50517. if (refs == null) {
  50518. refs = new WeakSet();
  50519. }
  50520. if (val === String) {
  50521. return t.createIdentifier('String');
  50522. }
  50523. if (val === Number) {
  50524. return t.createIdentifier('Number');
  50525. }
  50526. if (val === Boolean) {
  50527. return t.createIdentifier('Boolean');
  50528. }
  50529. if (val === undefined) {
  50530. return t.createIdentifier('undefined');
  50531. }
  50532. if (val === null) {
  50533. return t.createIdentifier('null');
  50534. }
  50535. if (Array.isArray(val)) {
  50536. return arrayToArrayLiteral(val, refs);
  50537. }
  50538. if (typeof val === 'object') {
  50539. if (val.__identifier && val.__escapedText) {
  50540. return t.createIdentifier(val.__escapedText);
  50541. }
  50542. return objectToObjectLiteral(val, refs);
  50543. }
  50544. return t.createLiteral(val);
  50545. };
  50546. /**
  50547. * Convert a JavaScript Array instance to TypeScript's Intermediate
  50548. * Representation (IR) for an array literal. This is done by recursively using
  50549. * {@link convertValueToLiteral} to create a new array consisting of the
  50550. * TypeScript IR of each element in the array to be converted, and then creating
  50551. * the TypeScript IR for _that_ array.
  50552. *
  50553. * @param list the array instance to convert
  50554. * @param refs a set of references to objects, used when converting objects to
  50555. * avoid circular references
  50556. * @returns TypeScript IR for the array we want to convert
  50557. */
  50558. const arrayToArrayLiteral = (list, refs) => {
  50559. const newList = list.map((l) => {
  50560. return convertValueToLiteral(l, refs);
  50561. });
  50562. return t.createArrayLiteral(newList);
  50563. };
  50564. /**
  50565. * Convert a JavaScript object (i.e. an object existing at runtime) to the
  50566. * corresponding TypeScript Intermediate Representation (IR)
  50567. * ({@see ts.ObjectLiteralExpression}) for an object literal. This function
  50568. * takes an argument holding a `WeakSet` of references to objects which is
  50569. * used to avoid circular references. Objects that are converted in this
  50570. * function are added to the set, and if an object is already present then an
  50571. * `undefined` literal (in TypeScript IR) is returned instead of another
  50572. * object literal, as continuing to convert a circular reference would, well,
  50573. * never end!
  50574. *
  50575. * @param obj the JavaScript object to convert to TypeScript IR
  50576. * @param refs a set of references to objects, used to avoid circular references
  50577. * @returns a TypeScript object literal expression
  50578. */
  50579. const objectToObjectLiteral = (obj, refs) => {
  50580. if (refs.has(obj)) {
  50581. return t.createIdentifier('undefined');
  50582. }
  50583. refs.add(obj);
  50584. const newProperties = Object.keys(obj).map((key) => {
  50585. const prop = t.createPropertyAssignment(t.createLiteral(key), convertValueToLiteral(obj[key], refs));
  50586. return prop;
  50587. });
  50588. return t.createObjectLiteral(newProperties, true);
  50589. };
  50590. /**
  50591. * Create a TypeScript getter declaration AST node corresponding to a
  50592. * supplied prop name and return value
  50593. *
  50594. * @param propName the name of the prop to access
  50595. * @param returnExpression a TypeScript AST node to return from the getter
  50596. * @returns an AST node representing a getter
  50597. */
  50598. const createStaticGetter = (propName, returnExpression) => {
  50599. return t.factory.createGetAccessorDeclaration(undefined, [t.factory.createToken(t.SyntaxKind.StaticKeyword)], propName, undefined, undefined, t.factory.createBlock([t.factory.createReturnStatement(returnExpression)]));
  50600. };
  50601. const getStaticValue = (staticMembers, staticName) => {
  50602. const staticMember = staticMembers.find((member) => member.name.escapedText === staticName);
  50603. if (!staticMember || !staticMember.body || !staticMember.body.statements) {
  50604. return null;
  50605. }
  50606. const rtnStatement = staticMember.body.statements.find((s) => s.kind === t.SyntaxKind.ReturnStatement);
  50607. if (!rtnStatement || !rtnStatement.expression) {
  50608. return null;
  50609. }
  50610. const expKind = rtnStatement.expression.kind;
  50611. if (expKind === t.SyntaxKind.StringLiteral) {
  50612. return rtnStatement.expression.text;
  50613. }
  50614. if (expKind === t.SyntaxKind.NoSubstitutionTemplateLiteral) {
  50615. return rtnStatement.expression.text;
  50616. }
  50617. if (expKind === t.SyntaxKind.TrueKeyword) {
  50618. return true;
  50619. }
  50620. if (expKind === t.SyntaxKind.FalseKeyword) {
  50621. return false;
  50622. }
  50623. if (expKind === t.SyntaxKind.ObjectLiteralExpression) {
  50624. return objectLiteralToObjectMap(rtnStatement.expression);
  50625. }
  50626. if (expKind === t.SyntaxKind.ArrayLiteralExpression &&
  50627. rtnStatement.expression.elements) {
  50628. return arrayLiteralToArray(rtnStatement.expression);
  50629. }
  50630. if (expKind === t.SyntaxKind.Identifier) {
  50631. const identifier = rtnStatement.expression;
  50632. if (typeof identifier.escapedText === 'string') {
  50633. return getIdentifierValue(identifier.escapedText);
  50634. }
  50635. if (identifier.escapedText) {
  50636. const obj = {};
  50637. Object.keys(identifier.escapedText).forEach((key) => {
  50638. obj[key] = getIdentifierValue(identifier.escapedText[key]);
  50639. });
  50640. return obj;
  50641. }
  50642. }
  50643. return null;
  50644. };
  50645. const arrayLiteralToArray = (arr) => {
  50646. return arr.elements.map((element) => {
  50647. let val;
  50648. switch (element.kind) {
  50649. case t.SyntaxKind.ObjectLiteralExpression:
  50650. val = objectLiteralToObjectMap(element);
  50651. break;
  50652. case t.SyntaxKind.StringLiteral:
  50653. val = element.text;
  50654. break;
  50655. case t.SyntaxKind.TrueKeyword:
  50656. val = true;
  50657. break;
  50658. case t.SyntaxKind.FalseKeyword:
  50659. val = false;
  50660. break;
  50661. case t.SyntaxKind.Identifier:
  50662. const escapedText = element.escapedText;
  50663. if (escapedText === 'String') {
  50664. val = String;
  50665. }
  50666. else if (escapedText === 'Number') {
  50667. val = Number;
  50668. }
  50669. else if (escapedText === 'Boolean') {
  50670. val = Boolean;
  50671. }
  50672. break;
  50673. case t.SyntaxKind.PropertyAccessExpression:
  50674. default:
  50675. val = element;
  50676. }
  50677. return val;
  50678. });
  50679. };
  50680. const objectLiteralToObjectMap = (objectLiteral) => {
  50681. const properties = objectLiteral.properties;
  50682. const final = {};
  50683. for (const propAssignment of properties) {
  50684. const propName = getTextOfPropertyName(propAssignment.name);
  50685. let val;
  50686. if (t.isShorthandPropertyAssignment(propAssignment)) {
  50687. val = getIdentifierValue(propName);
  50688. }
  50689. else if (t.isPropertyAssignment(propAssignment)) {
  50690. switch (propAssignment.initializer.kind) {
  50691. case t.SyntaxKind.ArrayLiteralExpression:
  50692. val = arrayLiteralToArray(propAssignment.initializer);
  50693. break;
  50694. case t.SyntaxKind.ObjectLiteralExpression:
  50695. val = objectLiteralToObjectMap(propAssignment.initializer);
  50696. break;
  50697. case t.SyntaxKind.StringLiteral:
  50698. val = propAssignment.initializer.text;
  50699. break;
  50700. case t.SyntaxKind.NoSubstitutionTemplateLiteral:
  50701. val = propAssignment.initializer.text;
  50702. break;
  50703. case t.SyntaxKind.TrueKeyword:
  50704. val = true;
  50705. break;
  50706. case t.SyntaxKind.FalseKeyword:
  50707. val = false;
  50708. break;
  50709. case t.SyntaxKind.Identifier:
  50710. const escapedText = propAssignment.initializer.escapedText;
  50711. if (escapedText === 'String') {
  50712. val = String;
  50713. }
  50714. else if (escapedText === 'Number') {
  50715. val = Number;
  50716. }
  50717. else if (escapedText === 'Boolean') {
  50718. val = Boolean;
  50719. }
  50720. else if (escapedText === 'undefined') {
  50721. val = undefined;
  50722. }
  50723. else if (escapedText === 'null') {
  50724. val = null;
  50725. }
  50726. else {
  50727. val = getIdentifierValue(propAssignment.initializer.escapedText);
  50728. }
  50729. break;
  50730. case t.SyntaxKind.PropertyAccessExpression:
  50731. default:
  50732. val = propAssignment.initializer;
  50733. }
  50734. }
  50735. final[propName] = val;
  50736. }
  50737. return final;
  50738. };
  50739. const getIdentifierValue = (escapedText) => {
  50740. const identifier = {
  50741. __identifier: true,
  50742. __escapedText: escapedText,
  50743. };
  50744. return identifier;
  50745. };
  50746. const getTextOfPropertyName = (propName) => {
  50747. switch (propName.kind) {
  50748. case t.SyntaxKind.Identifier:
  50749. return propName.text;
  50750. case t.SyntaxKind.StringLiteral:
  50751. case t.SyntaxKind.NumericLiteral:
  50752. return propName.text;
  50753. case t.SyntaxKind.ComputedPropertyName:
  50754. const expression = propName.expression;
  50755. if (t.isStringLiteral(expression) || t.isNumericLiteral(expression)) {
  50756. return propName.expression.text;
  50757. }
  50758. }
  50759. return undefined;
  50760. };
  50761. /**
  50762. * Generate a series of type references for a given AST node
  50763. * @param baseNode the AST node to pull type references from
  50764. * @param sourceFile the source file in which the provided `baseNode` exists
  50765. * @returns the generated series of type references
  50766. */
  50767. const getAttributeTypeInfo = (baseNode, sourceFile) => {
  50768. const allReferences = {};
  50769. getAllTypeReferences(baseNode).forEach((typeName) => {
  50770. allReferences[typeName] = getTypeReferenceLocation(typeName, sourceFile);
  50771. });
  50772. return allReferences;
  50773. };
  50774. /**
  50775. * Get the text-based name from a TypeScript `EntityName`, which is an identifier of some form
  50776. * @param entity a TypeScript `EntityName` to retrieve the name of an entity from
  50777. * @returns the entity's name
  50778. */
  50779. const getEntityName = (entity) => {
  50780. if (t.isIdentifier(entity)) {
  50781. return entity.escapedText.toString();
  50782. }
  50783. else {
  50784. // We have qualified name - e.g. const x: Foo.Bar.Baz;
  50785. // Recurse until we find the 'base' of the qualified name
  50786. return getEntityName(entity.left);
  50787. }
  50788. };
  50789. /**
  50790. * Recursively walks the provided AST to collect all TypeScript type references that are found
  50791. * @param node the node to walk to retrieve type information
  50792. * @returns the collected type references
  50793. */
  50794. const getAllTypeReferences = (node) => {
  50795. const referencedTypes = [];
  50796. const visit = (node) => {
  50797. /**
  50798. * A type reference node will refer to some type T.
  50799. * e.g: In `const foo: Bar = {...}` the reference node will contain semantic information about `Bar`.
  50800. * In TypeScript, types that are also keywords (e.g. `number` in `const foo: number`) are not `TypeReferenceNode`s.
  50801. */
  50802. if (t.isTypeReferenceNode(node)) {
  50803. referencedTypes.push(getEntityName(node.typeName));
  50804. if (node.typeArguments) {
  50805. // a type may contain types itself (e.g. generics - Foo<Bar>)
  50806. node.typeArguments
  50807. .filter((typeArg) => t.isTypeReferenceNode(typeArg))
  50808. .forEach((typeRef) => {
  50809. const typeName = typeRef.typeName;
  50810. if (typeName && typeName.escapedText) {
  50811. referencedTypes.push(typeName.escapedText.toString());
  50812. }
  50813. });
  50814. }
  50815. }
  50816. return t.forEachChild(node, visit);
  50817. };
  50818. visit(node);
  50819. return referencedTypes;
  50820. };
  50821. const validateReferences = (diagnostics, references, node) => {
  50822. Object.keys(references).forEach((refName) => {
  50823. const ref = references[refName];
  50824. if (ref.path === '@stencil/core' && readOnlyArrayHasStringMember(MEMBER_DECORATORS_TO_REMOVE, refName)) {
  50825. const err = buildError(diagnostics);
  50826. augmentDiagnosticWithNode(err, node);
  50827. }
  50828. });
  50829. };
  50830. /**
  50831. * Determine where a TypeScript type reference originates from. This is accomplished by interrogating the AST node in
  50832. * which the type's name appears
  50833. *
  50834. * A type may originate:
  50835. * - from the same file where it is used (a type is declared in some file, `foo.ts`, and later used in the same file)
  50836. * - from another file (I.E. it is imported and should have an import statement somewhere in the file)
  50837. * - from a global context
  50838. * - etc.
  50839. *
  50840. * The type may be declared using the `type` or `interface` keywords.
  50841. *
  50842. * @param typeName the name of the type to find the origination of
  50843. * @param tsNode the TypeScript AST node being searched for the provided `typeName`
  50844. * @returns the context stating where the type originates from
  50845. */
  50846. const getTypeReferenceLocation = (typeName, tsNode) => {
  50847. const sourceFileObj = tsNode.getSourceFile();
  50848. // Loop through all top level imports to find any reference to the type for 'import' reference location
  50849. const importTypeDeclaration = sourceFileObj.statements.find((st) => {
  50850. const statement = t.isImportDeclaration(st) &&
  50851. st.importClause &&
  50852. t.isImportClause(st.importClause) &&
  50853. st.importClause.namedBindings &&
  50854. t.isNamedImports(st.importClause.namedBindings) &&
  50855. Array.isArray(st.importClause.namedBindings.elements) &&
  50856. st.importClause.namedBindings.elements.find((nbe) => nbe.name.getText() === typeName);
  50857. if (!statement) {
  50858. return false;
  50859. }
  50860. return true;
  50861. });
  50862. if (importTypeDeclaration) {
  50863. const localImportPath = importTypeDeclaration.moduleSpecifier.text;
  50864. return {
  50865. location: 'import',
  50866. path: localImportPath,
  50867. };
  50868. }
  50869. // Loop through all top level exports to find if any reference to the type for 'local' reference location
  50870. const isExported = sourceFileObj.statements.some((st) => {
  50871. // Is the interface defined in the file and exported
  50872. const isInterfaceDeclarationExported = t.isInterfaceDeclaration(st) &&
  50873. st.name.getText() === typeName &&
  50874. Array.isArray(st.modifiers) &&
  50875. st.modifiers.some((mod) => mod.kind === t.SyntaxKind.ExportKeyword);
  50876. const isTypeAliasDeclarationExported = t.isTypeAliasDeclaration(st) &&
  50877. st.name.getText() === typeName &&
  50878. Array.isArray(st.modifiers) &&
  50879. st.modifiers.some((mod) => mod.kind === t.SyntaxKind.ExportKeyword);
  50880. // Is the interface exported through a named export
  50881. const isTypeInExportDeclaration = t.isExportDeclaration(st) &&
  50882. t.isNamedExports(st.exportClause) &&
  50883. st.exportClause.elements.some((nee) => nee.name.getText() === typeName);
  50884. return isInterfaceDeclarationExported || isTypeAliasDeclarationExported || isTypeInExportDeclaration;
  50885. });
  50886. if (isExported) {
  50887. return {
  50888. location: 'local',
  50889. };
  50890. }
  50891. // This is most likely a global type, if it is a local that is not exported then typescript will inform the dev
  50892. return {
  50893. location: 'global',
  50894. };
  50895. };
  50896. const resolveType = (checker, type) => {
  50897. const set = new Set();
  50898. parseDocsType(checker, type, set);
  50899. // normalize booleans
  50900. const hasTrue = set.delete('true');
  50901. const hasFalse = set.delete('false');
  50902. if (hasTrue || hasFalse) {
  50903. set.add('boolean');
  50904. }
  50905. let parts = Array.from(set.keys()).sort();
  50906. // TODO(STENCIL-366): Get this section of code under tests that directly exercises this behavior
  50907. if (parts.length > 1) {
  50908. parts = parts.map((p) => (p.indexOf('=>') >= 0 ? `(${p})` : p));
  50909. }
  50910. if (parts.length > 20) {
  50911. return typeToString(checker, type);
  50912. }
  50913. else {
  50914. return parts.join(' | ');
  50915. }
  50916. };
  50917. /**
  50918. * Formats a TypeScript `Type` entity as a string
  50919. * @param checker a reference to the TypeScript type checker
  50920. * @param type a TypeScript `Type` entity to format
  50921. * @returns the formatted string
  50922. */
  50923. const typeToString = (checker, type) => {
  50924. const TYPE_FORMAT_FLAGS = t.TypeFormatFlags.NoTruncation | t.TypeFormatFlags.InTypeAlias | t.TypeFormatFlags.InElementType;
  50925. return checker.typeToString(type, undefined, TYPE_FORMAT_FLAGS);
  50926. };
  50927. const parseDocsType = (checker, type, parts) => {
  50928. if (type.isUnion()) {
  50929. type.types.forEach((t) => {
  50930. parseDocsType(checker, t, parts);
  50931. });
  50932. }
  50933. else {
  50934. const text = typeToString(checker, type);
  50935. parts.add(text);
  50936. }
  50937. };
  50938. const getModuleFromSourceFile = (compilerCtx, tsSourceFile) => {
  50939. const sourceFilePath = normalizePath$1(tsSourceFile.fileName);
  50940. const moduleFile = compilerCtx.moduleMap.get(sourceFilePath);
  50941. if (moduleFile != null) {
  50942. return moduleFile;
  50943. }
  50944. const moduleFiles = Array.from(compilerCtx.moduleMap.values());
  50945. return moduleFiles.find((m) => m.jsFilePath === sourceFilePath);
  50946. };
  50947. const getComponentMeta = (compilerCtx, tsSourceFile, node) => {
  50948. const meta = compilerCtx.nodeMap.get(node);
  50949. if (meta) {
  50950. return meta;
  50951. }
  50952. const moduleFile = getModuleFromSourceFile(compilerCtx, tsSourceFile);
  50953. if (moduleFile != null && node.members != null) {
  50954. const staticMembers = node.members.filter(isStaticGetter);
  50955. const tagName = getComponentTagName(staticMembers);
  50956. if (typeof tagName === 'string') {
  50957. return moduleFile.cmps.find((cmp) => cmp.tagName === tagName);
  50958. }
  50959. }
  50960. return undefined;
  50961. };
  50962. const getComponentTagName = (staticMembers) => {
  50963. if (staticMembers.length > 0) {
  50964. const tagName = getStaticValue(staticMembers, 'is');
  50965. if (typeof tagName === 'string' && tagName.includes('-')) {
  50966. return tagName;
  50967. }
  50968. }
  50969. return null;
  50970. };
  50971. const isStaticGetter = (member) => {
  50972. return (member.kind === t.SyntaxKind.GetAccessor &&
  50973. member.modifiers &&
  50974. member.modifiers.some(({ kind }) => kind === t.SyntaxKind.StaticKeyword));
  50975. };
  50976. /**
  50977. * Create a serialized representation of a TypeScript `Symbol` entity to expose the Symbol's text and attached JSDoc.
  50978. * Note that the `Symbol` being serialized is not the same as the JavaScript primitive 'symbol'.
  50979. * @param checker a reference to the TypeScript type checker
  50980. * @param symbol the `Symbol` to serialize
  50981. * @returns the serialized `Symbol` data
  50982. */
  50983. const serializeSymbol = (checker, symbol) => {
  50984. if (!checker || !symbol) {
  50985. return {
  50986. tags: [],
  50987. text: '',
  50988. };
  50989. }
  50990. return {
  50991. tags: mapJSDocTagInfo(symbol.getJsDocTags()),
  50992. text: t.displayPartsToString(symbol.getDocumentationComment(checker)),
  50993. };
  50994. };
  50995. /**
  50996. * Maps a TypeScript 4.3+ JSDocTagInfo to a flattened Stencil CompilerJsDocTagInfo.
  50997. * @param tags A readonly array of JSDocTagInfo objects.
  50998. * @returns An array of CompilerJsDocTagInfo objects.
  50999. */
  51000. const mapJSDocTagInfo = (tags) => {
  51001. // The text following a tag is split semantically by TS 4.3+, e.g. '@param foo the first parameter' ->
  51002. // [{text: 'foo', kind: 'parameterName'}, {text: ' ', kind: 'space'}, {text: 'the first parameter', kind: 'text'}], so
  51003. // we join the elements to reconstruct the text.
  51004. return tags.map((tag) => { var _a; return ({ ...tag, text: (_a = tag.text) === null || _a === void 0 ? void 0 : _a.map((part) => part.text).join('') }); });
  51005. };
  51006. const isInternal = (jsDocs) => {
  51007. return jsDocs && jsDocs.tags.some((s) => s.name === 'internal');
  51008. };
  51009. const isMethod = (member, methodName) => {
  51010. return t.isMethodDeclaration(member) && member.name && member.name.escapedText === methodName;
  51011. };
  51012. const createImportStatement = (importFnNames, importPath) => {
  51013. // ESM Imports
  51014. // import { importNames } from 'importPath';
  51015. const importSpecifiers = importFnNames.map((importKey) => {
  51016. const splt = importKey.split(' as ');
  51017. let importAs = importKey;
  51018. let importFnName = importKey;
  51019. if (splt.length > 1) {
  51020. importAs = splt[1];
  51021. importFnName = splt[0];
  51022. }
  51023. return t.factory.createImportSpecifier(false, typeof importFnName === 'string' && importFnName !== importAs
  51024. ? t.factory.createIdentifier(importFnName)
  51025. : undefined, t.factory.createIdentifier(importAs));
  51026. });
  51027. return t.createImportDeclaration(undefined, undefined, t.createImportClause(undefined, t.createNamedImports(importSpecifiers)), t.createLiteral(importPath));
  51028. };
  51029. const createRequireStatement = (importFnNames, importPath) => {
  51030. // CommonJS require()
  51031. // const { a, b, c } = require(importPath);
  51032. const importBinding = t.createObjectBindingPattern(importFnNames.map((importKey) => {
  51033. const splt = importKey.split(' as ');
  51034. let importAs = importKey;
  51035. let importFnName = importKey;
  51036. if (splt.length > 1) {
  51037. importAs = splt[1];
  51038. importFnName = splt[0];
  51039. }
  51040. return t.createBindingElement(undefined, importFnName, importAs);
  51041. }));
  51042. return t.createVariableStatement(undefined, t.createVariableDeclarationList([
  51043. t.createVariableDeclaration(importBinding, undefined, t.createCall(t.createIdentifier('require'), [], [t.createLiteral(importPath)])),
  51044. ], t.NodeFlags.Const));
  51045. };
  51046. /**
  51047. * Import and define components along with any component dependents within the `dist-custom-elements` output.
  51048. * Adds `defineCustomElement()` function for all components.
  51049. * @param compilerCtx - current compiler context
  51050. * @param components - all current components within the stencil buildCtx
  51051. * @param outputTarget - the output target being compiled
  51052. * @returns a TS AST transformer factory function
  51053. */
  51054. const addDefineCustomElementFunctions = (compilerCtx, components, outputTarget) => {
  51055. return () => {
  51056. return (tsSourceFile) => {
  51057. const moduleFile = getModuleFromSourceFile(compilerCtx, tsSourceFile);
  51058. const newStatements = [];
  51059. const caseStatements = [];
  51060. const tagNames = [];
  51061. if (moduleFile.cmps.length) {
  51062. const principalComponent = moduleFile.cmps[0];
  51063. tagNames.push(principalComponent.tagName);
  51064. // define the current component - `customElements.define(tagName, MyProxiedComponent);`
  51065. const customElementsDefineCallExpression = t.factory.createCallExpression(t.factory.createPropertyAccessExpression(t.factory.createIdentifier('customElements'), 'define'), undefined, [t.factory.createIdentifier('tagName'), t.factory.createIdentifier(principalComponent.componentClassName)]);
  51066. // create a `case` block that defines the current component. We'll add them to our switch statement later.
  51067. caseStatements.push(createCustomElementsDefineCase(principalComponent.tagName, customElementsDefineCallExpression));
  51068. setupComponentDependencies(moduleFile, components, newStatements, caseStatements, tagNames);
  51069. addDefineCustomElementFunction(tagNames, newStatements, caseStatements);
  51070. if (outputTarget.autoDefineCustomElements) {
  51071. const conditionalDefineCustomElementCall = createAutoDefinitionExpression(principalComponent.componentClassName);
  51072. newStatements.push(conditionalDefineCustomElementCall);
  51073. }
  51074. }
  51075. tsSourceFile = t.factory.updateSourceFile(tsSourceFile, [...tsSourceFile.statements, ...newStatements]);
  51076. return tsSourceFile;
  51077. };
  51078. };
  51079. };
  51080. /**
  51081. * Adds dependent component import statements and sets up and case blocks
  51082. * @param moduleFile current components' module
  51083. * @param components all current components within the stencil buildCtx
  51084. * @param newStatements new top level statement array to add to that will get added to the AST
  51085. * @param caseStatements an array of case statement blocks to add to. Will get added to `defineCustomElement` later
  51086. * @param tagNames array of all related component tag-names to add to
  51087. */
  51088. const setupComponentDependencies = (moduleFile, components, newStatements, caseStatements, tagNames) => {
  51089. moduleFile.cmps.forEach((cmp) => {
  51090. cmp.dependencies.forEach((dCmp) => {
  51091. const foundDep = components.find((dComp) => dComp.tagName === dCmp);
  51092. const exportName = dashToPascalCase$1(foundDep.tagName);
  51093. const importAs = `$${exportName}DefineCustomElement`;
  51094. tagNames.push(foundDep.tagName);
  51095. // Will add `import { defineCustomElement as $ComponentDefineCustomElement } from 'my-nested-component.tsx';`
  51096. newStatements.push(createImportStatement([`defineCustomElement as ${importAs}`], foundDep.sourceFilePath));
  51097. // define a dependent component by recursively calling their own `defineCustomElement()`
  51098. const callExpression = t.factory.createCallExpression(t.factory.createIdentifier(importAs), undefined, []);
  51099. // `case` blocks that define the dependent components. We'll add them to our switch statement later.
  51100. caseStatements.push(createCustomElementsDefineCase(foundDep.tagName, callExpression));
  51101. });
  51102. });
  51103. };
  51104. /**
  51105. * Creates a case block which will be used to define components. e.g.
  51106. * ``` javascript
  51107. * case "my-component":
  51108. * if (!customElements.get(tagName)) {
  51109. * customElements.define(tagName, MyProxiedComponent);
  51110. * // OR for dependent components
  51111. * defineCustomElement(tagName);
  51112. * }
  51113. * break;
  51114. * } });
  51115. ```
  51116. * @param tagName the components' tagName saved within stencil.
  51117. * @param actionExpression the actual expression to call to define the customElement
  51118. * @returns ts AST CaseClause
  51119. */
  51120. const createCustomElementsDefineCase = (tagName, actionExpression) => {
  51121. return t.factory.createCaseClause(t.factory.createStringLiteral(tagName), [
  51122. t.factory.createIfStatement(t.factory.createPrefixUnaryExpression(t.SyntaxKind.ExclamationToken, t.factory.createCallExpression(t.factory.createPropertyAccessExpression(t.factory.createIdentifier('customElements'), 'get'), undefined, [t.factory.createIdentifier('tagName')])), t.factory.createBlock([t.factory.createExpressionStatement(actionExpression)])),
  51123. t.factory.createBreakStatement(),
  51124. ]);
  51125. };
  51126. /**
  51127. * Add the main `defineCustomElement` function e.g.
  51128. * ```javascript
  51129. * function defineCustomElement() {
  51130. * if (typeof customElements === 'undefined') {
  51131. * return;
  51132. * }
  51133. * const components = ['my-component'];
  51134. * components.forEach(tagName => {
  51135. * switch (tagName) {
  51136. * case "my-component":
  51137. * if (!customElements.get(tagName)) {
  51138. * customElements.define(tagName, MyProxiedComponent);
  51139. * // OR for dependent components
  51140. * defineCustomElement(tagName);
  51141. * }
  51142. * break;
  51143. * }
  51144. * });
  51145. * }
  51146. ```
  51147. * @param tagNames all components that will be defined
  51148. * @param newStatements new top level statement array that will get added to the AST
  51149. * @param caseStatements an array of case statement blocks. Will get added to `defineCustomElement` later
  51150. */
  51151. const addDefineCustomElementFunction = (tagNames, newStatements, caseStatements) => {
  51152. const newExpression = t.factory.createFunctionDeclaration(undefined, [t.factory.createModifier(t.SyntaxKind.ExportKeyword)], undefined, t.factory.createIdentifier('defineCustomElement'), undefined, undefined, undefined, t.factory.createBlock([
  51153. t.factory.createIfStatement(t.factory.createStrictEquality(t.factory.createTypeOfExpression(t.factory.createIdentifier('customElements')), t.factory.createStringLiteral('undefined')), t.factory.createBlock([t.factory.createReturnStatement()])),
  51154. t.factory.createVariableStatement(undefined, t.factory.createVariableDeclarationList([
  51155. t.factory.createVariableDeclaration('components', undefined, undefined, t.factory.createArrayLiteralExpression(tagNames.map((tagName) => t.factory.createStringLiteral(tagName)))),
  51156. ], t.NodeFlags.Const)),
  51157. t.factory.createExpressionStatement(t.factory.createCallExpression(t.factory.createPropertyAccessExpression(t.factory.createIdentifier('components'), 'forEach'), undefined, [
  51158. t.factory.createArrowFunction(undefined, undefined, [
  51159. t.factory.createParameterDeclaration(undefined, undefined, undefined, t.factory.createIdentifier('tagName'), undefined, undefined),
  51160. ], undefined, t.factory.createToken(t.SyntaxKind.EqualsGreaterThanToken), t.factory.createBlock([
  51161. t.factory.createSwitchStatement(t.factory.createIdentifier('tagName'), t.factory.createCaseBlock(caseStatements)),
  51162. ])),
  51163. ])),
  51164. ], true));
  51165. newStatements.push(newExpression);
  51166. };
  51167. /**
  51168. * Create a call to `defineCustomElement` for the principle web component.
  51169. * ```typescript
  51170. * defineCustomElement(MyPrincipalComponent);
  51171. * ```
  51172. * @param componentName the component's class name to use as the first argument to `defineCustomElement`
  51173. * @returns the expression statement described above
  51174. */
  51175. function createAutoDefinitionExpression(componentName) {
  51176. return t.factory.createExpressionStatement(t.factory.createCallExpression(t.factory.createIdentifier('defineCustomElement'), undefined, [
  51177. t.factory.createIdentifier(componentName),
  51178. ]));
  51179. }
  51180. const ATTACH_SHADOW = '__stencil_attachShadow';
  51181. const CREATE_EVENT = '__stencil_createEvent';
  51182. const DEFINE_CUSTOM_ELEMENT = '__stencil_defineCustomElement';
  51183. const GET_CONNECT = '__stencil_getConnect';
  51184. const GET_CONTEXT = '__stencil_getContext';
  51185. const GET_ELEMENT = '__stencil_getElement';
  51186. const HOST = '__stencil_Host';
  51187. const HTML_ELEMENT = 'HTMLElement';
  51188. const PROXY_CUSTOM_ELEMENT = '__stencil_proxyCustomElement';
  51189. const REGISTER_INSTANCE = '__stencil_registerInstance';
  51190. const REGISTER_HOST = '__stencil_registerHost';
  51191. const H = '__stencil_h';
  51192. const RUNTIME_APIS = {
  51193. attachShadow: `attachShadow as ${ATTACH_SHADOW}`,
  51194. createEvent: `createEvent as ${CREATE_EVENT}`,
  51195. defineCustomElement: `defineCustomElement as ${DEFINE_CUSTOM_ELEMENT}`,
  51196. getConnect: `getConnect as ${GET_CONNECT}`,
  51197. getContext: `getContext as ${GET_CONTEXT}`,
  51198. getElement: `getElement as ${GET_ELEMENT}`,
  51199. h: `h as ${H}`,
  51200. legacyH: `h`,
  51201. Host: `Host as ${HOST}`,
  51202. HTMLElement: HTML_ELEMENT,
  51203. proxyCustomElement: `proxyCustomElement as ${PROXY_CUSTOM_ELEMENT}`,
  51204. registerHost: `registerHost as ${REGISTER_HOST}`,
  51205. registerInstance: `registerInstance as ${REGISTER_INSTANCE}`,
  51206. };
  51207. const addCoreRuntimeApi = (moduleFile, coreRuntimeApi) => {
  51208. if (!moduleFile.coreRuntimeApis.includes(coreRuntimeApi)) {
  51209. moduleFile.coreRuntimeApis.push(coreRuntimeApi);
  51210. }
  51211. };
  51212. const addLegacyApis = (moduleFile) => {
  51213. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.legacyH);
  51214. };
  51215. const addModuleMetadataProxies = (tsSourceFile, moduleFile) => {
  51216. const statements = tsSourceFile.statements.slice();
  51217. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.proxyCustomElement);
  51218. statements.push(...moduleFile.cmps.map(addComponentMetadataProxy));
  51219. return t.updateSourceFileNode(tsSourceFile, statements);
  51220. };
  51221. const addComponentMetadataProxy = (compilerMeta) => {
  51222. return t.createStatement(createComponentMetadataProxy(compilerMeta));
  51223. };
  51224. /**
  51225. * Create a call expression for wrapping a component in a proxy. This call expression takes a form:
  51226. * ```ts
  51227. * PROXY_CUSTOM_ELEMENT(ComponentClassName, Metadata);
  51228. * ```
  51229. * where
  51230. * - `PROXY_CUSTOM_ELEMENT` is a Stencil internal identifier that will be replaced with the name of the actual function
  51231. * name at compile name
  51232. * - `ComponentClassName` is the name Stencil component's class
  51233. * - `Metadata` is the compiler metadata associated with the Stencil component
  51234. *
  51235. * @param compilerMeta compiler metadata associated with the component to be wrapped in a proxy
  51236. * @returns the generated call expression
  51237. */
  51238. const createComponentMetadataProxy = (compilerMeta) => {
  51239. const compactMeta = formatComponentRuntimeMeta(compilerMeta, true);
  51240. const literalCmpClassName = t.factory.createIdentifier(compilerMeta.componentClassName);
  51241. const literalMeta = convertValueToLiteral(compactMeta);
  51242. return t.factory.createCallExpression(t.factory.createIdentifier(PROXY_CUSTOM_ELEMENT), [], [literalCmpClassName, literalMeta]);
  51243. };
  51244. /**
  51245. * Create a call expression for wrapping a component represented as an anonymous class in a proxy. This call expression
  51246. * takes a form:
  51247. * ```ts
  51248. * PROXY_CUSTOM_ELEMENT(Clazz, Metadata);
  51249. * ```
  51250. * where
  51251. * - `PROXY_CUSTOM_ELEMENT` is a Stencil internal identifier that will be replaced with the name of the actual function
  51252. * name at compile name
  51253. * - `Clazz` is an anonymous class to be proxied
  51254. * - `Metadata` is the compiler metadata associated with the Stencil component
  51255. *
  51256. * @param compilerMeta compiler metadata associated with the component to be wrapped in a proxy
  51257. * @param clazz the anonymous class to proxy
  51258. * @returns the generated call expression
  51259. */
  51260. const createAnonymousClassMetadataProxy = (compilerMeta, clazz) => {
  51261. const compactMeta = formatComponentRuntimeMeta(compilerMeta, true);
  51262. const literalMeta = convertValueToLiteral(compactMeta);
  51263. return t.factory.createCallExpression(t.factory.createIdentifier(PROXY_CUSTOM_ELEMENT), [], [clazz, literalMeta]);
  51264. };
  51265. const addImports = (transformOpts, tsSourceFile, importFnNames, importPath) => {
  51266. if (importFnNames.length === 0) {
  51267. return tsSourceFile;
  51268. }
  51269. if (transformOpts.module === 'cjs') {
  51270. // CommonJS require()
  51271. const newRequire = createRequireStatement(importFnNames, importPath);
  51272. const statements = tsSourceFile.statements.slice();
  51273. statements.splice(2, 0, newRequire);
  51274. return t.updateSourceFileNode(tsSourceFile, statements);
  51275. }
  51276. // ESM Imports
  51277. const newImport = createImportStatement(importFnNames, importPath);
  51278. const statements = tsSourceFile.statements.slice();
  51279. statements.unshift(newImport);
  51280. return t.updateSourceFileNode(tsSourceFile, statements);
  51281. };
  51282. /**
  51283. * Proxy custom elements for the `dist-custom-elements` output target. This function searches for a Stencil component's
  51284. * class initializer (found on the righthand side of the '=' operator):
  51285. *
  51286. * ```ts
  51287. * const MyComponent = class extends HTMLElement { // Implementation omitted }
  51288. * ```
  51289. *
  51290. * and wraps the initializer into a `proxyCustomElement` call:
  51291. *
  51292. * ```ts
  51293. * const MyComponent = proxyCustomElement(class extends HTMLElement { // Implementation omitted }, componentMetadata);
  51294. * ```
  51295. *
  51296. * This is to work around an issue where treeshaking does not work for webpack users, whose details are captured in full
  51297. * in [this issue on the webpack GitHub repo](https://github.com/webpack/webpack/issues/14963).
  51298. *
  51299. * @param compilerCtx current compiler context
  51300. * @param transformOpts transpilation options for the current build
  51301. * @returns a TypeScript AST transformer factory function that performs the above described transformation
  51302. */
  51303. const proxyCustomElement = (compilerCtx, transformOpts) => {
  51304. return () => {
  51305. return (tsSourceFile) => {
  51306. const moduleFile = getModuleFromSourceFile(compilerCtx, tsSourceFile);
  51307. if (!moduleFile.cmps.length) {
  51308. return tsSourceFile;
  51309. }
  51310. const principalComponent = moduleFile.cmps[0];
  51311. for (const [stmtIndex, stmt] of tsSourceFile.statements.entries()) {
  51312. if (t.isVariableStatement(stmt)) {
  51313. for (const [declarationIndex, declaration] of stmt.declarationList.declarations.entries()) {
  51314. if (declaration.name.getText() !== principalComponent.componentClassName) {
  51315. continue;
  51316. }
  51317. // wrap the Stencil component's class declaration in a component proxy
  51318. const proxyCreationCall = createAnonymousClassMetadataProxy(principalComponent, declaration.initializer);
  51319. t.addSyntheticLeadingComment(proxyCreationCall, t.SyntaxKind.MultiLineCommentTrivia, '@__PURE__', false);
  51320. // update the component's variable declaration to use the new initializer
  51321. const proxiedComponentDeclaration = t.factory.updateVariableDeclaration(declaration, declaration.name, declaration.exclamationToken, declaration.type, proxyCreationCall);
  51322. // update the declaration list that contains the updated variable declaration
  51323. const updatedDeclarationList = t.factory.updateVariableDeclarationList(stmt.declarationList, [
  51324. ...stmt.declarationList.declarations.slice(0, declarationIndex),
  51325. proxiedComponentDeclaration,
  51326. ...stmt.declarationList.declarations.slice(declarationIndex + 1),
  51327. ]);
  51328. // update the variable statement containing the updated declaration list
  51329. const updatedVariableStatement = t.factory.updateVariableStatement(stmt, [t.factory.createModifier(t.SyntaxKind.ExportKeyword)], updatedDeclarationList);
  51330. // update the source file's statements to use the new variable statement
  51331. tsSourceFile = t.factory.updateSourceFile(tsSourceFile, [
  51332. ...tsSourceFile.statements.slice(0, stmtIndex),
  51333. updatedVariableStatement,
  51334. ...tsSourceFile.statements.slice(stmtIndex + 1),
  51335. ]);
  51336. // finally, ensure that the proxyCustomElement function is imported
  51337. tsSourceFile = addImports(transformOpts, tsSourceFile, [RUNTIME_APIS.proxyCustomElement], transformOpts.coreImportPath);
  51338. return tsSourceFile;
  51339. }
  51340. }
  51341. }
  51342. return tsSourceFile;
  51343. };
  51344. };
  51345. };
  51346. const defineCustomElement = (tsSourceFile, moduleFile, transformOpts) => {
  51347. let statements = tsSourceFile.statements.slice();
  51348. statements.push(...moduleFile.cmps.map((cmp) => {
  51349. return addDefineCustomElement(moduleFile, cmp);
  51350. }));
  51351. if (transformOpts.module === 'cjs') {
  51352. // remove commonjs exports keyword from component classes
  51353. statements = removeComponentCjsExport(statements, moduleFile);
  51354. }
  51355. return t.updateSourceFileNode(tsSourceFile, statements);
  51356. };
  51357. const addDefineCustomElement = (moduleFile, compilerMeta) => {
  51358. if (compilerMeta.isPlain) {
  51359. // add customElements.define('cmp-a', CmpClass);
  51360. return t.createStatement(t.createCall(t.createPropertyAccess(t.createIdentifier('customElements'), t.createIdentifier('define')), [], [t.createLiteral(compilerMeta.tagName), t.createIdentifier(compilerMeta.componentClassName)]));
  51361. }
  51362. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.defineCustomElement);
  51363. const compactMeta = formatComponentRuntimeMeta(compilerMeta, true);
  51364. const liternalCmpClassName = t.createIdentifier(compilerMeta.componentClassName);
  51365. const liternalMeta = convertValueToLiteral(compactMeta);
  51366. return t.createStatement(t.createCall(t.createIdentifier(DEFINE_CUSTOM_ELEMENT), [], [liternalCmpClassName, liternalMeta]));
  51367. };
  51368. const removeComponentCjsExport = (statements, moduleFile) => {
  51369. const cmpClassNames = new Set(moduleFile.cmps.map((cmp) => cmp.componentClassName));
  51370. return statements.filter((s) => {
  51371. if (s.kind === t.SyntaxKind.ExpressionStatement) {
  51372. const exp = s.expression;
  51373. if (exp && exp.kind === t.SyntaxKind.BinaryExpression) {
  51374. const left = exp.left;
  51375. if (left && left.kind === t.SyntaxKind.PropertyAccessExpression) {
  51376. if (left.expression && left.expression.kind === t.SyntaxKind.Identifier) {
  51377. const leftText = left.expression;
  51378. if (leftText.text === 'exports') {
  51379. const right = exp.right;
  51380. if (right && cmpClassNames.has(right.text)) {
  51381. return false;
  51382. }
  51383. }
  51384. }
  51385. }
  51386. }
  51387. }
  51388. return true;
  51389. });
  51390. };
  51391. const updateStyleImports = (transformOpts, tsSourceFile, moduleFile) => {
  51392. // add style imports built from @Component() styleUrl option
  51393. if (transformOpts.module === 'cjs') {
  51394. return updateCjsStyleRequires(transformOpts, tsSourceFile, moduleFile);
  51395. }
  51396. return updateEsmStyleImports(transformOpts, tsSourceFile, moduleFile);
  51397. };
  51398. const updateEsmStyleImports = (transformOpts, tsSourceFile, moduleFile) => {
  51399. const styleImports = [];
  51400. let statements = tsSourceFile.statements.slice();
  51401. let updateSourceFile = false;
  51402. moduleFile.cmps.forEach((cmp) => {
  51403. cmp.styles.forEach((style) => {
  51404. if (typeof style.styleIdentifier === 'string') {
  51405. updateSourceFile = true;
  51406. if (style.externalStyles.length > 0) {
  51407. // add style imports built from @Component() styleUrl option
  51408. styleImports.push(createEsmStyleImport(transformOpts, tsSourceFile, cmp, style));
  51409. }
  51410. else {
  51411. // update existing esm import of a style identifier
  51412. statements = updateEsmStyleImportPath(transformOpts, tsSourceFile, statements, cmp, style);
  51413. }
  51414. }
  51415. });
  51416. });
  51417. if (updateSourceFile) {
  51418. let lastImportIndex = -1;
  51419. for (let i = 0; i < statements.length; i++) {
  51420. if (t.isImportDeclaration(statements[i])) {
  51421. lastImportIndex = i;
  51422. }
  51423. }
  51424. statements.splice(lastImportIndex + 1, 0, ...styleImports);
  51425. return t.updateSourceFileNode(tsSourceFile, statements);
  51426. }
  51427. return tsSourceFile;
  51428. };
  51429. const updateEsmStyleImportPath = (transformOpts, tsSourceFile, statements, cmp, style) => {
  51430. for (let i = 0; i < statements.length; i++) {
  51431. const n = statements[i];
  51432. if (t.isImportDeclaration(n) && n.importClause && n.moduleSpecifier && t.isStringLiteral(n.moduleSpecifier)) {
  51433. if (n.importClause.name && n.importClause.name.escapedText === style.styleIdentifier) {
  51434. const orgImportPath = n.moduleSpecifier.text;
  51435. const importPath = getStyleImportPath(transformOpts, tsSourceFile, cmp, style, orgImportPath);
  51436. statements[i] = t.factory.updateImportDeclaration(n, n.decorators, n.modifiers, n.importClause, t.factory.createStringLiteral(importPath), undefined);
  51437. break;
  51438. }
  51439. }
  51440. }
  51441. return statements;
  51442. };
  51443. const createEsmStyleImport = (transformOpts, tsSourceFile, cmp, style) => {
  51444. const importName = t.createIdentifier(style.styleIdentifier);
  51445. const importPath = getStyleImportPath(transformOpts, tsSourceFile, cmp, style, style.externalStyles[0].absolutePath);
  51446. return t.createImportDeclaration(undefined, undefined, t.createImportClause(importName, undefined), t.createLiteral(importPath));
  51447. };
  51448. const updateCjsStyleRequires = (transformOpts, tsSourceFile, moduleFile) => {
  51449. const styleRequires = [];
  51450. moduleFile.cmps.forEach((cmp) => {
  51451. cmp.styles.forEach((style) => {
  51452. if (typeof style.styleIdentifier === 'string' && style.externalStyles.length > 0) {
  51453. // add style imports built from @Component() styleUrl option
  51454. styleRequires.push(createCjsStyleRequire(transformOpts, tsSourceFile, cmp, style));
  51455. }
  51456. });
  51457. });
  51458. if (styleRequires.length > 0) {
  51459. return t.updateSourceFileNode(tsSourceFile, [...styleRequires, ...tsSourceFile.statements]);
  51460. }
  51461. return tsSourceFile;
  51462. };
  51463. const createCjsStyleRequire = (transformOpts, tsSourceFile, cmp, style) => {
  51464. const importName = t.createIdentifier(style.styleIdentifier);
  51465. const importPath = getStyleImportPath(transformOpts, tsSourceFile, cmp, style, style.externalStyles[0].absolutePath);
  51466. return t.createVariableStatement(undefined, t.createVariableDeclarationList([
  51467. t.createVariableDeclaration(importName, undefined, t.createCall(t.createIdentifier('require'), [], [t.createLiteral(importPath)])),
  51468. ], t.NodeFlags.Const));
  51469. };
  51470. const getStyleImportPath = (transformOpts, tsSourceFile, cmp, style, importPath) => {
  51471. const importData = {
  51472. importeePath: importPath,
  51473. importerPath: tsSourceFile.fileName,
  51474. tag: cmp.tagName,
  51475. encapsulation: cmp.encapsulation,
  51476. mode: style.modeName,
  51477. };
  51478. return serializeImportPath(importData, transformOpts.styleImportData);
  51479. };
  51480. const transformHostData = (classElements, moduleFile) => {
  51481. const hasHostData = classElements.some((e) => t.isMethodDeclaration(e) && e.name.escapedText === 'hostData');
  51482. if (hasHostData) {
  51483. const renderIndex = classElements.findIndex((e) => t.isMethodDeclaration(e) && e.name.escapedText === 'render');
  51484. if (renderIndex >= 0) {
  51485. const renderMethod = classElements[renderIndex];
  51486. classElements[renderIndex] = t.updateMethod(renderMethod, renderMethod.decorators, renderMethod.modifiers, renderMethod.asteriskToken, t.createIdentifier(INTERNAL_RENDER), renderMethod.questionToken, renderMethod.typeParameters, renderMethod.parameters, renderMethod.type, renderMethod.body);
  51487. }
  51488. classElements.push(syntheticRender(moduleFile, renderIndex >= 0));
  51489. }
  51490. };
  51491. const syntheticRender = (moduleFile, hasRender) => {
  51492. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.Host);
  51493. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.h);
  51494. const hArguments = [
  51495. // __stencil_Host
  51496. t.createIdentifier(HOST),
  51497. // this.hostData()
  51498. t.createCall(t.createPropertyAccess(t.createThis(), 'hostData'), undefined, undefined),
  51499. ];
  51500. if (hasRender) {
  51501. hArguments.push(
  51502. // this.render()
  51503. t.createCall(t.createPropertyAccess(t.createThis(), INTERNAL_RENDER), undefined, undefined));
  51504. }
  51505. /**
  51506. * render() {
  51507. * return h(arguments);
  51508. * }
  51509. */
  51510. return t.createMethod(undefined, undefined, undefined, 'render', undefined, undefined, undefined, undefined, t.createBlock([t.createReturn(t.createCall(t.createIdentifier(H), undefined, hArguments))]));
  51511. };
  51512. const INTERNAL_RENDER = '__stencil_render';
  51513. const removeStaticMetaProperties = (classNode) => {
  51514. if (classNode.members == null) {
  51515. return [];
  51516. }
  51517. return classNode.members.filter((classMember) => {
  51518. if (classMember.modifiers) {
  51519. if (classMember.modifiers.some((m) => m.kind === t.SyntaxKind.StaticKeyword)) {
  51520. const memberName = classMember.name.escapedText;
  51521. if (REMOVE_STATIC_GETTERS.has(memberName)) {
  51522. return false;
  51523. }
  51524. }
  51525. }
  51526. return true;
  51527. });
  51528. };
  51529. const REMOVE_STATIC_GETTERS = new Set([
  51530. 'is',
  51531. 'properties',
  51532. 'encapsulation',
  51533. 'elementRef',
  51534. 'events',
  51535. 'listeners',
  51536. 'methods',
  51537. 'states',
  51538. 'originalStyleUrls',
  51539. 'styleMode',
  51540. 'style',
  51541. 'styles',
  51542. 'styleUrl',
  51543. 'watchers',
  51544. 'styleUrls',
  51545. 'contextProps',
  51546. 'connectProps',
  51547. ]);
  51548. const updateComponentClass = (transformOpts, classNode, heritageClauses, members) => {
  51549. let classModifiers = Array.isArray(classNode.modifiers) ? classNode.modifiers.slice() : [];
  51550. if (transformOpts.module === 'cjs') {
  51551. // CommonJS, leave component class as is
  51552. if (transformOpts.componentExport === 'customelement') {
  51553. // remove export from class
  51554. classModifiers = classModifiers.filter((m) => {
  51555. return m.kind !== t.SyntaxKind.ExportKeyword;
  51556. });
  51557. }
  51558. return t.updateClassDeclaration(classNode, classNode.decorators, classModifiers, classNode.name, classNode.typeParameters, heritageClauses, members);
  51559. }
  51560. // ESM with export
  51561. return createConstClass(transformOpts, classNode, heritageClauses, members);
  51562. };
  51563. const createConstClass = (transformOpts, classNode, heritageClauses, members) => {
  51564. const className = classNode.name;
  51565. const classModifiers = (Array.isArray(classNode.modifiers) ? classNode.modifiers : []).filter((m) => {
  51566. // remove the export
  51567. return m.kind !== t.SyntaxKind.ExportKeyword;
  51568. });
  51569. const constModifiers = [];
  51570. if (transformOpts.componentExport !== 'customelement') {
  51571. constModifiers.push(t.createModifier(t.SyntaxKind.ExportKeyword));
  51572. }
  51573. return t.createVariableStatement(constModifiers, t.createVariableDeclarationList([
  51574. t.createVariableDeclaration(className, undefined, t.createClassExpression(classModifiers, undefined, classNode.typeParameters, heritageClauses, members)),
  51575. ], t.NodeFlags.Const));
  51576. };
  51577. const addWatchers = (classMembers, cmp) => {
  51578. if (cmp.watchers.length > 0) {
  51579. const watcherObj = {};
  51580. cmp.watchers.forEach(({ propName, methodName }) => {
  51581. watcherObj[propName] = watcherObj[propName] || [];
  51582. watcherObj[propName].push(methodName);
  51583. });
  51584. classMembers.push(createStaticGetter('watchers', convertValueToLiteral(watcherObj)));
  51585. }
  51586. };
  51587. const addNativeConnectedCallback = (classMembers, cmp) => {
  51588. // function call to stencil's exported connectedCallback(elm, plt)
  51589. // TODO: fast path
  51590. if (cmp.isPlain && cmp.hasRenderFn) {
  51591. const fnCall = t.createExpressionStatement(t.createAssignment(t.createPropertyAccess(t.createThis(), 'textContent'), t.createCall(t.createPropertyAccess(t.createThis(), 'render'), undefined, undefined)));
  51592. const connectedCallback = classMembers.find((classMember) => {
  51593. return t.isMethodDeclaration(classMember) && classMember.name.escapedText === 'connectedCallback';
  51594. });
  51595. if (connectedCallback != null) {
  51596. // class already has a connectedCallback(), so update it
  51597. const callbackMethod = t.createMethod(undefined, undefined, undefined, 'connectedCallback', undefined, undefined, undefined, undefined, t.createBlock([fnCall, ...connectedCallback.body.statements], true));
  51598. const index = classMembers.indexOf(connectedCallback);
  51599. classMembers[index] = callbackMethod;
  51600. }
  51601. else {
  51602. // class doesn't have a connectedCallback(), so add it
  51603. const callbackMethod = t.createMethod(undefined, undefined, undefined, 'connectedCallback', undefined, undefined, undefined, undefined, t.createBlock([fnCall], true));
  51604. classMembers.push(callbackMethod);
  51605. }
  51606. }
  51607. };
  51608. const addCreateEvents = (moduleFile, cmp) => {
  51609. return cmp.events.map((ev) => {
  51610. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.createEvent);
  51611. return t.createStatement(t.createAssignment(t.createPropertyAccess(t.createThis(), t.createIdentifier(ev.method)), t.createCall(t.createIdentifier(CREATE_EVENT), undefined, [
  51612. t.createThis(),
  51613. t.createLiteral(ev.name),
  51614. t.createLiteral(computeFlags(ev)),
  51615. ])));
  51616. });
  51617. };
  51618. const computeFlags = (eventMeta) => {
  51619. let flags = 0;
  51620. if (eventMeta.bubbles) {
  51621. flags |= 4 /* EVENT_FLAGS.Bubbles */;
  51622. }
  51623. if (eventMeta.composed) {
  51624. flags |= 2 /* EVENT_FLAGS.Composed */;
  51625. }
  51626. if (eventMeta.cancelable) {
  51627. flags |= 1 /* EVENT_FLAGS.Cancellable */;
  51628. }
  51629. return flags;
  51630. };
  51631. const addLegacyProps = (moduleFile, cmp) => {
  51632. if (cmp.legacyConnect.length > 0) {
  51633. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.getConnect);
  51634. }
  51635. if (cmp.legacyContext.length > 0) {
  51636. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.getContext);
  51637. }
  51638. return [
  51639. ...cmp.legacyConnect.map((c) => getStatement(c.name, GET_CONNECT, c.connect)),
  51640. ...cmp.legacyContext.map((c) => getStatement(c.name, GET_CONTEXT, c.context)),
  51641. ];
  51642. };
  51643. const getStatement = (propName, method, arg) => {
  51644. return t.createExpressionStatement(t.createAssignment(t.createPropertyAccess(t.createThis(), propName), t.createCall(t.createIdentifier(method), undefined, [t.createThis(), t.createLiteral(arg)])));
  51645. };
  51646. const updateNativeConstructor = (classMembers, moduleFile, cmp, ensureSuper) => {
  51647. if (cmp.isPlain) {
  51648. return;
  51649. }
  51650. const cstrMethodIndex = classMembers.findIndex((m) => m.kind === t.SyntaxKind.Constructor);
  51651. if (cstrMethodIndex >= 0) {
  51652. // add to the existing constructor()
  51653. const cstrMethod = classMembers[cstrMethodIndex];
  51654. let statements = [
  51655. ...nativeInit(moduleFile, cmp),
  51656. ...addCreateEvents(moduleFile, cmp),
  51657. ...cstrMethod.body.statements,
  51658. ...addLegacyProps(moduleFile, cmp),
  51659. ];
  51660. if (ensureSuper) {
  51661. const hasSuper = cstrMethod.body.statements.some((s) => s.kind === t.SyntaxKind.SuperKeyword);
  51662. if (!hasSuper) {
  51663. statements = [createNativeConstructorSuper(), ...statements];
  51664. }
  51665. }
  51666. classMembers[cstrMethodIndex] = t.updateConstructor(cstrMethod, cstrMethod.decorators, cstrMethod.modifiers, cstrMethod.parameters, t.updateBlock(cstrMethod.body, statements));
  51667. }
  51668. else {
  51669. // create a constructor()
  51670. let statements = [
  51671. ...nativeInit(moduleFile, cmp),
  51672. ...addCreateEvents(moduleFile, cmp),
  51673. ...addLegacyProps(moduleFile, cmp),
  51674. ];
  51675. if (ensureSuper) {
  51676. statements = [createNativeConstructorSuper(), ...statements];
  51677. }
  51678. const cstrMethod = t.createConstructor(undefined, undefined, undefined, t.createBlock(statements, true));
  51679. classMembers.unshift(cstrMethod);
  51680. }
  51681. };
  51682. /**
  51683. * Generates a series of expression statements used to help initialize a Stencil component
  51684. * @param moduleFile the Stencil module that will be instantiated
  51685. * @param cmp the component's metadata
  51686. * @returns the generated expression statements
  51687. */
  51688. const nativeInit = (moduleFile, cmp) => {
  51689. const initStatements = [nativeRegisterHostStatement()];
  51690. if (cmp.encapsulation === 'shadow') {
  51691. initStatements.push(nativeAttachShadowStatement(moduleFile));
  51692. }
  51693. return initStatements;
  51694. };
  51695. const nativeRegisterHostStatement = () => {
  51696. return t.createStatement(t.createCall(t.createPropertyAccess(t.createThis(), t.createIdentifier('__registerHost')), undefined, undefined));
  51697. };
  51698. /**
  51699. * Generates an expression statement for attaching a shadow DOM tree to an element.
  51700. * @param moduleFile the Stencil module that will use the generated expression statement
  51701. * @returns the generated expression statement
  51702. */
  51703. const nativeAttachShadowStatement = (moduleFile) => {
  51704. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.attachShadow);
  51705. // Create an expression statement, `this.__attachShadow();`
  51706. return t.factory.createExpressionStatement(t.factory.createCallExpression(t.factory.createPropertyAccessExpression(t.factory.createThis(), t.factory.createIdentifier('__attachShadow')), undefined, undefined));
  51707. };
  51708. const createNativeConstructorSuper = () => {
  51709. return t.createExpressionStatement(t.createCall(t.createIdentifier('super'), undefined, undefined));
  51710. };
  51711. const addNativeElementGetter = (classMembers, cmp) => {
  51712. // @Element() element;
  51713. // is transformed into:
  51714. // get element() { return this; }
  51715. if (cmp.elementRef) {
  51716. classMembers.push(t.createGetAccessor(undefined, undefined, cmp.elementRef, [], undefined, t.createBlock([t.createReturn(t.createThis())])));
  51717. }
  51718. };
  51719. const addNativeComponentMeta = (classMembers, cmp) => {
  51720. classMembers.push(createStaticGetter('is', convertValueToLiteral(cmp.tagName)));
  51721. };
  51722. const addNativeStaticStyle = (classMembers, cmp) => {
  51723. if (Array.isArray(cmp.styles) && cmp.styles.length > 0) {
  51724. if (cmp.styles.length > 1 || (cmp.styles.length === 1 && cmp.styles[0].modeName !== DEFAULT_STYLE_MODE)) {
  51725. // multiple style modes
  51726. addMultipleModeStyleGetter(classMembers, cmp, cmp.styles);
  51727. }
  51728. else {
  51729. // single style
  51730. addSingleStyleGetter(classMembers, cmp, cmp.styles[0]);
  51731. }
  51732. }
  51733. };
  51734. const addMultipleModeStyleGetter = (classMembers, cmp, styles) => {
  51735. const styleModes = [];
  51736. styles.forEach((style) => {
  51737. if (typeof style.styleStr === 'string') {
  51738. // inline the style string
  51739. // static get style() { return { "ios": "string" }; }
  51740. const styleLiteral = createStyleLiteral$1(cmp, style);
  51741. const propStr = t.createPropertyAssignment(style.modeName, styleLiteral);
  51742. styleModes.push(propStr);
  51743. }
  51744. else if (typeof style.styleIdentifier === 'string') {
  51745. // direct import already written in the source code
  51746. // import myTagIosStyle from './import-path.css';
  51747. // static get style() { return { "ios": myTagIosStyle }; }
  51748. const styleIdentifier = t.createIdentifier(style.styleIdentifier);
  51749. const propIdentifier = t.createPropertyAssignment(style.modeName, styleIdentifier);
  51750. styleModes.push(propIdentifier);
  51751. }
  51752. else if (Array.isArray(style.externalStyles) && style.externalStyles.length > 0) {
  51753. // import generated from @Component() styleUrls option
  51754. // import myTagIosStyle from './import-path.css';
  51755. // static get style() { return { "ios": myTagIosStyle }; }
  51756. const styleUrlIdentifier = createStyleIdentifierFromUrl$1(cmp, style);
  51757. const propUrlIdentifier = t.createPropertyAssignment(style.modeName, styleUrlIdentifier);
  51758. styleModes.push(propUrlIdentifier);
  51759. }
  51760. });
  51761. const styleObj = t.createObjectLiteral(styleModes, true);
  51762. classMembers.push(createStaticGetter('style', styleObj));
  51763. };
  51764. const addSingleStyleGetter = (classMembers, cmp, style) => {
  51765. if (typeof style.styleStr === 'string') {
  51766. // inline the style string
  51767. // static get style() { return "string"; }
  51768. const styleLiteral = createStyleLiteral$1(cmp, style);
  51769. classMembers.push(createStaticGetter('style', styleLiteral));
  51770. }
  51771. else if (typeof style.styleIdentifier === 'string') {
  51772. // direct import already written in the source code
  51773. // import myTagStyle from './import-path.css';
  51774. // static get style() { return myTagStyle; }
  51775. const styleIdentifier = t.createIdentifier(style.styleIdentifier);
  51776. classMembers.push(createStaticGetter('style', styleIdentifier));
  51777. }
  51778. else if (Array.isArray(style.externalStyles) && style.externalStyles.length > 0) {
  51779. // import generated from @Component() styleUrls option
  51780. // import myTagStyle from './import-path.css';
  51781. // static get style() { return myTagStyle; }
  51782. const styleUrlIdentifier = createStyleIdentifierFromUrl$1(cmp, style);
  51783. classMembers.push(createStaticGetter('style', styleUrlIdentifier));
  51784. }
  51785. };
  51786. const createStyleLiteral$1 = (cmp, style) => {
  51787. if (cmp.encapsulation === 'scoped') {
  51788. // scope the css first
  51789. const scopeId = getScopeId(cmp.tagName, style.modeName);
  51790. return t.createStringLiteral(scopeCss(style.styleStr, scopeId, false));
  51791. }
  51792. return t.createStringLiteral(style.styleStr);
  51793. };
  51794. const createStyleIdentifierFromUrl$1 = (cmp, style) => {
  51795. style.styleIdentifier = dashToPascalCase$1(cmp.tagName);
  51796. style.styleIdentifier = style.styleIdentifier.charAt(0).toLowerCase() + style.styleIdentifier.substring(1);
  51797. if (style.modeName !== DEFAULT_STYLE_MODE) {
  51798. style.styleIdentifier += dashToPascalCase$1(style.modeName);
  51799. }
  51800. style.styleIdentifier += 'Style';
  51801. style.externalStyles = [style.externalStyles[0]];
  51802. return t.createIdentifier(style.styleIdentifier);
  51803. };
  51804. const updateNativeComponentClass = (transformOpts, classNode, moduleFile, cmp) => {
  51805. const heritageClauses = updateNativeHostComponentHeritageClauses(classNode, moduleFile);
  51806. const members = updateNativeHostComponentMembers(transformOpts, classNode, moduleFile, cmp);
  51807. return updateComponentClass(transformOpts, classNode, heritageClauses, members);
  51808. };
  51809. const updateNativeHostComponentHeritageClauses = (classNode, moduleFile) => {
  51810. if (classNode.heritageClauses != null && classNode.heritageClauses.length > 0) {
  51811. return classNode.heritageClauses;
  51812. }
  51813. if (moduleFile.cmps.length >= 1) {
  51814. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.HTMLElement);
  51815. }
  51816. const heritageClause = t.factory.createHeritageClause(t.SyntaxKind.ExtendsKeyword, [
  51817. t.factory.createExpressionWithTypeArguments(t.factory.createIdentifier(HTML_ELEMENT), []),
  51818. ]);
  51819. return [heritageClause];
  51820. };
  51821. const updateNativeHostComponentMembers = (transformOpts, classNode, moduleFile, cmp) => {
  51822. const classMembers = removeStaticMetaProperties(classNode);
  51823. updateNativeConstructor(classMembers, moduleFile, cmp, true);
  51824. addNativeConnectedCallback(classMembers, cmp);
  51825. addNativeElementGetter(classMembers, cmp);
  51826. addWatchers(classMembers, cmp);
  51827. if (cmp.isPlain) {
  51828. addNativeComponentMeta(classMembers, cmp);
  51829. }
  51830. if (transformOpts.style === 'static') {
  51831. addNativeStaticStyle(classMembers, cmp);
  51832. }
  51833. transformHostData(classMembers, moduleFile);
  51834. return classMembers;
  51835. };
  51836. const nativeComponentTransform = (compilerCtx, transformOpts) => {
  51837. return (transformCtx) => {
  51838. return (tsSourceFile) => {
  51839. const moduleFile = getModuleFromSourceFile(compilerCtx, tsSourceFile);
  51840. const visitNode = (node) => {
  51841. if (t.isClassDeclaration(node)) {
  51842. const cmp = getComponentMeta(compilerCtx, tsSourceFile, node);
  51843. if (cmp != null) {
  51844. return updateNativeComponentClass(transformOpts, node, moduleFile, cmp);
  51845. }
  51846. }
  51847. return t.visitEachChild(node, visitNode, transformCtx);
  51848. };
  51849. tsSourceFile = t.visitEachChild(tsSourceFile, visitNode, transformCtx);
  51850. if (moduleFile.cmps.length > 0) {
  51851. if (transformOpts.componentExport === 'customelement') {
  51852. // define custom element, will have no export
  51853. tsSourceFile = defineCustomElement(tsSourceFile, moduleFile, transformOpts);
  51854. }
  51855. else if (transformOpts.proxy === 'defineproperty') {
  51856. // exporting as a module, but also add the component proxy fn
  51857. tsSourceFile = addModuleMetadataProxies(tsSourceFile, moduleFile);
  51858. }
  51859. tsSourceFile = updateStyleImports(transformOpts, tsSourceFile, moduleFile);
  51860. }
  51861. if (moduleFile.isLegacy) {
  51862. addLegacyApis(moduleFile);
  51863. }
  51864. tsSourceFile = addImports(transformOpts, tsSourceFile, moduleFile.coreRuntimeApis, transformOpts.coreImportPath);
  51865. return tsSourceFile;
  51866. };
  51867. };
  51868. };
  51869. const updateStencilCoreImports = (updatedCoreImportPath) => {
  51870. return () => {
  51871. return (tsSourceFile) => {
  51872. if (STENCIL_CORE_ID === updatedCoreImportPath) {
  51873. return tsSourceFile;
  51874. }
  51875. let madeChanges = false;
  51876. const newStatements = [];
  51877. tsSourceFile.statements.forEach((s) => {
  51878. if (t.isImportDeclaration(s)) {
  51879. if (s.moduleSpecifier != null && t.isStringLiteral(s.moduleSpecifier)) {
  51880. if (s.moduleSpecifier.text === STENCIL_CORE_ID) {
  51881. if (s.importClause &&
  51882. s.importClause.namedBindings &&
  51883. s.importClause.namedBindings.kind === t.SyntaxKind.NamedImports) {
  51884. const origImports = s.importClause.namedBindings.elements;
  51885. const keepImports = origImports.map((e) => e.getText()).filter((name) => KEEP_IMPORTS.has(name));
  51886. if (keepImports.length > 0) {
  51887. const newImport = t.factory.updateImportDeclaration(s, undefined, undefined, t.factory.createImportClause(false, undefined, t.factory.createNamedImports(keepImports.map((name) => t.factory.createImportSpecifier(false, undefined, t.factory.createIdentifier(name))))), t.factory.createStringLiteral(updatedCoreImportPath), undefined);
  51888. newStatements.push(newImport);
  51889. }
  51890. }
  51891. madeChanges = true;
  51892. return;
  51893. }
  51894. }
  51895. }
  51896. newStatements.push(s);
  51897. });
  51898. if (madeChanges) {
  51899. return t.updateSourceFileNode(tsSourceFile, newStatements, tsSourceFile.isDeclarationFile, tsSourceFile.referencedFiles, tsSourceFile.typeReferenceDirectives, tsSourceFile.hasNoDefaultLib, tsSourceFile.libReferenceDirectives);
  51900. }
  51901. return tsSourceFile;
  51902. };
  51903. };
  51904. };
  51905. /**
  51906. * A set of imports which we don't want to remove from an output file
  51907. */
  51908. const KEEP_IMPORTS = new Set([
  51909. 'h',
  51910. 'setMode',
  51911. 'getMode',
  51912. 'setPlatformHelpers',
  51913. 'Build',
  51914. 'Env',
  51915. 'Host',
  51916. 'Fragment',
  51917. 'getAssetPath',
  51918. 'writeTask',
  51919. 'readTask',
  51920. 'getElement',
  51921. 'forceUpdate',
  51922. 'getRenderingRef',
  51923. 'forceModeUpdate',
  51924. 'setErrorHandler',
  51925. ]);
  51926. const getBuildFeatures = (cmps) => {
  51927. const slot = cmps.some((c) => c.htmlTagNames.includes('slot'));
  51928. const shadowDom = cmps.some((c) => c.encapsulation === 'shadow');
  51929. const slotRelocation = cmps.some((c) => c.encapsulation !== 'shadow' && c.htmlTagNames.includes('slot'));
  51930. const f = {
  51931. allRenderFn: cmps.every((c) => c.hasRenderFn),
  51932. cmpDidLoad: cmps.some((c) => c.hasComponentDidLoadFn),
  51933. cmpShouldUpdate: cmps.some((c) => c.hasComponentShouldUpdateFn),
  51934. cmpDidUnload: cmps.some((c) => c.hasComponentDidUnloadFn),
  51935. cmpDidUpdate: cmps.some((c) => c.hasComponentDidUpdateFn),
  51936. cmpDidRender: cmps.some((c) => c.hasComponentDidRenderFn),
  51937. cmpWillLoad: cmps.some((c) => c.hasComponentWillLoadFn),
  51938. cmpWillUpdate: cmps.some((c) => c.hasComponentWillUpdateFn),
  51939. cmpWillRender: cmps.some((c) => c.hasComponentWillRenderFn),
  51940. connectedCallback: cmps.some((c) => c.hasConnectedCallbackFn),
  51941. disconnectedCallback: cmps.some((c) => c.hasDisconnectedCallbackFn),
  51942. element: cmps.some((c) => c.hasElement),
  51943. event: cmps.some((c) => c.hasEvent),
  51944. hasRenderFn: cmps.some((c) => c.hasRenderFn),
  51945. lifecycle: cmps.some((c) => c.hasLifecycle),
  51946. asyncLoading: false,
  51947. hostListener: cmps.some((c) => c.hasListener),
  51948. hostListenerTargetWindow: cmps.some((c) => c.hasListenerTargetWindow),
  51949. hostListenerTargetDocument: cmps.some((c) => c.hasListenerTargetDocument),
  51950. hostListenerTargetBody: cmps.some((c) => c.hasListenerTargetBody),
  51951. hostListenerTargetParent: cmps.some((c) => c.hasListenerTargetParent),
  51952. hostListenerTarget: cmps.some((c) => c.hasListenerTarget),
  51953. member: cmps.some((c) => c.hasMember),
  51954. method: cmps.some((c) => c.hasMethod),
  51955. mode: cmps.some((c) => c.hasMode),
  51956. observeAttribute: cmps.some((c) => c.hasAttribute),
  51957. prop: cmps.some((c) => c.hasProp),
  51958. propBoolean: cmps.some((c) => c.hasPropBoolean),
  51959. propNumber: cmps.some((c) => c.hasPropNumber),
  51960. propString: cmps.some((c) => c.hasPropString),
  51961. propMutable: cmps.some((c) => c.hasPropMutable),
  51962. reflect: cmps.some((c) => c.hasReflect),
  51963. scoped: cmps.some((c) => c.encapsulation === 'scoped'),
  51964. shadowDom,
  51965. shadowDelegatesFocus: shadowDom && cmps.some((c) => c.shadowDelegatesFocus),
  51966. slot,
  51967. slotRelocation,
  51968. state: cmps.some((c) => c.hasState),
  51969. style: cmps.some((c) => c.hasStyle),
  51970. svg: cmps.some((c) => c.htmlTagNames.includes('svg')),
  51971. updatable: cmps.some((c) => c.isUpdateable),
  51972. vdomAttribute: cmps.some((c) => c.hasVdomAttribute),
  51973. vdomXlink: cmps.some((c) => c.hasVdomXlink),
  51974. vdomClass: cmps.some((c) => c.hasVdomClass),
  51975. vdomFunctional: cmps.some((c) => c.hasVdomFunctional),
  51976. vdomKey: cmps.some((c) => c.hasVdomKey),
  51977. vdomListener: cmps.some((c) => c.hasVdomListener),
  51978. vdomPropOrAttr: cmps.some((c) => c.hasVdomPropOrAttr),
  51979. vdomRef: cmps.some((c) => c.hasVdomRef),
  51980. vdomRender: cmps.some((c) => c.hasVdomRender),
  51981. vdomStyle: cmps.some((c) => c.hasVdomStyle),
  51982. vdomText: cmps.some((c) => c.hasVdomText),
  51983. watchCallback: cmps.some((c) => c.hasWatchCallback),
  51984. taskQueue: true,
  51985. };
  51986. f.asyncLoading = f.cmpWillUpdate || f.cmpWillLoad || f.cmpWillRender;
  51987. f.vdomAttribute = f.vdomAttribute || f.reflect;
  51988. f.vdomPropOrAttr = f.vdomPropOrAttr || f.reflect;
  51989. return f;
  51990. };
  51991. const updateComponentBuildConditionals = (moduleMap, cmps) => {
  51992. cmps.forEach((cmp) => {
  51993. const importedModules = getModuleImports(moduleMap, cmp.sourceFilePath, []);
  51994. importedModules.forEach((importedModule) => {
  51995. // if the component already has a boolean true value it'll keep it
  51996. // otherwise we get the boolean value from the imported module
  51997. cmp.hasVdomAttribute = cmp.hasVdomAttribute || importedModule.hasVdomAttribute;
  51998. cmp.hasVdomPropOrAttr = cmp.hasVdomPropOrAttr || importedModule.hasVdomPropOrAttr;
  51999. cmp.hasVdomXlink = cmp.hasVdomXlink || importedModule.hasVdomXlink;
  52000. cmp.hasVdomClass = cmp.hasVdomClass || importedModule.hasVdomClass;
  52001. cmp.hasVdomFunctional = cmp.hasVdomFunctional || importedModule.hasVdomFunctional;
  52002. cmp.hasVdomKey = cmp.hasVdomKey || importedModule.hasVdomKey;
  52003. cmp.hasVdomListener = cmp.hasVdomListener || importedModule.hasVdomListener;
  52004. cmp.hasVdomRef = cmp.hasVdomRef || importedModule.hasVdomRef;
  52005. cmp.hasVdomRender = cmp.hasVdomRender || importedModule.hasVdomRender;
  52006. cmp.hasVdomStyle = cmp.hasVdomStyle || importedModule.hasVdomStyle;
  52007. cmp.hasVdomText = cmp.hasVdomText || importedModule.hasVdomText;
  52008. cmp.htmlAttrNames.push(...importedModule.htmlAttrNames);
  52009. cmp.htmlTagNames.push(...importedModule.htmlTagNames);
  52010. cmp.potentialCmpRefs.push(...importedModule.potentialCmpRefs);
  52011. });
  52012. cmp.htmlAttrNames = unique(cmp.htmlAttrNames);
  52013. cmp.htmlTagNames = unique(cmp.htmlTagNames);
  52014. cmp.potentialCmpRefs = unique(cmp.potentialCmpRefs);
  52015. });
  52016. };
  52017. const getModuleImports = (moduleMap, filePath, importedModules) => {
  52018. let moduleFile = moduleMap.get(filePath);
  52019. if (moduleFile == null) {
  52020. moduleFile = moduleMap.get(filePath + '.tsx');
  52021. if (moduleFile == null) {
  52022. moduleFile = moduleMap.get(filePath + '.ts');
  52023. if (moduleFile == null) {
  52024. moduleFile = moduleMap.get(filePath + '.js');
  52025. }
  52026. }
  52027. }
  52028. if (moduleFile != null && !importedModules.some((m) => m.sourceFilePath === moduleFile.sourceFilePath)) {
  52029. importedModules.push(moduleFile);
  52030. moduleFile.localImports.forEach((localImport) => {
  52031. getModuleImports(moduleMap, localImport, importedModules);
  52032. });
  52033. }
  52034. return importedModules;
  52035. };
  52036. const updateBuildConditionals = (config, b) => {
  52037. b.isDebug = config.logLevel === 'debug';
  52038. b.isDev = !!config.devMode;
  52039. b.isTesting = !!config._isTesting;
  52040. b.devTools = b.isDev && !config._isTesting;
  52041. b.profile = !!config.profile;
  52042. b.hotModuleReplacement = !!(config.devMode &&
  52043. config.devServer &&
  52044. config.devServer.reloadStrategy === 'hmr' &&
  52045. !config._isTesting);
  52046. b.updatable = b.updatable || b.hydrateClientSide || b.hotModuleReplacement;
  52047. b.member = b.member || b.updatable || b.mode || b.lifecycle;
  52048. b.constructableCSS = !b.hotModuleReplacement || !!config._isTesting;
  52049. b.asyncLoading = !!(b.asyncLoading || b.lazyLoad || b.taskQueue || b.initializeNextTick);
  52050. b.cssAnnotations = true;
  52051. b.appendChildSlotFix = config.extras.appendChildSlotFix;
  52052. b.slotChildNodesFix = config.extras.slotChildNodesFix;
  52053. b.cloneNodeFix = config.extras.cloneNodeFix;
  52054. b.dynamicImportShim = config.extras.dynamicImportShim;
  52055. b.lifecycleDOMEvents = !!(b.isDebug || config._isTesting || config.extras.lifecycleDOMEvents);
  52056. b.safari10 = config.extras.safari10;
  52057. b.scopedSlotTextContentFix = !!config.extras.scopedSlotTextContentFix;
  52058. b.scriptDataOpts = config.extras.scriptDataOpts;
  52059. b.shadowDomShim = config.extras.shadowDomShim;
  52060. b.attachStyles = true;
  52061. b.invisiblePrehydration = typeof config.invisiblePrehydration === 'undefined' ? true : config.invisiblePrehydration;
  52062. if (b.shadowDomShim) {
  52063. b.slotRelocation = b.slot;
  52064. }
  52065. if (config.hydratedFlag) {
  52066. b.hydratedAttribute = config.hydratedFlag.selector === 'attribute';
  52067. b.hydratedClass = config.hydratedFlag.selector === 'class';
  52068. }
  52069. else {
  52070. b.hydratedAttribute = false;
  52071. b.hydratedClass = false;
  52072. }
  52073. };
  52074. const getCustomElementsBuildConditionals = (config, cmps) => {
  52075. // because custom elements bundling does not customize the build conditionals by default
  52076. // then the default in "import { BUILD, NAMESPACE } from '@stencil/core/internal/app-data'"
  52077. // needs to have the static build conditionals set for the custom elements build
  52078. const build = getBuildFeatures(cmps);
  52079. build.lazyLoad = false;
  52080. build.hydrateClientSide = false;
  52081. build.hydrateServerSide = false;
  52082. build.asyncQueue = config.taskQueue === 'congestionAsync';
  52083. build.taskQueue = config.taskQueue !== 'immediate';
  52084. updateBuildConditionals(config, build);
  52085. build.devTools = false;
  52086. return build;
  52087. };
  52088. /**
  52089. * Main output target function for `dist-custom-elements`. This function just
  52090. * does some organizational work to call the other functions in this module,
  52091. * which do actual work of generating the rollup configuration, creating an
  52092. * entry chunk, running, the build, etc.
  52093. *
  52094. * @param config the validated compiler configuration we're using
  52095. * @param compilerCtx the current compiler context
  52096. * @param buildCtx the current build context
  52097. * @returns an empty Promise which won't resolve until the work is done!
  52098. */
  52099. const outputCustomElements = async (config, compilerCtx, buildCtx) => {
  52100. if (!config.buildDist) {
  52101. return;
  52102. }
  52103. const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
  52104. if (outputTargets.length === 0) {
  52105. return;
  52106. }
  52107. const bundlingEventMessage = 'generate custom elements';
  52108. const timespan = buildCtx.createTimeSpan(`${bundlingEventMessage} started`);
  52109. await Promise.all(outputTargets.map((target) => bundleCustomElements$1(config, compilerCtx, buildCtx, target)));
  52110. timespan.finish(`${bundlingEventMessage} finished`);
  52111. };
  52112. /**
  52113. * Get bundle options for our current build and compiler context which we'll use
  52114. * to generate a Rollup build and so on.
  52115. *
  52116. * @param config a validated Stencil configuration object
  52117. * @param buildCtx the current build context
  52118. * @param compilerCtx the current compiler context
  52119. * @param outputTarget the outputTarget we're currently dealing with
  52120. * @returns bundle options suitable for generating a rollup configuration
  52121. */
  52122. const getBundleOptions = (config, buildCtx, compilerCtx, outputTarget) => ({
  52123. id: 'customElements',
  52124. platform: 'client',
  52125. conditionals: getCustomElementsBuildConditionals(config, buildCtx.components),
  52126. customTransformers: getCustomElementCustomTransformer(config, compilerCtx, buildCtx.components, outputTarget),
  52127. externalRuntime: !!outputTarget.externalRuntime,
  52128. inlineWorkers: true,
  52129. inputs: {
  52130. // Here we prefix our index chunk with '\0' to tell Rollup that we're
  52131. // going to be using virtual modules with this module. A leading '\0'
  52132. // prevents other plugins from messing with the module. We generate a
  52133. // string for the index chunk below in the `loader` property.
  52134. //
  52135. // @see {@link https://rollupjs.org/guide/en/#conventions} for more info.
  52136. index: '\0core',
  52137. },
  52138. loader: {
  52139. '\0core': generateEntryPoint$1(outputTarget),
  52140. },
  52141. inlineDynamicImports: outputTarget.inlineDynamicImports,
  52142. preserveEntrySignatures: 'allow-extension',
  52143. });
  52144. /**
  52145. * Get bundle options for rollup, run the rollup build, optionally minify the
  52146. * output, and write files to disk.
  52147. *
  52148. * @param config the validated Stencil configuration we're using
  52149. * @param compilerCtx the current compiler context
  52150. * @param buildCtx the current build context
  52151. * @param outputTarget the outputTarget we're currently dealing with
  52152. * @returns an empty promise
  52153. */
  52154. const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarget) => {
  52155. try {
  52156. const bundleOpts = getBundleOptions(config, buildCtx, compilerCtx, outputTarget);
  52157. addCustomElementInputs(buildCtx, bundleOpts);
  52158. const build = await bundleOutput(config, compilerCtx, buildCtx, bundleOpts);
  52159. if (build) {
  52160. const rollupOutput = await build.generate({
  52161. banner: generatePreamble(config),
  52162. format: 'esm',
  52163. sourcemap: config.sourceMap,
  52164. chunkFileNames: outputTarget.externalRuntime || !config.hashFileNames ? '[name].js' : 'p-[hash].js',
  52165. entryFileNames: '[name].js',
  52166. hoistTransitiveImports: false,
  52167. preferConst: true,
  52168. });
  52169. // the output target should have been validated at this point - as a result, we expect this field
  52170. // to have been backfilled if it wasn't provided
  52171. const outputTargetDir = outputTarget.dir;
  52172. // besides, if it isn't here we do a diagnostic and an early return
  52173. if (!isString$1(outputTargetDir)) {
  52174. buildCtx.diagnostics.push({
  52175. level: 'error',
  52176. type: 'build',
  52177. messageText: 'dist-custom-elements output target provided with no output target directory!',
  52178. });
  52179. return;
  52180. }
  52181. const minify = outputTarget.externalRuntime || outputTarget.minify !== true ? false : config.minifyJs;
  52182. const files = rollupOutput.output.map(async (bundle) => {
  52183. if (bundle.type === 'chunk') {
  52184. let code = bundle.code;
  52185. let sourceMap = rollupToStencilSourceMap(bundle.map);
  52186. const optimizeResults = await optimizeModule(config, compilerCtx, {
  52187. input: code,
  52188. isCore: bundle.isEntry,
  52189. minify,
  52190. sourceMap,
  52191. });
  52192. buildCtx.diagnostics.push(...optimizeResults.diagnostics);
  52193. if (!hasError(optimizeResults.diagnostics) && typeof optimizeResults.output === 'string') {
  52194. code = optimizeResults.output;
  52195. }
  52196. if (optimizeResults.sourceMap) {
  52197. sourceMap = optimizeResults.sourceMap;
  52198. code = code + getSourceMappingUrlForEndOfFile(bundle.fileName);
  52199. await compilerCtx.fs.writeFile(join(outputTargetDir, bundle.fileName + '.map'), JSON.stringify(sourceMap), {
  52200. outputTargetType: outputTarget.type,
  52201. });
  52202. }
  52203. await compilerCtx.fs.writeFile(join(outputTargetDir, bundle.fileName), code, {
  52204. outputTargetType: outputTarget.type,
  52205. });
  52206. }
  52207. });
  52208. await Promise.all(files);
  52209. }
  52210. }
  52211. catch (e) {
  52212. catchError(buildCtx.diagnostics, e);
  52213. }
  52214. };
  52215. /**
  52216. * Create the virtual modules/input modules for the `dist-custom-elements` output target.
  52217. * @param buildCtx the context for the current build
  52218. * @param bundleOpts the bundle options to store the virtual modules under. acts as an output parameter
  52219. */
  52220. const addCustomElementInputs = (buildCtx, bundleOpts) => {
  52221. const components = buildCtx.components;
  52222. // an array to store the imports of these modules that we're going to add to our entry chunk
  52223. const indexImports = [];
  52224. components.forEach((cmp) => {
  52225. const exp = [];
  52226. const exportName = dashToPascalCase$1(cmp.tagName);
  52227. const importName = cmp.componentClassName;
  52228. const importAs = `$Cmp${exportName}`;
  52229. const coreKey = `\0${exportName}`;
  52230. if (cmp.isPlain) {
  52231. exp.push(`export { ${importName} as ${exportName} } from '${cmp.sourceFilePath}';`);
  52232. indexImports.push(`export { {${exportName} } from '${coreKey}';`);
  52233. }
  52234. else {
  52235. // the `importName` may collide with the `exportName`, alias it just in case it does with `importAs`
  52236. exp.push(`import { ${importName} as ${importAs}, defineCustomElement as cmpDefCustomEle } from '${cmp.sourceFilePath}';`);
  52237. exp.push(`export const ${exportName} = ${importAs};`);
  52238. exp.push(`export const defineCustomElement = cmpDefCustomEle;`);
  52239. // Here we push an export (with a rename for `defineCustomElement`) for
  52240. // this component onto our array which references the `coreKey` (prefixed
  52241. // with `\0`). We have to do this so that our import is referencing the
  52242. // correct virtual module, if we instead referenced, for instance,
  52243. // `cmp.sourceFilePath`, we would end up with duplicated modules in our
  52244. // output.
  52245. indexImports.push(`export { ${exportName}, defineCustomElement as defineCustomElement${exportName} } from '${coreKey}';`);
  52246. }
  52247. bundleOpts.inputs[cmp.tagName] = coreKey;
  52248. bundleOpts.loader[coreKey] = exp.join('\n');
  52249. });
  52250. bundleOpts.loader['\0core'] += indexImports.join('\n');
  52251. };
  52252. /**
  52253. * Generate the entrypoint (`index.ts` file) contents for the `dist-custom-elements` output target
  52254. * @param outputTarget the output target's configuration
  52255. * @returns the stringified contents to be placed in the entrypoint
  52256. */
  52257. const generateEntryPoint$1 = (outputTarget) => {
  52258. const imp = [];
  52259. imp.push(`export { setAssetPath, setPlatformOptions } from '${STENCIL_INTERNAL_CLIENT_ID}';`, `export * from '${USER_INDEX_ENTRY_ID}';`);
  52260. if (outputTarget.includeGlobalScripts !== false) {
  52261. imp.push(`import { globalScripts } from '${STENCIL_APP_GLOBALS_ID}';`, `globalScripts();`);
  52262. }
  52263. return imp.join('\n') + '\n';
  52264. };
  52265. /**
  52266. * Get the series of custom transformers that will be applied to a Stencil project's source code during the TypeScript
  52267. * transpilation process
  52268. *
  52269. * @param config the configuration for the Stencil project
  52270. * @param compilerCtx the current compiler context
  52271. * @param components the components that will be compiled as a part of the current build
  52272. * @param outputTarget the output target configuration
  52273. * @returns a list of transformers to use in the transpilation process
  52274. */
  52275. const getCustomElementCustomTransformer = (config, compilerCtx, components, outputTarget) => {
  52276. const transformOpts = {
  52277. coreImportPath: STENCIL_INTERNAL_CLIENT_ID,
  52278. componentExport: null,
  52279. componentMetadata: null,
  52280. currentDirectory: config.sys.getCurrentDirectory(),
  52281. proxy: null,
  52282. style: 'static',
  52283. styleImportData: 'queryparams',
  52284. };
  52285. return [
  52286. addDefineCustomElementFunctions(compilerCtx, components, outputTarget),
  52287. updateStencilCoreImports(transformOpts.coreImportPath),
  52288. nativeComponentTransform(compilerCtx, transformOpts),
  52289. proxyCustomElement(compilerCtx, transformOpts),
  52290. removeCollectionImports(compilerCtx),
  52291. ];
  52292. };
  52293. const outputCustomElementsBundle = async (config, compilerCtx, buildCtx) => {
  52294. if (!config.buildDist) {
  52295. return;
  52296. }
  52297. const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElementsBundle);
  52298. if (outputTargets.length === 0) {
  52299. return;
  52300. }
  52301. const bundlingEventMessage = `generate custom elements bundle${config.sourceMap ? ' + source maps' : ''}`;
  52302. const timespan = buildCtx.createTimeSpan(`${bundlingEventMessage} started`);
  52303. await Promise.all(outputTargets.map((o) => bundleCustomElements(config, compilerCtx, buildCtx, o)));
  52304. timespan.finish(`${bundlingEventMessage} finished`);
  52305. };
  52306. const bundleCustomElements = async (config, compilerCtx, buildCtx, outputTarget) => {
  52307. try {
  52308. const bundleOpts = {
  52309. id: 'customElementsBundle',
  52310. platform: 'client',
  52311. conditionals: getCustomElementsBuildConditionals(config, buildCtx.components),
  52312. customTransformers: getCustomElementBundleCustomTransformer(config, compilerCtx),
  52313. externalRuntime: !!outputTarget.externalRuntime,
  52314. inlineWorkers: true,
  52315. inputs: {
  52316. index: '\0core',
  52317. },
  52318. loader: {
  52319. '\0core': generateEntryPoint(outputTarget, buildCtx),
  52320. },
  52321. inlineDynamicImports: outputTarget.inlineDynamicImports,
  52322. preserveEntrySignatures: 'allow-extension',
  52323. };
  52324. const build = await bundleOutput(config, compilerCtx, buildCtx, bundleOpts);
  52325. if (build) {
  52326. const rollupOutput = await build.generate({
  52327. banner: generatePreamble(config),
  52328. format: 'esm',
  52329. sourcemap: config.sourceMap,
  52330. chunkFileNames: outputTarget.externalRuntime || !config.hashFileNames ? '[name].js' : 'p-[hash].js',
  52331. entryFileNames: '[name].js',
  52332. hoistTransitiveImports: false,
  52333. preferConst: true,
  52334. });
  52335. const minify = outputTarget.externalRuntime || outputTarget.minify !== true ? false : config.minifyJs;
  52336. const files = rollupOutput.output.map(async (bundle) => {
  52337. if (bundle.type === 'chunk') {
  52338. let code = bundle.code;
  52339. let sourceMap = rollupToStencilSourceMap(bundle.map);
  52340. const optimizeResults = await optimizeModule(config, compilerCtx, {
  52341. input: code,
  52342. isCore: bundle.isEntry,
  52343. minify,
  52344. sourceMap,
  52345. });
  52346. buildCtx.diagnostics.push(...optimizeResults.diagnostics);
  52347. if (!hasError(optimizeResults.diagnostics) && typeof optimizeResults.output === 'string') {
  52348. code = optimizeResults.output;
  52349. sourceMap = optimizeResults.sourceMap;
  52350. }
  52351. if (sourceMap) {
  52352. code = code + getSourceMappingUrlForEndOfFile(bundle.fileName);
  52353. await compilerCtx.fs.writeFile(join(outputTarget.dir, bundle.fileName + '.map'), JSON.stringify(sourceMap), {
  52354. outputTargetType: outputTarget.type,
  52355. });
  52356. }
  52357. await compilerCtx.fs.writeFile(join(outputTarget.dir, bundle.fileName), code, {
  52358. outputTargetType: outputTarget.type,
  52359. });
  52360. }
  52361. });
  52362. await Promise.all(files);
  52363. }
  52364. }
  52365. catch (e) {
  52366. catchError(buildCtx.diagnostics, e);
  52367. }
  52368. };
  52369. const generateEntryPoint = (outputTarget, buildCtx) => {
  52370. const imp = [];
  52371. const exp = [];
  52372. const exportNames = [];
  52373. imp.push(`import { proxyCustomElement } from '${STENCIL_INTERNAL_CLIENT_ID}';`, `export { setAssetPath, setPlatformOptions } from '${STENCIL_INTERNAL_CLIENT_ID}';`, `export * from '${USER_INDEX_ENTRY_ID}';`);
  52374. if (outputTarget.includeGlobalScripts !== false) {
  52375. imp.push(`import { globalScripts } from '${STENCIL_APP_GLOBALS_ID}';`, `globalScripts();`);
  52376. }
  52377. buildCtx.components.forEach((cmp) => {
  52378. const exportName = dashToPascalCase$1(cmp.tagName);
  52379. const importName = cmp.componentClassName;
  52380. const importAs = `$Cmp${exportName}`;
  52381. if (cmp.isPlain) {
  52382. exp.push(`export { ${importName} as ${exportName} } from '${cmp.sourceFilePath}';`);
  52383. }
  52384. else {
  52385. const meta = stringifyRuntimeData(formatComponentRuntimeMeta(cmp, false));
  52386. imp.push(`import { ${importName} as ${importAs} } from '${cmp.sourceFilePath}';`);
  52387. exp.push(`export const ${exportName} = /*@__PURE__*/proxyCustomElement(${importAs}, ${meta});`);
  52388. }
  52389. exportNames.push(exportName);
  52390. });
  52391. exp.push(`export const defineCustomElements = (opts) => {`);
  52392. exp.push(` if (typeof customElements !== 'undefined') {`);
  52393. exp.push(` [`);
  52394. exp.push(` ${exportNames.join(',\n ')}`);
  52395. exp.push(` ].forEach(cmp => {`);
  52396. exp.push(` if (!customElements.get(cmp.is)) {`);
  52397. exp.push(` customElements.define(cmp.is, cmp, opts);`);
  52398. exp.push(` }`);
  52399. exp.push(` });`);
  52400. exp.push(` }`);
  52401. exp.push(`};`);
  52402. return [...imp, ...exp].join('\n') + '\n';
  52403. };
  52404. const getCustomElementBundleCustomTransformer = (config, compilerCtx) => {
  52405. const transformOpts = {
  52406. coreImportPath: STENCIL_INTERNAL_CLIENT_ID,
  52407. componentExport: null,
  52408. componentMetadata: null,
  52409. currentDirectory: config.sys.getCurrentDirectory(),
  52410. proxy: null,
  52411. style: 'static',
  52412. styleImportData: 'queryparams',
  52413. };
  52414. return [
  52415. updateStencilCoreImports(transformOpts.coreImportPath),
  52416. nativeComponentTransform(compilerCtx, transformOpts),
  52417. removeCollectionImports(compilerCtx),
  52418. ];
  52419. };
  52420. const updateLazyComponentConstructor = (classMembers, moduleFile, cmp) => {
  52421. const cstrMethodArgs = [t.createParameter(undefined, undefined, undefined, t.createIdentifier(HOST_REF_ARG))];
  52422. const cstrMethodIndex = classMembers.findIndex((m) => m.kind === t.SyntaxKind.Constructor);
  52423. if (cstrMethodIndex >= 0) {
  52424. // add to the existing constructor()
  52425. const cstrMethod = classMembers[cstrMethodIndex];
  52426. const body = t.updateBlock(cstrMethod.body, [
  52427. registerInstanceStatement(moduleFile),
  52428. ...addCreateEvents(moduleFile, cmp),
  52429. ...cstrMethod.body.statements,
  52430. ...addLegacyProps(moduleFile, cmp),
  52431. ]);
  52432. classMembers[cstrMethodIndex] = t.updateConstructor(cstrMethod, cstrMethod.decorators, cstrMethod.modifiers, cstrMethodArgs, body);
  52433. }
  52434. else {
  52435. // create a constructor()
  52436. const cstrMethod = t.createConstructor(undefined, undefined, cstrMethodArgs, t.createBlock([
  52437. registerInstanceStatement(moduleFile),
  52438. ...addCreateEvents(moduleFile, cmp),
  52439. ...addLegacyProps(moduleFile, cmp),
  52440. ], true));
  52441. classMembers.unshift(cstrMethod);
  52442. }
  52443. };
  52444. const registerInstanceStatement = (moduleFile) => {
  52445. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.registerInstance);
  52446. return t.createStatement(t.createCall(t.createIdentifier(REGISTER_INSTANCE), undefined, [
  52447. t.createThis(),
  52448. t.createIdentifier(HOST_REF_ARG),
  52449. ]));
  52450. };
  52451. const HOST_REF_ARG = 'hostRef';
  52452. const addLazyElementGetter = (classMembers, moduleFile, cmp) => {
  52453. // @Element() element;
  52454. // is transformed into:
  52455. // get element() { return __stencil_getElement(this); }
  52456. if (cmp.elementRef) {
  52457. addCoreRuntimeApi(moduleFile, RUNTIME_APIS.getElement);
  52458. classMembers.push(t.createGetAccessor(undefined, undefined, cmp.elementRef, [], undefined, t.createBlock([t.createReturn(t.createCall(t.createIdentifier(GET_ELEMENT), undefined, [t.createThis()]))])));
  52459. }
  52460. };
  52461. /**
  52462. * Adds static "style" getter within the class
  52463. * ```typescript
  52464. * const MyComponent = class {
  52465. * static get style() { return "styles"; }
  52466. * }
  52467. * ```
  52468. * @param classMembers a class to existing members of a class. **this parameter will be mutated** rather than returning
  52469. * a cloned version
  52470. * @param cmp the metadata associated with the component being evaluated
  52471. * @param commentOriginalSelector if `true`, add a comment with the original CSS selector to the style.
  52472. */
  52473. const addStaticStyleGetterWithinClass = (classMembers, cmp, commentOriginalSelector) => {
  52474. const styleLiteral = getStyleLiteral(cmp, commentOriginalSelector);
  52475. if (styleLiteral) {
  52476. classMembers.push(createStaticGetter('style', styleLiteral));
  52477. }
  52478. };
  52479. /**
  52480. * Adds static "style" property to the class variable.
  52481. * ```typescript
  52482. * const MyComponent = class {}
  52483. * MyComponent.style = "styles";
  52484. * ```
  52485. * @param styleStatements a list of statements containing style assignments to a class
  52486. * @param cmp the metadata associated with the component being evaluated
  52487. */
  52488. const addStaticStylePropertyToClass = (styleStatements, cmp) => {
  52489. const styleLiteral = getStyleLiteral(cmp, false);
  52490. if (styleLiteral) {
  52491. const statement = t.createStatement(t.createAssignment(t.createPropertyAccess(t.createIdentifier(cmp.componentClassName), 'style'), styleLiteral));
  52492. styleStatements.push(statement);
  52493. }
  52494. };
  52495. const getStyleLiteral = (cmp, commentOriginalSelector) => {
  52496. if (Array.isArray(cmp.styles) && cmp.styles.length > 0) {
  52497. if (cmp.styles.length > 1 || (cmp.styles.length === 1 && cmp.styles[0].modeName !== DEFAULT_STYLE_MODE)) {
  52498. // multiple style modes
  52499. return getMultipleModeStyle(cmp, cmp.styles, commentOriginalSelector);
  52500. }
  52501. else {
  52502. // single style
  52503. return getSingleStyle(cmp, cmp.styles[0], commentOriginalSelector);
  52504. }
  52505. }
  52506. return null;
  52507. };
  52508. const getMultipleModeStyle = (cmp, styles, commentOriginalSelector) => {
  52509. const styleModes = [];
  52510. styles.forEach((style) => {
  52511. if (typeof style.styleStr === 'string') {
  52512. // inline the style string
  52513. // static get style() { return { ios: "string" }; }
  52514. const styleLiteral = createStyleLiteral(cmp, style, commentOriginalSelector);
  52515. const propStr = createPropertyAssignment(style.modeName, styleLiteral);
  52516. styleModes.push(propStr);
  52517. }
  52518. else if (typeof style.styleIdentifier === 'string') {
  52519. // direct import already written in the source code
  52520. // import myTagIosStyle from './import-path.css';
  52521. // static get style() { return { ios: myTagIosStyle }; }
  52522. const styleIdentifier = t.createIdentifier(style.styleIdentifier);
  52523. const propIdentifier = createPropertyAssignment(style.modeName, styleIdentifier);
  52524. styleModes.push(propIdentifier);
  52525. }
  52526. else if (Array.isArray(style.externalStyles) && style.externalStyles.length > 0) {
  52527. // import generated from @Component() styleUrls option
  52528. // import myTagIosStyle from './import-path.css';
  52529. // static get style() { return { ios: myTagIosStyle }; }
  52530. const styleUrlIdentifier = createStyleIdentifierFromUrl(cmp, style);
  52531. const propUrlIdentifier = createPropertyAssignment(style.modeName, styleUrlIdentifier);
  52532. styleModes.push(propUrlIdentifier);
  52533. }
  52534. });
  52535. return t.createObjectLiteral(styleModes, true);
  52536. };
  52537. const createPropertyAssignment = (mode, initializer) => {
  52538. const node = t.createPropertyAssignment(mode, initializer);
  52539. return node;
  52540. };
  52541. const getSingleStyle = (cmp, style, commentOriginalSelector) => {
  52542. if (typeof style.styleStr === 'string') {
  52543. // inline the style string
  52544. // static get style() { return "string"; }
  52545. return createStyleLiteral(cmp, style, commentOriginalSelector);
  52546. }
  52547. if (typeof style.styleIdentifier === 'string') {
  52548. // direct import already written in the source code
  52549. // import myTagStyle from './import-path.css';
  52550. // static get style() { return myTagStyle; }
  52551. return t.createIdentifier(style.styleIdentifier);
  52552. }
  52553. if (Array.isArray(style.externalStyles) && style.externalStyles.length > 0) {
  52554. // import generated from @Component() styleUrls option
  52555. // import myTagStyle from './import-path.css';
  52556. // static get style() { return myTagStyle; }
  52557. return createStyleIdentifierFromUrl(cmp, style);
  52558. }
  52559. return null;
  52560. };
  52561. const createStyleLiteral = (cmp, style, commentOriginalSelector) => {
  52562. if (cmp.encapsulation === 'scoped' || (commentOriginalSelector && cmp.encapsulation === 'shadow')) {
  52563. // scope the css first
  52564. const scopeId = getScopeId(cmp.tagName, style.modeName);
  52565. return t.createStringLiteral(scopeCss(style.styleStr, scopeId, commentOriginalSelector));
  52566. }
  52567. return t.createStringLiteral(style.styleStr);
  52568. };
  52569. const createStyleIdentifierFromUrl = (cmp, style) => {
  52570. style.styleIdentifier = dashToPascalCase$1(cmp.tagName);
  52571. style.styleIdentifier = style.styleIdentifier.charAt(0).toLowerCase() + style.styleIdentifier.substring(1);
  52572. if (style.modeName !== DEFAULT_STYLE_MODE) {
  52573. style.styleIdentifier += dashToPascalCase$1(style.modeName);
  52574. }
  52575. style.styleIdentifier += 'Style';
  52576. style.externalStyles = [style.externalStyles[0]];
  52577. return t.createIdentifier(style.styleIdentifier);
  52578. };
  52579. const addHydrateRuntimeCmpMeta = (classMembers, cmp) => {
  52580. const compactMeta = formatComponentRuntimeMeta(cmp, true);
  52581. const cmpMeta = {
  52582. $flags$: compactMeta[0],
  52583. $tagName$: compactMeta[1],
  52584. $members$: compactMeta[2],
  52585. $listeners$: compactMeta[3],
  52586. $lazyBundleId$: fakeBundleIds(),
  52587. $attrsToReflect$: getHydrateAttrsToReflect(cmp),
  52588. };
  52589. // We always need shadow-dom shim in hydrate runtime
  52590. if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
  52591. cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
  52592. }
  52593. const staticMember = createStaticGetter('cmpMeta', convertValueToLiteral(cmpMeta));
  52594. const commentOriginalSelector = cmp.encapsulation === 'shadow';
  52595. addStaticStyleGetterWithinClass(classMembers, cmp, commentOriginalSelector);
  52596. classMembers.push(staticMember);
  52597. };
  52598. const fakeBundleIds = (_cmp) => {
  52599. return '-';
  52600. };
  52601. const getHydrateAttrsToReflect = (cmp) => {
  52602. return cmp.properties.reduce((attrs, prop) => {
  52603. if (prop.reflect) {
  52604. attrs.push([prop.name, prop.attribute]);
  52605. }
  52606. return attrs;
  52607. }, []);
  52608. };
  52609. const updateHydrateComponentClass = (classNode, moduleFile, cmp) => {
  52610. return t.updateClassDeclaration(classNode, classNode.decorators, classNode.modifiers, classNode.name, classNode.typeParameters, classNode.heritageClauses, updateHydrateHostComponentMembers(classNode, moduleFile, cmp));
  52611. };
  52612. const updateHydrateHostComponentMembers = (classNode, moduleFile, cmp) => {
  52613. const classMembers = removeStaticMetaProperties(classNode);
  52614. updateLazyComponentConstructor(classMembers, moduleFile, cmp);
  52615. addLazyElementGetter(classMembers, moduleFile, cmp);
  52616. addWatchers(classMembers, cmp);
  52617. addHydrateRuntimeCmpMeta(classMembers, cmp);
  52618. transformHostData(classMembers, moduleFile);
  52619. return classMembers;
  52620. };
  52621. const hydrateComponentTransform = (compilerCtx, transformOpts) => {
  52622. return (transformCtx) => {
  52623. return (tsSourceFile) => {
  52624. const moduleFile = getModuleFromSourceFile(compilerCtx, tsSourceFile);
  52625. const visitNode = (node) => {
  52626. if (t.isClassDeclaration(node)) {
  52627. const cmp = getComponentMeta(compilerCtx, tsSourceFile, node);
  52628. if (cmp != null) {
  52629. return updateHydrateComponentClass(node, moduleFile, cmp);
  52630. }
  52631. }
  52632. return t.visitEachChild(node, visitNode, transformCtx);
  52633. };
  52634. tsSourceFile = t.visitEachChild(tsSourceFile, visitNode, transformCtx);
  52635. if (moduleFile.cmps.length > 0) {
  52636. tsSourceFile = updateStyleImports(transformOpts, tsSourceFile, moduleFile);
  52637. }
  52638. if (moduleFile.isLegacy) {
  52639. addLegacyApis(moduleFile);
  52640. }
  52641. tsSourceFile = addImports(transformOpts, tsSourceFile, moduleFile.coreRuntimeApis, transformOpts.coreImportPath);
  52642. return tsSourceFile;
  52643. };
  52644. };
  52645. };
  52646. const getHydrateBuildConditionals$1 = (cmps) => {
  52647. const build = getBuildFeatures(cmps);
  52648. build.slotRelocation = true;
  52649. build.lazyLoad = true;
  52650. build.hydrateServerSide = true;
  52651. build.cssVarShim = false;
  52652. build.hydrateClientSide = true;
  52653. build.isDebug = false;
  52654. build.isDev = false;
  52655. build.isTesting = false;
  52656. build.devTools = false;
  52657. build.lifecycleDOMEvents = false;
  52658. build.profile = false;
  52659. build.hotModuleReplacement = false;
  52660. build.updatable = true;
  52661. build.member = true;
  52662. build.constructableCSS = false;
  52663. build.asyncLoading = true;
  52664. build.appendChildSlotFix = false;
  52665. build.slotChildNodesFix = false;
  52666. build.cloneNodeFix = false;
  52667. build.cssAnnotations = true;
  52668. build.shadowDomShim = true;
  52669. build.safari10 = false;
  52670. build.hydratedAttribute = false;
  52671. build.hydratedClass = true;
  52672. build.scriptDataOpts = false;
  52673. build.dynamicImportShim = false;
  52674. build.attachStyles = true;
  52675. return build;
  52676. };
  52677. const bundleHydrateFactory = async (config, compilerCtx, buildCtx, _build, appFactoryEntryCode) => {
  52678. try {
  52679. const bundleOpts = {
  52680. id: 'hydrate',
  52681. platform: 'hydrate',
  52682. conditionals: getHydrateBuildConditionals$1(buildCtx.components),
  52683. customTransformers: getHydrateCustomTransformer(config, compilerCtx),
  52684. inlineDynamicImports: true,
  52685. inputs: {
  52686. '@app-factory-entry': '@app-factory-entry',
  52687. },
  52688. loader: {
  52689. '@app-factory-entry': appFactoryEntryCode,
  52690. },
  52691. };
  52692. const rollupBuild = await bundleOutput(config, compilerCtx, buildCtx, bundleOpts);
  52693. return rollupBuild;
  52694. }
  52695. catch (e) {
  52696. if (!buildCtx.hasError) {
  52697. // TODO(STENCIL-353): Implement a type guard that balances using our own copy of Rollup types (which are
  52698. // breakable) and type safety (so that the error variable may be something other than `any`)
  52699. loadRollupDiagnostics(config, compilerCtx, buildCtx, e);
  52700. }
  52701. }
  52702. return undefined;
  52703. };
  52704. const getHydrateCustomTransformer = (config, compilerCtx) => {
  52705. const transformOpts = {
  52706. coreImportPath: STENCIL_INTERNAL_HYDRATE_ID,
  52707. componentExport: null,
  52708. componentMetadata: null,
  52709. currentDirectory: config.sys.getCurrentDirectory(),
  52710. proxy: null,
  52711. style: 'static',
  52712. styleImportData: 'queryparams',
  52713. };
  52714. return [
  52715. updateStencilCoreImports(transformOpts.coreImportPath),
  52716. hydrateComponentTransform(compilerCtx, transformOpts),
  52717. removeCollectionImports(compilerCtx),
  52718. ];
  52719. };
  52720. const HYDRATE_APP_CLOSURE_START = `/*hydrateAppClosure start*/`;
  52721. const HYDRATE_FACTORY_INTRO = `
  52722. export function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
  52723. var globalThis = $stencilWindow;
  52724. var self = $stencilWindow;
  52725. var top = $stencilWindow;
  52726. var parent = $stencilWindow;
  52727. var addEventListener = $stencilWindow.addEventListener.bind($stencilWindow);
  52728. var alert = $stencilWindow.alert.bind($stencilWindow);
  52729. var blur = $stencilWindow.blur.bind($stencilWindow);
  52730. var cancelAnimationFrame = $stencilWindow.cancelAnimationFrame.bind($stencilWindow);
  52731. var cancelIdleCallback = $stencilWindow.cancelIdleCallback.bind($stencilWindow);
  52732. var clearInterval = $stencilWindow.clearInterval.bind($stencilWindow);
  52733. var clearTimeout = $stencilWindow.clearTimeout.bind($stencilWindow);
  52734. var close = () => {};
  52735. var confirm = $stencilWindow.confirm.bind($stencilWindow);
  52736. var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow);
  52737. var focus = $stencilWindow.focus.bind($stencilWindow);
  52738. var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow);
  52739. var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow);
  52740. var open = $stencilWindow.open.bind($stencilWindow);
  52741. var prompt = $stencilWindow.prompt.bind($stencilWindow);
  52742. var removeEventListener = $stencilWindow.removeEventListener.bind($stencilWindow);
  52743. var requestAnimationFrame = $stencilWindow.requestAnimationFrame.bind($stencilWindow);
  52744. var requestIdleCallback = $stencilWindow.requestIdleCallback.bind($stencilWindow);
  52745. var setInterval = $stencilWindow.setInterval.bind($stencilWindow);
  52746. var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow);
  52747. var CharacterData = $stencilWindow.CharacterData;
  52748. var CSS = $stencilWindow.CSS;
  52749. var CustomEvent = $stencilWindow.CustomEvent;
  52750. var Document = $stencilWindow.Document;
  52751. var DocumentFragment = $stencilWindow.DocumentFragment;
  52752. var DocumentType = $stencilWindow.DocumentType;
  52753. var DOMTokenList = $stencilWindow.DOMTokenList;
  52754. var Element = $stencilWindow.Element;
  52755. var Event = $stencilWindow.Event;
  52756. var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement;
  52757. var HTMLBaseElement = $stencilWindow.HTMLBaseElement;
  52758. var HTMLButtonElement = $stencilWindow.HTMLButtonElement;
  52759. var HTMLCanvasElement = $stencilWindow.HTMLCanvasElement;
  52760. var HTMLElement = $stencilWindow.HTMLElement;
  52761. var HTMLFormElement = $stencilWindow.HTMLFormElement;
  52762. var HTMLImageElement = $stencilWindow.HTMLImageElement;
  52763. var HTMLInputElement = $stencilWindow.HTMLInputElement;
  52764. var HTMLLinkElement = $stencilWindow.HTMLLinkElement;
  52765. var HTMLMetaElement = $stencilWindow.HTMLMetaElement;
  52766. var HTMLScriptElement = $stencilWindow.HTMLScriptElement;
  52767. var HTMLStyleElement = $stencilWindow.HTMLStyleElement;
  52768. var HTMLTemplateElement = $stencilWindow.HTMLTemplateElement;
  52769. var HTMLTitleElement = $stencilWindow.HTMLTitleElement;
  52770. var IntersectionObserver = $stencilWindow.IntersectionObserver;
  52771. var KeyboardEvent = $stencilWindow.KeyboardEvent;
  52772. var MouseEvent = $stencilWindow.MouseEvent;
  52773. var Node = $stencilWindow.Node;
  52774. var NodeList = $stencilWindow.NodeList;
  52775. var URL = $stencilWindow.URL;
  52776. var console = $stencilWindow.console;
  52777. var customElements = $stencilWindow.customElements;
  52778. var history = $stencilWindow.history;
  52779. var localStorage = $stencilWindow.localStorage;
  52780. var location = $stencilWindow.location;
  52781. var navigator = $stencilWindow.navigator;
  52782. var performance = $stencilWindow.performance;
  52783. var sessionStorage = $stencilWindow.sessionStorage;
  52784. var devicePixelRatio = $stencilWindow.devicePixelRatio;
  52785. var innerHeight = $stencilWindow.innerHeight;
  52786. var innerWidth = $stencilWindow.innerWidth;
  52787. var origin = $stencilWindow.origin;
  52788. var pageXOffset = $stencilWindow.pageXOffset;
  52789. var pageYOffset = $stencilWindow.pageYOffset;
  52790. var screen = $stencilWindow.screen;
  52791. var screenLeft = $stencilWindow.screenLeft;
  52792. var screenTop = $stencilWindow.screenTop;
  52793. var screenX = $stencilWindow.screenX;
  52794. var screenY = $stencilWindow.screenY;
  52795. var scrollX = $stencilWindow.scrollX;
  52796. var scrollY = $stencilWindow.scrollY;
  52797. var exports = {};
  52798. var fetch, FetchError, Headers, Request, Response;
  52799. if (typeof $stencilWindow.fetch === 'function') {
  52800. fetch = $stencilWindow.fetch;
  52801. } else {
  52802. fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); };
  52803. }
  52804. if (typeof $stencilWindow.FetchError === 'function') {
  52805. FetchError = $stencilWindow.FetchError;
  52806. } else {
  52807. FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } };
  52808. }
  52809. if (typeof $stencilWindow.Headers === 'function') {
  52810. Headers = $stencilWindow.Headers;
  52811. } else {
  52812. Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } };
  52813. }
  52814. if (typeof $stencilWindow.Request === 'function') {
  52815. Request = $stencilWindow.Request;
  52816. } else {
  52817. Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } };
  52818. }
  52819. if (typeof $stencilWindow.Response === 'function') {
  52820. Response = $stencilWindow.Response;
  52821. } else {
  52822. Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } };
  52823. }
  52824. function hydrateAppClosure($stencilWindow) {
  52825. const window = $stencilWindow;
  52826. const document = $stencilWindow.document;
  52827. ${HYDRATE_APP_CLOSURE_START}
  52828. `;
  52829. const HYDRATE_FACTORY_OUTRO = `
  52830. /*hydrateAppClosure end*/
  52831. hydrateApp(window, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve);
  52832. }
  52833. hydrateAppClosure($stencilWindow);
  52834. }
  52835. `;
  52836. const updateToHydrateComponents = async (cmps) => {
  52837. const hydrateCmps = await Promise.all(cmps.map(updateToHydrateComponent));
  52838. return sortBy(hydrateCmps, (c) => c.cmp.componentClassName);
  52839. };
  52840. const updateToHydrateComponent = async (cmp) => {
  52841. const cmpData = {
  52842. filePath: cmp.sourceFilePath,
  52843. exportLine: ``,
  52844. cmp: cmp,
  52845. uniqueComponentClassName: ``,
  52846. importLine: ``,
  52847. };
  52848. const pascalCasedClassName = dashToPascalCase$1(toTitleCase(cmp.tagName));
  52849. if (cmp.componentClassName !== pascalCasedClassName) {
  52850. cmpData.uniqueComponentClassName = pascalCasedClassName;
  52851. cmpData.importLine = `import { ${cmp.componentClassName} as ${cmpData.uniqueComponentClassName} } from '${cmpData.filePath}';`;
  52852. }
  52853. else {
  52854. cmpData.uniqueComponentClassName = cmp.componentClassName;
  52855. cmpData.importLine = `import { ${cmpData.uniqueComponentClassName} } from '${cmpData.filePath}';`;
  52856. }
  52857. return cmpData;
  52858. };
  52859. const relocateHydrateContextConst = (config, compilerCtx, code) => {
  52860. // for whatever reason, const Context = {};
  52861. // is not hoisted to the correct location when bundled,
  52862. // so manually doing it here
  52863. // /*hydrate context start*/export const Context = {};/*hydrate context end*/
  52864. const globalScripts = getGlobalScriptData(config, compilerCtx);
  52865. if (globalScripts.length > 0) {
  52866. const startCode = code.indexOf('/*hydrate context start*/');
  52867. if (startCode > -1) {
  52868. const endCode = code.indexOf('/*hydrate context end*/') + '/*hydrate context end*/'.length;
  52869. const hydrateContextCode = code.substring(startCode, endCode);
  52870. code = code.replace(hydrateContextCode, '');
  52871. return code.replace(HYDRATE_APP_CLOSURE_START, HYDRATE_APP_CLOSURE_START + '\n ' + hydrateContextCode);
  52872. }
  52873. }
  52874. return code;
  52875. };
  52876. const writeHydrateOutputs = (config, compilerCtx, buildCtx, outputTargets, rollupOutput) => {
  52877. return Promise.all(outputTargets.map((outputTarget) => {
  52878. return writeHydrateOutput(config, compilerCtx, buildCtx, outputTarget, rollupOutput);
  52879. }));
  52880. };
  52881. const writeHydrateOutput = async (config, compilerCtx, buildCtx, outputTarget, rollupOutput) => {
  52882. const hydratePackageName = await getHydratePackageName(config, compilerCtx);
  52883. const hydrateAppDirPath = outputTarget.dir;
  52884. const hydrateCoreIndexPath = join(hydrateAppDirPath, 'index.js');
  52885. const hydrateCoreIndexDtsFilePath = join(hydrateAppDirPath, 'index.d.ts');
  52886. const pkgJsonPath = join(hydrateAppDirPath, 'package.json');
  52887. const pkgJsonCode = getHydratePackageJson(config, hydrateCoreIndexPath, hydrateCoreIndexDtsFilePath, hydratePackageName);
  52888. await Promise.all([
  52889. copyHydrateRunnerDts(config, compilerCtx, hydrateAppDirPath),
  52890. compilerCtx.fs.writeFile(pkgJsonPath, pkgJsonCode),
  52891. ]);
  52892. // always remember a path to the hydrate app that the prerendering may need later on
  52893. buildCtx.hydrateAppFilePath = hydrateCoreIndexPath;
  52894. await Promise.all(rollupOutput.output.map(async (output) => {
  52895. if (output.type === 'chunk') {
  52896. output.code = relocateHydrateContextConst(config, compilerCtx, output.code);
  52897. const filePath = join(hydrateAppDirPath, output.fileName);
  52898. await compilerCtx.fs.writeFile(filePath, output.code, { immediateWrite: true });
  52899. }
  52900. }));
  52901. };
  52902. const getHydratePackageJson = (config, hydrateAppFilePath, hydrateDtsFilePath, hydratePackageName) => {
  52903. const pkg = {
  52904. name: hydratePackageName,
  52905. description: `${config.namespace} component hydration app.`,
  52906. main: basename(hydrateAppFilePath),
  52907. types: basename(hydrateDtsFilePath),
  52908. };
  52909. return JSON.stringify(pkg, null, 2);
  52910. };
  52911. const getHydratePackageName = async (config, compilerCtx) => {
  52912. try {
  52913. const rootPkgFilePath = join(config.rootDir, 'package.json');
  52914. const pkgStr = await compilerCtx.fs.readFile(rootPkgFilePath);
  52915. const pkgData = JSON.parse(pkgStr);
  52916. return `${pkgData.name}/hydrate`;
  52917. }
  52918. catch (e) { }
  52919. return `${config.fsNamespace}/hydrate`;
  52920. };
  52921. const copyHydrateRunnerDts = async (config, compilerCtx, hydrateAppDirPath) => {
  52922. const packageDir = join(config.sys.getCompilerExecutingPath(), '..', '..');
  52923. const srcHydrateDir = join(packageDir, 'internal', 'hydrate', 'runner.d.ts');
  52924. const runnerDtsDestPath = join(hydrateAppDirPath, 'index.d.ts');
  52925. await compilerCtx.fs.copyFile(srcHydrateDir, runnerDtsDestPath);
  52926. };
  52927. const generateHydrateApp = async (config, compilerCtx, buildCtx, outputTargets) => {
  52928. try {
  52929. const packageDir = join(config.sys.getCompilerExecutingPath(), '..', '..');
  52930. const input = join(packageDir, 'internal', 'hydrate', 'runner.js');
  52931. const mockDoc = join(packageDir, 'mock-doc', 'index.js');
  52932. const rollupOptions = {
  52933. ...config.rollupConfig.inputOptions,
  52934. input,
  52935. inlineDynamicImports: true,
  52936. plugins: [
  52937. {
  52938. name: 'hydrateAppPlugin',
  52939. resolveId(id) {
  52940. if (id === STENCIL_HYDRATE_FACTORY_ID) {
  52941. return id;
  52942. }
  52943. if (id === STENCIL_MOCK_DOC_ID) {
  52944. return mockDoc;
  52945. }
  52946. return null;
  52947. },
  52948. load(id) {
  52949. if (id === STENCIL_HYDRATE_FACTORY_ID) {
  52950. return generateHydrateFactory(config, compilerCtx, buildCtx);
  52951. }
  52952. return null;
  52953. },
  52954. },
  52955. ],
  52956. treeshake: false,
  52957. onwarn: createOnWarnFn(buildCtx.diagnostics),
  52958. };
  52959. const rollupAppBuild = await rollup(rollupOptions);
  52960. const rollupOutput = await rollupAppBuild.generate({
  52961. banner: generatePreamble(config),
  52962. format: 'cjs',
  52963. file: 'index.js',
  52964. });
  52965. await writeHydrateOutputs(config, compilerCtx, buildCtx, outputTargets, rollupOutput);
  52966. }
  52967. catch (e) {
  52968. if (!buildCtx.hasError) {
  52969. // TODO(STENCIL-353): Implement a type guard that balances using our own copy of Rollup types (which are
  52970. // breakable) and type safety (so that the error variable may be something other than `any`)
  52971. loadRollupDiagnostics(config, compilerCtx, buildCtx, e);
  52972. }
  52973. }
  52974. };
  52975. const generateHydrateFactory = async (config, compilerCtx, buildCtx) => {
  52976. if (!buildCtx.hasError) {
  52977. try {
  52978. const cmps = buildCtx.components;
  52979. const build = getHydrateBuildConditionals(config, cmps);
  52980. const appFactoryEntryCode = await generateHydrateFactoryEntry(buildCtx);
  52981. const rollupFactoryBuild = await bundleHydrateFactory(config, compilerCtx, buildCtx, build, appFactoryEntryCode);
  52982. if (rollupFactoryBuild != null) {
  52983. const rollupOutput = await rollupFactoryBuild.generate({
  52984. format: 'cjs',
  52985. esModule: false,
  52986. strict: false,
  52987. intro: HYDRATE_FACTORY_INTRO,
  52988. outro: HYDRATE_FACTORY_OUTRO,
  52989. preferConst: false,
  52990. });
  52991. if (!buildCtx.hasError && rollupOutput != null && Array.isArray(rollupOutput.output)) {
  52992. return rollupOutput.output[0].code;
  52993. }
  52994. }
  52995. }
  52996. catch (e) {
  52997. catchError(buildCtx.diagnostics, e);
  52998. }
  52999. }
  53000. return '';
  53001. };
  53002. const generateHydrateFactoryEntry = async (buildCtx) => {
  53003. const cmps = buildCtx.components;
  53004. const hydrateCmps = await updateToHydrateComponents(cmps);
  53005. const s = new MagicString$3('');
  53006. s.append(`import { hydrateApp, registerComponents, styles } from '${STENCIL_INTERNAL_HYDRATE_ID}';\n`);
  53007. hydrateCmps.forEach((cmpData) => s.append(cmpData.importLine + '\n'));
  53008. s.append(`registerComponents([\n`);
  53009. hydrateCmps.forEach((cmpData) => {
  53010. s.append(` ${cmpData.uniqueComponentClassName},\n`);
  53011. });
  53012. s.append(`]);\n`);
  53013. s.append(`export { hydrateApp }\n`);
  53014. return s.toString();
  53015. };
  53016. const getHydrateBuildConditionals = (config, cmps) => {
  53017. const build = getBuildFeatures(cmps);
  53018. build.lazyLoad = true;
  53019. build.hydrateClientSide = false;
  53020. build.hydrateServerSide = true;
  53021. updateBuildConditionals(config, build);
  53022. build.lifecycleDOMEvents = false;
  53023. build.devTools = false;
  53024. build.hotModuleReplacement = false;
  53025. build.cloneNodeFix = false;
  53026. build.appendChildSlotFix = false;
  53027. build.slotChildNodesFix = false;
  53028. build.safari10 = false;
  53029. build.shadowDomShim = false;
  53030. return build;
  53031. };
  53032. const outputHydrateScript = async (config, compilerCtx, buildCtx) => {
  53033. const hydrateOutputTargets = config.outputTargets.filter(isOutputTargetHydrate);
  53034. if (hydrateOutputTargets.length > 0) {
  53035. const timespan = buildCtx.createTimeSpan(`generate hydrate app started`);
  53036. await generateHydrateApp(config, compilerCtx, buildCtx, hydrateOutputTargets);
  53037. timespan.finish(`generate hydrate app finished`);
  53038. }
  53039. };
  53040. /**
  53041. * Scan the provided `doc` for any known Stencil components
  53042. * @param doc the Document to scan
  53043. * @param cmps the compiler metadata of known Stencil components
  53044. * @returns a list of all tags that were identified as known Stencil components
  53045. */
  53046. const getUsedComponents = (doc, cmps) => {
  53047. const tags = new Set(cmps.map((cmp) => cmp.tagName.toUpperCase()));
  53048. const found = [];
  53049. const searchComponents = (el) => {
  53050. if (tags.has(el.tagName)) {
  53051. found.push(el.tagName.toLowerCase());
  53052. }
  53053. for (let i = 0; i < el.childElementCount; i++) {
  53054. searchComponents(el.children[i]);
  53055. }
  53056. };
  53057. searchComponents(doc.documentElement);
  53058. return found;
  53059. };
  53060. /**
  53061. * Retrieve the component bundle groupings to be used when generating output
  53062. * @param config the Stencil configuration used for the build
  53063. * @param buildCtx the current build context
  53064. * @param cmps the components that have been registered & defined for the current build
  53065. * @returns the component bundling data
  53066. */
  53067. function getDefaultBundles(config, buildCtx, cmps) {
  53068. // get all of the user defined bundles in the Stencil config file
  53069. const userConfigEntryPoints = getUserConfigBundles(config, buildCtx, cmps);
  53070. if (userConfigEntryPoints.length > 0) {
  53071. // prefer user defined entry points over anything else Stencil may derive
  53072. return userConfigEntryPoints;
  53073. }
  53074. let entryPointsHints = config.entryComponentsHint;
  53075. if (!entryPointsHints && buildCtx.indexDoc) {
  53076. // attempt to scan an HTML file for known Stencil components
  53077. entryPointsHints = getUsedComponents(buildCtx.indexDoc, cmps);
  53078. }
  53079. if (!entryPointsHints) {
  53080. return [];
  53081. }
  53082. const mainBundle = unique([
  53083. ...entryPointsHints,
  53084. ...flatOne(entryPointsHints.map(resolveTag).map((cmp) => cmp.dependencies)),
  53085. ]).map(resolveTag);
  53086. function resolveTag(tag) {
  53087. return cmps.find((cmp) => cmp.tagName === tag);
  53088. }
  53089. return [mainBundle];
  53090. }
  53091. /**
  53092. * Retrieve and validate the `bundles` field on a project's Stencil configuration file
  53093. * @param config the configuration file with a `bundles` field to inspect
  53094. * @param buildCtx the current build context
  53095. * @param cmps the components that have been registered & defined for the current build
  53096. * @returns a three dimensional array with the compiler metadata for each component used
  53097. */
  53098. function getUserConfigBundles(config, buildCtx, cmps) {
  53099. const definedTags = new Set();
  53100. const entryTags = config.bundles.map((b) => {
  53101. return b.components
  53102. .map((tag) => {
  53103. const tagError = validateComponentTag(tag);
  53104. if (tagError) {
  53105. const err = buildError(buildCtx.diagnostics);
  53106. err.header = `Stencil Config`;
  53107. err.messageText = tagError;
  53108. }
  53109. const component = cmps.find((cmp) => cmp.tagName === tag);
  53110. if (!component) {
  53111. const warn = buildWarn(buildCtx.diagnostics);
  53112. warn.header = `Stencil Config`;
  53113. warn.messageText = `Component tag "${tag}" is defined in a bundle but no matching component was found within this app or its collections.`;
  53114. }
  53115. if (definedTags.has(tag)) {
  53116. const warn = buildWarn(buildCtx.diagnostics);
  53117. warn.header = `Stencil Config`;
  53118. warn.messageText = `Component tag "${tag}" has been defined multiple times in the "bundles" config.`;
  53119. }
  53120. definedTags.add(tag);
  53121. return component;
  53122. })
  53123. .sort();
  53124. });
  53125. return entryTags;
  53126. }
  53127. /**
  53128. * Generate a list of all component tags that will be used by the output
  53129. * @param config the Stencil configuration used for the build
  53130. * @param defaultBundles metadata of the assumed components being used/bundled
  53131. * @param allCmps all known components
  53132. * @returns a set of all component tags that are used
  53133. */
  53134. function computeUsedComponents(config, defaultBundles, allCmps) {
  53135. if (!config.excludeUnusedDependencies) {
  53136. // the user/config has specified that Stencil should use all the dependencies it's found, return the set of all
  53137. // known tags
  53138. return new Set(allCmps.map((c) => c.tagName));
  53139. }
  53140. const usedComponents = new Set();
  53141. // All components
  53142. defaultBundles.forEach((entry) => {
  53143. entry.forEach((cmp) => usedComponents.add(cmp.tagName));
  53144. });
  53145. allCmps.forEach((cmp) => {
  53146. if (!cmp.isCollectionDependency) {
  53147. usedComponents.add(cmp.tagName);
  53148. }
  53149. });
  53150. allCmps.forEach((cmp) => {
  53151. if (cmp.isCollectionDependency) {
  53152. if (cmp.dependents.some((dep) => usedComponents.has(dep))) {
  53153. usedComponents.add(cmp.tagName);
  53154. }
  53155. }
  53156. });
  53157. return usedComponents;
  53158. }
  53159. /**
  53160. * Generate the bundles that will be used during the bundling process
  53161. * @param config the Stencil configuration used for the build
  53162. * @param buildCtx the current build context
  53163. * @returns the bundles to be used during the bundling process
  53164. */
  53165. function generateComponentBundles(config, buildCtx) {
  53166. const cmps = sortBy(buildCtx.components, (cmp) => cmp.dependents.length);
  53167. const defaultBundles = getDefaultBundles(config, buildCtx, cmps);
  53168. const usedComponents = computeUsedComponents(config, defaultBundles, cmps);
  53169. if (config.devMode) {
  53170. return cmps
  53171. .filter((c) => usedComponents.has(c.tagName))
  53172. .map((cmp) => [cmp]);
  53173. }
  53174. // Visit components that are already in one of the default bundlers
  53175. const alreadyBundled = new Set();
  53176. defaultBundles.forEach((entry) => {
  53177. entry.forEach((cmp) => alreadyBundled.add(cmp));
  53178. });
  53179. const bundlers = cmps
  53180. .filter((cmp) => usedComponents.has(cmp.tagName) && !alreadyBundled.has(cmp))
  53181. .map((c) => [c]);
  53182. return [...defaultBundles, ...optimizeBundlers(bundlers, 0.6)].filter((b) => b.length > 0);
  53183. }
  53184. /**
  53185. * Calculate and reorganize bundles based on a calculated similarity score between bundle entries
  53186. * @param bundles the bundles to reorganize
  53187. * @param threshold a numeric value used to determine whether or not bundles should be reorganized
  53188. * @returns the reorganized bundles
  53189. */
  53190. function optimizeBundlers(bundles, threshold) {
  53191. /**
  53192. * build a mapping of component tag names in each `bundles` entry to the index where that entry occurs in `bundles`:
  53193. * ```ts
  53194. * bundles = [
  53195. * [
  53196. * {
  53197. * tagName: 'my-foo', ...<other_fields>,
  53198. * },
  53199. * ],
  53200. * [
  53201. * {
  53202. * tagName: 'my-bar', ...<other_fields>,
  53203. * },
  53204. * {
  53205. * tagName: 'my-baz', ...<other_fields>,
  53206. * },
  53207. * ],
  53208. * ];
  53209. * // yields
  53210. * {
  53211. * 'my-foo': 0,
  53212. * 'my-bar': 1,
  53213. * 'my-baz': 1,
  53214. * }
  53215. * ```
  53216. * note that in the event of a component being found >1 time, store the index of the last entry in which it's found
  53217. */
  53218. const cmpIndexMap = new Map();
  53219. bundles.forEach((entry, index) => {
  53220. entry.forEach((cmp) => {
  53221. cmpIndexMap.set(cmp.tagName, index);
  53222. });
  53223. });
  53224. // build a record of components
  53225. const matrix = bundles.map((entry) => {
  53226. const vector = new Uint8Array(bundles.length);
  53227. entry.forEach((cmp) => {
  53228. // for each dependent of a component, check to see if the dependent has been seen already when the `cmpIndexMap`
  53229. // was originally built. If so, mark it with a '1'
  53230. cmp.dependents.forEach((tag) => {
  53231. const index = cmpIndexMap.get(tag);
  53232. if (index !== undefined) {
  53233. vector[index] = 1;
  53234. }
  53235. });
  53236. });
  53237. entry.forEach((cmp) => {
  53238. // for each entry, check to see if the component has been seen already when the `cmpIndexMap` was originally
  53239. // built. If so, mark it with a '0', potentially overriding a previously set value on the vector.
  53240. const index = cmpIndexMap.get(cmp.tagName);
  53241. if (index !== undefined) {
  53242. vector[index] = 0;
  53243. }
  53244. });
  53245. return vector;
  53246. });
  53247. // resolve similar components
  53248. const newBundles = [];
  53249. const visited = new Uint8Array(bundles.length);
  53250. for (let i = 0; i < matrix.length; i++) {
  53251. // check if bundle is visited (0 means it's not)
  53252. if (visited[i] === 0) {
  53253. const bundle = [...bundles[i]];
  53254. visited[i] = 1;
  53255. for (let j = i + 1; j < matrix.length; j++) {
  53256. if (visited[j] === 0 && computeScore(matrix[i], matrix[j]) >= threshold) {
  53257. bundle.push(...bundles[j]);
  53258. visited[j] = 1;
  53259. }
  53260. }
  53261. newBundles.push(bundle);
  53262. }
  53263. }
  53264. return newBundles;
  53265. }
  53266. /**
  53267. * Computes a 'score' between two arrays, that is defined as the number of times that the value at a given index is the
  53268. * same in both arrays divided by the number of times the value in either array is high at the given index.
  53269. * @param m0 the first array to calculate sameness with
  53270. * @param m1 the second array to calculate sameness with
  53271. * @returns the calculated score
  53272. */
  53273. function computeScore(m0, m1) {
  53274. let total = 0;
  53275. let match = 0;
  53276. for (let i = 0; i < m0.length; i++) {
  53277. if (m0[i] === 1 || m1[i] === 1) {
  53278. total++;
  53279. if (m0[i] === m1[i]) {
  53280. match++;
  53281. }
  53282. }
  53283. }
  53284. return match / total;
  53285. }
  53286. const generateModuleGraph = (cmps, bundleModules) => {
  53287. const cmpMap = new Map();
  53288. cmps.forEach((cmp) => {
  53289. const bundle = bundleModules.find((b) => b.cmps.includes(cmp));
  53290. if (bundle) {
  53291. // add default case for no mode
  53292. cmpMap.set(getScopeId(cmp.tagName), bundle.rollupResult.imports);
  53293. }
  53294. });
  53295. return cmpMap;
  53296. };
  53297. const updateLazyComponentClass = (transformOpts, styleStatements, classNode, moduleFile, cmp) => {
  53298. const members = updateLazyComponentMembers(transformOpts, styleStatements, classNode, moduleFile, cmp);
  53299. return updateComponentClass(transformOpts, classNode, classNode.heritageClauses, members);
  53300. };
  53301. const updateLazyComponentMembers = (transformOpts, styleStatements, classNode, moduleFile, cmp) => {
  53302. const classMembers = removeStaticMetaProperties(classNode);
  53303. updateLazyComponentConstructor(classMembers, moduleFile, cmp);
  53304. addLazyElementGetter(classMembers, moduleFile, cmp);
  53305. addWatchers(classMembers, cmp);
  53306. transformHostData(classMembers, moduleFile);
  53307. if (transformOpts.style === 'static') {
  53308. addStaticStylePropertyToClass(styleStatements, cmp);
  53309. }
  53310. return classMembers;
  53311. };
  53312. const lazyComponentTransform = (compilerCtx, transformOpts) => {
  53313. return (transformCtx) => {
  53314. return (tsSourceFile) => {
  53315. const styleStatements = [];
  53316. const moduleFile = getModuleFromSourceFile(compilerCtx, tsSourceFile);
  53317. const visitNode = (node) => {
  53318. if (t.isClassDeclaration(node)) {
  53319. const cmp = getComponentMeta(compilerCtx, tsSourceFile, node);
  53320. if (cmp != null) {
  53321. return updateLazyComponentClass(transformOpts, styleStatements, node, moduleFile, cmp);
  53322. }
  53323. }
  53324. return t.visitEachChild(node, visitNode, transformCtx);
  53325. };
  53326. tsSourceFile = t.visitEachChild(tsSourceFile, visitNode, transformCtx);
  53327. if (moduleFile.cmps.length > 0) {
  53328. tsSourceFile = updateStyleImports(transformOpts, tsSourceFile, moduleFile);
  53329. }
  53330. if (moduleFile.isLegacy) {
  53331. addLegacyApis(moduleFile);
  53332. }
  53333. tsSourceFile = addImports(transformOpts, tsSourceFile, moduleFile.coreRuntimeApis, transformOpts.coreImportPath);
  53334. if (styleStatements.length > 0) {
  53335. tsSourceFile = t.updateSourceFileNode(tsSourceFile, [...tsSourceFile.statements, ...styleStatements]);
  53336. }
  53337. return tsSourceFile;
  53338. };
  53339. };
  53340. };
  53341. /**
  53342. * Generate rollup output based on a rollup build and a series of options.
  53343. *
  53344. * @param build a rollup build
  53345. * @param options output options for rollup
  53346. * @param config a user-supplied configuration object
  53347. * @param entryModules a list of entry modules, for checking which chunks
  53348. * contain components
  53349. * @returns a Promise wrapping either build results or `null`
  53350. */
  53351. const generateRollupOutput = async (build, options, config, entryModules) => {
  53352. if (build == null) {
  53353. return null;
  53354. }
  53355. const { output } = await build.generate(options);
  53356. return output.map((chunk) => {
  53357. if (chunk.type === 'chunk') {
  53358. const isCore = Object.keys(chunk.modules).some((m) => m.includes(STENCIL_CORE_ID));
  53359. return {
  53360. type: 'chunk',
  53361. fileName: chunk.fileName,
  53362. map: chunk.map,
  53363. code: chunk.code,
  53364. moduleFormat: options.format,
  53365. entryKey: chunk.name,
  53366. imports: chunk.imports,
  53367. isEntry: !!chunk.isEntry,
  53368. isComponent: !!chunk.isEntry && entryModules.some((m) => m.entryKey === chunk.name),
  53369. isBrowserLoader: chunk.isEntry && chunk.name === config.fsNamespace,
  53370. isIndex: chunk.isEntry && chunk.name === 'index',
  53371. isCore,
  53372. };
  53373. }
  53374. else {
  53375. return {
  53376. type: 'asset',
  53377. fileName: chunk.fileName,
  53378. content: chunk.source,
  53379. };
  53380. }
  53381. });
  53382. };
  53383. const writeLazyModule = async (config, compilerCtx, outputTargetType, destinations, entryModule, shouldHash, code, sourceMap, sufix) => {
  53384. // code = replaceStylePlaceholders(entryModule.cmps, modeName, code);
  53385. const bundleId = await getBundleId(config, entryModule.entryKey, shouldHash, code, sufix);
  53386. const fileName = `${bundleId}.entry.js`;
  53387. if (sourceMap) {
  53388. code = code + getSourceMappingUrlForEndOfFile(fileName);
  53389. }
  53390. await Promise.all(destinations.map((dst) => {
  53391. compilerCtx.fs.writeFile(join(dst, fileName), code, { outputTargetType });
  53392. if (!!sourceMap) {
  53393. compilerCtx.fs.writeFile(join(dst, fileName) + '.map', JSON.stringify(sourceMap), { outputTargetType });
  53394. }
  53395. }));
  53396. return {
  53397. bundleId,
  53398. fileName,
  53399. code,
  53400. };
  53401. };
  53402. const getBundleId = async (config, entryKey, shouldHash, code, sufix) => {
  53403. if (shouldHash) {
  53404. const hash = await config.sys.generateContentHash(code, config.hashedFileNameLength);
  53405. return `p-${hash}${sufix}`;
  53406. }
  53407. const components = entryKey.split('.');
  53408. let bundleId = components[0];
  53409. if (components.length > 2) {
  53410. bundleId = `${bundleId}_${components.length - 1}`;
  53411. }
  53412. return bundleId + sufix;
  53413. };
  53414. const generateLazyModules = async (config, compilerCtx, buildCtx, outputTargetType, destinations, results, sourceTarget, isBrowserBuild, sufix) => {
  53415. var _a;
  53416. if (!Array.isArray(destinations) || destinations.length === 0) {
  53417. return [];
  53418. }
  53419. const shouldMinify = config.minifyJs && isBrowserBuild;
  53420. const rollupResults = results.filter((r) => r.type === 'chunk');
  53421. const entryComponentsResults = rollupResults.filter((rollupResult) => rollupResult.isComponent);
  53422. const chunkResults = rollupResults.filter((rollupResult) => !rollupResult.isComponent && !rollupResult.isEntry);
  53423. const bundleModules = await Promise.all(entryComponentsResults.map((rollupResult) => {
  53424. return generateLazyEntryModule(config, compilerCtx, buildCtx, rollupResult, outputTargetType, destinations, sourceTarget, shouldMinify, isBrowserBuild, sufix);
  53425. }));
  53426. if (!!((_a = config.extras) === null || _a === void 0 ? void 0 : _a.experimentalImportInjection) && !isBrowserBuild) {
  53427. addStaticImports(rollupResults, bundleModules);
  53428. }
  53429. await Promise.all(chunkResults.map((rollupResult) => {
  53430. return writeLazyChunk(config, compilerCtx, buildCtx, rollupResult, outputTargetType, destinations, sourceTarget, shouldMinify, isBrowserBuild);
  53431. }));
  53432. const lazyRuntimeData = formatLazyBundlesRuntimeMeta(bundleModules);
  53433. const entryResults = rollupResults.filter((rollupResult) => !rollupResult.isComponent && rollupResult.isEntry);
  53434. await Promise.all(entryResults.map((rollupResult) => {
  53435. return writeLazyEntry(config, compilerCtx, buildCtx, rollupResult, outputTargetType, destinations, lazyRuntimeData, sourceTarget, shouldMinify, isBrowserBuild);
  53436. }));
  53437. await Promise.all(results
  53438. .filter((r) => r.type === 'asset')
  53439. .map((r) => {
  53440. return Promise.all(destinations.map((dest) => {
  53441. return compilerCtx.fs.writeFile(join(dest, r.fileName), r.content);
  53442. }));
  53443. }));
  53444. return bundleModules;
  53445. };
  53446. /**
  53447. * Add imports for each bundle to Stencil's lazy loader. Some bundlers that are built atop of Rollup strictly impose
  53448. * the limitations that are laid out in https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations.
  53449. * This function injects an explicit import statement for each bundle that can be lazily loaded.
  53450. * @param rollupChunkResults the results of running Rollup across a Stencil project
  53451. * @param bundleModules lazy-loadable modules that can be resolved at runtime
  53452. */
  53453. const addStaticImports = (rollupChunkResults, bundleModules) => {
  53454. rollupChunkResults.filter(isStencilCoreResult).forEach((index) => {
  53455. const generateCjs = isCjsFormat(index) ? generateCaseClauseCjs : generateCaseClause;
  53456. index.code = index.code.replace('/*!__STENCIL_STATIC_IMPORT_SWITCH__*/', `
  53457. if (!hmrVersionId || !BUILD.hotModuleReplacement) {
  53458. const processMod = importedModule => {
  53459. cmpModules.set(bundleId, importedModule);
  53460. return importedModule[exportName];
  53461. }
  53462. switch(bundleId) {
  53463. ${bundleModules.map((mod) => generateCjs(mod.output.bundleId)).join('')}
  53464. }
  53465. }`);
  53466. });
  53467. };
  53468. /**
  53469. * Determine if a Rollup output chunk contains Stencil runtime code
  53470. * @param rollupChunkResult the rollup chunk output to test
  53471. * @returns true if the output chunk contains Stencil runtime code, false otherwise
  53472. */
  53473. const isStencilCoreResult = (rollupChunkResult) => {
  53474. return (rollupChunkResult.isCore &&
  53475. rollupChunkResult.entryKey === 'index' &&
  53476. (rollupChunkResult.moduleFormat === 'es' ||
  53477. rollupChunkResult.moduleFormat === 'esm' ||
  53478. isCjsFormat(rollupChunkResult)));
  53479. };
  53480. /**
  53481. * Helper function to determine if a Rollup chunk has a commonjs module format
  53482. * @param rollupChunkResult the Rollup result to test
  53483. * @returns true if the Rollup chunk has a commonjs module format, false otherwise
  53484. */
  53485. const isCjsFormat = (rollupChunkResult) => {
  53486. return rollupChunkResult.moduleFormat === 'cjs' || rollupChunkResult.moduleFormat === 'commonjs';
  53487. };
  53488. /**
  53489. * Generate a 'case' clause to be used within a `switch` statement. The case clause generated will key-off the provided
  53490. * bundle ID for a component, and load a file (tied to that ID) at runtime.
  53491. * @param bundleId the name of the bundle to load
  53492. * @returns the case clause that will load the component's file at runtime
  53493. */
  53494. const generateCaseClause = (bundleId) => {
  53495. return `
  53496. case '${bundleId}':
  53497. return import(
  53498. /* webpackMode: "lazy" */
  53499. './${bundleId}.entry.js').then(processMod, consoleError);`;
  53500. };
  53501. /**
  53502. * Generate a 'case' clause to be used within a `switch` statement. The case clause generated will key-off the provided
  53503. * bundle ID for a component, and load a CommonJS file (tied to that ID) at runtime.
  53504. * @param bundleId the name of the bundle to load
  53505. * @returns the case clause that will load the component's file at runtime
  53506. */
  53507. const generateCaseClauseCjs = (bundleId) => {
  53508. return `
  53509. case '${bundleId}':
  53510. return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
  53511. /* webpackMode: "lazy" */
  53512. './${bundleId}.entry.js')); }).then(processMod, consoleError);`;
  53513. };
  53514. const generateLazyEntryModule = async (config, compilerCtx, buildCtx, rollupResult, outputTargetType, destinations, sourceTarget, shouldMinify, isBrowserBuild, sufix) => {
  53515. const entryModule = buildCtx.entryModules.find((entryModule) => entryModule.entryKey === rollupResult.entryKey);
  53516. const shouldHash = config.hashFileNames && isBrowserBuild;
  53517. const { code, sourceMap } = await convertChunk(config, compilerCtx, buildCtx, sourceTarget, shouldMinify, false, isBrowserBuild, rollupResult.code, rollupResult.map);
  53518. const output = await writeLazyModule(config, compilerCtx, outputTargetType, destinations, entryModule, shouldHash, code, sourceMap, sufix);
  53519. return {
  53520. rollupResult,
  53521. entryKey: rollupResult.entryKey,
  53522. cmps: entryModule.cmps,
  53523. output,
  53524. };
  53525. };
  53526. const writeLazyChunk = async (config, compilerCtx, buildCtx, rollupResult, outputTargetType, destinations, sourceTarget, shouldMinify, isBrowserBuild) => {
  53527. const { code, sourceMap } = await convertChunk(config, compilerCtx, buildCtx, sourceTarget, shouldMinify, rollupResult.isCore, isBrowserBuild, rollupResult.code, rollupResult.map);
  53528. await Promise.all(destinations.map((dst) => {
  53529. const filePath = join(dst, rollupResult.fileName);
  53530. let fileCode = code;
  53531. if (rollupResult.map) {
  53532. fileCode = code + getSourceMappingUrlForEndOfFile(rollupResult.fileName);
  53533. compilerCtx.fs.writeFile(filePath + '.map', JSON.stringify(sourceMap), { outputTargetType });
  53534. }
  53535. compilerCtx.fs.writeFile(filePath, fileCode, { outputTargetType });
  53536. }));
  53537. };
  53538. const writeLazyEntry = async (config, compilerCtx, buildCtx, rollupResult, outputTargetType, destinations, lazyRuntimeData, sourceTarget, shouldMinify, isBrowserBuild) => {
  53539. if (isBrowserBuild && ['loader'].includes(rollupResult.entryKey)) {
  53540. return;
  53541. }
  53542. const inputCode = rollupResult.code.replace(`[/*!__STENCIL_LAZY_DATA__*/]`, `${lazyRuntimeData}`);
  53543. const { code, sourceMap } = await convertChunk(config, compilerCtx, buildCtx, sourceTarget, shouldMinify, false, isBrowserBuild, inputCode, rollupResult.map);
  53544. await Promise.all(destinations.map((dst) => {
  53545. const filePath = join(dst, rollupResult.fileName);
  53546. let fileCode = code;
  53547. if (sourceMap) {
  53548. fileCode = code + getSourceMappingUrlForEndOfFile(rollupResult.fileName);
  53549. compilerCtx.fs.writeFile(filePath + '.map', JSON.stringify(sourceMap), { outputTargetType });
  53550. }
  53551. return compilerCtx.fs.writeFile(filePath, fileCode, { outputTargetType });
  53552. }));
  53553. };
  53554. const formatLazyBundlesRuntimeMeta = (bundleModules) => {
  53555. const sortedBundles = bundleModules.slice().sort(sortBundleModules);
  53556. const lazyBundles = sortedBundles.map(formatLazyRuntimeBundle);
  53557. return stringifyRuntimeData(lazyBundles);
  53558. };
  53559. const formatLazyRuntimeBundle = (bundleModule) => {
  53560. const bundleId = bundleModule.output.bundleId;
  53561. const bundleCmps = bundleModule.cmps.slice().sort(sortBundleComponents);
  53562. return [bundleId, bundleCmps.map((cmp) => formatComponentRuntimeMeta(cmp, true))];
  53563. };
  53564. const sortBundleModules = (a, b) => {
  53565. const aDependents = a.cmps.reduce((dependents, cmp) => {
  53566. dependents.push(...cmp.dependents);
  53567. return dependents;
  53568. }, []);
  53569. const bDependents = b.cmps.reduce((dependents, cmp) => {
  53570. dependents.push(...cmp.dependents);
  53571. return dependents;
  53572. }, []);
  53573. if (a.cmps.some((cmp) => bDependents.includes(cmp.tagName)))
  53574. return 1;
  53575. if (b.cmps.some((cmp) => aDependents.includes(cmp.tagName)))
  53576. return -1;
  53577. const aDependencies = a.cmps.reduce((dependencies, cmp) => {
  53578. dependencies.push(...cmp.dependencies);
  53579. return dependencies;
  53580. }, []);
  53581. const bDependencies = b.cmps.reduce((dependencies, cmp) => {
  53582. dependencies.push(...cmp.dependencies);
  53583. return dependencies;
  53584. }, []);
  53585. if (a.cmps.some((cmp) => bDependencies.includes(cmp.tagName)))
  53586. return -1;
  53587. if (b.cmps.some((cmp) => aDependencies.includes(cmp.tagName)))
  53588. return 1;
  53589. if (aDependents.length < bDependents.length)
  53590. return -1;
  53591. if (aDependents.length > bDependents.length)
  53592. return 1;
  53593. if (aDependencies.length > bDependencies.length)
  53594. return -1;
  53595. if (aDependencies.length < bDependencies.length)
  53596. return 1;
  53597. const aTags = a.cmps.map((cmp) => cmp.tagName);
  53598. const bTags = b.cmps.map((cmp) => cmp.tagName);
  53599. if (aTags.length > bTags.length)
  53600. return -1;
  53601. if (aTags.length < bTags.length)
  53602. return 1;
  53603. const aTagsStr = aTags.sort().join('.');
  53604. const bTagsStr = bTags.sort().join('.');
  53605. if (aTagsStr < bTagsStr)
  53606. return -1;
  53607. if (aTagsStr > bTagsStr)
  53608. return 1;
  53609. return 0;
  53610. };
  53611. const sortBundleComponents = (a, b) => {
  53612. // <cmp-a>
  53613. // <cmp-b>
  53614. // <cmp-c></cmp-c>
  53615. // </cmp-b>
  53616. // </cmp-a>
  53617. // cmp-c is a dependency of cmp-a and cmp-b
  53618. // cmp-c is a directDependency of cmp-b
  53619. // cmp-a is a dependant of cmp-b and cmp-c
  53620. // cmp-a is a directDependant of cmp-b
  53621. if (a.directDependents.includes(b.tagName))
  53622. return 1;
  53623. if (b.directDependents.includes(a.tagName))
  53624. return -1;
  53625. if (a.directDependencies.includes(b.tagName))
  53626. return 1;
  53627. if (b.directDependencies.includes(a.tagName))
  53628. return -1;
  53629. if (a.dependents.includes(b.tagName))
  53630. return 1;
  53631. if (b.dependents.includes(a.tagName))
  53632. return -1;
  53633. if (a.dependencies.includes(b.tagName))
  53634. return 1;
  53635. if (b.dependencies.includes(a.tagName))
  53636. return -1;
  53637. if (a.dependents.length < b.dependents.length)
  53638. return -1;
  53639. if (a.dependents.length > b.dependents.length)
  53640. return 1;
  53641. if (a.dependencies.length > b.dependencies.length)
  53642. return -1;
  53643. if (a.dependencies.length < b.dependencies.length)
  53644. return 1;
  53645. if (a.tagName < b.tagName)
  53646. return -1;
  53647. if (a.tagName > b.tagName)
  53648. return 1;
  53649. return 0;
  53650. };
  53651. const convertChunk = async (config, compilerCtx, buildCtx, sourceTarget, shouldMinify, isCore, isBrowserBuild, code, rollupSrcMap) => {
  53652. let sourceMap = rollupToStencilSourceMap(rollupSrcMap);
  53653. const inlineHelpers = isBrowserBuild || !hasDependency(buildCtx, 'tslib');
  53654. const optimizeResults = await optimizeModule(config, compilerCtx, {
  53655. input: code,
  53656. sourceMap: sourceMap,
  53657. isCore,
  53658. sourceTarget,
  53659. inlineHelpers,
  53660. minify: shouldMinify,
  53661. });
  53662. buildCtx.diagnostics.push(...optimizeResults.diagnostics);
  53663. if (typeof optimizeResults.output === 'string') {
  53664. code = optimizeResults.output;
  53665. sourceMap = optimizeResults.sourceMap;
  53666. }
  53667. return { code, sourceMap };
  53668. };
  53669. const generateCjs = async (config, compilerCtx, buildCtx, rollupBuild, outputTargets) => {
  53670. const cjsOutputs = outputTargets.filter((o) => !!o.cjsDir);
  53671. if (cjsOutputs.length > 0) {
  53672. const outputTargetType = cjsOutputs[0].type;
  53673. const esmOpts = {
  53674. banner: generatePreamble(config),
  53675. format: 'cjs',
  53676. entryFileNames: '[name].cjs.js',
  53677. assetFileNames: '[name]-[hash][extname]',
  53678. preferConst: true,
  53679. sourcemap: config.sourceMap,
  53680. };
  53681. const results = await generateRollupOutput(rollupBuild, esmOpts, config, buildCtx.entryModules);
  53682. if (results != null) {
  53683. const destinations = cjsOutputs.map((o) => o.cjsDir);
  53684. buildCtx.commonJsComponentBundle = await generateLazyModules(config, compilerCtx, buildCtx, outputTargetType, destinations, results, 'es2017', false, '.cjs');
  53685. await generateShortcuts$1(compilerCtx, results, cjsOutputs);
  53686. }
  53687. }
  53688. return { name: 'cjs', buildCtx };
  53689. };
  53690. const generateShortcuts$1 = (compilerCtx, rollupResult, outputTargets) => {
  53691. const indexFilename = rollupResult.find((r) => r.type === 'chunk' && r.isIndex).fileName;
  53692. return Promise.all(outputTargets.map(async (o) => {
  53693. if (o.cjsIndexFile) {
  53694. const entryPointPath = join(o.cjsDir, indexFilename);
  53695. const relativePath = relativeImport(o.cjsIndexFile, entryPointPath);
  53696. const shortcutContent = `module.exports = require('${relativePath}');\n`;
  53697. await compilerCtx.fs.writeFile(o.cjsIndexFile, shortcutContent, { outputTargetType: o.type });
  53698. }
  53699. }));
  53700. };
  53701. const generateEsm = async (config, compilerCtx, buildCtx, rollupBuild, outputTargets) => {
  53702. const esmEs5Outputs = config.buildEs5 ? outputTargets.filter((o) => !!o.esmEs5Dir && !o.isBrowserBuild) : [];
  53703. const esmOutputs = outputTargets.filter((o) => !!o.esmDir && !o.isBrowserBuild);
  53704. if (esmOutputs.length + esmEs5Outputs.length > 0) {
  53705. const esmOpts = {
  53706. banner: generatePreamble(config),
  53707. format: 'es',
  53708. entryFileNames: '[name].js',
  53709. assetFileNames: '[name]-[hash][extname]',
  53710. preferConst: true,
  53711. sourcemap: config.sourceMap,
  53712. };
  53713. const outputTargetType = esmOutputs[0].type;
  53714. const output = await generateRollupOutput(rollupBuild, esmOpts, config, buildCtx.entryModules);
  53715. if (output != null) {
  53716. const es2017destinations = esmOutputs.map((o) => o.esmDir);
  53717. buildCtx.esmComponentBundle = await generateLazyModules(config, compilerCtx, buildCtx, outputTargetType, es2017destinations, output, 'es2017', false, '');
  53718. const es5destinations = esmEs5Outputs.map((o) => o.esmEs5Dir);
  53719. buildCtx.es5ComponentBundle = await generateLazyModules(config, compilerCtx, buildCtx, outputTargetType, es5destinations, output, 'es5', false, '');
  53720. await copyPolyfills(config, compilerCtx, esmOutputs);
  53721. await generateShortcuts(config, compilerCtx, outputTargets, output);
  53722. }
  53723. }
  53724. return { name: 'esm', buildCtx };
  53725. };
  53726. const copyPolyfills = async (config, compilerCtx, outputTargets) => {
  53727. const destinations = outputTargets.filter((o) => o.polyfills).map((o) => o.esmDir);
  53728. if (destinations.length === 0) {
  53729. return;
  53730. }
  53731. const src = join(config.sys.getCompilerExecutingPath(), '..', '..', 'internal', 'client', 'polyfills');
  53732. const files = await compilerCtx.fs.readdir(src);
  53733. await Promise.all(destinations.map((dest) => {
  53734. return Promise.all(files.map((f) => {
  53735. return compilerCtx.fs.copyFile(f.absPath, join(dest, 'polyfills', f.relPath));
  53736. }));
  53737. }));
  53738. };
  53739. const generateShortcuts = (config, compilerCtx, outputTargets, rollupResult) => {
  53740. const indexFilename = rollupResult.find((r) => r.type === 'chunk' && r.isIndex).fileName;
  53741. return Promise.all(outputTargets.map(async (o) => {
  53742. if (o.esmDir && o.esmIndexFile) {
  53743. const entryPointPath = config.buildEs5 && o.esmEs5Dir ? join(o.esmEs5Dir, indexFilename) : join(o.esmDir, indexFilename);
  53744. const relativePath = relativeImport(o.esmIndexFile, entryPointPath);
  53745. const shortcutContent = `export * from '${relativePath}';`;
  53746. await compilerCtx.fs.writeFile(o.esmIndexFile, shortcutContent, { outputTargetType: o.type });
  53747. }
  53748. }));
  53749. };
  53750. const generateEsmBrowser = async (config, compilerCtx, buildCtx, rollupBuild, outputTargets) => {
  53751. const esmOutputs = outputTargets.filter((o) => !!o.esmDir && !!o.isBrowserBuild);
  53752. if (esmOutputs.length) {
  53753. const outputTargetType = esmOutputs[0].type;
  53754. const esmOpts = {
  53755. banner: generatePreamble(config),
  53756. format: 'es',
  53757. entryFileNames: '[name].esm.js',
  53758. chunkFileNames: config.hashFileNames ? 'p-[hash].js' : '[name]-[hash].js',
  53759. assetFileNames: config.hashFileNames ? 'p-[hash][extname]' : '[name]-[hash][extname]',
  53760. preferConst: true,
  53761. sourcemap: config.sourceMap,
  53762. };
  53763. if (config.extras.dynamicImportShim) {
  53764. // for Edge 16-18
  53765. esmOpts.dynamicImportFunction = getDynamicImportFunction$1(config.fsNamespace);
  53766. }
  53767. const output = await generateRollupOutput(rollupBuild, esmOpts, config, buildCtx.entryModules);
  53768. if (output != null) {
  53769. const es2017destinations = esmOutputs.map((o) => o.esmDir);
  53770. buildCtx.esmBrowserComponentBundle = await generateLazyModules(config, compilerCtx, buildCtx, outputTargetType, es2017destinations, output, 'es2017', true, '');
  53771. }
  53772. }
  53773. return { name: 'esm-browser', buildCtx };
  53774. };
  53775. const getClientPolyfill = async (config, compilerCtx, polyfillFile) => {
  53776. const polyfillFilePath = join(config.sys.getCompilerExecutingPath(), '..', '..', 'internal', 'client', 'polyfills', polyfillFile);
  53777. return compilerCtx.fs.readFile(polyfillFilePath);
  53778. };
  53779. const getAppBrowserCorePolyfills = async (config, compilerCtx) => {
  53780. // read all the polyfill content, in this particular order
  53781. const polyfills = INLINE_POLYFILLS.slice();
  53782. if (config.extras.cssVarsShim) {
  53783. polyfills.push(INLINE_CSS_SHIM);
  53784. }
  53785. const results = await Promise.all(polyfills.map((polyfillFile) => getClientPolyfill(config, compilerCtx, polyfillFile)));
  53786. // concat the polyfills
  53787. return results.join('\n').trim();
  53788. };
  53789. // order of the polyfills matters!! test test test
  53790. // actual source of the polyfills are found in /src/client/polyfills/
  53791. const INLINE_POLYFILLS = ['core-js.js', 'dom.js', 'es5-html-element.js', 'system.js'];
  53792. const INLINE_CSS_SHIM = 'css-shim.js';
  53793. const generateSystem = async (config, compilerCtx, buildCtx, rollupBuild, outputTargets) => {
  53794. const systemOutputs = outputTargets.filter((o) => !!o.systemDir);
  53795. if (systemOutputs.length > 0) {
  53796. const esmOpts = {
  53797. banner: generatePreamble(config),
  53798. format: 'system',
  53799. entryFileNames: config.hashFileNames ? 'p-[hash].system.js' : '[name].system.js',
  53800. chunkFileNames: config.hashFileNames ? 'p-[hash].system.js' : '[name]-[hash].system.js',
  53801. assetFileNames: config.hashFileNames ? 'p-[hash][extname]' : '[name]-[hash][extname]',
  53802. preferConst: true,
  53803. sourcemap: config.sourceMap,
  53804. };
  53805. const results = await generateRollupOutput(rollupBuild, esmOpts, config, buildCtx.entryModules);
  53806. if (results != null) {
  53807. const destinations = systemOutputs.map((o) => o.esmDir);
  53808. buildCtx.systemComponentBundle = await generateLazyModules(config, compilerCtx, buildCtx, outputTargets[0].type, destinations, results, 'es5', true, '.system');
  53809. await generateSystemLoaders(config, compilerCtx, results, systemOutputs);
  53810. }
  53811. }
  53812. return { name: 'system', buildCtx };
  53813. };
  53814. const generateSystemLoaders = (config, compilerCtx, rollupResult, systemOutputs) => {
  53815. const loaderFilename = rollupResult.find((r) => r.type === 'chunk' && r.isBrowserLoader).fileName;
  53816. return Promise.all(systemOutputs.map((o) => writeSystemLoader(config, compilerCtx, loaderFilename, o)));
  53817. };
  53818. const writeSystemLoader = async (config, compilerCtx, loaderFilename, outputTarget) => {
  53819. if (outputTarget.systemLoaderFile) {
  53820. const entryPointPath = join(outputTarget.systemDir, loaderFilename);
  53821. const relativePath = relativeImport(outputTarget.systemLoaderFile, entryPointPath);
  53822. const loaderContent = await getSystemLoader(config, compilerCtx, relativePath, outputTarget.polyfills);
  53823. await compilerCtx.fs.writeFile(outputTarget.systemLoaderFile, loaderContent, {
  53824. outputTargetType: outputTarget.type,
  53825. });
  53826. }
  53827. };
  53828. const getSystemLoader = async (config, compilerCtx, corePath, includePolyfills) => {
  53829. const polyfills = includePolyfills
  53830. ? await getAppBrowserCorePolyfills(config, compilerCtx)
  53831. : '/* polyfills excluded */';
  53832. return `
  53833. 'use strict';
  53834. (function () {
  53835. var currentScript = document.currentScript;
  53836. // Safari 10 support type="module" but still download and executes the nomodule script
  53837. if (!currentScript || !currentScript.hasAttribute('nomodule') || !('onbeforeload' in currentScript)) {
  53838. ${polyfills}
  53839. // Figure out currentScript (for IE11, since it does not support currentScript)
  53840. var regex = /\\/${config.fsNamespace}(\\.esm)?\\.js($|\\?|#)/;
  53841. var scriptElm = currentScript || Array.from(document.querySelectorAll('script')).find(function(s) {
  53842. return regex.test(s.src) || s.getAttribute('data-stencil-namespace') === "${config.fsNamespace}";
  53843. });
  53844. var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : '';
  53845. var start = function() {
  53846. // if src is not present then origin is "null", and new URL() throws TypeError: Failed to construct 'URL': Invalid base URL
  53847. var url = new URL('${corePath}', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
  53848. System.import(url.href);
  53849. };
  53850. if (window.__cssshim) {
  53851. window.__cssshim.i().then(start);
  53852. } else {
  53853. start();
  53854. }
  53855. // Note: using .call(window) here because the self-executing function needs
  53856. // to be scoped to the window object for the ES6Promise polyfill to work
  53857. }
  53858. }).call(window);
  53859. `;
  53860. };
  53861. const getLazyBuildConditionals = (config, cmps) => {
  53862. const build = getBuildFeatures(cmps);
  53863. build.lazyLoad = true;
  53864. build.hydrateServerSide = false;
  53865. build.cssVarShim = config.extras.cssVarsShim;
  53866. build.transformTagName = config.extras.tagNameTransform;
  53867. build.asyncQueue = config.taskQueue === 'congestionAsync';
  53868. build.taskQueue = config.taskQueue !== 'immediate';
  53869. build.initializeNextTick = config.extras.initializeNextTick;
  53870. const hasHydrateOutputTargets = config.outputTargets.some(isOutputTargetHydrate);
  53871. build.hydrateClientSide = hasHydrateOutputTargets;
  53872. updateBuildConditionals(config, build);
  53873. return build;
  53874. };
  53875. const outputLazy = async (config, compilerCtx, buildCtx) => {
  53876. const outputTargets = config.outputTargets.filter(isOutputTargetDistLazy);
  53877. if (outputTargets.length === 0) {
  53878. return;
  53879. }
  53880. const bundleEventMessage = `generate lazy${config.sourceMap ? ' + source maps' : ''}`;
  53881. const timespan = buildCtx.createTimeSpan(`${bundleEventMessage} started`);
  53882. try {
  53883. const bundleOpts = {
  53884. id: 'lazy',
  53885. platform: 'client',
  53886. conditionals: getLazyBuildConditionals(config, buildCtx.components),
  53887. customTransformers: getLazyCustomTransformer(config, compilerCtx),
  53888. inlineWorkers: config.outputTargets.some(isOutputTargetDist),
  53889. inputs: {
  53890. [config.fsNamespace]: LAZY_BROWSER_ENTRY_ID,
  53891. loader: LAZY_EXTERNAL_ENTRY_ID,
  53892. index: USER_INDEX_ENTRY_ID,
  53893. },
  53894. loader: {
  53895. [LAZY_EXTERNAL_ENTRY_ID]: getLazyEntry(false),
  53896. [LAZY_BROWSER_ENTRY_ID]: getLazyEntry(true),
  53897. },
  53898. };
  53899. // we've got the compiler context filled with app modules and collection dependency modules
  53900. // figure out how all these components should be connected
  53901. generateEntryModules(config, buildCtx);
  53902. buildCtx.entryModules.forEach((entryModule) => {
  53903. bundleOpts.inputs[entryModule.entryKey] = entryModule.entryKey;
  53904. });
  53905. const rollupBuild = await bundleOutput(config, compilerCtx, buildCtx, bundleOpts);
  53906. if (rollupBuild != null) {
  53907. const results = await Promise.all([
  53908. generateEsmBrowser(config, compilerCtx, buildCtx, rollupBuild, outputTargets),
  53909. generateEsm(config, compilerCtx, buildCtx, rollupBuild, outputTargets),
  53910. generateSystem(config, compilerCtx, buildCtx, rollupBuild, outputTargets),
  53911. generateCjs(config, compilerCtx, buildCtx, rollupBuild, outputTargets),
  53912. ]);
  53913. results.forEach((result) => {
  53914. if (result.name === 'cjs') {
  53915. buildCtx.commonJsComponentBundle = result.buildCtx.commonJsComponentBundle;
  53916. }
  53917. else if (result.name === 'system') {
  53918. buildCtx.systemComponentBundle = result.buildCtx.systemComponentBundle;
  53919. }
  53920. else if (result.name === 'esm') {
  53921. buildCtx.esmComponentBundle = result.buildCtx.esmComponentBundle;
  53922. buildCtx.es5ComponentBundle = result.buildCtx.es5ComponentBundle;
  53923. }
  53924. else if (result.name === 'esm-browser') {
  53925. buildCtx.esmBrowserComponentBundle = result.buildCtx.esmBrowserComponentBundle;
  53926. buildCtx.buildResults = result.buildCtx.buildResults;
  53927. buildCtx.components = result.buildCtx.components;
  53928. }
  53929. });
  53930. if (buildCtx.esmBrowserComponentBundle != null) {
  53931. buildCtx.componentGraph = generateModuleGraph(buildCtx.components, buildCtx.esmBrowserComponentBundle);
  53932. }
  53933. }
  53934. }
  53935. catch (e) {
  53936. catchError(buildCtx.diagnostics, e);
  53937. }
  53938. timespan.finish(`${bundleEventMessage} finished`);
  53939. };
  53940. const getLazyCustomTransformer = (config, compilerCtx) => {
  53941. const transformOpts = {
  53942. coreImportPath: STENCIL_CORE_ID,
  53943. componentExport: 'lazy',
  53944. componentMetadata: null,
  53945. currentDirectory: config.sys.getCurrentDirectory(),
  53946. proxy: null,
  53947. style: 'static',
  53948. styleImportData: 'queryparams',
  53949. };
  53950. return [
  53951. updateStencilCoreImports(transformOpts.coreImportPath),
  53952. lazyComponentTransform(compilerCtx, transformOpts),
  53953. removeCollectionImports(compilerCtx),
  53954. ];
  53955. };
  53956. /**
  53957. * Generate entry modules to be used by the build process by determining how modules and components are connected
  53958. * @param config the Stencil configuration file that was provided as a part of the build step
  53959. * @param buildCtx the current build context
  53960. */
  53961. function generateEntryModules(config, buildCtx) {
  53962. // figure out how modules and components connect
  53963. try {
  53964. const bundles = generateComponentBundles(config, buildCtx);
  53965. buildCtx.entryModules = bundles.map(createEntryModule);
  53966. }
  53967. catch (e) {
  53968. catchError(buildCtx.diagnostics, e);
  53969. }
  53970. buildCtx.debug(`generateEntryModules, ${buildCtx.entryModules.length} entryModules`);
  53971. }
  53972. /**
  53973. * Generates an entry module to be used during the bundling process
  53974. * @param cmps the component metadata to create a single entry module from
  53975. * @returns the entry module generated
  53976. */
  53977. function createEntryModule(cmps) {
  53978. // generate a unique entry key based on the components within this entry module
  53979. cmps = sortBy(cmps, (c) => c.tagName);
  53980. const entryKey = cmps.map((c) => c.tagName).join('.') + '.entry';
  53981. return {
  53982. cmps,
  53983. entryKey,
  53984. };
  53985. }
  53986. const getLazyEntry = (isBrowser) => {
  53987. const s = new MagicString$3(``);
  53988. s.append(`import { bootstrapLazy } from '${STENCIL_CORE_ID}';\n`);
  53989. if (isBrowser) {
  53990. s.append(`import { patchBrowser } from '${STENCIL_INTERNAL_CLIENT_PATCH_BROWSER_ID}';\n`);
  53991. s.append(`import { globalScripts } from '${STENCIL_APP_GLOBALS_ID}';\n`);
  53992. s.append(`patchBrowser().then(options => {\n`);
  53993. s.append(` globalScripts();\n`);
  53994. s.append(` return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n`);
  53995. s.append(`});\n`);
  53996. }
  53997. else {
  53998. s.append(`import { patchEsm } from '${STENCIL_INTERNAL_CLIENT_PATCH_ESM_ID}';\n`);
  53999. s.append(`import { globalScripts } from '${STENCIL_APP_GLOBALS_ID}';\n`);
  54000. s.append(`export const defineCustomElements = (win, options) => {\n`);
  54001. s.append(` if (typeof window === 'undefined') return Promise.resolve();\n`);
  54002. s.append(` return patchEsm().then(() => {\n`);
  54003. s.append(` globalScripts();\n`);
  54004. s.append(` return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n`);
  54005. s.append(` });\n`);
  54006. s.append(`};\n`);
  54007. }
  54008. return s.toString();
  54009. };
  54010. const outputAngular = async (config, compilerCtx, buildCtx) => {
  54011. if (!config.buildDist) {
  54012. return;
  54013. }
  54014. const angularOutputTargets = config.outputTargets.filter(isOutputTargetAngular);
  54015. if (angularOutputTargets.length === 0) {
  54016. return;
  54017. }
  54018. const timespan = buildCtx.createTimeSpan(`generate angular proxies started`, true);
  54019. await Promise.all(angularOutputTargets.map((outputTarget) => angularDirectiveProxyOutput(config, compilerCtx, buildCtx, outputTarget)));
  54020. timespan.finish(`generate angular proxies finished`);
  54021. };
  54022. const angularDirectiveProxyOutput = (config, compilerCtx, buildCtx, outputTarget) => {
  54023. const filteredComponents = getFilteredComponents(outputTarget.excludeComponents, buildCtx.components);
  54024. return Promise.all([
  54025. generateProxies(config, compilerCtx, buildCtx, filteredComponents, outputTarget),
  54026. generateAngularArray(compilerCtx, filteredComponents, outputTarget),
  54027. generateAngularUtils(compilerCtx, outputTarget),
  54028. ]);
  54029. };
  54030. const getFilteredComponents = (excludeComponents = [], cmps) => {
  54031. return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
  54032. };
  54033. const generateProxies = async (config, compilerCtx, buildCtx, components, outputTarget) => {
  54034. const proxies = getProxies(components);
  54035. const distTypesDir = dirname(buildCtx.packageJson.types);
  54036. const dtsFilePath = join(config.rootDir, distTypesDir, GENERATED_DTS);
  54037. const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
  54038. const imports = `/* eslint-disable */
  54039. /* tslint:disable */
  54040. /* auto-generated angular directive proxies */
  54041. import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, NgZone } from '@angular/core';`;
  54042. const sourceImports = !outputTarget.componentCorePackage
  54043. ? `import { Components } from '${componentsTypeFile}';`
  54044. : `import { Components } from '${outputTarget.componentCorePackage}';`;
  54045. const final = [imports, getProxyUtils(outputTarget), sourceImports, proxies];
  54046. const finalText = final.join('\n') + '\n';
  54047. const tsSourceFile = t.createSourceFile(GENERATED_DTS, finalText, t.ScriptTarget.Latest, false);
  54048. const tsPrinter = t.createPrinter({
  54049. newLine: t.NewLineKind.LineFeed,
  54050. });
  54051. const formattedCode = tsPrinter.printFile(tsSourceFile);
  54052. return compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, formattedCode);
  54053. };
  54054. const getProxies = (components) => {
  54055. return components.map(getProxy).join('\n');
  54056. };
  54057. const getProxyCmp = (inputs, methods) => {
  54058. const hasInputs = inputs.length > 0;
  54059. const hasMethods = methods.length > 0;
  54060. const proxMeta = [];
  54061. if (!hasInputs && !hasMethods) {
  54062. return '';
  54063. }
  54064. if (hasInputs)
  54065. proxMeta.push(`inputs: ['${inputs.join(`', '`)}']`);
  54066. if (hasMethods)
  54067. proxMeta.push(`'methods': ['${methods.join(`', '`)}']`);
  54068. return `@ProxyCmp({${proxMeta.join(', ')}})`;
  54069. };
  54070. const getProxy = (cmpMeta) => {
  54071. // Collect component meta
  54072. const inputs = getInputs(cmpMeta);
  54073. const outputs = getOutputs(cmpMeta);
  54074. const methods = getMethods(cmpMeta);
  54075. const hasOutputs = outputs.length > 0;
  54076. // Generate Angular @Directive
  54077. const directiveOpts = [
  54078. `selector: \'${cmpMeta.tagName}\'`,
  54079. `changeDetection: ChangeDetectionStrategy.OnPush`,
  54080. `template: '<ng-content></ng-content>'`,
  54081. ];
  54082. if (inputs.length > 0) {
  54083. directiveOpts.push(`inputs: ['${inputs.join(`', '`)}']`);
  54084. }
  54085. const tagNameAsPascal = dashToPascalCase$1(cmpMeta.tagName);
  54086. const lines = [
  54087. `
  54088. export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {}
  54089. ${getProxyCmp(inputs, methods)}
  54090. @Component({ ${directiveOpts.join(', ')} })
  54091. export class ${tagNameAsPascal} {`,
  54092. ];
  54093. // Generate outputs
  54094. outputs.forEach((output) => {
  54095. lines.push(` ${output}!: EventEmitter<CustomEvent>;`);
  54096. });
  54097. lines.push(' protected el: HTMLElement;');
  54098. lines.push(` constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
  54099. c.detach();
  54100. this.el = r.nativeElement;`);
  54101. if (hasOutputs) {
  54102. lines.push(` proxyOutputs(this, this.el, ['${outputs.join(`', '`)}']);`);
  54103. }
  54104. lines.push(` }`);
  54105. lines.push(`}`);
  54106. return lines.join('\n');
  54107. };
  54108. const getInputs = (cmpMeta) => {
  54109. return [
  54110. ...cmpMeta.properties.filter((prop) => !prop.internal).map((prop) => prop.name),
  54111. ...cmpMeta.virtualProperties.map((prop) => prop.name),
  54112. ].sort();
  54113. };
  54114. const getOutputs = (cmpMeta) => {
  54115. return cmpMeta.events.filter((ev) => !ev.internal).map((prop) => prop.name);
  54116. };
  54117. const getMethods = (cmpMeta) => {
  54118. return cmpMeta.methods.filter((method) => !method.internal).map((prop) => prop.name);
  54119. };
  54120. const getProxyUtils = (outputTarget) => {
  54121. if (!outputTarget.directivesUtilsFile) {
  54122. return PROXY_UTILS.replace(/export function/g, 'function');
  54123. }
  54124. else {
  54125. const utilsPath = relativeImport(outputTarget.directivesProxyFile, outputTarget.directivesUtilsFile, '.ts');
  54126. return `import { ProxyCmp, proxyOutputs } from '${utilsPath}';\n`;
  54127. }
  54128. };
  54129. const generateAngularArray = (compilerCtx, components, outputTarget) => {
  54130. if (!outputTarget.directivesArrayFile) {
  54131. return Promise.resolve();
  54132. }
  54133. const proxyPath = relativeImport(outputTarget.directivesArrayFile, outputTarget.directivesProxyFile, '.ts');
  54134. const directives = components
  54135. .map((cmpMeta) => dashToPascalCase$1(cmpMeta.tagName))
  54136. .map((className) => ` d.${className}`)
  54137. .join(',\n');
  54138. const c = `
  54139. import type * as d from '${proxyPath}';
  54140. export const DIRECTIVES = [
  54141. ${directives}
  54142. ];
  54143. `;
  54144. return compilerCtx.fs.writeFile(outputTarget.directivesArrayFile, c);
  54145. };
  54146. const generateAngularUtils = async (compilerCtx, outputTarget) => {
  54147. if (outputTarget.directivesUtilsFile) {
  54148. await compilerCtx.fs.writeFile(outputTarget.directivesUtilsFile, '/* eslint-disable */\n/* tslint:disable */\n' + PROXY_UTILS);
  54149. }
  54150. };
  54151. const PROXY_UTILS = `import { fromEvent } from 'rxjs';
  54152. export const proxyInputs = (Cmp: any, inputs: string[]) => {
  54153. const Prototype = Cmp.prototype;
  54154. inputs.forEach(item => {
  54155. Object.defineProperty(Prototype, item, {
  54156. get() {
  54157. return this.el[item];
  54158. },
  54159. set(val: any) {
  54160. this.z.runOutsideAngular(() => (this.el[item] = val));
  54161. }
  54162. });
  54163. });
  54164. };
  54165. export const proxyMethods = (Cmp: any, methods: string[]) => {
  54166. const Prototype = Cmp.prototype;
  54167. methods.forEach(methodName => {
  54168. Prototype[methodName] = function () {
  54169. const args = arguments;
  54170. return this.z.runOutsideAngular(() =>
  54171. this.el[methodName].apply(this.el, args)
  54172. );
  54173. };
  54174. });
  54175. };
  54176. export const proxyOutputs = (instance: any, el: any, events: string[]) => {
  54177. events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
  54178. }
  54179. export function ProxyCmp(opts: { inputs?: any; methods?: any }) {
  54180. const decorator = function(cls: any){
  54181. if (opts.inputs) {
  54182. proxyInputs(cls, opts.inputs);
  54183. }
  54184. if (opts.methods) {
  54185. proxyMethods(cls, opts.methods);
  54186. }
  54187. return cls;
  54188. };
  54189. return decorator;
  54190. }
  54191. `;
  54192. const GENERATED_DTS = 'components.d.ts';
  54193. const generateCustomDocs = async (config, docsData, outputTargets) => {
  54194. const customOutputTargets = outputTargets.filter(isOutputTargetDocsCustom);
  54195. if (customOutputTargets.length === 0) {
  54196. return;
  54197. }
  54198. await Promise.all(customOutputTargets.map(async (customOutput) => {
  54199. try {
  54200. await customOutput.generator(docsData, config);
  54201. }
  54202. catch (e) {
  54203. config.logger.error(`uncaught custom docs error: ${e}`);
  54204. }
  54205. }));
  54206. };
  54207. const AUTO_GENERATE_COMMENT = `<!-- Auto Generated Below -->`;
  54208. const NOTE = `*Built with [StencilJS](https://stenciljs.com/)*`;
  54209. const generateDocData = async (config, compilerCtx, buildCtx) => {
  54210. return {
  54211. timestamp: getBuildTimestamp(),
  54212. compiler: {
  54213. name: '@stencil/core',
  54214. version: version$3,
  54215. typescriptVersion,
  54216. },
  54217. components: await getDocsComponents(config, compilerCtx, buildCtx),
  54218. };
  54219. };
  54220. const getDocsComponents = async (config, compilerCtx, buildCtx) => {
  54221. const results = await Promise.all(buildCtx.moduleFiles.map(async (moduleFile) => {
  54222. const filePath = moduleFile.sourceFilePath;
  54223. const dirPath = normalizePath$1(dirname(filePath));
  54224. const readmePath = normalizePath$1(join(dirPath, 'readme.md'));
  54225. const usagesDir = normalizePath$1(join(dirPath, 'usage'));
  54226. const readme = await getUserReadmeContent(compilerCtx, readmePath);
  54227. const usage = await generateUsages(compilerCtx, usagesDir);
  54228. return moduleFile.cmps
  54229. .filter((cmp) => !cmp.internal && !cmp.isCollectionDependency)
  54230. .map((cmp) => ({
  54231. dirPath,
  54232. filePath: relative$1(config.rootDir, filePath),
  54233. fileName: basename(filePath),
  54234. readmePath,
  54235. usagesDir,
  54236. tag: cmp.tagName,
  54237. readme,
  54238. usage,
  54239. docs: generateDocs(readme, cmp.docs),
  54240. docsTags: cmp.docs.tags,
  54241. encapsulation: getDocsEncapsulation(cmp),
  54242. dependents: cmp.directDependents,
  54243. dependencies: cmp.directDependencies,
  54244. dependencyGraph: buildDocsDepGraph(cmp, buildCtx.components),
  54245. deprecation: getDocsDeprecationText(cmp.docs.tags),
  54246. props: getDocsProperties(cmp),
  54247. methods: getDocsMethods(cmp.methods),
  54248. events: getDocsEvents(cmp.events),
  54249. styles: getDocsStyles(cmp),
  54250. slots: getDocsSlots(cmp.docs.tags),
  54251. parts: getDocsParts(cmp.htmlParts, cmp.docs.tags),
  54252. listeners: getDocsListeners(cmp.listeners),
  54253. }));
  54254. }));
  54255. return sortBy(flatOne(results), (cmp) => cmp.tag);
  54256. };
  54257. const buildDocsDepGraph = (cmp, cmps) => {
  54258. const dependencies = {};
  54259. function walk(tagName) {
  54260. if (!dependencies[tagName]) {
  54261. const cmp = cmps.find((c) => c.tagName === tagName);
  54262. const deps = cmp.directDependencies;
  54263. if (deps.length > 0) {
  54264. dependencies[tagName] = deps;
  54265. deps.forEach(walk);
  54266. }
  54267. }
  54268. }
  54269. walk(cmp.tagName);
  54270. // load dependents
  54271. cmp.directDependents.forEach((tagName) => {
  54272. if (dependencies[tagName] && !dependencies[tagName].includes(cmp.tagName)) {
  54273. dependencies[tagName].push(cmp.tagName);
  54274. }
  54275. else {
  54276. dependencies[tagName] = [cmp.tagName];
  54277. }
  54278. });
  54279. return dependencies;
  54280. };
  54281. const getDocsEncapsulation = (cmp) => {
  54282. if (cmp.encapsulation === 'shadow') {
  54283. return 'shadow';
  54284. }
  54285. else if (cmp.encapsulation === 'scoped') {
  54286. return 'scoped';
  54287. }
  54288. else {
  54289. return 'none';
  54290. }
  54291. };
  54292. const getDocsProperties = (cmpMeta) => {
  54293. return sortBy([...getRealProperties(cmpMeta.properties), ...getVirtualProperties(cmpMeta.virtualProperties)], (p) => p.name);
  54294. };
  54295. const getRealProperties = (properties) => {
  54296. return properties
  54297. .filter((member) => !member.internal)
  54298. .map((member) => ({
  54299. name: member.name,
  54300. type: member.complexType.resolved,
  54301. mutable: member.mutable,
  54302. attr: member.attribute,
  54303. reflectToAttr: !!member.reflect,
  54304. docs: member.docs.text,
  54305. docsTags: member.docs.tags,
  54306. default: member.defaultValue,
  54307. deprecation: getDocsDeprecationText(member.docs.tags),
  54308. values: parseTypeIntoValues(member.complexType.resolved),
  54309. optional: member.optional,
  54310. required: member.required,
  54311. }));
  54312. };
  54313. const getVirtualProperties = (virtualProps) => {
  54314. return virtualProps.map((member) => ({
  54315. name: member.name,
  54316. type: member.type,
  54317. mutable: false,
  54318. attr: member.name,
  54319. reflectToAttr: false,
  54320. docs: member.docs,
  54321. docsTags: [],
  54322. default: undefined,
  54323. deprecation: undefined,
  54324. values: parseTypeIntoValues(member.type),
  54325. optional: true,
  54326. required: false,
  54327. }));
  54328. };
  54329. const parseTypeIntoValues = (type) => {
  54330. if (typeof type === 'string') {
  54331. const unions = type.split('|').map((u) => u.trim());
  54332. const parsedUnions = [];
  54333. unions.forEach((u) => {
  54334. if (u === 'true') {
  54335. parsedUnions.push({
  54336. value: 'true',
  54337. type: 'boolean',
  54338. });
  54339. return;
  54340. }
  54341. if (u === 'false') {
  54342. parsedUnions.push({
  54343. value: 'false',
  54344. type: 'boolean',
  54345. });
  54346. return;
  54347. }
  54348. if (!Number.isNaN(parseFloat(u))) {
  54349. // union is a number
  54350. parsedUnions.push({
  54351. value: u,
  54352. type: 'number',
  54353. });
  54354. return;
  54355. }
  54356. if (/^("|').+("|')$/gm.test(u)) {
  54357. // ionic is a string
  54358. parsedUnions.push({
  54359. value: u.slice(1, -1),
  54360. type: 'string',
  54361. });
  54362. return;
  54363. }
  54364. parsedUnions.push({
  54365. type: u,
  54366. });
  54367. });
  54368. return parsedUnions;
  54369. }
  54370. return [];
  54371. };
  54372. const getDocsMethods = (methods) => {
  54373. return sortBy(methods, (member) => member.name)
  54374. .filter((member) => !member.internal)
  54375. .map((member) => ({
  54376. name: member.name,
  54377. returns: {
  54378. type: member.complexType.return,
  54379. docs: member.docs.tags
  54380. .filter((t) => t.name === 'return' || t.name === 'returns')
  54381. .map((t) => t.text)
  54382. .join('\n'),
  54383. },
  54384. signature: `${member.name}${member.complexType.signature}`,
  54385. parameters: [],
  54386. docs: member.docs.text,
  54387. docsTags: member.docs.tags,
  54388. deprecation: getDocsDeprecationText(member.docs.tags),
  54389. }));
  54390. };
  54391. const getDocsEvents = (events) => {
  54392. return sortBy(events, (eventMeta) => eventMeta.name.toLowerCase())
  54393. .filter((eventMeta) => !eventMeta.internal)
  54394. .map((eventMeta) => ({
  54395. event: eventMeta.name,
  54396. detail: eventMeta.complexType.resolved,
  54397. bubbles: eventMeta.bubbles,
  54398. cancelable: eventMeta.cancelable,
  54399. composed: eventMeta.composed,
  54400. docs: eventMeta.docs.text,
  54401. docsTags: eventMeta.docs.tags,
  54402. deprecation: getDocsDeprecationText(eventMeta.docs.tags),
  54403. }));
  54404. };
  54405. const getDocsStyles = (cmpMeta) => {
  54406. if (!cmpMeta.styleDocs) {
  54407. return [];
  54408. }
  54409. return sortBy(cmpMeta.styleDocs, (o) => o.name.toLowerCase()).map((styleDoc) => {
  54410. return {
  54411. name: styleDoc.name,
  54412. annotation: styleDoc.annotation || '',
  54413. docs: styleDoc.docs || '',
  54414. };
  54415. });
  54416. };
  54417. const getDocsListeners = (listeners) => {
  54418. return listeners.map((listener) => ({
  54419. event: listener.name,
  54420. target: listener.target,
  54421. capture: listener.capture,
  54422. passive: listener.passive,
  54423. }));
  54424. };
  54425. const getDocsDeprecationText = (tags) => {
  54426. const deprecation = tags.find((t) => t.name === 'deprecated');
  54427. if (deprecation) {
  54428. return deprecation.text || '';
  54429. }
  54430. return undefined;
  54431. };
  54432. const getDocsSlots = (tags) => {
  54433. return sortBy(getNameText('slot', tags).map(([name, docs]) => ({ name, docs })), (a) => a.name);
  54434. };
  54435. const getDocsParts = (vdom, tags) => {
  54436. const docsParts = getNameText('part', tags).map(([name, docs]) => ({ name, docs }));
  54437. const vdomParts = vdom.map((name) => ({ name, docs: '' }));
  54438. return sortBy(unique([...docsParts, ...vdomParts], (p) => p.name), (p) => p.name);
  54439. };
  54440. const getNameText = (name, tags) => {
  54441. return tags
  54442. .filter((tag) => tag.name === name && tag.text)
  54443. .map(({ text }) => {
  54444. const [namePart, ...rest] = (' ' + text).split(' - ');
  54445. return [namePart.trim(), rest.join(' - ').trim()];
  54446. });
  54447. };
  54448. const getUserReadmeContent = async (compilerCtx, readmePath) => {
  54449. try {
  54450. const existingContent = await compilerCtx.fs.readFile(readmePath);
  54451. const userContentIndex = existingContent.indexOf(AUTO_GENERATE_COMMENT) - 1;
  54452. if (userContentIndex >= 0) {
  54453. return existingContent.substring(0, userContentIndex);
  54454. }
  54455. }
  54456. catch (e) { }
  54457. return undefined;
  54458. };
  54459. const generateDocs = (readme, jsdoc) => {
  54460. const docs = jsdoc.text;
  54461. if (docs !== '' || !readme) {
  54462. return docs;
  54463. }
  54464. let isContent = false;
  54465. const lines = readme.split('\n');
  54466. const contentLines = [];
  54467. for (const line of lines) {
  54468. const isHeader = line.startsWith('#');
  54469. if (isHeader && isContent) {
  54470. break;
  54471. }
  54472. if (!isHeader && !isContent) {
  54473. isContent = true;
  54474. }
  54475. if (isContent) {
  54476. contentLines.push(line);
  54477. }
  54478. }
  54479. return contentLines.join('\n').trim();
  54480. };
  54481. const generateUsages = async (compilerCtx, usagesDir) => {
  54482. const rtn = {};
  54483. try {
  54484. const usageFilePaths = await compilerCtx.fs.readdir(usagesDir);
  54485. const usages = {};
  54486. await Promise.all(usageFilePaths.map(async (f) => {
  54487. if (!f.isFile) {
  54488. return;
  54489. }
  54490. const fileName = basename(f.relPath);
  54491. if (!fileName.toLowerCase().endsWith('.md')) {
  54492. return;
  54493. }
  54494. const parts = fileName.split('.');
  54495. parts.pop();
  54496. const key = parts.join('.');
  54497. usages[key] = await compilerCtx.fs.readFile(f.absPath);
  54498. }));
  54499. Object.keys(usages)
  54500. .sort()
  54501. .forEach((key) => {
  54502. rtn[key] = usages[key];
  54503. });
  54504. }
  54505. catch (e) { }
  54506. return rtn;
  54507. };
  54508. const generateJsonDocs = async (config, compilerCtx, docsData, outputTargets) => {
  54509. const jsonOutputTargets = outputTargets.filter(isOutputTargetDocsJson);
  54510. if (jsonOutputTargets.length === 0) {
  54511. return;
  54512. }
  54513. const docsDtsPath = join(config.sys.getCompilerExecutingPath(), '..', '..', 'internal', 'stencil-public-docs.d.ts');
  54514. const docsDts = await compilerCtx.fs.readFile(docsDtsPath);
  54515. const typesContent = `
  54516. /**
  54517. * This is an autogenerated file created by the Stencil compiler.
  54518. * DO NOT MODIFY IT MANUALLY
  54519. */
  54520. ${docsDts}
  54521. declare const _default: JsonDocs;
  54522. export default _default;
  54523. `;
  54524. const json = {
  54525. ...docsData,
  54526. components: docsData.components.map((cmp) => ({
  54527. filePath: cmp.filePath,
  54528. encapsulation: cmp.encapsulation,
  54529. tag: cmp.tag,
  54530. readme: cmp.readme,
  54531. docs: cmp.docs,
  54532. docsTags: cmp.docsTags,
  54533. usage: cmp.usage,
  54534. props: cmp.props,
  54535. methods: cmp.methods,
  54536. events: cmp.events,
  54537. listeners: cmp.listeners,
  54538. styles: cmp.styles,
  54539. slots: cmp.slots,
  54540. parts: cmp.parts,
  54541. dependents: cmp.dependents,
  54542. dependencies: cmp.dependencies,
  54543. dependencyGraph: cmp.dependencyGraph,
  54544. deprecation: cmp.deprecation,
  54545. })),
  54546. };
  54547. const jsonContent = JSON.stringify(json, null, 2);
  54548. await Promise.all(jsonOutputTargets.map((jsonOutput) => {
  54549. return writeDocsOutput(compilerCtx, jsonOutput, jsonContent, typesContent);
  54550. }));
  54551. };
  54552. const writeDocsOutput = async (compilerCtx, jsonOutput, jsonContent, typesContent) => {
  54553. return Promise.all([
  54554. compilerCtx.fs.writeFile(jsonOutput.file, jsonContent),
  54555. jsonOutput.typesFile ? compilerCtx.fs.writeFile(jsonOutput.typesFile, typesContent) : Promise.resolve(),
  54556. ]);
  54557. };
  54558. class MarkdownTable {
  54559. constructor() {
  54560. this.rows = [];
  54561. }
  54562. addHeader(data) {
  54563. this.addRow(data, true);
  54564. }
  54565. addRow(data, isHeader = false) {
  54566. const colData = [];
  54567. data.forEach((text) => {
  54568. const col = {
  54569. text: escapeMarkdownTableColumn(text),
  54570. width: text.length,
  54571. };
  54572. colData.push(col);
  54573. });
  54574. this.rows.push({
  54575. columns: colData,
  54576. isHeader: isHeader,
  54577. });
  54578. }
  54579. toMarkdown() {
  54580. return createTable(this.rows);
  54581. }
  54582. }
  54583. const escapeMarkdownTableColumn = (text) => {
  54584. text = text.replace(/\r?\n/g, ' ');
  54585. text = text.replace(/\|/g, '\\|');
  54586. return text;
  54587. };
  54588. const createTable = (rows) => {
  54589. const content = [];
  54590. if (rows.length === 0) {
  54591. return content;
  54592. }
  54593. normalizeColumCount(rows);
  54594. normalizeColumnWidth(rows);
  54595. const th = rows.find((r) => r.isHeader);
  54596. if (th) {
  54597. const headerRow = createRow(th);
  54598. content.push(headerRow);
  54599. content.push(createBorder(th));
  54600. }
  54601. const tds = rows.filter((r) => !r.isHeader);
  54602. tds.forEach((td) => {
  54603. content.push(createRow(td));
  54604. });
  54605. return content;
  54606. };
  54607. const createBorder = (th) => {
  54608. const border = {
  54609. columns: [],
  54610. isHeader: false,
  54611. };
  54612. th.columns.forEach((c) => {
  54613. const borderCol = {
  54614. text: '',
  54615. width: c.width,
  54616. };
  54617. while (borderCol.text.length < borderCol.width) {
  54618. borderCol.text += '-';
  54619. }
  54620. border.columns.push(borderCol);
  54621. });
  54622. return createRow(border);
  54623. };
  54624. const createRow = (row) => {
  54625. const content = ['| '];
  54626. row.columns.forEach((c) => {
  54627. content.push(c.text);
  54628. content.push(' | ');
  54629. });
  54630. return content.join('').trim();
  54631. };
  54632. const normalizeColumCount = (rows) => {
  54633. let columnCount = 0;
  54634. rows.forEach((r) => {
  54635. if (r.columns.length > columnCount) {
  54636. columnCount = r.columns.length;
  54637. }
  54638. });
  54639. rows.forEach((r) => {
  54640. while (r.columns.length < columnCount) {
  54641. r.columns.push({
  54642. text: ``,
  54643. width: 0,
  54644. });
  54645. }
  54646. });
  54647. };
  54648. const normalizeColumnWidth = (rows) => {
  54649. const columnCount = rows[0].columns.length;
  54650. for (let columnIndex = 0; columnIndex < columnCount; columnIndex++) {
  54651. let longestText = 0;
  54652. rows.forEach((r) => {
  54653. const col = r.columns[columnIndex];
  54654. if (col.text.length > longestText) {
  54655. longestText = col.text.length;
  54656. }
  54657. });
  54658. rows.forEach((r) => {
  54659. const col = r.columns[columnIndex];
  54660. col.width = longestText;
  54661. while (col.text.length < longestText) {
  54662. col.text += ' ';
  54663. }
  54664. });
  54665. }
  54666. };
  54667. const stylesToMarkdown = (styles) => {
  54668. const content = [];
  54669. if (styles.length === 0) {
  54670. return content;
  54671. }
  54672. content.push(`## CSS Custom Properties`);
  54673. content.push(``);
  54674. const table = new MarkdownTable();
  54675. table.addHeader(['Name', 'Description']);
  54676. styles.forEach((style) => {
  54677. table.addRow([`\`${style.name}\``, style.docs]);
  54678. });
  54679. content.push(...table.toMarkdown());
  54680. content.push(``);
  54681. content.push(``);
  54682. return content;
  54683. };
  54684. const depsToMarkdown = (cmp, cmps) => {
  54685. const content = [];
  54686. const deps = Object.entries(cmp.dependencyGraph);
  54687. if (deps.length === 0) {
  54688. return content;
  54689. }
  54690. content.push(`## Dependencies`);
  54691. content.push(``);
  54692. if (cmp.dependents.length > 0) {
  54693. const usedBy = cmp.dependents.map((tag) => ' - ' + getCmpLink(cmp, tag, cmps));
  54694. content.push(`### Used by`);
  54695. content.push(``);
  54696. content.push(...usedBy);
  54697. content.push(``);
  54698. }
  54699. if (cmp.dependencies.length > 0) {
  54700. const dependsOn = cmp.dependencies.map((tag) => '- ' + getCmpLink(cmp, tag, cmps));
  54701. content.push(`### Depends on`);
  54702. content.push(``);
  54703. content.push(...dependsOn);
  54704. content.push(``);
  54705. }
  54706. content.push(`### Graph`);
  54707. content.push('```mermaid');
  54708. content.push('graph TD;');
  54709. deps.forEach(([key, deps]) => {
  54710. deps.forEach((dep) => {
  54711. content.push(` ${key} --> ${dep}`);
  54712. });
  54713. });
  54714. content.push(` style ${cmp.tag} fill:#f9f,stroke:#333,stroke-width:4px`);
  54715. content.push('```');
  54716. content.push(``);
  54717. return content;
  54718. };
  54719. const getCmpLink = (from, to, cmps) => {
  54720. const destCmp = cmps.find((c) => c.tag === to);
  54721. if (destCmp) {
  54722. const cmpRelPath = normalizePath$1(relative$1(from.dirPath, destCmp.dirPath));
  54723. return `[${to}](${cmpRelPath})`;
  54724. }
  54725. return to;
  54726. };
  54727. const eventsToMarkdown = (events) => {
  54728. const content = [];
  54729. if (events.length === 0) {
  54730. return content;
  54731. }
  54732. content.push(`## Events`);
  54733. content.push(``);
  54734. const table = new MarkdownTable();
  54735. table.addHeader(['Event', 'Description', 'Type']);
  54736. events.forEach((ev) => {
  54737. table.addRow([`\`${ev.event}\``, getDocsField$2(ev), `\`CustomEvent<${ev.detail}>\``]);
  54738. });
  54739. content.push(...table.toMarkdown());
  54740. content.push(``);
  54741. content.push(``);
  54742. return content;
  54743. };
  54744. const getDocsField$2 = (prop) => {
  54745. return `${prop.deprecation !== undefined
  54746. ? `<span style="color:red">**[DEPRECATED]**</span> ${prop.deprecation}<br/><br/>`
  54747. : ''}${prop.docs}`;
  54748. };
  54749. const methodsToMarkdown = (methods) => {
  54750. const content = [];
  54751. if (methods.length === 0) {
  54752. return content;
  54753. }
  54754. content.push(`## Methods`);
  54755. content.push(``);
  54756. methods.forEach((method) => {
  54757. content.push(`### \`${method.signature}\``);
  54758. content.push(``);
  54759. content.push(getDocsField$1(method));
  54760. content.push(``);
  54761. if (method.parameters.length > 0) {
  54762. const parmsTable = new MarkdownTable();
  54763. parmsTable.addHeader(['Name', 'Type', 'Description']);
  54764. method.parameters.forEach(({ name, type, docs }) => {
  54765. parmsTable.addRow(['`' + name + '`', '`' + type + '`', docs]);
  54766. });
  54767. content.push(`#### Parameters`);
  54768. content.push(``);
  54769. content.push(...parmsTable.toMarkdown());
  54770. content.push(``);
  54771. }
  54772. if (method.returns) {
  54773. content.push(`#### Returns`);
  54774. content.push(``);
  54775. content.push(`Type: \`${method.returns.type}\``);
  54776. content.push(``);
  54777. content.push(method.returns.docs);
  54778. content.push(``);
  54779. }
  54780. });
  54781. content.push(``);
  54782. return content;
  54783. };
  54784. const getDocsField$1 = (prop) => {
  54785. return `${prop.deprecation !== undefined
  54786. ? `<span style="color:red">**[DEPRECATED]**</span> ${prop.deprecation}<br/><br/>`
  54787. : ''}${prop.docs}`;
  54788. };
  54789. const partsToMarkdown = (parts) => {
  54790. const content = [];
  54791. if (parts.length === 0) {
  54792. return content;
  54793. }
  54794. content.push(`## Shadow Parts`);
  54795. content.push(``);
  54796. const table = new MarkdownTable();
  54797. table.addHeader(['Part', 'Description']);
  54798. parts.forEach((style) => {
  54799. table.addRow([style.name === '' ? '' : `\`"${style.name}"\``, style.docs]);
  54800. });
  54801. content.push(...table.toMarkdown());
  54802. content.push(``);
  54803. content.push(``);
  54804. return content;
  54805. };
  54806. const propsToMarkdown = (props) => {
  54807. const content = [];
  54808. if (props.length === 0) {
  54809. return content;
  54810. }
  54811. content.push(`## Properties`);
  54812. content.push(``);
  54813. const table = new MarkdownTable();
  54814. table.addHeader(['Property', 'Attribute', 'Description', 'Type', 'Default']);
  54815. props.forEach((prop) => {
  54816. table.addRow([
  54817. getPropertyField(prop),
  54818. getAttributeField(prop),
  54819. getDocsField(prop),
  54820. `\`${prop.type}\``,
  54821. `\`${prop.default}\``,
  54822. ]);
  54823. });
  54824. content.push(...table.toMarkdown());
  54825. content.push(``);
  54826. content.push(``);
  54827. return content;
  54828. };
  54829. const getPropertyField = (prop) => {
  54830. return `\`${prop.name}\`${prop.required ? ' _(required)_' : ''}`;
  54831. };
  54832. const getAttributeField = (prop) => {
  54833. return prop.attr ? `\`${prop.attr}\`` : '--';
  54834. };
  54835. const getDocsField = (prop) => {
  54836. return `${prop.deprecation !== undefined
  54837. ? `<span style="color:red">**[DEPRECATED]**</span> ${prop.deprecation}<br/><br/>`
  54838. : ''}${prop.docs}`;
  54839. };
  54840. const slotsToMarkdown = (slots) => {
  54841. const content = [];
  54842. if (slots.length === 0) {
  54843. return content;
  54844. }
  54845. content.push(`## Slots`);
  54846. content.push(``);
  54847. const table = new MarkdownTable();
  54848. table.addHeader(['Slot', 'Description']);
  54849. slots.forEach((style) => {
  54850. table.addRow([style.name === '' ? '' : `\`"${style.name}"\``, style.docs]);
  54851. });
  54852. content.push(...table.toMarkdown());
  54853. content.push(``);
  54854. content.push(``);
  54855. return content;
  54856. };
  54857. const usageToMarkdown = (usages) => {
  54858. const content = [];
  54859. const merged = mergeUsages(usages);
  54860. if (merged.length === 0) {
  54861. return content;
  54862. }
  54863. content.push(`## Usage`);
  54864. merged.forEach(({ name, text }) => {
  54865. content.push('');
  54866. content.push(`### ${toTitleCase(name)}`);
  54867. content.push('');
  54868. content.push(text);
  54869. content.push('');
  54870. }),
  54871. content.push('');
  54872. content.push('');
  54873. return content;
  54874. };
  54875. const mergeUsages = (usages) => {
  54876. const keys = Object.keys(usages);
  54877. const map = new Map();
  54878. keys.forEach((key) => {
  54879. const usage = usages[key].trim();
  54880. const array = map.get(usage) || [];
  54881. array.push(key);
  54882. map.set(usage, array);
  54883. });
  54884. const merged = [];
  54885. map.forEach((value, key) => {
  54886. merged.push({
  54887. name: value.join(' / '),
  54888. text: key,
  54889. });
  54890. });
  54891. return merged;
  54892. };
  54893. const generateReadme = async (config, compilerCtx, readmeOutputs, docsData, cmps) => {
  54894. const isUpdate = !!docsData.readme;
  54895. const userContent = isUpdate ? docsData.readme : getDefaultReadme(docsData);
  54896. await Promise.all(readmeOutputs.map(async (readmeOutput) => {
  54897. if (readmeOutput.dir) {
  54898. const readmeContent = generateMarkdown(userContent, docsData, cmps, readmeOutput);
  54899. const relPath = relative$1(config.srcDir, docsData.readmePath);
  54900. const absPath = join(readmeOutput.dir, relPath);
  54901. const results = await compilerCtx.fs.writeFile(absPath, readmeContent);
  54902. if (results.changedContent) {
  54903. if (isUpdate) {
  54904. config.logger.info(`updated readme docs: ${docsData.tag}`);
  54905. }
  54906. else {
  54907. config.logger.info(`created readme docs: ${docsData.tag}`);
  54908. }
  54909. }
  54910. }
  54911. }));
  54912. };
  54913. const generateMarkdown = (userContent, cmp, cmps, readmeOutput) => {
  54914. //If the readmeOutput.dependencies is true or undefined the dependencies will be generated.
  54915. const dependencies = readmeOutput.dependencies !== false ? depsToMarkdown(cmp, cmps) : [];
  54916. return [
  54917. userContent,
  54918. AUTO_GENERATE_COMMENT,
  54919. '',
  54920. '',
  54921. ...getDocsDeprecation(cmp),
  54922. ...usageToMarkdown(cmp.usage),
  54923. ...propsToMarkdown(cmp.props),
  54924. ...eventsToMarkdown(cmp.events),
  54925. ...methodsToMarkdown(cmp.methods),
  54926. ...slotsToMarkdown(cmp.slots),
  54927. ...partsToMarkdown(cmp.parts),
  54928. ...stylesToMarkdown(cmp.styles),
  54929. ...dependencies,
  54930. `----------------------------------------------`,
  54931. '',
  54932. readmeOutput.footer,
  54933. '',
  54934. ].join('\n');
  54935. };
  54936. const getDocsDeprecation = (cmp) => {
  54937. if (cmp.deprecation !== undefined) {
  54938. return [`> **[DEPRECATED]** ${cmp.deprecation}`, ''];
  54939. }
  54940. return [];
  54941. };
  54942. const getDefaultReadme = (docsData) => {
  54943. return [`# ${docsData.tag}`, '', '', ''].join('\n');
  54944. };
  54945. const generateReadmeDocs = async (config, compilerCtx, docsData, outputTargets) => {
  54946. const readmeOutputTargets = outputTargets.filter(isOutputTargetDocsReadme);
  54947. if (readmeOutputTargets.length === 0) {
  54948. return;
  54949. }
  54950. const strictCheck = readmeOutputTargets.some((o) => o.strict);
  54951. if (strictCheck) {
  54952. strictCheckDocs(config, docsData);
  54953. }
  54954. await Promise.all(docsData.components.map((cmpData) => {
  54955. return generateReadme(config, compilerCtx, readmeOutputTargets, cmpData, docsData.components);
  54956. }));
  54957. };
  54958. const strictCheckDocs = (config, docsData) => {
  54959. docsData.components.forEach((component) => {
  54960. component.props.forEach((prop) => {
  54961. if (!prop.docs && prop.deprecation === undefined) {
  54962. config.logger.warn(`Property "${prop.name}" of "${component.tag}" is not documented. ${component.filePath}`);
  54963. }
  54964. });
  54965. component.methods.forEach((method) => {
  54966. if (!method.docs && method.deprecation === undefined) {
  54967. config.logger.warn(`Method "${method.name}" of "${component.tag}" is not documented. ${component.filePath}`);
  54968. }
  54969. });
  54970. component.events.forEach((ev) => {
  54971. if (!ev.docs && ev.deprecation === undefined) {
  54972. config.logger.warn(`Event "${ev.event}" of "${component.tag}" is not documented. ${component.filePath}`);
  54973. }
  54974. });
  54975. component.parts.forEach((ev) => {
  54976. if (ev.docs === '') {
  54977. config.logger.warn(`Part "${ev.name}" of "${component.tag}" is not documented. ${component.filePath}`);
  54978. }
  54979. });
  54980. });
  54981. };
  54982. /**
  54983. * Generate [custom data](https://github.com/microsoft/vscode-custom-data) to augment existing HTML types in VS Code.
  54984. * This function writes the custom data as a JSON file to disk, which can be used in VS Code to inform the IDE about
  54985. * custom elements generated by Stencil.
  54986. *
  54987. * The JSON generated by this function must conform to the
  54988. * [HTML custom data schema](https://github.com/microsoft/vscode-html-languageservice/blob/e7ae8a7170df5e721a13cee1b86e293b24eb3b20/docs/customData.schema.json).
  54989. *
  54990. * This function generates custom data for HTML only at this time (it does not generate custom data for CSS).
  54991. *
  54992. * @param compilerCtx the current compiler context
  54993. * @param docsData an intermediate representation documentation derived from compiled Stencil components
  54994. * @param outputTargets the output target(s) the associated with the current build
  54995. */
  54996. const generateVscodeDocs = async (compilerCtx, docsData, outputTargets) => {
  54997. const vsCodeOutputTargets = outputTargets.filter(isOutputTargetDocsVscode);
  54998. if (vsCodeOutputTargets.length === 0) {
  54999. return;
  55000. }
  55001. await Promise.all(vsCodeOutputTargets.map(async (outputTarget) => {
  55002. const json = {
  55003. /**
  55004. * the 'version' top-level field is required by the schema. changes to the JSON generated by Stencil must:
  55005. * - comply with v1.X of the schema _OR_
  55006. * - increment this field as a part of updating the JSON generation. This should be considered a breaking change
  55007. *
  55008. * {@link https://github.com/microsoft/vscode-html-languageservice/blob/e7ae8a7170df5e721a13cee1b86e293b24eb3b20/src/htmlLanguageTypes.ts#L184}
  55009. */
  55010. version: 1.1,
  55011. tags: docsData.components.map((cmp) => ({
  55012. name: cmp.tag,
  55013. description: {
  55014. kind: 'markdown',
  55015. value: cmp.docs,
  55016. },
  55017. attributes: cmp.props
  55018. .filter((p) => p.attr !== undefined && p.attr.length > 0)
  55019. .map(serializeAttribute),
  55020. references: getReferences(cmp, outputTarget.sourceCodeBaseUrl),
  55021. })),
  55022. };
  55023. // fields in the custom data may have a value of `undefined`. calling `stringify` will remove such fields.
  55024. const jsonContent = JSON.stringify(json, null, 2);
  55025. await compilerCtx.fs.writeFile(outputTarget.file, jsonContent);
  55026. }));
  55027. };
  55028. /**
  55029. * Generate a 'references' section for a component's documentation.
  55030. * @param cmp the Stencil component to generate a references section for
  55031. * @param repoBaseUrl an optional URL, that when provided, will add a reference to the source code for the component
  55032. * @returns the generated references section, or undefined if no references could be generated
  55033. */
  55034. const getReferences = (cmp, repoBaseUrl) => {
  55035. var _a;
  55036. // collect any `@reference` JSDoc tags on the component
  55037. const references = getNameText('reference', cmp.docsTags).map(([name, url]) => ({ name, url }));
  55038. if (repoBaseUrl) {
  55039. references.push({
  55040. name: 'Source code',
  55041. url: join(repoBaseUrl, (_a = cmp.filePath) !== null && _a !== void 0 ? _a : ''),
  55042. });
  55043. }
  55044. if (references.length > 0) {
  55045. return references;
  55046. }
  55047. return undefined;
  55048. };
  55049. /**
  55050. * Serialize a component's class member decorated with `@Prop` to be written to disk
  55051. * @param prop the intermediate representation of the documentation to serialize
  55052. * @returns the serialized data
  55053. */
  55054. const serializeAttribute = (prop) => {
  55055. const attribute = {
  55056. name: prop.attr,
  55057. description: prop.docs,
  55058. };
  55059. const values = prop.values
  55060. .filter((jsonDocValue) => jsonDocValue.type === 'string' && jsonDocValue.value !== undefined)
  55061. .map((jsonDocValue) => ({ name: jsonDocValue.value }));
  55062. if (values.length > 0) {
  55063. attribute.values = values;
  55064. }
  55065. return attribute;
  55066. };
  55067. const outputCustom = async (config, compilerCtx, buildCtx, docs, outputTargets) => {
  55068. const customOutputTargets = outputTargets.filter(isOutputTargetCustom);
  55069. if (customOutputTargets.length === 0) {
  55070. return;
  55071. }
  55072. await Promise.all(customOutputTargets.map(async (o) => {
  55073. const timespan = buildCtx.createTimeSpan(`generating ${o.name} started`);
  55074. try {
  55075. await o.generator(config, compilerCtx, buildCtx, docs);
  55076. }
  55077. catch (e) {
  55078. catchError(buildCtx.diagnostics, e);
  55079. }
  55080. timespan.finish(`generate ${o.name} finished`);
  55081. }));
  55082. };
  55083. const outputDocs = async (config, compilerCtx, buildCtx) => {
  55084. if (!config.buildDocs) {
  55085. return;
  55086. }
  55087. const docsOutputTargets = config.outputTargets.filter((o) => isOutputTargetCustom(o) ||
  55088. isOutputTargetDocsReadme(o) ||
  55089. isOutputTargetDocsJson(o) ||
  55090. isOutputTargetDocsCustom(o) ||
  55091. isOutputTargetDocsVscode(o));
  55092. if (docsOutputTargets.length === 0) {
  55093. return;
  55094. }
  55095. // ensure all the styles are built first, which parses all the css docs
  55096. await buildCtx.stylesPromise;
  55097. const docsData = await generateDocData(config, compilerCtx, buildCtx);
  55098. await Promise.all([
  55099. generateReadmeDocs(config, compilerCtx, docsData, docsOutputTargets),
  55100. generateJsonDocs(config, compilerCtx, docsData, docsOutputTargets),
  55101. generateVscodeDocs(compilerCtx, docsData, docsOutputTargets),
  55102. generateCustomDocs(config, docsData, docsOutputTargets),
  55103. outputCustom(config, compilerCtx, buildCtx, docsData, docsOutputTargets),
  55104. ]);
  55105. };
  55106. const outputLazyLoader = async (config, compilerCtx) => {
  55107. const outputTargets = config.outputTargets.filter(isOutputTargetDistLazyLoader);
  55108. if (outputTargets.length === 0) {
  55109. return;
  55110. }
  55111. await Promise.all(outputTargets.map((o) => generateLoader(config, compilerCtx, o)));
  55112. };
  55113. const generateLoader = async (config, compilerCtx, outputTarget) => {
  55114. const loaderPath = outputTarget.dir;
  55115. const es2017Dir = outputTarget.esmDir;
  55116. const es5Dir = outputTarget.esmEs5Dir || es2017Dir;
  55117. const cjsDir = outputTarget.cjsDir;
  55118. if (!loaderPath || !es2017Dir || !cjsDir) {
  55119. return;
  55120. }
  55121. const es5HtmlElement = await getClientPolyfill(config, compilerCtx, 'es5-html-element.js');
  55122. const packageJsonContent = JSON.stringify({
  55123. name: config.fsNamespace + '-loader',
  55124. private: true,
  55125. typings: './index.d.ts',
  55126. module: './index.js',
  55127. main: './index.cjs.js',
  55128. 'jsnext:main': './index.es2017.js',
  55129. es2015: './index.es2017.js',
  55130. es2017: './index.es2017.js',
  55131. unpkg: './cdn.js',
  55132. }, null, 2);
  55133. const es5EntryPoint = join(es5Dir, 'loader.js');
  55134. const es2017EntryPoint = join(es2017Dir, 'loader.js');
  55135. const polyfillsEntryPoint = join(es2017Dir, 'polyfills/index.js');
  55136. const cjsEntryPoint = join(cjsDir, 'loader.cjs.js');
  55137. const polyfillsExport = `export * from '${normalizePath$1(relative$1(loaderPath, polyfillsEntryPoint))}';`;
  55138. const indexContent = `${generatePreamble(config)}
  55139. ${es5HtmlElement}
  55140. ${polyfillsExport}
  55141. export * from '${normalizePath$1(relative$1(loaderPath, es5EntryPoint))}';
  55142. `;
  55143. const indexES2017Content = `${generatePreamble(config)}
  55144. ${polyfillsExport}
  55145. export * from '${normalizePath$1(relative$1(loaderPath, es2017EntryPoint))}';
  55146. `;
  55147. const indexCjsContent = `${generatePreamble(config)}
  55148. module.exports = require('${normalizePath$1(relative$1(loaderPath, cjsEntryPoint))}');
  55149. module.exports.applyPolyfills = function() { return Promise.resolve() };
  55150. `;
  55151. const indexDtsPath = join(loaderPath, 'index.d.ts');
  55152. await Promise.all([
  55153. compilerCtx.fs.writeFile(join(loaderPath, 'package.json'), packageJsonContent),
  55154. compilerCtx.fs.writeFile(join(loaderPath, 'index.d.ts'), generateIndexDts(indexDtsPath, outputTarget.componentDts)),
  55155. compilerCtx.fs.writeFile(join(loaderPath, 'index.js'), indexContent),
  55156. compilerCtx.fs.writeFile(join(loaderPath, 'index.cjs.js'), indexCjsContent),
  55157. compilerCtx.fs.writeFile(join(loaderPath, 'cdn.js'), indexCjsContent),
  55158. compilerCtx.fs.writeFile(join(loaderPath, 'index.es2017.js'), indexES2017Content),
  55159. ]);
  55160. };
  55161. const generateIndexDts = (indexDtsPath, componentsDtsPath) => {
  55162. return `export * from '${relativeImport(indexDtsPath, componentsDtsPath, '.d.ts')}';
  55163. export interface CustomElementsDefineOptions {
  55164. exclude?: string[];
  55165. resourcesUrl?: string;
  55166. syncQueue?: boolean;
  55167. jmp?: (c: Function) => any;
  55168. raf?: (c: FrameRequestCallback) => number;
  55169. ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
  55170. rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
  55171. }
  55172. export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
  55173. export declare function applyPolyfills(): Promise<void>;
  55174. `;
  55175. };
  55176. /**
  55177. * Entrypoint for generating types for one or more `dist-custom-elements` output targets defined in a Stencil project's
  55178. * configuration
  55179. * @param config the Stencil configuration associated with the project being compiled
  55180. * @param compilerCtx the current compiler context
  55181. * @param buildCtx the context associated with the current build
  55182. * @param typesDir the path to the directory where type declarations are saved
  55183. */
  55184. const generateCustomElementsTypes = async (config, compilerCtx, buildCtx, typesDir) => {
  55185. const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
  55186. await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput$1(config, compilerCtx, buildCtx, typesDir, outputTarget)));
  55187. };
  55188. /**
  55189. * Generates types for a single `dist-custom-elements` output target definition in a Stencil project's configuration
  55190. *
  55191. * @param config the Stencil configuration associated with the project being compiled
  55192. * @param compilerCtx the current compiler context
  55193. * @param buildCtx the context associated with the current build
  55194. * @param typesDir path to the directory where type declarations are saved
  55195. * @param outputTarget the output target for which types are being currently generated
  55196. */
  55197. const generateCustomElementsTypesOutput$1 = async (config, compilerCtx, buildCtx, typesDir, outputTarget) => {
  55198. // the path where we're going to write the typedef for the whole dist-custom-elements output
  55199. const customElementsDtsPath = join(outputTarget.dir, 'index.d.ts');
  55200. // the directory where types for the individual components are written
  55201. const componentsTypeDirectoryRelPath = relative$1(outputTarget.dir, typesDir);
  55202. const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
  55203. const code = [
  55204. `/* ${config.namespace} custom elements */`,
  55205. ...components.map((component) => {
  55206. const exportName = dashToPascalCase$1(component.tagName);
  55207. const importName = component.componentClassName;
  55208. // typedefs for individual components can be found under paths like
  55209. // $TYPES_DIR/components/my-component/my-component.d.ts
  55210. //
  55211. // To construct this path we:
  55212. //
  55213. // - get the relative path to the component's source file from the source directory
  55214. // - join that relative path to the relative path from the `index.d.ts` file to the
  55215. // directory where typedefs are saved
  55216. const componentSourceRelPath = relative$1(config.srcDir, component.sourceFilePath).replace('.tsx', '');
  55217. const componentDTSPath = join(componentsTypeDirectoryRelPath, componentSourceRelPath);
  55218. return `export { ${importName} as ${exportName} } from '${componentDTSPath}';`;
  55219. }),
  55220. ``,
  55221. `/**`,
  55222. ` * Used to manually set the base path where assets can be found.`,
  55223. ` * If the script is used as "module", it's recommended to use "import.meta.url",`,
  55224. ` * such as "setAssetPath(import.meta.url)". Other options include`,
  55225. ` * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to`,
  55226. ` * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".`,
  55227. ` * But do note that this configuration depends on how your script is bundled, or lack of`,
  55228. ` * bundling, and where your assets can be loaded from. Additionally custom bundling`,
  55229. ` * will have to ensure the static assets are copied to its build directory.`,
  55230. ` */`,
  55231. `export declare const setAssetPath: (path: string) => void;`,
  55232. ``,
  55233. `export interface SetPlatformOptions {`,
  55234. ` raf?: (c: FrameRequestCallback) => number;`,
  55235. ` ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;`,
  55236. ` rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;`,
  55237. `}`,
  55238. `export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;`,
  55239. ];
  55240. const componentsDtsRelPath = relDts$1(outputTarget.dir, join(typesDir, 'components.d.ts'));
  55241. const usersIndexJsPath = join(config.srcDir, 'index.ts');
  55242. const hasUserIndex = await compilerCtx.fs.access(usersIndexJsPath);
  55243. if (hasUserIndex) {
  55244. const userIndexRelPath = normalizePath$1(dirname(componentsDtsRelPath));
  55245. code.push(`export * from '${userIndexRelPath}';`);
  55246. }
  55247. else {
  55248. code.push(`export * from '${componentsDtsRelPath}';`);
  55249. }
  55250. await compilerCtx.fs.writeFile(customElementsDtsPath, code.join('\n') + `\n`, {
  55251. outputTargetType: outputTarget.type,
  55252. });
  55253. await Promise.all(components.map(async (cmp) => {
  55254. const dtsCode = generateCustomElementType$1(componentsDtsRelPath, cmp);
  55255. const fileName = `${cmp.tagName}.d.ts`;
  55256. const filePath = join(outputTarget.dir, fileName);
  55257. await compilerCtx.fs.writeFile(filePath, dtsCode, { outputTargetType: outputTarget.type });
  55258. }));
  55259. };
  55260. /**
  55261. * Generate a type declaration file for a specific Stencil component
  55262. * @param componentsDtsRelPath the path to a root type declaration file from which commonly used entities can be
  55263. * referenced from in the newly generated file
  55264. * @param cmp the component to generate the type declaration file for
  55265. * @returns the contents of the type declaration file for the provided `cmp`
  55266. */
  55267. const generateCustomElementType$1 = (componentsDtsRelPath, cmp) => {
  55268. const tagNameAsPascal = dashToPascalCase$1(cmp.tagName);
  55269. const o = [
  55270. `import type { Components, JSX } from "${componentsDtsRelPath}";`,
  55271. ``,
  55272. `interface ${tagNameAsPascal} extends Components.${tagNameAsPascal}, HTMLElement {}`,
  55273. `export const ${tagNameAsPascal}: {`,
  55274. ` prototype: ${tagNameAsPascal};`,
  55275. ` new (): ${tagNameAsPascal};`,
  55276. `};`,
  55277. `/**`,
  55278. ` * Used to define this component and all nested components recursively.`,
  55279. ` */`,
  55280. `export const defineCustomElement: () => void;`,
  55281. ``,
  55282. ];
  55283. return o.join('\n');
  55284. };
  55285. /**
  55286. * Determines the relative path between two provided paths. If a type declaration file extension is present on
  55287. * `dtsPath`, it will be removed from the computed relative path.
  55288. * @param fromPath the path from which to start at
  55289. * @param dtsPath the destination path
  55290. * @returns the relative path from the provided `fromPath` to the `dtsPath`
  55291. */
  55292. const relDts$1 = (fromPath, dtsPath) => {
  55293. dtsPath = relative$1(fromPath, dtsPath);
  55294. if (!dtsPath.startsWith('.')) {
  55295. dtsPath = '.' + dtsPath;
  55296. }
  55297. return normalizePath$1(dtsPath.replace('.d.ts', ''));
  55298. };
  55299. const generateCustomElementsBundleTypes = async (config, compilerCtx, buildCtx, distDtsFilePath) => {
  55300. const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElementsBundle);
  55301. await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, distDtsFilePath, outputTarget)));
  55302. };
  55303. const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx, distDtsFilePath, outputTarget) => {
  55304. const customElementsDtsPath = join(outputTarget.dir, 'index.d.ts');
  55305. const componentsDtsRelPath = relDts(outputTarget.dir, distDtsFilePath);
  55306. const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
  55307. const code = [
  55308. `/* ${config.namespace} custom elements bundle */`,
  55309. ``,
  55310. `import type { Components, JSX } from "${componentsDtsRelPath}";`,
  55311. ``,
  55312. ...components.map(generateCustomElementType),
  55313. `/**`,
  55314. ` * Utility to define all custom elements within this package using the tag name provided in the component's source. `,
  55315. ` * When defining each custom element, it will also check it's safe to define by:`,
  55316. ` *`,
  55317. ` * 1. Ensuring the "customElements" registry is available in the global context (window).`,
  55318. ` * 2. The component tag name is not already defined.`,
  55319. ` *`,
  55320. ` * Use the standard [customElements.define()](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define) `,
  55321. ` * method instead to define custom elements individually, or to provide a different tag name.`,
  55322. ` */`,
  55323. `export declare const defineCustomElements: (opts?: any) => void;`,
  55324. ``,
  55325. `/**`,
  55326. ` * Used to manually set the base path where assets can be found.`,
  55327. ` * If the script is used as "module", it's recommended to use "import.meta.url",`,
  55328. ` * such as "setAssetPath(import.meta.url)". Other options include`,
  55329. ` * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to`,
  55330. ` * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".`,
  55331. ` * But do note that this configuration depends on how your script is bundled, or lack of`,
  55332. ` * bunding, and where your assets can be loaded from. Additionally custom bundling`,
  55333. ` * will have to ensure the static assets are copied to its build directory.`,
  55334. ` */`,
  55335. `export declare const setAssetPath: (path: string) => void;`,
  55336. ``,
  55337. `export interface SetPlatformOptions {`,
  55338. ` raf?: (c: FrameRequestCallback) => number;`,
  55339. ` ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;`,
  55340. ` rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;`,
  55341. ` ce?: (eventName: string, opts?: any) => CustomEvent;`,
  55342. `}`,
  55343. `export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;`,
  55344. ``,
  55345. `export type { Components, JSX };`,
  55346. ``,
  55347. ];
  55348. const usersIndexJsPath = join(config.srcDir, 'index.ts');
  55349. const hasUserIndex = await compilerCtx.fs.access(usersIndexJsPath);
  55350. if (hasUserIndex) {
  55351. const userIndexRelPath = normalizePath$1(dirname(componentsDtsRelPath));
  55352. code.push(`export * from '${userIndexRelPath}';`);
  55353. }
  55354. else {
  55355. code.push(`export * from '${componentsDtsRelPath}';`);
  55356. }
  55357. await compilerCtx.fs.writeFile(customElementsDtsPath, code.join('\n') + `\n`, {
  55358. outputTargetType: outputTarget.type,
  55359. });
  55360. };
  55361. const generateCustomElementType = (cmp) => {
  55362. const tagNameAsPascal = dashToPascalCase$1(cmp.tagName);
  55363. const o = [
  55364. `interface ${tagNameAsPascal} extends Components.${tagNameAsPascal}, HTMLElement {}`,
  55365. `export const ${tagNameAsPascal}: {`,
  55366. ` prototype: ${tagNameAsPascal};`,
  55367. ` new (): ${tagNameAsPascal};`,
  55368. `};`,
  55369. ``,
  55370. ];
  55371. return o.join('\n');
  55372. };
  55373. const relDts = (fromPath, dtsPath) => {
  55374. dtsPath = relative$1(fromPath, dtsPath);
  55375. if (!dtsPath.startsWith('.')) {
  55376. dtsPath = '.' + dtsPath;
  55377. }
  55378. return normalizePath$1(dtsPath.replace('.d.ts', ''));
  55379. };
  55380. /**
  55381. * Update a type declaration file's import declarations using the module `@stencil/core`
  55382. * @param typesDir the directory where type declaration files are expected to exist
  55383. * @param dtsFilePath the path of the type declaration file being updated, used to derive the correct import declaration
  55384. * module
  55385. * @param dtsContent the content of a type declaration file to update
  55386. * @returns the updated type declaration file contents
  55387. */
  55388. const updateStencilTypesImports = (typesDir, dtsFilePath, dtsContent) => {
  55389. const dir = dirname(dtsFilePath);
  55390. // determine the relative path between the directory of the .d.ts file and the types directory. this value may result
  55391. // in '.' if they are the same
  55392. const relPath = relative$1(dir, typesDir);
  55393. let coreDtsPath = join(relPath, CORE_FILENAME);
  55394. if (!coreDtsPath.startsWith('.')) {
  55395. coreDtsPath = `./${coreDtsPath}`;
  55396. }
  55397. coreDtsPath = normalizePath$1(coreDtsPath);
  55398. if (dtsContent.includes('@stencil/core')) {
  55399. dtsContent = dtsContent.replace(/(from\s*(:?'|"))@stencil\/core\/internal('|")/g, `$1${coreDtsPath}$2`);
  55400. dtsContent = dtsContent.replace(/(from\s*(:?'|"))@stencil\/core('|")/g, `$1${coreDtsPath}$2`);
  55401. }
  55402. return dtsContent;
  55403. };
  55404. /**
  55405. * Utility for ensuring that naming collisions do not appear in type declaration files for a component's class members
  55406. * decorated with @Prop, @Event, and @Method
  55407. * @param typeReferences all type names used by a component class member
  55408. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55409. * @param sourceFilePath the path to the source file of a component using the type being inspected
  55410. * @param initialType the name of the type that may be updated
  55411. * @returns the updated type name, which may be the same as the initial type name provided as an argument to this
  55412. * function
  55413. */
  55414. const updateTypeIdentifierNames = (typeReferences, typeImportData, sourceFilePath, initialType) => {
  55415. let currentTypeName = initialType;
  55416. // iterate over each of the type references, as there may be >1 reference to inspect
  55417. for (const typeReference of Object.values(typeReferences)) {
  55418. const importResolvedFile = getTypeImportPath(typeReference.path, sourceFilePath);
  55419. if (!typeImportData.hasOwnProperty(importResolvedFile)) {
  55420. continue;
  55421. }
  55422. for (const typesImportDatumElement of typeImportData[importResolvedFile]) {
  55423. currentTypeName = updateTypeName(currentTypeName, typesImportDatumElement);
  55424. }
  55425. }
  55426. return currentTypeName;
  55427. };
  55428. /**
  55429. * Determine the path of a given type reference, relative to the path of a source file
  55430. * @param importResolvedFile the path to the file containing the resolve type. may be absolute or relative
  55431. * @param sourceFilePath the component source file path to resolve against
  55432. * @returns the path of the type import
  55433. */
  55434. const getTypeImportPath = (importResolvedFile, sourceFilePath) => {
  55435. const isPathRelative = importResolvedFile && importResolvedFile.startsWith('.');
  55436. if (isPathRelative) {
  55437. importResolvedFile = resolve$1(dirname(sourceFilePath), importResolvedFile);
  55438. }
  55439. return importResolvedFile;
  55440. };
  55441. /**
  55442. * Determine whether the string representation of a type should be replaced with an alias
  55443. * @param currentTypeName the current string representation of a type
  55444. * @param typeAlias a type member and a potential different name associated with the type member
  55445. * @returns the updated string representation of a type. If the type is not updated, the original type name is returned
  55446. */
  55447. const updateTypeName = (currentTypeName, typeAlias) => {
  55448. if (!typeAlias.importName) {
  55449. return currentTypeName;
  55450. }
  55451. // TODO(STENCIL-419): Update this functionality to no longer use a regex
  55452. // negative lookahead specifying that quotes that designate a string in JavaScript cannot follow some expression
  55453. const endingStrChar = '(?!("|\'|`))';
  55454. /**
  55455. * A regular expression that looks at type names along a [word boundary](https://www.regular-expressions.info/wordboundaries.html).
  55456. * This is used as the best approximation for replacing type collisions, as this stage of compilation has only
  55457. * 'flattened' type information in the form of a String.
  55458. *
  55459. * This regex should be expected to capture types that are found in generics, unions, intersections, etc., but not
  55460. * those in string literals. We do not check for a starting quote (" | ' | `) here as some browsers do not support
  55461. * negative lookbehind. This works "well enough" until STENCIL-419 is completed.
  55462. */
  55463. const typeNameRegex = new RegExp(`${typeAlias.localName}\\b${endingStrChar}`, 'g');
  55464. return currentTypeName.replace(typeNameRegex, typeAlias.importName);
  55465. };
  55466. /**
  55467. * Writes Stencil core typings file to disk for a dist-* output target
  55468. * @param config the Stencil configuration associated with the project being compiled
  55469. * @param compilerCtx the current compiler context
  55470. * @returns the results of writing one or more type declaration files to disk
  55471. */
  55472. const copyStencilCoreDts = async (config, compilerCtx) => {
  55473. const typesOutputTargets = config.outputTargets.filter(isOutputTargetDistTypes).filter((o) => o.typesDir);
  55474. const srcStencilDtsPath = join(config.sys.getCompilerExecutingPath(), '..', '..', 'internal', CORE_DTS);
  55475. const srcStencilCoreDts = await compilerCtx.fs.readFile(srcStencilDtsPath);
  55476. return Promise.all(typesOutputTargets.map((o) => {
  55477. const coreDtsFilePath = join(o.typesDir, CORE_DTS);
  55478. return compilerCtx.fs.writeFile(coreDtsFilePath, srcStencilCoreDts, { outputTargetType: o.type });
  55479. }));
  55480. };
  55481. const CORE_FILENAME = `stencil-public-runtime`;
  55482. const CORE_DTS = `${CORE_FILENAME}.d.ts`;
  55483. /**
  55484. * Generates the individual event types for all @Event() decorated events in a component
  55485. * @param cmpMeta component runtime metadata for a single component
  55486. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55487. * @param cmpClassName The pascal cased name of the component class
  55488. * @returns the generated type metadata
  55489. */
  55490. const generateEventTypes = (cmpMeta, typeImportData, cmpClassName) => {
  55491. return cmpMeta.events.map((cmpEvent) => {
  55492. const name = `on${toTitleCase(cmpEvent.name)}`;
  55493. const cmpEventDetailInterface = `${cmpClassName}CustomEvent`;
  55494. const type = getEventType$1(cmpEvent, cmpEventDetailInterface, typeImportData, cmpMeta.sourceFilePath);
  55495. const typeInfo = {
  55496. name,
  55497. type,
  55498. optional: false,
  55499. required: false,
  55500. internal: cmpEvent.internal,
  55501. jsdoc: getTextDocs(cmpEvent.docs),
  55502. };
  55503. return typeInfo;
  55504. });
  55505. };
  55506. /**
  55507. * Determine the correct type name for all type(s) used by a class member annotated with `@Event()`
  55508. * @param cmpEvent the compiler metadata for a single `@Event()`
  55509. * @param cmpEventDetailInterface the name of the custom event type to use in the generated type
  55510. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55511. * @param componentSourcePath the path to the component on disk
  55512. * @returns the type associated with a `@Event()`
  55513. */
  55514. const getEventType$1 = (cmpEvent, cmpEventDetailInterface, typeImportData, componentSourcePath) => {
  55515. if (!cmpEvent.complexType.original) {
  55516. return 'CustomEvent';
  55517. }
  55518. const updatedTypeName = updateTypeIdentifierNames(cmpEvent.complexType.references, typeImportData, componentSourcePath, cmpEvent.complexType.original);
  55519. return `(event: ${cmpEventDetailInterface}<${updatedTypeName}>) => void`;
  55520. };
  55521. /**
  55522. * Generates the individual event types for all @Method() decorated events in a component
  55523. * @param cmpMeta component runtime metadata for a single component
  55524. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55525. * @returns the generated type metadata
  55526. */
  55527. const generateMethodTypes = (cmpMeta, typeImportData) => {
  55528. return cmpMeta.methods.map((cmpMethod) => ({
  55529. name: cmpMethod.name,
  55530. type: getType$1(cmpMethod, typeImportData, cmpMeta.sourceFilePath),
  55531. optional: false,
  55532. required: false,
  55533. internal: cmpMethod.internal,
  55534. jsdoc: getTextDocs(cmpMethod.docs),
  55535. }));
  55536. };
  55537. /**
  55538. * Determine the correct type name for all type(s) used by a class member annotated with `@Method()`
  55539. * @param cmpMethod the compiler metadata for a single `@Method()`
  55540. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55541. * @param componentSourcePath the path to the component on disk
  55542. * @returns the type associated with a `@Method()`
  55543. */
  55544. function getType$1(cmpMethod, typeImportData, componentSourcePath) {
  55545. return updateTypeIdentifierNames(cmpMethod.complexType.references, typeImportData, componentSourcePath, cmpMethod.complexType.signature);
  55546. }
  55547. /**
  55548. * Generates the individual event types for all @Prop() decorated events in a component
  55549. * @param cmpMeta component runtime metadata for a single component
  55550. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55551. * @returns the generated type metadata
  55552. */
  55553. const generatePropTypes = (cmpMeta, typeImportData) => {
  55554. return [
  55555. ...cmpMeta.properties.map((cmpProp) => ({
  55556. name: cmpProp.name,
  55557. type: getType(cmpProp, typeImportData, cmpMeta.sourceFilePath),
  55558. optional: cmpProp.optional,
  55559. required: cmpProp.required,
  55560. internal: cmpProp.internal,
  55561. jsdoc: getTextDocs(cmpProp.docs),
  55562. })),
  55563. ...cmpMeta.virtualProperties.map((cmpProp) => ({
  55564. name: cmpProp.name,
  55565. type: cmpProp.type,
  55566. optional: true,
  55567. required: false,
  55568. jsdoc: cmpProp.docs,
  55569. internal: false,
  55570. })),
  55571. ];
  55572. };
  55573. /**
  55574. * Determine the correct type name for all type(s) used by a class member annotated with `@Prop()`
  55575. * @param cmpProp the compiler metadata for a single `@Prop()`
  55576. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55577. * @param componentSourcePath the path to the component on disk
  55578. * @returns the type associated with a `@Prop()`
  55579. */
  55580. function getType(cmpProp, typeImportData, componentSourcePath) {
  55581. return updateTypeIdentifierNames(cmpProp.complexType.references, typeImportData, componentSourcePath, cmpProp.complexType.original);
  55582. }
  55583. /**
  55584. * Generate a string based on the types that are defined within a component
  55585. * @param cmp the metadata for the component that a type definition string is generated for
  55586. * @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
  55587. * @param areTypesInternal `true` if types being generated are for a project's internal purposes, `false` otherwise
  55588. * @returns the generated types string alongside additional metadata
  55589. */
  55590. const generateComponentTypes = (cmp, typeImportData, areTypesInternal) => {
  55591. const tagName = cmp.tagName.toLowerCase();
  55592. const tagNameAsPascal = dashToPascalCase$1(tagName);
  55593. const htmlElementName = `HTML${tagNameAsPascal}Element`;
  55594. const propAttributes = generatePropTypes(cmp, typeImportData);
  55595. const methodAttributes = generateMethodTypes(cmp, typeImportData);
  55596. const eventAttributes = generateEventTypes(cmp, typeImportData, tagNameAsPascal);
  55597. const componentAttributes = attributesToMultiLineString([...propAttributes, ...methodAttributes], false, areTypesInternal);
  55598. const isDep = cmp.isCollectionDependency;
  55599. const jsxAttributes = attributesToMultiLineString([...propAttributes, ...eventAttributes], true, areTypesInternal);
  55600. const element = [
  55601. ` interface ${htmlElementName} extends Components.${tagNameAsPascal}, HTMLStencilElement {`,
  55602. ` }`,
  55603. ` var ${htmlElementName}: {`,
  55604. ` prototype: ${htmlElementName};`,
  55605. ` new (): ${htmlElementName};`,
  55606. ` };`,
  55607. ];
  55608. return {
  55609. isDep,
  55610. tagName,
  55611. tagNameAsPascal,
  55612. htmlElementName,
  55613. component: ` interface ${tagNameAsPascal} {\n${componentAttributes} }`,
  55614. jsx: ` interface ${tagNameAsPascal} {\n${jsxAttributes} }`,
  55615. element: element.join(`\n`),
  55616. };
  55617. };
  55618. const attributesToMultiLineString = (attributes, jsxAttributes, internal) => {
  55619. const attributesStr = sortBy(attributes, (a) => a.name)
  55620. .filter((type) => {
  55621. if (jsxAttributes && !internal && type.internal) {
  55622. return false;
  55623. }
  55624. return true;
  55625. })
  55626. .reduce((fullList, type) => {
  55627. if (type.jsdoc) {
  55628. fullList.push(` /**`);
  55629. fullList.push(...type.jsdoc.split('\n').map((line) => ' * ' + line));
  55630. fullList.push(` */`);
  55631. }
  55632. const optional = jsxAttributes ? !type.required : type.optional;
  55633. fullList.push(` "${type.name}"${optional ? '?' : ''}: ${type.type};`);
  55634. return fullList;
  55635. }, [])
  55636. .join(`\n`);
  55637. return attributesStr !== '' ? `${attributesStr}\n` : '';
  55638. };
  55639. /**
  55640. * Generates the custom event interface for each component that combines the `CustomEvent` interface with
  55641. * the HTMLElement target. This is used to allow implementers to use strict typings on event handlers.
  55642. *
  55643. * The generated interface accepts a generic for the event detail type. This allows implementers to use
  55644. * custom typings for individual events without Stencil needing to generate an interface for each event.
  55645. *
  55646. * @param cmp The component compiler metadata
  55647. * @returns The generated interface type definition.
  55648. */
  55649. const generateEventDetailTypes = (cmp) => {
  55650. const tagName = cmp.tagName.toLowerCase();
  55651. const tagNameAsPascal = dashToPascalCase$1(tagName);
  55652. const htmlElementName = `HTML${tagNameAsPascal}Element`;
  55653. const isDep = cmp.isCollectionDependency;
  55654. const cmpEventInterface = `${tagNameAsPascal}CustomEvent`;
  55655. const cmpInterface = [
  55656. `export interface ${cmpEventInterface}<T> extends CustomEvent<T> {`,
  55657. ` detail: T;`,
  55658. ` target: ${htmlElementName};`,
  55659. `}`,
  55660. ];
  55661. return {
  55662. isDep,
  55663. tagName,
  55664. tagNameAsPascal,
  55665. htmlElementName,
  55666. component: cmpInterface.join('\n'),
  55667. jsx: cmpInterface.join('\n'),
  55668. element: cmpInterface.join('\n'),
  55669. };
  55670. };
  55671. const COMPONENTS_DTS_HEADER = `/* eslint-disable */
  55672. /* tslint:disable */
  55673. /**
  55674. * This is an autogenerated file created by the Stencil compiler.
  55675. * It contains typing information for all components that exist in this project.
  55676. */`;
  55677. const sortImportNames = (a, b) => {
  55678. const aName = a.localName.toLowerCase();
  55679. const bName = b.localName.toLowerCase();
  55680. if (aName < bName)
  55681. return -1;
  55682. if (aName > bName)
  55683. return 1;
  55684. if (a.localName < b.localName)
  55685. return -1;
  55686. if (a.localName > b.localName)
  55687. return 1;
  55688. return 0;
  55689. };
  55690. /**
  55691. * Find all referenced types by a component and add them to the `importDataObj` parameter
  55692. * @param importDataObj an output parameter that contains the imported types seen thus far by the compiler
  55693. * @param typeCounts a map of seen types and the number of times the type has been seen
  55694. * @param cmp the metadata associated with the component whose types are being inspected
  55695. * @param filePath the path of the component file
  55696. * @returns the updated import data
  55697. */
  55698. const updateReferenceTypeImports = (importDataObj, typeCounts, cmp, filePath) => {
  55699. const updateImportReferences = updateImportReferenceFactory(typeCounts, filePath);
  55700. return [...cmp.properties, ...cmp.events, ...cmp.methods]
  55701. .filter((cmpProp) => cmpProp.complexType && cmpProp.complexType.references)
  55702. .reduce((typesImportData, cmpProp) => {
  55703. return updateImportReferences(typesImportData, cmpProp.complexType.references);
  55704. }, importDataObj);
  55705. };
  55706. /**
  55707. * Factory function to create an `ImportReferenceUpdater` instance
  55708. * @param typeCounts a key-value store of seen type names and the number of times the type name has been seen
  55709. * @param filePath the path of the file containing the component whose imports are being inspected
  55710. * @returns an `ImportReferenceUpdater` instance for updating import references in the provided `filePath`
  55711. */
  55712. const updateImportReferenceFactory = (typeCounts, filePath) => {
  55713. /**
  55714. * Determines the number of times that a type identifier (name) has been used. If an identifier has been used before,
  55715. * append the number of times the identifier has been seen to its name to avoid future naming collisions
  55716. * @param name the identifier name to check for previous usages
  55717. * @returns the identifier name, potentially with an integer appended to its name if it has been seen before.
  55718. */
  55719. function getIncrementTypeName(name) {
  55720. const counter = typeCounts.get(name);
  55721. if (counter === undefined) {
  55722. typeCounts.set(name, 1);
  55723. return name;
  55724. }
  55725. typeCounts.set(name, counter + 1);
  55726. return `${name}${counter}`;
  55727. }
  55728. return (existingTypeImportData, typeReferences) => {
  55729. Object.keys(typeReferences)
  55730. .map((typeName) => {
  55731. return [typeName, typeReferences[typeName]];
  55732. })
  55733. .forEach(([typeName, typeReference]) => {
  55734. let importResolvedFile;
  55735. // If global then there is no import statement needed
  55736. if (typeReference.location === 'global') {
  55737. return;
  55738. // If local then import location is the current file
  55739. }
  55740. else if (typeReference.location === 'local') {
  55741. importResolvedFile = filePath;
  55742. }
  55743. else if (typeReference.location === 'import') {
  55744. importResolvedFile = typeReference.path;
  55745. }
  55746. // If this is a relative path make it absolute
  55747. if (importResolvedFile.startsWith('.')) {
  55748. importResolvedFile = resolve$1(dirname(filePath), importResolvedFile);
  55749. }
  55750. existingTypeImportData[importResolvedFile] = existingTypeImportData[importResolvedFile] || [];
  55751. // If this file already has a reference to this type move on
  55752. if (existingTypeImportData[importResolvedFile].find((df) => df.localName === typeName)) {
  55753. return;
  55754. }
  55755. const newTypeName = getIncrementTypeName(typeName);
  55756. existingTypeImportData[importResolvedFile].push({
  55757. localName: typeName,
  55758. importName: newTypeName,
  55759. });
  55760. });
  55761. return existingTypeImportData;
  55762. };
  55763. };
  55764. /**
  55765. * Generates and writes a `components.d.ts` file to disk. This file may be written to the `src` directory of a project,
  55766. * or be written to a directory that is meant to be distributed (e.g. the output directory of `dist-custom-elements`).
  55767. * @param config the Stencil configuration associated with the project being compiled
  55768. * @param compilerCtx the current compiler context
  55769. * @param buildCtx the context associated with the current build
  55770. * @param destination the relative directory in the filesystem to write the type declaration file to
  55771. * @returns `true` if the type declaration file written to disk has changed, `false` otherwise
  55772. */
  55773. const generateAppTypes = async (config, compilerCtx, buildCtx, destination) => {
  55774. // only gather components that are still root ts files we've found and have component metadata
  55775. // the compilerCtx cache may still have files that may have been deleted/renamed
  55776. const timespan = buildCtx.createTimeSpan(`generated app types started`, true);
  55777. const areTypesInternal = destination === 'src';
  55778. // Generate d.ts files for component types
  55779. let componentTypesFileContent = generateComponentTypesFile(config, buildCtx, areTypesInternal);
  55780. // immediately write the components.d.ts file to disk and put it into fs memory
  55781. let componentsDtsFilePath = getComponentsDtsSrcFilePath(config);
  55782. if (!areTypesInternal) {
  55783. componentsDtsFilePath = resolve$1(destination, GENERATED_DTS$1);
  55784. componentTypesFileContent = updateStencilTypesImports(destination, componentsDtsFilePath, componentTypesFileContent);
  55785. }
  55786. const writeResults = await compilerCtx.fs.writeFile(componentsDtsFilePath, componentTypesFileContent, {
  55787. immediateWrite: true,
  55788. });
  55789. const hasComponentsDtsChanged = writeResults.changedContent;
  55790. const componentsDtsRelFileName = relative$1(config.rootDir, componentsDtsFilePath);
  55791. if (hasComponentsDtsChanged) {
  55792. config.logger.debug(`generateAppTypes: ${componentsDtsRelFileName} has changed`);
  55793. }
  55794. timespan.finish(`generated app types finished: ${componentsDtsRelFileName}`);
  55795. return hasComponentsDtsChanged;
  55796. };
  55797. /**
  55798. * Generates a `components.d.ts` file's contents, which contains the typings for all components in a Stencil project
  55799. * @param config the Stencil configuration associated with the project being compiled
  55800. * @param buildCtx the context associated with the current build
  55801. * @param areTypesInternal determines if non-exported type definitions are being generated or not
  55802. * @returns the contents of the `components.d.ts` file
  55803. */
  55804. const generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
  55805. let typeImportData = {};
  55806. const c = [];
  55807. const allTypes = new Map();
  55808. const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
  55809. const componentEventDetailTypes = [];
  55810. const modules = components.map((cmp) => {
  55811. /**
  55812. * Generate a key-value store that uses the path to the file where an import is defined as the key, and an object
  55813. * containing the import's original name and any 'new' name we give it to avoid collisions. We're generating this
  55814. * data structure for each Stencil component in series, therefore the memory footprint of this entity will likely
  55815. * grow as more components (with additional types) are processed.
  55816. */
  55817. typeImportData = updateReferenceTypeImports(typeImportData, allTypes, cmp, cmp.sourceFilePath);
  55818. if (cmp.events.length > 0) {
  55819. /**
  55820. * Only generate event detail types for components that have events.
  55821. */
  55822. componentEventDetailTypes.push(generateEventDetailTypes(cmp));
  55823. }
  55824. return generateComponentTypes(cmp, typeImportData, areTypesInternal);
  55825. });
  55826. c.push(COMPONENTS_DTS_HEADER);
  55827. c.push(`import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";`);
  55828. // write the import statements for our type declaration file
  55829. c.push(...Object.keys(typeImportData).map((filePath) => {
  55830. const typeData = typeImportData[filePath];
  55831. let importFilePath;
  55832. if (isAbsolute$1(filePath)) {
  55833. importFilePath = normalizePath$1('./' + relative$1(config.srcDir, filePath)).replace(/\.(tsx|ts)$/, '');
  55834. }
  55835. else {
  55836. importFilePath = filePath;
  55837. }
  55838. return `import { ${typeData
  55839. .sort(sortImportNames)
  55840. .map((td) => {
  55841. if (td.localName === td.importName) {
  55842. return `${td.importName}`;
  55843. }
  55844. else {
  55845. return `${td.localName} as ${td.importName}`;
  55846. }
  55847. })
  55848. .join(`, `)} } from "${importFilePath}";`;
  55849. }));
  55850. c.push(`export namespace Components {`);
  55851. c.push(...modules.map((m) => `${m.component}`));
  55852. c.push(`}`);
  55853. c.push(...componentEventDetailTypes.map((m) => `${m.component}`));
  55854. c.push(`declare global {`);
  55855. c.push(...modules.map((m) => m.element));
  55856. c.push(` interface HTMLElementTagNameMap {`);
  55857. c.push(...modules.map((m) => ` "${m.tagName}": ${m.htmlElementName};`));
  55858. c.push(` }`);
  55859. c.push(`}`);
  55860. c.push(`declare namespace LocalJSX {`);
  55861. c.push(...modules.map((m) => ` ${m.jsx}`));
  55862. c.push(` interface IntrinsicElements {`);
  55863. c.push(...modules.map((m) => ` "${m.tagName}": ${m.tagNameAsPascal};`));
  55864. c.push(` }`);
  55865. c.push(`}`);
  55866. c.push(`export { LocalJSX as JSX };`);
  55867. c.push(`declare module "@stencil/core" {`);
  55868. c.push(` export namespace JSX {`);
  55869. c.push(` interface IntrinsicElements {`);
  55870. c.push(...modules.map((m) => ` "${m.tagName}": LocalJSX.${m.tagNameAsPascal} & JSXBase.HTMLAttributes<${m.htmlElementName}>;`));
  55871. c.push(` }`);
  55872. c.push(` }`);
  55873. c.push(`}`);
  55874. return c.join(`\n`) + `\n`;
  55875. };
  55876. /**
  55877. * For a single output target, generate types, then copy the Stencil core type declaration file
  55878. * @param config the Stencil configuration associated with the project being compiled
  55879. * @param compilerCtx the current compiler context
  55880. * @param buildCtx the context associated with the current build
  55881. * @param outputTarget the output target to generate types for
  55882. */
  55883. const generateTypes = async (config, compilerCtx, buildCtx, outputTarget) => {
  55884. if (!buildCtx.hasError) {
  55885. await generateTypesOutput(config, compilerCtx, buildCtx, outputTarget);
  55886. await copyStencilCoreDts(config, compilerCtx);
  55887. }
  55888. };
  55889. /**
  55890. * Generate type definition files and write them to a dist directory
  55891. * @param config the Stencil configuration associated with the project being compiled
  55892. * @param compilerCtx the current compiler context
  55893. * @param buildCtx the context associated with the current build
  55894. * @param outputTarget the output target to generate types for
  55895. */
  55896. const generateTypesOutput = async (config, compilerCtx, buildCtx, outputTarget) => {
  55897. // get all type declaration files in a project's src/ directory
  55898. const srcDirItems = await compilerCtx.fs.readdir(config.srcDir, { recursive: false });
  55899. const srcDtsFiles = srcDirItems.filter((srcItem) => srcItem.isFile && isDtsFile$1(srcItem.absPath));
  55900. // Copy .d.ts files from src to dist
  55901. // In addition, all references to @stencil/core are replaced
  55902. const copiedDTSFilePaths = await Promise.all(srcDtsFiles.map(async (srcDtsFile) => {
  55903. const relPath = relative$1(config.srcDir, srcDtsFile.absPath);
  55904. const distPath = join(outputTarget.typesDir, relPath);
  55905. const originalDtsContent = await compilerCtx.fs.readFile(srcDtsFile.absPath);
  55906. const distDtsContent = updateStencilTypesImports(outputTarget.typesDir, distPath, originalDtsContent);
  55907. await compilerCtx.fs.writeFile(distPath, distDtsContent);
  55908. return distPath;
  55909. }));
  55910. const distDtsFilePath = copiedDTSFilePaths.slice(-1)[0];
  55911. const distPath = outputTarget.typesDir;
  55912. await generateAppTypes(config, compilerCtx, buildCtx, distPath);
  55913. const { typesDir } = outputTarget;
  55914. if (distDtsFilePath) {
  55915. await generateCustomElementsBundleTypes(config, compilerCtx, buildCtx, distDtsFilePath);
  55916. await generateCustomElementsTypes(config, compilerCtx, buildCtx, typesDir);
  55917. }
  55918. };
  55919. /**
  55920. * Entrypoint for generating types for all output targets
  55921. * @param config the Stencil configuration associated with the project being compiled
  55922. * @param compilerCtx the current compiler context
  55923. * @param buildCtx the context associated with the current build
  55924. */
  55925. const outputTypes = async (config, compilerCtx, buildCtx) => {
  55926. const outputTargets = config.outputTargets.filter(isOutputTargetDistTypes);
  55927. if (outputTargets.length === 0) {
  55928. return;
  55929. }
  55930. const timespan = buildCtx.createTimeSpan(`generate types started`, true);
  55931. await Promise.all(outputTargets.map((outputsTarget) => generateTypes(config, compilerCtx, buildCtx, outputsTarget)));
  55932. timespan.finish(`generate types finished`);
  55933. };
  55934. const generateEs5DisabledMessage = async (config, compilerCtx, outputTarget) => {
  55935. // not doing an es5 right now
  55936. // but it's possible during development the user
  55937. // tests on a browser that doesn't support es2017
  55938. const fileName = `${config.fsNamespace}.js`;
  55939. const filePath = join(outputTarget.buildDir, fileName);
  55940. await compilerCtx.fs.writeFile(filePath, getDisabledMessageScript(config));
  55941. return fileName;
  55942. };
  55943. const getDisabledMessageScript = (config) => {
  55944. const style = `
  55945. <style>
  55946. body {
  55947. display: block !important;
  55948. font-family: sans-serif;
  55949. padding: 20px;
  55950. line-height:22px;
  55951. }
  55952. h1 {
  55953. font-size: 18px;
  55954. }
  55955. h2 {
  55956. font-size: 14px;
  55957. margin-top: 40px;
  55958. }
  55959. </style>
  55960. `;
  55961. const htmlLegacy = `
  55962. ${style}
  55963. <h1>This Stencil app is disabled for this browser.</h1>
  55964. <h2>Developers:</h2>
  55965. <ul>
  55966. <li>ES5 builds are disabled <strong>during development</strong> to take advantage of 2x faster build times.</li>
  55967. <li>Please see the example below or our <a href="https://stenciljs.com/docs/stencil-config" target="_blank" rel="noopener noreferrer">config docs</a> if you would like to develop on a browser that does not fully support ES2017 and custom elements.</li>
  55968. <li>Note that as of Stencil v2, ES5 builds and polyfills are <strong>disabled</strong> during production builds. You can enable these <a href="https://stenciljs.com/docs/config#buildes5" target="_blank" rel="noopener noreferrer">in your stencil.config.ts file</a>.</li>
  55969. <li>When testing browsers it is recommended to always test in production mode, and ES5 builds should always be enabled during production builds.</li>
  55970. <li><em>This is only an experiment and if it slows down app development then we will revert this and enable ES5 builds during dev.</em></li>
  55971. </ul>
  55972. <h2>Enabling ES5 builds during development:</h2>
  55973. <pre>
  55974. <code>npm run dev --es5</code>
  55975. </pre>
  55976. <p>For stencil-component-starter, use:</p>
  55977. <pre>
  55978. <code>npm start --es5</code>
  55979. </pre>
  55980. <h2>Enabling full production builds during development:</h2>
  55981. <pre>
  55982. <code>npm run dev --prod</code>
  55983. </pre>
  55984. <p>For stencil-component-starter, use:</p>
  55985. <pre>
  55986. <code>npm start --prod</code>
  55987. </pre>
  55988. <h2>Current Browser's Support:</h2>
  55989. <ul>
  55990. <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import">ES Module Imports</a>: <span id="es-modules-test"></span></li>
  55991. <li><a href="http://2ality.com/2017/01/import-operator.html">ES Dynamic Imports</a>: <span id="es-dynamic-modules-test"></span></li>
  55992. <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements">Custom Elements</a>: <span id="custom-elements-test"></span></li>
  55993. <li><a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM">Shadow DOM</a>: <span id="shadow-dom-test"></span></li>
  55994. <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">fetch</a>: <span id="fetch-test"></span></li>
  55995. <li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables">CSS Variables</a>: <span id="css-variables-test"></span></li>
  55996. </ul>
  55997. <h2>Current Browser:</h2>
  55998. <pre>
  55999. <code id="current-browser-output"></code>
  56000. </pre>
  56001. `;
  56002. const htmlUpdate = `
  56003. ${style}
  56004. <h1>Update src/index.html</h1>
  56005. <p>Stencil recently changed how scripts are loaded in order to improve performance.</p>
  56006. <h2>BEFORE:</h2>
  56007. <p>Previously, a single script was included that handled loading the correct JavaScript based on browser support.</p>
  56008. <pre>
  56009. <code>${escapeHtml(`<script src="/build/${config.fsNamespace}.js"></script>
  56010. `)}</code>
  56011. </pre>
  56012. <h2 style="margin-top:0">AFTER:</h2>
  56013. <p>The index.html should now include two scripts using the modern ES Module script pattern.
  56014. Note that only one file will actually be requested and loaded based on the browser's native support for ES Modules.
  56015. For more info, please see <a href="https://developers.google.com/web/fundamentals/primers/modules#browser" target="_blank" rel="noopener noreferrer">Using JavaScript modules on the web</a>.
  56016. </p>
  56017. <pre>
  56018. <code>${escapeHtml(`<script`)} <span style="background:yellow">type="module"</span> src="/build/${config.fsNamespace}<span style="background:yellow">.esm</span>.js"${escapeHtml(`></script>`)}
  56019. ${escapeHtml(`<script`)} <span style="background:yellow">nomodule</span> ${escapeHtml(`src="/build/${config.fsNamespace}.js"></script>`)}</code>
  56020. </pre>
  56021. `;
  56022. return `${generatePreamble(config)}
  56023. (function() {
  56024. function checkSupport() {
  56025. if (!document.body) {
  56026. setTimeout(checkSupport);
  56027. return;
  56028. }
  56029. function supportsDynamicImports() {
  56030. try {
  56031. new Function('import("")');
  56032. return true;
  56033. } catch (e) {}
  56034. return false;
  56035. }
  56036. var supportsEsModules = !!('noModule' in document.createElement('script'));
  56037. if (!supportsEsModules) {
  56038. document.body.innerHTML = '${inlineHTML(htmlLegacy)}';
  56039. document.getElementById('current-browser-output').textContent = window.navigator.userAgent;
  56040. document.getElementById('es-modules-test').textContent = supportsEsModules;
  56041. document.getElementById('es-dynamic-modules-test').textContent = supportsDynamicImports();
  56042. document.getElementById('shadow-dom-test').textContent = !!(document.head.attachShadow);
  56043. document.getElementById('custom-elements-test').textContent = !!(window.customElements);
  56044. document.getElementById('css-variables-test').textContent = !!(window.CSS && window.CSS.supports && window.CSS.supports('color', 'var(--c)'));
  56045. document.getElementById('fetch-test').textContent = !!(window.fetch);
  56046. } else {
  56047. document.body.innerHTML = '${inlineHTML(htmlUpdate)}';
  56048. }
  56049. }
  56050. setTimeout(checkSupport);
  56051. })();`;
  56052. };
  56053. const inlineHTML = (html) => {
  56054. return html.replace(/\n/g, '\\n').replace(/\'/g, `\\'`).trim();
  56055. };
  56056. const addScriptDataAttribute = (config, doc, outputTarget) => {
  56057. const resourcesUrl = getAbsoluteBuildDir(outputTarget);
  56058. const entryEsmFilename = `${config.fsNamespace}.esm.js`;
  56059. const entryNoModuleFilename = `${config.fsNamespace}.js`;
  56060. const expectedEsmSrc = join(resourcesUrl, entryEsmFilename);
  56061. const expectedNoModuleSrc = join(resourcesUrl, entryNoModuleFilename);
  56062. const scripts = Array.from(doc.querySelectorAll('script'));
  56063. const scriptEsm = scripts.find((s) => s.getAttribute('src') === expectedEsmSrc);
  56064. const scriptNomodule = scripts.find((s) => s.getAttribute('src') === expectedNoModuleSrc);
  56065. if (scriptEsm) {
  56066. scriptEsm.setAttribute('data-stencil', '');
  56067. }
  56068. if (scriptNomodule) {
  56069. scriptNomodule.setAttribute('data-stencil', '');
  56070. }
  56071. };
  56072. const generateServiceWorker = async (config, buildCtx, workbox, outputTarget) => {
  56073. const serviceWorker = await getServiceWorker(outputTarget);
  56074. if (serviceWorker.unregister) {
  56075. await config.sys.writeFile(serviceWorker.swDest, SELF_UNREGISTER_SW);
  56076. }
  56077. else if (serviceWorker.swSrc) {
  56078. return Promise.all([copyLib(buildCtx, outputTarget, workbox), injectManifest(buildCtx, serviceWorker, workbox)]);
  56079. }
  56080. else {
  56081. return generateSW(buildCtx, serviceWorker, workbox);
  56082. }
  56083. };
  56084. const copyLib = async (buildCtx, outputTarget, workbox) => {
  56085. const timeSpan = buildCtx.createTimeSpan(`copy service worker library started`, true);
  56086. try {
  56087. await workbox.copyWorkboxLibraries(outputTarget.appDir);
  56088. }
  56089. catch (e) {
  56090. const d = buildWarn(buildCtx.diagnostics);
  56091. d.messageText = 'Service worker library already exists';
  56092. }
  56093. timeSpan.finish(`copy service worker library finished`);
  56094. };
  56095. const generateSW = async (buildCtx, serviceWorker, workbox) => {
  56096. const timeSpan = buildCtx.createTimeSpan(`generate service worker started`);
  56097. try {
  56098. await workbox.generateSW(serviceWorker);
  56099. timeSpan.finish(`generate service worker finished`);
  56100. }
  56101. catch (e) {
  56102. catchError(buildCtx.diagnostics, e);
  56103. }
  56104. };
  56105. const injectManifest = async (buildCtx, serviceWorker, workbox) => {
  56106. const timeSpan = buildCtx.createTimeSpan(`inject manifest into service worker started`);
  56107. try {
  56108. await workbox.injectManifest(serviceWorker);
  56109. timeSpan.finish('inject manifest into service worker finished');
  56110. }
  56111. catch (e) {
  56112. catchError(buildCtx.diagnostics, e);
  56113. }
  56114. };
  56115. const hasServiceWorkerChanges = (config, buildCtx) => {
  56116. if (config.devMode && !config.flags.serviceWorker) {
  56117. return false;
  56118. }
  56119. const wwwServiceOutputs = config.outputTargets
  56120. .filter(isOutputTargetWww)
  56121. .filter((o) => o.serviceWorker && o.serviceWorker.swSrc);
  56122. return wwwServiceOutputs.some((outputTarget) => {
  56123. return buildCtx.filesChanged.some((fileChanged) => {
  56124. if (outputTarget.serviceWorker) {
  56125. return basename(fileChanged).toLowerCase() === basename(outputTarget.serviceWorker.swSrc).toLowerCase();
  56126. }
  56127. return false;
  56128. });
  56129. });
  56130. };
  56131. const getServiceWorker = async (outputTarget) => {
  56132. if (!outputTarget.serviceWorker) {
  56133. return undefined;
  56134. }
  56135. const serviceWorker = {
  56136. ...outputTarget.serviceWorker,
  56137. };
  56138. if (serviceWorker.unregister !== true) {
  56139. delete serviceWorker.unregister;
  56140. }
  56141. return serviceWorker;
  56142. };
  56143. const INDEX_ORG = 'index-org.html';
  56144. const getRegisterSW = (swUrl) => {
  56145. return `
  56146. if ('serviceWorker' in navigator && location.protocol !== 'file:') {
  56147. window.addEventListener('load', function() {
  56148. navigator.serviceWorker.register('${swUrl}')
  56149. .then(function(reg) {
  56150. reg.onupdatefound = function() {
  56151. var installingWorker = reg.installing;
  56152. installingWorker.onstatechange = function() {
  56153. if (installingWorker.state === 'installed') {
  56154. window.dispatchEvent(new Event('swUpdate'))
  56155. }
  56156. }
  56157. }
  56158. })
  56159. .catch(function(err) { console.error('service worker error', err) });
  56160. });
  56161. }`;
  56162. };
  56163. const UNREGISTER_SW = `
  56164. if ('serviceWorker' in navigator && location.protocol !== 'file:') {
  56165. // auto-unregister service worker during dev mode
  56166. navigator.serviceWorker.getRegistration().then(function(registration) {
  56167. if (registration) {
  56168. registration.unregister().then(function() { location.reload(true) });
  56169. }
  56170. });
  56171. }
  56172. `;
  56173. const SELF_UNREGISTER_SW = `
  56174. self.addEventListener('install', function(e) {
  56175. self.skipWaiting();
  56176. });
  56177. self.addEventListener('activate', function(e) {
  56178. self.registration.unregister()
  56179. .then(function() {
  56180. return self.clients.matchAll();
  56181. })
  56182. .then(function(clients) {
  56183. clients.forEach(client => client.navigate(client.url))
  56184. });
  56185. });
  56186. `;
  56187. const generateServiceWorkerUrl = (outputTarget, serviceWorker) => {
  56188. let swUrl = normalizePath$1(relative$1(outputTarget.appDir, serviceWorker.swDest));
  56189. if (swUrl.charAt(0) !== '/') {
  56190. swUrl = '/' + swUrl;
  56191. }
  56192. const baseUrl = new URL(outputTarget.baseUrl, 'http://config.stenciljs.com');
  56193. let basePath = baseUrl.pathname;
  56194. if (!basePath.endsWith('/')) {
  56195. basePath += '/';
  56196. }
  56197. swUrl = basePath + swUrl.substring(1);
  56198. return swUrl;
  56199. };
  56200. const updateIndexHtmlServiceWorker = async (config, buildCtx, doc, outputTarget) => {
  56201. const serviceWorker = outputTarget.serviceWorker;
  56202. if (serviceWorker !== false) {
  56203. if ((serviceWorker && serviceWorker.unregister) || (!serviceWorker && config.devMode)) {
  56204. injectUnregisterServiceWorker(doc);
  56205. }
  56206. else if (serviceWorker) {
  56207. await injectRegisterServiceWorker(buildCtx, outputTarget, doc);
  56208. }
  56209. }
  56210. };
  56211. const injectRegisterServiceWorker = async (buildCtx, outputTarget, doc) => {
  56212. const swUrl = generateServiceWorkerUrl(outputTarget, outputTarget.serviceWorker);
  56213. const serviceWorker = getRegisterSwScript(doc, buildCtx, swUrl);
  56214. doc.body.appendChild(serviceWorker);
  56215. };
  56216. const injectUnregisterServiceWorker = (doc) => {
  56217. const script = doc.createElement('script');
  56218. script.innerHTML = UNREGISTER_SW;
  56219. doc.body.appendChild(script);
  56220. };
  56221. const getRegisterSwScript = (doc, buildCtx, swUrl) => {
  56222. const script = doc.createElement('script');
  56223. script.setAttribute('data-build', `${buildCtx.timestamp}`);
  56224. script.innerHTML = getRegisterSW(swUrl);
  56225. return script;
  56226. };
  56227. const generateHashedCopy = async (config, compilerCtx, path) => {
  56228. try {
  56229. const content = await compilerCtx.fs.readFile(path);
  56230. const hash = await config.sys.generateContentHash(content, config.hashedFileNameLength);
  56231. const hashedFileName = `p-${hash}${extname$1(path)}`;
  56232. await compilerCtx.fs.writeFile(join(dirname(path), hashedFileName), content);
  56233. return hashedFileName;
  56234. }
  56235. catch (e) { }
  56236. return undefined;
  56237. };
  56238. const optimizeEsmImport = async (config, compilerCtx, doc, outputTarget) => {
  56239. const resourcesUrl = getAbsoluteBuildDir(outputTarget);
  56240. const entryFilename = `${config.fsNamespace}.esm.js`;
  56241. const expectedSrc = join(resourcesUrl, entryFilename);
  56242. const script = Array.from(doc.querySelectorAll('script')).find((s) => s.getAttribute('type') === 'module' && !s.hasAttribute('crossorigin') && s.getAttribute('src') === expectedSrc);
  56243. if (!script) {
  56244. return false;
  56245. }
  56246. script.setAttribute('data-resources-url', resourcesUrl);
  56247. script.setAttribute('data-stencil-namespace', config.fsNamespace);
  56248. const entryPath = join(outputTarget.buildDir, entryFilename);
  56249. const content = await compilerCtx.fs.readFile(entryPath);
  56250. if (isString$1(content)) {
  56251. // If the script is too big, instead of inlining, we hash the file and change
  56252. // the <script> to the new location
  56253. if (config.allowInlineScripts && content.length < MAX_JS_INLINE_SIZE) {
  56254. // Let's try to inline, we have to fix all the relative paths of the imports
  56255. const results = updateImportPaths(content, resourcesUrl);
  56256. if (results.orgImportPaths.length > 0) {
  56257. // insert inline script
  56258. script.removeAttribute('src');
  56259. script.innerHTML = results.code;
  56260. }
  56261. }
  56262. else {
  56263. const hashedFile = await generateHashedCopy(config, compilerCtx, entryPath);
  56264. if (hashedFile) {
  56265. const hashedPath = join(resourcesUrl, hashedFile);
  56266. script.setAttribute('src', hashedPath);
  56267. injectModulePreloads(doc, [hashedPath]);
  56268. }
  56269. }
  56270. return true;
  56271. }
  56272. return false;
  56273. };
  56274. const updateImportPaths = (code, newDir) => {
  56275. const orgImportPaths = [];
  56276. const tsSourceFile = t.createSourceFile('module.ts', code, t.ScriptTarget.Latest);
  56277. t.transform(tsSourceFile, [readImportPaths(orgImportPaths)]);
  56278. orgImportPaths.forEach((orgImportPath) => {
  56279. const newPath = replacePathDir(orgImportPath, newDir);
  56280. if (newPath) {
  56281. code = code.replace(`"${orgImportPath}"`, `"${newPath}"`);
  56282. code = code.replace(`'${orgImportPath}'`, `'${newPath}'`);
  56283. }
  56284. });
  56285. return {
  56286. code,
  56287. orgImportPaths,
  56288. };
  56289. };
  56290. const replacePathDir = (orgImportPath, newDir) => {
  56291. if (orgImportPath.startsWith('./') && (orgImportPath.endsWith('.js') || orgImportPath.endsWith('.mjs'))) {
  56292. return newDir + orgImportPath.substring(2);
  56293. }
  56294. return null;
  56295. };
  56296. const readImportPaths = (orgImportPaths) => {
  56297. return () => {
  56298. return (tsSourceFile) => {
  56299. const importStatements = tsSourceFile.statements
  56300. .filter(t.isImportDeclaration)
  56301. .filter((s) => s.moduleSpecifier != null)
  56302. .filter((s) => t.isStringLiteral(s.moduleSpecifier) && s.moduleSpecifier.text);
  56303. importStatements.forEach((s) => {
  56304. if (t.isStringLiteral(s.moduleSpecifier)) {
  56305. orgImportPaths.push(s.moduleSpecifier.text);
  56306. }
  56307. });
  56308. return tsSourceFile;
  56309. };
  56310. };
  56311. };
  56312. // https://twitter.com/addyosmani/status/1143938175926095872
  56313. const MAX_JS_INLINE_SIZE = 1 * 1024;
  56314. const inlineStyleSheets = (compilerCtx, doc, maxSize, outputTarget) => {
  56315. const globalLinks = Array.from(doc.querySelectorAll('link[rel=stylesheet]'));
  56316. return Promise.all(globalLinks.map(async (link) => {
  56317. const href = link.getAttribute('href');
  56318. if (typeof href !== 'string' || !href.startsWith('/') || link.getAttribute('media') !== null) {
  56319. return;
  56320. }
  56321. try {
  56322. const fsPath = join(outputTarget.dir, href);
  56323. const styles = await compilerCtx.fs.readFile(fsPath);
  56324. if (styles.length > maxSize) {
  56325. return;
  56326. }
  56327. // insert inline <style>
  56328. const inlinedStyles = doc.createElement('style');
  56329. inlinedStyles.innerHTML = styles;
  56330. link.parentNode.insertBefore(inlinedStyles, link);
  56331. link.remove();
  56332. }
  56333. catch (e) { }
  56334. }));
  56335. };
  56336. const updateGlobalStylesLink = (config, doc, globalScriptFilename, outputTarget) => {
  56337. if (!globalScriptFilename) {
  56338. return;
  56339. }
  56340. const buildDir = getAbsoluteBuildDir(outputTarget);
  56341. const originalPath = join(buildDir, config.fsNamespace + '.css');
  56342. const newPath = join(buildDir, globalScriptFilename);
  56343. if (originalPath === newPath) {
  56344. return;
  56345. }
  56346. const replacer = new RegExp(escapeRegExp(originalPath) + '$');
  56347. Array.from(doc.querySelectorAll('link')).forEach((link) => {
  56348. const href = link.getAttribute('href');
  56349. if (href) {
  56350. const newHref = href.replace(replacer, newPath);
  56351. if (newHref !== href) {
  56352. link.setAttribute('href', newHref);
  56353. }
  56354. }
  56355. });
  56356. };
  56357. const escapeRegExp = (text) => text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
  56358. const outputWww = async (config, compilerCtx, buildCtx) => {
  56359. const outputTargets = config.outputTargets.filter(isOutputTargetWww);
  56360. if (outputTargets.length === 0) {
  56361. return;
  56362. }
  56363. const timespan = buildCtx.createTimeSpan(`generate www started`, true);
  56364. const criticalBundles = getCriticalPath(buildCtx);
  56365. await Promise.all(outputTargets.map((outputTarget) => generateWww(config, compilerCtx, buildCtx, criticalBundles, outputTarget)));
  56366. timespan.finish(`generate www finished`);
  56367. };
  56368. const getCriticalPath = (buildCtx) => {
  56369. const componentGraph = buildCtx.componentGraph;
  56370. if (!buildCtx.indexDoc || !componentGraph) {
  56371. return [];
  56372. }
  56373. return unique(flatOne(getUsedComponents(buildCtx.indexDoc, buildCtx.components)
  56374. .map((tagName) => getScopeId(tagName))
  56375. .map((scopeId) => buildCtx.componentGraph.get(scopeId) || []))).sort();
  56376. };
  56377. const generateWww = async (config, compilerCtx, buildCtx, criticalPath, outputTarget) => {
  56378. if (!config.buildEs5) {
  56379. await generateEs5DisabledMessage(config, compilerCtx, outputTarget);
  56380. }
  56381. // Copy global styles into the build directory
  56382. // Process
  56383. if (buildCtx.indexDoc && outputTarget.indexHtml) {
  56384. await generateIndexHtml(config, compilerCtx, buildCtx, criticalPath, outputTarget);
  56385. }
  56386. await generateHostConfig(compilerCtx, outputTarget);
  56387. };
  56388. const generateHostConfig = (compilerCtx, outputTarget) => {
  56389. const buildDir = getAbsoluteBuildDir(outputTarget);
  56390. const hostConfigPath = join(outputTarget.appDir, 'host.config.json');
  56391. const hostConfigContent = JSON.stringify({
  56392. hosting: {
  56393. headers: [
  56394. {
  56395. source: join(buildDir, '/p-*'),
  56396. headers: [
  56397. {
  56398. key: 'Cache-Control',
  56399. value: 'max-age=31556952, s-maxage=31556952, immutable',
  56400. },
  56401. ],
  56402. },
  56403. ],
  56404. },
  56405. }, null, ' ');
  56406. return compilerCtx.fs.writeFile(hostConfigPath, hostConfigContent, { outputTargetType: outputTarget.type });
  56407. };
  56408. const generateIndexHtml = async (config, compilerCtx, buildCtx, criticalPath, outputTarget) => {
  56409. if (compilerCtx.hasSuccessfulBuild && !buildCtx.hasHtmlChanges) {
  56410. // no need to rebuild index.html if there were no app file changes
  56411. return;
  56412. }
  56413. // get the source index html content
  56414. try {
  56415. const doc = cloneDocument(buildCtx.indexDoc);
  56416. addScriptDataAttribute(config, doc, outputTarget);
  56417. // validateHtml(config, buildCtx, doc);
  56418. await updateIndexHtmlServiceWorker(config, buildCtx, doc, outputTarget);
  56419. if (!config.watch && !config.devMode) {
  56420. const globalStylesFilename = await generateHashedCopy(config, compilerCtx, join(outputTarget.buildDir, `${config.fsNamespace}.css`));
  56421. const scriptFound = await optimizeEsmImport(config, compilerCtx, doc, outputTarget);
  56422. await inlineStyleSheets(compilerCtx, doc, MAX_CSS_INLINE_SIZE, outputTarget);
  56423. updateGlobalStylesLink(config, doc, globalStylesFilename, outputTarget);
  56424. if (scriptFound) {
  56425. optimizeCriticalPath(doc, criticalPath, outputTarget);
  56426. }
  56427. }
  56428. const indexContent = serializeNodeToHtml(doc);
  56429. await compilerCtx.fs.writeFile(outputTarget.indexHtml, indexContent, { outputTargetType: outputTarget.type });
  56430. if (outputTarget.serviceWorker && config.flags.prerender) {
  56431. await compilerCtx.fs.writeFile(join(outputTarget.appDir, INDEX_ORG), indexContent, {
  56432. outputTargetType: outputTarget.type,
  56433. });
  56434. }
  56435. buildCtx.debug(`generateIndexHtml, write: ${relative$1(config.rootDir, outputTarget.indexHtml)}`);
  56436. }
  56437. catch (e) {
  56438. catchError(buildCtx.diagnostics, e);
  56439. }
  56440. };
  56441. const MAX_CSS_INLINE_SIZE = 3 * 1024;
  56442. const generateOutputTargets = async (config, compilerCtx, buildCtx) => {
  56443. const timeSpan = buildCtx.createTimeSpan('generate outputs started', true);
  56444. const changedModuleFiles = Array.from(compilerCtx.changedModules)
  56445. .map((filename) => compilerCtx.moduleMap.get(filename))
  56446. .filter((mod) => mod && !mod.isCollectionDependency);
  56447. compilerCtx.changedModules.clear();
  56448. invalidateRollupCaches(compilerCtx);
  56449. await Promise.all([
  56450. outputAngular(config, compilerCtx, buildCtx),
  56451. outputCopy(config, compilerCtx, buildCtx),
  56452. outputCollection(config, compilerCtx, buildCtx, changedModuleFiles),
  56453. outputCustomElements(config, compilerCtx, buildCtx),
  56454. outputCustomElementsBundle(config, compilerCtx, buildCtx),
  56455. outputHydrateScript(config, compilerCtx, buildCtx),
  56456. outputLazyLoader(config, compilerCtx),
  56457. outputLazy(config, compilerCtx, buildCtx),
  56458. outputWww(config, compilerCtx, buildCtx),
  56459. ]);
  56460. // must run after all the other outputs
  56461. // since it validates files were created
  56462. await outputDocs(config, compilerCtx, buildCtx);
  56463. await outputTypes(config, compilerCtx, buildCtx);
  56464. timeSpan.finish('generate outputs finished');
  56465. };
  56466. const invalidateRollupCaches = (compilerCtx) => {
  56467. const invalidatedIds = compilerCtx.changedFiles;
  56468. compilerCtx.rollupCache.forEach((cache) => {
  56469. cache.modules.forEach((mod) => {
  56470. if (mod.transformDependencies.some((id) => invalidatedIds.has(id))) {
  56471. mod.originalCode = null;
  56472. }
  56473. });
  56474. });
  56475. };
  56476. const isEmptable = (o) => isOutputTargetDist(o) ||
  56477. isOutputTargetDistCustomElements(o) ||
  56478. isOutputTargetDistCustomElementsBundle(o) ||
  56479. isOutputTargetWww(o) ||
  56480. isOutputTargetDistLazy(o) ||
  56481. isOutputTargetDistLazyLoader(o) ||
  56482. isOutputTargetHydrate(o);
  56483. const emptyOutputTargets = async (config, compilerCtx, buildCtx) => {
  56484. if (buildCtx.isRebuild) {
  56485. return;
  56486. }
  56487. const cleanDirs = config.outputTargets
  56488. .filter(isEmptable)
  56489. .filter((o) => o.empty === true)
  56490. .map((o) => o.dir || o.esmDir)
  56491. .filter(isString$1);
  56492. if (cleanDirs.length === 0) {
  56493. return;
  56494. }
  56495. const timeSpan = buildCtx.createTimeSpan(`cleaning ${cleanDirs.length} dirs`, true);
  56496. await compilerCtx.fs.emptyDirs(cleanDirs);
  56497. timeSpan.finish('cleaning dirs finished');
  56498. };
  56499. const optimizeCss = async (config, compilerCtx, diagnostics, styleText, filePath) => {
  56500. if (typeof styleText !== 'string' || !styleText.length) {
  56501. // don't bother with invalid data
  56502. return styleText;
  56503. }
  56504. if ((config.autoprefixCss === false || config.autoprefixCss === null) && !config.minifyCss) {
  56505. // don't wanna autoprefix or minify, so just skip this
  56506. return styleText;
  56507. }
  56508. if (typeof filePath === 'string') {
  56509. filePath = normalizePath$1(filePath);
  56510. }
  56511. const opts = {
  56512. input: styleText,
  56513. filePath: filePath,
  56514. autoprefixer: config.autoprefixCss,
  56515. minify: config.minifyCss,
  56516. };
  56517. const cacheKey = await compilerCtx.cache.createKey('optimizeCss', optimizeCssId, opts);
  56518. const cachedContent = await compilerCtx.cache.get(cacheKey);
  56519. if (cachedContent != null) {
  56520. // let's use the cached data we already figured out
  56521. return cachedContent;
  56522. }
  56523. const minifyResults = await compilerCtx.worker.optimizeCss(opts);
  56524. minifyResults.diagnostics.forEach((d) => {
  56525. // collect up any diagnostics from minifying
  56526. diagnostics.push(d);
  56527. });
  56528. if (typeof minifyResults.output === 'string' && !hasError(diagnostics)) {
  56529. // cool, we got valid minified output
  56530. // only cache if we got a cache key, if not it probably has an @import
  56531. await compilerCtx.cache.put(cacheKey, minifyResults.output);
  56532. return minifyResults.output;
  56533. }
  56534. return styleText;
  56535. };
  56536. const generateGlobalStyles = async (config, compilerCtx, buildCtx) => {
  56537. const outputTargets = config.outputTargets.filter(isOutputTargetDistGlobalStyles);
  56538. if (outputTargets.length === 0) {
  56539. return;
  56540. }
  56541. const globalStyles = await buildGlobalStyles(config, compilerCtx, buildCtx);
  56542. if (globalStyles) {
  56543. await Promise.all(outputTargets.map((o) => compilerCtx.fs.writeFile(o.file, globalStyles)));
  56544. }
  56545. };
  56546. const buildGlobalStyles = async (config, compilerCtx, buildCtx) => {
  56547. let globalStylePath = config.globalStyle;
  56548. if (!globalStylePath) {
  56549. return null;
  56550. }
  56551. const canSkip = await canSkipGlobalStyles(config, compilerCtx, buildCtx);
  56552. if (canSkip) {
  56553. return compilerCtx.cachedGlobalStyle;
  56554. }
  56555. try {
  56556. globalStylePath = normalizePath$1(globalStylePath);
  56557. compilerCtx.addWatchFile(globalStylePath);
  56558. const transformResults = await runPluginTransforms(config, compilerCtx, buildCtx, globalStylePath);
  56559. if (transformResults) {
  56560. const optimizedCss = await optimizeCss(config, compilerCtx, buildCtx.diagnostics, transformResults.code, globalStylePath);
  56561. compilerCtx.cachedGlobalStyle = optimizedCss;
  56562. if (Array.isArray(transformResults.dependencies)) {
  56563. const cssModuleImports = compilerCtx.cssModuleImports.get(globalStylePath) || [];
  56564. transformResults.dependencies.forEach((dep) => {
  56565. compilerCtx.addWatchFile(dep);
  56566. if (!cssModuleImports.includes(dep)) {
  56567. cssModuleImports.push(dep);
  56568. }
  56569. });
  56570. compilerCtx.cssModuleImports.set(globalStylePath, cssModuleImports);
  56571. }
  56572. return optimizedCss;
  56573. }
  56574. }
  56575. catch (e) {
  56576. const d = catchError(buildCtx.diagnostics, e);
  56577. d.absFilePath = globalStylePath;
  56578. }
  56579. compilerCtx.cachedGlobalStyle = null;
  56580. return null;
  56581. };
  56582. const canSkipGlobalStyles = async (config, compilerCtx, buildCtx) => {
  56583. if (!compilerCtx.cachedGlobalStyle) {
  56584. return false;
  56585. }
  56586. if (buildCtx.requiresFullBuild) {
  56587. return false;
  56588. }
  56589. if (buildCtx.isRebuild && !buildCtx.hasStyleChanges) {
  56590. return true;
  56591. }
  56592. if (buildCtx.filesChanged.includes(config.globalStyle)) {
  56593. // changed file IS the global entry style
  56594. return false;
  56595. }
  56596. const cssModuleImports = compilerCtx.cssModuleImports.get(config.globalStyle);
  56597. if (cssModuleImports && buildCtx.filesChanged.some((f) => cssModuleImports.includes(f))) {
  56598. return false;
  56599. }
  56600. const hasChangedImports = await hasChangedImportFile(config, compilerCtx, buildCtx, config.globalStyle, compilerCtx.cachedGlobalStyle, []);
  56601. if (hasChangedImports) {
  56602. return false;
  56603. }
  56604. return true;
  56605. };
  56606. const hasChangedImportFile = async (config, compilerCtx, buildCtx, filePath, content, noLoop) => {
  56607. if (noLoop.includes(filePath)) {
  56608. return false;
  56609. }
  56610. noLoop.push(filePath);
  56611. return hasChangedImportContent(config, compilerCtx, buildCtx, filePath, content, noLoop);
  56612. };
  56613. const hasChangedImportContent = async (config, compilerCtx, buildCtx, filePath, content, checkedFiles) => {
  56614. const cssImports = await getCssImports(config, compilerCtx, buildCtx, filePath, content);
  56615. if (cssImports.length === 0) {
  56616. // don't bother
  56617. return false;
  56618. }
  56619. const isChangedImport = buildCtx.filesChanged.some((changedFilePath) => {
  56620. return cssImports.some((c) => c.filePath === changedFilePath);
  56621. });
  56622. if (isChangedImport) {
  56623. // one of the changed files is an import of this file
  56624. return true;
  56625. }
  56626. // keep diggin'
  56627. const promises = cssImports.map(async (cssImportData) => {
  56628. try {
  56629. const content = await compilerCtx.fs.readFile(cssImportData.filePath);
  56630. return hasChangedImportFile(config, compilerCtx, buildCtx, cssImportData.filePath, content, checkedFiles);
  56631. }
  56632. catch (e) {
  56633. return false;
  56634. }
  56635. });
  56636. const results = await Promise.all(promises);
  56637. return results.includes(true);
  56638. };
  56639. function resolveComponentDependencies(cmps) {
  56640. computeDependencies(cmps);
  56641. computeDependents(cmps);
  56642. }
  56643. function computeDependencies(cmps) {
  56644. const visited = new Set();
  56645. cmps.forEach((cmp) => {
  56646. resolveTransitiveDependencies(cmp, cmps, visited);
  56647. cmp.dependencies = unique(cmp.dependencies).sort();
  56648. });
  56649. }
  56650. function computeDependents(cmps) {
  56651. cmps.forEach((cmp) => {
  56652. resolveTransitiveDependents(cmp, cmps);
  56653. });
  56654. }
  56655. function resolveTransitiveDependencies(cmp, cmps, visited) {
  56656. if (visited.has(cmp)) {
  56657. return cmp.dependencies;
  56658. }
  56659. visited.add(cmp);
  56660. const dependencies = unique(cmp.potentialCmpRefs.filter((tagName) => cmps.some((c) => c.tagName === tagName)));
  56661. cmp.dependencies = cmp.directDependencies = dependencies;
  56662. const transitiveDeps = flatOne(dependencies
  56663. .map((tagName) => cmps.find((c) => c.tagName === tagName))
  56664. .map((c) => resolveTransitiveDependencies(c, cmps, visited)));
  56665. return (cmp.dependencies = [...dependencies, ...transitiveDeps]);
  56666. }
  56667. function resolveTransitiveDependents(cmp, cmps) {
  56668. cmp.dependents = cmps
  56669. .filter((c) => c.dependencies.includes(cmp.tagName))
  56670. .map((c) => c.tagName)
  56671. .sort();
  56672. cmp.directDependents = cmps
  56673. .filter((c) => c.directDependencies.includes(cmp.tagName))
  56674. .map((c) => c.tagName)
  56675. .sort();
  56676. }
  56677. const getDeclarationParameters = (decorator) => {
  56678. if (!t.isCallExpression(decorator.expression)) {
  56679. return [];
  56680. }
  56681. return decorator.expression.arguments.map(getDeclarationParameter);
  56682. };
  56683. const getDeclarationParameter = (arg) => {
  56684. if (t.isObjectLiteralExpression(arg)) {
  56685. return objectLiteralToObjectMap(arg);
  56686. }
  56687. else if (t.isStringLiteral(arg)) {
  56688. return arg.text;
  56689. }
  56690. throw new Error(`invalid decorator argument: ${arg.getText()}`);
  56691. };
  56692. /**
  56693. * Returns a function that checks if a decorator:
  56694. * - is a call expression. these are decorators that are immediately followed by open/close parenthesis with optional
  56695. * arg(s), e.g. `@Prop()`
  56696. * - the name of the decorator matches the provided `propName`
  56697. *
  56698. * @param propName the name of the decorator to match against
  56699. * @returns true if the conditions above are both true, false otherwise
  56700. */
  56701. const isDecoratorNamed = (propName) => {
  56702. return (dec) => {
  56703. return t.isCallExpression(dec.expression) && dec.expression.expression.getText() === propName;
  56704. };
  56705. };
  56706. const styleToStatic = (newMembers, componentOptions) => {
  56707. const defaultModeStyles = [];
  56708. if (componentOptions.styleUrls) {
  56709. if (Array.isArray(componentOptions.styleUrls)) {
  56710. defaultModeStyles.push(...normalizeStyleUrl(componentOptions.styleUrls));
  56711. }
  56712. else {
  56713. defaultModeStyles.push(...normalizeStyleUrl(componentOptions.styleUrls[DEFAULT_STYLE_MODE]));
  56714. }
  56715. }
  56716. if (componentOptions.styleUrl) {
  56717. defaultModeStyles.push(...normalizeStyleUrl(componentOptions.styleUrl));
  56718. }
  56719. let styleUrls = {};
  56720. if (componentOptions.styleUrls && !Array.isArray(componentOptions.styleUrls)) {
  56721. styleUrls = normalizeStyleUrls(componentOptions.styleUrls);
  56722. }
  56723. if (defaultModeStyles.length > 0) {
  56724. styleUrls[DEFAULT_STYLE_MODE] = defaultModeStyles;
  56725. }
  56726. if (Object.keys(styleUrls).length > 0) {
  56727. const originalStyleUrls = convertValueToLiteral(styleUrls);
  56728. newMembers.push(createStaticGetter('originalStyleUrls', originalStyleUrls));
  56729. const norlizedStyleExt = normalizeExtension(styleUrls);
  56730. const normalizedStyleExp = convertValueToLiteral(norlizedStyleExt);
  56731. newMembers.push(createStaticGetter('styleUrls', normalizedStyleExp));
  56732. }
  56733. if (typeof componentOptions.styles === 'string') {
  56734. const styles = componentOptions.styles.trim();
  56735. if (styles.length > 0) {
  56736. // @Component({
  56737. // styles: ":host {...}"
  56738. // })
  56739. newMembers.push(createStaticGetter('styles', t.createLiteral(styles)));
  56740. }
  56741. }
  56742. else if (componentOptions.styles) {
  56743. const convertIdentifier = componentOptions.styles;
  56744. if (convertIdentifier.__identifier) {
  56745. // import styles from './styles.css';
  56746. // @Component({
  56747. // styles
  56748. // })
  56749. const stylesIdentifier = convertIdentifier.__escapedText;
  56750. newMembers.push(createStaticGetter('styles', t.createIdentifier(stylesIdentifier)));
  56751. }
  56752. else if (typeof convertIdentifier === 'object') {
  56753. // import ios from './ios.css';
  56754. // import md from './md.css';
  56755. // @Component({
  56756. // styles: {
  56757. // ios
  56758. // md
  56759. // }
  56760. // })
  56761. if (Object.keys(convertIdentifier).length > 0) {
  56762. newMembers.push(createStaticGetter('styles', convertValueToLiteral(convertIdentifier)));
  56763. }
  56764. }
  56765. }
  56766. };
  56767. const normalizeExtension = (styleUrls) => {
  56768. const compilerStyleUrls = {};
  56769. Object.keys(styleUrls).forEach((key) => {
  56770. compilerStyleUrls[key] = styleUrls[key].map((s) => useCss(s));
  56771. });
  56772. return compilerStyleUrls;
  56773. };
  56774. const useCss = (stylePath) => {
  56775. const sourceFileDir = dirname(stylePath);
  56776. const sourceFileExt = extname$1(stylePath);
  56777. const sourceFileName = basename(stylePath, sourceFileExt);
  56778. return join(sourceFileDir, sourceFileName + '.css');
  56779. };
  56780. const normalizeStyleUrls = (styleUrls) => {
  56781. const compilerStyleUrls = {};
  56782. Object.keys(styleUrls).forEach((key) => {
  56783. compilerStyleUrls[key] = normalizeStyleUrl(styleUrls[key]);
  56784. });
  56785. return compilerStyleUrls;
  56786. };
  56787. const normalizeStyleUrl = (style) => {
  56788. if (Array.isArray(style)) {
  56789. return style;
  56790. }
  56791. if (style) {
  56792. return [style];
  56793. }
  56794. return [];
  56795. };
  56796. const componentDecoratorToStatic = (config, typeChecker, diagnostics, cmpNode, newMembers, componentDecorator) => {
  56797. const [componentOptions] = getDeclarationParameters(componentDecorator);
  56798. if (!componentOptions) {
  56799. return;
  56800. }
  56801. if (!validateComponent(config, diagnostics, typeChecker, componentOptions, cmpNode, componentDecorator)) {
  56802. return;
  56803. }
  56804. newMembers.push(createStaticGetter('is', convertValueToLiteral(componentOptions.tag.trim())));
  56805. if (componentOptions.shadow) {
  56806. newMembers.push(createStaticGetter('encapsulation', convertValueToLiteral('shadow')));
  56807. if (typeof componentOptions.shadow !== 'boolean') {
  56808. if (componentOptions.shadow.delegatesFocus === true) {
  56809. newMembers.push(createStaticGetter('delegatesFocus', convertValueToLiteral(true)));
  56810. }
  56811. }
  56812. }
  56813. else if (componentOptions.scoped) {
  56814. newMembers.push(createStaticGetter('encapsulation', convertValueToLiteral('scoped')));
  56815. }
  56816. styleToStatic(newMembers, componentOptions);
  56817. const assetsDirs = componentOptions.assetsDirs || [];
  56818. if (isString$1(componentOptions.assetsDir)) {
  56819. assetsDirs.push(componentOptions.assetsDir);
  56820. const warn = buildWarn(diagnostics);
  56821. warn.messageText = `@Component option "assetsDir" should be renamed to "assetsDirs" and the value should be an array of strings.`;
  56822. augmentDiagnosticWithNode(warn, componentDecorator);
  56823. }
  56824. if (assetsDirs.length > 0) {
  56825. newMembers.push(createStaticGetter('assetsDirs', convertValueToLiteral(assetsDirs)));
  56826. }
  56827. };
  56828. const validateComponent = (config, diagnostics, typeChecker, componentOptions, cmpNode, componentDecorator) => {
  56829. const extendNode = cmpNode.heritageClauses && cmpNode.heritageClauses.find((c) => c.token === t.SyntaxKind.ExtendsKeyword);
  56830. if (extendNode) {
  56831. const err = buildError(diagnostics);
  56832. err.messageText = `Classes decorated with @Component can not extend from a base class.
  56833. Stencil needs to be able to switch between different base classes in order to implement the different output targets such as: lazy and raw web components.`;
  56834. augmentDiagnosticWithNode(err, extendNode);
  56835. return false;
  56836. }
  56837. if (componentOptions.shadow && componentOptions.scoped) {
  56838. const err = buildError(diagnostics);
  56839. err.messageText = `Components cannot be "scoped" and "shadow" at the same time, they are mutually exclusive configurations.`;
  56840. augmentDiagnosticWithNode(err, findTagNode('scoped', componentDecorator));
  56841. return false;
  56842. }
  56843. const constructor = cmpNode.members.find(t.isConstructorDeclaration);
  56844. if (constructor && constructor.parameters.length > 0) {
  56845. const err = buildError(diagnostics);
  56846. err.messageText = `Classes decorated with @Component can not have a "constructor" that takes arguments.
  56847. All data required by a component must be passed by using class properties decorated with @Prop()`;
  56848. augmentDiagnosticWithNode(err, constructor.parameters[0]);
  56849. return false;
  56850. }
  56851. // check if class has more than one decorator
  56852. const otherDecorator = cmpNode.decorators && cmpNode.decorators.find((d) => d !== componentDecorator);
  56853. if (otherDecorator) {
  56854. const err = buildError(diagnostics);
  56855. err.messageText = `Classes decorated with @Component can not be decorated with more decorators.
  56856. Stencil performs extensive static analysis on top of your components in order to generate the necessary metadata, runtime decorators at the components level make this task very hard.`;
  56857. augmentDiagnosticWithNode(err, otherDecorator);
  56858. return false;
  56859. }
  56860. const tag = componentOptions.tag;
  56861. if (typeof tag !== 'string' || tag.trim().length === 0) {
  56862. const err = buildError(diagnostics);
  56863. err.messageText = `tag missing in component decorator`;
  56864. augmentDiagnosticWithNode(err, componentDecorator);
  56865. return false;
  56866. }
  56867. const tagError = validateComponentTag(tag);
  56868. if (tagError) {
  56869. const err = buildError(diagnostics);
  56870. err.messageText = `${tagError}. Please refer to https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name for more info.`;
  56871. augmentDiagnosticWithNode(err, findTagNode('tag', componentDecorator));
  56872. return false;
  56873. }
  56874. if (!config._isTesting) {
  56875. const nonTypeExports = typeChecker
  56876. .getExportsOfModule(typeChecker.getSymbolAtLocation(cmpNode.getSourceFile()))
  56877. .filter((symbol) => (symbol.flags & (t.SymbolFlags.Interface | t.SymbolFlags.TypeAlias)) === 0)
  56878. .filter((symbol) => symbol.name !== cmpNode.name.text);
  56879. nonTypeExports.forEach((symbol) => {
  56880. const err = buildError(diagnostics);
  56881. err.messageText = `To allow efficient bundling, modules using @Component() can only have a single export which is the component class itself.
  56882. Any other exports should be moved to a separate file.
  56883. For further information check out: https://stenciljs.com/docs/module-bundling`;
  56884. const errorNode = symbol.valueDeclaration ? symbol.valueDeclaration : symbol.declarations[0];
  56885. augmentDiagnosticWithNode(err, errorNode);
  56886. });
  56887. if (nonTypeExports.length > 0) {
  56888. return false;
  56889. }
  56890. }
  56891. return true;
  56892. };
  56893. const findTagNode = (propName, node) => {
  56894. if (t.isDecorator(node) && t.isCallExpression(node.expression)) {
  56895. const arg = node.expression.arguments[0];
  56896. if (t.isObjectLiteralExpression(arg)) {
  56897. arg.properties.forEach((p) => {
  56898. if (t.isPropertyAssignment(p)) {
  56899. if (p.name.getText() === propName) {
  56900. node = p.initializer;
  56901. }
  56902. }
  56903. });
  56904. }
  56905. }
  56906. return node;
  56907. };
  56908. const elementDecoratorsToStatic = (diagnostics, decoratedMembers, typeChecker, newMembers) => {
  56909. const elementRefs = decoratedMembers
  56910. .filter(t.isPropertyDeclaration)
  56911. .map((prop) => parseElementDecorator(diagnostics, typeChecker, prop))
  56912. .filter((element) => !!element);
  56913. if (elementRefs.length > 0) {
  56914. newMembers.push(createStaticGetter('elementRef', t.createLiteral(elementRefs[0])));
  56915. if (elementRefs.length > 1) {
  56916. const error = buildError(diagnostics);
  56917. error.messageText = `It's not valid to add more than one Element() decorator`;
  56918. }
  56919. }
  56920. };
  56921. const parseElementDecorator = (_diagnostics, _typeChecker, prop) => {
  56922. const elementDecorator = prop.decorators && prop.decorators.find(isDecoratorNamed('Element'));
  56923. if (elementDecorator == null) {
  56924. return null;
  56925. }
  56926. return prop.name.getText();
  56927. };
  56928. const eventDecoratorsToStatic = (diagnostics, decoratedProps, typeChecker, newMembers) => {
  56929. const events = decoratedProps
  56930. .filter(t.isPropertyDeclaration)
  56931. .map((prop) => parseEventDecorator(diagnostics, typeChecker, prop))
  56932. .filter((ev) => !!ev);
  56933. if (events.length > 0) {
  56934. newMembers.push(createStaticGetter('events', convertValueToLiteral(events)));
  56935. }
  56936. };
  56937. /**
  56938. * Parse a single instance of Stencil's `@Event()` decorator and generate metadata for the class member that is
  56939. * decorated
  56940. * @param diagnostics a list of diagnostics used as a part of the parsing process. Any parse errors/warnings shall be
  56941. * added to this collection
  56942. * @param typeChecker an instance of the TypeScript type checker, used to generate information about the `@Event()` and
  56943. * its surrounding context in the AST
  56944. * @param prop the property on the Stencil component class that is decorated with `@Event()`
  56945. * @returns generated metadata for the class member decorated by `@Event()`, or `null` if none could be derived
  56946. */
  56947. const parseEventDecorator = (diagnostics, typeChecker, prop) => {
  56948. var _a;
  56949. const eventDecorator = (_a = prop.decorators) === null || _a === void 0 ? void 0 : _a.find(isDecoratorNamed('Event'));
  56950. if (eventDecorator == null) {
  56951. return null;
  56952. }
  56953. const memberName = prop.name.getText();
  56954. if (!memberName) {
  56955. return null;
  56956. }
  56957. const [eventOpts] = getDeclarationParameters(eventDecorator);
  56958. const symbol = typeChecker.getSymbolAtLocation(prop.name);
  56959. const eventName = getEventName(eventOpts, memberName);
  56960. validateEventName(diagnostics, prop.name, eventName);
  56961. const eventMeta = {
  56962. method: memberName,
  56963. name: eventName,
  56964. bubbles: eventOpts && typeof eventOpts.bubbles === 'boolean' ? eventOpts.bubbles : true,
  56965. cancelable: eventOpts && typeof eventOpts.cancelable === 'boolean' ? eventOpts.cancelable : true,
  56966. composed: eventOpts && typeof eventOpts.composed === 'boolean' ? eventOpts.composed : true,
  56967. docs: serializeSymbol(typeChecker, symbol),
  56968. complexType: getComplexType$1(typeChecker, prop),
  56969. };
  56970. validateReferences(diagnostics, eventMeta.complexType.references, prop.type);
  56971. return eventMeta;
  56972. };
  56973. const getEventName = (eventOptions, memberName) => {
  56974. if (eventOptions && typeof eventOptions.eventName === 'string' && eventOptions.eventName.trim().length > 0) {
  56975. // always use the event name if given
  56976. return eventOptions.eventName.trim();
  56977. }
  56978. return memberName;
  56979. };
  56980. /**
  56981. * Derive Stencil's class member type metadata from a node in the AST
  56982. * @param typeChecker the TypeScript type checker
  56983. * @param node the node in the AST to generate metadata for
  56984. * @returns the generated metadata
  56985. */
  56986. const getComplexType$1 = (typeChecker, node) => {
  56987. const sourceFile = node.getSourceFile();
  56988. const eventType = node.type ? getEventType(node.type) : null;
  56989. return {
  56990. original: eventType ? eventType.getText() : 'any',
  56991. resolved: eventType ? resolveType(typeChecker, typeChecker.getTypeFromTypeNode(eventType)) : 'any',
  56992. references: eventType ? getAttributeTypeInfo(eventType, sourceFile) : {},
  56993. };
  56994. };
  56995. /**
  56996. * Derive the type of the event from the typings of `EventEmitter`
  56997. * @param type the AST node containing the `EventEmitter` typing
  56998. * @returns the type taken from `EventEmitter`, or `null` if the type cannot be derived
  56999. */
  57000. const getEventType = (type) => {
  57001. if (t.isTypeReferenceNode(type) &&
  57002. t.isIdentifier(type.typeName) &&
  57003. type.typeName.text === 'EventEmitter' &&
  57004. type.typeArguments &&
  57005. type.typeArguments.length > 0) {
  57006. return type.typeArguments[0];
  57007. }
  57008. return null;
  57009. };
  57010. /**
  57011. * Helper function for validating the name of the event
  57012. *
  57013. * This function assumes that the name of the event has been determined prior to calling it
  57014. *
  57015. * @param diagnostics a list of diagnostics used as a part of the validation process. Any parse errors/warnings shall be
  57016. * added to this collection
  57017. * @param node the node in the AT containing the class member decorated with `@Event()`
  57018. * @param eventName the name of the event
  57019. */
  57020. const validateEventName = (diagnostics, node, eventName) => {
  57021. // this regex checks for a string that begins with a capital letter - e.g. 'AskJeeves', 'Zoo', 'Spotify'
  57022. if (/^[A-Z]/.test(eventName)) {
  57023. const diagnostic = buildWarn(diagnostics);
  57024. diagnostic.messageText = [
  57025. `In order to be compatible with all event listeners on elements, the event name `,
  57026. `cannot start with a capital letter. `,
  57027. `Please lowercase the first character for the event to best work with all listeners.`,
  57028. ].join('');
  57029. augmentDiagnosticWithNode(diagnostic, node);
  57030. return;
  57031. }
  57032. // this regex checks for a string that begins 'on', followed by a capital letter - e.g. 'onAbout', 'onZing', 'onBlur'
  57033. if (/^on[A-Z]/.test(eventName)) {
  57034. const warn = buildWarn(diagnostics);
  57035. const suggestedEventName = eventName[2].toLowerCase() + eventName.slice(3);
  57036. warn.messageText = `Events decorated with @Event() should describe the actual DOM event name, not the handler. In other words "${eventName}" would be better named as "${suggestedEventName}".`;
  57037. augmentDiagnosticWithNode(warn, node);
  57038. return;
  57039. }
  57040. if (DOM_EVENT_NAMES.has(eventName.toLowerCase())) {
  57041. const diagnostic = buildWarn(diagnostics);
  57042. diagnostic.messageText = `The event name conflicts with the "${eventName}" native DOM event name.`;
  57043. augmentDiagnosticWithNode(diagnostic, node);
  57044. return;
  57045. }
  57046. };
  57047. const DOM_EVENT_NAMES = new Set([
  57048. 'CheckboxStateChange',
  57049. 'DOMContentLoaded',
  57050. 'DOMMenuItemActive',
  57051. 'DOMMenuItemInactive',
  57052. 'DOMMouseScroll',
  57053. 'MSManipulationStateChanged',
  57054. 'MSPointerHover',
  57055. 'MozAudioAvailable',
  57056. 'MozGamepadButtonDown',
  57057. 'MozGamepadButtonUp',
  57058. 'MozMousePixelScroll',
  57059. 'MozOrientation',
  57060. 'MozScrolledAreaChanged',
  57061. 'RadioStateChange',
  57062. 'SVGAbort',
  57063. 'SVGError',
  57064. 'SVGLoad',
  57065. 'SVGResize',
  57066. 'SVGScroll',
  57067. 'SVGUnload',
  57068. 'SVGZoom',
  57069. 'abort',
  57070. 'afterprint',
  57071. 'afterscriptexecute',
  57072. 'alerting',
  57073. 'animationcancel',
  57074. 'animationend',
  57075. 'animationiteration',
  57076. 'animationstart',
  57077. 'appinstalled',
  57078. 'audioend',
  57079. 'audioprocess',
  57080. 'audiostart',
  57081. 'auxclick',
  57082. 'beforeinstallprompt',
  57083. 'beforeprint',
  57084. 'beforescriptexecute',
  57085. 'beforeunload',
  57086. 'beginEvent',
  57087. 'blur',
  57088. 'boundary',
  57089. 'broadcast',
  57090. 'busy',
  57091. 'callschanged',
  57092. 'canplay',
  57093. 'canplaythrough',
  57094. 'cardstatechange',
  57095. 'cfstatechange',
  57096. 'change',
  57097. 'chargingchange',
  57098. 'chargingtimechange',
  57099. 'checking',
  57100. 'click',
  57101. 'command',
  57102. 'commandupdate',
  57103. 'compassneedscalibration',
  57104. 'complete',
  57105. 'compositionend',
  57106. 'compositionstart',
  57107. 'compositionupdate',
  57108. 'connected',
  57109. 'connecting',
  57110. 'connectionInfoUpdate',
  57111. 'contextmenu',
  57112. 'copy',
  57113. 'cut',
  57114. 'datachange',
  57115. 'dataerror',
  57116. 'dblclick',
  57117. 'delivered',
  57118. 'devicechange',
  57119. 'devicemotion',
  57120. 'deviceorientation',
  57121. 'dialing',
  57122. 'disabled',
  57123. 'dischargingtimechange',
  57124. 'disconnected',
  57125. 'disconnecting',
  57126. 'downloading',
  57127. 'drag',
  57128. 'dragend',
  57129. 'dragenter',
  57130. 'dragleave',
  57131. 'dragover',
  57132. 'dragstart',
  57133. 'drop',
  57134. 'durationchange',
  57135. 'emptied',
  57136. 'enabled',
  57137. 'end',
  57138. 'endEvent',
  57139. 'ended',
  57140. 'error',
  57141. 'focus',
  57142. 'focusin',
  57143. 'focusout',
  57144. 'fullscreenchange',
  57145. 'fullscreenerror',
  57146. 'gamepadconnected',
  57147. 'gamepaddisconnected',
  57148. 'gotpointercapture',
  57149. 'hashchange',
  57150. 'held',
  57151. 'holding',
  57152. 'icccardlockerror',
  57153. 'iccinfochange',
  57154. 'incoming',
  57155. 'input',
  57156. 'invalid',
  57157. 'keydown',
  57158. 'keypress',
  57159. 'keyup',
  57160. 'languagechange',
  57161. 'levelchange',
  57162. 'load',
  57163. 'loadeddata',
  57164. 'loadedmetadata',
  57165. 'loadend',
  57166. 'loadstart',
  57167. 'localized',
  57168. 'lostpointercapture',
  57169. 'mark',
  57170. 'message',
  57171. 'messageerror',
  57172. 'mousedown',
  57173. 'mouseenter',
  57174. 'mouseleave',
  57175. 'mousemove',
  57176. 'mouseout',
  57177. 'mouseover',
  57178. 'mouseup',
  57179. 'mousewheel',
  57180. 'mozbrowseractivitydone',
  57181. 'mozbrowserasyncscroll',
  57182. 'mozbrowseraudioplaybackchange',
  57183. 'mozbrowsercaretstatechanged',
  57184. 'mozbrowserclose',
  57185. 'mozbrowsercontextmenu',
  57186. 'mozbrowserdocumentfirstpaint',
  57187. 'mozbrowsererror',
  57188. 'mozbrowserfindchange',
  57189. 'mozbrowserfirstpaint',
  57190. 'mozbrowsericonchange',
  57191. 'mozbrowserloadend',
  57192. 'mozbrowserloadstart',
  57193. 'mozbrowserlocationchange',
  57194. 'mozbrowsermanifestchange',
  57195. 'mozbrowsermetachange',
  57196. 'mozbrowseropensearch',
  57197. 'mozbrowseropentab',
  57198. 'mozbrowseropenwindow',
  57199. 'mozbrowserresize',
  57200. 'mozbrowserscroll',
  57201. 'mozbrowserscrollareachanged',
  57202. 'mozbrowserscrollviewchange',
  57203. 'mozbrowsersecuritychange',
  57204. 'mozbrowserselectionstatechanged',
  57205. 'mozbrowsershowmodalprompt',
  57206. 'mozbrowsertitlechange',
  57207. 'mozbrowserusernameandpasswordrequired',
  57208. 'mozbrowservisibilitychange',
  57209. 'moztimechange',
  57210. 'msContentZoom',
  57211. 'nomatch',
  57212. 'notificationclick',
  57213. 'noupdate',
  57214. 'obsolete',
  57215. 'offline',
  57216. 'online',
  57217. 'orientationchange',
  57218. 'overflow',
  57219. 'pagehide',
  57220. 'pageshow',
  57221. 'paste',
  57222. 'pause',
  57223. 'play',
  57224. 'playing',
  57225. 'pointercancel',
  57226. 'pointerdown',
  57227. 'pointerenter',
  57228. 'pointerleave',
  57229. 'pointerlockchange',
  57230. 'pointerlockerror',
  57231. 'pointermove',
  57232. 'pointerout',
  57233. 'pointerover',
  57234. 'pointerup',
  57235. 'popstate',
  57236. 'popuphidden',
  57237. 'popuphiding',
  57238. 'popupshowing',
  57239. 'popupshown',
  57240. 'progress',
  57241. 'push',
  57242. 'pushsubscriptionchange',
  57243. 'ratechange',
  57244. 'readystatechange',
  57245. 'received',
  57246. 'repeatEvent',
  57247. 'reset',
  57248. 'resize',
  57249. 'resourcetimingbufferfull',
  57250. 'result',
  57251. 'resume',
  57252. 'resuming',
  57253. 'scroll',
  57254. 'seeked',
  57255. 'seeking',
  57256. 'select',
  57257. 'selectionchange',
  57258. 'selectstart',
  57259. 'sent',
  57260. 'show',
  57261. 'slotchange',
  57262. 'smartcard-insert',
  57263. 'smartcard-remove',
  57264. 'soundend',
  57265. 'soundstart',
  57266. 'speechend',
  57267. 'speechstart',
  57268. 'stalled',
  57269. 'start',
  57270. 'statechange',
  57271. 'statuschange',
  57272. 'stkcommand',
  57273. 'stksessionend',
  57274. 'storage',
  57275. 'submit',
  57276. 'suspend',
  57277. 'timeout',
  57278. 'timeupdate',
  57279. 'touchcancel',
  57280. 'touchend',
  57281. 'touchenter',
  57282. 'touchleave',
  57283. 'touchmove',
  57284. 'touchstart',
  57285. 'transitioncancel',
  57286. 'transitionend',
  57287. 'transitionrun',
  57288. 'transitionstart',
  57289. 'underflow',
  57290. 'unload',
  57291. 'updateready',
  57292. 'userproximity',
  57293. 'ussdreceived',
  57294. 'visibilitychange',
  57295. 'voicechange',
  57296. 'voiceschanged',
  57297. 'volumechange',
  57298. 'vrdisplayactivate',
  57299. 'vrdisplayblur',
  57300. 'vrdisplayconnect',
  57301. 'vrdisplaydeactivate',
  57302. 'vrdisplaydisconnect',
  57303. 'vrdisplayfocus',
  57304. 'vrdisplaypresentchange',
  57305. 'waiting',
  57306. 'wheel',
  57307. ].map((e) => e.toLowerCase()));
  57308. const listenDecoratorsToStatic = (diagnostics, decoratedMembers, newMembers) => {
  57309. const listeners = decoratedMembers
  57310. .filter(t.isMethodDeclaration)
  57311. .map((method) => parseListenDecorators(diagnostics, method));
  57312. const flatListeners = flatOne(listeners);
  57313. if (flatListeners.length > 0) {
  57314. newMembers.push(createStaticGetter('listeners', convertValueToLiteral(flatListeners)));
  57315. }
  57316. };
  57317. const parseListenDecorators = (diagnostics, method) => {
  57318. const listenDecorators = method.decorators.filter(isDecoratorNamed('Listen'));
  57319. if (listenDecorators.length === 0) {
  57320. return [];
  57321. }
  57322. return listenDecorators.map((listenDecorator) => {
  57323. const methodName = method.name.getText();
  57324. const [listenText, listenOptions] = getDeclarationParameters(listenDecorator);
  57325. const eventNames = listenText.split(',');
  57326. if (eventNames.length > 1) {
  57327. const err = buildError(diagnostics);
  57328. err.messageText = 'Please use multiple @Listen() decorators instead of comma-separated names.';
  57329. augmentDiagnosticWithNode(err, listenDecorator);
  57330. }
  57331. const listener = parseListener(eventNames[0], listenOptions, methodName);
  57332. if (listener.target === 'parent') {
  57333. const err = buildError(diagnostics);
  57334. err.messageText =
  57335. 'The "parent" target is no longer available as of Stencil 2. Please use "window", "document" or "body" instead.';
  57336. augmentDiagnosticWithNode(err, listenDecorator);
  57337. }
  57338. return listener;
  57339. });
  57340. };
  57341. const parseListener = (eventName, opts = {}, methodName) => {
  57342. const rawEventName = eventName.trim();
  57343. const listener = {
  57344. name: rawEventName,
  57345. method: methodName,
  57346. target: opts.target,
  57347. capture: typeof opts.capture === 'boolean' ? opts.capture : false,
  57348. passive: typeof opts.passive === 'boolean'
  57349. ? opts.passive
  57350. : // if the event name is kown to be a passive event then set it to true
  57351. PASSIVE_TRUE_DEFAULTS.has(rawEventName.toLowerCase()),
  57352. };
  57353. return listener;
  57354. };
  57355. const PASSIVE_TRUE_DEFAULTS = new Set([
  57356. 'dragstart',
  57357. 'drag',
  57358. 'dragend',
  57359. 'dragenter',
  57360. 'dragover',
  57361. 'dragleave',
  57362. 'drop',
  57363. 'mouseenter',
  57364. 'mouseover',
  57365. 'mousemove',
  57366. 'mousedown',
  57367. 'mouseup',
  57368. 'mouseleave',
  57369. 'mouseout',
  57370. 'mousewheel',
  57371. 'pointerover',
  57372. 'pointerenter',
  57373. 'pointerdown',
  57374. 'pointermove',
  57375. 'pointerup',
  57376. 'pointercancel',
  57377. 'pointerout',
  57378. 'pointerleave',
  57379. 'resize',
  57380. 'scroll',
  57381. 'touchstart',
  57382. 'touchmove',
  57383. 'touchend',
  57384. 'touchenter',
  57385. 'touchleave',
  57386. 'touchcancel',
  57387. 'wheel',
  57388. ]);
  57389. /**
  57390. * Determine if a public class member collides with a reserved name for HTML elements, nodes, or JSX
  57391. * @param diagnostics a collection of compiler diagnostics. If a naming collision is found, a diagnostic detected must
  57392. * be added to this collection
  57393. * @param memberName the name of the class member to check for collision
  57394. * @param decorator the decorator associated with the class member, used in providing richer error diagnostics
  57395. * @param memberType a string representing the class member's type. e.g. 'prop'. Used in providing richer error
  57396. * diagnostics
  57397. * @param node the TypeScript AST node at which the class member is defined
  57398. */
  57399. const validatePublicName = (diagnostics, memberName, decorator, memberType, node) => {
  57400. if (RESERVED_PUBLIC_MEMBERS.has(memberName.toLowerCase())) {
  57401. const warn = buildWarn(diagnostics);
  57402. warn.messageText = [
  57403. `The ${decorator} name "${memberName}" is a reserved public name. `,
  57404. `Please rename the "${memberName}" ${memberType} so it does not conflict with an existing standardized prototype member. `,
  57405. `Reusing ${memberType} names that are already defined on the element's prototype may cause `,
  57406. `unexpected runtime errors or user-interface issues on various browsers, so it's best to avoid them entirely.`,
  57407. ].join('');
  57408. augmentDiagnosticWithNode(warn, node);
  57409. return;
  57410. }
  57411. };
  57412. const HTML_ELEMENT_KEYS = [
  57413. 'title',
  57414. 'lang',
  57415. 'translate',
  57416. 'dir',
  57417. // 'dataset',
  57418. // 'hidden',
  57419. 'tabIndex',
  57420. 'accessKey',
  57421. 'draggable',
  57422. // 'spellcheck',
  57423. // 'autocapitalize',
  57424. 'contentEditable',
  57425. 'isContentEditable',
  57426. // 'inputMode',
  57427. 'offsetParent',
  57428. 'offsetTop',
  57429. 'offsetLeft',
  57430. 'offsetWidth',
  57431. 'offsetHeight',
  57432. 'style',
  57433. 'innerText',
  57434. 'outerText',
  57435. 'oncopy',
  57436. 'oncut',
  57437. 'onpaste',
  57438. 'onabort',
  57439. 'onblur',
  57440. 'oncancel',
  57441. 'oncanplay',
  57442. 'oncanplaythrough',
  57443. 'onchange',
  57444. 'onclick',
  57445. 'onclose',
  57446. 'oncontextmenu',
  57447. 'oncuechange',
  57448. 'ondblclick',
  57449. 'ondrag',
  57450. 'ondragend',
  57451. 'ondragenter',
  57452. 'ondragleave',
  57453. 'ondragover',
  57454. 'ondragstart',
  57455. 'ondrop',
  57456. 'ondurationchange',
  57457. 'onemptied',
  57458. 'onended',
  57459. 'onerror',
  57460. 'onfocus',
  57461. 'onfocusin',
  57462. 'onfocusout',
  57463. 'oninput',
  57464. 'oninvalid',
  57465. 'onkeydown',
  57466. 'onkeypress',
  57467. 'onkeyup',
  57468. 'onload',
  57469. 'onloadeddata',
  57470. 'onloadedmetadata',
  57471. 'onloadstart',
  57472. 'onmousedown',
  57473. 'onmouseenter',
  57474. 'onmouseleave',
  57475. 'onmousemove',
  57476. 'onmouseout',
  57477. 'onmouseover',
  57478. 'onmouseup',
  57479. 'onmousewheel',
  57480. 'onpause',
  57481. 'onplay',
  57482. 'onplaying',
  57483. 'onprogress',
  57484. 'onratechange',
  57485. 'onreset',
  57486. 'onresize',
  57487. 'onscroll',
  57488. 'onseeked',
  57489. 'onseeking',
  57490. 'onselect',
  57491. 'onstalled',
  57492. 'onsubmit',
  57493. 'onsuspend',
  57494. 'ontimeupdate',
  57495. 'ontoggle',
  57496. 'onvolumechange',
  57497. 'onwaiting',
  57498. 'onwheel',
  57499. 'onauxclick',
  57500. 'ongotpointercapture',
  57501. 'onlostpointercapture',
  57502. 'onpointerdown',
  57503. 'onpointermove',
  57504. 'onpointerup',
  57505. 'onpointercancel',
  57506. 'onpointerover',
  57507. 'onpointerout',
  57508. 'onpointerenter',
  57509. 'onpointerleave',
  57510. 'onselectstart',
  57511. 'onselectionchange',
  57512. 'nonce',
  57513. 'click',
  57514. 'focus',
  57515. 'blur',
  57516. ];
  57517. const ELEMENT_KEYS = [
  57518. 'namespaceURI',
  57519. 'prefix',
  57520. 'localName',
  57521. 'tagName',
  57522. 'id',
  57523. 'className',
  57524. 'classList',
  57525. 'slot',
  57526. 'attributes',
  57527. 'shadowRoot',
  57528. 'assignedSlot',
  57529. 'innerHTML',
  57530. 'outerHTML',
  57531. 'scrollTop',
  57532. 'scrollLeft',
  57533. 'scrollWidth',
  57534. 'scrollHeight',
  57535. 'clientTop',
  57536. 'clientLeft',
  57537. 'clientWidth',
  57538. 'clientHeight',
  57539. 'attributeStyleMap',
  57540. 'onbeforecopy',
  57541. 'onbeforecut',
  57542. 'onbeforepaste',
  57543. 'onsearch',
  57544. 'previousElementSibling',
  57545. 'nextElementSibling',
  57546. 'children',
  57547. 'firstElementChild',
  57548. 'lastElementChild',
  57549. 'childElementCount',
  57550. 'onfullscreenchange',
  57551. 'onfullscreenerror',
  57552. 'onwebkitfullscreenchange',
  57553. 'onwebkitfullscreenerror',
  57554. 'setPointerCapture',
  57555. 'releasePointerCapture',
  57556. 'hasPointerCapture',
  57557. 'hasAttributes',
  57558. 'getAttributeNames',
  57559. 'getAttribute',
  57560. 'getAttributeNS',
  57561. 'setAttribute',
  57562. 'setAttributeNS',
  57563. 'removeAttribute',
  57564. 'removeAttributeNS',
  57565. 'hasAttribute',
  57566. 'hasAttributeNS',
  57567. 'toggleAttribute',
  57568. 'getAttributeNode',
  57569. 'getAttributeNodeNS',
  57570. 'setAttributeNode',
  57571. 'setAttributeNodeNS',
  57572. 'removeAttributeNode',
  57573. 'closest',
  57574. 'matches',
  57575. 'webkitMatchesSelector',
  57576. 'attachShadow',
  57577. 'getElementsByTagName',
  57578. 'getElementsByTagNameNS',
  57579. 'getElementsByClassName',
  57580. 'insertAdjacentElement',
  57581. 'insertAdjacentText',
  57582. 'insertAdjacentHTML',
  57583. 'requestPointerLock',
  57584. 'getClientRects',
  57585. 'getBoundingClientRect',
  57586. 'scrollIntoView',
  57587. 'scroll',
  57588. 'scrollTo',
  57589. 'scrollBy',
  57590. 'scrollIntoViewIfNeeded',
  57591. 'animate',
  57592. 'computedStyleMap',
  57593. 'before',
  57594. 'after',
  57595. 'replaceWith',
  57596. 'remove',
  57597. 'prepend',
  57598. 'append',
  57599. 'querySelector',
  57600. 'querySelectorAll',
  57601. 'requestFullscreen',
  57602. 'webkitRequestFullScreen',
  57603. 'webkitRequestFullscreen',
  57604. 'part',
  57605. 'createShadowRoot',
  57606. 'getDestinationInsertionPoints',
  57607. ];
  57608. const NODE_KEYS = [
  57609. 'ELEMENT_NODE',
  57610. 'ATTRIBUTE_NODE',
  57611. 'TEXT_NODE',
  57612. 'CDATA_SECTION_NODE',
  57613. 'ENTITY_REFERENCE_NODE',
  57614. 'ENTITY_NODE',
  57615. 'PROCESSING_INSTRUCTION_NODE',
  57616. 'COMMENT_NODE',
  57617. 'DOCUMENT_NODE',
  57618. 'DOCUMENT_TYPE_NODE',
  57619. 'DOCUMENT_FRAGMENT_NODE',
  57620. 'NOTATION_NODE',
  57621. 'DOCUMENT_POSITION_DISCONNECTED',
  57622. 'DOCUMENT_POSITION_PRECEDING',
  57623. 'DOCUMENT_POSITION_FOLLOWING',
  57624. 'DOCUMENT_POSITION_CONTAINS',
  57625. 'DOCUMENT_POSITION_CONTAINED_BY',
  57626. 'DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC',
  57627. 'nodeType',
  57628. 'nodeName',
  57629. 'baseURI',
  57630. 'isConnected',
  57631. 'ownerDocument',
  57632. 'parentNode',
  57633. 'parentElement',
  57634. 'childNodes',
  57635. 'firstChild',
  57636. 'lastChild',
  57637. 'previousSibling',
  57638. 'nextSibling',
  57639. 'nodeValue',
  57640. 'textContent',
  57641. 'hasChildNodes',
  57642. 'getRootNode',
  57643. 'normalize',
  57644. 'cloneNode',
  57645. 'isEqualNode',
  57646. 'isSameNode',
  57647. 'compareDocumentPosition',
  57648. 'contains',
  57649. 'lookupPrefix',
  57650. 'lookupNamespaceURI',
  57651. 'isDefaultNamespace',
  57652. 'insertBefore',
  57653. 'appendChild',
  57654. 'replaceChild',
  57655. 'removeChild',
  57656. ];
  57657. const JSX_KEYS = ['ref', 'key'];
  57658. const ALL_KEYS = [...HTML_ELEMENT_KEYS, ...ELEMENT_KEYS, ...NODE_KEYS, ...JSX_KEYS].map((p) => p.toLowerCase());
  57659. const RESERVED_PUBLIC_MEMBERS = new Set(ALL_KEYS);
  57660. const methodDecoratorsToStatic = (config, diagnostics, cmpNode, decoratedProps, typeChecker, newMembers) => {
  57661. const tsSourceFile = cmpNode.getSourceFile();
  57662. const methods = decoratedProps
  57663. .filter(t.isMethodDeclaration)
  57664. .map((method) => parseMethodDecorator(config, diagnostics, tsSourceFile, typeChecker, method))
  57665. .filter((method) => !!method);
  57666. if (methods.length > 0) {
  57667. newMembers.push(createStaticGetter('methods', t.createObjectLiteral(methods, true)));
  57668. }
  57669. };
  57670. const parseMethodDecorator = (config, diagnostics, tsSourceFile, typeChecker, method) => {
  57671. const methodDecorator = method.decorators.find(isDecoratorNamed('Method'));
  57672. if (methodDecorator == null) {
  57673. return null;
  57674. }
  57675. const methodName = method.name.getText();
  57676. const flags = t.TypeFormatFlags.WriteArrowStyleSignature | t.TypeFormatFlags.NoTruncation;
  57677. const signature = typeChecker.getSignatureFromDeclaration(method);
  57678. const returnType = typeChecker.getReturnTypeOfSignature(signature);
  57679. const returnTypeNode = typeChecker.typeToTypeNode(returnType, method, t.NodeBuilderFlags.NoTruncation | t.NodeBuilderFlags.NoTypeReduction);
  57680. let returnString = typeToString(typeChecker, returnType);
  57681. let signatureString = typeChecker.signatureToString(signature, method, flags, t.SignatureKind.Call);
  57682. if (!config._isTesting) {
  57683. if (returnString === 'void') {
  57684. const warn = buildWarn(diagnostics);
  57685. warn.header = '@Method requires async';
  57686. warn.messageText = `External @Method() ${methodName}() must return a Promise.\n\n Consider prefixing the method with async, such as @Method() async ${methodName}().`;
  57687. augmentDiagnosticWithNode(warn, method.name);
  57688. returnString = 'Promise<void>';
  57689. signatureString = signatureString.replace(/=> void$/, '=> Promise<void>');
  57690. }
  57691. else if (!isTypePromise(returnString)) {
  57692. const err = buildError(diagnostics);
  57693. err.header = '@Method requires async';
  57694. err.messageText = `External @Method() ${methodName}() must return a Promise.\n\n Consider prefixing the method with async, such as @Method() async ${methodName}().`;
  57695. augmentDiagnosticWithNode(err, method.name);
  57696. }
  57697. }
  57698. if (isMemberPrivate(method)) {
  57699. const err = buildError(diagnostics);
  57700. err.messageText =
  57701. 'Methods decorated with the @Method() decorator cannot be "private" nor "protected". More info: https://stenciljs.com/docs/methods';
  57702. augmentDiagnosticWithNode(err, method.modifiers[0]);
  57703. }
  57704. // Validate if the method name does not conflict with existing public names
  57705. validatePublicName(diagnostics, methodName, '@Method()', 'method', method.name);
  57706. const methodMeta = {
  57707. complexType: {
  57708. signature: signatureString,
  57709. parameters: signature.parameters.map((symbol) => serializeSymbol(typeChecker, symbol)),
  57710. references: {
  57711. ...getAttributeTypeInfo(returnTypeNode, tsSourceFile),
  57712. ...getAttributeTypeInfo(method, tsSourceFile),
  57713. },
  57714. return: returnString,
  57715. },
  57716. docs: {
  57717. text: t.displayPartsToString(signature.getDocumentationComment(typeChecker)),
  57718. tags: mapJSDocTagInfo(signature.getJsDocTags()),
  57719. },
  57720. };
  57721. validateReferences(diagnostics, methodMeta.complexType.references, method.type || method.name);
  57722. const staticProp = t.createPropertyAssignment(t.createLiteral(methodName), convertValueToLiteral(methodMeta));
  57723. return staticProp;
  57724. };
  57725. const isTypePromise = (typeStr) => {
  57726. return /^Promise<.+>$/.test(typeStr);
  57727. };
  57728. const validateMethods = (diagnostics, members) => {
  57729. members.filter(t.isMethodDeclaration).map((method) => {
  57730. if (method.name.getText() === 'componentDidUnload') {
  57731. const err = buildError(diagnostics);
  57732. err.header = `Replace "componentDidUnload()" with "disconnectedCallback()"`;
  57733. err.messageText = `The "componentDidUnload()" method was removed in Stencil 2. Please use the "disconnectedCallback()" method instead.`;
  57734. augmentDiagnosticWithNode(err, method.name);
  57735. }
  57736. });
  57737. };
  57738. /**
  57739. * Parse a collection of class members decorated with `@Prop()`
  57740. *
  57741. * @param diagnostics a collection of compiler diagnostics. During the parsing process, any errors detected must be
  57742. * added to this collection
  57743. * @param decoratedProps a collection of class elements that may or may not my class members decorated with `@Prop`.
  57744. * Only those decorated with `@Prop()` will be parsed.
  57745. * @param typeChecker a reference to the TypeScript type checker
  57746. * @param watchable a collection of class members that can be watched for changes using Stencil's `@Watch` decorator
  57747. * @param newMembers a collection that parsed `@Prop` annotated class members should be pushed to as a side effect of
  57748. * calling this function
  57749. */
  57750. const propDecoratorsToStatic = (diagnostics, decoratedProps, typeChecker, watchable, newMembers) => {
  57751. const properties = decoratedProps
  57752. .filter(t.isPropertyDeclaration)
  57753. .map((prop) => parsePropDecorator(diagnostics, typeChecker, prop, watchable))
  57754. .filter((prop) => prop != null);
  57755. if (properties.length > 0) {
  57756. newMembers.push(createStaticGetter('properties', t.createObjectLiteral(properties, true)));
  57757. }
  57758. };
  57759. /**
  57760. * Parse a single `@Prop` decorator annotated class member
  57761. * @param diagnostics a collection of compiler diagnostics. During the parsing process, any errors detected must be
  57762. * added to this collection
  57763. * @param typeChecker a reference to the TypeScript type checker
  57764. * @param prop the TypeScript `PropertyDeclaration` to parse
  57765. * @param watchable a collection of class members that can be watched for changes using Stencil's `@Watch` decorator
  57766. * @returns a property assignment expression to be added to the Stencil component's class
  57767. */
  57768. const parsePropDecorator = (diagnostics, typeChecker, prop, watchable) => {
  57769. const propDecorator = prop.decorators.find(isDecoratorNamed('Prop'));
  57770. if (propDecorator == null) {
  57771. return null;
  57772. }
  57773. const decoratorParams = getDeclarationParameters(propDecorator);
  57774. const propOptions = decoratorParams[0] || {};
  57775. const propName = prop.name.getText();
  57776. if (isMemberPrivate(prop)) {
  57777. const err = buildError(diagnostics);
  57778. err.messageText =
  57779. 'Properties decorated with the @Prop() decorator cannot be "private" nor "protected". More info: https://stenciljs.com/docs/properties';
  57780. augmentDiagnosticWithNode(err, prop.modifiers[0]);
  57781. }
  57782. if (/^on(-|[A-Z])/.test(propName)) {
  57783. const warn = buildWarn(diagnostics);
  57784. warn.messageText = `The @Prop() name "${propName}" looks like an event. Please use the "@Event()" decorator to expose events instead, not properties or methods.`;
  57785. augmentDiagnosticWithNode(warn, prop.name);
  57786. }
  57787. else {
  57788. validatePublicName(diagnostics, propName, '@Prop()', 'prop', prop.name);
  57789. }
  57790. const symbol = typeChecker.getSymbolAtLocation(prop.name);
  57791. const type = typeChecker.getTypeAtLocation(prop);
  57792. const typeStr = propTypeFromTSType(type);
  57793. const propMeta = {
  57794. type: typeStr,
  57795. mutable: !!propOptions.mutable,
  57796. complexType: getComplexType(typeChecker, prop, type),
  57797. required: prop.exclamationToken !== undefined && propName !== 'mode',
  57798. optional: prop.questionToken !== undefined,
  57799. docs: serializeSymbol(typeChecker, symbol),
  57800. };
  57801. validateReferences(diagnostics, propMeta.complexType.references, prop.type);
  57802. // prop can have an attribute if type is NOT "unknown"
  57803. if (typeStr !== 'unknown') {
  57804. propMeta.attribute = getAttributeName(propName, propOptions);
  57805. propMeta.reflect = getReflect(diagnostics, propDecorator, propOptions);
  57806. }
  57807. // extract default value
  57808. const initializer = prop.initializer;
  57809. if (initializer) {
  57810. propMeta.defaultValue = initializer.getText();
  57811. }
  57812. const staticProp = t.createPropertyAssignment(t.createLiteral(propName), convertValueToLiteral(propMeta));
  57813. watchable.add(propName);
  57814. return staticProp;
  57815. };
  57816. /**
  57817. * Format the attribute name provided as an argument to `@Prop({attribute: ''}`
  57818. * @param propName the prop's name, used as a fallback value
  57819. * @param propOptions the options passed in to the `@Prop` call expression
  57820. * @returns the formatted attribute name
  57821. */
  57822. const getAttributeName = (propName, propOptions) => {
  57823. if (propOptions.attribute === null) {
  57824. return undefined;
  57825. }
  57826. if (typeof propOptions.attribute === 'string' && propOptions.attribute.trim().length > 0) {
  57827. return propOptions.attribute.trim().toLowerCase();
  57828. }
  57829. return toDashCase(propName);
  57830. };
  57831. /**
  57832. * Determines if the 'reflect' property should be applied to the class member decorated with `@Prop`
  57833. * @param diagnostics a collection of compiler diagnostics. Any errors detected with setting 'reflect' must be added to
  57834. * this collection
  57835. * @param propDecorator the AST containing the Prop decorator
  57836. * @param propOptions the options passed in to the `@Prop` call expression
  57837. * @returns `true` if the prop should be reflected in the DOM, `false` otherwise
  57838. */
  57839. const getReflect = (diagnostics, propDecorator, propOptions) => {
  57840. if (typeof propOptions.reflect === 'boolean') {
  57841. return propOptions.reflect;
  57842. }
  57843. if (typeof propOptions.reflectToAttr === 'boolean') {
  57844. const err = buildError(diagnostics);
  57845. err.header = `Rename "reflectToAttr" to "reflect"`;
  57846. err.messageText = `@Prop option "reflectToAttr" should be renamed to "reflect".`;
  57847. augmentDiagnosticWithNode(err, propDecorator);
  57848. return propOptions.reflectToAttr;
  57849. }
  57850. return false;
  57851. };
  57852. const getComplexType = (typeChecker, node, type) => {
  57853. const nodeType = node.type;
  57854. return {
  57855. original: nodeType ? nodeType.getText() : typeToString(typeChecker, type),
  57856. resolved: resolveType(typeChecker, type),
  57857. references: getAttributeTypeInfo(node, node.getSourceFile()),
  57858. };
  57859. };
  57860. /**
  57861. * Derives a Stencil-permitted prop type from the TypeScript compiler's output. This function may narrow the type of a
  57862. * prop, as the types that can be returned from the TypeScript compiler may be more complex than what Stencil can/should
  57863. * handle for props.
  57864. * @param type the prop type to narrow
  57865. * @returns a valid Stencil prop type
  57866. */
  57867. const propTypeFromTSType = (type) => {
  57868. const isAnyType = checkType(type, isAny);
  57869. if (isAnyType) {
  57870. return 'any';
  57871. }
  57872. const isStr = checkType(type, isString);
  57873. const isNu = checkType(type, isNumber);
  57874. const isBool = checkType(type, isBoolean);
  57875. // if type is more than a primitive type at the same time, we mark it as any
  57876. if (Number(isStr) + Number(isNu) + Number(isBool) > 1) {
  57877. return 'any';
  57878. }
  57879. // at this point we know the prop's type is NOT the mix of primitive types
  57880. if (isStr) {
  57881. return 'string';
  57882. }
  57883. if (isNu) {
  57884. return 'number';
  57885. }
  57886. if (isBool) {
  57887. return 'boolean';
  57888. }
  57889. return 'unknown';
  57890. };
  57891. /**
  57892. * Determines if a TypeScript compiler given `Type` is of a particular type according to the provided `check` parameter.
  57893. * Union types (e.g. `boolean | number | string`) will be evaluated one type at a time.
  57894. * @param type the TypeScript `Type` entity to evaluate
  57895. * @param check a function that takes a TypeScript `Type` as its only argument and returns `true` if the `Type` conforms
  57896. * to a particular type
  57897. * @returns the result of the `check` argument. The result of `check` is `true` for one or more types in a union type,
  57898. * return `true`.
  57899. */
  57900. const checkType = (type, check) => {
  57901. if (type.flags & t.TypeFlags.Union) {
  57902. // if the type is a union, check each type in the union
  57903. const union = type;
  57904. if (union.types.some((type) => checkType(type, check))) {
  57905. return true;
  57906. }
  57907. }
  57908. return check(type);
  57909. };
  57910. /**
  57911. * Determine if a TypeScript compiler `Type` is a boolean
  57912. * @param t the `Type` to evaluate
  57913. * @returns `true` if the `Type` has any boolean-similar flags, `false` otherwise
  57914. */
  57915. const isBoolean = (t$1) => {
  57916. if (t$1) {
  57917. return !!(t$1.flags & (t.TypeFlags.Boolean | t.TypeFlags.BooleanLike));
  57918. }
  57919. return false;
  57920. };
  57921. /**
  57922. * Determine if a TypeScript compiler `Type` is a number
  57923. * @param t the `Type` to evaluate
  57924. * @returns `true` if the `Type` has any number-similar flags, `false` otherwise
  57925. */
  57926. const isNumber = (t$1) => {
  57927. if (t$1) {
  57928. return !!(t$1.flags & (t.TypeFlags.Number | t.TypeFlags.NumberLike | t.TypeFlags.NumberLiteral));
  57929. }
  57930. return false;
  57931. };
  57932. /**
  57933. * Determine if a TypeScript compiler `Type` is a string
  57934. * @param t the `Type` to evaluate
  57935. * @returns `true` if the `Type` has any string-similar flags, `false` otherwise
  57936. */
  57937. const isString = (t$1) => {
  57938. if (t$1) {
  57939. return !!(t$1.flags & (t.TypeFlags.String | t.TypeFlags.StringLike | t.TypeFlags.StringLiteral));
  57940. }
  57941. return false;
  57942. };
  57943. /**
  57944. * Determine if a TypeScript compiler `Type` is of type any
  57945. * @param t the `Type` to evaluate
  57946. * @returns `true` if the `Type` has the `Any` flag set on it, `false` otherwise
  57947. */
  57948. const isAny = (t$1) => {
  57949. if (t$1) {
  57950. return !!(t$1.flags & t.TypeFlags.Any);
  57951. }
  57952. return false;
  57953. };
  57954. /**
  57955. * Convert class fields decorated with `@State` to static getters
  57956. *
  57957. * This function takes a list of decorated properties pulled off of a class
  57958. * declaration AST Node and builds up equivalent static getter AST nodes
  57959. * with which they can be replaced.
  57960. *
  57961. * @param decoratedProps TypeScript AST nodes representing class members
  57962. * @param watchable set of names of fields which should be watched for changes
  57963. * @param newMembers an out param containing new class members
  57964. */
  57965. const stateDecoratorsToStatic = (decoratedProps, watchable, newMembers) => {
  57966. const states = decoratedProps
  57967. .filter(t.isPropertyDeclaration)
  57968. .map((prop) => stateDecoratorToStatic(prop, watchable))
  57969. .filter((state) => !!state);
  57970. if (states.length > 0) {
  57971. newMembers.push(createStaticGetter('states', t.factory.createObjectLiteralExpression(states, true)));
  57972. }
  57973. };
  57974. /**
  57975. * Convert a property declaration decorated with `@State` to a property
  57976. * assignment AST node which maps the name of the state property to an empty
  57977. * object.
  57978. *
  57979. * Note that this function will return null if the property declaration is
  57980. * decorated with other decorators.
  57981. *
  57982. * @param prop A TypeScript AST node representing a class property declaration
  57983. * @param watchable set of names of fields which should be watched for changes
  57984. * @returns a property assignment AST Node which maps the name of the state
  57985. * prop to an empty object
  57986. */
  57987. const stateDecoratorToStatic = (prop, watchable) => {
  57988. const stateDecorator = prop.decorators.find(isDecoratorNamed('State'));
  57989. if (stateDecorator == null) {
  57990. return null;
  57991. }
  57992. const stateName = prop.name.getText();
  57993. watchable.add(stateName);
  57994. return t.factory.createPropertyAssignment(t.factory.createStringLiteral(stateName), t.factory.createObjectLiteralExpression([], true));
  57995. };
  57996. const watchDecoratorsToStatic = (config, diagnostics, decoratedProps, watchable, newMembers) => {
  57997. const watchers = decoratedProps
  57998. .filter(t.isMethodDeclaration)
  57999. .map((method) => parseWatchDecorator(config, diagnostics, watchable, method));
  58000. const flatWatchers = flatOne(watchers);
  58001. if (flatWatchers.length > 0) {
  58002. newMembers.push(createStaticGetter('watchers', convertValueToLiteral(flatWatchers)));
  58003. }
  58004. };
  58005. const parseWatchDecorator = (config, diagnostics, watchable, method) => {
  58006. const methodName = method.name.getText();
  58007. return method.decorators.filter(isDecoratorNamed('Watch')).map((decorator) => {
  58008. const [propName] = getDeclarationParameters(decorator);
  58009. if (!watchable.has(propName)) {
  58010. const diagnostic = config.devMode ? buildWarn(diagnostics) : buildError(diagnostics);
  58011. diagnostic.messageText = `@Watch('${propName}') is trying to watch for changes in a property that does not exist.
  58012. Make sure only properties decorated with @State() or @Prop() are watched.`;
  58013. augmentDiagnosticWithNode(diagnostic, decorator);
  58014. }
  58015. return {
  58016. propName,
  58017. methodName,
  58018. };
  58019. });
  58020. };
  58021. const convertDecoratorsToStatic = (config, diagnostics, typeChecker) => {
  58022. return (transformCtx) => {
  58023. const visit = (node) => {
  58024. if (t.isClassDeclaration(node)) {
  58025. return visitClassDeclaration(config, diagnostics, typeChecker, node);
  58026. }
  58027. return t.visitEachChild(node, visit, transformCtx);
  58028. };
  58029. return (tsSourceFile) => {
  58030. return t.visitEachChild(tsSourceFile, visit, transformCtx);
  58031. };
  58032. };
  58033. };
  58034. const visitClassDeclaration = (config, diagnostics, typeChecker, classNode) => {
  58035. if (!classNode.decorators) {
  58036. return classNode;
  58037. }
  58038. const componentDecorator = classNode.decorators.find(isDecoratorNamed('Component'));
  58039. if (!componentDecorator) {
  58040. return classNode;
  58041. }
  58042. const classMembers = classNode.members;
  58043. const decoratedMembers = classMembers.filter((member) => Array.isArray(member.decorators) && member.decorators.length > 0);
  58044. // create an array of all class members which do _not_ have a Stencil
  58045. // decorator on them. we do this so we can transform the decorated class
  58046. // fields into static getters while preserving other class members (like
  58047. // methods and so on).
  58048. const newMembers = removeStencilDecorators(Array.from(classMembers));
  58049. // parser component decorator (Component)
  58050. componentDecoratorToStatic(config, typeChecker, diagnostics, classNode, newMembers, componentDecorator);
  58051. // stores a reference to fields that should be watched for changes
  58052. const watchable = new Set();
  58053. // parse member decorators (Prop, State, Listen, Event, Method, Element and Watch)
  58054. if (decoratedMembers.length > 0) {
  58055. propDecoratorsToStatic(diagnostics, decoratedMembers, typeChecker, watchable, newMembers);
  58056. stateDecoratorsToStatic(decoratedMembers, watchable, newMembers);
  58057. eventDecoratorsToStatic(diagnostics, decoratedMembers, typeChecker, newMembers);
  58058. methodDecoratorsToStatic(config, diagnostics, classNode, decoratedMembers, typeChecker, newMembers);
  58059. elementDecoratorsToStatic(diagnostics, decoratedMembers, typeChecker, newMembers);
  58060. watchDecoratorsToStatic(config, diagnostics, decoratedMembers, watchable, newMembers);
  58061. listenDecoratorsToStatic(diagnostics, decoratedMembers, newMembers);
  58062. }
  58063. validateMethods(diagnostics, classMembers);
  58064. return t.updateClassDeclaration(classNode, filterDecorators(classNode, CLASS_DECORATORS_TO_REMOVE), classNode.modifiers, classNode.name, classNode.typeParameters, classNode.heritageClauses, newMembers);
  58065. };
  58066. const removeStencilDecorators = (classMembers) => {
  58067. return classMembers.map((m) => {
  58068. const currentDecorators = m.decorators;
  58069. const newDecorators = filterDecorators(m, MEMBER_DECORATORS_TO_REMOVE);
  58070. if (currentDecorators !== newDecorators) {
  58071. if (t.isMethodDeclaration(m)) {
  58072. return t.updateMethod(m, newDecorators, m.modifiers, m.asteriskToken, m.name, m.questionToken, m.typeParameters, m.parameters, m.type, m.body);
  58073. }
  58074. else if (t.isPropertyDeclaration(m)) {
  58075. return t.updateProperty(m, newDecorators, m.modifiers, m.name, m.questionToken, m.type, m.initializer);
  58076. }
  58077. else {
  58078. console.log('unknown class node');
  58079. }
  58080. }
  58081. return m;
  58082. });
  58083. };
  58084. /**
  58085. * Generate a list of decorators from an AST node that are not in a provided list
  58086. *
  58087. * @param node the AST node whose decorators should be inspected
  58088. * @param decoratorNames the decorators that should _not_ be included in the returned list
  58089. * @returns a list of decorators on the AST node that are not in the provided list, or `undefined` if:
  58090. * - there are no decorators on the node
  58091. * - the node contains only decorators in the provided list
  58092. */
  58093. const filterDecorators = (node, decoratorNames) => {
  58094. if (node.decorators) {
  58095. const updatedDecoratorList = node.decorators.filter((dec) => {
  58096. const name = t.isCallExpression(dec.expression) &&
  58097. t.isIdentifier(dec.expression.expression) &&
  58098. dec.expression.expression.text;
  58099. return typeof name === 'boolean' || !decoratorNames.includes(name);
  58100. });
  58101. if (updatedDecoratorList.length === 0) {
  58102. return undefined;
  58103. }
  58104. else if (updatedDecoratorList.length !== node.decorators.length) {
  58105. return t.factory.createNodeArray(updatedDecoratorList);
  58106. }
  58107. }
  58108. return node.decorators;
  58109. };
  58110. const gatherVdomMeta = (m, args) => {
  58111. m.hasVdomRender = true;
  58112. // Parse vdom tag
  58113. const hTag = args[0];
  58114. if (!t.isStringLiteral(hTag) && (!t.isIdentifier(hTag) || hTag.text !== 'Host')) {
  58115. m.hasVdomFunctional = true;
  58116. }
  58117. // Parse attributes
  58118. if (args.length > 1) {
  58119. const objectLiteral = args[1];
  58120. if (t.isCallExpression(objectLiteral) || t.isIdentifier(objectLiteral)) {
  58121. m.hasVdomAttribute = true;
  58122. m.hasVdomClass = true;
  58123. m.hasVdomKey = true;
  58124. m.hasVdomListener = true;
  58125. m.hasVdomPropOrAttr = true;
  58126. m.hasVdomRef = true;
  58127. m.hasVdomStyle = true;
  58128. m.hasVdomXlink = true;
  58129. }
  58130. else if (t.isObjectLiteralExpression(objectLiteral)) {
  58131. objectLiteral.properties.forEach((prop) => {
  58132. m.hasVdomAttribute = true;
  58133. if (t.isSpreadAssignment(prop) || t.isComputedPropertyName(prop.name)) {
  58134. m.hasVdomClass = true;
  58135. m.hasVdomKey = true;
  58136. m.hasVdomListener = true;
  58137. m.hasVdomPropOrAttr = true;
  58138. m.hasVdomRef = true;
  58139. m.hasVdomStyle = true;
  58140. m.hasVdomXlink = true;
  58141. }
  58142. else if (prop.name && prop.name.text && prop.name.text.length > 0) {
  58143. const attrName = prop.name.text;
  58144. if (attrName === 'key') {
  58145. m.hasVdomKey = true;
  58146. }
  58147. else if (attrName === 'ref') {
  58148. m.hasVdomRef = true;
  58149. }
  58150. else if (attrName === 'class' || attrName === 'className') {
  58151. m.hasVdomClass = true;
  58152. }
  58153. else if (attrName === 'style') {
  58154. m.hasVdomStyle = true;
  58155. }
  58156. else if (/^on(-|[A-Z])/.test(attrName)) {
  58157. m.hasVdomListener = true;
  58158. }
  58159. else if (attrName.startsWith('xlink')) {
  58160. m.hasVdomXlink = true;
  58161. m.hasVdomPropOrAttr = true;
  58162. }
  58163. else {
  58164. m.hasVdomPropOrAttr = true;
  58165. }
  58166. if (attrName === 'part' && t.isPropertyAssignment(prop) && t.isStringLiteral(prop.initializer)) {
  58167. m.htmlParts.push(...prop.initializer.text
  58168. .toLowerCase()
  58169. .split(' ')
  58170. .filter((part) => part.length > 0));
  58171. }
  58172. m.htmlAttrNames.push(attrName);
  58173. }
  58174. });
  58175. }
  58176. }
  58177. // Parse children
  58178. if (!m.hasVdomText) {
  58179. for (let i = 2; i < args.length; i++) {
  58180. const arg = args[i];
  58181. if (!t.isCallExpression(arg) || !t.isIdentifier(arg.expression) || arg.expression.text !== 'h') {
  58182. m.hasVdomText = true;
  58183. break;
  58184. }
  58185. }
  58186. }
  58187. };
  58188. const parseCallExpression = (m, node) => {
  58189. if (node.arguments != null && node.arguments.length > 0) {
  58190. if (t.isIdentifier(node.expression)) {
  58191. // h('tag')
  58192. visitCallExpressionArgs(m, node.expression, node.arguments);
  58193. }
  58194. else if (t.isPropertyAccessExpression(node.expression)) {
  58195. // document.createElement('tag')
  58196. const n = node.expression.name;
  58197. if (t.isIdentifier(n) && n) {
  58198. visitCallExpressionArgs(m, n, node.arguments);
  58199. }
  58200. }
  58201. }
  58202. };
  58203. const visitCallExpressionArgs = (m, callExpressionName, args) => {
  58204. const fnName = callExpressionName.escapedText;
  58205. if (fnName === 'h' || fnName === H || fnName === 'createElement') {
  58206. visitCallExpressionArg(m, args[0]);
  58207. if (fnName === 'h' || fnName === H) {
  58208. gatherVdomMeta(m, args);
  58209. }
  58210. }
  58211. else if (args.length > 1 && fnName === 'createElementNS') {
  58212. visitCallExpressionArg(m, args[1]);
  58213. }
  58214. else if (fnName === 'require' && args.length > 0 && m.originalImports) {
  58215. const arg = args[0];
  58216. if (t.isStringLiteral(arg)) {
  58217. if (!m.originalImports.includes(arg.text)) {
  58218. m.originalImports.push(arg.text);
  58219. }
  58220. }
  58221. }
  58222. };
  58223. const visitCallExpressionArg = (m, arg) => {
  58224. if (t.isStringLiteral(arg)) {
  58225. let tag = arg.text;
  58226. if (typeof tag === 'string') {
  58227. tag = tag.toLowerCase();
  58228. m.htmlTagNames.push(tag);
  58229. if (tag.includes('-')) {
  58230. m.potentialCmpRefs.push(tag);
  58231. }
  58232. }
  58233. }
  58234. };
  58235. /**
  58236. * Update an instance of TypeScript's Intermediate Representation (IR) for a
  58237. * class declaration ({@link ts.ClassDeclaration}) with a static getter for the
  58238. * compiler metadata that we produce as part of the compilation process.
  58239. *
  58240. * @param cmpNode an instance of the TypeScript IR for a class declaration (i.e.
  58241. * a stencil component) to be updated
  58242. * @param cmpMeta the component metadata corresponding to that component
  58243. * @returns the updated typescript class declaration
  58244. */
  58245. const addComponentMetaStatic = (cmpNode, cmpMeta) => {
  58246. const publicCompilerMeta = getPublicCompilerMeta(cmpMeta);
  58247. const cmpMetaStaticProp = createStaticGetter('COMPILER_META', convertValueToLiteral(publicCompilerMeta));
  58248. const classMembers = [...cmpNode.members, cmpMetaStaticProp];
  58249. return t.updateClassDeclaration(cmpNode, cmpNode.decorators, cmpNode.modifiers, cmpNode.name, cmpNode.typeParameters, cmpNode.heritageClauses, classMembers);
  58250. };
  58251. const getPublicCompilerMeta = (cmpMeta) => {
  58252. const publicCompilerMeta = Object.assign({}, cmpMeta);
  58253. // no need to copy all compiler meta data
  58254. delete publicCompilerMeta.assetsDirs;
  58255. delete publicCompilerMeta.dependencies;
  58256. delete publicCompilerMeta.excludeFromCollection;
  58257. delete publicCompilerMeta.isCollectionDependency;
  58258. delete publicCompilerMeta.docs;
  58259. delete publicCompilerMeta.jsFilePath;
  58260. delete publicCompilerMeta.potentialCmpRefs;
  58261. delete publicCompilerMeta.styleDocs;
  58262. delete publicCompilerMeta.sourceFilePath;
  58263. return publicCompilerMeta;
  58264. };
  58265. const setComponentBuildConditionals = (cmpMeta) => {
  58266. if (cmpMeta.properties.length > 0) {
  58267. cmpMeta.hasProp = true;
  58268. cmpMeta.hasPropMutable = cmpMeta.properties.some((p) => p.mutable);
  58269. cmpMeta.hasReflect = cmpMeta.properties.some((p) => p.reflect);
  58270. cmpMeta.hasAttribute = cmpMeta.properties.some((p) => typeof p.attribute === 'string');
  58271. cmpMeta.hasPropBoolean = cmpMeta.properties.some((p) => p.type === 'boolean');
  58272. cmpMeta.hasPropNumber = cmpMeta.properties.some((p) => p.type === 'number');
  58273. cmpMeta.hasPropString = cmpMeta.properties.some((p) => p.type === 'string');
  58274. }
  58275. if (cmpMeta.states.length > 0) {
  58276. cmpMeta.hasState = true;
  58277. }
  58278. if (cmpMeta.watchers.length > 0) {
  58279. cmpMeta.hasWatchCallback = true;
  58280. }
  58281. if (cmpMeta.methods.length > 0) {
  58282. cmpMeta.hasMethod = true;
  58283. }
  58284. if (cmpMeta.events.length > 0) {
  58285. cmpMeta.hasEvent = true;
  58286. }
  58287. if (cmpMeta.listeners.length > 0) {
  58288. cmpMeta.hasListener = true;
  58289. cmpMeta.hasListenerTargetWindow = cmpMeta.listeners.some((l) => l.target === 'window');
  58290. cmpMeta.hasListenerTargetDocument = cmpMeta.listeners.some((l) => l.target === 'document');
  58291. cmpMeta.hasListenerTargetBody = cmpMeta.listeners.some((l) => l.target === 'body');
  58292. cmpMeta.hasListenerTargetParent = cmpMeta.listeners.some((l) => l.target === 'parent');
  58293. cmpMeta.hasListenerTarget = cmpMeta.listeners.some((l) => !!l.target);
  58294. }
  58295. cmpMeta.hasMember = cmpMeta.hasProp || cmpMeta.hasState || cmpMeta.hasElement || cmpMeta.hasMethod;
  58296. cmpMeta.isUpdateable = cmpMeta.hasProp || cmpMeta.hasState;
  58297. if (cmpMeta.styles.length > 0) {
  58298. cmpMeta.hasStyle = true;
  58299. cmpMeta.hasMode = cmpMeta.styles.some((s) => s.modeName !== DEFAULT_STYLE_MODE);
  58300. }
  58301. cmpMeta.hasLifecycle =
  58302. cmpMeta.hasComponentWillLoadFn ||
  58303. cmpMeta.hasComponentDidLoadFn ||
  58304. cmpMeta.hasComponentShouldUpdateFn ||
  58305. cmpMeta.hasComponentWillUpdateFn ||
  58306. cmpMeta.hasComponentDidUpdateFn ||
  58307. cmpMeta.hasComponentWillRenderFn ||
  58308. cmpMeta.hasComponentDidRenderFn;
  58309. cmpMeta.isPlain =
  58310. !cmpMeta.hasMember && !cmpMeta.hasStyle && !cmpMeta.hasLifecycle && !cmpMeta.hasListener && !cmpMeta.hasVdomRender;
  58311. };
  58312. const parseClassMethods = (cmpNode, cmpMeta) => {
  58313. const classMembers = cmpNode.members;
  58314. if (!classMembers || classMembers.length === 0) {
  58315. return;
  58316. }
  58317. const classMethods = classMembers.filter((m) => t.isMethodDeclaration(m));
  58318. if (classMethods.length === 0) {
  58319. return;
  58320. }
  58321. const hasHostData = classMethods.some((m) => isMethod(m, 'hostData'));
  58322. cmpMeta.hasAttributeChangedCallbackFn = classMethods.some((m) => isMethod(m, 'attributeChangedCallback'));
  58323. cmpMeta.hasConnectedCallbackFn = classMethods.some((m) => isMethod(m, 'connectedCallback'));
  58324. cmpMeta.hasDisconnectedCallbackFn = classMethods.some((m) => isMethod(m, 'disconnectedCallback'));
  58325. cmpMeta.hasComponentWillLoadFn = classMethods.some((m) => isMethod(m, 'componentWillLoad'));
  58326. cmpMeta.hasComponentWillUpdateFn = classMethods.some((m) => isMethod(m, 'componentWillUpdate'));
  58327. cmpMeta.hasComponentWillRenderFn = classMethods.some((m) => isMethod(m, 'componentWillRender'));
  58328. cmpMeta.hasComponentDidRenderFn = classMethods.some((m) => isMethod(m, 'componentDidRender'));
  58329. cmpMeta.hasComponentDidLoadFn = classMethods.some((m) => isMethod(m, 'componentDidLoad'));
  58330. cmpMeta.hasComponentShouldUpdateFn = classMethods.some((m) => isMethod(m, 'componentShouldUpdate'));
  58331. cmpMeta.hasComponentDidUpdateFn = classMethods.some((m) => isMethod(m, 'componentDidUpdate'));
  58332. cmpMeta.hasComponentDidUnloadFn = classMethods.some((m) => isMethod(m, 'componentDidUnload'));
  58333. cmpMeta.hasLifecycle =
  58334. cmpMeta.hasComponentWillLoadFn ||
  58335. cmpMeta.hasComponentDidLoadFn ||
  58336. cmpMeta.hasComponentWillUpdateFn ||
  58337. cmpMeta.hasComponentDidUpdateFn;
  58338. cmpMeta.hasRenderFn = classMethods.some((m) => isMethod(m, 'render')) || hasHostData;
  58339. cmpMeta.hasVdomRender = cmpMeta.hasVdomRender || hasHostData;
  58340. };
  58341. const parseStaticElementRef = (staticMembers) => {
  58342. const parsedElementRef = getStaticValue(staticMembers, 'elementRef');
  58343. if (typeof parsedElementRef === 'string') {
  58344. return parsedElementRef;
  58345. }
  58346. return null;
  58347. };
  58348. const parseStaticEncapsulation = (staticMembers) => {
  58349. let encapsulation = getStaticValue(staticMembers, 'encapsulation');
  58350. if (typeof encapsulation === 'string') {
  58351. encapsulation = encapsulation.toLowerCase().trim();
  58352. if (encapsulation === 'shadow' || encapsulation === 'scoped') {
  58353. return encapsulation;
  58354. }
  58355. }
  58356. return 'none';
  58357. };
  58358. const parseStaticShadowDelegatesFocus = (encapsulation, staticMembers) => {
  58359. if (encapsulation === 'shadow') {
  58360. const delegatesFocus = getStaticValue(staticMembers, 'delegatesFocus');
  58361. return !!delegatesFocus;
  58362. }
  58363. return null;
  58364. };
  58365. const parseStaticEvents = (staticMembers) => {
  58366. const parsedEvents = getStaticValue(staticMembers, 'events');
  58367. if (!parsedEvents || parsedEvents.length === 0) {
  58368. return [];
  58369. }
  58370. return parsedEvents.map((parsedEvent) => {
  58371. return {
  58372. name: parsedEvent.name,
  58373. method: parsedEvent.method,
  58374. bubbles: parsedEvent.bubbles,
  58375. cancelable: parsedEvent.cancelable,
  58376. composed: parsedEvent.composed,
  58377. docs: parsedEvent.docs,
  58378. complexType: parsedEvent.complexType,
  58379. internal: isInternal(parsedEvent.docs),
  58380. };
  58381. });
  58382. };
  58383. const parseStaticListeners = (staticMembers) => {
  58384. const parsedListeners = getStaticValue(staticMembers, 'listeners');
  58385. if (!parsedListeners || parsedListeners.length === 0) {
  58386. return [];
  58387. }
  58388. return parsedListeners.map((parsedListener) => {
  58389. return {
  58390. name: parsedListener.name,
  58391. method: parsedListener.method,
  58392. capture: !!parsedListener.capture,
  58393. passive: !!parsedListener.passive,
  58394. target: parsedListener.target,
  58395. };
  58396. });
  58397. };
  58398. const parseStaticMethods = (staticMembers) => {
  58399. const parsedMethods = getStaticValue(staticMembers, 'methods');
  58400. if (!parsedMethods) {
  58401. return [];
  58402. }
  58403. const methodNames = Object.keys(parsedMethods);
  58404. if (methodNames.length === 0) {
  58405. return [];
  58406. }
  58407. return methodNames.map((methodName) => {
  58408. return {
  58409. name: methodName,
  58410. docs: parsedMethods[methodName].docs,
  58411. complexType: parsedMethods[methodName].complexType,
  58412. internal: isInternal(parsedMethods[methodName].docs),
  58413. };
  58414. });
  58415. };
  58416. /**
  58417. * Parse a list of {@link ts.ClassElement} objects representing static props
  58418. * into a list of our own Intermediate Representation (IR) of properties on
  58419. * components.
  58420. *
  58421. * @param staticMembers TypeScript IR for the properties on our component
  58422. * @returns a manifest of compiler properties in our own Stencil IR
  58423. */
  58424. const parseStaticProps = (staticMembers) => {
  58425. const parsedProps = getStaticValue(staticMembers, 'properties');
  58426. if (!parsedProps) {
  58427. return [];
  58428. }
  58429. const propNames = Object.keys(parsedProps);
  58430. if (propNames.length === 0) {
  58431. return [];
  58432. }
  58433. return propNames.map((propName) => {
  58434. const val = parsedProps[propName];
  58435. return {
  58436. name: propName,
  58437. type: val.type,
  58438. attribute: val.attribute ? val.attribute.toLowerCase() : undefined,
  58439. reflect: typeof val.reflect === 'boolean' ? val.reflect : false,
  58440. mutable: !!val.mutable,
  58441. required: !!val.required,
  58442. optional: !!val.optional,
  58443. defaultValue: val.defaultValue,
  58444. complexType: val.complexType,
  58445. docs: val.docs,
  58446. internal: isInternal(val.docs),
  58447. };
  58448. });
  58449. };
  58450. const parseStaticStates = (staticMembers) => {
  58451. const parsedStates = getStaticValue(staticMembers, 'states');
  58452. if (!parsedStates) {
  58453. return [];
  58454. }
  58455. const stateNames = Object.keys(parsedStates);
  58456. if (stateNames.length === 0) {
  58457. return [];
  58458. }
  58459. return stateNames.map((stateName) => {
  58460. return {
  58461. name: stateName,
  58462. };
  58463. });
  58464. };
  58465. const parseStringLiteral = (m, node) => {
  58466. if (typeof node.text === 'string' && node.text.includes('</')) {
  58467. if (node.text.includes('<slot')) {
  58468. m.htmlTagNames.push('slot');
  58469. }
  58470. if (node.text.includes('<svg')) {
  58471. m.htmlTagNames.push('svg');
  58472. }
  58473. }
  58474. };
  58475. const normalizeStyles = (tagName, componentFilePath, styles) => {
  58476. styles.forEach((style) => {
  58477. if (style.modeName === DEFAULT_STYLE_MODE) {
  58478. style.styleId = tagName.toUpperCase();
  58479. }
  58480. else {
  58481. style.styleId = `${tagName.toUpperCase()}#${style.modeName}`;
  58482. }
  58483. if (Array.isArray(style.externalStyles)) {
  58484. style.externalStyles.forEach((externalStyle) => {
  58485. normalizeExternalStyle(componentFilePath, externalStyle);
  58486. });
  58487. }
  58488. });
  58489. };
  58490. const normalizeExternalStyle = (componentFilePath, externalStyle) => {
  58491. if (typeof externalStyle.originalComponentPath !== 'string' ||
  58492. externalStyle.originalComponentPath.trim().length === 0) {
  58493. return;
  58494. }
  58495. // get the absolute path of the directory which the component is sitting in
  58496. const componentDir = dirname(componentFilePath);
  58497. if (isAbsolute$1(externalStyle.originalComponentPath)) {
  58498. // this path is absolute already!
  58499. // add to our list of style absolute paths
  58500. externalStyle.absolutePath = normalizePath$1(externalStyle.originalComponentPath);
  58501. // if this is an absolute path already, let's convert it to be relative
  58502. externalStyle.relativePath = normalizePath$1(relative$1(componentDir, externalStyle.originalComponentPath));
  58503. }
  58504. else {
  58505. // this path is relative to the component
  58506. // add to our list of style relative paths
  58507. externalStyle.relativePath = normalizePath$1(externalStyle.originalComponentPath);
  58508. // create the absolute path to the style file
  58509. externalStyle.absolutePath = normalizePath$1(join(componentDir, externalStyle.originalComponentPath));
  58510. }
  58511. };
  58512. const parseStaticStyles = (compilerCtx, tagName, componentFilePath, isCollectionDependency, staticMembers) => {
  58513. const styles = [];
  58514. const styleUrlsProp = isCollectionDependency ? 'styleUrls' : 'originalStyleUrls';
  58515. const parsedStyleUrls = getStaticValue(staticMembers, styleUrlsProp);
  58516. let parsedStyle = getStaticValue(staticMembers, 'styles');
  58517. if (parsedStyle) {
  58518. if (typeof parsedStyle === 'string') {
  58519. // styles: 'div { padding: 10px }'
  58520. parsedStyle = parsedStyle.trim();
  58521. if (parsedStyle.length > 0) {
  58522. styles.push({
  58523. modeName: DEFAULT_STYLE_MODE,
  58524. styleId: null,
  58525. styleStr: parsedStyle,
  58526. styleIdentifier: null,
  58527. externalStyles: [],
  58528. });
  58529. compilerCtx.styleModeNames.add(DEFAULT_STYLE_MODE);
  58530. }
  58531. }
  58532. else if (parsedStyle.__identifier) {
  58533. styles.push(parseStyleIdentifier(parsedStyle, DEFAULT_STYLE_MODE));
  58534. compilerCtx.styleModeNames.add(DEFAULT_STYLE_MODE);
  58535. }
  58536. else if (typeof parsedStyle === 'object') {
  58537. Object.keys(parsedStyle).forEach((modeName) => {
  58538. const parsedStyleMode = parsedStyle[modeName];
  58539. if (typeof parsedStyleMode === 'string') {
  58540. styles.push({
  58541. modeName: modeName,
  58542. styleId: null,
  58543. styleStr: parsedStyleMode,
  58544. styleIdentifier: null,
  58545. externalStyles: [],
  58546. });
  58547. }
  58548. else {
  58549. styles.push(parseStyleIdentifier(parsedStyleMode, modeName));
  58550. }
  58551. compilerCtx.styleModeNames.add(modeName);
  58552. });
  58553. }
  58554. }
  58555. if (parsedStyleUrls && typeof parsedStyleUrls === 'object') {
  58556. Object.keys(parsedStyleUrls).forEach((modeName) => {
  58557. const externalStyles = [];
  58558. const styleObj = parsedStyleUrls[modeName];
  58559. styleObj.forEach((styleUrl) => {
  58560. if (typeof styleUrl === 'string' && styleUrl.trim().length > 0) {
  58561. externalStyles.push({
  58562. absolutePath: null,
  58563. relativePath: null,
  58564. originalComponentPath: styleUrl.trim(),
  58565. });
  58566. }
  58567. });
  58568. if (externalStyles.length > 0) {
  58569. const style = {
  58570. modeName: modeName,
  58571. styleId: null,
  58572. styleStr: null,
  58573. styleIdentifier: null,
  58574. externalStyles: externalStyles,
  58575. };
  58576. styles.push(style);
  58577. compilerCtx.styleModeNames.add(modeName);
  58578. }
  58579. });
  58580. }
  58581. normalizeStyles(tagName, componentFilePath, styles);
  58582. return sortBy(styles, (s) => s.modeName);
  58583. };
  58584. const parseStyleIdentifier = (parsedStyle, modeName) => {
  58585. const style = {
  58586. modeName: modeName,
  58587. styleId: null,
  58588. styleStr: null,
  58589. styleIdentifier: parsedStyle.__escapedText,
  58590. externalStyles: [],
  58591. };
  58592. return style;
  58593. };
  58594. const parseStaticWatchers = (staticMembers) => {
  58595. const parsedWatchers = getStaticValue(staticMembers, 'watchers');
  58596. if (!parsedWatchers || parsedWatchers.length === 0) {
  58597. return [];
  58598. }
  58599. return parsedWatchers.map((parsedWatch) => {
  58600. return {
  58601. propName: parsedWatch.propName,
  58602. methodName: parsedWatch.methodName,
  58603. };
  58604. });
  58605. };
  58606. /**
  58607. * Given an instance of TypeScript's Intermediate Representation (IR) for a
  58608. * class declaration ({@see ts.ClassDeclaration}) which represents a Stencil
  58609. * component class declaration, parse and format various pieces of data about
  58610. * static class members which we use in the compilation process
  58611. *
  58612. * @param compilerCtx the current compiler context
  58613. * @param typeChecker a TypeScript type checker instance
  58614. * @param cmpNode the TypeScript class declaration for the component
  58615. * @param moduleFile Stencil's IR for a module, used here as an out param
  58616. * @param transformOpts options which control various aspects of the
  58617. * transformation
  58618. * @returns the TypeScript class declaration IR instance with which the
  58619. * function was called
  58620. */
  58621. const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile, transformOpts) => {
  58622. if (cmpNode.members == null) {
  58623. return cmpNode;
  58624. }
  58625. const staticMembers = cmpNode.members.filter(isStaticGetter);
  58626. const tagName = getComponentTagName(staticMembers);
  58627. if (tagName == null) {
  58628. return cmpNode;
  58629. }
  58630. const symbol = typeChecker ? typeChecker.getSymbolAtLocation(cmpNode.name) : undefined;
  58631. const docs = serializeSymbol(typeChecker, symbol);
  58632. const isCollectionDependency = moduleFile.isCollectionDependency;
  58633. const encapsulation = parseStaticEncapsulation(staticMembers);
  58634. const cmp = {
  58635. tagName: tagName,
  58636. excludeFromCollection: moduleFile.excludeFromCollection,
  58637. isCollectionDependency,
  58638. componentClassName: cmpNode.name ? cmpNode.name.text : '',
  58639. elementRef: parseStaticElementRef(staticMembers),
  58640. encapsulation,
  58641. shadowDelegatesFocus: parseStaticShadowDelegatesFocus(encapsulation, staticMembers),
  58642. properties: parseStaticProps(staticMembers),
  58643. virtualProperties: parseVirtualProps(docs),
  58644. states: parseStaticStates(staticMembers),
  58645. methods: parseStaticMethods(staticMembers),
  58646. listeners: parseStaticListeners(staticMembers),
  58647. events: parseStaticEvents(staticMembers),
  58648. watchers: parseStaticWatchers(staticMembers),
  58649. styles: parseStaticStyles(compilerCtx, tagName, moduleFile.sourceFilePath, isCollectionDependency, staticMembers),
  58650. legacyConnect: getStaticValue(staticMembers, 'connectProps') || [],
  58651. legacyContext: getStaticValue(staticMembers, 'contextProps') || [],
  58652. internal: isInternal(docs),
  58653. assetsDirs: parseAssetsDirs(staticMembers, moduleFile.jsFilePath),
  58654. styleDocs: [],
  58655. docs,
  58656. jsFilePath: moduleFile.jsFilePath,
  58657. sourceFilePath: moduleFile.sourceFilePath,
  58658. sourceMapPath: moduleFile.sourceMapPath,
  58659. hasAttributeChangedCallbackFn: false,
  58660. hasComponentWillLoadFn: false,
  58661. hasComponentDidLoadFn: false,
  58662. hasComponentShouldUpdateFn: false,
  58663. hasComponentWillUpdateFn: false,
  58664. hasComponentDidUpdateFn: false,
  58665. hasComponentWillRenderFn: false,
  58666. hasComponentDidRenderFn: false,
  58667. hasComponentDidUnloadFn: false,
  58668. hasConnectedCallbackFn: false,
  58669. hasDisconnectedCallbackFn: false,
  58670. hasElement: false,
  58671. hasEvent: false,
  58672. hasLifecycle: false,
  58673. hasListener: false,
  58674. hasListenerTarget: false,
  58675. hasListenerTargetWindow: false,
  58676. hasListenerTargetDocument: false,
  58677. hasListenerTargetBody: false,
  58678. hasListenerTargetParent: false,
  58679. hasMember: false,
  58680. hasMethod: false,
  58681. hasMode: false,
  58682. hasAttribute: false,
  58683. hasProp: false,
  58684. hasPropNumber: false,
  58685. hasPropBoolean: false,
  58686. hasPropString: false,
  58687. hasPropMutable: false,
  58688. hasReflect: false,
  58689. hasRenderFn: false,
  58690. hasState: false,
  58691. hasStyle: false,
  58692. hasVdomAttribute: false,
  58693. hasVdomXlink: false,
  58694. hasVdomClass: false,
  58695. hasVdomFunctional: false,
  58696. hasVdomKey: false,
  58697. hasVdomListener: false,
  58698. hasVdomPropOrAttr: false,
  58699. hasVdomRef: false,
  58700. hasVdomRender: false,
  58701. hasVdomStyle: false,
  58702. hasVdomText: false,
  58703. hasWatchCallback: false,
  58704. isPlain: false,
  58705. htmlAttrNames: [],
  58706. htmlTagNames: [],
  58707. htmlParts: [],
  58708. isUpdateable: false,
  58709. potentialCmpRefs: [],
  58710. };
  58711. const visitComponentChildNode = (node) => {
  58712. if (t.isCallExpression(node)) {
  58713. parseCallExpression(cmp, node);
  58714. }
  58715. else if (t.isStringLiteral(node)) {
  58716. parseStringLiteral(cmp, node);
  58717. }
  58718. node.forEachChild(visitComponentChildNode);
  58719. };
  58720. visitComponentChildNode(cmpNode);
  58721. parseClassMethods(cmpNode, cmp);
  58722. cmp.legacyConnect.forEach(({ connect }) => {
  58723. cmp.htmlTagNames.push(connect);
  58724. if (connect.includes('-')) {
  58725. cmp.potentialCmpRefs.push(connect);
  58726. }
  58727. });
  58728. cmp.htmlAttrNames = unique(cmp.htmlAttrNames);
  58729. cmp.htmlTagNames = unique(cmp.htmlTagNames);
  58730. cmp.potentialCmpRefs = unique(cmp.potentialCmpRefs);
  58731. setComponentBuildConditionals(cmp);
  58732. if (transformOpts && transformOpts.componentMetadata === 'compilerstatic') {
  58733. cmpNode = addComponentMetaStatic(cmpNode, cmp);
  58734. }
  58735. // add to module map
  58736. moduleFile.cmps.push(cmp);
  58737. // add to node map
  58738. compilerCtx.nodeMap.set(cmpNode, cmp);
  58739. return cmpNode;
  58740. };
  58741. const parseVirtualProps = (docs) => {
  58742. return docs.tags
  58743. .filter(({ name }) => name === 'virtualProp')
  58744. .map(parseVirtualProp)
  58745. .filter((prop) => !!prop);
  58746. };
  58747. const parseVirtualProp = (tag) => {
  58748. const results = /^\s*(?:\{([^}]+)\}\s+)?(\w+)\s+-\s+(.*)$/.exec(tag.text);
  58749. if (!results) {
  58750. return undefined;
  58751. }
  58752. const [, type, name, docs] = results;
  58753. return {
  58754. type: type == null ? 'any' : type.trim(),
  58755. name: name.trim(),
  58756. docs: docs.trim(),
  58757. };
  58758. };
  58759. const parseAssetsDirs = (staticMembers, componentFilePath) => {
  58760. const dirs = getStaticValue(staticMembers, 'assetsDirs') || [];
  58761. const componentDir = normalizePath$1(dirname(componentFilePath));
  58762. return dirs.map((dir) => {
  58763. // get the relative path from the component file to the assets directory
  58764. dir = normalizePath$1(dir.trim());
  58765. let absolutePath = dir;
  58766. let cmpRelativePath = dir;
  58767. if (isAbsolute$1(dir)) {
  58768. // if this is an absolute path already, let's convert it to be relative
  58769. cmpRelativePath = relative$1(componentDir, dir);
  58770. }
  58771. else {
  58772. // create the absolute path to the asset dir
  58773. absolutePath = join(componentDir, dir);
  58774. }
  58775. return {
  58776. absolutePath,
  58777. cmpRelativePath,
  58778. originalComponentPath: dir,
  58779. };
  58780. });
  58781. };
  58782. const parseCollectionComponents = (config, compilerCtx, buildCtx, collectionDir, collectionManifest, collection) => {
  58783. if (collectionManifest.entries) {
  58784. collectionManifest.entries.forEach((entryPath) => {
  58785. const componentPath = join(collectionDir, entryPath);
  58786. transpileCollectionModule(config, compilerCtx, buildCtx, collection, componentPath);
  58787. });
  58788. }
  58789. };
  58790. const transpileCollectionModule = (config, compilerCtx, buildCtx, collection, inputFileName) => {
  58791. const sourceText = compilerCtx.fs.readFileSync(inputFileName);
  58792. const sourceFile = t.createSourceFile(inputFileName, sourceText, t.ScriptTarget.ES2017, true, t.ScriptKind.JS);
  58793. return updateModule(config, compilerCtx, buildCtx, sourceFile, sourceText, inputFileName, undefined, collection);
  58794. };
  58795. const parseCollectionManifest = (config, compilerCtx, buildCtx, collectionName, collectionDir, collectionJsonStr) => {
  58796. const collectionManifest = JSON.parse(collectionJsonStr);
  58797. const compilerVersion = collectionManifest.compiler || {};
  58798. const collection = {
  58799. collectionName: collectionName,
  58800. moduleId: collectionName,
  58801. moduleFiles: [],
  58802. dependencies: parseCollectionDependencies(collectionManifest),
  58803. compiler: {
  58804. name: compilerVersion.name || '',
  58805. version: compilerVersion.version || '',
  58806. typescriptVersion: compilerVersion.typescriptVersion || '',
  58807. },
  58808. bundles: parseBundles(collectionManifest),
  58809. };
  58810. parseGlobal(config, compilerCtx, buildCtx, collectionDir, collectionManifest, collection);
  58811. parseCollectionComponents(config, compilerCtx, buildCtx, collectionDir, collectionManifest, collection);
  58812. return collection;
  58813. };
  58814. const parseCollectionDependencies = (collectionManifest) => {
  58815. return (collectionManifest.collections || []).map((c) => c.name);
  58816. };
  58817. const parseGlobal = (config, compilerCtx, buildCtx, collectionDir, collectionManifest, collection) => {
  58818. if (typeof collectionManifest.global !== 'string') {
  58819. return;
  58820. }
  58821. const sourceFilePath = normalizePath$1(join(collectionDir, collectionManifest.global));
  58822. const globalModule = transpileCollectionModule(config, compilerCtx, buildCtx, collection, sourceFilePath);
  58823. collection.global = globalModule;
  58824. };
  58825. const parseBundles = (collectionManifest) => {
  58826. if (invalidArrayData(collectionManifest.bundles)) {
  58827. return [];
  58828. }
  58829. return collectionManifest.bundles.map((b) => {
  58830. return {
  58831. components: b.components.slice().sort(),
  58832. };
  58833. });
  58834. };
  58835. const invalidArrayData = (arr) => {
  58836. return !arr || !Array.isArray(arr) || arr.length === 0;
  58837. };
  58838. const parseCollection = (config, compilerCtx, buildCtx, moduleId, pkgJsonFilePath, pkgData) => {
  58839. // note this MUST be synchronous because this is used during transpile
  58840. const collectionName = pkgData.name;
  58841. let collection = compilerCtx.collections.find((c) => c.collectionName === collectionName);
  58842. if (collection != null) {
  58843. // we've already cached the collection, no need for another resolve/readFile/parse
  58844. // thought being that /node_modules/ isn't changing between watch builds
  58845. return collection;
  58846. }
  58847. // get the root directory of the dependency
  58848. const collectionPackageRootDir = dirname(pkgJsonFilePath);
  58849. // figure out the full path to the collection collection file
  58850. const collectionFilePath = join(collectionPackageRootDir, pkgData.collection);
  58851. const relPath = relative$1(config.rootDir, collectionFilePath);
  58852. config.logger.debug(`load collection: ${collectionName}, ${relPath}`);
  58853. // we haven't cached the collection yet, let's read this file
  58854. // sync on purpose :(
  58855. const collectionJsonStr = compilerCtx.fs.readFileSync(collectionFilePath);
  58856. if (!collectionJsonStr) {
  58857. return null;
  58858. }
  58859. // get the directory where the collection collection file is sitting
  58860. const collectionDir = normalizePath$1(dirname(collectionFilePath));
  58861. // parse the json string into our collection data
  58862. collection = parseCollectionManifest(config, compilerCtx, buildCtx, collectionName, collectionDir, collectionJsonStr);
  58863. collection.moduleId = moduleId;
  58864. if (pkgData.module && pkgData.module !== pkgData.main) {
  58865. collection.hasExports = true;
  58866. }
  58867. // remember the source of this collection node_module
  58868. collection.moduleDir = collectionPackageRootDir;
  58869. // cache it for later yo
  58870. compilerCtx.collections.push(collection);
  58871. return collection;
  58872. };
  58873. const addExternalImport = (config, compilerCtx, buildCtx, moduleFile, containingFile, moduleId, resolveCollections) => {
  58874. if (!moduleFile.externalImports.includes(moduleId)) {
  58875. moduleFile.externalImports.push(moduleId);
  58876. moduleFile.externalImports.sort();
  58877. }
  58878. if (!resolveCollections || compilerCtx.resolvedCollections.has(moduleId)) {
  58879. // we've already handled this collection moduleId before
  58880. return;
  58881. }
  58882. let pkgJsonFilePath = tsResolveModuleNamePackageJsonPath(config, compilerCtx, moduleId, containingFile);
  58883. // cache that we've already parsed this
  58884. compilerCtx.resolvedCollections.add(moduleId);
  58885. if (pkgJsonFilePath == null) {
  58886. return;
  58887. }
  58888. const realPkgJsonFilePath = config.sys.realpathSync(pkgJsonFilePath);
  58889. if (realPkgJsonFilePath.path) {
  58890. pkgJsonFilePath = realPkgJsonFilePath.path;
  58891. }
  58892. if (pkgJsonFilePath === config.packageJsonFilePath) {
  58893. // same package silly!
  58894. return;
  58895. }
  58896. // open up and parse the package.json
  58897. // sync on purpose :(
  58898. const pkgJsonStr = compilerCtx.fs.readFileSync(pkgJsonFilePath);
  58899. if (pkgJsonStr == null) {
  58900. return;
  58901. }
  58902. const parsedPkgJson = parsePackageJson(pkgJsonStr, pkgJsonFilePath);
  58903. if (parsedPkgJson.diagnostic) {
  58904. buildCtx.diagnostics.push(parsedPkgJson.diagnostic);
  58905. return;
  58906. }
  58907. if (!isString$1(parsedPkgJson.data.collection) || !parsedPkgJson.data.collection.endsWith('.json')) {
  58908. // this import is not a stencil collection
  58909. return;
  58910. }
  58911. if (!isString$1(parsedPkgJson.data.types) || !parsedPkgJson.data.types.endsWith('.d.ts')) {
  58912. // this import should have types
  58913. return;
  58914. }
  58915. // this import is a stencil collection
  58916. // let's parse it and gather all the module data about it
  58917. // internally it'll cached collection data if we've already done this
  58918. const collection = parseCollection(config, compilerCtx, buildCtx, moduleId, parsedPkgJson.filePath, parsedPkgJson.data);
  58919. if (!collection) {
  58920. return;
  58921. }
  58922. // check if we already added this collection to the build context
  58923. const alreadyHasCollection = buildCtx.collections.some((c) => {
  58924. return c.collectionName === collection.collectionName;
  58925. });
  58926. if (alreadyHasCollection) {
  58927. // we already have this collection in our build context
  58928. return;
  58929. }
  58930. // let's add the collection to the build context
  58931. buildCtx.collections.push(collection);
  58932. if (Array.isArray(collection.dependencies)) {
  58933. // this collection has more collections
  58934. // let's keep digging down and discover all of them
  58935. collection.dependencies.forEach((dependencyModuleId) => {
  58936. const resolveFromDir = dirname(pkgJsonFilePath);
  58937. addExternalImport(config, compilerCtx, buildCtx, moduleFile, resolveFromDir, dependencyModuleId, resolveCollections);
  58938. });
  58939. }
  58940. };
  58941. const parseModuleImport = (config, compilerCtx, buildCtx, moduleFile, dirPath, importNode, resolveCollections) => {
  58942. if (importNode.moduleSpecifier && t.isStringLiteral(importNode.moduleSpecifier)) {
  58943. let importPath = importNode.moduleSpecifier.text;
  58944. if (!moduleFile.originalImports.includes(importPath)) {
  58945. moduleFile.originalImports.push(importPath);
  58946. }
  58947. if (isAbsolute$1(importPath)) {
  58948. // absolute import
  58949. importPath = normalizePath$1(importPath);
  58950. moduleFile.localImports.push(importPath);
  58951. }
  58952. else if (importPath.startsWith('.')) {
  58953. // relative import
  58954. importPath = normalizePath$1(resolve$1(dirPath, importPath));
  58955. moduleFile.localImports.push(importPath);
  58956. }
  58957. else {
  58958. // node resolve side effect import
  58959. addExternalImport(config, compilerCtx, buildCtx, moduleFile, moduleFile.sourceFilePath, importPath, resolveCollections);
  58960. }
  58961. }
  58962. };
  58963. const updateModule = (config, compilerCtx, buildCtx, tsSourceFile, sourceFileText, emitFilePath, typeChecker, collection) => {
  58964. const sourceFilePath = normalizePath$1(tsSourceFile.fileName);
  58965. const prevModuleFile = getModule(compilerCtx, sourceFilePath);
  58966. if (prevModuleFile && prevModuleFile.staticSourceFileText === sourceFileText) {
  58967. return prevModuleFile;
  58968. }
  58969. const srcDirPath = dirname(sourceFilePath);
  58970. const emitFileName = basename(emitFilePath);
  58971. emitFilePath = normalizePath$1(join(srcDirPath, emitFileName));
  58972. const moduleFile = createModule(tsSourceFile, sourceFileText, emitFilePath);
  58973. if (emitFilePath.endsWith('.js.map')) {
  58974. moduleFile.sourceMapPath = emitFilePath;
  58975. moduleFile.sourceMapFileText = sourceFileText;
  58976. }
  58977. else if (prevModuleFile && prevModuleFile.sourceMapPath) {
  58978. moduleFile.sourceMapPath = prevModuleFile.sourceMapPath;
  58979. moduleFile.sourceMapFileText = prevModuleFile.sourceMapFileText;
  58980. }
  58981. const moduleFileKey = normalizePath$1(moduleFile.sourceFilePath);
  58982. compilerCtx.moduleMap.set(moduleFileKey, moduleFile);
  58983. compilerCtx.changedModules.add(moduleFile.sourceFilePath);
  58984. const visitNode = (node) => {
  58985. if (t.isClassDeclaration(node)) {
  58986. parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile);
  58987. return;
  58988. }
  58989. else if (t.isImportDeclaration(node)) {
  58990. parseModuleImport(config, compilerCtx, buildCtx, moduleFile, srcDirPath, node, true);
  58991. return;
  58992. }
  58993. else if (t.isCallExpression(node)) {
  58994. parseCallExpression(moduleFile, node);
  58995. }
  58996. else if (t.isStringLiteral(node)) {
  58997. parseStringLiteral(moduleFile, node);
  58998. }
  58999. node.forEachChild(visitNode);
  59000. };
  59001. if (collection != null) {
  59002. moduleFile.isCollectionDependency = true;
  59003. moduleFile.collectionName = collection.collectionName;
  59004. collection.moduleFiles.push(moduleFile);
  59005. }
  59006. visitNode(tsSourceFile);
  59007. // TODO: workaround around const enums
  59008. // find better way
  59009. if (moduleFile.cmps.length > 0) {
  59010. moduleFile.staticSourceFile = t.createSourceFile(sourceFilePath, sourceFileText, tsSourceFile.languageVersion, true, t.ScriptKind.JS);
  59011. }
  59012. return moduleFile;
  59013. };
  59014. const validateTranspiledComponents = (config, buildCtx) => {
  59015. for (const cmp of buildCtx.components) {
  59016. validateUniqueTagNames(config, buildCtx, cmp);
  59017. }
  59018. };
  59019. const validateUniqueTagNames = (config, buildCtx, cmp) => {
  59020. const tagName = cmp.tagName;
  59021. const cmpsWithTagName = buildCtx.components.filter((c) => c.tagName === tagName);
  59022. if (cmpsWithTagName.length > 1) {
  59023. const err = buildError(buildCtx.diagnostics);
  59024. err.header = `Component Tag Name "${tagName}" Must Be Unique`;
  59025. err.messageText = `Please update the components so "${tagName}" is only used once: ${cmpsWithTagName
  59026. .map((c) => relative$1(config.rootDir, c.sourceFilePath))
  59027. .join(' ')}`;
  59028. }
  59029. };
  59030. const runTsProgram = async (config, compilerCtx, buildCtx, tsBuilder) => {
  59031. const tsSyntactic = loadTypeScriptDiagnostics(tsBuilder.getSyntacticDiagnostics());
  59032. const tsGlobal = loadTypeScriptDiagnostics(tsBuilder.getGlobalDiagnostics());
  59033. const tsOptions = loadTypeScriptDiagnostics(tsBuilder.getOptionsDiagnostics());
  59034. buildCtx.diagnostics.push(...tsSyntactic);
  59035. buildCtx.diagnostics.push(...tsGlobal);
  59036. buildCtx.diagnostics.push(...tsOptions);
  59037. if (buildCtx.hasError) {
  59038. return false;
  59039. }
  59040. const tsProgram = tsBuilder.getProgram();
  59041. const tsTypeChecker = tsProgram.getTypeChecker();
  59042. const typesOutputTarget = config.outputTargets.filter(isOutputTargetDistTypes);
  59043. const emittedDts = [];
  59044. const emitCallback = (emitFilePath, data, _w, _e, tsSourceFiles) => {
  59045. if (emitFilePath.endsWith('.js') || emitFilePath.endsWith('js.map')) {
  59046. updateModule(config, compilerCtx, buildCtx, tsSourceFiles[0], data, emitFilePath, tsTypeChecker, null);
  59047. }
  59048. else if (emitFilePath.endsWith('.d.ts')) {
  59049. const srcDtsPath = normalizePath$1(tsSourceFiles[0].fileName);
  59050. const relativeEmitFilepath = getRelativeDts(config, srcDtsPath, emitFilePath);
  59051. emittedDts.push(srcDtsPath);
  59052. typesOutputTarget.forEach((o) => {
  59053. const distPath = join(o.typesDir, relativeEmitFilepath);
  59054. data = updateStencilTypesImports(o.typesDir, distPath, data);
  59055. compilerCtx.fs.writeFile(distPath, data);
  59056. });
  59057. }
  59058. };
  59059. // Emit files that changed
  59060. tsBuilder.emit(undefined, emitCallback, undefined, false, {
  59061. before: [convertDecoratorsToStatic(config, buildCtx.diagnostics, tsTypeChecker)],
  59062. });
  59063. const changedmodules = Array.from(compilerCtx.changedModules.keys());
  59064. buildCtx.debug('Transpiled modules: ' + JSON.stringify(changedmodules, null, '\n'));
  59065. // Finalize components metadata
  59066. buildCtx.moduleFiles = Array.from(compilerCtx.moduleMap.values());
  59067. buildCtx.components = getComponentsFromModules(buildCtx.moduleFiles);
  59068. updateComponentBuildConditionals(compilerCtx.moduleMap, buildCtx.components);
  59069. resolveComponentDependencies(buildCtx.components);
  59070. validateTranspiledComponents(config, buildCtx);
  59071. if (buildCtx.hasError) {
  59072. return false;
  59073. }
  59074. // create the components.d.ts file and write to disk
  59075. const hasTypesChanged = await generateAppTypes(config, compilerCtx, buildCtx, 'src');
  59076. if (hasTypesChanged) {
  59077. return true;
  59078. }
  59079. if (typesOutputTarget.length > 0) {
  59080. // copy src dts files that do not get emitted by the compiler
  59081. // but we still want to ship them in the dist directory
  59082. const srcRootDtsFiles = tsProgram
  59083. .getRootFileNames()
  59084. .filter((f) => f.endsWith('.d.ts') && !f.endsWith('components.d.ts'))
  59085. .map(normalizePath$1)
  59086. .filter((f) => !emittedDts.includes(f))
  59087. .map((srcRootDtsFilePath) => {
  59088. const relativeEmitFilepath = relative$1(config.srcDir, srcRootDtsFilePath);
  59089. return Promise.all(typesOutputTarget.map(async (o) => {
  59090. const distPath = join(o.typesDir, relativeEmitFilepath);
  59091. let dtsContent = await compilerCtx.fs.readFile(srcRootDtsFilePath);
  59092. dtsContent = updateStencilTypesImports(o.typesDir, distPath, dtsContent);
  59093. await compilerCtx.fs.writeFile(distPath, dtsContent);
  59094. }));
  59095. });
  59096. await Promise.all(srcRootDtsFiles);
  59097. }
  59098. if (config.validateTypes) {
  59099. const tsSemantic = loadTypeScriptDiagnostics(tsBuilder.getSemanticDiagnostics());
  59100. if (config.devMode) {
  59101. tsSemantic.forEach((semanticDiagnostic) => {
  59102. // Unused variable errors become warnings in dev mode
  59103. if (semanticDiagnostic.code === '6133' || semanticDiagnostic.code === '6192') {
  59104. semanticDiagnostic.level = 'warn';
  59105. }
  59106. });
  59107. }
  59108. buildCtx.diagnostics.push(...tsSemantic);
  59109. }
  59110. return false;
  59111. };
  59112. const getRelativeDts = (config, srcPath, emitDtsPath) => {
  59113. const parts = [];
  59114. for (let i = 0; i < 30; i++) {
  59115. if (config.srcDir === srcPath) {
  59116. break;
  59117. }
  59118. const b = basename(emitDtsPath);
  59119. parts.push(b);
  59120. emitDtsPath = join(emitDtsPath, '..');
  59121. srcPath = normalizePath$1(join(srcPath, '..'));
  59122. }
  59123. return join(...parts.reverse());
  59124. };
  59125. const generateHmr = (config, compilerCtx, buildCtx) => {
  59126. if (config.devServer == null || config.devServer.reloadStrategy == null) {
  59127. return null;
  59128. }
  59129. const hmr = {
  59130. reloadStrategy: config.devServer.reloadStrategy,
  59131. versionId: Date.now().toString().substring(6) + '' + Math.round(Math.random() * 89999 + 10000),
  59132. };
  59133. if (buildCtx.scriptsAdded.length > 0) {
  59134. hmr.scriptsAdded = buildCtx.scriptsAdded.slice();
  59135. }
  59136. if (buildCtx.scriptsDeleted.length > 0) {
  59137. hmr.scriptsDeleted = buildCtx.scriptsDeleted.slice();
  59138. }
  59139. const excludeHmr = excludeHmrFiles(config, config.devServer.excludeHmr, buildCtx.filesChanged);
  59140. if (excludeHmr.length > 0) {
  59141. hmr.excludeHmr = excludeHmr.slice();
  59142. }
  59143. if (buildCtx.hasHtmlChanges) {
  59144. hmr.indexHtmlUpdated = true;
  59145. }
  59146. if (buildCtx.hasServiceWorkerChanges) {
  59147. hmr.serviceWorkerUpdated = true;
  59148. }
  59149. const outputTargetsWww = config.outputTargets.filter(isOutputTargetWww);
  59150. const componentsUpdated = getComponentsUpdated(compilerCtx, buildCtx);
  59151. if (componentsUpdated) {
  59152. hmr.componentsUpdated = componentsUpdated;
  59153. }
  59154. if (Object.keys(buildCtx.stylesUpdated).length > 0) {
  59155. hmr.inlineStylesUpdated = sortBy(buildCtx.stylesUpdated.map((s) => {
  59156. return {
  59157. styleId: getScopeId(s.styleTag, s.styleMode),
  59158. styleTag: s.styleTag,
  59159. styleText: s.styleText,
  59160. };
  59161. }), (s) => s.styleId);
  59162. }
  59163. const externalStylesUpdated = getExternalStylesUpdated(buildCtx, outputTargetsWww);
  59164. if (externalStylesUpdated) {
  59165. hmr.externalStylesUpdated = externalStylesUpdated;
  59166. }
  59167. const externalImagesUpdated = getImagesUpdated(buildCtx, outputTargetsWww);
  59168. if (externalImagesUpdated) {
  59169. hmr.imagesUpdated = externalImagesUpdated;
  59170. }
  59171. return hmr;
  59172. };
  59173. const getComponentsUpdated = (compilerCtx, buildCtx) => {
  59174. // find all of the components that would be affected from the file changes
  59175. if (!buildCtx.filesChanged) {
  59176. return null;
  59177. }
  59178. const filesToLookForImporters = buildCtx.filesChanged.filter((f) => {
  59179. return f.endsWith('.ts') || f.endsWith('.tsx') || f.endsWith('.js') || f.endsWith('.jsx');
  59180. });
  59181. if (filesToLookForImporters.length === 0) {
  59182. return null;
  59183. }
  59184. const changedScriptFiles = [];
  59185. const checkedFiles = new Set();
  59186. const allModuleFiles = buildCtx.moduleFiles.filter((m) => m.localImports && m.localImports.length > 0);
  59187. while (filesToLookForImporters.length > 0) {
  59188. const scriptFile = filesToLookForImporters.shift();
  59189. addTsFileImporters(allModuleFiles, filesToLookForImporters, checkedFiles, changedScriptFiles, scriptFile);
  59190. }
  59191. const tags = changedScriptFiles.reduce((tags, changedTsFile) => {
  59192. const moduleFile = compilerCtx.moduleMap.get(changedTsFile);
  59193. if (moduleFile != null) {
  59194. moduleFile.cmps.forEach((cmp) => {
  59195. if (typeof cmp.tagName === 'string') {
  59196. if (!tags.includes(cmp.tagName)) {
  59197. tags.push(cmp.tagName);
  59198. }
  59199. }
  59200. });
  59201. }
  59202. return tags;
  59203. }, []);
  59204. if (tags.length === 0) {
  59205. return null;
  59206. }
  59207. return tags.sort();
  59208. };
  59209. const addTsFileImporters = (allModuleFiles, filesToLookForImporters, checkedFiles, changedScriptFiles, scriptFile) => {
  59210. if (!changedScriptFiles.includes(scriptFile)) {
  59211. // add it to our list of files to transpile
  59212. changedScriptFiles.push(scriptFile);
  59213. }
  59214. if (checkedFiles.has(scriptFile)) {
  59215. // already checked this file
  59216. return;
  59217. }
  59218. checkedFiles.add(scriptFile);
  59219. // get all the ts files that import this ts file
  59220. const tsFilesThatImportsThisTsFile = allModuleFiles.reduce((arr, moduleFile) => {
  59221. moduleFile.localImports.forEach((localImport) => {
  59222. let checkFile = localImport;
  59223. if (checkFile === scriptFile) {
  59224. arr.push(moduleFile.sourceFilePath);
  59225. return;
  59226. }
  59227. checkFile = localImport + '.tsx';
  59228. if (checkFile === scriptFile) {
  59229. arr.push(moduleFile.sourceFilePath);
  59230. return;
  59231. }
  59232. checkFile = localImport + '.ts';
  59233. if (checkFile === scriptFile) {
  59234. arr.push(moduleFile.sourceFilePath);
  59235. return;
  59236. }
  59237. checkFile = localImport + '.js';
  59238. if (checkFile === scriptFile) {
  59239. arr.push(moduleFile.sourceFilePath);
  59240. return;
  59241. }
  59242. });
  59243. return arr;
  59244. }, []);
  59245. // add all the files that import this ts file to the list of ts files we need to look through
  59246. tsFilesThatImportsThisTsFile.forEach((tsFileThatImportsThisTsFile) => {
  59247. // if we add to this array, then the while look will keep working until it's empty
  59248. filesToLookForImporters.push(tsFileThatImportsThisTsFile);
  59249. });
  59250. };
  59251. const getExternalStylesUpdated = (buildCtx, outputTargetsWww) => {
  59252. if (!buildCtx.isRebuild || outputTargetsWww.length === 0) {
  59253. return null;
  59254. }
  59255. const cssFiles = buildCtx.filesWritten.filter((f) => f.endsWith('.css'));
  59256. if (cssFiles.length === 0) {
  59257. return null;
  59258. }
  59259. return cssFiles.map((cssFile) => basename(cssFile)).sort();
  59260. };
  59261. const getImagesUpdated = (buildCtx, outputTargetsWww) => {
  59262. if (outputTargetsWww.length === 0) {
  59263. return null;
  59264. }
  59265. const imageFiles = buildCtx.filesChanged.reduce((arr, filePath) => {
  59266. if (IMAGE_EXT.some((ext) => filePath.toLowerCase().endsWith(ext))) {
  59267. const fileName = basename(filePath);
  59268. if (!arr.includes(fileName)) {
  59269. arr.push(fileName);
  59270. }
  59271. }
  59272. return arr;
  59273. }, []);
  59274. if (imageFiles.length === 0) {
  59275. return null;
  59276. }
  59277. return imageFiles.sort();
  59278. };
  59279. const excludeHmrFiles = (config, excludeHmr, filesChanged) => {
  59280. const excludeFiles = [];
  59281. if (!excludeHmr || excludeHmr.length === 0) {
  59282. return excludeFiles;
  59283. }
  59284. excludeHmr.forEach((excludeHmr) => {
  59285. return filesChanged
  59286. .map((fileChanged) => {
  59287. let shouldExclude = false;
  59288. if (isGlob(excludeHmr)) {
  59289. shouldExclude = minimatch_1$1(fileChanged, excludeHmr);
  59290. }
  59291. else {
  59292. shouldExclude = normalizePath$1(excludeHmr) === normalizePath$1(fileChanged);
  59293. }
  59294. if (shouldExclude) {
  59295. config.logger.debug(`excludeHmr: ${fileChanged}`);
  59296. excludeFiles.push(basename(fileChanged));
  59297. }
  59298. return shouldExclude;
  59299. })
  59300. .some((r) => r);
  59301. });
  59302. return excludeFiles.sort();
  59303. };
  59304. const IMAGE_EXT = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.ico', '.svg'];
  59305. const generateBuildResults = (config, compilerCtx, buildCtx) => {
  59306. const componentGraph = buildCtx.componentGraph ? fromEntries(buildCtx.componentGraph.entries()) : undefined;
  59307. const buildResults = {
  59308. buildId: buildCtx.buildId,
  59309. diagnostics: normalizeDiagnostics(compilerCtx, buildCtx.diagnostics),
  59310. dirsAdded: buildCtx.dirsAdded.slice().sort(),
  59311. dirsDeleted: buildCtx.dirsDeleted.slice().sort(),
  59312. duration: Date.now() - buildCtx.startTime,
  59313. filesAdded: buildCtx.filesAdded.slice().sort(),
  59314. filesChanged: buildCtx.filesChanged.slice().sort(),
  59315. filesDeleted: buildCtx.filesDeleted.slice().sort(),
  59316. filesUpdated: buildCtx.filesUpdated.slice().sort(),
  59317. hasError: hasError(buildCtx.diagnostics),
  59318. hasSuccessfulBuild: compilerCtx.hasSuccessfulBuild,
  59319. isRebuild: buildCtx.isRebuild,
  59320. namespace: config.namespace,
  59321. outputs: compilerCtx.fs.getBuildOutputs(),
  59322. rootDir: config.rootDir,
  59323. srcDir: config.srcDir,
  59324. timestamp: getBuildTimestamp(),
  59325. componentGraph,
  59326. };
  59327. const hmr = generateHmr(config, compilerCtx, buildCtx);
  59328. if (hmr != null) {
  59329. buildResults.hmr = hmr;
  59330. }
  59331. if (isString$1(buildCtx.hydrateAppFilePath)) {
  59332. buildResults.hydrateAppFilePath = buildCtx.hydrateAppFilePath;
  59333. }
  59334. compilerCtx.lastBuildResults = Object.assign({}, buildResults);
  59335. return buildResults;
  59336. };
  59337. /**
  59338. * Generates the Build Stats from the buildCtx. Writes any files to the file system.
  59339. * @param config the project build configuration
  59340. * @param buildCtx An instance of the build which holds the details about the build
  59341. * @returns CompilerBuildStats or an Object including diagnostics.
  59342. */
  59343. function generateBuildStats(config, buildCtx) {
  59344. // TODO(STENCIL-461): Investigate making this return only a single type
  59345. const buildResults = buildCtx.buildResults;
  59346. let jsonData;
  59347. try {
  59348. if (buildResults.hasError) {
  59349. jsonData = {
  59350. diagnostics: buildResults.diagnostics,
  59351. };
  59352. }
  59353. else {
  59354. const stats = {
  59355. timestamp: buildResults.timestamp,
  59356. compiler: {
  59357. name: config.sys.name,
  59358. version: config.sys.version,
  59359. },
  59360. app: {
  59361. namespace: config.namespace,
  59362. fsNamespace: config.fsNamespace,
  59363. components: Object.keys(buildResults.componentGraph).length,
  59364. entries: Object.keys(buildResults.componentGraph).length,
  59365. bundles: buildResults.outputs.reduce((total, en) => total + en.files.length, 0),
  59366. outputs: getAppOutputs(config, buildResults),
  59367. },
  59368. options: {
  59369. minifyJs: config.minifyJs,
  59370. minifyCss: config.minifyCss,
  59371. hashFileNames: config.hashFileNames,
  59372. hashedFileNameLength: config.hashedFileNameLength,
  59373. buildEs5: config.buildEs5,
  59374. },
  59375. formats: {
  59376. esmBrowser: sanitizeBundlesForStats(buildCtx.esmBrowserComponentBundle),
  59377. esm: sanitizeBundlesForStats(buildCtx.esmComponentBundle),
  59378. es5: sanitizeBundlesForStats(buildCtx.es5ComponentBundle),
  59379. system: sanitizeBundlesForStats(buildCtx.systemComponentBundle),
  59380. commonjs: sanitizeBundlesForStats(buildCtx.commonJsComponentBundle),
  59381. },
  59382. components: getComponentsFileMap(config, buildCtx),
  59383. entries: buildCtx.entryModules,
  59384. componentGraph: buildResults.componentGraph,
  59385. sourceGraph: getSourceGraph(config, buildCtx),
  59386. rollupResults: buildCtx.rollupResults,
  59387. collections: getCollections(config, buildCtx),
  59388. };
  59389. jsonData = stats;
  59390. }
  59391. }
  59392. catch (e) {
  59393. const diagnostic = {
  59394. messageText: `Generate Build Stats Error: ` + e,
  59395. level: `error`,
  59396. type: `build`,
  59397. };
  59398. jsonData = {
  59399. diagnostics: [diagnostic],
  59400. };
  59401. }
  59402. return jsonData;
  59403. }
  59404. /**
  59405. * Writes the files from the stats config to the file system
  59406. * @param config the project build configuration
  59407. * @param data the information to write out to disk (as specified by each stats output target specified in the provided
  59408. * config)
  59409. */
  59410. async function writeBuildStats(config, data) {
  59411. const statsTargets = config.outputTargets.filter(isOutputTargetStats);
  59412. await Promise.all(statsTargets.map(async (outputTarget) => {
  59413. const result = await config.sys.writeFile(outputTarget.file, JSON.stringify(data, null, 2));
  59414. if (result.error) {
  59415. config.logger.warn([`Stats failed to write file to ${outputTarget.file}`]);
  59416. }
  59417. }));
  59418. }
  59419. function sanitizeBundlesForStats(bundleArray) {
  59420. if (!bundleArray) {
  59421. return [];
  59422. }
  59423. return bundleArray.map((bundle) => {
  59424. return {
  59425. key: bundle.entryKey,
  59426. components: bundle.cmps.map((c) => c.tagName),
  59427. bundleId: bundle.output.bundleId,
  59428. fileName: bundle.output.fileName,
  59429. imports: bundle.rollupResult.imports,
  59430. // code: bundle.rollupResult.code, // (use this to debug)
  59431. // Currently, this number is inaccurate vs what seems to be on disk.
  59432. originalByteSize: byteSize(bundle.rollupResult.code),
  59433. };
  59434. });
  59435. }
  59436. function getSourceGraph(config, buildCtx) {
  59437. const sourceGraph = {};
  59438. sortBy(buildCtx.moduleFiles, (m) => m.sourceFilePath).forEach((moduleFile) => {
  59439. const key = relativePath(config, moduleFile.sourceFilePath);
  59440. sourceGraph[key] = moduleFile.localImports.map((localImport) => relativePath(config, localImport)).sort();
  59441. });
  59442. return sourceGraph;
  59443. }
  59444. function getAppOutputs(config, buildResults) {
  59445. return buildResults.outputs.map((output) => {
  59446. return {
  59447. name: output.type,
  59448. files: output.files.length,
  59449. generatedFiles: output.files.map((file) => relativePath(config, file)),
  59450. };
  59451. });
  59452. }
  59453. function getComponentsFileMap(config, buildCtx) {
  59454. return buildCtx.components.map((component) => {
  59455. return {
  59456. tag: component.tagName,
  59457. path: relativePath(config, component.jsFilePath),
  59458. source: relativePath(config, component.sourceFilePath),
  59459. elementRef: component.elementRef,
  59460. componentClassName: component.componentClassName,
  59461. assetsDirs: component.assetsDirs,
  59462. dependencies: component.dependencies,
  59463. dependents: component.dependents,
  59464. directDependencies: component.directDependencies,
  59465. directDependents: component.directDependents,
  59466. docs: component.docs,
  59467. encapsulation: component.encapsulation,
  59468. excludeFromCollection: component.excludeFromCollection,
  59469. events: component.events,
  59470. internal: component.internal,
  59471. legacyConnect: component.legacyConnect,
  59472. legacyContext: component.legacyContext,
  59473. listeners: component.listeners,
  59474. methods: component.methods,
  59475. potentialCmpRefs: component.potentialCmpRefs,
  59476. properties: component.properties,
  59477. shadowDelegatesFocus: component.shadowDelegatesFocus,
  59478. states: component.states,
  59479. };
  59480. });
  59481. }
  59482. function getCollections(config, buildCtx) {
  59483. return buildCtx.collections
  59484. .map((c) => {
  59485. return {
  59486. name: c.collectionName,
  59487. source: relativePath(config, c.moduleDir),
  59488. tags: c.moduleFiles.map((m) => m.cmps.map((cmp) => cmp.tagName)).sort(),
  59489. };
  59490. })
  59491. .sort((a, b) => {
  59492. if (a.name < b.name)
  59493. return -1;
  59494. if (a.name > b.name)
  59495. return 1;
  59496. return 0;
  59497. });
  59498. }
  59499. function relativePath(config, file) {
  59500. return config.sys.normalizePath(config.sys.platformPath.relative(config.rootDir, file));
  59501. }
  59502. /**
  59503. * Finish a build as having completed successfully
  59504. * @param buildCtx the build context for the build being aborted
  59505. * @returns the build results
  59506. */
  59507. const buildFinish = async (buildCtx) => {
  59508. const results = await buildDone(buildCtx.config, buildCtx.compilerCtx, buildCtx, false);
  59509. const buildLog = {
  59510. buildId: buildCtx.buildId,
  59511. messages: buildCtx.buildMessages.slice(),
  59512. progress: 1,
  59513. };
  59514. buildCtx.compilerCtx.events.emit('buildLog', buildLog);
  59515. return results;
  59516. };
  59517. /**
  59518. * Finish a build early due to failure. During the build process, a fatal error has occurred where the compiler cannot
  59519. * continue further
  59520. * @param buildCtx the build context for the build being aborted
  59521. * @returns the build results
  59522. */
  59523. const buildAbort = (buildCtx) => {
  59524. return buildDone(buildCtx.config, buildCtx.compilerCtx, buildCtx, true);
  59525. };
  59526. /**
  59527. * Mark a build as done
  59528. * @param config the Stencil configuration used for the build
  59529. * @param compilerCtx the compiler context associated with the build
  59530. * @param buildCtx the build context associated with the build to mark as done
  59531. * @param aborted true if the build ended early due to failure, false otherwise
  59532. * @returns the build results
  59533. */
  59534. const buildDone = async (config, compilerCtx, buildCtx, aborted) => {
  59535. if (buildCtx.hasFinished && buildCtx.buildResults) {
  59536. // we've already marked this build as finished and
  59537. // already created the build results, just return these
  59538. return buildCtx.buildResults;
  59539. }
  59540. // create the build results data
  59541. buildCtx.buildResults = generateBuildResults(config, compilerCtx, buildCtx);
  59542. // After the build results are available on the buildCtx, call the stats and set it.
  59543. // We will use this later to write the files.
  59544. buildCtx.buildStats = generateBuildStats(config, buildCtx);
  59545. await writeBuildStats(config, buildCtx.buildStats);
  59546. buildCtx.debug(`${aborted ? 'aborted' : 'finished'} build, ${buildCtx.buildResults.duration}ms`);
  59547. // log any errors/warnings
  59548. if (!buildCtx.hasFinished) {
  59549. // haven't set this build as finished yet
  59550. if (!buildCtx.hasPrintedResults) {
  59551. cleanDiagnosticsRelativePath(config, buildCtx.buildResults.diagnostics);
  59552. config.logger.printDiagnostics(buildCtx.buildResults.diagnostics);
  59553. }
  59554. const hasChanges = buildCtx.hasScriptChanges || buildCtx.hasStyleChanges;
  59555. if (buildCtx.isRebuild && hasChanges && buildCtx.buildResults.hmr && !aborted) {
  59556. // this is a rebuild, and we've got hmr data
  59557. // and this build hasn't been aborted
  59558. logHmr(config.logger, buildCtx);
  59559. }
  59560. // create a nice pretty message stating what happened
  59561. const buildText = buildCtx.isRebuild ? 'rebuild' : 'build';
  59562. const watchText = config.watch ? ', watching for changes...' : '';
  59563. let buildStatus = 'finished';
  59564. let statusColor = 'green';
  59565. if (buildCtx.hasError) {
  59566. // gosh darn, build had errors
  59567. // ಥ_ಥ
  59568. buildStatus = 'failed';
  59569. statusColor = 'red';
  59570. }
  59571. else {
  59572. // successful build!
  59573. // ┏(°.°)┛ ┗(°.°)┓ ┗(°.°)┛ ┏(°.°)┓
  59574. compilerCtx.changedFiles.clear();
  59575. compilerCtx.hasSuccessfulBuild = true;
  59576. buildCtx.buildResults.hasSuccessfulBuild = true;
  59577. }
  59578. // print out the time it took to build
  59579. // and add the duration to the build results
  59580. if (!buildCtx.hasPrintedResults) {
  59581. buildCtx.timeSpan.finish(`${buildText} ${buildStatus}${watchText}`, statusColor, true, true);
  59582. buildCtx.hasPrintedResults = true;
  59583. }
  59584. // emit a buildFinish event for anyone who cares
  59585. compilerCtx.events.emit('buildFinish', buildCtx.buildResults);
  59586. // write all of our logs to disk if config'd to do so
  59587. // do this even if there are errors or not the active build
  59588. if (isFunction(config.logger.writeLogs)) {
  59589. config.logger.writeLogs(buildCtx.isRebuild);
  59590. }
  59591. }
  59592. // it's official, this build has finished
  59593. buildCtx.hasFinished = true;
  59594. if (!config.watch) {
  59595. compilerCtx.reset();
  59596. if (IS_NODE_ENV && global.gc) {
  59597. buildCtx.debug(`triggering forced gc`);
  59598. global.gc();
  59599. buildCtx.debug(`forced gc finished`);
  59600. }
  59601. }
  59602. return buildCtx.buildResults;
  59603. };
  59604. const logHmr = (logger, buildCtx) => {
  59605. // this is a rebuild, and we've got hmr data
  59606. // and this build hasn't been aborted
  59607. const hmr = buildCtx.buildResults.hmr;
  59608. if (hmr.componentsUpdated) {
  59609. cleanupUpdateMsg(logger, `updated component`, hmr.componentsUpdated);
  59610. }
  59611. if (hmr.inlineStylesUpdated) {
  59612. const inlineStyles = hmr.inlineStylesUpdated
  59613. .map((s) => s.styleTag)
  59614. .reduce((arr, v) => {
  59615. if (!arr.includes(v)) {
  59616. arr.push(v);
  59617. }
  59618. return arr;
  59619. }, []);
  59620. cleanupUpdateMsg(logger, `updated style`, inlineStyles);
  59621. }
  59622. if (hmr.externalStylesUpdated) {
  59623. cleanupUpdateMsg(logger, `updated stylesheet`, hmr.externalStylesUpdated);
  59624. }
  59625. if (hmr.imagesUpdated) {
  59626. cleanupUpdateMsg(logger, `updated image`, hmr.imagesUpdated);
  59627. }
  59628. };
  59629. const cleanupUpdateMsg = (logger, msg, fileNames) => {
  59630. if (fileNames.length > 0) {
  59631. let fileMsg = '';
  59632. if (fileNames.length > 7) {
  59633. const remaining = fileNames.length - 6;
  59634. fileNames = fileNames.slice(0, 6);
  59635. fileMsg = fileNames.join(', ') + `, +${remaining} others`;
  59636. }
  59637. else {
  59638. fileMsg = fileNames.join(', ');
  59639. }
  59640. if (fileNames.length > 1) {
  59641. msg += 's';
  59642. }
  59643. logger.info(`${msg}: ${logger.cyan(fileMsg)}`);
  59644. }
  59645. };
  59646. /**
  59647. * Update the relative file path for diagnostics. The updates are done in place.
  59648. * @param config the Stencil configuration associated with the current build
  59649. * @param diagnostics the diagnostics to update
  59650. */
  59651. const cleanDiagnosticsRelativePath = (config, diagnostics) => {
  59652. diagnostics.forEach((diagnostic) => {
  59653. if (!diagnostic.relFilePath && !isRemoteUrl(diagnostic.absFilePath) && diagnostic.absFilePath && config.rootDir) {
  59654. diagnostic.relFilePath = relative$1(config.rootDir, diagnostic.absFilePath);
  59655. }
  59656. });
  59657. };
  59658. /**
  59659. * Entrypoint to creating a service worker for every `www` output target
  59660. * @param config the Stencil configuration used for the build
  59661. * @param buildCtx the build context associated with the build to mark as done
  59662. */
  59663. const outputServiceWorkers = async (config, buildCtx) => {
  59664. const wwwServiceOutputs = config.outputTargets
  59665. .filter(isOutputTargetWww)
  59666. .filter((o) => typeof o.indexHtml === 'string' && !!o.serviceWorker);
  59667. if (wwwServiceOutputs.length === 0 || config.sys.lazyRequire == null) {
  59668. return;
  59669. }
  59670. // let's make sure they have what we need from workbox installed
  59671. const diagnostics = await config.sys.lazyRequire.ensure(config.rootDir, ['workbox-build']);
  59672. if (diagnostics.length > 0) {
  59673. buildCtx.diagnostics.push(...diagnostics);
  59674. }
  59675. else {
  59676. // we've ensured workbox is installed, so let's require it now
  59677. const workbox = config.sys.lazyRequire.require(config.rootDir, 'workbox-build');
  59678. await Promise.all(wwwServiceOutputs.map((outputTarget) => generateServiceWorker(config, buildCtx, workbox, outputTarget)));
  59679. }
  59680. };
  59681. const validateManifestJson = (config, compilerCtx, buildCtx) => {
  59682. if (config.devMode) {
  59683. return null;
  59684. }
  59685. const outputTargets = config.outputTargets.filter(isOutputTargetWww);
  59686. return Promise.all(outputTargets.map(async (outputsTarget) => {
  59687. const manifestFilePath = join(outputsTarget.dir, 'manifest.json');
  59688. try {
  59689. const manifestContent = await compilerCtx.fs.readFile(manifestFilePath);
  59690. if (manifestContent) {
  59691. try {
  59692. const manifestData = JSON.parse(manifestContent);
  59693. await validateManifestJsonData(compilerCtx, buildCtx, manifestFilePath, manifestData);
  59694. }
  59695. catch (e) {
  59696. const err = buildError(buildCtx.diagnostics);
  59697. err.header = `Invalid manifest.json: ${e}`;
  59698. err.absFilePath = manifestFilePath;
  59699. }
  59700. }
  59701. }
  59702. catch (e) { }
  59703. }));
  59704. };
  59705. const validateManifestJsonData = async (compilerCtx, buildCtx, manifestFilePath, manifestData) => {
  59706. if (Array.isArray(manifestData.icons)) {
  59707. await Promise.all(manifestData.icons.map((manifestIcon) => {
  59708. return validateManifestJsonIcon(compilerCtx, buildCtx, manifestFilePath, manifestIcon);
  59709. }));
  59710. }
  59711. };
  59712. const validateManifestJsonIcon = async (compilerCtx, buildCtx, manifestFilePath, manifestIcon) => {
  59713. let iconSrc = manifestIcon.src;
  59714. if (typeof iconSrc !== 'string') {
  59715. const msg = `Manifest icon missing "src"`;
  59716. buildJsonFileError(compilerCtx, buildCtx.diagnostics, manifestFilePath, msg, `"icons"`);
  59717. return;
  59718. }
  59719. if (iconSrc.startsWith('/')) {
  59720. iconSrc = iconSrc.slice(1);
  59721. }
  59722. const manifestDir = dirname(manifestFilePath);
  59723. const iconPath = join(manifestDir, iconSrc);
  59724. const hasAccess = await compilerCtx.fs.access(iconPath);
  59725. if (!hasAccess) {
  59726. const msg = `Unable to find manifest icon "${manifestIcon.src}"`;
  59727. buildJsonFileError(compilerCtx, buildCtx.diagnostics, manifestFilePath, msg, `"${manifestIcon.src}"`);
  59728. }
  59729. };
  59730. /**
  59731. * Validate the package.json file for a project, checking that various fields
  59732. * are set correctly for the currently-configured output targets.
  59733. *
  59734. * @param config the project's Stencil config
  59735. * @param compilerCtx the compiler context
  59736. * @param buildCtx the build context
  59737. * @returns an empty Promise
  59738. */
  59739. const validateBuildPackageJson = async (config, compilerCtx, buildCtx) => {
  59740. if (config.watch) {
  59741. return;
  59742. }
  59743. if (buildCtx.packageJson == null) {
  59744. return;
  59745. }
  59746. const distCollectionOutputTargets = config.outputTargets.filter(isOutputTargetDistCollection);
  59747. const typesOutputTargets = config.outputTargets.filter(isOutputTargetDistTypes);
  59748. await Promise.all([
  59749. ...distCollectionOutputTargets.map((distCollectionOT) => validateDistCollectionPkgJson(config, compilerCtx, buildCtx, distCollectionOT)),
  59750. ...typesOutputTargets.map((typesOT) => validateTypes(config, compilerCtx, buildCtx, typesOT)),
  59751. validateModule(config, compilerCtx, buildCtx),
  59752. ]);
  59753. };
  59754. /**
  59755. * Validate package.json contents for the `DIST_COLLECTION` output target,
  59756. * checking that various fields like `files`, `main`, and so on are set
  59757. * correctly.
  59758. *
  59759. * @param config the stencil config
  59760. * @param compilerCtx the current compiler context
  59761. * @param buildCtx the current build context
  59762. * @param outputTarget a DIST_COLLECTION output target
  59763. */
  59764. const validateDistCollectionPkgJson = async (config, compilerCtx, buildCtx, outputTarget) => {
  59765. await Promise.all([
  59766. validatePackageFiles(config, compilerCtx, buildCtx, outputTarget),
  59767. validateMain(config, compilerCtx, buildCtx, outputTarget),
  59768. validateCollection$1(config, compilerCtx, buildCtx, outputTarget),
  59769. validateBrowser(config, compilerCtx, buildCtx),
  59770. ]);
  59771. };
  59772. /**
  59773. * Validate that the `files` field in `package.json` contains directories and
  59774. * files that are necessary for the `DIST_COLLECTION` output target.
  59775. *
  59776. * @param config the stencil config
  59777. * @param compilerCtx the current compiler context
  59778. * @param buildCtx the current build context
  59779. * @param outputTarget a DIST_COLLECTION output target
  59780. */
  59781. const validatePackageFiles = async (config, compilerCtx, buildCtx, outputTarget) => {
  59782. if (!config.devMode && Array.isArray(buildCtx.packageJson.files)) {
  59783. const actualDistDir = normalizePath$1(relative$1(config.rootDir, outputTarget.dir));
  59784. const validPaths = [`${actualDistDir}`, `${actualDistDir}/`, `./${actualDistDir}`, `./${actualDistDir}/`];
  59785. const containsDistDir = buildCtx.packageJson.files.some((userPath) => validPaths.some((validPath) => normalizePath$1(userPath) === validPath));
  59786. if (!containsDistDir) {
  59787. const msg = `package.json "files" array must contain the distribution directory "${actualDistDir}/" when generating a distribution.`;
  59788. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"files"`);
  59789. return;
  59790. }
  59791. await Promise.all(buildCtx.packageJson.files.map(async (pkgFile) => {
  59792. if (!isGlob(pkgFile)) {
  59793. const packageJsonDir = dirname(config.packageJsonFilePath);
  59794. const absPath = join(packageJsonDir, pkgFile);
  59795. const hasAccess = await compilerCtx.fs.access(absPath);
  59796. if (!hasAccess) {
  59797. const msg = `Unable to find "${pkgFile}" within the package.json "files" array.`;
  59798. packageJsonError(config, compilerCtx, buildCtx, msg, `"${pkgFile}"`);
  59799. }
  59800. }
  59801. }));
  59802. }
  59803. };
  59804. /**
  59805. * Check that the `main` field is set correctly in `package.json` for the
  59806. * `DIST_COLLECTION` output target.
  59807. *
  59808. * @param config the stencil config
  59809. * @param compilerCtx the current compiler context
  59810. * @param buildCtx the current build context
  59811. * @param outputTarget a DIST_COLLECTION output target
  59812. */
  59813. const validateMain = (config, compilerCtx, buildCtx, outputTarget) => {
  59814. const mainAbs = join(outputTarget.dir, 'index.cjs.js');
  59815. const mainRel = relative$1(config.rootDir, mainAbs);
  59816. if (!isString$1(buildCtx.packageJson.main) || buildCtx.packageJson.main === '') {
  59817. const msg = `package.json "main" property is required when generating a distribution. It's recommended to set the "main" property to: ${mainRel}`;
  59818. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"main"`);
  59819. }
  59820. else if (normalizePath$1(buildCtx.packageJson.main) !== normalizePath$1(mainRel)) {
  59821. const msg = `package.json "main" property is set to "${buildCtx.packageJson.main}". It's recommended to set the "main" property to: ${mainRel}`;
  59822. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"main"`);
  59823. }
  59824. };
  59825. /**
  59826. * Validate the package.json 'module' field, taking into account output targets
  59827. * and other configuration details. This will look for a value for the `module`
  59828. * field. If not present it will set a relevant warning message with an
  59829. * output-target specific recommended value. If it is present and is not equal
  59830. * to that recommended value it will set a different warning message.
  59831. *
  59832. * @param config the project's Stencil config
  59833. * @param compilerCtx the compiler context
  59834. * @param buildCtx the build context
  59835. * @returns an empty Promise
  59836. */
  59837. const validateModule = async (config, compilerCtx, buildCtx) => {
  59838. const currentModule = buildCtx.packageJson.module;
  59839. const recommendedRelPath = recommendedModulePath(config);
  59840. if (!isString$1(currentModule)) {
  59841. let msg = 'package.json "module" property is required when generating a distribution.';
  59842. if (recommendedRelPath !== null) {
  59843. msg += ` It's recommended to set the "module" property to: ${normalizePath$1(recommendedRelPath)}`;
  59844. }
  59845. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"module"`);
  59846. return;
  59847. }
  59848. if (recommendedRelPath !== null && normalizePath$1(recommendedRelPath) !== normalizePath$1(currentModule)) {
  59849. const msg = `package.json "module" property is set to "${currentModule}". It's recommended to set the "module" property to: ${normalizePath$1(recommendedRelPath)}`;
  59850. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"module"`);
  59851. }
  59852. };
  59853. // TODO(STENCIL-516): Investigate the hierarchy of these output targets
  59854. /**
  59855. * Get the recommended `"module"` path for `package.json` given the output
  59856. * targets that a user has set on their config.
  59857. *
  59858. * @param config the project's Stencil config
  59859. * @returns a recommended module path or a null value to indicate no default
  59860. * value is supplied
  59861. */
  59862. function recommendedModulePath(config) {
  59863. const customElementsBundleOT = config.outputTargets.find(isOutputTargetDistCustomElementsBundle);
  59864. const customElementsOT = config.outputTargets.find(isOutputTargetDistCustomElements);
  59865. const distCollectionOT = config.outputTargets.find(isOutputTargetDistCollection);
  59866. if (distCollectionOT) {
  59867. return relative$1(config.rootDir, join(distCollectionOT.dir, 'index.js'));
  59868. }
  59869. if (customElementsOT) {
  59870. const componentsIndexAbs = join(customElementsOT.dir, 'index.js');
  59871. return relative$1(config.rootDir, componentsIndexAbs);
  59872. }
  59873. if (customElementsBundleOT) {
  59874. const customElementsAbs = join(customElementsBundleOT.dir, 'index.js');
  59875. return relative$1(config.rootDir, customElementsAbs);
  59876. }
  59877. // if no output target for which we define a recommended output target is set
  59878. // we return `null`
  59879. return null;
  59880. }
  59881. /**
  59882. * Check that the `types` field is set correctly in `package.json` for the
  59883. * `DIST_COLLECTION` output target.
  59884. *
  59885. * @param config the stencil config
  59886. * @param compilerCtx the current compiler context
  59887. * @param buildCtx the current build context
  59888. * @param outputTarget a DIST_COLLECTION output target
  59889. */
  59890. const validateTypes = async (config, compilerCtx, buildCtx, outputTarget) => {
  59891. const typesAbs = getComponentsDtsTypesFilePath(outputTarget);
  59892. const recommendedPath = relative$1(config.rootDir, typesAbs);
  59893. if (!isString$1(buildCtx.packageJson.types) || buildCtx.packageJson.types === '') {
  59894. const msg = `package.json "types" property is required when generating a distribution. It's recommended to set the "types" property to: ${recommendedPath}`;
  59895. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"types"`);
  59896. }
  59897. else if (!buildCtx.packageJson.types.endsWith('.d.ts')) {
  59898. const msg = `package.json "types" file must have a ".d.ts" extension: ${buildCtx.packageJson.types}`;
  59899. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"types"`);
  59900. }
  59901. else {
  59902. const typesFile = join(config.rootDir, buildCtx.packageJson.types);
  59903. const typesFileExists = await compilerCtx.fs.access(typesFile);
  59904. if (!typesFileExists) {
  59905. let msg = `package.json "types" property is set to "${buildCtx.packageJson.types}" but cannot be found.`;
  59906. if (normalizePath$1(buildCtx.packageJson.types) !== normalizePath$1(recommendedPath)) {
  59907. msg += ` It's recommended to set the "types" property to: ${recommendedPath}`;
  59908. }
  59909. packageJsonError(config, compilerCtx, buildCtx, msg, `"types"`);
  59910. }
  59911. }
  59912. };
  59913. /**
  59914. * Check that the `collection` field is set correctly in `package.json` for the
  59915. * `DIST_COLLECTION` output target.
  59916. *
  59917. * @param config the stencil config
  59918. * @param compilerCtx the current compiler context
  59919. * @param buildCtx the current build context
  59920. * @param outputTarget a DIST_COLLECTION output target
  59921. */
  59922. const validateCollection$1 = (config, compilerCtx, buildCtx, outputTarget) => {
  59923. if (outputTarget.collectionDir) {
  59924. const collectionRel = join(relative$1(config.rootDir, outputTarget.collectionDir), COLLECTION_MANIFEST_FILE_NAME);
  59925. if (!buildCtx.packageJson.collection || normalizePath$1(buildCtx.packageJson.collection) !== collectionRel) {
  59926. const msg = `package.json "collection" property is required when generating a distribution and must be set to: ${collectionRel}`;
  59927. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"collection"`);
  59928. }
  59929. }
  59930. };
  59931. /**
  59932. * Check that the `browser` field is set correctly in `package.json` for the
  59933. * `DIST_COLLECTION` output target.
  59934. *
  59935. * @param config the stencil config
  59936. * @param compilerCtx the current compiler context
  59937. * @param buildCtx the current build context
  59938. */
  59939. const validateBrowser = (config, compilerCtx, buildCtx) => {
  59940. if (isString$1(buildCtx.packageJson.browser)) {
  59941. const msg = `package.json "browser" property is set to "${buildCtx.packageJson.browser}". However, for maximum compatibility with all bundlers it's recommended to not set the "browser" property and instead ensure both "module" and "main" properties are set.`;
  59942. packageJsonWarn(config, compilerCtx, buildCtx, msg, `"browser"`);
  59943. }
  59944. };
  59945. /**
  59946. * Build a diagnostic for an error resulting from a particular field in a
  59947. * package.json file
  59948. *
  59949. * @param config the stencil config
  59950. * @param compilerCtx the current compiler context
  59951. * @param buildCtx the current build context
  59952. * @param msg an error string
  59953. * @param jsonField the key for the field which caused the error, used for
  59954. * finding the error line in the original JSON file
  59955. * @returns a diagnostic object
  59956. */
  59957. const packageJsonError = (config, compilerCtx, buildCtx, msg, jsonField) => {
  59958. const err = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField);
  59959. err.header = `Package Json`;
  59960. return err;
  59961. };
  59962. /**
  59963. * Build a diagnostic for a warning resulting from a particular field in a
  59964. * package.json file
  59965. *
  59966. * @param config the stencil config
  59967. * @param compilerCtx the current compiler context
  59968. * @param buildCtx the current build context
  59969. * @param msg an error string
  59970. * @param jsonField the key for the field which caused the error, used for
  59971. * finding the error line in the original JSON file
  59972. * @returns a diagnostic object
  59973. */
  59974. const packageJsonWarn = (config, compilerCtx, buildCtx, msg, jsonField) => {
  59975. const warn = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField);
  59976. warn.header = `Package Json`;
  59977. warn.level = 'warn';
  59978. return warn;
  59979. };
  59980. /**
  59981. * Validate the existence and contents of certain files that were generated after writing the results of the build to
  59982. * disk
  59983. * @param config the Stencil configuration used for the build
  59984. * @param compilerCtx the compiler context associated with the build
  59985. * @param buildCtx the build context associated with the current build
  59986. * @returns an array containing empty-Promise results
  59987. */
  59988. const validateBuildFiles = (config, compilerCtx, buildCtx) => {
  59989. if (buildCtx.hasError) {
  59990. return null;
  59991. }
  59992. return Promise.all([
  59993. validateBuildPackageJson(config, compilerCtx, buildCtx),
  59994. validateManifestJson(config, compilerCtx, buildCtx),
  59995. ]);
  59996. };
  59997. /**
  59998. * Writes files to disk as a result of compilation
  59999. * @param config the Stencil configuration used for the build
  60000. * @param compilerCtx the compiler context associated with the build
  60001. * @param buildCtx the build context associated with the current build
  60002. */
  60003. const writeBuild = async (config, compilerCtx, buildCtx) => {
  60004. const timeSpan = buildCtx.createTimeSpan(`writeBuildFiles started`, true);
  60005. let totalFilesWrote = 0;
  60006. try {
  60007. // commit all the writeFiles, mkdirs, rmdirs and unlinks to disk
  60008. const commitResults = await compilerCtx.fs.commit();
  60009. // get the results from the write to disk commit
  60010. buildCtx.filesWritten = commitResults.filesWritten;
  60011. buildCtx.filesDeleted = commitResults.filesDeleted;
  60012. buildCtx.dirsDeleted = commitResults.dirsDeleted;
  60013. buildCtx.dirsAdded = commitResults.dirsAdded;
  60014. totalFilesWrote = commitResults.filesWritten.length;
  60015. // successful write
  60016. // kick off writing the cached file stuff
  60017. buildCtx.debug(`in-memory-fs: ${compilerCtx.fs.getMemoryStats()}`);
  60018. await outputServiceWorkers(config, buildCtx);
  60019. await validateBuildFiles(config, compilerCtx, buildCtx);
  60020. }
  60021. catch (e) {
  60022. catchError(buildCtx.diagnostics, e);
  60023. }
  60024. timeSpan.finish(`writeBuildFiles finished, files wrote: ${totalFilesWrote}`);
  60025. };
  60026. const build = async (config, compilerCtx, buildCtx, tsBuilder) => {
  60027. try {
  60028. // reset process.cwd() for 3rd-party plugins
  60029. process.chdir(config.rootDir);
  60030. // empty the directories on the first build
  60031. await emptyOutputTargets(config, compilerCtx, buildCtx);
  60032. if (buildCtx.hasError)
  60033. return buildAbort(buildCtx);
  60034. if (config.srcIndexHtml) {
  60035. const indexSrcHtml = await compilerCtx.fs.readFile(config.srcIndexHtml);
  60036. if (isString$1(indexSrcHtml)) {
  60037. buildCtx.indexDoc = createDocument(indexSrcHtml);
  60038. }
  60039. }
  60040. await readPackageJson(config, compilerCtx, buildCtx);
  60041. if (buildCtx.hasError)
  60042. return buildAbort(buildCtx);
  60043. // run typescript program
  60044. const tsTimeSpan = buildCtx.createTimeSpan('transpile started');
  60045. const componentDtsChanged = await runTsProgram(config, compilerCtx, buildCtx, tsBuilder);
  60046. tsTimeSpan.finish('transpile finished');
  60047. if (buildCtx.hasError)
  60048. return buildAbort(buildCtx);
  60049. if (config.watch && componentDtsChanged) {
  60050. // silent abort for watch mode only
  60051. return null;
  60052. }
  60053. // preprocess and generate styles before any outputTarget starts
  60054. buildCtx.stylesPromise = generateGlobalStyles(config, compilerCtx, buildCtx);
  60055. if (buildCtx.hasError)
  60056. return buildAbort(buildCtx);
  60057. // create outputs
  60058. await generateOutputTargets(config, compilerCtx, buildCtx);
  60059. if (buildCtx.hasError)
  60060. return buildAbort(buildCtx);
  60061. // write outputs
  60062. await buildCtx.stylesPromise;
  60063. await writeBuild(config, compilerCtx, buildCtx);
  60064. }
  60065. catch (e) {
  60066. // ¯\_(ツ)_/¯
  60067. catchError(buildCtx.diagnostics, e);
  60068. }
  60069. // TODO
  60070. // clear changed files
  60071. compilerCtx.changedFiles.clear();
  60072. // return what we've learned today
  60073. return buildFinish(buildCtx);
  60074. };
  60075. /**
  60076. * Build a callable function to perform a full build of a Stencil project
  60077. * @param config a Stencil configuration to apply to a full build of a Stencil project
  60078. * @param compilerCtx the current Stencil compiler context
  60079. * @returns the results of a full build of Stencil
  60080. */
  60081. const createFullBuild = async (config, compilerCtx) => {
  60082. return new Promise((resolve) => {
  60083. let tsWatchProgram = null;
  60084. compilerCtx.events.on('fileUpdate', (p) => {
  60085. config.logger.debug(`fileUpdate: ${p}`);
  60086. compilerCtx.fs.clearFileCache(p);
  60087. });
  60088. /**
  60089. * A function that kicks off the transpilation process for both the TypeScript and Stencil compilers
  60090. * @param tsBuilder the manager of the {@link ts.Program} state
  60091. */
  60092. const onBuild = async (tsBuilder) => {
  60093. const buildCtx = new BuildContext(config, compilerCtx);
  60094. buildCtx.isRebuild = false;
  60095. buildCtx.requiresFullBuild = true;
  60096. buildCtx.start();
  60097. const result = await build(config, compilerCtx, buildCtx, tsBuilder);
  60098. if (result !== null) {
  60099. if (tsWatchProgram) {
  60100. tsWatchProgram.close();
  60101. tsWatchProgram = null;
  60102. }
  60103. resolve(result);
  60104. }
  60105. };
  60106. createTsBuildProgram(config, onBuild).then((program) => {
  60107. tsWatchProgram = program;
  60108. });
  60109. });
  60110. };
  60111. const filesChanged = (buildCtx) => {
  60112. // files changed include updated, added and deleted
  60113. return unique([...buildCtx.filesUpdated, ...buildCtx.filesAdded, ...buildCtx.filesDeleted]).sort();
  60114. };
  60115. /**
  60116. * Unary helper function mapping string to string and wrapping `basename`,
  60117. * which normally takes two string arguments. This means it cannot be passed
  60118. * to `Array.prototype.map`, but this little helper can!
  60119. *
  60120. * @param filePath a filepath to check out
  60121. * @returns the basename for that filepath
  60122. */
  60123. const unaryBasename = (filePath) => basename(filePath);
  60124. /**
  60125. * Get the file extension for a path
  60126. *
  60127. * @param filePath a path
  60128. * @returns the file extension (well, characters after the last `'.'`)
  60129. */
  60130. const getExt = (filePath) => filePath.split('.').pop().toLowerCase();
  60131. /**
  60132. * Script extensions which we want to be able to recognize
  60133. */
  60134. const SCRIPT_EXT = ['ts', 'tsx', 'js', 'jsx'];
  60135. /**
  60136. * Helper to check if a filepath has a script extension
  60137. *
  60138. * @param filePath a file extension
  60139. * @returns whether the filepath has a script extension or not
  60140. */
  60141. const hasScriptExt = (filePath) => SCRIPT_EXT.includes(getExt(filePath));
  60142. const STYLE_EXT = ['css', 'scss', 'sass', 'pcss', 'styl', 'stylus', 'less'];
  60143. /**
  60144. * Helper to check if a filepath has a style extension
  60145. *
  60146. * @param filePath a file extension to check
  60147. * @returns whether the filepath has a style extension or not
  60148. */
  60149. const hasStyleExt = (filePath) => STYLE_EXT.includes(getExt(filePath));
  60150. /**
  60151. * Get all scripts from a build context that were added
  60152. *
  60153. * @param buildCtx the build context
  60154. * @returns an array of filepaths that were added
  60155. */
  60156. const scriptsAdded = (buildCtx) => buildCtx.filesAdded.filter(hasScriptExt).map(unaryBasename);
  60157. /**
  60158. * Get all scripts from a build context that were deleted
  60159. *
  60160. * @param buildCtx the build context
  60161. * @returns an array of deleted filepaths
  60162. */
  60163. const scriptsDeleted = (buildCtx) => buildCtx.filesDeleted.filter(hasScriptExt).map(unaryBasename);
  60164. /**
  60165. * Check whether a build has script changes
  60166. *
  60167. * @param buildCtx the build context
  60168. * @returns whether or not there are script changes
  60169. */
  60170. const hasScriptChanges = (buildCtx) => buildCtx.filesChanged.some(hasScriptExt);
  60171. /**
  60172. * Check whether a build has style changes
  60173. *
  60174. * @param buildCtx the build context
  60175. * @returns whether or not there are style changes
  60176. */
  60177. const hasStyleChanges = (buildCtx) => buildCtx.filesChanged.some(hasStyleExt);
  60178. /**
  60179. * Check whether a build has html changes
  60180. *
  60181. * @param config the current config
  60182. * @param buildCtx the build context
  60183. * @returns whether or not HTML files were changed
  60184. */
  60185. const hasHtmlChanges = (config, buildCtx) => {
  60186. const anyHtmlChanged = buildCtx.filesChanged.some((f) => f.toLowerCase().endsWith('.html'));
  60187. if (anyHtmlChanged) {
  60188. // any *.html in any directory that changes counts and rebuilds
  60189. return true;
  60190. }
  60191. const srcIndexHtmlChanged = buildCtx.filesChanged.some((fileChanged) => {
  60192. // the src index index.html file has changed
  60193. // this file name could be something other than index.html
  60194. return fileChanged === config.srcIndexHtml;
  60195. });
  60196. return srcIndexHtmlChanged;
  60197. };
  60198. const isWatchIgnorePath = (config, path) => {
  60199. if (isString$1(path)) {
  60200. const isWatchIgnore = config.watchIgnoredRegex.some((reg) => reg.test(path));
  60201. if (isWatchIgnore) {
  60202. return true;
  60203. }
  60204. const outputTargets = config.outputTargets;
  60205. const ignoreFiles = [
  60206. ...outputTargets.filter(isOutputTargetDocsJson).map((o) => o.file),
  60207. ...outputTargets.filter(isOutputTargetDocsJson).map((o) => o.typesFile),
  60208. ...outputTargets.filter(isOutputTargetStats).map((o) => o.file),
  60209. ...outputTargets.filter(isOutputTargetDocsVscode).map((o) => o.file),
  60210. ];
  60211. if (ignoreFiles.includes(path)) {
  60212. return true;
  60213. }
  60214. }
  60215. return false;
  60216. };
  60217. const createTsWatchProgram = async (config, buildCallback) => {
  60218. let isRunning = false;
  60219. let lastTsBuilder;
  60220. let timeoutId;
  60221. let rebuildTimer;
  60222. const optionsToExtend = getTsOptionsToExtend(config);
  60223. const tsWatchSys = {
  60224. ...t.sys,
  60225. setTimeout(callback, time) {
  60226. clearInterval(rebuildTimer);
  60227. const t = (timeoutId = setInterval(() => {
  60228. if (!isRunning) {
  60229. callback();
  60230. clearInterval(t);
  60231. timeoutId = rebuildTimer = null;
  60232. }
  60233. }, config.sys.watchTimeout || time));
  60234. return t;
  60235. },
  60236. clearTimeout(id) {
  60237. return clearInterval(id);
  60238. },
  60239. };
  60240. config.sys.addDestory(() => tsWatchSys.clearTimeout(timeoutId));
  60241. const tsWatchHost = t.createWatchCompilerHost(config.tsconfig, optionsToExtend, tsWatchSys, t.createEmitAndSemanticDiagnosticsBuilderProgram, (reportDiagnostic) => {
  60242. config.logger.debug('watch reportDiagnostic:' + reportDiagnostic.messageText);
  60243. }, (reportWatchStatus) => {
  60244. config.logger.debug(reportWatchStatus.messageText);
  60245. });
  60246. tsWatchHost.afterProgramCreate = async (tsBuilder) => {
  60247. lastTsBuilder = tsBuilder;
  60248. isRunning = true;
  60249. await buildCallback(tsBuilder);
  60250. isRunning = false;
  60251. };
  60252. return {
  60253. program: t.createWatchProgram(tsWatchHost),
  60254. rebuild: () => {
  60255. if (lastTsBuilder && !timeoutId) {
  60256. rebuildTimer = tsWatchSys.setTimeout(() => tsWatchHost.afterProgramCreate(lastTsBuilder), 300);
  60257. }
  60258. },
  60259. };
  60260. };
  60261. const createWatchBuild = async (config, compilerCtx) => {
  60262. let isRebuild = false;
  60263. let tsWatchProgram;
  60264. let closeResolver;
  60265. const watchWaiter = new Promise((resolve) => (closeResolver = resolve));
  60266. const dirsAdded = new Set();
  60267. const dirsDeleted = new Set();
  60268. const filesAdded = new Set();
  60269. const filesUpdated = new Set();
  60270. const filesDeleted = new Set();
  60271. const onBuild = async (tsBuilder) => {
  60272. const buildCtx = new BuildContext(config, compilerCtx);
  60273. buildCtx.isRebuild = isRebuild;
  60274. buildCtx.requiresFullBuild = !isRebuild;
  60275. buildCtx.dirsAdded = Array.from(dirsAdded.keys()).sort();
  60276. buildCtx.dirsDeleted = Array.from(dirsDeleted.keys()).sort();
  60277. buildCtx.filesAdded = Array.from(filesAdded.keys()).sort();
  60278. buildCtx.filesUpdated = Array.from(filesUpdated.keys()).sort();
  60279. buildCtx.filesDeleted = Array.from(filesDeleted.keys()).sort();
  60280. buildCtx.filesChanged = filesChanged(buildCtx);
  60281. buildCtx.scriptsAdded = scriptsAdded(buildCtx);
  60282. buildCtx.scriptsDeleted = scriptsDeleted(buildCtx);
  60283. buildCtx.hasScriptChanges = hasScriptChanges(buildCtx);
  60284. buildCtx.hasStyleChanges = hasStyleChanges(buildCtx);
  60285. buildCtx.hasHtmlChanges = hasHtmlChanges(config, buildCtx);
  60286. buildCtx.hasServiceWorkerChanges = hasServiceWorkerChanges(config, buildCtx);
  60287. dirsAdded.clear();
  60288. dirsDeleted.clear();
  60289. filesAdded.clear();
  60290. filesUpdated.clear();
  60291. filesDeleted.clear();
  60292. emitFsChange(compilerCtx, buildCtx);
  60293. buildCtx.start();
  60294. const result = await build(config, compilerCtx, buildCtx, tsBuilder);
  60295. if (result && !result.hasError) {
  60296. isRebuild = true;
  60297. }
  60298. };
  60299. const start = async () => {
  60300. const srcRead = watchSrcDirectory(config, compilerCtx);
  60301. const otherRead = watchRootFiles(config, compilerCtx);
  60302. await srcRead;
  60303. await otherRead;
  60304. tsWatchProgram = await createTsWatchProgram(config, onBuild);
  60305. return watchWaiter;
  60306. };
  60307. const watchingDirs = new Map();
  60308. const watchingFiles = new Map();
  60309. const onFsChange = (p, eventKind) => {
  60310. if (tsWatchProgram && !isWatchIgnorePath(config, p)) {
  60311. updateCompilerCtxCache(config, compilerCtx, p, eventKind);
  60312. switch (eventKind) {
  60313. case 'dirAdd':
  60314. dirsAdded.add(p);
  60315. break;
  60316. case 'dirDelete':
  60317. dirsDeleted.add(p);
  60318. break;
  60319. case 'fileAdd':
  60320. filesAdded.add(p);
  60321. break;
  60322. case 'fileUpdate':
  60323. filesUpdated.add(p);
  60324. break;
  60325. case 'fileDelete':
  60326. filesDeleted.add(p);
  60327. break;
  60328. }
  60329. config.logger.debug(`onFsChange ${eventKind}: ${p}`);
  60330. tsWatchProgram.rebuild();
  60331. }
  60332. };
  60333. const onDirChange = (p, eventKind) => {
  60334. if (eventKind != null) {
  60335. onFsChange(p, eventKind);
  60336. }
  60337. };
  60338. const close = async () => {
  60339. watchingDirs.forEach((w) => w.close());
  60340. watchingFiles.forEach((w) => w.close());
  60341. watchingDirs.clear();
  60342. watchingFiles.clear();
  60343. if (tsWatchProgram) {
  60344. tsWatchProgram.program.close();
  60345. tsWatchProgram = null;
  60346. }
  60347. const watcherCloseResults = {
  60348. exitCode: 0,
  60349. };
  60350. closeResolver(watcherCloseResults);
  60351. return watcherCloseResults;
  60352. };
  60353. const request = async (data) => compilerRequest(config, compilerCtx, data);
  60354. compilerCtx.addWatchFile = (filePath) => {
  60355. if (isString$1(filePath) && !watchingFiles.has(filePath) && !isWatchIgnorePath(config, filePath)) {
  60356. watchingFiles.set(filePath, config.sys.watchFile(filePath, onFsChange));
  60357. }
  60358. };
  60359. compilerCtx.addWatchDir = (dirPath, recursive) => {
  60360. if (isString$1(dirPath) && !watchingDirs.has(dirPath) && !isWatchIgnorePath(config, dirPath)) {
  60361. watchingDirs.set(dirPath, config.sys.watchDirectory(dirPath, onDirChange, recursive));
  60362. }
  60363. };
  60364. config.sys.addDestory(close);
  60365. return {
  60366. start,
  60367. close,
  60368. on: compilerCtx.events.on,
  60369. request,
  60370. };
  60371. };
  60372. const watchSrcDirectory = async (config, compilerCtx) => {
  60373. const srcFiles = await compilerCtx.fs.readdir(config.srcDir, {
  60374. recursive: true,
  60375. excludeDirNames: ['.cache', '.git', '.github', '.stencil', '.vscode', 'node_modules'],
  60376. excludeExtensions: [
  60377. '.md',
  60378. '.markdown',
  60379. '.txt',
  60380. '.spec.ts',
  60381. '.spec.tsx',
  60382. '.e2e.ts',
  60383. '.e2e.tsx',
  60384. '.gitignore',
  60385. '.editorconfig',
  60386. ],
  60387. });
  60388. srcFiles.filter(({ isFile }) => isFile).forEach(({ absPath }) => compilerCtx.addWatchFile(absPath));
  60389. compilerCtx.addWatchDir(config.srcDir, true);
  60390. };
  60391. const watchRootFiles = async (config, compilerCtx) => {
  60392. // non-src files that cause a rebuild
  60393. // mainly for root level config files, and getting an event when they change
  60394. const rootFiles = await compilerCtx.fs.readdir(config.rootDir, {
  60395. recursive: false,
  60396. excludeDirNames: ['.cache', '.git', '.github', '.stencil', '.vscode', 'node_modules'],
  60397. });
  60398. rootFiles.filter(({ isFile }) => isFile).forEach(({ absPath }) => compilerCtx.addWatchFile(absPath));
  60399. };
  60400. const emitFsChange = (compilerCtx, buildCtx) => {
  60401. if (buildCtx.dirsAdded.length > 0 ||
  60402. buildCtx.dirsDeleted.length > 0 ||
  60403. buildCtx.filesUpdated.length > 0 ||
  60404. buildCtx.filesAdded.length > 0 ||
  60405. buildCtx.filesDeleted.length > 0) {
  60406. compilerCtx.events.emit('fsChange', {
  60407. dirsAdded: buildCtx.dirsAdded.slice(),
  60408. dirsDeleted: buildCtx.dirsDeleted.slice(),
  60409. filesUpdated: buildCtx.filesUpdated.slice(),
  60410. filesAdded: buildCtx.filesAdded.slice(),
  60411. filesDeleted: buildCtx.filesDeleted.slice(),
  60412. });
  60413. }
  60414. };
  60415. const updateCompilerCtxCache = (config, compilerCtx, path, kind) => {
  60416. compilerCtx.fs.clearFileCache(path);
  60417. compilerCtx.changedFiles.add(path);
  60418. if (kind === 'fileDelete') {
  60419. compilerCtx.moduleMap.delete(path);
  60420. }
  60421. else if (kind === 'dirDelete') {
  60422. const fsRootDir = resolve$1('/');
  60423. compilerCtx.moduleMap.forEach((_, moduleFilePath) => {
  60424. let moduleAncestorDir = dirname(moduleFilePath);
  60425. for (let i = 0; i < 50; i++) {
  60426. if (moduleAncestorDir === config.rootDir || moduleAncestorDir === fsRootDir) {
  60427. break;
  60428. }
  60429. if (moduleAncestorDir === path) {
  60430. compilerCtx.fs.clearFileCache(moduleFilePath);
  60431. compilerCtx.moduleMap.delete(moduleFilePath);
  60432. compilerCtx.changedFiles.add(moduleFilePath);
  60433. break;
  60434. }
  60435. moduleAncestorDir = dirname(moduleAncestorDir);
  60436. }
  60437. });
  60438. }
  60439. };
  60440. class Cache {
  60441. constructor(config, cacheFs) {
  60442. this.config = config;
  60443. this.cacheFs = cacheFs;
  60444. this.failed = 0;
  60445. this.skip = false;
  60446. this.sys = config.sys;
  60447. this.logger = config.logger;
  60448. }
  60449. async initCacheDir() {
  60450. if (this.config._isTesting || !this.config.cacheDir) {
  60451. return;
  60452. }
  60453. if (!this.config.enableCache || !this.cacheFs) {
  60454. this.config.logger.info(`cache optimizations disabled`);
  60455. this.clearDiskCache();
  60456. return;
  60457. }
  60458. this.config.logger.debug(`cache enabled, cacheDir: ${this.config.cacheDir}`);
  60459. try {
  60460. const readmeFilePath = join(this.config.cacheDir, '_README.log');
  60461. await this.cacheFs.writeFile(readmeFilePath, CACHE_DIR_README);
  60462. }
  60463. catch (e) {
  60464. this.logger.error(`Cache, initCacheDir: ${e}`);
  60465. this.config.enableCache = false;
  60466. }
  60467. }
  60468. async get(key) {
  60469. if (!this.config.enableCache || this.skip) {
  60470. return null;
  60471. }
  60472. if (this.failed >= MAX_FAILED) {
  60473. if (!this.skip) {
  60474. this.skip = true;
  60475. this.logger.debug(`cache had ${this.failed} failed ops, skip disk ops for remander of build`);
  60476. }
  60477. return null;
  60478. }
  60479. let result;
  60480. try {
  60481. result = await this.cacheFs.readFile(this.getCacheFilePath(key));
  60482. this.failed = 0;
  60483. this.skip = false;
  60484. }
  60485. catch (e) {
  60486. this.failed++;
  60487. result = null;
  60488. }
  60489. return result;
  60490. }
  60491. async put(key, value) {
  60492. if (!this.config.enableCache) {
  60493. return false;
  60494. }
  60495. let result;
  60496. try {
  60497. await this.cacheFs.writeFile(this.getCacheFilePath(key), value);
  60498. result = true;
  60499. }
  60500. catch (e) {
  60501. this.failed++;
  60502. result = false;
  60503. }
  60504. return result;
  60505. }
  60506. async has(key) {
  60507. const val = await this.get(key);
  60508. return typeof val === 'string';
  60509. }
  60510. async createKey(domain, ...args) {
  60511. if (!this.config.enableCache) {
  60512. return domain + Math.random() * 9999999;
  60513. }
  60514. const hash = await this.sys.generateContentHash(JSON.stringify(args), 32);
  60515. return domain + '_' + hash;
  60516. }
  60517. async commit() {
  60518. if (this.config.enableCache) {
  60519. this.skip = false;
  60520. this.failed = 0;
  60521. await this.cacheFs.commit();
  60522. await this.clearExpiredCache();
  60523. }
  60524. }
  60525. clear() {
  60526. if (this.cacheFs != null) {
  60527. this.cacheFs.clearCache();
  60528. }
  60529. }
  60530. async clearExpiredCache() {
  60531. if (this.cacheFs == null || this.sys.cacheStorage == null) {
  60532. return;
  60533. }
  60534. const now = Date.now();
  60535. const lastClear = (await this.sys.cacheStorage.get(EXP_STORAGE_KEY));
  60536. if (lastClear != null) {
  60537. const diff = now - lastClear;
  60538. if (diff < ONE_DAY) {
  60539. return;
  60540. }
  60541. const fs = this.cacheFs.sys;
  60542. const cachedFileNames = await fs.readDir(this.config.cacheDir);
  60543. const cachedFilePaths = cachedFileNames.map((f) => join(this.config.cacheDir, f));
  60544. let totalCleared = 0;
  60545. const promises = cachedFilePaths.map(async (filePath) => {
  60546. const stat = await fs.stat(filePath);
  60547. const lastModified = stat.mtimeMs;
  60548. const diff = now - lastModified;
  60549. if (diff > ONE_WEEK) {
  60550. await fs.removeFile(filePath);
  60551. totalCleared++;
  60552. }
  60553. });
  60554. await Promise.all(promises);
  60555. this.logger.debug(`clearExpiredCache, cachedFileNames: ${cachedFileNames.length}, totalCleared: ${totalCleared}`);
  60556. }
  60557. this.logger.debug(`clearExpiredCache, set last clear`);
  60558. await this.sys.cacheStorage.set(EXP_STORAGE_KEY, now);
  60559. }
  60560. async clearDiskCache() {
  60561. if (this.cacheFs != null) {
  60562. const hasAccess = await this.cacheFs.access(this.config.cacheDir);
  60563. if (hasAccess) {
  60564. await this.cacheFs.remove(this.config.cacheDir);
  60565. await this.cacheFs.commit();
  60566. }
  60567. }
  60568. }
  60569. getCacheFilePath(key) {
  60570. return join(this.config.cacheDir, key) + '.log';
  60571. }
  60572. getMemoryStats() {
  60573. if (this.cacheFs != null) {
  60574. return this.cacheFs.getMemoryStats();
  60575. }
  60576. return null;
  60577. }
  60578. }
  60579. const MAX_FAILED = 100;
  60580. const ONE_DAY = 1000 * 60 * 60 * 24;
  60581. const ONE_WEEK = ONE_DAY * 7;
  60582. const EXP_STORAGE_KEY = `last_clear_expired_cache`;
  60583. const CACHE_DIR_README = `# Stencil Cache Directory
  60584. This directory contains files which the compiler has
  60585. cached for faster builds. To disable caching, please set
  60586. "enableCache: false" within the stencil config.
  60587. To change the cache directory, please update the
  60588. "cacheDir" property within the stencil config.
  60589. `;
  60590. /**
  60591. * All the Boolean options supported by the Stencil CLI
  60592. */
  60593. /**
  60594. * Helper function for initializing a `ConfigFlags` object. Provide any overrides
  60595. * for default values and off you go!
  60596. *
  60597. * @param init an object with any overrides for default values
  60598. * @returns a complete CLI flag object
  60599. */
  60600. const createConfigFlags = (init = {}) => {
  60601. const flags = {
  60602. task: null,
  60603. args: [],
  60604. knownArgs: [],
  60605. unknownArgs: [],
  60606. ...init,
  60607. };
  60608. return flags;
  60609. };
  60610. const getConfig = (userConfig) => {
  60611. var _a, _b, _c, _d, _e;
  60612. const logger = (_a = userConfig.logger) !== null && _a !== void 0 ? _a : createLogger();
  60613. const config = {
  60614. ...userConfig,
  60615. flags: createConfigFlags((_b = userConfig.flags) !== null && _b !== void 0 ? _b : {}),
  60616. logger,
  60617. outputTargets: (_c = userConfig.outputTargets) !== null && _c !== void 0 ? _c : [],
  60618. rootDir: (_d = userConfig.rootDir) !== null && _d !== void 0 ? _d : '/',
  60619. sys: (_e = userConfig.sys) !== null && _e !== void 0 ? _e : createSystem({ logger }),
  60620. testing: userConfig !== null && userConfig !== void 0 ? userConfig : {},
  60621. };
  60622. setPlatformPath(config.sys.platformPath);
  60623. if (config.flags.debug || config.flags.verbose) {
  60624. config.logLevel = 'debug';
  60625. }
  60626. else if (config.flags.logLevel) {
  60627. config.logLevel = config.flags.logLevel;
  60628. }
  60629. else if (typeof config.logLevel !== 'string') {
  60630. config.logLevel = 'info';
  60631. }
  60632. config.logger.setLevel(config.logLevel);
  60633. return config;
  60634. };
  60635. const patchFs = (userSys) => {
  60636. const fsObj = fs$3;
  60637. Object.assign(fsObj.__sys, userSys);
  60638. };
  60639. /**
  60640. * Create an in-memory FS which proxies the underlying OS filesystem using an
  60641. * in-memory cache. FS writes can accumulate on the in-memory system, using an
  60642. * API similar to Node.js' `"fs"` module, and then be committed to disk as a
  60643. * unit.
  60644. *
  60645. * Files written to the in-memory system can be edited, deleted, and so on.
  60646. * This allows the compiler to proceed freely as if it is modifying the
  60647. * filesystem, modifying the world in whatever way suits it, while deferring
  60648. * actual FS writes until the end of the compilation process, making actual
  60649. * changes to the filesystem on disk contingent on an error-free build or any
  60650. * other condition.
  60651. *
  60652. * @param sys a compiler system object
  60653. * @returns an in-memory filesystem interface
  60654. */
  60655. const createInMemoryFs = (sys) => {
  60656. /**
  60657. * Map to hold the items in the in-memory cache which proxies the underlying
  60658. * OS filesystem.
  60659. */
  60660. const items = new Map();
  60661. const outputTargetTypes = new Map();
  60662. /**
  60663. * Check if a file exists at a provided path. This function will attempt to
  60664. * use the in-memory cache before performing a blocking read. In the event of
  60665. * a cache hit, the content from the cache will be returned and the read skipped.
  60666. *
  60667. * @param filePath the path to the file to read
  60668. * @returns `true` if the file exists, `false` otherwise
  60669. */
  60670. const access = async (filePath) => {
  60671. const item = getItem(filePath);
  60672. if (typeof item.exists !== 'boolean') {
  60673. const stats = await stat(filePath);
  60674. return stats.exists;
  60675. }
  60676. return item.exists;
  60677. };
  60678. /**
  60679. * **Synchronous!!! Do not use!!!**
  60680. * (Only typescript transpiling is allowed to use)
  60681. *
  60682. * Synchronously get information about a file from a provided path. This
  60683. * function will attempt to use an in-memory cache before performing a
  60684. * blocking read.
  60685. *
  60686. * In the event of a cache hit, the content from the cache will be returned
  60687. * and skip the read.
  60688. *
  60689. * @param filePath the path to the file to read
  60690. * @returns `true` if the file exists, `false` otherwise
  60691. */
  60692. const accessSync = (filePath) => {
  60693. const item = getItem(filePath);
  60694. if (typeof item.exists !== 'boolean') {
  60695. const stats = statSync(filePath);
  60696. return stats.exists;
  60697. }
  60698. return item.exists;
  60699. };
  60700. /**
  60701. * Copy a file from `src` to `dest`. Note that this merely queues the file
  60702. * for copying, the copy isn't actually committed.
  60703. *
  60704. * @param src the path to the source file
  60705. * @param dest the destination the source file should be copied to
  60706. */
  60707. const copyFile = async (src, dest) => {
  60708. const item = getItem(src);
  60709. item.queueCopyFileToDest = dest;
  60710. };
  60711. /**
  60712. * Empty a series of directories of their contents
  60713. *
  60714. * @param dirs a set of directories to empty
  60715. * @returns an empty Promise
  60716. */
  60717. const emptyDirs = async (dirs) => {
  60718. dirs = dirs
  60719. .filter(isString$1)
  60720. .map(normalizePath$1)
  60721. .reduce((dirs, dir) => {
  60722. if (!dirs.includes(dir)) {
  60723. dirs.push(dir);
  60724. }
  60725. return dirs;
  60726. }, []);
  60727. const allFsItems = await Promise.all(dirs.map((dir) => readdir(dir, { recursive: true })));
  60728. const reducedItems = [];
  60729. for (const fsItems of allFsItems) {
  60730. for (const f of fsItems) {
  60731. if (!reducedItems.includes(f.absPath)) {
  60732. reducedItems.push(f.absPath);
  60733. }
  60734. }
  60735. }
  60736. reducedItems.sort((a, b) => {
  60737. const partsA = a.split('/').length;
  60738. const partsB = b.split('/').length;
  60739. if (partsA < partsB)
  60740. return 1;
  60741. if (partsA > partsB)
  60742. return -1;
  60743. return 0;
  60744. });
  60745. await Promise.all(reducedItems.map(removeItem));
  60746. dirs.forEach((dir) => {
  60747. const item = getItem(dir);
  60748. item.isFile = false;
  60749. item.isDirectory = true;
  60750. item.queueWriteToDisk = true;
  60751. item.queueDeleteFromDisk = false;
  60752. });
  60753. };
  60754. /**
  60755. * Get the contents of a directory on the in-memory filesystem
  60756. *
  60757. * @param dirPath the path to the directory of interest
  60758. * @param opts an optional object containing configuration options
  60759. * @returns a Promise wrapping a list of directory contents
  60760. */
  60761. const readdir = async (dirPath, opts = {}) => {
  60762. dirPath = normalizePath$1(dirPath);
  60763. const collectedPaths = [];
  60764. if (opts.inMemoryOnly === true) {
  60765. let inMemoryDir = dirPath;
  60766. if (!inMemoryDir.endsWith('/')) {
  60767. inMemoryDir += '/';
  60768. }
  60769. const inMemoryDirs = dirPath.split('/');
  60770. items.forEach((dir, filePath) => {
  60771. if (!filePath.startsWith(dirPath)) {
  60772. return;
  60773. }
  60774. const parts = filePath.split('/');
  60775. if (parts.length === inMemoryDirs.length + 1 || (opts.recursive && parts.length > inMemoryDirs.length)) {
  60776. if (dir.exists) {
  60777. const item = {
  60778. absPath: filePath,
  60779. relPath: parts[inMemoryDirs.length],
  60780. isDirectory: dir.isDirectory,
  60781. isFile: dir.isFile,
  60782. };
  60783. if (!shouldExcludeFromReaddir(opts, item)) {
  60784. collectedPaths.push(item);
  60785. }
  60786. }
  60787. }
  60788. });
  60789. }
  60790. else {
  60791. // always a disk read
  60792. await readDirectory(dirPath, dirPath, opts, collectedPaths);
  60793. }
  60794. return collectedPaths.sort((a, b) => {
  60795. if (a.absPath < b.absPath)
  60796. return -1;
  60797. if (a.absPath > b.absPath)
  60798. return 1;
  60799. return 0;
  60800. });
  60801. };
  60802. /**
  60803. * A directory read function which _always_ reads from the disk and so is
  60804. * only used internally.
  60805. *
  60806. * @param initPath an initial path used for computing relative paths
  60807. * @param dirPath the path of the directory to look at
  60808. * @param opts options for read operations
  60809. * @param collectedPaths an out param to which directory entries will be
  60810. * added
  60811. */
  60812. const readDirectory = async (initPath, dirPath, opts, collectedPaths) => {
  60813. // used internally only so we could easily recursively drill down
  60814. // loop through this directory and sub directories
  60815. // always a disk read!!removeDir
  60816. const dirItems = await sys.readDir(dirPath);
  60817. if (dirItems.length > 0) {
  60818. // cache some facts about this path
  60819. const item = getItem(dirPath);
  60820. item.exists = true;
  60821. item.isFile = false;
  60822. item.isDirectory = true;
  60823. await Promise.all(dirItems.map(async (dirItem) => {
  60824. // let's loop through each of the files we've found so far
  60825. // create an absolute path of the item inside of this directory
  60826. const absPath = normalizePath$1(dirItem);
  60827. const relPath = normalizePath$1(relative$1(initPath, absPath));
  60828. // get the fs stats for the item, could be either a file or directory
  60829. const stats = await stat(absPath);
  60830. const childItem = {
  60831. absPath: absPath,
  60832. relPath: relPath,
  60833. isDirectory: stats.isDirectory,
  60834. isFile: stats.isFile,
  60835. };
  60836. if (shouldExcludeFromReaddir(opts, childItem)) {
  60837. return;
  60838. }
  60839. collectedPaths.push(childItem);
  60840. if (opts.recursive === true && stats.isDirectory === true) {
  60841. // looks like it's yet another directory
  60842. // let's keep drilling down
  60843. await readDirectory(initPath, absPath, opts, collectedPaths);
  60844. }
  60845. }));
  60846. }
  60847. };
  60848. /**
  60849. * Check whether a given item should be excluded from readdir results
  60850. *
  60851. * @param opts options for fs read operations
  60852. * @param item the item in question
  60853. * @returns whether the item should be excluded or not
  60854. */
  60855. const shouldExcludeFromReaddir = (opts, item) => {
  60856. if (item.isDirectory) {
  60857. if (Array.isArray(opts.excludeDirNames)) {
  60858. const base = basename(item.absPath);
  60859. if (opts.excludeDirNames.some((dir) => base === dir)) {
  60860. return true;
  60861. }
  60862. }
  60863. }
  60864. else {
  60865. if (Array.isArray(opts.excludeExtensions)) {
  60866. const p = item.relPath.toLowerCase();
  60867. if (opts.excludeExtensions.some((ext) => p.endsWith(ext))) {
  60868. return true;
  60869. }
  60870. }
  60871. }
  60872. return false;
  60873. };
  60874. /**
  60875. * Read a file on the in-memory filesystem. By default, this will look at
  60876. * the in-memory FS proxy first and then, if nothing is found at the provided
  60877. * path, it will then look at the real FS.
  60878. *
  60879. * This behavior can be disabled by setting the `useCache` option to `false`
  60880. * on the provided options object. When this option is set the actual FS will
  60881. * be checked directly without looking at the in-memory FS first.
  60882. *
  60883. * @param filePath the filepath of interest
  60884. * @param opts an optional object containing options for reading files
  60885. * @returns a promise wrapping either the contents of the file (if found) or
  60886. * undefined if it's not found
  60887. */
  60888. const readFile = async (filePath, opts) => {
  60889. // default to looking at the in-memory FS first (we will only *not* do
  60890. // so if `opts.useCache === false`)
  60891. if (opts == null || opts.useCache === true || opts.useCache === undefined) {
  60892. const item = getItem(filePath);
  60893. if (item.exists && typeof item.fileText === 'string') {
  60894. return item.fileText;
  60895. }
  60896. }
  60897. const fileText = await sys.readFile(filePath);
  60898. const item = getItem(filePath);
  60899. if (typeof fileText === 'string') {
  60900. if (fileText.length < MAX_TEXT_CACHE) {
  60901. item.exists = true;
  60902. item.isFile = true;
  60903. item.isDirectory = false;
  60904. item.fileText = fileText;
  60905. }
  60906. }
  60907. else {
  60908. item.exists = false;
  60909. }
  60910. return fileText;
  60911. };
  60912. /**
  60913. * **Synchronous!!! Do not use!!!**
  60914. * (Only typescript transpiling is allowed to use)
  60915. *
  60916. * Synchronously read a file from a provided path. This function will attempt
  60917. * to use an in-memory cache before performing a blocking read in the
  60918. * following circumstances:
  60919. *
  60920. * - no `opts` are provided
  60921. * - the `useCache` member on `opts` is set to `true`, or is not set
  60922. *
  60923. * In the event of a cache hit, the content from the cache will be returned
  60924. * and skip the read.
  60925. *
  60926. * @param filePath the path to the file to read
  60927. * @param opts a configuration to use when reading a file
  60928. * @returns the contents of the file (read from either disk or the cache).
  60929. */
  60930. const readFileSync = (filePath, opts) => {
  60931. if (opts == null || opts.useCache === true || opts.useCache === undefined) {
  60932. const item = getItem(filePath);
  60933. if (item.exists && typeof item.fileText === 'string') {
  60934. return item.fileText;
  60935. }
  60936. }
  60937. const fileText = sys.readFileSync(filePath);
  60938. const item = getItem(filePath);
  60939. if (typeof fileText === 'string') {
  60940. if (fileText.length < MAX_TEXT_CACHE) {
  60941. item.exists = true;
  60942. item.isFile = true;
  60943. item.isDirectory = false;
  60944. item.fileText = fileText;
  60945. }
  60946. }
  60947. else {
  60948. item.exists = false;
  60949. }
  60950. return fileText;
  60951. };
  60952. /**
  60953. * Remove an item from the in-memory FS
  60954. *
  60955. * This is done by marking it for deletion. The item will remain in memory
  60956. * until the queued changes are committed. This function handles both files
  60957. * and directories.
  60958. *
  60959. * @param itemPath the path to the item to be deleted
  60960. * @returns an empty promise
  60961. */
  60962. const remove = async (itemPath) => {
  60963. const stats = await stat(itemPath);
  60964. if (stats.isDirectory === true) {
  60965. await removeDir(itemPath);
  60966. }
  60967. else if (stats.isFile === true) {
  60968. await removeItem(itemPath);
  60969. }
  60970. };
  60971. /**
  60972. * Remove an item from the in-memory FS by marking it to be deleted
  60973. *
  60974. * @param dirPath the path to the item to be deleted
  60975. * @returns an empty promise
  60976. */
  60977. const removeDir = async (dirPath) => {
  60978. const item = getItem(dirPath);
  60979. item.isFile = false;
  60980. item.isDirectory = true;
  60981. if (!item.queueWriteToDisk) {
  60982. item.queueDeleteFromDisk = true;
  60983. }
  60984. try {
  60985. const dirItems = await readdir(dirPath, { recursive: true });
  60986. await Promise.all(dirItems.map((item) => {
  60987. if (item.relPath.endsWith('.gitkeep')) {
  60988. return null;
  60989. }
  60990. return removeItem(item.absPath);
  60991. }));
  60992. }
  60993. catch (e) {
  60994. // do not throw error if the directory never existed
  60995. }
  60996. };
  60997. /**
  60998. * Remove an item from the in-memory FS by marking it to be deleted
  60999. *
  61000. * @param filePath the path to the item to be deleted
  61001. * @returns an empty promise
  61002. */
  61003. const removeItem = async (filePath) => {
  61004. const item = getItem(filePath);
  61005. if (!item.queueWriteToDisk) {
  61006. item.queueDeleteFromDisk = true;
  61007. }
  61008. };
  61009. /**
  61010. * Get statistics and information about a filepath in the in-memory FS.
  61011. *
  61012. * This function is fairly similar to the `stat` function in node's
  61013. * `fs` module. If an item exists at the path in question this will return
  61014. * information including whether it's a file or a directory, filesize, etc.
  61015. * If it does not exist the `exists` property will be set accordingly.
  61016. *
  61017. * @param itemPath the path to the item in question
  61018. * @returns a Promise wrapping an object with information about the item
  61019. */
  61020. const stat = async (itemPath) => {
  61021. const item = getItem(itemPath);
  61022. if (typeof item.isDirectory !== 'boolean' || typeof item.isFile !== 'boolean') {
  61023. const stat = await sys.stat(itemPath);
  61024. if (!stat.error) {
  61025. item.exists = true;
  61026. if (stat.isFile) {
  61027. item.isFile = true;
  61028. item.isDirectory = false;
  61029. item.size = stat.size;
  61030. }
  61031. else if (stat.isDirectory) {
  61032. item.isFile = false;
  61033. item.isDirectory = true;
  61034. item.size = stat.size;
  61035. }
  61036. else {
  61037. item.isFile = false;
  61038. item.isDirectory = false;
  61039. item.size = null;
  61040. }
  61041. }
  61042. else {
  61043. item.exists = false;
  61044. }
  61045. }
  61046. return {
  61047. exists: !!item.exists,
  61048. isFile: !!item.isFile,
  61049. isDirectory: !!item.isDirectory,
  61050. size: typeof item.size === 'number' ? item.size : 0,
  61051. };
  61052. };
  61053. /**
  61054. * **Synchronous!!! Do not use!!!**
  61055. * (Only typescript transpiling is allowed to use)
  61056. *
  61057. * Searches an in-memory cache for an item at the provided path. Always
  61058. * returns an object, **does not throw errors**.
  61059. *
  61060. * @param itemPath the path to the file to read
  61061. * @returns an object describing the item found at the provided `itemPath`
  61062. */
  61063. const statSync = (itemPath) => {
  61064. const item = getItem(itemPath);
  61065. if (typeof item.isDirectory !== 'boolean' || typeof item.isFile !== 'boolean') {
  61066. const stat = sys.statSync(itemPath);
  61067. if (!stat.error) {
  61068. item.exists = true;
  61069. if (stat.isFile) {
  61070. item.isFile = true;
  61071. item.isDirectory = false;
  61072. item.size = stat.size;
  61073. }
  61074. else if (stat.isDirectory) {
  61075. item.isFile = false;
  61076. item.isDirectory = true;
  61077. item.size = stat.size;
  61078. }
  61079. else {
  61080. item.isFile = false;
  61081. item.isDirectory = false;
  61082. item.size = null;
  61083. }
  61084. }
  61085. else {
  61086. item.exists = false;
  61087. }
  61088. }
  61089. return {
  61090. exists: !!item.exists,
  61091. isFile: !!item.isFile,
  61092. isDirectory: !!item.isDirectory,
  61093. size: item.size,
  61094. };
  61095. };
  61096. /**
  61097. * Write a file to the in-memory filesystem. The behavior of this function
  61098. * can be modified in several ways by passing different parameters in the
  61099. * options object.
  61100. *
  61101. * Supported options and their effects:
  61102. *
  61103. * - `useCache`: specify that the cache should be used
  61104. * - `inMemoryOnly`: only use the in-memory cache and do not write the file
  61105. * to disk
  61106. * - `immediateWrite`: flush the write to disk immediately, skipping the
  61107. * in-memory cache
  61108. *
  61109. * This function will additionally check before it writes anything to disk
  61110. * to see if the content to be written is different than what already exists
  61111. * on disk.
  61112. *
  61113. * @param filePath the filePath to write to
  61114. * @param content what to write!
  61115. * @param opts an optional object which controls how the file is written
  61116. * @return a Promise wrapping a write result object
  61117. */
  61118. const writeFile = async (filePath, content, opts) => {
  61119. if (typeof filePath !== 'string') {
  61120. throw new Error(`writeFile, invalid filePath: ${filePath}`);
  61121. }
  61122. if (typeof content !== 'string') {
  61123. throw new Error(`writeFile, invalid content: ${filePath}`);
  61124. }
  61125. const results = {
  61126. ignored: false,
  61127. changedContent: false,
  61128. queuedWrite: false,
  61129. };
  61130. if (shouldIgnore(filePath) === true) {
  61131. results.ignored = true;
  61132. return results;
  61133. }
  61134. const item = getItem(filePath);
  61135. item.exists = true;
  61136. item.isFile = true;
  61137. item.isDirectory = false;
  61138. item.queueDeleteFromDisk = false;
  61139. if (typeof item.fileText === 'string') {
  61140. // compare strings but replace Windows CR to rule out any
  61141. // insignificant new line differences
  61142. results.changedContent = item.fileText.replace(/\r/g, '') !== content.replace(/\r/g, '');
  61143. }
  61144. else {
  61145. results.changedContent = true;
  61146. }
  61147. item.fileText = content;
  61148. results.queuedWrite = false;
  61149. if (opts != null) {
  61150. if (typeof opts.outputTargetType === 'string') {
  61151. outputTargetTypes.set(filePath, opts.outputTargetType);
  61152. }
  61153. if (opts.useCache === false) {
  61154. item.useCache = false;
  61155. }
  61156. }
  61157. if (opts != null && opts.inMemoryOnly === true) {
  61158. // we don't want to actually write this to disk
  61159. // just keep it in memory
  61160. if (item.queueWriteToDisk) {
  61161. // we already queued this file to write to disk
  61162. // in that case we still need to do it
  61163. results.queuedWrite = true;
  61164. }
  61165. else {
  61166. // we only want this in memory and
  61167. // it wasn't already queued to be written
  61168. item.queueWriteToDisk = false;
  61169. }
  61170. // ensure in-memory directories are created
  61171. await ensureDir(filePath, true);
  61172. }
  61173. else if (opts != null && opts.immediateWrite === true) {
  61174. // if this is an immediate write then write the file
  61175. // now and do not add it to the queue
  61176. if (results.changedContent || opts.useCache !== true) {
  61177. // writing the file to disk is a big deal and kicks off fs watchers
  61178. // so let's just double check that the file is actually different first
  61179. const existingFile = await sys.readFile(filePath);
  61180. if (typeof existingFile === 'string') {
  61181. results.changedContent = item.fileText.replace(/\r/g, '') !== existingFile.replace(/\r/g, '');
  61182. }
  61183. if (results.changedContent) {
  61184. await ensureDir(filePath, false);
  61185. await sys.writeFile(filePath, item.fileText);
  61186. }
  61187. }
  61188. }
  61189. else {
  61190. // we want to write this to disk (eventually)
  61191. // but only if the content is different
  61192. // from our existing cached content
  61193. if (!item.queueWriteToDisk && results.changedContent === true) {
  61194. // not already queued to be written
  61195. // and the content is different
  61196. item.queueWriteToDisk = true;
  61197. results.queuedWrite = true;
  61198. }
  61199. }
  61200. return results;
  61201. };
  61202. /**
  61203. * Write a series of files to the in-memory filesystem
  61204. *
  61205. * @param files a data structure mapping filepath -> content
  61206. * @param opts an optional set of options passed to `writeFile`
  61207. * @returns a Promise wrapping all write result objects for all the files
  61208. */
  61209. const writeFiles = (files, opts) => {
  61210. const writes = [];
  61211. if (isIterable(files)) {
  61212. files.forEach((content, filePath) => {
  61213. writes.push(writeFile(filePath, content, opts));
  61214. });
  61215. }
  61216. else {
  61217. Object.keys(files).map((filePath) => {
  61218. writes.push(writeFile(filePath, files[filePath], opts));
  61219. });
  61220. }
  61221. return Promise.all(writes);
  61222. };
  61223. /**
  61224. * Commit all pending FS operations to disk
  61225. *
  61226. * FS operations like writes, copies, and deletes which are done to the
  61227. * in-memory FS are deferred and only recorded in the in-memory cache. This
  61228. * method takes all of the deferred FS actions and commits them to the FS,
  61229. * writing and copying files, creating directories, etc.
  61230. *
  61231. * @returns a Promise wrapping a summary of what was done
  61232. */
  61233. const commit = async () => {
  61234. const instructions = getCommitInstructions(items);
  61235. // ensure directories we need exist
  61236. const dirsAdded = await commitEnsureDirs(instructions.dirsToEnsure, false);
  61237. // write all queued the files
  61238. const filesWritten = await commitWriteFiles(instructions.filesToWrite);
  61239. // write all queued the files to copy
  61240. const filesCopied = await commitCopyFiles(instructions.filesToCopy);
  61241. // remove all the queued files to be deleted
  61242. const filesDeleted = await commitDeleteFiles(instructions.filesToDelete);
  61243. // remove all the queued dirs to be deleted
  61244. const dirsDeleted = await commitDeleteDirs(instructions.dirsToDelete);
  61245. instructions.filesToDelete.forEach(clearFileCache);
  61246. instructions.dirsToDelete.forEach(clearDirCache);
  61247. // return only the files that were
  61248. return {
  61249. filesCopied,
  61250. filesWritten,
  61251. filesDeleted,
  61252. dirsDeleted,
  61253. dirsAdded,
  61254. };
  61255. };
  61256. /**
  61257. * Ensure that a directory exists
  61258. *
  61259. * @param path the path to ensure exists
  61260. * @param inMemoryOnly don't commit any changes to the filesystem, instead
  61261. * only change the in-memory cache
  61262. */
  61263. const ensureDir = async (path, inMemoryOnly) => {
  61264. const allDirs = [];
  61265. while (true) {
  61266. path = dirname(path);
  61267. if (typeof path === 'string' &&
  61268. path.length > 0 &&
  61269. path !== '/' &&
  61270. path.endsWith(':/') === false &&
  61271. path.endsWith(':\\') === false) {
  61272. allDirs.push(path);
  61273. }
  61274. else {
  61275. break;
  61276. }
  61277. }
  61278. allDirs.reverse();
  61279. await commitEnsureDirs(allDirs, inMemoryOnly);
  61280. };
  61281. /**
  61282. * Ensure that a series of directories are created.
  61283. *
  61284. * If `inMemoryOnly` is true this will not touch the disk but will only
  61285. * modify the in-memory filesystem cache. Otherwise it will create directories
  61286. * in the real FS.
  61287. *
  61288. * @param dirsToEnsure directories we want to ensure exist
  61289. * @param inMemoryOnly whether directory creation should be confined to the
  61290. * in-memory cache
  61291. * @returns a Promise wrapping a list of directories created
  61292. */
  61293. const commitEnsureDirs = async (dirsToEnsure, inMemoryOnly) => {
  61294. const dirsAdded = [];
  61295. for (const dirPath of dirsToEnsure) {
  61296. const item = getItem(dirPath);
  61297. if (item.exists === true && item.isDirectory === true) {
  61298. // already cached that this path is indeed an existing directory
  61299. continue;
  61300. }
  61301. try {
  61302. // cache that we know this is a directory on disk
  61303. item.exists = true;
  61304. item.isDirectory = true;
  61305. item.isFile = false;
  61306. if (!inMemoryOnly) {
  61307. await sys.createDir(dirPath);
  61308. }
  61309. dirsAdded.push(dirPath);
  61310. }
  61311. catch (e) { }
  61312. }
  61313. return dirsAdded;
  61314. };
  61315. /**
  61316. * Commit copy file operations to disk
  61317. *
  61318. * @param filesToCopy a list of [src, dest] tuples
  61319. * @returns an array of copied file types
  61320. */
  61321. const commitCopyFiles = (filesToCopy) => {
  61322. const copiedFiles = Promise.all(filesToCopy.map(async (data) => {
  61323. const [src, dest] = data;
  61324. await sys.copyFile(src, dest);
  61325. return [src, dest];
  61326. }));
  61327. return copiedFiles;
  61328. };
  61329. /**
  61330. * Commit file write operations to disk
  61331. *
  61332. * @param filesToWrite a list of files to write
  61333. * @returns a Promise wrapping the files written
  61334. *
  61335. */
  61336. const commitWriteFiles = (filesToWrite) => {
  61337. const writtenFiles = Promise.all(filesToWrite.map(async (filePath) => {
  61338. if (typeof filePath !== 'string') {
  61339. throw new Error(`unable to writeFile without filePath`);
  61340. }
  61341. return commitWriteFile(filePath);
  61342. }));
  61343. return writtenFiles;
  61344. };
  61345. /**
  61346. * Commit a file write operation to disk
  61347. *
  61348. * @param filePath the filepath to write
  61349. * @returns a Promise wrapping the written path
  61350. */
  61351. const commitWriteFile = async (filePath) => {
  61352. const item = getItem(filePath);
  61353. if (item.fileText == null) {
  61354. throw new Error(`unable to find item fileText to write: ${filePath}`);
  61355. }
  61356. await sys.writeFile(filePath, item.fileText);
  61357. if (item.useCache === false) {
  61358. clearFileCache(filePath);
  61359. }
  61360. return filePath;
  61361. };
  61362. /**
  61363. * Commit file delete operations to disk
  61364. *
  61365. * @param filesToDelete a set of files to delete
  61366. * @returns a Promise wrapping the set of files deleted
  61367. */
  61368. const commitDeleteFiles = async (filesToDelete) => {
  61369. const deletedFiles = await Promise.all(filesToDelete.map(async (filePath) => {
  61370. if (typeof filePath !== 'string') {
  61371. throw new Error(`unable to unlink without filePath`);
  61372. }
  61373. await sys.removeFile(filePath);
  61374. return filePath;
  61375. }));
  61376. return deletedFiles;
  61377. };
  61378. /**
  61379. * Commit directory delete operations to disk
  61380. *
  61381. * @param dirsToDelete a set of directories to delete
  61382. * @returns a Promise wrapping the set of directories deleted
  61383. */
  61384. const commitDeleteDirs = async (dirsToDelete) => {
  61385. const dirsDeleted = [];
  61386. for (const dirPath of dirsToDelete) {
  61387. await sys.removeDir(dirPath);
  61388. dirsDeleted.push(dirPath);
  61389. }
  61390. return dirsDeleted;
  61391. };
  61392. /**
  61393. * Clear all items within a given dir from the in-memory FS cache
  61394. *
  61395. * @param dirPath the path for the item to remove
  61396. */
  61397. const clearDirCache = (dirPath) => {
  61398. dirPath = normalizePath$1(dirPath);
  61399. items.forEach((_, f) => {
  61400. const filePath = relative$1(dirPath, f).split('/')[0];
  61401. if (!filePath.startsWith('.') && !filePath.startsWith('/')) {
  61402. clearFileCache(f);
  61403. }
  61404. });
  61405. };
  61406. /**
  61407. * Remove an item from the in-memory FS cache, checking first that it is
  61408. * not currently queued for a write operation.
  61409. *
  61410. * @param filePath the path for the item to remove
  61411. */
  61412. const clearFileCache = (filePath) => {
  61413. filePath = normalizePath$1(filePath);
  61414. const item = items.get(filePath);
  61415. if (item != null && !item.queueWriteToDisk) {
  61416. items.delete(filePath);
  61417. }
  61418. };
  61419. /**
  61420. * Cancel pending delete operations on files cached in the in-memory FS.
  61421. * This will not reverse a delete operation if it has already been committed
  61422. * to disk, but will cancel any pending delete operations that have not yet
  61423. * been committed.
  61424. *
  61425. * Note that this will silently **not cancel delete operations on directories**!
  61426. *
  61427. * @param filePaths a list of filepaths which should not be deleted
  61428. */
  61429. const cancelDeleteFilesFromDisk = (filePaths) => {
  61430. for (const filePath of filePaths) {
  61431. const item = getItem(filePath);
  61432. if (item.isFile === true && item.queueDeleteFromDisk === true) {
  61433. item.queueDeleteFromDisk = false;
  61434. }
  61435. }
  61436. };
  61437. /**
  61438. * Cancel a pending delete operations on directories cached in the in-memory
  61439. * FS. This will not reverse a delete operation if it has already been
  61440. * committed to disk, but will cancel any pending delete operations that
  61441. * have not yet been committed.
  61442. *
  61443. * @param dirPaths a list of filepaths whose delete ops should be canceled
  61444. */
  61445. const cancelDeleteDirectoriesFromDisk = (dirPaths) => {
  61446. for (const dirPath of dirPaths) {
  61447. const item = getItem(dirPath);
  61448. if (item.queueDeleteFromDisk === true) {
  61449. item.queueDeleteFromDisk = false;
  61450. }
  61451. }
  61452. };
  61453. /**
  61454. * Getter method for the in-memory FS cache / proxy.
  61455. *
  61456. * This will return an item if found or, if it's not present in the cache,
  61457. * will create an 'empty' filesystem item and set it in the cache.
  61458. *
  61459. * @param itemPath the filepath for the item in question
  61460. * @returns an object with information about the item in question
  61461. */
  61462. const getItem = (itemPath) => {
  61463. itemPath = normalizePath$1(itemPath);
  61464. let item = items.get(itemPath);
  61465. if (item != null) {
  61466. return item;
  61467. }
  61468. items.set(itemPath, (item = {
  61469. exists: null,
  61470. fileText: null,
  61471. size: null,
  61472. mtimeMs: null,
  61473. isDirectory: null,
  61474. isFile: null,
  61475. queueCopyFileToDest: null,
  61476. queueDeleteFromDisk: null,
  61477. queueWriteToDisk: null,
  61478. useCache: null,
  61479. }));
  61480. return item;
  61481. };
  61482. /**
  61483. * Clear all items out of the in-memory cache
  61484. */
  61485. const clearCache = () => {
  61486. items.clear();
  61487. };
  61488. /**
  61489. * Get some very basic usage statistics for the in-memory cache
  61490. *
  61491. * @returns a formatted description of cache usage
  61492. */
  61493. const getMemoryStats = () => `data length: ${items.size}`;
  61494. /**
  61495. * Get information about the files built for output type
  61496. *
  61497. * @returns a list of build output records
  61498. */
  61499. const getBuildOutputs = () => {
  61500. const outputs = [];
  61501. outputTargetTypes.forEach((outputTargetType, filePath) => {
  61502. const output = outputs.find((o) => o.type === outputTargetType);
  61503. if (output) {
  61504. output.files.push(filePath);
  61505. }
  61506. else {
  61507. outputs.push({
  61508. type: outputTargetType,
  61509. files: [filePath],
  61510. });
  61511. }
  61512. });
  61513. outputs.forEach((output) => output.files.sort());
  61514. return outputs.sort((a, b) => {
  61515. if (a.type < b.type)
  61516. return -1;
  61517. if (a.type > b.type)
  61518. return 1;
  61519. return 0;
  61520. });
  61521. };
  61522. // only cache if it's less than 5MB-ish (using .length as a rough guess)
  61523. // why 5MB? idk, seems like a good number for source text
  61524. // it's pretty darn large to cover almost ALL legitimate source files
  61525. // and anything larger is probably a REALLY large file and a rare case
  61526. // which we don't need to eat up memory for
  61527. const MAX_TEXT_CACHE = 5242880;
  61528. return {
  61529. access,
  61530. accessSync,
  61531. cancelDeleteDirectoriesFromDisk,
  61532. cancelDeleteFilesFromDisk,
  61533. clearCache,
  61534. clearDirCache,
  61535. clearFileCache,
  61536. commit,
  61537. copyFile,
  61538. emptyDirs,
  61539. getBuildOutputs,
  61540. getItem,
  61541. getMemoryStats,
  61542. readFile,
  61543. readFileSync,
  61544. readdir,
  61545. remove,
  61546. stat,
  61547. statSync,
  61548. sys,
  61549. writeFile,
  61550. writeFiles,
  61551. };
  61552. };
  61553. /**
  61554. * Given the current state of the in-memory proxy filesystem, collect all of
  61555. * the changes that need to be made in order to commit the currently-pending
  61556. * operations (e.g. write, copy, delete) to the OS filesystem.
  61557. *
  61558. * @param items the storage data structure for the in-memory FS cache
  61559. * @returns a collection of all the operations that need to be done
  61560. */
  61561. const getCommitInstructions = (items) => {
  61562. const instructions = {
  61563. filesToDelete: [],
  61564. filesToWrite: [],
  61565. filesToCopy: [],
  61566. dirsToDelete: [],
  61567. dirsToEnsure: [],
  61568. };
  61569. items.forEach((item, itemPath) => {
  61570. if (item.queueWriteToDisk === true) {
  61571. if (item.isFile === true) {
  61572. instructions.filesToWrite.push(itemPath);
  61573. const dir = normalizePath$1(dirname(itemPath));
  61574. if (!instructions.dirsToEnsure.includes(dir)) {
  61575. instructions.dirsToEnsure.push(dir);
  61576. }
  61577. const dirDeleteIndex = instructions.dirsToDelete.indexOf(dir);
  61578. if (dirDeleteIndex > -1) {
  61579. instructions.dirsToDelete.splice(dirDeleteIndex, 1);
  61580. }
  61581. const fileDeleteIndex = instructions.filesToDelete.indexOf(itemPath);
  61582. if (fileDeleteIndex > -1) {
  61583. instructions.filesToDelete.splice(fileDeleteIndex, 1);
  61584. }
  61585. }
  61586. else if (item.isDirectory === true) {
  61587. if (!instructions.dirsToEnsure.includes(itemPath)) {
  61588. instructions.dirsToEnsure.push(itemPath);
  61589. }
  61590. const dirDeleteIndex = instructions.dirsToDelete.indexOf(itemPath);
  61591. if (dirDeleteIndex > -1) {
  61592. instructions.dirsToDelete.splice(dirDeleteIndex, 1);
  61593. }
  61594. }
  61595. }
  61596. else if (item.queueDeleteFromDisk === true) {
  61597. if (item.isDirectory && !instructions.dirsToEnsure.includes(itemPath)) {
  61598. instructions.dirsToDelete.push(itemPath);
  61599. }
  61600. else if (item.isFile && !instructions.filesToWrite.includes(itemPath)) {
  61601. instructions.filesToDelete.push(itemPath);
  61602. }
  61603. }
  61604. else if (typeof item.queueCopyFileToDest === 'string') {
  61605. const src = itemPath;
  61606. const dest = item.queueCopyFileToDest;
  61607. instructions.filesToCopy.push([src, dest]);
  61608. const dir = normalizePath$1(dirname(dest));
  61609. if (!instructions.dirsToEnsure.includes(dir)) {
  61610. instructions.dirsToEnsure.push(dir);
  61611. }
  61612. const dirDeleteIndex = instructions.dirsToDelete.indexOf(dir);
  61613. if (dirDeleteIndex > -1) {
  61614. instructions.dirsToDelete.splice(dirDeleteIndex, 1);
  61615. }
  61616. const fileDeleteIndex = instructions.filesToDelete.indexOf(dest);
  61617. if (fileDeleteIndex > -1) {
  61618. instructions.filesToDelete.splice(fileDeleteIndex, 1);
  61619. }
  61620. }
  61621. item.queueDeleteFromDisk = false;
  61622. item.queueWriteToDisk = false;
  61623. });
  61624. // add all the ancestor directories for each directory too
  61625. for (let i = 0, ilen = instructions.dirsToEnsure.length; i < ilen; i++) {
  61626. const segments = instructions.dirsToEnsure[i].split('/');
  61627. for (let j = 2; j < segments.length; j++) {
  61628. const dir = segments.slice(0, j).join('/');
  61629. if (instructions.dirsToEnsure.includes(dir) === false) {
  61630. instructions.dirsToEnsure.push(dir);
  61631. }
  61632. }
  61633. }
  61634. // sort directories so shortest paths are ensured first
  61635. instructions.dirsToEnsure.sort((a, b) => {
  61636. const segmentsA = a.split('/').length;
  61637. const segmentsB = b.split('/').length;
  61638. if (segmentsA < segmentsB)
  61639. return -1;
  61640. if (segmentsA > segmentsB)
  61641. return 1;
  61642. if (a.length < b.length)
  61643. return -1;
  61644. if (a.length > b.length)
  61645. return 1;
  61646. return 0;
  61647. });
  61648. // sort directories so longest paths are removed first
  61649. instructions.dirsToDelete.sort((a, b) => {
  61650. const segmentsA = a.split('/').length;
  61651. const segmentsB = b.split('/').length;
  61652. if (segmentsA < segmentsB)
  61653. return 1;
  61654. if (segmentsA > segmentsB)
  61655. return -1;
  61656. if (a.length < b.length)
  61657. return 1;
  61658. if (a.length > b.length)
  61659. return -1;
  61660. return 0;
  61661. });
  61662. for (const dirToEnsure of instructions.dirsToEnsure) {
  61663. const i = instructions.dirsToDelete.indexOf(dirToEnsure);
  61664. if (i > -1) {
  61665. instructions.dirsToDelete.splice(i, 1);
  61666. }
  61667. }
  61668. instructions.dirsToDelete = instructions.dirsToDelete.filter((dir) => {
  61669. if (dir === '/' || dir.endsWith(':/') === true) {
  61670. return false;
  61671. }
  61672. return true;
  61673. });
  61674. instructions.dirsToEnsure = instructions.dirsToEnsure.filter((dir) => {
  61675. const item = items.get(dir);
  61676. if (item != null && item.exists === true && item.isDirectory === true) {
  61677. return false;
  61678. }
  61679. if (dir === '/' || dir.endsWith(':/')) {
  61680. return false;
  61681. }
  61682. return true;
  61683. });
  61684. return instructions;
  61685. };
  61686. /**
  61687. * Check whether a given filepath should be ignored
  61688. *
  61689. * We have a little ignore list, and we just check whether the
  61690. * filepath ends with any of the strings on the ignore list.
  61691. *
  61692. * @param filePath the filepath to check!
  61693. * @returns whether we should ignore it or not
  61694. */
  61695. const shouldIgnore = (filePath) => {
  61696. filePath = filePath.trim().toLowerCase();
  61697. return IGNORE.some((ignoreFile) => filePath.endsWith(ignoreFile));
  61698. };
  61699. /**
  61700. * Ignore list for files which we don't want to write.
  61701. */
  61702. const IGNORE = ['.ds_store', '.gitignore', 'desktop.ini', 'thumbs.db'];
  61703. const createWorkerMainContext = (workerCtrl) => ({
  61704. optimizeCss: workerCtrl.handler('optimizeCss'),
  61705. prepareModule: workerCtrl.handler('prepareModule'),
  61706. prerenderWorker: workerCtrl.handler('prerenderWorker'),
  61707. transformCssToEsm: workerCtrl.handler('transformCssToEsm'),
  61708. });
  61709. const createSysWorker = (config) => {
  61710. if (isFunction(config.sys.createWorkerController) &&
  61711. config.maxConcurrentWorkers > 0 &&
  61712. config.sys.hardwareConcurrency > 1) {
  61713. const workerCtrl = config.sys.createWorkerController(config.maxConcurrentWorkers);
  61714. config.sys.addDestory(() => workerCtrl.destroy());
  61715. config.logger.debug(`create workers, maxWorkers: ${workerCtrl.maxWorkers}`);
  61716. return createWorkerMainContext(workerCtrl);
  61717. }
  61718. config.logger.debug(`no workers, maxConcurrentWorkers: ${config.maxConcurrentWorkers}, hardwareConcurrency: ${config.sys.hardwareConcurrency}`);
  61719. return createWorkerContext(config.sys);
  61720. };
  61721. /**
  61722. * Generate a Stencil compiler instance
  61723. * @param userConfig a user-provided Stencil configuration to apply to the compiler instance
  61724. * @returns a new instance of a Stencil compiler
  61725. * @public
  61726. */
  61727. const createCompiler = async (userConfig) => {
  61728. // actual compiler code
  61729. // could be in a web worker on the browser
  61730. // or the main thread in node
  61731. const config = getConfig(userConfig);
  61732. const diagnostics = [];
  61733. const sys = config.sys;
  61734. const compilerCtx = new CompilerContext();
  61735. if (isFunction(config.sys.setupCompiler)) {
  61736. config.sys.setupCompiler({ ts: t });
  61737. }
  61738. patchFs(sys);
  61739. compilerCtx.fs = createInMemoryFs(sys);
  61740. compilerCtx.cache = new Cache(config, createInMemoryFs(sys));
  61741. await compilerCtx.cache.initCacheDir();
  61742. sys.resolveModuleId = (opts) => resolveModuleIdAsync(sys, compilerCtx.fs, opts);
  61743. compilerCtx.worker = createSysWorker(config);
  61744. if (sys.events) {
  61745. // Pipe events from sys.events to compilerCtx
  61746. sys.events.on(compilerCtx.events.emit);
  61747. }
  61748. patchTypescript(config, compilerCtx.fs);
  61749. const build = () => createFullBuild(config, compilerCtx);
  61750. const createWatcher = () => createWatchBuild(config, compilerCtx);
  61751. const destroy = async () => {
  61752. compilerCtx.reset();
  61753. compilerCtx.events.unsubscribeAll();
  61754. await sys.destroy();
  61755. };
  61756. const compiler = {
  61757. build,
  61758. createWatcher,
  61759. destroy,
  61760. sys,
  61761. };
  61762. config.logger.printDiagnostics(diagnostics);
  61763. return compiler;
  61764. };
  61765. const validateTsConfig = async (config, sys, init) => {
  61766. var _a;
  61767. const tsconfig = {
  61768. path: null,
  61769. compilerOptions: null,
  61770. files: null,
  61771. include: null,
  61772. exclude: null,
  61773. extends: null,
  61774. diagnostics: [],
  61775. };
  61776. try {
  61777. const readTsConfig = await getTsConfigPath(config, sys, init);
  61778. if (!readTsConfig) {
  61779. const diagnostic = buildError(tsconfig.diagnostics);
  61780. diagnostic.header = `Missing tsconfig.json`;
  61781. diagnostic.messageText = `Unable to load TypeScript config file. Please create a "tsconfig.json" file within the "${config.rootDir}" directory.`;
  61782. }
  61783. else {
  61784. tsconfig.path = readTsConfig.path;
  61785. const host = {
  61786. ...t.sys,
  61787. readFile: (p) => {
  61788. if (p === tsconfig.path) {
  61789. return readTsConfig.content;
  61790. }
  61791. return sys.readFileSync(p);
  61792. },
  61793. readDirectory: (p) => sys.readDirSync(p),
  61794. fileExists: (p) => sys.accessSync(p),
  61795. onUnRecoverableConfigFileDiagnostic: (e) => console.error(e),
  61796. };
  61797. const results = t.getParsedCommandLineOfConfigFile(tsconfig.path, {}, host);
  61798. if (results.errors && results.errors.length > 0) {
  61799. results.errors.forEach((configErr) => {
  61800. const tsDiagnostic = loadTypeScriptDiagnostic(configErr);
  61801. if (tsDiagnostic.code === '18003') {
  61802. // "No inputs were found in config file"
  61803. // fine to just "warn" rather than "error" even before starting
  61804. tsDiagnostic.level = 'warn';
  61805. }
  61806. tsDiagnostic.absFilePath = tsconfig.path;
  61807. tsconfig.diagnostics.push(tsDiagnostic);
  61808. });
  61809. }
  61810. else {
  61811. if (results.raw) {
  61812. const srcDir = relative$1(config.rootDir, config.srcDir);
  61813. if (!hasSrcDirectoryInclude(results.raw.include, srcDir)) {
  61814. const warn = buildWarn(tsconfig.diagnostics);
  61815. warn.header = `tsconfig.json "include" required`;
  61816. warn.messageText = `In order for TypeScript to improve watch performance, it's recommended the "tsconfig.json" file should have the "include" property, with at least the app's "${srcDir}" directory listed. For example: "include": ["${srcDir}"]`;
  61817. }
  61818. if (hasStencilConfigInclude(results.raw.include)) {
  61819. const warn = buildWarn(tsconfig.diagnostics);
  61820. warn.header = `tsconfig.json should not reference stencil.config.ts`;
  61821. warn.messageText = `stencil.config.ts is not part of the output build, it should not be included.`;
  61822. }
  61823. if (Array.isArray(results.raw.files)) {
  61824. tsconfig.files = results.raw.files.slice();
  61825. }
  61826. if (Array.isArray(results.raw.include)) {
  61827. tsconfig.include = results.raw.include.slice();
  61828. }
  61829. if (Array.isArray(results.raw.exclude)) {
  61830. tsconfig.exclude = results.raw.exclude.slice();
  61831. }
  61832. if (isString$1(results.raw.extends)) {
  61833. tsconfig.extends = results.raw.extends;
  61834. }
  61835. }
  61836. if (results.options) {
  61837. tsconfig.compilerOptions = results.options;
  61838. const target = (_a = tsconfig.compilerOptions.target) !== null && _a !== void 0 ? _a : t.ScriptTarget.ES5;
  61839. if ([t.ScriptTarget.ES3, t.ScriptTarget.ES5, t.ScriptTarget.ES2015, t.ScriptTarget.ES2016].includes(target)) {
  61840. const warn = buildWarn(tsconfig.diagnostics);
  61841. warn.messageText = `To improve bundling, it is always recommended to set the tsconfig.json “target” setting to "es2017". Note that the compiler will automatically handle transpilation for ES5-only browsers.`;
  61842. }
  61843. if (tsconfig.compilerOptions.module !== t.ModuleKind.ESNext && !config._isTesting) {
  61844. const warn = buildWarn(tsconfig.diagnostics);
  61845. warn.messageText = `To improve bundling, it is always recommended to set the tsconfig.json “module” setting to “esnext”. Note that the compiler will automatically handle bundling both modern and legacy builds.`;
  61846. }
  61847. tsconfig.compilerOptions.sourceMap = config.sourceMap;
  61848. tsconfig.compilerOptions.inlineSources = config.sourceMap;
  61849. }
  61850. }
  61851. }
  61852. }
  61853. catch (e) {
  61854. catchError(tsconfig.diagnostics, e);
  61855. }
  61856. return tsconfig;
  61857. };
  61858. const getTsConfigPath = async (config, sys, init) => {
  61859. const tsconfig = {
  61860. path: null,
  61861. content: null,
  61862. };
  61863. if (isString$1(config.tsconfig)) {
  61864. if (!isAbsolute$1(config.tsconfig)) {
  61865. tsconfig.path = join(config.rootDir, config.tsconfig);
  61866. }
  61867. else {
  61868. tsconfig.path = config.tsconfig;
  61869. }
  61870. }
  61871. else {
  61872. tsconfig.path = join(config.rootDir, 'tsconfig.json');
  61873. }
  61874. tsconfig.content = await sys.readFile(tsconfig.path);
  61875. if (!isString$1(tsconfig.content)) {
  61876. if (!init.initTsConfig) {
  61877. // not set to automatically generate a default tsconfig
  61878. return null;
  61879. }
  61880. // create a default tsconfig
  61881. tsconfig.path = join(config.rootDir, 'tsconfig.json');
  61882. tsconfig.content = createDefaultTsConfig(config);
  61883. await sys.writeFile(tsconfig.path, tsconfig.content);
  61884. }
  61885. tsconfig.path = normalizePath$1(tsconfig.path);
  61886. return tsconfig;
  61887. };
  61888. const createDefaultTsConfig = (config) => JSON.stringify({
  61889. compilerOptions: {
  61890. allowSyntheticDefaultImports: true,
  61891. experimentalDecorators: true,
  61892. lib: ['dom', 'es2015'],
  61893. moduleResolution: 'node',
  61894. module: 'esnext',
  61895. target: 'es2017',
  61896. jsx: 'react',
  61897. jsxFactory: 'h',
  61898. jsxFragmentFactory: 'Fragment',
  61899. sourceMap: config.sourceMap,
  61900. inlineSources: config.sourceMap,
  61901. },
  61902. include: [relative$1(config.rootDir, config.srcDir)],
  61903. }, null, 2);
  61904. const hasSrcDirectoryInclude = (includeProp, src) => Array.isArray(includeProp) && includeProp.includes(src);
  61905. const hasStencilConfigInclude = (includeProp) => Array.isArray(includeProp) && includeProp.includes('stencil.config.ts');
  61906. const getAbsolutePath = (config, dir) => {
  61907. if (!isAbsolute$1(dir)) {
  61908. dir = join(config.rootDir, dir);
  61909. }
  61910. return dir;
  61911. };
  61912. /**
  61913. * This function does two things:
  61914. *
  61915. * 1. If you pass a `flagName`, it will hoist that `flagName` out of the
  61916. * `ConfigFlags` object and onto the 'root' level (if you will) of the
  61917. * `config` under the `configName` (`keyof d.Config`) that you pass.
  61918. * 2. If you _don't_ pass a `flagName` it will just set the value you supply
  61919. * on the config.
  61920. *
  61921. * @param config the config that we want to update
  61922. * @param configName the key we're setting on the config
  61923. * @param flagName either the name of a ConfigFlag prop we want to hoist up or null
  61924. * @param defaultValue the default value we should set!
  61925. */
  61926. const setBooleanConfig = (config, configName, flagName, defaultValue) => {
  61927. var _a;
  61928. if (flagName) {
  61929. const flagValue = (_a = config.flags) === null || _a === void 0 ? void 0 : _a[flagName];
  61930. if (isBoolean$1(flagValue)) {
  61931. config[configName] = flagValue;
  61932. }
  61933. }
  61934. const userConfigName = getUserConfigName(config, configName);
  61935. if (typeof config[userConfigName] === 'function') {
  61936. config[userConfigName] = !!config[userConfigName]();
  61937. }
  61938. if (isBoolean$1(config[userConfigName])) {
  61939. config[configName] = config[userConfigName];
  61940. }
  61941. else {
  61942. config[configName] = defaultValue;
  61943. }
  61944. };
  61945. /**
  61946. * Find any possibly mis-capitalized configuration names on the config, logging
  61947. * and warning if one is found.
  61948. *
  61949. * @param config the user-supplied config that we're dealing with
  61950. * @param correctConfigName the configuration name that we're checking for right now
  61951. * @returns a string container a mis-capitalized config name found on the
  61952. * config object, if any.
  61953. */
  61954. const getUserConfigName = (config, correctConfigName) => {
  61955. var _a;
  61956. const userConfigNames = Object.keys(config);
  61957. for (const userConfigName of userConfigNames) {
  61958. if (userConfigName.toLowerCase() === correctConfigName.toLowerCase()) {
  61959. if (userConfigName !== correctConfigName) {
  61960. (_a = config.logger) === null || _a === void 0 ? void 0 : _a.warn(`config "${userConfigName}" should be "${correctConfigName}"`);
  61961. return userConfigName;
  61962. }
  61963. break;
  61964. }
  61965. }
  61966. return correctConfigName;
  61967. };
  61968. const validateAngular = (config, userOutputs) => {
  61969. const angularOutputTargets = userOutputs.filter(isOutputTargetAngular);
  61970. return angularOutputTargets.map((outputTarget) => {
  61971. let directivesProxyFile = outputTarget.directivesProxyFile;
  61972. if (directivesProxyFile && !isAbsolute$1(directivesProxyFile)) {
  61973. directivesProxyFile = join(config.rootDir, directivesProxyFile);
  61974. }
  61975. let directivesArrayFile = outputTarget.directivesArrayFile;
  61976. if (directivesArrayFile && !isAbsolute$1(directivesArrayFile)) {
  61977. directivesArrayFile = join(config.rootDir, directivesArrayFile);
  61978. }
  61979. let directivesUtilsFile = outputTarget.directivesUtilsFile;
  61980. if (directivesUtilsFile && !isAbsolute$1(directivesUtilsFile)) {
  61981. directivesUtilsFile = join(config.rootDir, directivesUtilsFile);
  61982. }
  61983. return {
  61984. type: 'angular',
  61985. componentCorePackage: outputTarget.componentCorePackage,
  61986. directivesProxyFile,
  61987. directivesArrayFile,
  61988. directivesUtilsFile,
  61989. excludeComponents: outputTarget.excludeComponents || [],
  61990. };
  61991. });
  61992. };
  61993. /**
  61994. * Validate and return DIST_COLLECTION output targets, ensuring that the `dir`
  61995. * property is set on them.
  61996. *
  61997. * @param config a validated configuration object
  61998. * @param userOutputs an array of output targets
  61999. * @returns an array of validated DIST_COLLECTION output targets
  62000. */
  62001. const validateCollection = (config, userOutputs) => {
  62002. return userOutputs.filter(isOutputTargetDistCollection).map((outputTarget) => {
  62003. var _a, _b;
  62004. return {
  62005. ...outputTarget,
  62006. transformAliasedImportPaths: (_a = outputTarget.transformAliasedImportPaths) !== null && _a !== void 0 ? _a : false,
  62007. dir: getAbsolutePath(config, (_b = outputTarget.dir) !== null && _b !== void 0 ? _b : 'dist/collection'),
  62008. };
  62009. });
  62010. };
  62011. const validateCopy = (copy, defaultCopy = []) => {
  62012. if (copy === null || copy === false) {
  62013. return [];
  62014. }
  62015. if (!Array.isArray(copy)) {
  62016. copy = [];
  62017. }
  62018. copy = copy.slice();
  62019. for (const task of defaultCopy) {
  62020. if (copy.every((t) => t.src !== task.src)) {
  62021. copy.push(task);
  62022. }
  62023. }
  62024. return unique(copy, (task) => `${task.src}:${task.dest}:${task.keepDirStructure}`);
  62025. };
  62026. /**
  62027. * Validate one or more `dist-custom-elements` output targets. Validation of an output target may involve back-filling
  62028. * fields that are omitted with sensible defaults and/or creating additional supporting output targets that were not
  62029. * explicitly defined by the user
  62030. * @param config the Stencil configuration associated with the project being compiled
  62031. * @param userOutputs the output target(s) specified by the user
  62032. * @returns the validated output target(s)
  62033. */
  62034. const validateCustomElement = (config, userOutputs) => {
  62035. const defaultDir = 'dist';
  62036. return userOutputs.filter(isOutputTargetDistCustomElements).reduce((outputs, o) => {
  62037. const outputTarget = {
  62038. ...o,
  62039. dir: getAbsolutePath(config, o.dir || join(defaultDir, 'components')),
  62040. };
  62041. if (!isBoolean$1(outputTarget.empty)) {
  62042. outputTarget.empty = true;
  62043. }
  62044. if (!isBoolean$1(outputTarget.externalRuntime)) {
  62045. outputTarget.externalRuntime = true;
  62046. }
  62047. // unlike other output targets, Stencil does not allow users to define the output location of types at this time
  62048. if (outputTarget.generateTypeDeclarations) {
  62049. const typesDirectory = getAbsolutePath(config, join(defaultDir, 'types'));
  62050. outputs.push({
  62051. type: DIST_TYPES,
  62052. dir: outputTarget.dir,
  62053. typesDir: typesDirectory,
  62054. });
  62055. }
  62056. outputTarget.copy = validateCopy(outputTarget.copy, []);
  62057. if (outputTarget.copy.length > 0) {
  62058. outputs.push({
  62059. type: COPY,
  62060. dir: config.rootDir,
  62061. copy: [...outputTarget.copy],
  62062. });
  62063. }
  62064. outputs.push(outputTarget);
  62065. return outputs;
  62066. }, []);
  62067. };
  62068. const validateCustomElementBundle = (config, userOutputs) => {
  62069. return userOutputs.filter(isOutputTargetDistCustomElementsBundle).reduce((arr, o) => {
  62070. const outputTarget = {
  62071. ...o,
  62072. dir: getAbsolutePath(config, o.dir || 'dist/custom-elements'),
  62073. };
  62074. if (!isBoolean$1(outputTarget.empty)) {
  62075. outputTarget.empty = true;
  62076. }
  62077. if (!isBoolean$1(outputTarget.externalRuntime)) {
  62078. outputTarget.externalRuntime = true;
  62079. }
  62080. outputTarget.copy = validateCopy(outputTarget.copy, []);
  62081. if (outputTarget.copy.length > 0) {
  62082. arr.push({
  62083. type: COPY,
  62084. dir: config.rootDir,
  62085. copy: [...outputTarget.copy],
  62086. });
  62087. }
  62088. arr.push(outputTarget);
  62089. return arr;
  62090. }, []);
  62091. };
  62092. const validateCustomOutput = (config, diagnostics, userOutputs) => {
  62093. return userOutputs.filter(isOutputTargetCustom).map((o) => {
  62094. if (o.validate) {
  62095. const localDiagnostics = [];
  62096. try {
  62097. o.validate(config, diagnostics);
  62098. }
  62099. catch (e) {
  62100. catchError(localDiagnostics, e);
  62101. }
  62102. if (o.copy && o.copy.length > 0) {
  62103. config.outputTargets.push({
  62104. type: COPY,
  62105. dir: config.rootDir,
  62106. copy: [...o.copy],
  62107. });
  62108. }
  62109. diagnostics.push(...localDiagnostics);
  62110. }
  62111. return o;
  62112. });
  62113. };
  62114. /**
  62115. * Validate that the "dist" output targets are valid and ready to go.
  62116. *
  62117. * This function will also add in additional output targets to its output, based on the input supplied.
  62118. *
  62119. * @param config the compiler config, what else?
  62120. * @param userOutputs a user-supplied list of output targets.
  62121. * @returns a list of OutputTargets which have been validated for us.
  62122. */
  62123. const validateDist = (config, userOutputs) => {
  62124. const distOutputTargets = userOutputs.filter(isOutputTargetDist);
  62125. return distOutputTargets.reduce((outputs, o) => {
  62126. var _a;
  62127. const distOutputTarget = validateOutputTargetDist(config, o);
  62128. outputs.push(distOutputTarget);
  62129. const namespace = config.fsNamespace || 'app';
  62130. const lazyDir = join(distOutputTarget.buildDir, namespace);
  62131. // Lazy build for CDN in dist
  62132. outputs.push({
  62133. type: DIST_LAZY,
  62134. esmDir: lazyDir,
  62135. systemDir: config.buildEs5 ? lazyDir : undefined,
  62136. systemLoaderFile: config.buildEs5 ? join(lazyDir, namespace + '.js') : undefined,
  62137. legacyLoaderFile: join(distOutputTarget.buildDir, namespace + '.js'),
  62138. polyfills: distOutputTarget.polyfills !== undefined ? !!distOutputTarget.polyfills : true,
  62139. isBrowserBuild: true,
  62140. empty: distOutputTarget.empty,
  62141. });
  62142. outputs.push({
  62143. type: COPY,
  62144. dir: lazyDir,
  62145. copyAssets: 'dist',
  62146. copy: ((_a = distOutputTarget.copy) !== null && _a !== void 0 ? _a : []).concat(),
  62147. });
  62148. outputs.push({
  62149. type: DIST_GLOBAL_STYLES,
  62150. file: join(lazyDir, `${config.fsNamespace}.css`),
  62151. });
  62152. outputs.push({
  62153. type: DIST_TYPES,
  62154. dir: distOutputTarget.dir,
  62155. typesDir: distOutputTarget.typesDir,
  62156. });
  62157. if (config.buildDist) {
  62158. if (distOutputTarget.collectionDir) {
  62159. outputs.push({
  62160. type: DIST_COLLECTION,
  62161. dir: distOutputTarget.dir,
  62162. collectionDir: distOutputTarget.collectionDir,
  62163. empty: distOutputTarget.empty,
  62164. transformAliasedImportPaths: distOutputTarget.transformAliasedImportPathsInCollection,
  62165. });
  62166. outputs.push({
  62167. type: COPY,
  62168. dir: distOutputTarget.collectionDir,
  62169. copyAssets: 'collection',
  62170. copy: [...distOutputTarget.copy, { src: '**/*.svg' }, { src: '**/*.js' }],
  62171. });
  62172. }
  62173. const esmDir = join(distOutputTarget.dir, 'esm');
  62174. const esmEs5Dir = config.buildEs5 ? join(distOutputTarget.dir, 'esm-es5') : undefined;
  62175. const cjsDir = join(distOutputTarget.dir, 'cjs');
  62176. // Create lazy output-target
  62177. outputs.push({
  62178. type: DIST_LAZY,
  62179. esmDir,
  62180. esmEs5Dir,
  62181. cjsDir,
  62182. cjsIndexFile: join(distOutputTarget.dir, 'index.cjs.js'),
  62183. esmIndexFile: join(distOutputTarget.dir, 'index.js'),
  62184. polyfills: true,
  62185. empty: distOutputTarget.empty,
  62186. });
  62187. // Create output target that will generate the /loader entry-point
  62188. outputs.push({
  62189. type: DIST_LAZY_LOADER,
  62190. dir: distOutputTarget.esmLoaderPath,
  62191. esmDir,
  62192. esmEs5Dir,
  62193. cjsDir,
  62194. componentDts: getComponentsDtsTypesFilePath(distOutputTarget),
  62195. empty: distOutputTarget.empty,
  62196. });
  62197. }
  62198. return outputs;
  62199. }, []);
  62200. };
  62201. /**
  62202. * Validate that an OutputTargetDist object has what it needs to do it's job.
  62203. * To enforce this, we have this function return
  62204. * `Required<d.OutputTargetDist>`, giving us a compile-time check that all
  62205. * properties are defined (with either user-supplied or default values).
  62206. *
  62207. * @param config the current config
  62208. * @param o the OutputTargetDist object we want to validate
  62209. * @returns `Required<d.OutputTargetDist>`, i.e. `d.OutputTargetDist` with all
  62210. * optional properties rendered un-optional.
  62211. */
  62212. const validateOutputTargetDist = (config, o) => {
  62213. var _a, _b;
  62214. // we need to create an object with a bunch of default values here so that
  62215. // the typescript compiler can infer their types correctly
  62216. const outputTarget = {
  62217. ...o,
  62218. dir: getAbsolutePath(config, o.dir || DEFAULT_DIR),
  62219. buildDir: isString$1(o.buildDir) ? o.buildDir : DEFAULT_BUILD_DIR,
  62220. collectionDir: o.collectionDir !== undefined ? o.collectionDir : DEFAULT_COLLECTION_DIR,
  62221. typesDir: o.typesDir || DEFAULT_TYPES_DIR,
  62222. esmLoaderPath: o.esmLoaderPath || DEFAULT_ESM_LOADER_DIR,
  62223. copy: validateCopy((_a = o.copy) !== null && _a !== void 0 ? _a : [], []),
  62224. polyfills: isBoolean$1(o.polyfills) ? o.polyfills : undefined,
  62225. empty: isBoolean$1(o.empty) ? o.empty : true,
  62226. transformAliasedImportPathsInCollection: (_b = o.transformAliasedImportPathsInCollection) !== null && _b !== void 0 ? _b : false,
  62227. };
  62228. if (!isAbsolute$1(outputTarget.buildDir)) {
  62229. outputTarget.buildDir = join(outputTarget.dir, outputTarget.buildDir);
  62230. }
  62231. if (outputTarget.collectionDir && !isAbsolute$1(outputTarget.collectionDir)) {
  62232. outputTarget.collectionDir = join(outputTarget.dir, outputTarget.collectionDir);
  62233. }
  62234. if (!isAbsolute$1(outputTarget.esmLoaderPath)) {
  62235. outputTarget.esmLoaderPath = resolve$1(outputTarget.dir, outputTarget.esmLoaderPath);
  62236. }
  62237. if (!isAbsolute$1(outputTarget.typesDir)) {
  62238. outputTarget.typesDir = join(outputTarget.dir, outputTarget.typesDir);
  62239. }
  62240. return outputTarget;
  62241. };
  62242. const DEFAULT_DIR = 'dist';
  62243. const DEFAULT_BUILD_DIR = '';
  62244. const DEFAULT_COLLECTION_DIR = 'collection';
  62245. const DEFAULT_TYPES_DIR = 'types';
  62246. const DEFAULT_ESM_LOADER_DIR = 'loader';
  62247. const validateDocs = (config, diagnostics, userOutputs) => {
  62248. const docsOutputs = [];
  62249. // json docs flag
  62250. if (isString$1(config.flags.docsJson)) {
  62251. docsOutputs.push(validateJsonDocsOutputTarget(config, diagnostics, {
  62252. type: 'docs-json',
  62253. file: config.flags.docsJson,
  62254. }));
  62255. }
  62256. // json docs
  62257. const jsonDocsOutputs = userOutputs.filter(isOutputTargetDocsJson);
  62258. jsonDocsOutputs.forEach((jsonDocsOutput) => {
  62259. docsOutputs.push(validateJsonDocsOutputTarget(config, diagnostics, jsonDocsOutput));
  62260. });
  62261. // readme docs flag
  62262. if (config.flags.docs || config.flags.task === 'docs') {
  62263. if (!userOutputs.some(isOutputTargetDocsReadme)) {
  62264. // didn't provide a docs config, so let's add one
  62265. docsOutputs.push(validateReadmeOutputTarget(config, { type: 'docs-readme' }));
  62266. }
  62267. }
  62268. // readme docs
  62269. const readmeDocsOutputs = userOutputs.filter(isOutputTargetDocsReadme);
  62270. readmeDocsOutputs.forEach((readmeDocsOutput) => {
  62271. docsOutputs.push(validateReadmeOutputTarget(config, readmeDocsOutput));
  62272. });
  62273. // custom docs
  62274. const customDocsOutputs = userOutputs.filter(isOutputTargetDocsCustom);
  62275. customDocsOutputs.forEach((jsonDocsOutput) => {
  62276. docsOutputs.push(validateCustomDocsOutputTarget(diagnostics, jsonDocsOutput));
  62277. });
  62278. // vscode docs
  62279. const vscodeDocsOutputs = userOutputs.filter(isOutputTargetDocsVscode);
  62280. vscodeDocsOutputs.forEach((vscodeDocsOutput) => {
  62281. docsOutputs.push(validateVScodeDocsOutputTarget(diagnostics, vscodeDocsOutput));
  62282. });
  62283. return docsOutputs;
  62284. };
  62285. const validateReadmeOutputTarget = (config, outputTarget) => {
  62286. if (!isString$1(outputTarget.dir)) {
  62287. outputTarget.dir = config.srcDir;
  62288. }
  62289. if (!isAbsolute$1(outputTarget.dir)) {
  62290. outputTarget.dir = join(config.rootDir, outputTarget.dir);
  62291. }
  62292. if (outputTarget.footer == null) {
  62293. outputTarget.footer = NOTE;
  62294. }
  62295. outputTarget.strict = !!outputTarget.strict;
  62296. return outputTarget;
  62297. };
  62298. const validateJsonDocsOutputTarget = (config, diagnostics, outputTarget) => {
  62299. if (!isString$1(outputTarget.file)) {
  62300. const err = buildError(diagnostics);
  62301. err.messageText = `docs-json outputTarget missing the "file" option`;
  62302. }
  62303. outputTarget.file = join(config.rootDir, outputTarget.file);
  62304. if (isString$1(outputTarget.typesFile)) {
  62305. outputTarget.typesFile = join(config.rootDir, outputTarget.typesFile);
  62306. }
  62307. else if (outputTarget.typesFile !== null && outputTarget.file.endsWith('.json')) {
  62308. outputTarget.typesFile = outputTarget.file.replace(/\.json$/, '.d.ts');
  62309. }
  62310. outputTarget.strict = !!outputTarget.strict;
  62311. return outputTarget;
  62312. };
  62313. const validateCustomDocsOutputTarget = (diagnostics, outputTarget) => {
  62314. if (!isFunction(outputTarget.generator)) {
  62315. const err = buildError(diagnostics);
  62316. err.messageText = `docs-custom outputTarget missing the "generator" function`;
  62317. }
  62318. outputTarget.strict = !!outputTarget.strict;
  62319. return outputTarget;
  62320. };
  62321. const validateVScodeDocsOutputTarget = (diagnostics, outputTarget) => {
  62322. if (!isString$1(outputTarget.file)) {
  62323. const err = buildError(diagnostics);
  62324. err.messageText = `docs-vscode outputTarget missing the "file" path`;
  62325. }
  62326. return outputTarget;
  62327. };
  62328. const validateHydrateScript = (config, userOutputs) => {
  62329. const output = [];
  62330. const hasHydrateOutputTarget = userOutputs.some(isOutputTargetHydrate);
  62331. if (!hasHydrateOutputTarget) {
  62332. // we don't already have a hydrate output target
  62333. // let's still see if we require one because of other output targets
  62334. const hasWwwOutput = userOutputs.filter(isOutputTargetWww).some((o) => isString$1(o.indexHtml));
  62335. const shouldBuildHydrate = config.flags.prerender || config.flags.ssr;
  62336. if (hasWwwOutput && shouldBuildHydrate) {
  62337. // we're prerendering a www output target, so we'll need a hydrate app
  62338. let hydrateDir;
  62339. const distOutput = userOutputs.find(isOutputTargetDist);
  62340. if (distOutput != null && isString$1(distOutput.dir)) {
  62341. hydrateDir = join(distOutput.dir, 'hydrate');
  62342. }
  62343. else {
  62344. hydrateDir = 'dist/hydrate';
  62345. }
  62346. const hydrateForWwwOutputTarget = {
  62347. type: DIST_HYDRATE_SCRIPT,
  62348. dir: hydrateDir,
  62349. };
  62350. userOutputs.push(hydrateForWwwOutputTarget);
  62351. }
  62352. }
  62353. const hydrateOutputTargets = userOutputs.filter(isOutputTargetHydrate);
  62354. hydrateOutputTargets.forEach((outputTarget) => {
  62355. if (!isString$1(outputTarget.dir)) {
  62356. // no directory given, see if we've got a dist to go off of
  62357. outputTarget.dir = 'hydrate';
  62358. }
  62359. if (!isAbsolute$1(outputTarget.dir)) {
  62360. outputTarget.dir = join(config.rootDir, outputTarget.dir);
  62361. }
  62362. if (!isBoolean$1(outputTarget.empty)) {
  62363. outputTarget.empty = true;
  62364. }
  62365. outputTarget.external = outputTarget.external || [];
  62366. outputTarget.external.push(...NODE_BUILTINS);
  62367. output.push(outputTarget);
  62368. });
  62369. return output;
  62370. };
  62371. const validateLazy = (config, userOutputs) => {
  62372. return userOutputs.filter(isOutputTargetDistLazy).map((o) => {
  62373. const dir = getAbsolutePath(config, o.dir || join('dist', config.fsNamespace));
  62374. const lazyOutput = {
  62375. type: DIST_LAZY,
  62376. esmDir: dir,
  62377. systemDir: config.buildEs5 ? dir : undefined,
  62378. systemLoaderFile: config.buildEs5 ? join(dir, `${config.fsNamespace}.js`) : undefined,
  62379. polyfills: !!o.polyfills,
  62380. isBrowserBuild: true,
  62381. empty: isBoolean$1(o.empty) ? o.empty : true,
  62382. };
  62383. return lazyOutput;
  62384. });
  62385. };
  62386. const validateStats = (userConfig, userOutputs) => {
  62387. const outputTargets = [];
  62388. if (userConfig.flags.stats) {
  62389. const hasOutputTarget = userOutputs.some(isOutputTargetStats);
  62390. if (!hasOutputTarget) {
  62391. outputTargets.push({
  62392. type: STATS,
  62393. });
  62394. }
  62395. }
  62396. outputTargets.push(...userOutputs.filter(isOutputTargetStats));
  62397. outputTargets.forEach((outputTarget) => {
  62398. if (!outputTarget.file) {
  62399. outputTarget.file = 'stencil-stats.json';
  62400. }
  62401. if (!isAbsolute$1(outputTarget.file)) {
  62402. outputTarget.file = join(userConfig.rootDir, outputTarget.file);
  62403. }
  62404. });
  62405. return outputTargets;
  62406. };
  62407. const validatePrerender = (config, diagnostics, outputTarget) => {
  62408. if (!config.flags.ssr && !config.flags.prerender && config.flags.task !== 'prerender') {
  62409. return;
  62410. }
  62411. outputTarget.baseUrl = normalizePath$1(outputTarget.baseUrl);
  62412. if (!outputTarget.baseUrl.startsWith('http://') && !outputTarget.baseUrl.startsWith('https://')) {
  62413. const err = buildError(diagnostics);
  62414. err.messageText = `When prerendering, the "baseUrl" output target config must be a full URL and start with either "http://" or "https://". The config can be updated in the "www" output target within the stencil config.`;
  62415. }
  62416. try {
  62417. new URL(outputTarget.baseUrl);
  62418. }
  62419. catch (e) {
  62420. const err = buildError(diagnostics);
  62421. err.messageText = `invalid "baseUrl": ${e}`;
  62422. }
  62423. if (!outputTarget.baseUrl.endsWith('/')) {
  62424. outputTarget.baseUrl += '/';
  62425. }
  62426. if (isString$1(outputTarget.prerenderConfig)) {
  62427. if (!isAbsolute$1(outputTarget.prerenderConfig)) {
  62428. outputTarget.prerenderConfig = join(config.rootDir, outputTarget.prerenderConfig);
  62429. }
  62430. }
  62431. };
  62432. const validateServiceWorker = (config, outputTarget) => {
  62433. if (outputTarget.serviceWorker === false) {
  62434. return;
  62435. }
  62436. if (config.devMode && !config.flags.serviceWorker) {
  62437. outputTarget.serviceWorker = null;
  62438. return;
  62439. }
  62440. if (outputTarget.serviceWorker === null) {
  62441. outputTarget.serviceWorker = null;
  62442. return;
  62443. }
  62444. if (outputTarget.serviceWorker === true) {
  62445. outputTarget.serviceWorker = {};
  62446. }
  62447. else if (!outputTarget.serviceWorker && config.devMode) {
  62448. outputTarget.serviceWorker = null;
  62449. return;
  62450. }
  62451. if (typeof outputTarget.serviceWorker !== 'object') {
  62452. // what was passed in could have been a boolean
  62453. // in that case let's just turn it into an empty obj so Object.assign doesn't crash
  62454. outputTarget.serviceWorker = {};
  62455. }
  62456. if (!Array.isArray(outputTarget.serviceWorker.globPatterns)) {
  62457. if (typeof outputTarget.serviceWorker.globPatterns === 'string') {
  62458. outputTarget.serviceWorker.globPatterns = [outputTarget.serviceWorker.globPatterns];
  62459. }
  62460. else if (typeof outputTarget.serviceWorker.globPatterns !== 'string') {
  62461. outputTarget.serviceWorker.globPatterns = DEFAULT_GLOB_PATTERNS.slice();
  62462. }
  62463. }
  62464. if (typeof outputTarget.serviceWorker.globDirectory !== 'string') {
  62465. outputTarget.serviceWorker.globDirectory = outputTarget.appDir;
  62466. }
  62467. if (typeof outputTarget.serviceWorker.globIgnores === 'string') {
  62468. outputTarget.serviceWorker.globIgnores = [outputTarget.serviceWorker.globIgnores];
  62469. }
  62470. outputTarget.serviceWorker.globIgnores = outputTarget.serviceWorker.globIgnores || [];
  62471. addGlobIgnores(config, outputTarget.serviceWorker.globIgnores);
  62472. outputTarget.serviceWorker.dontCacheBustURLsMatching = /p-\w{8}/;
  62473. if (isString$1(outputTarget.serviceWorker.swSrc) && !isAbsolute$1(outputTarget.serviceWorker.swSrc)) {
  62474. outputTarget.serviceWorker.swSrc = join(config.rootDir, outputTarget.serviceWorker.swSrc);
  62475. }
  62476. if (!isString$1(outputTarget.serviceWorker.swDest)) {
  62477. outputTarget.serviceWorker.swDest = join(outputTarget.appDir, DEFAULT_FILENAME);
  62478. }
  62479. if (!isAbsolute$1(outputTarget.serviceWorker.swDest)) {
  62480. outputTarget.serviceWorker.swDest = join(outputTarget.appDir, outputTarget.serviceWorker.swDest);
  62481. }
  62482. };
  62483. const addGlobIgnores = (config, globIgnores) => {
  62484. globIgnores.push(`**/host.config.json`, // the filename of the host configuration
  62485. `**/*.system.entry.js`, `**/*.system.js`, `**/${config.fsNamespace}.js`, `**/${config.fsNamespace}.esm.js`, `**/${config.fsNamespace}.css`);
  62486. };
  62487. const DEFAULT_GLOB_PATTERNS = ['*.html', '**/*.{js,css,json}'];
  62488. const DEFAULT_FILENAME = 'sw.js';
  62489. const validateWww = (config, diagnostics, userOutputs) => {
  62490. const hasOutputTargets = userOutputs.length > 0;
  62491. const hasE2eTests = !!config.flags.e2e;
  62492. const userWwwOutputs = userOutputs.filter(isOutputTargetWww);
  62493. if (!hasOutputTargets ||
  62494. (hasE2eTests && !userOutputs.some(isOutputTargetWww) && !userOutputs.some(isOutputTargetDist))) {
  62495. userWwwOutputs.push({ type: WWW });
  62496. }
  62497. if (config.flags.prerender && userWwwOutputs.length === 0) {
  62498. const err = buildError(diagnostics);
  62499. err.messageText = `You need at least one "www" output target configured in your stencil.config.ts, when the "--prerender" flag is used`;
  62500. }
  62501. return userWwwOutputs.reduce((outputs, o) => {
  62502. const outputTarget = validateWwwOutputTarget(config, o, diagnostics);
  62503. outputs.push(outputTarget);
  62504. // Add dist-lazy output target
  62505. const buildDir = outputTarget.buildDir;
  62506. outputs.push({
  62507. type: DIST_LAZY,
  62508. dir: buildDir,
  62509. esmDir: buildDir,
  62510. systemDir: config.buildEs5 ? buildDir : undefined,
  62511. systemLoaderFile: config.buildEs5 ? join(buildDir, `${config.fsNamespace}.js`) : undefined,
  62512. polyfills: outputTarget.polyfills,
  62513. isBrowserBuild: true,
  62514. });
  62515. // Copy for dist
  62516. outputs.push({
  62517. type: COPY,
  62518. dir: buildDir,
  62519. copyAssets: 'dist',
  62520. });
  62521. // Copy for www
  62522. outputs.push({
  62523. type: COPY,
  62524. dir: outputTarget.appDir,
  62525. copy: validateCopy(outputTarget.copy, [
  62526. { src: 'assets', warn: false },
  62527. { src: 'manifest.json', warn: false },
  62528. ]),
  62529. });
  62530. // Generate global style with original name
  62531. outputs.push({
  62532. type: DIST_GLOBAL_STYLES,
  62533. file: join(buildDir, `${config.fsNamespace}.css`),
  62534. });
  62535. return outputs;
  62536. }, []);
  62537. };
  62538. const validateWwwOutputTarget = (config, outputTarget, diagnostics) => {
  62539. if (!isString$1(outputTarget.baseUrl)) {
  62540. outputTarget.baseUrl = '/';
  62541. }
  62542. if (!outputTarget.baseUrl.endsWith('/')) {
  62543. // Make sure the baseUrl always finish with "/"
  62544. outputTarget.baseUrl += '/';
  62545. }
  62546. outputTarget.dir = getAbsolutePath(config, outputTarget.dir || 'www');
  62547. // Fix "dir" to account
  62548. const pathname = new URL(outputTarget.baseUrl, 'http://localhost/').pathname;
  62549. outputTarget.appDir = join(outputTarget.dir, pathname);
  62550. if (outputTarget.appDir.endsWith('/') || outputTarget.appDir.endsWith('\\')) {
  62551. outputTarget.appDir = outputTarget.appDir.substring(0, outputTarget.appDir.length - 1);
  62552. }
  62553. if (!isString$1(outputTarget.buildDir)) {
  62554. outputTarget.buildDir = 'build';
  62555. }
  62556. if (!isAbsolute$1(outputTarget.buildDir)) {
  62557. outputTarget.buildDir = join(outputTarget.appDir, outputTarget.buildDir);
  62558. }
  62559. if (!isString$1(outputTarget.indexHtml)) {
  62560. outputTarget.indexHtml = 'index.html';
  62561. }
  62562. if (!isAbsolute$1(outputTarget.indexHtml)) {
  62563. outputTarget.indexHtml = join(outputTarget.appDir, outputTarget.indexHtml);
  62564. }
  62565. if (!isBoolean$1(outputTarget.empty)) {
  62566. outputTarget.empty = true;
  62567. }
  62568. validatePrerender(config, diagnostics, outputTarget);
  62569. validateServiceWorker(config, outputTarget);
  62570. if (outputTarget.polyfills === undefined) {
  62571. outputTarget.polyfills = true;
  62572. }
  62573. outputTarget.polyfills = !!outputTarget.polyfills;
  62574. return outputTarget;
  62575. };
  62576. const validateOutputTargets = (config, diagnostics) => {
  62577. const userOutputs = (config.outputTargets || []).slice();
  62578. userOutputs.forEach((outputTarget) => {
  62579. if (!isValidConfigOutputTarget(outputTarget.type)) {
  62580. const err = buildError(diagnostics);
  62581. err.messageText = `Invalid outputTarget type "${outputTarget.type}". Valid outputTarget types include: ${VALID_CONFIG_OUTPUT_TARGETS.map((t) => `"${t}"`).join(', ')}`;
  62582. }
  62583. else if (outputTarget.type === DIST_CUSTOM_ELEMENTS_BUNDLE) {
  62584. // TODO(STENCIL-260): Remove this check when the 'dist-custom-elements-bundle' is removed
  62585. const warning = buildWarn(diagnostics);
  62586. warning.messageText = `dist-custom-elements-bundle is deprecated and will be removed in a future major version release. Use "dist-custom-elements" instead. If "dist-custom-elements" does not meet your needs, please add a comment to https://github.com/ionic-team/stencil/issues/3136.`;
  62587. }
  62588. });
  62589. config.outputTargets = [
  62590. ...validateCollection(config, userOutputs),
  62591. ...validateCustomElement(config, userOutputs),
  62592. ...validateCustomElementBundle(config, userOutputs),
  62593. ...validateCustomOutput(config, diagnostics, userOutputs),
  62594. ...validateLazy(config, userOutputs),
  62595. ...validateWww(config, diagnostics, userOutputs),
  62596. ...validateDist(config, userOutputs),
  62597. ...validateDocs(config, diagnostics, userOutputs),
  62598. ...validateAngular(config, userOutputs),
  62599. ...validateStats(config, userOutputs),
  62600. ];
  62601. // hydrate also gets info from the www output
  62602. config.outputTargets = [
  62603. ...config.outputTargets,
  62604. ...validateHydrateScript(config, [...userOutputs, ...config.outputTargets]),
  62605. ];
  62606. };
  62607. const validateDevServer = (config, diagnostics) => {
  62608. var _a, _b, _c, _d, _e;
  62609. if ((config.devServer === null || config.devServer) === false) {
  62610. return undefined;
  62611. }
  62612. const { flags } = config;
  62613. const devServer = { ...config.devServer };
  62614. if (flags.address && isString$1(flags.address)) {
  62615. devServer.address = flags.address;
  62616. }
  62617. else if (!isString$1(devServer.address)) {
  62618. devServer.address = '0.0.0.0';
  62619. }
  62620. // default to http for localdev
  62621. let addressProtocol = 'http';
  62622. if (devServer.address.toLowerCase().startsWith('http://')) {
  62623. devServer.address = devServer.address.substring(7);
  62624. addressProtocol = 'http';
  62625. }
  62626. else if (devServer.address.toLowerCase().startsWith('https://')) {
  62627. devServer.address = devServer.address.substring(8);
  62628. addressProtocol = 'https';
  62629. }
  62630. devServer.address = devServer.address.split('/')[0];
  62631. // split on `:` to get the domain and the (possibly present) port
  62632. // separately. we've already sliced off the protocol (if present) above
  62633. // so we can safely split on `:` here.
  62634. const addressSplit = devServer.address.split(':');
  62635. const isLocalhost = addressSplit[0] === 'localhost' || !isNaN(addressSplit[0].split('.')[0]);
  62636. // if localhost we use 3333 as a default port
  62637. let addressPort = isLocalhost ? 3333 : undefined;
  62638. if (addressSplit.length > 1) {
  62639. if (!isNaN(addressSplit[1])) {
  62640. devServer.address = addressSplit[0];
  62641. addressPort = parseInt(addressSplit[1], 10);
  62642. }
  62643. }
  62644. if (isNumber$1(flags.port)) {
  62645. devServer.port = flags.port;
  62646. }
  62647. else if (devServer.port !== null && !isNumber$1(devServer.port)) {
  62648. if (isNumber$1(addressPort)) {
  62649. devServer.port = addressPort;
  62650. }
  62651. }
  62652. if (devServer.reloadStrategy === undefined) {
  62653. devServer.reloadStrategy = 'hmr';
  62654. }
  62655. else if (devServer.reloadStrategy !== 'hmr' &&
  62656. devServer.reloadStrategy !== 'pageReload' &&
  62657. devServer.reloadStrategy !== null) {
  62658. const err = buildError(diagnostics);
  62659. err.messageText = `Invalid devServer reloadStrategy "${devServer.reloadStrategy}". Valid configs include "hmr", "pageReload" and null.`;
  62660. }
  62661. if (!isBoolean$1(devServer.gzip)) {
  62662. devServer.gzip = true;
  62663. }
  62664. if (!isBoolean$1(devServer.openBrowser)) {
  62665. devServer.openBrowser = true;
  62666. }
  62667. if (!isBoolean$1(devServer.websocket)) {
  62668. devServer.websocket = true;
  62669. }
  62670. if (flags.ssr) {
  62671. devServer.ssr = true;
  62672. }
  62673. else {
  62674. devServer.ssr = !!devServer.ssr;
  62675. }
  62676. if (devServer.ssr) {
  62677. const wwwOutput = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).find(isOutputTargetWww);
  62678. devServer.prerenderConfig = wwwOutput === null || wwwOutput === void 0 ? void 0 : wwwOutput.prerenderConfig;
  62679. }
  62680. if (isString$1(config.srcIndexHtml)) {
  62681. devServer.srcIndexHtml = normalizePath$1(config.srcIndexHtml);
  62682. }
  62683. if (devServer.protocol !== 'http' && devServer.protocol !== 'https') {
  62684. devServer.protocol = devServer.https ? 'https' : addressProtocol ? addressProtocol : 'http';
  62685. }
  62686. if (devServer.historyApiFallback !== null && devServer.historyApiFallback !== false) {
  62687. devServer.historyApiFallback = devServer.historyApiFallback || {};
  62688. if (!isString$1(devServer.historyApiFallback.index)) {
  62689. devServer.historyApiFallback.index = 'index.html';
  62690. }
  62691. if (!isBoolean$1(devServer.historyApiFallback.disableDotRule)) {
  62692. devServer.historyApiFallback.disableDotRule = false;
  62693. }
  62694. }
  62695. if (flags.open === false) {
  62696. devServer.openBrowser = false;
  62697. }
  62698. else if (flags.prerender && !config.watch) {
  62699. devServer.openBrowser = false;
  62700. }
  62701. let serveDir;
  62702. let basePath;
  62703. const wwwOutputTarget = ((_b = config.outputTargets) !== null && _b !== void 0 ? _b : []).find(isOutputTargetWww);
  62704. if (wwwOutputTarget) {
  62705. const baseUrl = new URL((_c = wwwOutputTarget.baseUrl) !== null && _c !== void 0 ? _c : '', 'http://config.stenciljs.com');
  62706. basePath = baseUrl.pathname;
  62707. serveDir = (_d = wwwOutputTarget.appDir) !== null && _d !== void 0 ? _d : '';
  62708. }
  62709. else {
  62710. basePath = '';
  62711. serveDir = (_e = config.rootDir) !== null && _e !== void 0 ? _e : '';
  62712. }
  62713. if (!isString$1(basePath) || basePath.trim() === '') {
  62714. basePath = `/`;
  62715. }
  62716. basePath = normalizePath$1(basePath);
  62717. if (!basePath.startsWith('/')) {
  62718. basePath = '/' + basePath;
  62719. }
  62720. if (!basePath.endsWith('/')) {
  62721. basePath += '/';
  62722. }
  62723. if (!isBoolean$1(devServer.logRequests)) {
  62724. devServer.logRequests = config.logLevel === 'debug';
  62725. }
  62726. if (!isString$1(devServer.root)) {
  62727. devServer.root = serveDir;
  62728. }
  62729. if (!isString$1(devServer.basePath)) {
  62730. devServer.basePath = basePath;
  62731. }
  62732. if (isString$1(devServer.baseUrl)) {
  62733. const err = buildError(diagnostics);
  62734. err.messageText = `devServer config "baseUrl" has been renamed to "basePath", and should not include a domain or protocol.`;
  62735. }
  62736. if (!isAbsolute$1(devServer.root)) {
  62737. devServer.root = join(config.rootDir, devServer.root);
  62738. }
  62739. devServer.root = normalizePath$1(devServer.root);
  62740. if (devServer.excludeHmr) {
  62741. if (!Array.isArray(devServer.excludeHmr)) {
  62742. const err = buildError(diagnostics);
  62743. err.messageText = `dev server excludeHmr must be an array of glob strings`;
  62744. }
  62745. }
  62746. else {
  62747. devServer.excludeHmr = [];
  62748. }
  62749. if (!config.devMode || config.buildEs5) {
  62750. devServer.experimentalDevModules = false;
  62751. }
  62752. else {
  62753. devServer.experimentalDevModules = !!devServer.experimentalDevModules;
  62754. }
  62755. return devServer;
  62756. };
  62757. /**
  62758. * Check the provided `.hydratedFlag` prop and return a properly-validated value.
  62759. *
  62760. * @param config the configuration we're examining
  62761. * @returns a suitable value for the hydratedFlag property
  62762. */
  62763. const validateHydrated = (config) => {
  62764. /**
  62765. * If `config.hydratedFlag` is set to `null` that is an explicit signal that we
  62766. * should _not_ create a default configuration when validating and should instead
  62767. * just return `undefined`.
  62768. *
  62769. * See {@link HydratedFlag} for more details.
  62770. */
  62771. if (config.hydratedFlag === null || config.hydratedFlag === false) {
  62772. return undefined;
  62773. }
  62774. // Here we start building up a default config since `.hydratedFlag` wasn't set to
  62775. // `null` on the provided config.
  62776. const hydratedFlag = { ...config.hydratedFlag };
  62777. if (!isString$1(hydratedFlag.name) || hydratedFlag.property === '') {
  62778. hydratedFlag.name = `hydrated`;
  62779. }
  62780. if (hydratedFlag.selector === 'attribute') {
  62781. hydratedFlag.selector = `attribute`;
  62782. }
  62783. else {
  62784. hydratedFlag.selector = `class`;
  62785. }
  62786. if (!isString$1(hydratedFlag.property) || hydratedFlag.property === '') {
  62787. hydratedFlag.property = `visibility`;
  62788. }
  62789. if (!isString$1(hydratedFlag.initialValue) && hydratedFlag.initialValue !== null) {
  62790. hydratedFlag.initialValue = `hidden`;
  62791. }
  62792. if (!isString$1(hydratedFlag.hydratedValue) && hydratedFlag.initialValue !== null) {
  62793. hydratedFlag.hydratedValue = `inherit`;
  62794. }
  62795. return hydratedFlag;
  62796. };
  62797. const validateNamespace = (c, diagnostics) => {
  62798. c.namespace = isString$1(c.namespace) ? c.namespace : DEFAULT_NAMESPACE;
  62799. c.namespace = c.namespace.trim();
  62800. const invalidNamespaceChars = c.namespace.replace(/(\w)|(\-)|(\$)/g, '');
  62801. if (invalidNamespaceChars !== '') {
  62802. const err = buildError(diagnostics);
  62803. err.messageText = `Namespace "${c.namespace}" contains invalid characters: ${invalidNamespaceChars}`;
  62804. }
  62805. if (c.namespace.length < 3) {
  62806. const err = buildError(diagnostics);
  62807. err.messageText = `Namespace "${c.namespace}" must be at least 3 characters`;
  62808. }
  62809. if (/^\d+$/.test(c.namespace.charAt(0))) {
  62810. const err = buildError(diagnostics);
  62811. err.messageText = `Namespace "${c.namespace}" cannot have a number for the first character`;
  62812. }
  62813. if (c.namespace.charAt(0) === '-') {
  62814. const err = buildError(diagnostics);
  62815. err.messageText = `Namespace "${c.namespace}" cannot have a dash for the first character`;
  62816. }
  62817. if (c.namespace.charAt(c.namespace.length - 1) === '-') {
  62818. const err = buildError(diagnostics);
  62819. err.messageText = `Namespace "${c.namespace}" cannot have a dash for the last character`;
  62820. }
  62821. // the file system namespace is the one
  62822. // used in filenames and seen in the url
  62823. if (!isString$1(c.fsNamespace)) {
  62824. c.fsNamespace = c.namespace.toLowerCase().trim();
  62825. }
  62826. if (c.namespace.includes('-')) {
  62827. // convert to PascalCase
  62828. c.namespace = dashToPascalCase$1(c.namespace);
  62829. }
  62830. };
  62831. const validateDistNamespace = (config, diagnostics) => {
  62832. var _a;
  62833. const hasDist = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).some(isOutputTargetDist);
  62834. if (hasDist) {
  62835. if (!isString$1(config.namespace) || config.namespace.toLowerCase() === 'app') {
  62836. const err = buildError(diagnostics);
  62837. err.messageText = `When generating a distribution it is recommended to choose a unique namespace rather than the default setting "App". Please updated the "namespace" config property within the stencil config.`;
  62838. }
  62839. }
  62840. };
  62841. const DEFAULT_NAMESPACE = 'App';
  62842. /**
  62843. * Do logical-level validation (as opposed to type-level validation)
  62844. * for various properties in the user-supplied config which represent
  62845. * filesystem paths.
  62846. *
  62847. * @param config a validated user-supplied configuration
  62848. */
  62849. const validatePaths = (config) => {
  62850. if (typeof config.rootDir !== 'string') {
  62851. config.rootDir = '/';
  62852. }
  62853. if (typeof config.srcDir !== 'string') {
  62854. config.srcDir = DEFAULT_SRC_DIR;
  62855. }
  62856. if (!isAbsolute$1(config.srcDir)) {
  62857. config.srcDir = join(config.rootDir, config.srcDir);
  62858. }
  62859. if (typeof config.cacheDir !== 'string') {
  62860. config.cacheDir = DEFAULT_CACHE_DIR;
  62861. }
  62862. if (!isAbsolute$1(config.cacheDir)) {
  62863. config.cacheDir = join(config.rootDir, config.cacheDir);
  62864. }
  62865. if (typeof config.srcIndexHtml !== 'string') {
  62866. config.srcIndexHtml = join(config.srcDir, DEFAULT_INDEX_HTML);
  62867. }
  62868. if (!isAbsolute$1(config.srcIndexHtml)) {
  62869. config.srcIndexHtml = join(config.rootDir, config.srcIndexHtml);
  62870. }
  62871. if (typeof config.globalScript === 'string' && !isAbsolute$1(config.globalScript)) {
  62872. if (!isAbsolute$1(config.globalScript)) {
  62873. config.globalScript = join(config.rootDir, config.globalScript);
  62874. }
  62875. }
  62876. if (typeof config.globalStyle === 'string') {
  62877. if (!isAbsolute$1(config.globalStyle)) {
  62878. config.globalStyle = join(config.rootDir, config.globalStyle);
  62879. }
  62880. }
  62881. if (config.writeLog) {
  62882. if (typeof config.buildLogFilePath !== 'string') {
  62883. config.buildLogFilePath = DEFAULT_BUILD_LOG_FILE_NAME;
  62884. }
  62885. if (!isAbsolute$1(config.buildLogFilePath)) {
  62886. config.buildLogFilePath = join(config.rootDir, config.buildLogFilePath);
  62887. }
  62888. }
  62889. config.packageJsonFilePath = join(config.rootDir, 'package.json');
  62890. };
  62891. const DEFAULT_BUILD_LOG_FILE_NAME = 'stencil-build.log';
  62892. const DEFAULT_CACHE_DIR = '.stencil';
  62893. const DEFAULT_INDEX_HTML = 'index.html';
  62894. const DEFAULT_SRC_DIR = 'src';
  62895. const validatePlugins = (config, diagnostics) => {
  62896. const userPlugins = config.plugins;
  62897. if (!config.rollupPlugins) {
  62898. config.rollupPlugins = {};
  62899. }
  62900. if (!Array.isArray(userPlugins)) {
  62901. config.plugins = [];
  62902. return;
  62903. }
  62904. const rollupPlugins = userPlugins.filter((plugin) => {
  62905. return !!(plugin && typeof plugin === 'object' && !plugin.pluginType);
  62906. });
  62907. const hasResolveNode = rollupPlugins.some((p) => p.name === 'node-resolve');
  62908. const hasCommonjs = rollupPlugins.some((p) => p.name === 'commonjs');
  62909. if (hasCommonjs) {
  62910. const warn = buildWarn(diagnostics);
  62911. warn.messageText = `Stencil already uses "@rollup/plugin-commonjs", please remove it from your "stencil.config.ts" plugins.
  62912. You can configure the commonjs settings using the "commonjs" property in "stencil.config.ts`;
  62913. }
  62914. if (hasResolveNode) {
  62915. const warn = buildWarn(diagnostics);
  62916. warn.messageText = `Stencil already uses "@rollup/plugin-commonjs", please remove it from your "stencil.config.ts" plugins.
  62917. You can configure the commonjs settings using the "commonjs" property in "stencil.config.ts`;
  62918. }
  62919. config.rollupPlugins.before = [
  62920. ...(config.rollupPlugins.before || []),
  62921. ...rollupPlugins.filter(({ name }) => name !== 'node-resolve' && name !== 'commonjs'),
  62922. ];
  62923. config.plugins = userPlugins.filter((plugin) => {
  62924. return !!(plugin && typeof plugin === 'object' && plugin.pluginType);
  62925. });
  62926. };
  62927. const validateRollupConfig = (config) => {
  62928. const cleanRollupConfig = getCleanRollupConfig(config.rollupConfig);
  62929. config.rollupConfig = cleanRollupConfig;
  62930. };
  62931. const getCleanRollupConfig = (rollupConfig) => {
  62932. let cleanRollupConfig = DEFAULT_ROLLUP_CONFIG;
  62933. if (!rollupConfig || !isObject$5(rollupConfig)) {
  62934. return cleanRollupConfig;
  62935. }
  62936. if (rollupConfig.inputOptions && isObject$5(rollupConfig.inputOptions)) {
  62937. cleanRollupConfig = {
  62938. ...cleanRollupConfig,
  62939. inputOptions: pluck(rollupConfig.inputOptions, ['context', 'moduleContext', 'treeshake']),
  62940. };
  62941. }
  62942. if (rollupConfig.outputOptions && isObject$5(rollupConfig.outputOptions)) {
  62943. cleanRollupConfig = {
  62944. ...cleanRollupConfig,
  62945. outputOptions: pluck(rollupConfig.outputOptions, ['globals']),
  62946. };
  62947. }
  62948. return cleanRollupConfig;
  62949. };
  62950. const DEFAULT_ROLLUP_CONFIG = {
  62951. inputOptions: {},
  62952. outputOptions: {},
  62953. };
  62954. const validateTesting = (config, diagnostics) => {
  62955. var _a;
  62956. const testing = (config.testing = Object.assign({}, config.testing || {}));
  62957. if (!config.flags.e2e && !config.flags.spec) {
  62958. return;
  62959. }
  62960. let configPathDir = config.configPath;
  62961. if (isString$1(configPathDir)) {
  62962. if (basename(configPathDir).includes('.')) {
  62963. configPathDir = dirname(configPathDir);
  62964. }
  62965. }
  62966. else {
  62967. configPathDir = config.rootDir;
  62968. }
  62969. if (typeof config.flags.headless === 'boolean') {
  62970. testing.browserHeadless = config.flags.headless;
  62971. }
  62972. else if (typeof testing.browserHeadless !== 'boolean') {
  62973. testing.browserHeadless = true;
  62974. }
  62975. if (!testing.browserWaitUntil) {
  62976. testing.browserWaitUntil = 'load';
  62977. }
  62978. testing.browserArgs = testing.browserArgs || [];
  62979. addTestingConfigOption(testing.browserArgs, '--font-render-hinting=medium');
  62980. addTestingConfigOption(testing.browserArgs, '--incognito');
  62981. if (config.flags.ci) {
  62982. addTestingConfigOption(testing.browserArgs, '--no-sandbox');
  62983. addTestingConfigOption(testing.browserArgs, '--disable-setuid-sandbox');
  62984. addTestingConfigOption(testing.browserArgs, '--disable-dev-shm-usage');
  62985. testing.browserHeadless = true;
  62986. }
  62987. if (typeof testing.rootDir === 'string') {
  62988. if (!isAbsolute$1(testing.rootDir)) {
  62989. testing.rootDir = join(config.rootDir, testing.rootDir);
  62990. }
  62991. }
  62992. else {
  62993. testing.rootDir = config.rootDir;
  62994. }
  62995. if (typeof config.flags.screenshotConnector === 'string') {
  62996. testing.screenshotConnector = config.flags.screenshotConnector;
  62997. }
  62998. if (typeof testing.screenshotConnector === 'string') {
  62999. if (!isAbsolute$1(testing.screenshotConnector)) {
  63000. testing.screenshotConnector = join(config.rootDir, testing.screenshotConnector);
  63001. }
  63002. }
  63003. else {
  63004. testing.screenshotConnector = join(config.sys.getCompilerExecutingPath(), '..', '..', 'screenshot', 'local-connector.js');
  63005. }
  63006. if (!Array.isArray(testing.testPathIgnorePatterns)) {
  63007. testing.testPathIgnorePatterns = DEFAULT_IGNORE_PATTERNS.map((ignorePattern) => {
  63008. return join(testing.rootDir, ignorePattern);
  63009. });
  63010. ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : [])
  63011. .filter((o) => (isOutputTargetDist(o) || isOutputTargetWww(o)) && o.dir)
  63012. .forEach((outputTarget) => {
  63013. var _a;
  63014. (_a = testing.testPathIgnorePatterns) === null || _a === void 0 ? void 0 : _a.push(outputTarget.dir);
  63015. });
  63016. }
  63017. if (typeof testing.preset !== 'string') {
  63018. testing.preset = join(config.sys.getCompilerExecutingPath(), '..', '..', 'testing');
  63019. }
  63020. else if (!isAbsolute$1(testing.preset)) {
  63021. testing.preset = join(configPathDir, testing.preset);
  63022. }
  63023. if (!Array.isArray(testing.setupFilesAfterEnv)) {
  63024. testing.setupFilesAfterEnv = [];
  63025. }
  63026. testing.setupFilesAfterEnv.unshift(join(config.sys.getCompilerExecutingPath(), '..', '..', 'testing', 'jest-setuptestframework.js'));
  63027. if (isString$1(testing.testEnvironment)) {
  63028. if (!isAbsolute$1(testing.testEnvironment) && isLocalModule(testing.testEnvironment)) {
  63029. testing.testEnvironment = join(configPathDir, testing.testEnvironment);
  63030. }
  63031. }
  63032. if (typeof testing.allowableMismatchedPixels === 'number') {
  63033. if (testing.allowableMismatchedPixels < 0) {
  63034. const err = buildError(diagnostics);
  63035. err.messageText = `allowableMismatchedPixels must be a value that is 0 or greater`;
  63036. }
  63037. }
  63038. else {
  63039. testing.allowableMismatchedPixels = DEFAULT_ALLOWABLE_MISMATCHED_PIXELS;
  63040. }
  63041. if (typeof testing.allowableMismatchedRatio === 'number') {
  63042. if (testing.allowableMismatchedRatio < 0 || testing.allowableMismatchedRatio > 1) {
  63043. const err = buildError(diagnostics);
  63044. err.messageText = `allowableMismatchedRatio must be a value ranging from 0 to 1`;
  63045. }
  63046. }
  63047. if (typeof testing.pixelmatchThreshold === 'number') {
  63048. if (testing.pixelmatchThreshold < 0 || testing.pixelmatchThreshold > 1) {
  63049. const err = buildError(diagnostics);
  63050. err.messageText = `pixelmatchThreshold must be a value ranging from 0 to 1`;
  63051. }
  63052. }
  63053. else {
  63054. testing.pixelmatchThreshold = DEFAULT_PIXEL_MATCH_THRESHOLD;
  63055. }
  63056. if (testing.testRegex === undefined) {
  63057. /**
  63058. * The test regex covers cases of:
  63059. * - files under a `__tests__` directory
  63060. * - the case where a test file has a name such as `test.ts`, `spec.ts` or `e2e.ts`.
  63061. * - these files can use any of the following file extensions: .ts, .tsx, .js, .jsx.
  63062. * - this regex only handles the entire path of a file, e.g. `/some/path/e2e.ts`
  63063. * - the case where a test file ends with `.test.ts`, `.spec.ts`, or `.e2e.ts`.
  63064. * - these files can use any of the following file extensions: .ts, .tsx, .js, .jsx.
  63065. * - this regex case shall match file names such as `my-cmp.spec.ts`, `test.spec.ts`
  63066. * - this regex case shall not match file names such as `attest.ts`, `bespec.ts`
  63067. */
  63068. testing.testRegex = '(/__tests__/.*|(\\.|/)(test|spec|e2e))\\.[jt]sx?$';
  63069. }
  63070. if (Array.isArray(testing.testMatch)) {
  63071. delete testing.testRegex;
  63072. }
  63073. else if (typeof testing.testRegex === 'string') {
  63074. delete testing.testMatch;
  63075. }
  63076. if (typeof testing.runner !== 'string') {
  63077. testing.runner = join(config.sys.getCompilerExecutingPath(), '..', '..', 'testing', 'jest-runner.js');
  63078. }
  63079. if (typeof testing.waitBeforeScreenshot === 'number') {
  63080. if (testing.waitBeforeScreenshot < 0) {
  63081. const err = buildError(diagnostics);
  63082. err.messageText = `waitBeforeScreenshot must be a value that is 0 or greater`;
  63083. }
  63084. }
  63085. else {
  63086. testing.waitBeforeScreenshot = 10;
  63087. }
  63088. if (!Array.isArray(testing.emulate) || testing.emulate.length === 0) {
  63089. testing.emulate = [
  63090. {
  63091. userAgent: 'default',
  63092. viewport: {
  63093. width: 600,
  63094. height: 600,
  63095. deviceScaleFactor: 1,
  63096. isMobile: false,
  63097. hasTouch: false,
  63098. isLandscape: false,
  63099. },
  63100. },
  63101. ];
  63102. }
  63103. };
  63104. const addTestingConfigOption = (setArray, option) => {
  63105. if (!setArray.includes(option)) {
  63106. setArray.push(option);
  63107. }
  63108. };
  63109. const DEFAULT_ALLOWABLE_MISMATCHED_PIXELS = 100;
  63110. const DEFAULT_PIXEL_MATCH_THRESHOLD = 0.1;
  63111. const DEFAULT_IGNORE_PATTERNS = ['.vscode', '.stencil', 'node_modules'];
  63112. const validateWorkers = (config) => {
  63113. if (typeof config.maxConcurrentWorkers !== 'number') {
  63114. config.maxConcurrentWorkers = 8;
  63115. }
  63116. if (typeof config.flags.maxWorkers === 'number') {
  63117. config.maxConcurrentWorkers = config.flags.maxWorkers;
  63118. }
  63119. else if (config.flags.ci) {
  63120. config.maxConcurrentWorkers = 4;
  63121. }
  63122. config.maxConcurrentWorkers = Math.max(Math.min(config.maxConcurrentWorkers, 16), 0);
  63123. if (config.devServer) {
  63124. config.devServer.worker = config.maxConcurrentWorkers > 0;
  63125. }
  63126. };
  63127. /**
  63128. * Validate a Config object, ensuring that all its field are present and
  63129. * consistent with our expectations. This function transforms an
  63130. * `UnvalidatedConfig` to a `Config`.
  63131. *
  63132. * @param userConfig an unvalidated config that we've gotten from a user
  63133. * @param bootstrapConfig the initial configuration provided by the user (or generated by Stencil) used to bootstrap
  63134. * configuration loading and validation
  63135. * @returns an object with config and diagnostics props
  63136. */
  63137. const validateConfig = (userConfig = {}, bootstrapConfig) => {
  63138. var _a, _b, _c, _d;
  63139. const config = Object.assign({}, userConfig); // not positive it's json safe
  63140. const diagnostics = [];
  63141. const logger = bootstrapConfig.logger || config.logger || createLogger();
  63142. const validatedConfig = {
  63143. ...config,
  63144. // flags _should_ be JSON safe
  63145. flags: JSON.parse(JSON.stringify(config.flags || {})),
  63146. logger,
  63147. outputTargets: (_a = config.outputTargets) !== null && _a !== void 0 ? _a : [],
  63148. rootDir: typeof config.rootDir === 'string' ? config.rootDir : '/',
  63149. sys: (_c = (_b = config.sys) !== null && _b !== void 0 ? _b : bootstrapConfig.sys) !== null && _c !== void 0 ? _c : createSystem({ logger }),
  63150. testing: (_d = config.testing) !== null && _d !== void 0 ? _d : {},
  63151. };
  63152. // default devMode false
  63153. if (validatedConfig.flags.prod) {
  63154. validatedConfig.devMode = false;
  63155. }
  63156. else if (validatedConfig.flags.dev) {
  63157. validatedConfig.devMode = true;
  63158. }
  63159. else if (!isBoolean$1(validatedConfig.devMode)) {
  63160. validatedConfig.devMode = DEFAULT_DEV_MODE;
  63161. }
  63162. validatedConfig.extras = validatedConfig.extras || {};
  63163. validatedConfig.extras.appendChildSlotFix = !!validatedConfig.extras.appendChildSlotFix;
  63164. validatedConfig.extras.cloneNodeFix = !!validatedConfig.extras.cloneNodeFix;
  63165. validatedConfig.extras.cssVarsShim = !!validatedConfig.extras.cssVarsShim;
  63166. validatedConfig.extras.dynamicImportShim = !!validatedConfig.extras.dynamicImportShim;
  63167. validatedConfig.extras.lifecycleDOMEvents = !!validatedConfig.extras.lifecycleDOMEvents;
  63168. validatedConfig.extras.safari10 = !!validatedConfig.extras.safari10;
  63169. validatedConfig.extras.scriptDataOpts = !!validatedConfig.extras.scriptDataOpts;
  63170. validatedConfig.extras.shadowDomShim = !!validatedConfig.extras.shadowDomShim;
  63171. validatedConfig.extras.slotChildNodesFix = !!validatedConfig.extras.slotChildNodesFix;
  63172. validatedConfig.extras.initializeNextTick = !!validatedConfig.extras.initializeNextTick;
  63173. validatedConfig.extras.tagNameTransform = !!validatedConfig.extras.tagNameTransform;
  63174. validatedConfig.buildEs5 =
  63175. validatedConfig.buildEs5 === true || (!validatedConfig.devMode && validatedConfig.buildEs5 === 'prod');
  63176. setBooleanConfig(validatedConfig, 'minifyCss', null, !validatedConfig.devMode);
  63177. setBooleanConfig(validatedConfig, 'minifyJs', null, !validatedConfig.devMode);
  63178. setBooleanConfig(validatedConfig, 'sourceMap', null, typeof validatedConfig.sourceMap === 'undefined' ? false : validatedConfig.sourceMap);
  63179. setBooleanConfig(validatedConfig, 'watch', 'watch', false);
  63180. setBooleanConfig(validatedConfig, 'buildDocs', 'docs', !validatedConfig.devMode);
  63181. setBooleanConfig(validatedConfig, 'buildDist', 'esm', !validatedConfig.devMode || validatedConfig.buildEs5);
  63182. setBooleanConfig(validatedConfig, 'profile', 'profile', validatedConfig.devMode);
  63183. setBooleanConfig(validatedConfig, 'writeLog', 'log', false);
  63184. setBooleanConfig(validatedConfig, 'buildAppCore', null, true);
  63185. setBooleanConfig(validatedConfig, 'autoprefixCss', null, validatedConfig.buildEs5);
  63186. setBooleanConfig(validatedConfig, 'validateTypes', null, !validatedConfig._isTesting);
  63187. setBooleanConfig(validatedConfig, 'allowInlineScripts', null, true);
  63188. if (!isString$1(validatedConfig.taskQueue)) {
  63189. validatedConfig.taskQueue = 'async';
  63190. }
  63191. // hash file names
  63192. if (!isBoolean$1(validatedConfig.hashFileNames)) {
  63193. validatedConfig.hashFileNames = !validatedConfig.devMode;
  63194. }
  63195. if (!isNumber$1(validatedConfig.hashedFileNameLength)) {
  63196. validatedConfig.hashedFileNameLength = DEFAULT_HASHED_FILENAME_LENTH;
  63197. }
  63198. if (validatedConfig.hashedFileNameLength < MIN_HASHED_FILENAME_LENTH) {
  63199. const err = buildError(diagnostics);
  63200. err.messageText = `validatedConfig.hashedFileNameLength must be at least ${MIN_HASHED_FILENAME_LENTH} characters`;
  63201. }
  63202. if (validatedConfig.hashedFileNameLength > MAX_HASHED_FILENAME_LENTH) {
  63203. const err = buildError(diagnostics);
  63204. err.messageText = `validatedConfig.hashedFileNameLength cannot be more than ${MAX_HASHED_FILENAME_LENTH} characters`;
  63205. }
  63206. if (!validatedConfig.env) {
  63207. validatedConfig.env = {};
  63208. }
  63209. // get a good namespace
  63210. validateNamespace(validatedConfig, diagnostics);
  63211. // figure out all of the config paths and absolute paths
  63212. validatePaths(validatedConfig);
  63213. // outputTargets
  63214. validateOutputTargets(validatedConfig, diagnostics);
  63215. // plugins
  63216. validatePlugins(validatedConfig, diagnostics);
  63217. // rollup config
  63218. validateRollupConfig(validatedConfig);
  63219. // dev server
  63220. validatedConfig.devServer = validateDevServer(validatedConfig, diagnostics);
  63221. // testing
  63222. validateTesting(validatedConfig, diagnostics);
  63223. // hydrate flag
  63224. validatedConfig.hydratedFlag = validateHydrated(validatedConfig);
  63225. // bundles
  63226. if (Array.isArray(validatedConfig.bundles)) {
  63227. validatedConfig.bundles = sortBy(validatedConfig.bundles, (a) => a.components.length);
  63228. }
  63229. else {
  63230. validatedConfig.bundles = [];
  63231. }
  63232. // validate how many workers we can use
  63233. validateWorkers(validatedConfig);
  63234. // default devInspector to whatever devMode is
  63235. setBooleanConfig(validatedConfig, 'devInspector', null, validatedConfig.devMode);
  63236. if (!validatedConfig._isTesting) {
  63237. validateDistNamespace(validatedConfig, diagnostics);
  63238. }
  63239. setBooleanConfig(validatedConfig, 'enableCache', 'cache', true);
  63240. if (!Array.isArray(validatedConfig.watchIgnoredRegex) && validatedConfig.watchIgnoredRegex != null) {
  63241. validatedConfig.watchIgnoredRegex = [validatedConfig.watchIgnoredRegex];
  63242. }
  63243. validatedConfig.watchIgnoredRegex = (validatedConfig.watchIgnoredRegex || []).reduce((arr, reg) => {
  63244. if (reg instanceof RegExp) {
  63245. arr.push(reg);
  63246. }
  63247. return arr;
  63248. }, []);
  63249. return {
  63250. config: validatedConfig,
  63251. diagnostics,
  63252. };
  63253. };
  63254. const DEFAULT_DEV_MODE = false;
  63255. const DEFAULT_HASHED_FILENAME_LENTH = 8;
  63256. const MIN_HASHED_FILENAME_LENTH = 4;
  63257. const MAX_HASHED_FILENAME_LENTH = 32;
  63258. /**
  63259. * Load and validate a configuration to use throughout the lifetime of any Stencil task (build, test, etc.).
  63260. *
  63261. * Users can provide configurations multiple ways simultaneously:
  63262. * - as an object of the `init` argument to this function
  63263. * - through a path to a configuration file that exists on disk
  63264. *
  63265. * In the case of both being present, the two configurations will be merged. The fields of the former will take precedence
  63266. * over the fields of the latter.
  63267. *
  63268. * @param init the initial configuration provided by the user (or generated by Stencil) used to bootstrap configuration
  63269. * loading and validation
  63270. * @returns the results of loading a configuration
  63271. * @public
  63272. */
  63273. const loadConfig = async (init = {}) => {
  63274. var _a;
  63275. const results = {
  63276. config: null,
  63277. diagnostics: [],
  63278. tsconfig: {
  63279. path: null,
  63280. compilerOptions: null,
  63281. files: null,
  63282. include: null,
  63283. exclude: null,
  63284. extends: null,
  63285. },
  63286. };
  63287. const unknownConfig = {};
  63288. try {
  63289. const config = init.config || {};
  63290. let configPath = init.configPath || config.configPath;
  63291. // Pull the {@link CompilerSystem} out of the initialization object, or create one if it does not exist.
  63292. // This entity is needed to load the project's configuration (and therefore needs to be created before it can be
  63293. // attached to a configuration entity, validated or otherwise)
  63294. const sys = (_a = init.sys) !== null && _a !== void 0 ? _a : createSystem();
  63295. const loadedConfigFile = await loadConfigFile(sys, results.diagnostics, configPath);
  63296. if (hasError(results.diagnostics)) {
  63297. return results;
  63298. }
  63299. if (loadedConfigFile !== null) {
  63300. // merge the user's config object into their loaded config file
  63301. configPath = loadedConfigFile.configPath;
  63302. unknownConfig.config = { ...loadedConfigFile, ...config };
  63303. unknownConfig.config.configPath = configPath;
  63304. unknownConfig.config.rootDir = normalizePath$1(dirname(configPath));
  63305. }
  63306. else {
  63307. // no stencil.config.ts or .js file, which is fine
  63308. unknownConfig.config = { ...config };
  63309. unknownConfig.config.configPath = null;
  63310. unknownConfig.config.rootDir = normalizePath$1(sys.getCurrentDirectory());
  63311. }
  63312. unknownConfig.config.sys = sys;
  63313. const validated = validateConfig(unknownConfig.config, init);
  63314. results.diagnostics.push(...validated.diagnostics);
  63315. if (hasError(results.diagnostics)) {
  63316. return results;
  63317. }
  63318. results.config = validated.config;
  63319. if (results.config.flags.debug || results.config.flags.verbose) {
  63320. results.config.logLevel = 'debug';
  63321. }
  63322. else if (results.config.flags.logLevel) {
  63323. results.config.logLevel = results.config.flags.logLevel;
  63324. }
  63325. else if (typeof results.config.logLevel !== 'string') {
  63326. results.config.logLevel = 'info';
  63327. }
  63328. results.config.logger.setLevel(results.config.logLevel);
  63329. if (!hasError(results.diagnostics)) {
  63330. const tsConfigResults = await validateTsConfig(results.config, sys, init);
  63331. results.diagnostics.push(...tsConfigResults.diagnostics);
  63332. results.config.tsconfig = tsConfigResults.path;
  63333. results.config.tsCompilerOptions = tsConfigResults.compilerOptions;
  63334. results.tsconfig.path = tsConfigResults.path;
  63335. results.tsconfig.compilerOptions = JSON.parse(JSON.stringify(tsConfigResults.compilerOptions));
  63336. results.tsconfig.files = tsConfigResults.files;
  63337. results.tsconfig.include = tsConfigResults.include;
  63338. results.tsconfig.exclude = tsConfigResults.exclude;
  63339. results.tsconfig.extends = tsConfigResults.extends;
  63340. }
  63341. }
  63342. catch (e) {
  63343. catchError(results.diagnostics, e);
  63344. }
  63345. return results;
  63346. };
  63347. /**
  63348. * Load a Stencil configuration file from disk
  63349. * @param sys the underlying System entity to use to interact with the operating system
  63350. * @param diagnostics a series of diagnostics used to track errors & warnings throughout the loading process. Entries
  63351. * may be added to this list in the event of an error.
  63352. * @param configPath the path to the configuration file to load
  63353. * @returns an unvalidated configuration. In the event of an error, additional diagnostics may be pushed to the
  63354. * provided `diagnostics` argument and `null` will be returned.
  63355. */
  63356. const loadConfigFile = async (sys, diagnostics, configPath) => {
  63357. let config = null;
  63358. if (isString$1(configPath)) {
  63359. // the passed in config was a string, so it's probably a path to the config we need to load
  63360. const configFileData = await evaluateConfigFile(sys, diagnostics, configPath);
  63361. if (hasError(diagnostics)) {
  63362. return config;
  63363. }
  63364. if (!configFileData.config) {
  63365. const err = buildError(diagnostics);
  63366. err.messageText = `Invalid Stencil configuration file "${configPath}". Missing "config" property.`;
  63367. err.absFilePath = configPath;
  63368. return config;
  63369. }
  63370. config = configFileData.config;
  63371. config.configPath = normalizePath$1(configPath);
  63372. }
  63373. return config;
  63374. };
  63375. /**
  63376. * Load the configuration file, based on the environment that Stencil is being run in
  63377. * @param sys the underlying System entity to use to interact with the operating system
  63378. * @param diagnostics a series of diagnostics used to track errors & warnings throughout the loading process. Entries
  63379. * may be added to this list in the event of an error.
  63380. * @param configFilePath the path to the configuration file to load
  63381. * @returns an unvalidated configuration. In the event of an error, additional diagnostics may be pushed to the
  63382. * provided `diagnostics` argument and `null` will be returned.
  63383. */
  63384. const evaluateConfigFile = async (sys, diagnostics, configFilePath) => {
  63385. let configFileData = null;
  63386. try {
  63387. if (IS_NODE_ENV) {
  63388. const results = nodeRequire(configFilePath);
  63389. diagnostics.push(...results.diagnostics);
  63390. configFileData = results.module;
  63391. }
  63392. else {
  63393. // browser environment, can't use node's require() to evaluate
  63394. let sourceText = await sys.readFile(configFilePath);
  63395. sourceText = transpileTypedConfig(diagnostics, sourceText, configFilePath);
  63396. if (hasError(diagnostics)) {
  63397. return configFileData;
  63398. }
  63399. const evalConfig = new Function(`const exports = {}; ${sourceText}; return exports;`);
  63400. configFileData = evalConfig();
  63401. }
  63402. }
  63403. catch (e) {
  63404. catchError(diagnostics, e);
  63405. }
  63406. return configFileData;
  63407. };
  63408. /**
  63409. * Transpiles the provided TypeScript source text into JavaScript.
  63410. *
  63411. * This function is intended to be used on a `stencil.config.ts` file
  63412. *
  63413. * @param diagnostics a collection of compiler diagnostics to check as a part of the compilation process
  63414. * @param sourceText the text to transpile
  63415. * @param filePath the name of the file to transpile
  63416. * @returns the transpiled text. If there are any diagnostics in the provided collection, the provided source is returned
  63417. */
  63418. const transpileTypedConfig = (diagnostics, sourceText, filePath) => {
  63419. // let's transpile an awesome stencil.config.ts file into
  63420. // a boring stencil.config.js file
  63421. if (hasError(diagnostics)) {
  63422. return sourceText;
  63423. }
  63424. const opts = {
  63425. fileName: filePath,
  63426. compilerOptions: {
  63427. module: t.ModuleKind.CommonJS,
  63428. moduleResolution: t.ModuleResolutionKind.NodeJs,
  63429. esModuleInterop: true,
  63430. target: t.ScriptTarget.ES2015,
  63431. allowJs: true,
  63432. },
  63433. reportDiagnostics: false,
  63434. };
  63435. const output = t.transpileModule(sourceText, opts);
  63436. return output.outputText;
  63437. };
  63438. const createHydrateBuildId = () => {
  63439. // should be case insensitive because it could be in a URL
  63440. // and shouldn't start with a number cuz we might use it as a js prop
  63441. let chars = 'abcdefghijklmnopqrstuvwxyz';
  63442. let buildId = '';
  63443. while (buildId.length < 8) {
  63444. const char = chars[Math.floor(Math.random() * chars.length)];
  63445. buildId += char;
  63446. if (buildId.length === 1) {
  63447. chars += '0123456789';
  63448. }
  63449. }
  63450. return buildId;
  63451. };
  63452. const getWriteFilePathFromUrlPath = (manager, inputHref) => {
  63453. const baseUrl = new URL(manager.outputTarget.baseUrl, manager.devServerHostUrl);
  63454. const basePathname = baseUrl.pathname.toLowerCase();
  63455. const inputUrl = new URL(inputHref, manager.devServerHostUrl);
  63456. const inputPathname = inputUrl.pathname.toLowerCase();
  63457. const basePathParts = basePathname.split('/');
  63458. const inputPathParts = inputPathname.split('/');
  63459. const isPrerrenderRoot = basePathname === inputPathname;
  63460. let fileName;
  63461. if (isPrerrenderRoot) {
  63462. fileName = path$5.basename(manager.outputTarget.indexHtml);
  63463. }
  63464. else {
  63465. fileName = 'index.html';
  63466. }
  63467. const pathParts = [];
  63468. for (let i = 0; i < inputPathParts.length; i++) {
  63469. const basePathPart = basePathParts[i];
  63470. const inputPathPart = inputPathParts[i];
  63471. if (typeof basePathPart === 'string' && basePathPart === inputPathPart) {
  63472. continue;
  63473. }
  63474. if (i === inputPathParts.length - 1) {
  63475. const lastPart = inputPathParts[i].toLowerCase();
  63476. if (lastPart.endsWith('.html') || lastPart.endsWith('.htm')) {
  63477. fileName = inputPathParts[i];
  63478. break;
  63479. }
  63480. }
  63481. pathParts.push(inputPathPart);
  63482. }
  63483. pathParts.push(fileName);
  63484. // figure out the directory where this file will be saved
  63485. return path$5.join(manager.outputTarget.appDir, ...pathParts);
  63486. };
  63487. const initializePrerenderEntryUrls = (results, manager) => {
  63488. const entryAnchors = [];
  63489. if (Array.isArray(manager.prerenderConfig.entryUrls)) {
  63490. for (const entryUrl of manager.prerenderConfig.entryUrls) {
  63491. const entryAnchor = {
  63492. href: entryUrl,
  63493. };
  63494. entryAnchors.push(entryAnchor);
  63495. }
  63496. }
  63497. else {
  63498. const entryAnchor = {
  63499. href: manager.outputTarget.baseUrl,
  63500. };
  63501. entryAnchors.push(entryAnchor);
  63502. }
  63503. for (const entryAnchor of entryAnchors) {
  63504. // ensure each entry url is valid
  63505. // and has a domain
  63506. try {
  63507. new URL(entryAnchor.href, manager.outputTarget.baseUrl);
  63508. }
  63509. catch (e) {
  63510. const diagnostic = buildError(results.diagnostics);
  63511. diagnostic.header = `Invalid Prerender Entry Url: ${entryAnchor.href}`;
  63512. diagnostic.messageText = `Entry Urls must include the protocol and domain of the site being prerendered.`;
  63513. return;
  63514. }
  63515. }
  63516. const base = new URL(manager.outputTarget.baseUrl);
  63517. const hrefs = crawlAnchorsForNextUrls(manager.prerenderConfig, results.diagnostics, base, base, entryAnchors);
  63518. for (const href of hrefs) {
  63519. addUrlToPendingQueue(manager, href, '#entryUrl');
  63520. }
  63521. };
  63522. const addUrlToPendingQueue = (manager, queueUrl, fromUrl) => {
  63523. if (!isString$1(queueUrl) || queueUrl === '') {
  63524. return;
  63525. }
  63526. if (manager.urlsPending.has(queueUrl)) {
  63527. return;
  63528. }
  63529. if (manager.urlsProcessing.has(queueUrl)) {
  63530. return;
  63531. }
  63532. if (manager.urlsCompleted.has(queueUrl)) {
  63533. return;
  63534. }
  63535. manager.urlsPending.add(queueUrl);
  63536. if (manager.isDebug) {
  63537. const url = new URL(queueUrl, manager.outputTarget.baseUrl).pathname;
  63538. const from = fromUrl.startsWith('#') ? fromUrl : new URL(fromUrl, manager.outputTarget.baseUrl).pathname;
  63539. manager.config.logger.debug(`prerender queue: ${url} (from ${from})`);
  63540. }
  63541. };
  63542. const drainPrerenderQueue = (results, manager) => {
  63543. const nextUrl = manager.urlsPending.values().next();
  63544. if (!nextUrl.done) {
  63545. if (manager.urlsProcessing.size > manager.maxConcurrency) {
  63546. // slow it down there buddy, too many at one time
  63547. setTimeout(() => drainPrerenderQueue(results, manager));
  63548. }
  63549. else {
  63550. const url = nextUrl.value;
  63551. // looks like we're ready to prerender more
  63552. // remove from pending
  63553. manager.urlsPending.delete(url);
  63554. // move to processing
  63555. manager.urlsProcessing.add(url);
  63556. // kick off async prerendering
  63557. prerenderUrl(results, manager, url);
  63558. if (manager.urlsProcessing.size < manager.maxConcurrency) {
  63559. // could be more ready for prerendering
  63560. // let's check again after a tick
  63561. manager.config.sys.nextTick(() => drainPrerenderQueue(results, manager));
  63562. }
  63563. }
  63564. }
  63565. if (manager.urlsProcessing.size === 0 && manager.urlsPending.size === 0) {
  63566. if (isFunction(manager.resolve)) {
  63567. // we're not actively processing anything
  63568. // and there aren't anymore urls in the queue to be prerendered
  63569. // so looks like our job here is done, good work team
  63570. manager.resolve();
  63571. manager.resolve = null;
  63572. }
  63573. }
  63574. };
  63575. const prerenderUrl = async (results, manager, url) => {
  63576. let previewUrl = url;
  63577. try {
  63578. previewUrl = new URL(url).pathname;
  63579. let timespan;
  63580. if (manager.isDebug) {
  63581. timespan = manager.config.logger.createTimeSpan(`prerender start: ${previewUrl}`, true);
  63582. }
  63583. const prerenderRequest = {
  63584. appDir: manager.outputTarget.appDir,
  63585. baseUrl: manager.outputTarget.baseUrl,
  63586. buildId: results.buildId,
  63587. componentGraphPath: manager.componentGraphPath,
  63588. devServerHostUrl: manager.devServerHostUrl,
  63589. hydrateAppFilePath: manager.hydrateAppFilePath,
  63590. isDebug: manager.isDebug,
  63591. prerenderConfigPath: manager.prerenderConfigPath,
  63592. staticSite: manager.staticSite,
  63593. templateId: manager.templateId,
  63594. url: url,
  63595. writeToFilePath: getWriteFilePathFromUrlPath(manager, url),
  63596. };
  63597. // prender this path and wait on the results
  63598. const urlResults = await manager.prerenderUrlWorker(prerenderRequest);
  63599. if (manager.isDebug) {
  63600. const filePath = relative$1(manager.config.rootDir, urlResults.filePath);
  63601. const hasError = urlResults.diagnostics.some((d) => d.level === 'error');
  63602. if (hasError) {
  63603. timespan.finish(`prerender failed: ${previewUrl}, ${filePath}`, 'red');
  63604. }
  63605. else {
  63606. timespan.finish(`prerender finish: ${previewUrl}, ${filePath}`);
  63607. }
  63608. }
  63609. manager.diagnostics.push(...urlResults.diagnostics);
  63610. if (Array.isArray(urlResults.anchorUrls)) {
  63611. for (const anchorUrl of urlResults.anchorUrls) {
  63612. addUrlToPendingQueue(manager, anchorUrl, url);
  63613. }
  63614. }
  63615. }
  63616. catch (e) {
  63617. // darn, idk, bad news
  63618. catchError(manager.diagnostics, e);
  63619. }
  63620. manager.urlsProcessing.delete(url);
  63621. manager.urlsCompleted.add(url);
  63622. results.urls++;
  63623. const urlsCompletedSize = manager.urlsCompleted.size;
  63624. if (manager.progressLogger && urlsCompletedSize > 1) {
  63625. manager.progressLogger.update(` prerendered ${urlsCompletedSize} urls: ${manager.config.logger.dim(previewUrl)}`);
  63626. }
  63627. // let's try to drain the queue again and let this
  63628. // next call figure out if we're actually done or not
  63629. manager.config.sys.nextTick(() => drainPrerenderQueue(results, manager));
  63630. };
  63631. const generateTemplateHtml = async (config, prerenderConfig, diagnostics, isDebug, srcIndexHtmlPath, outputTarget, hydrateOpts, manager) => {
  63632. try {
  63633. if (!isString$1(srcIndexHtmlPath)) {
  63634. srcIndexHtmlPath = outputTarget.indexHtml;
  63635. }
  63636. let templateHtml;
  63637. if (isFunction(prerenderConfig.loadTemplate)) {
  63638. const loadTemplateResult = prerenderConfig.loadTemplate(srcIndexHtmlPath);
  63639. if (isPromise(loadTemplateResult)) {
  63640. templateHtml = await loadTemplateResult;
  63641. }
  63642. else {
  63643. templateHtml = loadTemplateResult;
  63644. }
  63645. }
  63646. else {
  63647. templateHtml = await config.sys.readFile(srcIndexHtmlPath);
  63648. }
  63649. let doc = createDocument(templateHtml);
  63650. let staticSite = false;
  63651. if (prerenderConfig.staticSite) {
  63652. // purposely do not want any clientside JS
  63653. // go through the document and remove only stencil's scripts
  63654. removeStencilScripts(doc);
  63655. staticSite = true;
  63656. }
  63657. else {
  63658. // config didn't set if it's a staticSite only,
  63659. // but the HTML may not have any stencil scripts at all,
  63660. // so we'll need to know that so we don't add preload modules
  63661. // if there isn't at least one stencil script then it's a static site
  63662. staticSite = !hasStencilScript(doc);
  63663. }
  63664. doc.documentElement.classList.add('hydrated');
  63665. if (hydrateOpts.inlineExternalStyleSheets && !isDebug) {
  63666. try {
  63667. await inlineExternalStyleSheets(config.sys, outputTarget.appDir, doc);
  63668. }
  63669. catch (e) {
  63670. catchError(diagnostics, e);
  63671. }
  63672. }
  63673. if (hydrateOpts.minifyScriptElements && !isDebug) {
  63674. try {
  63675. await minifyScriptElements(doc, true);
  63676. }
  63677. catch (e) {
  63678. catchError(diagnostics, e);
  63679. }
  63680. }
  63681. if (hydrateOpts.minifyStyleElements && !isDebug) {
  63682. try {
  63683. const baseUrl = new URL(outputTarget.baseUrl, manager.devServerHostUrl);
  63684. await minifyStyleElements(config.sys, outputTarget.appDir, doc, baseUrl, true);
  63685. }
  63686. catch (e) {
  63687. catchError(diagnostics, e);
  63688. }
  63689. }
  63690. if (isFunction(prerenderConfig.beforeSerializeTemplate)) {
  63691. const beforeSerializeResults = prerenderConfig.beforeSerializeTemplate(doc);
  63692. if (isPromise(beforeSerializeResults)) {
  63693. doc = await beforeSerializeResults;
  63694. }
  63695. else {
  63696. doc = beforeSerializeResults;
  63697. }
  63698. }
  63699. let html = serializeNodeToHtml(doc);
  63700. if (isFunction(prerenderConfig.afterSerializeTemplate)) {
  63701. const afterSerializeResults = prerenderConfig.afterSerializeTemplate(html);
  63702. if (isPromise(afterSerializeResults)) {
  63703. html = await afterSerializeResults;
  63704. }
  63705. else {
  63706. html = afterSerializeResults;
  63707. }
  63708. }
  63709. return {
  63710. html,
  63711. staticSite,
  63712. };
  63713. }
  63714. catch (e) {
  63715. catchError(diagnostics, e);
  63716. }
  63717. return undefined;
  63718. };
  63719. const generateSitemapXml = async (manager) => {
  63720. if (manager.prerenderConfig.sitemapXml === null) {
  63721. // if it's set to null then let's not create a sitemap.xml file
  63722. return null;
  63723. }
  63724. try {
  63725. if (typeof manager.prerenderConfig.sitemapXml !== 'function') {
  63726. // not set to null, but also no config.sitemapXml(), so let's make a default
  63727. manager.prerenderConfig.sitemapXml = function sitemapXml(opts) {
  63728. const content = [];
  63729. content.push(`<?xml version="1.0" encoding="UTF-8"?>`);
  63730. content.push(`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`);
  63731. for (const url of opts.urls) {
  63732. content.push(`<url><loc>${url}</loc></url>`);
  63733. }
  63734. content.push(`</urlset>`);
  63735. return content.join('\n');
  63736. };
  63737. }
  63738. const opts = {
  63739. urls: getSitemapUrls(manager),
  63740. baseUrl: manager.outputTarget.baseUrl,
  63741. dir: manager.outputTarget.appDir,
  63742. };
  63743. const userResults = manager.prerenderConfig.sitemapXml(opts);
  63744. if (userResults == null) {
  63745. return null;
  63746. }
  63747. const results = {
  63748. content: null,
  63749. filePath: null,
  63750. url: null,
  63751. };
  63752. if (typeof userResults === 'string') {
  63753. results.content = userResults;
  63754. }
  63755. else {
  63756. results.content = userResults.content;
  63757. results.filePath = userResults.filePath;
  63758. }
  63759. if (typeof results.content !== 'string') {
  63760. return null;
  63761. }
  63762. if (typeof results.filePath !== 'string') {
  63763. results.filePath = join(manager.outputTarget.appDir, `sitemap.xml`);
  63764. }
  63765. if (typeof results.url !== 'string') {
  63766. const sitemapUrl = new URL(`sitemap.xml`, manager.outputTarget.baseUrl);
  63767. results.url = sitemapUrl.href;
  63768. }
  63769. await manager.config.sys.writeFile(results.filePath, results.content);
  63770. return results;
  63771. }
  63772. catch (e) {
  63773. catchError(manager.diagnostics, e);
  63774. return null;
  63775. }
  63776. };
  63777. const getSitemapUrls = (manager) => {
  63778. const urls = [];
  63779. if (typeof manager.prerenderConfig.canonicalUrl === 'function') {
  63780. // user provide a canonicalUrl() function
  63781. // use that to normalize the urls for the sitemap.xml
  63782. // if it returned null then don't add it to the sitemap
  63783. for (const url of manager.urlsCompleted) {
  63784. const canonicalUrl = manager.prerenderConfig.canonicalUrl(new URL(url));
  63785. if (typeof canonicalUrl === 'string' && canonicalUrl.trim() !== '') {
  63786. urls.push(canonicalUrl);
  63787. }
  63788. }
  63789. }
  63790. else {
  63791. for (const url of manager.urlsCompleted) {
  63792. if (typeof url === 'string') {
  63793. urls.push(url);
  63794. }
  63795. }
  63796. }
  63797. return urls.sort(sortUrls);
  63798. };
  63799. const sortUrls = (a, b) => {
  63800. const partsA = a.split('/').length;
  63801. const partsB = b.split('/').length;
  63802. if (partsA < partsB)
  63803. return -1;
  63804. if (partsA > partsB)
  63805. return 1;
  63806. if (a < b)
  63807. return -1;
  63808. if (a > b)
  63809. return 1;
  63810. return 0;
  63811. };
  63812. const generateRobotsTxt = async (manager, sitemapResults) => {
  63813. if (manager.prerenderConfig.robotsTxt === null) {
  63814. // if it's set to null then let's not create a robots.txt file
  63815. return null;
  63816. }
  63817. try {
  63818. if (typeof manager.prerenderConfig.robotsTxt !== 'function') {
  63819. // not set to null, but also no config.robotsTxt(), so let's make a default
  63820. manager.prerenderConfig.robotsTxt = function robotsTxt(opts) {
  63821. const content = [`User-agent: *`, `Disallow:`];
  63822. if (typeof opts.sitemapUrl === 'string') {
  63823. content.push(`Sitemap: ${opts.sitemapUrl}`);
  63824. }
  63825. return content.join('\n');
  63826. };
  63827. }
  63828. const opts = {
  63829. urls: getSitemapUrls(manager),
  63830. baseUrl: manager.outputTarget.baseUrl,
  63831. sitemapUrl: sitemapResults ? sitemapResults.url : null,
  63832. dir: manager.outputTarget.dir,
  63833. };
  63834. const userResults = manager.prerenderConfig.robotsTxt(opts);
  63835. if (userResults == null) {
  63836. return null;
  63837. }
  63838. const results = {
  63839. content: null,
  63840. filePath: null,
  63841. url: null,
  63842. };
  63843. if (typeof userResults === 'string') {
  63844. results.content = userResults;
  63845. }
  63846. else {
  63847. results.content = userResults.content;
  63848. results.filePath = userResults.filePath;
  63849. }
  63850. if (typeof results.content !== 'string') {
  63851. return null;
  63852. }
  63853. const lines = results.content.replace(/\r/g, '\n').split('\n');
  63854. results.content = lines.map((l) => l.trim()).join('\n');
  63855. if (typeof results.filePath !== 'string') {
  63856. results.filePath = join(manager.outputTarget.dir, `robots.txt`);
  63857. }
  63858. if (typeof results.url !== 'string') {
  63859. const robotsTxtUrl = new URL(`/robots.txt`, manager.outputTarget.baseUrl);
  63860. results.url = robotsTxtUrl.href;
  63861. }
  63862. await manager.config.sys.writeFile(results.filePath, results.content);
  63863. return results;
  63864. }
  63865. catch (e) {
  63866. catchError(manager.diagnostics, e);
  63867. return null;
  63868. }
  63869. };
  63870. const createPrerenderer = async (config) => {
  63871. const start = (opts) => {
  63872. return runPrerender(config, opts.hydrateAppFilePath, opts.componentGraph, opts.srcIndexHtmlPath, opts.buildId);
  63873. };
  63874. return {
  63875. start,
  63876. };
  63877. };
  63878. const runPrerender = async (config, hydrateAppFilePath, componentGraph, srcIndexHtmlPath, buildId) => {
  63879. const startTime = Date.now();
  63880. const diagnostics = [];
  63881. const results = {
  63882. buildId,
  63883. diagnostics,
  63884. urls: 0,
  63885. duration: 0,
  63886. average: 0,
  63887. };
  63888. const outputTargets = config.outputTargets.filter(isOutputTargetWww).filter((o) => isString$1(o.indexHtml));
  63889. if (!isString$1(results.buildId)) {
  63890. results.buildId = createHydrateBuildId();
  63891. }
  63892. if (outputTargets.length === 0) {
  63893. return results;
  63894. }
  63895. if (!isString$1(hydrateAppFilePath)) {
  63896. const diagnostic = buildError(diagnostics);
  63897. diagnostic.header = `Prerender Error`;
  63898. diagnostic.messageText = `Build results missing "hydrateAppFilePath"`;
  63899. }
  63900. else {
  63901. if (!isAbsolute$1(hydrateAppFilePath)) {
  63902. hydrateAppFilePath = join(config.sys.getCurrentDirectory(), hydrateAppFilePath);
  63903. }
  63904. const hydrateAppExists = await config.sys.access(hydrateAppFilePath);
  63905. if (!hydrateAppExists) {
  63906. const diagnostic = buildError(diagnostics);
  63907. diagnostic.header = `Prerender Error`;
  63908. diagnostic.messageText = `Unable to open "hydrateAppFilePath": ${hydrateAppFilePath}`;
  63909. }
  63910. }
  63911. if (!hasError(diagnostics)) {
  63912. let workerCtx;
  63913. let workerCtrl;
  63914. if (config.sys.createWorkerController == null || config.maxConcurrentWorkers < 1) {
  63915. workerCtx = createWorkerContext(config.sys);
  63916. }
  63917. else {
  63918. workerCtrl = config.sys.createWorkerController(config.maxConcurrentWorkers);
  63919. workerCtx = createWorkerMainContext(workerCtrl);
  63920. }
  63921. const devServerConfig = { ...config.devServer };
  63922. devServerConfig.openBrowser = false;
  63923. devServerConfig.gzip = false;
  63924. devServerConfig.logRequests = false;
  63925. devServerConfig.reloadStrategy = null;
  63926. const devServerPath = config.sys.getDevServerExecutingPath();
  63927. const { start } = await config.sys.dynamicImport(devServerPath);
  63928. const devServer = await start(devServerConfig, config.logger);
  63929. try {
  63930. await Promise.all(outputTargets.map((outputTarget) => {
  63931. return runPrerenderOutputTarget(workerCtx, results, diagnostics, config, devServer, hydrateAppFilePath, componentGraph, srcIndexHtmlPath, outputTarget);
  63932. }));
  63933. }
  63934. catch (e) {
  63935. catchError(diagnostics, e);
  63936. }
  63937. if (workerCtrl) {
  63938. workerCtrl.destroy();
  63939. }
  63940. if (devServer) {
  63941. await devServer.close();
  63942. }
  63943. }
  63944. results.duration = Date.now() - startTime;
  63945. if (results.urls > 0) {
  63946. results.average = results.duration / results.urls;
  63947. }
  63948. return results;
  63949. };
  63950. const runPrerenderOutputTarget = async (workerCtx, results, diagnostics, config, devServer, hydrateAppFilePath, componentGraph, srcIndexHtmlPath, outputTarget) => {
  63951. try {
  63952. const timeSpan = config.logger.createTimeSpan(`prerendering started`);
  63953. const devServerBaseUrl = new URL(devServer.browserUrl);
  63954. const devServerHostUrl = devServerBaseUrl.origin;
  63955. const prerenderConfig = getPrerenderConfig(diagnostics, outputTarget.prerenderConfig);
  63956. const hydrateOpts = getHydrateOptions(prerenderConfig, devServerBaseUrl, diagnostics);
  63957. config.logger.debug(`prerender hydrate app: ${hydrateAppFilePath}`);
  63958. config.logger.debug(`prerender dev server: ${devServerHostUrl}`);
  63959. if (hasError(diagnostics)) {
  63960. return;
  63961. }
  63962. // get the prerender urls to queue up
  63963. const prerenderDiagnostics = [];
  63964. const manager = {
  63965. prerenderUrlWorker: (prerenderRequest) => workerCtx.prerenderWorker(prerenderRequest),
  63966. componentGraphPath: null,
  63967. config: config,
  63968. diagnostics: prerenderDiagnostics,
  63969. devServerHostUrl: devServerHostUrl,
  63970. hydrateAppFilePath: hydrateAppFilePath,
  63971. isDebug: config.logLevel === 'debug',
  63972. logCount: 0,
  63973. maxConcurrency: Math.max(20, config.maxConcurrentWorkers * 10),
  63974. outputTarget: outputTarget,
  63975. prerenderConfig: prerenderConfig,
  63976. prerenderConfigPath: outputTarget.prerenderConfig,
  63977. staticSite: false,
  63978. templateId: null,
  63979. urlsCompleted: new Set(),
  63980. urlsPending: new Set(),
  63981. urlsProcessing: new Set(),
  63982. resolve: null,
  63983. };
  63984. if (!config.flags.ci && !manager.isDebug) {
  63985. manager.progressLogger = await config.logger.createLineUpdater();
  63986. }
  63987. initializePrerenderEntryUrls(results, manager);
  63988. if (manager.urlsPending.size === 0) {
  63989. const err = buildError(diagnostics);
  63990. err.messageText = `prerendering failed: no urls found in the prerender config`;
  63991. return;
  63992. }
  63993. const templateData = await generateTemplateHtml(config, prerenderConfig, diagnostics, manager.isDebug, srcIndexHtmlPath, outputTarget, hydrateOpts, manager);
  63994. if (diagnostics.length > 0 || !templateData || !isString$1(templateData.html)) {
  63995. return;
  63996. }
  63997. manager.templateId = await createPrerenderTemplate(config, templateData.html);
  63998. manager.staticSite = templateData.staticSite;
  63999. manager.componentGraphPath = await createComponentGraphPath(config, componentGraph, outputTarget);
  64000. await new Promise((resolve) => {
  64001. manager.resolve = resolve;
  64002. config.sys.nextTick(() => drainPrerenderQueue(results, manager));
  64003. });
  64004. if (manager.isDebug) {
  64005. const debugDiagnostics = prerenderDiagnostics.filter((d) => d.level === 'debug');
  64006. if (debugDiagnostics.length > 0) {
  64007. config.logger.printDiagnostics(debugDiagnostics);
  64008. }
  64009. }
  64010. const duration = timeSpan.duration();
  64011. const sitemapResults = await generateSitemapXml(manager);
  64012. await generateRobotsTxt(manager, sitemapResults);
  64013. const prerenderBuildErrors = prerenderDiagnostics.filter((d) => d.level === 'error');
  64014. const prerenderRuntimeErrors = prerenderDiagnostics.filter((d) => d.type === 'runtime');
  64015. if (prerenderBuildErrors.length > 0) {
  64016. // convert to just runtime errors so the other build files still write
  64017. // but the CLI knows an error occurred and should have an exit code 1
  64018. for (const diagnostic of prerenderBuildErrors) {
  64019. diagnostic.type = 'runtime';
  64020. }
  64021. diagnostics.push(...prerenderBuildErrors);
  64022. }
  64023. diagnostics.push(...prerenderRuntimeErrors);
  64024. // Clear progress logger
  64025. if (manager.progressLogger) {
  64026. await manager.progressLogger.stop();
  64027. }
  64028. const totalUrls = manager.urlsCompleted.size;
  64029. if (totalUrls > 1) {
  64030. const average = Math.round(duration / totalUrls);
  64031. config.logger.info(`prerendered ${totalUrls} urls, averaging ${average} ms per url`);
  64032. }
  64033. const statusMessage = prerenderBuildErrors.length > 0 ? 'failed' : 'finished';
  64034. const statusColor = prerenderBuildErrors.length > 0 ? 'red' : 'green';
  64035. timeSpan.finish(`prerendering ${statusMessage}`, statusColor, true);
  64036. }
  64037. catch (e) {
  64038. catchError(diagnostics, e);
  64039. }
  64040. };
  64041. const createPrerenderTemplate = async (config, templateHtml) => {
  64042. const hash = await config.sys.generateContentHash(templateHtml, 12);
  64043. const templateFileName = `prerender-${hash}.html`;
  64044. const templateId = join(config.sys.tmpDirSync(), templateFileName);
  64045. config.logger.debug(`prerender template: ${templateId}`);
  64046. config.sys.writeFileSync(templateId, templateHtml);
  64047. return templateId;
  64048. };
  64049. const createComponentGraphPath = async (config, componentGraph, outputTarget) => {
  64050. if (componentGraph) {
  64051. const content = getComponentPathContent(componentGraph, outputTarget);
  64052. const hash = await config.sys.generateContentHash(content);
  64053. const fileName = `prerender-component-graph-${hash}.json`;
  64054. const componentGraphPath = join(config.sys.tmpDirSync(), fileName);
  64055. config.sys.writeFileSync(componentGraphPath, content);
  64056. return componentGraphPath;
  64057. }
  64058. return null;
  64059. };
  64060. const getComponentPathContent = (componentGraph, outputTarget) => {
  64061. const buildDir = getAbsoluteBuildDir(outputTarget);
  64062. const object = {};
  64063. const entries = Object.entries(componentGraph);
  64064. for (const [key, chunks] of entries) {
  64065. object[key] = chunks.map((filename) => join(buildDir, filename));
  64066. }
  64067. return JSON.stringify(object);
  64068. };
  64069. const dependencies = [
  64070. {
  64071. name: "@stencil/core",
  64072. version: "2.18.1",
  64073. main: "compiler/stencil.js",
  64074. resources: [
  64075. "package.json",
  64076. "compiler/lib.d.ts",
  64077. "compiler/lib.dom.d.ts",
  64078. "compiler/lib.dom.iterable.d.ts",
  64079. "compiler/lib.es2015.collection.d.ts",
  64080. "compiler/lib.es2015.core.d.ts",
  64081. "compiler/lib.es2015.d.ts",
  64082. "compiler/lib.es2015.generator.d.ts",
  64083. "compiler/lib.es2015.iterable.d.ts",
  64084. "compiler/lib.es2015.promise.d.ts",
  64085. "compiler/lib.es2015.proxy.d.ts",
  64086. "compiler/lib.es2015.reflect.d.ts",
  64087. "compiler/lib.es2015.symbol.d.ts",
  64088. "compiler/lib.es2015.symbol.wellknown.d.ts",
  64089. "compiler/lib.es2016.array.include.d.ts",
  64090. "compiler/lib.es2016.d.ts",
  64091. "compiler/lib.es2016.full.d.ts",
  64092. "compiler/lib.es2017.d.ts",
  64093. "compiler/lib.es2017.full.d.ts",
  64094. "compiler/lib.es2017.intl.d.ts",
  64095. "compiler/lib.es2017.object.d.ts",
  64096. "compiler/lib.es2017.sharedmemory.d.ts",
  64097. "compiler/lib.es2017.string.d.ts",
  64098. "compiler/lib.es2017.typedarrays.d.ts",
  64099. "compiler/lib.es2018.asyncgenerator.d.ts",
  64100. "compiler/lib.es2018.asynciterable.d.ts",
  64101. "compiler/lib.es2018.d.ts",
  64102. "compiler/lib.es2018.full.d.ts",
  64103. "compiler/lib.es2018.intl.d.ts",
  64104. "compiler/lib.es2018.promise.d.ts",
  64105. "compiler/lib.es2018.regexp.d.ts",
  64106. "compiler/lib.es2019.array.d.ts",
  64107. "compiler/lib.es2019.d.ts",
  64108. "compiler/lib.es2019.full.d.ts",
  64109. "compiler/lib.es2019.object.d.ts",
  64110. "compiler/lib.es2019.string.d.ts",
  64111. "compiler/lib.es2019.symbol.d.ts",
  64112. "compiler/lib.es2020.bigint.d.ts",
  64113. "compiler/lib.es2020.d.ts",
  64114. "compiler/lib.es2020.date.d.ts",
  64115. "compiler/lib.es2020.full.d.ts",
  64116. "compiler/lib.es2020.intl.d.ts",
  64117. "compiler/lib.es2020.number.d.ts",
  64118. "compiler/lib.es2020.promise.d.ts",
  64119. "compiler/lib.es2020.sharedmemory.d.ts",
  64120. "compiler/lib.es2020.string.d.ts",
  64121. "compiler/lib.es2020.symbol.wellknown.d.ts",
  64122. "compiler/lib.es2021.d.ts",
  64123. "compiler/lib.es2021.full.d.ts",
  64124. "compiler/lib.es2021.intl.d.ts",
  64125. "compiler/lib.es2021.promise.d.ts",
  64126. "compiler/lib.es2021.string.d.ts",
  64127. "compiler/lib.es2021.weakref.d.ts",
  64128. "compiler/lib.es2022.array.d.ts",
  64129. "compiler/lib.es2022.d.ts",
  64130. "compiler/lib.es2022.error.d.ts",
  64131. "compiler/lib.es2022.full.d.ts",
  64132. "compiler/lib.es2022.intl.d.ts",
  64133. "compiler/lib.es2022.object.d.ts",
  64134. "compiler/lib.es2022.string.d.ts",
  64135. "compiler/lib.es5.d.ts",
  64136. "compiler/lib.es6.d.ts",
  64137. "compiler/lib.esnext.d.ts",
  64138. "compiler/lib.esnext.full.d.ts",
  64139. "compiler/lib.esnext.intl.d.ts",
  64140. "compiler/lib.esnext.promise.d.ts",
  64141. "compiler/lib.esnext.string.d.ts",
  64142. "compiler/lib.esnext.weakref.d.ts",
  64143. "compiler/lib.scripthost.d.ts",
  64144. "compiler/lib.webworker.d.ts",
  64145. "compiler/lib.webworker.importscripts.d.ts",
  64146. "compiler/lib.webworker.iterable.d.ts",
  64147. "internal/index.d.ts",
  64148. "internal/index.js",
  64149. "internal/package.json",
  64150. "internal/stencil-ext-modules.d.ts",
  64151. "internal/stencil-private.d.ts",
  64152. "internal/stencil-public-compiler.d.ts",
  64153. "internal/stencil-public-docs.d.ts",
  64154. "internal/stencil-public-runtime.d.ts",
  64155. "mock-doc/index.js",
  64156. "mock-doc/package.json",
  64157. "internal/client/css-shim.js",
  64158. "internal/client/dom.js",
  64159. "internal/client/index.js",
  64160. "internal/client/package.json",
  64161. "internal/client/patch-browser.js",
  64162. "internal/client/patch-esm.js",
  64163. "internal/client/shadow-css.js",
  64164. "internal/hydrate/index.js",
  64165. "internal/hydrate/package.json",
  64166. "internal/hydrate/runner.js",
  64167. "internal/hydrate/shadow-css.js",
  64168. "internal/stencil-core/index.d.ts",
  64169. "internal/stencil-core/index.js"
  64170. ]
  64171. },
  64172. {
  64173. name: "rollup",
  64174. version: "2.42.3",
  64175. main: "dist/es/rollup.browser.js"
  64176. },
  64177. {
  64178. name: "terser",
  64179. version: "5.6.1",
  64180. main: "dist/bundle.min.js"
  64181. },
  64182. {
  64183. name: "typescript",
  64184. version: "4.7.4",
  64185. main: "lib/typescript.js"
  64186. }
  64187. ];
  64188. const getTranspileResults = (code, input) => {
  64189. if (!isString$1(input.file)) {
  64190. input.file = 'module.tsx';
  64191. }
  64192. const parsedImport = parseImportPath(input.file);
  64193. const results = {
  64194. code: typeof code === 'string' ? code : '',
  64195. data: [],
  64196. diagnostics: [],
  64197. inputFileExtension: parsedImport.ext,
  64198. inputFilePath: input.file,
  64199. imports: [],
  64200. map: null,
  64201. outputFilePath: null,
  64202. };
  64203. return {
  64204. importData: parsedImport.data,
  64205. results,
  64206. };
  64207. };
  64208. const transpileCtx = { sys: null };
  64209. const getTranspileConfig = (input) => {
  64210. if (input.sys) {
  64211. transpileCtx.sys = input.sys;
  64212. }
  64213. else if (!transpileCtx.sys) {
  64214. if (IS_NODE_ENV) {
  64215. transpileCtx.sys = requireFunc('../sys/node/index.js').createNodeSys();
  64216. }
  64217. else {
  64218. transpileCtx.sys = createSystem();
  64219. }
  64220. }
  64221. const compileOpts = {
  64222. componentExport: getTranspileConfigOpt(input.componentExport, VALID_EXPORT, 'customelement'),
  64223. componentMetadata: getTranspileConfigOpt(input.componentMetadata, VALID_METADATA, null),
  64224. coreImportPath: isString$1(input.coreImportPath) ? input.coreImportPath : STENCIL_INTERNAL_CLIENT_ID,
  64225. currentDirectory: isString$1(input.currentDirectory)
  64226. ? input.currentDirectory
  64227. : transpileCtx.sys.getCurrentDirectory(),
  64228. file: input.file,
  64229. proxy: getTranspileConfigOpt(input.proxy, VALID_PROXY, 'defineproperty'),
  64230. module: getTranspileConfigOpt(input.module, VALID_MODULE, 'esm'),
  64231. sourceMap: input.sourceMap === 'inline' ? 'inline' : input.sourceMap !== false,
  64232. style: getTranspileConfigOpt(input.style, VALID_STYLE, 'static'),
  64233. styleImportData: getTranspileConfigOpt(input.styleImportData, VALID_STYLE_IMPORT_DATA, 'queryparams'),
  64234. target: getTranspileConfigOpt(input.target, VALID_TARGET, 'latest'),
  64235. };
  64236. const tsCompilerOptions = {
  64237. // best we always set this to true
  64238. allowSyntheticDefaultImports: true,
  64239. // best we always set this to true
  64240. esModuleInterop: true,
  64241. // always get source maps
  64242. sourceMap: compileOpts.sourceMap !== false,
  64243. // isolated per file transpiling
  64244. isolatedModules: true,
  64245. // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
  64246. suppressOutputPathCheck: true,
  64247. // Filename can be non-ts file.
  64248. allowNonTsExtensions: true,
  64249. // We are not returning a sourceFile for lib file when asked by the program,
  64250. // so pass --noLib to avoid reporting a file not found error.
  64251. noLib: true,
  64252. noResolve: true,
  64253. // NOTE: "module" and "target" configs will be set later
  64254. // after the "ts" object has been loaded
  64255. };
  64256. if (isString$1(input.baseUrl)) {
  64257. compileOpts.baseUrl = input.baseUrl;
  64258. tsCompilerOptions.baseUrl = compileOpts.baseUrl;
  64259. }
  64260. if (input.paths) {
  64261. compileOpts.paths = { ...input.paths };
  64262. tsCompilerOptions.paths = { ...compileOpts.paths };
  64263. }
  64264. const transformOpts = {
  64265. coreImportPath: compileOpts.coreImportPath,
  64266. componentExport: compileOpts.componentExport,
  64267. componentMetadata: compileOpts.componentMetadata,
  64268. currentDirectory: compileOpts.currentDirectory,
  64269. isolatedModules: true,
  64270. module: compileOpts.module,
  64271. proxy: compileOpts.proxy,
  64272. file: compileOpts.file,
  64273. style: compileOpts.style,
  64274. styleImportData: compileOpts.styleImportData,
  64275. target: compileOpts.target,
  64276. };
  64277. const config = {
  64278. rootDir: compileOpts.currentDirectory,
  64279. srcDir: compileOpts.currentDirectory,
  64280. devMode: true,
  64281. minifyCss: true,
  64282. minifyJs: false,
  64283. _isTesting: true,
  64284. validateTypes: false,
  64285. enableCache: false,
  64286. sys: transpileCtx.sys,
  64287. tsCompilerOptions,
  64288. };
  64289. return {
  64290. compileOpts,
  64291. config,
  64292. transformOpts,
  64293. };
  64294. };
  64295. const getTranspileCssConfig = (compileOpts, importData, results) => {
  64296. const transformInput = {
  64297. file: results.inputFilePath,
  64298. input: results.code,
  64299. tag: importData && importData.tag,
  64300. encapsulation: importData && importData.encapsulation,
  64301. mode: importData && importData.mode,
  64302. sourceMap: compileOpts.sourceMap !== false,
  64303. commentOriginalSelector: false,
  64304. minify: false,
  64305. autoprefixer: false,
  64306. module: compileOpts.module,
  64307. styleImportData: compileOpts.styleImportData,
  64308. };
  64309. return transformInput;
  64310. };
  64311. const getTranspileConfigOpt = (value, validValues, defaultValue) => {
  64312. if (value === null || value === 'null') {
  64313. return null;
  64314. }
  64315. value = isString$1(value) ? value.toLowerCase().trim() : null;
  64316. if (validValues.has(value)) {
  64317. return value;
  64318. }
  64319. return defaultValue;
  64320. };
  64321. const VALID_EXPORT = new Set(['customelement', 'module']);
  64322. const VALID_METADATA = new Set(['compilerstatic', null]);
  64323. const VALID_MODULE = new Set(['cjs', 'esm']);
  64324. const VALID_PROXY = new Set(['defineproperty', null]);
  64325. const VALID_STYLE = new Set(['static']);
  64326. const VALID_STYLE_IMPORT_DATA = new Set(['queryparams']);
  64327. const VALID_TARGET = new Set(['latest', 'esnext', 'es2020', 'es2019', 'es2018', 'es2017', 'es2016', 'es2015', 'es5']);
  64328. const convertStaticToMeta = (config, compilerCtx, buildCtx, typeChecker, collection, transformOpts) => {
  64329. return (transformCtx) => {
  64330. let dirPath;
  64331. let moduleFile;
  64332. const visitNode = (node) => {
  64333. if (t.isClassDeclaration(node)) {
  64334. return parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile, transformOpts);
  64335. }
  64336. else if (t.isImportDeclaration(node)) {
  64337. parseModuleImport(config, compilerCtx, buildCtx, moduleFile, dirPath, node, !transformOpts.isolatedModules);
  64338. }
  64339. else if (t.isCallExpression(node)) {
  64340. parseCallExpression(moduleFile, node);
  64341. }
  64342. else if (t.isStringLiteral(node)) {
  64343. parseStringLiteral(moduleFile, node);
  64344. }
  64345. return t.visitEachChild(node, visitNode, transformCtx);
  64346. };
  64347. return (tsSourceFile) => {
  64348. dirPath = dirname(tsSourceFile.fileName);
  64349. moduleFile = getModuleLegacy(config, compilerCtx, tsSourceFile.fileName);
  64350. resetModuleLegacy(moduleFile);
  64351. if (collection != null) {
  64352. moduleFile.isCollectionDependency = true;
  64353. moduleFile.collectionName = collection.collectionName;
  64354. collection.moduleFiles.push(moduleFile);
  64355. }
  64356. else {
  64357. moduleFile.isCollectionDependency = false;
  64358. moduleFile.collectionName = null;
  64359. }
  64360. return visitNode(tsSourceFile);
  64361. };
  64362. };
  64363. };
  64364. /**
  64365. * Stand-alone compiling of a single string
  64366. * @param config the Stencil configuration to use in the compilation process
  64367. * @param input the string to compile
  64368. * @param transformOpts a configuration object for how the string is compiled
  64369. * @returns the results of compiling the provided input string
  64370. */
  64371. const transpileModule = (config, input, transformOpts) => {
  64372. if (!config.logger) {
  64373. config = {
  64374. ...config,
  64375. logger: createLogger(),
  64376. };
  64377. }
  64378. const compilerCtx = new CompilerContext();
  64379. const buildCtx = new BuildContext(config, compilerCtx);
  64380. const tsCompilerOptions = {
  64381. ...config.tsCompilerOptions,
  64382. };
  64383. let sourceFilePath = transformOpts.file;
  64384. if (isString$1(sourceFilePath)) {
  64385. sourceFilePath = normalizePath$1(sourceFilePath);
  64386. }
  64387. else {
  64388. sourceFilePath = tsCompilerOptions.jsx ? `module.tsx` : `module.ts`;
  64389. }
  64390. const results = {
  64391. sourceFilePath: sourceFilePath,
  64392. code: null,
  64393. map: null,
  64394. diagnostics: [],
  64395. moduleFile: null,
  64396. };
  64397. if (transformOpts.module === 'cjs') {
  64398. tsCompilerOptions.module = t.ModuleKind.CommonJS;
  64399. }
  64400. else {
  64401. tsCompilerOptions.module = t.ModuleKind.ESNext;
  64402. }
  64403. tsCompilerOptions.target = getScriptTargetKind(transformOpts);
  64404. if ((sourceFilePath.endsWith('.tsx') || sourceFilePath.endsWith('.jsx')) && tsCompilerOptions.jsx == null) {
  64405. // ensure we're setup for JSX in typescript
  64406. tsCompilerOptions.jsx = t.JsxEmit.React;
  64407. }
  64408. if (tsCompilerOptions.jsx != null && !isString$1(tsCompilerOptions.jsxFactory)) {
  64409. tsCompilerOptions.jsxFactory = 'h';
  64410. }
  64411. if (tsCompilerOptions.jsx != null && !isString$1(tsCompilerOptions.jsxFragmentFactory)) {
  64412. tsCompilerOptions.jsxFragmentFactory = 'Fragment';
  64413. }
  64414. if (tsCompilerOptions.paths && !isString$1(tsCompilerOptions.baseUrl)) {
  64415. tsCompilerOptions.baseUrl = '.';
  64416. }
  64417. const sourceFile = t.createSourceFile(sourceFilePath, input, tsCompilerOptions.target);
  64418. // Create a compilerHost object to allow the compiler to read and write files
  64419. const compilerHost = {
  64420. getSourceFile: (fileName) => {
  64421. return normalizePath$1(fileName) === normalizePath$1(sourceFilePath) ? sourceFile : undefined;
  64422. },
  64423. writeFile: (name, text) => {
  64424. if (name.endsWith('.js.map')) {
  64425. results.map = text;
  64426. }
  64427. else if (name.endsWith('.js')) {
  64428. results.code = text;
  64429. }
  64430. },
  64431. getDefaultLibFileName: () => `lib.d.ts`,
  64432. useCaseSensitiveFileNames: () => false,
  64433. getCanonicalFileName: (fileName) => fileName,
  64434. getCurrentDirectory: () => transformOpts.currentDirectory || getCurrentDirectory(),
  64435. getNewLine: () => t.sys.newLine || '\n',
  64436. fileExists: (fileName) => normalizePath$1(fileName) === normalizePath$1(sourceFilePath),
  64437. readFile: () => '',
  64438. directoryExists: () => true,
  64439. getDirectories: () => [],
  64440. };
  64441. const program = t.createProgram([sourceFilePath], tsCompilerOptions, compilerHost);
  64442. const typeChecker = program.getTypeChecker();
  64443. const after = [
  64444. convertStaticToMeta(config, compilerCtx, buildCtx, typeChecker, null, transformOpts),
  64445. ];
  64446. if (transformOpts.componentExport === 'customelement' || transformOpts.componentExport === 'module') {
  64447. after.push(nativeComponentTransform(compilerCtx, transformOpts));
  64448. }
  64449. else {
  64450. after.push(lazyComponentTransform(compilerCtx, transformOpts));
  64451. }
  64452. program.emit(undefined, undefined, undefined, false, {
  64453. before: [
  64454. convertDecoratorsToStatic(config, buildCtx.diagnostics, typeChecker),
  64455. updateStencilCoreImports(transformOpts.coreImportPath),
  64456. ],
  64457. after,
  64458. });
  64459. const tsDiagnostics = [...program.getSyntacticDiagnostics()];
  64460. if (config.validateTypes) {
  64461. tsDiagnostics.push(...program.getOptionsDiagnostics());
  64462. }
  64463. buildCtx.diagnostics.push(...loadTypeScriptDiagnostics(tsDiagnostics));
  64464. results.diagnostics.push(...buildCtx.diagnostics);
  64465. results.moduleFile = compilerCtx.moduleMap.get(results.sourceFilePath);
  64466. return results;
  64467. };
  64468. const getScriptTargetKind = (transformOpts) => {
  64469. const target = transformOpts.target && transformOpts.target.toUpperCase();
  64470. if (isNumber$1(t.ScriptTarget[target])) {
  64471. return t.ScriptTarget[target];
  64472. }
  64473. // ESNext and Latest are the same
  64474. return t.ScriptTarget.Latest;
  64475. };
  64476. const transpile = async (code, opts = {}) => {
  64477. const { importData, results } = getTranspileResults(code, opts);
  64478. try {
  64479. if (shouldTranspileModule(results.inputFileExtension)) {
  64480. const { config, compileOpts, transformOpts } = getTranspileConfig(opts);
  64481. patchTypescript(config, null);
  64482. transpileCode(config, compileOpts, transformOpts, results);
  64483. }
  64484. else if (results.inputFileExtension === 'd.ts') {
  64485. results.code = '';
  64486. }
  64487. else if (results.inputFileExtension === 'css') {
  64488. const transformInput = getTranspileCssConfig(opts, importData, results);
  64489. await transpileCss(transformInput, results);
  64490. }
  64491. else if (results.inputFileExtension === 'json') {
  64492. transpileJson(results);
  64493. }
  64494. }
  64495. catch (e) {
  64496. catchError(results.diagnostics, e);
  64497. }
  64498. return results;
  64499. };
  64500. const transpileSync = (code, opts = {}) => {
  64501. const { importData, results } = getTranspileResults(code, opts);
  64502. try {
  64503. if (shouldTranspileModule(results.inputFileExtension)) {
  64504. const { config, compileOpts, transformOpts } = getTranspileConfig(opts);
  64505. patchTypescript(config, null);
  64506. transpileCode(config, compileOpts, transformOpts, results);
  64507. }
  64508. else if (results.inputFileExtension === 'd.ts') {
  64509. results.code = '';
  64510. }
  64511. else if (results.inputFileExtension === 'css') {
  64512. const transformInput = getTranspileCssConfig(opts, importData, results);
  64513. transpileCssSync(transformInput, results);
  64514. }
  64515. else if (results.inputFileExtension === 'json') {
  64516. transpileJson(results);
  64517. }
  64518. }
  64519. catch (e) {
  64520. catchError(results.diagnostics, e);
  64521. }
  64522. return results;
  64523. };
  64524. const transpileCode = (config, transpileOpts, transformOpts, results) => {
  64525. const transpileResults = transpileModule(config, results.code, transformOpts);
  64526. results.diagnostics.push(...transpileResults.diagnostics);
  64527. if (typeof transpileResults.code === 'string') {
  64528. results.code = transpileResults.code;
  64529. results.map = transpileResults.map;
  64530. if (transpileOpts.sourceMap === 'inline') {
  64531. try {
  64532. const mapObject = JSON.parse(transpileResults.map);
  64533. mapObject.file = transpileOpts.file;
  64534. mapObject.sources = [transpileOpts.file];
  64535. delete mapObject.sourceRoot;
  64536. const sourceMapComment = results.code.lastIndexOf('//#');
  64537. results.code =
  64538. results.code.slice(0, sourceMapComment) + getInlineSourceMappingUrlLinker(JSON.stringify(mapObject));
  64539. }
  64540. catch (e) {
  64541. console.error(e);
  64542. }
  64543. }
  64544. }
  64545. if (isString$1(transpileResults.sourceFilePath)) {
  64546. results.inputFilePath = transpileResults.sourceFilePath;
  64547. }
  64548. const moduleFile = transpileResults.moduleFile;
  64549. if (moduleFile) {
  64550. results.outputFilePath = moduleFile.jsFilePath;
  64551. moduleFile.cmps.forEach((cmp) => {
  64552. results.data.push(getPublicCompilerMeta(cmp));
  64553. });
  64554. moduleFile.originalImports.forEach((originalImport) => {
  64555. results.imports.push({
  64556. path: originalImport,
  64557. });
  64558. });
  64559. }
  64560. };
  64561. const transpileCss = async (transformInput, results) => {
  64562. const cssResults = await transformCssToEsm(transformInput);
  64563. results.code = cssResults.output;
  64564. results.map = cssResults.map;
  64565. results.imports = cssResults.imports.map((p) => ({ path: p.importPath }));
  64566. results.diagnostics.push(...cssResults.diagnostics);
  64567. };
  64568. const transpileCssSync = (transformInput, results) => {
  64569. const cssResults = transformCssToEsmSync(transformInput);
  64570. results.code = cssResults.output;
  64571. results.map = cssResults.map;
  64572. results.imports = cssResults.imports.map((p) => ({ path: p.importPath }));
  64573. results.diagnostics.push(...cssResults.diagnostics);
  64574. };
  64575. const transpileJson = (results) => {
  64576. results.code = index.dataToEsm(JSON.parse(results.code), {
  64577. preferConst: true,
  64578. compact: false,
  64579. indent: ' ',
  64580. });
  64581. results.map = { mappings: '' };
  64582. };
  64583. // NOTE: if you change this, also change scripts/bundles/helpers/jest/jest-preset.js
  64584. const shouldTranspileModule = (ext) => ['tsx', 'ts', 'mjs', 'jsx', 'js'].includes(ext);
  64585. if (IS_WEB_WORKER_ENV) {
  64586. initWebWorkerThread(createWorkerMessageHandler(createSystem()));
  64587. }
  64588. exports.buildId = buildId;
  64589. exports.createCompiler = createCompiler;
  64590. exports.createPrerenderer = createPrerenderer;
  64591. exports.createSystem = createSystem;
  64592. exports.createWorkerContext = createWorkerContext;
  64593. exports.createWorkerMessageHandler = createWorkerMessageHandler;
  64594. exports.dependencies = dependencies;
  64595. exports.loadConfig = loadConfig;
  64596. exports.nodeRequire = nodeRequire;
  64597. exports.optimizeCss = optimizeCss$1;
  64598. exports.optimizeJs = optimizeJs;
  64599. exports.path = path$5;
  64600. exports.transpile = transpile;
  64601. exports.transpileSync = transpileSync;
  64602. exports.ts = t;
  64603. exports.vermoji = vermoji;
  64604. exports.version = version$3;
  64605. exports.versions = versions;
  64606. if (typeof module !== 'undefined' && module.exports) {
  64607. module.exports = exports;
  64608. }
  64609. globalThis.stencil = exports;
  64610. })({});
  64611. //# sourceMappingURL=stencil.js.map